From #1864842-7: Add support for PayPal Express Checkout:

For the "Mark" flow, we need to improve our address options. SetExpressCheckout lets us pass in known addresses and also lets us tell PayPal whether or not to show things like shipping address prompts or to default them to the address we pass in instead of the address on file. We should take advantage of these options found at https://www.x.com/developers/paypal/documentation-tools/api/setexpressch....

Specifically, I'm talking about the NOSHIPPING and ADDROVERRIDE parameters and passing the shipping address in via the PAYMENTREQUEST_0_SHIPTO* parameters. Obviously this should only happen if the site actually collects shipping addresses and the order in question has one. For NOSHIPPING and ADDROVERRIDE we should add payment method settings letting the merchant toggle these features, but we should still allow for sites where some orders require shipping information and some don't.

Also, to reiterate, the "Mark" flow is the one where the customer has already filled out the checkout form on the Drupal Commerce site but then opted to pay via Express Checkout from the payment methods selection list. We'd only want to submit these parameters if
$order->data['commerce_paypal_ec']['flow'] == 'mark'.

Comments

rszrama’s picture

Issue summary: View changes

Improving formatting with a line break.

JulienD’s picture

StatusFileSize
new115.15 KB

Hey

I provided settings on the payment method to allow the merchant toggle these features. Maybe some wording have to be changed and more precision have to be add (see the attached screenshot).

Currently I'm not able to submit these parameters only if the customer used the 'mark' mode, because I don't have the information in the commerce_paypal_ec_set_express_checkout() function. This function is used to generate a token and if it's a valid token, we fill out the $order->data['commerce_paypal_ec'] array (see the code below). The solution would be to pass the mark information to the commerce_paypal_ec_set_express_checkout() ?

  // Request a token from Express Checkout.
  $token = commerce_paypal_ec_set_express_checkout($payment_method, $order);
  watchdog('commerce_paypal_ec', 'set => ' . __FUNCTION__);

  // If we got one back...
  if (!empty($token)) {
    // Set the Express Checkout data array.
    $order->data['commerce_paypal_ec'] = array(
      'flow' => 'ec',
      'token' => $token,
      'payerid' => FALSE,
    );
    ...
rszrama’s picture

Status: Active » Fixed

Great, thanks for the patch. Looking through it, I began to realize that we could simplify how we set the parameters by basing our checks around whether or not the Shipping module actually existed on the site. If it doesn't, we simply won't prompt for shipping at all. If it does and there's an address, we pass that in and let the admin determine whether or not we should allow the address to be changed at PayPal (turns out the parameters were inconsistent with the documentation, btw). If it does and there's no address, then we ask for one unless the administrator has said not to do so at all.

Commit: http://drupalcode.org/project/commerce_paypal.git/commitdiff/14c780c

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Fixing a tag.