@astrasyncai/verification-gateway 5.4.2 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -21
- package/dist/adapters/express.d.mts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +12 -3
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +12 -3
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/mcp.js +12 -3
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +12 -3
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +1 -1
- package/dist/adapters/nextjs.d.ts +1 -1
- package/dist/adapters/nextjs.js +12 -3
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +12 -3
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +41 -1
- package/dist/adapters/sdk.d.ts +41 -1
- package/dist/adapters/sdk.js +54 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +54 -3
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +12 -3
- package/dist/bin/astrasync-codex-hook.js +12 -3
- package/dist/bin/astrasync-guard.js +12 -3
- package/dist/bin/astrasync.js +13 -3
- package/dist/browser/background.js +12 -3
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +12 -3
- package/dist/browser/background.mjs.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/codex/index.js +12 -3
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +12 -3
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +12 -3
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +12 -3
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +1 -1
- package/dist/edge-config.d.ts +1 -1
- package/dist/edge-config.js +1 -1
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +1 -1
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +1 -1
- package/dist/edge-core/index.d.ts +1 -1
- package/dist/edge-core/index.js +12 -3
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +12 -3
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +12 -3
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +12 -3
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +1 -1
- package/dist/git-trigger/git-hooks.d.ts +1 -1
- package/dist/index.d.mts +121 -4
- package/dist/index.d.ts +121 -4
- package/dist/index.js +54 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -3
- package/dist/index.mjs.map +1 -1
- package/dist/registration/index.js +1 -1
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +1 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +1 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-Bd2O3eX1.d.mts → types-BCmHFdkJ.d.mts} +78 -1
- package/dist/{types-BU04qAAR.d.mts → types-BK_pRNSs.d.mts} +78 -1
- package/dist/{types-BU04qAAR.d.ts → types-BK_pRNSs.d.ts} +78 -1
- package/dist/{types-DMChboN_.d.ts → types-CwY5IY-0.d.ts} +78 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +12 -3
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +12 -3
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
package/dist/adapters/sdk.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TrustLevel, S as SDKOptions, d as VerificationResult, c as VerificationRequest } from '../types-
|
|
1
|
+
import { T as TrustLevel, S as SDKOptions, d as VerificationResult, c as VerificationRequest } from '../types-BK_pRNSs.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* AstraSync Universal Verification Gateway — Trust Level helpers.
|
|
@@ -86,6 +86,21 @@ declare class VerificationGatewayClient {
|
|
|
86
86
|
* settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
|
|
87
87
|
* identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
|
|
88
88
|
* party path `settlementOutcome` is simply absent — no money moves.
|
|
89
|
+
*
|
|
90
|
+
* 5.5.0 self-settling merchants (settlement_mode='self_settle'): the result
|
|
91
|
+
* carries `.settlementToken` instead of a completed charge. Charge on your
|
|
92
|
+
* own integration with Stripe idempotency key `voucher:<token.jti>` and
|
|
93
|
+
* `metadata: { jti: token.jti, sessionId: token.sessionId }`, then call
|
|
94
|
+
* `reportSettlement()` with the outcome. Treat any `settlementOutcome.status`
|
|
95
|
+
* you don't recognize (e.g. `pending_merchant`) as PENDING, never failed.
|
|
96
|
+
*
|
|
97
|
+
* 5.6.0 fulfilment contact: first-party confirm results carry
|
|
98
|
+
* `.fulfilment { email, emailSource }` — the buyer's receipt/delivery
|
|
99
|
+
* email. You always get one: the platform defaults to the buyer's account
|
|
100
|
+
* email when no `buyerEmail` was passed. Store it with the pending order;
|
|
101
|
+
* fulfil against it only once the order is settled / pending_merchant. An
|
|
102
|
+
* explicit `buyerEmail` (here or on the bridge handoff body) wins over the
|
|
103
|
+
* account default.
|
|
89
104
|
*/
|
|
90
105
|
confirmCheckout(options: {
|
|
91
106
|
astraId?: string;
|
|
@@ -97,9 +112,34 @@ declare class VerificationGatewayClient {
|
|
|
97
112
|
currency?: string;
|
|
98
113
|
checkoutSessionId?: string;
|
|
99
114
|
checkoutItems?: VerificationRequest['checkoutItems'];
|
|
115
|
+
/** 5.6.0: alternate receipt/delivery email (transit-only) — omit to let
|
|
116
|
+
* the platform default `fulfilment.email` to the buyer's account email. */
|
|
117
|
+
buyerEmail?: string;
|
|
100
118
|
counterpartyUrl?: string;
|
|
101
119
|
counterpartyType?: string;
|
|
102
120
|
}): Promise<VerificationResult>;
|
|
121
|
+
/**
|
|
122
|
+
* 5.5.0 (astra-pay): report a self-settled charge outcome back to the
|
|
123
|
+
* platform — the other half of the `settlementToken` contract. Call after
|
|
124
|
+
* your PaymentIntent reaches a terminal state so the buyer's dashboard,
|
|
125
|
+
* /orders and the agent's poll surface reconcile. Authenticated with this
|
|
126
|
+
* client's api key (must be the merchant's own). Amounts must match the
|
|
127
|
+
* order EXACTLY (integer minor units) or the report is rejected whole
|
|
128
|
+
* (409 amount_mismatch). Replays of the same terminal state are safe.
|
|
129
|
+
*/
|
|
130
|
+
reportSettlement(options: {
|
|
131
|
+
sessionId: string;
|
|
132
|
+
status: 'settled' | 'declined' | 'failed';
|
|
133
|
+
amountMinor: number;
|
|
134
|
+
currency: string;
|
|
135
|
+
/** Stripe PaymentIntent id — REQUIRED when status is 'settled'. */
|
|
136
|
+
processorRef?: string;
|
|
137
|
+
failureCode?: string;
|
|
138
|
+
}): Promise<{
|
|
139
|
+
orderId: string;
|
|
140
|
+
status: string;
|
|
141
|
+
alreadySettled?: boolean;
|
|
142
|
+
}>;
|
|
103
143
|
/**
|
|
104
144
|
* Quick verification — checks credentials and policy in one call.
|
|
105
145
|
*
|
package/dist/adapters/sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TrustLevel, S as SDKOptions, d as VerificationResult, c as VerificationRequest } from '../types-
|
|
1
|
+
import { T as TrustLevel, S as SDKOptions, d as VerificationResult, c as VerificationRequest } from '../types-BK_pRNSs.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* AstraSync Universal Verification Gateway — Trust Level helpers.
|
|
@@ -86,6 +86,21 @@ declare class VerificationGatewayClient {
|
|
|
86
86
|
* settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
|
|
87
87
|
* identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
|
|
88
88
|
* party path `settlementOutcome` is simply absent — no money moves.
|
|
89
|
+
*
|
|
90
|
+
* 5.5.0 self-settling merchants (settlement_mode='self_settle'): the result
|
|
91
|
+
* carries `.settlementToken` instead of a completed charge. Charge on your
|
|
92
|
+
* own integration with Stripe idempotency key `voucher:<token.jti>` and
|
|
93
|
+
* `metadata: { jti: token.jti, sessionId: token.sessionId }`, then call
|
|
94
|
+
* `reportSettlement()` with the outcome. Treat any `settlementOutcome.status`
|
|
95
|
+
* you don't recognize (e.g. `pending_merchant`) as PENDING, never failed.
|
|
96
|
+
*
|
|
97
|
+
* 5.6.0 fulfilment contact: first-party confirm results carry
|
|
98
|
+
* `.fulfilment { email, emailSource }` — the buyer's receipt/delivery
|
|
99
|
+
* email. You always get one: the platform defaults to the buyer's account
|
|
100
|
+
* email when no `buyerEmail` was passed. Store it with the pending order;
|
|
101
|
+
* fulfil against it only once the order is settled / pending_merchant. An
|
|
102
|
+
* explicit `buyerEmail` (here or on the bridge handoff body) wins over the
|
|
103
|
+
* account default.
|
|
89
104
|
*/
|
|
90
105
|
confirmCheckout(options: {
|
|
91
106
|
astraId?: string;
|
|
@@ -97,9 +112,34 @@ declare class VerificationGatewayClient {
|
|
|
97
112
|
currency?: string;
|
|
98
113
|
checkoutSessionId?: string;
|
|
99
114
|
checkoutItems?: VerificationRequest['checkoutItems'];
|
|
115
|
+
/** 5.6.0: alternate receipt/delivery email (transit-only) — omit to let
|
|
116
|
+
* the platform default `fulfilment.email` to the buyer's account email. */
|
|
117
|
+
buyerEmail?: string;
|
|
100
118
|
counterpartyUrl?: string;
|
|
101
119
|
counterpartyType?: string;
|
|
102
120
|
}): Promise<VerificationResult>;
|
|
121
|
+
/**
|
|
122
|
+
* 5.5.0 (astra-pay): report a self-settled charge outcome back to the
|
|
123
|
+
* platform — the other half of the `settlementToken` contract. Call after
|
|
124
|
+
* your PaymentIntent reaches a terminal state so the buyer's dashboard,
|
|
125
|
+
* /orders and the agent's poll surface reconcile. Authenticated with this
|
|
126
|
+
* client's api key (must be the merchant's own). Amounts must match the
|
|
127
|
+
* order EXACTLY (integer minor units) or the report is rejected whole
|
|
128
|
+
* (409 amount_mismatch). Replays of the same terminal state are safe.
|
|
129
|
+
*/
|
|
130
|
+
reportSettlement(options: {
|
|
131
|
+
sessionId: string;
|
|
132
|
+
status: 'settled' | 'declined' | 'failed';
|
|
133
|
+
amountMinor: number;
|
|
134
|
+
currency: string;
|
|
135
|
+
/** Stripe PaymentIntent id — REQUIRED when status is 'settled'. */
|
|
136
|
+
processorRef?: string;
|
|
137
|
+
failureCode?: string;
|
|
138
|
+
}): Promise<{
|
|
139
|
+
orderId: string;
|
|
140
|
+
status: string;
|
|
141
|
+
alreadySettled?: boolean;
|
|
142
|
+
}>;
|
|
103
143
|
/**
|
|
104
144
|
* Quick verification — checks credentials and policy in one call.
|
|
105
145
|
*
|
package/dist/adapters/sdk.js
CHANGED
|
@@ -28,7 +28,7 @@ __export(sdk_exports, {
|
|
|
28
28
|
module.exports = __toCommonJS(sdk_exports);
|
|
29
29
|
|
|
30
30
|
// src/version.ts
|
|
31
|
-
var SDK_VERSION = "5.
|
|
31
|
+
var SDK_VERSION = "5.6.0";
|
|
32
32
|
|
|
33
33
|
// src/http.ts
|
|
34
34
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -310,6 +310,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
310
310
|
if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
|
|
311
311
|
if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
|
|
312
312
|
if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
|
|
313
|
+
if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
|
|
313
314
|
if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
|
|
314
315
|
if (requestData.attemptId) body.attemptId = requestData.attemptId;
|
|
315
316
|
if (requestData.considerationSet) body.considerationSet = requestData.considerationSet;
|
|
@@ -482,7 +483,12 @@ async function verify(config, request, options) {
|
|
|
482
483
|
recommendationReasons: apiResponse.recommendationReasons,
|
|
483
484
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
484
485
|
settlement: apiResponse.settlement,
|
|
485
|
-
settlementOutcome: apiResponse.settlementOutcome
|
|
486
|
+
settlementOutcome: apiResponse.settlementOutcome,
|
|
487
|
+
// 5.5.0 self-settlement: merchant-only material — passes through to the
|
|
488
|
+
// MERCHANT caller only (bridge callers strip it before the agent plane).
|
|
489
|
+
settlementToken: apiResponse.settlementToken,
|
|
490
|
+
// 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
|
|
491
|
+
fulfilment: apiResponse.fulfilment
|
|
486
492
|
};
|
|
487
493
|
return result2;
|
|
488
494
|
}
|
|
@@ -540,7 +546,10 @@ async function verify(config, request, options) {
|
|
|
540
546
|
warningHeader: apiResponse.warningHeader,
|
|
541
547
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
542
548
|
settlement: apiResponse.settlement,
|
|
543
|
-
settlementOutcome: apiResponse.settlementOutcome
|
|
549
|
+
settlementOutcome: apiResponse.settlementOutcome,
|
|
550
|
+
settlementToken: apiResponse.settlementToken,
|
|
551
|
+
// 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
|
|
552
|
+
fulfilment: apiResponse.fulfilment
|
|
544
553
|
};
|
|
545
554
|
if (result.recommendation === "deny") {
|
|
546
555
|
result.policyAllowed = false;
|
|
@@ -643,6 +652,21 @@ var VerificationGatewayClient = class {
|
|
|
643
652
|
* settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
|
|
644
653
|
* identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
|
|
645
654
|
* party path `settlementOutcome` is simply absent — no money moves.
|
|
655
|
+
*
|
|
656
|
+
* 5.5.0 self-settling merchants (settlement_mode='self_settle'): the result
|
|
657
|
+
* carries `.settlementToken` instead of a completed charge. Charge on your
|
|
658
|
+
* own integration with Stripe idempotency key `voucher:<token.jti>` and
|
|
659
|
+
* `metadata: { jti: token.jti, sessionId: token.sessionId }`, then call
|
|
660
|
+
* `reportSettlement()` with the outcome. Treat any `settlementOutcome.status`
|
|
661
|
+
* you don't recognize (e.g. `pending_merchant`) as PENDING, never failed.
|
|
662
|
+
*
|
|
663
|
+
* 5.6.0 fulfilment contact: first-party confirm results carry
|
|
664
|
+
* `.fulfilment { email, emailSource }` — the buyer's receipt/delivery
|
|
665
|
+
* email. You always get one: the platform defaults to the buyer's account
|
|
666
|
+
* email when no `buyerEmail` was passed. Store it with the pending order;
|
|
667
|
+
* fulfil against it only once the order is settled / pending_merchant. An
|
|
668
|
+
* explicit `buyerEmail` (here or on the bridge handoff body) wins over the
|
|
669
|
+
* account default.
|
|
646
670
|
*/
|
|
647
671
|
async confirmCheckout(options) {
|
|
648
672
|
const credentials = {
|
|
@@ -662,6 +686,7 @@ var VerificationGatewayClient = class {
|
|
|
662
686
|
commercePhase: "confirm",
|
|
663
687
|
checkoutSessionId: options.checkoutSessionId,
|
|
664
688
|
checkoutItems: options.checkoutItems,
|
|
689
|
+
buyerEmail: options.buyerEmail,
|
|
665
690
|
counterpartyUrl: options.counterpartyUrl,
|
|
666
691
|
counterpartyType: options.counterpartyType
|
|
667
692
|
},
|
|
@@ -672,6 +697,32 @@ var VerificationGatewayClient = class {
|
|
|
672
697
|
)
|
|
673
698
|
);
|
|
674
699
|
}
|
|
700
|
+
/**
|
|
701
|
+
* 5.5.0 (astra-pay): report a self-settled charge outcome back to the
|
|
702
|
+
* platform — the other half of the `settlementToken` contract. Call after
|
|
703
|
+
* your PaymentIntent reaches a terminal state so the buyer's dashboard,
|
|
704
|
+
* /orders and the agent's poll surface reconcile. Authenticated with this
|
|
705
|
+
* client's api key (must be the merchant's own). Amounts must match the
|
|
706
|
+
* order EXACTLY (integer minor units) or the report is rejected whole
|
|
707
|
+
* (409 amount_mismatch). Replays of the same terminal state are safe.
|
|
708
|
+
*/
|
|
709
|
+
async reportSettlement(options) {
|
|
710
|
+
const base = this.config.apiBaseUrl.replace(/\/+$/, "");
|
|
711
|
+
const res = await sdkFetch(`${base}/merchant/settlements/report`, {
|
|
712
|
+
method: "POST",
|
|
713
|
+
headers: {
|
|
714
|
+
"Content-Type": "application/json",
|
|
715
|
+
// Same auth pair as every backend call the SDK makes (verify.ts).
|
|
716
|
+
...this.config.apiKey ? { Authorization: `Bearer ${this.config.apiKey}`, "X-API-Key": this.config.apiKey } : {}
|
|
717
|
+
},
|
|
718
|
+
body: JSON.stringify(options)
|
|
719
|
+
});
|
|
720
|
+
const json = await res.json().catch(() => ({}));
|
|
721
|
+
if (!res.ok || !json.success || !json.data) {
|
|
722
|
+
throw new Error(`reportSettlement failed (${res.status}): ${json.error ?? "unknown error"}`);
|
|
723
|
+
}
|
|
724
|
+
return json.data;
|
|
725
|
+
}
|
|
675
726
|
/**
|
|
676
727
|
* Quick verification — checks credentials and policy in one call.
|
|
677
728
|
*
|