@peable.to/contracts 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/address.js +81 -0
- package/dist/cjs/common/envelopes.js +101 -0
- package/dist/cjs/common/objects.js +85 -0
- package/dist/cjs/common/params.js +211 -0
- package/dist/cjs/common/primitives.js +39 -0
- package/dist/cjs/contributions.js +22 -0
- package/dist/cjs/index.js +40 -137
- package/dist/cjs/openapi/document.js +297 -0
- package/dist/cjs/openapi/index.js +7 -0
- package/dist/cjs/openapi/webhooks.js +17 -0
- package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
- package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
- package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
- package/dist/cjs/resources/billingEngine/index.js +43 -0
- package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
- package/dist/cjs/resources/billingEngine/invoices.js +509 -0
- package/dist/cjs/resources/billingEngine/params.js +43 -0
- package/dist/cjs/resources/billingEngine/public.js +326 -0
- package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
- package/dist/cjs/resources/catalog/billing.js +755 -0
- package/dist/cjs/resources/catalog/billingSettings.js +131 -0
- package/dist/cjs/resources/catalog/coupons.js +222 -0
- package/dist/cjs/resources/catalog/entitlements.js +257 -0
- package/dist/cjs/resources/catalog/index.js +58 -0
- package/dist/cjs/resources/catalog/meters.js +279 -0
- package/dist/cjs/resources/catalog/prices.js +423 -0
- package/dist/cjs/resources/catalog/products.js +228 -0
- package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
- package/dist/cjs/resources/catalog/shared.js +75 -0
- package/dist/cjs/resources/catalog/testClocks.js +127 -0
- package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
- package/dist/cjs/resources/checkout/contributions.js +172 -0
- package/dist/cjs/resources/checkout/files.js +133 -0
- package/dist/cjs/resources/checkout/index.js +57 -0
- package/dist/cjs/resources/checkout/merchants.js +290 -0
- package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
- package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
- package/dist/cjs/resources/checkout/shared.js +368 -0
- package/dist/cjs/resources/connect/account.js +332 -0
- package/dist/cjs/resources/connect/applicationFees.js +113 -0
- package/dist/cjs/resources/connect/balance.js +212 -0
- package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
- package/dist/cjs/resources/connect/index.js +51 -0
- package/dist/cjs/resources/connect/onboarding.js +82 -0
- package/dist/cjs/resources/connect/payouts.js +196 -0
- package/dist/cjs/resources/connect/reporting.js +235 -0
- package/dist/cjs/resources/connect/requestLogs.js +110 -0
- package/dist/cjs/resources/connect/transfers.js +227 -0
- package/dist/cjs/resources/core/customers.js +194 -0
- package/dist/cjs/resources/core/index.js +23 -0
- package/dist/cjs/resources/core/paymentMethods.js +134 -0
- package/dist/cjs/resources/events/events.js +357 -0
- package/dist/cjs/resources/events/index.js +29 -0
- package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
- package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
- package/dist/cjs/resources/payments/charges.js +157 -0
- package/dist/cjs/resources/payments/disputes.js +204 -0
- package/dist/cjs/resources/payments/index.js +41 -0
- package/dist/cjs/resources/payments/paymentIntents.js +529 -0
- package/dist/cjs/resources/payments/refunds.js +245 -0
- package/dist/cjs/resources/payments/setupIntents.js +158 -0
- package/dist/cjs/resources/payments/social.js +182 -0
- package/dist/cjs/resources/payments/testHelpers.js +39 -0
- package/dist/cjs/resources/tax/assessments.js +217 -0
- package/dist/cjs/resources/tax/businessProfile.js +99 -0
- package/dist/cjs/resources/tax/calculations.js +176 -0
- package/dist/cjs/resources/tax/capabilities.js +42 -0
- package/dist/cjs/resources/tax/codes.js +37 -0
- package/dist/cjs/resources/tax/complianceActions.js +56 -0
- package/dist/cjs/resources/tax/deadlines.js +59 -0
- package/dist/cjs/resources/tax/documents.js +128 -0
- package/dist/cjs/resources/tax/index.js +80 -0
- package/dist/cjs/resources/tax/locationEvidence.js +131 -0
- package/dist/cjs/resources/tax/operatingLocations.js +98 -0
- package/dist/cjs/resources/tax/products.js +67 -0
- package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
- package/dist/cjs/resources/tax/registrations.js +82 -0
- package/dist/cjs/resources/tax/reports.js +92 -0
- package/dist/cjs/resources/tax/reviewItems.js +116 -0
- package/dist/cjs/resources/tax/ruleSet.js +68 -0
- package/dist/cjs/resources/tax/salesDestinations.js +94 -0
- package/dist/cjs/resources/tax/settings.js +104 -0
- package/dist/cjs/resources/tax/shared.js +62 -0
- package/dist/cjs/resources/tax/transactions.js +102 -0
- package/dist/cjs/route.js +22 -0
- package/dist/cjs/routes.js +31 -0
- package/dist/cjs/vocabulary/billingPortal.js +15 -0
- package/dist/cjs/vocabulary/catalog.js +110 -0
- package/dist/cjs/vocabulary/checkout.js +53 -0
- package/dist/cjs/vocabulary/connect.js +95 -0
- package/dist/cjs/vocabulary/errors.js +174 -0
- package/dist/cjs/vocabulary/events.js +176 -0
- package/dist/cjs/vocabulary/files.js +44 -0
- package/dist/cjs/vocabulary/index.js +37 -0
- package/dist/cjs/vocabulary/invoices.js +52 -0
- package/dist/cjs/vocabulary/lists.js +22 -0
- package/dist/cjs/vocabulary/merchants.js +23 -0
- package/dist/cjs/vocabulary/money.js +104 -0
- package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
- package/dist/cjs/vocabulary/payments.js +195 -0
- package/dist/cjs/vocabulary/reporting.js +27 -0
- package/dist/cjs/vocabulary/subscriptions.js +60 -0
- package/dist/cjs/vocabulary/tax.js +237 -0
- package/dist/cjs/vocabulary/version.js +12 -0
- package/dist/esm/common/address.js +76 -0
- package/dist/esm/common/envelopes.js +95 -0
- package/dist/esm/common/objects.js +74 -0
- package/dist/esm/common/params.js +203 -0
- package/dist/esm/common/primitives.js +35 -0
- package/dist/esm/contributions.js +5 -0
- package/dist/esm/index.js +26 -134
- package/dist/esm/openapi/document.js +294 -0
- package/dist/esm/openapi/index.js +2 -0
- package/dist/esm/openapi/webhooks.js +14 -0
- package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
- package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
- package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
- package/dist/esm/resources/billingEngine/index.js +26 -0
- package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
- package/dist/esm/resources/billingEngine/invoices.js +506 -0
- package/dist/esm/resources/billingEngine/params.js +39 -0
- package/dist/esm/resources/billingEngine/public.js +323 -0
- package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
- package/dist/esm/resources/catalog/billing.js +752 -0
- package/dist/esm/resources/catalog/billingSettings.js +128 -0
- package/dist/esm/resources/catalog/coupons.js +219 -0
- package/dist/esm/resources/catalog/entitlements.js +254 -0
- package/dist/esm/resources/catalog/index.js +38 -0
- package/dist/esm/resources/catalog/meters.js +276 -0
- package/dist/esm/resources/catalog/prices.js +419 -0
- package/dist/esm/resources/catalog/products.js +225 -0
- package/dist/esm/resources/catalog/promotionCodes.js +171 -0
- package/dist/esm/resources/catalog/shared.js +67 -0
- package/dist/esm/resources/catalog/testClocks.js +124 -0
- package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
- package/dist/esm/resources/checkout/contributions.js +167 -0
- package/dist/esm/resources/checkout/files.js +130 -0
- package/dist/esm/resources/checkout/index.js +25 -0
- package/dist/esm/resources/checkout/merchants.js +287 -0
- package/dist/esm/resources/checkout/paymentLinks.js +327 -0
- package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
- package/dist/esm/resources/checkout/shared.js +363 -0
- package/dist/esm/resources/connect/account.js +329 -0
- package/dist/esm/resources/connect/applicationFees.js +110 -0
- package/dist/esm/resources/connect/balance.js +209 -0
- package/dist/esm/resources/connect/connectedAccounts.js +257 -0
- package/dist/esm/resources/connect/index.js +34 -0
- package/dist/esm/resources/connect/onboarding.js +79 -0
- package/dist/esm/resources/connect/payouts.js +193 -0
- package/dist/esm/resources/connect/reporting.js +232 -0
- package/dist/esm/resources/connect/requestLogs.js +107 -0
- package/dist/esm/resources/connect/transfers.js +224 -0
- package/dist/esm/resources/core/customers.js +191 -0
- package/dist/esm/resources/core/index.js +6 -0
- package/dist/esm/resources/core/paymentMethods.js +131 -0
- package/dist/esm/resources/events/events.js +353 -0
- package/dist/esm/resources/events/index.js +12 -0
- package/dist/esm/resources/events/webhookDeliveries.js +90 -0
- package/dist/esm/resources/events/webhookEndpoints.js +212 -0
- package/dist/esm/resources/payments/charges.js +154 -0
- package/dist/esm/resources/payments/disputes.js +201 -0
- package/dist/esm/resources/payments/index.js +24 -0
- package/dist/esm/resources/payments/paymentIntents.js +526 -0
- package/dist/esm/resources/payments/refunds.js +242 -0
- package/dist/esm/resources/payments/setupIntents.js +155 -0
- package/dist/esm/resources/payments/social.js +179 -0
- package/dist/esm/resources/payments/testHelpers.js +36 -0
- package/dist/esm/resources/tax/assessments.js +214 -0
- package/dist/esm/resources/tax/businessProfile.js +96 -0
- package/dist/esm/resources/tax/calculations.js +173 -0
- package/dist/esm/resources/tax/capabilities.js +39 -0
- package/dist/esm/resources/tax/codes.js +34 -0
- package/dist/esm/resources/tax/complianceActions.js +53 -0
- package/dist/esm/resources/tax/deadlines.js +56 -0
- package/dist/esm/resources/tax/documents.js +125 -0
- package/dist/esm/resources/tax/index.js +63 -0
- package/dist/esm/resources/tax/locationEvidence.js +128 -0
- package/dist/esm/resources/tax/operatingLocations.js +95 -0
- package/dist/esm/resources/tax/products.js +64 -0
- package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
- package/dist/esm/resources/tax/registrations.js +79 -0
- package/dist/esm/resources/tax/reports.js +89 -0
- package/dist/esm/resources/tax/reviewItems.js +113 -0
- package/dist/esm/resources/tax/ruleSet.js +65 -0
- package/dist/esm/resources/tax/salesDestinations.js +91 -0
- package/dist/esm/resources/tax/settings.js +101 -0
- package/dist/esm/resources/tax/shared.js +58 -0
- package/dist/esm/resources/tax/transactions.js +99 -0
- package/dist/esm/route.js +16 -0
- package/dist/esm/routes.js +27 -0
- package/dist/esm/vocabulary/billingPortal.js +12 -0
- package/dist/esm/vocabulary/catalog.js +106 -0
- package/dist/esm/vocabulary/checkout.js +50 -0
- package/dist/esm/vocabulary/connect.js +92 -0
- package/dist/esm/vocabulary/errors.js +169 -0
- package/dist/esm/vocabulary/events.js +173 -0
- package/dist/esm/vocabulary/files.js +41 -0
- package/dist/esm/vocabulary/index.js +21 -0
- package/dist/esm/vocabulary/invoices.js +49 -0
- package/dist/esm/vocabulary/lists.js +19 -0
- package/dist/esm/vocabulary/merchants.js +20 -0
- package/dist/esm/vocabulary/money.js +98 -0
- package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
- package/dist/esm/vocabulary/payments.js +192 -0
- package/dist/esm/vocabulary/reporting.js +24 -0
- package/dist/esm/vocabulary/subscriptions.js +57 -0
- package/dist/esm/vocabulary/tax.js +233 -0
- package/dist/esm/vocabulary/version.js +9 -0
- package/dist/types/common/address.d.ts +62 -0
- package/dist/types/common/envelopes.d.ts +88 -0
- package/dist/types/common/objects.d.ts +107 -0
- package/dist/types/common/params.d.ts +156 -0
- package/dist/types/common/primitives.d.ts +56 -0
- package/dist/types/contributions.d.ts +1 -0
- package/dist/types/index.d.ts +16 -171
- package/dist/types/openapi/document.d.ts +16 -0
- package/dist/types/openapi/index.d.ts +2 -0
- package/dist/types/openapi/webhooks.d.ts +15 -0
- package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
- package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
- package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
- package/dist/types/resources/billingEngine/index.d.ts +6071 -0
- package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
- package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
- package/dist/types/resources/billingEngine/params.d.ts +51 -0
- package/dist/types/resources/billingEngine/public.d.ts +1860 -0
- package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
- package/dist/types/resources/catalog/billing.d.ts +1723 -0
- package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
- package/dist/types/resources/catalog/coupons.d.ts +403 -0
- package/dist/types/resources/catalog/entitlements.d.ts +422 -0
- package/dist/types/resources/catalog/index.d.ts +3155 -0
- package/dist/types/resources/catalog/meters.d.ts +474 -0
- package/dist/types/resources/catalog/prices.d.ts +1091 -0
- package/dist/types/resources/catalog/products.d.ts +430 -0
- package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
- package/dist/types/resources/catalog/shared.d.ts +34 -0
- package/dist/types/resources/catalog/testClocks.d.ts +220 -0
- package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
- package/dist/types/resources/checkout/contributions.d.ts +375 -0
- package/dist/types/resources/checkout/files.d.ts +280 -0
- package/dist/types/resources/checkout/index.d.ts +5678 -0
- package/dist/types/resources/checkout/merchants.d.ts +395 -0
- package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
- package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
- package/dist/types/resources/checkout/shared.d.ts +419 -0
- package/dist/types/resources/connect/account.d.ts +483 -0
- package/dist/types/resources/connect/applicationFees.d.ts +198 -0
- package/dist/types/resources/connect/balance.d.ts +399 -0
- package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
- package/dist/types/resources/connect/index.d.ts +2094 -0
- package/dist/types/resources/connect/onboarding.d.ts +95 -0
- package/dist/types/resources/connect/payouts.d.ts +527 -0
- package/dist/types/resources/connect/reporting.d.ts +506 -0
- package/dist/types/resources/connect/requestLogs.d.ts +236 -0
- package/dist/types/resources/connect/transfers.d.ts +436 -0
- package/dist/types/resources/core/customers.d.ts +619 -0
- package/dist/types/resources/core/index.d.ts +679 -0
- package/dist/types/resources/core/paymentMethods.d.ts +336 -0
- package/dist/types/resources/events/events.d.ts +731 -0
- package/dist/types/resources/events/index.d.ts +1727 -0
- package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
- package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
- package/dist/types/resources/payments/charges.d.ts +390 -0
- package/dist/types/resources/payments/disputes.d.ts +822 -0
- package/dist/types/resources/payments/index.d.ts +3517 -0
- package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
- package/dist/types/resources/payments/refunds.d.ts +684 -0
- package/dist/types/resources/payments/setupIntents.d.ts +391 -0
- package/dist/types/resources/payments/social.d.ts +266 -0
- package/dist/types/resources/payments/testHelpers.d.ts +178 -0
- package/dist/types/resources/tax/assessments.d.ts +787 -0
- package/dist/types/resources/tax/businessProfile.d.ts +134 -0
- package/dist/types/resources/tax/calculations.d.ts +261 -0
- package/dist/types/resources/tax/capabilities.d.ts +81 -0
- package/dist/types/resources/tax/codes.d.ts +29 -0
- package/dist/types/resources/tax/complianceActions.d.ts +97 -0
- package/dist/types/resources/tax/deadlines.d.ts +133 -0
- package/dist/types/resources/tax/documents.d.ts +257 -0
- package/dist/types/resources/tax/index.d.ts +1946 -0
- package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
- package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
- package/dist/types/resources/tax/products.d.ts +68 -0
- package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
- package/dist/types/resources/tax/registrations.d.ts +103 -0
- package/dist/types/resources/tax/reports.d.ts +129 -0
- package/dist/types/resources/tax/reviewItems.d.ts +226 -0
- package/dist/types/resources/tax/ruleSet.d.ts +219 -0
- package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
- package/dist/types/resources/tax/settings.d.ts +122 -0
- package/dist/types/resources/tax/shared.d.ts +43 -0
- package/dist/types/resources/tax/transactions.d.ts +404 -0
- package/dist/types/route.d.ts +86 -0
- package/dist/types/routes.d.ts +23 -0
- package/dist/types/vocabulary/billingPortal.d.ts +15 -0
- package/dist/types/vocabulary/catalog.d.ts +97 -0
- package/dist/types/vocabulary/checkout.d.ts +49 -0
- package/dist/types/vocabulary/connect.d.ts +62 -0
- package/dist/types/vocabulary/errors.d.ts +145 -0
- package/dist/types/vocabulary/events.d.ts +171 -0
- package/dist/types/vocabulary/files.d.ts +30 -0
- package/dist/types/vocabulary/index.d.ts +17 -0
- package/dist/types/vocabulary/invoices.d.ts +39 -0
- package/dist/types/vocabulary/lists.d.ts +9 -0
- package/dist/types/vocabulary/merchants.d.ts +9 -0
- package/dist/types/vocabulary/money.d.ts +59 -0
- package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
- package/dist/types/vocabulary/payments.d.ts +117 -0
- package/dist/types/vocabulary/reporting.d.ts +18 -0
- package/dist/types/vocabulary/subscriptions.d.ts +45 -0
- package/dist/types/vocabulary/tax.d.ts +163 -0
- package/dist/types/vocabulary/version.d.ts +10 -0
- package/package.json +51 -11
- package/dist/cjs/openapi.js +0 -165
- package/dist/esm/openapi.js +0 -161
- package/dist/types/openapi.d.ts +0 -148
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paymentLinkRoutes = exports.createPaymentLinkSessionParams = exports.listPaymentLinkLineItemsQuery = exports.listPaymentLinksQuery = exports.updatePaymentLinkParams = exports.createPaymentLinkParams = exports.linkLineItemParams = exports.paymentLinkSessionStartSchema = exports.publicPaymentLinkSchema = exports.paymentLinkSchema = exports.checkoutAfterCompletionSchema = 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 checkout_1 = require("../../vocabulary/checkout");
|
|
11
|
+
const contributions_1 = require("./contributions");
|
|
12
|
+
const shared_1 = require("./shared");
|
|
13
|
+
/**
|
|
14
|
+
* Payment Links (`link_…`, Orbit Phase 3) — Stripe's model: a shareable URL
|
|
15
|
+
* over catalog PRICES. A payer visiting it creates a Checkout Session with the
|
|
16
|
+
* link's line items and options; the session creates the payment when the
|
|
17
|
+
* payer confirms. Nothing about a link mints a payment on its own.
|
|
18
|
+
*
|
|
19
|
+
* A contribution link (an Oxy organization's FairCoin collection) is a payment
|
|
20
|
+
* link whose one line is the contribution itself — a fixed amount, or one the
|
|
21
|
+
* payer chooses — rather than a price.
|
|
22
|
+
*/
|
|
23
|
+
exports.checkoutAfterCompletionSchema = (0, objects_1.defineComponent)('CheckoutAfterCompletion', zod_1.z
|
|
24
|
+
.object({
|
|
25
|
+
type: zod_1.z.enum(['redirect', 'hosted_confirmation']),
|
|
26
|
+
redirect: zod_1.z.object({ url: zod_1.z.string() }).strict().nullable(),
|
|
27
|
+
hosted_confirmation: zod_1.z.object({ custom_message: zod_1.z.string().nullable() }).strict().nullable(),
|
|
28
|
+
})
|
|
29
|
+
.strict());
|
|
30
|
+
const linkFields = {
|
|
31
|
+
id: zod_1.z.string(),
|
|
32
|
+
object: zod_1.z.literal('payment_link'),
|
|
33
|
+
livemode: primitives_1.livemode,
|
|
34
|
+
active: zod_1.z.boolean(),
|
|
35
|
+
currency: primitives_1.currency,
|
|
36
|
+
rail: shared_1.railSchema,
|
|
37
|
+
network: primitives_1.network.nullable(),
|
|
38
|
+
line_items: zod_1.z
|
|
39
|
+
.array(shared_1.checkoutLineItemSchema)
|
|
40
|
+
.describe("The link's prices (`GET /v1/payment_links/{id}/line_items` lists them in full)."),
|
|
41
|
+
contribution: contributions_1.contributionDetailsSchema
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Present on an organization contribution link (FairCoin).'),
|
|
44
|
+
locale: zod_1.z.enum(checkout_1.CHECKOUT_LOCALES).nullable(),
|
|
45
|
+
};
|
|
46
|
+
exports.paymentLinkSchema = (0, objects_1.defineObject)('payment_link', 'PaymentLink', zod_1.z
|
|
47
|
+
.object({
|
|
48
|
+
...linkFields,
|
|
49
|
+
allow_promotion_codes: zod_1.z.boolean(),
|
|
50
|
+
...shared_1.collectionResponseFields,
|
|
51
|
+
automatic_tax: zod_1.z.object({ enabled: zod_1.z.boolean() }).strict(),
|
|
52
|
+
customer_creation: zod_1.z.enum(checkout_1.CHECKOUT_CUSTOMER_CREATIONS),
|
|
53
|
+
after_completion: exports.checkoutAfterCompletionSchema,
|
|
54
|
+
restrictions: zod_1.z
|
|
55
|
+
.object({
|
|
56
|
+
completed_sessions: zod_1.z
|
|
57
|
+
.object({ limit: zod_1.z.number().int(), count: zod_1.z.number().int() })
|
|
58
|
+
.strict(),
|
|
59
|
+
})
|
|
60
|
+
.strict()
|
|
61
|
+
.nullable(),
|
|
62
|
+
submit_type: zod_1.z.enum(checkout_1.CHECKOUT_SUBMIT_TYPES),
|
|
63
|
+
metadata: primitives_1.metadata,
|
|
64
|
+
url: zod_1.z
|
|
65
|
+
.string()
|
|
66
|
+
.describe('`checkout.peable.to/l/<id>` — share it, or render it as a QR code.'),
|
|
67
|
+
created: primitives_1.unixSeconds,
|
|
68
|
+
updated_at: primitives_1.unixSeconds,
|
|
69
|
+
})
|
|
70
|
+
.strict(), {
|
|
71
|
+
examples: [
|
|
72
|
+
{
|
|
73
|
+
id: 'link_0193b8f2c1a87d3e9f4a',
|
|
74
|
+
object: 'payment_link',
|
|
75
|
+
livemode: false,
|
|
76
|
+
active: true,
|
|
77
|
+
currency: 'EUR',
|
|
78
|
+
rail: 'card',
|
|
79
|
+
network: null,
|
|
80
|
+
line_items: [],
|
|
81
|
+
allow_promotion_codes: false,
|
|
82
|
+
billing_address_collection: 'auto',
|
|
83
|
+
shipping_address_collection: null,
|
|
84
|
+
phone_number_collection: { enabled: false },
|
|
85
|
+
tax_id_collection: { enabled: false },
|
|
86
|
+
custom_fields: [],
|
|
87
|
+
consent_collection: null,
|
|
88
|
+
automatic_tax: { enabled: false },
|
|
89
|
+
customer_creation: 'if_required',
|
|
90
|
+
after_completion: {
|
|
91
|
+
type: 'hosted_confirmation',
|
|
92
|
+
redirect: null,
|
|
93
|
+
hosted_confirmation: { custom_message: null },
|
|
94
|
+
},
|
|
95
|
+
restrictions: null,
|
|
96
|
+
submit_type: 'auto',
|
|
97
|
+
locale: null,
|
|
98
|
+
metadata: {},
|
|
99
|
+
url: 'https://checkout.peable.to/l/link_0193b8f2c1a87d3e9f4a',
|
|
100
|
+
created: 1793750400,
|
|
101
|
+
updated_at: 1793750400,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
/** What an anonymous visitor may see before checkout starts — no metadata, no counts. */
|
|
106
|
+
exports.publicPaymentLinkSchema = (0, objects_1.defineComponent)('PublicPaymentLink', zod_1.z
|
|
107
|
+
.object({
|
|
108
|
+
...linkFields,
|
|
109
|
+
contribution_amount: zod_1.z
|
|
110
|
+
.string()
|
|
111
|
+
.nullable()
|
|
112
|
+
.describe("A fixed contribution's amount; `null` when the payer chooses (or for a price link)."),
|
|
113
|
+
merchant: shared_1.merchantDisplaySchema,
|
|
114
|
+
branding: shared_1.checkoutBrandingSchema,
|
|
115
|
+
})
|
|
116
|
+
.strict());
|
|
117
|
+
/** `POST /v1/payment_links/{id}/checkout_sessions`' answer: the hosted session and the secret that opens it. */
|
|
118
|
+
exports.paymentLinkSessionStartSchema = (0, objects_1.defineComponent)('PaymentLinkSessionStart', zod_1.z
|
|
119
|
+
.object({
|
|
120
|
+
object: zod_1.z.literal('checkout_session_start'),
|
|
121
|
+
id: zod_1.z.string().describe('The Checkout Session (`cs_…`).'),
|
|
122
|
+
client_secret: zod_1.z.string(),
|
|
123
|
+
url: zod_1.z.string().describe('The hosted checkout to send the payer to.'),
|
|
124
|
+
})
|
|
125
|
+
.strict());
|
|
126
|
+
// ---- Requests --------------------------------------------------------------------
|
|
127
|
+
/** One `line_items[]` entry of a payment link — a catalog price only. */
|
|
128
|
+
exports.linkLineItemParams = zod_1.z
|
|
129
|
+
.object({
|
|
130
|
+
price: shared_1.checkoutIdParam,
|
|
131
|
+
quantity: shared_1.quantityParam,
|
|
132
|
+
adjustable_quantity: shared_1.adjustableQuantityParam.optional(),
|
|
133
|
+
})
|
|
134
|
+
.strict()
|
|
135
|
+
.superRefine((line, ctx) => (0, shared_1.adjustableIssues)(line.quantity, line.adjustable_quantity, ctx));
|
|
136
|
+
const afterCompletionParams = zod_1.z
|
|
137
|
+
.object({
|
|
138
|
+
type: zod_1.z.enum(['redirect', 'hosted_confirmation']),
|
|
139
|
+
redirect: zod_1.z.object({ url: shared_1.redirectUrlParam }).strict().optional(),
|
|
140
|
+
hosted_confirmation: zod_1.z
|
|
141
|
+
.object({
|
|
142
|
+
custom_message: zod_1.z
|
|
143
|
+
.string()
|
|
144
|
+
.trim()
|
|
145
|
+
.min(1)
|
|
146
|
+
.max(checkout_1.PAYMENT_LINK_LIMITS.customMessageMax)
|
|
147
|
+
.optional(),
|
|
148
|
+
})
|
|
149
|
+
.strict()
|
|
150
|
+
.optional(),
|
|
151
|
+
})
|
|
152
|
+
.strict()
|
|
153
|
+
.superRefine((value, ctx) => {
|
|
154
|
+
if (value.type === 'redirect' && !value.redirect) {
|
|
155
|
+
ctx.addIssue({ code: 'custom', path: ['redirect'], message: 'redirect.url is required' });
|
|
156
|
+
}
|
|
157
|
+
if (value.type === 'redirect' && value.hosted_confirmation) {
|
|
158
|
+
ctx.addIssue({
|
|
159
|
+
code: 'custom',
|
|
160
|
+
path: ['hosted_confirmation'],
|
|
161
|
+
message: 'hosted_confirmation is for type hosted_confirmation',
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (value.type === 'hosted_confirmation' && value.redirect) {
|
|
165
|
+
ctx.addIssue({
|
|
166
|
+
code: 'custom',
|
|
167
|
+
path: ['redirect'],
|
|
168
|
+
message: 'redirect is for type redirect',
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const restrictionsParams = zod_1.z
|
|
173
|
+
.object({
|
|
174
|
+
completed_sessions: zod_1.z.object({ limit: zod_1.z.number().int().min(1).max(1000000) }).strict(),
|
|
175
|
+
})
|
|
176
|
+
.strict();
|
|
177
|
+
const optionParams = {
|
|
178
|
+
allow_promotion_codes: zod_1.z.boolean().optional(),
|
|
179
|
+
...shared_1.collectionParams,
|
|
180
|
+
automatic_tax: zod_1.z.object({ enabled: zod_1.z.boolean() }).strict().optional(),
|
|
181
|
+
customer_creation: zod_1.z.enum(checkout_1.CHECKOUT_CUSTOMER_CREATIONS).optional(),
|
|
182
|
+
after_completion: afterCompletionParams.optional(),
|
|
183
|
+
submit_type: zod_1.z.enum(checkout_1.CHECKOUT_SUBMIT_TYPES).optional(),
|
|
184
|
+
locale: shared_1.localeParam.optional(),
|
|
185
|
+
};
|
|
186
|
+
/** `POST /v1/payment_links`: 1–20 one-time prices of ONE currency. */
|
|
187
|
+
exports.createPaymentLinkParams = zod_1.z
|
|
188
|
+
.object({
|
|
189
|
+
line_items: zod_1.z.array(exports.linkLineItemParams).min(1).max(checkout_1.PAYMENT_LINK_LIMITS.lineItemsMax),
|
|
190
|
+
...optionParams,
|
|
191
|
+
restrictions: restrictionsParams.optional(),
|
|
192
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
193
|
+
expand: params_1.expandParam.optional(),
|
|
194
|
+
})
|
|
195
|
+
.strict();
|
|
196
|
+
/**
|
|
197
|
+
* `POST /v1/payment_links/{id}` — everything but the line items, which are
|
|
198
|
+
* fixed once shared (a payer may hold a session priced from them). `""`
|
|
199
|
+
* clears; `metadata` is a patch.
|
|
200
|
+
*/
|
|
201
|
+
exports.updatePaymentLinkParams = zod_1.z
|
|
202
|
+
.object({
|
|
203
|
+
active: zod_1.z.boolean().optional(),
|
|
204
|
+
...optionParams,
|
|
205
|
+
shipping_address_collection: zod_1.z
|
|
206
|
+
.union([shared_1.collectionParams.shipping_address_collection.unwrap(), zod_1.z.literal('')])
|
|
207
|
+
.optional(),
|
|
208
|
+
custom_fields: zod_1.z.union([shared_1.collectionParams.custom_fields.unwrap(), zod_1.z.literal('')]).optional(),
|
|
209
|
+
restrictions: zod_1.z.union([restrictionsParams, zod_1.z.literal('')]).optional(),
|
|
210
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
211
|
+
expand: params_1.expandParam.optional(),
|
|
212
|
+
})
|
|
213
|
+
.strict();
|
|
214
|
+
exports.listPaymentLinksQuery = (0, params_1.listQuery)({ active: params_1.queryBoolean.optional() });
|
|
215
|
+
/** A link's lines: a complete set of at most twenty (`has_more` is `false`). */
|
|
216
|
+
exports.listPaymentLinkLineItemsQuery = (0, params_1.listQuery)({});
|
|
217
|
+
/**
|
|
218
|
+
* `POST /v1/payment_links/{id}/checkout_sessions` — a payer starting checkout.
|
|
219
|
+
* A contribution link the payer prices takes `amount`; nothing else is the
|
|
220
|
+
* payer's to say.
|
|
221
|
+
*/
|
|
222
|
+
exports.createPaymentLinkSessionParams = zod_1.z
|
|
223
|
+
.object({
|
|
224
|
+
amount: zod_1.z
|
|
225
|
+
.string()
|
|
226
|
+
.refine((value) => contributions_1.contributionAmountSchema.safeParse(value).success, 'Enter a positive FairCoin base-unit amount within the supported range')
|
|
227
|
+
.optional()
|
|
228
|
+
.describe("A free contribution's amount, in FAIR base units."),
|
|
229
|
+
})
|
|
230
|
+
.strict();
|
|
231
|
+
const linkId = { id: 'The payment link (`link_…`).' };
|
|
232
|
+
exports.paymentLinkRoutes = [
|
|
233
|
+
(0, route_1.defineRoute)({
|
|
234
|
+
operationId: 'createPaymentLink',
|
|
235
|
+
method: 'post',
|
|
236
|
+
path: '/v1/payment_links',
|
|
237
|
+
tag: 'Payment Links',
|
|
238
|
+
summary: 'Create a payment link',
|
|
239
|
+
auth: 'service',
|
|
240
|
+
scope: 'payments:write',
|
|
241
|
+
idempotent: true,
|
|
242
|
+
body: exports.createPaymentLinkParams,
|
|
243
|
+
response: exports.paymentLinkSchema,
|
|
244
|
+
status: 201,
|
|
245
|
+
sdk: 'paymentLinks.create',
|
|
246
|
+
expandable: 'payment_link',
|
|
247
|
+
}),
|
|
248
|
+
(0, route_1.defineRoute)({
|
|
249
|
+
operationId: 'listPaymentLinks',
|
|
250
|
+
method: 'get',
|
|
251
|
+
path: '/v1/payment_links',
|
|
252
|
+
tag: 'Payment Links',
|
|
253
|
+
summary: 'List payment links',
|
|
254
|
+
auth: 'service',
|
|
255
|
+
scope: 'payments:read',
|
|
256
|
+
query: exports.listPaymentLinksQuery,
|
|
257
|
+
response: (0, envelopes_1.listOf)(exports.paymentLinkSchema),
|
|
258
|
+
sdk: 'paymentLinks.list',
|
|
259
|
+
expandable: 'payment_link',
|
|
260
|
+
}),
|
|
261
|
+
(0, route_1.defineRoute)({
|
|
262
|
+
operationId: 'retrievePaymentLink',
|
|
263
|
+
method: 'get',
|
|
264
|
+
path: '/v1/payment_links/{id}',
|
|
265
|
+
tag: 'Payment Links',
|
|
266
|
+
summary: 'Retrieve a payment link',
|
|
267
|
+
auth: 'service',
|
|
268
|
+
scope: 'payments:read',
|
|
269
|
+
params: linkId,
|
|
270
|
+
query: params_1.expandOnlyQuery,
|
|
271
|
+
response: exports.paymentLinkSchema,
|
|
272
|
+
sdk: 'paymentLinks.retrieve',
|
|
273
|
+
expandable: 'payment_link',
|
|
274
|
+
}),
|
|
275
|
+
(0, route_1.defineRoute)({
|
|
276
|
+
operationId: 'updatePaymentLink',
|
|
277
|
+
method: 'post',
|
|
278
|
+
path: '/v1/payment_links/{id}',
|
|
279
|
+
tag: 'Payment Links',
|
|
280
|
+
summary: 'Update a payment link',
|
|
281
|
+
description: 'Everything but the line items. `""` clears a field; `metadata` is a patch.',
|
|
282
|
+
auth: 'service',
|
|
283
|
+
scope: 'payments:write',
|
|
284
|
+
idempotent: true,
|
|
285
|
+
params: linkId,
|
|
286
|
+
body: exports.updatePaymentLinkParams,
|
|
287
|
+
response: exports.paymentLinkSchema,
|
|
288
|
+
sdk: 'paymentLinks.update',
|
|
289
|
+
expandable: 'payment_link',
|
|
290
|
+
}),
|
|
291
|
+
(0, route_1.defineRoute)({
|
|
292
|
+
operationId: 'listPaymentLinkLineItems',
|
|
293
|
+
method: 'get',
|
|
294
|
+
path: '/v1/payment_links/{id}/line_items',
|
|
295
|
+
tag: 'Payment Links',
|
|
296
|
+
summary: "List a payment link's line items",
|
|
297
|
+
description: 'A complete set of at most twenty lines: `has_more` is always `false`.',
|
|
298
|
+
auth: 'service',
|
|
299
|
+
scope: 'payments:read',
|
|
300
|
+
params: linkId,
|
|
301
|
+
query: exports.listPaymentLinkLineItemsQuery,
|
|
302
|
+
response: (0, envelopes_1.listOf)(shared_1.checkoutLineItemSchema),
|
|
303
|
+
sdk: 'paymentLinks.listLineItems',
|
|
304
|
+
expandable: 'item',
|
|
305
|
+
}),
|
|
306
|
+
(0, route_1.defineRoute)({
|
|
307
|
+
operationId: 'retrievePaymentLinkPublic',
|
|
308
|
+
method: 'get',
|
|
309
|
+
path: '/v1/payment_links/{id}/public',
|
|
310
|
+
tag: 'Payment Links',
|
|
311
|
+
summary: 'Retrieve a payment link as a visitor',
|
|
312
|
+
description: 'Anonymous and rate-limited: what a visitor sees before checkout starts. An inactive (or expired contribution) link answers with `active: false`, so the page can say so.',
|
|
313
|
+
auth: 'public',
|
|
314
|
+
params: linkId,
|
|
315
|
+
response: exports.publicPaymentLinkSchema,
|
|
316
|
+
}),
|
|
317
|
+
(0, route_1.defineRoute)({
|
|
318
|
+
operationId: 'createPaymentLinkCheckoutSession',
|
|
319
|
+
method: 'post',
|
|
320
|
+
path: '/v1/payment_links/{id}/checkout_sessions',
|
|
321
|
+
tag: 'Payment Links',
|
|
322
|
+
summary: 'Start checkout from a payment link',
|
|
323
|
+
description: 'Anonymous and rate-limited. Creates a Checkout Session from the STORED link — never a payment. A contribution link requires a UUID `Idempotency-Key` header, written by the page before the request, so a lost answer recovers the same session.',
|
|
324
|
+
auth: 'public',
|
|
325
|
+
params: linkId,
|
|
326
|
+
body: exports.createPaymentLinkSessionParams,
|
|
327
|
+
response: exports.paymentLinkSessionStartSchema,
|
|
328
|
+
status: 201,
|
|
329
|
+
}),
|
|
330
|
+
];
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paymentMethodConfigurationRoutes = exports.listPaymentMethodDomainsQuery = exports.validatePaymentMethodDomainParams = exports.updatePaymentMethodDomainParams = exports.createPaymentMethodDomainParams = exports.listPaymentMethodConfigurationsQuery = exports.updatePaymentMethodConfigurationParams = exports.createPaymentMethodConfigurationParams = exports.paymentMethodConfigurationEntryParams = exports.paymentMethodDomainSchema = exports.paymentMethodDomainWalletStatusSchema = exports.paymentMethodConfigurationSchema = exports.paymentMethodConfigurationEntrySchema = exports.paymentMethodDisplayPreferenceSchema = 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 paymentMethodConfigurations_1 = require("../../vocabulary/paymentMethodConfigurations");
|
|
11
|
+
/**
|
|
12
|
+
* Payment method breadth on the card rail — which methods a merchant's payers
|
|
13
|
+
* are offered (`pmc_…`), and the web domains wallets may run on (`pmd_…`).
|
|
14
|
+
* Both are Orbit's objects; the provider's configuration and domain are
|
|
15
|
+
* bindings behind them (ADR 0016). Card data and bank credentials are entered
|
|
16
|
+
* in the provider's hosted fields and never reach Peable (PCI SAQ-A).
|
|
17
|
+
*/
|
|
18
|
+
/** The merchant's choice (`none`: Orbit's default) and what is in effect. */
|
|
19
|
+
exports.paymentMethodDisplayPreferenceSchema = zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
preference: zod_1.z.enum(['on', 'off', 'none']),
|
|
22
|
+
value: zod_1.z.enum(['on', 'off']),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
exports.paymentMethodConfigurationEntrySchema = (0, objects_1.defineComponent)('PaymentMethodConfigurationEntry', zod_1.z
|
|
26
|
+
.object({
|
|
27
|
+
available: zod_1.z
|
|
28
|
+
.boolean()
|
|
29
|
+
.describe('Whether payers can be offered this method: it is on and nothing prevents it.'),
|
|
30
|
+
display_preference: exports.paymentMethodDisplayPreferenceSchema,
|
|
31
|
+
unavailable_reason: zod_1.z
|
|
32
|
+
.enum(paymentMethodConfigurations_1.PAYMENT_METHOD_UNAVAILABLE_REASONS)
|
|
33
|
+
.nullable()
|
|
34
|
+
.describe('Why it cannot be offered whatever the merchant chooses; `null` when it can.'),
|
|
35
|
+
currencies: zod_1.z.array(primitives_1.fiatCurrency).describe('The payment currencies it is offered on.'),
|
|
36
|
+
})
|
|
37
|
+
.strict());
|
|
38
|
+
const entryFields = Object.fromEntries(paymentMethodConfigurations_1.PAYMENT_METHOD_CONFIGURATION_TYPES.map((type) => [type, exports.paymentMethodConfigurationEntrySchema]));
|
|
39
|
+
exports.paymentMethodConfigurationSchema = (0, objects_1.defineObject)('payment_method_configuration', 'PaymentMethodConfiguration', zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
id: zod_1.z.string(),
|
|
42
|
+
object: zod_1.z.literal('payment_method_configuration'),
|
|
43
|
+
livemode: primitives_1.livemode,
|
|
44
|
+
name: zod_1.z.string(),
|
|
45
|
+
active: zod_1.z
|
|
46
|
+
.boolean()
|
|
47
|
+
.describe('An inactive configuration cannot be named on a new PaymentIntent. The default is always active.'),
|
|
48
|
+
is_default: zod_1.z
|
|
49
|
+
.boolean()
|
|
50
|
+
.describe('The configuration a PaymentIntent uses when it names none. One per merchant.'),
|
|
51
|
+
created: primitives_1.unixSeconds,
|
|
52
|
+
updated_at: primitives_1.unixSeconds,
|
|
53
|
+
...entryFields,
|
|
54
|
+
})
|
|
55
|
+
.strict());
|
|
56
|
+
/** A wallet's standing on one domain. */
|
|
57
|
+
exports.paymentMethodDomainWalletStatusSchema = (0, objects_1.defineComponent)('PaymentMethodDomainWalletStatus', zod_1.z
|
|
58
|
+
.object({
|
|
59
|
+
status: zod_1.z
|
|
60
|
+
.enum(['active', 'inactive'])
|
|
61
|
+
.describe('`active`: the wallet can run on pages served from this domain.'),
|
|
62
|
+
status_details: zod_1.z
|
|
63
|
+
.object({ error_message: zod_1.z.string() })
|
|
64
|
+
.strict()
|
|
65
|
+
.nullable()
|
|
66
|
+
.describe("Present while `inactive`: what the wallet's verification said."),
|
|
67
|
+
})
|
|
68
|
+
.strict());
|
|
69
|
+
/**
|
|
70
|
+
* A web domain the merchant serves payment pages from (`pmd_…`), registered so
|
|
71
|
+
* Apple Pay and Google Pay run there. Peable's own hosted checkout needs none.
|
|
72
|
+
*/
|
|
73
|
+
exports.paymentMethodDomainSchema = (0, objects_1.defineObject)('payment_method_domain', 'PaymentMethodDomain', zod_1.z
|
|
74
|
+
.object({
|
|
75
|
+
id: zod_1.z.string(),
|
|
76
|
+
object: zod_1.z.literal('payment_method_domain'),
|
|
77
|
+
livemode: primitives_1.livemode,
|
|
78
|
+
domain_name: zod_1.z.string().describe('Lowercase hostname, no scheme, port or path.'),
|
|
79
|
+
enabled: zod_1.z.boolean().describe('Whether wallets may run on it at all.'),
|
|
80
|
+
apple_pay: exports.paymentMethodDomainWalletStatusSchema,
|
|
81
|
+
google_pay: exports.paymentMethodDomainWalletStatusSchema,
|
|
82
|
+
created: primitives_1.unixSeconds,
|
|
83
|
+
})
|
|
84
|
+
.strict(), {
|
|
85
|
+
examples: [
|
|
86
|
+
{
|
|
87
|
+
id: 'pmd_0193b8f2c1a87d3e9f4a',
|
|
88
|
+
object: 'payment_method_domain',
|
|
89
|
+
livemode: false,
|
|
90
|
+
domain_name: 'shop.example.com',
|
|
91
|
+
enabled: true,
|
|
92
|
+
apple_pay: { status: 'active', status_details: null },
|
|
93
|
+
google_pay: { status: 'active', status_details: null },
|
|
94
|
+
created: 1793750400,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
/** One method's setting in a create or update. `none` returns it to Orbit's default. */
|
|
99
|
+
exports.paymentMethodConfigurationEntryParams = zod_1.z
|
|
100
|
+
.object({
|
|
101
|
+
display_preference: zod_1.z.object({ preference: zod_1.z.enum(['on', 'off', 'none']) }).strict(),
|
|
102
|
+
})
|
|
103
|
+
.strict();
|
|
104
|
+
const methodParams = Object.fromEntries(paymentMethodConfigurations_1.PAYMENT_METHOD_CONFIGURATION_TYPES.map((type) => [
|
|
105
|
+
type,
|
|
106
|
+
exports.paymentMethodConfigurationEntryParams.optional(),
|
|
107
|
+
]));
|
|
108
|
+
/** `POST /v1/payment_method_configurations` — an additional, non-default configuration. */
|
|
109
|
+
exports.createPaymentMethodConfigurationParams = zod_1.z
|
|
110
|
+
.object({ name: zod_1.z.string().min(1).max(100).optional(), ...methodParams })
|
|
111
|
+
.strict();
|
|
112
|
+
/** `POST /v1/payment_method_configurations/{id}` — methods (merged), name, active. */
|
|
113
|
+
exports.updatePaymentMethodConfigurationParams = zod_1.z
|
|
114
|
+
.object({
|
|
115
|
+
name: zod_1.z.string().min(1).max(100).optional(),
|
|
116
|
+
active: zod_1.z.boolean().optional(),
|
|
117
|
+
...methodParams,
|
|
118
|
+
})
|
|
119
|
+
.strict();
|
|
120
|
+
exports.listPaymentMethodConfigurationsQuery = (0, params_1.listQuery)({});
|
|
121
|
+
exports.createPaymentMethodDomainParams = zod_1.z
|
|
122
|
+
.object({ domain_name: zod_1.z.string().min(1).max(300), enabled: zod_1.z.boolean().optional() })
|
|
123
|
+
.strict();
|
|
124
|
+
exports.updatePaymentMethodDomainParams = zod_1.z
|
|
125
|
+
.object({ enabled: zod_1.z.boolean().optional() })
|
|
126
|
+
.strict();
|
|
127
|
+
/** The validate body: nothing. */
|
|
128
|
+
exports.validatePaymentMethodDomainParams = zod_1.z.object({}).strict();
|
|
129
|
+
exports.listPaymentMethodDomainsQuery = (0, params_1.listQuery)({
|
|
130
|
+
domain_name: zod_1.z.string().min(1).max(253).optional().describe('Exact match, any case.'),
|
|
131
|
+
enabled: params_1.queryBoolean.optional(),
|
|
132
|
+
});
|
|
133
|
+
const pmcId = { id: 'The configuration (`pmc_…`).' };
|
|
134
|
+
const pmdId = { id: 'The domain (`pmd_…`).' };
|
|
135
|
+
exports.paymentMethodConfigurationRoutes = [
|
|
136
|
+
(0, route_1.defineRoute)({
|
|
137
|
+
operationId: 'listPaymentMethodConfigurations',
|
|
138
|
+
method: 'get',
|
|
139
|
+
path: '/v1/payment_method_configurations',
|
|
140
|
+
tag: 'Payment method configurations',
|
|
141
|
+
summary: 'List payment method configurations',
|
|
142
|
+
description: 'The default configuration is created on first read.',
|
|
143
|
+
auth: 'service',
|
|
144
|
+
scope: 'payments:read',
|
|
145
|
+
query: exports.listPaymentMethodConfigurationsQuery,
|
|
146
|
+
response: (0, envelopes_1.listOf)(exports.paymentMethodConfigurationSchema),
|
|
147
|
+
sdk: 'paymentMethodConfigurations.list',
|
|
148
|
+
expandable: 'payment_method_configuration',
|
|
149
|
+
}),
|
|
150
|
+
(0, route_1.defineRoute)({
|
|
151
|
+
operationId: 'createPaymentMethodConfiguration',
|
|
152
|
+
method: 'post',
|
|
153
|
+
path: '/v1/payment_method_configurations',
|
|
154
|
+
tag: 'Payment method configurations',
|
|
155
|
+
summary: 'Create a payment method configuration',
|
|
156
|
+
description: 'An additional, non-default configuration. Turning `on` a method the processing provider does not offer is refused.',
|
|
157
|
+
auth: 'service',
|
|
158
|
+
scope: 'payments:write',
|
|
159
|
+
idempotent: true,
|
|
160
|
+
body: exports.createPaymentMethodConfigurationParams,
|
|
161
|
+
response: exports.paymentMethodConfigurationSchema,
|
|
162
|
+
sdk: 'paymentMethodConfigurations.create',
|
|
163
|
+
}),
|
|
164
|
+
(0, route_1.defineRoute)({
|
|
165
|
+
operationId: 'retrievePaymentMethodConfiguration',
|
|
166
|
+
method: 'get',
|
|
167
|
+
path: '/v1/payment_method_configurations/{id}',
|
|
168
|
+
tag: 'Payment method configurations',
|
|
169
|
+
summary: 'Retrieve a payment method configuration',
|
|
170
|
+
auth: 'service',
|
|
171
|
+
scope: 'payments:read',
|
|
172
|
+
params: pmcId,
|
|
173
|
+
query: params_1.expandOnlyQuery,
|
|
174
|
+
response: exports.paymentMethodConfigurationSchema,
|
|
175
|
+
sdk: 'paymentMethodConfigurations.retrieve',
|
|
176
|
+
expandable: 'payment_method_configuration',
|
|
177
|
+
}),
|
|
178
|
+
(0, route_1.defineRoute)({
|
|
179
|
+
operationId: 'updatePaymentMethodConfiguration',
|
|
180
|
+
method: 'post',
|
|
181
|
+
path: '/v1/payment_method_configurations/{id}',
|
|
182
|
+
tag: 'Payment method configurations',
|
|
183
|
+
summary: 'Update a payment method configuration',
|
|
184
|
+
description: 'Method settings are merged; the default configuration is always active.',
|
|
185
|
+
auth: 'service',
|
|
186
|
+
scope: 'payments:write',
|
|
187
|
+
idempotent: true,
|
|
188
|
+
params: pmcId,
|
|
189
|
+
body: exports.updatePaymentMethodConfigurationParams,
|
|
190
|
+
response: exports.paymentMethodConfigurationSchema,
|
|
191
|
+
sdk: 'paymentMethodConfigurations.update',
|
|
192
|
+
}),
|
|
193
|
+
(0, route_1.defineRoute)({
|
|
194
|
+
operationId: 'listPaymentMethodDomains',
|
|
195
|
+
method: 'get',
|
|
196
|
+
path: '/v1/payment_method_domains',
|
|
197
|
+
tag: 'Payment method domains',
|
|
198
|
+
summary: 'List payment method domains',
|
|
199
|
+
auth: 'service',
|
|
200
|
+
scope: 'payments:read',
|
|
201
|
+
query: exports.listPaymentMethodDomainsQuery,
|
|
202
|
+
response: (0, envelopes_1.listOf)(exports.paymentMethodDomainSchema),
|
|
203
|
+
sdk: 'paymentMethodDomains.list',
|
|
204
|
+
expandable: 'payment_method_domain',
|
|
205
|
+
}),
|
|
206
|
+
(0, route_1.defineRoute)({
|
|
207
|
+
operationId: 'createPaymentMethodDomain',
|
|
208
|
+
method: 'post',
|
|
209
|
+
path: '/v1/payment_method_domains',
|
|
210
|
+
tag: 'Payment method domains',
|
|
211
|
+
summary: 'Register a payment method domain',
|
|
212
|
+
auth: 'service',
|
|
213
|
+
scope: 'payments:write',
|
|
214
|
+
idempotent: true,
|
|
215
|
+
body: exports.createPaymentMethodDomainParams,
|
|
216
|
+
response: exports.paymentMethodDomainSchema,
|
|
217
|
+
sdk: 'paymentMethodDomains.create',
|
|
218
|
+
}),
|
|
219
|
+
(0, route_1.defineRoute)({
|
|
220
|
+
operationId: 'retrievePaymentMethodDomain',
|
|
221
|
+
method: 'get',
|
|
222
|
+
path: '/v1/payment_method_domains/{id}',
|
|
223
|
+
tag: 'Payment method domains',
|
|
224
|
+
summary: 'Retrieve a payment method domain',
|
|
225
|
+
auth: 'service',
|
|
226
|
+
scope: 'payments:read',
|
|
227
|
+
params: pmdId,
|
|
228
|
+
query: params_1.expandOnlyQuery,
|
|
229
|
+
response: exports.paymentMethodDomainSchema,
|
|
230
|
+
sdk: 'paymentMethodDomains.retrieve',
|
|
231
|
+
expandable: 'payment_method_domain',
|
|
232
|
+
}),
|
|
233
|
+
(0, route_1.defineRoute)({
|
|
234
|
+
operationId: 'updatePaymentMethodDomain',
|
|
235
|
+
method: 'post',
|
|
236
|
+
path: '/v1/payment_method_domains/{id}',
|
|
237
|
+
tag: 'Payment method domains',
|
|
238
|
+
summary: 'Update a payment method domain',
|
|
239
|
+
auth: 'service',
|
|
240
|
+
scope: 'payments:write',
|
|
241
|
+
idempotent: true,
|
|
242
|
+
params: pmdId,
|
|
243
|
+
body: exports.updatePaymentMethodDomainParams,
|
|
244
|
+
response: exports.paymentMethodDomainSchema,
|
|
245
|
+
sdk: 'paymentMethodDomains.update',
|
|
246
|
+
}),
|
|
247
|
+
(0, route_1.defineRoute)({
|
|
248
|
+
operationId: 'validatePaymentMethodDomain',
|
|
249
|
+
method: 'post',
|
|
250
|
+
path: '/v1/payment_method_domains/{id}/validate',
|
|
251
|
+
tag: 'Payment method domains',
|
|
252
|
+
summary: 'Validate a payment method domain',
|
|
253
|
+
description: "Re-runs the wallets' verification of the domain.",
|
|
254
|
+
auth: 'service',
|
|
255
|
+
scope: 'payments:write',
|
|
256
|
+
idempotent: true,
|
|
257
|
+
params: pmdId,
|
|
258
|
+
body: exports.validatePaymentMethodDomainParams,
|
|
259
|
+
response: exports.paymentMethodDomainSchema,
|
|
260
|
+
sdk: 'paymentMethodDomains.validate',
|
|
261
|
+
}),
|
|
262
|
+
];
|