@proxy-checkout/server-js 0.0.8 → 0.1.0-prx-124.137.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 +35 -4
- package/dist/cjs/sessions.d.ts +35 -4
- package/dist/cjs/sessions.js +129 -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 +24 -0
- package/dist/cjs/webhook-events.d.ts +24 -0
- package/dist/cjs/webhook-events.js +54 -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 +35 -4
- package/dist/esm/sessions.js +129 -7
- package/dist/esm/version.d.ts +2 -2
- package/dist/esm/version.js +1 -1
- package/dist/esm/webhook-events.d.ts +24 -0
- package/dist/esm/webhook-events.js +52 -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,21 @@ export interface ProxySessionCartResult {
|
|
|
84
100
|
readonly cartVersion: number;
|
|
85
101
|
readonly currency: string;
|
|
86
102
|
}
|
|
87
|
-
|
|
103
|
+
interface RecordProviderBindingBaseInput extends ProxyCheckoutServerRequestOptions {
|
|
88
104
|
readonly providerCheckoutSessionId: string;
|
|
89
|
-
readonly psp: string;
|
|
90
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Input for the deprecated provider-binding compatibility adapter.
|
|
108
|
+
* Canonical Stripe literals require `commercialMode` at compile time; dynamic
|
|
109
|
+
* or untyped inputs remain protected by the matching runtime validation.
|
|
110
|
+
*/
|
|
111
|
+
export type RecordProviderBindingInput<TPsp extends string = string> = RecordProviderBindingBaseInput & {
|
|
112
|
+
readonly psp: TPsp;
|
|
113
|
+
} & (Lowercase<TPsp> extends "stripe" ? {
|
|
114
|
+
readonly commercialMode: "one_time" | "subscription";
|
|
115
|
+
} : {
|
|
116
|
+
readonly commercialMode?: "one_time" | "subscription";
|
|
117
|
+
});
|
|
91
118
|
export interface ProxySessionProviderBinding {
|
|
92
119
|
readonly providerCheckoutSessionId: string;
|
|
93
120
|
readonly proxySessionId: string;
|
|
@@ -181,8 +208,11 @@ export declare class ProxySessionsResource {
|
|
|
181
208
|
* Bind a provider (PSP) checkout object to a Proxy session so later cart sync
|
|
182
209
|
* can verify ownership. Idempotent for the same provider object; conflicts when
|
|
183
210
|
* the session is already bound to a different one.
|
|
211
|
+
*
|
|
212
|
+
* @deprecated Prefer provider acquisition attempts or a provider-specific
|
|
213
|
+
* helper such as `@proxy-checkout/stripe-server-js` `openCheckout(...)`.
|
|
184
214
|
*/
|
|
185
|
-
recordProviderBinding(proxySessionId: string, input: RecordProviderBindingInput): Promise<ProxySessionProviderBinding>;
|
|
215
|
+
recordProviderBinding<const TPsp extends string>(proxySessionId: string, input: RecordProviderBindingInput<TPsp>): Promise<ProxySessionProviderBinding>;
|
|
186
216
|
markProvisioned(proxySessionId: string, input?: MarkProxySessionProvisionedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
187
217
|
markProvisioningFailed(proxySessionId: string, input: MarkProxySessionProvisioningFailedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
188
218
|
}
|
|
@@ -191,3 +221,4 @@ export declare class ProxySessionCartResource {
|
|
|
191
221
|
constructor(httpClient: ProxyCheckoutHttpClient);
|
|
192
222
|
set(proxySessionId: string, input: SetProxySessionCartInput): Promise<ProxySessionCartResult>;
|
|
193
223
|
}
|
|
224
|
+
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,21 @@ export interface ProxySessionCartResult {
|
|
|
84
100
|
readonly cartVersion: number;
|
|
85
101
|
readonly currency: string;
|
|
86
102
|
}
|
|
87
|
-
|
|
103
|
+
interface RecordProviderBindingBaseInput extends ProxyCheckoutServerRequestOptions {
|
|
88
104
|
readonly providerCheckoutSessionId: string;
|
|
89
|
-
readonly psp: string;
|
|
90
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Input for the deprecated provider-binding compatibility adapter.
|
|
108
|
+
* Canonical Stripe literals require `commercialMode` at compile time; dynamic
|
|
109
|
+
* or untyped inputs remain protected by the matching runtime validation.
|
|
110
|
+
*/
|
|
111
|
+
export type RecordProviderBindingInput<TPsp extends string = string> = RecordProviderBindingBaseInput & {
|
|
112
|
+
readonly psp: TPsp;
|
|
113
|
+
} & (Lowercase<TPsp> extends "stripe" ? {
|
|
114
|
+
readonly commercialMode: "one_time" | "subscription";
|
|
115
|
+
} : {
|
|
116
|
+
readonly commercialMode?: "one_time" | "subscription";
|
|
117
|
+
});
|
|
91
118
|
export interface ProxySessionProviderBinding {
|
|
92
119
|
readonly providerCheckoutSessionId: string;
|
|
93
120
|
readonly proxySessionId: string;
|
|
@@ -181,8 +208,11 @@ export declare class ProxySessionsResource {
|
|
|
181
208
|
* Bind a provider (PSP) checkout object to a Proxy session so later cart sync
|
|
182
209
|
* can verify ownership. Idempotent for the same provider object; conflicts when
|
|
183
210
|
* the session is already bound to a different one.
|
|
211
|
+
*
|
|
212
|
+
* @deprecated Prefer provider acquisition attempts or a provider-specific
|
|
213
|
+
* helper such as `@proxy-checkout/stripe-server-js` `openCheckout(...)`.
|
|
184
214
|
*/
|
|
185
|
-
recordProviderBinding(proxySessionId: string, input: RecordProviderBindingInput): Promise<ProxySessionProviderBinding>;
|
|
215
|
+
recordProviderBinding<const TPsp extends string>(proxySessionId: string, input: RecordProviderBindingInput<TPsp>): Promise<ProxySessionProviderBinding>;
|
|
186
216
|
markProvisioned(proxySessionId: string, input?: MarkProxySessionProvisionedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
187
217
|
markProvisioningFailed(proxySessionId: string, input: MarkProxySessionProvisioningFailedInput): Promise<ProxySessionProvisioningAcknowledgement>;
|
|
188
218
|
}
|
|
@@ -191,3 +221,4 @@ export declare class ProxySessionCartResource {
|
|
|
191
221
|
constructor(httpClient: ProxyCheckoutHttpClient);
|
|
192
222
|
set(proxySessionId: string, input: SetProxySessionCartInput): Promise<ProxySessionCartResult>;
|
|
193
223
|
}
|
|
224
|
+
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,16 @@ 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 }),
|
|
145
153
|
provider_checkout_session_id: input.providerCheckoutSessionId,
|
|
146
154
|
psp: input.psp,
|
|
147
155
|
}, { requestId: input.requestId });
|
|
@@ -260,14 +268,24 @@ function toProxySessionHandoff(response) {
|
|
|
260
268
|
}
|
|
261
269
|
function toMerchantProxySession(response) {
|
|
262
270
|
const body = (0, response_validators_js_1.requireJsonObject)(response, "sessions.retrieve");
|
|
271
|
+
const status = (0, response_validators_js_1.requireString)(body.status, "sessions.retrieve.status");
|
|
272
|
+
const currentAcquisitionAttempt = optionalAcquisitionSummary(body.current_acquisition_attempt, "sessions.retrieve.currentAcquisitionAttempt");
|
|
273
|
+
const providerCheckoutSessionId = (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_id, "sessions.retrieve.providerCheckoutSessionId");
|
|
274
|
+
const presentationState = proxySessionPresentationState(body.presentation_state, status);
|
|
263
275
|
return {
|
|
276
|
+
actionableNextStep: proxySessionActionableNextStep(body.actionable_next_step, {
|
|
277
|
+
presentationState,
|
|
278
|
+
providerCheckoutSessionId,
|
|
279
|
+
}),
|
|
264
280
|
amountMinor: (0, response_validators_js_1.requireInteger)(body.amount_minor, "sessions.retrieve.amountMinor"),
|
|
265
281
|
beneficiaryContact: requireNullableContact(body.beneficiary_contact, "sessions.retrieve.beneficiaryContact"),
|
|
266
282
|
buyerReference: (0, response_validators_js_1.requireString)(body.buyer_reference, "sessions.retrieve.buyerReference"),
|
|
267
283
|
cartSnapshot: (0, response_validators_js_1.requireJsonObject)(body.cart_snapshot, "sessions.retrieve.cartSnapshot"),
|
|
268
284
|
cartVersion: (0, response_validators_js_1.requireInteger)(body.cart_version, "sessions.retrieve.cartVersion"),
|
|
285
|
+
completedAcquisitionAttemptId: optionalNullableString(body.completed_acquisition_attempt_id, "sessions.retrieve.completedAcquisitionAttemptId"),
|
|
269
286
|
createdAt: (0, response_validators_js_1.requireString)(body.created_at, "sessions.retrieve.createdAt"),
|
|
270
287
|
currency: (0, response_validators_js_1.requireString)(body.currency, "sessions.retrieve.currency"),
|
|
288
|
+
currentAcquisitionAttempt,
|
|
271
289
|
expiresAt: (0, response_validators_js_1.requireString)(body.expires_at, "sessions.retrieve.expiresAt"),
|
|
272
290
|
id: (0, response_validators_js_1.requireString)(body.id, "sessions.retrieve.id"),
|
|
273
291
|
idempotencyKey: (0, response_validators_js_1.requireNullableString)(body.idempotency_key, "sessions.retrieve.idempotencyKey"),
|
|
@@ -275,26 +293,33 @@ function toMerchantProxySession(response) {
|
|
|
275
293
|
metadata: (0, response_validators_js_1.requireJsonObject)(body.metadata, "sessions.retrieve.metadata"),
|
|
276
294
|
payerContact: requireNullableContact(body.payer_contact, "sessions.retrieve.payerContact"),
|
|
277
295
|
payerDestinationUrl: (0, response_validators_js_1.requireNullableString)(body.payer_destination_url, "sessions.retrieve.payerDestinationUrl"),
|
|
278
|
-
|
|
296
|
+
presentationState,
|
|
297
|
+
providerCheckoutSessionId,
|
|
279
298
|
providerCheckoutSessionPsp: (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_psp, "sessions.retrieve.providerCheckoutSessionPsp"),
|
|
280
|
-
status
|
|
299
|
+
status,
|
|
281
300
|
updatedAt: (0, response_validators_js_1.requireString)(body.updated_at, "sessions.retrieve.updatedAt"),
|
|
282
301
|
};
|
|
283
302
|
}
|
|
284
303
|
function toPayerOpenedResult(response) {
|
|
285
304
|
const body = (0, response_validators_js_1.requireJsonObject)(response, "sessions.payerOpened");
|
|
286
|
-
const status = (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
305
|
+
const status = requireProxySessionViewStatus(body.status);
|
|
306
|
+
const currentAcquisitionAttempt = optionalAcquisitionSummary(body.current_acquisition_attempt, "sessions.payerOpened.currentAcquisitionAttempt");
|
|
307
|
+
const providerCheckoutSessionId = (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_id, "sessions.payerOpened.providerCheckoutSessionId");
|
|
308
|
+
const presentationState = proxySessionPresentationState(body.presentation_state, status);
|
|
290
309
|
return {
|
|
310
|
+
actionableNextStep: proxySessionActionableNextStep(body.actionable_next_step, {
|
|
311
|
+
presentationState,
|
|
312
|
+
providerCheckoutSessionId,
|
|
313
|
+
}),
|
|
291
314
|
amountMinor: (0, response_validators_js_1.requireInteger)(body.amount_minor, "sessions.payerOpened.amountMinor"),
|
|
292
315
|
beneficiaryContact: requireNullableContact(body.beneficiary_contact, "sessions.payerOpened.beneficiaryContact"),
|
|
293
316
|
buyerReference: (0, response_validators_js_1.requireString)(body.buyer_reference, "sessions.payerOpened.buyerReference"),
|
|
294
317
|
cartSnapshot: (0, response_validators_js_1.requireJsonObject)(body.cart_snapshot, "sessions.payerOpened.cartSnapshot"),
|
|
295
318
|
cartVersion: (0, response_validators_js_1.requireInteger)(body.cart_version, "sessions.payerOpened.cartVersion"),
|
|
319
|
+
completedAcquisitionAttemptId: optionalNullableString(body.completed_acquisition_attempt_id, "sessions.payerOpened.completedAcquisitionAttemptId"),
|
|
296
320
|
createdAt: (0, response_validators_js_1.requireString)(body.created_at, "sessions.payerOpened.createdAt"),
|
|
297
321
|
currency: (0, response_validators_js_1.requireString)(body.currency, "sessions.payerOpened.currency"),
|
|
322
|
+
currentAcquisitionAttempt,
|
|
298
323
|
expiresAt: (0, response_validators_js_1.requireString)(body.expires_at, "sessions.payerOpened.expiresAt"),
|
|
299
324
|
id: (0, response_validators_js_1.requireString)(body.id, "sessions.payerOpened.id"),
|
|
300
325
|
idempotencyKey: (0, response_validators_js_1.requireNullableString)(body.idempotency_key, "sessions.payerOpened.idempotencyKey"),
|
|
@@ -302,12 +327,109 @@ function toPayerOpenedResult(response) {
|
|
|
302
327
|
metadata: (0, response_validators_js_1.requireJsonObject)(body.metadata, "sessions.payerOpened.metadata"),
|
|
303
328
|
payerContact: requireNullableContact(body.payer_contact, "sessions.payerOpened.payerContact"),
|
|
304
329
|
payerDestinationUrl: (0, response_validators_js_1.requireNullableString)(body.payer_destination_url, "sessions.payerOpened.payerDestinationUrl"),
|
|
305
|
-
|
|
330
|
+
presentationState,
|
|
331
|
+
providerCheckoutSessionId,
|
|
306
332
|
providerCheckoutSessionPsp: (0, response_validators_js_1.requireNullableString)(body.provider_checkout_session_psp, "sessions.payerOpened.providerCheckoutSessionPsp"),
|
|
307
333
|
status,
|
|
308
334
|
updatedAt: (0, response_validators_js_1.requireString)(body.updated_at, "sessions.payerOpened.updatedAt"),
|
|
309
335
|
};
|
|
310
336
|
}
|
|
337
|
+
function optionalAcquisitionSummary(value, field) {
|
|
338
|
+
if (value === null || value === undefined) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
const acquisition = (0, response_validators_js_1.requireJsonObject)(value, field);
|
|
342
|
+
return {
|
|
343
|
+
attemptNumber: (0, response_validators_js_1.requireInteger)(acquisition.attempt_number, `${field}.attemptNumber`),
|
|
344
|
+
checkoutUiMode: (0, response_validators_js_1.requireNullableString)(acquisition.checkout_ui_mode, `${field}.checkoutUiMode`),
|
|
345
|
+
id: (0, response_validators_js_1.requireString)(acquisition.id, `${field}.id`),
|
|
346
|
+
integrationPath: (0, response_validators_js_1.requireString)(acquisition.integration_path, `${field}.integrationPath`),
|
|
347
|
+
status: (0, response_validators_js_1.requireString)(acquisition.status, `${field}.status`),
|
|
348
|
+
statusReason: (0, response_validators_js_1.requireNullableString)(acquisition.status_reason, `${field}.statusReason`),
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function optionalNullableString(value, field) {
|
|
352
|
+
return value === undefined ? null : (0, response_validators_js_1.requireNullableString)(value, field);
|
|
353
|
+
}
|
|
354
|
+
function proxySessionActionableNextStep(value, fallback) {
|
|
355
|
+
if (value === undefined) {
|
|
356
|
+
switch (fallback.presentationState) {
|
|
357
|
+
case "action_required":
|
|
358
|
+
return "merchant_action_required";
|
|
359
|
+
case "already_paid":
|
|
360
|
+
return "already_paid";
|
|
361
|
+
case "checkout_available":
|
|
362
|
+
return fallback.providerCheckoutSessionId === null
|
|
363
|
+
? "prepare_provider"
|
|
364
|
+
: "continue_payment";
|
|
365
|
+
case "unavailable":
|
|
366
|
+
return "unavailable";
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const step = (0, response_validators_js_1.requireString)(value, "sessions.actionableNextStep");
|
|
370
|
+
switch (step) {
|
|
371
|
+
case "already_paid":
|
|
372
|
+
case "continue_payment":
|
|
373
|
+
case "merchant_action_required":
|
|
374
|
+
case "prepare_provider":
|
|
375
|
+
case "unavailable":
|
|
376
|
+
return step;
|
|
377
|
+
default:
|
|
378
|
+
throw new Error("Proxy API response field sessions.actionableNextStep is unsupported.");
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function proxySessionPresentationState(value, status) {
|
|
382
|
+
if (value === undefined) {
|
|
383
|
+
switch (requireProxySessionViewStatus(status)) {
|
|
384
|
+
case "payer_handoff_pending":
|
|
385
|
+
case "payer_opened":
|
|
386
|
+
case "payment_pending":
|
|
387
|
+
return "checkout_available";
|
|
388
|
+
case "paid":
|
|
389
|
+
case "provisionable":
|
|
390
|
+
case "provisioned":
|
|
391
|
+
case "provisioning_failed":
|
|
392
|
+
return "already_paid";
|
|
393
|
+
case "merchant_action_required":
|
|
394
|
+
return "action_required";
|
|
395
|
+
case "cancelled":
|
|
396
|
+
case "created":
|
|
397
|
+
case "expired":
|
|
398
|
+
case "failed":
|
|
399
|
+
return "unavailable";
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
const state = (0, response_validators_js_1.requireString)(value, "sessions.payerOpened.presentationState");
|
|
403
|
+
switch (state) {
|
|
404
|
+
case "action_required":
|
|
405
|
+
case "already_paid":
|
|
406
|
+
case "checkout_available":
|
|
407
|
+
case "unavailable":
|
|
408
|
+
return state;
|
|
409
|
+
default:
|
|
410
|
+
throw new Error("Proxy API response field sessions.payerOpened.presentationState is unsupported.");
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function requireProxySessionViewStatus(value) {
|
|
414
|
+
const status = (0, response_validators_js_1.requireString)(value, "sessions.payerOpened.status");
|
|
415
|
+
switch (status) {
|
|
416
|
+
case "cancelled":
|
|
417
|
+
case "created":
|
|
418
|
+
case "expired":
|
|
419
|
+
case "failed":
|
|
420
|
+
case "merchant_action_required":
|
|
421
|
+
case "paid":
|
|
422
|
+
case "payer_handoff_pending":
|
|
423
|
+
case "payer_opened":
|
|
424
|
+
case "payment_pending":
|
|
425
|
+
case "provisionable":
|
|
426
|
+
case "provisioned":
|
|
427
|
+
case "provisioning_failed":
|
|
428
|
+
return status;
|
|
429
|
+
default:
|
|
430
|
+
throw new Error("Proxy API response field sessions.payerOpened.status is unsupported.");
|
|
431
|
+
}
|
|
432
|
+
}
|
|
311
433
|
function requireNullableContact(value, field) {
|
|
312
434
|
if (value === null || value === undefined) {
|
|
313
435
|
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.137.1";
|
|
3
|
+
export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.1.0-prx-124.137.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.137.1";
|
|
3
|
+
export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.1.0-prx-124.137.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.137.1";
|
|
6
6
|
exports.proxyCheckoutServerSdkUserAgent = `${exports.proxyCheckoutServerSdkName}/${exports.proxyCheckoutServerSdkVersion}`;
|
|
@@ -7,18 +7,38 @@
|
|
|
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 providerAcquisitionPrepared: "provider_acquisition.prepared";
|
|
22
|
+
readonly providerAcquisitionProcessing: "provider_acquisition.processing";
|
|
23
|
+
readonly providerAcquisitionReconciliationRequired: "provider_acquisition.reconciliation_required";
|
|
24
|
+
readonly providerAcquisitionRequiresAction: "provider_acquisition.requires_action";
|
|
12
25
|
readonly sessionCancelled: "proxy_session.cancelled";
|
|
13
26
|
readonly sessionExpired: "proxy_session.expired";
|
|
14
27
|
readonly sessionFailed: "proxy_session.failed";
|
|
15
28
|
readonly sessionMerchantActionRequired: "proxy_session.merchant_action_required";
|
|
16
29
|
readonly sessionPaid: "proxy_session.paid";
|
|
17
30
|
readonly sessionProvisionable: "proxy_session.provisionable";
|
|
31
|
+
readonly shopifyFulfillmentObserved: "shopify.fulfillment_observed";
|
|
32
|
+
readonly shopifyRefundObserved: "shopify.refund_observed";
|
|
33
|
+
readonly shopifySubscriptionPaymentObserved: "shopify.subscription_payment_observed";
|
|
34
|
+
readonly shopifySubscriptionRefundObserved: "shopify.subscription_refund_observed";
|
|
18
35
|
readonly subscriptionCancelled: "subscription.cancelled";
|
|
19
36
|
readonly subscriptionCancelScheduled: "subscription.cancel_scheduled";
|
|
37
|
+
readonly subscriptionChanged: "subscription.changed";
|
|
38
|
+
readonly subscriptionConfigurationActionRequired: "subscription.configuration_action_required";
|
|
20
39
|
readonly subscriptionPaymentFailed: "subscription.payment_failed";
|
|
21
40
|
readonly subscriptionRenewed: "subscription.renewed";
|
|
41
|
+
readonly subscriptionTrialEnding: "subscription.trial_ending";
|
|
22
42
|
};
|
|
23
43
|
export type ProxyWebhookEventType = (typeof PROXY_WEBHOOK_EVENT_TYPES)[keyof typeof PROXY_WEBHOOK_EVENT_TYPES];
|
|
24
44
|
/** True for `proxy_session.*` events. */
|
|
@@ -27,3 +47,7 @@ export declare function isProxySessionEvent(eventType: string): boolean;
|
|
|
27
47
|
export declare function isProxySubscriptionEvent(eventType: string): boolean;
|
|
28
48
|
/** True for `payment_attempt.*` events. */
|
|
29
49
|
export declare function isProxyPaymentAttemptEvent(eventType: string): boolean;
|
|
50
|
+
/** True for non-granting `provider_acquisition.*` progress wakeups. */
|
|
51
|
+
export declare function isProxyProviderAcquisitionEvent(eventType: string): boolean;
|
|
52
|
+
/** True for observation-only `shopify.*` commerce events. */
|
|
53
|
+
export declare function isProxyShopifyEvent(eventType: string): boolean;
|