2
0

(payment) Add address in payment input

This commit is contained in:
Baptiste Arnaud
2023-05-05 14:54:37 -04:00
parent b9f94cdf19
commit c469912979
4 changed files with 132 additions and 2 deletions

View File

@ -14,6 +14,15 @@ export type CreditCardDetails = {
cvc: string
}
const addressSchema = z.object({
country: z.string().optional(),
line1: z.string().optional(),
line2: z.string().optional(),
state: z.string().optional(),
city: z.string().optional(),
postalCode: z.string().optional(),
})
export const paymentInputOptionsSchema = optionBaseSchema.merge(
z.object({
provider: z.nativeEnum(PaymentProvider),
@ -27,6 +36,7 @@ export const paymentInputOptionsSchema = optionBaseSchema.merge(
name: z.string().optional(),
email: z.string().optional(),
phoneNumber: z.string().optional(),
address: addressSchema.optional(),
})
.optional(),
credentialsId: z.string().optional(),
@ -76,3 +86,6 @@ export type PaymentInputRuntimeOptions = z.infer<
typeof paymentInputRuntimeOptionsSchema
>
export type StripeCredentials = z.infer<typeof stripeCredentialsSchema>
export type PaymentAddress = NonNullable<
PaymentInputOptions['additionalInformation']
>['address']