@paygentic/sdk 0.7.17 → 0.7.19

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.
Files changed (150) hide show
  1. package/README.md +9 -3
  2. package/dist/commonjs/funcs/entitlementsList.d.ts +1 -1
  3. package/dist/commonjs/funcs/entitlementsList.d.ts.map +1 -1
  4. package/dist/commonjs/funcs/entitlementsList.js +10 -8
  5. package/dist/commonjs/funcs/entitlementsList.js.map +1 -1
  6. package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.d.ts +19 -0
  7. package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.js +125 -0
  9. package/dist/commonjs/funcs/invoicesV2CreateInvoiceRefund.js.map +1 -0
  10. package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.d.ts +19 -0
  11. package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.js +124 -0
  13. package/dist/commonjs/funcs/invoicesV2ListInvoiceRefunds.js.map +1 -0
  14. package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.d.ts +19 -0
  15. package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.js +129 -0
  17. package/dist/commonjs/funcs/invoicesV2VoidInvoiceRefund.js.map +1 -0
  18. package/dist/commonjs/lib/config.d.ts +2 -2
  19. package/dist/commonjs/lib/config.js +2 -2
  20. package/dist/commonjs/models/index.d.ts +2 -0
  21. package/dist/commonjs/models/index.d.ts.map +1 -1
  22. package/dist/commonjs/models/index.js +2 -0
  23. package/dist/commonjs/models/index.js.map +1 -1
  24. package/dist/commonjs/models/invoicerefund.d.ts +95 -0
  25. package/dist/commonjs/models/invoicerefund.d.ts.map +1 -0
  26. package/dist/commonjs/models/invoicerefund.js +81 -0
  27. package/dist/commonjs/models/invoicerefund.js.map +1 -0
  28. package/dist/commonjs/models/invoicerefundlist.d.ts +31 -0
  29. package/dist/commonjs/models/invoicerefundlist.d.ts.map +1 -0
  30. package/dist/commonjs/models/invoicerefundlist.js +60 -0
  31. package/dist/commonjs/models/invoicerefundlist.js.map +1 -0
  32. package/dist/commonjs/models/operations/createcustomerpaymentmethod.d.ts +5 -0
  33. package/dist/commonjs/models/operations/createcustomerpaymentmethod.d.ts.map +1 -1
  34. package/dist/commonjs/models/operations/createcustomerpaymentmethod.js +1 -0
  35. package/dist/commonjs/models/operations/createcustomerpaymentmethod.js.map +1 -1
  36. package/dist/commonjs/models/operations/createinvoicerefund.d.ts +30 -0
  37. package/dist/commonjs/models/operations/createinvoicerefund.d.ts.map +1 -0
  38. package/dist/commonjs/models/operations/createinvoicerefund.js +64 -0
  39. package/dist/commonjs/models/operations/createinvoicerefund.js.map +1 -0
  40. package/dist/commonjs/models/operations/index.d.ts +3 -0
  41. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  42. package/dist/commonjs/models/operations/index.js +3 -0
  43. package/dist/commonjs/models/operations/index.js.map +1 -1
  44. package/dist/commonjs/models/operations/listentitlements.d.ts +13 -3
  45. package/dist/commonjs/models/operations/listentitlements.d.ts.map +1 -1
  46. package/dist/commonjs/models/operations/listentitlements.js +3 -1
  47. package/dist/commonjs/models/operations/listentitlements.js.map +1 -1
  48. package/dist/commonjs/models/operations/listinvoicerefunds.d.ts +15 -0
  49. package/dist/commonjs/models/operations/listinvoicerefunds.d.ts.map +1 -0
  50. package/dist/commonjs/models/operations/listinvoicerefunds.js +49 -0
  51. package/dist/commonjs/models/operations/listinvoicerefunds.js.map +1 -0
  52. package/dist/commonjs/models/operations/voidinvoicerefund.d.ts +35 -0
  53. package/dist/commonjs/models/operations/voidinvoicerefund.d.ts.map +1 -0
  54. package/dist/commonjs/models/operations/voidinvoicerefund.js +65 -0
  55. package/dist/commonjs/models/operations/voidinvoicerefund.js.map +1 -0
  56. package/dist/commonjs/models/revenuesummaryresponse.d.ts +9 -1
  57. package/dist/commonjs/models/revenuesummaryresponse.d.ts.map +1 -1
  58. package/dist/commonjs/models/revenuesummaryresponse.js +2 -0
  59. package/dist/commonjs/models/revenuesummaryresponse.js.map +1 -1
  60. package/dist/commonjs/sdk/entitlements.d.ts +1 -1
  61. package/dist/commonjs/sdk/entitlements.d.ts.map +1 -1
  62. package/dist/commonjs/sdk/entitlements.js.map +1 -1
  63. package/dist/commonjs/sdk/invoicesv2.d.ts +21 -0
  64. package/dist/commonjs/sdk/invoicesv2.d.ts.map +1 -1
  65. package/dist/commonjs/sdk/invoicesv2.js +30 -0
  66. package/dist/commonjs/sdk/invoicesv2.js.map +1 -1
  67. package/dist/esm/funcs/entitlementsList.d.ts +1 -1
  68. package/dist/esm/funcs/entitlementsList.d.ts.map +1 -1
  69. package/dist/esm/funcs/entitlementsList.js +10 -8
  70. package/dist/esm/funcs/entitlementsList.js.map +1 -1
  71. package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.d.ts +19 -0
  72. package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.d.ts.map +1 -0
  73. package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.js +89 -0
  74. package/dist/esm/funcs/invoicesV2CreateInvoiceRefund.js.map +1 -0
  75. package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.d.ts +19 -0
  76. package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.d.ts.map +1 -0
  77. package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.js +88 -0
  78. package/dist/esm/funcs/invoicesV2ListInvoiceRefunds.js.map +1 -0
  79. package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.d.ts +19 -0
  80. package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.d.ts.map +1 -0
  81. package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.js +93 -0
  82. package/dist/esm/funcs/invoicesV2VoidInvoiceRefund.js.map +1 -0
  83. package/dist/esm/lib/config.d.ts +2 -2
  84. package/dist/esm/lib/config.js +2 -2
  85. package/dist/esm/models/index.d.ts +2 -0
  86. package/dist/esm/models/index.d.ts.map +1 -1
  87. package/dist/esm/models/index.js +2 -0
  88. package/dist/esm/models/index.js.map +1 -1
  89. package/dist/esm/models/invoicerefund.d.ts +95 -0
  90. package/dist/esm/models/invoicerefund.d.ts.map +1 -0
  91. package/dist/esm/models/invoicerefund.js +44 -0
  92. package/dist/esm/models/invoicerefund.js.map +1 -0
  93. package/dist/esm/models/invoicerefundlist.d.ts +31 -0
  94. package/dist/esm/models/invoicerefundlist.d.ts.map +1 -0
  95. package/dist/esm/models/invoicerefundlist.js +23 -0
  96. package/dist/esm/models/invoicerefundlist.js.map +1 -0
  97. package/dist/esm/models/operations/createcustomerpaymentmethod.d.ts +5 -0
  98. package/dist/esm/models/operations/createcustomerpaymentmethod.d.ts.map +1 -1
  99. package/dist/esm/models/operations/createcustomerpaymentmethod.js +1 -0
  100. package/dist/esm/models/operations/createcustomerpaymentmethod.js.map +1 -1
  101. package/dist/esm/models/operations/createinvoicerefund.d.ts +30 -0
  102. package/dist/esm/models/operations/createinvoicerefund.d.ts.map +1 -0
  103. package/dist/esm/models/operations/createinvoicerefund.js +26 -0
  104. package/dist/esm/models/operations/createinvoicerefund.js.map +1 -0
  105. package/dist/esm/models/operations/index.d.ts +3 -0
  106. package/dist/esm/models/operations/index.d.ts.map +1 -1
  107. package/dist/esm/models/operations/index.js +3 -0
  108. package/dist/esm/models/operations/index.js.map +1 -1
  109. package/dist/esm/models/operations/listentitlements.d.ts +13 -3
  110. package/dist/esm/models/operations/listentitlements.d.ts.map +1 -1
  111. package/dist/esm/models/operations/listentitlements.js +3 -1
  112. package/dist/esm/models/operations/listentitlements.js.map +1 -1
  113. package/dist/esm/models/operations/listinvoicerefunds.d.ts +15 -0
  114. package/dist/esm/models/operations/listinvoicerefunds.d.ts.map +1 -0
  115. package/dist/esm/models/operations/listinvoicerefunds.js +12 -0
  116. package/dist/esm/models/operations/listinvoicerefunds.js.map +1 -0
  117. package/dist/esm/models/operations/voidinvoicerefund.d.ts +35 -0
  118. package/dist/esm/models/operations/voidinvoicerefund.d.ts.map +1 -0
  119. package/dist/esm/models/operations/voidinvoicerefund.js +27 -0
  120. package/dist/esm/models/operations/voidinvoicerefund.js.map +1 -0
  121. package/dist/esm/models/revenuesummaryresponse.d.ts +9 -1
  122. package/dist/esm/models/revenuesummaryresponse.d.ts.map +1 -1
  123. package/dist/esm/models/revenuesummaryresponse.js +2 -0
  124. package/dist/esm/models/revenuesummaryresponse.js.map +1 -1
  125. package/dist/esm/sdk/entitlements.d.ts +1 -1
  126. package/dist/esm/sdk/entitlements.d.ts.map +1 -1
  127. package/dist/esm/sdk/entitlements.js.map +1 -1
  128. package/dist/esm/sdk/invoicesv2.d.ts +21 -0
  129. package/dist/esm/sdk/invoicesv2.d.ts.map +1 -1
  130. package/dist/esm/sdk/invoicesv2.js +30 -0
  131. package/dist/esm/sdk/invoicesv2.js.map +1 -1
  132. package/jsr.json +1 -1
  133. package/package.json +1 -1
  134. package/src/funcs/entitlementsList.ts +13 -10
  135. package/src/funcs/invoicesV2CreateInvoiceRefund.ts +182 -0
  136. package/src/funcs/invoicesV2ListInvoiceRefunds.ts +176 -0
  137. package/src/funcs/invoicesV2VoidInvoiceRefund.ts +187 -0
  138. package/src/lib/config.ts +2 -2
  139. package/src/models/index.ts +2 -0
  140. package/src/models/invoicerefund.ts +140 -0
  141. package/src/models/invoicerefundlist.ts +59 -0
  142. package/src/models/operations/createcustomerpaymentmethod.ts +6 -0
  143. package/src/models/operations/createinvoicerefund.ts +74 -0
  144. package/src/models/operations/index.ts +3 -0
  145. package/src/models/operations/listentitlements.ts +16 -4
  146. package/src/models/operations/listinvoicerefunds.ts +34 -0
  147. package/src/models/operations/voidinvoicerefund.ts +80 -0
  148. package/src/models/revenuesummaryresponse.ts +11 -1
  149. package/src/sdk/entitlements.ts +1 -1
  150. package/src/sdk/invoicesv2.ts +54 -0
