@peable.to/shared-types 0.15.0 → 0.17.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/branding.js +31 -0
- package/dist/cjs/checkoutSession.js +43 -0
- package/dist/cjs/file.js +20 -5
- package/dist/cjs/index.js +32 -2
- package/dist/cjs/paymentLink.js +5 -0
- package/dist/cjs/reporting.js +92 -0
- package/dist/cjs/search.js +18 -0
- package/dist/esm/branding.js +28 -0
- package/dist/esm/checkoutSession.js +42 -1
- package/dist/esm/file.js +19 -4
- package/dist/esm/index.js +6 -1
- package/dist/esm/paymentLink.js +4 -1
- package/dist/esm/reporting.js +89 -0
- package/dist/esm/search.js +15 -0
- package/dist/types/branding.d.ts +88 -0
- package/dist/types/charge.d.ts +6 -0
- package/dist/types/checkoutSession.d.ts +418 -39
- package/dist/types/event.d.ts +21 -0
- package/dist/types/file.d.ts +25 -10
- package/dist/types/index.d.ts +6 -3
- package/dist/types/paymentLink.d.ts +142 -37
- package/dist/types/reporting.d.ts +84 -0
- package/dist/types/search.d.ts +48 -0
- package/package.json +1 -1
package/dist/types/file.d.ts
CHANGED
|
@@ -4,10 +4,18 @@
|
|
|
4
4
|
* reference the file — a `business_logo` is public, a `dispute_evidence` file
|
|
5
5
|
* is private and can only be attached to the merchant's own disputes.
|
|
6
6
|
*/
|
|
7
|
-
export declare const FILE_PURPOSES: readonly ["dispute_evidence", "business_logo", "identity_document", "additional_verification"];
|
|
7
|
+
export declare const FILE_PURPOSES: readonly ["dispute_evidence", "business_logo", "identity_document", "additional_verification", "finance_report_run"];
|
|
8
8
|
export type FilePurpose = (typeof FILE_PURPOSES)[number];
|
|
9
|
+
/**
|
|
10
|
+
* The purposes a merchant may upload or import. `finance_report_run` is not
|
|
11
|
+
* among them: a report's CSV is written by Peable's report runs
|
|
12
|
+
* (`/v1/reporting/report_runs`) and nobody else, so a file of that purpose is
|
|
13
|
+
* always a report Peable produced.
|
|
14
|
+
*/
|
|
15
|
+
export declare const FILE_UPLOAD_PURPOSES: readonly ["dispute_evidence", "business_logo", "identity_document", "additional_verification"];
|
|
16
|
+
export type FileUploadPurpose = (typeof FILE_UPLOAD_PURPOSES)[number];
|
|
9
17
|
/** The stored format, by its conventional extension (Stripe's `type`). */
|
|
10
|
-
export declare const FILE_TYPES: readonly ["pdf", "png", "jpg"];
|
|
18
|
+
export declare const FILE_TYPES: readonly ["pdf", "png", "jpg", "csv"];
|
|
11
19
|
export type FileType = (typeof FILE_TYPES)[number];
|
|
12
20
|
/**
|
|
13
21
|
* Whether the bytes can be used right now.
|
|
@@ -21,12 +29,13 @@ export type FileType = (typeof FILE_TYPES)[number];
|
|
|
21
29
|
export declare const FILE_STATUSES: readonly ["available", "withheld", "removed"];
|
|
22
30
|
export type FileStatus = (typeof FILE_STATUSES)[number];
|
|
23
31
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
32
|
+
* The policy of each purpose: the formats it takes, recognised from the bytes
|
|
33
|
+
* and never from a client's `Content-Type`, and the largest file.
|
|
26
34
|
*
|
|
27
35
|
* The provider's own ceilings, restated where the upload is parsed, so a file
|
|
28
36
|
* the card network would refuse is refused at upload — not at the one-shot
|
|
29
|
-
* dispute submission it was meant for.
|
|
37
|
+
* dispute submission it was meant for. `finance_report_run` is Peable's own
|
|
38
|
+
* output (see {@link FILE_UPLOAD_PURPOSES}); its ceiling bounds a report.
|
|
30
39
|
*/
|
|
31
40
|
export declare const FILE_PURPOSE_POLICIES: Readonly<Record<FilePurpose, {
|
|
32
41
|
readonly types: readonly FileType[];
|
|
@@ -50,10 +59,16 @@ export interface FileObject {
|
|
|
50
59
|
type: FileType;
|
|
51
60
|
status: FileStatus;
|
|
52
61
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
62
|
+
* Where the bytes can be read, while the file is `available`:
|
|
63
|
+
*
|
|
64
|
+
* - a `business_logo`: a PUBLIC URL — what a payer surface renders;
|
|
65
|
+
* - a `finance_report_run`: the gateway's `GET /v1/files/:id/contents`,
|
|
66
|
+
* which answers the CSV to the merchant's own credential (Stripe's
|
|
67
|
+
* `files.stripe.com/v1/files/:id/contents`).
|
|
68
|
+
*
|
|
69
|
+
* `null` for every other purpose: evidence and identity documents are never
|
|
70
|
+
* addressable by URL, and their bytes leave Peable only to the provider they
|
|
71
|
+
* are submitted to.
|
|
57
72
|
*/
|
|
58
73
|
url: string | null;
|
|
59
74
|
created: number;
|
|
@@ -68,7 +83,7 @@ export interface FileObject {
|
|
|
68
83
|
* checked once, here, and never again.
|
|
69
84
|
*/
|
|
70
85
|
export interface CreateFileFromOxyParams {
|
|
71
|
-
purpose:
|
|
86
|
+
purpose: FileUploadPurpose;
|
|
72
87
|
/** Oxy file id. */
|
|
73
88
|
oxy_file: string;
|
|
74
89
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ export { PEABLE_API_VERSION, type WebhookEventType, type WebhookEvent, type Webh
|
|
|
10
10
|
export { WEBHOOK_ENDPOINT_STATUSES, WEBHOOK_ENDPOINT_DISABLED_REASONS, WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT, WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS, type WebhookEnabledEvent, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEndpointDisabledReason, type DeletedWebhookEndpoint, type CreateWebhookEndpointParams, type UpdateWebhookEndpointParams, type RollWebhookEndpointSecretParams, } from './webhookEndpoint';
|
|
11
11
|
export { PRICE_BILLING_SCHEMES, PRICE_TIERS_MODES, PRICE_TYPES, RECURRING_INTERVALS, RECURRING_USAGE_TYPES, PRICE_TAX_BEHAVIORS, TRANSFORM_QUANTITY_ROUNDS, COUPON_DURATIONS, CATALOG_LIMITS, type PriceBillingScheme, type PriceTiersMode, type PriceType, type RecurringInterval, type RecurringUsageType, type PriceTaxBehavior, type TransformQuantityRound, type CouponDuration, type ProductMarketingFeature, type Product, type DeletedProduct, type PriceTier, type PriceTransformQuantity, type PriceRecurring, type Price, type Coupon, type DeletedCoupon, type PromotionCodeRestrictions, type PromotionCode, type RecurringParams, type PriceTierParams, type PriceDataParams, type DefaultPriceDataParams, type CreateProductParams, type UpdateProductParams, type ProductListParams, type CreatePriceParams, type UpdatePriceParams, type PriceListParams, type CreateCouponParams, type UpdateCouponParams, type CouponListParams, type CreatePromotionCodeParams, type UpdatePromotionCodeParams, type PromotionCodeListParams, } from './catalog';
|
|
12
12
|
export { DISPUTE_FILE_EVIDENCE_FIELDS, DISPUTE_REASONS, DISPUTE_TEXT_EVIDENCE_FIELDS, normalizeDisputeReason, type Dispute, type DisputeEvidence, type DisputeEvidenceDetails, type DisputeEvidenceField, type DisputeEvidenceParams, type DisputeFileEvidenceField, type DisputeReason, type DisputeStatus, type DisputeTextEvidenceField, type ListDisputesParams, type UpdateDisputeParams, } from './dispute';
|
|
13
|
-
export { FILE_PURPOSES, FILE_PURPOSE_POLICIES, FILE_STATUSES, FILE_TYPES, type CreateFileFromOxyParams, type FileObject, type FilePurpose, type FileStatus, type FileType, type ListFilesParams, } from './file';
|
|
13
|
+
export { FILE_PURPOSES, FILE_PURPOSE_POLICIES, FILE_UPLOAD_PURPOSES, FILE_STATUSES, FILE_TYPES, type CreateFileFromOxyParams, type FileObject, type FilePurpose, type FileStatus, type FileType, type FileUploadPurpose, type ListFilesParams, } from './file';
|
|
14
|
+
export { SEARCHABLE_RESOURCES, SEARCH_QUERY_MAX_CLAUSES, SEARCH_QUERY_MAX_LENGTH, SEARCH_SUBSTRING_MIN_LENGTH, type SearchParams, type SearchResult, type SearchableResource, } from './search';
|
|
15
|
+
export { REPORT_RUN_STATUSES, REPORT_TYPE_IDS, REPORT_TYPE_LAYOUTS, type CreateReportRunParams, type ListReportRunsParams, type ReportRun, type ReportRunParameters, type ReportRunStatus, type ReportType, type ReportTypeId, } from './reporting';
|
|
14
16
|
export { CARD_RAIL_PAYMENT_METHOD_TYPES, PAYMENT_METHOD_CONFIGURATION_TYPES, PAYMENT_METHOD_CURRENCIES, type CardRailPaymentMethodType, type CreatePaymentMethodConfigurationParams, type CreatePaymentMethodDomainParams, type ListPaymentMethodDomainsParams, type PaymentMethodConfiguration, type PaymentMethodConfigurationEntry, type PaymentMethodConfigurationEntryParams, type PaymentMethodConfigurationType, type PaymentMethodDisplayPreference, type PaymentMethodDomain, type PaymentMethodDomainWalletStatus, type PaymentMethodUnavailableReason, type UpdatePaymentMethodConfigurationParams, type UpdatePaymentMethodDomainParams, } from './paymentMethodConfiguration';
|
|
15
17
|
export { PAYOUT_INTERVALS, PAYOUT_WEEKLY_ANCHORS, type Account, type AccountBusinessProfile, type AccountCapabilityStatus, type AccountPayoutSchedule, type AccountRequirements, type AccountSettings, type AccountType, type CreateAccountLinkParams, type PayoutInterval, type PayoutWeeklyAnchor, type UpdateAccountParams, } from './account';
|
|
16
18
|
export { BALANCE_TRANSACTION_STATUSES, BALANCE_TRANSACTION_TYPES, PAYOUT_STATUSES, RECONCILIATION_MISMATCH_KINDS, type ApplicationFee, type Balance, type BalanceAmount, type BalanceTransaction, type BalanceTransactionFeeDetail, type BalanceTransactionStatus, type BalanceTransactionType, type CreatePayoutParams, type FeeRefund, type ListBalanceTransactionsParams, type ListPayoutsParams, type Payout, type PayoutReconciliationReport, type PayoutStatus, type ReconciliationMismatch, type ReconciliationMismatchKind, } from './balance';
|
|
@@ -23,8 +25,9 @@ export { signWebhook, verifyWebhook } from './webhookSigner';
|
|
|
23
25
|
export { type MerchantEnvironment, type Merchant, MERCHANT_ENVIRONMENTS, } from './merchant';
|
|
24
26
|
export type { MerchantDisplay } from './merchantDisplay';
|
|
25
27
|
export type { AccountLink, ConnectOnboarding, ConnectOnboardingComplete, RegisterFaircoinKeyParams, } from './connect';
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
28
|
+
export { PAYMENT_LINK_LIMITS, type PaymentLink, type PublicPaymentLink, type PaymentLinkLineItemParams, type PaymentLinkAfterCompletionParams, type CreatePaymentLinkParams, type UpdatePaymentLinkParams, type CreatePaymentLinkSessionParams, type PaymentLinkSessionStart, } from './paymentLink';
|
|
29
|
+
export { CHECKOUT_SESSION_MODES, CHECKOUT_SESSION_STATUSES, CHECKOUT_PAYMENT_STATUSES, CHECKOUT_UI_MODES, CHECKOUT_LOCALES, CHECKOUT_SUBMIT_TYPES, CHECKOUT_CUSTOMER_CREATIONS, CHECKOUT_BILLING_ADDRESS_COLLECTIONS, CHECKOUT_CUSTOM_FIELD_TYPES, CHECKOUT_TAX_ID_TYPES, CHECKOUT_LIMITS, CHECKOUT_SESSION_ID_TEMPLATE, type CheckoutSessionMode, type CheckoutSessionStatus, type CheckoutSessionPaymentStatus, type CheckoutUiMode, type CheckoutLocale, type CheckoutSubmitType, type CheckoutCustomerCreation, type CheckoutBillingAddressCollection, type CheckoutCustomFieldType, type CheckoutTaxIdType, type CheckoutAdjustableQuantity, type CheckoutLineItem, type CheckoutTaxId, type CheckoutCustomerDetails, type CheckoutShippingDetails, type CheckoutCustomFieldLabel, type CheckoutCustomFieldDropdownOption, type CheckoutCustomField, type CheckoutDiscount, type CheckoutTotalDetails, type CheckoutAutomaticTax, type CheckoutConsentCollection, type CheckoutConsent, type CheckoutAfterCompletion, type CheckoutSession, type CheckoutSessionPublic, type UpdateCheckoutSessionPublicParams, type ConfirmCheckoutSessionPublicParams, type CheckoutProductDataParams, type CheckoutPriceDataParams, type CheckoutLineItemParams, type CheckoutCustomFieldParams, type CreateCheckoutSessionParams, type UpdateCheckoutSessionParams, } from './checkoutSession';
|
|
30
|
+
export { BRANDING_FONTS, BRANDING_BORDER_STYLES, BRANDING_COLOR_PATTERN, DEFAULT_BRANDING, type BrandingFont, type BrandingBorderStyle, type MerchantBranding, type UpdateMerchantBrandingParams, type CheckoutBranding, type MerchantEmailSettings, type UpdateMerchantEmailSettingsParams, } from './branding';
|
|
28
31
|
export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, type SocialPaymentSource, type SocialNextAddressRequest, type SocialNextAddressResponse, type SocialReceiveCursorResponse, type SocialPaymentDirection, type SocialPayment, type SocialPaymentsResponse, type EnrichmentKind, type EnrichmentResult, type EnrichRequest, type EnrichResponse, } from './social';
|
|
29
32
|
export { BILLING_SUBSCRIPTION_STATUSES, type BillingSubscriptionStatus, type CreateBillingTaxQuoteParams, type BillingTaxQuote, type BillingInvoiceAuthoritySource, type BillingFinalInvoice, type BillingFinalInvoiceAuthority, type BillingFaircoinRenewalChoice, type BillingFaircoinRenewalConsent, type BillingFaircoinRenewalRevocation, type BillingCheckoutSession, type BillingEmbeddedCheckoutSession, type BillingEmbeddedCheckoutConfiguration, type BillingEmbeddedCheckoutBinding, type BillingEmbeddedCheckoutAction, type BillingEmbeddedCheckoutScope, type BillingCheckoutObservation, type RetrieveBillingCheckoutOperationParams, type BillingCheckoutOperationSource, type BillingCheckoutOperationRecovery, type BillingPaidInvoice, type BillingInvoiceState, type BillingCustomer, type BillingRail, type BillingRailSettlement, type BillingRailOffer, type BillingRailOption, type BillingRailList, type EnsureBillingCustomerParams, type CreateBillingCheckoutParams, type CreateBillingPortalParams, type BillingHostedSession, type BillingSubscription, } from './billing';
|
|
30
33
|
export { canonicalBillingAuthority, canonicalBillingTaxQuote, PEABLE_BILLING_AUTHORITY_KEYS, } from './billing-authority';
|
|
@@ -1,72 +1,177 @@
|
|
|
1
1
|
import type { ContributionDetails } from '@peable.to/contracts';
|
|
2
|
+
import type { CheckoutBranding } from './branding';
|
|
3
|
+
import type { CheckoutAdjustableQuantity, CheckoutAfterCompletion, CheckoutBillingAddressCollection, CheckoutCustomField, CheckoutCustomFieldParams, CheckoutCustomerCreation, CheckoutLineItem, CheckoutLocale, CheckoutSubmitType } from './checkoutSession';
|
|
2
4
|
import type { CurrencyCode } from './money';
|
|
3
|
-
import type { NetworkType } from './network';
|
|
4
5
|
import type { MerchantDisplay } from './merchantDisplay';
|
|
6
|
+
import type { NetworkType } from './network';
|
|
5
7
|
import type { PaymentIntentRail } from './paymentIntent';
|
|
6
|
-
|
|
8
|
+
export declare const PAYMENT_LINK_LIMITS: Readonly<{
|
|
9
|
+
lineItemsMax: 20;
|
|
10
|
+
customMessageMax: 500;
|
|
11
|
+
}>;
|
|
7
12
|
export interface PaymentLink {
|
|
8
13
|
id: string;
|
|
9
14
|
object: 'payment_link';
|
|
10
|
-
/**
|
|
11
|
-
* Which of the provider's two worlds this object belongs to (ADR 0017):
|
|
12
|
-
* `true` for a `production` merchant, `false` for every other environment.
|
|
13
|
-
*/
|
|
14
15
|
livemode: boolean;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Amount in the currency's smallest unit, as a canonical integer string.
|
|
18
|
-
* Never a float, and never interpretable without `currency`.
|
|
19
|
-
*/
|
|
20
|
-
amount: string;
|
|
16
|
+
active: boolean;
|
|
21
17
|
currency: CurrencyCode;
|
|
22
18
|
rail: PaymentIntentRail;
|
|
23
|
-
/** FairCoin rail only; `null` on a card link. */
|
|
24
19
|
network: NetworkType | null;
|
|
25
|
-
|
|
20
|
+
/** The link's prices (`GET /v1/payment_links/:id/line_items` lists them in full). */
|
|
21
|
+
line_items: CheckoutLineItem[];
|
|
22
|
+
allow_promotion_codes: boolean;
|
|
23
|
+
billing_address_collection: CheckoutBillingAddressCollection;
|
|
24
|
+
shipping_address_collection: {
|
|
25
|
+
allowed_countries: string[];
|
|
26
|
+
} | null;
|
|
27
|
+
phone_number_collection: {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
};
|
|
30
|
+
tax_id_collection: {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
};
|
|
33
|
+
custom_fields: CheckoutCustomField[];
|
|
34
|
+
consent_collection: {
|
|
35
|
+
terms_of_service: 'none' | 'required';
|
|
36
|
+
} | null;
|
|
37
|
+
automatic_tax: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
};
|
|
40
|
+
customer_creation: CheckoutCustomerCreation;
|
|
41
|
+
after_completion: CheckoutAfterCompletion;
|
|
42
|
+
restrictions: {
|
|
43
|
+
completed_sessions: {
|
|
44
|
+
limit: number;
|
|
45
|
+
count: number;
|
|
46
|
+
};
|
|
47
|
+
} | null;
|
|
48
|
+
submit_type: CheckoutSubmitType;
|
|
49
|
+
locale: CheckoutLocale | null;
|
|
50
|
+
/** Present on an organization contribution link (FairCoin). */
|
|
51
|
+
contribution?: ContributionDetails;
|
|
26
52
|
metadata: Record<string, string>;
|
|
27
|
-
/**
|
|
28
|
-
success_url?: string;
|
|
29
|
-
/** Canonical `checkout.peable.to/l/<id>` URL. */
|
|
53
|
+
/** `checkout.peable.to/l/<id>` — share it, or render it as a QR code. */
|
|
30
54
|
url: string;
|
|
31
55
|
created: number;
|
|
32
56
|
updated_at: number;
|
|
33
57
|
}
|
|
34
|
-
/** What an
|
|
58
|
+
/** What an anonymous visitor may see before checkout starts — no metadata, no counts. */
|
|
35
59
|
export interface PublicPaymentLink {
|
|
36
60
|
id: string;
|
|
37
61
|
object: 'payment_link';
|
|
38
|
-
/**
|
|
39
|
-
* Which of the provider's two worlds this object belongs to (ADR 0017):
|
|
40
|
-
* `true` for a `production` merchant, `false` for every other environment.
|
|
41
|
-
*/
|
|
42
62
|
livemode: boolean;
|
|
43
|
-
|
|
44
|
-
amount: string;
|
|
63
|
+
active: boolean;
|
|
45
64
|
currency: CurrencyCode;
|
|
46
65
|
rail: PaymentIntentRail;
|
|
47
66
|
network: NetworkType | null;
|
|
48
|
-
|
|
67
|
+
line_items: CheckoutLineItem[];
|
|
68
|
+
contribution?: ContributionDetails;
|
|
69
|
+
/** A fixed contribution's amount; `null` when the payer chooses (or for a price link). */
|
|
70
|
+
contribution_amount: string | null;
|
|
49
71
|
merchant: MerchantDisplay;
|
|
72
|
+
branding: CheckoutBranding;
|
|
73
|
+
locale: CheckoutLocale | null;
|
|
74
|
+
}
|
|
75
|
+
export interface PaymentLinkLineItemParams {
|
|
76
|
+
price: string;
|
|
77
|
+
quantity: number;
|
|
78
|
+
adjustable_quantity?: {
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
minimum?: number;
|
|
81
|
+
maximum?: number;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export interface PaymentLinkAfterCompletionParams {
|
|
85
|
+
type: 'redirect' | 'hosted_confirmation';
|
|
86
|
+
/** `type: redirect` — may carry `{CHECKOUT_SESSION_ID}`. */
|
|
87
|
+
redirect?: {
|
|
88
|
+
url: string;
|
|
89
|
+
};
|
|
90
|
+
hosted_confirmation?: {
|
|
91
|
+
custom_message?: string;
|
|
92
|
+
};
|
|
50
93
|
}
|
|
51
94
|
export interface CreatePaymentLinkParams {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
95
|
+
/** 1–20 prices of ONE currency, one-time prices only. */
|
|
96
|
+
line_items: PaymentLinkLineItemParams[];
|
|
97
|
+
allow_promotion_codes?: boolean;
|
|
98
|
+
billing_address_collection?: CheckoutBillingAddressCollection;
|
|
99
|
+
shipping_address_collection?: {
|
|
100
|
+
allowed_countries: string[];
|
|
101
|
+
};
|
|
102
|
+
phone_number_collection?: {
|
|
103
|
+
enabled: boolean;
|
|
104
|
+
};
|
|
105
|
+
tax_id_collection?: {
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
};
|
|
108
|
+
custom_fields?: CheckoutCustomFieldParams[];
|
|
109
|
+
consent_collection?: {
|
|
110
|
+
terms_of_service?: 'none' | 'required';
|
|
111
|
+
};
|
|
112
|
+
automatic_tax?: {
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
};
|
|
115
|
+
customer_creation?: CheckoutCustomerCreation;
|
|
116
|
+
after_completion?: PaymentLinkAfterCompletionParams;
|
|
117
|
+
restrictions?: {
|
|
118
|
+
completed_sessions: {
|
|
119
|
+
limit: number;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
submit_type?: CheckoutSubmitType;
|
|
123
|
+
locale?: CheckoutLocale | 'auto';
|
|
59
124
|
metadata?: Record<string, string>;
|
|
60
|
-
success_url?: string;
|
|
61
125
|
}
|
|
62
126
|
/**
|
|
63
|
-
* `POST /v1/payment_links/:id`.
|
|
64
|
-
*
|
|
127
|
+
* `POST /v1/payment_links/:id`. The line items are fixed once shared (a payer
|
|
128
|
+
* may hold a session priced from them); everything else may change.
|
|
65
129
|
*/
|
|
66
130
|
export interface UpdatePaymentLinkParams {
|
|
67
131
|
active?: boolean;
|
|
132
|
+
allow_promotion_codes?: boolean;
|
|
133
|
+
billing_address_collection?: CheckoutBillingAddressCollection;
|
|
134
|
+
shipping_address_collection?: {
|
|
135
|
+
allowed_countries: string[];
|
|
136
|
+
} | '';
|
|
137
|
+
phone_number_collection?: {
|
|
138
|
+
enabled: boolean;
|
|
139
|
+
};
|
|
140
|
+
tax_id_collection?: {
|
|
141
|
+
enabled: boolean;
|
|
142
|
+
};
|
|
143
|
+
custom_fields?: CheckoutCustomFieldParams[] | '';
|
|
144
|
+
consent_collection?: {
|
|
145
|
+
terms_of_service?: 'none' | 'required';
|
|
146
|
+
};
|
|
147
|
+
automatic_tax?: {
|
|
148
|
+
enabled: boolean;
|
|
149
|
+
};
|
|
150
|
+
customer_creation?: CheckoutCustomerCreation;
|
|
151
|
+
after_completion?: PaymentLinkAfterCompletionParams;
|
|
152
|
+
restrictions?: {
|
|
153
|
+
completed_sessions: {
|
|
154
|
+
limit: number;
|
|
155
|
+
};
|
|
156
|
+
} | '';
|
|
157
|
+
submit_type?: CheckoutSubmitType;
|
|
158
|
+
locale?: CheckoutLocale | 'auto';
|
|
68
159
|
/** A patch: named keys are set, `""` removes a key, others are kept. */
|
|
69
160
|
metadata?: Record<string, string>;
|
|
70
|
-
/** `null` removes it. */
|
|
71
|
-
success_url?: string | null;
|
|
72
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* `POST /v1/payment_links/:id/checkout_sessions` — a payer starting checkout
|
|
164
|
+
* (anonymous, rate-limited). A contribution link the payer prices takes
|
|
165
|
+
* `amount`; nothing else is the payer's to say.
|
|
166
|
+
*/
|
|
167
|
+
export interface CreatePaymentLinkSessionParams {
|
|
168
|
+
amount?: string;
|
|
169
|
+
}
|
|
170
|
+
/** Its answer: where to go — the hosted session and the secret that opens it. */
|
|
171
|
+
export interface PaymentLinkSessionStart {
|
|
172
|
+
object: 'checkout_session_start';
|
|
173
|
+
id: string;
|
|
174
|
+
client_secret: string;
|
|
175
|
+
url: string;
|
|
176
|
+
}
|
|
177
|
+
export type { CheckoutAdjustableQuantity };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { CurrencyCode } from './money';
|
|
2
|
+
import type { FileObject } from './file';
|
|
3
|
+
/**
|
|
4
|
+
* Every report Peable produces, by Stripe's versioned id: the trailing `.1` is
|
|
5
|
+
* the column layout's version, so a layout can change under a new id without
|
|
6
|
+
* changing a report a merchant already parses.
|
|
7
|
+
*/
|
|
8
|
+
export declare const REPORT_TYPE_IDS: readonly ["payments.itemized.1", "balance.summary.1", "payouts.itemized.1"];
|
|
9
|
+
export type ReportTypeId = (typeof REPORT_TYPE_IDS)[number];
|
|
10
|
+
/**
|
|
11
|
+
* The layout of each report: its name, every column it can carry and the ones
|
|
12
|
+
* it carries when `parameters.columns` is absent. Fixed per version.
|
|
13
|
+
*
|
|
14
|
+
* - `payments.itemized.1` — one row per payment intent CREATED in the
|
|
15
|
+
* interval. Amounts are base-unit strings, as on the API.
|
|
16
|
+
* - `balance.summary.1` — per currency, the balance at `interval_start`, the
|
|
17
|
+
* activity and payouts inside the interval, and the balance at
|
|
18
|
+
* `interval_end`, from the ledger (ADR 0015). A figure built on a transaction
|
|
19
|
+
* whose fee the provider has not reported is empty, never `0`.
|
|
20
|
+
* - `payouts.itemized.1` — one row per payout created in the interval.
|
|
21
|
+
*/
|
|
22
|
+
export declare const REPORT_TYPE_LAYOUTS: Readonly<Record<ReportTypeId, {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly columns: readonly string[];
|
|
25
|
+
readonly default_columns: readonly string[];
|
|
26
|
+
/** Whether the report reads the ledger, and so needs the merchant's account. */
|
|
27
|
+
readonly ledger: boolean;
|
|
28
|
+
}>>;
|
|
29
|
+
/** `reporting.report_type` — what can be run, and over which interval data exists. */
|
|
30
|
+
export interface ReportType {
|
|
31
|
+
/** `payments.itemized.1`, … */
|
|
32
|
+
id: ReportTypeId;
|
|
33
|
+
object: 'reporting.report_type';
|
|
34
|
+
livemode: boolean;
|
|
35
|
+
name: string;
|
|
36
|
+
/** The column layout's version — the trailing number of the id. */
|
|
37
|
+
version: number;
|
|
38
|
+
/** Every column `parameters.columns` may name, in the order they are written. */
|
|
39
|
+
columns: string[];
|
|
40
|
+
default_columns: string[];
|
|
41
|
+
/** The earliest `interval_start` with data (Unix seconds). */
|
|
42
|
+
data_available_start: number;
|
|
43
|
+
/** The latest `interval_end` a run may ask for: now — the data is live. */
|
|
44
|
+
data_available_end: number;
|
|
45
|
+
/** When the layout last changed. */
|
|
46
|
+
updated: number;
|
|
47
|
+
}
|
|
48
|
+
export declare const REPORT_RUN_STATUSES: readonly ["pending", "succeeded", "failed"];
|
|
49
|
+
export type ReportRunStatus = (typeof REPORT_RUN_STATUSES)[number];
|
|
50
|
+
/** What a run was asked to cover. */
|
|
51
|
+
export interface ReportRunParameters {
|
|
52
|
+
/** Inclusive, Unix seconds. */
|
|
53
|
+
interval_start: number;
|
|
54
|
+
/** Exclusive, Unix seconds. */
|
|
55
|
+
interval_end: number;
|
|
56
|
+
/** The columns, in the layout's order; the report type's `default_columns` when absent. */
|
|
57
|
+
columns?: string[];
|
|
58
|
+
/** Only this currency. */
|
|
59
|
+
currency?: CurrencyCode;
|
|
60
|
+
}
|
|
61
|
+
/** `reporting.report_run` (`frr_…`). */
|
|
62
|
+
export interface ReportRun {
|
|
63
|
+
id: string;
|
|
64
|
+
object: 'reporting.report_run';
|
|
65
|
+
livemode: boolean;
|
|
66
|
+
created: number;
|
|
67
|
+
report_type: ReportTypeId;
|
|
68
|
+
parameters: ReportRunParameters;
|
|
69
|
+
status: ReportRunStatus;
|
|
70
|
+
/** Why a `failed` run failed; `null` otherwise. */
|
|
71
|
+
error: string | null;
|
|
72
|
+
/** The CSV once `succeeded` — a `file_…` of purpose `finance_report_run`. */
|
|
73
|
+
result: FileObject | null;
|
|
74
|
+
succeeded_at: number | null;
|
|
75
|
+
}
|
|
76
|
+
/** `POST /v1/reporting/report_runs`. */
|
|
77
|
+
export interface CreateReportRunParams {
|
|
78
|
+
report_type: ReportTypeId;
|
|
79
|
+
parameters: ReportRunParameters;
|
|
80
|
+
}
|
|
81
|
+
/** `GET /v1/reporting/report_runs`. */
|
|
82
|
+
export interface ListReportRunsParams {
|
|
83
|
+
report_type?: ReportTypeId;
|
|
84
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One page of a search.
|
|
3
|
+
*
|
|
4
|
+
* Unlike a {@link List} it pages FORWARD only, by an opaque `next_page` token
|
|
5
|
+
* passed back as `page`: a search is a filter over the newest-first walk of the
|
|
6
|
+
* resource, and the token remembers both where the walk stopped and which
|
|
7
|
+
* query it belongs to (a token used with another query is refused).
|
|
8
|
+
*/
|
|
9
|
+
export interface SearchResult<T> {
|
|
10
|
+
object: 'search_result';
|
|
11
|
+
data: T[];
|
|
12
|
+
has_more: boolean;
|
|
13
|
+
/** Pass as `page` for the next page; `null` on the last one. */
|
|
14
|
+
next_page: string | null;
|
|
15
|
+
/** The path that was searched (`/v1/customers/search`). */
|
|
16
|
+
url: string;
|
|
17
|
+
/** Present only when asked for with `expand: ['total_count']`. */
|
|
18
|
+
total_count?: number;
|
|
19
|
+
}
|
|
20
|
+
/** The parameters every search accepts. */
|
|
21
|
+
export interface SearchParams {
|
|
22
|
+
/**
|
|
23
|
+
* The query, in Stripe's search query language:
|
|
24
|
+
* `email:"jenny@example.com"`, `amount>1000 AND currency:"EUR"`,
|
|
25
|
+
* `metadata['order_id']:'6735'`, `name~"shirt"`, `-status:"canceled"`,
|
|
26
|
+
* `customer:null`. Clauses join with spaces or `AND` (all of them must
|
|
27
|
+
* match) or with `OR` (any), never both; at most 10 clauses and 1000
|
|
28
|
+
* characters.
|
|
29
|
+
*/
|
|
30
|
+
query: string;
|
|
31
|
+
/** 1–100. Default 10. */
|
|
32
|
+
limit?: number;
|
|
33
|
+
/** The `next_page` of the previous page, with the SAME query. */
|
|
34
|
+
page?: string;
|
|
35
|
+
/**
|
|
36
|
+
* `data.`-prefixed expansions (`['data.customer']`), and `'total_count'` to
|
|
37
|
+
* count every match (one extra query).
|
|
38
|
+
*/
|
|
39
|
+
expand?: string[];
|
|
40
|
+
}
|
|
41
|
+
/** Every searchable resource, by its path segment (`/v1/<resource>/search`). */
|
|
42
|
+
export declare const SEARCHABLE_RESOURCES: readonly ["payment_intents", "charges", "customers", "products", "prices", "refunds"];
|
|
43
|
+
export type SearchableResource = (typeof SEARCHABLE_RESOURCES)[number];
|
|
44
|
+
/** Search query bounds — the gateway's, restated so a client can check before it asks. */
|
|
45
|
+
export declare const SEARCH_QUERY_MAX_LENGTH = 1000;
|
|
46
|
+
export declare const SEARCH_QUERY_MAX_CLAUSES = 10;
|
|
47
|
+
/** A `~` substring needs at least this many characters (Stripe's rule). */
|
|
48
|
+
export declare const SEARCH_SUBSTRING_MIN_LENGTH = 3;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peable.to/shared-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Shared TypeScript types for the Peable Gateway — the wire contract shared by the backend, SDK, and frontend.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|