Changeset 2979934
- Timestamp:
- 10/17/2023 08:38:32 AM (2 years ago)
- Location:
- wpbr-linepay-tw
- Files:
-
- 14 edited
- 1 copied
-
tags/1.1.3 (copied) (copied from wpbr-linepay-tw/trunk)
-
tags/1.1.3/includes/admin/meta-boxes/class-linepay-tw-order-meta-boxes.php (modified) (4 diffs)
-
tags/1.1.3/includes/gateways/class-linepay-tw-payment.php (modified) (2 diffs)
-
tags/1.1.3/includes/gateways/class-linepay-tw-request.php (modified) (1 diff)
-
tags/1.1.3/includes/gateways/class-linepay-tw-response.php (modified) (1 diff)
-
tags/1.1.3/readme.md (modified) (1 diff)
-
tags/1.1.3/readme.txt (modified) (2 diffs)
-
tags/1.1.3/wpbr-linepay-tw.php (modified) (3 diffs)
-
trunk/includes/admin/meta-boxes/class-linepay-tw-order-meta-boxes.php (modified) (4 diffs)
-
trunk/includes/gateways/class-linepay-tw-payment.php (modified) (2 diffs)
-
trunk/includes/gateways/class-linepay-tw-request.php (modified) (1 diff)
-
trunk/includes/gateways/class-linepay-tw-response.php (modified) (1 diff)
-
trunk/readme.md (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wpbr-linepay-tw.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpbr-linepay-tw/tags/1.1.3/includes/admin/meta-boxes/class-linepay-tw-order-meta-boxes.php
r2964807 r2979934 7 7 8 8 defined( 'ABSPATH' ) || exit; 9 10 use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController; 11 use Automattic\WooCommerce\Utilities\OrderUtil; 9 12 10 13 /** … … 38 41 * @return void 39 42 */ 40 public function linepay_add_meta_boxes( $post) {43 public function linepay_add_meta_boxes() { 41 44 42 global $post; 45 //NOTE: 這邊拿不到 global $post 46 $screen = wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() 47 ? wc_get_page_screen_id( 'shop-order' ) 48 : 'shop_order'; 43 49 44 if ( array_key_exists( get_post_meta( $post->ID, '_payment_method', true), LINEPay_TW::$allowed_payments ) ) {50 // if ( array_key_exists( $order->get_meta( '_payment_method' ), LINEPay_TW::$allowed_payments ) ) { 45 51 add_meta_box( 46 52 'woocommerce-linepay-meta-boxes', … … 50 56 'linepay_admin_meta', 51 57 ), 52 'shop_order',58 $screen, 53 59 'side', 54 60 'default' 55 61 ); 56 }62 // } 57 63 58 64 } … … 65 71 * @return void 66 72 */ 67 public function linepay_admin_meta( $post ) {73 public function linepay_admin_meta( $post_or_order_object ) { 68 74 69 global $theorder;75 $order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object; 70 76 71 if ( ! is_object( $theorder ) ) { 72 $theorder = wc_get_order( $post->ID ); 73 } 74 75 if ( array_key_exists( get_post_meta( $post->ID, '_payment_method', true ), LINEPay_TW::$allowed_payments ) ) { 77 if ( array_key_exists( $order->get_payment_method(), LINEPay_TW::$allowed_payments ) ) { 76 78 77 79 echo '<table>'; 78 echo '<tr><th><div id="order-id" data-order-id="' . esc_html( $ post->ID ) . '">' . esc_html__( 'Transaction ID', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $theorder->get_meta( '_linepay_reserved_transaction_id' ) ) . '</td></tr>';79 echo '<tr><th><div>' . esc_html__( 'Payment Status', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $ theorder->get_meta( '_linepay_payment_status' ) ) . '</td></tr>';80 echo '<tr><th><div id="order-id" data-order-id="' . esc_html( $order->get_id() ) . '">' . esc_html__( 'Transaction ID', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $order->get_meta( '_linepay_reserved_transaction_id' ) ) . '</td></tr>'; 81 echo '<tr><th><div>' . esc_html__( 'Payment Status', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $order->get_meta( '_linepay_payment_status' ) ) . '</td></tr>'; 80 82 81 // if ( $theorder->get_meta( '_linepay_payment_status' ) === WPBR_LINEPay_Const::PAYMENT_STATUS_AUTHED ) {82 echo '<tr id="linepay-action"><th>' . esc_html__( 'Payment Action', 'wpbr-linepay-tw' ) . '</th><td><button class="button linepay-confirm-btn" data-id=' . esc_html( $ post->ID) . '>' . esc_html__( 'Confirm Payment', 'wpbr-linepay-tw' ) . '</button></tr>';83 //}83 if ( $order->get_meta( '_linepay_payment_status' ) === WPBR_LINEPay_Const::PAYMENT_STATUS_AUTHED ) { 84 echo '<tr id="linepay-action"><th>' . esc_html__( 'Payment Action', 'wpbr-linepay-tw' ) . '</th><td><button class="button linepay-confirm-btn" data-id=' . esc_html( $order->get_id() ) . '>' . esc_html__( 'Confirm Payment', 'wpbr-linepay-tw' ) . '</button></tr>'; 85 } 84 86 85 87 echo '</table>'; -
wpbr-linepay-tw/tags/1.1.3/includes/gateways/class-linepay-tw-payment.php
r2964807 r2979934 181 181 182 182 if ( $order->get_status() === 'on-hold' ) { 183 $text = '<span class="linepay-order-onhold">' . esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ) . '</span>';183 $text = esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ); 184 184 } 185 185 186 186 if ( $order->get_status() === 'pending' ) { 187 $text = '<span class="linepay-order-onhold">' . esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ) . '</span>';187 $text = esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ); 188 188 } 189 189 } … … 207 207 208 208 if ( $order->get_status() === 'on-hold' ) { 209 echo '<div class="linepay-order-onhold">' . esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ) . '</div>';209 echo esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ); 210 210 } 211 211 212 212 if ( $order->get_status() === 'pending' ) { 213 echo '<div class="linepay-order-onhold">' .esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ) . '</div>';213 echo esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ) . '</div>'; 214 214 } 215 215 -
wpbr-linepay-tw/tags/1.1.3/includes/gateways/class-linepay-tw-request.php
r2976149 r2979934 178 178 179 179 // Direct access to DB to check whether order price information is altered. 180 $reserved_std_amount = $this->get_standardized( get_post_meta( $order_id, '_order_total', true), $currency );180 $reserved_std_amount = $this->get_standardized( $order->get_total(), $currency ); 181 181 $std_amount = $this->get_standardized( $amount ); 182 182 -
wpbr-linepay-tw/tags/1.1.3/includes/gateways/class-linepay-tw-response.php
r2964807 r2979934 55 55 $order_id = ( isset( $_GET['order_id'] ) ) ? sanitize_text_field( wp_unslash( $_GET['order_id'] ) ) : ''; 56 56 57 if ( empty( $order_id ) ) { 57 $order = wc_get_order( $order_id ); 58 59 if ( ! $order ) { 58 60 throw new Exception( sprintf( WPBR_LINEPay_Const::LOG_TEMPLATE_HANDLE_CALLBANK_NOT_FOUND_ORDER_ID, $order_id, __( 'Unable to process callback.', 'wpbr-linepay-tw' ) ) ); 59 61 } 60 62 61 63 $request_type = ( isset( $_GET['request_type'] ) ) ? sanitize_text_field( wp_unslash( $_GET['request_type'] ) ) : ''; 62 $payment_status = get_post_meta( $order_id, '_linepay_payment_status', true);64 $payment_status = $order->get_meta( '_linepay_payment_status' ); 63 65 64 66 $gateway = new LINEPay_TW_Payment(); -
wpbr-linepay-tw/tags/1.1.3/readme.md
r2977332 r2979934 10 10 11 11 ## Changlog ## 12 13 = 1.1.3 = 14 *Release Date - 18 October 2023* 15 16 * Update: Compatible with HPOS 17 * Update: Increase Requires PHP to 7.4 12 18 13 19 = 1.1.2 = -
wpbr-linepay-tw/tags/1.1.3/readme.txt
r2977332 r2979934 3 3 Tags: WooCommerce, payment, LINE Pay, LINE, taiwan, payment, payment gateway 4 4 Requires at least: 5.9 5 Tested up to: 6. 26 Requires PHP: 7. 07 Stable tag: 1.1. 25 Tested up to: 6.3.2 6 Requires PHP: 7.4 7 Stable tag: 1.1.3 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 23 23 24 24 == Changelog == 25 26 = 1.1.3 - 2023-10-18 = 27 28 * Update: Compatible with HPOS 29 * Update: Increase Requires PHP version to 7.4 25 30 26 31 = 1.1.2 - 2023-10-11 = -
wpbr-linepay-tw/tags/1.1.3/wpbr-linepay-tw.php
r2977332 r2979934 6 6 * Author: WPBrewer 7 7 * Author URI: https://wpbrewer.com 8 * Version: 1.1. 28 * Version: 1.1.3 9 9 * Text Domain: wpbr-linepay-tw 10 10 * Domain Path: /languages 11 11 * 12 12 * WC requires at least: 3.0.0 13 * WC tested up to: 7.6.013 * WC tested up to: 8.2.1 14 14 * 15 15 * … … 35 35 define( 'WPBR_LINEPAY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 36 36 define( 'WPBR_LINEPAY_BASENAME', plugin_basename( __FILE__ ) ); 37 define( 'WPBR_LINEPAY_VERSION', '1.1. 2' );37 define( 'WPBR_LINEPAY_VERSION', '1.1.3' ); 38 38 39 39 /** … … 55 55 echo '</div>'; 56 56 } 57 58 add_action( 'before_woocommerce_init', function() { 59 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 60 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 61 } 62 } ); 57 63 58 64 /** -
wpbr-linepay-tw/trunk/includes/admin/meta-boxes/class-linepay-tw-order-meta-boxes.php
r2964807 r2979934 7 7 8 8 defined( 'ABSPATH' ) || exit; 9 10 use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController; 11 use Automattic\WooCommerce\Utilities\OrderUtil; 9 12 10 13 /** … … 38 41 * @return void 39 42 */ 40 public function linepay_add_meta_boxes( $post) {43 public function linepay_add_meta_boxes() { 41 44 42 global $post; 45 //NOTE: 這邊拿不到 global $post 46 $screen = wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() 47 ? wc_get_page_screen_id( 'shop-order' ) 48 : 'shop_order'; 43 49 44 if ( array_key_exists( get_post_meta( $post->ID, '_payment_method', true), LINEPay_TW::$allowed_payments ) ) {50 // if ( array_key_exists( $order->get_meta( '_payment_method' ), LINEPay_TW::$allowed_payments ) ) { 45 51 add_meta_box( 46 52 'woocommerce-linepay-meta-boxes', … … 50 56 'linepay_admin_meta', 51 57 ), 52 'shop_order',58 $screen, 53 59 'side', 54 60 'default' 55 61 ); 56 }62 // } 57 63 58 64 } … … 65 71 * @return void 66 72 */ 67 public function linepay_admin_meta( $post ) {73 public function linepay_admin_meta( $post_or_order_object ) { 68 74 69 global $theorder;75 $order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object; 70 76 71 if ( ! is_object( $theorder ) ) { 72 $theorder = wc_get_order( $post->ID ); 73 } 74 75 if ( array_key_exists( get_post_meta( $post->ID, '_payment_method', true ), LINEPay_TW::$allowed_payments ) ) { 77 if ( array_key_exists( $order->get_payment_method(), LINEPay_TW::$allowed_payments ) ) { 76 78 77 79 echo '<table>'; 78 echo '<tr><th><div id="order-id" data-order-id="' . esc_html( $ post->ID ) . '">' . esc_html__( 'Transaction ID', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $theorder->get_meta( '_linepay_reserved_transaction_id' ) ) . '</td></tr>';79 echo '<tr><th><div>' . esc_html__( 'Payment Status', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $ theorder->get_meta( '_linepay_payment_status' ) ) . '</td></tr>';80 echo '<tr><th><div id="order-id" data-order-id="' . esc_html( $order->get_id() ) . '">' . esc_html__( 'Transaction ID', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $order->get_meta( '_linepay_reserved_transaction_id' ) ) . '</td></tr>'; 81 echo '<tr><th><div>' . esc_html__( 'Payment Status', 'wpbr-linepay-tw' ) . '</div></th><td>' . esc_html( $order->get_meta( '_linepay_payment_status' ) ) . '</td></tr>'; 80 82 81 // if ( $theorder->get_meta( '_linepay_payment_status' ) === WPBR_LINEPay_Const::PAYMENT_STATUS_AUTHED ) {82 echo '<tr id="linepay-action"><th>' . esc_html__( 'Payment Action', 'wpbr-linepay-tw' ) . '</th><td><button class="button linepay-confirm-btn" data-id=' . esc_html( $ post->ID) . '>' . esc_html__( 'Confirm Payment', 'wpbr-linepay-tw' ) . '</button></tr>';83 //}83 if ( $order->get_meta( '_linepay_payment_status' ) === WPBR_LINEPay_Const::PAYMENT_STATUS_AUTHED ) { 84 echo '<tr id="linepay-action"><th>' . esc_html__( 'Payment Action', 'wpbr-linepay-tw' ) . '</th><td><button class="button linepay-confirm-btn" data-id=' . esc_html( $order->get_id() ) . '>' . esc_html__( 'Confirm Payment', 'wpbr-linepay-tw' ) . '</button></tr>'; 85 } 84 86 85 87 echo '</table>'; -
wpbr-linepay-tw/trunk/includes/gateways/class-linepay-tw-payment.php
r2964807 r2979934 181 181 182 182 if ( $order->get_status() === 'on-hold' ) { 183 $text = '<span class="linepay-order-onhold">' . esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ) . '</span>';183 $text = esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ); 184 184 } 185 185 186 186 if ( $order->get_status() === 'pending' ) { 187 $text = '<span class="linepay-order-onhold">' . esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ) . '</span>';187 $text = esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ); 188 188 } 189 189 } … … 207 207 208 208 if ( $order->get_status() === 'on-hold' ) { 209 echo '<div class="linepay-order-onhold">' . esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ) . '</div>';209 echo esc_html__( 'We have received your order, but the payment status need to be confirmed. Please contact the support.', 'wpbr-linepay-tw' ); 210 210 } 211 211 212 212 if ( $order->get_status() === 'pending' ) { 213 echo '<div class="linepay-order-onhold">' .esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ) . '</div>';213 echo esc_html__( 'We have received your order, but the order is awaiting payment. Please pay again.', 'wpbr-linepay-tw' ) . '</div>'; 214 214 } 215 215 -
wpbr-linepay-tw/trunk/includes/gateways/class-linepay-tw-request.php
r2976149 r2979934 178 178 179 179 // Direct access to DB to check whether order price information is altered. 180 $reserved_std_amount = $this->get_standardized( get_post_meta( $order_id, '_order_total', true), $currency );180 $reserved_std_amount = $this->get_standardized( $order->get_total(), $currency ); 181 181 $std_amount = $this->get_standardized( $amount ); 182 182 -
wpbr-linepay-tw/trunk/includes/gateways/class-linepay-tw-response.php
r2964807 r2979934 55 55 $order_id = ( isset( $_GET['order_id'] ) ) ? sanitize_text_field( wp_unslash( $_GET['order_id'] ) ) : ''; 56 56 57 if ( empty( $order_id ) ) { 57 $order = wc_get_order( $order_id ); 58 59 if ( ! $order ) { 58 60 throw new Exception( sprintf( WPBR_LINEPay_Const::LOG_TEMPLATE_HANDLE_CALLBANK_NOT_FOUND_ORDER_ID, $order_id, __( 'Unable to process callback.', 'wpbr-linepay-tw' ) ) ); 59 61 } 60 62 61 63 $request_type = ( isset( $_GET['request_type'] ) ) ? sanitize_text_field( wp_unslash( $_GET['request_type'] ) ) : ''; 62 $payment_status = get_post_meta( $order_id, '_linepay_payment_status', true);64 $payment_status = $order->get_meta( '_linepay_payment_status' ); 63 65 64 66 $gateway = new LINEPay_TW_Payment(); -
wpbr-linepay-tw/trunk/readme.md
r2977332 r2979934 10 10 11 11 ## Changlog ## 12 13 = 1.1.3 = 14 *Release Date - 18 October 2023* 15 16 * Update: Compatible with HPOS 17 * Update: Increase Requires PHP to 7.4 12 18 13 19 = 1.1.2 = -
wpbr-linepay-tw/trunk/readme.txt
r2977332 r2979934 3 3 Tags: WooCommerce, payment, LINE Pay, LINE, taiwan, payment, payment gateway 4 4 Requires at least: 5.9 5 Tested up to: 6. 26 Requires PHP: 7. 07 Stable tag: 1.1. 25 Tested up to: 6.3.2 6 Requires PHP: 7.4 7 Stable tag: 1.1.3 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 23 23 24 24 == Changelog == 25 26 = 1.1.3 - 2023-10-18 = 27 28 * Update: Compatible with HPOS 29 * Update: Increase Requires PHP version to 7.4 25 30 26 31 = 1.1.2 - 2023-10-11 = -
wpbr-linepay-tw/trunk/wpbr-linepay-tw.php
r2977332 r2979934 6 6 * Author: WPBrewer 7 7 * Author URI: https://wpbrewer.com 8 * Version: 1.1. 28 * Version: 1.1.3 9 9 * Text Domain: wpbr-linepay-tw 10 10 * Domain Path: /languages 11 11 * 12 12 * WC requires at least: 3.0.0 13 * WC tested up to: 7.6.013 * WC tested up to: 8.2.1 14 14 * 15 15 * … … 35 35 define( 'WPBR_LINEPAY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 36 36 define( 'WPBR_LINEPAY_BASENAME', plugin_basename( __FILE__ ) ); 37 define( 'WPBR_LINEPAY_VERSION', '1.1. 2' );37 define( 'WPBR_LINEPAY_VERSION', '1.1.3' ); 38 38 39 39 /** … … 55 55 echo '</div>'; 56 56 } 57 58 add_action( 'before_woocommerce_init', function() { 59 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 60 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 61 } 62 } ); 57 63 58 64 /**
Note: See TracChangeset
for help on using the changeset viewer.