@flexprice/sdk 2.1.35 → 2.1.36

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 (199) hide show
  1. package/docs/sdk/models/add-addon-ref.md +1 -0
  2. package/docs/sdk/models/add-addon-request.md +1 -0
  3. package/docs/sdk/models/add-addon-to-subscription-request.md +1 -0
  4. package/docs/sdk/models/coupon-ref.md +19 -0
  5. package/docs/sdk/models/create-credit-grant-request.md +1 -0
  6. package/docs/sdk/models/create-customer-request.md +6 -0
  7. package/docs/sdk/models/create-scheduled-task-request.md +1 -1
  8. package/docs/sdk/models/customer-contact-person.md +25 -0
  9. package/docs/sdk/models/customer-response.md +1 -0
  10. package/docs/sdk/models/customer.md +1 -0
  11. package/docs/sdk/models/external-tax-details.md +25 -0
  12. package/docs/sdk/models/line-item-change.md +1 -0
  13. package/docs/sdk/models/modify-subscription-line-item.md +1 -0
  14. package/docs/sdk/models/scheduled-task-entity-type.md +1 -1
  15. package/docs/sdk/models/tax-applied-response.md +5 -1
  16. package/docs/sdk/models/tax-exemption-reason-code.md +2 -2
  17. package/docs/sdk/models/tax-jurisdiction.md +18 -0
  18. package/docs/sdk/models/tax-provider.md +17 -0
  19. package/docs/sdk/models/tax-rate-entity-type.md +1 -1
  20. package/docs/sdk/models/tax-reversal-mode.md +17 -0
  21. package/docs/sdk/models/tax-reversal.md +16 -0
  22. package/docs/sdk/models/tax-transaction-type.md +17 -0
  23. package/docs/sdk/models/top-up-coupon.md +17 -0
  24. package/docs/sdk/models/top-up-wallet-request.md +1 -0
  25. package/docs/sdk/models/update-customer-request-request.md +7 -1
  26. package/docs/sdk/models/update-customer-request.md +4 -1
  27. package/docs/sdk/models/wallet-transaction-response.md +3 -0
  28. package/docs/sdk/models/wallet-tx-consumption.md +16 -0
  29. package/docs/sdk/models/wallet-tx-source-type.md +15 -0
  30. package/docs/sdk/models/webhook-dto-invoice-line-item.md +1 -0
  31. package/docs/sdk/models/webhook-dto-invoice.md +1 -0
  32. package/docs/sdk/models/webhook-dto-tax-applied.md +3 -0
  33. package/docs/sdk/models/webhook-dto-wallet-transaction.md +3 -0
  34. package/docs/sdks/customers/README.md +8 -2
  35. package/esm/lib/config.d.ts +3 -3
  36. package/esm/lib/config.js +3 -3
  37. package/esm/sdk/models/add-addon-ref.d.ts +3 -0
  38. package/esm/sdk/models/add-addon-ref.d.ts.map +1 -1
  39. package/esm/sdk/models/add-addon-ref.js +2 -0
  40. package/esm/sdk/models/add-addon-ref.js.map +1 -1
  41. package/esm/sdk/models/add-addon-request.d.ts +6 -0
  42. package/esm/sdk/models/add-addon-request.d.ts.map +1 -1
  43. package/esm/sdk/models/add-addon-request.js +2 -0
  44. package/esm/sdk/models/add-addon-request.js.map +1 -1
  45. package/esm/sdk/models/add-addon-to-subscription-request.d.ts +6 -0
  46. package/esm/sdk/models/add-addon-to-subscription-request.d.ts.map +1 -1
  47. package/esm/sdk/models/add-addon-to-subscription-request.js +2 -0
  48. package/esm/sdk/models/add-addon-to-subscription-request.js.map +1 -1
  49. package/esm/sdk/models/coupon-ref.d.ts +20 -0
  50. package/esm/sdk/models/coupon-ref.d.ts.map +1 -0
  51. package/esm/sdk/models/coupon-ref.js +25 -0
  52. package/esm/sdk/models/coupon-ref.js.map +1 -0
  53. package/esm/sdk/models/create-credit-grant-request.d.ts +3 -0
  54. package/esm/sdk/models/create-credit-grant-request.d.ts.map +1 -1
  55. package/esm/sdk/models/create-credit-grant-request.js +3 -0
  56. package/esm/sdk/models/create-credit-grant-request.js.map +1 -1
  57. package/esm/sdk/models/create-customer-request.d.ts +6 -0
  58. package/esm/sdk/models/create-customer-request.d.ts.map +1 -1
  59. package/esm/sdk/models/create-customer-request.js +3 -0
  60. package/esm/sdk/models/create-customer-request.js.map +1 -1
  61. package/esm/sdk/models/customer-contact-person.d.ts +33 -0
  62. package/esm/sdk/models/customer-contact-person.d.ts.map +1 -0
  63. package/esm/sdk/models/customer-contact-person.js +50 -0
  64. package/esm/sdk/models/customer-contact-person.js.map +1 -0
  65. package/esm/sdk/models/customer-response.d.ts +2 -0
  66. package/esm/sdk/models/customer-response.d.ts.map +1 -1
  67. package/esm/sdk/models/customer-response.js +3 -0
  68. package/esm/sdk/models/customer-response.js.map +1 -1
  69. package/esm/sdk/models/customer.d.ts +2 -0
  70. package/esm/sdk/models/customer.d.ts.map +1 -1
  71. package/esm/sdk/models/customer.js +3 -0
  72. package/esm/sdk/models/customer.js.map +1 -1
  73. package/esm/sdk/models/external-tax-details.d.ts +66 -0
  74. package/esm/sdk/models/external-tax-details.d.ts.map +1 -0
  75. package/esm/sdk/models/external-tax-details.js +36 -0
  76. package/esm/sdk/models/external-tax-details.js.map +1 -0
  77. package/esm/sdk/models/index.d.ts +11 -0
  78. package/esm/sdk/models/index.d.ts.map +1 -1
  79. package/esm/sdk/models/index.js +11 -0
  80. package/esm/sdk/models/index.js.map +1 -1
  81. package/esm/sdk/models/line-item-change.d.ts +6 -0
  82. package/esm/sdk/models/line-item-change.d.ts.map +1 -1
  83. package/esm/sdk/models/line-item-change.js +2 -0
  84. package/esm/sdk/models/line-item-change.js.map +1 -1
  85. package/esm/sdk/models/modify-subscription-line-item.d.ts +3 -0
  86. package/esm/sdk/models/modify-subscription-line-item.d.ts.map +1 -1
  87. package/esm/sdk/models/modify-subscription-line-item.js +2 -0
  88. package/esm/sdk/models/modify-subscription-line-item.js.map +1 -1
  89. package/esm/sdk/models/scheduled-task-entity-type.d.ts +1 -0
  90. package/esm/sdk/models/scheduled-task-entity-type.d.ts.map +1 -1
  91. package/esm/sdk/models/scheduled-task-entity-type.js +1 -0
  92. package/esm/sdk/models/scheduled-task-entity-type.js.map +1 -1
  93. package/esm/sdk/models/tax-applied-response.d.ts +13 -0
  94. package/esm/sdk/models/tax-applied-response.d.ts.map +1 -1
  95. package/esm/sdk/models/tax-applied-response.js +10 -0
  96. package/esm/sdk/models/tax-applied-response.js.map +1 -1
  97. package/esm/sdk/models/tax-exemption-reason-code.d.ts +4 -0
  98. package/esm/sdk/models/tax-exemption-reason-code.d.ts.map +1 -1
  99. package/esm/sdk/models/tax-exemption-reason-code.js +4 -0
  100. package/esm/sdk/models/tax-exemption-reason-code.js.map +1 -1
  101. package/esm/sdk/models/tax-jurisdiction.d.ts +13 -0
  102. package/esm/sdk/models/tax-jurisdiction.d.ts.map +1 -0
  103. package/esm/sdk/models/tax-jurisdiction.js +22 -0
  104. package/esm/sdk/models/tax-jurisdiction.js.map +1 -0
  105. package/esm/sdk/models/tax-provider.d.ts +10 -0
  106. package/esm/sdk/models/tax-provider.d.ts.map +1 -0
  107. package/esm/sdk/models/tax-provider.js +11 -0
  108. package/esm/sdk/models/tax-provider.js.map +1 -0
  109. package/esm/sdk/models/tax-rate-entity-type.d.ts +1 -0
  110. package/esm/sdk/models/tax-rate-entity-type.d.ts.map +1 -1
  111. package/esm/sdk/models/tax-rate-entity-type.js +1 -0
  112. package/esm/sdk/models/tax-rate-entity-type.js.map +1 -1
  113. package/esm/sdk/models/tax-reversal-mode.d.ts +10 -0
  114. package/esm/sdk/models/tax-reversal-mode.d.ts.map +1 -0
  115. package/esm/sdk/models/tax-reversal-mode.js +11 -0
  116. package/esm/sdk/models/tax-reversal-mode.js.map +1 -0
  117. package/esm/sdk/models/tax-reversal.d.ts +12 -0
  118. package/esm/sdk/models/tax-reversal.d.ts.map +1 -0
  119. package/esm/sdk/models/tax-reversal.js +22 -0
  120. package/esm/sdk/models/tax-reversal.js.map +1 -0
  121. package/esm/sdk/models/tax-transaction-type.d.ts +10 -0
  122. package/esm/sdk/models/tax-transaction-type.d.ts.map +1 -0
  123. package/esm/sdk/models/tax-transaction-type.js +11 -0
  124. package/esm/sdk/models/tax-transaction-type.js.map +1 -0
  125. package/esm/sdk/models/top-up-coupon.d.ts +12 -0
  126. package/esm/sdk/models/top-up-coupon.d.ts.map +1 -0
  127. package/esm/sdk/models/top-up-coupon.js +17 -0
  128. package/esm/sdk/models/top-up-coupon.js.map +1 -0
  129. package/esm/sdk/models/top-up-wallet-request.d.ts +3 -0
  130. package/esm/sdk/models/top-up-wallet-request.d.ts.map +1 -1
  131. package/esm/sdk/models/top-up-wallet-request.js +2 -0
  132. package/esm/sdk/models/top-up-wallet-request.js.map +1 -1
  133. package/esm/sdk/models/update-customer-request.d.ts +6 -0
  134. package/esm/sdk/models/update-customer-request.d.ts.map +1 -1
  135. package/esm/sdk/models/update-customer-request.js +3 -0
  136. package/esm/sdk/models/update-customer-request.js.map +1 -1
  137. package/esm/sdk/models/wallet-transaction-response.d.ts +8 -0
  138. package/esm/sdk/models/wallet-transaction-response.d.ts.map +1 -1
  139. package/esm/sdk/models/wallet-transaction-response.js +8 -0
  140. package/esm/sdk/models/wallet-transaction-response.js.map +1 -1
  141. package/esm/sdk/models/wallet-tx-consumption.d.ts +11 -0
  142. package/esm/sdk/models/wallet-tx-consumption.d.ts.map +1 -0
  143. package/esm/sdk/models/wallet-tx-consumption.js +20 -0
  144. package/esm/sdk/models/wallet-tx-consumption.js.map +1 -0
  145. package/esm/sdk/models/wallet-tx-source-type.d.ts +9 -0
  146. package/esm/sdk/models/wallet-tx-source-type.d.ts.map +1 -0
  147. package/esm/sdk/models/wallet-tx-source-type.js +10 -0
  148. package/esm/sdk/models/wallet-tx-source-type.js.map +1 -0
  149. package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts +2 -0
  150. package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts.map +1 -1
  151. package/esm/sdk/models/webhook-dto-invoice-line-item.js +3 -0
  152. package/esm/sdk/models/webhook-dto-invoice-line-item.js.map +1 -1
  153. package/esm/sdk/models/webhook-dto-invoice.d.ts +2 -0
  154. package/esm/sdk/models/webhook-dto-invoice.d.ts.map +1 -1
  155. package/esm/sdk/models/webhook-dto-invoice.js +3 -0
  156. package/esm/sdk/models/webhook-dto-invoice.js.map +1 -1
  157. package/esm/sdk/models/webhook-dto-tax-applied.d.ts +6 -0
  158. package/esm/sdk/models/webhook-dto-tax-applied.d.ts.map +1 -1
  159. package/esm/sdk/models/webhook-dto-tax-applied.js +8 -0
  160. package/esm/sdk/models/webhook-dto-tax-applied.js.map +1 -1
  161. package/esm/sdk/models/webhook-dto-wallet-transaction.d.ts +5 -0
  162. package/esm/sdk/models/webhook-dto-wallet-transaction.d.ts.map +1 -1
  163. package/esm/sdk/models/webhook-dto-wallet-transaction.js +8 -0
  164. package/esm/sdk/models/webhook-dto-wallet-transaction.js.map +1 -1
  165. package/jsr.json +1 -1
  166. package/package.json +1 -1
  167. package/src/lib/config.ts +3 -3
  168. package/src/sdk/models/add-addon-ref.ts +8 -0
  169. package/src/sdk/models/add-addon-request.ts +11 -0
  170. package/src/sdk/models/add-addon-to-subscription-request.ts +11 -0
  171. package/src/sdk/models/coupon-ref.ts +50 -0
  172. package/src/sdk/models/create-credit-grant-request.ts +8 -0
  173. package/src/sdk/models/create-customer-request.ts +12 -0
  174. package/src/sdk/models/customer-contact-person.ts +101 -0
  175. package/src/sdk/models/customer-response.ts +9 -0
  176. package/src/sdk/models/customer.ts +9 -0
  177. package/src/sdk/models/external-tax-details.ts +113 -0
  178. package/src/sdk/models/index.ts +11 -0
  179. package/src/sdk/models/line-item-change.ts +11 -0
  180. package/src/sdk/models/modify-subscription-line-item.ts +8 -0
  181. package/src/sdk/models/scheduled-task-entity-type.ts +1 -0
  182. package/src/sdk/models/tax-applied-response.ts +26 -0
  183. package/src/sdk/models/tax-exemption-reason-code.ts +4 -0
  184. package/src/sdk/models/tax-jurisdiction.ts +45 -0
  185. package/src/sdk/models/tax-provider.ts +17 -0
  186. package/src/sdk/models/tax-rate-entity-type.ts +1 -0
  187. package/src/sdk/models/tax-reversal-mode.ts +19 -0
  188. package/src/sdk/models/tax-reversal.ts +43 -0
  189. package/src/sdk/models/tax-transaction-type.ts +19 -0
  190. package/src/sdk/models/top-up-coupon.ts +34 -0
  191. package/src/sdk/models/top-up-wallet-request.ts +8 -0
  192. package/src/sdk/models/update-customer-request.ts +12 -0
  193. package/src/sdk/models/wallet-transaction-response.ts +22 -0
  194. package/src/sdk/models/wallet-tx-consumption.ts +41 -0
  195. package/src/sdk/models/wallet-tx-source-type.ts +16 -0
  196. package/src/sdk/models/webhook-dto-invoice-line-item.ts +4 -0
  197. package/src/sdk/models/webhook-dto-invoice.ts +4 -0
  198. package/src/sdk/models/webhook-dto-tax-applied.ts +17 -0
  199. package/src/sdk/models/webhook-dto-wallet-transaction.ts +19 -0
