Add bic field for iDeal gateway and local apms to allowed refund list

This commit is contained in:
Emili Castells Guasch 2024-08-26 15:16:42 +02:00
parent 9e8ee47ecb
commit 23f9bb246c
3 changed files with 28 additions and 2 deletions

View file

@ -119,6 +119,13 @@ class IDealGateway extends WC_Payment_Gateway {
'desc_tip' => true,
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-paypal-payments' ),
),
'bic' => array(
'title' => __( 'BIC', 'woocommerce-paypal-payments' ),
'type' => 'text',
'default' => '',
'desc_tip' => true,
'description' => __( 'Business identification number (BIC) to identify the specific bank.', 'woocommerce-paypal-payments' ),
),
);
}
@ -139,7 +146,10 @@ class IDealGateway extends WC_Payment_Gateway {
'country_code' => $wc_order->get_billing_country(),
'name' => $wc_order->get_billing_first_name() . ' ' . $wc_order->get_billing_last_name(),
);
// TODO get "bic" from gateway settings.
$bic = $this->get_option( 'bic' ) ?? '';
if ( $bic ) {
$payment_source['bic'] = $bic;
}
$request_body = array(
'intent' => 'CAPTURE',

View file

@ -178,6 +178,18 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
10,
2
);
add_filter(
'woocommerce_paypal_payments_allowed_refund_payment_methods',
function( array $payment_methods ) use ( $c ): array {
$local_payment_methods = $c->get( 'ppcp-local-apms.payment-methods' );
foreach ( $local_payment_methods as $payment_method ) {
$payment_methods[] = $payment_method['id'];
}
return $payment_methods;
}
);
}
/**