Skip to content

Commit

Permalink
fixes #352
Browse files Browse the repository at this point in the history
  • Loading branch information
levansy2020 committed Nov 7, 2015
1 parent cff2310 commit 2ac6d9a
Showing 1 changed file with 42 additions and 6 deletions.
48 changes: 42 additions & 6 deletions classes/wc-gateway-paypal-pro-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,12 +731,48 @@ function do_payment($order, $card_number, $card_type, $card_exp_month, $card_exp
}
}

/**
* Shipping/tax/item amount
*/
$PaymentDetails['taxamt'] = $PaymentData['taxamt'];
$PaymentDetails['shippingamt'] = $PaymentData['shippingamt'];
$PaymentDetails['itemamt'] = $PaymentData['itemamt'];
//fix: itemamt = 0, make shipping or tax as order item
if ($PaymentData['itemamt'] == 0) {
$OrderItems = array();
if ($PaymentData['shippingamt']) {
$Item = array(
'l_name' => __( apply_filters('angelleye_paypal_pro_shipping_text', 'Shipping'), 'paypal-for-woocommerce' ), // Item Name. 127 char max.
'l_desc' => '', // Item description. 127 char max.
'l_amt' => $PaymentData['shippingamt'], // Cost of individual item.
'l_number' => '', // Item Number. 127 char max.
'l_qty' => 1, // Item quantity. Must be any positive integer.
'l_taxamt' => '', // Item's sales tax amount.
'l_ebayitemnumber' => '', // eBay auction number of item.
'l_ebayitemauctiontxnid' => '', // eBay transaction ID of purchased item.
'l_ebayitemorderid' => '' // eBay order ID for the item.
);
array_push($OrderItems, $Item);
}

if ($PaymentData['taxamt']) {
$Item = array(
'l_name' => __( apply_filters('angelleye_paypal_pro_tax_text', 'Tax'), 'paypal-for-woocommerce' ), // Item Name. 127 char max.
'l_desc' => '', // Item description. 127 char max.
'l_amt' => $PaymentData['taxamt'], // Cost of individual item.
'l_number' => '', // Item Number. 127 char max.
'l_qty' => 1, // Item quantity. Must be any positive integer.
'l_taxamt' => '', // Item's sales tax amount.
'l_ebayitemnumber' => '', // eBay auction number of item.
'l_ebayitemauctiontxnid' => '', // eBay transaction ID of purchased item.
'l_ebayitemorderid' => '' // eBay order ID for the item.
);
array_push($OrderItems, $Item);
}

$PaymentDetails['itemamt'] = number_format( $order->get_total(), 2, '.', '' );
} else {
/**
* Shipping/tax/item amount
*/
$PaymentDetails['taxamt'] = $PaymentData['taxamt'];
$PaymentDetails['shippingamt'] = $PaymentData['shippingamt'];
$PaymentDetails['itemamt'] = $PaymentData['itemamt'];
}

/**
* 3D Secure Params
Expand Down

0 comments on commit 2ac6d9a

Please sign in to comment.