@peable.to/contracts 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/address.js +81 -0
- package/dist/cjs/common/envelopes.js +101 -0
- package/dist/cjs/common/objects.js +85 -0
- package/dist/cjs/common/params.js +211 -0
- package/dist/cjs/common/primitives.js +39 -0
- package/dist/cjs/contributions.js +22 -0
- package/dist/cjs/index.js +40 -97
- package/dist/cjs/openapi/document.js +297 -0
- package/dist/cjs/openapi/index.js +7 -0
- package/dist/cjs/openapi/webhooks.js +17 -0
- package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
- package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
- package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
- package/dist/cjs/resources/billingEngine/index.js +43 -0
- package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
- package/dist/cjs/resources/billingEngine/invoices.js +509 -0
- package/dist/cjs/resources/billingEngine/params.js +43 -0
- package/dist/cjs/resources/billingEngine/public.js +326 -0
- package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
- package/dist/cjs/resources/catalog/billing.js +755 -0
- package/dist/cjs/resources/catalog/billingSettings.js +131 -0
- package/dist/cjs/resources/catalog/coupons.js +222 -0
- package/dist/cjs/resources/catalog/entitlements.js +257 -0
- package/dist/cjs/resources/catalog/index.js +58 -0
- package/dist/cjs/resources/catalog/meters.js +279 -0
- package/dist/cjs/resources/catalog/prices.js +423 -0
- package/dist/cjs/resources/catalog/products.js +228 -0
- package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
- package/dist/cjs/resources/catalog/shared.js +75 -0
- package/dist/cjs/resources/catalog/testClocks.js +127 -0
- package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
- package/dist/cjs/resources/checkout/contributions.js +172 -0
- package/dist/cjs/resources/checkout/files.js +133 -0
- package/dist/cjs/resources/checkout/index.js +57 -0
- package/dist/cjs/resources/checkout/merchants.js +290 -0
- package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
- package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
- package/dist/cjs/resources/checkout/shared.js +368 -0
- package/dist/cjs/resources/connect/account.js +332 -0
- package/dist/cjs/resources/connect/applicationFees.js +113 -0
- package/dist/cjs/resources/connect/balance.js +212 -0
- package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
- package/dist/cjs/resources/connect/index.js +51 -0
- package/dist/cjs/resources/connect/onboarding.js +82 -0
- package/dist/cjs/resources/connect/payouts.js +196 -0
- package/dist/cjs/resources/connect/reporting.js +235 -0
- package/dist/cjs/resources/connect/requestLogs.js +110 -0
- package/dist/cjs/resources/connect/transfers.js +227 -0
- package/dist/cjs/resources/core/customers.js +194 -0
- package/dist/cjs/resources/core/index.js +23 -0
- package/dist/cjs/resources/core/paymentMethods.js +134 -0
- package/dist/cjs/resources/events/events.js +357 -0
- package/dist/cjs/resources/events/index.js +29 -0
- package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
- package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
- package/dist/cjs/resources/payments/charges.js +157 -0
- package/dist/cjs/resources/payments/disputes.js +204 -0
- package/dist/cjs/resources/payments/index.js +41 -0
- package/dist/cjs/resources/payments/paymentIntents.js +529 -0
- package/dist/cjs/resources/payments/refunds.js +245 -0
- package/dist/cjs/resources/payments/setupIntents.js +158 -0
- package/dist/cjs/resources/payments/social.js +182 -0
- package/dist/cjs/resources/payments/testHelpers.js +39 -0
- package/dist/cjs/resources/tax/assessments.js +217 -0
- package/dist/cjs/resources/tax/businessProfile.js +99 -0
- package/dist/cjs/resources/tax/calculations.js +176 -0
- package/dist/cjs/resources/tax/capabilities.js +42 -0
- package/dist/cjs/resources/tax/codes.js +37 -0
- package/dist/cjs/resources/tax/complianceActions.js +56 -0
- package/dist/cjs/resources/tax/deadlines.js +59 -0
- package/dist/cjs/resources/tax/documents.js +128 -0
- package/dist/cjs/resources/tax/index.js +80 -0
- package/dist/cjs/resources/tax/locationEvidence.js +131 -0
- package/dist/cjs/resources/tax/operatingLocations.js +98 -0
- package/dist/cjs/resources/tax/products.js +67 -0
- package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
- package/dist/cjs/resources/tax/registrations.js +82 -0
- package/dist/cjs/resources/tax/reports.js +92 -0
- package/dist/cjs/resources/tax/reviewItems.js +116 -0
- package/dist/cjs/resources/tax/ruleSet.js +68 -0
- package/dist/cjs/resources/tax/salesDestinations.js +94 -0
- package/dist/cjs/resources/tax/settings.js +104 -0
- package/dist/cjs/resources/tax/shared.js +62 -0
- package/dist/cjs/resources/tax/transactions.js +102 -0
- package/dist/cjs/route.js +22 -0
- package/dist/cjs/routes.js +31 -0
- package/dist/cjs/vocabulary/billingPortal.js +15 -0
- package/dist/cjs/vocabulary/catalog.js +110 -0
- package/dist/cjs/vocabulary/checkout.js +53 -0
- package/dist/cjs/vocabulary/connect.js +95 -0
- package/dist/cjs/vocabulary/errors.js +174 -0
- package/dist/cjs/vocabulary/events.js +176 -0
- package/dist/cjs/vocabulary/files.js +44 -0
- package/dist/cjs/vocabulary/index.js +37 -0
- package/dist/cjs/vocabulary/invoices.js +52 -0
- package/dist/cjs/vocabulary/lists.js +22 -0
- package/dist/cjs/vocabulary/merchants.js +23 -0
- package/dist/cjs/vocabulary/money.js +104 -0
- package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
- package/dist/cjs/vocabulary/payments.js +195 -0
- package/dist/cjs/vocabulary/reporting.js +27 -0
- package/dist/cjs/vocabulary/subscriptions.js +60 -0
- package/dist/cjs/vocabulary/tax.js +237 -0
- package/dist/cjs/vocabulary/version.js +12 -0
- package/dist/esm/common/address.js +76 -0
- package/dist/esm/common/envelopes.js +95 -0
- package/dist/esm/common/objects.js +74 -0
- package/dist/esm/common/params.js +203 -0
- package/dist/esm/common/primitives.js +35 -0
- package/dist/esm/contributions.js +5 -0
- package/dist/esm/index.js +26 -94
- package/dist/esm/openapi/document.js +294 -0
- package/dist/esm/openapi/index.js +2 -0
- package/dist/esm/openapi/webhooks.js +14 -0
- package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
- package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
- package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
- package/dist/esm/resources/billingEngine/index.js +26 -0
- package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
- package/dist/esm/resources/billingEngine/invoices.js +506 -0
- package/dist/esm/resources/billingEngine/params.js +39 -0
- package/dist/esm/resources/billingEngine/public.js +323 -0
- package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
- package/dist/esm/resources/catalog/billing.js +752 -0
- package/dist/esm/resources/catalog/billingSettings.js +128 -0
- package/dist/esm/resources/catalog/coupons.js +219 -0
- package/dist/esm/resources/catalog/entitlements.js +254 -0
- package/dist/esm/resources/catalog/index.js +38 -0
- package/dist/esm/resources/catalog/meters.js +276 -0
- package/dist/esm/resources/catalog/prices.js +419 -0
- package/dist/esm/resources/catalog/products.js +225 -0
- package/dist/esm/resources/catalog/promotionCodes.js +171 -0
- package/dist/esm/resources/catalog/shared.js +67 -0
- package/dist/esm/resources/catalog/testClocks.js +124 -0
- package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
- package/dist/esm/resources/checkout/contributions.js +167 -0
- package/dist/esm/resources/checkout/files.js +130 -0
- package/dist/esm/resources/checkout/index.js +25 -0
- package/dist/esm/resources/checkout/merchants.js +287 -0
- package/dist/esm/resources/checkout/paymentLinks.js +327 -0
- package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
- package/dist/esm/resources/checkout/shared.js +363 -0
- package/dist/esm/resources/connect/account.js +329 -0
- package/dist/esm/resources/connect/applicationFees.js +110 -0
- package/dist/esm/resources/connect/balance.js +209 -0
- package/dist/esm/resources/connect/connectedAccounts.js +257 -0
- package/dist/esm/resources/connect/index.js +34 -0
- package/dist/esm/resources/connect/onboarding.js +79 -0
- package/dist/esm/resources/connect/payouts.js +193 -0
- package/dist/esm/resources/connect/reporting.js +232 -0
- package/dist/esm/resources/connect/requestLogs.js +107 -0
- package/dist/esm/resources/connect/transfers.js +224 -0
- package/dist/esm/resources/core/customers.js +191 -0
- package/dist/esm/resources/core/index.js +6 -0
- package/dist/esm/resources/core/paymentMethods.js +131 -0
- package/dist/esm/resources/events/events.js +353 -0
- package/dist/esm/resources/events/index.js +12 -0
- package/dist/esm/resources/events/webhookDeliveries.js +90 -0
- package/dist/esm/resources/events/webhookEndpoints.js +212 -0
- package/dist/esm/resources/payments/charges.js +154 -0
- package/dist/esm/resources/payments/disputes.js +201 -0
- package/dist/esm/resources/payments/index.js +24 -0
- package/dist/esm/resources/payments/paymentIntents.js +526 -0
- package/dist/esm/resources/payments/refunds.js +242 -0
- package/dist/esm/resources/payments/setupIntents.js +155 -0
- package/dist/esm/resources/payments/social.js +179 -0
- package/dist/esm/resources/payments/testHelpers.js +36 -0
- package/dist/esm/resources/tax/assessments.js +214 -0
- package/dist/esm/resources/tax/businessProfile.js +96 -0
- package/dist/esm/resources/tax/calculations.js +173 -0
- package/dist/esm/resources/tax/capabilities.js +39 -0
- package/dist/esm/resources/tax/codes.js +34 -0
- package/dist/esm/resources/tax/complianceActions.js +53 -0
- package/dist/esm/resources/tax/deadlines.js +56 -0
- package/dist/esm/resources/tax/documents.js +125 -0
- package/dist/esm/resources/tax/index.js +63 -0
- package/dist/esm/resources/tax/locationEvidence.js +128 -0
- package/dist/esm/resources/tax/operatingLocations.js +95 -0
- package/dist/esm/resources/tax/products.js +64 -0
- package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
- package/dist/esm/resources/tax/registrations.js +79 -0
- package/dist/esm/resources/tax/reports.js +89 -0
- package/dist/esm/resources/tax/reviewItems.js +113 -0
- package/dist/esm/resources/tax/ruleSet.js +65 -0
- package/dist/esm/resources/tax/salesDestinations.js +91 -0
- package/dist/esm/resources/tax/settings.js +101 -0
- package/dist/esm/resources/tax/shared.js +58 -0
- package/dist/esm/resources/tax/transactions.js +99 -0
- package/dist/esm/route.js +16 -0
- package/dist/esm/routes.js +27 -0
- package/dist/esm/vocabulary/billingPortal.js +12 -0
- package/dist/esm/vocabulary/catalog.js +106 -0
- package/dist/esm/vocabulary/checkout.js +50 -0
- package/dist/esm/vocabulary/connect.js +92 -0
- package/dist/esm/vocabulary/errors.js +169 -0
- package/dist/esm/vocabulary/events.js +173 -0
- package/dist/esm/vocabulary/files.js +41 -0
- package/dist/esm/vocabulary/index.js +21 -0
- package/dist/esm/vocabulary/invoices.js +49 -0
- package/dist/esm/vocabulary/lists.js +19 -0
- package/dist/esm/vocabulary/merchants.js +20 -0
- package/dist/esm/vocabulary/money.js +98 -0
- package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
- package/dist/esm/vocabulary/payments.js +192 -0
- package/dist/esm/vocabulary/reporting.js +24 -0
- package/dist/esm/vocabulary/subscriptions.js +57 -0
- package/dist/esm/vocabulary/tax.js +233 -0
- package/dist/esm/vocabulary/version.js +9 -0
- package/dist/types/common/address.d.ts +62 -0
- package/dist/types/common/envelopes.d.ts +88 -0
- package/dist/types/common/objects.d.ts +107 -0
- package/dist/types/common/params.d.ts +156 -0
- package/dist/types/common/primitives.d.ts +56 -0
- package/dist/types/contributions.d.ts +1 -0
- package/dist/types/index.d.ts +16 -134
- package/dist/types/openapi/document.d.ts +16 -0
- package/dist/types/openapi/index.d.ts +2 -0
- package/dist/types/openapi/webhooks.d.ts +15 -0
- package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
- package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
- package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
- package/dist/types/resources/billingEngine/index.d.ts +6071 -0
- package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
- package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
- package/dist/types/resources/billingEngine/params.d.ts +51 -0
- package/dist/types/resources/billingEngine/public.d.ts +1860 -0
- package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
- package/dist/types/resources/catalog/billing.d.ts +1723 -0
- package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
- package/dist/types/resources/catalog/coupons.d.ts +403 -0
- package/dist/types/resources/catalog/entitlements.d.ts +422 -0
- package/dist/types/resources/catalog/index.d.ts +3155 -0
- package/dist/types/resources/catalog/meters.d.ts +474 -0
- package/dist/types/resources/catalog/prices.d.ts +1091 -0
- package/dist/types/resources/catalog/products.d.ts +430 -0
- package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
- package/dist/types/resources/catalog/shared.d.ts +34 -0
- package/dist/types/resources/catalog/testClocks.d.ts +220 -0
- package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
- package/dist/types/resources/checkout/contributions.d.ts +375 -0
- package/dist/types/resources/checkout/files.d.ts +280 -0
- package/dist/types/resources/checkout/index.d.ts +5678 -0
- package/dist/types/resources/checkout/merchants.d.ts +395 -0
- package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
- package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
- package/dist/types/resources/checkout/shared.d.ts +419 -0
- package/dist/types/resources/connect/account.d.ts +483 -0
- package/dist/types/resources/connect/applicationFees.d.ts +198 -0
- package/dist/types/resources/connect/balance.d.ts +399 -0
- package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
- package/dist/types/resources/connect/index.d.ts +2094 -0
- package/dist/types/resources/connect/onboarding.d.ts +95 -0
- package/dist/types/resources/connect/payouts.d.ts +527 -0
- package/dist/types/resources/connect/reporting.d.ts +506 -0
- package/dist/types/resources/connect/requestLogs.d.ts +236 -0
- package/dist/types/resources/connect/transfers.d.ts +436 -0
- package/dist/types/resources/core/customers.d.ts +619 -0
- package/dist/types/resources/core/index.d.ts +679 -0
- package/dist/types/resources/core/paymentMethods.d.ts +336 -0
- package/dist/types/resources/events/events.d.ts +731 -0
- package/dist/types/resources/events/index.d.ts +1727 -0
- package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
- package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
- package/dist/types/resources/payments/charges.d.ts +390 -0
- package/dist/types/resources/payments/disputes.d.ts +822 -0
- package/dist/types/resources/payments/index.d.ts +3517 -0
- package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
- package/dist/types/resources/payments/refunds.d.ts +684 -0
- package/dist/types/resources/payments/setupIntents.d.ts +391 -0
- package/dist/types/resources/payments/social.d.ts +266 -0
- package/dist/types/resources/payments/testHelpers.d.ts +178 -0
- package/dist/types/resources/tax/assessments.d.ts +787 -0
- package/dist/types/resources/tax/businessProfile.d.ts +134 -0
- package/dist/types/resources/tax/calculations.d.ts +261 -0
- package/dist/types/resources/tax/capabilities.d.ts +81 -0
- package/dist/types/resources/tax/codes.d.ts +29 -0
- package/dist/types/resources/tax/complianceActions.d.ts +97 -0
- package/dist/types/resources/tax/deadlines.d.ts +133 -0
- package/dist/types/resources/tax/documents.d.ts +257 -0
- package/dist/types/resources/tax/index.d.ts +1946 -0
- package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
- package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
- package/dist/types/resources/tax/products.d.ts +68 -0
- package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
- package/dist/types/resources/tax/registrations.d.ts +103 -0
- package/dist/types/resources/tax/reports.d.ts +129 -0
- package/dist/types/resources/tax/reviewItems.d.ts +226 -0
- package/dist/types/resources/tax/ruleSet.d.ts +219 -0
- package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
- package/dist/types/resources/tax/settings.d.ts +122 -0
- package/dist/types/resources/tax/shared.d.ts +43 -0
- package/dist/types/resources/tax/transactions.d.ts +404 -0
- package/dist/types/route.d.ts +86 -0
- package/dist/types/routes.d.ts +23 -0
- package/dist/types/vocabulary/billingPortal.d.ts +15 -0
- package/dist/types/vocabulary/catalog.d.ts +97 -0
- package/dist/types/vocabulary/checkout.d.ts +49 -0
- package/dist/types/vocabulary/connect.d.ts +62 -0
- package/dist/types/vocabulary/errors.d.ts +145 -0
- package/dist/types/vocabulary/events.d.ts +171 -0
- package/dist/types/vocabulary/files.d.ts +30 -0
- package/dist/types/vocabulary/index.d.ts +17 -0
- package/dist/types/vocabulary/invoices.d.ts +39 -0
- package/dist/types/vocabulary/lists.d.ts +9 -0
- package/dist/types/vocabulary/merchants.d.ts +9 -0
- package/dist/types/vocabulary/money.d.ts +59 -0
- package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
- package/dist/types/vocabulary/payments.d.ts +117 -0
- package/dist/types/vocabulary/reporting.d.ts +18 -0
- package/dist/types/vocabulary/subscriptions.d.ts +45 -0
- package/dist/types/vocabulary/tax.d.ts +163 -0
- package/dist/types/vocabulary/version.d.ts +10 -0
- package/package.json +51 -11
- package/dist/cjs/openapi.js +0 -138
- package/dist/esm/openapi.js +0 -134
- package/dist/types/openapi.d.ts +0 -145
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customerRoutes = exports.listCustomersQuery = exports.updateCustomerParams = exports.createCustomerParams = exports.deletedCustomerSchema = exports.customerSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const address_1 = require("../../common/address");
|
|
6
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
7
|
+
const objects_1 = require("../../common/objects");
|
|
8
|
+
const params_1 = require("../../common/params");
|
|
9
|
+
const primitives_1 = require("../../common/primitives");
|
|
10
|
+
const route_1 = require("../../route");
|
|
11
|
+
/**
|
|
12
|
+
* Customers (`cus_…`) — Orbit's own object (ADR 0016). A provider customer is an
|
|
13
|
+
* internal binding created lazily, per mode, when a card payment method is
|
|
14
|
+
* first attached; it is never serialized.
|
|
15
|
+
*/
|
|
16
|
+
exports.customerSchema = (0, objects_1.defineObject)('customer', 'Customer', zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
id: zod_1.z.string(),
|
|
19
|
+
object: zod_1.z.literal('customer'),
|
|
20
|
+
livemode: primitives_1.livemode,
|
|
21
|
+
email: zod_1.z.string().nullable(),
|
|
22
|
+
name: zod_1.z.string().nullable(),
|
|
23
|
+
phone: zod_1.z.string().nullable(),
|
|
24
|
+
description: zod_1.z.string().nullable(),
|
|
25
|
+
address: address_1.addressSchema.nullable(),
|
|
26
|
+
shipping: address_1.shippingSchema.nullable(),
|
|
27
|
+
invoice_settings: zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
default_payment_method: (0, objects_1.expandable)('payment_method', '`pm_…`, or the PaymentMethod with `expand[]=invoice_settings.default_payment_method`.').nullable(),
|
|
30
|
+
})
|
|
31
|
+
.strict(),
|
|
32
|
+
metadata: primitives_1.metadata,
|
|
33
|
+
balance: primitives_1.signedAmount.describe('SIGNED base units in `currency`: negative is credit the customer holds, positive is owed. Applied to the next invoice when it finalizes.'),
|
|
34
|
+
currency: primitives_1.currency
|
|
35
|
+
.nullable()
|
|
36
|
+
.describe("The customer's billing currency, set by its first balance movement, subscription or invoice."),
|
|
37
|
+
test_clock: zod_1.z
|
|
38
|
+
.string()
|
|
39
|
+
.nullable()
|
|
40
|
+
.describe('The test clock (`clock_…`) it lives on; test mode only.'),
|
|
41
|
+
created: primitives_1.unixSeconds,
|
|
42
|
+
})
|
|
43
|
+
.strict(), {
|
|
44
|
+
examples: [
|
|
45
|
+
{
|
|
46
|
+
id: 'cus_0193b8f2c1a87d3e9f4a',
|
|
47
|
+
object: 'customer',
|
|
48
|
+
livemode: false,
|
|
49
|
+
email: 'jenny@example.com',
|
|
50
|
+
name: 'Jenny Rosen',
|
|
51
|
+
phone: null,
|
|
52
|
+
description: null,
|
|
53
|
+
address: null,
|
|
54
|
+
shipping: null,
|
|
55
|
+
invoice_settings: { default_payment_method: null },
|
|
56
|
+
metadata: { order_id: '6735' },
|
|
57
|
+
balance: '0',
|
|
58
|
+
currency: 'EUR',
|
|
59
|
+
test_clock: null,
|
|
60
|
+
created: 1793750400,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
/** A deleted customer: a tombstone that still retrieves. */
|
|
65
|
+
exports.deletedCustomerSchema = (0, objects_1.defineComponent)('DeletedCustomer', (0, envelopes_1.deletedOf)('customer'));
|
|
66
|
+
const name = zod_1.z.string().max(500);
|
|
67
|
+
const phone = zod_1.z.string().max(40);
|
|
68
|
+
const description = zod_1.z.string().max(1000);
|
|
69
|
+
exports.createCustomerParams = zod_1.z
|
|
70
|
+
.object({
|
|
71
|
+
email: address_1.emailParam.optional(),
|
|
72
|
+
name: name.optional(),
|
|
73
|
+
phone: phone.optional(),
|
|
74
|
+
description: description.optional(),
|
|
75
|
+
address: address_1.addressParams.optional(),
|
|
76
|
+
shipping: address_1.shippingParams.optional(),
|
|
77
|
+
invoice_settings: zod_1.z.object({ default_payment_method: params_1.idParam.optional() }).strict().optional(),
|
|
78
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
79
|
+
test_clock: params_1.idParam
|
|
80
|
+
.optional()
|
|
81
|
+
.describe('Create only, test mode only: attach the customer to a test clock (`clock_…`).'),
|
|
82
|
+
expand: params_1.expandParam.optional(),
|
|
83
|
+
})
|
|
84
|
+
.strict();
|
|
85
|
+
/** A field sent as `""` is cleared; `metadata` is a patch. */
|
|
86
|
+
exports.updateCustomerParams = zod_1.z
|
|
87
|
+
.object({
|
|
88
|
+
email: (0, params_1.clearable)(address_1.emailParam).optional(),
|
|
89
|
+
name: (0, params_1.clearable)(name).optional(),
|
|
90
|
+
phone: (0, params_1.clearable)(phone).optional(),
|
|
91
|
+
description: (0, params_1.clearable)(description).optional(),
|
|
92
|
+
address: (0, params_1.clearable)(address_1.addressParams).optional(),
|
|
93
|
+
shipping: (0, params_1.clearable)(address_1.shippingParams).optional(),
|
|
94
|
+
invoice_settings: zod_1.z
|
|
95
|
+
.object({ default_payment_method: (0, params_1.clearable)(params_1.idParam).optional() })
|
|
96
|
+
.strict()
|
|
97
|
+
.optional(),
|
|
98
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
99
|
+
expand: params_1.expandParam.optional(),
|
|
100
|
+
})
|
|
101
|
+
.strict();
|
|
102
|
+
exports.listCustomersQuery = (0, params_1.listQuery)({
|
|
103
|
+
email: zod_1.z.string().min(1).max(512).optional().describe('Exact match.'),
|
|
104
|
+
});
|
|
105
|
+
const customerOrDeleted = zod_1.z.union([exports.customerSchema, exports.deletedCustomerSchema]);
|
|
106
|
+
exports.customerRoutes = [
|
|
107
|
+
(0, route_1.defineRoute)({
|
|
108
|
+
operationId: 'createCustomer',
|
|
109
|
+
method: 'post',
|
|
110
|
+
path: '/v1/customers',
|
|
111
|
+
tag: 'Customers',
|
|
112
|
+
summary: 'Create a customer',
|
|
113
|
+
auth: 'service',
|
|
114
|
+
scope: 'payments:write',
|
|
115
|
+
idempotent: true,
|
|
116
|
+
body: exports.createCustomerParams,
|
|
117
|
+
response: exports.customerSchema,
|
|
118
|
+
status: 201,
|
|
119
|
+
sdk: 'customers.create',
|
|
120
|
+
expandable: 'customer',
|
|
121
|
+
}),
|
|
122
|
+
(0, route_1.defineRoute)({
|
|
123
|
+
operationId: 'listCustomers',
|
|
124
|
+
method: 'get',
|
|
125
|
+
path: '/v1/customers',
|
|
126
|
+
tag: 'Customers',
|
|
127
|
+
summary: 'List customers',
|
|
128
|
+
description: 'Your live customers, newest first. Deleted customers are not listed.',
|
|
129
|
+
auth: 'service',
|
|
130
|
+
scope: 'payments:read',
|
|
131
|
+
query: exports.listCustomersQuery,
|
|
132
|
+
response: (0, envelopes_1.listOf)(exports.customerSchema),
|
|
133
|
+
sdk: 'customers.list',
|
|
134
|
+
expandable: 'customer',
|
|
135
|
+
}),
|
|
136
|
+
(0, route_1.defineRoute)({
|
|
137
|
+
operationId: 'retrieveCustomer',
|
|
138
|
+
method: 'get',
|
|
139
|
+
path: '/v1/customers/{id}',
|
|
140
|
+
tag: 'Customers',
|
|
141
|
+
summary: 'Retrieve a customer',
|
|
142
|
+
description: 'A deleted customer answers `{ id, object: "customer", deleted: true }`.',
|
|
143
|
+
auth: 'service',
|
|
144
|
+
scope: 'payments:read',
|
|
145
|
+
params: { id: 'The customer (`cus_…`).' },
|
|
146
|
+
query: params_1.expandOnlyQuery,
|
|
147
|
+
response: customerOrDeleted,
|
|
148
|
+
sdk: 'customers.retrieve',
|
|
149
|
+
expandable: 'customer',
|
|
150
|
+
}),
|
|
151
|
+
(0, route_1.defineRoute)({
|
|
152
|
+
operationId: 'updateCustomer',
|
|
153
|
+
method: 'post',
|
|
154
|
+
path: '/v1/customers/{id}',
|
|
155
|
+
tag: 'Customers',
|
|
156
|
+
summary: 'Update a customer',
|
|
157
|
+
description: 'A field sent as `""` is cleared; `metadata` is a patch.',
|
|
158
|
+
auth: 'service',
|
|
159
|
+
scope: 'payments:write',
|
|
160
|
+
idempotent: true,
|
|
161
|
+
params: { id: 'The customer (`cus_…`).' },
|
|
162
|
+
body: exports.updateCustomerParams,
|
|
163
|
+
response: exports.customerSchema,
|
|
164
|
+
sdk: 'customers.update',
|
|
165
|
+
expandable: 'customer',
|
|
166
|
+
}),
|
|
167
|
+
(0, route_1.defineRoute)({
|
|
168
|
+
operationId: 'deleteCustomer',
|
|
169
|
+
method: 'delete',
|
|
170
|
+
path: '/v1/customers/{id}',
|
|
171
|
+
tag: 'Customers',
|
|
172
|
+
summary: 'Delete a customer',
|
|
173
|
+
description: 'A tombstone, with every saved payment method of the customer detached. Deleting a deleted customer answers the tombstone again.',
|
|
174
|
+
auth: 'service',
|
|
175
|
+
scope: 'payments:write',
|
|
176
|
+
params: { id: 'The customer (`cus_…`).' },
|
|
177
|
+
response: exports.deletedCustomerSchema,
|
|
178
|
+
sdk: 'customers.del',
|
|
179
|
+
}),
|
|
180
|
+
(0, route_1.defineRoute)({
|
|
181
|
+
operationId: 'searchCustomers',
|
|
182
|
+
method: 'get',
|
|
183
|
+
path: '/v1/customers/search',
|
|
184
|
+
tag: 'Customers',
|
|
185
|
+
summary: 'Search customers',
|
|
186
|
+
description: "Stripe's query language over `email`, `name`, `phone`, `created` and `metadata['key']`.",
|
|
187
|
+
auth: 'service',
|
|
188
|
+
scope: 'payments:read',
|
|
189
|
+
query: params_1.searchQuery,
|
|
190
|
+
response: (0, envelopes_1.searchResultOf)(exports.customerSchema),
|
|
191
|
+
sdk: 'customers.search',
|
|
192
|
+
expandable: 'customer',
|
|
193
|
+
}),
|
|
194
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.coreRoutes = void 0;
|
|
18
|
+
const customers_1 = require("./customers");
|
|
19
|
+
const paymentMethods_1 = require("./paymentMethods");
|
|
20
|
+
__exportStar(require("./customers"), exports);
|
|
21
|
+
__exportStar(require("./paymentMethods"), exports);
|
|
22
|
+
/** Customers and their saved payment methods. */
|
|
23
|
+
exports.coreRoutes = [...customers_1.customerRoutes, ...paymentMethods_1.paymentMethodRoutes];
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paymentMethodRoutes = exports.listPaymentMethodsQuery = exports.detachPaymentMethodParams = exports.updatePaymentMethodParams = exports.paymentMethodSchema = exports.billingDetailsSchema = exports.cardDetailsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const address_1 = require("../../common/address");
|
|
6
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
7
|
+
const objects_1 = require("../../common/objects");
|
|
8
|
+
const params_1 = require("../../common/params");
|
|
9
|
+
const primitives_1 = require("../../common/primitives");
|
|
10
|
+
const route_1 = require("../../route");
|
|
11
|
+
/**
|
|
12
|
+
* PaymentMethods (`pm_…`) — Peable's wrapper over a provider payment method
|
|
13
|
+
* (ADR 0016). Card details are collected by the provider's own Elements in the
|
|
14
|
+
* browser; the card number never reaches Peable. A FairCoin customer has no
|
|
15
|
+
* payment method: signing stays on the payer's device.
|
|
16
|
+
*/
|
|
17
|
+
/** Card details safe to show: never the number, never the CVC. */
|
|
18
|
+
exports.cardDetailsSchema = (0, objects_1.defineComponent)('CardDetails', zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
brand: zod_1.z.string().nullable(),
|
|
21
|
+
last4: zod_1.z.string().nullable(),
|
|
22
|
+
exp_month: zod_1.z.number().int().nullable(),
|
|
23
|
+
exp_year: zod_1.z.number().int().nullable(),
|
|
24
|
+
country: zod_1.z.string().nullable().describe('ISO 3166-1 alpha-2 of the issuer.'),
|
|
25
|
+
funding: zod_1.z.string().nullable().describe('`credit`, `debit`, `prepaid` or `unknown`.'),
|
|
26
|
+
})
|
|
27
|
+
.strict());
|
|
28
|
+
exports.billingDetailsSchema = (0, objects_1.defineComponent)('BillingDetails', zod_1.z
|
|
29
|
+
.object({
|
|
30
|
+
address: address_1.addressSchema.nullable(),
|
|
31
|
+
email: zod_1.z.string().nullable(),
|
|
32
|
+
name: zod_1.z.string().nullable(),
|
|
33
|
+
phone: zod_1.z.string().nullable(),
|
|
34
|
+
})
|
|
35
|
+
.strict());
|
|
36
|
+
exports.paymentMethodSchema = (0, objects_1.defineObject)('payment_method', 'PaymentMethod', zod_1.z
|
|
37
|
+
.object({
|
|
38
|
+
id: zod_1.z.string(),
|
|
39
|
+
object: zod_1.z.literal('payment_method'),
|
|
40
|
+
livemode: primitives_1.livemode,
|
|
41
|
+
type: zod_1.z.literal('card'),
|
|
42
|
+
card: exports.cardDetailsSchema,
|
|
43
|
+
billing_details: exports.billingDetailsSchema,
|
|
44
|
+
customer: (0, objects_1.expandable)('customer', '`cus_…`, or the Customer with `expand[]=customer`; `null` once detached.').nullable(),
|
|
45
|
+
metadata: primitives_1.metadata,
|
|
46
|
+
created: primitives_1.unixSeconds,
|
|
47
|
+
})
|
|
48
|
+
.strict());
|
|
49
|
+
/**
|
|
50
|
+
* Billing details (each named field replaces that field) and metadata (a
|
|
51
|
+
* patch). Orbit's record of the card holder; the provider's copy is not
|
|
52
|
+
* rewritten — the card was verified against what the payer entered there.
|
|
53
|
+
*/
|
|
54
|
+
exports.updatePaymentMethodParams = zod_1.z
|
|
55
|
+
.object({
|
|
56
|
+
billing_details: zod_1.z
|
|
57
|
+
.object({
|
|
58
|
+
address: address_1.addressParams.optional(),
|
|
59
|
+
email: address_1.emailParam.optional(),
|
|
60
|
+
name: zod_1.z.string().max(500).optional(),
|
|
61
|
+
phone: zod_1.z.string().max(40).optional(),
|
|
62
|
+
})
|
|
63
|
+
.strict()
|
|
64
|
+
.optional(),
|
|
65
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
66
|
+
expand: params_1.expandParam.optional(),
|
|
67
|
+
})
|
|
68
|
+
.strict();
|
|
69
|
+
exports.detachPaymentMethodParams = zod_1.z.object({ expand: params_1.expandParam.optional() }).strict();
|
|
70
|
+
/** `customer` is REQUIRED: Stripe lists a customer's methods, never a merchant's whole wallet. */
|
|
71
|
+
exports.listPaymentMethodsQuery = (0, params_1.listQuery)({
|
|
72
|
+
customer: params_1.idParam.describe('The customer (`cus_…`) whose methods to list.'),
|
|
73
|
+
type: zod_1.z.literal('card').optional(),
|
|
74
|
+
});
|
|
75
|
+
exports.paymentMethodRoutes = [
|
|
76
|
+
(0, route_1.defineRoute)({
|
|
77
|
+
operationId: 'listPaymentMethods',
|
|
78
|
+
method: 'get',
|
|
79
|
+
path: '/v1/payment_methods',
|
|
80
|
+
tag: 'Payment methods',
|
|
81
|
+
summary: "List a customer's payment methods",
|
|
82
|
+
auth: 'service',
|
|
83
|
+
scope: 'payments:read',
|
|
84
|
+
query: exports.listPaymentMethodsQuery,
|
|
85
|
+
response: (0, envelopes_1.listOf)(exports.paymentMethodSchema),
|
|
86
|
+
sdk: 'paymentMethods.list',
|
|
87
|
+
expandable: 'payment_method',
|
|
88
|
+
}),
|
|
89
|
+
(0, route_1.defineRoute)({
|
|
90
|
+
operationId: 'retrievePaymentMethod',
|
|
91
|
+
method: 'get',
|
|
92
|
+
path: '/v1/payment_methods/{id}',
|
|
93
|
+
tag: 'Payment methods',
|
|
94
|
+
summary: 'Retrieve a payment method',
|
|
95
|
+
auth: 'service',
|
|
96
|
+
scope: 'payments:read',
|
|
97
|
+
params: { id: 'The payment method (`pm_…`).' },
|
|
98
|
+
query: params_1.expandOnlyQuery,
|
|
99
|
+
response: exports.paymentMethodSchema,
|
|
100
|
+
sdk: 'paymentMethods.retrieve',
|
|
101
|
+
expandable: 'payment_method',
|
|
102
|
+
}),
|
|
103
|
+
(0, route_1.defineRoute)({
|
|
104
|
+
operationId: 'updatePaymentMethod',
|
|
105
|
+
method: 'post',
|
|
106
|
+
path: '/v1/payment_methods/{id}',
|
|
107
|
+
tag: 'Payment methods',
|
|
108
|
+
summary: 'Update a payment method',
|
|
109
|
+
auth: 'service',
|
|
110
|
+
scope: 'payments:write',
|
|
111
|
+
idempotent: true,
|
|
112
|
+
params: { id: 'The payment method (`pm_…`).' },
|
|
113
|
+
body: exports.updatePaymentMethodParams,
|
|
114
|
+
response: exports.paymentMethodSchema,
|
|
115
|
+
sdk: 'paymentMethods.update',
|
|
116
|
+
expandable: 'payment_method',
|
|
117
|
+
}),
|
|
118
|
+
(0, route_1.defineRoute)({
|
|
119
|
+
operationId: 'detachPaymentMethod',
|
|
120
|
+
method: 'post',
|
|
121
|
+
path: '/v1/payment_methods/{id}/detach',
|
|
122
|
+
tag: 'Payment methods',
|
|
123
|
+
summary: 'Detach a payment method',
|
|
124
|
+
description: 'Permanently. A second detach answers the detached method.',
|
|
125
|
+
auth: 'service',
|
|
126
|
+
scope: 'payments:write',
|
|
127
|
+
idempotent: true,
|
|
128
|
+
params: { id: 'The payment method (`pm_…`).' },
|
|
129
|
+
body: exports.detachPaymentMethodParams,
|
|
130
|
+
response: exports.paymentMethodSchema,
|
|
131
|
+
sdk: 'paymentMethods.detach',
|
|
132
|
+
expandable: 'payment_method',
|
|
133
|
+
}),
|
|
134
|
+
];
|