chore: added setup payment v1 params

This commit is contained in:
John Yeo
2026-02-23 11:21:28 +00:00
parent b6de9d5ac0
commit 5afd5a2de3
5 changed files with 13 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ import {
type ProductItem,
type RewardRedemption,
type SetUsageParams,
type SetupPaymentParams,
type SetupPaymentParamsV0,
type TrackParams,
type UpdateBalanceParamsV0,
type UpdateSubscriptionV0Params,
@@ -908,7 +908,7 @@ export class AutumnInt {
return data;
},
setupPayment: async (params: SetupPaymentParams) => {
setupPayment: async (params: SetupPaymentParamsV0) => {
const data = await this.post(`/setup_payment`, params);
return data;
},

View File

@@ -1,8 +1,9 @@
import {
AffectedResource,
ErrCode,
SetupPaymentParamsSchema,
SetupPaymentParamsV0Schema,
} from "@autumn/shared";
import { createStripeCli } from "@/external/connect/createStripeCli.js";
import { getOrCreateStripeCustomer } from "@/external/stripe/customers";
import { createRoute } from "@/honoMiddlewares/routeHandler.js";
@@ -11,7 +12,7 @@ import RecaseError from "@/utils/errorUtils.js";
import { getOrCreateCustomer } from "../../customers/cusUtils/getOrCreateCustomer.js";
export const handleSetupPayment = createRoute({
body: SetupPaymentParamsSchema,
body: SetupPaymentParamsV0Schema,
resource: AffectedResource.Customer,
handler: async (c) => {
const ctx = c.get("ctx");

View File

@@ -1,4 +1,4 @@
import { batchUpdateCustomerProducts } from "@/internal/customers/cusProducts/repos/batchUpdteCustomerProducts";
import { batchUpdateCustomerProducts } from "./batchUpdateCustomerProducts";
export const customerProductRepo = {
batchUpdate: batchUpdateCustomerProducts,

View File

@@ -1,7 +1,7 @@
import { z } from "zod/v4";
import { CustomerDataSchema } from "../../common/customerData";
export const SetupPaymentParamsSchema = z.object({
export const SetupPaymentParamsV0Schema = z.object({
customer_id: z.string().meta({
description: "The ID of the customer",
}),
@@ -25,3 +25,8 @@ export const SetupPaymentResponseV0Schema = z.object({
description: "URL to the payment setup page",
}),
});
export type SetupPaymentParamsV0 = z.infer<typeof SetupPaymentParamsV0Schema>;
export type SetupPaymentResponseV0 = z.infer<
typeof SetupPaymentResponseV0Schema
>;

View File

@@ -51,6 +51,7 @@ export * from "./balances/track/trackResponseV2.js";
export * from "./balances/track/trackResponseV3.js";
export * from "./balances/update/updateBalanceParams.js";
export * from "./balances/usageModels.js";
export * from "./billing";
// Billing
export * from "./billing/index.js";
export * from "./common/customerData.js";