Skip to content

Commit

Permalink
Braintree - Failed Order Notes, ref #647
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed Apr 25, 2017
1 parent 531e86d commit c5d3cca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions classes/wc-gateway-braintree-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,33 +614,40 @@ public function angelleye_do_payment($order) {
} catch (Braintree_Exception_Authentication $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_Transaction::sale Braintree_Exception_Authentication: API keys are incorrect, Please double-check that you haven't accidentally tried to use your sandbox keys in production or vice-versa.");
$order->add_order_note("Braintree_Transaction::sale Braintree_Exception_Authentication: API keys are incorrect, Please double-check that you haven't accidentally tried to use your sandbox keys in production or vice-versa.");
return $success = false;
} catch (Braintree_Exception_Authorization $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_Transaction::sale Braintree_Exception_Authorization: The API key that you're using is not authorized to perform the attempted action according to the role assigned to the user who owns the API key.");
$order->add_order_note("Braintree_Transaction::sale Braintree_Exception_Authorization: The API key that you're using is not authorized to perform the attempted action according to the role assigned to the user who owns the API key.");
return $success = false;
} catch (Braintree_Exception_DownForMaintenance $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_Transaction::sale Braintree_Exception_DownForMaintenance: Request times out.");
$order->add_order_note("Braintree_Transaction::sale Braintree_Exception_DownForMaintenance: Request times out.");
return $success = false;
} catch (Braintree_Exception_ServerError $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_Transaction::sale Braintree_Exception_ServerError " . $e->getMessage());
$order->add_order_note("Braintree_Transaction::sale Braintree_Exception_ServerError " . $e->getMessage());
return $success = false;
} catch (Braintree_Exception_SSLCertificate $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_Transaction::sale Braintree_Exception_SSLCertificate " . $e->getMessage());
$order->add_order_note("Braintree_Transaction::sale Braintree_Exception_SSLCertificate " . $e->getMessage());
return $success = false;
} catch (Exception $e) {
wc_add_notice(__('Error: PayPal Powered by Braintree was unable to complete the transaction. Please try again later or use another means of payment.', 'paypal-for-woocommerce'), 'error');
$this->add_log('Error: Unable to complete transaction. Reason: ' . $e->getMessage());
$order->add_order_note("Error: Unable to complete transaction. Reason: " . $e->getMessage());
return $success = false;
}

if (!$this->response->success) {
$notice = sprintf(__('Error: PayPal Powered by Braintree was unable to complete the transaction. Please try again later or use another means of payment. Reason: %s', 'paypal-for-woocommerce'), $this->response->message);
wc_add_notice($notice, 'error');
$this->add_log("Error: Unable to complete transaction. Reason: {$this->response->message}");
$order->add_order_note("Error: Unable to complete transaction. Reason: {$this->response->message}");
return $success = false;
}

Expand Down

0 comments on commit c5d3cca

Please sign in to comment.