-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: BNPL payment methods should work when available in the Pay For O…
…rder page (#9670)
- Loading branch information
1 parent
c061a08
commit ed04c34
Showing
8 changed files
with
237 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: fix | ||
|
||
BNPL methods now work properly in Pay for Order when they are available. Default values are also provided when available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,6 +284,8 @@ describe( 'UPE checkout utils', () => { | |
if ( checkboxElement ) { | ||
checkboxElement.remove(); | ||
} | ||
|
||
delete window.wcpayCustomerData; | ||
} ); | ||
|
||
it( 'should not provide terms when cart does not contain subscriptions and the saving checkbox is unchecked', () => { | ||
|
@@ -355,6 +357,34 @@ describe( 'UPE checkout utils', () => { | |
expect( upeSettings.terms.card ).toEqual( 'always' ); | ||
} ); | ||
|
||
it( 'should define defaultValues when wcpayCustomerData is present', () => { | ||
window.wcpayCustomerData = { | ||
name: 'Test Person', | ||
email: '[email protected]', | ||
billing_country: 'US', | ||
}; | ||
|
||
const upeSettings = getUpeSettings(); | ||
|
||
expect( upeSettings.defaultValues ).toEqual( { | ||
billingDetails: { | ||
name: 'Test Person', | ||
email: '[email protected]', | ||
address: { | ||
country: 'US', | ||
}, | ||
}, | ||
} ); | ||
} ); | ||
|
||
it( 'should not define defaultValues if wcpayCustomerData is not present', () => { | ||
window.wcpayCustomerData = null; | ||
|
||
const upeSettings = getUpeSettings(); | ||
|
||
expect( upeSettings.defaultValues ).toBeUndefined(); | ||
} ); | ||
|
||
function createCheckboxElementWhich( isChecked ) { | ||
// Create the checkbox element | ||
const checkboxElement = document.createElement( 'input' ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters