mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Add bic field for iDeal gateway and local apms to allowed refund list
This commit is contained in:
parent
9e8ee47ecb
commit
23f9bb246c
3 changed files with 28 additions and 2 deletions
|
@ -119,6 +119,13 @@ class IDealGateway extends WC_Payment_Gateway {
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-paypal-payments' ),
|
'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(),
|
'country_code' => $wc_order->get_billing_country(),
|
||||||
'name' => $wc_order->get_billing_first_name() . ' ' . $wc_order->get_billing_last_name(),
|
'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(
|
$request_body = array(
|
||||||
'intent' => 'CAPTURE',
|
'intent' => 'CAPTURE',
|
||||||
|
|
|
@ -178,6 +178,18 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
|
||||||
10,
|
10,
|
||||||
2
|
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;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -109,7 +109,11 @@ class RefundProcessor {
|
||||||
*/
|
*/
|
||||||
public function process( WC_Order $wc_order, float $amount = null, string $reason = '' ) : bool {
|
public function process( WC_Order $wc_order, float $amount = null, string $reason = '' ) : bool {
|
||||||
try {
|
try {
|
||||||
if ( ! in_array( $wc_order->get_payment_method(), array( PayPalGateway::ID, CreditCardGateway::ID, CardButtonGateway::ID, PayUponInvoiceGateway::ID ), true ) ) {
|
$allowed_refund_payment_methods = apply_filters(
|
||||||
|
'woocommerce_paypal_payments_allowed_refund_payment_methods',
|
||||||
|
array( PayPalGateway::ID, CreditCardGateway::ID, CardButtonGateway::ID, PayUponInvoiceGateway::ID )
|
||||||
|
);
|
||||||
|
if ( ! in_array( $wc_order->get_payment_method(), $allowed_refund_payment_methods, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue