@paygentic/sdk 0.6.16 → 0.6.18
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 +7 -3
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.d.ts +19 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.js +122 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.js.map +1 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.d.ts +19 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.js +126 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/createmanuallineitemrequest.d.ts +65 -0
- package/dist/commonjs/models/createmanuallineitemrequest.d.ts.map +1 -0
- package/dist/commonjs/models/createmanuallineitemrequest.js +59 -0
- package/dist/commonjs/models/createmanuallineitemrequest.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +4 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoicelineitem.d.ts +4 -4
- package/dist/commonjs/models/invoicelineitem.d.ts.map +1 -1
- package/dist/commonjs/models/invoicelineitem.js +4 -4
- package/dist/commonjs/models/invoicelineitem.js.map +1 -1
- package/dist/commonjs/models/lineitem.d.ts +146 -0
- package/dist/commonjs/models/lineitem.d.ts.map +1 -0
- package/dist/commonjs/models/lineitem.js +101 -0
- package/dist/commonjs/models/lineitem.js.map +1 -0
- package/dist/commonjs/models/lineitemsresponse.d.ts +37 -0
- package/dist/commonjs/models/lineitemsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/lineitemsresponse.js +63 -0
- package/dist/commonjs/models/lineitemsresponse.js.map +1 -0
- package/dist/commonjs/models/lineitemssummary.d.ts +21 -0
- package/dist/commonjs/models/lineitemssummary.d.ts.map +1 -0
- package/dist/commonjs/models/lineitemssummary.js +52 -0
- package/dist/commonjs/models/lineitemssummary.js.map +1 -0
- package/dist/commonjs/models/operations/createlineitem.d.ts +18 -0
- package/dist/commonjs/models/operations/createlineitem.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createlineitem.js +57 -0
- package/dist/commonjs/models/operations/createlineitem.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listlineitems.d.ts +49 -0
- package/dist/commonjs/models/operations/listlineitems.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listlineitems.js +62 -0
- package/dist/commonjs/models/operations/listlineitems.js.map +1 -0
- package/dist/commonjs/models/payment.d.ts +4 -4
- package/dist/commonjs/models/payment.d.ts.map +1 -1
- package/dist/commonjs/models/payment.js +6 -6
- package/dist/commonjs/models/payment.js.map +1 -1
- package/dist/commonjs/models/subscription.d.ts +39 -27
- package/dist/commonjs/models/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/subscription.js +32 -18
- package/dist/commonjs/models/subscription.js.map +1 -1
- package/dist/commonjs/sdk/invoicesv2.d.ts +14 -0
- package/dist/commonjs/sdk/invoicesv2.d.ts.map +1 -1
- package/dist/commonjs/sdk/invoicesv2.js +20 -0
- package/dist/commonjs/sdk/invoicesv2.js.map +1 -1
- package/dist/esm/funcs/invoicesV2CreateLineItem.d.ts +19 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.js +86 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.js.map +1 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.d.ts +19 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.js +90 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/createmanuallineitemrequest.d.ts +65 -0
- package/dist/esm/models/createmanuallineitemrequest.d.ts.map +1 -0
- package/dist/esm/models/createmanuallineitemrequest.js +22 -0
- package/dist/esm/models/createmanuallineitemrequest.js.map +1 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoicelineitem.d.ts +4 -4
- package/dist/esm/models/invoicelineitem.d.ts.map +1 -1
- package/dist/esm/models/invoicelineitem.js +3 -3
- package/dist/esm/models/invoicelineitem.js.map +1 -1
- package/dist/esm/models/lineitem.d.ts +146 -0
- package/dist/esm/models/lineitem.d.ts.map +1 -0
- package/dist/esm/models/lineitem.js +64 -0
- package/dist/esm/models/lineitem.js.map +1 -0
- package/dist/esm/models/lineitemsresponse.d.ts +37 -0
- package/dist/esm/models/lineitemsresponse.d.ts.map +1 -0
- package/dist/esm/models/lineitemsresponse.js +26 -0
- package/dist/esm/models/lineitemsresponse.js.map +1 -0
- package/dist/esm/models/lineitemssummary.d.ts +21 -0
- package/dist/esm/models/lineitemssummary.d.ts.map +1 -0
- package/dist/esm/models/lineitemssummary.js +15 -0
- package/dist/esm/models/lineitemssummary.js.map +1 -0
- package/dist/esm/models/operations/createlineitem.d.ts +18 -0
- package/dist/esm/models/operations/createlineitem.d.ts.map +1 -0
- package/dist/esm/models/operations/createlineitem.js +20 -0
- package/dist/esm/models/operations/createlineitem.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listlineitems.d.ts +49 -0
- package/dist/esm/models/operations/listlineitems.d.ts.map +1 -0
- package/dist/esm/models/operations/listlineitems.js +25 -0
- package/dist/esm/models/operations/listlineitems.js.map +1 -0
- package/dist/esm/models/payment.d.ts +4 -4
- package/dist/esm/models/payment.d.ts.map +1 -1
- package/dist/esm/models/payment.js +4 -4
- package/dist/esm/models/payment.js.map +1 -1
- package/dist/esm/models/subscription.d.ts +39 -27
- package/dist/esm/models/subscription.d.ts.map +1 -1
- package/dist/esm/models/subscription.js +28 -16
- package/dist/esm/models/subscription.js.map +1 -1
- package/dist/esm/sdk/invoicesv2.d.ts +14 -0
- package/dist/esm/sdk/invoicesv2.d.ts.map +1 -1
- package/dist/esm/sdk/invoicesv2.js +20 -0
- package/dist/esm/sdk/invoicesv2.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/invoicesV2CreateLineItem.ts +182 -0
- package/src/funcs/invoicesV2ListLineItems.ts +184 -0
- package/src/lib/config.ts +3 -3
- package/src/models/createmanuallineitemrequest.ts +96 -0
- package/src/models/index.ts +4 -0
- package/src/models/invoicelineitem.ts +9 -6
- package/src/models/lineitem.ts +205 -0
- package/src/models/lineitemsresponse.ts +70 -0
- package/src/models/lineitemssummary.ts +44 -0
- package/src/models/operations/createlineitem.ts +45 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/listlineitems.ts +76 -0
- package/src/models/payment.ts +9 -9
- package/src/models/subscription.ts +89 -41
- package/src/sdk/invoicesv2.ts +36 -0
|
@@ -13,6 +13,24 @@ export const SubscriptionObject = {
|
|
|
13
13
|
} as const;
|
|
14
14
|
export type SubscriptionObject = ClosedEnum<typeof SubscriptionObject>;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Zero-amount Invoice 0 that completed synchronously to PAID
|
|
18
|
+
*/
|
|
19
|
+
export type PaymentPaid = {
|
|
20
|
+
/**
|
|
21
|
+
* The Invoice 0 id
|
|
22
|
+
*/
|
|
23
|
+
invoiceId: string;
|
|
24
|
+
/**
|
|
25
|
+
* Payment amount ('0' for zero-amount subscriptions)
|
|
26
|
+
*/
|
|
27
|
+
amount: string;
|
|
28
|
+
/**
|
|
29
|
+
* Payment status
|
|
30
|
+
*/
|
|
31
|
+
status: "paid";
|
|
32
|
+
};
|
|
33
|
+
|
|
16
34
|
/**
|
|
17
35
|
* Breakdown of payment amount
|
|
18
36
|
*/
|
|
@@ -22,26 +40,12 @@ export type Breakdown = {
|
|
|
22
40
|
*/
|
|
23
41
|
upfrontCharges: string;
|
|
24
42
|
/**
|
|
25
|
-
* Wallet charge amount in decimal dollar format.
|
|
43
|
+
* Wallet charge amount in decimal dollar format.
|
|
26
44
|
*/
|
|
27
45
|
walletCharge: string;
|
|
28
46
|
};
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
* Payment status
|
|
32
|
-
*/
|
|
33
|
-
export const StatusPending = {
|
|
34
|
-
Pending: "pending",
|
|
35
|
-
} as const;
|
|
36
|
-
/**
|
|
37
|
-
* Payment status
|
|
38
|
-
*/
|
|
39
|
-
export type StatusPending = ClosedEnum<typeof StatusPending>;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Payment session details when upfront payment is required
|
|
43
|
-
*/
|
|
44
|
-
export type SubscriptionPayment = {
|
|
48
|
+
export type PaymentPending = {
|
|
45
49
|
/**
|
|
46
50
|
* Total payment amount in decimal dollar format. Sample values: '250.00' equals $250.00, '99.99' equals $99.99
|
|
47
51
|
*/
|
|
@@ -51,7 +55,7 @@ export type SubscriptionPayment = {
|
|
|
51
55
|
*/
|
|
52
56
|
breakdown: Breakdown;
|
|
53
57
|
/**
|
|
54
|
-
* Checkout page URL for customer payment completion.
|
|
58
|
+
* Checkout page URL for customer payment completion.
|
|
55
59
|
*/
|
|
56
60
|
checkoutUrl: string;
|
|
57
61
|
/**
|
|
@@ -59,21 +63,26 @@ export type SubscriptionPayment = {
|
|
|
59
63
|
*/
|
|
60
64
|
invoiceId?: string | undefined;
|
|
61
65
|
/**
|
|
62
|
-
* Payment session identifier for upfront payment processing.
|
|
66
|
+
* Payment session identifier for upfront payment processing.
|
|
63
67
|
*/
|
|
64
68
|
paymentSessionId: string;
|
|
65
69
|
/**
|
|
66
70
|
* Payment status
|
|
67
71
|
*/
|
|
68
|
-
status:
|
|
72
|
+
status: "pending";
|
|
69
73
|
};
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Payment session details when upfront payment is required, or confirmation of a zero-amount paid invoice
|
|
77
|
+
*/
|
|
78
|
+
export type PaymentUnion = PaymentPending | PaymentPaid;
|
|
79
|
+
|
|
80
|
+
export const SubscriptionStatusEnum = {
|
|
72
81
|
PendingPayment: "pending_payment",
|
|
73
82
|
Active: "active",
|
|
74
83
|
Terminated: "terminated",
|
|
75
84
|
} as const;
|
|
76
|
-
export type
|
|
85
|
+
export type SubscriptionStatusEnum = ClosedEnum<typeof SubscriptionStatusEnum>;
|
|
77
86
|
|
|
78
87
|
export type Subscription = {
|
|
79
88
|
id: string;
|
|
@@ -95,9 +104,9 @@ export type Subscription = {
|
|
|
95
104
|
taxExempt: boolean;
|
|
96
105
|
name: string;
|
|
97
106
|
/**
|
|
98
|
-
* Payment session details when upfront payment is required
|
|
107
|
+
* Payment session details when upfront payment is required, or confirmation of a zero-amount paid invoice
|
|
99
108
|
*/
|
|
100
|
-
payment?:
|
|
109
|
+
payment?: PaymentPending | PaymentPaid | undefined;
|
|
101
110
|
planId: string;
|
|
102
111
|
/**
|
|
103
112
|
* @deprecated Use minimumAccountBalance instead. Minimum required wallet balance in atomic units. Sample values: '200000000000' equals $200.00 minimum, '1000000000000' equals $1000.00 minimum
|
|
@@ -108,7 +117,7 @@ export type Subscription = {
|
|
|
108
117
|
*/
|
|
109
118
|
minimumAccountBalance?: string | undefined;
|
|
110
119
|
startedAt: Date;
|
|
111
|
-
status:
|
|
120
|
+
status: SubscriptionStatusEnum;
|
|
112
121
|
terminatedAt?: Date | undefined;
|
|
113
122
|
/**
|
|
114
123
|
* ID of who terminated the subscription (customer ID or merchant ID)
|
|
@@ -142,6 +151,27 @@ export const SubscriptionObject$inboundSchema: z.ZodNativeEnum<
|
|
|
142
151
|
typeof SubscriptionObject
|
|
143
152
|
> = z.nativeEnum(SubscriptionObject);
|
|
144
153
|
|
|
154
|
+
/** @internal */
|
|
155
|
+
export const PaymentPaid$inboundSchema: z.ZodType<
|
|
156
|
+
PaymentPaid,
|
|
157
|
+
z.ZodTypeDef,
|
|
158
|
+
unknown
|
|
159
|
+
> = z.object({
|
|
160
|
+
invoiceId: z.string(),
|
|
161
|
+
amount: z.string(),
|
|
162
|
+
status: z.literal("paid"),
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
export function paymentPaidFromJSON(
|
|
166
|
+
jsonString: string,
|
|
167
|
+
): SafeParseResult<PaymentPaid, SDKValidationError> {
|
|
168
|
+
return safeParse(
|
|
169
|
+
jsonString,
|
|
170
|
+
(x) => PaymentPaid$inboundSchema.parse(JSON.parse(x)),
|
|
171
|
+
`Failed to parse 'PaymentPaid' from JSON`,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
145
175
|
/** @internal */
|
|
146
176
|
export const Breakdown$inboundSchema: z.ZodType<
|
|
147
177
|
Breakdown,
|
|
@@ -163,13 +193,8 @@ export function breakdownFromJSON(
|
|
|
163
193
|
}
|
|
164
194
|
|
|
165
195
|
/** @internal */
|
|
166
|
-
export const
|
|
167
|
-
|
|
168
|
-
> = z.nativeEnum(StatusPending);
|
|
169
|
-
|
|
170
|
-
/** @internal */
|
|
171
|
-
export const SubscriptionPayment$inboundSchema: z.ZodType<
|
|
172
|
-
SubscriptionPayment,
|
|
196
|
+
export const PaymentPending$inboundSchema: z.ZodType<
|
|
197
|
+
PaymentPending,
|
|
173
198
|
z.ZodTypeDef,
|
|
174
199
|
unknown
|
|
175
200
|
> = z.object({
|
|
@@ -178,23 +203,43 @@ export const SubscriptionPayment$inboundSchema: z.ZodType<
|
|
|
178
203
|
checkoutUrl: z.string(),
|
|
179
204
|
invoiceId: z.string().optional(),
|
|
180
205
|
paymentSessionId: z.string(),
|
|
181
|
-
status:
|
|
206
|
+
status: z.literal("pending"),
|
|
182
207
|
});
|
|
183
208
|
|
|
184
|
-
export function
|
|
209
|
+
export function paymentPendingFromJSON(
|
|
210
|
+
jsonString: string,
|
|
211
|
+
): SafeParseResult<PaymentPending, SDKValidationError> {
|
|
212
|
+
return safeParse(
|
|
213
|
+
jsonString,
|
|
214
|
+
(x) => PaymentPending$inboundSchema.parse(JSON.parse(x)),
|
|
215
|
+
`Failed to parse 'PaymentPending' from JSON`,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** @internal */
|
|
220
|
+
export const PaymentUnion$inboundSchema: z.ZodType<
|
|
221
|
+
PaymentUnion,
|
|
222
|
+
z.ZodTypeDef,
|
|
223
|
+
unknown
|
|
224
|
+
> = z.union([
|
|
225
|
+
z.lazy(() => PaymentPending$inboundSchema),
|
|
226
|
+
z.lazy(() => PaymentPaid$inboundSchema),
|
|
227
|
+
]);
|
|
228
|
+
|
|
229
|
+
export function paymentUnionFromJSON(
|
|
185
230
|
jsonString: string,
|
|
186
|
-
): SafeParseResult<
|
|
231
|
+
): SafeParseResult<PaymentUnion, SDKValidationError> {
|
|
187
232
|
return safeParse(
|
|
188
233
|
jsonString,
|
|
189
|
-
(x) =>
|
|
190
|
-
`Failed to parse '
|
|
234
|
+
(x) => PaymentUnion$inboundSchema.parse(JSON.parse(x)),
|
|
235
|
+
`Failed to parse 'PaymentUnion' from JSON`,
|
|
191
236
|
);
|
|
192
237
|
}
|
|
193
238
|
|
|
194
239
|
/** @internal */
|
|
195
|
-
export const
|
|
196
|
-
typeof
|
|
197
|
-
> = z.nativeEnum(
|
|
240
|
+
export const SubscriptionStatusEnum$inboundSchema: z.ZodNativeEnum<
|
|
241
|
+
typeof SubscriptionStatusEnum
|
|
242
|
+
> = z.nativeEnum(SubscriptionStatusEnum);
|
|
198
243
|
|
|
199
244
|
/** @internal */
|
|
200
245
|
export const Subscription$inboundSchema: z.ZodType<
|
|
@@ -212,12 +257,15 @@ export const Subscription$inboundSchema: z.ZodType<
|
|
|
212
257
|
estimatedTaxRate: z.number().optional(),
|
|
213
258
|
taxExempt: z.boolean().default(false),
|
|
214
259
|
name: z.string(),
|
|
215
|
-
payment: z.
|
|
260
|
+
payment: z.union([
|
|
261
|
+
z.lazy(() => PaymentPending$inboundSchema),
|
|
262
|
+
z.lazy(() => PaymentPaid$inboundSchema),
|
|
263
|
+
]).optional(),
|
|
216
264
|
planId: z.string(),
|
|
217
265
|
prefundAmount: z.string().optional(),
|
|
218
266
|
minimumAccountBalance: z.string().optional(),
|
|
219
267
|
startedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
220
|
-
status:
|
|
268
|
+
status: SubscriptionStatusEnum$inboundSchema,
|
|
221
269
|
terminatedAt: z.string().datetime({ offset: true }).transform(v =>
|
|
222
270
|
new Date(v)
|
|
223
271
|
).optional(),
|
package/src/sdk/invoicesv2.ts
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { invoicesV2CreateLineItem } from "../funcs/invoicesV2CreateLineItem.js";
|
|
5
6
|
import { invoicesV2Get } from "../funcs/invoicesV2Get.js";
|
|
6
7
|
import { invoicesV2GetLineItems } from "../funcs/invoicesV2GetLineItems.js";
|
|
7
8
|
import { invoicesV2List } from "../funcs/invoicesV2List.js";
|
|
9
|
+
import { invoicesV2ListLineItems } from "../funcs/invoicesV2ListLineItems.js";
|
|
8
10
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
9
11
|
import * as models from "../models/index.js";
|
|
10
12
|
import * as operations from "../models/operations/index.js";
|
|
@@ -28,6 +30,40 @@ export class InvoicesV2 extends ClientSDK {
|
|
|
28
30
|
));
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
* List Line Items
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* List pending and invoiced line items for a subscription from the billing database. Returns exact fee amounts and estimated metered charges.
|
|
38
|
+
*/
|
|
39
|
+
async listLineItems(
|
|
40
|
+
request?: operations.ListLineItemsRequest | undefined,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): Promise<models.LineItemsResponse> {
|
|
43
|
+
return unwrapAsync(invoicesV2ListLineItems(
|
|
44
|
+
this,
|
|
45
|
+
request,
|
|
46
|
+
options,
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create Manual Line Item
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Create a manual line item for a billing v1 subscription. Manual line items are ad-hoc charges or credits that flow through the same collection pipeline as auto-generated items. Exactly one of subscriptionId or invoiceId must be provided.
|
|
55
|
+
*/
|
|
56
|
+
async createLineItem(
|
|
57
|
+
request: operations.CreateLineItemRequest,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<models.LineItem> {
|
|
60
|
+
return unwrapAsync(invoicesV2CreateLineItem(
|
|
61
|
+
this,
|
|
62
|
+
request,
|
|
63
|
+
options,
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
31
67
|
/**
|
|
32
68
|
* Get
|
|
33
69
|
*
|