@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,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountRoutes = exports.createAccountLinkParams = exports.updateAccountParams = exports.accountLinkSchema = exports.accountSchema = exports.accountSettingsSchema = exports.accountPayoutScheduleSchema = exports.accountBusinessProfileSchema = exports.accountRequirementsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const objects_1 = require("../../common/objects");
|
|
6
|
+
const params_1 = require("../../common/params");
|
|
7
|
+
const primitives_1 = require("../../common/primitives");
|
|
8
|
+
const route_1 = require("../../route");
|
|
9
|
+
const connect_1 = require("../../vocabulary/connect");
|
|
10
|
+
/**
|
|
11
|
+
* The merchant's fiat account (ADR 0015 §1) — `GET /v1/account`.
|
|
12
|
+
*
|
|
13
|
+
* Orbit's funds never reach a Peable bank account: a merchant that takes fiat
|
|
14
|
+
* has its OWN provider account, opened and onboarded through Peable, and this
|
|
15
|
+
* object mirrors it. Everything here is what the provider last reported; the
|
|
16
|
+
* provider is the authority and Orbit never decides readiness itself. The
|
|
17
|
+
* provider's own `acct_…` never crosses (ADR 0016 D2).
|
|
18
|
+
*
|
|
19
|
+
* A marketplace's sellers (`/v1/connected_accounts`) are provider accounts too,
|
|
20
|
+
* and a platform reads one of them in this same shape by sending
|
|
21
|
+
* `Peable-Account: ca_…` to `GET /v1/account`.
|
|
22
|
+
*/
|
|
23
|
+
const capabilityStatus = zod_1.z.enum(connect_1.ACCOUNT_CAPABILITY_STATUSES);
|
|
24
|
+
/**
|
|
25
|
+
* What the provider is waiting on. Requirement IDENTIFIERS only
|
|
26
|
+
* (`individual.verification.document`), never their values: the gateway
|
|
27
|
+
* records that a document is owed and never learns what it says.
|
|
28
|
+
*/
|
|
29
|
+
exports.accountRequirementsSchema = (0, objects_1.defineComponent)('AccountRequirements', zod_1.z
|
|
30
|
+
.object({
|
|
31
|
+
currently_due: zod_1.z.array(zod_1.z.string()),
|
|
32
|
+
eventually_due: zod_1.z.array(zod_1.z.string()),
|
|
33
|
+
past_due: zod_1.z.array(zod_1.z.string()),
|
|
34
|
+
pending_verification: zod_1.z
|
|
35
|
+
.array(zod_1.z.string())
|
|
36
|
+
.describe('Submitted and being checked — nothing for the merchant to do.'),
|
|
37
|
+
disabled_reason: zod_1.z
|
|
38
|
+
.string()
|
|
39
|
+
.nullable()
|
|
40
|
+
.describe("Why charges or payouts are disabled, in the provider's own code, or `null`."),
|
|
41
|
+
})
|
|
42
|
+
.strict());
|
|
43
|
+
exports.accountBusinessProfileSchema = (0, objects_1.defineComponent)('AccountBusinessProfile', zod_1.z
|
|
44
|
+
.object({
|
|
45
|
+
name: zod_1.z.string().nullable(),
|
|
46
|
+
url: zod_1.z.string().nullable(),
|
|
47
|
+
support_email: zod_1.z.string().nullable(),
|
|
48
|
+
support_url: zod_1.z.string().nullable(),
|
|
49
|
+
product_description: zod_1.z.string().nullable(),
|
|
50
|
+
mcc: zod_1.z.string().nullable().describe('Merchant category code.'),
|
|
51
|
+
})
|
|
52
|
+
.strict());
|
|
53
|
+
/**
|
|
54
|
+
* When the provider pays the balance out. `manual` means only an explicit
|
|
55
|
+
* `POST /v1/payouts` does — the provider still executes it; Orbit never moves
|
|
56
|
+
* the money itself (ADR 0015 §4).
|
|
57
|
+
*/
|
|
58
|
+
exports.accountPayoutScheduleSchema = (0, objects_1.defineComponent)('AccountPayoutSchedule', zod_1.z
|
|
59
|
+
.object({
|
|
60
|
+
interval: zod_1.z.enum(connect_1.PAYOUT_INTERVALS),
|
|
61
|
+
delay_days: zod_1.z
|
|
62
|
+
.number()
|
|
63
|
+
.int()
|
|
64
|
+
.nullable()
|
|
65
|
+
.describe('Days between a payment and its funds becoming payable; `null` when not reported.'),
|
|
66
|
+
weekly_anchor: zod_1.z.enum(connect_1.PAYOUT_WEEKLY_ANCHORS).nullable().describe('`weekly` only.'),
|
|
67
|
+
monthly_anchor: zod_1.z
|
|
68
|
+
.number()
|
|
69
|
+
.int()
|
|
70
|
+
.nullable()
|
|
71
|
+
.describe('`monthly` only: the day of the month, 1–31.'),
|
|
72
|
+
})
|
|
73
|
+
.strict());
|
|
74
|
+
exports.accountSettingsSchema = (0, objects_1.defineComponent)('AccountSettings', zod_1.z
|
|
75
|
+
.object({
|
|
76
|
+
payouts: zod_1.z
|
|
77
|
+
.object({
|
|
78
|
+
schedule: exports.accountPayoutScheduleSchema.nullable(),
|
|
79
|
+
statement_descriptor: zod_1.z
|
|
80
|
+
.string()
|
|
81
|
+
.nullable()
|
|
82
|
+
.describe("What the merchant's bank statement shows for a payout."),
|
|
83
|
+
})
|
|
84
|
+
.strict(),
|
|
85
|
+
payments: zod_1.z
|
|
86
|
+
.object({
|
|
87
|
+
statement_descriptor: zod_1.z
|
|
88
|
+
.string()
|
|
89
|
+
.nullable()
|
|
90
|
+
.describe("What a cardholder's statement shows — the merchant is the merchant of record."),
|
|
91
|
+
})
|
|
92
|
+
.strict(),
|
|
93
|
+
branding: zod_1.z
|
|
94
|
+
.object({
|
|
95
|
+
primary_color: zod_1.z.string().nullable(),
|
|
96
|
+
secondary_color: zod_1.z.string().nullable(),
|
|
97
|
+
})
|
|
98
|
+
.strict(),
|
|
99
|
+
})
|
|
100
|
+
.strict());
|
|
101
|
+
exports.accountSchema = (0, objects_1.defineObject)('account', 'Account', zod_1.z
|
|
102
|
+
.object({
|
|
103
|
+
id: zod_1.z.string().describe('`ca_…` — the same id space as a marketplace seller.'),
|
|
104
|
+
object: zod_1.z.literal('account'),
|
|
105
|
+
livemode: primitives_1.livemode,
|
|
106
|
+
type: zod_1.z.enum(connect_1.ACCOUNT_TYPES),
|
|
107
|
+
country: zod_1.z.string().describe('ISO 3166-1 alpha-2. Fixed at the provider once created.'),
|
|
108
|
+
default_currency: zod_1.z.string().nullable(),
|
|
109
|
+
business_profile: exports.accountBusinessProfileSchema,
|
|
110
|
+
capabilities: zod_1.z
|
|
111
|
+
.object({
|
|
112
|
+
card_payments: capabilityStatus.nullable(),
|
|
113
|
+
transfers: capabilityStatus.nullable(),
|
|
114
|
+
})
|
|
115
|
+
.strict()
|
|
116
|
+
.describe('`null`: never requested — a different fact from the provider declining it.'),
|
|
117
|
+
requirements: exports.accountRequirementsSchema,
|
|
118
|
+
charges_enabled: zod_1.z
|
|
119
|
+
.boolean()
|
|
120
|
+
.describe('Whether the account can take payments as merchant of record (`on_behalf_of`).'),
|
|
121
|
+
payouts_enabled: zod_1.z
|
|
122
|
+
.boolean()
|
|
123
|
+
.describe("Whether the provider will pay this account's balance out."),
|
|
124
|
+
settings: exports.accountSettingsSchema,
|
|
125
|
+
last_synced_at: primitives_1.unixSeconds
|
|
126
|
+
.nullable()
|
|
127
|
+
.describe('The last provider read; `null` before the first one completed.'),
|
|
128
|
+
created: primitives_1.unixSeconds,
|
|
129
|
+
})
|
|
130
|
+
.strict(), {
|
|
131
|
+
examples: [
|
|
132
|
+
{
|
|
133
|
+
id: 'ca_0193b8f2c1a87d3e9f4a',
|
|
134
|
+
object: 'account',
|
|
135
|
+
livemode: false,
|
|
136
|
+
type: 'merchant',
|
|
137
|
+
country: 'ES',
|
|
138
|
+
default_currency: 'EUR',
|
|
139
|
+
business_profile: {
|
|
140
|
+
name: 'Rosen Ceramics',
|
|
141
|
+
url: 'https://rosen.example',
|
|
142
|
+
support_email: 'help@rosen.example',
|
|
143
|
+
support_url: null,
|
|
144
|
+
product_description: 'Handmade tableware',
|
|
145
|
+
mcc: '5719',
|
|
146
|
+
},
|
|
147
|
+
capabilities: { card_payments: 'active', transfers: 'active' },
|
|
148
|
+
requirements: {
|
|
149
|
+
currently_due: [],
|
|
150
|
+
eventually_due: [],
|
|
151
|
+
past_due: [],
|
|
152
|
+
pending_verification: [],
|
|
153
|
+
disabled_reason: null,
|
|
154
|
+
},
|
|
155
|
+
charges_enabled: true,
|
|
156
|
+
payouts_enabled: true,
|
|
157
|
+
settings: {
|
|
158
|
+
payouts: {
|
|
159
|
+
schedule: {
|
|
160
|
+
interval: 'weekly',
|
|
161
|
+
delay_days: 7,
|
|
162
|
+
weekly_anchor: 'friday',
|
|
163
|
+
monthly_anchor: null,
|
|
164
|
+
},
|
|
165
|
+
statement_descriptor: 'ROSEN CERAMICS',
|
|
166
|
+
},
|
|
167
|
+
payments: { statement_descriptor: 'ROSEN CERAMICS' },
|
|
168
|
+
branding: { primary_color: '#1f2937', secondary_color: null },
|
|
169
|
+
},
|
|
170
|
+
last_synced_at: 1793750460,
|
|
171
|
+
created: 1793750400,
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* A hosted onboarding link — the merchant's own account's
|
|
177
|
+
* (`POST /v1/account_links`) or a seller's
|
|
178
|
+
* (`POST /v1/connected_accounts/{accountId}/account_links`). Single-use and
|
|
179
|
+
* short-lived: mint one when the person is about to open it, never store it.
|
|
180
|
+
*/
|
|
181
|
+
exports.accountLinkSchema = (0, objects_1.defineObject)('account_link', 'AccountLink', zod_1.z
|
|
182
|
+
.object({
|
|
183
|
+
object: zod_1.z.literal('account_link'),
|
|
184
|
+
livemode: primitives_1.livemode,
|
|
185
|
+
url: zod_1.z.string().describe('Where to send the person. Single use.'),
|
|
186
|
+
expires_at: primitives_1.unixSeconds.describe('When the link stops working (minutes, not days).'),
|
|
187
|
+
})
|
|
188
|
+
.strict(), {
|
|
189
|
+
examples: [
|
|
190
|
+
{
|
|
191
|
+
object: 'account_link',
|
|
192
|
+
livemode: false,
|
|
193
|
+
url: 'https://connect.peable.to/onboarding/Zk3s9v…',
|
|
194
|
+
expires_at: 1793750700,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
});
|
|
198
|
+
/** A statement descriptor: what a bank or card statement shows. */
|
|
199
|
+
const statementDescriptor = zod_1.z
|
|
200
|
+
.string()
|
|
201
|
+
.min(5)
|
|
202
|
+
.max(22)
|
|
203
|
+
.regex(/^[^<>\\'"*]*$/, 'a statement descriptor may not contain < > \\ \' " *');
|
|
204
|
+
const hexColor = zod_1.z.string().regex(/^#[0-9a-fA-F]{6}$/);
|
|
205
|
+
/**
|
|
206
|
+
* `POST /v1/account`: the account's settings, written to the provider and read
|
|
207
|
+
* back. `country` + `business_type` OPEN the account the first time (when the
|
|
208
|
+
* merchant has none) and are refused afterwards — a provider account's country
|
|
209
|
+
* cannot change.
|
|
210
|
+
*/
|
|
211
|
+
exports.updateAccountParams = zod_1.z
|
|
212
|
+
.object({
|
|
213
|
+
country: zod_1.z.string().length(2).optional(),
|
|
214
|
+
business_type: zod_1.z.enum(connect_1.ACCOUNT_BUSINESS_TYPES).optional(),
|
|
215
|
+
business_profile: zod_1.z
|
|
216
|
+
.object({
|
|
217
|
+
name: zod_1.z.string().min(1).max(200).optional(),
|
|
218
|
+
url: zod_1.z.url().max(2048).optional(),
|
|
219
|
+
support_email: zod_1.z.email().max(320).optional(),
|
|
220
|
+
support_url: zod_1.z.url().max(2048).optional(),
|
|
221
|
+
product_description: zod_1.z.string().max(1000).optional(),
|
|
222
|
+
mcc: zod_1.z
|
|
223
|
+
.string()
|
|
224
|
+
.regex(/^[0-9]{4}$/)
|
|
225
|
+
.optional(),
|
|
226
|
+
})
|
|
227
|
+
.strict()
|
|
228
|
+
.optional(),
|
|
229
|
+
settings: zod_1.z
|
|
230
|
+
.object({
|
|
231
|
+
payouts: zod_1.z
|
|
232
|
+
.object({
|
|
233
|
+
schedule: zod_1.z
|
|
234
|
+
.object({
|
|
235
|
+
interval: zod_1.z.enum(connect_1.PAYOUT_INTERVALS),
|
|
236
|
+
delay_days: zod_1.z.number().int().min(1).max(365).optional(),
|
|
237
|
+
weekly_anchor: zod_1.z.enum(connect_1.PAYOUT_WEEKLY_ANCHORS).optional(),
|
|
238
|
+
monthly_anchor: zod_1.z.number().int().min(1).max(31).optional(),
|
|
239
|
+
})
|
|
240
|
+
.strict()
|
|
241
|
+
.superRefine((schedule, ctx) => {
|
|
242
|
+
if (schedule.weekly_anchor !== undefined && schedule.interval !== 'weekly') {
|
|
243
|
+
ctx.addIssue({
|
|
244
|
+
code: 'custom',
|
|
245
|
+
path: ['weekly_anchor'],
|
|
246
|
+
message: 'weekly_anchor is for a weekly schedule',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
if (schedule.monthly_anchor !== undefined && schedule.interval !== 'monthly') {
|
|
250
|
+
ctx.addIssue({
|
|
251
|
+
code: 'custom',
|
|
252
|
+
path: ['monthly_anchor'],
|
|
253
|
+
message: 'monthly_anchor is for a monthly schedule',
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
.optional(),
|
|
258
|
+
statement_descriptor: statementDescriptor.optional(),
|
|
259
|
+
})
|
|
260
|
+
.strict()
|
|
261
|
+
.optional(),
|
|
262
|
+
payments: zod_1.z
|
|
263
|
+
.object({ statement_descriptor: statementDescriptor.optional() })
|
|
264
|
+
.strict()
|
|
265
|
+
.optional(),
|
|
266
|
+
branding: zod_1.z
|
|
267
|
+
.object({
|
|
268
|
+
primary_color: hexColor.optional(),
|
|
269
|
+
secondary_color: hexColor.optional(),
|
|
270
|
+
})
|
|
271
|
+
.strict()
|
|
272
|
+
.optional(),
|
|
273
|
+
})
|
|
274
|
+
.strict()
|
|
275
|
+
.optional(),
|
|
276
|
+
})
|
|
277
|
+
.strict();
|
|
278
|
+
/** `POST /v1/account_links`: hosted onboarding (or an update of what was submitted). */
|
|
279
|
+
exports.createAccountLinkParams = zod_1.z
|
|
280
|
+
.object({
|
|
281
|
+
refresh_url: zod_1.z.url().describe('Where the person goes when the link has expired.'),
|
|
282
|
+
return_url: zod_1.z.url().describe('Where the person returns when they leave the flow.'),
|
|
283
|
+
type: zod_1.z.enum(connect_1.ACCOUNT_LINK_TYPES).optional().describe('Defaults to `account_onboarding`.'),
|
|
284
|
+
})
|
|
285
|
+
.strict();
|
|
286
|
+
exports.accountRoutes = [
|
|
287
|
+
(0, route_1.defineRoute)({
|
|
288
|
+
operationId: 'retrieveAccount',
|
|
289
|
+
method: 'get',
|
|
290
|
+
path: '/v1/account',
|
|
291
|
+
tag: 'Account',
|
|
292
|
+
summary: 'Retrieve the account',
|
|
293
|
+
description: "The merchant's own fiat account, or with `Peable-Account: ca_…` one of a platform's sellers. A merchant without one is told so (404 `account_missing`).",
|
|
294
|
+
auth: 'service',
|
|
295
|
+
scope: 'payments:read',
|
|
296
|
+
peableAccount: true,
|
|
297
|
+
query: params_1.expandOnlyQuery,
|
|
298
|
+
response: exports.accountSchema,
|
|
299
|
+
sdk: 'account.retrieve',
|
|
300
|
+
}),
|
|
301
|
+
(0, route_1.defineRoute)({
|
|
302
|
+
operationId: 'updateAccount',
|
|
303
|
+
method: 'post',
|
|
304
|
+
path: '/v1/account',
|
|
305
|
+
tag: 'Account',
|
|
306
|
+
summary: 'Open or update the account',
|
|
307
|
+
description: 'The first call, with `country` and `business_type`, opens the account (201); every later one writes its settings to the provider and answers the account read back (200).',
|
|
308
|
+
auth: 'service',
|
|
309
|
+
scope: 'payments:write',
|
|
310
|
+
idempotent: true,
|
|
311
|
+
peableAccount: true,
|
|
312
|
+
body: exports.updateAccountParams,
|
|
313
|
+
response: exports.accountSchema,
|
|
314
|
+
sdk: 'account.update',
|
|
315
|
+
}),
|
|
316
|
+
(0, route_1.defineRoute)({
|
|
317
|
+
operationId: 'createAccountLink',
|
|
318
|
+
method: 'post',
|
|
319
|
+
path: '/v1/account_links',
|
|
320
|
+
tag: 'Account links',
|
|
321
|
+
summary: 'Create an account link',
|
|
322
|
+
description: "Hosted onboarding for the merchant's own account (or, with `Peable-Account`, a seller's card account), minted on demand.",
|
|
323
|
+
auth: 'service',
|
|
324
|
+
scope: 'payments:write',
|
|
325
|
+
idempotent: true,
|
|
326
|
+
peableAccount: true,
|
|
327
|
+
body: exports.createAccountLinkParams,
|
|
328
|
+
response: exports.accountLinkSchema,
|
|
329
|
+
status: 201,
|
|
330
|
+
sdk: 'accountLinks.create',
|
|
331
|
+
}),
|
|
332
|
+
];
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicationFeeRoutes = exports.listApplicationFeesQuery = exports.applicationFeeSchema = exports.feeRefundSchema = 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
|
+
/**
|
|
11
|
+
* Application fees (`fee_…`, ADR 0015 §3) — Orbit's fee on one payment, taken
|
|
12
|
+
* by the provider from the merchant's account when the charge succeeded.
|
|
13
|
+
* Created from the provider's own record, never computed after the fact, and
|
|
14
|
+
* refunded through `POST /v1/refunds` with `refund_application_fee`.
|
|
15
|
+
*/
|
|
16
|
+
/** A refund of an application fee (`fr_…`). */
|
|
17
|
+
exports.feeRefundSchema = (0, objects_1.defineObject)('fee_refund', 'FeeRefund', zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
id: zod_1.z.string(),
|
|
20
|
+
object: zod_1.z.literal('fee_refund'),
|
|
21
|
+
amount: primitives_1.amount,
|
|
22
|
+
currency: zod_1.z.string(),
|
|
23
|
+
fee: zod_1.z.string().describe('The `fee_…` it refunds.'),
|
|
24
|
+
created: primitives_1.unixSeconds,
|
|
25
|
+
})
|
|
26
|
+
.strict());
|
|
27
|
+
exports.applicationFeeSchema = (0, objects_1.defineObject)('application_fee', 'ApplicationFee', zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
id: zod_1.z.string(),
|
|
30
|
+
object: zod_1.z.literal('application_fee'),
|
|
31
|
+
livemode: primitives_1.livemode,
|
|
32
|
+
account: zod_1.z.string().describe('The account (`ca_…`) the fee was taken from.'),
|
|
33
|
+
amount: primitives_1.amount,
|
|
34
|
+
amount_refunded: primitives_1.amount,
|
|
35
|
+
currency: zod_1.z.string(),
|
|
36
|
+
charge: zod_1.z
|
|
37
|
+
.string()
|
|
38
|
+
.nullable()
|
|
39
|
+
.describe('The `ch_…` it was taken on, when Orbit holds the charge.'),
|
|
40
|
+
payment_intent: zod_1.z.string().describe('The `pi_…` it was taken on.'),
|
|
41
|
+
refunded: zod_1.z.boolean().describe('Refunded in full.'),
|
|
42
|
+
refunds: (0, envelopes_1.listOf)(exports.feeRefundSchema).describe('Every refund of the fee: a complete set.'),
|
|
43
|
+
created: primitives_1.unixSeconds,
|
|
44
|
+
})
|
|
45
|
+
.strict(), {
|
|
46
|
+
examples: [
|
|
47
|
+
{
|
|
48
|
+
id: 'fee_0193b8f32b7f4d0e8a15',
|
|
49
|
+
object: 'application_fee',
|
|
50
|
+
livemode: false,
|
|
51
|
+
account: 'ca_0193b8f2c1a87d3e9f4a',
|
|
52
|
+
amount: '60',
|
|
53
|
+
amount_refunded: '0',
|
|
54
|
+
currency: 'EUR',
|
|
55
|
+
charge: 'ch_0193b8f2f7c94b1d8e02',
|
|
56
|
+
payment_intent: 'pi_0193b8f2e8a14f6c9d31',
|
|
57
|
+
refunded: false,
|
|
58
|
+
refunds: {
|
|
59
|
+
object: 'list',
|
|
60
|
+
data: [],
|
|
61
|
+
has_more: false,
|
|
62
|
+
url: '/v1/application_fees/fee_0193b8f32b7f4d0e8a15/refunds',
|
|
63
|
+
},
|
|
64
|
+
created: 1793750400,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
exports.listApplicationFeesQuery = (0, params_1.listQuery)({
|
|
69
|
+
payment_intent: params_1.idParam.optional().describe('Only the fee taken on this payment (`pi_…`).'),
|
|
70
|
+
});
|
|
71
|
+
const feeIdParam = { id: 'The application fee (`fee_…`).' };
|
|
72
|
+
exports.applicationFeeRoutes = [
|
|
73
|
+
(0, route_1.defineRoute)({
|
|
74
|
+
operationId: 'listApplicationFees',
|
|
75
|
+
method: 'get',
|
|
76
|
+
path: '/v1/application_fees',
|
|
77
|
+
tag: 'Application fees',
|
|
78
|
+
summary: 'List application fees',
|
|
79
|
+
auth: 'service',
|
|
80
|
+
scope: 'payments:read',
|
|
81
|
+
query: exports.listApplicationFeesQuery,
|
|
82
|
+
response: (0, envelopes_1.listOf)(exports.applicationFeeSchema),
|
|
83
|
+
sdk: 'applicationFees.list',
|
|
84
|
+
expandable: 'application_fee',
|
|
85
|
+
}),
|
|
86
|
+
(0, route_1.defineRoute)({
|
|
87
|
+
operationId: 'retrieveApplicationFee',
|
|
88
|
+
method: 'get',
|
|
89
|
+
path: '/v1/application_fees/{id}',
|
|
90
|
+
tag: 'Application fees',
|
|
91
|
+
summary: 'Retrieve an application fee',
|
|
92
|
+
auth: 'service',
|
|
93
|
+
scope: 'payments:read',
|
|
94
|
+
params: feeIdParam,
|
|
95
|
+
query: params_1.expandOnlyQuery,
|
|
96
|
+
response: exports.applicationFeeSchema,
|
|
97
|
+
sdk: 'applicationFees.retrieve',
|
|
98
|
+
}),
|
|
99
|
+
(0, route_1.defineRoute)({
|
|
100
|
+
operationId: 'listApplicationFeeRefunds',
|
|
101
|
+
method: 'get',
|
|
102
|
+
path: '/v1/application_fees/{id}/refunds',
|
|
103
|
+
tag: 'Application fees',
|
|
104
|
+
summary: "List an application fee's refunds",
|
|
105
|
+
description: 'A complete set (`has_more: false`): one refund per partial refund of the payment.',
|
|
106
|
+
auth: 'service',
|
|
107
|
+
scope: 'payments:read',
|
|
108
|
+
params: feeIdParam,
|
|
109
|
+
query: params_1.emptyQuery,
|
|
110
|
+
response: (0, envelopes_1.listOf)(exports.feeRefundSchema),
|
|
111
|
+
sdk: 'applicationFees.listRefunds',
|
|
112
|
+
}),
|
|
113
|
+
];
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.balanceRoutes = exports.listReconciliationMismatchesQuery = exports.listBalanceTransactionsQuery = exports.reconciliationMismatchSchema = exports.balanceTransactionSchema = exports.balanceTransactionFeeDetailSchema = exports.balanceSchema = exports.balanceAmountSchema = 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 connect_1 = require("../../vocabulary/connect");
|
|
11
|
+
/**
|
|
12
|
+
* Balance and balance transactions (ADR 0015 §3–§5).
|
|
13
|
+
*
|
|
14
|
+
* MIRRORS, every one of them. The money is in the merchant's own provider
|
|
15
|
+
* account; Orbit's double-entry ledger is fed by the provider's own balance
|
|
16
|
+
* transactions and payouts for that account and reconciled against them daily.
|
|
17
|
+
* Nothing here is computed by Orbit: a figure the provider has not given is
|
|
18
|
+
* `null` with a status, never `0`.
|
|
19
|
+
*
|
|
20
|
+
* Every amount is a canonical integer STRING in the currency's smallest unit
|
|
21
|
+
* that MAY be negative (`"-1500"`): a refund or a payout takes money out of a
|
|
22
|
+
* balance.
|
|
23
|
+
*/
|
|
24
|
+
/** A currency as the provider reports it: upper-case ISO 4217, or `FAIR`. */
|
|
25
|
+
const ledgerCurrency = zod_1.z.string().describe('Upper-case ISO 4217 code, or `FAIR`.');
|
|
26
|
+
/** One currency's figure in a balance. */
|
|
27
|
+
exports.balanceAmountSchema = (0, objects_1.defineComponent)('BalanceAmount', zod_1.z.object({ amount: primitives_1.signedAmount, currency: ledgerCurrency }).strict());
|
|
28
|
+
/**
|
|
29
|
+
* `GET /v1/balance` — read from the ledger, per currency. A merchant without a
|
|
30
|
+
* fiat account has NO balance and is told so (404 `account_missing`), never
|
|
31
|
+
* shown zeros.
|
|
32
|
+
*/
|
|
33
|
+
exports.balanceSchema = (0, objects_1.defineObject)('balance', 'Balance', zod_1.z
|
|
34
|
+
.object({
|
|
35
|
+
object: zod_1.z.literal('balance'),
|
|
36
|
+
livemode: primitives_1.livemode,
|
|
37
|
+
available: zod_1.z
|
|
38
|
+
.array(exports.balanceAmountSchema)
|
|
39
|
+
.describe('Payable now: the provider has made these funds available.'),
|
|
40
|
+
pending: zod_1.z.array(exports.balanceAmountSchema).describe('Not yet available at the provider.'),
|
|
41
|
+
informational: zod_1.z
|
|
42
|
+
.array(exports.balanceAmountSchema)
|
|
43
|
+
.describe("FairCoin received straight into the merchant's own wallet (ADR 0015 §5): recorded for the books only. Orbit never held it, so it is never payable."),
|
|
44
|
+
account: zod_1.z
|
|
45
|
+
.string()
|
|
46
|
+
.nullable()
|
|
47
|
+
.describe('The account (`ca_…`) this balance mirrors; `null` for an Oxy first-party merchant.'),
|
|
48
|
+
})
|
|
49
|
+
.strict(), {
|
|
50
|
+
examples: [
|
|
51
|
+
{
|
|
52
|
+
object: 'balance',
|
|
53
|
+
livemode: false,
|
|
54
|
+
available: [{ amount: '184250', currency: 'EUR' }],
|
|
55
|
+
pending: [{ amount: '12900', currency: 'EUR' }],
|
|
56
|
+
informational: [{ amount: '250000000', currency: 'FAIR' }],
|
|
57
|
+
account: 'ca_0193b8f2c1a87d3e9f4a',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
/** One component of a transaction's fee. */
|
|
62
|
+
exports.balanceTransactionFeeDetailSchema = (0, objects_1.defineComponent)('BalanceTransactionFeeDetail', zod_1.z
|
|
63
|
+
.object({
|
|
64
|
+
amount: primitives_1.signedAmount,
|
|
65
|
+
currency: ledgerCurrency,
|
|
66
|
+
type: zod_1.z.enum(connect_1.BALANCE_TRANSACTION_FEE_TYPES),
|
|
67
|
+
})
|
|
68
|
+
.strict());
|
|
69
|
+
exports.balanceTransactionSchema = (0, objects_1.defineObject)('balance_transaction', 'BalanceTransaction', zod_1.z
|
|
70
|
+
.object({
|
|
71
|
+
id: zod_1.z.string().describe('`txn_…`'),
|
|
72
|
+
object: zod_1.z.literal('balance_transaction'),
|
|
73
|
+
livemode: primitives_1.livemode,
|
|
74
|
+
amount: primitives_1.signedAmount.describe('Gross, signed.'),
|
|
75
|
+
fee: primitives_1.signedAmount
|
|
76
|
+
.nullable()
|
|
77
|
+
.describe('What was taken, or `null` when the source gave no figure (never `0` for unknown).'),
|
|
78
|
+
net: primitives_1.signedAmount
|
|
79
|
+
.nullable()
|
|
80
|
+
.describe('`amount - fee`, as the provider reports it, or `null` with `fee`.'),
|
|
81
|
+
currency: ledgerCurrency,
|
|
82
|
+
type: zod_1.z.enum(connect_1.BALANCE_TRANSACTION_TYPES),
|
|
83
|
+
reporting_category: zod_1.z
|
|
84
|
+
.string()
|
|
85
|
+
.describe('A coarser grouping for reports (`charge`, `refund`, `payout`, `fee`, …).'),
|
|
86
|
+
status: zod_1.z.enum(connect_1.BALANCE_TRANSACTION_STATUSES),
|
|
87
|
+
available_on: primitives_1.unixSeconds
|
|
88
|
+
.nullable()
|
|
89
|
+
.describe('When the funds became (or become) available; `null` for an informational entry.'),
|
|
90
|
+
created: primitives_1.unixSeconds.describe('When it happened at its source.'),
|
|
91
|
+
description: zod_1.z.string().nullable(),
|
|
92
|
+
exchange_rate: zod_1.z.number().nullable(),
|
|
93
|
+
fee_details: zod_1.z.array(exports.balanceTransactionFeeDetailSchema),
|
|
94
|
+
source: zod_1.z
|
|
95
|
+
.string()
|
|
96
|
+
.nullable()
|
|
97
|
+
.describe("The Orbit object that caused it (`ch_…`, `re_…`, `po_…`, `fee_…`, `tr_…`, `pi_…`), or `null` when the provider's source is not an object Orbit holds."),
|
|
98
|
+
payout: zod_1.z
|
|
99
|
+
.string()
|
|
100
|
+
.nullable()
|
|
101
|
+
.describe('The payout (`po_…`) that paid this transaction out, once known.'),
|
|
102
|
+
account: zod_1.z
|
|
103
|
+
.string()
|
|
104
|
+
.nullable()
|
|
105
|
+
.describe('The account (`ca_…`) whose balance it moved; `null` for a first-party merchant.'),
|
|
106
|
+
})
|
|
107
|
+
.strict(), {
|
|
108
|
+
examples: [
|
|
109
|
+
{
|
|
110
|
+
id: 'txn_0193b8f30a6c4e21b7d9',
|
|
111
|
+
object: 'balance_transaction',
|
|
112
|
+
livemode: false,
|
|
113
|
+
amount: '2000',
|
|
114
|
+
fee: '88',
|
|
115
|
+
net: '1912',
|
|
116
|
+
currency: 'EUR',
|
|
117
|
+
type: 'charge',
|
|
118
|
+
reporting_category: 'charge',
|
|
119
|
+
status: 'available',
|
|
120
|
+
available_on: 1794355200,
|
|
121
|
+
created: 1793750400,
|
|
122
|
+
description: 'Order 6735',
|
|
123
|
+
exchange_rate: null,
|
|
124
|
+
fee_details: [{ amount: '88', currency: 'EUR', type: 'processing_fee' }],
|
|
125
|
+
source: 'ch_0193b8f2f7c94b1d8e02',
|
|
126
|
+
payout: null,
|
|
127
|
+
account: 'ca_0193b8f2c1a87d3e9f4a',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
/**
|
|
132
|
+
* What the daily reconciliation found disagreeing with the provider (Orbit's
|
|
133
|
+
* dashboard reads them). Never auto-corrected.
|
|
134
|
+
*/
|
|
135
|
+
exports.reconciliationMismatchSchema = (0, objects_1.defineObject)('reconciliation_mismatch', 'ReconciliationMismatch', zod_1.z
|
|
136
|
+
.object({
|
|
137
|
+
id: zod_1.z.string(),
|
|
138
|
+
object: zod_1.z.literal('reconciliation_mismatch'),
|
|
139
|
+
livemode: primitives_1.livemode,
|
|
140
|
+
account: zod_1.z.string().nullable(),
|
|
141
|
+
kind: zod_1.z.enum(connect_1.RECONCILIATION_MISMATCH_KINDS),
|
|
142
|
+
object_id: zod_1.z
|
|
143
|
+
.string()
|
|
144
|
+
.nullable()
|
|
145
|
+
.describe('The Orbit object concerned (`txn_…`, `po_…`), when Orbit holds one.'),
|
|
146
|
+
expected: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable().describe('What the provider says.'),
|
|
147
|
+
actual: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable().describe('What the ledger holds.'),
|
|
148
|
+
detected_at: primitives_1.unixSeconds,
|
|
149
|
+
last_seen_at: primitives_1.unixSeconds,
|
|
150
|
+
resolved_at: primitives_1.unixSeconds
|
|
151
|
+
.nullable()
|
|
152
|
+
.describe('Set when a later run no longer sees the difference.'),
|
|
153
|
+
})
|
|
154
|
+
.strict());
|
|
155
|
+
exports.listBalanceTransactionsQuery = (0, params_1.listQuery)({
|
|
156
|
+
type: zod_1.z.enum(connect_1.BALANCE_TRANSACTION_TYPES).optional(),
|
|
157
|
+
payout: params_1.idParam.optional().describe('`po_…`: only the transactions that payout paid out.'),
|
|
158
|
+
source: params_1.idParam.optional().describe('An Orbit object id the transaction was caused by.'),
|
|
159
|
+
currency: zod_1.z
|
|
160
|
+
.string()
|
|
161
|
+
.regex(/^[A-Za-z]{3,4}$/)
|
|
162
|
+
.optional()
|
|
163
|
+
.describe('Case-insensitive.'),
|
|
164
|
+
});
|
|
165
|
+
/** Reconciliation findings, as Orbit's dashboard lists them (not a public route). */
|
|
166
|
+
exports.listReconciliationMismatchesQuery = (0, params_1.listQuery)({
|
|
167
|
+
open: zod_1.z.enum(['true', 'false']).optional().describe('`true`: only unresolved findings.'),
|
|
168
|
+
});
|
|
169
|
+
exports.balanceRoutes = [
|
|
170
|
+
(0, route_1.defineRoute)({
|
|
171
|
+
operationId: 'retrieveBalance',
|
|
172
|
+
method: 'get',
|
|
173
|
+
path: '/v1/balance',
|
|
174
|
+
tag: 'Balance',
|
|
175
|
+
summary: 'Retrieve the balance',
|
|
176
|
+
auth: 'service',
|
|
177
|
+
scope: 'payments:read',
|
|
178
|
+
peableAccount: true,
|
|
179
|
+
query: params_1.expandOnlyQuery,
|
|
180
|
+
response: exports.balanceSchema,
|
|
181
|
+
sdk: 'balance.retrieve',
|
|
182
|
+
}),
|
|
183
|
+
(0, route_1.defineRoute)({
|
|
184
|
+
operationId: 'listBalanceTransactions',
|
|
185
|
+
method: 'get',
|
|
186
|
+
path: '/v1/balance_transactions',
|
|
187
|
+
tag: 'Balance transactions',
|
|
188
|
+
summary: 'List balance transactions',
|
|
189
|
+
description: 'Newest first, filtered by `type`, `payout`, `source`, `currency` and `created`.',
|
|
190
|
+
auth: 'service',
|
|
191
|
+
scope: 'payments:read',
|
|
192
|
+
peableAccount: true,
|
|
193
|
+
query: exports.listBalanceTransactionsQuery,
|
|
194
|
+
response: (0, envelopes_1.listOf)(exports.balanceTransactionSchema),
|
|
195
|
+
sdk: 'balanceTransactions.list',
|
|
196
|
+
expandable: 'balance_transaction',
|
|
197
|
+
}),
|
|
198
|
+
(0, route_1.defineRoute)({
|
|
199
|
+
operationId: 'retrieveBalanceTransaction',
|
|
200
|
+
method: 'get',
|
|
201
|
+
path: '/v1/balance_transactions/{id}',
|
|
202
|
+
tag: 'Balance transactions',
|
|
203
|
+
summary: 'Retrieve a balance transaction',
|
|
204
|
+
auth: 'service',
|
|
205
|
+
scope: 'payments:read',
|
|
206
|
+
peableAccount: true,
|
|
207
|
+
params: { id: 'The balance transaction (`txn_…`).' },
|
|
208
|
+
query: params_1.expandOnlyQuery,
|
|
209
|
+
response: exports.balanceTransactionSchema,
|
|
210
|
+
sdk: 'balanceTransactions.retrieve',
|
|
211
|
+
}),
|
|
212
|
+
];
|