pronamic / wp-pronamic-pay

The Pronamic Pay plugin allows you to easily accept payments with payment methods like credit card, iDEAL, Bancontact and Sofort through a variety of payment providers on your WordPress website.
https://pronamicpay.com
35 stars 14 forks source link

Empty payment method and not empty issuer logic in Ninja Forms #235

Closed remcotolsma closed 3 years ago

remcotolsma commented 3 years ago

@rvdsteege I removed the following code from the Ninja Forms library: https://github.com/wp-pay-extensions/ninjaforms/commit/115e761bb5483a798a76d0be45b0fed665f7e2a1

        // Set default payment method if necessary.
        if ( empty( $payment->method ) && ( null !== $payment->issuer || $gateway->payment_method_is_required() ) ) {
            $payment->method = PaymentMethods::IDEAL;
        }

        // Only start payments for known/active payment methods.
        if ( is_string( $payment->method ) && ! PaymentMethods::is_active( $payment->method ) ) {
            return false;
        }

I hope that the core library handles this correctly and the try/catch statements handles the issues.

We have to check this, i noticed we have almost the same code in core: https://github.com/pronamic/wp-pay-core/blob/94fc56fed35fffcec612e473174c17254d894faf/src/Plugin.php#L941-L959