@peable.to/contracts 0.4.0 → 1.1.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/dashboard.js +68 -0
- package/dist/cjs/vocabulary/errors.js +175 -0
- package/dist/cjs/vocabulary/events.js +176 -0
- package/dist/cjs/vocabulary/files.js +44 -0
- package/dist/cjs/vocabulary/identity.js +12 -0
- package/dist/cjs/vocabulary/index.js +39 -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/dashboard.js +64 -0
- package/dist/esm/vocabulary/errors.js +170 -0
- package/dist/esm/vocabulary/events.js +173 -0
- package/dist/esm/vocabulary/files.js +41 -0
- package/dist/esm/vocabulary/identity.js +9 -0
- package/dist/esm/vocabulary/index.js +23 -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/dashboard.d.ts +44 -0
- package/dist/types/vocabulary/errors.d.ts +146 -0
- package/dist/types/vocabulary/events.d.ts +171 -0
- package/dist/types/vocabulary/files.d.ts +30 -0
- package/dist/types/vocabulary/identity.d.ts +9 -0
- package/dist/types/vocabulary/index.d.ts +19 -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,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxSettingsRoutes = exports.updateTaxSettingsParams = exports.taxSettingsSchema = exports.taxAddressParams = exports.taxAddressSchema = 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
|
+
* Peable Tax settings (ADR 0011): the seller's legal identity and defaults, and
|
|
12
|
+
* whether the owner has approved collection. Changed and approved by the owner
|
|
13
|
+
* in Orbit only; the merchant API reads them.
|
|
14
|
+
*/
|
|
15
|
+
/** An address as Peable Tax stores it: only `country` is always present. */
|
|
16
|
+
exports.taxAddressSchema = (0, objects_1.defineComponent)('TaxAddress', zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
country: shared_1.taxCountry,
|
|
19
|
+
state: zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.nullable()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('ISO 3166-2 subdivision without the country prefix (`CA`, `QC`).'),
|
|
24
|
+
postal_code: zod_1.z.string().nullable().optional(),
|
|
25
|
+
city: zod_1.z.string().nullable().optional(),
|
|
26
|
+
line1: zod_1.z.string().nullable().optional(),
|
|
27
|
+
line2: zod_1.z.string().nullable().optional(),
|
|
28
|
+
})
|
|
29
|
+
.strict());
|
|
30
|
+
const addressLine = zod_1.z.string().trim().min(1).max(200).nullish();
|
|
31
|
+
/** An address in a tax request. */
|
|
32
|
+
exports.taxAddressParams = zod_1.z
|
|
33
|
+
.object({
|
|
34
|
+
country: zod_1.z.string().regex(/^[A-Z]{2}$/),
|
|
35
|
+
state: zod_1.z
|
|
36
|
+
.string()
|
|
37
|
+
.regex(/^[A-Z0-9]{1,3}$/)
|
|
38
|
+
.nullish(),
|
|
39
|
+
postal_code: zod_1.z.string().trim().min(1).max(20).nullish(),
|
|
40
|
+
city: addressLine,
|
|
41
|
+
line1: addressLine,
|
|
42
|
+
line2: addressLine,
|
|
43
|
+
})
|
|
44
|
+
.strict();
|
|
45
|
+
exports.taxSettingsSchema = (0, objects_1.defineObject)('tax.settings', 'TaxSettings', zod_1.z
|
|
46
|
+
.object({
|
|
47
|
+
object: zod_1.z.literal('tax.settings'),
|
|
48
|
+
merchant_id: zod_1.z.string().describe('The merchant (`merch_…`) these settings belong to.'),
|
|
49
|
+
status: zod_1.z
|
|
50
|
+
.enum(tax_1.TAX_SETTINGS_STATUSES)
|
|
51
|
+
.describe('`active` once the owner approved; any edit returns it to `draft`.'),
|
|
52
|
+
legal_name: primitives_1.nullableString,
|
|
53
|
+
head_office: exports.taxAddressSchema.nullable(),
|
|
54
|
+
default_tax_code: zod_1.z.string().describe('The `txcd_…` a line without its own code uses.'),
|
|
55
|
+
default_tax_behavior: zod_1.z.enum(tax_1.TAX_BEHAVIORS),
|
|
56
|
+
calculation_account: zod_1.z
|
|
57
|
+
.enum(tax_1.TAX_CALCULATION_ACCOUNTS)
|
|
58
|
+
.describe("`platform`: Peable's own provider account (official Oxy applications only). `none`: registered sales cannot be calculated and fail closed."),
|
|
59
|
+
provider: primitives_1.nullableString.describe('The provider that calculates registered sales, when one is reachable.'),
|
|
60
|
+
approved_at: primitives_1.unixSeconds.nullable(),
|
|
61
|
+
approved_by: primitives_1.nullableString.describe('The Oxy user who approved collection.'),
|
|
62
|
+
updated_at: primitives_1.unixSeconds.nullable(),
|
|
63
|
+
})
|
|
64
|
+
.strict(), {
|
|
65
|
+
examples: [
|
|
66
|
+
{
|
|
67
|
+
object: 'tax.settings',
|
|
68
|
+
merchant_id: 'merch_0193b8f2c1a87d3e9f4a',
|
|
69
|
+
status: 'active',
|
|
70
|
+
legal_name: 'Example Software SL',
|
|
71
|
+
head_office: { country: 'ES', state: null, postal_code: '08001', city: 'Barcelona' },
|
|
72
|
+
default_tax_code: 'txcd_10103001',
|
|
73
|
+
default_tax_behavior: 'exclusive',
|
|
74
|
+
calculation_account: 'platform',
|
|
75
|
+
provider: 'stripe_tax',
|
|
76
|
+
approved_at: 1793750400,
|
|
77
|
+
approved_by: 'user_42',
|
|
78
|
+
updated_at: 1793750400,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
/** Orbit's settings update (the owner's, never the merchant API's). Any change returns the settings to `draft`. */
|
|
83
|
+
exports.updateTaxSettingsParams = zod_1.z
|
|
84
|
+
.object({
|
|
85
|
+
legal_name: zod_1.z.string().trim().min(1).max(200).nullable().optional(),
|
|
86
|
+
head_office: exports.taxAddressParams.nullable().optional(),
|
|
87
|
+
default_tax_code: zod_1.z.string().optional(),
|
|
88
|
+
default_tax_behavior: zod_1.z.enum(tax_1.TAX_BEHAVIORS).optional(),
|
|
89
|
+
})
|
|
90
|
+
.strict();
|
|
91
|
+
exports.taxSettingsRoutes = [
|
|
92
|
+
(0, route_1.defineRoute)({
|
|
93
|
+
operationId: 'retrieveTaxSettings',
|
|
94
|
+
method: 'get',
|
|
95
|
+
path: '/v1/tax/settings',
|
|
96
|
+
tag: 'Tax',
|
|
97
|
+
summary: 'Retrieve tax settings',
|
|
98
|
+
description: 'Settings are changed, and collection approved, by the owner in Orbit. Until approved, `POST /v1/tax/calculations` refuses with `tax_settings_not_active`.',
|
|
99
|
+
auth: 'service',
|
|
100
|
+
scope: 'payments:read',
|
|
101
|
+
response: exports.taxSettingsSchema,
|
|
102
|
+
sdk: 'tax.retrieveSettings',
|
|
103
|
+
}),
|
|
104
|
+
];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.complianceIdParam = exports.complianceTextParam = exports.complianceStateParam = exports.complianceCountryParam = exports.taxFacts = exports.taxCoverageLimitSchema = exports.taxRuleSourceSchema = exports.taxInstantParam = exports.taxReferenceParam = exports.taxMinorAmount = exports.taxState = exports.taxCountry = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const objects_1 = require("../../common/objects");
|
|
6
|
+
const params_1 = require("../../common/params");
|
|
7
|
+
/**
|
|
8
|
+
* Building blocks every Peable Tax resource shares.
|
|
9
|
+
*
|
|
10
|
+
* Tax AMOUNTS (calculations, transactions, the report) are integer JSON
|
|
11
|
+
* numbers in the currency's minor unit, as Peable Tax has always answered
|
|
12
|
+
* them: unlike a FAIR amount, a tax amount is denominated in a fiat currency
|
|
13
|
+
* and is bounded by the safe-integer checks the calculator applies. Business
|
|
14
|
+
* compliance (ADR 0020) amounts are base-unit strings, as ADR 0014 D1 has it.
|
|
15
|
+
*/
|
|
16
|
+
/** ISO 3166-1 alpha-2, as returned. */
|
|
17
|
+
exports.taxCountry = zod_1.z.string().describe('ISO 3166-1 alpha-2.');
|
|
18
|
+
/** An ISO 3166-2 subdivision without its country prefix (`CA`, `QC`), as returned. */
|
|
19
|
+
exports.taxState = zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.nullable()
|
|
22
|
+
.describe('ISO 3166-2 subdivision without the country prefix (`CA`, `QC`).');
|
|
23
|
+
/** A minor-unit integer amount (cents), signed: a reversal's amounts are negative. */
|
|
24
|
+
exports.taxMinorAmount = zod_1.z
|
|
25
|
+
.number()
|
|
26
|
+
.int()
|
|
27
|
+
.describe('Minor units of `currency` (cents), as an integer.');
|
|
28
|
+
/** A Peable-side reference: a product, a customer, a refund. */
|
|
29
|
+
exports.taxReferenceParam = zod_1.z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(128)
|
|
33
|
+
.regex(/^[A-Za-z0-9_.:-]+$/);
|
|
34
|
+
/** An instant in a tax request body. */
|
|
35
|
+
exports.taxInstantParam = params_1.unixSecondsParam;
|
|
36
|
+
/** An official source a rule rests on. */
|
|
37
|
+
exports.taxRuleSourceSchema = (0, objects_1.defineComponent)('TaxRuleSource', zod_1.z
|
|
38
|
+
.object({
|
|
39
|
+
title: zod_1.z.string(),
|
|
40
|
+
publisher: zod_1.z.string(),
|
|
41
|
+
url: zod_1.z.string(),
|
|
42
|
+
})
|
|
43
|
+
.strict());
|
|
44
|
+
/** What a rule cannot see or decide, stated rather than implied. */
|
|
45
|
+
exports.taxCoverageLimitSchema = (0, objects_1.defineComponent)('TaxCoverageLimit', zod_1.z.object({ code: zod_1.z.string(), message: zod_1.z.string() }).strict());
|
|
46
|
+
/** The facts a finding or a change rests on: field names, counts, ids — never personal data. */
|
|
47
|
+
exports.taxFacts = zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.null()]));
|
|
48
|
+
// ── Business compliance request fields (ADR 0020) ────────────────────────────
|
|
49
|
+
/** A country in a compliance request. */
|
|
50
|
+
exports.complianceCountryParam = zod_1.z
|
|
51
|
+
.string()
|
|
52
|
+
.regex(/^[A-Z]{2}$/, 'a country is an ISO 3166-1 alpha-2 code');
|
|
53
|
+
/** A subdivision in a compliance request; `null` for the whole country. */
|
|
54
|
+
exports.complianceStateParam = zod_1.z
|
|
55
|
+
.string()
|
|
56
|
+
.regex(/^[A-Z0-9]{1,3}$/, 'a state is its ISO 3166-2 subdivision code')
|
|
57
|
+
.nullable();
|
|
58
|
+
/** Free text in a compliance request: trimmed, never empty (`null` clears it). */
|
|
59
|
+
const complianceTextParam = (max) => zod_1.z.string().trim().min(1).max(max).nullable();
|
|
60
|
+
exports.complianceTextParam = complianceTextParam;
|
|
61
|
+
/** An id another compliance object is linked by (`taxrd_…`, `taxreg_…`, `file_…`). */
|
|
62
|
+
exports.complianceIdParam = zod_1.z.string().min(1).max(64);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taxTransactionRoutes = exports.createTaxReversalParams = exports.listTaxTransactionsQuery = exports.taxTransactionSchema = exports.taxTransactionReversalSchema = 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 calculations_1 = require("./calculations");
|
|
12
|
+
const shared_1 = require("./shared");
|
|
13
|
+
/**
|
|
14
|
+
* A tax transaction (`taxtxn_…`, ADR 0011/0013): a calculation that was paid,
|
|
15
|
+
* created by Peable when the payment it priced is accepted on its rail. The
|
|
16
|
+
* report and filings are built from these. A `reversal` is a refund (or credit
|
|
17
|
+
* note) of an earlier transaction, netted into the original's report rows,
|
|
18
|
+
* never a deletion of it.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* What a reversal gave back: the original calculation's amounts, scaled to the
|
|
22
|
+
* refunded share and NEGATIVE (positive only when it reinstates an earlier
|
|
23
|
+
* reversal, e.g. a refund the bank later failed).
|
|
24
|
+
*/
|
|
25
|
+
exports.taxTransactionReversalSchema = (0, objects_1.defineComponent)('TaxTransactionReversal', zod_1.z
|
|
26
|
+
.object({
|
|
27
|
+
amount_total: shared_1.taxMinorAmount,
|
|
28
|
+
amount_net: shared_1.taxMinorAmount,
|
|
29
|
+
tax_amount: shared_1.taxMinorAmount,
|
|
30
|
+
line_items: zod_1.z.array(calculations_1.taxCalculationLineItemSchema),
|
|
31
|
+
})
|
|
32
|
+
.strict());
|
|
33
|
+
exports.taxTransactionSchema = (0, objects_1.defineObject)('tax.transaction', 'TaxTransaction', zod_1.z
|
|
34
|
+
.object({
|
|
35
|
+
object: zod_1.z.literal('tax.transaction'),
|
|
36
|
+
id: zod_1.z.string().describe('`taxtxn_…`.'),
|
|
37
|
+
type: zod_1.z.enum(tax_1.TAX_TRANSACTION_TYPES),
|
|
38
|
+
calculation_id: zod_1.z.string().describe('The calculation (`taxcalc_…`) that was paid.'),
|
|
39
|
+
reference: zod_1.z.string().describe("The rail's own object, e.g. the invoice id."),
|
|
40
|
+
rail: zod_1.z.string(),
|
|
41
|
+
committed_at: primitives_1.unixSeconds.describe('The tax date a filing period is judged by.'),
|
|
42
|
+
reversal_of: primitives_1.nullableString.describe("The original transaction's id, for a reversal."),
|
|
43
|
+
reversal: exports.taxTransactionReversalSchema.nullable(),
|
|
44
|
+
calculation: calculations_1.taxCalculationSchema,
|
|
45
|
+
})
|
|
46
|
+
.strict());
|
|
47
|
+
/** The shared list parameters; `created[...]` filters `committed_at`. */
|
|
48
|
+
exports.listTaxTransactionsQuery = (0, params_1.listQuery)({});
|
|
49
|
+
/**
|
|
50
|
+
* Record a refund made outside Peable (a FairCoin payment is refunded from the
|
|
51
|
+
* seller's own wallet, never by the gateway). Card refunds and credit notes are
|
|
52
|
+
* observed from the provider instead, so the two cannot double-count one refund.
|
|
53
|
+
*/
|
|
54
|
+
exports.createTaxReversalParams = zod_1.z
|
|
55
|
+
.object({
|
|
56
|
+
reference: zod_1.z
|
|
57
|
+
.string()
|
|
58
|
+
.min(1)
|
|
59
|
+
.max(200)
|
|
60
|
+
.regex(/^[A-Za-z0-9_.:-]+$/)
|
|
61
|
+
.describe("The refund's own reference; a repeated reference returns the same reversal."),
|
|
62
|
+
amount: zod_1.z
|
|
63
|
+
.number()
|
|
64
|
+
.int()
|
|
65
|
+
.positive()
|
|
66
|
+
.safe()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe('Gross minor units refunded (what the payer got back). Omitted: everything not yet reversed.'),
|
|
69
|
+
})
|
|
70
|
+
.strict();
|
|
71
|
+
exports.taxTransactionRoutes = [
|
|
72
|
+
(0, route_1.defineRoute)({
|
|
73
|
+
operationId: 'listTaxTransactions',
|
|
74
|
+
method: 'get',
|
|
75
|
+
path: '/v1/tax/transactions',
|
|
76
|
+
tag: 'Tax',
|
|
77
|
+
summary: 'List tax transactions',
|
|
78
|
+
description: 'Newest first. `created` filters on `committed_at` — the tax date a filing period is judged by.',
|
|
79
|
+
auth: 'service',
|
|
80
|
+
scope: 'payments:read',
|
|
81
|
+
query: exports.listTaxTransactionsQuery,
|
|
82
|
+
response: (0, envelopes_1.listOf)(exports.taxTransactionSchema),
|
|
83
|
+
sdk: 'tax.transactions.list',
|
|
84
|
+
expandable: 'tax.transaction',
|
|
85
|
+
}),
|
|
86
|
+
(0, route_1.defineRoute)({
|
|
87
|
+
operationId: 'createTaxReversal',
|
|
88
|
+
method: 'post',
|
|
89
|
+
path: '/v1/tax/transactions/{id}/reversals',
|
|
90
|
+
tag: 'Tax',
|
|
91
|
+
summary: 'Reverse a tax transaction',
|
|
92
|
+
description: 'For a refund the rail cannot report itself (FairCoin). Card refunds and credit notes, and Orbit invoices, are reversed from their own records and are refused here.',
|
|
93
|
+
auth: 'service',
|
|
94
|
+
scope: 'payments:write',
|
|
95
|
+
idempotent: true,
|
|
96
|
+
params: { id: 'The original transaction (`taxtxn_…`).' },
|
|
97
|
+
body: exports.createTaxReversalParams,
|
|
98
|
+
response: exports.taxTransactionSchema,
|
|
99
|
+
status: 201,
|
|
100
|
+
sdk: 'tax.transactions.createReversal',
|
|
101
|
+
}),
|
|
102
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineRoute = defineRoute;
|
|
4
|
+
exports.expressPath = expressPath;
|
|
5
|
+
exports.pathParamNames = pathParamNames;
|
|
6
|
+
exports.isJsonResponse = isJsonResponse;
|
|
7
|
+
/** Declare a route, keeping its literal types for the SDK's inference. */
|
|
8
|
+
function defineRoute(route) {
|
|
9
|
+
return route;
|
|
10
|
+
}
|
|
11
|
+
/** `/v1/customers/{id}` → `/v1/customers/:id`, Express's spelling. */
|
|
12
|
+
function expressPath(path) {
|
|
13
|
+
return path.replace(/\{([^}]+)\}/g, ':$1');
|
|
14
|
+
}
|
|
15
|
+
/** The path parameter names of a template, in order. */
|
|
16
|
+
function pathParamNames(path) {
|
|
17
|
+
return [...path.matchAll(/\{([^}]+)\}/g)].map((match) => match[1]);
|
|
18
|
+
}
|
|
19
|
+
/** Whether `response` is a JSON schema (as opposed to bytes or a stream). */
|
|
20
|
+
function isJsonResponse(response) {
|
|
21
|
+
return '_zod' in response;
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.routes = void 0;
|
|
4
|
+
exports.routeOf = routeOf;
|
|
5
|
+
const billingEngine_1 = require("./resources/billingEngine");
|
|
6
|
+
const catalog_1 = require("./resources/catalog");
|
|
7
|
+
const checkout_1 = require("./resources/checkout");
|
|
8
|
+
const connect_1 = require("./resources/connect");
|
|
9
|
+
const core_1 = require("./resources/core");
|
|
10
|
+
const events_1 = require("./resources/events");
|
|
11
|
+
const payments_1 = require("./resources/payments");
|
|
12
|
+
const tax_1 = require("./resources/tax");
|
|
13
|
+
// Annotated, not inferred: the inferred tuple of every route is larger than the
|
|
14
|
+
// declaration emitter serializes. Each group's own tuple keeps its literal types.
|
|
15
|
+
exports.routes = [
|
|
16
|
+
...core_1.coreRoutes,
|
|
17
|
+
...payments_1.paymentsRoutes,
|
|
18
|
+
...checkout_1.checkoutRoutes,
|
|
19
|
+
...catalog_1.catalogRoutes,
|
|
20
|
+
...billingEngine_1.billingEngineRoutes,
|
|
21
|
+
...connect_1.connectRoutes,
|
|
22
|
+
...tax_1.taxRoutes,
|
|
23
|
+
...events_1.eventsRoutes,
|
|
24
|
+
];
|
|
25
|
+
/** The route of an operation. */
|
|
26
|
+
function routeOf(operationId) {
|
|
27
|
+
const route = exports.routes.find((candidate) => candidate.operationId === operationId);
|
|
28
|
+
if (!route)
|
|
29
|
+
throw new Error(`no route '${operationId}'`);
|
|
30
|
+
return route;
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The customer portal (ADR 0018 §9) — the closed value sets its schemas are
|
|
3
|
+
// built from. Zod-free: `@peable.to/shared-types` re-exports them at runtime.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.PORTAL_PAYMENT_METHOD_UPDATE_STATUSES = exports.PORTAL_SUBSCRIPTION_UPDATES = exports.PORTAL_CANCEL_PRORATION_BEHAVIORS = exports.PORTAL_CANCEL_MODES = exports.PORTAL_CUSTOMER_UPDATES = void 0;
|
|
6
|
+
/** What a portal customer may edit about themselves. */
|
|
7
|
+
exports.PORTAL_CUSTOMER_UPDATES = ['email', 'name', 'address', 'phone'];
|
|
8
|
+
/** When a cancellation from the portal takes effect. */
|
|
9
|
+
exports.PORTAL_CANCEL_MODES = ['at_period_end', 'immediately'];
|
|
10
|
+
/** How a cancellation from the portal prorates. */
|
|
11
|
+
exports.PORTAL_CANCEL_PRORATION_BEHAVIORS = ['create_prorations', 'none'];
|
|
12
|
+
/** What a plan change from the portal may change. */
|
|
13
|
+
exports.PORTAL_SUBSCRIPTION_UPDATES = ['price', 'quantity'];
|
|
14
|
+
/** What finishing a payment method update from the portal answered. */
|
|
15
|
+
exports.PORTAL_PAYMENT_METHOD_UPDATE_STATUSES = ['succeeded', 'pending'];
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BILLING_RAIL_RENEWALS = exports.BILLING_RAIL_SETTLEMENTS = exports.BILLING_SUBSCRIPTION_STATUSES = exports.METER_STATUSES = exports.METER_AGGREGATIONS = exports.BILLING_SETTINGS_LIMITS = exports.DUNNING_INVOICE_ACTIONS = exports.DUNNING_FINAL_ACTIONS = exports.TEST_CLOCK_STATUSES = exports.RECURRING_INTERVAL_COUNT_MAX = exports.CATALOG_MAX_WHOLE_UNITS = exports.CATALOG_LIMITS = exports.COUPON_DURATIONS = exports.TRANSFORM_QUANTITY_ROUNDS = exports.PRICE_TAX_BEHAVIORS = exports.RECURRING_USAGE_TYPES = exports.RECURRING_INTERVALS = exports.PRICE_TYPES = exports.PRICE_TIERS_MODES = exports.PRICE_BILLING_SCHEMES = void 0;
|
|
4
|
+
exports.maxBaseUnits = maxBaseUnits;
|
|
5
|
+
// The catalog's and the billing engine platform's closed value sets (ADR 0016,
|
|
6
|
+
// ADR 0018): what a price, a coupon, a test clock, a meter and the billing
|
|
7
|
+
// settings can say, and the bounds the gateway enforces — restated so a form
|
|
8
|
+
// can say them first. Zod-free: the wallet bundles this.
|
|
9
|
+
const money_1 = require("./money");
|
|
10
|
+
/** How a price's amount is computed from a quantity. */
|
|
11
|
+
exports.PRICE_BILLING_SCHEMES = ['per_unit', 'tiered'];
|
|
12
|
+
/**
|
|
13
|
+
* How a tiered price reads its tiers.
|
|
14
|
+
*
|
|
15
|
+
* - `volume` — the WHOLE quantity is priced at the tier it falls into.
|
|
16
|
+
* - `graduated` — each unit is priced at the tier it falls into, so a
|
|
17
|
+
* quantity crossing two tiers pays each tier's rate for its
|
|
18
|
+
* share, plus the flat amount of every tier it reaches.
|
|
19
|
+
*/
|
|
20
|
+
exports.PRICE_TIERS_MODES = ['graduated', 'volume'];
|
|
21
|
+
/** `recurring` when the price has a recurring component, `one_time` otherwise. */
|
|
22
|
+
exports.PRICE_TYPES = ['one_time', 'recurring'];
|
|
23
|
+
exports.RECURRING_INTERVALS = ['day', 'week', 'month', 'year'];
|
|
24
|
+
/**
|
|
25
|
+
* `licensed` bills the quantity on the subscription. `metered` bills the usage
|
|
26
|
+
* a meter (`recurring.meter`, `mtr_…`) aggregated over the period, in arrears.
|
|
27
|
+
*/
|
|
28
|
+
exports.RECURRING_USAGE_TYPES = ['licensed', 'metered'];
|
|
29
|
+
/**
|
|
30
|
+
* Whether a price includes tax (Peable Tax, ADR 0011). `unspecified` defers to
|
|
31
|
+
* the merchant's default tax behavior; once a price says `inclusive` or
|
|
32
|
+
* `exclusive` it can never change.
|
|
33
|
+
*/
|
|
34
|
+
exports.PRICE_TAX_BEHAVIORS = ['inclusive', 'exclusive', 'unspecified'];
|
|
35
|
+
exports.TRANSFORM_QUANTITY_ROUNDS = ['up', 'down'];
|
|
36
|
+
/** How long a coupon's discount lasts once applied to a subscription. */
|
|
37
|
+
exports.COUPON_DURATIONS = ['once', 'repeating', 'forever'];
|
|
38
|
+
/** The bounds the gateway enforces, published so a form can say them first. */
|
|
39
|
+
exports.CATALOG_LIMITS = Object.freeze({
|
|
40
|
+
productNameMax: 250,
|
|
41
|
+
productDescriptionMax: 40000,
|
|
42
|
+
productImagesMax: 8,
|
|
43
|
+
urlMax: 2048,
|
|
44
|
+
unitLabelMax: 12,
|
|
45
|
+
statementDescriptorMax: 22,
|
|
46
|
+
marketingFeaturesMax: 15,
|
|
47
|
+
marketingFeatureNameMax: 80,
|
|
48
|
+
priceNicknameMax: 250,
|
|
49
|
+
lookupKeyMax: 200,
|
|
50
|
+
lookupKeysFilterMax: 10,
|
|
51
|
+
priceTiersMax: 250,
|
|
52
|
+
couponIdMax: 64,
|
|
53
|
+
couponNameMax: 40,
|
|
54
|
+
couponAppliesToProductsMax: 100,
|
|
55
|
+
couponDurationInMonthsMax: 1200,
|
|
56
|
+
promotionCodeMax: 64,
|
|
57
|
+
idsFilterMax: 100,
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* The largest amount the catalog stores, in whole units of any currency, so a
|
|
61
|
+
* FAIR amount (8 decimals) and a EUR amount (2) are bounded at the same real
|
|
62
|
+
* size rather than the same number of digits.
|
|
63
|
+
*/
|
|
64
|
+
exports.CATALOG_MAX_WHOLE_UNITS = 1000000000n;
|
|
65
|
+
/** The largest base-unit amount of `currency` the catalog accepts. */
|
|
66
|
+
function maxBaseUnits(currency) {
|
|
67
|
+
return exports.CATALOG_MAX_WHOLE_UNITS * 10n ** BigInt((0, money_1.decimalsFor)(currency)) - 1n;
|
|
68
|
+
}
|
|
69
|
+
/** The longest a recurring interval may be: three years, in each unit. */
|
|
70
|
+
exports.RECURRING_INTERVAL_COUNT_MAX = Object.freeze({
|
|
71
|
+
day: 1095,
|
|
72
|
+
week: 156,
|
|
73
|
+
month: 36,
|
|
74
|
+
year: 3,
|
|
75
|
+
});
|
|
76
|
+
// ---- Test clocks -------------------------------------------------------------
|
|
77
|
+
exports.TEST_CLOCK_STATUSES = ['ready', 'advancing', 'internal_failure'];
|
|
78
|
+
// ---- Billing settings --------------------------------------------------------
|
|
79
|
+
/** What dunning does to a subscription once the last retry has failed. */
|
|
80
|
+
exports.DUNNING_FINAL_ACTIONS = ['cancel', 'unpaid', 'past_due'];
|
|
81
|
+
/** What happens to the invoice itself once the last retry has failed. */
|
|
82
|
+
exports.DUNNING_INVOICE_ACTIONS = ['leave_open', 'mark_uncollectible'];
|
|
83
|
+
/** The bounds the gateway enforces on billing settings. */
|
|
84
|
+
exports.BILLING_SETTINGS_LIMITS = Object.freeze({
|
|
85
|
+
retriesMax: 8,
|
|
86
|
+
retryDaysMax: 60,
|
|
87
|
+
daysUntilDueMax: 365,
|
|
88
|
+
invoicePrefixPattern: '^[A-Z0-9]{3,12}$',
|
|
89
|
+
});
|
|
90
|
+
// ---- Meters ------------------------------------------------------------------
|
|
91
|
+
/** How a meter combines a period's events into the quantity billed. */
|
|
92
|
+
exports.METER_AGGREGATIONS = ['sum', 'count', 'last'];
|
|
93
|
+
exports.METER_STATUSES = ['active', 'inactive'];
|
|
94
|
+
// ---- Recurring billing transport (`/v1/billing/*`) ---------------------------
|
|
95
|
+
/** A provider subscription's status, as the recurring transport observes it. */
|
|
96
|
+
exports.BILLING_SUBSCRIPTION_STATUSES = [
|
|
97
|
+
'incomplete',
|
|
98
|
+
'incomplete_expired',
|
|
99
|
+
'trialing',
|
|
100
|
+
'active',
|
|
101
|
+
'past_due',
|
|
102
|
+
'canceled',
|
|
103
|
+
'unpaid',
|
|
104
|
+
'paused',
|
|
105
|
+
];
|
|
106
|
+
/** `fiat` (Stripe and any further provider) or `faircoin` (native, to the merchant's watch-only wallet). */
|
|
107
|
+
exports.BILLING_RAIL_SETTLEMENTS = ['fiat', 'faircoin'];
|
|
108
|
+
/** `automatic`: the provider charges each period. `payer_initiated`: each period is an explicit payment. */
|
|
109
|
+
exports.BILLING_RAIL_RENEWALS = ['automatic', 'payer_initiated'];
|
|
110
|
+
// Product tax codes are Peable Tax's vocabulary: `vocabulary/tax.ts` (`TAX_CODES`).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Checkout vocabulary (Orbit Phase 3): the closed value sets and bounds of
|
|
3
|
+
// Checkout Sessions and Payment Links. Zod-free, so the hosted checkout and
|
|
4
|
+
// the wallet import them without the schemas (`@peable.to/contracts/vocabulary`,
|
|
5
|
+
// re-exported by `@peable.to/shared-types`).
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PAYMENT_LINK_LIMITS = exports.CHECKOUT_SESSION_ID_TEMPLATE = exports.CHECKOUT_LIMITS = exports.CHECKOUT_TAX_ID_TYPES = exports.CHECKOUT_CUSTOM_FIELD_TYPES = exports.CHECKOUT_BILLING_ADDRESS_COLLECTIONS = exports.CHECKOUT_CUSTOMER_CREATIONS = exports.CHECKOUT_SUBMIT_TYPES = exports.CHECKOUT_LOCALES = exports.CHECKOUT_UI_MODES = exports.CHECKOUT_PAYMENT_STATUSES = exports.CHECKOUT_SESSION_STATUSES = exports.CHECKOUT_SESSION_MODES = void 0;
|
|
8
|
+
exports.CHECKOUT_SESSION_MODES = ['payment', 'setup', 'subscription'];
|
|
9
|
+
exports.CHECKOUT_SESSION_STATUSES = ['open', 'complete', 'expired'];
|
|
10
|
+
exports.CHECKOUT_PAYMENT_STATUSES = ['paid', 'unpaid', 'no_payment_required'];
|
|
11
|
+
exports.CHECKOUT_UI_MODES = ['hosted', 'embedded'];
|
|
12
|
+
/** The languages the hosted and embedded checkout speak. */
|
|
13
|
+
exports.CHECKOUT_LOCALES = ['en', 'es', 'fr', 'de', 'it', 'pt'];
|
|
14
|
+
exports.CHECKOUT_SUBMIT_TYPES = ['auto', 'pay', 'book', 'donate'];
|
|
15
|
+
exports.CHECKOUT_CUSTOMER_CREATIONS = ['always', 'if_required'];
|
|
16
|
+
exports.CHECKOUT_BILLING_ADDRESS_COLLECTIONS = ['auto', 'required'];
|
|
17
|
+
exports.CHECKOUT_CUSTOM_FIELD_TYPES = ['text', 'numeric', 'dropdown'];
|
|
18
|
+
/** Stripe's tax id types Peable collects; `eu_vat` covers every EU member state. */
|
|
19
|
+
exports.CHECKOUT_TAX_ID_TYPES = [
|
|
20
|
+
'eu_vat',
|
|
21
|
+
'gb_vat',
|
|
22
|
+
'ch_vat',
|
|
23
|
+
'no_vat',
|
|
24
|
+
'us_ein',
|
|
25
|
+
'ca_bn',
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Bounds of the session contract, shared by the gateway's validators and the
|
|
29
|
+
* clients that build requests, so the two cannot drift.
|
|
30
|
+
*/
|
|
31
|
+
exports.CHECKOUT_LIMITS = Object.freeze({
|
|
32
|
+
lineItemsMax: 20,
|
|
33
|
+
quantityMax: 999999,
|
|
34
|
+
customFieldsMax: 3,
|
|
35
|
+
customFieldKeyMax: 200,
|
|
36
|
+
customFieldLabelMax: 50,
|
|
37
|
+
customFieldTextMax: 255,
|
|
38
|
+
dropdownOptionsMax: 200,
|
|
39
|
+
dropdownOptionLabelMax: 100,
|
|
40
|
+
dropdownOptionValueMax: 100,
|
|
41
|
+
clientReferenceIdMax: 200,
|
|
42
|
+
/** `expires_at` must be between 30 minutes and 24 hours from creation. */
|
|
43
|
+
expiresMinSeconds: 30 * 60,
|
|
44
|
+
expiresMaxSeconds: 24 * 3600,
|
|
45
|
+
shippingCountriesMax: 250,
|
|
46
|
+
termsTextMax: 1200,
|
|
47
|
+
});
|
|
48
|
+
/** The template a `success_url` may carry; replaced with the session's `cs_…`. */
|
|
49
|
+
exports.CHECKOUT_SESSION_ID_TEMPLATE = '{CHECKOUT_SESSION_ID}';
|
|
50
|
+
exports.PAYMENT_LINK_LIMITS = Object.freeze({
|
|
51
|
+
lineItemsMax: 20,
|
|
52
|
+
customMessageMax: 500,
|
|
53
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Connect and money vocabulary (ADR 0012, ADR 0015): the closed value sets of
|
|
3
|
+
// accounts, balances, payouts, application fees, transfers and reconciliation.
|
|
4
|
+
// Zod-free, like every vocabulary module.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TRANSFER_REVERSAL_STATUSES = exports.TRANSFER_STATUSES = exports.RECONCILIATION_MISMATCH_KINDS = exports.PAYOUT_RECONCILIATION_STATUSES = exports.PAYOUT_DESTINATION_TYPES = exports.PAYOUT_METHODS = exports.PAYOUT_STATUSES = exports.BALANCE_TRANSACTION_FEE_TYPES = exports.BALANCE_TRANSACTION_STATUSES = exports.BALANCE_TRANSACTION_TYPES = exports.PAYOUT_WEEKLY_ANCHORS = exports.PAYOUT_INTERVALS = exports.CONNECTED_ACCOUNT_FAIRCOIN_STATUSES = exports.CONNECTED_ACCOUNT_RAILS = exports.ACCOUNT_LINK_TYPES = exports.ACCOUNT_TYPES = exports.ACCOUNT_CAPABILITY_STATUSES = exports.ACCOUNT_BUSINESS_TYPES = void 0;
|
|
7
|
+
/** Which half of an account a business type opens: the provider's two kinds. */
|
|
8
|
+
exports.ACCOUNT_BUSINESS_TYPES = ['individual', 'company'];
|
|
9
|
+
/** A capability's state as the provider reports it; `null` on the wire means never requested. */
|
|
10
|
+
exports.ACCOUNT_CAPABILITY_STATUSES = ['active', 'pending', 'inactive'];
|
|
11
|
+
/** Whose account an `account` is: the merchant's own, or one of its marketplace sellers. */
|
|
12
|
+
exports.ACCOUNT_TYPES = ['merchant', 'connected'];
|
|
13
|
+
/** What a hosted onboarding link for the merchant's own account is for. */
|
|
14
|
+
exports.ACCOUNT_LINK_TYPES = ['account_onboarding', 'account_update'];
|
|
15
|
+
/**
|
|
16
|
+
* Which rails a seller's account was opened for (ADR 0012 D1). One seller is
|
|
17
|
+
* ONE `ca_…`: `card` is the provider account a marketplace settles to by
|
|
18
|
+
* transfer, `faircoin` is the seller's own watch-only key.
|
|
19
|
+
*/
|
|
20
|
+
exports.CONNECTED_ACCOUNT_RAILS = ['card', 'faircoin'];
|
|
21
|
+
/**
|
|
22
|
+
* Where a seller's FairCoin half stands: `pending` until the seller registers
|
|
23
|
+
* a key, `active` once they did.
|
|
24
|
+
*/
|
|
25
|
+
exports.CONNECTED_ACCOUNT_FAIRCOIN_STATUSES = ['pending', 'active'];
|
|
26
|
+
exports.PAYOUT_INTERVALS = ['manual', 'daily', 'weekly', 'monthly'];
|
|
27
|
+
exports.PAYOUT_WEEKLY_ANCHORS = [
|
|
28
|
+
'monday',
|
|
29
|
+
'tuesday',
|
|
30
|
+
'wednesday',
|
|
31
|
+
'thursday',
|
|
32
|
+
'friday',
|
|
33
|
+
'saturday',
|
|
34
|
+
'sunday',
|
|
35
|
+
];
|
|
36
|
+
/** Orbit's vocabulary for what moved — the provider's own types, provider-neutral. */
|
|
37
|
+
exports.BALANCE_TRANSACTION_TYPES = [
|
|
38
|
+
'charge',
|
|
39
|
+
'payment',
|
|
40
|
+
'refund',
|
|
41
|
+
'payment_refund',
|
|
42
|
+
'adjustment',
|
|
43
|
+
'application_fee',
|
|
44
|
+
'application_fee_refund',
|
|
45
|
+
'payout',
|
|
46
|
+
'payout_cancel',
|
|
47
|
+
'payout_failure',
|
|
48
|
+
'transfer',
|
|
49
|
+
'transfer_refund',
|
|
50
|
+
'dispute',
|
|
51
|
+
'dispute_reversal',
|
|
52
|
+
'processing_fee',
|
|
53
|
+
'faircoin_payment',
|
|
54
|
+
'faircoin_payment_reversal',
|
|
55
|
+
'other',
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* - `pending` / `available` — the provider's own status for the funds.
|
|
59
|
+
* - `informational` — a FairCoin payment: recorded, never part of a payable balance.
|
|
60
|
+
*/
|
|
61
|
+
exports.BALANCE_TRANSACTION_STATUSES = ['available', 'pending', 'informational'];
|
|
62
|
+
/** One component of a transaction's fee. `processing_fee` is the acquirer's own. */
|
|
63
|
+
exports.BALANCE_TRANSACTION_FEE_TYPES = [
|
|
64
|
+
'application_fee',
|
|
65
|
+
'processing_fee',
|
|
66
|
+
'tax',
|
|
67
|
+
'other',
|
|
68
|
+
];
|
|
69
|
+
exports.PAYOUT_STATUSES = ['pending', 'in_transit', 'paid', 'failed', 'canceled'];
|
|
70
|
+
exports.PAYOUT_METHODS = ['standard', 'instant'];
|
|
71
|
+
exports.PAYOUT_DESTINATION_TYPES = ['bank_account', 'card'];
|
|
72
|
+
/**
|
|
73
|
+
* A payout reconciliation report's state: `complete` once the payout is `paid`
|
|
74
|
+
* and its transactions were read from the provider, `pending` before.
|
|
75
|
+
*/
|
|
76
|
+
exports.PAYOUT_RECONCILIATION_STATUSES = ['complete', 'pending'];
|
|
77
|
+
/** What the daily reconciliation found disagreeing with the provider. Never auto-corrected. */
|
|
78
|
+
exports.RECONCILIATION_MISMATCH_KINDS = [
|
|
79
|
+
'missing_in_ledger',
|
|
80
|
+
'amount_mismatch',
|
|
81
|
+
'status_mismatch',
|
|
82
|
+
'missing_at_provider',
|
|
83
|
+
'payout_mismatch',
|
|
84
|
+
'unbalanced_journal',
|
|
85
|
+
];
|
|
86
|
+
/** Where one settlement stands. */
|
|
87
|
+
exports.TRANSFER_STATUSES = [
|
|
88
|
+
'pending',
|
|
89
|
+
'paid',
|
|
90
|
+
'partially_reversed',
|
|
91
|
+
'reversed',
|
|
92
|
+
'failed',
|
|
93
|
+
];
|
|
94
|
+
/** Where one reversal of a settlement stands. */
|
|
95
|
+
exports.TRANSFER_REVERSAL_STATUSES = ['pending', 'succeeded', 'failed'];
|