@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.
- 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 -97
- 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 -94
- 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 -134
- 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 -138
- package/dist/esm/openapi.js +0 -134
- package/dist/types/openapi.d.ts +0 -145
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxAssessmentRoutes = exports.listTaxAssessmentsQuery = exports.createTaxAssessmentParams = exports.taxAssessmentReplaySchema = exports.taxAssessmentSchema = exports.taxAssessmentResultSchema = exports.taxAssessmentMeasuredSchema = exports.taxAssessmentReasonSchema = 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
|
+
* An assessment (`taxasm_…`, ADR 0020): the recorded facts judged against a
|
|
14
|
+
* VERSIONED rule set at one instant. It stores the version and its exact
|
|
15
|
+
* inputs, so `replay` can re-run them and show the same answer. Every finding
|
|
16
|
+
* goes to the review queue for a person to decide; none activates collection.
|
|
17
|
+
*/
|
|
18
|
+
exports.taxAssessmentReasonSchema = (0, objects_1.defineComponent)('TaxAssessmentReason', zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
code: zod_1.z.string(),
|
|
21
|
+
message: zod_1.z.string(),
|
|
22
|
+
evidence: shared_1.taxFacts.describe('The facts the reason rests on — amounts, counts, ids. Never personal data.'),
|
|
23
|
+
})
|
|
24
|
+
.strict());
|
|
25
|
+
/** Net sales measured against a rule's threshold. */
|
|
26
|
+
exports.taxAssessmentMeasuredSchema = (0, objects_1.defineComponent)('TaxAssessmentMeasured', zod_1.z
|
|
27
|
+
.object({
|
|
28
|
+
amount: primitives_1.signedAmount.describe('Net sales in `currency`: reversals are netted in.'),
|
|
29
|
+
currency: primitives_1.currency,
|
|
30
|
+
transactions: zod_1.z.number().int().nonnegative(),
|
|
31
|
+
from: primitives_1.unixSeconds,
|
|
32
|
+
to: primitives_1.unixSeconds,
|
|
33
|
+
excluded_currencies: zod_1.z
|
|
34
|
+
.array(zod_1.z.string())
|
|
35
|
+
.describe('Sales in other currencies: counted nowhere, named here.'),
|
|
36
|
+
})
|
|
37
|
+
.strict());
|
|
38
|
+
exports.taxAssessmentResultSchema = (0, objects_1.defineComponent)('TaxAssessmentResult', zod_1.z
|
|
39
|
+
.object({
|
|
40
|
+
rule: primitives_1.nullableString.describe('The rule applied, or `null` for an unsupported jurisdiction.'),
|
|
41
|
+
country: primitives_1.nullableString,
|
|
42
|
+
state: shared_1.taxState,
|
|
43
|
+
tax_type: zod_1.z.enum(tax_1.TAX_TYPES).nullable(),
|
|
44
|
+
outcome: zod_1.z.enum(tax_1.TAX_OBLIGATION_OUTCOMES),
|
|
45
|
+
reasons: zod_1.z.array(exports.taxAssessmentReasonSchema),
|
|
46
|
+
measured: exports.taxAssessmentMeasuredSchema
|
|
47
|
+
.nullable()
|
|
48
|
+
.describe('Net sales measured against the threshold, when the rule has one.'),
|
|
49
|
+
threshold: zod_1.z.object({ amount: primitives_1.amount, currency: primitives_1.currency }).strict().nullable(),
|
|
50
|
+
deadline: zod_1.z
|
|
51
|
+
.object({
|
|
52
|
+
kind: zod_1.z.literal('registration'),
|
|
53
|
+
due: primitives_1.unixSeconds,
|
|
54
|
+
source: shared_1.taxRuleSourceSchema,
|
|
55
|
+
})
|
|
56
|
+
.strict()
|
|
57
|
+
.nullable()
|
|
58
|
+
.describe('A deadline the rule itself sets (a Texas permit after crossing).'),
|
|
59
|
+
coverage_limits: zod_1.z.array(shared_1.taxCoverageLimitSchema),
|
|
60
|
+
review_items: zod_1.z
|
|
61
|
+
.array(zod_1.z.string())
|
|
62
|
+
.describe('The review items (`taxrev_…`) this result opened or kept open.'),
|
|
63
|
+
})
|
|
64
|
+
.strict());
|
|
65
|
+
const outcomeCount = zod_1.z.number().int().nonnegative();
|
|
66
|
+
exports.taxAssessmentSchema = (0, objects_1.defineObject)('tax.assessment', 'TaxAssessment', zod_1.z
|
|
67
|
+
.object({
|
|
68
|
+
object: zod_1.z.literal('tax.assessment'),
|
|
69
|
+
id: zod_1.z.string().describe('`taxasm_…`.'),
|
|
70
|
+
livemode: primitives_1.livemode,
|
|
71
|
+
rule_set_version: zod_1.z.string(),
|
|
72
|
+
as_of: primitives_1.unixSeconds.describe('The instant the facts were judged at.'),
|
|
73
|
+
inputs_digest: zod_1.z
|
|
74
|
+
.string()
|
|
75
|
+
.describe('SHA-256 of the canonical inputs — what a replay is checked against.'),
|
|
76
|
+
results: zod_1.z.array(exports.taxAssessmentResultSchema),
|
|
77
|
+
summary: zod_1.z
|
|
78
|
+
.object({
|
|
79
|
+
registration_declared: outcomeCount,
|
|
80
|
+
likely_required: outcomeCount,
|
|
81
|
+
approaching_threshold: outcomeCount,
|
|
82
|
+
not_indicated: outcomeCount,
|
|
83
|
+
uncertain: outcomeCount,
|
|
84
|
+
unsupported: outcomeCount,
|
|
85
|
+
})
|
|
86
|
+
.strict()
|
|
87
|
+
.describe('How many results have each outcome.'),
|
|
88
|
+
created_by: zod_1.z.object({ type: zod_1.z.enum(['user', 'service']), id: primitives_1.nullableString }).strict(),
|
|
89
|
+
created: primitives_1.unixSeconds,
|
|
90
|
+
})
|
|
91
|
+
.strict(), {
|
|
92
|
+
examples: [
|
|
93
|
+
{
|
|
94
|
+
object: 'tax.assessment',
|
|
95
|
+
id: 'taxasm_0193b8f2c1a87d3e9f4a',
|
|
96
|
+
livemode: false,
|
|
97
|
+
rule_set_version: '2026-11-03.1',
|
|
98
|
+
as_of: 1793750400,
|
|
99
|
+
inputs_digest: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08',
|
|
100
|
+
results: [
|
|
101
|
+
{
|
|
102
|
+
rule: 'us_tx_sales_tax',
|
|
103
|
+
country: 'US',
|
|
104
|
+
state: 'TX',
|
|
105
|
+
tax_type: 'sales_tax',
|
|
106
|
+
outcome: 'approaching_threshold',
|
|
107
|
+
reasons: [
|
|
108
|
+
{
|
|
109
|
+
code: 'approaching_threshold',
|
|
110
|
+
message: 'Texas revenue is at or above 80% of the safe-harbor threshold.',
|
|
111
|
+
evidence: { measured_minor: '41000000', threshold_minor: '50000000' },
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
measured: {
|
|
115
|
+
amount: '41000000',
|
|
116
|
+
currency: 'USD',
|
|
117
|
+
transactions: 812,
|
|
118
|
+
from: 1762041600,
|
|
119
|
+
to: 1793577600,
|
|
120
|
+
excluded_currencies: [],
|
|
121
|
+
},
|
|
122
|
+
threshold: { amount: '50000000', currency: 'USD' },
|
|
123
|
+
deadline: null,
|
|
124
|
+
coverage_limits: [],
|
|
125
|
+
review_items: ['taxrev_0193b8f2c1a87d3e9f4a'],
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
summary: {
|
|
129
|
+
registration_declared: 0,
|
|
130
|
+
likely_required: 0,
|
|
131
|
+
approaching_threshold: 1,
|
|
132
|
+
not_indicated: 0,
|
|
133
|
+
uncertain: 0,
|
|
134
|
+
unsupported: 0,
|
|
135
|
+
},
|
|
136
|
+
created_by: { type: 'service', id: 'app_42' },
|
|
137
|
+
created: 1793750400,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
/** Re-running a stored assessment's inputs through its own rule set version. */
|
|
142
|
+
exports.taxAssessmentReplaySchema = (0, objects_1.defineObject)('tax.assessment_replay', 'TaxAssessmentReplay', zod_1.z
|
|
143
|
+
.object({
|
|
144
|
+
object: zod_1.z.literal('tax.assessment_replay'),
|
|
145
|
+
assessment: zod_1.z.string().describe('The assessment replayed (`taxasm_…`).'),
|
|
146
|
+
rule_set_version: zod_1.z.string(),
|
|
147
|
+
inputs_digest: zod_1.z.string(),
|
|
148
|
+
matches: zod_1.z
|
|
149
|
+
.boolean()
|
|
150
|
+
.describe('`true` when the replayed results are identical to the stored ones.'),
|
|
151
|
+
results: zod_1.z
|
|
152
|
+
.array(exports.taxAssessmentResultSchema)
|
|
153
|
+
.describe('A replay opens no review items: every `review_items` is empty.'),
|
|
154
|
+
})
|
|
155
|
+
.strict());
|
|
156
|
+
exports.createTaxAssessmentParams = zod_1.z
|
|
157
|
+
.object({
|
|
158
|
+
as_of: shared_1.taxInstantParam.optional().describe('Unix seconds; default now. Never in the future.'),
|
|
159
|
+
})
|
|
160
|
+
.strict();
|
|
161
|
+
exports.listTaxAssessmentsQuery = (0, params_1.listQuery)({});
|
|
162
|
+
exports.taxAssessmentRoutes = [
|
|
163
|
+
(0, route_1.defineRoute)({
|
|
164
|
+
operationId: 'listTaxAssessments',
|
|
165
|
+
method: 'get',
|
|
166
|
+
path: '/v1/tax/assessments',
|
|
167
|
+
tag: 'Tax compliance',
|
|
168
|
+
summary: 'List assessments',
|
|
169
|
+
auth: 'service',
|
|
170
|
+
scope: 'payments:read',
|
|
171
|
+
query: exports.listTaxAssessmentsQuery,
|
|
172
|
+
response: (0, envelopes_1.listOf)(exports.taxAssessmentSchema),
|
|
173
|
+
sdk: 'tax.compliance.listAssessments',
|
|
174
|
+
expandable: 'tax.assessment',
|
|
175
|
+
}),
|
|
176
|
+
(0, route_1.defineRoute)({
|
|
177
|
+
operationId: 'createTaxAssessment',
|
|
178
|
+
method: 'post',
|
|
179
|
+
path: '/v1/tax/assessments',
|
|
180
|
+
tag: 'Tax compliance',
|
|
181
|
+
summary: 'Run an assessment',
|
|
182
|
+
description: 'Judges the recorded facts against the current rule set, opening review items for what needs a person. Activates nothing.',
|
|
183
|
+
auth: 'service',
|
|
184
|
+
scope: 'payments:write',
|
|
185
|
+
idempotent: true,
|
|
186
|
+
body: exports.createTaxAssessmentParams,
|
|
187
|
+
response: exports.taxAssessmentSchema,
|
|
188
|
+
sdk: 'tax.compliance.createAssessment',
|
|
189
|
+
}),
|
|
190
|
+
(0, route_1.defineRoute)({
|
|
191
|
+
operationId: 'retrieveTaxAssessment',
|
|
192
|
+
method: 'get',
|
|
193
|
+
path: '/v1/tax/assessments/{id}',
|
|
194
|
+
tag: 'Tax compliance',
|
|
195
|
+
summary: 'Retrieve an assessment',
|
|
196
|
+
auth: 'service',
|
|
197
|
+
scope: 'payments:read',
|
|
198
|
+
params: { id: 'The assessment (`taxasm_…`).' },
|
|
199
|
+
query: params_1.expandOnlyQuery,
|
|
200
|
+
response: exports.taxAssessmentSchema,
|
|
201
|
+
sdk: 'tax.compliance.retrieveAssessment',
|
|
202
|
+
expandable: 'tax.assessment',
|
|
203
|
+
}),
|
|
204
|
+
(0, route_1.defineRoute)({
|
|
205
|
+
operationId: 'replayTaxAssessment',
|
|
206
|
+
method: 'get',
|
|
207
|
+
path: '/v1/tax/assessments/{id}/replay',
|
|
208
|
+
tag: 'Tax compliance',
|
|
209
|
+
summary: 'Replay an assessment',
|
|
210
|
+
description: "Re-runs the stored inputs through the assessment's own rule set version; `matches` says whether the answer is the same.",
|
|
211
|
+
auth: 'service',
|
|
212
|
+
scope: 'payments:read',
|
|
213
|
+
params: { id: 'The assessment (`taxasm_…`).' },
|
|
214
|
+
response: exports.taxAssessmentReplaySchema,
|
|
215
|
+
sdk: 'tax.compliance.replayAssessment',
|
|
216
|
+
}),
|
|
217
|
+
];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxBusinessProfileRoutes = exports.updateTaxBusinessProfileParams = exports.taxBusinessProfileSchema = 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
|
+
* Peable Tax business compliance (ADR 0020): what a business tells Peable
|
|
13
|
+
* about itself, what Peable works out from it against a VERSIONED rule set
|
|
14
|
+
* (an assessment), and what needs a person's decision (the review queue).
|
|
15
|
+
* Nothing here registers, files or pays anything with a government, and
|
|
16
|
+
* nothing here turns tax collection on: that is still the owner's registration
|
|
17
|
+
* plus approval (ADR 0011). The merchant API reads it and may run an
|
|
18
|
+
* assessment; every onboarding fact and decision is the owner's, in Orbit.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The business behind a merchant. Deliberately carries NO government
|
|
22
|
+
* identifier (company number, EIN): none is evidence of a tax obligation and
|
|
23
|
+
* none is needed by any rule in the supported set.
|
|
24
|
+
*/
|
|
25
|
+
exports.taxBusinessProfileSchema = (0, objects_1.defineObject)('tax.business_profile', 'TaxBusinessProfile', zod_1.z
|
|
26
|
+
.object({
|
|
27
|
+
object: zod_1.z.literal('tax.business_profile'),
|
|
28
|
+
livemode: primitives_1.livemode,
|
|
29
|
+
legal_name: primitives_1.nullableString.describe('Read from the tax settings, where editing it returns collection to draft.'),
|
|
30
|
+
entity_type: zod_1.z
|
|
31
|
+
.enum(tax_1.TAX_LEGAL_ENTITY_TYPES)
|
|
32
|
+
.describe('`unknown` is an answer: the owner does not know yet.'),
|
|
33
|
+
incorporation_country: primitives_1.nullableString.describe('ISO 3166-1 alpha-2, or `null` while not given. Never evidence of registration.'),
|
|
34
|
+
incorporation_state: primitives_1.nullableString,
|
|
35
|
+
fiscal_year_end_month: zod_1.z
|
|
36
|
+
.number()
|
|
37
|
+
.int()
|
|
38
|
+
.min(1)
|
|
39
|
+
.max(12)
|
|
40
|
+
.nullable()
|
|
41
|
+
.describe('1–12, the month the fiscal year ends in.'),
|
|
42
|
+
customer_types: zod_1.z.enum(tax_1.TAX_CUSTOMER_TYPES),
|
|
43
|
+
supply_types: zod_1.z.array(zod_1.z.enum(tax_1.TAX_SUPPLY_TYPES)),
|
|
44
|
+
missing: zod_1.z
|
|
45
|
+
.array(zod_1.z.string())
|
|
46
|
+
.describe('What onboarding still lacks before an assessment can be complete: `legal_name`, `entity_type`, `customer_types`, `establishment`, `sales_destinations`.'),
|
|
47
|
+
metadata: primitives_1.metadata,
|
|
48
|
+
updated_by: primitives_1.nullableString,
|
|
49
|
+
updated: primitives_1.unixSeconds.nullable(),
|
|
50
|
+
})
|
|
51
|
+
.strict(), {
|
|
52
|
+
examples: [
|
|
53
|
+
{
|
|
54
|
+
object: 'tax.business_profile',
|
|
55
|
+
livemode: false,
|
|
56
|
+
legal_name: 'Example Software SL',
|
|
57
|
+
entity_type: 'limited_liability_company',
|
|
58
|
+
incorporation_country: 'ES',
|
|
59
|
+
incorporation_state: null,
|
|
60
|
+
fiscal_year_end_month: 12,
|
|
61
|
+
customer_types: 'both',
|
|
62
|
+
supply_types: ['software_as_a_service'],
|
|
63
|
+
missing: [],
|
|
64
|
+
metadata: {},
|
|
65
|
+
updated_by: 'user_42',
|
|
66
|
+
updated: 1793750400,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
/** Orbit's profile update (the owner's); `metadata` is a patch. */
|
|
71
|
+
exports.updateTaxBusinessProfileParams = zod_1.z
|
|
72
|
+
.object({
|
|
73
|
+
entity_type: zod_1.z.enum(tax_1.TAX_LEGAL_ENTITY_TYPES).optional(),
|
|
74
|
+
incorporation_country: shared_1.complianceCountryParam.nullable().optional(),
|
|
75
|
+
incorporation_state: shared_1.complianceStateParam.optional(),
|
|
76
|
+
fiscal_year_end_month: zod_1.z.number().int().min(1).max(12).nullable().optional(),
|
|
77
|
+
customer_types: zod_1.z.enum(tax_1.TAX_CUSTOMER_TYPES).optional(),
|
|
78
|
+
supply_types: zod_1.z
|
|
79
|
+
.array(zod_1.z.enum(tax_1.TAX_SUPPLY_TYPES))
|
|
80
|
+
.max(tax_1.TAX_SUPPLY_TYPES.length)
|
|
81
|
+
.refine((list) => new Set(list).size === list.length, 'supply_types must be distinct')
|
|
82
|
+
.optional(),
|
|
83
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
84
|
+
})
|
|
85
|
+
.strict();
|
|
86
|
+
exports.taxBusinessProfileRoutes = [
|
|
87
|
+
(0, route_1.defineRoute)({
|
|
88
|
+
operationId: 'retrieveTaxBusinessProfile',
|
|
89
|
+
method: 'get',
|
|
90
|
+
path: '/v1/tax/business_profile',
|
|
91
|
+
tag: 'Tax compliance',
|
|
92
|
+
summary: 'Retrieve the business profile',
|
|
93
|
+
description: 'Changed by the owner in Orbit; a service credential records no onboarding fact.',
|
|
94
|
+
auth: 'service',
|
|
95
|
+
scope: 'payments:read',
|
|
96
|
+
response: exports.taxBusinessProfileSchema,
|
|
97
|
+
sdk: 'tax.compliance.retrieveBusinessProfile',
|
|
98
|
+
}),
|
|
99
|
+
];
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxCalculationRoutes = exports.createTaxCalculationParams = exports.taxLineItemParams = exports.taxCalculationSchema = exports.taxCalculationLineItemSchema = exports.taxBreakdownEntrySchema = 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
|
+
* A tax calculation (`taxcalc_…`, ADR 0011): a frozen answer. Peable decides
|
|
12
|
+
* whether a registration covers the customer's evidenced location and asks
|
|
13
|
+
* the provider for the amount only when one does; the answer is stored exactly
|
|
14
|
+
* as given and never recomputed.
|
|
15
|
+
*/
|
|
16
|
+
exports.taxBreakdownEntrySchema = (0, objects_1.defineComponent)('TaxBreakdownEntry', zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
country: shared_1.taxCountry,
|
|
19
|
+
state: shared_1.taxState,
|
|
20
|
+
level: primitives_1.nullableString.describe('The jurisdiction level (`country`, `state`, …).'),
|
|
21
|
+
display_name: primitives_1.nullableString,
|
|
22
|
+
tax_type: primitives_1.nullableString.describe('`vat`, `sales_tax`, …; `null` when no tax is imposed.'),
|
|
23
|
+
rate_percentage: primitives_1.nullableString.describe('Decimal string, e.g. `"20.0"`; `null` when no tax is imposed.'),
|
|
24
|
+
taxable_amount: shared_1.taxMinorAmount,
|
|
25
|
+
amount: shared_1.taxMinorAmount,
|
|
26
|
+
inclusive: zod_1.z.boolean(),
|
|
27
|
+
taxability_reason: zod_1.z
|
|
28
|
+
.string()
|
|
29
|
+
.describe("The provider's reason, or Peable's own `not_registered` / `product_nontaxable`."),
|
|
30
|
+
})
|
|
31
|
+
.strict());
|
|
32
|
+
exports.taxCalculationLineItemSchema = (0, objects_1.defineComponent)('TaxCalculationLineItem', zod_1.z
|
|
33
|
+
.object({
|
|
34
|
+
reference: zod_1.z.string(),
|
|
35
|
+
quantity: zod_1.z.number().int(),
|
|
36
|
+
tax_code: zod_1.z.string(),
|
|
37
|
+
tax_behavior: zod_1.z.enum(tax_1.TAX_BEHAVIORS),
|
|
38
|
+
amount: shared_1.taxMinorAmount.describe('As given: includes tax when inclusive.'),
|
|
39
|
+
amount_tax: shared_1.taxMinorAmount,
|
|
40
|
+
amount_net: shared_1.taxMinorAmount.describe('Excluding tax.'),
|
|
41
|
+
breakdown: zod_1.z.array(exports.taxBreakdownEntrySchema),
|
|
42
|
+
})
|
|
43
|
+
.strict());
|
|
44
|
+
exports.taxCalculationSchema = (0, objects_1.defineObject)('tax.calculation', 'TaxCalculation', zod_1.z
|
|
45
|
+
.object({
|
|
46
|
+
object: zod_1.z.literal('tax.calculation'),
|
|
47
|
+
id: zod_1.z.string().describe('`taxcalc_…`.'),
|
|
48
|
+
currency: zod_1.z.string().describe('Uppercase ISO 4217.'),
|
|
49
|
+
collection: zod_1.z
|
|
50
|
+
.enum(tax_1.TAX_COLLECTIONS)
|
|
51
|
+
.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).'),
|
|
52
|
+
registration_id: primitives_1.nullableString.describe('The registration (`taxreg_…`) that collects.'),
|
|
53
|
+
provider: primitives_1.nullableString,
|
|
54
|
+
provider_calculation_ref: primitives_1.nullableString,
|
|
55
|
+
customer_location_evidence_id: zod_1.z.string().describe('`taxloc_…`.'),
|
|
56
|
+
country: shared_1.taxCountry,
|
|
57
|
+
state: shared_1.taxState,
|
|
58
|
+
amount_total: shared_1.taxMinorAmount.describe('What the customer pays.'),
|
|
59
|
+
amount_net: shared_1.taxMinorAmount,
|
|
60
|
+
tax_amount_exclusive: shared_1.taxMinorAmount,
|
|
61
|
+
tax_amount_inclusive: shared_1.taxMinorAmount,
|
|
62
|
+
line_items: zod_1.z.array(exports.taxCalculationLineItemSchema),
|
|
63
|
+
tax_date: primitives_1.unixSeconds,
|
|
64
|
+
created: primitives_1.unixSeconds,
|
|
65
|
+
expires_at: primitives_1.unixSeconds,
|
|
66
|
+
livemode: primitives_1.livemode,
|
|
67
|
+
})
|
|
68
|
+
.strict(), {
|
|
69
|
+
examples: [
|
|
70
|
+
{
|
|
71
|
+
object: 'tax.calculation',
|
|
72
|
+
id: 'taxcalc_0193b8f2c1a87d3e9f4a',
|
|
73
|
+
currency: 'EUR',
|
|
74
|
+
collection: 'collect',
|
|
75
|
+
registration_id: 'taxreg_0193b8f2c1a87d3e9f4a',
|
|
76
|
+
provider: 'stripe_tax',
|
|
77
|
+
provider_calculation_ref: 'taxcalc_1QxYz2AbCdEf',
|
|
78
|
+
customer_location_evidence_id: 'taxloc_0193b8f2c1a87d3e9f4a',
|
|
79
|
+
country: 'DE',
|
|
80
|
+
state: null,
|
|
81
|
+
amount_total: 1190,
|
|
82
|
+
amount_net: 1000,
|
|
83
|
+
tax_amount_exclusive: 190,
|
|
84
|
+
tax_amount_inclusive: 0,
|
|
85
|
+
line_items: [
|
|
86
|
+
{
|
|
87
|
+
reference: 'plan_pro_monthly',
|
|
88
|
+
quantity: 1,
|
|
89
|
+
tax_code: 'txcd_10103001',
|
|
90
|
+
tax_behavior: 'exclusive',
|
|
91
|
+
amount: 1000,
|
|
92
|
+
amount_tax: 190,
|
|
93
|
+
amount_net: 1000,
|
|
94
|
+
breakdown: [
|
|
95
|
+
{
|
|
96
|
+
country: 'DE',
|
|
97
|
+
state: null,
|
|
98
|
+
level: 'country',
|
|
99
|
+
display_name: 'VAT',
|
|
100
|
+
tax_type: 'vat',
|
|
101
|
+
rate_percentage: '19.0',
|
|
102
|
+
taxable_amount: 1000,
|
|
103
|
+
amount: 190,
|
|
104
|
+
inclusive: false,
|
|
105
|
+
taxability_reason: 'standard_rated',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
tax_date: 1793750400,
|
|
111
|
+
created: 1793750400,
|
|
112
|
+
expires_at: 1793836800,
|
|
113
|
+
livemode: false,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
exports.taxLineItemParams = zod_1.z
|
|
118
|
+
.object({
|
|
119
|
+
reference: zod_1.z.string().min(1).max(200),
|
|
120
|
+
amount: zod_1.z
|
|
121
|
+
.number()
|
|
122
|
+
.int()
|
|
123
|
+
.nonnegative()
|
|
124
|
+
.safe()
|
|
125
|
+
.describe('Unit amount × quantity, minor units. Includes tax when inclusive.'),
|
|
126
|
+
quantity: zod_1.z.number().int().positive().max(1000000).optional(),
|
|
127
|
+
tax_code: zod_1.z
|
|
128
|
+
.string()
|
|
129
|
+
.optional()
|
|
130
|
+
.describe("Defaults to the product's tax code, then the merchant's default."),
|
|
131
|
+
tax_behavior: zod_1.z
|
|
132
|
+
.enum(tax_1.TAX_BEHAVIORS)
|
|
133
|
+
.optional()
|
|
134
|
+
.describe("Defaults to the merchant's default tax behavior."),
|
|
135
|
+
})
|
|
136
|
+
.strict();
|
|
137
|
+
exports.createTaxCalculationParams = zod_1.z
|
|
138
|
+
.object({
|
|
139
|
+
currency: zod_1.z.string().regex(/^[A-Za-z]{3}$/),
|
|
140
|
+
customer_location_evidence_id: shared_1.taxReferenceParam.describe('Sufficient, unexpired evidence (`taxloc_…`).'),
|
|
141
|
+
line_items: zod_1.z
|
|
142
|
+
.array(exports.taxLineItemParams)
|
|
143
|
+
.min(1)
|
|
144
|
+
.max(100)
|
|
145
|
+
.refine((lines) => new Set(lines.map((line) => line.reference)).size === lines.length, 'Line references must be unique'),
|
|
146
|
+
})
|
|
147
|
+
.strict();
|
|
148
|
+
exports.taxCalculationRoutes = [
|
|
149
|
+
(0, route_1.defineRoute)({
|
|
150
|
+
operationId: 'createTaxCalculation',
|
|
151
|
+
method: 'post',
|
|
152
|
+
path: '/v1/tax/calculations',
|
|
153
|
+
tag: 'Tax',
|
|
154
|
+
summary: 'Calculate tax',
|
|
155
|
+
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.',
|
|
156
|
+
auth: 'service',
|
|
157
|
+
scope: 'payments:write',
|
|
158
|
+
idempotent: true,
|
|
159
|
+
body: exports.createTaxCalculationParams,
|
|
160
|
+
response: exports.taxCalculationSchema,
|
|
161
|
+
status: 201,
|
|
162
|
+
sdk: 'tax.calculations.create',
|
|
163
|
+
}),
|
|
164
|
+
(0, route_1.defineRoute)({
|
|
165
|
+
operationId: 'retrieveTaxCalculation',
|
|
166
|
+
method: 'get',
|
|
167
|
+
path: '/v1/tax/calculations/{id}',
|
|
168
|
+
tag: 'Tax',
|
|
169
|
+
summary: 'Retrieve a tax calculation',
|
|
170
|
+
auth: 'service',
|
|
171
|
+
scope: 'payments:read',
|
|
172
|
+
params: { id: 'The calculation (`taxcalc_…`).' },
|
|
173
|
+
response: exports.taxCalculationSchema,
|
|
174
|
+
sdk: 'tax.calculations.retrieve',
|
|
175
|
+
}),
|
|
176
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxCapabilityRoutes = exports.taxComplianceCapabilitiesSchema = exports.taxComplianceCapabilitySchema = 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
|
+
/** What Peable Tax compliance can and cannot do, each stated rather than simulated. */
|
|
10
|
+
exports.taxComplianceCapabilitySchema = (0, objects_1.defineComponent)('TaxComplianceCapability', zod_1.z
|
|
11
|
+
.object({
|
|
12
|
+
id: zod_1.z.string(),
|
|
13
|
+
category: zod_1.z
|
|
14
|
+
.enum(tax_1.TAX_COMPLIANCE_CAPABILITY_CATEGORIES)
|
|
15
|
+
.describe('VAT/sales tax, corporate income tax and annual company filings are different obligations.'),
|
|
16
|
+
status: zod_1.z.enum(tax_1.TAX_COMPLIANCE_CAPABILITY_STATUSES),
|
|
17
|
+
reason: zod_1.z.string(),
|
|
18
|
+
})
|
|
19
|
+
.strict());
|
|
20
|
+
exports.taxComplianceCapabilitiesSchema = (0, objects_1.defineObject)('tax.compliance_capabilities', 'TaxComplianceCapabilities', zod_1.z
|
|
21
|
+
.object({
|
|
22
|
+
object: zod_1.z.literal('tax.compliance_capabilities'),
|
|
23
|
+
livemode: primitives_1.livemode,
|
|
24
|
+
rule_set_version: zod_1.z.string(),
|
|
25
|
+
supported_rules: zod_1.z.array(zod_1.z.string()).describe('The ids of the rules assessed.'),
|
|
26
|
+
capabilities: zod_1.z.array(exports.taxComplianceCapabilitySchema),
|
|
27
|
+
})
|
|
28
|
+
.strict());
|
|
29
|
+
exports.taxCapabilityRoutes = [
|
|
30
|
+
(0, route_1.defineRoute)({
|
|
31
|
+
operationId: 'retrieveTaxComplianceCapabilities',
|
|
32
|
+
method: 'get',
|
|
33
|
+
path: '/v1/tax/capabilities',
|
|
34
|
+
tag: 'Tax compliance',
|
|
35
|
+
summary: 'Retrieve compliance capabilities',
|
|
36
|
+
description: 'What is available, limited, not available or out of scope — Peable submits, files and pays nothing with any authority.',
|
|
37
|
+
auth: 'service',
|
|
38
|
+
scope: 'payments:read',
|
|
39
|
+
response: exports.taxComplianceCapabilitiesSchema,
|
|
40
|
+
sdk: 'tax.compliance.retrieveCapabilities',
|
|
41
|
+
}),
|
|
42
|
+
];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxCodeRoutes = exports.taxCodeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
6
|
+
const objects_1 = require("../../common/objects");
|
|
7
|
+
const route_1 = require("../../route");
|
|
8
|
+
/** A product tax code Peable accepts (`txcd_…`, Stripe Tax's ids). */
|
|
9
|
+
exports.taxCodeSchema = (0, objects_1.defineComponent)('TaxCode', zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
id: zod_1.z.string().describe('`txcd_…`.'),
|
|
12
|
+
name: zod_1.z.string(),
|
|
13
|
+
description: zod_1.z.string(),
|
|
14
|
+
})
|
|
15
|
+
.strict(), {
|
|
16
|
+
examples: [
|
|
17
|
+
{
|
|
18
|
+
id: 'txcd_10103001',
|
|
19
|
+
name: 'Software as a service (SaaS) - business use',
|
|
20
|
+
description: 'Hosted software accessed online, sold to businesses for business use.',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
exports.taxCodeRoutes = [
|
|
25
|
+
(0, route_1.defineRoute)({
|
|
26
|
+
operationId: 'listTaxCodes',
|
|
27
|
+
method: 'get',
|
|
28
|
+
path: '/v1/tax/codes',
|
|
29
|
+
tag: 'Tax',
|
|
30
|
+
summary: 'List tax codes',
|
|
31
|
+
description: 'Every product tax code Peable accepts: a complete list, `has_more` is `false`.',
|
|
32
|
+
auth: 'service',
|
|
33
|
+
scope: 'payments:read',
|
|
34
|
+
response: (0, envelopes_1.listOf)(exports.taxCodeSchema),
|
|
35
|
+
sdk: 'tax.listCodes',
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxComplianceActionRoutes = exports.listTaxComplianceActionsQuery = exports.taxComplianceActionSchema = 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
|
+
/** One recorded compliance change (`taxact_…`), written in the transaction of the change itself. */
|
|
13
|
+
exports.taxComplianceActionSchema = (0, objects_1.defineObject)('tax.compliance_action', 'TaxComplianceAction', zod_1.z
|
|
14
|
+
.object({
|
|
15
|
+
object: zod_1.z.literal('tax.compliance_action'),
|
|
16
|
+
id: zod_1.z.string().describe('`taxact_…`.'),
|
|
17
|
+
livemode: primitives_1.livemode,
|
|
18
|
+
action: zod_1.z.string().describe('e.g. `business_profile.updated`, `review_item.resolved`.'),
|
|
19
|
+
actor: zod_1.z.object({ type: zod_1.z.enum(tax_1.TAX_ACTOR_TYPES), id: primitives_1.nullableString }).strict(),
|
|
20
|
+
object_type: zod_1.z.string(),
|
|
21
|
+
object_id: primitives_1.nullableString,
|
|
22
|
+
details: shared_1.taxFacts.describe('Field names and statuses that changed — never the values of a document or a number.'),
|
|
23
|
+
created: primitives_1.unixSeconds,
|
|
24
|
+
})
|
|
25
|
+
.strict(), {
|
|
26
|
+
examples: [
|
|
27
|
+
{
|
|
28
|
+
object: 'tax.compliance_action',
|
|
29
|
+
id: 'taxact_0193b8f2c1a87d3e9f4a',
|
|
30
|
+
livemode: false,
|
|
31
|
+
action: 'review_item.resolved',
|
|
32
|
+
actor: { type: 'user', id: 'user_42' },
|
|
33
|
+
object_type: 'tax.review_item',
|
|
34
|
+
object_id: 'taxrev_0193b8f2c1a87d3e9f4a',
|
|
35
|
+
details: { decision: 'will_register' },
|
|
36
|
+
created: 1793750400,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
exports.listTaxComplianceActionsQuery = (0, params_1.listQuery)({});
|
|
41
|
+
exports.taxComplianceActionRoutes = [
|
|
42
|
+
(0, route_1.defineRoute)({
|
|
43
|
+
operationId: 'listTaxComplianceActions',
|
|
44
|
+
method: 'get',
|
|
45
|
+
path: '/v1/tax/compliance_actions',
|
|
46
|
+
tag: 'Tax compliance',
|
|
47
|
+
summary: 'List compliance actions',
|
|
48
|
+
description: 'The history of every compliance change, newest first.',
|
|
49
|
+
auth: 'service',
|
|
50
|
+
scope: 'payments:read',
|
|
51
|
+
query: exports.listTaxComplianceActionsQuery,
|
|
52
|
+
response: (0, envelopes_1.listOf)(exports.taxComplianceActionSchema),
|
|
53
|
+
sdk: 'tax.compliance.listActions',
|
|
54
|
+
expandable: 'tax.compliance_action',
|
|
55
|
+
}),
|
|
56
|
+
];
|