mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #385 from woocommerce/PCP-359-customer-details-not-available-i
Ensure hosted fields `cardholderName` is submitted to JavaScript SDK
This commit is contained in:
commit
2d903e19a6
2 changed files with 23 additions and 5 deletions
|
@ -194,6 +194,23 @@ class CreditCardRenderer {
|
||||||
if (contingency !== 'NO_3D_SECURE') {
|
if (contingency !== 'NO_3D_SECURE') {
|
||||||
hostedFieldsData.contingencies = [contingency];
|
hostedFieldsData.contingencies = [contingency];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.defaultConfig.payer) {
|
||||||
|
hostedFieldsData.cardholderName = this.defaultConfig.payer.given_name + ' ' + this.defaultConfig.payer.surname;
|
||||||
|
}
|
||||||
|
if (!hostedFieldsData.cardholderName) {
|
||||||
|
const firstName = document.getElementById('billing_first_name') ? document.getElementById('billing_first_name').value : '';
|
||||||
|
const lastName = document.getElementById('billing_last_name') ? document.getElementById('billing_last_name').value : '';
|
||||||
|
|
||||||
|
if (!firstName || !lastName) {
|
||||||
|
this.spinner.unblock();
|
||||||
|
this.errorHandler.message(this.defaultConfig.hosted_fields.labels.cardholder_name_required);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hostedFieldsData.cardholderName = firstName + ' ' + lastName;
|
||||||
|
}
|
||||||
|
|
||||||
this.currentHostedFieldsInstance.submit(hostedFieldsData).then((payload) => {
|
this.currentHostedFieldsInstance.submit(hostedFieldsData).then((payload) => {
|
||||||
payload.orderID = payload.orderId;
|
payload.orderID = payload.orderId;
|
||||||
this.spinner.unblock();
|
this.spinner.unblock();
|
||||||
|
|
|
@ -695,6 +695,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
'Unfortunately, we do not support your credit card.',
|
'Unfortunately, we do not support your credit card.',
|
||||||
'woocommerce-paypal-payments'
|
'woocommerce-paypal-payments'
|
||||||
),
|
),
|
||||||
|
'cardholder_name_required' => __( 'Cardholder\'s first and last name are required, please fill the checkout form required fields.', 'woocommerce-paypal-payments' ),
|
||||||
),
|
),
|
||||||
'valid_cards' => $this->dcc_applies->valid_cards(),
|
'valid_cards' => $this->dcc_applies->valid_cards(),
|
||||||
'contingency' => $this->get_3ds_contingency(),
|
'contingency' => $this->get_3ds_contingency(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue