Skip to content

Commit

Permalink
Merge pull request #1329 from Gator92/check_duplicate_ppe
Browse files Browse the repository at this point in the history
check for duplicate order upon paypal express return
  • Loading branch information
kcppdevelopers committed Jul 10, 2019
2 parents efdb454 + fa222f0 commit 97b914e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -1608,8 +1608,14 @@ public function process_payment($order_id) {
if (!empty($_POST['wc-paypal_express-payment-token']) && $_POST['wc-paypal_express-payment-token'] != 'new') {
$result = $this->angelleye_ex_doreference_transaction($order_id);
if (!empty($result['ACK']) && $result['ACK'] == 'Success' || $result['ACK'] == 'SuccessWithWarning') {
$order->payment_complete($result['TRANSACTIONID']);
$order->add_order_note(sprintf(__('%s payment approved! Transaction ID: %s', 'paypal-for-woocommerce'), $this->title, $result['TRANSACTIONID']));
// @note Skylar L check for duplicate order
if ($result['ACK'] == 'SuccessWithWarning' && !empty($result['L_ERRORCODE0']) && '11607' == $result['L_ERRORCODE0']) {
$order->update_status('on-hold', empty($result['L_LONGMESSAGE0']) ? $result['L_SHORTMESSAGE0'] : $result['L_LONGMESSAGE0']);
}
else {
$order->payment_complete($result['TRANSACTIONID']);
$order->add_order_note(sprintf(__('%s payment approved! Transaction ID: %s', 'paypal-for-woocommerce'), $this->title, $result['TRANSACTIONID']));
}
WC()->cart->empty_cart();
return array(
'result' => 'success',
Expand Down

0 comments on commit 97b914e

Please sign in to comment.