@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,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// What a signed-in person may do in Orbit — the ONE map from a dashboard
|
|
3
|
+
// action to the Oxy application permission it needs. Zod-free. The gateway
|
|
4
|
+
// gates every `/v1/dashboard/applications/:id/*` and contribution route on it
|
|
5
|
+
// (a refusal is `permission_required`, `param` naming the permission), and
|
|
6
|
+
// Orbit hides or disables what the person lacks with the SAME map, so the two
|
|
7
|
+
// can never disagree about who may do what.
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FILE_UPLOAD_ACTION = exports.DASHBOARD_PERMISSIONS = void 0;
|
|
10
|
+
exports.allowsDashboardAction = allowsDashboardAction;
|
|
11
|
+
/**
|
|
12
|
+
* The permissions are oxy-api's own APPLICATION vocabulary
|
|
13
|
+
* (`packages/api/src/utils/accountRoles.ts`, `APPLICATION_PERMISSIONS`): Oxy
|
|
14
|
+
* resolves the person's role, grants and revokes on the account that owns the
|
|
15
|
+
* application into `callerMembership.permissions`, and that list — from
|
|
16
|
+
* `apps.get` on the gateway, from `apps.list` in Orbit — is the whole answer.
|
|
17
|
+
* Peable never reads a role name and keeps no membership copy.
|
|
18
|
+
*/
|
|
19
|
+
exports.DASHBOARD_PERMISSIONS = {
|
|
20
|
+
/**
|
|
21
|
+
* Every read, the searches and a report run (it materialises the same rows a
|
|
22
|
+
* download streams). oxy-api answers an application only to a holder of
|
|
23
|
+
* `app:read`, so this is membership itself.
|
|
24
|
+
*/
|
|
25
|
+
read: 'app:read',
|
|
26
|
+
/**
|
|
27
|
+
* The integration's configuration: branding and customer emails, the
|
|
28
|
+
* catalog, checkout sessions and payment links, contribution links, payment
|
|
29
|
+
* methods and wallet domains, a business logo.
|
|
30
|
+
*/
|
|
31
|
+
configure: 'app:update',
|
|
32
|
+
/** Webhook endpoints and their signing secrets, test events, redelivery. */
|
|
33
|
+
webhooks: 'webhooks:update',
|
|
34
|
+
/**
|
|
35
|
+
* Money and who receives it: the merchant registration (its watch-only key
|
|
36
|
+
* and confirmations), the provider account and its onboarding and identity
|
|
37
|
+
* documents, payouts, sellers and transfers, disputes and their evidence, the
|
|
38
|
+
* billing engine, and every Peable Tax change or decision.
|
|
39
|
+
*/
|
|
40
|
+
money: 'billing:manage',
|
|
41
|
+
/** Peable Tax reads and previews (ADR 0011, ADR 0020). */
|
|
42
|
+
taxRead: 'billing:read',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A permission that CONTAINS another: whoever may manage billing may read it.
|
|
46
|
+
* Stated once so the gateway and Orbit apply the same containment.
|
|
47
|
+
*/
|
|
48
|
+
const IMPLIED_BY = {
|
|
49
|
+
'billing:read': 'billing:manage',
|
|
50
|
+
};
|
|
51
|
+
/** Whether `held` (Oxy's `callerMembership.permissions`) allows `action`. */
|
|
52
|
+
function allowsDashboardAction(held, action) {
|
|
53
|
+
const required = exports.DASHBOARD_PERMISSIONS[action];
|
|
54
|
+
const container = IMPLIED_BY[required];
|
|
55
|
+
return held.includes(required) || (container !== undefined && held.includes(container));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Uploading a file is the first half of USING it, so it needs what the use
|
|
59
|
+
* needs: a logo is configuration, everything else is evidence or identity for
|
|
60
|
+
* money (a dispute, the provider account, Peable Tax).
|
|
61
|
+
*/
|
|
62
|
+
exports.FILE_UPLOAD_ACTION = {
|
|
63
|
+
business_logo: 'configure',
|
|
64
|
+
dispute_evidence: 'money',
|
|
65
|
+
identity_document: 'money',
|
|
66
|
+
additional_verification: 'money',
|
|
67
|
+
tax_document: 'money',
|
|
68
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The error vocabulary (ADR 0014 D1). Zod-free: the documentation site renders
|
|
3
|
+
// its errors page from these two tables, and the backend's `sendError` takes an
|
|
4
|
+
// `ErrorCode`, so a code the gateway can answer with and the page does not list
|
|
5
|
+
// is a compile error rather than a dead `doc_url`.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ERROR_CODES = exports.ERROR_CODE_DESCRIPTIONS = exports.ERROR_DOCS_BASE_URL = exports.ERROR_TYPE_DESCRIPTIONS = exports.ERROR_TYPES = void 0;
|
|
8
|
+
exports.errorDocUrl = errorDocUrl;
|
|
9
|
+
exports.isErrorCode = isErrorCode;
|
|
10
|
+
/** `error.type`: the broad class a caller branches on first. */
|
|
11
|
+
exports.ERROR_TYPES = [
|
|
12
|
+
'api_error',
|
|
13
|
+
'authentication_error',
|
|
14
|
+
'card_error',
|
|
15
|
+
'idempotency_error',
|
|
16
|
+
'invalid_request_error',
|
|
17
|
+
'permission_error',
|
|
18
|
+
'rate_limit_error',
|
|
19
|
+
];
|
|
20
|
+
/** What each `error.type` means, and the HTTP status it comes with. */
|
|
21
|
+
exports.ERROR_TYPE_DESCRIPTIONS = {
|
|
22
|
+
api_error: 'Something went wrong on Peable or its provider (5xx, or 502 for a retryable provider fault). Safe to retry with the same `Idempotency-Key`.',
|
|
23
|
+
authentication_error: 'The credential is missing, expired or invalid (401).',
|
|
24
|
+
card_error: 'The payment method was declined (402). `decline_code` carries the issuer reason when there is one.',
|
|
25
|
+
idempotency_error: 'The `Idempotency-Key` was reused with a different request (400), or the first request with it is still running (409).',
|
|
26
|
+
invalid_request_error: 'The request is malformed, names something that does not exist, or conflicts with the state of an object (400, 404, 409).',
|
|
27
|
+
permission_error: 'The credential is valid but may not do this (403).',
|
|
28
|
+
rate_limit_error: 'Too many requests (429). Back off and retry.',
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Where every code is documented: the error-code page of Peable's docs on the
|
|
32
|
+
* Oxy developer site, generated from this file (`bun run generate:api-docs`,
|
|
33
|
+
* `packages/sdk/docs/errors.mdx`). The trailing slash is the page's canonical
|
|
34
|
+
* form; each code is its own fragment.
|
|
35
|
+
*/
|
|
36
|
+
exports.ERROR_DOCS_BASE_URL = 'https://oxy.so/developers/docs/peable/errors/';
|
|
37
|
+
/** The `doc_url` of a code. */
|
|
38
|
+
function errorDocUrl(code) {
|
|
39
|
+
return `${exports.ERROR_DOCS_BASE_URL}#${code}`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Every `error.code` the gateway answers with, and what it means. The keys ARE
|
|
43
|
+
* the list — {@link ERROR_CODES} is derived from them — so a new code cannot be
|
|
44
|
+
* added without its description.
|
|
45
|
+
*/
|
|
46
|
+
exports.ERROR_CODE_DESCRIPTIONS = {
|
|
47
|
+
account_invalid: 'The `Peable-Account` header names no connected account of this platform.',
|
|
48
|
+
account_missing: 'The merchant has no account object yet.',
|
|
49
|
+
amount_not_representable: 'The amount does not fit the currency or the rail.',
|
|
50
|
+
billing_not_enabled: 'Billing is not enabled for this merchant.',
|
|
51
|
+
billing_provider_unavailable: 'The billing provider could not be reached; retry.',
|
|
52
|
+
domain_taken: 'The domain is already registered by another merchant.',
|
|
53
|
+
file_too_large: 'The uploaded file is larger than its purpose allows.',
|
|
54
|
+
file_unavailable: 'The file exists but its contents cannot be served right now.',
|
|
55
|
+
idempotency_error: 'The `Idempotency-Key` was used with a different request, or its first request is still running.',
|
|
56
|
+
idempotency_key_invalid: 'The `Idempotency-Key` header is not a valid key.',
|
|
57
|
+
insufficient_scope: 'The credential is valid but was not granted the Oxy scope this route requires (`payments:read`, `payments:write`, …); `message` names it.',
|
|
58
|
+
invalid_billing_request: 'The billing request is not valid for this subscription or offer.',
|
|
59
|
+
keyless_recipient: 'The recipient has no receive key, so no address can be derived for them.',
|
|
60
|
+
link_not_found: 'The link does not exist or is no longer active.',
|
|
61
|
+
live_payments_gated: 'Live payments are not enabled for this application yet.',
|
|
62
|
+
local_test_request_required: 'This test helper only answers a local test request.',
|
|
63
|
+
parameter_invalid: 'A parameter is invalid; `param` names it.',
|
|
64
|
+
parameter_missing: 'A required parameter is missing; `param` names it.',
|
|
65
|
+
parameter_unknown: 'The request carries a parameter this route does not accept; `param` names it.',
|
|
66
|
+
payment_intent_unexpected_state: 'The PaymentIntent is in a status that does not allow this operation.',
|
|
67
|
+
payout_not_allowed: 'Payouts cannot be created for this account.',
|
|
68
|
+
rate_limited: 'Too many requests; back off and retry.',
|
|
69
|
+
refund_not_cancelable: 'The refund has already left a cancelable state.',
|
|
70
|
+
resource_conflict: 'The object changed under this request; read it again and retry.',
|
|
71
|
+
resource_missing: 'The object does not exist, or this credential cannot read it.',
|
|
72
|
+
setup_intent_unexpected_state: 'The SetupIntent is in a status that does not allow this operation.',
|
|
73
|
+
tax_not_enabled: 'Peable Tax is not enabled for this merchant.',
|
|
74
|
+
test_mode_only: 'This operation exists in test mode only.',
|
|
75
|
+
too_many_streams: 'Too many live streams are open for this merchant.',
|
|
76
|
+
url_invalid: 'The URL is not an allowed https URL.',
|
|
77
|
+
watch_only_violation: 'The extended key carries a private key. Peable only ever accepts watch-only (public) keys.',
|
|
78
|
+
webhook_endpoint_disabled: 'The webhook endpoint is disabled.',
|
|
79
|
+
webhook_endpoint_limit_reached: 'The merchant already has the maximum number of webhook endpoints.',
|
|
80
|
+
account_not_ready: 'The connected account cannot take this payment yet: its onboarding or a capability is incomplete.',
|
|
81
|
+
approval_incomplete: 'The tax settings cannot be approved yet: a legal name and head office are required, or they changed during the approval.',
|
|
82
|
+
approval_requires_provider: 'Registered sales need a tax provider, and this application has none: the approval would leave covered sales unpriceable.',
|
|
83
|
+
checkout_session_expired: 'The Checkout Session has expired.',
|
|
84
|
+
checkout_session_not_open: 'The Checkout Session is no longer open (complete or expired).',
|
|
85
|
+
customer_location_conflicting: "The customer's location evidence disagrees, so the sale cannot be placed in one jurisdiction.",
|
|
86
|
+
customer_location_expired: "The customer's location evidence is too old to price a sale with.",
|
|
87
|
+
customer_location_insufficient: "There is not enough evidence of the customer's location to decide whether the sale is taxed.",
|
|
88
|
+
customer_location_invalid: "The tax provider could not use the customer's location.",
|
|
89
|
+
dispute_already_submitted: 'Evidence for this dispute has already been submitted; it is one shot.',
|
|
90
|
+
dispute_not_answerable: 'The dispute is in a status that no longer accepts evidence.',
|
|
91
|
+
idempotency_conflict: 'The same operation key was used for a different billing request.',
|
|
92
|
+
identity_conflict: 'The billing identity already belongs to another customer or subscription.',
|
|
93
|
+
in_progress: 'The same operation is still running; retry with the same key.',
|
|
94
|
+
invalid_provider_response: 'The provider answered with something Peable cannot trust; the operation was not applied.',
|
|
95
|
+
invalid_registration: 'The tax registration is not valid.',
|
|
96
|
+
invalid_registration_declaration: 'The tax registration declaration is not valid.',
|
|
97
|
+
invalid_tax_code: 'The tax code does not exist.',
|
|
98
|
+
invalid_tax_document: 'The tax document is not valid for its declared purpose.',
|
|
99
|
+
invalid_tax_request: 'The tax request is not valid.',
|
|
100
|
+
lookup_key_taken: 'Another price already uses this `lookup_key`.',
|
|
101
|
+
mode_unavailable: 'This Checkout mode is not available to this merchant.',
|
|
102
|
+
not_found: 'The object does not exist, or this credential cannot read it.',
|
|
103
|
+
payment_link_inactive: 'The Payment Link is deactivated.',
|
|
104
|
+
price_is_default: "The price is its product's `default_price` and cannot be archived.",
|
|
105
|
+
product_has_prices: 'The product still has prices; archive it instead.',
|
|
106
|
+
product_in_use: 'The product is referenced by a subscription or a link.',
|
|
107
|
+
promotion_code_invalid: 'The promotion code does not exist, is inactive or does not apply.',
|
|
108
|
+
promotion_code_taken: 'Another active promotion code already uses this `code`.',
|
|
109
|
+
provider_unavailable: 'The payment provider could not be reached; retry.',
|
|
110
|
+
rail_unavailable: 'The payment rail this request needs is not available.',
|
|
111
|
+
reconciliation_required: 'The billing operation has an unknown outcome at the provider and is being reconciled.',
|
|
112
|
+
registration_immutable: 'An approved or ended tax registration cannot be deleted or changed this way; end it instead.',
|
|
113
|
+
resource_already_exists: 'An object with this identity already exists.',
|
|
114
|
+
result_expired: 'The stored result of this operation has expired.',
|
|
115
|
+
review_item_not_open: 'The review item is already resolved or dismissed.',
|
|
116
|
+
rule_set_version_unavailable: 'The tax rule set version is not available.',
|
|
117
|
+
subscription_line_invalid: 'A subscription line item is not valid for Checkout.',
|
|
118
|
+
tax_behavior_locked: "The price's `tax_behavior` cannot change once set.",
|
|
119
|
+
tax_calculation_unavailable: 'Tax could not be calculated; a covered sale fails closed.',
|
|
120
|
+
tax_provider_registration_mismatch: "The provider's registrations disagree with the ones Peable has approved.",
|
|
121
|
+
tax_settings_not_active: 'Tax settings are not active for this merchant.',
|
|
122
|
+
local_test_unavailable: 'The local test checkout is not available.',
|
|
123
|
+
local_test_configuration_unavailable: 'The local test checkout has no provider configuration.',
|
|
124
|
+
local_test_subscription_unavailable: 'The local test subscription cannot be read.',
|
|
125
|
+
rail_mismatch: 'The operation does not apply to the rail this payment uses.',
|
|
126
|
+
checkout_session_changed: 'The Checkout Session changed while this request ran (a price, a discount, its tax); read it again and retry.',
|
|
127
|
+
checkout_session_locked: 'The Checkout Session is being confirmed and cannot change.',
|
|
128
|
+
tax_calculation_failed: 'The tax for this Checkout Session could not be calculated.',
|
|
129
|
+
payment_cancellation_failed: 'The payment could not be cancelled at the provider; the Checkout Session stays as it was.',
|
|
130
|
+
invoice_not_editable: 'The invoice is finalized and can no longer be edited.',
|
|
131
|
+
invoice_unexpected_state: 'The invoice is in a status that does not allow this operation.',
|
|
132
|
+
invoice_no_customer_line_items: 'The invoice has no line items to finalize.',
|
|
133
|
+
invoice_payment_intent_requires_action: "The invoice's payment needs the customer to act (a card challenge).",
|
|
134
|
+
subscription_unexpected_state: 'The subscription is in a status that does not allow this operation.',
|
|
135
|
+
customer_currency_mismatch: "The currency differs from the customer's billing currency.",
|
|
136
|
+
customer_test_clock_mismatch: 'The objects live on different test clocks.',
|
|
137
|
+
coupon_invalid: 'The coupon does not exist or is no longer valid.',
|
|
138
|
+
coupon_currency_mismatch: "The coupon's currency differs from the purchase's.",
|
|
139
|
+
coupon_not_applicable: 'The coupon does not apply to these products.',
|
|
140
|
+
promotion_code_inactive: 'The promotion code is inactive.',
|
|
141
|
+
promotion_code_customer_mismatch: 'The promotion code is restricted to another customer.',
|
|
142
|
+
promotion_code_expired: 'The promotion code has expired.',
|
|
143
|
+
promotion_code_max_redemptions: 'The promotion code has been redeemed its maximum number of times.',
|
|
144
|
+
promotion_code_minimum_amount: 'The purchase is below the promotion code minimum amount.',
|
|
145
|
+
payment_method_missing: 'No payment method is available to charge.',
|
|
146
|
+
faircoin_cannot_debit: 'A FairCoin invoice cannot be charged automatically: the payer signs every payment.',
|
|
147
|
+
credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
|
|
148
|
+
test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
|
|
149
|
+
meter_event_customer_missing: 'The meter event names no customer of this merchant.',
|
|
150
|
+
feature_lookup_key_taken: 'Another feature already uses this `lookup_key`.',
|
|
151
|
+
portal_feature_disabled: 'The customer portal configuration does not allow this action.',
|
|
152
|
+
portal_session_expired: 'The customer portal session has expired.',
|
|
153
|
+
card_declined: 'The card was declined.',
|
|
154
|
+
promotion_code_first_time_only: "The promotion code is for a customer's first purchase only.",
|
|
155
|
+
network_mismatch: 'The FairCoin network differs from the one this object uses.',
|
|
156
|
+
// Connect onboarding (ADR 0012 D3): the seller-facing refusals.
|
|
157
|
+
link_expired: 'The onboarding link has expired or was already used; `refresh_url` is where the seller gets a fresh one.',
|
|
158
|
+
wrong_seller: 'The onboarding link names a different Oxy account; sign in as the seller it was minted for.',
|
|
159
|
+
already_registered: 'The seller already registered a FairCoin key, and it cannot be changed.',
|
|
160
|
+
key_in_use: 'The key already receives payments for another account.',
|
|
161
|
+
no_faircoin_half: 'The connected account has no FairCoin half to register a key for.',
|
|
162
|
+
// The dashboard routes (`/v1/dashboard/*`, Orbit): the signed-in person, not a credential.
|
|
163
|
+
merchant_missing: 'The application has no merchant in this environment yet; register one (Orbit shows "Set up payments").',
|
|
164
|
+
application_membership_required: 'The signed-in Oxy account is not a member of the account that owns this application.',
|
|
165
|
+
account_membership_required: "The signed-in Oxy account is not a member of the Oxy account the path names (a contribution route's organization).",
|
|
166
|
+
permission_required: 'The member lacks the Oxy permission this action needs; `param` names it (`app:update`, `webhooks:update`, `billing:read`, `billing:manage`). An owner grants it in Oxy Console.',
|
|
167
|
+
membership_unavailable: 'Oxy could not be asked what the signed-in person may do on this application or account; retry.',
|
|
168
|
+
session_invalid: 'Oxy no longer accepts the signed-in session; sign in again.',
|
|
169
|
+
};
|
|
170
|
+
/** Every error code, sorted. */
|
|
171
|
+
exports.ERROR_CODES = Object.keys(exports.ERROR_CODE_DESCRIPTIONS).sort();
|
|
172
|
+
/** Whether a string is a documented error code. */
|
|
173
|
+
function isErrorCode(value) {
|
|
174
|
+
return Object.hasOwn(exports.ERROR_CODE_DESCRIPTIONS, value);
|
|
175
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The event vocabulary (ADR 0014 D4, ADR 0019): every event type the gateway
|
|
3
|
+
// emits and the `object` type its `data.object` carries. Zod-free, so the SDK's
|
|
4
|
+
// signature check, the CLI and the backend's CHECK constraints read the same
|
|
5
|
+
// closed set without constructing a schema.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.WEBHOOK_DELIVERY_STATUSES = exports.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS = exports.WEBHOOK_ENDPOINT_DESCRIPTION_MAX = exports.WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = exports.WEBHOOK_ENDPOINT_DISABLED_REASONS = exports.WEBHOOK_ENDPOINT_STATUSES = exports.WEBHOOK_ENABLED_EVENTS = exports.TARGETED_WEBHOOK_EVENT_TYPES = exports.WEBHOOK_EVENT_TYPES = exports.WEBHOOK_EVENT_OBJECTS = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Event type → the `object` value of the resource under `data.object`.
|
|
10
|
+
*
|
|
11
|
+
* TOTAL and the ONLY list: {@link WEBHOOK_EVENT_TYPES} is its keys, so a new
|
|
12
|
+
* event type cannot exist without saying what it delivers — an event added
|
|
13
|
+
* with a default would silently ship a PaymentIntent to a consumer expecting
|
|
14
|
+
* something else, which typechecks on both sides and fails only in production.
|
|
15
|
+
* The precise payload TYPE is `WebhookEventPayload` (`resources/events`), the
|
|
16
|
+
* registered object of each value.
|
|
17
|
+
*
|
|
18
|
+
* The order is the database's: the backend's CHECK constraints list the types
|
|
19
|
+
* in this order, so reordering it is a migration.
|
|
20
|
+
*
|
|
21
|
+
* - `payment_intent.*` follow the status the intent reached (ADR 0019):
|
|
22
|
+
* `created` when it is minted, then one per transition — `requires_action`,
|
|
23
|
+
* `processing`, `amount_capturable_updated` (authorized, awaiting capture),
|
|
24
|
+
* `succeeded`, `payment_failed` (an attempt failed; a card returns to
|
|
25
|
+
* `requires_payment_method`, a FairCoin underpayment is also `canceled`) and
|
|
26
|
+
* `canceled` (by the merchant, by expiry — `abandoned` — or underpaid).
|
|
27
|
+
* - Refunds are not PaymentIntent statuses: `refund.*` carry the Refund, and
|
|
28
|
+
* `charge.refunded` the Charge whose `amount_refunded` moved.
|
|
29
|
+
* - A dispute is the network's process beside a payment that stays
|
|
30
|
+
* `succeeded`; its events carry the Dispute, never the evidence (which is not
|
|
31
|
+
* stored).
|
|
32
|
+
* - The catalog has no `price.deleted` or `promotion_code.deleted`: those are
|
|
33
|
+
* archived with `active: false`, and a type that can never be sent is a
|
|
34
|
+
* promise the catalog cannot keep.
|
|
35
|
+
*/
|
|
36
|
+
exports.WEBHOOK_EVENT_OBJECTS = {
|
|
37
|
+
'payment_intent.created': 'payment_intent',
|
|
38
|
+
'payment_intent.requires_action': 'payment_intent',
|
|
39
|
+
'payment_intent.processing': 'payment_intent',
|
|
40
|
+
'payment_intent.amount_capturable_updated': 'payment_intent',
|
|
41
|
+
'payment_intent.succeeded': 'payment_intent',
|
|
42
|
+
'payment_intent.payment_failed': 'payment_intent',
|
|
43
|
+
'payment_intent.canceled': 'payment_intent',
|
|
44
|
+
'charge.refunded': 'charge',
|
|
45
|
+
'charge.dispute.created': 'dispute',
|
|
46
|
+
'charge.dispute.updated': 'dispute',
|
|
47
|
+
'charge.dispute.closed': 'dispute',
|
|
48
|
+
'charge.dispute.funds_withdrawn': 'dispute',
|
|
49
|
+
'charge.dispute.funds_reinstated': 'dispute',
|
|
50
|
+
'refund.created': 'refund',
|
|
51
|
+
'refund.updated': 'refund',
|
|
52
|
+
'refund.failed': 'refund',
|
|
53
|
+
'customer.created': 'customer',
|
|
54
|
+
'customer.updated': 'customer',
|
|
55
|
+
'customer.deleted': 'customer',
|
|
56
|
+
'payment_method.attached': 'payment_method',
|
|
57
|
+
'payment_method.detached': 'payment_method',
|
|
58
|
+
'payment_method.updated': 'payment_method',
|
|
59
|
+
'setup_intent.created': 'setup_intent',
|
|
60
|
+
'setup_intent.requires_action': 'setup_intent',
|
|
61
|
+
'setup_intent.succeeded': 'setup_intent',
|
|
62
|
+
'setup_intent.setup_failed': 'setup_intent',
|
|
63
|
+
'setup_intent.canceled': 'setup_intent',
|
|
64
|
+
'billing.observation.updated': 'billing_observation',
|
|
65
|
+
'connected_account.updated': 'connected_account',
|
|
66
|
+
'product.created': 'product',
|
|
67
|
+
'product.updated': 'product',
|
|
68
|
+
'product.deleted': 'product',
|
|
69
|
+
'price.created': 'price',
|
|
70
|
+
'price.updated': 'price',
|
|
71
|
+
'coupon.created': 'coupon',
|
|
72
|
+
'coupon.updated': 'coupon',
|
|
73
|
+
'coupon.deleted': 'coupon',
|
|
74
|
+
'promotion_code.created': 'promotion_code',
|
|
75
|
+
'promotion_code.updated': 'promotion_code',
|
|
76
|
+
'account.updated': 'account',
|
|
77
|
+
'application_fee.created': 'application_fee',
|
|
78
|
+
'application_fee.refunded': 'application_fee',
|
|
79
|
+
'payout.created': 'payout',
|
|
80
|
+
'payout.updated': 'payout',
|
|
81
|
+
'payout.paid': 'payout',
|
|
82
|
+
'payout.failed': 'payout',
|
|
83
|
+
'payout.canceled': 'payout',
|
|
84
|
+
'balance.available': 'balance',
|
|
85
|
+
'checkout.session.completed': 'checkout_session',
|
|
86
|
+
'checkout.session.expired': 'checkout_session',
|
|
87
|
+
'checkout.session.async_payment_succeeded': 'checkout_session',
|
|
88
|
+
'checkout.session.async_payment_failed': 'checkout_session',
|
|
89
|
+
'payment_link.created': 'payment_link',
|
|
90
|
+
'payment_link.updated': 'payment_link',
|
|
91
|
+
'reporting.report_run.succeeded': 'reporting.report_run',
|
|
92
|
+
'reporting.report_run.failed': 'reporting.report_run',
|
|
93
|
+
'customer.subscription.created': 'subscription',
|
|
94
|
+
'customer.subscription.updated': 'subscription',
|
|
95
|
+
'customer.subscription.deleted': 'subscription',
|
|
96
|
+
'customer.subscription.trial_will_end': 'subscription',
|
|
97
|
+
'customer.subscription.paused': 'subscription',
|
|
98
|
+
'customer.subscription.resumed': 'subscription',
|
|
99
|
+
'invoice.created': 'invoice',
|
|
100
|
+
'invoice.updated': 'invoice',
|
|
101
|
+
'invoice.deleted': 'invoice',
|
|
102
|
+
'invoice.finalized': 'invoice',
|
|
103
|
+
'invoice.paid': 'invoice',
|
|
104
|
+
'invoice.payment_failed': 'invoice',
|
|
105
|
+
'invoice.payment_action_required': 'invoice',
|
|
106
|
+
'invoice.voided': 'invoice',
|
|
107
|
+
'invoice.marked_uncollectible': 'invoice',
|
|
108
|
+
'invoice.upcoming': 'invoice',
|
|
109
|
+
'invoice.sent': 'invoice',
|
|
110
|
+
'invoiceitem.created': 'invoiceitem',
|
|
111
|
+
'invoiceitem.deleted': 'invoiceitem',
|
|
112
|
+
'credit_note.created': 'credit_note',
|
|
113
|
+
'credit_note.updated': 'credit_note',
|
|
114
|
+
'credit_note.voided': 'credit_note',
|
|
115
|
+
'test_helpers.test_clock.created': 'test_helpers.test_clock',
|
|
116
|
+
'test_helpers.test_clock.advancing': 'test_helpers.test_clock',
|
|
117
|
+
'test_helpers.test_clock.ready': 'test_helpers.test_clock',
|
|
118
|
+
'test_helpers.test_clock.deleted': 'test_helpers.test_clock',
|
|
119
|
+
'billing.meter.created': 'billing.meter',
|
|
120
|
+
'billing.meter.updated': 'billing.meter',
|
|
121
|
+
'billing.meter.deactivated': 'billing.meter',
|
|
122
|
+
'billing.meter.reactivated': 'billing.meter',
|
|
123
|
+
'entitlements.active_entitlement_summary.updated': 'entitlements.active_entitlement_summary',
|
|
124
|
+
'billing_portal.configuration.created': 'billing_portal.configuration',
|
|
125
|
+
'billing_portal.configuration.updated': 'billing_portal.configuration',
|
|
126
|
+
'billing_portal.session.created': 'billing_portal.session',
|
|
127
|
+
'tax.assessment.created': 'tax.assessment',
|
|
128
|
+
'tax.review_item.created': 'tax.review_item',
|
|
129
|
+
'tax.review_item.updated': 'tax.review_item',
|
|
130
|
+
'webhook_endpoint.test': 'webhook_endpoint',
|
|
131
|
+
};
|
|
132
|
+
/** Every event type, in {@link WEBHOOK_EVENT_OBJECTS} order. */
|
|
133
|
+
exports.WEBHOOK_EVENT_TYPES = Object.keys(exports.WEBHOOK_EVENT_OBJECTS);
|
|
134
|
+
/**
|
|
135
|
+
* The event types never fanned out by subscription — sent only to the one
|
|
136
|
+
* endpoint they name. `enabled_events` refuses them.
|
|
137
|
+
*/
|
|
138
|
+
exports.TARGETED_WEBHOOK_EVENT_TYPES = [
|
|
139
|
+
'webhook_endpoint.test',
|
|
140
|
+
];
|
|
141
|
+
/** What `enabled_events` may hold: `*`, then every subscribable type. */
|
|
142
|
+
exports.WEBHOOK_ENABLED_EVENTS = [
|
|
143
|
+
'*',
|
|
144
|
+
...exports.WEBHOOK_EVENT_TYPES.filter((type) => !exports.TARGETED_WEBHOOK_EVENT_TYPES.includes(type)),
|
|
145
|
+
];
|
|
146
|
+
exports.WEBHOOK_ENDPOINT_STATUSES = ['enabled', 'disabled'];
|
|
147
|
+
/**
|
|
148
|
+
* Why an endpoint is `disabled`.
|
|
149
|
+
*
|
|
150
|
+
* - `disabled_by_merchant` — its owner set `disabled: true`.
|
|
151
|
+
* - `delivery_failures` — every delivery to it failed for three days
|
|
152
|
+
* straight, so Peable stopped sending. Re-enabling it (`disabled: false`)
|
|
153
|
+
* starts the clock again.
|
|
154
|
+
*/
|
|
155
|
+
exports.WEBHOOK_ENDPOINT_DISABLED_REASONS = [
|
|
156
|
+
'disabled_by_merchant',
|
|
157
|
+
'delivery_failures',
|
|
158
|
+
];
|
|
159
|
+
/** At most this many endpoints per merchant (per mode). */
|
|
160
|
+
exports.WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = 16;
|
|
161
|
+
/** The longest an endpoint's `description` may be. */
|
|
162
|
+
exports.WEBHOOK_ENDPOINT_DESCRIPTION_MAX = 5000;
|
|
163
|
+
/** The longest a rolled secret may keep signing beside its replacement. */
|
|
164
|
+
exports.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS = 24 * 60 * 60;
|
|
165
|
+
/**
|
|
166
|
+
* Where one webhook delivery stands (ADR 0001 D7).
|
|
167
|
+
*
|
|
168
|
+
* - `pending` — will be attempted. `next_attempt_at` says when.
|
|
169
|
+
* - `delivered` — terminal success.
|
|
170
|
+
* - `failed` — the endpoint REFUSED it (a 4xx, a blocked address), or the
|
|
171
|
+
* endpoint was disabled before it could be attempted. No retry
|
|
172
|
+
* can fix that, so none is made.
|
|
173
|
+
* - `dead` — every attempt failed transiently over three days and the
|
|
174
|
+
* budget ran out. It can be redelivered by hand.
|
|
175
|
+
*/
|
|
176
|
+
exports.WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed', 'dead'];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Files vocabulary (`file_…`): what a file is for, the formats it is stored
|
|
3
|
+
// in, and whether its bytes are being served. Zod-free.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.FILE_STATUSES = exports.FILE_TYPES = exports.FILE_UPLOAD_PURPOSES = exports.FILE_PURPOSES = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* What a file is FOR. Decided at upload and never changed: the purpose is what
|
|
8
|
+
* sets the type and size policy, who may see the bytes, and which objects may
|
|
9
|
+
* reference the file — a `business_logo` is public, a `dispute_evidence` file
|
|
10
|
+
* is private and can only be attached to the merchant's own disputes.
|
|
11
|
+
*/
|
|
12
|
+
exports.FILE_PURPOSES = [
|
|
13
|
+
'dispute_evidence',
|
|
14
|
+
'business_logo',
|
|
15
|
+
'identity_document',
|
|
16
|
+
'additional_verification',
|
|
17
|
+
'finance_report_run',
|
|
18
|
+
'tax_document',
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* The purposes a merchant may upload or import. `finance_report_run` is not
|
|
22
|
+
* among them: a report's CSV is written by Peable's report runs
|
|
23
|
+
* (`/v1/reporting/report_runs`) and nobody else, so a file of that purpose is
|
|
24
|
+
* always a report Peable produced.
|
|
25
|
+
*/
|
|
26
|
+
exports.FILE_UPLOAD_PURPOSES = [
|
|
27
|
+
'dispute_evidence',
|
|
28
|
+
'business_logo',
|
|
29
|
+
'identity_document',
|
|
30
|
+
'additional_verification',
|
|
31
|
+
'tax_document',
|
|
32
|
+
];
|
|
33
|
+
/** The stored format, by its conventional extension (Stripe's `type`). */
|
|
34
|
+
exports.FILE_TYPES = ['pdf', 'png', 'jpg', 'csv'];
|
|
35
|
+
/**
|
|
36
|
+
* Whether the bytes can be used right now.
|
|
37
|
+
*
|
|
38
|
+
* - `available` — Oxy serves the file; it can be shown or forwarded.
|
|
39
|
+
* - `withheld` — the file still exists and is not being served (its owner
|
|
40
|
+
* trashed it or made it private); it can come back.
|
|
41
|
+
* - `removed` — Oxy said the file is gone for good (deleted, taken down, lost).
|
|
42
|
+
* The object stays so whatever referenced it can say why it stopped working.
|
|
43
|
+
*/
|
|
44
|
+
exports.FILE_STATUSES = ['available', 'withheld', 'removed'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PEABLE_SERVICE_AUDIENCE = exports.PEABLE_OXY_APPLICATION_ID = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Peable's own Oxy application: the identity the gateway runs as (`OxyServer`'s
|
|
6
|
+
* `applicationId`) and the one an Oxy service addresses when it calls the
|
|
7
|
+
* gateway. One constant, so the gateway's accepted audience and the SDK's
|
|
8
|
+
* requested one cannot name two different applications.
|
|
9
|
+
*/
|
|
10
|
+
exports.PEABLE_OXY_APPLICATION_ID = '6a2f851751b784a86fd0e958';
|
|
11
|
+
/** The service-token audience of Peable's gateway (`oxy-service:<application id>`). */
|
|
12
|
+
exports.PEABLE_SERVICE_AUDIENCE = `oxy-service:${exports.PEABLE_OXY_APPLICATION_ID}`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// `@peable.to/contracts/vocabulary` — the zod-free half of the contract: the
|
|
18
|
+
// closed value sets (currencies, statuses, event types, error codes) a schema
|
|
19
|
+
// is built from. A bundle that must stay small imports this subpath, never the
|
|
20
|
+
// package root, which constructs every schema at load.
|
|
21
|
+
__exportStar(require("./billingPortal"), exports);
|
|
22
|
+
__exportStar(require("./connect"), exports);
|
|
23
|
+
__exportStar(require("./dashboard"), exports);
|
|
24
|
+
__exportStar(require("./catalog"), exports);
|
|
25
|
+
__exportStar(require("./errors"), exports);
|
|
26
|
+
__exportStar(require("./invoices"), exports);
|
|
27
|
+
__exportStar(require("./events"), exports);
|
|
28
|
+
__exportStar(require("./lists"), exports);
|
|
29
|
+
__exportStar(require("./money"), exports);
|
|
30
|
+
__exportStar(require("./tax"), exports);
|
|
31
|
+
__exportStar(require("./subscriptions"), exports);
|
|
32
|
+
__exportStar(require("./reporting"), exports);
|
|
33
|
+
__exportStar(require("./payments"), exports);
|
|
34
|
+
__exportStar(require("./version"), exports);
|
|
35
|
+
__exportStar(require("./checkout"), exports);
|
|
36
|
+
__exportStar(require("./files"), exports);
|
|
37
|
+
__exportStar(require("./identity"), exports);
|
|
38
|
+
__exportStar(require("./merchants"), exports);
|
|
39
|
+
__exportStar(require("./paymentMethodConfigurations"), exports);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Invoices, invoice items, credit notes and the customer balance (ADR 0018
|
|
3
|
+
// §2–4) — the closed value sets their schemas are built from. Zod-free:
|
|
4
|
+
// `@peable.to/shared-types` re-exports them at runtime.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PUBLIC_INVOICE_PAYMENT_METHOD_TYPES = exports.CUSTOMER_BALANCE_TRANSACTION_TYPES = exports.CREDIT_NOTE_LINE_TYPES = exports.CREDIT_NOTE_REASONS = exports.CREDIT_NOTE_TYPES = exports.CREDIT_NOTE_STATUSES = exports.PENDING_INVOICE_ITEMS_BEHAVIORS = exports.INVOICE_LINE_TYPES = exports.AUTOMATIC_TAX_STATUSES = exports.INVOICE_BILLING_REASONS = exports.INVOICE_STATUSES = void 0;
|
|
7
|
+
exports.INVOICE_STATUSES = ['draft', 'open', 'paid', 'void', 'uncollectible'];
|
|
8
|
+
/** Why an invoice exists. */
|
|
9
|
+
exports.INVOICE_BILLING_REASONS = [
|
|
10
|
+
'manual',
|
|
11
|
+
'subscription_create',
|
|
12
|
+
'subscription_cycle',
|
|
13
|
+
'subscription_update',
|
|
14
|
+
'subscription_cancel',
|
|
15
|
+
'upcoming',
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* `automatic_tax.status` — Peable Tax (ADR 0011) is computed before an invoice
|
|
19
|
+
* finalizes (ADR 0018 §2).
|
|
20
|
+
*
|
|
21
|
+
* - `requires_location_inputs` — the customer's location could not be
|
|
22
|
+
* established; the invoice cannot finalize until it can.
|
|
23
|
+
* - `failed` — the calculation failed closed (the provider
|
|
24
|
+
* was unavailable, or disagreed with Peable's registrations); retried.
|
|
25
|
+
* - `complete` — calculated (including `not_registered`,
|
|
26
|
+
* which is a calculation that collects zero).
|
|
27
|
+
*/
|
|
28
|
+
exports.AUTOMATIC_TAX_STATUSES = ['requires_location_inputs', 'failed', 'complete'];
|
|
29
|
+
/** Where an invoice line comes from: a subscription item's period, or an invoice item. */
|
|
30
|
+
exports.INVOICE_LINE_TYPES = ['subscription', 'invoiceitem'];
|
|
31
|
+
/** `pending_invoice_items_behavior` on an invoice create. Default `exclude` (Stripe's). */
|
|
32
|
+
exports.PENDING_INVOICE_ITEMS_BEHAVIORS = ['include', 'exclude'];
|
|
33
|
+
exports.CREDIT_NOTE_STATUSES = ['issued', 'void'];
|
|
34
|
+
/** `pre_payment` reduces what an open invoice asks for; `post_payment` gives back on a paid one. */
|
|
35
|
+
exports.CREDIT_NOTE_TYPES = ['pre_payment', 'post_payment'];
|
|
36
|
+
exports.CREDIT_NOTE_REASONS = [
|
|
37
|
+
'duplicate',
|
|
38
|
+
'fraudulent',
|
|
39
|
+
'order_change',
|
|
40
|
+
'product_unsatisfactory',
|
|
41
|
+
];
|
|
42
|
+
/** A credit note line: part of an invoice line, or a custom amount. */
|
|
43
|
+
exports.CREDIT_NOTE_LINE_TYPES = ['invoice_line_item', 'custom_line_item'];
|
|
44
|
+
exports.CUSTOMER_BALANCE_TRANSACTION_TYPES = [
|
|
45
|
+
'adjustment',
|
|
46
|
+
'applied_to_invoice',
|
|
47
|
+
'credit_note',
|
|
48
|
+
'invoice_overpaid',
|
|
49
|
+
'unapplied_from_invoice',
|
|
50
|
+
];
|
|
51
|
+
/** The rails a hosted invoice is paid on: a card through the provider's fields, FairCoin from the payer's wallet. */
|
|
52
|
+
exports.PUBLIC_INVOICE_PAYMENT_METHOD_TYPES = ['card', 'faircoin'];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// List and search bounds (ADR 0014 D1) — the gateway's, restated so a client
|
|
3
|
+
// can check before it asks.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.SEARCHABLE_RESOURCES = exports.SEARCH_SUBSTRING_MIN_LENGTH = exports.SEARCH_QUERY_MAX_CLAUSES = exports.SEARCH_QUERY_MAX_LENGTH = exports.LIST_LIMIT_MAX = exports.LIST_LIMIT_DEFAULT = void 0;
|
|
6
|
+
exports.LIST_LIMIT_DEFAULT = 10;
|
|
7
|
+
exports.LIST_LIMIT_MAX = 100;
|
|
8
|
+
exports.SEARCH_QUERY_MAX_LENGTH = 1000;
|
|
9
|
+
exports.SEARCH_QUERY_MAX_CLAUSES = 10;
|
|
10
|
+
/** A `~` substring needs at least this many characters (Stripe's rule). */
|
|
11
|
+
exports.SEARCH_SUBSTRING_MIN_LENGTH = 3;
|
|
12
|
+
/** Every searchable resource, by its path segment (`/v1/<resource>/search`). */
|
|
13
|
+
exports.SEARCHABLE_RESOURCES = [
|
|
14
|
+
'payment_intents',
|
|
15
|
+
'charges',
|
|
16
|
+
'customers',
|
|
17
|
+
'products',
|
|
18
|
+
'prices',
|
|
19
|
+
'refunds',
|
|
20
|
+
'subscriptions',
|
|
21
|
+
'invoices',
|
|
22
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Merchant vocabulary: the environments a merchant lives in, and the closed
|
|
3
|
+
// sets branding draws from. Every branding value is from a CLOSED set or a
|
|
4
|
+
// validated colour, so nothing a merchant stores can inject markup or a remote
|
|
5
|
+
// font into a payer's page or an email. Zod-free.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BRANDING_COLOR_PATTERN = exports.BRANDING_BORDER_STYLES = exports.BRANDING_FONTS = exports.MERCHANT_ENVIRONMENTS = void 0;
|
|
8
|
+
exports.MERCHANT_ENVIRONMENTS = ['development', 'staging', 'production'];
|
|
9
|
+
/** The fonts checkout may render in — system stacks only, no remote font is ever loaded. */
|
|
10
|
+
exports.BRANDING_FONTS = [
|
|
11
|
+
'system',
|
|
12
|
+
'inter',
|
|
13
|
+
'roboto',
|
|
14
|
+
'open_sans',
|
|
15
|
+
'lato',
|
|
16
|
+
'source_sans',
|
|
17
|
+
'noto_sans',
|
|
18
|
+
'serif',
|
|
19
|
+
'monospace',
|
|
20
|
+
];
|
|
21
|
+
exports.BRANDING_BORDER_STYLES = ['rounded', 'rectangular', 'pill'];
|
|
22
|
+
/** `#rrggbb`, lowercase — the only colour spelling branding stores. */
|
|
23
|
+
exports.BRANDING_COLOR_PATTERN = /^#[0-9a-f]{6}$/;
|