@peable.to/contracts 0.3.0 → 1.0.0

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 (316) hide show
  1. package/dist/cjs/common/address.js +81 -0
  2. package/dist/cjs/common/envelopes.js +101 -0
  3. package/dist/cjs/common/objects.js +85 -0
  4. package/dist/cjs/common/params.js +211 -0
  5. package/dist/cjs/common/primitives.js +39 -0
  6. package/dist/cjs/contributions.js +22 -0
  7. package/dist/cjs/index.js +40 -97
  8. package/dist/cjs/openapi/document.js +297 -0
  9. package/dist/cjs/openapi/index.js +7 -0
  10. package/dist/cjs/openapi/webhooks.js +17 -0
  11. package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
  12. package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
  13. package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
  14. package/dist/cjs/resources/billingEngine/index.js +43 -0
  15. package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
  16. package/dist/cjs/resources/billingEngine/invoices.js +509 -0
  17. package/dist/cjs/resources/billingEngine/params.js +43 -0
  18. package/dist/cjs/resources/billingEngine/public.js +326 -0
  19. package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
  20. package/dist/cjs/resources/catalog/billing.js +755 -0
  21. package/dist/cjs/resources/catalog/billingSettings.js +131 -0
  22. package/dist/cjs/resources/catalog/coupons.js +222 -0
  23. package/dist/cjs/resources/catalog/entitlements.js +257 -0
  24. package/dist/cjs/resources/catalog/index.js +58 -0
  25. package/dist/cjs/resources/catalog/meters.js +279 -0
  26. package/dist/cjs/resources/catalog/prices.js +423 -0
  27. package/dist/cjs/resources/catalog/products.js +228 -0
  28. package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
  29. package/dist/cjs/resources/catalog/shared.js +75 -0
  30. package/dist/cjs/resources/catalog/testClocks.js +127 -0
  31. package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
  32. package/dist/cjs/resources/checkout/contributions.js +172 -0
  33. package/dist/cjs/resources/checkout/files.js +133 -0
  34. package/dist/cjs/resources/checkout/index.js +57 -0
  35. package/dist/cjs/resources/checkout/merchants.js +290 -0
  36. package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
  37. package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
  38. package/dist/cjs/resources/checkout/shared.js +368 -0
  39. package/dist/cjs/resources/connect/account.js +332 -0
  40. package/dist/cjs/resources/connect/applicationFees.js +113 -0
  41. package/dist/cjs/resources/connect/balance.js +212 -0
  42. package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
  43. package/dist/cjs/resources/connect/index.js +51 -0
  44. package/dist/cjs/resources/connect/onboarding.js +82 -0
  45. package/dist/cjs/resources/connect/payouts.js +196 -0
  46. package/dist/cjs/resources/connect/reporting.js +235 -0
  47. package/dist/cjs/resources/connect/requestLogs.js +110 -0
  48. package/dist/cjs/resources/connect/transfers.js +227 -0
  49. package/dist/cjs/resources/core/customers.js +194 -0
  50. package/dist/cjs/resources/core/index.js +23 -0
  51. package/dist/cjs/resources/core/paymentMethods.js +134 -0
  52. package/dist/cjs/resources/events/events.js +357 -0
  53. package/dist/cjs/resources/events/index.js +29 -0
  54. package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
  55. package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
  56. package/dist/cjs/resources/payments/charges.js +157 -0
  57. package/dist/cjs/resources/payments/disputes.js +204 -0
  58. package/dist/cjs/resources/payments/index.js +41 -0
  59. package/dist/cjs/resources/payments/paymentIntents.js +529 -0
  60. package/dist/cjs/resources/payments/refunds.js +245 -0
  61. package/dist/cjs/resources/payments/setupIntents.js +158 -0
  62. package/dist/cjs/resources/payments/social.js +182 -0
  63. package/dist/cjs/resources/payments/testHelpers.js +39 -0
  64. package/dist/cjs/resources/tax/assessments.js +217 -0
  65. package/dist/cjs/resources/tax/businessProfile.js +99 -0
  66. package/dist/cjs/resources/tax/calculations.js +176 -0
  67. package/dist/cjs/resources/tax/capabilities.js +42 -0
  68. package/dist/cjs/resources/tax/codes.js +37 -0
  69. package/dist/cjs/resources/tax/complianceActions.js +56 -0
  70. package/dist/cjs/resources/tax/deadlines.js +59 -0
  71. package/dist/cjs/resources/tax/documents.js +128 -0
  72. package/dist/cjs/resources/tax/index.js +80 -0
  73. package/dist/cjs/resources/tax/locationEvidence.js +131 -0
  74. package/dist/cjs/resources/tax/operatingLocations.js +98 -0
  75. package/dist/cjs/resources/tax/products.js +67 -0
  76. package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
  77. package/dist/cjs/resources/tax/registrations.js +82 -0
  78. package/dist/cjs/resources/tax/reports.js +92 -0
  79. package/dist/cjs/resources/tax/reviewItems.js +116 -0
  80. package/dist/cjs/resources/tax/ruleSet.js +68 -0
  81. package/dist/cjs/resources/tax/salesDestinations.js +94 -0
  82. package/dist/cjs/resources/tax/settings.js +104 -0
  83. package/dist/cjs/resources/tax/shared.js +62 -0
  84. package/dist/cjs/resources/tax/transactions.js +102 -0
  85. package/dist/cjs/route.js +22 -0
  86. package/dist/cjs/routes.js +31 -0
  87. package/dist/cjs/vocabulary/billingPortal.js +15 -0
  88. package/dist/cjs/vocabulary/catalog.js +110 -0
  89. package/dist/cjs/vocabulary/checkout.js +53 -0
  90. package/dist/cjs/vocabulary/connect.js +95 -0
  91. package/dist/cjs/vocabulary/errors.js +174 -0
  92. package/dist/cjs/vocabulary/events.js +176 -0
  93. package/dist/cjs/vocabulary/files.js +44 -0
  94. package/dist/cjs/vocabulary/index.js +37 -0
  95. package/dist/cjs/vocabulary/invoices.js +52 -0
  96. package/dist/cjs/vocabulary/lists.js +22 -0
  97. package/dist/cjs/vocabulary/merchants.js +23 -0
  98. package/dist/cjs/vocabulary/money.js +104 -0
  99. package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
  100. package/dist/cjs/vocabulary/payments.js +195 -0
  101. package/dist/cjs/vocabulary/reporting.js +27 -0
  102. package/dist/cjs/vocabulary/subscriptions.js +60 -0
  103. package/dist/cjs/vocabulary/tax.js +237 -0
  104. package/dist/cjs/vocabulary/version.js +12 -0
  105. package/dist/esm/common/address.js +76 -0
  106. package/dist/esm/common/envelopes.js +95 -0
  107. package/dist/esm/common/objects.js +74 -0
  108. package/dist/esm/common/params.js +203 -0
  109. package/dist/esm/common/primitives.js +35 -0
  110. package/dist/esm/contributions.js +5 -0
  111. package/dist/esm/index.js +26 -94
  112. package/dist/esm/openapi/document.js +294 -0
  113. package/dist/esm/openapi/index.js +2 -0
  114. package/dist/esm/openapi/webhooks.js +14 -0
  115. package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
  116. package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
  117. package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
  118. package/dist/esm/resources/billingEngine/index.js +26 -0
  119. package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
  120. package/dist/esm/resources/billingEngine/invoices.js +506 -0
  121. package/dist/esm/resources/billingEngine/params.js +39 -0
  122. package/dist/esm/resources/billingEngine/public.js +323 -0
  123. package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
  124. package/dist/esm/resources/catalog/billing.js +752 -0
  125. package/dist/esm/resources/catalog/billingSettings.js +128 -0
  126. package/dist/esm/resources/catalog/coupons.js +219 -0
  127. package/dist/esm/resources/catalog/entitlements.js +254 -0
  128. package/dist/esm/resources/catalog/index.js +38 -0
  129. package/dist/esm/resources/catalog/meters.js +276 -0
  130. package/dist/esm/resources/catalog/prices.js +419 -0
  131. package/dist/esm/resources/catalog/products.js +225 -0
  132. package/dist/esm/resources/catalog/promotionCodes.js +171 -0
  133. package/dist/esm/resources/catalog/shared.js +67 -0
  134. package/dist/esm/resources/catalog/testClocks.js +124 -0
  135. package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
  136. package/dist/esm/resources/checkout/contributions.js +167 -0
  137. package/dist/esm/resources/checkout/files.js +130 -0
  138. package/dist/esm/resources/checkout/index.js +25 -0
  139. package/dist/esm/resources/checkout/merchants.js +287 -0
  140. package/dist/esm/resources/checkout/paymentLinks.js +327 -0
  141. package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
  142. package/dist/esm/resources/checkout/shared.js +363 -0
  143. package/dist/esm/resources/connect/account.js +329 -0
  144. package/dist/esm/resources/connect/applicationFees.js +110 -0
  145. package/dist/esm/resources/connect/balance.js +209 -0
  146. package/dist/esm/resources/connect/connectedAccounts.js +257 -0
  147. package/dist/esm/resources/connect/index.js +34 -0
  148. package/dist/esm/resources/connect/onboarding.js +79 -0
  149. package/dist/esm/resources/connect/payouts.js +193 -0
  150. package/dist/esm/resources/connect/reporting.js +232 -0
  151. package/dist/esm/resources/connect/requestLogs.js +107 -0
  152. package/dist/esm/resources/connect/transfers.js +224 -0
  153. package/dist/esm/resources/core/customers.js +191 -0
  154. package/dist/esm/resources/core/index.js +6 -0
  155. package/dist/esm/resources/core/paymentMethods.js +131 -0
  156. package/dist/esm/resources/events/events.js +353 -0
  157. package/dist/esm/resources/events/index.js +12 -0
  158. package/dist/esm/resources/events/webhookDeliveries.js +90 -0
  159. package/dist/esm/resources/events/webhookEndpoints.js +212 -0
  160. package/dist/esm/resources/payments/charges.js +154 -0
  161. package/dist/esm/resources/payments/disputes.js +201 -0
  162. package/dist/esm/resources/payments/index.js +24 -0
  163. package/dist/esm/resources/payments/paymentIntents.js +526 -0
  164. package/dist/esm/resources/payments/refunds.js +242 -0
  165. package/dist/esm/resources/payments/setupIntents.js +155 -0
  166. package/dist/esm/resources/payments/social.js +179 -0
  167. package/dist/esm/resources/payments/testHelpers.js +36 -0
  168. package/dist/esm/resources/tax/assessments.js +214 -0
  169. package/dist/esm/resources/tax/businessProfile.js +96 -0
  170. package/dist/esm/resources/tax/calculations.js +173 -0
  171. package/dist/esm/resources/tax/capabilities.js +39 -0
  172. package/dist/esm/resources/tax/codes.js +34 -0
  173. package/dist/esm/resources/tax/complianceActions.js +53 -0
  174. package/dist/esm/resources/tax/deadlines.js +56 -0
  175. package/dist/esm/resources/tax/documents.js +125 -0
  176. package/dist/esm/resources/tax/index.js +63 -0
  177. package/dist/esm/resources/tax/locationEvidence.js +128 -0
  178. package/dist/esm/resources/tax/operatingLocations.js +95 -0
  179. package/dist/esm/resources/tax/products.js +64 -0
  180. package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
  181. package/dist/esm/resources/tax/registrations.js +79 -0
  182. package/dist/esm/resources/tax/reports.js +89 -0
  183. package/dist/esm/resources/tax/reviewItems.js +113 -0
  184. package/dist/esm/resources/tax/ruleSet.js +65 -0
  185. package/dist/esm/resources/tax/salesDestinations.js +91 -0
  186. package/dist/esm/resources/tax/settings.js +101 -0
  187. package/dist/esm/resources/tax/shared.js +58 -0
  188. package/dist/esm/resources/tax/transactions.js +99 -0
  189. package/dist/esm/route.js +16 -0
  190. package/dist/esm/routes.js +27 -0
  191. package/dist/esm/vocabulary/billingPortal.js +12 -0
  192. package/dist/esm/vocabulary/catalog.js +106 -0
  193. package/dist/esm/vocabulary/checkout.js +50 -0
  194. package/dist/esm/vocabulary/connect.js +92 -0
  195. package/dist/esm/vocabulary/errors.js +169 -0
  196. package/dist/esm/vocabulary/events.js +173 -0
  197. package/dist/esm/vocabulary/files.js +41 -0
  198. package/dist/esm/vocabulary/index.js +21 -0
  199. package/dist/esm/vocabulary/invoices.js +49 -0
  200. package/dist/esm/vocabulary/lists.js +19 -0
  201. package/dist/esm/vocabulary/merchants.js +20 -0
  202. package/dist/esm/vocabulary/money.js +98 -0
  203. package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
  204. package/dist/esm/vocabulary/payments.js +192 -0
  205. package/dist/esm/vocabulary/reporting.js +24 -0
  206. package/dist/esm/vocabulary/subscriptions.js +57 -0
  207. package/dist/esm/vocabulary/tax.js +233 -0
  208. package/dist/esm/vocabulary/version.js +9 -0
  209. package/dist/types/common/address.d.ts +62 -0
  210. package/dist/types/common/envelopes.d.ts +88 -0
  211. package/dist/types/common/objects.d.ts +107 -0
  212. package/dist/types/common/params.d.ts +156 -0
  213. package/dist/types/common/primitives.d.ts +56 -0
  214. package/dist/types/contributions.d.ts +1 -0
  215. package/dist/types/index.d.ts +16 -134
  216. package/dist/types/openapi/document.d.ts +16 -0
  217. package/dist/types/openapi/index.d.ts +2 -0
  218. package/dist/types/openapi/webhooks.d.ts +15 -0
  219. package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
  220. package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
  221. package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
  222. package/dist/types/resources/billingEngine/index.d.ts +6071 -0
  223. package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
  224. package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
  225. package/dist/types/resources/billingEngine/params.d.ts +51 -0
  226. package/dist/types/resources/billingEngine/public.d.ts +1860 -0
  227. package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
  228. package/dist/types/resources/catalog/billing.d.ts +1723 -0
  229. package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
  230. package/dist/types/resources/catalog/coupons.d.ts +403 -0
  231. package/dist/types/resources/catalog/entitlements.d.ts +422 -0
  232. package/dist/types/resources/catalog/index.d.ts +3155 -0
  233. package/dist/types/resources/catalog/meters.d.ts +474 -0
  234. package/dist/types/resources/catalog/prices.d.ts +1091 -0
  235. package/dist/types/resources/catalog/products.d.ts +430 -0
  236. package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
  237. package/dist/types/resources/catalog/shared.d.ts +34 -0
  238. package/dist/types/resources/catalog/testClocks.d.ts +220 -0
  239. package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
  240. package/dist/types/resources/checkout/contributions.d.ts +375 -0
  241. package/dist/types/resources/checkout/files.d.ts +280 -0
  242. package/dist/types/resources/checkout/index.d.ts +5678 -0
  243. package/dist/types/resources/checkout/merchants.d.ts +395 -0
  244. package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
  245. package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
  246. package/dist/types/resources/checkout/shared.d.ts +419 -0
  247. package/dist/types/resources/connect/account.d.ts +483 -0
  248. package/dist/types/resources/connect/applicationFees.d.ts +198 -0
  249. package/dist/types/resources/connect/balance.d.ts +399 -0
  250. package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
  251. package/dist/types/resources/connect/index.d.ts +2094 -0
  252. package/dist/types/resources/connect/onboarding.d.ts +95 -0
  253. package/dist/types/resources/connect/payouts.d.ts +527 -0
  254. package/dist/types/resources/connect/reporting.d.ts +506 -0
  255. package/dist/types/resources/connect/requestLogs.d.ts +236 -0
  256. package/dist/types/resources/connect/transfers.d.ts +436 -0
  257. package/dist/types/resources/core/customers.d.ts +619 -0
  258. package/dist/types/resources/core/index.d.ts +679 -0
  259. package/dist/types/resources/core/paymentMethods.d.ts +336 -0
  260. package/dist/types/resources/events/events.d.ts +731 -0
  261. package/dist/types/resources/events/index.d.ts +1727 -0
  262. package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
  263. package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
  264. package/dist/types/resources/payments/charges.d.ts +390 -0
  265. package/dist/types/resources/payments/disputes.d.ts +822 -0
  266. package/dist/types/resources/payments/index.d.ts +3517 -0
  267. package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
  268. package/dist/types/resources/payments/refunds.d.ts +684 -0
  269. package/dist/types/resources/payments/setupIntents.d.ts +391 -0
  270. package/dist/types/resources/payments/social.d.ts +266 -0
  271. package/dist/types/resources/payments/testHelpers.d.ts +178 -0
  272. package/dist/types/resources/tax/assessments.d.ts +787 -0
  273. package/dist/types/resources/tax/businessProfile.d.ts +134 -0
  274. package/dist/types/resources/tax/calculations.d.ts +261 -0
  275. package/dist/types/resources/tax/capabilities.d.ts +81 -0
  276. package/dist/types/resources/tax/codes.d.ts +29 -0
  277. package/dist/types/resources/tax/complianceActions.d.ts +97 -0
  278. package/dist/types/resources/tax/deadlines.d.ts +133 -0
  279. package/dist/types/resources/tax/documents.d.ts +257 -0
  280. package/dist/types/resources/tax/index.d.ts +1946 -0
  281. package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
  282. package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
  283. package/dist/types/resources/tax/products.d.ts +68 -0
  284. package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
  285. package/dist/types/resources/tax/registrations.d.ts +103 -0
  286. package/dist/types/resources/tax/reports.d.ts +129 -0
  287. package/dist/types/resources/tax/reviewItems.d.ts +226 -0
  288. package/dist/types/resources/tax/ruleSet.d.ts +219 -0
  289. package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
  290. package/dist/types/resources/tax/settings.d.ts +122 -0
  291. package/dist/types/resources/tax/shared.d.ts +43 -0
  292. package/dist/types/resources/tax/transactions.d.ts +404 -0
  293. package/dist/types/route.d.ts +86 -0
  294. package/dist/types/routes.d.ts +23 -0
  295. package/dist/types/vocabulary/billingPortal.d.ts +15 -0
  296. package/dist/types/vocabulary/catalog.d.ts +97 -0
  297. package/dist/types/vocabulary/checkout.d.ts +49 -0
  298. package/dist/types/vocabulary/connect.d.ts +62 -0
  299. package/dist/types/vocabulary/errors.d.ts +145 -0
  300. package/dist/types/vocabulary/events.d.ts +171 -0
  301. package/dist/types/vocabulary/files.d.ts +30 -0
  302. package/dist/types/vocabulary/index.d.ts +17 -0
  303. package/dist/types/vocabulary/invoices.d.ts +39 -0
  304. package/dist/types/vocabulary/lists.d.ts +9 -0
  305. package/dist/types/vocabulary/merchants.d.ts +9 -0
  306. package/dist/types/vocabulary/money.d.ts +59 -0
  307. package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
  308. package/dist/types/vocabulary/payments.d.ts +117 -0
  309. package/dist/types/vocabulary/reporting.d.ts +18 -0
  310. package/dist/types/vocabulary/subscriptions.d.ts +45 -0
  311. package/dist/types/vocabulary/tax.d.ts +163 -0
  312. package/dist/types/vocabulary/version.d.ts +10 -0
  313. package/package.json +51 -11
  314. package/dist/cjs/openapi.js +0 -138
  315. package/dist/esm/openapi.js +0 -134
  316. package/dist/types/openapi.d.ts +0 -145
