-
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.
Pass pay for order param to init WooPay session (#7253)
- Loading branch information
Showing
8 changed files
with
77 additions
and
15 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: patch | ||
Type: fix | ||
|
||
Fix init WooPay and empty cart error |
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 |
---|---|---|
|
@@ -19,7 +19,15 @@ jest.mock( 'wcpay/utils/checkout', () => ( { | |
describe( 'WCPayAPI', () => { | ||
test( 'does not initialize woopay if already requesting', async () => { | ||
buildAjaxURL.mockReturnValue( 'https://example.org/' ); | ||
getConfig.mockReturnValue( 'foo' ); | ||
getConfig.mockImplementation( ( key ) => { | ||
const mockProperties = { | ||
initWooPayNonce: 'foo', | ||
order_id: 1, | ||
key: 'testkey', | ||
billing_email: '[email protected]', | ||
}; | ||
return mockProperties[ key ]; | ||
} ); | ||
|
||
const api = new WCPayAPI( {}, request ); | ||
api.isWooPayRequesting = true; | ||
|
@@ -31,7 +39,15 @@ describe( 'WCPayAPI', () => { | |
|
||
test( 'initializes woopay using config params', async () => { | ||
buildAjaxURL.mockReturnValue( 'https://example.org/' ); | ||
getConfig.mockReturnValue( 'foo' ); | ||
getConfig.mockImplementation( ( key ) => { | ||
const mockProperties = { | ||
initWooPayNonce: 'foo', | ||
order_id: 1, | ||
key: 'testkey', | ||
billing_email: '[email protected]', | ||
}; | ||
return mockProperties[ key ]; | ||
} ); | ||
|
||
const api = new WCPayAPI( {}, request ); | ||
await api.initWooPay( '[email protected]', 'qwerty123' ); | ||
|
@@ -40,6 +56,9 @@ describe( 'WCPayAPI', () => { | |
_wpnonce: 'foo', | ||
email: '[email protected]', | ||
user_session: 'qwerty123', | ||
order_id: 1, | ||
key: 'testkey', | ||
billing_email: '[email protected]', | ||
} ); | ||
expect( api.isWooPayRequesting ).toBe( false ); | ||
} ); | ||
|
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