@paygentic/sdk 0.6.11 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -5
- package/dist/commonjs/funcs/billableMetricsMeter.d.ts +19 -0
- package/dist/commonjs/funcs/billableMetricsMeter.d.ts.map +1 -0
- package/dist/commonjs/funcs/billableMetricsMeter.js +133 -0
- package/dist/commonjs/funcs/billableMetricsMeter.js.map +1 -0
- package/dist/commonjs/funcs/customersDelete.d.ts +15 -0
- package/dist/commonjs/funcs/customersDelete.d.ts.map +1 -0
- package/dist/commonjs/funcs/customersDelete.js +121 -0
- package/dist/commonjs/funcs/customersDelete.js.map +1 -0
- package/dist/commonjs/funcs/entitlementsList.js +1 -0
- package/dist/commonjs/funcs/entitlementsList.js.map +1 -1
- package/dist/commonjs/funcs/paymentsCreate.d.ts +19 -0
- package/dist/commonjs/funcs/paymentsCreate.d.ts.map +1 -0
- package/dist/commonjs/funcs/paymentsCreate.js +119 -0
- package/dist/commonjs/funcs/paymentsCreate.js.map +1 -0
- package/dist/commonjs/funcs/paymentsGet.d.ts +19 -0
- package/dist/commonjs/funcs/paymentsGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/paymentsGet.js +124 -0
- package/dist/commonjs/funcs/paymentsGet.js.map +1 -0
- package/dist/commonjs/funcs/paymentsList.d.ts +18 -0
- package/dist/commonjs/funcs/paymentsList.d.ts.map +1 -0
- package/dist/commonjs/funcs/paymentsList.js +125 -0
- package/dist/commonjs/funcs/paymentsList.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/lib/matchers.d.ts.map +1 -1
- package/dist/commonjs/lib/matchers.js +0 -1
- package/dist/commonjs/lib/matchers.js.map +1 -1
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js +1 -2
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +2 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/createpayment.d.ts +113 -0
- package/dist/commonjs/models/operations/createpayment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createpayment.js +82 -0
- package/dist/commonjs/models/operations/createpayment.js.map +1 -0
- package/dist/commonjs/models/operations/createpaymentsession.d.ts +113 -0
- package/dist/commonjs/models/operations/createpaymentsession.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createpaymentsession.js +82 -0
- package/dist/commonjs/models/operations/createpaymentsession.js.map +1 -0
- package/dist/commonjs/models/operations/createplan.d.ts +18 -0
- package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createplan.js +11 -1
- package/dist/commonjs/models/operations/createplan.js.map +1 -1
- package/dist/commonjs/models/operations/getbillablemetricmeter.d.ts +57 -0
- package/dist/commonjs/models/operations/getbillablemetricmeter.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getbillablemetricmeter.js +66 -0
- package/dist/commonjs/models/operations/getbillablemetricmeter.js.map +1 -0
- package/dist/commonjs/models/operations/getpayment.d.ts +15 -0
- package/dist/commonjs/models/operations/getpayment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getpayment.js +49 -0
- package/dist/commonjs/models/operations/getpayment.js.map +1 -0
- package/dist/commonjs/models/operations/getpaymentsession.d.ts +15 -0
- package/dist/commonjs/models/operations/getpaymentsession.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getpaymentsession.js +49 -0
- package/dist/commonjs/models/operations/getpaymentsession.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +4 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +4 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listentitlements.d.ts +5 -0
- package/dist/commonjs/models/operations/listentitlements.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listentitlements.js +1 -0
- package/dist/commonjs/models/operations/listentitlements.js.map +1 -1
- package/dist/commonjs/models/operations/listpayments.d.ts +75 -0
- package/dist/commonjs/models/operations/listpayments.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listpayments.js +82 -0
- package/dist/commonjs/models/operations/listpayments.js.map +1 -0
- package/dist/commonjs/models/operations/listpaymentsessions.d.ts +75 -0
- package/dist/commonjs/models/operations/listpaymentsessions.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listpaymentsessions.js +82 -0
- package/dist/commonjs/models/operations/listpaymentsessions.js.map +1 -0
- package/dist/commonjs/models/payment.d.ts +91 -0
- package/dist/commonjs/models/payment.d.ts.map +1 -0
- package/dist/commonjs/models/payment.js +90 -0
- package/dist/commonjs/models/payment.js.map +1 -0
- package/dist/commonjs/models/subscription.d.ts +8 -4
- package/dist/commonjs/models/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/subscription.js +7 -6
- package/dist/commonjs/models/subscription.js.map +1 -1
- package/dist/commonjs/models/usageresponse.d.ts +50 -0
- package/dist/commonjs/models/usageresponse.d.ts.map +1 -0
- package/dist/commonjs/models/usageresponse.js +78 -0
- package/dist/commonjs/models/usageresponse.js.map +1 -0
- package/dist/commonjs/sdk/billablemetrics.d.ts +7 -0
- package/dist/commonjs/sdk/billablemetrics.d.ts.map +1 -1
- package/dist/commonjs/sdk/billablemetrics.js +10 -0
- package/dist/commonjs/sdk/billablemetrics.js.map +1 -1
- package/dist/commonjs/sdk/customers.d.ts +1 -1
- package/dist/commonjs/sdk/customers.d.ts.map +1 -1
- package/dist/commonjs/sdk/customers.js +3 -3
- package/dist/commonjs/sdk/customers.js.map +1 -1
- package/dist/commonjs/sdk/payments.d.ts +27 -0
- package/dist/commonjs/sdk/payments.d.ts.map +1 -0
- package/dist/commonjs/sdk/payments.js +42 -0
- package/dist/commonjs/sdk/payments.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/billableMetricsMeter.d.ts +19 -0
- package/dist/esm/funcs/billableMetricsMeter.d.ts.map +1 -0
- package/dist/esm/funcs/billableMetricsMeter.js +97 -0
- package/dist/esm/funcs/billableMetricsMeter.js.map +1 -0
- package/dist/esm/funcs/customersDelete.d.ts +15 -0
- package/dist/esm/funcs/customersDelete.d.ts.map +1 -0
- package/dist/esm/funcs/customersDelete.js +85 -0
- package/dist/esm/funcs/customersDelete.js.map +1 -0
- package/dist/esm/funcs/entitlementsList.js +1 -0
- package/dist/esm/funcs/entitlementsList.js.map +1 -1
- package/dist/esm/funcs/paymentsCreate.d.ts +19 -0
- package/dist/esm/funcs/paymentsCreate.d.ts.map +1 -0
- package/dist/esm/funcs/paymentsCreate.js +83 -0
- package/dist/esm/funcs/paymentsCreate.js.map +1 -0
- package/dist/esm/funcs/paymentsGet.d.ts +19 -0
- package/dist/esm/funcs/paymentsGet.d.ts.map +1 -0
- package/dist/esm/funcs/paymentsGet.js +88 -0
- package/dist/esm/funcs/paymentsGet.js.map +1 -0
- package/dist/esm/funcs/paymentsList.d.ts +18 -0
- package/dist/esm/funcs/paymentsList.d.ts.map +1 -0
- package/dist/esm/funcs/paymentsList.js +89 -0
- package/dist/esm/funcs/paymentsList.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/lib/matchers.d.ts.map +1 -1
- package/dist/esm/lib/matchers.js +0 -1
- package/dist/esm/lib/matchers.js.map +1 -1
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js +1 -2
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/createpayment.d.ts +113 -0
- package/dist/esm/models/operations/createpayment.d.ts.map +1 -0
- package/dist/esm/models/operations/createpayment.js +44 -0
- package/dist/esm/models/operations/createpayment.js.map +1 -0
- package/dist/esm/models/operations/createpaymentsession.d.ts +113 -0
- package/dist/esm/models/operations/createpaymentsession.d.ts.map +1 -0
- package/dist/esm/models/operations/createpaymentsession.js +44 -0
- package/dist/esm/models/operations/createpaymentsession.js.map +1 -0
- package/dist/esm/models/operations/createplan.d.ts +18 -0
- package/dist/esm/models/operations/createplan.d.ts.map +1 -1
- package/dist/esm/models/operations/createplan.js +10 -0
- package/dist/esm/models/operations/createplan.js.map +1 -1
- package/dist/esm/models/operations/getbillablemetricmeter.d.ts +57 -0
- package/dist/esm/models/operations/getbillablemetricmeter.d.ts.map +1 -0
- package/dist/esm/models/operations/getbillablemetricmeter.js +29 -0
- package/dist/esm/models/operations/getbillablemetricmeter.js.map +1 -0
- package/dist/esm/models/operations/getpayment.d.ts +15 -0
- package/dist/esm/models/operations/getpayment.d.ts.map +1 -0
- package/dist/esm/models/operations/getpayment.js +12 -0
- package/dist/esm/models/operations/getpayment.js.map +1 -0
- package/dist/esm/models/operations/getpaymentsession.d.ts +15 -0
- package/dist/esm/models/operations/getpaymentsession.d.ts.map +1 -0
- package/dist/esm/models/operations/getpaymentsession.js +12 -0
- package/dist/esm/models/operations/getpaymentsession.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +4 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +4 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listentitlements.d.ts +5 -0
- package/dist/esm/models/operations/listentitlements.d.ts.map +1 -1
- package/dist/esm/models/operations/listentitlements.js +1 -0
- package/dist/esm/models/operations/listentitlements.js.map +1 -1
- package/dist/esm/models/operations/listpayments.d.ts +75 -0
- package/dist/esm/models/operations/listpayments.d.ts.map +1 -0
- package/dist/esm/models/operations/listpayments.js +44 -0
- package/dist/esm/models/operations/listpayments.js.map +1 -0
- package/dist/esm/models/operations/listpaymentsessions.d.ts +75 -0
- package/dist/esm/models/operations/listpaymentsessions.d.ts.map +1 -0
- package/dist/esm/models/operations/listpaymentsessions.js +44 -0
- package/dist/esm/models/operations/listpaymentsessions.js.map +1 -0
- package/dist/esm/models/payment.d.ts +91 -0
- package/dist/esm/models/payment.d.ts.map +1 -0
- package/dist/esm/models/payment.js +52 -0
- package/dist/esm/models/payment.js.map +1 -0
- package/dist/esm/models/subscription.d.ts +8 -4
- package/dist/esm/models/subscription.d.ts.map +1 -1
- package/dist/esm/models/subscription.js +5 -4
- package/dist/esm/models/subscription.js.map +1 -1
- package/dist/esm/models/usageresponse.d.ts +50 -0
- package/dist/esm/models/usageresponse.d.ts.map +1 -0
- package/dist/esm/models/usageresponse.js +39 -0
- package/dist/esm/models/usageresponse.js.map +1 -0
- package/dist/esm/sdk/billablemetrics.d.ts +7 -0
- package/dist/esm/sdk/billablemetrics.d.ts.map +1 -1
- package/dist/esm/sdk/billablemetrics.js +10 -0
- package/dist/esm/sdk/billablemetrics.js.map +1 -1
- package/dist/esm/sdk/customers.d.ts +1 -1
- package/dist/esm/sdk/customers.d.ts.map +1 -1
- package/dist/esm/sdk/customers.js +3 -3
- package/dist/esm/sdk/customers.js.map +1 -1
- package/dist/esm/sdk/payments.d.ts +27 -0
- package/dist/esm/sdk/payments.d.ts.map +1 -0
- package/dist/esm/sdk/payments.js +38 -0
- package/dist/esm/sdk/payments.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/funcs/billableMetricsMeter.ts +192 -0
- package/src/funcs/customersDelete.ts +178 -0
- package/src/funcs/entitlementsList.ts +1 -0
- package/src/funcs/paymentsCreate.ts +175 -0
- package/src/funcs/paymentsGet.ts +177 -0
- package/src/funcs/paymentsList.ts +179 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/matchers.ts +3 -2
- package/src/lib/security.ts +1 -2
- package/src/models/index.ts +2 -0
- package/src/models/operations/createpayment.ts +156 -0
- package/src/models/operations/createpaymentsession.ts +158 -0
- package/src/models/operations/createplan.ts +23 -0
- package/src/models/operations/getbillablemetricmeter.ts +87 -0
- package/src/models/operations/getpayment.ts +34 -0
- package/src/models/operations/getpaymentsession.ts +34 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/listentitlements.ts +6 -0
- package/src/models/operations/listpayments.ts +126 -0
- package/src/models/operations/listpaymentsessions.ts +130 -0
- package/src/models/payment.ts +149 -0
- package/src/models/subscription.ts +24 -16
- package/src/models/usageresponse.ts +116 -0
- package/src/sdk/billablemetrics.ts +18 -0
- package/src/sdk/customers.ts +3 -3
- package/src/sdk/payments.ts +64 -0
- package/src/sdk/sdk.ts +6 -0
- package/.devcontainer/devcontainer.json +0 -45
- package/examples/package-lock.json +0 -612
- package/examples/package.json +0 -18
- package/tsconfig.json +0 -40
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export const PaymentObject = {
|
|
12
|
+
Payment: "payment",
|
|
13
|
+
} as const;
|
|
14
|
+
export type PaymentObject = ClosedEnum<typeof PaymentObject>;
|
|
15
|
+
|
|
16
|
+
export type LineItem = {
|
|
17
|
+
description?: string | undefined;
|
|
18
|
+
amount?: string | undefined;
|
|
19
|
+
quantity?: number | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Current status of the payment.
|
|
24
|
+
*/
|
|
25
|
+
export const PaymentStatus = {
|
|
26
|
+
Pending: "pending",
|
|
27
|
+
Processing: "processing",
|
|
28
|
+
Completed: "completed",
|
|
29
|
+
Expired: "expired",
|
|
30
|
+
Cancelled: "cancelled",
|
|
31
|
+
} as const;
|
|
32
|
+
/**
|
|
33
|
+
* Current status of the payment.
|
|
34
|
+
*/
|
|
35
|
+
export type PaymentStatus = ClosedEnum<typeof PaymentStatus>;
|
|
36
|
+
|
|
37
|
+
export type Payment = {
|
|
38
|
+
/**
|
|
39
|
+
* Unique payment identifier (pay_* prefixed).
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
object: PaymentObject;
|
|
43
|
+
/**
|
|
44
|
+
* Payment amount in decimal format (e.g. '10.50').
|
|
45
|
+
*/
|
|
46
|
+
amount: string;
|
|
47
|
+
/**
|
|
48
|
+
* ISO 4217 currency code (e.g. 'USD').
|
|
49
|
+
*/
|
|
50
|
+
currency: string;
|
|
51
|
+
/**
|
|
52
|
+
* URL for the customer to complete the payment.
|
|
53
|
+
*/
|
|
54
|
+
paymentUrl?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Customer ID if provided.
|
|
57
|
+
*/
|
|
58
|
+
customerId?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Client-provided idempotency key.
|
|
61
|
+
*/
|
|
62
|
+
idempotencyKey?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Merchant-defined reference for this payment.
|
|
65
|
+
*/
|
|
66
|
+
reference?: string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Merchant-provided key-value metadata.
|
|
69
|
+
*/
|
|
70
|
+
metadata?: { [k: string]: string } | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Breakdown of what the customer is being charged for.
|
|
73
|
+
*/
|
|
74
|
+
lineItems?: Array<LineItem> | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Current status of the payment.
|
|
77
|
+
*/
|
|
78
|
+
status: PaymentStatus;
|
|
79
|
+
/**
|
|
80
|
+
* When the payment expires.
|
|
81
|
+
*/
|
|
82
|
+
expiresAt?: Date | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* When the payment was created.
|
|
85
|
+
*/
|
|
86
|
+
createdAt: Date;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
export const PaymentObject$inboundSchema: z.ZodNativeEnum<
|
|
91
|
+
typeof PaymentObject
|
|
92
|
+
> = z.nativeEnum(PaymentObject);
|
|
93
|
+
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const LineItem$inboundSchema: z.ZodType<
|
|
96
|
+
LineItem,
|
|
97
|
+
z.ZodTypeDef,
|
|
98
|
+
unknown
|
|
99
|
+
> = z.object({
|
|
100
|
+
description: z.string().optional(),
|
|
101
|
+
amount: z.string().optional(),
|
|
102
|
+
quantity: z.number().int().optional(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export function lineItemFromJSON(
|
|
106
|
+
jsonString: string,
|
|
107
|
+
): SafeParseResult<LineItem, SDKValidationError> {
|
|
108
|
+
return safeParse(
|
|
109
|
+
jsonString,
|
|
110
|
+
(x) => LineItem$inboundSchema.parse(JSON.parse(x)),
|
|
111
|
+
`Failed to parse 'LineItem' from JSON`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** @internal */
|
|
116
|
+
export const PaymentStatus$inboundSchema: z.ZodNativeEnum<
|
|
117
|
+
typeof PaymentStatus
|
|
118
|
+
> = z.nativeEnum(PaymentStatus);
|
|
119
|
+
|
|
120
|
+
/** @internal */
|
|
121
|
+
export const Payment$inboundSchema: z.ZodType<Payment, z.ZodTypeDef, unknown> =
|
|
122
|
+
z.object({
|
|
123
|
+
id: z.string(),
|
|
124
|
+
object: PaymentObject$inboundSchema.default("payment"),
|
|
125
|
+
amount: z.string(),
|
|
126
|
+
currency: z.string(),
|
|
127
|
+
paymentUrl: z.string().optional(),
|
|
128
|
+
customerId: z.string().optional(),
|
|
129
|
+
idempotencyKey: z.string().optional(),
|
|
130
|
+
reference: z.string().optional(),
|
|
131
|
+
metadata: z.record(z.string()).optional(),
|
|
132
|
+
lineItems: z.array(z.lazy(() => LineItem$inboundSchema)).optional(),
|
|
133
|
+
status: PaymentStatus$inboundSchema,
|
|
134
|
+
expiresAt: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
135
|
+
.optional(),
|
|
136
|
+
createdAt: z.string().datetime({ offset: true }).transform(v =>
|
|
137
|
+
new Date(v)
|
|
138
|
+
),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export function paymentFromJSON(
|
|
142
|
+
jsonString: string,
|
|
143
|
+
): SafeParseResult<Payment, SDKValidationError> {
|
|
144
|
+
return safeParse(
|
|
145
|
+
jsonString,
|
|
146
|
+
(x) => Payment$inboundSchema.parse(JSON.parse(x)),
|
|
147
|
+
`Failed to parse 'Payment' from JSON`,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
@@ -41,7 +41,7 @@ export type StatusPending = ClosedEnum<typeof StatusPending>;
|
|
|
41
41
|
/**
|
|
42
42
|
* Payment session details when upfront payment is required
|
|
43
43
|
*/
|
|
44
|
-
export type
|
|
44
|
+
export type SubscriptionPayment = {
|
|
45
45
|
/**
|
|
46
46
|
* Total payment amount in decimal dollar format. Sample values: '250.00' equals $250.00, '99.99' equals $99.99
|
|
47
47
|
*/
|
|
@@ -54,6 +54,10 @@ export type Payment = {
|
|
|
54
54
|
* Checkout page URL for customer payment completion. Sample values: 'https://checkout.paygentic.com/session/ps_abc123', 'https://pay.example.com/checkout/xyz789'
|
|
55
55
|
*/
|
|
56
56
|
checkoutUrl: string;
|
|
57
|
+
/**
|
|
58
|
+
* ID of the invoice linked to this payment.
|
|
59
|
+
*/
|
|
60
|
+
invoiceId?: string | undefined;
|
|
57
61
|
/**
|
|
58
62
|
* Payment session identifier for upfront payment processing. Sample values: 'ps_abc123xyz', 'ps_789def456'
|
|
59
63
|
*/
|
|
@@ -93,7 +97,7 @@ export type Subscription = {
|
|
|
93
97
|
/**
|
|
94
98
|
* Payment session details when upfront payment is required
|
|
95
99
|
*/
|
|
96
|
-
payment?:
|
|
100
|
+
payment?: SubscriptionPayment | undefined;
|
|
97
101
|
planId: string;
|
|
98
102
|
/**
|
|
99
103
|
* @deprecated Use minimumAccountBalance instead. Minimum required wallet balance in atomic units. Sample values: '200000000000' equals $200.00 minimum, '1000000000000' equals $1000.00 minimum
|
|
@@ -164,22 +168,26 @@ export const StatusPending$inboundSchema: z.ZodNativeEnum<
|
|
|
164
168
|
> = z.nativeEnum(StatusPending);
|
|
165
169
|
|
|
166
170
|
/** @internal */
|
|
167
|
-
export const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
export const SubscriptionPayment$inboundSchema: z.ZodType<
|
|
172
|
+
SubscriptionPayment,
|
|
173
|
+
z.ZodTypeDef,
|
|
174
|
+
unknown
|
|
175
|
+
> = z.object({
|
|
176
|
+
amount: z.string(),
|
|
177
|
+
breakdown: z.lazy(() => Breakdown$inboundSchema),
|
|
178
|
+
checkoutUrl: z.string(),
|
|
179
|
+
invoiceId: z.string().optional(),
|
|
180
|
+
paymentSessionId: z.string(),
|
|
181
|
+
status: StatusPending$inboundSchema,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
export function subscriptionPaymentFromJSON(
|
|
177
185
|
jsonString: string,
|
|
178
|
-
): SafeParseResult<
|
|
186
|
+
): SafeParseResult<SubscriptionPayment, SDKValidationError> {
|
|
179
187
|
return safeParse(
|
|
180
188
|
jsonString,
|
|
181
|
-
(x) =>
|
|
182
|
-
`Failed to parse '
|
|
189
|
+
(x) => SubscriptionPayment$inboundSchema.parse(JSON.parse(x)),
|
|
190
|
+
`Failed to parse 'SubscriptionPayment' from JSON`,
|
|
183
191
|
);
|
|
184
192
|
}
|
|
185
193
|
|
|
@@ -204,7 +212,7 @@ export const Subscription$inboundSchema: z.ZodType<
|
|
|
204
212
|
estimatedTaxRate: z.number().optional(),
|
|
205
213
|
taxExempt: z.boolean().default(false),
|
|
206
214
|
name: z.string(),
|
|
207
|
-
payment: z.lazy(() =>
|
|
215
|
+
payment: z.lazy(() => SubscriptionPayment$inboundSchema).optional(),
|
|
208
216
|
planId: z.string(),
|
|
209
217
|
prefundAmount: z.string().optional(),
|
|
210
218
|
minimumAccountBalance: z.string().optional(),
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export const UsageResponseObject = {
|
|
12
|
+
Meter: "meter",
|
|
13
|
+
} as const;
|
|
14
|
+
export type UsageResponseObject = ClosedEnum<typeof UsageResponseObject>;
|
|
15
|
+
|
|
16
|
+
export type WindowedValue = {
|
|
17
|
+
windowStart: Date;
|
|
18
|
+
windowEnd: Date;
|
|
19
|
+
value: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type GroupedValue = {
|
|
23
|
+
groupBy: { [k: string]: string };
|
|
24
|
+
value: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type UsageResponse = {
|
|
28
|
+
object: UsageResponseObject;
|
|
29
|
+
/**
|
|
30
|
+
* Unique identifier for a billable metric
|
|
31
|
+
*/
|
|
32
|
+
billableMetricId: string;
|
|
33
|
+
/**
|
|
34
|
+
* Total aggregated value across the query window
|
|
35
|
+
*/
|
|
36
|
+
totalValue: number;
|
|
37
|
+
/**
|
|
38
|
+
* Time-bucketed values. Only present when windowSize is specified.
|
|
39
|
+
*/
|
|
40
|
+
windowedValues?: Array<WindowedValue> | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Dimension-grouped values. Only present when groupBy is specified.
|
|
43
|
+
*/
|
|
44
|
+
groupedValues?: Array<GroupedValue> | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export const UsageResponseObject$inboundSchema: z.ZodNativeEnum<
|
|
49
|
+
typeof UsageResponseObject
|
|
50
|
+
> = z.nativeEnum(UsageResponseObject);
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
export const WindowedValue$inboundSchema: z.ZodType<
|
|
54
|
+
WindowedValue,
|
|
55
|
+
z.ZodTypeDef,
|
|
56
|
+
unknown
|
|
57
|
+
> = z.object({
|
|
58
|
+
windowStart: z.string().datetime({ offset: true }).transform(v =>
|
|
59
|
+
new Date(v)
|
|
60
|
+
),
|
|
61
|
+
windowEnd: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
62
|
+
value: z.number(),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export function windowedValueFromJSON(
|
|
66
|
+
jsonString: string,
|
|
67
|
+
): SafeParseResult<WindowedValue, SDKValidationError> {
|
|
68
|
+
return safeParse(
|
|
69
|
+
jsonString,
|
|
70
|
+
(x) => WindowedValue$inboundSchema.parse(JSON.parse(x)),
|
|
71
|
+
`Failed to parse 'WindowedValue' from JSON`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const GroupedValue$inboundSchema: z.ZodType<
|
|
77
|
+
GroupedValue,
|
|
78
|
+
z.ZodTypeDef,
|
|
79
|
+
unknown
|
|
80
|
+
> = z.object({
|
|
81
|
+
groupBy: z.record(z.string()),
|
|
82
|
+
value: z.number(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export function groupedValueFromJSON(
|
|
86
|
+
jsonString: string,
|
|
87
|
+
): SafeParseResult<GroupedValue, SDKValidationError> {
|
|
88
|
+
return safeParse(
|
|
89
|
+
jsonString,
|
|
90
|
+
(x) => GroupedValue$inboundSchema.parse(JSON.parse(x)),
|
|
91
|
+
`Failed to parse 'GroupedValue' from JSON`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** @internal */
|
|
96
|
+
export const UsageResponse$inboundSchema: z.ZodType<
|
|
97
|
+
UsageResponse,
|
|
98
|
+
z.ZodTypeDef,
|
|
99
|
+
unknown
|
|
100
|
+
> = z.object({
|
|
101
|
+
object: UsageResponseObject$inboundSchema.default("meter"),
|
|
102
|
+
billableMetricId: z.string(),
|
|
103
|
+
totalValue: z.number(),
|
|
104
|
+
windowedValues: z.array(z.lazy(() => WindowedValue$inboundSchema)).optional(),
|
|
105
|
+
groupedValues: z.array(z.lazy(() => GroupedValue$inboundSchema)).optional(),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export function usageResponseFromJSON(
|
|
109
|
+
jsonString: string,
|
|
110
|
+
): SafeParseResult<UsageResponse, SDKValidationError> {
|
|
111
|
+
return safeParse(
|
|
112
|
+
jsonString,
|
|
113
|
+
(x) => UsageResponse$inboundSchema.parse(JSON.parse(x)),
|
|
114
|
+
`Failed to parse 'UsageResponse' from JSON`,
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { billableMetricsCreate } from "../funcs/billableMetricsCreate.js";
|
|
6
6
|
import { billableMetricsGet } from "../funcs/billableMetricsGet.js";
|
|
7
7
|
import { billableMetricsList } from "../funcs/billableMetricsList.js";
|
|
8
|
+
import { billableMetricsMeter } from "../funcs/billableMetricsMeter.js";
|
|
8
9
|
import { billableMetricsUpdate } from "../funcs/billableMetricsUpdate.js";
|
|
9
10
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
10
11
|
import * as models from "../models/index.js";
|
|
@@ -70,4 +71,21 @@ export class BillableMetrics extends ClientSDK {
|
|
|
70
71
|
options,
|
|
71
72
|
));
|
|
72
73
|
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Query Meter Usage
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* Query aggregated usage data for a billable metric from the metering service.
|
|
80
|
+
*/
|
|
81
|
+
async meter(
|
|
82
|
+
request: operations.GetBillableMetricMeterRequest,
|
|
83
|
+
options?: RequestOptions,
|
|
84
|
+
): Promise<models.UsageResponse> {
|
|
85
|
+
return unwrapAsync(billableMetricsMeter(
|
|
86
|
+
this,
|
|
87
|
+
request,
|
|
88
|
+
options,
|
|
89
|
+
));
|
|
90
|
+
}
|
|
73
91
|
}
|
package/src/sdk/customers.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { customersCreate } from "../funcs/customersCreate.js";
|
|
6
|
-
import {
|
|
6
|
+
import { customersDelete } from "../funcs/customersDelete.js";
|
|
7
7
|
import { customersGet } from "../funcs/customersGet.js";
|
|
8
8
|
import { customersList } from "../funcs/customersList.js";
|
|
9
9
|
import { customersUpdate } from "../funcs/customersUpdate.js";
|
|
@@ -61,11 +61,11 @@ export class Customers extends ClientSDK {
|
|
|
61
61
|
/**
|
|
62
62
|
* Delete
|
|
63
63
|
*/
|
|
64
|
-
async
|
|
64
|
+
async delete(
|
|
65
65
|
request: operations.DeleteCustomerRequest,
|
|
66
66
|
options?: RequestOptions,
|
|
67
67
|
): Promise<void> {
|
|
68
|
-
return unwrapAsync(
|
|
68
|
+
return unwrapAsync(customersDelete(
|
|
69
69
|
this,
|
|
70
70
|
request,
|
|
71
71
|
options,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { paymentsCreate } from "../funcs/paymentsCreate.js";
|
|
6
|
+
import { paymentsGet } from "../funcs/paymentsGet.js";
|
|
7
|
+
import { paymentsList } from "../funcs/paymentsList.js";
|
|
8
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
9
|
+
import * as models from "../models/index.js";
|
|
10
|
+
import * as operations from "../models/operations/index.js";
|
|
11
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
12
|
+
|
|
13
|
+
export class Payments extends ClientSDK {
|
|
14
|
+
/**
|
|
15
|
+
* List Payments
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* List payments for the authenticated merchant with optional filters.
|
|
19
|
+
*/
|
|
20
|
+
async list(
|
|
21
|
+
request?: operations.ListPaymentsRequest | undefined,
|
|
22
|
+
options?: RequestOptions,
|
|
23
|
+
): Promise<operations.ListPaymentsResponse> {
|
|
24
|
+
return unwrapAsync(paymentsList(
|
|
25
|
+
this,
|
|
26
|
+
request,
|
|
27
|
+
options,
|
|
28
|
+
));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Create Payment
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Create a new payment for collecting a one-off charge. Returns a payment URL that can be shared with the customer.
|
|
36
|
+
*/
|
|
37
|
+
async create(
|
|
38
|
+
request: operations.CreatePaymentRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): Promise<models.Payment> {
|
|
41
|
+
return unwrapAsync(paymentsCreate(
|
|
42
|
+
this,
|
|
43
|
+
request,
|
|
44
|
+
options,
|
|
45
|
+
));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get Payment
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* Retrieve a single payment by ID.
|
|
53
|
+
*/
|
|
54
|
+
async get(
|
|
55
|
+
request: operations.GetPaymentRequest,
|
|
56
|
+
options?: RequestOptions,
|
|
57
|
+
): Promise<models.Payment> {
|
|
58
|
+
return unwrapAsync(paymentsGet(
|
|
59
|
+
this,
|
|
60
|
+
request,
|
|
61
|
+
options,
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { Events } from "./events.js";
|
|
|
12
12
|
import { Features } from "./features.js";
|
|
13
13
|
import { Fees } from "./fees.js";
|
|
14
14
|
import { InvoicesV2 } from "./invoicesv2.js";
|
|
15
|
+
import { Payments } from "./payments.js";
|
|
15
16
|
import { Plans } from "./plans.js";
|
|
16
17
|
import { Prices } from "./prices.js";
|
|
17
18
|
import { Products } from "./products.js";
|
|
@@ -98,6 +99,11 @@ export class Paygentic extends ClientSDK {
|
|
|
98
99
|
return (this._invoicesV2 ??= new InvoicesV2(this._options));
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
private _payments?: Payments;
|
|
103
|
+
get payments(): Payments {
|
|
104
|
+
return (this._payments ??= new Payments(this._options));
|
|
105
|
+
}
|
|
106
|
+
|
|
101
107
|
private _events?: Events;
|
|
102
108
|
get events(): Events {
|
|
103
109
|
return (this._events ??= new Events(this._options));
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
|
-
// README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
|
|
3
|
-
{
|
|
4
|
-
"name": "TypeScript",
|
|
5
|
-
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
|
|
6
|
-
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
7
|
-
// "features": {},
|
|
8
|
-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
9
|
-
// "forwardPorts": [],
|
|
10
|
-
// Use 'postCreateCommand' to run commands after the container is created.
|
|
11
|
-
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
|
|
12
|
-
"customizations": {
|
|
13
|
-
"vscode": {
|
|
14
|
-
"extensions": [
|
|
15
|
-
"ms-vscode.vscode-typescript-tslint-plugin",
|
|
16
|
-
"esbenp.prettier-vscode",
|
|
17
|
-
"github.vscode-pull-request-github"
|
|
18
|
-
],
|
|
19
|
-
"settings": {
|
|
20
|
-
"files.eol": "\n",
|
|
21
|
-
"editor.formatOnSave": true,
|
|
22
|
-
"typescript.tsc.autoDetect": "on",
|
|
23
|
-
"typescript.updateImportsOnFileMove.enabled": "always",
|
|
24
|
-
"typescript.preferences.importModuleSpecifier": "relative",
|
|
25
|
-
"[typescript]": {
|
|
26
|
-
"editor.codeActionsOnSave": {
|
|
27
|
-
"source.organizeImports": true
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"[typescriptreact]": {
|
|
31
|
-
"editor.codeActionsOnSave": {
|
|
32
|
-
"source.organizeImports": true
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"codespaces": {
|
|
38
|
-
"openFiles": [
|
|
39
|
-
".devcontainer/README.md"
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
44
|
-
// "remoteUser": "root"
|
|
45
|
-
}
|