@@ -0,0 +1,214 @@
1
+ import { z } from 'zod';
2
+ import { listOf } from '../../common/envelopes.js';
3
+ import { defineComponent, defineObject } from '../../common/objects.js';
4
+ import { expandOnlyQuery, listQuery } from '../../common/params.js';
5
+ import { amount, currency, livemode, nullableString, signedAmount, unixSeconds, } from '../../common/primitives.js';
6
+ import { defineRoute } from '../../route.js';
7
+ import { TAX_OBLIGATION_OUTCOMES, TAX_TYPES } from '../../vocabulary/tax.js';
8
+ import { taxCoverageLimitSchema, taxFacts, taxInstantParam, taxRuleSourceSchema, taxState, } from './shared.js';
9
+ /**
10
+ * An assessment (`taxasm_…`, ADR 0020): the recorded facts judged against a
11
+ * VERSIONED rule set at one instant. It stores the version and its exact
12
+ * inputs, so `replay` can re-run them and show the same answer. Every finding
13
+ * goes to the review queue for a person to decide; none activates collection.
14
+ */
15
+ export const taxAssessmentReasonSchema = defineComponent('TaxAssessmentReason', z
16
+ .object({
17
+ code: z.string(),
18
+ message: z.string(),
19
+ evidence: taxFacts.describe('The facts the reason rests on — amounts, counts, ids. Never personal data.'),
20
+ })
21
+ .strict());
22
+ /** Net sales measured against a rule's threshold. */
23
+ export const taxAssessmentMeasuredSchema = defineComponent('TaxAssessmentMeasured', z
24
+ .object({
25
+ amount: signedAmount.describe('Net sales in `currency`: reversals are netted in.'),
26
+ currency,
27
+ transactions: z.number().int().nonnegative(),
28
+ from: unixSeconds,
29
+ to: unixSeconds,
30
+ excluded_currencies: z
31
+ .array(z.string())
32
+ .describe('Sales in other currencies: counted nowhere, named here.'),
33
+ })
34
+ .strict());
35
+ export const taxAssessmentResultSchema = defineComponent('TaxAssessmentResult', z
36
+ .object({
37
+ rule: nullableString.describe('The rule applied, or `null` for an unsupported jurisdiction.'),
38
+ country: nullableString,
39
+ state: taxState,
40
+ tax_type: z.enum(TAX_TYPES).nullable(),
41
+ outcome: z.enum(TAX_OBLIGATION_OUTCOMES),
42
+ reasons: z.array(taxAssessmentReasonSchema),
43
+ measured: taxAssessmentMeasuredSchema
44
+ .nullable()
45
+ .describe('Net sales measured against the threshold, when the rule has one.'),
46
+ threshold: z.object({ amount, currency }).strict().nullable(),
47
+ deadline: z
48
+ .object({
49
+ kind: z.literal('registration'),
50
+ due: unixSeconds,
51
+ source: taxRuleSourceSchema,
52
+ })
53
+ .strict()
54
+ .nullable()
55
+ .describe('A deadline the rule itself sets (a Texas permit after crossing).'),
56
+ coverage_limits: z.array(taxCoverageLimitSchema),
57
+ review_items: z
58
+ .array(z.string())
59
+ .describe('The review items (`taxrev_…`) this result opened or kept open.'),
60
+ })
61
+ .strict());
62
+ const outcomeCount = z.number().int().nonnegative();
63
+ export const taxAssessmentSchema = defineObject('tax.assessment', 'TaxAssessment', z
64
+ .object({
65
+ object: z.literal('tax.assessment'),
66
+ id: z.string().describe('`taxasm_…`.'),
67
+ livemode,
68
+ rule_set_version: z.string(),
69
+ as_of: unixSeconds.describe('The instant the facts were judged at.'),
70
+ inputs_digest: z
71
+ .string()
72
+ .describe('SHA-256 of the canonical inputs — what a replay is checked against.'),
73
+ results: z.array(taxAssessmentResultSchema),
74
+ summary: z
75
+ .object({
76
+ registration_declared: outcomeCount,
77
+ likely_required: outcomeCount,
78
+ approaching_threshold: outcomeCount,
79
+ not_indicated: outcomeCount,
80
+ uncertain: outcomeCount,
81
+ unsupported: outcomeCount,
82
+ })
83
+ .strict()
84
+ .describe('How many results have each outcome.'),
85
+ created_by: z.object({ type: z.enum(['user', 'service']), id: nullableString }).strict(),
86
+ created: unixSeconds,
87
+ })
88
+ .strict(), {
89
+ examples: [
90
+ {
91
+ object: 'tax.assessment',
92
+ id: 'taxasm_0193b8f2c1a87d3e9f4a',
93
+ livemode: false,
94
+ rule_set_version: '2026-11-03.1',
95
+ as_of: 1793750400,
96
+ inputs_digest: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08',
97
+ results: [
98
+ {
99
+ rule: 'us_tx_sales_tax',
100
+ country: 'US',
101
+ state: 'TX',
102
+ tax_type: 'sales_tax',
103
+ outcome: 'approaching_threshold',
104
+ reasons: [
105
+ {
106
+ code: 'approaching_threshold',
107
+ message: 'Texas revenue is at or above 80% of the safe-harbor threshold.',
108
+ evidence: { measured_minor: '41000000', threshold_minor: '50000000' },
109
+ },
110
+ ],
111
+ measured: {
112
+ amount: '41000000',
113
+ currency: 'USD',
114
+ transactions: 812,
115
+ from: 1762041600,
116
+ to: 1793577600,
117
+ excluded_currencies: [],
118
+ },
119
+ threshold: { amount: '50000000', currency: 'USD' },
120
+ deadline: null,
121
+ coverage_limits: [],
122
+ review_items: ['taxrev_0193b8f2c1a87d3e9f4a'],
123
+ },
124
+ ],
125
+ summary: {
126
+ registration_declared: 0,
127
+ likely_required: 0,
128
+ approaching_threshold: 1,
129
+ not_indicated: 0,
130
+ uncertain: 0,
131
+ unsupported: 0,
132
+ },
133
+ created_by: { type: 'service', id: 'app_42' },
134
+ created: 1793750400,
135
+ },
136
+ ],
137
+ });
138
+ /** Re-running a stored assessment's inputs through its own rule set version. */
139
+ export const taxAssessmentReplaySchema = defineObject('tax.assessment_replay', 'TaxAssessmentReplay', z
140
+ .object({
141
+ object: z.literal('tax.assessment_replay'),
142
+ assessment: z.string().describe('The assessment replayed (`taxasm_…`).'),
143
+ rule_set_version: z.string(),
144
+ inputs_digest: z.string(),
145
+ matches: z
146
+ .boolean()
147
+ .describe('`true` when the replayed results are identical to the stored ones.'),
148
+ results: z
149
+ .array(taxAssessmentResultSchema)
150
+ .describe('A replay opens no review items: every `review_items` is empty.'),
151
+ })
152
+ .strict());
153
+ export const createTaxAssessmentParams = z
154
+ .object({
155
+ as_of: taxInstantParam.optional().describe('Unix seconds; default now. Never in the future.'),
156
+ })
157
+ .strict();
158
+ export const listTaxAssessmentsQuery = listQuery({});
159
+ export const taxAssessmentRoutes = [
160
+ defineRoute({
161
+ operationId: 'listTaxAssessments',
162
+ method: 'get',
163
+ path: '/v1/tax/assessments',
164
+ tag: 'Tax compliance',
165
+ summary: 'List assessments',
166
+ auth: 'service',
167
+ scope: 'payments:read',
168
+ query: listTaxAssessmentsQuery,
169
+ response: listOf(taxAssessmentSchema),
170
+ sdk: 'tax.compliance.listAssessments',
171
+ expandable: 'tax.assessment',
172
+ }),
173
+ defineRoute({
174
+ operationId: 'createTaxAssessment',
175
+ method: 'post',
176
+ path: '/v1/tax/assessments',
177
+ tag: 'Tax compliance',
178
+ summary: 'Run an assessment',
179
+ description: 'Judges the recorded facts against the current rule set, opening review items for what needs a person. Activates nothing.',
180
+ auth: 'service',
181
+ scope: 'payments:write',
182
+ idempotent: true,
183
+ body: createTaxAssessmentParams,
184
+ response: taxAssessmentSchema,
185
+ sdk: 'tax.compliance.createAssessment',
186
+ }),
187
+ defineRoute({
188
+ operationId: 'retrieveTaxAssessment',
189
+ method: 'get',
190
+ path: '/v1/tax/assessments/{id}',
191
+ tag: 'Tax compliance',
192
+ summary: 'Retrieve an assessment',
193
+ auth: 'service',
194
+ scope: 'payments:read',
195
+ params: { id: 'The assessment (`taxasm_…`).' },
196
+ query: expandOnlyQuery,
197
+ response: taxAssessmentSchema,
198
+ sdk: 'tax.compliance.retrieveAssessment',
199
+ expandable: 'tax.assessment',
200
+ }),
201
+ defineRoute({
202
+ operationId: 'replayTaxAssessment',
203
+ method: 'get',
204
+ path: '/v1/tax/assessments/{id}/replay',
205
+ tag: 'Tax compliance',
206
+ summary: 'Replay an assessment',
207
+ description: "Re-runs the stored inputs through the assessment's own rule set version; `matches` says whether the answer is the same.",
208
+ auth: 'service',
209
+ scope: 'payments:read',
210
+ params: { id: 'The assessment (`taxasm_…`).' },
211
+ response: taxAssessmentReplaySchema,
212
+ sdk: 'tax.compliance.replayAssessment',
213
+ }),
214
+ ];
@@ -0,0 +1,96 @@
1
+ import { z } from 'zod';
2
+ import { defineObject } from '../../common/objects.js';
3
+ import { metadataUpdateParam } from '../../common/params.js';
4
+ import { livemode, metadata, nullableString, unixSeconds } from '../../common/primitives.js';
5
+ import { defineRoute } from '../../route.js';
6
+ import { TAX_CUSTOMER_TYPES, TAX_LEGAL_ENTITY_TYPES, TAX_SUPPLY_TYPES } from '../../vocabulary/tax.js';
7
+ import { complianceCountryParam, complianceStateParam } from './shared.js';
8
+ /**
9
+ * Peable Tax business compliance (ADR 0020): what a business tells Peable
10
+ * about itself, what Peable works out from it against a VERSIONED rule set
11
+ * (an assessment), and what needs a person's decision (the review queue).
12
+ * Nothing here registers, files or pays anything with a government, and
13
+ * nothing here turns tax collection on: that is still the owner's registration
14
+ * plus approval (ADR 0011). The merchant API reads it and may run an
15
+ * assessment; every onboarding fact and decision is the owner's, in Orbit.
16
+ */
17
+ /**
18
+ * The business behind a merchant. Deliberately carries NO government
19
+ * identifier (company number, EIN): none is evidence of a tax obligation and
20
+ * none is needed by any rule in the supported set.
21
+ */
22
+ export const taxBusinessProfileSchema = defineObject('tax.business_profile', 'TaxBusinessProfile', z
23
+ .object({
24
+ object: z.literal('tax.business_profile'),
25
+ livemode,
26
+ legal_name: nullableString.describe('Read from the tax settings, where editing it returns collection to draft.'),
27
+ entity_type: z
28
+ .enum(TAX_LEGAL_ENTITY_TYPES)
29
+ .describe('`unknown` is an answer: the owner does not know yet.'),
30
+ incorporation_country: nullableString.describe('ISO 3166-1 alpha-2, or `null` while not given. Never evidence of registration.'),
31
+ incorporation_state: nullableString,
32
+ fiscal_year_end_month: z
33
+ .number()
34
+ .int()
35
+ .min(1)
36
+ .max(12)
37
+ .nullable()
38
+ .describe('1–12, the month the fiscal year ends in.'),
39
+ customer_types: z.enum(TAX_CUSTOMER_TYPES),
40
+ supply_types: z.array(z.enum(TAX_SUPPLY_TYPES)),
41
+ missing: z
42
+ .array(z.string())
43
+ .describe('What onboarding still lacks before an assessment can be complete: `legal_name`, `entity_type`, `customer_types`, `establishment`, `sales_destinations`.'),
44
+ metadata,
45
+ updated_by: nullableString,
46
+ updated: unixSeconds.nullable(),
47
+ })
48
+ .strict(), {
49
+ examples: [
50
+ {
51
+ object: 'tax.business_profile',
52
+ livemode: false,
53
+ legal_name: 'Example Software SL',
54
+ entity_type: 'limited_liability_company',
55
+ incorporation_country: 'ES',
56
+ incorporation_state: null,
57
+ fiscal_year_end_month: 12,
58
+ customer_types: 'both',
59
+ supply_types: ['software_as_a_service'],
60
+ missing: [],
61
+ metadata: {},
62
+ updated_by: 'user_42',
63
+ updated: 1793750400,
64
+ },
65
+ ],
66
+ });
67
+ /** Orbit's profile update (the owner's); `metadata` is a patch. */
68
+ export const updateTaxBusinessProfileParams = z
69
+ .object({
70
+ entity_type: z.enum(TAX_LEGAL_ENTITY_TYPES).optional(),
71
+ incorporation_country: complianceCountryParam.nullable().optional(),
72
+ incorporation_state: complianceStateParam.optional(),
73
+ fiscal_year_end_month: z.number().int().min(1).max(12).nullable().optional(),
74
+ customer_types: z.enum(TAX_CUSTOMER_TYPES).optional(),
75
+ supply_types: z
76
+ .array(z.enum(TAX_SUPPLY_TYPES))
77
+ .max(TAX_SUPPLY_TYPES.length)
78
+ .refine((list) => new Set(list).size === list.length, 'supply_types must be distinct')
79
+ .optional(),
80
+ metadata: metadataUpdateParam.optional(),
81
+ })
82
+ .strict();
83
+ export const taxBusinessProfileRoutes = [
84
+ defineRoute({
85
+ operationId: 'retrieveTaxBusinessProfile',
86
+ method: 'get',
87
+ path: '/v1/tax/business_profile',
88
+ tag: 'Tax compliance',
89
+ summary: 'Retrieve the business profile',
90
+ description: 'Changed by the owner in Orbit; a service credential records no onboarding fact.',
91
+ auth: 'service',
92
+ scope: 'payments:read',
93
+ response: taxBusinessProfileSchema,
94
+ sdk: 'tax.compliance.retrieveBusinessProfile',
95
+ }),
96
+ ];
@@ -0,0 +1,173 @@
1
+ import { z } from 'zod';
2
+ import { defineComponent, defineObject } from '../../common/objects.js';
3
+ import { livemode, nullableString, unixSeconds } from '../../common/primitives.js';
4
+ import { defineRoute } from '../../route.js';
5
+ import { TAX_BEHAVIORS, TAX_COLLECTIONS } from '../../vocabulary/tax.js';
6
+ import { taxCountry, taxMinorAmount, taxReferenceParam, taxState } from './shared.js';
7
+ /**
8
+ * A tax calculation (`taxcalc_…`, ADR 0011): a frozen answer. Peable decides
9
+ * whether a registration covers the customer's evidenced location and asks
10
+ * the provider for the amount only when one does; the answer is stored exactly
11
+ * as given and never recomputed.
12
+ */
13
+ export const taxBreakdownEntrySchema = defineComponent('TaxBreakdownEntry', z
14
+ .object({
15
+ country: taxCountry,
16
+ state: taxState,
17
+ level: nullableString.describe('The jurisdiction level (`country`, `state`, …).'),
18
+ display_name: nullableString,
19
+ tax_type: nullableString.describe('`vat`, `sales_tax`, …; `null` when no tax is imposed.'),
20
+ rate_percentage: nullableString.describe('Decimal string, e.g. `"20.0"`; `null` when no tax is imposed.'),
21
+ taxable_amount: taxMinorAmount,
22
+ amount: taxMinorAmount,
23
+ inclusive: z.boolean(),
24
+ taxability_reason: z
25
+ .string()
26
+ .describe("The provider's reason, or Peable's own `not_registered` / `product_nontaxable`."),
27
+ })
28
+ .strict());
29
+ export const taxCalculationLineItemSchema = defineComponent('TaxCalculationLineItem', z
30
+ .object({
31
+ reference: z.string(),
32
+ quantity: z.number().int(),
33
+ tax_code: z.string(),
34
+ tax_behavior: z.enum(TAX_BEHAVIORS),
35
+ amount: taxMinorAmount.describe('As given: includes tax when inclusive.'),
36
+ amount_tax: taxMinorAmount,
37
+ amount_net: taxMinorAmount.describe('Excluding tax.'),
38
+ breakdown: z.array(taxBreakdownEntrySchema),
39
+ })
40
+ .strict());
41
+ export const taxCalculationSchema = defineObject('tax.calculation', 'TaxCalculation', z
42
+ .object({
43
+ object: z.literal('tax.calculation'),
44
+ id: z.string().describe('`taxcalc_…`.'),
45
+ currency: z.string().describe('Uppercase ISO 4217.'),
46
+ collection: z
47
+ .enum(TAX_COLLECTIONS)
48
+ .describe('Why the tax is what it is: `collect` (a registration covers the customer and the provider calculated), `not_registered` (none does: zero tax, recorded as such), `nontaxable` (every line used the nontaxable code).'),
49
+ registration_id: nullableString.describe('The registration (`taxreg_…`) that collects.'),
50
+ provider: nullableString,
51
+ provider_calculation_ref: nullableString,
52
+ customer_location_evidence_id: z.string().describe('`taxloc_…`.'),
53
+ country: taxCountry,
54
+ state: taxState,
55
+ amount_total: taxMinorAmount.describe('What the customer pays.'),
56
+ amount_net: taxMinorAmount,
57
+ tax_amount_exclusive: taxMinorAmount,
58
+ tax_amount_inclusive: taxMinorAmount,
59
+ line_items: z.array(taxCalculationLineItemSchema),
60
+ tax_date: unixSeconds,
61
+ created: unixSeconds,
62
+ expires_at: unixSeconds,
63
+ livemode,
64
+ })
65
+ .strict(), {
66
+ examples: [
67
+ {
68
+ object: 'tax.calculation',
69
+ id: 'taxcalc_0193b8f2c1a87d3e9f4a',
70
+ currency: 'EUR',
71
+ collection: 'collect',
72
+ registration_id: 'taxreg_0193b8f2c1a87d3e9f4a',
73
+ provider: 'stripe_tax',
74
+ provider_calculation_ref: 'taxcalc_1QxYz2AbCdEf',
75
+ customer_location_evidence_id: 'taxloc_0193b8f2c1a87d3e9f4a',
76
+ country: 'DE',
77
+ state: null,
78
+ amount_total: 1190,
79
+ amount_net: 1000,
80
+ tax_amount_exclusive: 190,
81
+ tax_amount_inclusive: 0,
82
+ line_items: [
83
+ {
84
+ reference: 'plan_pro_monthly',
85
+ quantity: 1,
86
+ tax_code: 'txcd_10103001',
87
+ tax_behavior: 'exclusive',
88
+ amount: 1000,
89
+ amount_tax: 190,
90
+ amount_net: 1000,
91
+ breakdown: [
92
+ {
93
+ country: 'DE',
94
+ state: null,
95
+ level: 'country',
96
+ display_name: 'VAT',
97
+ tax_type: 'vat',
98
+ rate_percentage: '19.0',
99
+ taxable_amount: 1000,
100
+ amount: 190,
101
+ inclusive: false,
102
+ taxability_reason: 'standard_rated',
103
+ },
104
+ ],
105
+ },
106
+ ],
107
+ tax_date: 1793750400,
108
+ created: 1793750400,
109
+ expires_at: 1793836800,
110
+ livemode: false,
111
+ },
112
+ ],
113
+ });
114
+ export const taxLineItemParams = z
115
+ .object({
116
+ reference: z.string().min(1).max(200),
117
+ amount: z
118
+ .number()
119
+ .int()
120
+ .nonnegative()
121
+ .safe()
122
+ .describe('Unit amount × quantity, minor units. Includes tax when inclusive.'),
123
+ quantity: z.number().int().positive().max(1000000).optional(),
124
+ tax_code: z
125
+ .string()
126
+ .optional()
127
+ .describe("Defaults to the product's tax code, then the merchant's default."),
128
+ tax_behavior: z
129
+ .enum(TAX_BEHAVIORS)
130
+ .optional()
131
+ .describe("Defaults to the merchant's default tax behavior."),
132
+ })
133
+ .strict();
134
+ export const createTaxCalculationParams = z
135
+ .object({
136
+ currency: z.string().regex(/^[A-Za-z]{3}$/),
137
+ customer_location_evidence_id: taxReferenceParam.describe('Sufficient, unexpired evidence (`taxloc_…`).'),
138
+ line_items: z
139
+ .array(taxLineItemParams)
140
+ .min(1)
141
+ .max(100)
142
+ .refine((lines) => new Set(lines.map((line) => line.reference)).size === lines.length, 'Line references must be unique'),
143
+ })
144
+ .strict();
145
+ export const taxCalculationRoutes = [
146
+ defineRoute({
147
+ operationId: 'createTaxCalculation',
148
+ method: 'post',
149
+ path: '/v1/tax/calculations',
150
+ tag: 'Tax',
151
+ summary: 'Calculate tax',
152
+ description: 'Calculate and freeze. Refused with `tax_settings_not_active` until the owner approves; a covered sale the provider cannot price fails closed (`tax_calculation_unavailable`), never zero.',
153
+ auth: 'service',
154
+ scope: 'payments:write',
155
+ idempotent: true,
156
+ body: createTaxCalculationParams,
157
+ response: taxCalculationSchema,
158
+ status: 201,
159
+ sdk: 'tax.calculations.create',
160
+ }),
161
+ defineRoute({
162
+ operationId: 'retrieveTaxCalculation',
163
+ method: 'get',
164
+ path: '/v1/tax/calculations/{id}',
165
+ tag: 'Tax',
166
+ summary: 'Retrieve a tax calculation',
167
+ auth: 'service',
168
+ scope: 'payments:read',
169
+ params: { id: 'The calculation (`taxcalc_…`).' },
170
+ response: taxCalculationSchema,
171
+ sdk: 'tax.calculations.retrieve',
172
+ }),
173
+ ];
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ import { defineComponent, defineObject } from '../../common/objects.js';
3
+ import { livemode } from '../../common/primitives.js';
4
+ import { defineRoute } from '../../route.js';
5
+ import { TAX_COMPLIANCE_CAPABILITY_CATEGORIES, TAX_COMPLIANCE_CAPABILITY_STATUSES, } from '../../vocabulary/tax.js';
6
+ /** What Peable Tax compliance can and cannot do, each stated rather than simulated. */
7
+ export const taxComplianceCapabilitySchema = defineComponent('TaxComplianceCapability', z
8
+ .object({
9
+ id: z.string(),
10
+ category: z
11
+ .enum(TAX_COMPLIANCE_CAPABILITY_CATEGORIES)
12
+ .describe('VAT/sales tax, corporate income tax and annual company filings are different obligations.'),
13
+ status: z.enum(TAX_COMPLIANCE_CAPABILITY_STATUSES),
14
+ reason: z.string(),
15
+ })
16
+ .strict());
17
+ export const taxComplianceCapabilitiesSchema = defineObject('tax.compliance_capabilities', 'TaxComplianceCapabilities', z
18
+ .object({
19
+ object: z.literal('tax.compliance_capabilities'),
20
+ livemode,
21
+ rule_set_version: z.string(),
22
+ supported_rules: z.array(z.string()).describe('The ids of the rules assessed.'),
23
+ capabilities: z.array(taxComplianceCapabilitySchema),
24
+ })
25
+ .strict());
26
+ export const taxCapabilityRoutes = [
27
+ defineRoute({
28
+ operationId: 'retrieveTaxComplianceCapabilities',
29
+ method: 'get',
30
+ path: '/v1/tax/capabilities',
31
+ tag: 'Tax compliance',
32
+ summary: 'Retrieve compliance capabilities',
33
+ description: 'What is available, limited, not available or out of scope — Peable submits, files and pays nothing with any authority.',
34
+ auth: 'service',
35
+ scope: 'payments:read',
36
+ response: taxComplianceCapabilitiesSchema,
37
+ sdk: 'tax.compliance.retrieveCapabilities',
38
+ }),
39
+ ];
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { listOf } from '../../common/envelopes.js';
3
+ import { defineComponent } from '../../common/objects.js';
4
+ import { defineRoute } from '../../route.js';
5
+ /** A product tax code Peable accepts (`txcd_…`, Stripe Tax's ids). */
6
+ export const taxCodeSchema = defineComponent('TaxCode', z
7
+ .object({
8
+ id: z.string().describe('`txcd_…`.'),
9
+ name: z.string(),
10
+ description: z.string(),
11
+ })
12
+ .strict(), {
13
+ examples: [
14
+ {
15
+ id: 'txcd_10103001',
16
+ name: 'Software as a service (SaaS) - business use',
17
+ description: 'Hosted software accessed online, sold to businesses for business use.',
18
+ },
19
+ ],
20
+ });
21
+ export const taxCodeRoutes = [
22
+ defineRoute({
23
+ operationId: 'listTaxCodes',
24
+ method: 'get',
25
+ path: '/v1/tax/codes',
26
+ tag: 'Tax',
27
+ summary: 'List tax codes',
28
+ description: 'Every product tax code Peable accepts: a complete list, `has_more` is `false`.',
29
+ auth: 'service',
30
+ scope: 'payments:read',
31
+ response: listOf(taxCodeSchema),
32
+ sdk: 'tax.listCodes',
33
+ }),
34
+ ];
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ import { listOf } from '../../common/envelopes.js';
3
+ import { defineObject } from '../../common/objects.js';
4
+ import { listQuery } from '../../common/params.js';
5
+ import { livemode, nullableString, unixSeconds } from '../../common/primitives.js';
6
+ import { defineRoute } from '../../route.js';
7
+ import { TAX_ACTOR_TYPES } from '../../vocabulary/tax.js';
8
+ import { taxFacts } from './shared.js';
9
+ /** One recorded compliance change (`taxact_…`), written in the transaction of the change itself. */
10
+ export const taxComplianceActionSchema = defineObject('tax.compliance_action', 'TaxComplianceAction', z
11
+ .object({
12
+ object: z.literal('tax.compliance_action'),
13
+ id: z.string().describe('`taxact_…`.'),
14
+ livemode,
15
+ action: z.string().describe('e.g. `business_profile.updated`, `review_item.resolved`.'),
16
+ actor: z.object({ type: z.enum(TAX_ACTOR_TYPES), id: nullableString }).strict(),
17
+ object_type: z.string(),
18
+ object_id: nullableString,
19
+ details: taxFacts.describe('Field names and statuses that changed — never the values of a document or a number.'),
20
+ created: unixSeconds,
21
+ })
22
+ .strict(), {
23
+ examples: [
24
+ {
25
+ object: 'tax.compliance_action',
26
+ id: 'taxact_0193b8f2c1a87d3e9f4a',
27
+ livemode: false,
28
+ action: 'review_item.resolved',
29
+ actor: { type: 'user', id: 'user_42' },
30
+ object_type: 'tax.review_item',
31
+ object_id: 'taxrev_0193b8f2c1a87d3e9f4a',
32
+ details: { decision: 'will_register' },
33
+ created: 1793750400,
34
+ },
35
+ ],
36
+ });
37
+ export const listTaxComplianceActionsQuery = listQuery({});
38
+ export const taxComplianceActionRoutes = [
39
+ defineRoute({
40
+ operationId: 'listTaxComplianceActions',
41
+ method: 'get',
42
+ path: '/v1/tax/compliance_actions',
43
+ tag: 'Tax compliance',
44
+ summary: 'List compliance actions',
45
+ description: 'The history of every compliance change, newest first.',
46
+ auth: 'service',
47
+ scope: 'payments:read',
48
+ query: listTaxComplianceActionsQuery,
49
+ response: listOf(taxComplianceActionSchema),
50
+ sdk: 'tax.compliance.listActions',
51
+ expandable: 'tax.compliance_action',
52
+ }),
53
+ ];
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { listOf } from '../../common/envelopes.js';
3
+ import { defineComponent, defineObject } from '../../common/objects.js';
4
+ import { nullableString, unixSeconds } from '../../common/primitives.js';
5
+ import { defineRoute } from '../../route.js';
6
+ import { TAX_DEADLINE_KINDS, TAX_DEADLINE_STATUSES } from '../../vocabulary/tax.js';
7
+ import { taxRuleSourceSchema, taxState } from './shared.js';
8
+ /**
9
+ * A due date the rule set can compute. `filing_status` is `not_tracked`:
10
+ * Peable files nothing, so it never claims a return was or was not filed.
11
+ */
12
+ export const taxDeadlineSchema = defineObject('tax.deadline', 'TaxDeadline', z
13
+ .object({
14
+ object: z.literal('tax.deadline'),
15
+ kind: z.enum(TAX_DEADLINE_KINDS),
16
+ rule: z.string().describe('The rule that sets it.'),
17
+ country: nullableString,
18
+ state: taxState,
19
+ period_start: unixSeconds.nullable(),
20
+ period_end: unixSeconds.nullable(),
21
+ due: unixSeconds,
22
+ status: z.enum(TAX_DEADLINE_STATUSES),
23
+ filing_status: z.literal('not_tracked'),
24
+ description: z.string(),
25
+ source: taxRuleSourceSchema,
26
+ })
27
+ .strict());
28
+ /** Where a deadline exists but the rule set cannot compute it, and why. */
29
+ export const taxDeadlineUnavailableSchema = defineComponent('TaxDeadlineUnavailable', z
30
+ .object({
31
+ rule: nullableString,
32
+ country: nullableString,
33
+ state: taxState,
34
+ reason: z.string(),
35
+ })
36
+ .strict());
37
+ /** A complete list (`has_more` is `false`), with what could not be computed beside it. */
38
+ export const taxDeadlineListSchema = defineComponent('TaxDeadlineList', listOf(taxDeadlineSchema).extend({
39
+ unavailable: z
40
+ .array(taxDeadlineUnavailableSchema)
41
+ .describe('Where a deadline exists but the rule set cannot compute it, and why.'),
42
+ }));
43
+ export const taxDeadlineRoutes = [
44
+ defineRoute({
45
+ operationId: 'listTaxDeadlines',
46
+ method: 'get',
47
+ path: '/v1/tax/deadlines',
48
+ tag: 'Tax compliance',
49
+ summary: 'List tax deadlines',
50
+ description: 'Due dates the rule set computes from declared registrations and the latest assessment, soonest first.',
51
+ auth: 'service',
52
+ scope: 'payments:read',
53
+ response: taxDeadlineListSchema,
54
+ sdk: 'tax.compliance.listDeadlines',
55
+ }),
56
+ ];