From 5b1fffa79b22297c62fd12471ceba686126d92e9 Mon Sep 17 00:00:00 2001 From: ponddeja <35944403+ponddeja@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:39:39 +0700 Subject: [PATCH 1/2] Remove debug log make show notice message on woocommerce. --- includes/Api.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/includes/Api.php b/includes/Api.php index 2258f6cc..fefb0eed 100644 --- a/includes/Api.php +++ b/includes/Api.php @@ -1096,13 +1096,6 @@ public function get_reepay_cards( string $customer_handle, $reepay_token = null $result = $tmp; - wc_get_logger()->debug( - array( - 'source' => 'billwerk-token', - '_legacy' => true, - ) - ); - if ( ! $reepay_token ) { return $result['cards']; } From 11b450955e83805a44a43325469d2e71fe78573e Mon Sep 17 00:00:00 2001 From: ponddeja <35944403+ponddeja@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:14:52 +0700 Subject: [PATCH 2/2] Fix call function rp_prepare_amount double time when checkout using saved card --- includes/Gateways/ReepayGateway.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/Gateways/ReepayGateway.php b/includes/Gateways/ReepayGateway.php index 4b87d8eb..5a525916 100644 --- a/includes/Gateways/ReepayGateway.php +++ b/includes/Gateways/ReepayGateway.php @@ -1006,7 +1006,7 @@ public function process_payment( $order_id ) { return $this->process_session_charge( $params, $order ); } else { $order_lines = 'no' === $this->skip_order_lines ? $this->get_order_items( $order ) : null; - $amount = 'yes' === $this->skip_order_lines ? $this->get_skip_order_lines_amount( $order ) : null; + $amount = 'yes' === $this->skip_order_lines ? $this->get_skip_order_lines_amount( $order, true ) : null; // Charge payment. $result = reepay()->api( $this )->charge( $order, $token->get_token(), $amount, $order_lines ); @@ -1582,8 +1582,9 @@ public function get_order_items( WC_Order $order, bool $only_not_settled = false * Get order amount from order item amount * * @param WC_Order $order order to get items. + * @param bool $skip_fn_rp_amount skip call funcion rp_prepare_amount. */ - public function get_skip_order_lines_amount( WC_Order $order ) { + public function get_skip_order_lines_amount( WC_Order $order, $skip_fn_rp_amount = false ) { $total_amount = 0; if ( wcs_cart_have_subscription() ) { @@ -1593,6 +1594,8 @@ public function get_skip_order_lines_amount( WC_Order $order ) { $total_amount += $item['amount']; } } + } elseif ( true === $skip_fn_rp_amount ) { + $total_amount = $order->get_total(); } else { $total_amount = rp_prepare_amount( $order->get_total(), $order->get_currency() ); }