Skip to content

Commit

Permalink
WooCommerce Sequential Orders Compatibility, ref #145
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed Mar 4, 2017
1 parent 61bb7f3 commit 7f758d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public function angelleye_do_express_checkout_payment_request() {
try {
if (!empty($this->confirm_order_id)) {
$order = new WC_Order($this->confirm_order_id);
$invoice_number = preg_replace("/[^a-zA-Z0-9]/", "", $order->get_order_number());
if ($order->customer_note) {
$customer_notes = wptexturize($order->customer_note);
}
Expand All @@ -200,7 +199,7 @@ public function angelleye_do_express_checkout_payment_request() {
'handlingamt' => '',
'desc' => '',
'custom' => '',
'invnum' => $this->gateway->invoice_id_prefix . $invoice_number,
'invnum' => $this->gateway->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", str_replace("#","",$order->get_order_number())),
'notetext' => !empty($customer_notes) ? $customer_notes : '',
'allowedpaymentmethod' => '',
'paymentaction' => $this->gateway->payment_action,
Expand Down Expand Up @@ -735,17 +734,11 @@ public function DoReferenceTransaction($order_id) {
wp_redirect(get_permalink(wc_get_page_id('cart')));
}

if (!empty($order_id)) {
$order = new WC_Order($order_id);
$invoice_number = preg_replace("/[^a-zA-Z0-9]/", "", $order->get_order_number());
if ($order->customer_note) {
if ($order->customer_note) {
$customer_notes = wptexturize($order->customer_note);
} else {
$customer_notes = '';
}
} else {
$invoice_number = $order->id;
}
$DRTFields = array(
'referenceid' => $token->get_token(),
'paymentaction' => !empty($this->gateway->payment_action) ? $this->gateway->payment_action : 'Sale',
Expand All @@ -765,7 +758,11 @@ public function DoReferenceTransaction($order_id) {
'insuranceoptionoffered' => '', // If true, the insurance drop-down on the PayPal review page displays Yes and shows the amount.
'desc' => '', // Description of items on the order. 127 char max.
'custom' => '', // Free-form field for your own use. 256 char max.
'invnum' => $this->gateway->invoice_id_prefix . $invoice_number, // Your own invoice or tracking number. 127 char max.
'invnum' => $this->gateway->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", str_replace("#","",$order->get_order_number())), // Your own invoice or tracking number. 127 char max.




'buttonsource' => '' // URL for receiving Instant Payment Notifications
);
if (isset($this->gateway->notifyurl) && !empty($this->gateway->notifyurl)) {
Expand Down
4 changes: 2 additions & 2 deletions classes/wc-gateway-paypal-advanced-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ function get_secure_token($order) {
'TRXTYPE' => $this->transtype,
'CUSTREF' => $order->get_order_number(),
'USER1' => $order->id,
'INVNUM' => $this->invoice_prefix . ltrim($order->get_order_number(), '#'),
'INVNUM' => $this->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", str_replace("#","",$order->get_order_number())),
'AMT' => number_format($order->get_total(), 2, '.', ''),
'FREIGHTAMT' => '',
'COMPANYNAME[' . strlen($order->billing_company) . ']' => $order->billing_company,
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public function create_reference_transaction($token, $order) {
'TRXTYPE' => $this->transtype,
'CUSTREF' => $order->get_order_number(),
'USER1' => $order->id,
'INVNUM' => $this->invoice_prefix . ltrim($order->get_order_number(), '#'),
'INVNUM' => $this->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", str_replace("#","",$order->get_order_number())),
'AMT' => number_format($order->get_total(), 2, '.', ''),
'FREIGHTAMT' => '',
'COMPANYNAME[' . strlen($order->billing_company) . ']' => $order->billing_company,
Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-paypal-pro-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ function do_payment($order, $card_number, $card_type, $card_exp_month, $card_exp
'handlingamt' => '0.00', // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt.
'desc' => '', // Description of the order the customer is purchasing. 127 char max.
'custom' => apply_filters( 'ae_ppddp_custom_parameter', $customer_note , $order ), // Free-form field for your own use. 256 char max.
'invnum' => $invoice_number = $this->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", $order->id), // Your own invoice or tracking number
'invnum' => $this->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", str_replace("#","",$order->get_order_number())), // Your own invoice or tracking number
'recurring' => '' // Flag to indicate a recurring transaction. Value should be Y for recurring, or anything other than Y if it's not recurring. To pass Y here, you must have an established billing agreement with the buyer.
);

Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-paypal-pro-payflow-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ function do_payment( $order, $card_number, $card_exp, $card_csc, $centinelPAResS
'custref'=>'', //
'custcode'=>'', //
'custip'=>$this->get_user_ip(), //
'invnum'=>$this->invoice_id_prefix . str_replace("#","",$order->get_order_number()), //
'invnum'=> $this->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", str_replace("#","",$order->get_order_number())), //
'ponum'=>'', //
'starttime'=>'', // For inquiry transaction when using CUSTREF to specify the transaction.
'endtime'=>'', // For inquiry transaction when using CUSTREF to specify the transaction.
Expand Down

0 comments on commit 7f758d0

Please sign in to comment.