@@ -7,9 +7,14 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import * as types from "../../types/primitives.js";
10
+ import {
11
+ ExternalTaxDetails,
12
+ ExternalTaxDetails$inboundSchema,
13
+ } from "./external-tax-details.js";
10
14
  import { SDKValidationError } from "./sdk-validation-error.js";
11
15
  import { Status, Status$inboundSchema } from "./status.js";
12
16
  import { TaxBehavior, TaxBehavior$inboundSchema } from "./tax-behavior.js";
17
+ import { TaxProvider, TaxProvider$inboundSchema } from "./tax-provider.js";
13
18
  import {
14
19
  TaxRateEntityType,
15
20
  TaxRateEntityType$inboundSchema,
@@ -18,6 +23,10 @@ import {
18
23
  TaxRateResponse,
19
24
  TaxRateResponse$inboundSchema,
20
25
  } from "./tax-rate-response.js";
26
+ import {
27
+ TaxTransactionType,
28
+ TaxTransactionType$inboundSchema,
29
+ } from "./tax-transaction-type.js";
21
30
 
22
31
  export type TaxAppliedResponse = {
23
32
  appliedAt?: Date | undefined;
@@ -27,15 +36,25 @@ export type TaxAppliedResponse = {
27
36
  entityId?: string | undefined;
28
37
  entityType?: TaxRateEntityType | undefined;
29
38
  environmentId?: string | undefined;
39
+ externalTaxDetails?: ExternalTaxDetails | undefined;
30
40
  id?: string | undefined;
31
41
  idempotencyKey?: string | undefined;
32
42
  metadata?: { [k: string]: string } | undefined;
43
+ provider?: TaxProvider | undefined;
33
44
  status?: Status | undefined;
34
45
  taxAmount?: string | undefined;
35
46
  taxAssociationId?: string | undefined;
36
47
  taxBehavior?: TaxBehavior | undefined;
37
48
  taxRate?: TaxRateResponse | undefined;
49
+ /**
50
+ * Null when an external engine calculated the tax: there is no Flexprice rate to point at.
51
+ */
38
52
  taxRateId?: string | undefined;
53
+ /**
54
+ * TaxTransactionID is the provider transaction recording the filed tax, stamped at commit.
55
+ */
56
+ taxTransactionId?: string | undefined;
57
+ taxTransactionType?: TaxTransactionType | undefined;
39
58
  taxableAmount?: string | undefined;
40
59
  tenantId?: string | undefined;
41
60
  updatedAt?: Date | undefined;
@@ -55,15 +74,19 @@ export const TaxAppliedResponse$inboundSchema: z.ZodMiniType<
55
74
  entity_id: types.optional(types.string()),
56
75
  entity_type: types.optional(TaxRateEntityType$inboundSchema),
57
76
  environment_id: types.optional(types.string()),
77
+ external_tax_details: types.optional(ExternalTaxDetails$inboundSchema),
58
78
  id: types.optional(types.string()),
59
79
  idempotency_key: types.optional(types.string()),
60
80
  metadata: types.optional(z.record(z.string(), types.string())),
81
+ provider: types.optional(TaxProvider$inboundSchema),
61
82
  status: types.optional(Status$inboundSchema),
62
83
  tax_amount: types.optional(types.string()),
63
84
  tax_association_id: types.optional(types.string()),
64
85
  tax_behavior: types.optional(TaxBehavior$inboundSchema),
65
86
  tax_rate: types.optional(TaxRateResponse$inboundSchema),
66
87
  tax_rate_id: types.optional(types.string()),
88
+ tax_transaction_id: types.optional(types.string()),
89
+ tax_transaction_type: types.optional(TaxTransactionType$inboundSchema),
67
90
  taxable_amount: types.optional(types.string()),
68
91
  tenant_id: types.optional(types.string()),
69
92
  updated_at: types.optional(types.date()),
@@ -77,12 +100,15 @@ export const TaxAppliedResponse$inboundSchema: z.ZodMiniType<
77
100
  "entity_id": "entityId",
78
101
  "entity_type": "entityType",
79
102
  "environment_id": "environmentId",
103
+ "external_tax_details": "externalTaxDetails",
80
104
  "idempotency_key": "idempotencyKey",
81
105
  "tax_amount": "taxAmount",
82
106
  "tax_association_id": "taxAssociationId",
83
107
  "tax_behavior": "taxBehavior",
84
108
  "tax_rate": "taxRate",
85
109
  "tax_rate_id": "taxRateId",
110
+ "tax_transaction_id": "taxTransactionId",
111
+ "tax_transaction_type": "taxTransactionType",
86
112
  "taxable_amount": "taxableAmount",
87
113
  "tenant_id": "tenantId",
88
114
  "updated_at": "updatedAt",
@@ -9,6 +9,10 @@ import { OpenEnum } from "../../types/enums.js";
9
9
  export const TaxExemptionReasonCode = {
10
10
  CustomerExempt: "customer_exempt",
11
11
  NoTaxConfigured: "no_tax_configured",
12
+ ReverseCharge: "reverse_charge",
13
+ NotCollecting: "not_collecting",
14
+ NotSubjectToTax: "not_subject_to_tax",
15
+ NotSupported: "not_supported",
12
16
  } as const;
13
17
  export type TaxExemptionReasonCode = OpenEnum<typeof TaxExemptionReasonCode>;
14
18
 
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+
12
+ export type TaxJurisdiction = {
13
+ country?: string | undefined;
14
+ displayName?: string | undefined;
15
+ level?: string | undefined;
16
+ state?: string | undefined;
17
+ };
18
+
19
+ /** @internal */
20
+ export const TaxJurisdiction$inboundSchema: z.ZodMiniType<
21
+ TaxJurisdiction,
22
+ unknown
23
+ > = z.pipe(
24
+ z.object({
25
+ country: types.optional(types.string()),
26
+ display_name: types.optional(types.string()),
27
+ level: types.optional(types.string()),
28
+ state: types.optional(types.string()),
29
+ }),
30
+ z.transform((v) => {
31
+ return remap$(v, {
32
+ "display_name": "displayName",
33
+ });
34
+ }),
35
+ );
36
+
37
+ export function taxJurisdictionFromJSON(
38
+ jsonString: string,
39
+ ): SafeParseResult<TaxJurisdiction, SDKValidationError> {
40
+ return safeParse(
41
+ jsonString,
42
+ (x) => TaxJurisdiction$inboundSchema.parse(JSON.parse(x)),
43
+ `Failed to parse 'TaxJurisdiction' from JSON`,
44
+ );
45
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import * as openEnums from "../../types/enums.js";
7
+ import { OpenEnum } from "../../types/enums.js";
8
+
9
+ export const TaxProvider = {
10
+ Flexprice: "flexprice",
11
+ Stripe: "stripe",
12
+ } as const;
13
+ export type TaxProvider = OpenEnum<typeof TaxProvider>;
14
+
15
+ /** @internal */
16
+ export const TaxProvider$inboundSchema: z.ZodMiniType<TaxProvider, unknown> =
17
+ openEnums.inboundSchema(TaxProvider);
@@ -11,6 +11,7 @@ export const TaxRateEntityType = {
11
11
  Subscription: "subscription",
12
12
  Invoice: "invoice",
13
13
  Tenant: "tenant",
14
+ CreditNote: "credit_note",
14
15
  } as const;
15
16
  export type TaxRateEntityType = OpenEnum<typeof TaxRateEntityType>;
16
17
 
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import * as openEnums from "../../types/enums.js";
7
+ import { OpenEnum } from "../../types/enums.js";
8
+
9
+ export const TaxReversalMode = {
10
+ Full: "full",
11
+ Partial: "partial",
12
+ } as const;
13
+ export type TaxReversalMode = OpenEnum<typeof TaxReversalMode>;
14
+
15
+ /** @internal */
16
+ export const TaxReversalMode$inboundSchema: z.ZodMiniType<
17
+ TaxReversalMode,
18
+ unknown
19
+ > = openEnums.inboundSchema(TaxReversalMode);
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+ import {
12
+ TaxReversalMode,
13
+ TaxReversalMode$inboundSchema,
14
+ } from "./tax-reversal-mode.js";
15
+
16
+ export type TaxReversal = {
17
+ mode?: TaxReversalMode | undefined;
18
+ originalTransaction?: string | undefined;
19
+ };
20
+
21
+ /** @internal */
22
+ export const TaxReversal$inboundSchema: z.ZodMiniType<TaxReversal, unknown> = z
23
+ .pipe(
24
+ z.object({
25
+ mode: types.optional(TaxReversalMode$inboundSchema),
26
+ original_transaction: types.optional(types.string()),
27
+ }),
28
+ z.transform((v) => {
29
+ return remap$(v, {
30
+ "original_transaction": "originalTransaction",
31
+ });
32
+ }),
33
+ );
34
+
35
+ export function taxReversalFromJSON(
36
+ jsonString: string,
37
+ ): SafeParseResult<TaxReversal, SDKValidationError> {
38
+ return safeParse(
39
+ jsonString,
40
+ (x) => TaxReversal$inboundSchema.parse(JSON.parse(x)),
41
+ `Failed to parse 'TaxReversal' from JSON`,
42
+ );
43
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import * as openEnums from "../../types/enums.js";
7
+ import { OpenEnum } from "../../types/enums.js";
8
+
9
+ export const TaxTransactionType = {
10
+ Filing: "filing",
11
+ Reversal: "reversal",
12
+ } as const;
13
+ export type TaxTransactionType = OpenEnum<typeof TaxTransactionType>;
14
+
15
+ /** @internal */
16
+ export const TaxTransactionType$inboundSchema: z.ZodMiniType<
17
+ TaxTransactionType,
18
+ unknown
19
+ > = openEnums.inboundSchema(TaxTransactionType);
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ export type TopUpCoupon = {
9
+ couponCode: string;
10
+ };
11
+
12
+ /** @internal */
13
+ export type TopUpCoupon$Outbound = {
14
+ coupon_code: string;
15
+ };
16
+
17
+ /** @internal */
18
+ export const TopUpCoupon$outboundSchema: z.ZodMiniType<
19
+ TopUpCoupon$Outbound,
20
+ TopUpCoupon
21
+ > = z.pipe(
22
+ z.object({
23
+ couponCode: z.string(),
24
+ }),
25
+ z.transform((v) => {
26
+ return remap$(v, {
27
+ couponCode: "coupon_code",
28
+ });
29
+ }),
30
+ );
31
+
32
+ export function topUpCouponToJSON(topUpCoupon: TopUpCoupon): string {
33
+ return JSON.stringify(TopUpCoupon$outboundSchema.parse(topUpCoupon));
34
+ }
@@ -9,6 +9,11 @@ import {
9
9
  CheckoutParams$Outbound,
10
10
  CheckoutParams$outboundSchema,
11
11
  } from "./checkout-params.js";
12
+ import {
13
+ TopUpCoupon,
14
+ TopUpCoupon$Outbound,
15
+ TopUpCoupon$outboundSchema,
16
+ } from "./top-up-coupon.js";
12
17
  import {
13
18
  TransactionReason,
14
19
  TransactionReason$outboundSchema,
@@ -44,6 +49,7 @@ export type TopUpWalletRequest = {
44
49
  */
45
50
  bonusCreditsToAdd?: string | undefined;
46
51
  checkout?: CheckoutParams | undefined;
52
+ coupons?: Array<TopUpCoupon> | undefined;
47
53
  /**
48
54
  * credits_to_add is the number of credits to add to the wallet
49
55
  */
@@ -82,6 +88,7 @@ export type TopUpWalletRequest$Outbound = {
82
88
  bonus_credits_expiry_date_utc?: string | undefined;
83
89
  bonus_credits_to_add?: string | undefined;
84
90
  checkout?: CheckoutParams$Outbound | undefined;
91
+ coupons?: Array<TopUpCoupon$Outbound> | undefined;
85
92
  credits_to_add?: string | undefined;
86
93
  description?: string | undefined;
87
94
  expiry_date_utc?: string | undefined;
@@ -102,6 +109,7 @@ export const TopUpWalletRequest$outboundSchema: z.ZodMiniType<
102
109
  bonusCreditsExpiryDateUtc: z.optional(z.string()),
103
110
  bonusCreditsToAdd: z.optional(z.string()),
104
111
  checkout: z.optional(CheckoutParams$outboundSchema),
112
+ coupons: z.optional(z.array(TopUpCoupon$outboundSchema)),
105
113
  creditsToAdd: z.optional(z.string()),
106
114
  description: z.optional(z.string()),
107
115
  expiryDateUtc: z.optional(z.string()),
@@ -9,6 +9,11 @@ import {
9
9
  CreateEntityIntegrationMappingRequest$Outbound,
10
10
  CreateEntityIntegrationMappingRequest$outboundSchema,
11
11
  } from "./create-entity-integration-mapping-request.js";
12
+ import {
13
+ CustomerContactPerson,
14
+ CustomerContactPerson$Outbound,
15
+ CustomerContactPerson$outboundSchema,
16
+ } from "./customer-contact-person.js";
12
17
  import { TaxTreatment, TaxTreatment$outboundSchema } from "./tax-treatment.js";
13
18
 
14
19
  /**
@@ -47,6 +52,10 @@ export type UpdateCustomerRequest = {
47
52
  * contact is the updated contact number for the customer (e.g. phone)
48
53
  */
49
54
  contact?: string | undefined;
55
+ /**
56
+ * contact_persons replaces the customer's contact persons when provided; at most one may be primary
57
+ */
58
+ contactPersons: Array<CustomerContactPerson>;
50
59
  /**
51
60
  * email is the updated email address and must be a valid email format if provided
52
61
  */
@@ -86,6 +95,7 @@ export type UpdateCustomerRequest$Outbound = {
86
95
  address_state?: string | undefined;
87
96
  billing_currency?: string | undefined;
88
97
  contact?: string | undefined;
98
+ contact_persons: Array<CustomerContactPerson$Outbound>;
89
99
  email?: string | undefined;
90
100
  external_id?: string | undefined;
91
101
  integration_entity_mapping?:
@@ -111,6 +121,7 @@ export const UpdateCustomerRequest$outboundSchema: z.ZodMiniType<
111
121
  addressState: z.optional(z.string()),
112
122
  billingCurrency: z.optional(z.string()),
113
123
  contact: z.optional(z.string()),
124
+ contactPersons: z.array(CustomerContactPerson$outboundSchema),
114
125
  email: z.optional(z.string()),
115
126
  externalId: z.optional(z.string()),
116
127
  integrationEntityMapping: z.optional(
@@ -130,6 +141,7 @@ export const UpdateCustomerRequest$outboundSchema: z.ZodMiniType<
130
141
  addressPostalCode: "address_postal_code",
131
142
  addressState: "address_state",
132
143
  billingCurrency: "billing_currency",
144
+ contactPersons: "contact_persons",
133
145
  externalId: "external_id",
134
146
  integrationEntityMapping: "integration_entity_mapping",
135
147
  taxTreatment: "tax_treatment",
@@ -30,13 +30,25 @@ import {
30
30
  WalletResponse,
31
31
  WalletResponse$inboundSchema,
32
32
  } from "./wallet-response.js";
33
+ import {
34
+ WalletTxConsumption,
35
+ WalletTxConsumption$inboundSchema,
36
+ } from "./wallet-tx-consumption.js";
33
37
  import {
34
38
  WalletTxReferenceType,
35
39
  WalletTxReferenceType$inboundSchema,
36
40
  } from "./wallet-tx-reference-type.js";
41
+ import {
42
+ WalletTxSourceType,
43
+ WalletTxSourceType$inboundSchema,
44
+ } from "./wallet-tx-source-type.js";
37
45
 
38
46
  export type WalletTransactionResponse = {
39
47
  amount?: string | undefined;
48
+ /**
49
+ * ConsumptionBreakdown is set on debits: the credits drawn from each credit batch.
50
+ */
51
+ consumptionBreakdown?: Array<WalletTxConsumption> | undefined;
40
52
  /**
41
53
  * conversion_rate is the conversion rate for the transaction to the currency
42
54
  */
@@ -70,6 +82,8 @@ export type WalletTransactionResponse = {
70
82
  priority?: number | undefined;
71
83
  referenceId?: string | undefined;
72
84
  referenceType?: WalletTxReferenceType | undefined;
85
+ sourceId?: string | undefined;
86
+ sourceType?: WalletTxSourceType | undefined;
73
87
  status?: Status | undefined;
74
88
  tenantId?: string | undefined;
75
89
  /**
@@ -92,6 +106,9 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
92
106
  > = z.pipe(
93
107
  z.object({
94
108
  amount: types.optional(types.string()),
109
+ consumption_breakdown: types.optional(
110
+ z.array(WalletTxConsumption$inboundSchema),
111
+ ),
95
112
  conversion_rate: types.optional(types.string()),
96
113
  created_at: types.optional(types.date()),
97
114
  created_by: types.optional(types.string()),
@@ -113,6 +130,8 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
113
130
  priority: types.optional(types.number()),
114
131
  reference_id: types.optional(types.string()),
115
132
  reference_type: types.optional(WalletTxReferenceType$inboundSchema),
133
+ source_id: types.optional(types.string()),
134
+ source_type: types.optional(WalletTxSourceType$inboundSchema),
116
135
  status: types.optional(Status$inboundSchema),
117
136
  tenant_id: types.optional(types.string()),
118
137
  topup_conversion_rate: types.optional(types.string()),
@@ -126,6 +145,7 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
126
145
  }),
127
146
  z.transform((v) => {
128
147
  return remap$(v, {
148
+ "consumption_breakdown": "consumptionBreakdown",
129
149
  "conversion_rate": "conversionRate",
130
150
  "created_at": "createdAt",
131
151
  "created_by": "createdBy",
@@ -141,6 +161,8 @@ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType<
141
161
  "parent_transaction_id": "parentTransactionId",
142
162
  "reference_id": "referenceId",
143
163
  "reference_type": "referenceType",
164
+ "source_id": "sourceId",
165
+ "source_type": "sourceType",
144
166
  "tenant_id": "tenantId",
145
167
  "topup_conversion_rate": "topupConversionRate",
146
168
  "transaction_reason": "transactionReason",
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+
12
+ export type WalletTxConsumption = {
13
+ creditTransactionId?: string | undefined;
14
+ credits?: string | undefined;
15
+ };
16
+
17
+ /** @internal */
18
+ export const WalletTxConsumption$inboundSchema: z.ZodMiniType<
19
+ WalletTxConsumption,
20
+ unknown
21
+ > = z.pipe(
22
+ z.object({
23
+ credit_transaction_id: types.optional(types.string()),
24
+ credits: types.optional(types.string()),
25
+ }),
26
+ z.transform((v) => {
27
+ return remap$(v, {
28
+ "credit_transaction_id": "creditTransactionId",
29
+ });
30
+ }),
31
+ );
32
+
33
+ export function walletTxConsumptionFromJSON(
34
+ jsonString: string,
35
+ ): SafeParseResult<WalletTxConsumption, SDKValidationError> {
36
+ return safeParse(
37
+ jsonString,
38
+ (x) => WalletTxConsumption$inboundSchema.parse(JSON.parse(x)),
39
+ `Failed to parse 'WalletTxConsumption' from JSON`,
40
+ );
41
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const WalletTxSourceType = {
9
+ Invoice: "INVOICE",
10
+ } as const;
11
+ export type WalletTxSourceType = ClosedEnum<typeof WalletTxSourceType>;
12
+
13
+ /** @internal */
14
+ export const WalletTxSourceType$inboundSchema: z.ZodMiniEnum<
15
+ typeof WalletTxSourceType
16
+ > = z.enum(WalletTxSourceType);
@@ -11,6 +11,7 @@ import {
11
11
  CommitmentInfo,
12
12
  CommitmentInfo$inboundSchema,
13
13
  } from "./commitment-info.js";
14
+ import { FxConversion, FxConversion$inboundSchema } from "./fx-conversion.js";
14
15
  import { SDKValidationError } from "./sdk-validation-error.js";
15
16
 
16
17
  export type WebhookDtoInvoiceLineItem = {
@@ -21,6 +22,7 @@ export type WebhookDtoInvoiceLineItem = {
21
22
  displayName?: string | undefined;
22
23
  entityId?: string | undefined;
23
24
  entityType?: string | undefined;
25
+ fxConversion?: FxConversion | undefined;
24
26
  id?: string | undefined;
25
27
  invoiceLevelDiscount?: string | undefined;
26
28
  lineItemDiscount?: string | undefined;
@@ -52,6 +54,7 @@ export const WebhookDtoInvoiceLineItem$inboundSchema: z.ZodMiniType<
52
54
  display_name: types.optional(types.string()),
53
55
  entity_id: types.optional(types.string()),
54
56
  entity_type: types.optional(types.string()),
57
+ fx_conversion: types.optional(FxConversion$inboundSchema),
55
58
  id: types.optional(types.string()),
56
59
  invoice_level_discount: types.optional(types.string()),
57
60
  line_item_discount: types.optional(types.string()),
@@ -76,6 +79,7 @@ export const WebhookDtoInvoiceLineItem$inboundSchema: z.ZodMiniType<
76
79
  "display_name": "displayName",
77
80
  "entity_id": "entityId",
78
81
  "entity_type": "entityType",
82
+ "fx_conversion": "fxConversion",
79
83
  "invoice_level_discount": "invoiceLevelDiscount",
80
84
  "line_item_discount": "lineItemDiscount",
81
85
  "meter_display_name": "meterDisplayName",
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import * as types from "../../types/primitives.js";
10
+ import { FxConversion, FxConversion$inboundSchema } from "./fx-conversion.js";
10
11
  import {
11
12
  InvoiceStatus,
12
13
  InvoiceStatus$inboundSchema,
@@ -55,6 +56,7 @@ export type WebhookDtoInvoice = {
55
56
  dueDate?: Date | undefined;
56
57
  environmentId?: string | undefined;
57
58
  finalizedAt?: Date | undefined;
59
+ fxConversion?: FxConversion | undefined;
58
60
  id?: string | undefined;
59
61
  idempotencyKey?: string | undefined;
60
62
  invoiceNumber?: string | undefined;
@@ -103,6 +105,7 @@ export const WebhookDtoInvoice$inboundSchema: z.ZodMiniType<
103
105
  due_date: types.optional(types.date()),
104
106
  environment_id: types.optional(types.string()),
105
107
  finalized_at: types.optional(types.date()),
108
+ fx_conversion: types.optional(FxConversion$inboundSchema),
106
109
  id: types.optional(types.string()),
107
110
  idempotency_key: types.optional(types.string()),
108
111
  invoice_number: types.optional(types.string()),
@@ -143,6 +146,7 @@ export const WebhookDtoInvoice$inboundSchema: z.ZodMiniType<
143
146
  "due_date": "dueDate",
144
147
  "environment_id": "environmentId",
145
148
  "finalized_at": "finalizedAt",
149
+ "fx_conversion": "fxConversion",
146
150
  "idempotency_key": "idempotencyKey",
147
151
  "invoice_number": "invoiceNumber",
148
152
  "invoice_pdf_url": "invoicePdfUrl",
@@ -7,8 +7,17 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import * as types from "../../types/primitives.js";
10
+ import {
11
+ ExternalTaxDetails,
12
+ ExternalTaxDetails$inboundSchema,
13
+ } from "./external-tax-details.js";
10
14
  import { SDKValidationError } from "./sdk-validation-error.js";
11
15
  import { TaxBehavior, TaxBehavior$inboundSchema } from "./tax-behavior.js";
16
+ import { TaxProvider, TaxProvider$inboundSchema } from "./tax-provider.js";
17
+ import {
18
+ TaxTransactionType,
19
+ TaxTransactionType$inboundSchema,
20
+ } from "./tax-transaction-type.js";
12
21
  import {
13
22
  WebhookDtoTaxRate,
14
23
  WebhookDtoTaxRate$inboundSchema,
@@ -17,12 +26,15 @@ import {
17
26
  export type WebhookDtoTaxApplied = {
18
27
  appliedAt?: Date | undefined;
19
28
  currency?: string | undefined;
29
+ externalTaxDetails?: ExternalTaxDetails | undefined;
20
30
  id?: string | undefined;
21
31
  metadata?: { [k: string]: string } | undefined;
32
+ provider?: TaxProvider | undefined;
22
33
  taxAmount?: string | undefined;
23
34
  taxBehavior?: TaxBehavior | undefined;
24
35
  taxRate?: WebhookDtoTaxRate | undefined;
25
36
  taxRateId?: string | undefined;
37
+ taxTransactionType?: TaxTransactionType | undefined;
26
38
  taxableAmount?: string | undefined;
27
39
  };
28
40
 
@@ -34,21 +46,26 @@ export const WebhookDtoTaxApplied$inboundSchema: z.ZodMiniType<
34
46
  z.object({
35
47
  applied_at: types.optional(types.date()),
36
48
  currency: types.optional(types.string()),
49
+ external_tax_details: types.optional(ExternalTaxDetails$inboundSchema),
37
50
  id: types.optional(types.string()),
38
51
  metadata: types.optional(z.record(z.string(), types.string())),
52
+ provider: types.optional(TaxProvider$inboundSchema),
39
53
  tax_amount: types.optional(types.string()),
40
54
  tax_behavior: types.optional(TaxBehavior$inboundSchema),
41
55
  tax_rate: types.optional(WebhookDtoTaxRate$inboundSchema),
42
56
  tax_rate_id: types.optional(types.string()),
57
+ tax_transaction_type: types.optional(TaxTransactionType$inboundSchema),
43
58
  taxable_amount: types.optional(types.string()),
44
59
  }),
45
60
  z.transform((v) => {
46
61
  return remap$(v, {
47
62
  "applied_at": "appliedAt",
63
+ "external_tax_details": "externalTaxDetails",
48
64
  "tax_amount": "taxAmount",
49
65
  "tax_behavior": "taxBehavior",
50
66
  "tax_rate": "taxRate",
51
67
  "tax_rate_id": "taxRateId",
68
+ "tax_transaction_type": "taxTransactionType",
52
69
  "taxable_amount": "taxableAmount",
53
70
  });
54
71
  }),