angelleye / paypal-for-woocommerce-multi-account-management

GNU General Public License v3.0
0 stars 0 forks source link

Re-arrange multi-transaction orders so that commission is last. #83

Open drewangell opened 3 years ago

drewangell commented 3 years ago

Details

Currently, the order of transactions included in our request to PayPal is putting the commission amount (the smaller amount) first. This makes it show up above the actual product/service payment on PayPal and Woo receipts.

We need to re-arrange this so that the commission payment is always last. That way it will display the actual products/services and their amounts, with the commission coming at the bottom.

Sample of Current Request

Notice in the sample that PAYMENTREQUEST_0 is the commission amount of 2.34 while PAYMENTREQUEST_1 is the actual product amount. This should be reversed.

The commission should always come last no matter how many payments are included on the order.

2021-03-03T17:21:36+00:00 INFO DoExpressCheckoutPayment Request: Array
(
    [USER] => *****
    [PWD] => *****
    [VERSION] => 124.0
    [SIGNATURE] => *****
    [METHOD] => DoExpressCheckoutPayment
    [TOKEN] => EC-3D4146463Y3536014
    [PAYERID] => *****
    [RETURNFMFDETAILS] => 1
    [PAYMENTREQUEST_0_AMT] => 2.34
    [PAYMENTREQUEST_0_CURRENCYCODE] => GBP
    [PAYMENTREQUEST_0_CUSTOM] => {"order_id":211077,"order_key":"wc_order_oQuDHpBnlP40O","order_item_id":148}
    [PAYMENTREQUEST_0_INVNUM] => SA-211077-148
    [PAYMENTREQUEST_0_PAYMENTACTION] => Sale
    [PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID] => *****
    [PAYMENTREQUEST_0_PAYMENTREQUESTID] => 148-2091053544
    [PAYMENTREQUEST_0_ITEMAMT] => 2.34
    [PAYMENTREQUEST_0_SHIPPINGAMT] => 0.00
    [PAYMENTREQUEST_0_TAXAMT] => 0.00
    [L_PAYMENTREQUEST_0_NAME0] => Operation Template - Side A
    [L_PAYMENTREQUEST_0_AMT0] => 2.34
    [L_PAYMENTREQUEST_0_QTY0] => 1
    [PAYMENTREQUEST_1_AMT] => 46.65
    [PAYMENTREQUEST_1_CURRENCYCODE] => GBP
    [PAYMENTREQUEST_1_CUSTOM] => {"order_id":211077,"order_key":"wc_order_oQuDHpBnlP40O"}
    [PAYMENTREQUEST_1_INVNUM] => SA-211077-fees
    [PAYMENTREQUEST_1_PAYMENTACTION] => Sale
    [PAYMENTREQUEST_1_SELLERPAYPALACCOUNTID] => *****
    [PAYMENTREQUEST_1_PAYMENTREQUESTID] => 1405205022603fc599319e14.67905980
)