Skip to content

Commit

Permalink
Update consumer bank details fields (pronamic/wp-pronamic-pay#336).
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Sep 6, 2022
1 parent b92182c commit 5eae5ae
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
use Pronamic\WordPress\Pay\Core\PaymentMethodsCollection;
use Pronamic\WordPress\Pay\Fields\CachedCallbackOptions;
use Pronamic\WordPress\Pay\Fields\IDealIssuerSelectField;
use Pronamic\WordPress\Pay\Fields\Field;
use Pronamic\WordPress\Pay\Fields\SelectFieldOption;
use Pronamic\WordPress\Pay\Fields\SelectFieldOptionGroup;
use Pronamic\WordPress\Pay\Fields\TextField;
use Pronamic\WordPress\Pay\Gateways\Mollie\Payment as MolliePayment;
use Pronamic\WordPress\Pay\Payments\FailureReason;
use Pronamic\WordPress\Pay\Payments\Payment;
Expand Down Expand Up @@ -106,8 +106,13 @@ function() {
'pronamic_pay_ideal_issuers_' . \md5( \wp_json_encode( $config ) )
);

$field_consumer_name = new Field( 'pronamic_pay_consumer_bank_details_name' );
$field_consumer_iban = new Field( 'pronamic_pay_consumer_bank_details_iban' );
$field_consumer_name = new TextField( 'pronamic_pay_consumer_bank_details_name' );
$field_consumer_name->set_label( __( 'Account holder name', 'pronamic_ideal' ) );
$field_consumer_name->meta_key = 'consumer_bank_details_name';

$field_consumer_iban = new TextField( 'pronamic_pay_consumer_bank_details_iban' );
$field_consumer_iban->set_label( __( 'Account number (IBAN)', 'pronamic_ideal' ) );
$field_consumer_iban->meta_key = 'consumer_bank_details_iban';

// Apple Pay.
$payment_method_apple_pay = new PaymentMethod( PaymentMethods::APPLE_PAY );
Expand Down Expand Up @@ -1196,6 +1201,16 @@ public function update_payment_from_mollie_payment( Payment $payment, MolliePaym
$payment->set_action_url( $links->checkout->href );
}

if (
null === $payment->get_action_url()
&&
'' === $payment->get_meta( 'mollie_sequence_type' )
&&
PaymentMethods::DIRECT_DEBIT === $payment->get_payment_method()
) {
$payment->set_action_url( $payment->get_return_redirect_url() );
}

// Change payment state URL.
if ( \property_exists( $links, 'changePaymentState' ) ) {
$payment->set_meta( 'mollie_change_payment_state_url', $links->changePaymentState->href );
Expand Down

0 comments on commit 5eae5ae

Please sign in to comment.