Skip to content

Commit 4f968e2

Browse files
committed
fix(clerk-js,shared,ui): Rename payerCredit to payer
1 parent 02c4806 commit 4f968e2

5 files changed

Lines changed: 8 additions & 9 deletions

File tree

packages/clerk-js/sandbox/scenarios/checkout-account-credit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function CheckoutAccountCredit(): MockScenario {
169169
cycle_days_total: 1,
170170
cycle_remaining_percent: 1,
171171
},
172-
payer_credit: {
172+
payer: {
173173
remaining_balance: {
174174
amount: 1,
175175
amount_formatted: '100.00',

packages/clerk-js/src/utils/billing.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const billingCreditsFromJSON = (data: BillingCreditsJSON): BillingCredits => {
2828
cycleRemainingPercent: data.proration.cycle_remaining_percent,
2929
}
3030
: null,
31-
payerCredit: data.payer_credit
31+
payer: data.payer
3232
? {
33-
remainingBalance: billingMoneyAmountFromJSON(data.payer_credit.remaining_balance),
34-
appliedAmount: billingMoneyAmountFromJSON(data.payer_credit.applied_amount),
33+
remainingBalance: billingMoneyAmountFromJSON(data.payer.remaining_balance),
34+
appliedAmount: billingMoneyAmountFromJSON(data.payer.applied_amount),
3535
}
3636
: null,
3737
total: billingMoneyAmountFromJSON(data.total),

packages/shared/src/types/billing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ export interface BillingPayerCredit {
704704

705705
export interface BillingCredits {
706706
proration: BillingProrationCreditDetail | null;
707-
payerCredit: BillingPayerCredit | null;
707+
payer: BillingPayerCredit | null;
708708
total: BillingMoneyAmount;
709709
}
710710

packages/shared/src/types/json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ export interface BillingPayerCreditJSON {
769769
*/
770770
export interface BillingCreditsJSON {
771771
proration: BillingProrationCreditDetailJSON | null;
772-
payer_credit: BillingPayerCreditJSON | null;
772+
payer: BillingPayerCreditJSON | null;
773773
total: BillingMoneyAmountJSON;
774774
}
775775

packages/ui/src/components/Checkout/CheckoutForm.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ export const CheckoutForm = withCardStateProvider(() => {
3636
}
3737

3838
const showProratedCredit = !!totals.credits?.proration?.amount && totals.credits.proration.amount.amount > 0;
39-
const showAccountCredits =
40-
!!totals.credits?.payerCredit?.appliedAmount && totals.credits.payerCredit.appliedAmount.amount > 0;
39+
const showAccountCredits = !!totals.credits?.payer?.appliedAmount && totals.credits.payer.appliedAmount.amount > 0;
4140
const showPastDue = !!totals.pastDue?.amount && totals.pastDue.amount > 0;
4241
const showDowngradeInfo = !isImmediatePlanChange;
4342

@@ -92,7 +91,7 @@ export const CheckoutForm = withCardStateProvider(() => {
9291
<LineItems.Group variant='tertiary'>
9392
<LineItems.Title title={localizationKeys('billing.payerCreditRemainder')} />
9493
<LineItems.Description
95-
text={`- ${totals.credits?.payerCredit?.appliedAmount?.currencySymbol}${totals.credits?.payerCredit?.appliedAmount?.amountFormatted}`}
94+
text={`- ${totals.credits?.payer?.appliedAmount?.currencySymbol}${totals.credits?.payer?.appliedAmount?.amountFormatted}`}
9695
/>
9796
</LineItems.Group>
9897
)}

0 commit comments

Comments
 (0)