@peable.to/contracts 0.4.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.
- package/dist/cjs/common/address.js +81 -0
- package/dist/cjs/common/envelopes.js +101 -0
- package/dist/cjs/common/objects.js +85 -0
- package/dist/cjs/common/params.js +211 -0
- package/dist/cjs/common/primitives.js +39 -0
- package/dist/cjs/contributions.js +22 -0
- package/dist/cjs/index.js +40 -137
- package/dist/cjs/openapi/document.js +297 -0
- package/dist/cjs/openapi/index.js +7 -0
- package/dist/cjs/openapi/webhooks.js +17 -0
- package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
- package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
- package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
- package/dist/cjs/resources/billingEngine/index.js +43 -0
- package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
- package/dist/cjs/resources/billingEngine/invoices.js +509 -0
- package/dist/cjs/resources/billingEngine/params.js +43 -0
- package/dist/cjs/resources/billingEngine/public.js +326 -0
- package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
- package/dist/cjs/resources/catalog/billing.js +755 -0
- package/dist/cjs/resources/catalog/billingSettings.js +131 -0
- package/dist/cjs/resources/catalog/coupons.js +222 -0
- package/dist/cjs/resources/catalog/entitlements.js +257 -0
- package/dist/cjs/resources/catalog/index.js +58 -0
- package/dist/cjs/resources/catalog/meters.js +279 -0
- package/dist/cjs/resources/catalog/prices.js +423 -0
- package/dist/cjs/resources/catalog/products.js +228 -0
- package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
- package/dist/cjs/resources/catalog/shared.js +75 -0
- package/dist/cjs/resources/catalog/testClocks.js +127 -0
- package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
- package/dist/cjs/resources/checkout/contributions.js +172 -0
- package/dist/cjs/resources/checkout/files.js +133 -0
- package/dist/cjs/resources/checkout/index.js +57 -0
- package/dist/cjs/resources/checkout/merchants.js +290 -0
- package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
- package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
- package/dist/cjs/resources/checkout/shared.js +368 -0
- package/dist/cjs/resources/connect/account.js +332 -0
- package/dist/cjs/resources/connect/applicationFees.js +113 -0
- package/dist/cjs/resources/connect/balance.js +212 -0
- package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
- package/dist/cjs/resources/connect/index.js +51 -0
- package/dist/cjs/resources/connect/onboarding.js +82 -0
- package/dist/cjs/resources/connect/payouts.js +196 -0
- package/dist/cjs/resources/connect/reporting.js +235 -0
- package/dist/cjs/resources/connect/requestLogs.js +110 -0
- package/dist/cjs/resources/connect/transfers.js +227 -0
- package/dist/cjs/resources/core/customers.js +194 -0
- package/dist/cjs/resources/core/index.js +23 -0
- package/dist/cjs/resources/core/paymentMethods.js +134 -0
- package/dist/cjs/resources/events/events.js +357 -0
- package/dist/cjs/resources/events/index.js +29 -0
- package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
- package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
- package/dist/cjs/resources/payments/charges.js +157 -0
- package/dist/cjs/resources/payments/disputes.js +204 -0
- package/dist/cjs/resources/payments/index.js +41 -0
- package/dist/cjs/resources/payments/paymentIntents.js +529 -0
- package/dist/cjs/resources/payments/refunds.js +245 -0
- package/dist/cjs/resources/payments/setupIntents.js +158 -0
- package/dist/cjs/resources/payments/social.js +182 -0
- package/dist/cjs/resources/payments/testHelpers.js +39 -0
- package/dist/cjs/resources/tax/assessments.js +217 -0
- package/dist/cjs/resources/tax/businessProfile.js +99 -0
- package/dist/cjs/resources/tax/calculations.js +176 -0
- package/dist/cjs/resources/tax/capabilities.js +42 -0
- package/dist/cjs/resources/tax/codes.js +37 -0
- package/dist/cjs/resources/tax/complianceActions.js +56 -0
- package/dist/cjs/resources/tax/deadlines.js +59 -0
- package/dist/cjs/resources/tax/documents.js +128 -0
- package/dist/cjs/resources/tax/index.js +80 -0
- package/dist/cjs/resources/tax/locationEvidence.js +131 -0
- package/dist/cjs/resources/tax/operatingLocations.js +98 -0
- package/dist/cjs/resources/tax/products.js +67 -0
- package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
- package/dist/cjs/resources/tax/registrations.js +82 -0
- package/dist/cjs/resources/tax/reports.js +92 -0
- package/dist/cjs/resources/tax/reviewItems.js +116 -0
- package/dist/cjs/resources/tax/ruleSet.js +68 -0
- package/dist/cjs/resources/tax/salesDestinations.js +94 -0
- package/dist/cjs/resources/tax/settings.js +104 -0
- package/dist/cjs/resources/tax/shared.js +62 -0
- package/dist/cjs/resources/tax/transactions.js +102 -0
- package/dist/cjs/route.js +22 -0
- package/dist/cjs/routes.js +31 -0
- package/dist/cjs/vocabulary/billingPortal.js +15 -0
- package/dist/cjs/vocabulary/catalog.js +110 -0
- package/dist/cjs/vocabulary/checkout.js +53 -0
- package/dist/cjs/vocabulary/connect.js +95 -0
- package/dist/cjs/vocabulary/errors.js +174 -0
- package/dist/cjs/vocabulary/events.js +176 -0
- package/dist/cjs/vocabulary/files.js +44 -0
- package/dist/cjs/vocabulary/index.js +37 -0
- package/dist/cjs/vocabulary/invoices.js +52 -0
- package/dist/cjs/vocabulary/lists.js +22 -0
- package/dist/cjs/vocabulary/merchants.js +23 -0
- package/dist/cjs/vocabulary/money.js +104 -0
- package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
- package/dist/cjs/vocabulary/payments.js +195 -0
- package/dist/cjs/vocabulary/reporting.js +27 -0
- package/dist/cjs/vocabulary/subscriptions.js +60 -0
- package/dist/cjs/vocabulary/tax.js +237 -0
- package/dist/cjs/vocabulary/version.js +12 -0
- package/dist/esm/common/address.js +76 -0
- package/dist/esm/common/envelopes.js +95 -0
- package/dist/esm/common/objects.js +74 -0
- package/dist/esm/common/params.js +203 -0
- package/dist/esm/common/primitives.js +35 -0
- package/dist/esm/contributions.js +5 -0
- package/dist/esm/index.js +26 -134
- package/dist/esm/openapi/document.js +294 -0
- package/dist/esm/openapi/index.js +2 -0
- package/dist/esm/openapi/webhooks.js +14 -0
- package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
- package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
- package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
- package/dist/esm/resources/billingEngine/index.js +26 -0
- package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
- package/dist/esm/resources/billingEngine/invoices.js +506 -0
- package/dist/esm/resources/billingEngine/params.js +39 -0
- package/dist/esm/resources/billingEngine/public.js +323 -0
- package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
- package/dist/esm/resources/catalog/billing.js +752 -0
- package/dist/esm/resources/catalog/billingSettings.js +128 -0
- package/dist/esm/resources/catalog/coupons.js +219 -0
- package/dist/esm/resources/catalog/entitlements.js +254 -0
- package/dist/esm/resources/catalog/index.js +38 -0
- package/dist/esm/resources/catalog/meters.js +276 -0
- package/dist/esm/resources/catalog/prices.js +419 -0
- package/dist/esm/resources/catalog/products.js +225 -0
- package/dist/esm/resources/catalog/promotionCodes.js +171 -0
- package/dist/esm/resources/catalog/shared.js +67 -0
- package/dist/esm/resources/catalog/testClocks.js +124 -0
- package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
- package/dist/esm/resources/checkout/contributions.js +167 -0
- package/dist/esm/resources/checkout/files.js +130 -0
- package/dist/esm/resources/checkout/index.js +25 -0
- package/dist/esm/resources/checkout/merchants.js +287 -0
- package/dist/esm/resources/checkout/paymentLinks.js +327 -0
- package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
- package/dist/esm/resources/checkout/shared.js +363 -0
- package/dist/esm/resources/connect/account.js +329 -0
- package/dist/esm/resources/connect/applicationFees.js +110 -0
- package/dist/esm/resources/connect/balance.js +209 -0
- package/dist/esm/resources/connect/connectedAccounts.js +257 -0
- package/dist/esm/resources/connect/index.js +34 -0
- package/dist/esm/resources/connect/onboarding.js +79 -0
- package/dist/esm/resources/connect/payouts.js +193 -0
- package/dist/esm/resources/connect/reporting.js +232 -0
- package/dist/esm/resources/connect/requestLogs.js +107 -0
- package/dist/esm/resources/connect/transfers.js +224 -0
- package/dist/esm/resources/core/customers.js +191 -0
- package/dist/esm/resources/core/index.js +6 -0
- package/dist/esm/resources/core/paymentMethods.js +131 -0
- package/dist/esm/resources/events/events.js +353 -0
- package/dist/esm/resources/events/index.js +12 -0
- package/dist/esm/resources/events/webhookDeliveries.js +90 -0
- package/dist/esm/resources/events/webhookEndpoints.js +212 -0
- package/dist/esm/resources/payments/charges.js +154 -0
- package/dist/esm/resources/payments/disputes.js +201 -0
- package/dist/esm/resources/payments/index.js +24 -0
- package/dist/esm/resources/payments/paymentIntents.js +526 -0
- package/dist/esm/resources/payments/refunds.js +242 -0
- package/dist/esm/resources/payments/setupIntents.js +155 -0
- package/dist/esm/resources/payments/social.js +179 -0
- package/dist/esm/resources/payments/testHelpers.js +36 -0
- package/dist/esm/resources/tax/assessments.js +214 -0
- package/dist/esm/resources/tax/businessProfile.js +96 -0
- package/dist/esm/resources/tax/calculations.js +173 -0
- package/dist/esm/resources/tax/capabilities.js +39 -0
- package/dist/esm/resources/tax/codes.js +34 -0
- package/dist/esm/resources/tax/complianceActions.js +53 -0
- package/dist/esm/resources/tax/deadlines.js +56 -0
- package/dist/esm/resources/tax/documents.js +125 -0
- package/dist/esm/resources/tax/index.js +63 -0
- package/dist/esm/resources/tax/locationEvidence.js +128 -0
- package/dist/esm/resources/tax/operatingLocations.js +95 -0
- package/dist/esm/resources/tax/products.js +64 -0
- package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
- package/dist/esm/resources/tax/registrations.js +79 -0
- package/dist/esm/resources/tax/reports.js +89 -0
- package/dist/esm/resources/tax/reviewItems.js +113 -0
- package/dist/esm/resources/tax/ruleSet.js +65 -0
- package/dist/esm/resources/tax/salesDestinations.js +91 -0
- package/dist/esm/resources/tax/settings.js +101 -0
- package/dist/esm/resources/tax/shared.js +58 -0
- package/dist/esm/resources/tax/transactions.js +99 -0
- package/dist/esm/route.js +16 -0
- package/dist/esm/routes.js +27 -0
- package/dist/esm/vocabulary/billingPortal.js +12 -0
- package/dist/esm/vocabulary/catalog.js +106 -0
- package/dist/esm/vocabulary/checkout.js +50 -0
- package/dist/esm/vocabulary/connect.js +92 -0
- package/dist/esm/vocabulary/errors.js +169 -0
- package/dist/esm/vocabulary/events.js +173 -0
- package/dist/esm/vocabulary/files.js +41 -0
- package/dist/esm/vocabulary/index.js +21 -0
- package/dist/esm/vocabulary/invoices.js +49 -0
- package/dist/esm/vocabulary/lists.js +19 -0
- package/dist/esm/vocabulary/merchants.js +20 -0
- package/dist/esm/vocabulary/money.js +98 -0
- package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
- package/dist/esm/vocabulary/payments.js +192 -0
- package/dist/esm/vocabulary/reporting.js +24 -0
- package/dist/esm/vocabulary/subscriptions.js +57 -0
- package/dist/esm/vocabulary/tax.js +233 -0
- package/dist/esm/vocabulary/version.js +9 -0
- package/dist/types/common/address.d.ts +62 -0
- package/dist/types/common/envelopes.d.ts +88 -0
- package/dist/types/common/objects.d.ts +107 -0
- package/dist/types/common/params.d.ts +156 -0
- package/dist/types/common/primitives.d.ts +56 -0
- package/dist/types/contributions.d.ts +1 -0
- package/dist/types/index.d.ts +16 -171
- package/dist/types/openapi/document.d.ts +16 -0
- package/dist/types/openapi/index.d.ts +2 -0
- package/dist/types/openapi/webhooks.d.ts +15 -0
- package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
- package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
- package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
- package/dist/types/resources/billingEngine/index.d.ts +6071 -0
- package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
- package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
- package/dist/types/resources/billingEngine/params.d.ts +51 -0
- package/dist/types/resources/billingEngine/public.d.ts +1860 -0
- package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
- package/dist/types/resources/catalog/billing.d.ts +1723 -0
- package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
- package/dist/types/resources/catalog/coupons.d.ts +403 -0
- package/dist/types/resources/catalog/entitlements.d.ts +422 -0
- package/dist/types/resources/catalog/index.d.ts +3155 -0
- package/dist/types/resources/catalog/meters.d.ts +474 -0
- package/dist/types/resources/catalog/prices.d.ts +1091 -0
- package/dist/types/resources/catalog/products.d.ts +430 -0
- package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
- package/dist/types/resources/catalog/shared.d.ts +34 -0
- package/dist/types/resources/catalog/testClocks.d.ts +220 -0
- package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
- package/dist/types/resources/checkout/contributions.d.ts +375 -0
- package/dist/types/resources/checkout/files.d.ts +280 -0
- package/dist/types/resources/checkout/index.d.ts +5678 -0
- package/dist/types/resources/checkout/merchants.d.ts +395 -0
- package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
- package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
- package/dist/types/resources/checkout/shared.d.ts +419 -0
- package/dist/types/resources/connect/account.d.ts +483 -0
- package/dist/types/resources/connect/applicationFees.d.ts +198 -0
- package/dist/types/resources/connect/balance.d.ts +399 -0
- package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
- package/dist/types/resources/connect/index.d.ts +2094 -0
- package/dist/types/resources/connect/onboarding.d.ts +95 -0
- package/dist/types/resources/connect/payouts.d.ts +527 -0
- package/dist/types/resources/connect/reporting.d.ts +506 -0
- package/dist/types/resources/connect/requestLogs.d.ts +236 -0
- package/dist/types/resources/connect/transfers.d.ts +436 -0
- package/dist/types/resources/core/customers.d.ts +619 -0
- package/dist/types/resources/core/index.d.ts +679 -0
- package/dist/types/resources/core/paymentMethods.d.ts +336 -0
- package/dist/types/resources/events/events.d.ts +731 -0
- package/dist/types/resources/events/index.d.ts +1727 -0
- package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
- package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
- package/dist/types/resources/payments/charges.d.ts +390 -0
- package/dist/types/resources/payments/disputes.d.ts +822 -0
- package/dist/types/resources/payments/index.d.ts +3517 -0
- package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
- package/dist/types/resources/payments/refunds.d.ts +684 -0
- package/dist/types/resources/payments/setupIntents.d.ts +391 -0
- package/dist/types/resources/payments/social.d.ts +266 -0
- package/dist/types/resources/payments/testHelpers.d.ts +178 -0
- package/dist/types/resources/tax/assessments.d.ts +787 -0
- package/dist/types/resources/tax/businessProfile.d.ts +134 -0
- package/dist/types/resources/tax/calculations.d.ts +261 -0
- package/dist/types/resources/tax/capabilities.d.ts +81 -0
- package/dist/types/resources/tax/codes.d.ts +29 -0
- package/dist/types/resources/tax/complianceActions.d.ts +97 -0
- package/dist/types/resources/tax/deadlines.d.ts +133 -0
- package/dist/types/resources/tax/documents.d.ts +257 -0
- package/dist/types/resources/tax/index.d.ts +1946 -0
- package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
- package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
- package/dist/types/resources/tax/products.d.ts +68 -0
- package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
- package/dist/types/resources/tax/registrations.d.ts +103 -0
- package/dist/types/resources/tax/reports.d.ts +129 -0
- package/dist/types/resources/tax/reviewItems.d.ts +226 -0
- package/dist/types/resources/tax/ruleSet.d.ts +219 -0
- package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
- package/dist/types/resources/tax/settings.d.ts +122 -0
- package/dist/types/resources/tax/shared.d.ts +43 -0
- package/dist/types/resources/tax/transactions.d.ts +404 -0
- package/dist/types/route.d.ts +86 -0
- package/dist/types/routes.d.ts +23 -0
- package/dist/types/vocabulary/billingPortal.d.ts +15 -0
- package/dist/types/vocabulary/catalog.d.ts +97 -0
- package/dist/types/vocabulary/checkout.d.ts +49 -0
- package/dist/types/vocabulary/connect.d.ts +62 -0
- package/dist/types/vocabulary/errors.d.ts +145 -0
- package/dist/types/vocabulary/events.d.ts +171 -0
- package/dist/types/vocabulary/files.d.ts +30 -0
- package/dist/types/vocabulary/index.d.ts +17 -0
- package/dist/types/vocabulary/invoices.d.ts +39 -0
- package/dist/types/vocabulary/lists.d.ts +9 -0
- package/dist/types/vocabulary/merchants.d.ts +9 -0
- package/dist/types/vocabulary/money.d.ts +59 -0
- package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
- package/dist/types/vocabulary/payments.d.ts +117 -0
- package/dist/types/vocabulary/reporting.d.ts +18 -0
- package/dist/types/vocabulary/subscriptions.d.ts +45 -0
- package/dist/types/vocabulary/tax.d.ts +163 -0
- package/dist/types/vocabulary/version.d.ts +10 -0
- package/package.json +51 -11
- package/dist/cjs/openapi.js +0 -165
- package/dist/esm/openapi.js +0 -161
- package/dist/types/openapi.d.ts +0 -148
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxRegistrationDeclarationRoutes = exports.listTaxRegistrationDeclarationsQuery = exports.updateTaxRegistrationDeclarationParams = exports.createTaxRegistrationDeclarationParams = exports.taxRegistrationDeclarationSchema = exports.taxDeclarationVerificationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
6
|
+
const objects_1 = require("../../common/objects");
|
|
7
|
+
const params_1 = require("../../common/params");
|
|
8
|
+
const primitives_1 = require("../../common/primitives");
|
|
9
|
+
const route_1 = require("../../route");
|
|
10
|
+
const tax_1 = require("../../vocabulary/tax");
|
|
11
|
+
const shared_1 = require("./shared");
|
|
12
|
+
/** No authority integration confirms anything yet: every declaration is `unverified`. */
|
|
13
|
+
exports.taxDeclarationVerificationSchema = (0, objects_1.defineComponent)('TaxRegistrationDeclarationVerification', zod_1.z
|
|
14
|
+
.object({
|
|
15
|
+
status: zod_1.z.literal('unverified'),
|
|
16
|
+
reason: zod_1.z.literal('no_authority_integration'),
|
|
17
|
+
})
|
|
18
|
+
.strict());
|
|
19
|
+
/**
|
|
20
|
+
* A declared registration status (`taxrd_…`): where the business stands with a
|
|
21
|
+
* tax authority, IN ITS OWN WORDS. Storing one is NOT registration with a
|
|
22
|
+
* government, and it never makes Peable collect: collection needs a Peable Tax
|
|
23
|
+
* registration (`taxreg_…`) the owner approved.
|
|
24
|
+
*/
|
|
25
|
+
exports.taxRegistrationDeclarationSchema = (0, objects_1.defineObject)('tax.registration_declaration', 'TaxRegistrationDeclaration', zod_1.z
|
|
26
|
+
.object({
|
|
27
|
+
object: zod_1.z.literal('tax.registration_declaration'),
|
|
28
|
+
id: zod_1.z.string().describe('`taxrd_…`.'),
|
|
29
|
+
livemode: primitives_1.livemode,
|
|
30
|
+
country: shared_1.taxCountry,
|
|
31
|
+
state: shared_1.taxState,
|
|
32
|
+
scheme: zod_1.z
|
|
33
|
+
.enum(tax_1.TAX_REGISTRATION_SCHEMES)
|
|
34
|
+
.nullable()
|
|
35
|
+
.describe('The scheme, when the owner knows it; `null` for `unknown`.'),
|
|
36
|
+
status: zod_1.z.enum(tax_1.TAX_REGISTRATION_DECLARATION_STATUSES),
|
|
37
|
+
effective_from: primitives_1.unixSeconds.nullable(),
|
|
38
|
+
effective_to: primitives_1.unixSeconds.nullable(),
|
|
39
|
+
filing_frequency: zod_1.z.enum(tax_1.TAX_FILING_FREQUENCIES),
|
|
40
|
+
collection_registration: primitives_1.nullableString.describe('The Peable Tax collection registration (`taxreg_…`) it corresponds to, when there is one.'),
|
|
41
|
+
verification: exports.taxDeclarationVerificationSchema,
|
|
42
|
+
note: primitives_1.nullableString,
|
|
43
|
+
metadata: primitives_1.metadata,
|
|
44
|
+
created: primitives_1.unixSeconds,
|
|
45
|
+
updated: primitives_1.unixSeconds,
|
|
46
|
+
})
|
|
47
|
+
.strict(), {
|
|
48
|
+
examples: [
|
|
49
|
+
{
|
|
50
|
+
object: 'tax.registration_declaration',
|
|
51
|
+
id: 'taxrd_0193b8f2c1a87d3e9f4a',
|
|
52
|
+
livemode: false,
|
|
53
|
+
country: 'ES',
|
|
54
|
+
state: null,
|
|
55
|
+
scheme: 'eu_oss_union',
|
|
56
|
+
status: 'registered',
|
|
57
|
+
effective_from: 1767225600,
|
|
58
|
+
effective_to: null,
|
|
59
|
+
filing_frequency: 'quarterly',
|
|
60
|
+
collection_registration: 'taxreg_0193b8f2c1a87d3e9f4a',
|
|
61
|
+
verification: { status: 'unverified', reason: 'no_authority_integration' },
|
|
62
|
+
note: null,
|
|
63
|
+
metadata: {},
|
|
64
|
+
created: 1793750400,
|
|
65
|
+
updated: 1793750400,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
const declarationFields = {
|
|
70
|
+
scheme: zod_1.z.enum(tax_1.TAX_REGISTRATION_SCHEMES).nullable().optional(),
|
|
71
|
+
status: zod_1.z.enum(tax_1.TAX_REGISTRATION_DECLARATION_STATUSES),
|
|
72
|
+
effective_from: shared_1.taxInstantParam.nullable().optional(),
|
|
73
|
+
effective_to: shared_1.taxInstantParam.nullable().optional(),
|
|
74
|
+
filing_frequency: zod_1.z.enum(tax_1.TAX_FILING_FREQUENCIES).optional(),
|
|
75
|
+
collection_registration: shared_1.complianceIdParam.nullable().optional(),
|
|
76
|
+
note: (0, shared_1.complianceTextParam)(1000).optional(),
|
|
77
|
+
};
|
|
78
|
+
/** Orbit's new declaration (the owner's). */
|
|
79
|
+
exports.createTaxRegistrationDeclarationParams = zod_1.z
|
|
80
|
+
.object({
|
|
81
|
+
country: shared_1.complianceCountryParam,
|
|
82
|
+
state: shared_1.complianceStateParam.optional(),
|
|
83
|
+
...declarationFields,
|
|
84
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
85
|
+
})
|
|
86
|
+
.strict();
|
|
87
|
+
/** Orbit's update (the owner's): the place is fixed; `metadata` is a patch. */
|
|
88
|
+
exports.updateTaxRegistrationDeclarationParams = zod_1.z
|
|
89
|
+
.object({
|
|
90
|
+
...declarationFields,
|
|
91
|
+
status: declarationFields.status.optional(),
|
|
92
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
93
|
+
})
|
|
94
|
+
.strict();
|
|
95
|
+
exports.listTaxRegistrationDeclarationsQuery = (0, params_1.listQuery)({});
|
|
96
|
+
exports.taxRegistrationDeclarationRoutes = [
|
|
97
|
+
(0, route_1.defineRoute)({
|
|
98
|
+
operationId: 'listTaxRegistrationDeclarations',
|
|
99
|
+
method: 'get',
|
|
100
|
+
path: '/v1/tax/registration_declarations',
|
|
101
|
+
tag: 'Tax compliance',
|
|
102
|
+
summary: 'List registration declarations',
|
|
103
|
+
auth: 'service',
|
|
104
|
+
scope: 'payments:read',
|
|
105
|
+
query: exports.listTaxRegistrationDeclarationsQuery,
|
|
106
|
+
response: (0, envelopes_1.listOf)(exports.taxRegistrationDeclarationSchema),
|
|
107
|
+
sdk: 'tax.compliance.listRegistrationDeclarations',
|
|
108
|
+
expandable: 'tax.registration_declaration',
|
|
109
|
+
}),
|
|
110
|
+
(0, route_1.defineRoute)({
|
|
111
|
+
operationId: 'retrieveTaxRegistrationDeclaration',
|
|
112
|
+
method: 'get',
|
|
113
|
+
path: '/v1/tax/registration_declarations/{id}',
|
|
114
|
+
tag: 'Tax compliance',
|
|
115
|
+
summary: 'Retrieve a registration declaration',
|
|
116
|
+
auth: 'service',
|
|
117
|
+
scope: 'payments:read',
|
|
118
|
+
params: { id: 'The declaration (`taxrd_…`).' },
|
|
119
|
+
query: params_1.expandOnlyQuery,
|
|
120
|
+
response: exports.taxRegistrationDeclarationSchema,
|
|
121
|
+
sdk: 'tax.compliance.retrieveRegistrationDeclaration',
|
|
122
|
+
expandable: 'tax.registration_declaration',
|
|
123
|
+
}),
|
|
124
|
+
];
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxRegistrationRoutes = exports.endTaxRegistrationParams = exports.createTaxRegistrationParams = exports.taxRegistrationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
6
|
+
const objects_1 = require("../../common/objects");
|
|
7
|
+
const primitives_1 = require("../../common/primitives");
|
|
8
|
+
const route_1 = require("../../route");
|
|
9
|
+
const tax_1 = require("../../vocabulary/tax");
|
|
10
|
+
const shared_1 = require("./shared");
|
|
11
|
+
/**
|
|
12
|
+
* A Peable Tax registration (`taxreg_…`, ADR 0011): where the seller says it
|
|
13
|
+
* is registered to collect. Only registrations the owner approved make Peable
|
|
14
|
+
* collect. Registering with a government is the seller's job, never Peable's.
|
|
15
|
+
*/
|
|
16
|
+
exports.taxRegistrationSchema = (0, objects_1.defineObject)('tax.registration', 'TaxRegistration', zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
object: zod_1.z.literal('tax.registration'),
|
|
19
|
+
id: zod_1.z.string().describe('`taxreg_…`.'),
|
|
20
|
+
country: shared_1.taxCountry,
|
|
21
|
+
state: shared_1.taxState,
|
|
22
|
+
scheme: zod_1.z.enum(tax_1.TAX_REGISTRATION_SCHEMES),
|
|
23
|
+
registration_number: primitives_1.nullableString.describe('The government-issued number (VAT id, state permit), when there is one.'),
|
|
24
|
+
active_from: primitives_1.unixSeconds,
|
|
25
|
+
expires_at: primitives_1.unixSeconds.nullable(),
|
|
26
|
+
status: zod_1.z
|
|
27
|
+
.enum(tax_1.TAX_REGISTRATION_STATUSES)
|
|
28
|
+
.describe('`pending_approval` until the owner approves; `scheduled` before `active_from`.'),
|
|
29
|
+
approved_at: primitives_1.unixSeconds.nullable(),
|
|
30
|
+
provider_registration_ref: primitives_1.nullableString.describe('The mirrored registration at the calculating provider, once synced.'),
|
|
31
|
+
created: primitives_1.unixSeconds,
|
|
32
|
+
})
|
|
33
|
+
.strict(), {
|
|
34
|
+
examples: [
|
|
35
|
+
{
|
|
36
|
+
object: 'tax.registration',
|
|
37
|
+
id: 'taxreg_0193b8f2c1a87d3e9f4a',
|
|
38
|
+
country: 'ES',
|
|
39
|
+
state: null,
|
|
40
|
+
scheme: 'eu_oss_union',
|
|
41
|
+
registration_number: 'ESB12345678',
|
|
42
|
+
active_from: 1793750400,
|
|
43
|
+
expires_at: null,
|
|
44
|
+
status: 'active',
|
|
45
|
+
approved_at: 1793750400,
|
|
46
|
+
provider_registration_ref: 'taxreg_1QxYz2AbCdEf',
|
|
47
|
+
created: 1793664000,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
/** Orbit's new registration (the owner's): pending until the owner approves. */
|
|
52
|
+
exports.createTaxRegistrationParams = zod_1.z
|
|
53
|
+
.object({
|
|
54
|
+
country: zod_1.z.string().regex(/^[A-Z]{2}$/),
|
|
55
|
+
state: zod_1.z
|
|
56
|
+
.string()
|
|
57
|
+
.regex(/^[A-Z0-9]{1,3}$/)
|
|
58
|
+
.nullish(),
|
|
59
|
+
scheme: zod_1.z.enum(tax_1.TAX_REGISTRATION_SCHEMES),
|
|
60
|
+
registration_number: zod_1.z.string().trim().min(1).max(64).nullish(),
|
|
61
|
+
active_from: shared_1.taxInstantParam
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('Unix seconds; omitted means immediately on approval.'),
|
|
64
|
+
expires_at: shared_1.taxInstantParam.nullish(),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
67
|
+
/** Orbit's end of a registration at `expires_at`. */
|
|
68
|
+
exports.endTaxRegistrationParams = zod_1.z.object({ expires_at: shared_1.taxInstantParam }).strict();
|
|
69
|
+
exports.taxRegistrationRoutes = [
|
|
70
|
+
(0, route_1.defineRoute)({
|
|
71
|
+
operationId: 'listTaxRegistrations',
|
|
72
|
+
method: 'get',
|
|
73
|
+
path: '/v1/tax/registrations',
|
|
74
|
+
tag: 'Tax',
|
|
75
|
+
summary: 'List tax registrations',
|
|
76
|
+
description: 'Every registration of the merchant, oldest first: a complete list, `has_more` is `false`. Registrations are added and approved by the owner in Orbit.',
|
|
77
|
+
auth: 'service',
|
|
78
|
+
scope: 'payments:read',
|
|
79
|
+
response: (0, envelopes_1.listOf)(exports.taxRegistrationSchema),
|
|
80
|
+
sdk: 'tax.listRegistrations',
|
|
81
|
+
}),
|
|
82
|
+
];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxReportRoutes = exports.taxReportQuery = exports.taxReportSchema = exports.taxReportRowSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const objects_1 = require("../../common/objects");
|
|
6
|
+
const params_1 = require("../../common/params");
|
|
7
|
+
const primitives_1 = require("../../common/primitives");
|
|
8
|
+
const route_1 = require("../../route");
|
|
9
|
+
const tax_1 = require("../../vocabulary/tax");
|
|
10
|
+
const shared_1 = require("./shared");
|
|
11
|
+
/**
|
|
12
|
+
* The Peable Tax summary report: totals per jurisdiction, registration, tax
|
|
13
|
+
* type and rate — the lines a return (an OSS return, a state filing) is
|
|
14
|
+
* prepared from. A report is not a filed return.
|
|
15
|
+
*/
|
|
16
|
+
/** One filing line. Reversals are netted in: `taxable_amount` and `tax_amount` are net. */
|
|
17
|
+
exports.taxReportRowSchema = (0, objects_1.defineComponent)('TaxReportRow', zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
country: shared_1.taxCountry,
|
|
20
|
+
state: shared_1.taxState,
|
|
21
|
+
registration_id: primitives_1.nullableString.describe('The registration (`taxreg_…`) that collected.'),
|
|
22
|
+
scheme: zod_1.z.enum(tax_1.TAX_REGISTRATION_SCHEMES).nullable(),
|
|
23
|
+
collection: zod_1.z.enum(tax_1.TAX_COLLECTIONS),
|
|
24
|
+
tax_type: primitives_1.nullableString,
|
|
25
|
+
rate_percentage: primitives_1.nullableString.describe('Decimal string, e.g. `"20.0"`.'),
|
|
26
|
+
currency: zod_1.z.string().describe('Uppercase ISO 4217.'),
|
|
27
|
+
transactions: zod_1.z.number().int().nonnegative(),
|
|
28
|
+
reversals: zod_1.z.number().int().nonnegative().describe('Reversals netted into this row.'),
|
|
29
|
+
taxable_amount: shared_1.taxMinorAmount,
|
|
30
|
+
tax_amount: shared_1.taxMinorAmount,
|
|
31
|
+
})
|
|
32
|
+
.strict());
|
|
33
|
+
exports.taxReportSchema = (0, objects_1.defineObject)('tax.report', 'TaxReport', zod_1.z
|
|
34
|
+
.object({
|
|
35
|
+
object: zod_1.z.literal('tax.report'),
|
|
36
|
+
from: primitives_1.unixSeconds.describe('Inclusive.'),
|
|
37
|
+
to: primitives_1.unixSeconds.describe('Exclusive.'),
|
|
38
|
+
rows: zod_1.z.array(exports.taxReportRowSchema),
|
|
39
|
+
})
|
|
40
|
+
.strict(), {
|
|
41
|
+
examples: [
|
|
42
|
+
{
|
|
43
|
+
object: 'tax.report',
|
|
44
|
+
from: 1790812800,
|
|
45
|
+
to: 1798761600,
|
|
46
|
+
rows: [
|
|
47
|
+
{
|
|
48
|
+
country: 'DE',
|
|
49
|
+
state: null,
|
|
50
|
+
registration_id: 'taxreg_0193b8f2c1a87d3e9f4a',
|
|
51
|
+
scheme: 'eu_oss_union',
|
|
52
|
+
collection: 'collect',
|
|
53
|
+
tax_type: 'vat',
|
|
54
|
+
rate_percentage: '19.0',
|
|
55
|
+
currency: 'EUR',
|
|
56
|
+
transactions: 42,
|
|
57
|
+
reversals: 1,
|
|
58
|
+
taxable_amount: 41000,
|
|
59
|
+
tax_amount: 7790,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
});
|
|
65
|
+
/** The filing window: `from` inclusive, `to` exclusive, Unix seconds. */
|
|
66
|
+
exports.taxReportQuery = zod_1.z
|
|
67
|
+
.object({
|
|
68
|
+
// Not `.describe()`d: a described copy would lose the integer spelling the
|
|
69
|
+
// OpenAPI document gives `queryUnixSeconds`. The route says what they mean.
|
|
70
|
+
from: params_1.queryUnixSeconds,
|
|
71
|
+
to: params_1.queryUnixSeconds,
|
|
72
|
+
format: zod_1.z
|
|
73
|
+
.enum(['json', 'csv'])
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('`csv` answers the rows as a `text/csv` attachment (a filing export) instead of JSON.'),
|
|
76
|
+
})
|
|
77
|
+
.strict();
|
|
78
|
+
exports.taxReportRoutes = [
|
|
79
|
+
(0, route_1.defineRoute)({
|
|
80
|
+
operationId: 'retrieveTaxReportSummary',
|
|
81
|
+
method: 'get',
|
|
82
|
+
path: '/v1/tax/reports/summary',
|
|
83
|
+
tag: 'Tax',
|
|
84
|
+
summary: 'Summarize collected tax',
|
|
85
|
+
description: 'Totals per jurisdiction, registration, tax type and rate over `[from, to)` (Unix seconds, `from` inclusive, `to` exclusive, on `committed_at`), reversals netted in. With `format=csv`, the same rows as a `text/csv` attachment.',
|
|
86
|
+
auth: 'service',
|
|
87
|
+
scope: 'payments:read',
|
|
88
|
+
query: exports.taxReportQuery,
|
|
89
|
+
response: exports.taxReportSchema,
|
|
90
|
+
sdk: 'tax.reports.summary',
|
|
91
|
+
}),
|
|
92
|
+
];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxReviewItemRoutes = exports.listTaxReviewItemsQuery = exports.resolveTaxReviewItemParams = exports.taxReviewItemSchema = exports.taxReviewDecisionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
6
|
+
const objects_1 = require("../../common/objects");
|
|
7
|
+
const params_1 = require("../../common/params");
|
|
8
|
+
const primitives_1 = require("../../common/primitives");
|
|
9
|
+
const route_1 = require("../../route");
|
|
10
|
+
const tax_1 = require("../../vocabulary/tax");
|
|
11
|
+
const shared_1 = require("./shared");
|
|
12
|
+
/** The owner's recorded decision, with who and when. */
|
|
13
|
+
exports.taxReviewDecisionSchema = (0, objects_1.defineComponent)('TaxReviewDecision', zod_1.z
|
|
14
|
+
.object({
|
|
15
|
+
decision: zod_1.z.enum(tax_1.TAX_REVIEW_DECISIONS),
|
|
16
|
+
note: primitives_1.nullableString,
|
|
17
|
+
decided_by: zod_1.z.string().describe('The Oxy user who decided.'),
|
|
18
|
+
decided_at: primitives_1.unixSeconds,
|
|
19
|
+
})
|
|
20
|
+
.strict());
|
|
21
|
+
/**
|
|
22
|
+
* A finding that needs a person (`taxrev_…`): opened by an assessment, kept
|
|
23
|
+
* open while later ones find it again, and closed only by the owner's
|
|
24
|
+
* decision in Orbit. No decision activates collection.
|
|
25
|
+
*/
|
|
26
|
+
exports.taxReviewItemSchema = (0, objects_1.defineObject)('tax.review_item', 'TaxReviewItem', zod_1.z
|
|
27
|
+
.object({
|
|
28
|
+
object: zod_1.z.literal('tax.review_item'),
|
|
29
|
+
id: zod_1.z.string().describe('`taxrev_…`.'),
|
|
30
|
+
livemode: primitives_1.livemode,
|
|
31
|
+
code: zod_1.z
|
|
32
|
+
.string()
|
|
33
|
+
.describe('Machine reason, e.g. `threshold_exceeded`, `registration_status_unknown`.'),
|
|
34
|
+
severity: zod_1.z.enum(tax_1.TAX_REVIEW_SEVERITIES),
|
|
35
|
+
status: zod_1.z.enum(tax_1.TAX_REVIEW_ITEM_STATUSES),
|
|
36
|
+
rule: primitives_1.nullableString,
|
|
37
|
+
country: primitives_1.nullableString,
|
|
38
|
+
state: shared_1.taxState,
|
|
39
|
+
message: zod_1.z.string(),
|
|
40
|
+
first_assessment: primitives_1.nullableString.describe('The assessment (`taxasm_…`) that opened it.'),
|
|
41
|
+
latest_assessment: primitives_1.nullableString.describe('The latest assessment (`taxasm_…`) that found it again.'),
|
|
42
|
+
decision: exports.taxReviewDecisionSchema.nullable(),
|
|
43
|
+
created: primitives_1.unixSeconds,
|
|
44
|
+
updated: primitives_1.unixSeconds,
|
|
45
|
+
})
|
|
46
|
+
.strict(), {
|
|
47
|
+
examples: [
|
|
48
|
+
{
|
|
49
|
+
object: 'tax.review_item',
|
|
50
|
+
id: 'taxrev_0193b8f2c1a87d3e9f4a',
|
|
51
|
+
livemode: false,
|
|
52
|
+
code: 'threshold_approaching',
|
|
53
|
+
severity: 'review',
|
|
54
|
+
status: 'open',
|
|
55
|
+
rule: 'us_tx_sales_tax',
|
|
56
|
+
country: 'US',
|
|
57
|
+
state: 'TX',
|
|
58
|
+
message: 'Texas revenue is at or above 80% of the safe-harbor threshold.',
|
|
59
|
+
first_assessment: 'taxasm_0193b8f2c1a87d3e9f4a',
|
|
60
|
+
latest_assessment: 'taxasm_0193b8f2c1a87d3e9f4a',
|
|
61
|
+
decision: null,
|
|
62
|
+
created: 1793750400,
|
|
63
|
+
updated: 1793750400,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
/** Orbit's decision on an open item (the owner's, never a service credential's). */
|
|
68
|
+
exports.resolveTaxReviewItemParams = zod_1.z
|
|
69
|
+
.object({
|
|
70
|
+
decision: zod_1.z.enum(tax_1.TAX_REVIEW_DECISIONS),
|
|
71
|
+
note: (0, shared_1.complianceTextParam)(1000)
|
|
72
|
+
.optional()
|
|
73
|
+
.describe("Required for `not_required` and `accepted_risk`: the owner's reason."),
|
|
74
|
+
})
|
|
75
|
+
.strict()
|
|
76
|
+
.superRefine((input, ctx) => {
|
|
77
|
+
if ((input.decision === 'not_required' || input.decision === 'accepted_risk') && !input.note)
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: 'custom',
|
|
80
|
+
path: ['note'],
|
|
81
|
+
message: `a ${input.decision} decision records the owner's reason in note`,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
exports.listTaxReviewItemsQuery = (0, params_1.listQuery)({
|
|
85
|
+
status: zod_1.z.enum(tax_1.TAX_REVIEW_ITEM_STATUSES).optional().describe('Only items in this status.'),
|
|
86
|
+
});
|
|
87
|
+
exports.taxReviewItemRoutes = [
|
|
88
|
+
(0, route_1.defineRoute)({
|
|
89
|
+
operationId: 'listTaxReviewItems',
|
|
90
|
+
method: 'get',
|
|
91
|
+
path: '/v1/tax/review_items',
|
|
92
|
+
tag: 'Tax compliance',
|
|
93
|
+
summary: 'List review items',
|
|
94
|
+
auth: 'service',
|
|
95
|
+
scope: 'payments:read',
|
|
96
|
+
query: exports.listTaxReviewItemsQuery,
|
|
97
|
+
response: (0, envelopes_1.listOf)(exports.taxReviewItemSchema),
|
|
98
|
+
sdk: 'tax.compliance.listReviewItems',
|
|
99
|
+
expandable: 'tax.review_item',
|
|
100
|
+
}),
|
|
101
|
+
(0, route_1.defineRoute)({
|
|
102
|
+
operationId: 'retrieveTaxReviewItem',
|
|
103
|
+
method: 'get',
|
|
104
|
+
path: '/v1/tax/review_items/{id}',
|
|
105
|
+
tag: 'Tax compliance',
|
|
106
|
+
summary: 'Retrieve a review item',
|
|
107
|
+
description: "Deciding an item is the owner's, in Orbit; a service credential only reads it.",
|
|
108
|
+
auth: 'service',
|
|
109
|
+
scope: 'payments:read',
|
|
110
|
+
params: { id: 'The review item (`taxrev_…`).' },
|
|
111
|
+
query: params_1.expandOnlyQuery,
|
|
112
|
+
response: exports.taxReviewItemSchema,
|
|
113
|
+
sdk: 'tax.compliance.retrieveReviewItem',
|
|
114
|
+
expandable: 'tax.review_item',
|
|
115
|
+
}),
|
|
116
|
+
];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxRuleSetRoutes = exports.taxRuleSetSchema = exports.taxJurisdictionRuleSchema = exports.taxRuleThresholdSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const objects_1 = require("../../common/objects");
|
|
6
|
+
const primitives_1 = require("../../common/primitives");
|
|
7
|
+
const route_1 = require("../../route");
|
|
8
|
+
const tax_1 = require("../../vocabulary/tax");
|
|
9
|
+
const shared_1 = require("./shared");
|
|
10
|
+
/**
|
|
11
|
+
* The jurisdiction rule set (ADR 0020): versioned CODE, not data a request can
|
|
12
|
+
* change. A version is immutable once published; an assessment stores the
|
|
13
|
+
* version it ran under and replays through the same one. Only the rules listed
|
|
14
|
+
* are supported; every other jurisdiction is `unsupported`, stated as such.
|
|
15
|
+
*/
|
|
16
|
+
exports.taxRuleThresholdSchema = (0, objects_1.defineComponent)('TaxRuleThreshold', zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
amount: primitives_1.amount,
|
|
19
|
+
currency: primitives_1.currency,
|
|
20
|
+
period: zod_1.z.enum(tax_1.TAX_THRESHOLD_PERIODS),
|
|
21
|
+
})
|
|
22
|
+
.strict());
|
|
23
|
+
/**
|
|
24
|
+
* One supported jurisdiction rule. `review.status` says whether a tax
|
|
25
|
+
* professional has signed it off — an `unreviewed` rule's findings always go
|
|
26
|
+
* to the review queue rather than standing on their own.
|
|
27
|
+
*/
|
|
28
|
+
exports.taxJurisdictionRuleSchema = (0, objects_1.defineObject)('tax.jurisdiction_rule', 'TaxJurisdictionRule', zod_1.z
|
|
29
|
+
.object({
|
|
30
|
+
object: zod_1.z.literal('tax.jurisdiction_rule'),
|
|
31
|
+
id: zod_1.z.string().describe('Stable, e.g. `eu_vat_b2c_cross_border`.'),
|
|
32
|
+
rule_set_version: zod_1.z.string(),
|
|
33
|
+
name: zod_1.z.string(),
|
|
34
|
+
tax_type: zod_1.z.enum(tax_1.TAX_TYPES),
|
|
35
|
+
countries: zod_1.z.array(zod_1.z.string()).describe('ISO 3166-1 alpha-2 codes the rule covers.'),
|
|
36
|
+
state: shared_1.taxState,
|
|
37
|
+
effective_from: primitives_1.unixSeconds,
|
|
38
|
+
threshold: exports.taxRuleThresholdSchema.nullable(),
|
|
39
|
+
sources: zod_1.z.array(shared_1.taxRuleSourceSchema),
|
|
40
|
+
coverage_limits: zod_1.z.array(shared_1.taxCoverageLimitSchema),
|
|
41
|
+
review: zod_1.z.object({ status: zod_1.z.enum(tax_1.TAX_RULE_REVIEW_STATUSES), note: zod_1.z.string() }).strict(),
|
|
42
|
+
})
|
|
43
|
+
.strict());
|
|
44
|
+
exports.taxRuleSetSchema = (0, objects_1.defineObject)('tax.rule_set', 'TaxRuleSet', zod_1.z
|
|
45
|
+
.object({
|
|
46
|
+
object: zod_1.z.literal('tax.rule_set'),
|
|
47
|
+
version: zod_1.z.string(),
|
|
48
|
+
published: primitives_1.unixSeconds,
|
|
49
|
+
rules: zod_1.z.array(exports.taxJurisdictionRuleSchema),
|
|
50
|
+
unsupported: zod_1.z
|
|
51
|
+
.string()
|
|
52
|
+
.describe('Everything not listed is `unsupported`, stated rather than implied.'),
|
|
53
|
+
})
|
|
54
|
+
.strict());
|
|
55
|
+
exports.taxRuleSetRoutes = [
|
|
56
|
+
(0, route_1.defineRoute)({
|
|
57
|
+
operationId: 'retrieveTaxRuleSet',
|
|
58
|
+
method: 'get',
|
|
59
|
+
path: '/v1/tax/rule_set',
|
|
60
|
+
tag: 'Tax compliance',
|
|
61
|
+
summary: 'Retrieve the current rule set',
|
|
62
|
+
description: 'The rules assessments currently run under, with their sources and limits.',
|
|
63
|
+
auth: 'service',
|
|
64
|
+
scope: 'payments:read',
|
|
65
|
+
response: exports.taxRuleSetSchema,
|
|
66
|
+
sdk: 'tax.compliance.retrieveRuleSet',
|
|
67
|
+
}),
|
|
68
|
+
];
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxSalesDestinationRoutes = exports.listTaxSalesDestinationsQuery = exports.updateTaxSalesDestinationParams = exports.createTaxSalesDestinationParams = exports.taxSalesDestinationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
6
|
+
const objects_1 = require("../../common/objects");
|
|
7
|
+
const params_1 = require("../../common/params");
|
|
8
|
+
const primitives_1 = require("../../common/primitives");
|
|
9
|
+
const route_1 = require("../../route");
|
|
10
|
+
const tax_1 = require("../../vocabulary/tax");
|
|
11
|
+
const shared_1 = require("./shared");
|
|
12
|
+
/**
|
|
13
|
+
* Where the business SAYS it sells (`taxdest_…`). Actual sales come from Peable
|
|
14
|
+
* Tax transactions; an assessment compares the two.
|
|
15
|
+
*/
|
|
16
|
+
exports.taxSalesDestinationSchema = (0, objects_1.defineObject)('tax.sales_destination', 'TaxSalesDestination', zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
object: zod_1.z.literal('tax.sales_destination'),
|
|
19
|
+
id: zod_1.z.string().describe('`taxdest_…`.'),
|
|
20
|
+
livemode: primitives_1.livemode,
|
|
21
|
+
country: shared_1.taxCountry,
|
|
22
|
+
state: shared_1.taxState,
|
|
23
|
+
customer_types: zod_1.z.enum(tax_1.TAX_CUSTOMER_TYPES),
|
|
24
|
+
started: primitives_1.unixSeconds.nullable(),
|
|
25
|
+
ended: primitives_1.unixSeconds.nullable(),
|
|
26
|
+
metadata: primitives_1.metadata,
|
|
27
|
+
created: primitives_1.unixSeconds,
|
|
28
|
+
})
|
|
29
|
+
.strict(), {
|
|
30
|
+
examples: [
|
|
31
|
+
{
|
|
32
|
+
object: 'tax.sales_destination',
|
|
33
|
+
id: 'taxdest_0193b8f2c1a87d3e9f4a',
|
|
34
|
+
livemode: false,
|
|
35
|
+
country: 'US',
|
|
36
|
+
state: 'TX',
|
|
37
|
+
customer_types: 'consumers',
|
|
38
|
+
started: 1767225600,
|
|
39
|
+
ended: null,
|
|
40
|
+
metadata: {},
|
|
41
|
+
created: 1793750400,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
/** Orbit's new sales destination (the owner's). */
|
|
46
|
+
exports.createTaxSalesDestinationParams = zod_1.z
|
|
47
|
+
.object({
|
|
48
|
+
country: shared_1.complianceCountryParam,
|
|
49
|
+
state: shared_1.complianceStateParam.optional(),
|
|
50
|
+
customer_types: zod_1.z.enum(tax_1.TAX_CUSTOMER_TYPES).optional(),
|
|
51
|
+
started: shared_1.taxInstantParam.nullable().optional(),
|
|
52
|
+
ended: shared_1.taxInstantParam.nullable().optional(),
|
|
53
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
/** Orbit's update (the owner's): the place is fixed; `metadata` is a patch. */
|
|
57
|
+
exports.updateTaxSalesDestinationParams = zod_1.z
|
|
58
|
+
.object({
|
|
59
|
+
customer_types: zod_1.z.enum(tax_1.TAX_CUSTOMER_TYPES).optional(),
|
|
60
|
+
started: shared_1.taxInstantParam.nullable().optional(),
|
|
61
|
+
ended: shared_1.taxInstantParam.nullable().optional(),
|
|
62
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
63
|
+
})
|
|
64
|
+
.strict();
|
|
65
|
+
exports.listTaxSalesDestinationsQuery = (0, params_1.listQuery)({});
|
|
66
|
+
exports.taxSalesDestinationRoutes = [
|
|
67
|
+
(0, route_1.defineRoute)({
|
|
68
|
+
operationId: 'listTaxSalesDestinations',
|
|
69
|
+
method: 'get',
|
|
70
|
+
path: '/v1/tax/sales_destinations',
|
|
71
|
+
tag: 'Tax compliance',
|
|
72
|
+
summary: 'List sales destinations',
|
|
73
|
+
auth: 'service',
|
|
74
|
+
scope: 'payments:read',
|
|
75
|
+
query: exports.listTaxSalesDestinationsQuery,
|
|
76
|
+
response: (0, envelopes_1.listOf)(exports.taxSalesDestinationSchema),
|
|
77
|
+
sdk: 'tax.compliance.listSalesDestinations',
|
|
78
|
+
expandable: 'tax.sales_destination',
|
|
79
|
+
}),
|
|
80
|
+
(0, route_1.defineRoute)({
|
|
81
|
+
operationId: 'retrieveTaxSalesDestination',
|
|
82
|
+
method: 'get',
|
|
83
|
+
path: '/v1/tax/sales_destinations/{id}',
|
|
84
|
+
tag: 'Tax compliance',
|
|
85
|
+
summary: 'Retrieve a sales destination',
|
|
86
|
+
auth: 'service',
|
|
87
|
+
scope: 'payments:read',
|
|
88
|
+
params: { id: 'The sales destination (`taxdest_…`).' },
|
|
89
|
+
query: params_1.expandOnlyQuery,
|
|
90
|
+
response: exports.taxSalesDestinationSchema,
|
|
91
|
+
sdk: 'tax.compliance.retrieveSalesDestination',
|
|
92
|
+
expandable: 'tax.sales_destination',
|
|
93
|
+
}),
|
|
94
|
+
];
|