mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Hide bancontact from PayPal buttons
This commit is contained in:
parent
1628f86d4c
commit
86acc00f85
3 changed files with 16 additions and 8 deletions
|
@ -73,8 +73,9 @@ class Orders {
|
||||||
$url = trailingslashit( $this->host ) . 'v2/checkout/orders';
|
$url = trailingslashit( $this->host ) . 'v2/checkout/orders';
|
||||||
|
|
||||||
$default_headers = array(
|
$default_headers = array(
|
||||||
'Authorization' => 'Bearer ' . $bearer->token(),
|
'Authorization' => 'Bearer ' . $bearer->token(),
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
'PayPal-Request-Id' => uniqid( 'ppcp-', true ),
|
||||||
);
|
);
|
||||||
$headers = array_merge(
|
$headers = array_merge(
|
||||||
$default_headers,
|
$default_headers,
|
||||||
|
|
|
@ -129,15 +129,11 @@ class BancontactGateway extends WC_Payment_Gateway {
|
||||||
'application_context' => array(
|
'application_context' => array(
|
||||||
'locale' => 'en-BE',
|
'locale' => 'en-BE',
|
||||||
'return_url' => $this->get_return_url( $wc_order ),
|
'return_url' => $this->get_return_url( $wc_order ),
|
||||||
'cancel_url' => $this->get_return_url( $wc_order ),
|
'cancel_url' => wc_get_checkout_url(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$headers = array(
|
$response = $this->orders_endpoint->create( $request_body );
|
||||||
'PayPal-Request-Id' => uniqid( 'ppcp-', true ),
|
|
||||||
);
|
|
||||||
|
|
||||||
$response = $this->orders_endpoint->create( $request_body, $headers );
|
|
||||||
$body = json_decode( $response['body'] );
|
$body = json_decode( $response['body'] );
|
||||||
|
|
||||||
$payer_action = '';
|
$payer_action = '';
|
||||||
|
|
|
@ -53,5 +53,16 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
|
||||||
$payment_method_registry->register( $c->get( 'ppcp-local-apms.bancontact.payment-method' ) );
|
$payment_method_registry->register( $c->get( 'ppcp-local-apms.bancontact.payment-method' ) );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'woocommerce_paypal_payments_localized_script_data',
|
||||||
|
function ( array $data ) {
|
||||||
|
$default_disable_funding = $data['url_params']['disable-funding'] ?? '';
|
||||||
|
$disable_funding = array_merge( array( 'bancontact' ), array_filter( explode( ',', $default_disable_funding ) ) );
|
||||||
|
$data['url_params']['disable-funding'] = implode( ',', array_unique( $disable_funding ) );
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue