Changeset 2466033
- Timestamp:
- 01/31/2021 08:04:36 PM (5 years ago)
- Location:
- woo-pelecard-gateway/trunk
- Files:
-
- 5 edited
-
includes/Gateway.php (modified) (6 diffs)
-
includes/Order.php (modified) (1 diff)
-
includes/Plugin.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
woocommerce-pelecard-gateway.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woo-pelecard-gateway/trunk/includes/Gateway.php
r2462069 r2466033 176 176 add_action( 'woocommerce_checkout_update_order_review', [ $this, 'maybe_display_tokenization' ] ); 177 177 add_filter( 'woocommerce_credit_card_type_labels', [ $this, 'get_credit_card_type_labels' ] ); 178 add_filter( 'woocommerce_payment_complete_order_status', [ $this, 'order_needs_processing' ] );179 178 180 179 // WooCommerce Multilingual (WPML) … … 285 284 return ( $hook ? $this->get_option( 'hook_password' ) : null ) 286 285 ?: $this->get_option( 'password' ); 287 }288 289 /**290 * @param string $status291 *292 * @return string293 */294 public function order_needs_processing( string $status ) {295 if ( 'J5' === $this->get_action_type() ) {296 $status = 'on-hold';297 }298 299 return $status;300 286 } 301 287 … … 907 893 } 908 894 895 // Set auth number for future transactions 896 if ( 'J5' === $this->get_action_type() && ! $this->has_subscription( $order->get_id() ) ) { 897 $this->order_mark_as_chargeable( $order ); 898 $this->order_save_auth_number( $order, $transaction ); 899 } 900 909 901 unset( WC()->session->total_payments ); 910 902 … … 912 904 913 905 return $order->payment_complete( $transaction->get_id() ); 906 } 907 908 /** 909 * @param \WC_Order $order 910 */ 911 public function order_mark_as_chargeable( WC_Order $order ) { 912 $order->update_meta_data( '_wpg_is_chargeable', true ); 913 $order->save_meta_data(); 914 } 915 916 /** 917 * @param \WC_Order $order 918 * 919 * @return bool 920 */ 921 public static function is_order_chargeable( WC_Order $order ) { 922 return (bool) $order->get_meta( '_wpg_is_chargeable' ); 914 923 } 915 924 … … 1058 1067 $order = wc_get_order( $order_id ); 1059 1068 1069 if ( ! self::is_order_chargeable( $order ) ) { 1070 wp_die( -1 ); 1071 } 1072 1060 1073 $token = $this->get_order_payment_token( $order ); 1061 1074 if ( ! $token ) { … … 1086 1099 ->set_data( $result ); 1087 1100 1088 /**1089 * Orders with payment delay (J5) have on-hold status1090 */1091 add_filter( 'woocommerce_valid_order_statuses_for_payment', function( $statuses ) {1092 $statuses[] = 'on-hold';1093 1094 return $statuses;1095 } );1096 1097 1101 $this->do_payment( $transaction ); 1098 1102 } catch ( \Exception $e ) { 1099 1103 wp_send_json_error( [ 'error' => $e->getMessage() ] ); 1100 1104 } 1105 1106 $order->delete_meta_data( '_wpg_is_chargeable' ); 1107 $order->save_meta_data(); 1101 1108 1102 1109 wp_send_json_success(); -
woo-pelecard-gateway/trunk/includes/Order.php
r2460563 r2466033 83 83 */ 84 84 public function render_charge_button( WC_Order $order ) { 85 if ( ! $order->has_status( 'on-hold' ) ) { 86 return; 87 } 88 89 if ( ! current_user_can( 'edit_shop_orders' ) ) { 85 $is_chargeable = Gateway::is_order_chargeable( $order ); 86 if ( ! $is_chargeable || ! current_user_can( 'edit_shop_orders' ) ) { 90 87 return; 91 88 } -
woo-pelecard-gateway/trunk/includes/Plugin.php
r2462069 r2466033 18 18 * @var string $version 19 19 */ 20 public static $version = '1.4. 1';20 public static $version = '1.4.2'; 21 21 22 22 /** -
woo-pelecard-gateway/trunk/readme.txt
r2462069 r2466033 4 4 Requires at least: 5.3 5 5 Tested up to: 5.6 6 Stable tag: 1.4. 16 Stable tag: 1.4.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 55 55 56 56 == Changelog == 57 58 = 1.4.2 = 59 * Fixed J5 transactions logic. 57 60 58 61 = 1.4.1 = -
woo-pelecard-gateway/trunk/woocommerce-pelecard-gateway.php
r2462069 r2466033 4 4 * Plugin URI: https://wordpress.org/plugins/woo-pelecard-gateway/ 5 5 * Description: Extends WooCommerce with Pelecard payment gateway. 6 * Version: 1.4. 16 * Version: 1.4.2 7 7 * Author: Ido Friedlander 8 8 * Author URI: https://profiles.wordpress.org/idofri/
Note: See TracChangeset
for help on using the changeset viewer.