Send 3ds contingency in js

This commit is contained in:
Alex P 2021-08-20 17:47:32 +03:00
parent 31bd954870
commit 0553ea62bf
2 changed files with 15 additions and 1 deletions

View file

@ -104,7 +104,7 @@ class CreditCardRenderer {
const vault = document.getElementById('ppcp-credit-card-vault') ? const vault = document.getElementById('ppcp-credit-card-vault') ?
document.getElementById('ppcp-credit-card-vault').checked : save_card; document.getElementById('ppcp-credit-card-vault').checked : save_card;
hostedFields.submit({ hostedFields.submit({
contingencies: ['SCA_WHEN_REQUIRED'], contingencies: [this.defaultConfig.hosted_fields.contingency],
vault: vault vault: vault
}).then((payload) => { }).then((payload) => {
payload.orderID = payload.orderId; payload.orderID = payload.orderId;

View file

@ -601,6 +601,19 @@ class SmartButton implements SmartButtonInterface {
return $this->subscription_helper->cart_contains_subscription(); return $this->subscription_helper->cart_contains_subscription();
} }
/**
* Retrieves the 3D Secure contingency settings.
*
* @return string
*/
private function get_3ds_contingency(): string {
if ( $this->settings->has( '3d_secure_contingency' ) ) {
return $this->settings->get( '3d_secure_contingency' );
}
return 'SCA_WHEN_REQUIRED';
}
/** /**
* The localized data for the smart button. * The localized data for the smart button.
* *
@ -677,6 +690,7 @@ class SmartButton implements SmartButtonInterface {
), ),
), ),
'valid_cards' => $this->dcc_applies->valid_cards(), 'valid_cards' => $this->dcc_applies->valid_cards(),
'contingency' => $this->get_3ds_contingency(),
), ),
'messages' => $this->message_values(), 'messages' => $this->message_values(),
'labels' => array( 'labels' => array(