@genesis-tech/genesispay-seller 0.13.2 → 1.3.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/CHANGELOG.md +196 -0
- package/README.md +670 -91
- package/dist/checkout-documents.d.ts +99 -0
- package/dist/checkout-documents.d.ts.map +1 -0
- package/dist/checkout-documents.js +155 -0
- package/dist/checkout-documents.js.map +1 -0
- package/dist/checkout-return.d.ts +5 -5
- package/dist/checkout-return.d.ts.map +1 -1
- package/dist/checkout-return.js +3 -2
- package/dist/checkout-return.js.map +1 -1
- package/dist/client.d.ts +42 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +99 -10
- package/dist/client.js.map +1 -1
- package/dist/contract-mandates.d.ts +39 -0
- package/dist/contract-mandates.d.ts.map +1 -0
- package/dist/contract-mandates.js +98 -0
- package/dist/contract-mandates.js.map +1 -0
- package/dist/contract-usage.d.ts +29 -0
- package/dist/contract-usage.d.ts.map +1 -0
- package/dist/contract-usage.js +92 -0
- package/dist/contract-usage.js.map +1 -0
- package/dist/errors.d.ts +71 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +124 -13
- package/dist/errors.js.map +1 -1
- package/dist/fulfillment-attempts.d.ts +29 -0
- package/dist/fulfillment-attempts.d.ts.map +1 -0
- package/dist/fulfillment-attempts.js +71 -0
- package/dist/fulfillment-attempts.js.map +1 -0
- package/dist/fulfillment.d.ts +152 -0
- package/dist/fulfillment.d.ts.map +1 -0
- package/dist/fulfillment.js +810 -0
- package/dist/fulfillment.js.map +1 -0
- package/dist/genesispay-settlement.d.ts +4 -2
- package/dist/genesispay-settlement.d.ts.map +1 -1
- package/dist/genesispay-settlement.js +412 -15
- package/dist/genesispay-settlement.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/invoices.d.ts +31 -0
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +61 -2
- package/dist/invoices.js.map +1 -1
- package/dist/item-tax.d.ts +15 -0
- package/dist/item-tax.d.ts.map +1 -0
- package/dist/item-tax.js +19 -0
- package/dist/item-tax.js.map +1 -0
- package/dist/mandate-gate.d.ts +6 -1
- package/dist/mandate-gate.d.ts.map +1 -1
- package/dist/mandate-gate.js +81 -7
- package/dist/mandate-gate.js.map +1 -1
- package/dist/mandates.d.ts +21 -4
- package/dist/mandates.d.ts.map +1 -1
- package/dist/mandates.js +24 -3
- package/dist/mandates.js.map +1 -1
- package/dist/networks.d.ts.map +1 -1
- package/dist/networks.js +5 -4
- package/dist/networks.js.map +1 -1
- package/dist/payment-gate.d.ts +32 -1
- package/dist/payment-gate.d.ts.map +1 -1
- package/dist/payment-gate.js +275 -11
- package/dist/payment-gate.js.map +1 -1
- package/dist/products.d.ts +40 -16
- package/dist/products.d.ts.map +1 -1
- package/dist/products.js +1078 -56
- package/dist/products.js.map +1 -1
- package/dist/strict-response.d.ts +21 -0
- package/dist/strict-response.d.ts.map +1 -0
- package/dist/strict-response.js +68 -0
- package/dist/strict-response.js.map +1 -0
- package/dist/webhooks.d.ts +77 -2
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +20 -0
- package/dist/webhooks.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type FulfillmentAttemptList, type FulfillmentAttemptsQuery } from "./fulfillment-attempts.js";
|
|
2
|
+
export declare const GENESISPAY_API_VERSION: "2026-08-26";
|
|
3
|
+
export declare const GENESISPAY_VERSION_HEADER: "GENESISPAY-Version";
|
|
4
|
+
export declare const GENESISPAY_REQUEST_ID_HEADER: "GENESISPAY-Request-Id";
|
|
5
|
+
export declare const GENESISPAY_PAYMENT_ATTEMPT_ID_HEADER: "GENESISPAY-Payment-Attempt-Id";
|
|
6
|
+
export type ApiVersion = typeof GENESISPAY_API_VERSION;
|
|
7
|
+
export type DeploymentMode = "test" | "live";
|
|
8
|
+
export type SupportedAsset = "USDC" | "EURC";
|
|
9
|
+
export type PaymentChannel = "checkout" | "x402" | "bank_transfer";
|
|
10
|
+
export type DeliveryType = "none" | "url" | "gate";
|
|
11
|
+
export type SettlementStrategy = "dual" | "atomic";
|
|
12
|
+
type EvmAddress = `0x${string}`;
|
|
13
|
+
export interface NetworkContract {
|
|
14
|
+
mode: DeploymentMode;
|
|
15
|
+
network: "base";
|
|
16
|
+
chainId: 8453 | 84532;
|
|
17
|
+
asset: SupportedAsset;
|
|
18
|
+
tokenAddress: EvmAddress;
|
|
19
|
+
minorUnitScale: 6;
|
|
20
|
+
}
|
|
21
|
+
export interface ExpectedDeliveryContract {
|
|
22
|
+
type: DeliveryType;
|
|
23
|
+
url: string | null;
|
|
24
|
+
gate: null | {
|
|
25
|
+
method: string;
|
|
26
|
+
resourceUrl: string;
|
|
27
|
+
fingerprint: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface ExpectedProductContract {
|
|
31
|
+
kind: "product";
|
|
32
|
+
productId: string;
|
|
33
|
+
sku: string | null;
|
|
34
|
+
grossAmountMinor: bigint;
|
|
35
|
+
network: NetworkContract;
|
|
36
|
+
settlementDestination: EvmAddress;
|
|
37
|
+
delivery: ExpectedDeliveryContract;
|
|
38
|
+
}
|
|
39
|
+
export interface ExpectedPaymentLinkContract {
|
|
40
|
+
kind: "payment_link";
|
|
41
|
+
linkId: string;
|
|
42
|
+
grossAmountMinor: bigint;
|
|
43
|
+
network: NetworkContract;
|
|
44
|
+
settlementDestination: EvmAddress;
|
|
45
|
+
}
|
|
46
|
+
export type ExpectedFulfillmentContract = ExpectedProductContract | ExpectedPaymentLinkContract;
|
|
47
|
+
export type FulfillmentLocator = {
|
|
48
|
+
attemptId: string;
|
|
49
|
+
linkId?: never;
|
|
50
|
+
entitlementId?: never;
|
|
51
|
+
} | {
|
|
52
|
+
linkId: string;
|
|
53
|
+
attemptId?: never;
|
|
54
|
+
entitlementId?: never;
|
|
55
|
+
} | {
|
|
56
|
+
entitlementId: string;
|
|
57
|
+
attemptId?: never;
|
|
58
|
+
linkId?: never;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The fee agreement frozen onto the payment. `record_only` means the payer
|
|
62
|
+
* never signed a fee leg and the seller leg moved the full gross;
|
|
63
|
+
* `payer_authorized` means they did, and the seller leg moved gross − amount.
|
|
64
|
+
*/
|
|
65
|
+
export interface FeeTerms {
|
|
66
|
+
type: "record_only" | "payer_authorized";
|
|
67
|
+
amountMinor: bigint;
|
|
68
|
+
treasuryAddress: EvmAddress | null;
|
|
69
|
+
}
|
|
70
|
+
export type FeeCollectionStatus = "not_recorded" | "recorded" | "pending" | "collecting" | "collected" | "failed" | "written_off";
|
|
71
|
+
/**
|
|
72
|
+
* The fee leg's own outcome, which is separate from — and usually later than —
|
|
73
|
+
* the seller leg's. Only `collected` with a transaction hash means the platform
|
|
74
|
+
* fee actually moved; every other status means the seller was paid and the fee
|
|
75
|
+
* was not (yet) taken. Never derive it from `feeTerms`.
|
|
76
|
+
*/
|
|
77
|
+
export interface FeeCollection {
|
|
78
|
+
status: FeeCollectionStatus;
|
|
79
|
+
amountMinor: bigint | null;
|
|
80
|
+
treasuryAddress: EvmAddress | null;
|
|
81
|
+
transactionHash: EvmAddress | null;
|
|
82
|
+
collectedAt: string | null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Current delivery capability for a minted entitlement — never payment
|
|
86
|
+
* authority. A confirmed payment stays confirmed; `valid` goes false when the
|
|
87
|
+
* entitlement expires or an operator revokes it for fraud. Gate DELIVERY on
|
|
88
|
+
* this; gate refunds and reconciliation on the payment.
|
|
89
|
+
*/
|
|
90
|
+
export interface EntitlementState {
|
|
91
|
+
expiresAt: string;
|
|
92
|
+
revokedAt: string | null;
|
|
93
|
+
valid: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface VerifiedPayment {
|
|
96
|
+
attemptId: string;
|
|
97
|
+
linkId: string;
|
|
98
|
+
entitlementId: string | null;
|
|
99
|
+
entitlement: EntitlementState | null;
|
|
100
|
+
paymentChannel: PaymentChannel;
|
|
101
|
+
confirmedAt: string;
|
|
102
|
+
transactionHash: EvmAddress;
|
|
103
|
+
grossAmountMinor: bigint;
|
|
104
|
+
/** What the seller leg moved: gross minus the AUTHORIZED fee, not a collected one. */
|
|
105
|
+
sellerAmountMinor: bigint;
|
|
106
|
+
feeTerms: FeeTerms;
|
|
107
|
+
feeCollection: FeeCollection;
|
|
108
|
+
settlementDestination: EvmAddress;
|
|
109
|
+
network: NetworkContract;
|
|
110
|
+
product: null | {
|
|
111
|
+
productId: string;
|
|
112
|
+
sku: string | null;
|
|
113
|
+
delivery: ExpectedDeliveryContract;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export type FulfillmentVerification = {
|
|
117
|
+
verified: true;
|
|
118
|
+
requestId: string;
|
|
119
|
+
apiVersion: ApiVersion;
|
|
120
|
+
payment: VerifiedPayment;
|
|
121
|
+
} | {
|
|
122
|
+
verified: false;
|
|
123
|
+
reason: "not_found" | "not_confirmed" | "simulated" | "entitlement_invalid";
|
|
124
|
+
requestId: string;
|
|
125
|
+
apiVersion: ApiVersion;
|
|
126
|
+
};
|
|
127
|
+
export interface FulfillmentResource {
|
|
128
|
+
/** Seller-scoped recovery candidates, never a verified payment verdict. */
|
|
129
|
+
listAttempts(input?: FulfillmentAttemptsQuery): Promise<FulfillmentAttemptList>;
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves seller-scoped evidence and verifies it against `expected`.
|
|
132
|
+
* No overload accepts an evidence object: authority always comes from the
|
|
133
|
+
* authenticated GenesisPay response.
|
|
134
|
+
*/
|
|
135
|
+
verify(input: {
|
|
136
|
+
locator: FulfillmentLocator;
|
|
137
|
+
expected: ExpectedFulfillmentContract;
|
|
138
|
+
}): Promise<FulfillmentVerification>;
|
|
139
|
+
}
|
|
140
|
+
type CreateFulfillmentResourceOptions = {
|
|
141
|
+
baseUrl: string;
|
|
142
|
+
apiKey: string;
|
|
143
|
+
fetchFn: typeof fetch;
|
|
144
|
+
assertPinnedDestination(wallet: unknown, what: string): void;
|
|
145
|
+
};
|
|
146
|
+
export declare function createFulfillmentResource(options: CreateFulfillmentResourceOptions): FulfillmentResource;
|
|
147
|
+
/** Internal shared validation for product gates before any payment negotiation begins. */
|
|
148
|
+
export declare function validateExpectedProductContract(value: unknown): ExpectedProductContract;
|
|
149
|
+
/** Internal shape check after webhook HMAC verification, not authorization. */
|
|
150
|
+
export declare function assertFulfillmentEventEvidence(value: unknown): void;
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=fulfillment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fulfillment.d.ts","sourceRoot":"","sources":["../src/fulfillment.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAmC,KAAK,sBAAsB,EAAE,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAExI,eAAO,MAAM,sBAAsB,EAAG,YAAqB,CAAC;AAC5D,eAAO,MAAM,yBAAyB,EAAG,oBAA6B,CAAC;AACvE,eAAO,MAAM,4BAA4B,EAAG,uBAAgC,CAAC;AAC7E,eAAO,MAAM,oCAAoC,EAC/C,+BAAwC,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,OAAO,sBAAsB,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,eAAe,CAAC;AACnE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEnD,KAAK,UAAU,GAAG,KAAK,MAAM,EAAE,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAC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