Skip to content

Commit

Permalink
Merge pull request #1280 from angelleye/PFW-357
Browse files Browse the repository at this point in the history
Braintree - 1.5.5 Update - Payment fails when user is logged in, PFW-357
  • Loading branch information
Drew Angell committed Feb 18, 2019
2 parents 8ebdfd7 + 7732cbf commit bda657c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions classes/wc-gateway-braintree-angelleye.php
Expand Up @@ -1047,6 +1047,8 @@ public function angelleye_do_payment($order) {
'email' => version_compare(WC_VERSION, '3.0', '<') ? $order->billing_email : $order->get_billing_email(),
);
}
} else {
$request_data['creditCard']['cardholderName'] = $order->get_formatted_billing_full_name();
}
$request_data['amount'] = number_format($order->get_total(), 2, '.', '');
$this->merchant_account_id = $this->angelleye_braintree_get_merchant_account_id($order_id);
Expand All @@ -1055,7 +1057,6 @@ public function angelleye_do_payment($order) {
}
$request_data['orderId'] = $order->get_order_number();
$request_data['options'] = $this->get_braintree_options();
$request_data['creditCard']['cardholderName'] = $order->get_formatted_billing_full_name();
$request_data['channel'] = 'AngellEYEPayPalforWoo_BT';
if (!empty($this->softdescriptor)) {
$request_data['descriptor'] = array('name' => $this->softdescriptor);
Expand Down Expand Up @@ -1777,7 +1778,7 @@ public function braintree_create_payment_method($braintree_customer_id, $zero_am
return false;
}
} catch (Exception $ex) {
$error = $this->get_braintree_exception_message($e);
$error = $this->get_braintree_exception_message($ex);
wc_add_notice($error, 'error');
if ($zero_amount_payment == false) {
wp_redirect(wc_get_account_endpoint_url('payment-methods'));
Expand Down Expand Up @@ -2025,7 +2026,6 @@ public function process_subscription_payment($order, $amount, $payment_token = n
}
$request_data['orderId'] = $order->get_order_number();
$request_data['options'] = $this->get_braintree_options();
$request_data['creditCard']['cardholderName'] = $order->get_formatted_billing_full_name();
$request_data['channel'] = 'AngellEYEPayPalforWoo_BT';
if ($this->debug) {
$this->add_log('Begin Braintree_Transaction::sale request');
Expand Down Expand Up @@ -2444,10 +2444,10 @@ public function braintree_create_payment_method_auth($braintree_customer_id, $or
$payment_method_nonce = $token->get_token();
$order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
update_post_meta($order_id, '_first_transaction_id', $payment_method_nonce);
$payment_order_meta = array('_transaction_id' => $payment_method_token, '_payment_action' => $this->payment_action);
$payment_order_meta = array('_transaction_id' => $payment_method_nonce, '_payment_action' => $this->payment_action);
AngellEYE_Utility::angelleye_add_order_meta($order_id, $payment_order_meta);
$order->update_status('on-hold', __('Authorization only transaction', 'paypal-for-woocommerce'));
$this->save_payment_token($order, $payment_method_token);
$this->save_payment_token($order, $payment_method_nonce);
return true;
} else {
$payment_method_nonce = self::get_posted_variable('braintree_token');
Expand All @@ -2462,7 +2462,6 @@ public function braintree_create_payment_method_auth($braintree_customer_id, $or
$payment_method_request = array('customerId' => $braintree_customer_id, 'paymentMethodNonce' => $payment_method_nonce);
$this->merchant_account_id = $this->angelleye_braintree_get_merchant_account_id();
$payment_method_request['options']['verifyCard'] = true;
$request_data['creditCard']['cardholderName'] = $order->get_formatted_billing_full_name();
if (isset($this->merchant_account_id) && !empty($this->merchant_account_id)) {
$payment_method_request['options']['verificationMerchantAccountId'] = $this->merchant_account_id;
}
Expand Down

0 comments on commit bda657c

Please sign in to comment.