Plugin Directory

Changeset 3471053


Ignore:
Timestamp:
02/27/2026 12:09:36 PM (4 weeks ago)
Author:
ecommpay
Message:

new version 4.2.4

Location:
ecommpay-payments/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ecommpay-payments/trunk/common/EcpCore.php

    r3459640 r3471053  
    6161     * @since 2.0.0
    6262     */
    63     public const WC_ECP_VERSION = '4.2.3';
     63    public const WC_ECP_VERSION = '4.2.4';
    6464
    6565    public const ECOMMPAY_PAYMENT_METHOD = 'ecommpay';
  • ecommpay-payments/trunk/common/includes/EcpGatewayOrder.php

    r3449399 r3471053  
    5050
    5151    /**
     52     * Payment statuses that require creating a new payment_id.
     53     */
     54    private const STATUSES_REQUIRING_NEW_PAYMENT_ID = [
     55        EcpGatewayPaymentStatus::DECLINE,
     56        EcpGatewayPaymentStatus::EXPIRED,
     57        EcpGatewayPaymentStatus::INTERNAL_ERROR,
     58        EcpGatewayPaymentStatus::EXTERNAL_ERROR,
     59    ];
     60
     61    /**
    5262     * @var ?EcpGatewayPayment
    5363     */
     
    111121     */
    112122    public function create_payment_id(): string {
    113         $embeddedModePaymentId = $this->getEmbeddedModePaymentId();
    114         $paymentId = $embeddedModePaymentId ? : generateNewPaymentId($this);
     123        if ( $embeddedModePaymentId = $this->getEmbeddedModePaymentId() ) {
     124            $paymentId = $embeddedModePaymentId;
     125        } else {
     126            // Check if we can reuse existing payment_id first.
     127            if ( $reusablePaymentId = $this->get_reusable_payment_id() ) {
     128                ecp_get_log()->info(
     129                    sprintf(
     130                        __( 'Reusing existing payment ID %s (status: %s)', 'woo-ecommpay' ),
     131                        $reusablePaymentId,
     132                        $this->get_ecp_status()
     133                    )
     134                );
     135                return $reusablePaymentId;
     136            }
     137            $paymentId = generateNewPaymentId( $this );
     138        }
    115139
    116140        $this->set_payment_id( $paymentId );
     
    121145
    122146        return $paymentId;
     147    }
     148
     149    private function get_reusable_payment_id(): ?string {
     150        $existing_payment_id = $this->get_payment_id();
     151
     152        if ( ! $existing_payment_id ) {
     153            return null;
     154        }
     155
     156        $current_status = $this->get_ecp_status();
     157
     158        if ( in_array( $current_status, self::STATUSES_REQUIRING_NEW_PAYMENT_ID, true ) ) {
     159            return null;
     160        }
     161
     162        return $existing_payment_id;
    123163    }
    124164
  • ecommpay-payments/trunk/gateway-ecommpay.php

    r3459640 r3471053  
    55 * GitHub Plugin URI:
    66 * Description:       Easy payment from WooCommerce by different methods in single Payment Page.
    7  * Version:           4.2.3
     7 * Version:           4.2.4
    88 * License:           GPL2
    99 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
  • ecommpay-payments/trunk/readme.txt

    r3459640 r3471053  
    44Requires at least: 6.2
    55Tested up to: 6.9
    6 Stable tag: 4.2.3
     6Stable tag: 4.2.4
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.