Skip to content

Commit

Permalink
WooCommerce update breaks Proceed to Checkout button if our plugin is…
Browse files Browse the repository at this point in the history
… installed, ref #899
  • Loading branch information
kcppdevelopers committed Oct 12, 2017
1 parent e512e5e commit 41fda29
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function angelleye_ec_pp_pf_reference_transaction($order) {
AngellEYE_Utility::angelleye_paypal_for_woocommerce_add_paypal_transaction($result, $order, $this->gateway_settings['payment_action']);
$order->payment_complete($result['TRANSACTIONID']);
update_post_meta($order_id, '_first_transaction_id', $result['TRANSACTIONID']);
$order->add_order_note(sprintf(__('%s payment approved! Transaction ID: %s', 'paypal-for-woocommerce'), $this->payment_method, $result['TRANSACTIONID']));
$order->add_order_note(sprintf(__('%s payment Transaction ID: %s', 'paypal-for-woocommerce'), $this->payment_method, $result['TRANSACTIONID']));
} else {
if (!empty($result['L_ERRORCODE0'])) {
$ErrorCode = urldecode($result['L_ERRORCODE0']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,6 @@ public function mini_cart_button() {
}

public function woocommerce_paypal_express_checkout_button_angelleye($return = false, $possition = null) {
if (!defined('WOOCOMMERCE_CHECKOUT')) {
define('WOOCOMMERCE_CHECKOUT', true);
}
if (!defined('WOOCOMMERCE_CART')) {
define('WOOCOMMERCE_CART', true);
}
Expand Down Expand Up @@ -553,9 +550,6 @@ public function woocommerce_paypal_express_checkout_button_angelleye($return = f
}

public function checkout_message() {
if (!defined('WOOCOMMERCE_CHECKOUT')) {
define('WOOCOMMERCE_CHECKOUT', true);
}
if (!defined('WOOCOMMERCE_CART')) {
define('WOOCOMMERCE_CART', true);
}
Expand Down Expand Up @@ -641,9 +635,6 @@ public function angelleye_ship_to_different_address_checked($bool) {
}

public function woocommerce_before_cart() {
if (!defined('WOOCOMMERCE_CHECKOUT')) {
define('WOOCOMMERCE_CHECKOUT', true);
}
if (!defined('WOOCOMMERCE_CART')) {
define('WOOCOMMERCE_CART', true);
}
Expand Down Expand Up @@ -741,9 +732,6 @@ public function angelleye_ajax_generate_cart() {
if ( ! defined( 'WOOCOMMERCE_CART' ) ) {
define( 'WOOCOMMERCE_CART', true );
}
if (!defined('WOOCOMMERCE_CHECKOUT')) {
define('WOOCOMMERCE_CHECKOUT', true);
}
WC()->shipping->reset_shipping();
if ( is_product() ) {
$product = wc_get_product( $post->ID );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public function angelleye_do_express_checkout_payment() {
update_post_meta($order->get_id(), '_express_chekout_transactionid', isset($this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']) ? $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID'] : '' );
update_post_meta($order->get_id(), 'paypal_email', $payeremail);
}
$order->add_order_note(sprintf(__('%s payment approved! Transaction ID: %s', 'paypal-for-woocommerce'), $this->gateway->title, isset($this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']) ? $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID'] : ''));
$order->add_order_note(sprintf(__('%s payment Transaction ID: %s', 'paypal-for-woocommerce'), $this->gateway->title, isset($this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']) ? $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID'] : ''));
WC()->cart->empty_cart();
wc_clear_notices();
wp_redirect(add_query_arg( 'utm_nooverride', '1', $this->gateway->get_return_url($order) ));
Expand Down Expand Up @@ -303,7 +303,7 @@ public function angelleye_do_express_checkout_payment() {
update_post_meta($order->get_id(), '_express_chekout_transactionid', isset($this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']) ? $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID'] : '' );
}

$order->add_order_note(sprintf(__('%s payment approved! Transaction ID: %s', 'paypal-for-woocommerce'), $this->gateway->title, $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']));
$order->add_order_note(sprintf(__('%s payment Transaction ID: %s', 'paypal-for-woocommerce'), $this->gateway->title, $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']));

WC()->cart->empty_cart();
wc_clear_notices();
Expand Down Expand Up @@ -450,9 +450,9 @@ public function angelleye_load_paypal_class($gateway, $current, $order_id = null
public function angelleye_set_express_checkout_request() {
try {
$Payments = array();
$cancel_url = !empty($this->gateway->cancel_page_id) ? get_permalink($this->gateway->cancel_page_id) : WC()->cart->get_cart_url();
$cancel_url = !empty($this->gateway->cancel_page_id) ? get_permalink($this->gateway->cancel_page_id) : wc_get_cart_url();
if($cancel_url == false) {
$cancel_url = WC()->cart->get_cart_url();
$cancel_url = wc_get_cart_url();
}
$order_total = '';
$returnurl = urldecode(add_query_arg('pp_action', 'get_express_checkout_details', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')));
Expand Down Expand Up @@ -737,7 +737,7 @@ public function update_payment_status_by_paypal_responce($orderid, $result) {
$order->payment_complete($transaction_id);
break;
case 'pending' :
if (!in_array(strtolower($transaction_type), array('merchtpmt', 'cart', 'instant', 'express_checkout', 'web_accept', 'masspay', 'send_money'))) {
if (!in_array(strtolower($transaction_type), array('merchtpmt', 'cart', 'instant', 'express_checkout', 'web_accept', 'masspay', 'send_money', 'expresscheckout'))) {
break;
}
switch (strtolower($pending_reason)) {
Expand Down
14 changes: 7 additions & 7 deletions classes/wc-gateway-braintree-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,27 +407,27 @@ public function payment_fields() {
} catch (Braintree_Exception_Authentication $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_ClientToken::generate Exception: API keys are incorrect, Please double-check that you haven't accidentally tried to use your sandbox keys in production or vice-versa.");
wp_redirect($woocommerce->cart->get_cart_url());
wp_redirect(wc_get_cart_url());
exit;
} catch (Braintree_Exception_Authorization $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_ClientToken::generate Exception: 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.");
wp_redirect($woocommerce->cart->get_cart_url());
wp_redirect(wc_get_cart_url());
exit;
} catch (Braintree_Exception_DownForMaintenance $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_ClientToken::generate Exception: Request times out.");
wp_redirect($woocommerce->cart->get_cart_url());
wp_redirect(wc_get_cart_url());
exit;
} catch (Braintree_Exception_ServerError $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_ClientToken::generate Braintree_Exception_ServerError" . $e->getMessage());
wp_redirect($woocommerce->cart->get_cart_url());
wp_redirect(wc_get_cart_url());
exit;
} catch (Braintree_Exception_SSLCertificate $e) {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_ClientToken::generate Braintree_Exception_SSLCertificate" . $e->getMessage());
wp_redirect($woocommerce->cart->get_cart_url());
wp_redirect(wc_get_cart_url());
exit;
} catch (InvalidArgumentException $e) {
if ($e->getMessage() == 'Customer specified by customer_id does not exist') {
Expand All @@ -439,13 +439,13 @@ public function payment_fields() {
} else {
wc_add_notice(__("Error processing checkout. Please try again. ", 'paypal-for-woocommerce'), 'error');
$this->add_log("Braintree_ClientToken::generate Braintree_Exception_NotFound" . $e->getMessage());
wp_redirect($woocommerce->cart->get_cart_url());
wp_redirect(wc_get_cart_url());
exit;
}
} catch (Exception $ex) {

$this->add_log("Braintree_ClientToken::generate Exception:" . $ex->getMessage());
wp_redirect($woocommerce->cart->get_cart_url());
wp_redirect(wc_get_cart_url());
exit;
}
?>
Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ public function handle_wc_api() {
switch ($_GET['pp_action']) {
case 'cancel_order':
$this->function_helper->ec_clear_session_data();
$cancel_url = !empty($this->cancel_page_id) ? get_permalink($this->cancel_page_id) : WC()->cart->get_cart_url();
$cancel_url = !empty($this->cancel_page_id) ? get_permalink($this->cancel_page_id) : wc_get_cart_url();
wp_safe_redirect( $cancel_url );
exit;
case 'set_express_checkout':
Expand Down

0 comments on commit 41fda29

Please sign in to comment.