@@ -0,0 +1,59 @@
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
+ import { InvoiceRefund, InvoiceRefund$inboundSchema } from "./invoicerefund.js";
11
+
12
+ /**
13
+ * The object type
14
+ */
15
+ export const InvoiceRefundListObject = {
16
+ List: "list",
17
+ } as const;
18
+ /**
19
+ * The object type
20
+ */
21
+ export type InvoiceRefundListObject = ClosedEnum<
22
+ typeof InvoiceRefundListObject
23
+ >;
24
+
25
+ export type InvoiceRefundList = {
26
+ /**
27
+ * The object type
28
+ */
29
+ object: InvoiceRefundListObject;
30
+ /**
31
+ * The refunds for this invoice
32
+ */
33
+ data: Array<InvoiceRefund>;
34
+ };
35
+
36
+ /** @internal */
37
+ export const InvoiceRefundListObject$inboundSchema: z.ZodNativeEnum<
38
+ typeof InvoiceRefundListObject
39
+ > = z.nativeEnum(InvoiceRefundListObject);
40
+
41
+ /** @internal */
42
+ export const InvoiceRefundList$inboundSchema: z.ZodType<
43
+ InvoiceRefundList,
44
+ z.ZodTypeDef,
45
+ unknown
46
+ > = z.object({
47
+ object: InvoiceRefundListObject$inboundSchema,
48
+ data: z.array(InvoiceRefund$inboundSchema),
49
+ });
50
+
51
+ export function invoiceRefundListFromJSON(
52
+ jsonString: string,
53
+ ): SafeParseResult<InvoiceRefundList, SDKValidationError> {
54
+ return safeParse(
55
+ jsonString,
56
+ (x) => InvoiceRefundList$inboundSchema.parse(JSON.parse(x)),
57
+ `Failed to parse 'InvoiceRefundList' from JSON`,
58
+ );
59
+ }
@@ -18,6 +18,10 @@ export type CreateCustomerPaymentMethodRequestBody = {
18
18
  * Arbitrary key/value pairs to attach to the session.
19
19
  */
20
20
  metadata?: { [k: string]: any } | undefined;
21
+ /**
22
+ * Absolute time the generated link expires. Optional; defaults to the server's configured session expiry (30 days) when omitted. Must be in the future and no more than 30 days ahead.
23
+ */
24
+ expiresAt?: Date | undefined;
21
25
  };
