diff --git a/classes/wc-gateway-braintree-angelleye.php b/classes/wc-gateway-braintree-angelleye.php index 61d325c29..66a232cae 100644 --- a/classes/wc-gateway-braintree-angelleye.php +++ b/classes/wc-gateway-braintree-angelleye.php @@ -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); @@ -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); @@ -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')); @@ -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'); @@ -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'); @@ -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; }