mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Ensure empty data scenarios
This commit is contained in:
parent
41eb1792c0
commit
39cf0c99fc
2 changed files with 39 additions and 7 deletions
|
@ -38,6 +38,20 @@ class ShippingView {
|
|||
const stateCode = data.value('stateCode');
|
||||
const stateName = (this.states[countryCode] && this.states[countryCode][stateCode]) ? this.states[countryCode][stateCode] : stateCode;
|
||||
|
||||
if(
|
||||
this.hasEmptyValues(data, stateName)
|
||||
) {
|
||||
return `
|
||||
<div style="margin-bottom: 20px;">
|
||||
<div class="axo-checkout-header-section">
|
||||
<h3>Shipping</h3>
|
||||
<a href="javascript:void(0)" ${this.el.changeShippingAddressLink.attributes}>Edit</a>
|
||||
</div>
|
||||
<div>Please fill in your shipping details.</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
return `
|
||||
<div style="margin-bottom: 20px;">
|
||||
<div class="axo-checkout-header-section">
|
||||
|
@ -118,6 +132,15 @@ class ShippingView {
|
|||
});
|
||||
}
|
||||
|
||||
hasEmptyValues(data, stateName) {
|
||||
return !data.value('email')
|
||||
|| !data.value('firstName')
|
||||
|| !data.value('lastName')
|
||||
|| !data.value('street1')
|
||||
|| !data.value('city')
|
||||
|| !stateName;
|
||||
}
|
||||
|
||||
isActive() {
|
||||
return this.group.active;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue