chore: added setup payment v1 params
This commit is contained in:
4
server/src/external/autumn/autumnCli.ts
vendored
4
server/src/external/autumn/autumnCli.ts
vendored
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { batchUpdateCustomerProducts } from "@/internal/customers/cusProducts/repos/batchUpdteCustomerProducts";
|
||||
import { batchUpdateCustomerProducts } from "./batchUpdateCustomerProducts";
|
||||
|
||||
export const customerProductRepo = {
|
||||
batchUpdate: batchUpdateCustomerProducts,
|
||||
|
||||
@@ -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
|
||||
>;
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user