Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Braintree - 1.5.5 Update - Payment fails when user is logged in, PFW-357 #1280

Merged
merged 2 commits into from
Feb 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions classes/wc-gateway-braintree-angelleye.php
Original file line number Diff line number Diff line change
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