@facto-to/card 0.0.0-stage → 0.0.1-beta.2
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 +20 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +63 -2
- package/dist/card-inbox-DzsHFRPT.d.cts +312 -0
- package/dist/card-inbox-DzsHFRPT.d.ts +312 -0
- package/dist/chunk-KBS2PWM4.js +2 -0
- package/dist/cli/index.js +6 -0
- package/dist/docs/README.md +9 -0
- package/dist/docs/authentication.md +96 -0
- package/dist/docs/authorization-binding.md +182 -0
- package/dist/docs/authorizations.md +182 -0
- package/dist/docs/concepts.md +36 -0
- package/dist/docs/deliveries.md +170 -0
- package/dist/docs/errors.md +100 -0
- package/dist/docs/getting-access.md +56 -0
- package/dist/docs/idempotency.md +78 -0
- package/dist/docs/integration-checklist.md +15 -0
- package/dist/docs/integration.zh.md +59 -0
- package/dist/docs/interlace-adapter-v1.md +87 -0
- package/dist/docs/interlace-adapter-v1.zh.md +87 -0
- package/dist/docs/not-yet-available.md +13 -0
- package/dist/docs/quickstart.md +126 -0
- package/dist/docs/reconciliation.md +86 -0
- package/dist/docs/reference/api.md +2541 -0
- package/dist/docs/reference/events.md +639 -0
- package/dist/docs/reference/schemas.json +6603 -0
- package/dist/docs/reference/schemas.md +1001 -0
- package/dist/docs/simulator.md +235 -0
- package/dist/docs/versioning.md +9 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +987 -0
- package/dist/index.d.ts +987 -0
- package/dist/index.js +2 -0
- package/dist/source/build.mjs +5 -0
- package/dist/source/package.json +16 -0
- package/dist/source/src/connect/cli/deliveries.ts +48 -0
- package/dist/source/src/connect/cli/index.ts +57 -0
- package/dist/source/src/connect/server/card-binding-assertion.ts +312 -0
- package/dist/source/src/connect/server/card-client.ts +1018 -0
- package/dist/source/src/connect/server/card-delivery.ts +301 -0
- package/dist/source/src/connect/server/card-events.ts +473 -0
- package/dist/source/src/connect/server/card-idempotency.ts +27 -0
- package/dist/source/src/connect/server/card-inbox.ts +82 -0
- package/dist/source/src/connect/server/card-intent-token.ts +588 -0
- package/dist/source/src/connect/server/card-polling.ts +69 -0
- package/dist/source/src/connect/server/card-signing.ts +115 -0
- package/dist/source/src/connect/server/card-transport.ts +282 -0
- package/dist/source/src/connect/server/errors.ts +280 -0
- package/dist/source/src/connect/server/fixtures/engine/card-events.synthetic.ts +84 -0
- package/dist/source/src/connect/server/retry-after.ts +12 -0
- package/dist/source/src/connect/testing/card-inbox.ts +124 -0
- package/dist/source/src/connect/testing/card-scenarios.ts +243 -0
- package/dist/source/src/connect/testing/card-simulator-vectors.ts +262 -0
- package/dist/source/src/connect/testing/card-simulator.ts +531 -0
- package/dist/source/src/connect/testing/interlace-card-transactions.ts +704 -0
- package/dist/source/src/connect/testing/pure-sha256.ts +123 -0
- package/dist/source/src/connect/wire.d.ts +544 -0
- package/dist/source/src/index.ts +163 -0
- package/dist/source/src/testing-browser.ts +24 -0
- package/dist/source/src/testing.ts +26 -0
- package/dist/source/tsconfig.json +20 -0
- package/dist/testing-browser.d.ts +220 -0
- package/dist/testing-browser.js +5 -0
- package/dist/testing.cjs +6 -0
- package/dist/testing.d.cts +199 -0
- package/dist/testing.d.ts +199 -0
- package/dist/testing.js +5 -0
- package/package.json +60 -4
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Pure ES2022 RFC 6234 SHA-256 and RFC 2104 HMAC-SHA256 with zero runtime
|
|
2
|
+
// dependencies so browser-targeted testing helpers work identically in browsers and Node.js.
|
|
3
|
+
|
|
4
|
+
const K = new Uint32Array([
|
|
5
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
6
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
7
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
8
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
9
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
10
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
11
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
12
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
13
|
+
])
|
|
14
|
+
|
|
15
|
+
const H0 = new Uint32Array([
|
|
16
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
|
17
|
+
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
18
|
+
])
|
|
19
|
+
|
|
20
|
+
const textEncoder = new TextEncoder()
|
|
21
|
+
|
|
22
|
+
function toBytes(input: Uint8Array | string): Uint8Array {
|
|
23
|
+
return typeof input === 'string' ? textEncoder.encode(input) : input
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function rotr(value: number, shift: number): number {
|
|
27
|
+
return (value >>> shift) | (value << (32 - shift))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function sha256Bytes(input: Uint8Array | string): Uint8Array {
|
|
31
|
+
const message = toBytes(input)
|
|
32
|
+
const bitLenHi = Math.floor((message.byteLength * 8) / 0x100000000)
|
|
33
|
+
const bitLenLo = (message.byteLength * 8) >>> 0
|
|
34
|
+
const paddedLength = Math.ceil((message.byteLength + 9) / 64) * 64
|
|
35
|
+
const padded = new Uint8Array(paddedLength)
|
|
36
|
+
padded.set(message)
|
|
37
|
+
padded[message.byteLength] = 0x80
|
|
38
|
+
const view = new DataView(padded.buffer)
|
|
39
|
+
view.setUint32(paddedLength - 8, bitLenHi, false)
|
|
40
|
+
view.setUint32(paddedLength - 4, bitLenLo, false)
|
|
41
|
+
|
|
42
|
+
const h = new Uint32Array(H0)
|
|
43
|
+
const w = new Uint32Array(64)
|
|
44
|
+
|
|
45
|
+
for (let offset = 0; offset < paddedLength; offset += 64) {
|
|
46
|
+
for (let i = 0; i < 16; i += 1) {
|
|
47
|
+
w[i] = view.getUint32(offset + i * 4, false)
|
|
48
|
+
}
|
|
49
|
+
for (let i = 16; i < 64; i += 1) {
|
|
50
|
+
const s0 = rotr(w[i - 15]!, 7) ^ rotr(w[i - 15]!, 18) ^ (w[i - 15]! >>> 3)
|
|
51
|
+
const s1 = rotr(w[i - 2]!, 17) ^ rotr(w[i - 2]!, 19) ^ (w[i - 2]! >>> 10)
|
|
52
|
+
w[i] = (w[i - 16]! + s0 + w[i - 7]! + s1) >>> 0
|
|
53
|
+
}
|
|
54
|
+
let a = h[0]!, b = h[1]!, c = h[2]!, d = h[3]!
|
|
55
|
+
let e = h[4]!, f = h[5]!, g = h[6]!, hh = h[7]!
|
|
56
|
+
for (let i = 0; i < 64; i += 1) {
|
|
57
|
+
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)
|
|
58
|
+
const ch = (e & f) ^ (~e & g)
|
|
59
|
+
const temp1 = (hh + s1 + ch + K[i]! + w[i]!) >>> 0
|
|
60
|
+
const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)
|
|
61
|
+
const maj = (a & b) ^ (a & c) ^ (b & c)
|
|
62
|
+
const temp2 = (s0 + maj) >>> 0
|
|
63
|
+
hh = g
|
|
64
|
+
g = f
|
|
65
|
+
f = e
|
|
66
|
+
e = (d + temp1) >>> 0
|
|
67
|
+
d = c
|
|
68
|
+
c = b
|
|
69
|
+
b = a
|
|
70
|
+
a = (temp1 + temp2) >>> 0
|
|
71
|
+
}
|
|
72
|
+
h[0] = (h[0]! + a) >>> 0
|
|
73
|
+
h[1] = (h[1]! + b) >>> 0
|
|
74
|
+
h[2] = (h[2]! + c) >>> 0
|
|
75
|
+
h[3] = (h[3]! + d) >>> 0
|
|
76
|
+
h[4] = (h[4]! + e) >>> 0
|
|
77
|
+
h[5] = (h[5]! + f) >>> 0
|
|
78
|
+
h[6] = (h[6]! + g) >>> 0
|
|
79
|
+
h[7] = (h[7]! + hh) >>> 0
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const digest = new Uint8Array(32)
|
|
83
|
+
const out = new DataView(digest.buffer)
|
|
84
|
+
for (let i = 0; i < 8; i += 1) out.setUint32(i * 4, h[i]!, false)
|
|
85
|
+
return digest
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function bytesToHex(bytes: Uint8Array): string {
|
|
89
|
+
let hex = ''
|
|
90
|
+
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
91
|
+
hex += bytes[i]!.toString(16).padStart(2, '0')
|
|
92
|
+
}
|
|
93
|
+
return hex
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function sha256Hex(input: Uint8Array | string): string {
|
|
97
|
+
return bytesToHex(sha256Bytes(input))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function hmacSha256Hex(key: Uint8Array, message: Uint8Array | string): string {
|
|
101
|
+
const blockSize = 64
|
|
102
|
+
const keyBlock = new Uint8Array(blockSize)
|
|
103
|
+
const normalizedKey = key.byteLength > blockSize ? sha256Bytes(key) : key
|
|
104
|
+
keyBlock.set(normalizedKey)
|
|
105
|
+
|
|
106
|
+
const ipad = new Uint8Array(blockSize)
|
|
107
|
+
const opad = new Uint8Array(blockSize)
|
|
108
|
+
for (let i = 0; i < blockSize; i += 1) {
|
|
109
|
+
ipad[i] = keyBlock[i]! ^ 0x36
|
|
110
|
+
opad[i] = keyBlock[i]! ^ 0x5c
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const msgBytes = toBytes(message)
|
|
114
|
+
const innerInput = new Uint8Array(blockSize + msgBytes.byteLength)
|
|
115
|
+
innerInput.set(ipad, 0)
|
|
116
|
+
innerInput.set(msgBytes, blockSize)
|
|
117
|
+
const innerHash = sha256Bytes(innerInput)
|
|
118
|
+
|
|
119
|
+
const outerInput = new Uint8Array(blockSize + 32)
|
|
120
|
+
outerInput.set(opad, 0)
|
|
121
|
+
outerInput.set(innerHash, blockSize)
|
|
122
|
+
return bytesToHex(sha256Bytes(outerInput))
|
|
123
|
+
}
|
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
interface AuthorizationAccepted {
|
|
2
|
+
charge_id: string;
|
|
3
|
+
status: 'processing';
|
|
4
|
+
}
|
|
5
|
+
type AuthorizationTimestamp = string;
|
|
6
|
+
interface CardholderVerification {
|
|
7
|
+
evidence_id: string;
|
|
8
|
+
method: 'pin' | 'biometric' | 'cdcvm' | 'signature' | 'no_cvm' | 'provider_attested';
|
|
9
|
+
verified_at: AuthorizationTimestamp;
|
|
10
|
+
}
|
|
11
|
+
interface AuthorizationCreateInput {
|
|
12
|
+
amount: string;
|
|
13
|
+
cardholder_verification: CardholderVerification;
|
|
14
|
+
client_transaction_id?: string;
|
|
15
|
+
currency: 'USD' | 'USDC';
|
|
16
|
+
deadline_at?: string;
|
|
17
|
+
decision_mode?: 'asynchronous' | 'synchronous';
|
|
18
|
+
decision_timeout_ms?: number;
|
|
19
|
+
external_authorization_id: string;
|
|
20
|
+
external_card_id: string;
|
|
21
|
+
mapping_revision: string;
|
|
22
|
+
merchant_country?: string;
|
|
23
|
+
merchant_mcc?: string;
|
|
24
|
+
merchant_name?: string;
|
|
25
|
+
occurred_at?: string;
|
|
26
|
+
program_id: string;
|
|
27
|
+
resource_version: string;
|
|
28
|
+
supplier_transaction_id?: string;
|
|
29
|
+
}
|
|
30
|
+
interface AuthorizationDeadlineExceeded {
|
|
31
|
+
deadline_at: string;
|
|
32
|
+
decision_id: string;
|
|
33
|
+
error: 'decision_deadline_exceeded';
|
|
34
|
+
message: string;
|
|
35
|
+
request_id: string;
|
|
36
|
+
}
|
|
37
|
+
declare const AUTHORIZATION_FACT_KIND_VALUES: readonly ["facto_admission", "durable_commit", "provider_authorization", "chain_finality", "provider_settlement"];
|
|
38
|
+
type AuthorizationFactKind = (typeof AUTHORIZATION_FACT_KIND_VALUES)[number];
|
|
39
|
+
interface AuthorizationFactProperties {
|
|
40
|
+
kind: AuthorizationFactKind;
|
|
41
|
+
observed_at?: AuthorizationTimestamp;
|
|
42
|
+
recorded_at: AuthorizationTimestamp;
|
|
43
|
+
safe_code?: string;
|
|
44
|
+
source_system: 'facto' | 'provider' | 'chain';
|
|
45
|
+
state: 'unobserved' | 'pending' | 'confirmed' | 'rejected' | 'indeterminate';
|
|
46
|
+
}
|
|
47
|
+
type AuthorizationFact = AuthorizationFactProperties & (({
|
|
48
|
+
state: 'confirmed';
|
|
49
|
+
} & Required<Pick<AuthorizationFactProperties, 'observed_at'>>) | ({
|
|
50
|
+
state: Exclude<AuthorizationFactProperties['state'], 'confirmed'>;
|
|
51
|
+
})) & (({
|
|
52
|
+
state: 'unobserved';
|
|
53
|
+
} & {
|
|
54
|
+
observed_at?: never;
|
|
55
|
+
}) | ({
|
|
56
|
+
state: Exclude<AuthorizationFactProperties['state'], 'unobserved'>;
|
|
57
|
+
}));
|
|
58
|
+
interface AuthorizationFactInput {
|
|
59
|
+
amount: string;
|
|
60
|
+
client_transaction_id?: string;
|
|
61
|
+
currency: 'USD' | 'USDC';
|
|
62
|
+
fact_type: 'authorization_updated' | 'clearing' | 'reversal' | 'refund' | 'chargeback' | 'settlement';
|
|
63
|
+
mapping_revision: string;
|
|
64
|
+
merchant_country?: string;
|
|
65
|
+
merchant_mcc?: string;
|
|
66
|
+
merchant_name?: string;
|
|
67
|
+
parent_supplier_transaction_id?: string;
|
|
68
|
+
predecessor_version: string;
|
|
69
|
+
program_id: string;
|
|
70
|
+
recorded_at: string;
|
|
71
|
+
resource_version: string;
|
|
72
|
+
supplier_transaction_id?: string;
|
|
73
|
+
}
|
|
74
|
+
interface AuthorizationFactReceipt {
|
|
75
|
+
operation_id: string;
|
|
76
|
+
status: 'recorded';
|
|
77
|
+
}
|
|
78
|
+
type AuthorizationFacts = [
|
|
79
|
+
AuthorizationFact & {
|
|
80
|
+
kind?: 'facto_admission';
|
|
81
|
+
},
|
|
82
|
+
AuthorizationFact & {
|
|
83
|
+
kind?: 'durable_commit';
|
|
84
|
+
},
|
|
85
|
+
AuthorizationFact & {
|
|
86
|
+
kind?: 'provider_authorization';
|
|
87
|
+
},
|
|
88
|
+
AuthorizationFact & {
|
|
89
|
+
kind?: 'chain_finality';
|
|
90
|
+
},
|
|
91
|
+
AuthorizationFact & {
|
|
92
|
+
kind?: 'provider_settlement';
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
declare const AUTHORIZATION_OPERATION_TYPE_VALUES: readonly ["authorization_requested", "authorization_updated", "clearing", "reversal", "refund", "chargeback", "settlement"];
|
|
96
|
+
type AuthorizationOperationType = (typeof AUTHORIZATION_OPERATION_TYPE_VALUES)[number];
|
|
97
|
+
type AuthorizationUsdcAmount = string;
|
|
98
|
+
interface AuthorizationRefundCase {
|
|
99
|
+
amount: AuthorizationUsdcAmount;
|
|
100
|
+
case_id: string;
|
|
101
|
+
excess_amount: AuthorizationUsdcAmount;
|
|
102
|
+
not_payable_reason?: string;
|
|
103
|
+
paid_amount?: AuthorizationUsdcAmount;
|
|
104
|
+
source_operation_type: AuthorizationOperationType;
|
|
105
|
+
source_resource_version: string;
|
|
106
|
+
status: string;
|
|
107
|
+
updated_at: string;
|
|
108
|
+
}
|
|
109
|
+
interface AuthorizationLifecycleEntry {
|
|
110
|
+
amount: AuthorizationUsdcAmount;
|
|
111
|
+
currency: 'USDC';
|
|
112
|
+
link_status: 'linked' | 'unlinked';
|
|
113
|
+
operation_type: AuthorizationOperationType;
|
|
114
|
+
recorded_at: string;
|
|
115
|
+
resource_version: string;
|
|
116
|
+
unlinked_reason?: string;
|
|
117
|
+
}
|
|
118
|
+
interface AuthorizationSupplierSummary {
|
|
119
|
+
cleared_amount: AuthorizationUsdcAmount;
|
|
120
|
+
entries: AuthorizationLifecycleEntry[];
|
|
121
|
+
refunded_amount: AuthorizationUsdcAmount;
|
|
122
|
+
reversed_amount: AuthorizationUsdcAmount;
|
|
123
|
+
state: string;
|
|
124
|
+
}
|
|
125
|
+
interface AuthorizationLifecycle {
|
|
126
|
+
issuer: AuthorizationSupplierSummary;
|
|
127
|
+
refund_cases: AuthorizationRefundCase[];
|
|
128
|
+
}
|
|
129
|
+
interface AuthorizationPaymentDetails {
|
|
130
|
+
fee_breakdown: {
|
|
131
|
+
base_fee: AuthorizationUsdcAmount;
|
|
132
|
+
fast_pay_fee: AuthorizationUsdcAmount;
|
|
133
|
+
pooled_surcharge: AuthorizationUsdcAmount;
|
|
134
|
+
};
|
|
135
|
+
fee_total: AuthorizationUsdcAmount;
|
|
136
|
+
refund_payments?: Array<{
|
|
137
|
+
case_id: string;
|
|
138
|
+
chain_id: number;
|
|
139
|
+
paid_amount: AuthorizationUsdcAmount;
|
|
140
|
+
recorded_by: string;
|
|
141
|
+
tx_hash: string;
|
|
142
|
+
}>;
|
|
143
|
+
user_payment?: {
|
|
144
|
+
asset_symbol?: string;
|
|
145
|
+
chain_id: number;
|
|
146
|
+
tx_hash: string;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
type AuthorizationProgramConnectionId = string;
|
|
150
|
+
type AuthorizationRevision = number;
|
|
151
|
+
type AuthorizationUuid = string;
|
|
152
|
+
interface ChargeFinalReceiptProperties {
|
|
153
|
+
charge_id: string;
|
|
154
|
+
execution_outcome: 'succeeded' | 'failed';
|
|
155
|
+
external_authorization_id: string;
|
|
156
|
+
facts_at_finality: AuthorizationFacts;
|
|
157
|
+
finalized_at: AuthorizationTimestamp;
|
|
158
|
+
mapping_revision: string;
|
|
159
|
+
operation_type: AuthorizationOperationType;
|
|
160
|
+
receipt_event_id: AuthorizationUuid;
|
|
161
|
+
resource_version: string;
|
|
162
|
+
terminal_action: 'releaseFor' | 'cancelReservation';
|
|
163
|
+
}
|
|
164
|
+
type ChargeFinalReceipt = ChargeFinalReceiptProperties & {
|
|
165
|
+
facts_at_finality?: [
|
|
166
|
+
ChargeFinalReceiptProperties['facts_at_finality'][0],
|
|
167
|
+
ChargeFinalReceiptProperties['facts_at_finality'][1],
|
|
168
|
+
ChargeFinalReceiptProperties['facts_at_finality'][2],
|
|
169
|
+
ChargeFinalReceiptProperties['facts_at_finality'][3] & {
|
|
170
|
+
state?: 'confirmed';
|
|
171
|
+
},
|
|
172
|
+
ChargeFinalReceiptProperties['facts_at_finality'][4]
|
|
173
|
+
];
|
|
174
|
+
} & (({
|
|
175
|
+
terminal_action: 'releaseFor';
|
|
176
|
+
} & {
|
|
177
|
+
execution_outcome?: 'succeeded';
|
|
178
|
+
facts_at_finality?: [
|
|
179
|
+
ChargeFinalReceiptProperties['facts_at_finality'][0] & {
|
|
180
|
+
state?: 'confirmed';
|
|
181
|
+
},
|
|
182
|
+
ChargeFinalReceiptProperties['facts_at_finality'][1] & {
|
|
183
|
+
state?: 'confirmed';
|
|
184
|
+
},
|
|
185
|
+
ChargeFinalReceiptProperties['facts_at_finality'][2],
|
|
186
|
+
ChargeFinalReceiptProperties['facts_at_finality'][3],
|
|
187
|
+
ChargeFinalReceiptProperties['facts_at_finality'][4]
|
|
188
|
+
];
|
|
189
|
+
}) | ({
|
|
190
|
+
terminal_action: Exclude<ChargeFinalReceiptProperties['terminal_action'], 'releaseFor'>;
|
|
191
|
+
} & {
|
|
192
|
+
execution_outcome?: 'failed';
|
|
193
|
+
}));
|
|
194
|
+
interface AuthorizationProjectionProperties {
|
|
195
|
+
charge_id?: string;
|
|
196
|
+
decision?: 'approved' | 'declined' | 'self_reversed_timeout';
|
|
197
|
+
decline_reason_code?: string;
|
|
198
|
+
external_authorization_id: string;
|
|
199
|
+
facts: AuthorizationFacts;
|
|
200
|
+
final_receipt?: ChargeFinalReceipt;
|
|
201
|
+
lifecycle?: AuthorizationLifecycle;
|
|
202
|
+
mapping_revision: string;
|
|
203
|
+
operation_type: AuthorizationOperationType;
|
|
204
|
+
origin_connection_id: AuthorizationProgramConnectionId;
|
|
205
|
+
payment_details?: AuthorizationPaymentDetails;
|
|
206
|
+
processing_status: 'processing' | 'succeeded' | 'failed' | 'indeterminate';
|
|
207
|
+
resource_version: string;
|
|
208
|
+
revision: AuthorizationRevision;
|
|
209
|
+
supplier_transaction_id?: string;
|
|
210
|
+
}
|
|
211
|
+
type AuthorizationProjection = AuthorizationProjectionProperties & (({
|
|
212
|
+
processing_status: 'succeeded';
|
|
213
|
+
} & Required<Pick<AuthorizationProjectionProperties, 'charge_id'>>) | ({
|
|
214
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
|
|
215
|
+
} & {
|
|
216
|
+
final_receipt?: never;
|
|
217
|
+
})) & (({
|
|
218
|
+
processing_status: 'succeeded';
|
|
219
|
+
} & Required<Pick<AuthorizationProjectionProperties, 'final_receipt'>>) | ({
|
|
220
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
|
|
221
|
+
})) & ((Required<Pick<AuthorizationProjectionProperties, 'final_receipt'>> & {
|
|
222
|
+
decline_reason_code?: never;
|
|
223
|
+
}) | ({
|
|
224
|
+
final_receipt?: never;
|
|
225
|
+
})) & ((Required<Pick<AuthorizationProjectionProperties, 'decline_reason_code'>> & {
|
|
226
|
+
processing_status?: 'failed';
|
|
227
|
+
}) | ({
|
|
228
|
+
decline_reason_code?: never;
|
|
229
|
+
})) & ((Required<Pick<AuthorizationProjectionProperties, 'charge_id'>> & {
|
|
230
|
+
processing_status?: 'processing' | 'succeeded' | 'failed';
|
|
231
|
+
}) | ({
|
|
232
|
+
charge_id?: never;
|
|
233
|
+
})) & (({
|
|
234
|
+
processing_status: 'succeeded';
|
|
235
|
+
} & {
|
|
236
|
+
final_receipt?: {
|
|
237
|
+
execution_outcome?: 'succeeded';
|
|
238
|
+
};
|
|
239
|
+
}) | ({
|
|
240
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
|
|
241
|
+
})) & (({
|
|
242
|
+
processing_status: 'failed';
|
|
243
|
+
} & {
|
|
244
|
+
final_receipt?: {
|
|
245
|
+
execution_outcome?: 'failed';
|
|
246
|
+
};
|
|
247
|
+
}) | ({
|
|
248
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'failed'>;
|
|
249
|
+
}));
|
|
250
|
+
interface AuthorizationLookupResultProperties {
|
|
251
|
+
authorization?: AuthorizationProjection;
|
|
252
|
+
observed_at: AuthorizationTimestamp;
|
|
253
|
+
resolution: 'resolved' | 'pending' | 'unknown' | 'not_observed';
|
|
254
|
+
}
|
|
255
|
+
type AuthorizationLookupResult = AuthorizationLookupResultProperties & (({
|
|
256
|
+
resolution: 'not_observed';
|
|
257
|
+
} & {
|
|
258
|
+
authorization?: never;
|
|
259
|
+
}) | ({
|
|
260
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'not_observed'>;
|
|
261
|
+
})) & (({
|
|
262
|
+
resolution: 'resolved';
|
|
263
|
+
} & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
|
|
264
|
+
authorization?: {
|
|
265
|
+
processing_status?: 'succeeded' | 'failed';
|
|
266
|
+
};
|
|
267
|
+
}) | ({
|
|
268
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'resolved'>;
|
|
269
|
+
})) & (({
|
|
270
|
+
resolution: 'pending';
|
|
271
|
+
} & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
|
|
272
|
+
authorization?: {
|
|
273
|
+
processing_status?: 'processing';
|
|
274
|
+
};
|
|
275
|
+
}) | ({
|
|
276
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'pending'>;
|
|
277
|
+
})) & (({
|
|
278
|
+
resolution: 'unknown';
|
|
279
|
+
} & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
|
|
280
|
+
authorization?: {
|
|
281
|
+
processing_status?: 'indeterminate';
|
|
282
|
+
};
|
|
283
|
+
}) | ({
|
|
284
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'unknown'>;
|
|
285
|
+
}));
|
|
286
|
+
interface BindingFundingProjection {
|
|
287
|
+
configured: boolean;
|
|
288
|
+
reason?: string;
|
|
289
|
+
state: 'ready' | 'not_configured' | 'unavailable';
|
|
290
|
+
}
|
|
291
|
+
interface BindingLookupInput {
|
|
292
|
+
external_card_id: string;
|
|
293
|
+
}
|
|
294
|
+
type CardBindingId = string;
|
|
295
|
+
interface CardDisplayFacts {
|
|
296
|
+
last4: string | null;
|
|
297
|
+
network: string | null;
|
|
298
|
+
type: 'virtual' | 'physical' | 'unknown' | null;
|
|
299
|
+
}
|
|
300
|
+
interface BindingSummary {
|
|
301
|
+
card: CardDisplayFacts;
|
|
302
|
+
funding?: BindingFundingProjection;
|
|
303
|
+
id: CardBindingId;
|
|
304
|
+
revision: number;
|
|
305
|
+
status: 'active' | 'revoked';
|
|
306
|
+
}
|
|
307
|
+
interface BindingLookupResult {
|
|
308
|
+
binding: BindingSummary | null;
|
|
309
|
+
found: boolean;
|
|
310
|
+
}
|
|
311
|
+
type BindingSessionId = string;
|
|
312
|
+
type CardTimestamp = string;
|
|
313
|
+
interface BindingProofChallenge {
|
|
314
|
+
binding_session_id: BindingSessionId;
|
|
315
|
+
expires_at: CardTimestamp;
|
|
316
|
+
facto_challenge: string;
|
|
317
|
+
session_request_digest: string;
|
|
318
|
+
}
|
|
319
|
+
interface BindingProofPolicy {
|
|
320
|
+
allowed_modes: ['provider_reauthentication' | 'provider_second_channel', ...Array<'provider_reauthentication' | 'provider_second_channel'>];
|
|
321
|
+
card_selection_supported?: true;
|
|
322
|
+
challenge_after_facto_auth: true;
|
|
323
|
+
challenge_delivery: 'browser_handoff' | 'provider_backend';
|
|
324
|
+
}
|
|
325
|
+
interface BindingSessionCreate {
|
|
326
|
+
program_ref: string;
|
|
327
|
+
requested_user_consents: ['card.metadata.view' | 'card.use_for_facto_payments', ...Array<'card.metadata.view' | 'card.use_for_facto_payments'>];
|
|
328
|
+
return_uri: string;
|
|
329
|
+
}
|
|
330
|
+
interface BindingSessionCreated {
|
|
331
|
+
binding_session_id: BindingSessionId;
|
|
332
|
+
binding_url: string;
|
|
333
|
+
expires_at: CardTimestamp;
|
|
334
|
+
proof_policy: BindingProofPolicy;
|
|
335
|
+
status: 'pending';
|
|
336
|
+
}
|
|
337
|
+
type BindingSessionStatus = {
|
|
338
|
+
binding_session_id: BindingSessionId;
|
|
339
|
+
expires_at: CardTimestamp;
|
|
340
|
+
status: 'pending';
|
|
341
|
+
} | {
|
|
342
|
+
binding_session_id: BindingSessionId;
|
|
343
|
+
expires_at: CardTimestamp;
|
|
344
|
+
status: 'proof_pending';
|
|
345
|
+
} | {
|
|
346
|
+
binding_session_id: BindingSessionId;
|
|
347
|
+
expires_at: CardTimestamp;
|
|
348
|
+
status: 'consent_pending';
|
|
349
|
+
} | {
|
|
350
|
+
binding_ids: CardBindingId[];
|
|
351
|
+
binding_session_id: BindingSessionId;
|
|
352
|
+
completed_at?: CardTimestamp;
|
|
353
|
+
expires_at: CardTimestamp;
|
|
354
|
+
outcome: 'bound';
|
|
355
|
+
status: 'completed';
|
|
356
|
+
} | {
|
|
357
|
+
binding_session_id: BindingSessionId;
|
|
358
|
+
completed_at?: CardTimestamp;
|
|
359
|
+
expires_at: CardTimestamp;
|
|
360
|
+
failure_reason: 'declined_by_user';
|
|
361
|
+
outcome: 'declined';
|
|
362
|
+
status: 'completed';
|
|
363
|
+
} | {
|
|
364
|
+
binding_session_id: BindingSessionId;
|
|
365
|
+
completed_at?: CardTimestamp;
|
|
366
|
+
expires_at: CardTimestamp;
|
|
367
|
+
failure_reason?: 'cancelled_by_user' | 'cancelled_by_partner' | 'proof_rejected' | 'admission_closed' | 'no_eligible_cards' | 'integrity_conflict';
|
|
368
|
+
status: 'cancelled';
|
|
369
|
+
} | {
|
|
370
|
+
binding_session_id: BindingSessionId;
|
|
371
|
+
expires_at: CardTimestamp;
|
|
372
|
+
failure_reason?: 'expired' | 'proof_timeout';
|
|
373
|
+
status: 'expired';
|
|
374
|
+
};
|
|
375
|
+
type CardInboundEventInput = {
|
|
376
|
+
assertion_jws: string;
|
|
377
|
+
delivery_id: string;
|
|
378
|
+
external_account_id?: null;
|
|
379
|
+
external_card_id: string;
|
|
380
|
+
kind: 'card.unbound';
|
|
381
|
+
lifecycle_status?: null;
|
|
382
|
+
} | {
|
|
383
|
+
assertion_jws: string;
|
|
384
|
+
delivery_id: string;
|
|
385
|
+
external_account_id?: null;
|
|
386
|
+
external_card_id: string;
|
|
387
|
+
kind: 'card.lifecycle_changed';
|
|
388
|
+
lifecycle_status: 'pending' | 'active' | 'frozen' | 'closed' | 'replaced' | 'unknown';
|
|
389
|
+
} | {
|
|
390
|
+
assertion_jws: string;
|
|
391
|
+
delivery_id: string;
|
|
392
|
+
external_account_id: string;
|
|
393
|
+
external_card_id?: null;
|
|
394
|
+
kind: 'account.released';
|
|
395
|
+
lifecycle_status?: null;
|
|
396
|
+
};
|
|
397
|
+
type CardInboundEventReceipt = {
|
|
398
|
+
delivery_id: string;
|
|
399
|
+
disposition: 'applied';
|
|
400
|
+
effect: 'revoked' | 'status_updated' | 'released' | 'none';
|
|
401
|
+
} | {
|
|
402
|
+
delivery_id: string;
|
|
403
|
+
disposition: 'duplicate';
|
|
404
|
+
effect: null;
|
|
405
|
+
};
|
|
406
|
+
type CardUuid = string;
|
|
407
|
+
type ConnectIntentDigest = string;
|
|
408
|
+
type ConnectIntentId = string;
|
|
409
|
+
interface DeadLetterItem {
|
|
410
|
+
binding_id: CardBindingId;
|
|
411
|
+
binding_revision: number;
|
|
412
|
+
connection_sequence: number | null;
|
|
413
|
+
dead_lettered_at: CardTimestamp | null;
|
|
414
|
+
delivery_attempts: number;
|
|
415
|
+
event_kind: string;
|
|
416
|
+
id: CardUuid;
|
|
417
|
+
last_delivery_error: string | null;
|
|
418
|
+
replay_count: number;
|
|
419
|
+
}
|
|
420
|
+
interface DeadLetterPage {
|
|
421
|
+
items: DeadLetterItem[];
|
|
422
|
+
}
|
|
423
|
+
interface DeadLetterReplayAccepted {
|
|
424
|
+
id: CardUuid;
|
|
425
|
+
status: 'accepted';
|
|
426
|
+
}
|
|
427
|
+
type ProgramConnectionId = string;
|
|
428
|
+
interface DeliveryItem {
|
|
429
|
+
accepted_at?: CardTimestamp;
|
|
430
|
+
connection_sequence: number | null;
|
|
431
|
+
delivery_state: 'pending' | 'held' | 'accepted' | 'failed' | 'dead_lettered' | 'indeterminate';
|
|
432
|
+
event_id: CardUuid;
|
|
433
|
+
event_sha256: string;
|
|
434
|
+
origin_connection_id: ProgramConnectionId;
|
|
435
|
+
target_revision: CardUuid;
|
|
436
|
+
}
|
|
437
|
+
interface DeliveryPageProperties {
|
|
438
|
+
complete: boolean;
|
|
439
|
+
items: DeliveryItem[];
|
|
440
|
+
next_cursor: string | null;
|
|
441
|
+
snapshot_at: CardTimestamp;
|
|
442
|
+
snapshot_token: string;
|
|
443
|
+
to_at: CardTimestamp;
|
|
444
|
+
}
|
|
445
|
+
type DeliveryPage = DeliveryPageProperties & (({
|
|
446
|
+
complete: true;
|
|
447
|
+
} & {
|
|
448
|
+
next_cursor?: null;
|
|
449
|
+
}) | ({
|
|
450
|
+
complete: Exclude<DeliveryPageProperties['complete'], true>;
|
|
451
|
+
}));
|
|
452
|
+
interface DeliveryReconciliationListInputProperties {
|
|
453
|
+
cursor?: string;
|
|
454
|
+
from_at?: CardTimestamp;
|
|
455
|
+
page_size: number;
|
|
456
|
+
program_id: string;
|
|
457
|
+
selection_id?: CardUuid;
|
|
458
|
+
snapshot_token?: string;
|
|
459
|
+
target_revision: CardUuid;
|
|
460
|
+
to_at?: CardTimestamp;
|
|
461
|
+
}
|
|
462
|
+
type DeliveryReconciliationListInput = DeliveryReconciliationListInputProperties & ((Required<Pick<DeliveryReconciliationListInputProperties, 'selection_id'>> & {
|
|
463
|
+
from_at?: never;
|
|
464
|
+
to_at?: never;
|
|
465
|
+
}) | (Required<Pick<DeliveryReconciliationListInputProperties, 'from_at' | 'to_at'>> & {
|
|
466
|
+
selection_id?: never;
|
|
467
|
+
}));
|
|
468
|
+
interface DeliveryReplayAccepted {
|
|
469
|
+
replay_id: CardUuid;
|
|
470
|
+
selection_id: CardUuid;
|
|
471
|
+
status: 'accepted';
|
|
472
|
+
target_revision: CardUuid;
|
|
473
|
+
}
|
|
474
|
+
interface DeliveryReplayCreateInput {
|
|
475
|
+
program_id: string;
|
|
476
|
+
selection_id: CardUuid;
|
|
477
|
+
}
|
|
478
|
+
interface IntentCancelInput {
|
|
479
|
+
intent_token: string;
|
|
480
|
+
}
|
|
481
|
+
interface IntentCancelled {
|
|
482
|
+
id: ConnectIntentId;
|
|
483
|
+
status: 'cancelled';
|
|
484
|
+
}
|
|
485
|
+
interface IntentCardItem {
|
|
486
|
+
binding_id: CardBindingId;
|
|
487
|
+
card: CardDisplayFacts;
|
|
488
|
+
status: 'active' | 'revoked';
|
|
489
|
+
}
|
|
490
|
+
interface IntentCardList {
|
|
491
|
+
cards: IntentCardItem[];
|
|
492
|
+
id: ConnectIntentId;
|
|
493
|
+
revision: ConnectIntentDigest;
|
|
494
|
+
}
|
|
495
|
+
interface TargetCardInput {
|
|
496
|
+
external_card_id: string;
|
|
497
|
+
last4?: string | null;
|
|
498
|
+
network?: string | null;
|
|
499
|
+
type?: 'virtual' | 'physical' | 'unknown' | null;
|
|
500
|
+
}
|
|
501
|
+
interface IntentCardsReplaceInput {
|
|
502
|
+
approval_id: string;
|
|
503
|
+
approval_sha256: string;
|
|
504
|
+
cards: TargetCardInput[];
|
|
505
|
+
external_account_id?: string | null;
|
|
506
|
+
intent_token: string;
|
|
507
|
+
revision: ConnectIntentDigest;
|
|
508
|
+
}
|
|
509
|
+
interface IntentCardsReplaced {
|
|
510
|
+
added_binding_ids: CardBindingId[];
|
|
511
|
+
id: ConnectIntentId;
|
|
512
|
+
kept_binding_ids: CardBindingId[];
|
|
513
|
+
removed_binding_ids: CardBindingId[];
|
|
514
|
+
revision: ConnectIntentDigest;
|
|
515
|
+
status: 'applied' | 'no_change';
|
|
516
|
+
}
|
|
517
|
+
interface ProviderProofAccepted {
|
|
518
|
+
binding_session_id: BindingSessionId;
|
|
519
|
+
proof_received_at: CardTimestamp;
|
|
520
|
+
status: 'consent_pending';
|
|
521
|
+
}
|
|
522
|
+
interface ProviderProofSubmitPayload {
|
|
523
|
+
binding_assertion: string;
|
|
524
|
+
proof_format: 'compact-jws';
|
|
525
|
+
}
|
|
526
|
+
interface SynchronousAuthorizationApproved {
|
|
527
|
+
charge_id: string;
|
|
528
|
+
deadline_at: string;
|
|
529
|
+
decided_at: string;
|
|
530
|
+
decision: 'approved';
|
|
531
|
+
decision_id: string;
|
|
532
|
+
status: 'approved';
|
|
533
|
+
}
|
|
534
|
+
interface SynchronousAuthorizationDeclined {
|
|
535
|
+
deadline_at: string;
|
|
536
|
+
decided_at: string;
|
|
537
|
+
decision: 'declined' | 'self_reversed_timeout';
|
|
538
|
+
decision_id: string;
|
|
539
|
+
error: string;
|
|
540
|
+
message: string;
|
|
541
|
+
request_id: string;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export type { AuthorizationAccepted, AuthorizationCreateInput, AuthorizationDeadlineExceeded, AuthorizationFactInput, AuthorizationFactReceipt, AuthorizationFacts, AuthorizationLifecycle, AuthorizationLookupResult, AuthorizationOperationType, AuthorizationPaymentDetails, AuthorizationProjection, BindingFundingProjection, BindingLookupInput, BindingLookupResult, BindingProofChallenge, BindingProofPolicy, BindingSessionCreate, BindingSessionCreated, BindingSessionStatus, BindingSummary, CardDisplayFacts, CardInboundEventInput, CardInboundEventReceipt, CardholderVerification, ChargeFinalReceipt, DeadLetterItem, DeadLetterPage, DeadLetterReplayAccepted, DeliveryItem, DeliveryPage, DeliveryReconciliationListInput, DeliveryReplayAccepted, DeliveryReplayCreateInput, IntentCancelInput, IntentCancelled, IntentCardItem, IntentCardList, IntentCardsReplaceInput, IntentCardsReplaced, ProviderProofAccepted, ProviderProofSubmitPayload, SynchronousAuthorizationApproved, SynchronousAuthorizationDeclined, TargetCardInput };
|