Jump to content

Zebrabanana

Members
  • Content count

    73
  • Joined

  • Last visited


Reputation Activity

  1. Like
    Zebrabanana reacted to Escaping in PayPal WPP Direct Payments & Express Checkout Support   
    Hi All,


    My installation of this contrib that had been working for over a year suddenly stopped working 2 days ago. Symptoms of this issue might vary between web hosts, but in my case, when pressing the button for Express Checkout the customer is directed to an error on PayPal (no code) that basically just states the operation failed. This is previous to any login attempt. PayPal techs informed me that variable names were being passed to PayPal rather than the data that was supposed to be contained. For example, the customer name would be something along the line of PAYPAL_NAME. Naturally, if the customer hasn't logged in yet, there is no data for these fields so the variable passed to PayPal should simply be null.


    The contrib has worked despite this issue for quite a while. I assume a recent change at PayPal might be the problem, but it may have been an update at my web host. I found a little omission in the logic in includes/modules/payment//paypal_wpp.php. Search for line if (MODULE_PAYMENT_PAYPAL_EC_ADDRESS_OVERRIDE == 'Store' && . Subsequent codes check for the data we're talking about, and if it is missing, sets the address override to "0". The omission was that variables are only set if override is "1", if override is "0", variables aren't set at all. I've just added a small bit to set the vars to null in that instance. For my install, that took care of the issue and actually fixed another problem I had just lived with for the last year or so.


    The address override in admin should be set to PayPal, not store. If you like store, well you're on your own. Otherwise, usual disclaimers apply as I'm not a programmer.


    Find:


    /* Don't override if the state is missing (Avoid 10729 errors) */
    if ($order_info['PAYPAL_ADDRESS_OVERRIDE'] == '1' && $order_info['PAYPAL_STATE'] == '') {
    $order_info['PAYPAL_ADDRESS_OVERRIDE'] = '0';
    $order_info['PAYPAL_NAME'] = '';
    $order_info['PAYPAL_ADDRESS1'] = '';
    $order_info['PAYPAL_ADDRESS2'] = '';
    $order_info['PAYPAL_CITY'] = '';
    $order_info['PAYPAL_STATE'] = '';
    $order_info['PAYPAL_ZIP'] = '';
    $order_info['PAYPAL_COUNTRY'] = '';
    }


    Insert immediately after:


     
     
    /* If Address Override == "0", send null vars to Paypal (was sending Var Names instead) */
    if ($order_info['PAYPAL_ADDRESS_OVERRIDE'] == '0') {
     
    $order_info['PAYPAL_NAME'] = '';
    $order_info['PAYPAL_ADDRESS1'] = '';
    $order_info['PAYPAL_ADDRESS2'] = '';
    $order_info['PAYPAL_CITY'] = '';
    $order_info['PAYPAL_STATE'] = '';
    $order_info['PAYPAL_ZIP'] = '';
    $order_info['PAYPAL_COUNTRY'] = '';
    }


    That's it. Hope it saves someone some time.


×