-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(payment): PAYPAL-4937 updated PaymentMethodRequestSender by addi…
…ng an additional method
- Loading branch information
Showing
10 changed files
with
204 additions
and
2 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
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,8 @@ | ||
import { HeadlessPaymentMethodType } from './headless-payment-method-type'; | ||
|
||
const HeadlessPaymentMethodConfig: Record<string, HeadlessPaymentMethodType> = { | ||
paypalcommerce: HeadlessPaymentMethodType.PAYPALCOMMERCE, | ||
paypalcommercecredit: HeadlessPaymentMethodType.PAYPALCOMMERCECREDIT, | ||
}; | ||
|
||
export default HeadlessPaymentMethodConfig; |
7 changes: 7 additions & 0 deletions
7
packages/core/src/payment/headless-payment-method-response.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,7 @@ | ||
import HeadlessPaymentMethod from './headless-payment-method'; | ||
|
||
export interface HeadlessPaymentMethodResponse<T = any> { | ||
data: { | ||
site: HeadlessPaymentMethod<T>; | ||
} | ||
} |
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 @@ | ||
export enum HeadlessPaymentMethodType { | ||
PAYPALCOMMERCE = 'paypalcommerce.paypal', | ||
PAYPALCOMMERCECREDIT = 'paypalcommerce.paypalcredit', | ||
} |
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,6 @@ | ||
export default interface HeadlessPaymentMethod<T = any> { | ||
paymentWalletWithInitializationData: { | ||
clientToken?: string; | ||
initializationData?: T; | ||
}; | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/core/src/payment/headless-payment-methods.mock.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,12 @@ | ||
import HeadlessPaymentMethod from './headless-payment-method'; | ||
|
||
export function getHeadlessPaymentMethod(): HeadlessPaymentMethod { | ||
return { | ||
paymentWalletWithInitializationData: { | ||
clientToken: 'clientToken', | ||
// INFO:: base64 decoded to the following object => {"merchantId": "100000","paymentButtonStyles": {"checkoutTopButtonStyles": {"color": "blue","label": "checkout","height": "36"}}} | ||
initializationData: | ||
'eyJtZXJjaGFudElkIjogIjEwMDAwMCIsInBheW1lbnRCdXR0b25TdHlsZXMiOiB7ImNoZWNrb3V0VG9wQnV0dG9uU3R5bGVzIjogeyJjb2xvciI6ICJibHVlIiwibGFiZWwiOiAiY2hlY2tvdXQiLCJoZWlnaHQiOiAiMzYifX19', | ||
}, | ||
}; | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/core/src/payment/headless-payment-request-options.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,6 @@ | ||
import { RequestOptions } from '../common/http-request'; | ||
|
||
export default interface HeadlessPaymentRequestOptions extends RequestOptions { | ||
body?: { query: string }; | ||
headers: { Authorization: string; [key: string]: string }; | ||
} |
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