Changeset 3126058
- Timestamp:
- 07/26/2024 03:28:39 PM (20 months ago)
- Location:
- ecommpay-payments/trunk
- Files:
-
- 6 edited
-
common/class-ecp-core.php (modified) (1 diff)
-
common/includes/class-ecp-gateway-callbacks.php (modified) (1 diff)
-
common/includes/trait-ecp-gateway-order-extension.php (modified) (1 diff)
-
common/models/class-ecp-gateway-info-callback.php (modified) (1 diff)
-
gateway-ecommpay.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ecommpay-payments/trunk/common/class-ecp-core.php
r3090882 r3126058 43 43 * @since 2.0.0 44 44 */ 45 const WC_ECP_VERSION = '3.4. 3';45 const WC_ECP_VERSION = '3.4.4'; 46 46 // endregion 47 47 -
ecommpay-payments/trunk/common/includes/class-ecp-gateway-callbacks.php
r3054258 r3126058 249 249 private function complete_order(Ecp_Gateway_Info_Callback $callback, Ecp_Gateway_Order $order) 250 250 { 251 $is_amount_equal = (string) $callback['payment']['sum']['amount'] === (string) str_replace('.', '', $order->get_total()); 252 $is_currency_equal = $callback['payment']['sum']['currency'] === $order->get_currency(); 253 254 if ($is_amount_equal && $is_currency_equal) { 255 ecp_get_log()->debug(__('Run success process.', 'woo-ecommpay'), $order->get_id()); 256 $order->payment_complete($callback->get_operation()->get_request_id()); 257 ecp_get_log()->debug(__('Success process completed.', 'woo-ecommpay'), $order->get_id()); 258 } else { 259 $order->add_order_note( 260 __('The payment amount does not match the order amount. The order is on hold.', 'woo-ecommpay') 251 $order_currency = $order->get_currency_uppercase(); 252 $payment_currency = $callback->get_payment_currency(); 253 254 $is_amount_equal = $order->get_total_minor() === $callback->get_payment_amount_minor(); 255 $is_currency_equal = $order_currency === $payment_currency; 256 257 ecp_get_log()->debug(__('Run success process.', 'woo-ecommpay'), $order->get_id()); 258 $order->payment_complete($callback->get_operation()->get_request_id()); 259 ecp_get_log()->debug(__('Success process completed.', 'woo-ecommpay'), $order->get_id()); 260 261 if (!$is_amount_equal || !$is_currency_equal) { 262 $message = sprintf( 263 'The payment amount does not match the order amount. The order has %s %s. The payment has %s %s', 264 $order->get_total(), $order_currency, $callback->get_payment_amount(), $payment_currency 261 265 ); 262 $this->hold_order($callback, $order); 263 return; 266 $order->add_order_note(__($message, 'woo-ecommpay')); 264 267 } 265 268 } -
ecommpay-payments/trunk/common/includes/trait-ecp-gateway-order-extension.php
r3054258 r3126058 199 199 return $meta; 200 200 } 201 202 public function get_currency_uppercase(): string 203 { 204 return strtoupper($this->get_currency()); 205 } 206 207 public function get_total_minor(): int 208 { 209 return ecp_price_multiply($this->get_total(), $this->get_currency()); 210 } 201 211 } -
ecommpay-payments/trunk/common/models/class-ecp-gateway-info-callback.php
r2888278 r3126058 256 256 } 257 257 258 public function get_payment_sum(): ?Ecp_Gateway_Json 259 { 260 $payment = $this->get_payment(); 261 return $payment ? $payment->get_sum() : null; 262 } 263 264 public function get_payment_amount_minor(): ?int 265 { 266 $payment_sum = $this->get_payment_sum(); 267 return $payment_sum ? $payment_sum->get_amount() : null; 268 } 269 270 public function get_payment_amount(): ?float 271 { 272 $payment_amount_minor = $this->get_payment_amount_minor(); 273 $currency = $this->get_payment_currency(); 274 if (!$payment_amount_minor || !$currency) { 275 return null; 276 } 277 return ecp_price_multiplied_to_float($payment_amount_minor, $currency); 278 } 279 280 public function get_payment_currency(): ?string 281 { 282 if (!$payment_sum = $this->get_payment_sum()) { 283 return null; 284 } 285 $currency = $payment_sum->get_currency(); 286 return $currency ? strtoupper($currency) : null; 287 } 288 258 289 /** 259 290 * @inheritDoc -
ecommpay-payments/trunk/gateway-ecommpay.php
r3090882 r3126058 5 5 * GitHub Plugin URI: 6 6 * Description: Easy payment from WooCommerce by different methods in single Payment Page. 7 * Version: 3.4. 37 * Version: 3.4.4 8 8 * License: GPL2 9 9 * License URI: https://www.gnu.org/licenses/gpl-2.0.html -
ecommpay-payments/trunk/readme.txt
r3090882 r3126058 4 4 Requires at least: 4.0.0 5 5 Tested up to: 6.4 6 Stable tag: 3.4. 36 Stable tag: 3.4.4 7 7 License: GPLv2 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.