-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from xsolla/PAYMENTS-18338
feat(PAYMENTS-18338): add apple-pay redirect integration
- Loading branch information
Showing
30 changed files
with
673 additions
and
187 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
14 changes: 14 additions & 0 deletions
14
src/core/guards/apple-pay/open-apple-pay-page.guard.spec.ts
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,14 @@ | ||
import 'reflect-metadata'; | ||
import { EventName } from '../../event-name.enum'; | ||
import { isOpenApplePayPageEventMessage } from './open-apple-pay-page.guard'; | ||
|
||
describe('Event message type guard', () => { | ||
it('Should return true', () => { | ||
expect( | ||
isOpenApplePayPageEventMessage({ name: EventName.openApplePayPage }) | ||
).toBeTruthy(); | ||
}); | ||
it('Should return false', () => { | ||
expect(isOpenApplePayPageEventMessage({})).toBeFalsy(); | ||
}); | ||
}); |
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,12 @@ | ||
import { Message } from '../../message.interface'; | ||
import { isEventMessage } from '../event-message.guard'; | ||
import { EventName } from '../../event-name.enum'; | ||
|
||
export const isOpenApplePayPageEventMessage = ( | ||
messageData: unknown | ||
): messageData is Message<{ redirectUrl: string } | null | undefined> => { | ||
if (isEventMessage(messageData)) { | ||
return messageData.name === EventName.openApplePayPage; | ||
} | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const headlessCheckoutAppUrl = | ||
'https://secure.xsolla.com/headless-checkout'; | ||
// export const headlessCheckoutAppUrl = | ||
// 'https://secure.xsolla.com/headless-checkout'; | ||
export const headlessCheckoutAppUrl = 'https://localhost:4200'; | ||
export const cdnUrl = 'https://cdn3.xsolla.com'; |
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
26 changes: 26 additions & 0 deletions
26
...es/headless-checkout/post-messages-handlers/apple-pay/open-apple-pay-page.handler.spec.ts
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,26 @@ | ||
import { Message } from '../../../../core/message.interface'; | ||
import { EventName } from '../../../../core/event-name.enum'; | ||
import { openApplePayPageHandler } from './open-apple-pay-page.handler'; | ||
|
||
const mockMessage: Message<{ redirectUrl: string } | null | undefined> = { | ||
name: EventName.openApplePayPage, | ||
data: { | ||
redirectUrl: 'url', | ||
}, | ||
}; | ||
|
||
describe('openApplePayPageHandler', () => { | ||
it('Should handle data', () => { | ||
expect(openApplePayPageHandler(mockMessage)).toEqual({ | ||
isHandled: true, | ||
value: { | ||
redirectUrl: 'url', | ||
}, | ||
}); | ||
}); | ||
it('Should return null', () => { | ||
expect( | ||
openApplePayPageHandler({ name: EventName.getSavedMethods }) | ||
).toBeNull(); | ||
}); | ||
}); |
Oops, something went wrong.