diff --git a/modules/ppcp-local-alternative-payment-methods/src/IDealGateway.php b/modules/ppcp-local-alternative-payment-methods/src/IDealGateway.php index d7d671e1a..5b7adbc6e 100644 --- a/modules/ppcp-local-alternative-payment-methods/src/IDealGateway.php +++ b/modules/ppcp-local-alternative-payment-methods/src/IDealGateway.php @@ -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', diff --git a/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php b/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php index 1a3f41cec..5dda3b818 100644 --- a/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php +++ b/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php @@ -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; + } + ); } /** diff --git a/modules/ppcp-wc-gateway/src/Processor/RefundProcessor.php b/modules/ppcp-wc-gateway/src/Processor/RefundProcessor.php index 91e73866c..25e4c5eed 100644 --- a/modules/ppcp-wc-gateway/src/Processor/RefundProcessor.php +++ b/modules/ppcp-wc-gateway/src/Processor/RefundProcessor.php @@ -109,7 +109,11 @@ class RefundProcessor { */ public function process( WC_Order $wc_order, float $amount = null, string $reason = '' ) : bool { 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; }