зеркало из https://github.com/mozilla/fxa.git
fix(payments-cart): update cart taxAddress type
Because: - The cart was returning the incorrect type for taxaddress This commit: - Modifies the kysely-types entry in accordance with the example here: https://kysely.dev/docs/getting-started#types Closes FXA-10172
This commit is contained in:
Родитель
80a2e41285
Коммит
584bf462d9
|
@ -83,7 +83,7 @@ export const ResultCartFactory = (
|
|||
offeringConfigId: faker.string.uuid(),
|
||||
interval: faker.string.numeric(),
|
||||
experiment: null,
|
||||
taxAddress: JSON.stringify(TaxAddressFactory()),
|
||||
taxAddress: TaxAddressFactory(),
|
||||
createdAt: faker.date.past().getTime(),
|
||||
updatedAt: faker.date.past().getTime(),
|
||||
couponCode: null,
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
InvoiceManager,
|
||||
StripeCustomer,
|
||||
SubplatInterval,
|
||||
TaxAddress,
|
||||
} from '@fxa/payments/stripe';
|
||||
import { CartErrorReasonId, CartState } from '@fxa/shared/db/mysql/account';
|
||||
import { GeoDBManager } from '@fxa/shared/geodb';
|
||||
|
@ -124,7 +123,7 @@ export class CartService {
|
|||
interval: oldCart.interval,
|
||||
offeringConfigId: oldCart.offeringConfigId,
|
||||
experiment: oldCart.experiment || undefined,
|
||||
taxAddress: (oldCart.taxAddress as unknown as TaxAddress) || undefined, // TODO: Fix the typings for taxAddress
|
||||
taxAddress: oldCart.taxAddress || undefined,
|
||||
couponCode: oldCart.couponCode || undefined,
|
||||
stripeCustomerId: oldCart.stripeCustomerId || undefined,
|
||||
email: oldCart.email || undefined,
|
||||
|
@ -233,7 +232,7 @@ export class CartService {
|
|||
const invoicePreview = await this.invoiceManager.preview({
|
||||
priceId,
|
||||
customer,
|
||||
taxAddress: cart.taxAddress as unknown as TaxAddress, // TODO: Fix the typings for taxAddress
|
||||
taxAddress: cart.taxAddress || undefined,
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/**
|
||||
* This file is generated by kysely-codegen. Merge edits as needed.
|
||||
*/
|
||||
import type { ColumnType } from 'kysely';
|
||||
import type { ColumnType, JSONColumnType } from 'kysely';
|
||||
|
||||
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
|
||||
? ColumnType<S, I | undefined, U>
|
||||
|
@ -91,7 +91,10 @@ export interface Carts {
|
|||
offeringConfigId: string;
|
||||
interval: string;
|
||||
experiment: string | null;
|
||||
taxAddress: Json | null;
|
||||
taxAddress: JSONColumnType<{
|
||||
countryCode: string;
|
||||
postalCode: string;
|
||||
}> | null;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
couponCode: string | null;
|
||||
|
|
Загрузка…
Ссылка в новой задаче