@proxy-checkout/server-js 0.0.4-pr-76.27.1 → 0.0.4-pr-76.31.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.
@@ -30,6 +30,15 @@ class ProxyEventsResource {
30
30
  if ((0, webhook_events_js_1.isProxySessionEvent)(event.type)) {
31
31
  return this.resolveSessionEvent(event, options);
32
32
  }
33
+ if ((0, webhook_events_js_1.isProxyPaymentAttemptEvent)(event.type)) {
34
+ return {
35
+ event,
36
+ kind: "payment_attempt",
37
+ paymentAttemptId: readEventString(event.data.payment_attempt_id),
38
+ sessionId: readEventString(event.data.proxy_session_id),
39
+ subscriptionId: readEventString(event.data.subscription_id),
40
+ };
41
+ }
33
42
  return ignored(event, `Event type ${event.type} is not a lifecycle event.`, {
34
43
  sessionId: readEventString(event.data.proxy_session_id),
35
44
  subscriptionId: readEventString(event.data.subscription_id),
@@ -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.4-pr-76.27.1";
5
+ exports.proxyCheckoutServerSdkVersion = "0.0.4-pr-76.31.1";
6
6
  exports.proxyCheckoutServerSdkUserAgent = `${exports.proxyCheckoutServerSdkName}/${exports.proxyCheckoutServerSdkVersion}`;
@@ -146,6 +146,13 @@ function toProcessRecord(resolved) {
146
146
  sessionId: resolved.sessionId,
147
147
  subscriptionId: resolved.subscriptionId,
148
148
  };
149
+ case "payment_attempt":
150
+ return {
151
+ kind: resolved.kind,
152
+ paymentAttemptId: resolved.paymentAttemptId,
153
+ sessionId: resolved.sessionId,
154
+ subscriptionId: resolved.subscriptionId,
155
+ };
149
156
  case "terminal_session":
150
157
  return { kind: resolved.kind, sessionId: resolved.session.id, subscriptionId: null };
151
158
  case "initial_provision":
@@ -60,13 +60,19 @@ export interface ResolvedTerminalSession extends ResolvedBase {
60
60
  readonly kind: "terminal_session";
61
61
  readonly session: MerchantProxySession;
62
62
  }
63
+ export interface ResolvedPaymentAttempt extends ResolvedBase {
64
+ readonly kind: "payment_attempt";
65
+ readonly paymentAttemptId: string | null;
66
+ readonly sessionId: string | null;
67
+ readonly subscriptionId: string | null;
68
+ }
63
69
  export interface ResolvedIgnored extends ResolvedBase {
64
70
  readonly kind: "ignored";
65
71
  readonly reason: string;
66
72
  readonly sessionId: string | null;
67
73
  readonly subscriptionId: string | null;
68
74
  }
69
- export type ResolvedProxyEvent = ResolvedInitialProvision | ResolvedSubscriptionRenewed | ResolvedSubscriptionCancelScheduled | ResolvedSubscriptionCancelled | ResolvedPaymentRisk | ResolvedTerminalSession | ResolvedIgnored;
75
+ export type ResolvedProxyEvent = ResolvedInitialProvision | ResolvedSubscriptionRenewed | ResolvedSubscriptionCancelScheduled | ResolvedSubscriptionCancelled | ResolvedPaymentRisk | ResolvedTerminalSession | ResolvedPaymentAttempt | ResolvedIgnored;
70
76
  export type ResolvedProxyEventKind = ResolvedProxyEvent["kind"];
71
77
  export declare class ProxyEventsResource {
72
78
  private readonly sessions;
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { assertSubscriptionMatchesSession } from "./consistency.js";
10
10
  import { isSessionProvisionable, isSessionTerminal, isSubscriptionEnded, isSubscriptionPaymentAtRisk, subscriptionAccessEndsAt, subscriptionWillRenew, } from "./lifecycle.js";
11
- import { isProxySessionEvent, isProxySubscriptionEvent } from "./webhook-events.js";
11
+ import { isProxyPaymentAttemptEvent, isProxySessionEvent, isProxySubscriptionEvent, } from "./webhook-events.js";
12
12
  export class ProxyEventsResource {
13
13
  sessions;
14
14
  subscriptions;
@@ -27,6 +27,15 @@ export class ProxyEventsResource {
27
27
  if (isProxySessionEvent(event.type)) {
28
28
  return this.resolveSessionEvent(event, options);
29
29
  }
30
+ if (isProxyPaymentAttemptEvent(event.type)) {
31
+ return {
32
+ event,
33
+ kind: "payment_attempt",
34
+ paymentAttemptId: readEventString(event.data.payment_attempt_id),
35
+ sessionId: readEventString(event.data.proxy_session_id),
36
+ subscriptionId: readEventString(event.data.subscription_id),
37
+ };
38
+ }
30
39
  return ignored(event, `Event type ${event.type} is not a lifecycle event.`, {
31
40
  sessionId: readEventString(event.data.proxy_session_id),
32
41
  subscriptionId: readEventString(event.data.subscription_id),
@@ -2,7 +2,7 @@ export { type ProxyCartParseOptions, type ProxyCartValidator, parseProxyCart, }
2
2
  export { createProxyCheckoutServerClient, ProxyCheckoutServerClient, } from "./client.js";
3
3
  export { assertCartBuyerReference, assertSubscriptionMatchesSession, } from "./consistency.js";
4
4
  export { ProxyCheckoutApiError, type ProxyCheckoutApiErrorDetails, type ProxyCheckoutValidationCode, ProxyCheckoutValidationError, } from "./errors.js";
5
- export { ProxyEventsResource, type ResolvedIgnored, type ResolvedInitialProvision, type ResolvedPaymentRisk, type ResolvedProxyEvent, type ResolvedProxyEventKind, type ResolvedSubscriptionCancelled, type ResolvedSubscriptionCancelScheduled, type ResolvedSubscriptionRenewed, type ResolvedTerminalSession, type ResolveProxyEventOptions, } from "./events.js";
5
+ export { ProxyEventsResource, type ResolvedIgnored, type ResolvedInitialProvision, type ResolvedPaymentAttempt, type ResolvedPaymentRisk, type ResolvedProxyEvent, type ResolvedProxyEventKind, type ResolvedSubscriptionCancelled, type ResolvedSubscriptionCancelScheduled, type ResolvedSubscriptionRenewed, type ResolvedTerminalSession, type ResolveProxyEventOptions, } from "./events.js";
6
6
  export { AT_RISK_SUBSCRIPTION_STATUSES, ENDED_SUBSCRIPTION_STATUSES, isSessionProvisionable, isSessionTerminal, isSubscriptionEnded, isSubscriptionPaymentAtRisk, PROVISIONABLE_SESSION_STATUSES, parseOptionalProxyDate, requireProxyDate, subscriptionAccessEndsAt, subscriptionWillRenew, TERMINAL_SESSION_STATUSES, } from "./lifecycle.js";
7
7
  export { type CreateProxySessionHandoffInput, type CreateProxySessionInput, type CreateProxySessionOptions, type MerchantProxySession, type PayerHandoffResult, type PayerOpenedResult, type ProxySession, ProxySessionCartResource, type ProxySessionCartResult, type ProxySessionHandoff, type ProxySessionProviderBinding, ProxySessionsResource, proxyCheckoutServerEndpoints, type RecordProviderBindingInput, type SetProxySessionCartInput, type TypedMerchantProxySession, } from "./sessions.js";
8
8
  export { type MerchantProxySubscription, ProxySubscriptionsResource, type ProxySubscriptionWithSession, type ProxySubscriptionWithUntypedSession, proxyCheckoutSubscriptionEndpoints, } from "./subscriptions.js";
@@ -1,3 +1,3 @@
1
1
  export declare const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
2
- export declare const proxyCheckoutServerSdkVersion = "0.0.4-pr-76.27.1";
3
- export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.4-pr-76.27.1";
2
+ export declare const proxyCheckoutServerSdkVersion = "0.0.4-pr-76.31.1";
3
+ export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.4-pr-76.31.1";
@@ -1,3 +1,3 @@
1
1
  export const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
2
- export const proxyCheckoutServerSdkVersion = "0.0.4-pr-76.27.1";
2
+ export const proxyCheckoutServerSdkVersion = "0.0.4-pr-76.31.1";
3
3
  export const proxyCheckoutServerSdkUserAgent = `${proxyCheckoutServerSdkName}/${proxyCheckoutServerSdkVersion}`;
@@ -16,6 +16,7 @@ export type ProxyWebhookOutcome = "duplicate" | "ignored" | "processed" | "proce
16
16
  /** Compact, lifecycle-free audit record handed to a {@link ProxyWebhookStore}. */
17
17
  export interface ProxyWebhookProcessRecord {
18
18
  readonly kind: ResolvedProxyEventKind;
19
+ readonly paymentAttemptId?: string | null;
19
20
  readonly sessionId: string | null;
20
21
  readonly subscriptionId: string | null;
21
22
  }
@@ -142,6 +142,13 @@ function toProcessRecord(resolved) {
142
142
  sessionId: resolved.sessionId,
143
143
  subscriptionId: resolved.subscriptionId,
144
144
  };
145
+ case "payment_attempt":
146
+ return {
147
+ kind: resolved.kind,
148
+ paymentAttemptId: resolved.paymentAttemptId,
149
+ sessionId: resolved.sessionId,
150
+ subscriptionId: resolved.subscriptionId,
151
+ };
145
152
  case "terminal_session":
146
153
  return { kind: resolved.kind, sessionId: resolved.session.id, subscriptionId: null };
147
154
  case "initial_provision":
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "description": "Server-side JavaScript SDK for Proxy merchant API calls.",
3
3
  "license": "MIT",
4
- "main": "./dist/cjs/index.js",
5
4
  "module": "./dist/esm/index.js",
6
5
  "name": "@proxy-checkout/server-js",
7
6
  "private": false,
8
7
  "sideEffects": false,
9
8
  "type": "module",
10
9
  "types": "./dist/esm/index.d.ts",
11
- "version": "0.0.4-pr-76.27.1",
10
+ "version": "0.0.4-pr-76.31.1",
12
11
  "devDependencies": {
13
12
  "@types/node": "^24.12.4",
14
13
  "@vitest/coverage-v8": "4.1.7",
@@ -51,5 +50,6 @@
51
50
  "test:integration": "vitest run --project integration",
52
51
  "test:unit": "vitest run --project unit",
53
52
  "typecheck": "tsc --noEmit -p tsconfig.json"
54
- }
53
+ },
54
+ "main": "./dist/cjs/index.js"
55
55
  }