@proxy-checkout/server-js 0.0.8-prx-124.131.1 → 0.0.8-prx-124.133.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.
@@ -4,7 +4,7 @@ export interface ProxyCheckoutApiErrorDetails {
4
4
  readonly responseBody: unknown;
5
5
  readonly statusCode: number;
6
6
  }
7
- export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "invalid_date" | "invalid_session_presentation" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
7
+ export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "commercial_mode_required" | "invalid_date" | "invalid_session_presentation" | "provider_acquisition_in_progress" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
8
8
  /**
9
9
  * Raised when the SDK receives Proxy data it cannot safely normalize, for
10
10
  * example an invalid date string, a cart snapshot that fails the merchant
@@ -4,7 +4,7 @@ export interface ProxyCheckoutApiErrorDetails {
4
4
  readonly responseBody: unknown;
5
5
  readonly statusCode: number;
6
6
  }
7
- export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "invalid_date" | "invalid_session_presentation" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
7
+ export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "commercial_mode_required" | "invalid_date" | "invalid_session_presentation" | "provider_acquisition_in_progress" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
8
8
  /**
9
9
  * Raised when the SDK receives Proxy data it cannot safely normalize, for
10
10
  * example an invalid date string, a cart snapshot that fails the merchant
@@ -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
  {
@@ -141,6 +142,9 @@ class ProxySessionsResource {
141
142
  * the session is already bound to a different one.
142
143
  */
143
144
  async recordProviderBinding(proxySessionId, input) {
145
+ if (input.psp.trim().toLowerCase() === "stripe" && input.commercialMode === undefined) {
146
+ throw new errors_js_1.ProxyCheckoutValidationError("Stripe provider bindings require commercialMode so Proxy can infer the acquisition safely.", { code: "commercial_mode_required", field: "commercialMode" });
147
+ }
144
148
  const response = await this.httpClient.request("POST", `/proxy_sessions/${encodeURIComponent(proxySessionId)}/provider_bindings`, {
145
149
  ...(input.commercialMode === undefined ? {} : { commercial_mode: input.commercialMode }),
146
150
  provider_checkout_session_id: input.providerCheckoutSessionId,
@@ -1,3 +1,3 @@
1
1
  export declare const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
2
- export declare const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.131.1";
3
- export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.8-prx-124.131.1";
2
+ export declare const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.133.1";
3
+ export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.8-prx-124.133.1";
@@ -1,3 +1,3 @@
1
1
  export declare const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
2
- export declare const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.131.1";
3
- export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.8-prx-124.131.1";
2
+ export declare const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.133.1";
3
+ export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.8-prx-124.133.1";
@@ -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.8-prx-124.131.1";
5
+ exports.proxyCheckoutServerSdkVersion = "0.0.8-prx-124.133.1";
6
6
  exports.proxyCheckoutServerSdkUserAgent = `${exports.proxyCheckoutServerSdkName}/${exports.proxyCheckoutServerSdkVersion}`;
@@ -4,7 +4,7 @@ export interface ProxyCheckoutApiErrorDetails {
4
4
  readonly responseBody: unknown;
5
5
  readonly statusCode: number;
6
6
  }
7
- export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "invalid_date" | "invalid_session_presentation" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
7
+ export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "commercial_mode_required" | "invalid_date" | "invalid_session_presentation" | "provider_acquisition_in_progress" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
8
8
  /**
9
9
  * Raised when the SDK receives Proxy data it cannot safely normalize, for
10
10
  * example an invalid date string, a cart snapshot that fails the merchant
@@ -1,5 +1,6 @@
1
1
  import { parseProxyCart } from "./cart.js";
2
2
  import { assertCartBuyerReference } from "./consistency.js";
3
+ import { ProxyCheckoutValidationError } from "./errors.js";
3
4
  import { requireInteger, requireJsonObject, requireNullableString, requireString, } from "./response-validators.js";
4
5
  export const proxyCheckoutServerEndpoints = [
5
6
  {
@@ -138,6 +139,9 @@ export class ProxySessionsResource {
138
139
  * the session is already bound to a different one.
139
140
  */
140
141
  async recordProviderBinding(proxySessionId, input) {
142
+ if (input.psp.trim().toLowerCase() === "stripe" && input.commercialMode === undefined) {
143
+ throw new ProxyCheckoutValidationError("Stripe provider bindings require commercialMode so Proxy can infer the acquisition safely.", { code: "commercial_mode_required", field: "commercialMode" });
144
+ }
141
145
  const response = await this.httpClient.request("POST", `/proxy_sessions/${encodeURIComponent(proxySessionId)}/provider_bindings`, {
142
146
  ...(input.commercialMode === undefined ? {} : { commercial_mode: input.commercialMode }),
143
147
  provider_checkout_session_id: input.providerCheckoutSessionId,
@@ -1,3 +1,3 @@
1
1
  export declare const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
2
- export declare const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.131.1";
3
- export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.8-prx-124.131.1";
2
+ export declare const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.133.1";
3
+ export declare const proxyCheckoutServerSdkUserAgent = "@proxy-checkout/server-js/0.0.8-prx-124.133.1";
@@ -1,3 +1,3 @@
1
1
  export const proxyCheckoutServerSdkName = "@proxy-checkout/server-js";
2
- export const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.131.1";
2
+ export const proxyCheckoutServerSdkVersion = "0.0.8-prx-124.133.1";
3
3
  export const proxyCheckoutServerSdkUserAgent = `${proxyCheckoutServerSdkName}/${proxyCheckoutServerSdkVersion}`;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "sideEffects": false,
8
8
  "type": "module",
9
9
  "types": "./dist/esm/index.d.ts",
10
- "version": "0.0.8-prx-124.131.1",
10
+ "version": "0.0.8-prx-124.133.1",
11
11
  "devDependencies": {
12
12
  "@types/node": "^24.12.4",
13
13
  "@vitest/coverage-v8": "4.1.7",