Changeset 2442211
- Timestamp:
- 12/18/2020 10:47:54 AM (5 years ago)
- Location:
- quadpay-gateway-for-woocommerce
- Files:
-
- 15 added
- 2 edited
-
tags/1.3.8 (added)
-
tags/1.3.8/LICENSE (added)
-
tags/1.3.8/README.md (added)
-
tags/1.3.8/assets (added)
-
tags/1.3.8/assets/css (added)
-
tags/1.3.8/assets/css/widget.css (added)
-
tags/1.3.8/assets/images (added)
-
tags/1.3.8/assets/images/quadpay-logo-color.svg (added)
-
tags/1.3.8/assets/js (added)
-
tags/1.3.8/assets/js/frontend.js (added)
-
tags/1.3.8/assets/js/webcomponents-loader.js (added)
-
tags/1.3.8/config (added)
-
tags/1.3.8/config/config.php (added)
-
tags/1.3.8/quadpay.php (added)
-
tags/1.3.8/readme.txt (added)
-
trunk/quadpay.php (modified) (12 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
quadpay-gateway-for-woocommerce/trunk/quadpay.php
r2433401 r2442211 5 5 Author: QuadPay, Inc. 6 6 Author URI: https://www.quadpay.com 7 Version: 1.3. 87 Version: 1.3.9 8 8 WC requires at least: 3.1.0 9 9 WC tested up to: 4.8.0 … … 85 85 */ 86 86 private $configurationUrl; 87 /** 88 * @var string 89 */ 90 private $order_check_time; 87 91 88 92 /** … … 136 140 } 137 141 138 $this->description = __('Pay in 4 interest-free installments. Credit and debit cards accepted: Visa, Mastercard, Amex ','woo_quadpay');142 $this->description = __('Pay in 4 interest-free installments. Credit and debit cards accepted: Visa, Mastercard, Amex, Discover','woo_quadpay'); 139 143 140 144 self::$log_enabled = $this->get_option( 'logging' ) === 'yes' ? true : false; … … 167 171 $this->minimum_amount = $this->get_option( 'quadpay-amount-minimum' ); 168 172 $this->maximum_amount = $this->get_option( 'quadpay-maximum-amount' ); 173 // Default value 24h 174 $this->order_check_time = 175 ( !empty( $this->get_option( 'order_check_time' ) ) ? $this->get_option( 'order_check_time' ) : 'DAY_IN_SECONDS'); 169 176 170 177 } … … 227 234 'type' => 'select', 228 235 'options' => $env_values, 229 'description' => __( 'When in inTest/Sandbox mode, no transactions will actually be processed.', 'woo_quadpay' ),236 'description' => __( 'When in Test/Sandbox mode, no transactions will actually be processed.', 'woo_quadpay' ), 230 237 ), 231 238 'client_id' => array( … … 248 255 'default' => 'no', 249 256 'desc_tip' => true, 257 ), 258 'order_check_settings' => array( 259 'title' => __( 'Order Check', 'woo_quadpay ' ), 260 'type' => 'title', 261 'description' => __( '' ), 262 ), 263 'order_check_time' => array( 264 'title' => __( 'Order Check Timeframe', 'woo_quadpay' ), 265 'label' => __( 'Order Check Timeframe', 'woo_quadpay' ), 266 'type' => 'select', 267 'options' => array( 268 'DAY_IN_SECONDS' => __( '24h hours', 'woo_quadpay' ), 269 'WEEK_IN_SECONDS' => __( 'One Week', 'woo_quadpay' ), 270 'MONTH_IN_SECONDS' => __( 'One Month', 'woo_quadpay' ), 271 'YEAR_IN_SECONDS' => __( 'One Year', 'woo_quadpay' ), 272 ), 273 'description' => __( 'How far back should authorized, not captured orders be checked for status change.', 'woo_quadpay' ), 250 274 ), 251 275 'widget_settings' => array( … … 929 953 self::$log->add( 'quadpay', $message ); 930 954 } 955 956 if( WP_DEBUG && WP_DEBUG_LOG ) 957 error_log( $message ); 958 931 959 } 932 960 … … 1028 1056 public function check_on_hold_orders() { 1029 1057 1058 $this->log( 'Start checking On Hold orders' ); 1059 1030 1060 // Get ON-HOLD orders that are "pending" at QuadPay that need to be checked whether approved or denied 1031 $args = array( 1032 'status' => 'on-hold', 1033 'type' => 'shop_order', 1034 'date_created' => '>' . ( time() - DAY_IN_SECONDS ), 1035 'limit' => -1, 1036 'payment_method' => 'quadpay', 1037 ); 1061 $args = array( 1062 'status' => 'on-hold', 1063 'type' => 'shop_order', 1064 'date_created' => '>' . ( time() - constant( $this->order_check_time ) ), 1065 'limit' => -1, 1066 'payment_method' => 'quadpay', 1067 ); 1068 1069 1070 1038 1071 $on_hold_orders = wc_get_orders( $args ); 1039 1072 1040 1073 if ( empty( $on_hold_orders ) ) { 1074 1075 $this->log( 'No On Hold orders found (' . $this->order_check_time . ')' ); 1076 $this->log( 'End checking On Hold orders' ); 1077 1041 1078 return; 1042 1079 } 1080 1081 $this->log( count( $on_hold_orders ) . ' On Hold orders found' ); 1043 1082 1044 1083 foreach ( $on_hold_orders as $order ) { … … 1100 1139 if ( strtotime( 'now' ) - strtotime( $order_date ) > 3600 ) { 1101 1140 1102 $order->add_order_note( sprintf( __( 'On Hold Order Expired ' ) ) );1141 $order->add_order_note( sprintf( __( 'On Hold Order Expired at QuadPay' ) ) ); 1103 1142 $order->update_status( 'cancelled' ); 1104 1143 … … 1367 1406 * Process custom WooCommerce Order Actions: Check payment status on QuadPay 1368 1407 * 1369 * @param object$order1408 * @param $order 1370 1409 * 1371 1410 * @since 1.3.0 … … 1407 1446 $response_code = wp_remote_retrieve_response_code( $response ); 1408 1447 1409 // Check status of order 1448 $response_message = wp_remote_retrieve_response_message( $response ); 1449 1450 // Check status of order 1410 1451 if ( $response_code == 200 ) { 1411 1452 1412 1453 // Check status of order 1413 if ( $body->orderStatus == "Approved") {1454 if ( 'Approved' == $body->orderStatus ) { 1414 1455 1415 1456 $order->add_order_note( sprintf( __( 'Checked payment status with QuadPay. Payment approved. QuadPay Order ID: %s', 'woo_quadpay' ), $body->orderId ) ); 1416 1457 $order->payment_complete( $order_id ); 1417 1458 1418 } elseif ( $body->orderStatus == "Created") {1459 } elseif ( 'Created' == $body->orderStatus ) { 1419 1460 1420 1461 $order->add_order_note( __( 'Checked payment status with QuadPay. Still pending approval.', 'woo_quadpay' ) ); 1421 1462 $order->update_status( 'pending' ); 1422 1463 1423 } elseif ( $body->orderStatus == 'Abandoned') {1464 } elseif ( 'Abandoned' == $body->orderStatus ) { 1424 1465 1425 1466 $order->add_order_note( sprintf( __( 'Checked payment status with QuadPay. Payment %s. QuadPay Order ID: %s', 'woo_quadpay' ), strtolower( $body->orderStatus ), $body->orderId ) ); … … 1435 1476 } else { 1436 1477 1437 $order->add_order_note( 'Can\'t check order payment status on QuadPay , try again later.' );1478 $order->add_order_note( 'Can\'t check order payment status on QuadPay (response message: ' . $response_message . ').' ); 1438 1479 1439 1480 } -
quadpay-gateway-for-woocommerce/trunk/readme.txt
r2433401 r2442211 53 53 * none 54 54 55 = 1.3.9 = 56 * Fix - fixed issue with checking QuadPay status for on hold and pending orders 57 * Tweak - added time settings for order check 58 * Tweak - added detailed log and order notes messages 59 * Tweak - added "Discover" as a credit card option in QuadPay checkout button 60 55 61 == Changelog == 56 62 = 1.3.8 =
Note: See TracChangeset
for help on using the changeset viewer.