22
26
 
23
27
  export type CreateCustomerPaymentMethodRequest = {
@@ -33,6 +37,7 @@ export type CreateCustomerPaymentMethodRequestBody$Outbound = {
33
37
  successRedirectUrl?: string | undefined;
34
38
  failureRedirectUrl?: string | undefined;
35
39
  metadata?: { [k: string]: any } | undefined;
40
+ expiresAt?: string | undefined;
36
41
  };
37
42
 
38
43
  /** @internal */
@@ -44,6 +49,7 @@ export const CreateCustomerPaymentMethodRequestBody$outboundSchema: z.ZodType<
44
49
  successRedirectUrl: z.string().optional(),
45
50
  failureRedirectUrl: z.string().optional(),
46
51
  metadata: z.record(z.any()).optional(),
52
+ expiresAt: z.date().transform(v => v.toISOString()).optional(),
47
53
  });
48
54
 
49
55
  export function createCustomerPaymentMethodRequestBodyToJSON(
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ export type CreateInvoiceRefundRequestBody = {
9
+ /**
10
+ * Optional reason for the refund (recorded on the credit note)
11
+ */
12
+ reason?: string | undefined;
13
+ };
14
+
15
+ export type CreateInvoiceRefundRequest = {
16
+ /**
17
+ * The invoice ID
18
+ */
19
+ id: string;
20
+ requestBody?: CreateInvoiceRefundRequestBody | undefined;
21
+ };
22
+
23
+ /** @internal */
24
+ export type CreateInvoiceRefundRequestBody$Outbound = {
25
+ reason?: string | undefined;
26
+ };
27
+
28
+ /** @internal */
29
+ export const CreateInvoiceRefundRequestBody$outboundSchema: z.ZodType<
30
+ CreateInvoiceRefundRequestBody$Outbound,
31
+ z.ZodTypeDef,
32
+ CreateInvoiceRefundRequestBody
33
+ > = z.object({
34
+ reason: z.string().optional(),
35
+ });
36
+
37
+ export function createInvoiceRefundRequestBodyToJSON(
38
+ createInvoiceRefundRequestBody: CreateInvoiceRefundRequestBody,
39
+ ): string {
40
+ return JSON.stringify(
41
+ CreateInvoiceRefundRequestBody$outboundSchema.parse(
42
+ createInvoiceRefundRequestBody,
43
+ ),
44
+ );
45
+ }
46
+
47
+ /** @internal */
48
+ export type CreateInvoiceRefundRequest$Outbound = {
49
+ id: string;
50
+ RequestBody?: CreateInvoiceRefundRequestBody$Outbound | undefined;
51
+ };
52
+
53
+ /** @internal */
54
+ export const CreateInvoiceRefundRequest$outboundSchema: z.ZodType<
55
+ CreateInvoiceRefundRequest$Outbound,
56
+ z.ZodTypeDef,
57
+ CreateInvoiceRefundRequest
58
+ > = z.object({
59
+ id: z.string(),
60
+ requestBody: z.lazy(() => CreateInvoiceRefundRequestBody$outboundSchema)
61
+ .optional(),
62
+ }).transform((v) => {
63
+ return remap$(v, {
64
+ requestBody: "RequestBody",
65
+ });
66
+ });
67
+
68
+ export function createInvoiceRefundRequestToJSON(
69
+ createInvoiceRefundRequest: CreateInvoiceRefundRequest,
70
+ ): string {
71
+ return JSON.stringify(
72
+ CreateInvoiceRefundRequest$outboundSchema.parse(createInvoiceRefundRequest),
73
+ );
74
+ }
@@ -14,6 +14,7 @@ export * from "./createentitlementgrant.js";
14
14
  export * from "./createexternalreference.js";
15
15
  export * from "./createfeature.js";
16
16
  export * from "./createfee.js";
17
+ export * from "./createinvoicerefund.js";
17
18
  export * from "./createitem.js";
18
19
  export * from "./createlineitem.js";
19
20
  export * from "./createpayment.js";
@@ -73,6 +74,7 @@ export * from "./listentitlements.js";
73
74
  export * from "./listexternalreferences.js";
74
75
  export * from "./listfeatures.js";
75
76
  export * from "./listfees.js";
77
+ export * from "./listinvoicerefunds.js";
76
78
  export * from "./listinvoices.js";
77
79
  export * from "./listitems.js";
78
80
  export * from "./listlineitems.js";
@@ -107,3 +109,4 @@ export * from "./updatesubscription.js";
107
109
  export * from "./updateuser.js";
108
110
  export * from "./upsertmerchantintegration.js";
109
111
  export * from "./voidentitlementgrant.js";
112
+ export * from "./voidinvoicerefund.js";
@@ -11,9 +11,17 @@ import * as models from "../index.js";
11
11
 
12
12
  export type ListEntitlementsRequest = {
13
13
  /**
14
- * The unique identifier of the customer to retrieve entitlements for.
14
+ * The Paygentic customer id to retrieve entitlements for. Supply exactly one of `customerId` or `externalCustomerId`. When combined with `merchantId`, the customer must belong to that merchant or the request resolves to not found.
15
15
  */
16
- customerId: string;
16
+ customerId?: string | undefined;
17
+ /**
18
+ * The merchant's own external customer reference (`Customer.externalId`, exact match), used to retrieve entitlements without first resolving it to a `cus_` id. Matches the `externalId` filter on `GET /v1/customers` (plain string, exact match — no pattern constraint, so any stored `externalId` is addressable). Supply exactly one of `customerId` or `externalCustomerId`. `externalId` is unique only within a merchant, so an effective merchant scope is required: either pass `merchantId`, or authenticate with a single-merchant API key. With no resolvable merchant scope the request is rejected.
19
+ */
20
+ externalCustomerId?: string | undefined;
21
+ /**
22
+ * Optional merchant scope. With `externalCustomerId` it selects the merchant the external id is resolved within (required for the platform key, which has no single merchant). With `customerId` it acts as a tenant guard — the resolved customer must belong to this merchant, otherwise the request resolves to not found. A passed `merchantId` is only a filter and never grants access the caller does not already hold; authorization is always evaluated against the resolved customer's merchant.
23
+ */
24
+ merchantId?: string | undefined;
17
25
  /**
18
26
  * Filter results to a specific feature by its key. When specified, `productId` is also required. Use this to check access to a single feature.
19
27
  */
@@ -62,7 +70,9 @@ export type ListEntitlementsResponse = {
62
70
 
63
71
  /** @internal */
64
72
  export type ListEntitlementsRequest$Outbound = {
65
- customerId: string;
73
+ customerId?: string | undefined;
74
+ externalCustomerId?: string | undefined;
75
+ merchantId?: string | undefined;
66
76
  featureKey?: string | undefined;
67
77
  productId?: string | undefined;
68
78
  subscriptionId?: string | undefined;
@@ -77,7 +87,9 @@ export const ListEntitlementsRequest$outboundSchema: z.ZodType<
77
87
  z.ZodTypeDef,
78
88
  ListEntitlementsRequest
79
89
  > = z.object({
80
- customerId: z.string(),
90
+ customerId: z.string().optional(),
91
+ externalCustomerId: z.string().optional(),
92
+ merchantId: z.string().optional(),
81
93
  featureKey: z.string().optional(),
82
94
  productId: z.string().optional(),
83
95
  subscriptionId: z.string().optional(),
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+
7
+ export type ListInvoiceRefundsRequest = {
8
+ /**
9
+ * The invoice ID
10
+ */
11
+ id: string;
12
+ };
13
+
14
+ /** @internal */
15
+ export type ListInvoiceRefundsRequest$Outbound = {
16
+ id: string;
17
+ };
18
+
19
+ /** @internal */
20
+ export const ListInvoiceRefundsRequest$outboundSchema: z.ZodType<
21
+ ListInvoiceRefundsRequest$Outbound,
22
+ z.ZodTypeDef,
23
+ ListInvoiceRefundsRequest
24
+ > = z.object({
25
+ id: z.string(),
26
+ });
27
+
28
+ export function listInvoiceRefundsRequestToJSON(
29
+ listInvoiceRefundsRequest: ListInvoiceRefundsRequest,
30
+ ): string {
31
+ return JSON.stringify(
32
+ ListInvoiceRefundsRequest$outboundSchema.parse(listInvoiceRefundsRequest),
33
+ );
34
+ }
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ export type VoidInvoiceRefundRequestBody = {
9
+ /**
10
+ * Optional reason for voiding the refund (recorded on the credit note)
11
+ */
12
+ reason?: string | undefined;
13
+ };
14
+
15
+ export type VoidInvoiceRefundRequest = {
16
+ /**
17
+ * The invoice ID
18
+ */
19
+ id: string;
20
+ /**
21
+ * The refund (credit note) ID
22
+ */
23
+ refundId: string;
24
+ requestBody?: VoidInvoiceRefundRequestBody | undefined;
25
+ };
26
+
27
+ /** @internal */
28
+ export type VoidInvoiceRefundRequestBody$Outbound = {
29
+ reason?: string | undefined;
30
+ };
31
+
32
+ /** @internal */
33
+ export const VoidInvoiceRefundRequestBody$outboundSchema: z.ZodType<
34
+ VoidInvoiceRefundRequestBody$Outbound,
35
+ z.ZodTypeDef,
36
+ VoidInvoiceRefundRequestBody
37
+ > = z.object({
38
+ reason: z.string().optional(),
39
+ });
40
+
41
+ export function voidInvoiceRefundRequestBodyToJSON(
42
+ voidInvoiceRefundRequestBody: VoidInvoiceRefundRequestBody,
43
+ ): string {
44
+ return JSON.stringify(
45
+ VoidInvoiceRefundRequestBody$outboundSchema.parse(
46
+ voidInvoiceRefundRequestBody,
47
+ ),
48
+ );
49
+ }
50
+
51
+ /** @internal */
52
+ export type VoidInvoiceRefundRequest$Outbound = {
53
+ id: string;
54
+ refundId: string;
55
+ RequestBody?: VoidInvoiceRefundRequestBody$Outbound | undefined;
56
+ };
57
+
58
+ /** @internal */
59
+ export const VoidInvoiceRefundRequest$outboundSchema: z.ZodType<
60
+ VoidInvoiceRefundRequest$Outbound,
61
+ z.ZodTypeDef,
62
+ VoidInvoiceRefundRequest
63
+ > = z.object({
64
+ id: z.string(),
65
+ refundId: z.string(),
66
+ requestBody: z.lazy(() => VoidInvoiceRefundRequestBody$outboundSchema)
67
+ .optional(),
68
+ }).transform((v) => {
69
+ return remap$(v, {
70
+ requestBody: "RequestBody",
71
+ });
72
+ });
73
+
74
+ export function voidInvoiceRefundRequestToJSON(
75
+ voidInvoiceRefundRequest: VoidInvoiceRefundRequest,
76
+ ): string {
77
+ return JSON.stringify(
78
+ VoidInvoiceRefundRequest$outboundSchema.parse(voidInvoiceRefundRequest),
79
+ );
80
+ }
@@ -33,9 +33,17 @@ export type RevenueSummaryResponse = {
33
33
  */
34
34
  object: "revenue_summary";
35
35
  /**
36
- * Net collected revenue in dollars (paid invoices + completed payments). Omitted when groupBy=currency is active.
36
+ * Net collected revenue in dollars (paid invoices + completed payments), already net of non-voided refunds. Omitted when groupBy=currency is active.
37
37
  */
38
38
  netRevenue?: string | undefined;
39
+ /**
40
+ * Gross total of non-voided refunds (credit notes) issued in the period, in dollars. Already subtracted from netRevenue and invoice totals. Omitted when groupBy=currency is active.
41
+ */
42
+ totalRefunds?: string | undefined;
43
+ /**
44
+ * Number of non-voided refunds (credit notes) issued in the period. Omitted when groupBy=currency is active.
45
+ */
46
+ refundCount?: number | undefined;
39
47
  invoices?: InvoiceSummary | undefined;
40
48
  payments?: PaymentSummary | undefined;
41
49
  /**
@@ -60,6 +68,8 @@ export const RevenueSummaryResponse$inboundSchema: z.ZodType<
60
68
  > = z.object({
61
69
  object: z.literal("revenue_summary"),
62
70
  netRevenue: z.string().optional(),
71
+ totalRefunds: z.string().optional(),
72
+ refundCount: z.number().optional(),
63
73
  invoices: InvoiceSummary$inboundSchema.optional(),
64
74
  payments: PaymentSummary$inboundSchema.optional(),
65
75
  trend: z.array(RevenueTrendBucket$inboundSchema).optional(),
@@ -28,7 +28,7 @@ export class Entitlements extends ClientSDK {
28
28
  * For metered entitlements, each item carries live balance/usage fields, which the API resolves with one grant-engine balance lookup per metered item (bounded concurrency, up to `limit` items per page).
29
29
  */
30
30
  async list(
31
- request: operations.ListEntitlementsRequest,
31
+ request?: operations.ListEntitlementsRequest | undefined,
32
32
  options?: RequestOptions,
33
33
  ): Promise<operations.ListEntitlementsResponse> {
34
34
  return unwrapAsync(entitlementsList(
@@ -2,11 +2,14 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { invoicesV2CreateInvoiceRefund } from "../funcs/invoicesV2CreateInvoiceRefund.js";
5
6
  import { invoicesV2CreateLineItem } from "../funcs/invoicesV2CreateLineItem.js";
6
7
  import { invoicesV2Get } from "../funcs/invoicesV2Get.js";
7
8
  import { invoicesV2GetLineItems } from "../funcs/invoicesV2GetLineItems.js";
8
9
  import { invoicesV2List } from "../funcs/invoicesV2List.js";
10
+ import { invoicesV2ListInvoiceRefunds } from "../funcs/invoicesV2ListInvoiceRefunds.js";
9
11
  import { invoicesV2ListLineItems } from "../funcs/invoicesV2ListLineItems.js";
12
+ import { invoicesV2VoidInvoiceRefund } from "../funcs/invoicesV2VoidInvoiceRefund.js";
10
13
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
11
14
  import * as models from "../models/index.js";
12
15
  import * as operations from "../models/operations/index.js";
@@ -97,4 +100,55 @@ export class InvoicesV2 extends ClientSDK {
97
100
  options,
98
101
  ));
99
102
  }
103
+
104
+ /**
105
+ * Refund Invoice
106
+ *
107
+ * @remarks
108
+ * Issue a full refund against a paid invoice by creating a credit note. The invoice stays PAID; the refund is recorded as a child credit note. Accessible to the owning merchant or platform operators. Only works for invoices in PAID status that have not already been refunded. Full refund only — the entire invoice (subtotal + tax) is credited.
109
+ */
110
+ async createInvoiceRefund(
111
+ request: operations.CreateInvoiceRefundRequest,
112
+ options?: RequestOptions,
113
+ ): Promise<models.InvoiceRefund> {
114
+ return unwrapAsync(invoicesV2CreateInvoiceRefund(
115
+ this,
116
+ request,
117
+ options,
118
+ ));
119
+ }
120
+
121
+ /**
122
+ * List Invoice Refunds
123
+ *
124
+ * @remarks
125
+ * List the credit notes (refunds) recorded against an invoice. Accessible to the owning merchant or platform operators.
126
+ */
127
+ async listInvoiceRefunds(
128
+ request: operations.ListInvoiceRefundsRequest,
129
+ options?: RequestOptions,
130
+ ): Promise<models.InvoiceRefundList> {
131
+ return unwrapAsync(invoicesV2ListInvoiceRefunds(
132
+ this,
133
+ request,
134
+ options,
135
+ ));
136
+ }
137
+
138
+ /**
139
+ * Void Invoice Refund
140
+ *
141
+ * @remarks
142
+ * Void a previously-issued refund (credit note). Reverses the credit note in the tax provider and excludes it from revenue. Accessible to the owning merchant or platform operators.
143
+ */
144
+ async voidInvoiceRefund(
145
+ request: operations.VoidInvoiceRefundRequest,
146
+ options?: RequestOptions,
147
+ ): Promise<models.InvoiceRefund> {
148
+ return unwrapAsync(invoicesV2VoidInvoiceRefund(
149
+ this,
150
+ request,
151
+ options,
152
+ ));
153
+ }
100
154
  }