@proxy-checkout/server-js 0.0.8 → 0.1.0-prx-124.139.1
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/README.md +13 -1
- package/dist/cjs/client.d.cts +2 -0
- package/dist/cjs/client.d.ts +2 -0
- package/dist/cjs/client.js +4 -1
- package/dist/cjs/errors.d.cts +1 -1
- package/dist/cjs/errors.d.ts +1 -1
- package/dist/cjs/events.d.cts +10 -2
- package/dist/cjs/events.d.ts +10 -2
- package/dist/cjs/events.js +28 -1
- package/dist/cjs/index.d.cts +4 -3
- package/dist/cjs/index.d.ts +4 -3
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/provider-acquisitions.d.cts +106 -0
- package/dist/cjs/provider-acquisitions.d.ts +106 -0
- package/dist/cjs/provider-acquisitions.js +168 -0
- package/dist/cjs/sessions.d.cts +36 -4
- package/dist/cjs/sessions.d.ts +36 -4
- package/dist/cjs/sessions.js +132 -7
- package/dist/cjs/version.d.cts +2 -2
- package/dist/cjs/version.d.ts +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/webhook-events.d.cts +21 -0
- package/dist/cjs/webhook-events.d.ts +21 -0
- package/dist/cjs/webhook-events.js +48 -0
- package/dist/cjs/webhook-handler.d.cts +1 -0
- package/dist/cjs/webhook-handler.d.ts +1 -0
- package/dist/cjs/webhook-handler.js +7 -0
- package/dist/esm/client.d.ts +2 -0
- package/dist/esm/client.js +4 -1
- package/dist/esm/errors.d.ts +1 -1
- package/dist/esm/events.d.ts +10 -2
- package/dist/esm/events.js +29 -2
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/index.js +2 -1
- package/dist/esm/provider-acquisitions.d.ts +106 -0
- package/dist/esm/provider-acquisitions.js +164 -0
- package/dist/esm/sessions.d.ts +36 -4
- package/dist/esm/sessions.js +132 -7
- package/dist/esm/version.d.ts +2 -2
- package/dist/esm/version.js +1 -1
- package/dist/esm/webhook-events.d.ts +21 -0
- package/dist/esm/webhook-events.js +46 -0
- package/dist/esm/webhook-handler.d.ts +1 -0
- package/dist/esm/webhook-handler.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProxyProviderAcquisitionsResource = exports.proxyCheckoutProviderAcquisitionEndpoints = void 0;
|
|
4
|
+
const response_validators_js_1 = require("./response-validators.js");
|
|
5
|
+
const providerAcquisitionCheckoutUiModes = ["custom", "embedded", "hosted"];
|
|
6
|
+
const providerAcquisitionObservedCheckoutUiModes = [
|
|
7
|
+
...providerAcquisitionCheckoutUiModes,
|
|
8
|
+
"unknown",
|
|
9
|
+
];
|
|
10
|
+
const providerAcquisitionCommercialModes = ["one_time", "subscription"];
|
|
11
|
+
const providerAcquisitionIntegrationPaths = [
|
|
12
|
+
"checkout_session",
|
|
13
|
+
"direct_subscription",
|
|
14
|
+
"payment_intent",
|
|
15
|
+
];
|
|
16
|
+
const providerAcquisitionObjectTypes = [
|
|
17
|
+
"checkout_session",
|
|
18
|
+
"payment_intent",
|
|
19
|
+
"setup_intent",
|
|
20
|
+
"subscription",
|
|
21
|
+
];
|
|
22
|
+
const providerAcquisitionPricingModes = ["fixed", "provider_finalized"];
|
|
23
|
+
const providerAcquisitionPsps = ["stripe"];
|
|
24
|
+
exports.proxyCheckoutProviderAcquisitionEndpoints = [
|
|
25
|
+
{
|
|
26
|
+
method: "POST",
|
|
27
|
+
operation: "providerAcquisitions.reserveProviderAcquisition",
|
|
28
|
+
path: "/proxy_sessions/:proxy_session_id/acquisition_attempts",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
method: "POST",
|
|
32
|
+
operation: "providerAcquisitions.attachProviderAcquisitionObject",
|
|
33
|
+
path: "/proxy_sessions/:proxy_session_id/acquisition_attempts/:acquisition_attempt_id/provider_objects",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
method: "POST",
|
|
37
|
+
operation: "providerAcquisitions.supersedeProviderAcquisition",
|
|
38
|
+
path: "/proxy_sessions/:proxy_session_id/acquisition_attempts/:acquisition_attempt_id/supersede",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
method: "GET",
|
|
42
|
+
operation: "providerAcquisitions.listProviderAcquisitions",
|
|
43
|
+
path: "/proxy_sessions/:proxy_session_id/acquisition_attempts",
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
class ProxyProviderAcquisitionsResource {
|
|
47
|
+
httpClient;
|
|
48
|
+
constructor(httpClient) {
|
|
49
|
+
this.httpClient = httpClient;
|
|
50
|
+
}
|
|
51
|
+
async reserveProviderAcquisition(proxySessionId, input) {
|
|
52
|
+
const response = await this.httpClient.request("POST", `/proxy_sessions/${encodeURIComponent(proxySessionId)}/acquisition_attempts`, {
|
|
53
|
+
...(input.checkoutUiMode === undefined ? {} : { checkout_ui_mode: input.checkoutUiMode }),
|
|
54
|
+
commercial_mode: input.commercialMode,
|
|
55
|
+
integration_path: input.integrationPath,
|
|
56
|
+
...(input.merchandiseSubtotalMinor === undefined
|
|
57
|
+
? {}
|
|
58
|
+
: { merchandise_subtotal_minor: input.merchandiseSubtotalMinor }),
|
|
59
|
+
pricing_mode: input.pricingMode,
|
|
60
|
+
provider_options_fingerprint: input.providerOptionsFingerprint,
|
|
61
|
+
}, { requestId: input.requestId });
|
|
62
|
+
return parseReservation(response, "providerAcquisitions.reserveProviderAcquisition");
|
|
63
|
+
}
|
|
64
|
+
async attachProviderAcquisitionObject(proxySessionId, acquisitionAttemptId, input) {
|
|
65
|
+
const response = await this.httpClient.request("POST", `/proxy_sessions/${encodeURIComponent(proxySessionId)}/acquisition_attempts/${encodeURIComponent(acquisitionAttemptId)}/provider_objects`, {
|
|
66
|
+
expected_version: input.expectedVersion,
|
|
67
|
+
object_id: input.objectId,
|
|
68
|
+
object_type: input.objectType,
|
|
69
|
+
role: input.role,
|
|
70
|
+
}, { requestId: input.requestId });
|
|
71
|
+
return parseAcquisition(response, "providerAcquisitions.attachProviderAcquisitionObject");
|
|
72
|
+
}
|
|
73
|
+
async supersedeProviderAcquisition(proxySessionId, acquisitionAttemptId, input) {
|
|
74
|
+
const response = await this.httpClient.request("POST", `/proxy_sessions/${encodeURIComponent(proxySessionId)}/acquisition_attempts/${encodeURIComponent(acquisitionAttemptId)}/supersede`, {
|
|
75
|
+
expected_version: input.expectedVersion,
|
|
76
|
+
reason: input.reason,
|
|
77
|
+
replacement: {
|
|
78
|
+
...(input.replacement.checkoutUiMode === undefined
|
|
79
|
+
? {}
|
|
80
|
+
: { checkout_ui_mode: input.replacement.checkoutUiMode }),
|
|
81
|
+
integration_path: input.replacement.integrationPath,
|
|
82
|
+
provider_options_fingerprint: input.replacement.providerOptionsFingerprint,
|
|
83
|
+
},
|
|
84
|
+
}, { requestId: input.requestId });
|
|
85
|
+
return parseReservation(response, "providerAcquisitions.supersedeProviderAcquisition");
|
|
86
|
+
}
|
|
87
|
+
async listProviderAcquisitions(proxySessionId, options = {}) {
|
|
88
|
+
const response = await this.httpClient.request("GET", `/proxy_sessions/${encodeURIComponent(proxySessionId)}/acquisition_attempts`, undefined, options);
|
|
89
|
+
const body = (0, response_validators_js_1.requireJsonObject)(response, "providerAcquisitions.listProviderAcquisitions");
|
|
90
|
+
if (!Array.isArray(body.data)) {
|
|
91
|
+
throw new Error("Proxy API response field providerAcquisitions.listProviderAcquisitions.data must be an array.");
|
|
92
|
+
}
|
|
93
|
+
return body.data.map((value, index) => parseAcquisition(value, `providerAcquisitions.listProviderAcquisitions.data[${index}]`));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.ProxyProviderAcquisitionsResource = ProxyProviderAcquisitionsResource;
|
|
97
|
+
function parseReservation(value, operation) {
|
|
98
|
+
const body = (0, response_validators_js_1.requireJsonObject)(value, operation);
|
|
99
|
+
const stripe = (0, response_validators_js_1.requireJsonObject)(body.stripe, `${operation}.stripe`);
|
|
100
|
+
const idempotencyKeys = (0, response_validators_js_1.requireJsonObject)(stripe.idempotency_keys, `${operation}.stripe.idempotencyKeys`);
|
|
101
|
+
const metadata = (0, response_validators_js_1.requireJsonObject)(stripe.metadata, `${operation}.stripe.metadata`);
|
|
102
|
+
const contractVersion = (0, response_validators_js_1.requireString)(metadata.proxy_contract_version, `${operation}.stripe.metadata.proxyContractVersion`);
|
|
103
|
+
if (contractVersion !== "2") {
|
|
104
|
+
throw new Error(`Proxy API response field ${operation}.stripe.metadata.proxyContractVersion is unsupported.`);
|
|
105
|
+
}
|
|
106
|
+
const setupIntent = idempotencyKeys.setup_intent;
|
|
107
|
+
return {
|
|
108
|
+
acquisitionAttempt: parseAcquisition(body.acquisition_attempt, `${operation}.acquisitionAttempt`),
|
|
109
|
+
stripe: {
|
|
110
|
+
idempotencyKeys: {
|
|
111
|
+
root: (0, response_validators_js_1.requireString)(idempotencyKeys.root, `${operation}.stripe.idempotencyKeys.root`),
|
|
112
|
+
...(setupIntent === undefined
|
|
113
|
+
? {}
|
|
114
|
+
: {
|
|
115
|
+
setupIntent: (0, response_validators_js_1.requireString)(setupIntent, `${operation}.stripe.idempotencyKeys.setupIntent`),
|
|
116
|
+
}),
|
|
117
|
+
},
|
|
118
|
+
metadata: {
|
|
119
|
+
proxyAcquisitionAttemptId: (0, response_validators_js_1.requireString)(metadata.proxy_acquisition_attempt_id, `${operation}.stripe.metadata.proxyAcquisitionAttemptId`),
|
|
120
|
+
proxyContractVersion: contractVersion,
|
|
121
|
+
proxySessionId: (0, response_validators_js_1.requireString)(metadata.proxy_session_id, `${operation}.stripe.metadata.proxySessionId`),
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function parseAcquisition(value, operation) {
|
|
127
|
+
const body = (0, response_validators_js_1.requireJsonObject)(value, operation);
|
|
128
|
+
return {
|
|
129
|
+
attemptNumber: (0, response_validators_js_1.requireInteger)(body.attempt_number, `${operation}.attemptNumber`),
|
|
130
|
+
checkoutUiMode: requireNullableEnum(body.checkout_ui_mode, `${operation}.checkoutUiMode`, providerAcquisitionObservedCheckoutUiModes),
|
|
131
|
+
commercialMode: requireEnum(body.commercial_mode, `${operation}.commercialMode`, providerAcquisitionCommercialModes),
|
|
132
|
+
completionRecordedAt: (0, response_validators_js_1.requireNullableString)(body.completion_recorded_at, `${operation}.completionRecordedAt`),
|
|
133
|
+
createdAt: (0, response_validators_js_1.requireString)(body.created_at, `${operation}.createdAt`),
|
|
134
|
+
directFeeBasisSource: (0, response_validators_js_1.requireNullableString)(body.direct_fee_basis_source, `${operation}.directFeeBasisSource`),
|
|
135
|
+
directMerchandiseCurrency: (0, response_validators_js_1.requireNullableString)(body.direct_merchandise_currency, `${operation}.directMerchandiseCurrency`),
|
|
136
|
+
directMerchandiseSubtotalMinor: (0, response_validators_js_1.requireNullableInteger)(body.direct_merchandise_subtotal_minor, `${operation}.directMerchandiseSubtotalMinor`),
|
|
137
|
+
id: (0, response_validators_js_1.requireString)(body.id, `${operation}.id`),
|
|
138
|
+
integrationPath: requireEnum(body.integration_path, `${operation}.integrationPath`, providerAcquisitionIntegrationPaths),
|
|
139
|
+
merchantPspConfigId: (0, response_validators_js_1.requireString)(body.merchant_psp_config_id, `${operation}.merchantPspConfigId`),
|
|
140
|
+
pricingMode: requireEnum(body.pricing_mode, `${operation}.pricingMode`, providerAcquisitionPricingModes),
|
|
141
|
+
providerCreatedAt: (0, response_validators_js_1.requireNullableString)(body.provider_created_at, `${operation}.providerCreatedAt`),
|
|
142
|
+
providerCustomerId: (0, response_validators_js_1.requireNullableString)(body.provider_customer_id, `${operation}.providerCustomerId`),
|
|
143
|
+
providerRetryNotAfter: (0, response_validators_js_1.requireString)(body.provider_retry_not_after, `${operation}.providerRetryNotAfter`),
|
|
144
|
+
providerRootObjectId: (0, response_validators_js_1.requireNullableString)(body.provider_root_object_id, `${operation}.providerRootObjectId`),
|
|
145
|
+
providerRootObjectType: requireNullableEnum(body.provider_root_object_type, `${operation}.providerRootObjectType`, providerAcquisitionObjectTypes),
|
|
146
|
+
providerSetupIntentId: (0, response_validators_js_1.requireNullableString)(body.provider_setup_intent_id, `${operation}.providerSetupIntentId`),
|
|
147
|
+
proxySessionId: (0, response_validators_js_1.requireString)(body.proxy_session_id, `${operation}.proxySessionId`),
|
|
148
|
+
psp: requireEnum(body.psp, `${operation}.psp`, providerAcquisitionPsps),
|
|
149
|
+
status: (0, response_validators_js_1.requireString)(body.status, `${operation}.status`),
|
|
150
|
+
statusReason: (0, response_validators_js_1.requireNullableString)(body.status_reason, `${operation}.statusReason`),
|
|
151
|
+
supersedesAttemptId: (0, response_validators_js_1.requireNullableString)(body.supersedes_attempt_id, `${operation}.supersedesAttemptId`),
|
|
152
|
+
updatedAt: (0, response_validators_js_1.requireString)(body.updated_at, `${operation}.updatedAt`),
|
|
153
|
+
version: (0, response_validators_js_1.requireInteger)(body.version, `${operation}.version`),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function requireEnum(value, field, values) {
|
|
157
|
+
const parsed = (0, response_validators_js_1.requireString)(value, field);
|
|
158
|
+
if (!isEnumValue(parsed, values)) {
|
|
159
|
+
throw new Error(`Proxy API response field ${field} must be one of: ${values.join(", ")}.`);
|
|
160
|
+
}
|
|
161
|
+
return parsed;
|
|
162
|
+
}
|
|
163
|
+
function requireNullableEnum(value, field, values) {
|
|
164
|
+
return value === null ? null : requireEnum(value, field, values);
|
|
165
|
+
}
|
|
166
|
+
function isEnumValue(value, values) {
|
|
167
|
+
return values.some((candidate) => candidate === value);
|
|
168
|
+
}
|
package/dist/cjs/sessions.d.cts
CHANGED
|
@@ -37,6 +37,7 @@ export interface ProxySessionHandoff extends ProxySession {
|
|
|
37
37
|
readonly status: "payer_handoff_pending" | "payer_opened";
|
|
38
38
|
}
|
|
39
39
|
export interface MerchantProxySession {
|
|
40
|
+
readonly actionableNextStep: ProxySessionActionableNextStep;
|
|
40
41
|
readonly amountMinor: number;
|
|
41
42
|
readonly beneficiaryContact: {
|
|
42
43
|
readonly email: string | null;
|
|
@@ -45,8 +46,10 @@ export interface MerchantProxySession {
|
|
|
45
46
|
readonly buyerReference: string;
|
|
46
47
|
readonly cartSnapshot: JsonObject;
|
|
47
48
|
readonly cartVersion: number;
|
|
49
|
+
readonly completedAcquisitionAttemptId: string | null;
|
|
48
50
|
readonly createdAt: string;
|
|
49
51
|
readonly currency: string;
|
|
52
|
+
readonly currentAcquisitionAttempt: ProxySessionAcquisitionSummary | null;
|
|
50
53
|
readonly expiresAt: string;
|
|
51
54
|
readonly id: string;
|
|
52
55
|
readonly idempotencyKey: string | null;
|
|
@@ -57,14 +60,27 @@ export interface MerchantProxySession {
|
|
|
57
60
|
readonly phone: string | null;
|
|
58
61
|
} | null;
|
|
59
62
|
readonly payerDestinationUrl: string | null;
|
|
63
|
+
readonly presentationState: ProxySessionPresentationState;
|
|
60
64
|
readonly providerCheckoutSessionId: string | null;
|
|
61
65
|
readonly providerCheckoutSessionPsp: string | null;
|
|
62
66
|
readonly status: string;
|
|
63
67
|
readonly updatedAt: string;
|
|
64
68
|
}
|
|
69
|
+
export interface ProxySessionAcquisitionSummary {
|
|
70
|
+
readonly attemptNumber: number;
|
|
71
|
+
readonly checkoutUiMode: string | null;
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly integrationPath: string;
|
|
74
|
+
readonly status: string;
|
|
75
|
+
readonly statusReason: string | null;
|
|
76
|
+
}
|
|
77
|
+
export type ProxySessionActionableNextStep = "already_paid" | "continue_payment" | "merchant_action_required" | "prepare_provider" | "unavailable";
|
|
65
78
|
export interface PayerOpenedResult extends MerchantProxySession {
|
|
66
|
-
readonly
|
|
79
|
+
readonly presentationState: ProxySessionPresentationState;
|
|
80
|
+
readonly status: ProxySessionViewStatus;
|
|
67
81
|
}
|
|
82
|
+
export type ProxySessionPresentationState = "action_required" | "already_paid" | "checkout_available" | "unavailable";
|
|
83
|
+
export type ProxySessionViewStatus = "cancelled" | "created" | "expired" | "failed" | "merchant_action_required" | "paid" | "payer_handoff_pending" | "payer_opened" | "payment_pending" | "provisionable" | "provisioned" | "provisioning_failed";
|
|
68
84
|
/** A merchant session with its cart snapshot validated against a merchant schema. */
|
|
69
85
|
export interface TypedMerchantProxySession<TCart> extends MerchantProxySession {
|
|
70
86
|
readonly cart: TCart;
|
|
@@ -84,10 +100,22 @@ export interface ProxySessionCartResult {
|
|
|
84
100
|
readonly cartVersion: number;
|
|
85
101
|
readonly currency: string;
|
|
86
102
|
}
|
|
87
|
-
|
|
103
|
+
interface RecordProviderBindingBaseInput extends ProxyCheckoutServerRequestOptions {
|
|
104
|
+
readonly expectedCartVersion?: number;
|
|
88
105
|
readonly providerCheckoutSessionId: string;
|
|
89
|
-
readonly psp: string;
|
|
90
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Input for the deprecated provider-binding compatibility adapter.
|
|
109
|
+
* Canonical Stripe literals require `commercialMode` at compile time; dynamic
|
|
110
|
+
* or untyped inputs remain protected by the matching runtime validation.
|
|
111
|
+
*/
|
|
112
|
+
export type RecordProviderBindingInput<TPsp extends string = string> = RecordProviderBindingBaseInput & {
|
|
113
|
+
readonly psp: TPsp;
|
|
114
|
+
} & (Lowercase<TPsp> extends "stripe" ? {
|
|
115
|
+
readonly commercialMode: "one_time" | "subscription";
|
|
116
|
+
} : {
|
|
117
|
+
readonly commercialMode?: "one_time" | "subscription";
|
|
118
|
+
});
|
|
91
119
|
export interface ProxySessionProviderBinding {
|
|
92
120
|
readonly providerCheckoutSessionId: string;
|
|
93
121
|
readonly proxySessionId: string;
|
|
@@ -181,8 +209,11 @@ export declare class ProxySessionsResource {
|
|
|
181
209
|
* Bind a provider (PSP) checkout object to a Proxy session so later cart sync
|
|
182
210
|
* can verify ownership. Idempotent for the same provider object; conflicts when
|
|
183
211
|
* the session is already bound to a different one.
|
|
212
|
+
*
|
|
213
|
+
* @deprecated Prefer provider acquisition attempts or a provider-specific
|
|
214
|
+
* helper such as `@proxy-checkout/stripe-server-js` `openCheckout(...)`.
|
|
184
215
|
*/
|
|
185
|
-
recordProviderBinding(proxySessionId: string, input: RecordProviderBindingInput): Promise<ProxySessionProviderBinding>;
|
|
216
|
+
recordProviderBinding<const TPsp extends string>(proxySessionId: string, input: RecordProviderBindingInput<TPsp>): Promise<ProxySessionProviderBinding>;
|
|
186
217
|
markProvisioned(proxySessionId: string, input?: MarkProxySessionProvisionedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
187
218
|
markProvisioningFailed(proxySessionId: string, input: MarkProxySessionProvisioningFailedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
188
219
|
}
|
|
@@ -191,3 +222,4 @@ export declare class ProxySessionCartResource {
|
|
|
191
222
|
constructor(httpClient: ProxyCheckoutHttpClient);
|
|
192
223
|
set(proxySessionId: string, input: SetProxySessionCartInput): Promise<ProxySessionCartResult>;
|
|
193
224
|
}
|
|
225
|
+
export {};
|
package/dist/cjs/sessions.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface ProxySessionHandoff extends ProxySession {
|
|
|
37
37
|
readonly status: "payer_handoff_pending" | "payer_opened";
|
|
38
38
|
}
|
|
39
39
|
export interface MerchantProxySession {
|
|
40
|
+
readonly actionableNextStep: ProxySessionActionableNextStep;
|
|
40
41
|
readonly amountMinor: number;
|
|
41
42
|
readonly beneficiaryContact: {
|
|
42
43
|
readonly email: string | null;
|
|
@@ -45,8 +46,10 @@ export interface MerchantProxySession {
|
|
|
45
46
|
readonly buyerReference: string;
|
|
46
47
|
readonly cartSnapshot: JsonObject;
|
|
47
48
|
readonly cartVersion: number;
|
|
49
|
+
readonly completedAcquisitionAttemptId: string | null;
|
|
48
50
|
readonly createdAt: string;
|
|
49
51
|
readonly currency: string;
|
|
52
|
+
readonly currentAcquisitionAttempt: ProxySessionAcquisitionSummary | null;
|
|
50
53
|
readonly expiresAt: string;
|
|
51
54
|
readonly id: string;
|
|
52
55
|
readonly idempotencyKey: string | null;
|
|
@@ -57,14 +60,27 @@ export interface MerchantProxySession {
|
|
|
57
60
|
readonly phone: string | null;
|
|
58
61
|
} | null;
|
|
59
62
|
readonly payerDestinationUrl: string | null;
|
|
63
|
+
readonly presentationState: ProxySessionPresentationState;
|
|
60
64
|
readonly providerCheckoutSessionId: string | null;
|
|
61
65
|
readonly providerCheckoutSessionPsp: string | null;
|
|
62
66
|
readonly status: string;
|
|
63
67
|
readonly updatedAt: string;
|
|
64
68
|
}
|
|
69
|
+
export interface ProxySessionAcquisitionSummary {
|
|
70
|
+
readonly attemptNumber: number;
|
|
71
|
+
readonly checkoutUiMode: string | null;
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly integrationPath: string;
|
|
74
|
+
readonly status: string;
|
|
75
|
+
readonly statusReason: string | null;
|
|
76
|
+
}
|
|
77
|
+
export type ProxySessionActionableNextStep = "already_paid" | "continue_payment" | "merchant_action_required" | "prepare_provider" | "unavailable";
|
|
65
78
|
export interface PayerOpenedResult extends MerchantProxySession {
|
|
66
|
-
readonly
|
|
79
|
+
readonly presentationState: ProxySessionPresentationState;
|
|
80
|
+
readonly status: ProxySessionViewStatus;
|
|
67
81
|
}
|
|
82
|
+
export type ProxySessionPresentationState = "action_required" | "already_paid" | "checkout_available" | "unavailable";
|
|
83
|
+
export type ProxySessionViewStatus = "cancelled" | "created" | "expired" | "failed" | "merchant_action_required" | "paid" | "payer_handoff_pending" | "payer_opened" | "payment_pending" | "provisionable" | "provisioned" | "provisioning_failed";
|
|
68
84
|
/** A merchant session with its cart snapshot validated against a merchant schema. */
|
|
69
85
|
export interface TypedMerchantProxySession<TCart> extends MerchantProxySession {
|
|
70
86
|
readonly cart: TCart;
|
|
@@ -84,10 +100,22 @@ export interface ProxySessionCartResult {
|
|
|
84
100
|
readonly cartVersion: number;
|
|
85
101
|
readonly currency: string;
|
|
86
102
|
}
|
|
87
|
-
|
|
103
|
+
interface RecordProviderBindingBaseInput extends ProxyCheckoutServerRequestOptions {
|
|
104
|
+
readonly expectedCartVersion?: number;
|
|
88
105
|
readonly providerCheckoutSessionId: string;
|
|
89
|
-
readonly psp: string;
|
|
90
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Input for the deprecated provider-binding compatibility adapter.
|
|
109
|
+
* Canonical Stripe literals require `commercialMode` at compile time; dynamic
|
|
110
|
+
* or untyped inputs remain protected by the matching runtime validation.
|
|
111
|
+
*/
|
|
112
|
+
export type RecordProviderBindingInput<TPsp extends string = string> = RecordProviderBindingBaseInput & {
|
|
113
|
+
readonly psp: TPsp;
|
|
114
|
+
} & (Lowercase<TPsp> extends "stripe" ? {
|
|
115
|
+
readonly commercialMode: "one_time" | "subscription";
|
|
116
|
+
} : {
|
|
117
|
+
readonly commercialMode?: "one_time" | "subscription";
|
|
118
|
+
});
|
|
91
119
|
export interface ProxySessionProviderBinding {
|
|
92
120
|
readonly providerCheckoutSessionId: string;
|
|
93
121
|
readonly proxySessionId: string;
|
|
@@ -181,8 +209,11 @@ export declare class ProxySessionsResource {
|
|
|
181
209
|
* Bind a provider (PSP) checkout object to a Proxy session so later cart sync
|
|
182
210
|
* can verify ownership. Idempotent for the same provider object; conflicts when
|
|
183
211
|
* the session is already bound to a different one.
|
|
212
|
+
*
|
|
213
|
+
* @deprecated Prefer provider acquisition attempts or a provider-specific
|
|
214
|
+
* helper such as `@proxy-checkout/stripe-server-js` `openCheckout(...)`.
|
|
184
215
|
*/
|
|
185
|
-
recordProviderBinding(proxySessionId: string, input: RecordProviderBindingInput): Promise<ProxySessionProviderBinding>;
|
|
216
|
+
recordProviderBinding<const TPsp extends string>(proxySessionId: string, input: RecordProviderBindingInput<TPsp>): Promise<ProxySessionProviderBinding>;
|
|
186
217
|
markProvisioned(proxySessionId: string, input?: MarkProxySessionProvisionedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
187
218
|
markProvisioningFailed(proxySessionId: string, input: MarkProxySessionProvisioningFailedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
188
219
|
}
|
|
@@ -191,3 +222,4 @@ export declare class ProxySessionCartResource {
|
|
|
191
222
|
constructor(httpClient: ProxyCheckoutHttpClient);
|
|
192
223
|
set(proxySessionId: string, input: SetProxySessionCartInput): Promise<ProxySessionCartResult>;
|
|
193
224
|
}
|
|
225
|
+
export {};
|
package/dist/cjs/sessions.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProxySessionCartResource = exports.ProxySessionsResource = exports.proxyCheckoutServerEndpoints = void 0;
|
|
4
4
|
const cart_js_1 = require("./cart.js");
|
|
5
5
|
const consistency_js_1 = require("./consistency.js");
|
|
6
|
+
const errors_js_1 = require("./errors.js");
|
|
6
7
|
const response_validators_js_1 = require("./response-validators.js");
|
|
7
8
|
exports.proxyCheckoutServerEndpoints = [
|
|
8
9
|
{
|
|
@@ -139,9 +140,19 @@ class ProxySessionsResource {
|
|
|
139
140
|
* Bind a provider (PSP) checkout object to a Proxy session so later cart sync
|
|
140
141
|
* can verify ownership. Idempotent for the same provider object; conflicts when
|
|
141
142
|
* the session is already bound to a different one.
|
|
143
|
+
*
|
|
144
|
+
* @deprecated Prefer provider acquisition attempts or a provider-specific
|
|
145
|
+
* helper such as `@proxy-checkout/stripe-server-js` `openCheckout(...)`.
|
|
142
146
|
*/
|
|
143
147
|
async recordProviderBinding(proxySessionId, input) {
|
|
148
|
+
if (input.psp.trim().toLowerCase() === "stripe" && input.commercialMode === undefined) {
|
|
149
|
+
throw new errors_js_1.ProxyCheckoutValidationError("Stripe provider bindings require commercialMode so Proxy can infer the acquisition safely.", { code: "commercial_mode_required", field: "commercialMode" });
|
|
150
|
+
}
|
|
144
151
|
const response = await this.httpClient.request("POST", `/proxy_sessions/${encodeURIComponent(proxySessionId)}/provider_bindings`, {
|
|
152
|
+
...(input.commercialMode === undefined ? {} : { commercial_mode: input.commercialMode }),
|
|
153
|
+
...(input.expectedCartVersion === undefined
|
|
154
|
+
? {}
|
|
155
|
+
: { expected_cart_version: input.expectedCartVersion }),
|
|
145
156
|
provider_checkout_session_id: input.providerCheckoutSessionId,
|
|
146
157
|
psp: input.psp,
|
|
147
158
|
}, { requestId: input.requestId });
|
|
@@ -260,14 +271,24 @@ function toProxySessionHandoff(response) {
|
|
|
260
271
|
}
|
|
261
272
|
function toMerchantProxySession(response) {
|
|
262
273
|
const body = (0, response_validators_js_1.requireJsonObject)(response, "sessions.retrieve");
|
|
274
|
+
const status = (0, response_validators_js_1.requireString)(body.status, "sessions.retrieve.status");
|
|
275
|
+
const currentAcquisitionAttempt = optionalAcquisitionSummary(body.current_acquisition_attempt, "sessions.retrieve.currentAcquisitionAttempt");
|
|
276
|
+
const providerCheckoutSessionId = (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_id, "sessions.retrieve.providerCheckoutSessionId");
|
|
277
|
+
const presentationState = proxySessionPresentationState(body.presentation_state, status);
|
|
263
278
|
return {
|
|
279
|
+
actionableNextStep: proxySessionActionableNextStep(body.actionable_next_step, {
|
|
280
|
+
presentationState,
|
|
281
|
+
providerCheckoutSessionId,
|
|
282
|
+
}),
|
|
264
283
|
amountMinor: (0, response_validators_js_1.requireInteger)(body.amount_minor, "sessions.retrieve.amountMinor"),
|
|
265
284
|
beneficiaryContact: requireNullableContact(body.beneficiary_contact, "sessions.retrieve.beneficiaryContact"),
|
|
266
285
|
buyerReference: (0, response_validators_js_1.requireString)(body.buyer_reference, "sessions.retrieve.buyerReference"),
|
|
267
286
|
cartSnapshot: (0, response_validators_js_1.requireJsonObject)(body.cart_snapshot, "sessions.retrieve.cartSnapshot"),
|
|
268
287
|
cartVersion: (0, response_validators_js_1.requireInteger)(body.cart_version, "sessions.retrieve.cartVersion"),
|
|
288
|
+
completedAcquisitionAttemptId: optionalNullableString(body.completed_acquisition_attempt_id, "sessions.retrieve.completedAcquisitionAttemptId"),
|
|
269
289
|
createdAt: (0, response_validators_js_1.requireString)(body.created_at, "sessions.retrieve.createdAt"),
|
|
270
290
|
currency: (0, response_validators_js_1.requireString)(body.currency, "sessions.retrieve.currency"),
|
|
291
|
+
currentAcquisitionAttempt,
|
|
271
292
|
expiresAt: (0, response_validators_js_1.requireString)(body.expires_at, "sessions.retrieve.expiresAt"),
|
|
272
293
|
id: (0, response_validators_js_1.requireString)(body.id, "sessions.retrieve.id"),
|
|
273
294
|
idempotencyKey: (0, response_validators_js_1.requireNullableString)(body.idempotency_key, "sessions.retrieve.idempotencyKey"),
|
|
@@ -275,26 +296,33 @@ function toMerchantProxySession(response) {
|
|
|
275
296
|
metadata: (0, response_validators_js_1.requireJsonObject)(body.metadata, "sessions.retrieve.metadata"),
|
|
276
297
|
payerContact: requireNullableContact(body.payer_contact, "sessions.retrieve.payerContact"),
|
|
277
298
|
payerDestinationUrl: (0, response_validators_js_1.requireNullableString)(body.payer_destination_url, "sessions.retrieve.payerDestinationUrl"),
|
|
278
|
-
|
|
299
|
+
presentationState,
|
|
300
|
+
providerCheckoutSessionId,
|
|
279
301
|
providerCheckoutSessionPsp: (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_psp, "sessions.retrieve.providerCheckoutSessionPsp"),
|
|
280
|
-
status
|
|
302
|
+
status,
|
|
281
303
|
updatedAt: (0, response_validators_js_1.requireString)(body.updated_at, "sessions.retrieve.updatedAt"),
|
|
282
304
|
};
|
|
283
305
|
}
|
|
284
306
|
function toPayerOpenedResult(response) {
|
|
285
307
|
const body = (0, response_validators_js_1.requireJsonObject)(response, "sessions.payerOpened");
|
|
286
|
-
const status = (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
308
|
+
const status = requireProxySessionViewStatus(body.status);
|
|
309
|
+
const currentAcquisitionAttempt = optionalAcquisitionSummary(body.current_acquisition_attempt, "sessions.payerOpened.currentAcquisitionAttempt");
|
|
310
|
+
const providerCheckoutSessionId = (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_id, "sessions.payerOpened.providerCheckoutSessionId");
|
|
311
|
+
const presentationState = proxySessionPresentationState(body.presentation_state, status);
|
|
290
312
|
return {
|
|
313
|
+
actionableNextStep: proxySessionActionableNextStep(body.actionable_next_step, {
|
|
314
|
+
presentationState,
|
|
315
|
+
providerCheckoutSessionId,
|
|
316
|
+
}),
|
|
291
317
|
amountMinor: (0, response_validators_js_1.requireInteger)(body.amount_minor, "sessions.payerOpened.amountMinor"),
|
|
292
318
|
beneficiaryContact: requireNullableContact(body.beneficiary_contact, "sessions.payerOpened.beneficiaryContact"),
|
|
293
319
|
buyerReference: (0, response_validators_js_1.requireString)(body.buyer_reference, "sessions.payerOpened.buyerReference"),
|
|
294
320
|
cartSnapshot: (0, response_validators_js_1.requireJsonObject)(body.cart_snapshot, "sessions.payerOpened.cartSnapshot"),
|
|
295
321
|
cartVersion: (0, response_validators_js_1.requireInteger)(body.cart_version, "sessions.payerOpened.cartVersion"),
|
|
322
|
+
completedAcquisitionAttemptId: optionalNullableString(body.completed_acquisition_attempt_id, "sessions.payerOpened.completedAcquisitionAttemptId"),
|
|
296
323
|
createdAt: (0, response_validators_js_1.requireString)(body.created_at, "sessions.payerOpened.createdAt"),
|
|
297
324
|
currency: (0, response_validators_js_1.requireString)(body.currency, "sessions.payerOpened.currency"),
|
|
325
|
+
currentAcquisitionAttempt,
|
|
298
326
|
expiresAt: (0, response_validators_js_1.requireString)(body.expires_at, "sessions.payerOpened.expiresAt"),
|
|
299
327
|
id: (0, response_validators_js_1.requireString)(body.id, "sessions.payerOpened.id"),
|
|
300
328
|
idempotencyKey: (0, response_validators_js_1.requireNullableString)(body.idempotency_key, "sessions.payerOpened.idempotencyKey"),
|
|
@@ -302,12 +330,109 @@ function toPayerOpenedResult(response) {
|
|
|
302
330
|
metadata: (0, response_validators_js_1.requireJsonObject)(body.metadata, "sessions.payerOpened.metadata"),
|
|
303
331
|
payerContact: requireNullableContact(body.payer_contact, "sessions.payerOpened.payerContact"),
|
|
304
332
|
payerDestinationUrl: (0, response_validators_js_1.requireNullableString)(body.payer_destination_url, "sessions.payerOpened.payerDestinationUrl"),
|
|
305
|
-
|
|
333
|
+
presentationState,
|
|
334
|
+
providerCheckoutSessionId,
|
|
306
335
|
providerCheckoutSessionPsp: (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_psp, "sessions.payerOpened.providerCheckoutSessionPsp"),
|
|
307
336
|
status,
|
|
308
337
|
updatedAt: (0, response_validators_js_1.requireString)(body.updated_at, "sessions.payerOpened.updatedAt"),
|
|
309
338
|
};
|
|
310
339
|
}
|
|
340
|
+
function optionalAcquisitionSummary(value, field) {
|
|
341
|
+
if (value === null || value === undefined) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
const acquisition = (0, response_validators_js_1.requireJsonObject)(value, field);
|
|
345
|
+
return {
|
|
346
|
+
attemptNumber: (0, response_validators_js_1.requireInteger)(acquisition.attempt_number, `${field}.attemptNumber`),
|
|
347
|
+
checkoutUiMode: (0, response_validators_js_1.requireNullableString)(acquisition.checkout_ui_mode, `${field}.checkoutUiMode`),
|
|
348
|
+
id: (0, response_validators_js_1.requireString)(acquisition.id, `${field}.id`),
|
|
349
|
+
integrationPath: (0, response_validators_js_1.requireString)(acquisition.integration_path, `${field}.integrationPath`),
|
|
350
|
+
status: (0, response_validators_js_1.requireString)(acquisition.status, `${field}.status`),
|
|
351
|
+
statusReason: (0, response_validators_js_1.requireNullableString)(acquisition.status_reason, `${field}.statusReason`),
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function optionalNullableString(value, field) {
|
|
355
|
+
return value === undefined ? null : (0, response_validators_js_1.requireNullableString)(value, field);
|
|
356
|
+
}
|
|
357
|
+
function proxySessionActionableNextStep(value, fallback) {
|
|
358
|
+
if (value === undefined) {
|
|
359
|
+
switch (fallback.presentationState) {
|
|
360
|
+
case "action_required":
|
|
361
|
+
return "merchant_action_required";
|
|
362
|
+
case "already_paid":
|
|
363
|
+
return "already_paid";
|
|
364
|
+
case "checkout_available":
|
|
365
|
+
return fallback.providerCheckoutSessionId === null
|
|
366
|
+
? "prepare_provider"
|
|
367
|
+
: "continue_payment";
|
|
368
|
+
case "unavailable":
|
|
369
|
+
return "unavailable";
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const step = (0, response_validators_js_1.requireString)(value, "sessions.actionableNextStep");
|
|
373
|
+
switch (step) {
|
|
374
|
+
case "already_paid":
|
|
375
|
+
case "continue_payment":
|
|
376
|
+
case "merchant_action_required":
|
|
377
|
+
case "prepare_provider":
|
|
378
|
+
case "unavailable":
|
|
379
|
+
return step;
|
|
380
|
+
default:
|
|
381
|
+
throw new Error("Proxy API response field sessions.actionableNextStep is unsupported.");
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function proxySessionPresentationState(value, status) {
|
|
385
|
+
if (value === undefined) {
|
|
386
|
+
switch (requireProxySessionViewStatus(status)) {
|
|
387
|
+
case "payer_handoff_pending":
|
|
388
|
+
case "payer_opened":
|
|
389
|
+
case "payment_pending":
|
|
390
|
+
return "checkout_available";
|
|
391
|
+
case "paid":
|
|
392
|
+
case "provisionable":
|
|
393
|
+
case "provisioned":
|
|
394
|
+
case "provisioning_failed":
|
|
395
|
+
return "already_paid";
|
|
396
|
+
case "merchant_action_required":
|
|
397
|
+
return "action_required";
|
|
398
|
+
case "cancelled":
|
|
399
|
+
case "created":
|
|
400
|
+
case "expired":
|
|
401
|
+
case "failed":
|
|
402
|
+
return "unavailable";
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const state = (0, response_validators_js_1.requireString)(value, "sessions.payerOpened.presentationState");
|
|
406
|
+
switch (state) {
|
|
407
|
+
case "action_required":
|
|
408
|
+
case "already_paid":
|
|
409
|
+
case "checkout_available":
|
|
410
|
+
case "unavailable":
|
|
411
|
+
return state;
|
|
412
|
+
default:
|
|
413
|
+
throw new Error("Proxy API response field sessions.payerOpened.presentationState is unsupported.");
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function requireProxySessionViewStatus(value) {
|
|
417
|
+
const status = (0, response_validators_js_1.requireString)(value, "sessions.payerOpened.status");
|
|
418
|
+
switch (status) {
|
|
419
|
+
case "cancelled":
|
|
420
|
+
case "created":
|
|
421
|
+
case "expired":
|
|
422
|
+
case "failed":
|
|
423
|
+
case "merchant_action_required":
|
|
424
|
+
case "paid":
|
|
425
|
+
case "payer_handoff_pending":
|
|
426
|
+
case "payer_opened":
|
|
427
|
+
case "payment_pending":
|
|
428
|
+
case "provisionable":
|
|
429
|
+
case "provisioned":
|
|
430
|
+
case "provisioning_failed":
|
|
431
|
+
return status;
|
|
432
|
+
default:
|
|
433
|
+
throw new Error("Proxy API response field sessions.payerOpened.status is unsupported.");
|
|
434
|
+
}
|
|
435
|
+
}
|
|
311
436
|
function requireNullableContact(value, field) {
|
|
312
437
|
if (value === null || value === undefined) {
|
|
313
438
|
return null;
|
package/dist/cjs/version.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
|
|
2
|
-
export declare const proxyCheckoutServerSdkVersion = "0.0.
|
|
3
|
-
export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.
|
|
2
|
+
export declare const proxyCheckoutServerSdkVersion = "0.1.0-prx-124.139.1";
|
|
3
|
+
export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.1.0-prx-124.139.1";
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
|
|
2
|
-
export declare const proxyCheckoutServerSdkVersion = "0.0.
|
|
3
|
-
export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.
|
|
2
|
+
export declare const proxyCheckoutServerSdkVersion = "0.1.0-prx-124.139.1";
|
|
3
|
+
export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.1.0-prx-124.139.1";
|
package/dist/cjs/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.proxyCheckoutServerSdkUserAgent = exports.proxyCheckoutServerSdkVersion = exports.proxyCheckoutServerSdkName = void 0;
|
|
4
4
|
exports.proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
|
|
5
|
-
exports.proxyCheckoutServerSdkVersion = "0.0.
|
|
5
|
+
exports.proxyCheckoutServerSdkVersion = "0.1.0-prx-124.139.1";
|
|
6
6
|
exports.proxyCheckoutServerSdkUserAgent = `${exports.proxyCheckoutServerSdkName}/${exports.proxyCheckoutServerSdkVersion}`;
|
|
@@ -7,18 +7,35 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const PROXY_WEBHOOK_EVENT_TYPES: {
|
|
9
9
|
readonly paymentAttemptCancelled: "payment_attempt.cancelled";
|
|
10
|
+
readonly paymentAttemptDisputed: "payment_attempt.disputed";
|
|
11
|
+
readonly paymentAttemptDisputeLost: "payment_attempt.dispute_lost";
|
|
12
|
+
readonly paymentAttemptDisputeWon: "payment_attempt.dispute_won";
|
|
10
13
|
readonly paymentAttemptFailed: "payment_attempt.failed";
|
|
14
|
+
readonly paymentAttemptPartiallyRefunded: "payment_attempt.partially_refunded";
|
|
15
|
+
readonly paymentAttemptReconciliationRequired: "payment_attempt.reconciliation_required";
|
|
16
|
+
readonly paymentAttemptRefunded: "payment_attempt.refunded";
|
|
11
17
|
readonly paymentAttemptSucceeded: "payment_attempt.succeeded";
|
|
18
|
+
readonly providerAcquisitionCancelled: "provider_acquisition.cancelled";
|
|
19
|
+
readonly providerAcquisitionExpired: "provider_acquisition.expired";
|
|
20
|
+
readonly providerAcquisitionFailed: "provider_acquisition.failed";
|
|
21
|
+
readonly providerAcquisitionReconciliationRequired: "provider_acquisition.reconciliation_required";
|
|
12
22
|
readonly sessionCancelled: "proxy_session.cancelled";
|
|
13
23
|
readonly sessionExpired: "proxy_session.expired";
|
|
14
24
|
readonly sessionFailed: "proxy_session.failed";
|
|
15
25
|
readonly sessionMerchantActionRequired: "proxy_session.merchant_action_required";
|
|
16
26
|
readonly sessionPaid: "proxy_session.paid";
|
|
17
27
|
readonly sessionProvisionable: "proxy_session.provisionable";
|
|
28
|
+
readonly shopifyFulfillmentObserved: "shopify.fulfillment_observed";
|
|
29
|
+
readonly shopifyRefundObserved: "shopify.refund_observed";
|
|
30
|
+
readonly shopifySubscriptionPaymentObserved: "shopify.subscription_payment_observed";
|
|
31
|
+
readonly shopifySubscriptionRefundObserved: "shopify.subscription_refund_observed";
|
|
18
32
|
readonly subscriptionCancelled: "subscription.cancelled";
|
|
19
33
|
readonly subscriptionCancelScheduled: "subscription.cancel_scheduled";
|
|
34
|
+
readonly subscriptionChanged: "subscription.changed";
|
|
35
|
+
readonly subscriptionConfigurationActionRequired: "subscription.configuration_action_required";
|
|
20
36
|
readonly subscriptionPaymentFailed: "subscription.payment_failed";
|
|
21
37
|
readonly subscriptionRenewed: "subscription.renewed";
|
|
38
|
+
readonly subscriptionTrialEnding: "subscription.trial_ending";
|
|
22
39
|
};
|
|
23
40
|
export type ProxyWebhookEventType = (typeof PROXY_WEBHOOK_EVENT_TYPES)[keyof typeof PROXY_WEBHOOK_EVENT_TYPES];
|
|
24
41
|
/** True for `proxy_session.*` events. */
|
|
@@ -27,3 +44,7 @@ export declare function isProxySessionEvent(eventType: string): boolean;
|
|
|
27
44
|
export declare function isProxySubscriptionEvent(eventType: string): boolean;
|
|
28
45
|
/** True for `payment_attempt.*` events. */
|
|
29
46
|
export declare function isProxyPaymentAttemptEvent(eventType: string): boolean;
|
|
47
|
+
/** True for non-granting `provider_acquisition.*` progress wakeups. */
|
|
48
|
+
export declare function isProxyProviderAcquisitionEvent(eventType: string): boolean;
|
|
49
|
+
/** True for observation-only `shopify.*` commerce events. */
|
|
50
|
+
export declare function isProxyShopifyEvent(eventType: string): boolean;
|