v1.5.5f php 7.1 OPC v2.3.4

Hello Cindy,

I have been getting PayPal error code 10730 'Shipping Address Postal Code Empty - The field Shipping Address Postal Code is required'... only when checking out as a Guest and electing to pay via PayPal. There are no other issues with checkout and OPC, just this.

I have applied the patch you posted here (https://www.zen-cart.com/showthread....72#post1374172) however it is not working for me. (ever the pessimist I figure it may be a v155F quirk (???) )

I am not getting an OPC debug report but am getting PayPal CURL debugs (see example below)

Code:
2020-11-13 01:02:51
-------------------
(live transaction) --> https://api-3t.paypal.com/nvp
Request Headers: 
Array
(
    [0] => Content-Type: text/namevalue
    [1] => X-VPS-Timeout: 90
    [2] => X-VPS-VIT-Client-Type: PHP/cURL
    [3] => X-VPS-VIT-Integration-Product: PHP::Zen Cart(R) - PayPal/NVP
    [4] => X-VPS-VIT-Integration-Version: 1.5.5
)


Request Parameters: {DoExpressCheckoutPayment} 
Array
(
    [PAYMENTREQUEST_0_AMT] => 17.46
    [PAYMENTREQUEST_0_ITEMAMT] => 12.56
    [PAYMENTREQUEST_0_SHIPPINGAMT] => 4.9
    [L_PAYMENTREQUEST_0_NUMBER0] => ClipOn_433
    [L_PAYMENTREQUEST_0_NAME0] => Silver Clip On Earrings, Fashion Earrings, Turkish Influence [212]
    [L_PAYMENTREQUEST_0_QTY0] => 1
    [L_PAYMENTREQUEST_0_AMT0] => 12.56
    [PAYMENTREQUEST_0_SHIPTONAME] => Guest Customer, **do not remove**
    [PAYMENTREQUEST_0_SHIPTOSTREET] => Default billing address
    [PAYMENTREQUEST_0_SHIPTOCITY] => 
    [PAYMENTREQUEST_0_SHIPTOSTATE] => SA
    [PAYMENTREQUEST_0_SHIPTOZIP] => 
    [PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE] => AU
    [BUTTONSOURCE] => ZenCart-EC_us
    [ADDROVERRIDE] => 1
    [RETURNFMFDETAILS] => 0
    [PAYMENTREQUEST_0_CUSTOM] => EC-33-1605232971
    [PAYMENTREQUEST_0_INVNUM] => 33-1605232971-[DazzlersClipOnEarrings]
    [PAYMENTREQUEST_0_CURRENCYCODE] => AUD
    [TOKEN] => EC-45W88961NA283840S
    [PAYERID] => DFX4AE5BAT5QU
    [PAYMENTREQUEST_0_PAYMENTACTION] => Sale
    [NOTIFYURL] => https://www.dazzlerscliponearrings.com.au/ipn_main_handler.php
    [METHOD] => DoExpressCheckoutPayment
    [USER] => dazzlers2009_api1.hotmail.com
    [PWD] => ****************
    [VERSION] => 124.0
    [SIGNATURE] => ****************************************************SLns
)


Response: 
Array
(
    [TOKEN] => EC-45W88961NA283840S
    [SUCCESSPAGEREDIRECTREQUESTED] => false
    [TIMESTAMP] => 2020-11-13T02:02:51Z
    [CORRELATIONID] => 1ebb03776eb0d
    [ACK] => Failure
    [VERSION] => 124.0
    [BUILD] => 55058010
    [L_ERRORCODE0] => 10730
    [L_SHORTMESSAGE0] => Shipping Address Postal Code Empty
    [L_LONGMESSAGE0] => The field Shipping Address Postal Code is required
    [L_SEVERITYCODE0] => Error
    [CURL_ERRORS] => 
)


DoExpressCheckoutPayment, Elapsed: 387ms -- Failure

TOKEN=EC%2d45W88961NA283840S&SUCCESSPAGEREDIRECTREQUESTED=false&TIMESTAMP=2020%2d11%2d13T02%3a02%3a51Z&CORRELATIONID=1ebb03776eb0d&ACK=Failure&VERSION=124%2e0&BUILD=55058010&L_ERRORCODE0=10730&L_SHORTMESSAGE0=Shipping%20Address%20Postal%20Code%20Empty&L_LONGMESSAGE0=The%20field%20Shipping%20Address%20Postal%20Code%20is%20required&L_SEVERITYCODE0=Error&CURL_ERRORS=
This is a copy of the segment of my includes/modules/payment/paypalwpp.php (hopefully the patch is inserted correctly)
Code:
/**
   * Get Override Address (uses sendto if set, otherwise uses customer's primary address)
   */
  function getOverrideAddress() {
    global $db;

    // Only proceed IF *in* markflow mode AND logged-in (have to be logged in to get to markflow mode anyway)
    if (!empty($_GET['markflow']) && isset($_SESSION['customer_id']) && $_SESSION['customer_id']) {
      // From now on for this user we will edit addresses in Zen Cart, not by going to PayPal.
      $_SESSION['paypal_ec_markflow'] = 1;


      // debug
      $this->zcLog('getOverrideAddress - 1', 'Now in markflow mode.' . "\n" . 'SESSION[sendto] = ' . (int)$_SESSION['sendto']);


      // find the users default address id
      if (!empty($_SESSION['sendto'])) {
        $address_id = $_SESSION['sendto'];
      } else {
        $sql = "SELECT customers_default_address_id
                FROM " . TABLE_CUSTOMERS . "
                WHERE customers_id = :customerId";
        $sql = $db->bindVars($sql, ':customerId', $_SESSION['customer_id'], 'integer');
        $default_address_id_arr = $db->Execute($sql);
        if (!$default_address_id_arr->EOF) {
          $address_id = $default_address_id_arr->fields['customers_default_address_id'];
        } else {
          // couldn't find an address.
          return false;
        }
      }
	  
	  // -----
      // Give a watching observer the opportunity to bypass this address-override.  An observer
      // can disable the address-override processing by setting the $disable_address_override
      // parameter to specifically (bool)true.
      //
      $disable_address_override = false;
      $this->notify('NOTIFY_PAYPALWPP_DISABLE_GET_OVERRIDE_ADDRESS', $address_id, $disable_address_override);
      if ($disable_address_override === true) {
        $this->zcLog('getOverrideAddress - 1a', "Override disabled by observer request.\n");
        return false;
      }
cheers,
Mike