Skip to content

Commit

Permalink
feat(client): update payment installments types
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagodicosta committed Sep 15, 2023
1 parent 88ead15 commit e4db4fb
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/client/src/payments/types/paymentInstrument.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import type {
ShopperInteraction,
} from './index.js';

export type InstrumentInstallment = {
quantity: number;
};

export enum PaymentInstrumentStatus {
Created = 'Created',
Pending = 'Pending',
Expand Down
4 changes: 3 additions & 1 deletion packages/client/src/payments/types/paymentMethods.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export type CreditCard = {

export type CreditCardPaymentMethod = {
type: string;
creditCards: CreditCard[];
creditCards?: CreditCard[];
supportsInstallments?: boolean;
installments?: number[];
};

export type PaymentMethods = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
Amounts,
InstrumentInstallment,
Issuer,
PayerAddressType,
PayerInput,
Expand Down Expand Up @@ -50,6 +51,7 @@ export type PostPaymentIntentInstrumentData = {
payer?: PayerInput;
amounts: Amounts[];
data?: CreatePaymentInstrumentData;
installments?: InstrumentInstallment;
shopperInteraction?: ShopperInteraction;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
Amounts,
InstrumentInstallment,
PayerAddressType,
PayerInput,
PaymentInstrument,
Expand All @@ -12,6 +13,7 @@ export type PutPaymentIntentInstrumentData = {
createToken?: boolean;
payer?: PayerInput;
amounts: Amounts[];
installments?: InstrumentInstallment;
shopperInteraction?: ShopperInteraction;
payerAddressType?: PayerAddressType;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Object {
"id": "e13bb06b-392b-49a0-8acd-3f44416e3234",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "CreditCard",
},
"customerAccounts": Array [
Expand Down Expand Up @@ -148,6 +150,8 @@ Object {
"id": "e13bb06b-392b-49a0-8acd-3f44416e3234",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "CreditCard",
},
"customerAccounts": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down Expand Up @@ -484,6 +486,8 @@ Object {
"id": "",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "",
},
"customerAccounts": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Object {
"id": "e13bb06b-392b-49a0-8acd-3f44416e3234",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "CreditCard",
},
"customerAccounts": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Object {
"id": "e13bb06b-392b-49a0-8acd-3f44416e3234",
},
],
"installments": Array [],
"supportsInstallments": false,
"type": "CreditCard",
},
"customerAccounts": Array [
Expand Down
4 changes: 4 additions & 0 deletions tests/__fixtures__/checkout/checkout.fixtures.mts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ export const mockResponse = {
creditCard: {
type: '',
creditCards: [{ id: '', description: '', code: '' }],
supportsInstallments: false,
installments: [],
},
},
userPaymentTokens: undefined,
Expand Down Expand Up @@ -928,6 +930,8 @@ export const mockUpdateCheckoutResponse = {
code: '',
},
],
supportsInstallments: false,
installments: [],
},
},
orderStatus: OrderStatusError.NoError,
Expand Down
2 changes: 2 additions & 0 deletions tests/__fixtures__/payments/payments.fixtures.mts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ export const mockFetchPaymentMethodsResponse = {
code: 'VISA',
},
],
supportsInstallments: false,
installments: [],
},
};
export const mockFetchPaymentIntentChargeResponse = {
Expand Down

0 comments on commit e4db4fb

Please sign in to comment.