Changeset 2540675
- Timestamp:
- 06/01/2021 12:01:56 PM (5 years ago)
- Location:
- woocommerce-gateway-eway
- Files:
-
- 10 edited
- 1 copied
-
tags/3.2.2 (copied) (copied from woocommerce-gateway-eway/trunk)
-
tags/3.2.2/changelog.txt (modified) (1 diff)
-
tags/3.2.2/includes/class-wc-gateway-eway-subscriptions.php (modified) (1 diff)
-
tags/3.2.2/includes/class-wc-gateway-eway.php (modified) (1 diff)
-
tags/3.2.2/readme.txt (modified) (2 diffs)
-
tags/3.2.2/woocommerce-gateway-eway.php (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/class-wc-gateway-eway-subscriptions.php (modified) (1 diff)
-
trunk/includes/class-wc-gateway-eway.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woocommerce-gateway-eway.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-gateway-eway/tags/3.2.2/changelog.txt
r2533058 r2540675 1 1 *** WooCommerce eWAY Gateway Changelog *** 2 3 = 3.2.2 - 2021-06-01 = 4 * Fix - Fatal error when updating payment for all subscriptions. 2 5 3 6 = 3.2.1 - 2021-05-17 = -
woocommerce-gateway-eway/tags/3.2.2/includes/class-wc-gateway-eway-subscriptions.php
r2277835 r2540675 26 26 add_filter( 'woocommerce_subscription_validate_payment_meta', array( $this, 'validate_subscription_payment_meta' ), 10, 2 ); 27 27 28 // Don't update payment methods immediately when changing payment for subscriptions to eWay - wait until we get payment token. 29 add_filter( 'woocommerce_subscriptions_update_payment_via_pay_shortcode', array( $this, 'maybe_update_payment_method' ), 10, 3 ); 30 31 add_action( 'woocommerce_api_wc_gateway_eway_payment_completed', array( $this, 'maybe_update_all_subscriptions_payment' ), 10, 3 ); 32 } 33 34 /** 35 * Maybe update payment method of all subscriptions. 36 * 37 * @param WC_Order $order The order whose payment failed. 38 * @param stdClass $result The result from the API call. 39 * @param WC_Gateway_EWAY $gateway The instance of the gateway. 40 */ 41 public function maybe_update_all_subscriptions_payment( $order, $result, $gateway ) { 42 if ( $this->id !== $gateway->id ) { 43 return; 44 } 45 46 if ( ! wcs_is_subscription( $order ) ) { 47 return; 48 } 49 50 if ( ! WC_Subscriptions_Change_Payment_Gateway::will_subscription_update_all_payment_methods( $order ) ) { 51 return; 52 } 53 54 switch ( $result->ResponseMessage ) { 55 case 'A2000': 56 case 'A2008': 57 case 'A2010': 58 case 'A2011': 59 case 'A2016': 60 if ( empty( $result->TokenCustomerID ) ) { 61 return; 62 } 63 WC_Subscriptions_Change_Payment_Gateway::update_all_payment_methods_from_subscription( $order, $gateway->id ); 64 break; 65 } 66 } 67 68 /** 69 * Updates payment method if necessary. 70 * 71 * When changing payment to eWay for subscriptions it doesn't update payment methods immediately but waits until payment token available. 72 * 73 * @param bool $update 74 * @param string $new_payment_method 75 * @param WC_Subscription $subscription 76 * @return bool 77 */ 78 public function maybe_update_payment_method( $update, $new_payment_method, $subscription ) { 79 if ( empty( $_POST['update_all_subscriptions_payment_method'] ) ) { 80 return $update; 81 } 82 83 if ( $this->id !== $new_payment_method ) { 84 return $update; 85 } 86 87 /* 88 * So that 'pay for order' page shows the credit card form, the order whose 89 * payment method is to be changed needs to have payment method = eway. 90 * That's why, when payment method is not eway, we want to update it immediately. 91 * Hence, return $update here. 92 */ 93 if ( $this->id !== $subscription->get_payment_method() ) { 94 return $update; 95 } 96 97 $is_new_card = ! isset( $_POST['eway_card_id'] ) || 'new' === $_POST['eway_card_id']; 98 if ( ! $is_new_card ) { 99 return $update; 100 } 101 102 // Don't update payment methods immediately when changing payment for subscriptions to eWay - wait until we get payment token. 103 return false; 28 104 } 29 105 -
woocommerce-gateway-eway/tags/3.2.2/includes/class-wc-gateway-eway.php
r2531558 r2540675 38 38 'subscription_payment_method_change_admin', 39 39 'multiple_subscriptions', 40 'subscription_payment_method_delayed_change', 40 41 ); 41 42 -
woocommerce-gateway-eway/tags/3.2.2/readme.txt
r2533058 r2540675 4 4 Requires at least: 4.4 5 5 Tested up to: 5.7 6 Stable tag: 3.2. 16 Stable tag: 3.2.2 7 7 Requires PHP: 5.6 8 8 License: GPLv3 … … 84 84 == Changelog == 85 85 86 = 3.2.2 - 2021-06-01 = 87 * Fix - Fatal error when updating payment for all subscriptions. 88 86 89 = 3.2.1 - 2021-05-17 = 87 90 * Fix - Fatal error when PHP version is older than 7.3. -
woocommerce-gateway-eway/tags/3.2.2/woocommerce-gateway-eway.php
r2533058 r2540675 6 6 * Author: WooCommerce 7 7 * Author URI: https://woocommerce.com/ 8 * Version: 3.2. 18 * Version: 3.2.2 9 9 * Text Domain: wc-eway 10 10 * Domain Path: /languages … … 22 22 } 23 23 24 define( 'WOOCOMMERCE_GATEWAY_EWAY_VERSION', '3.2. 1' ); // WRCS: DEFINED_VERSION.24 define( 'WOOCOMMERCE_GATEWAY_EWAY_VERSION', '3.2.2' ); // WRCS: DEFINED_VERSION. 25 25 define( 'WOOCOMMERCE_GATEWAY_EWAY_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); 26 26 define( 'WOOCOMMERCE_GATEWAY_EWAY_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); -
woocommerce-gateway-eway/trunk/changelog.txt
r2533058 r2540675 1 1 *** WooCommerce eWAY Gateway Changelog *** 2 3 = 3.2.2 - 2021-06-01 = 4 * Fix - Fatal error when updating payment for all subscriptions. 2 5 3 6 = 3.2.1 - 2021-05-17 = -
woocommerce-gateway-eway/trunk/includes/class-wc-gateway-eway-subscriptions.php
r2277835 r2540675 26 26 add_filter( 'woocommerce_subscription_validate_payment_meta', array( $this, 'validate_subscription_payment_meta' ), 10, 2 ); 27 27 28 // Don't update payment methods immediately when changing payment for subscriptions to eWay - wait until we get payment token. 29 add_filter( 'woocommerce_subscriptions_update_payment_via_pay_shortcode', array( $this, 'maybe_update_payment_method' ), 10, 3 ); 30 31 add_action( 'woocommerce_api_wc_gateway_eway_payment_completed', array( $this, 'maybe_update_all_subscriptions_payment' ), 10, 3 ); 32 } 33 34 /** 35 * Maybe update payment method of all subscriptions. 36 * 37 * @param WC_Order $order The order whose payment failed. 38 * @param stdClass $result The result from the API call. 39 * @param WC_Gateway_EWAY $gateway The instance of the gateway. 40 */ 41 public function maybe_update_all_subscriptions_payment( $order, $result, $gateway ) { 42 if ( $this->id !== $gateway->id ) { 43 return; 44 } 45 46 if ( ! wcs_is_subscription( $order ) ) { 47 return; 48 } 49 50 if ( ! WC_Subscriptions_Change_Payment_Gateway::will_subscription_update_all_payment_methods( $order ) ) { 51 return; 52 } 53 54 switch ( $result->ResponseMessage ) { 55 case 'A2000': 56 case 'A2008': 57 case 'A2010': 58 case 'A2011': 59 case 'A2016': 60 if ( empty( $result->TokenCustomerID ) ) { 61 return; 62 } 63 WC_Subscriptions_Change_Payment_Gateway::update_all_payment_methods_from_subscription( $order, $gateway->id ); 64 break; 65 } 66 } 67 68 /** 69 * Updates payment method if necessary. 70 * 71 * When changing payment to eWay for subscriptions it doesn't update payment methods immediately but waits until payment token available. 72 * 73 * @param bool $update 74 * @param string $new_payment_method 75 * @param WC_Subscription $subscription 76 * @return bool 77 */ 78 public function maybe_update_payment_method( $update, $new_payment_method, $subscription ) { 79 if ( empty( $_POST['update_all_subscriptions_payment_method'] ) ) { 80 return $update; 81 } 82 83 if ( $this->id !== $new_payment_method ) { 84 return $update; 85 } 86 87 /* 88 * So that 'pay for order' page shows the credit card form, the order whose 89 * payment method is to be changed needs to have payment method = eway. 90 * That's why, when payment method is not eway, we want to update it immediately. 91 * Hence, return $update here. 92 */ 93 if ( $this->id !== $subscription->get_payment_method() ) { 94 return $update; 95 } 96 97 $is_new_card = ! isset( $_POST['eway_card_id'] ) || 'new' === $_POST['eway_card_id']; 98 if ( ! $is_new_card ) { 99 return $update; 100 } 101 102 // Don't update payment methods immediately when changing payment for subscriptions to eWay - wait until we get payment token. 103 return false; 28 104 } 29 105 -
woocommerce-gateway-eway/trunk/includes/class-wc-gateway-eway.php
r2531558 r2540675 38 38 'subscription_payment_method_change_admin', 39 39 'multiple_subscriptions', 40 'subscription_payment_method_delayed_change', 40 41 ); 41 42 -
woocommerce-gateway-eway/trunk/readme.txt
r2533058 r2540675 4 4 Requires at least: 4.4 5 5 Tested up to: 5.7 6 Stable tag: 3.2. 16 Stable tag: 3.2.2 7 7 Requires PHP: 5.6 8 8 License: GPLv3 … … 84 84 == Changelog == 85 85 86 = 3.2.2 - 2021-06-01 = 87 * Fix - Fatal error when updating payment for all subscriptions. 88 86 89 = 3.2.1 - 2021-05-17 = 87 90 * Fix - Fatal error when PHP version is older than 7.3. -
woocommerce-gateway-eway/trunk/woocommerce-gateway-eway.php
r2533058 r2540675 6 6 * Author: WooCommerce 7 7 * Author URI: https://woocommerce.com/ 8 * Version: 3.2. 18 * Version: 3.2.2 9 9 * Text Domain: wc-eway 10 10 * Domain Path: /languages … … 22 22 } 23 23 24 define( 'WOOCOMMERCE_GATEWAY_EWAY_VERSION', '3.2. 1' ); // WRCS: DEFINED_VERSION.24 define( 'WOOCOMMERCE_GATEWAY_EWAY_VERSION', '3.2.2' ); // WRCS: DEFINED_VERSION. 25 25 define( 'WOOCOMMERCE_GATEWAY_EWAY_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); 26 26 define( 'WOOCOMMERCE_GATEWAY_EWAY_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
Note: See TracChangeset
for help on using the changeset viewer.