@obhco/pay 0.0.0-stage → 0.1.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 +203 -2
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -0
- package/dist/gateways/digipay.d.ts +36 -0
- package/dist/gateways/digipay.d.ts.map +1 -0
- package/dist/gateways/digipay.js +489 -0
- package/dist/gateways/digipay.js.map +1 -0
- package/dist/gateways/index.d.ts +5 -0
- package/dist/gateways/index.d.ts.map +1 -0
- package/dist/gateways/index.js +5 -0
- package/dist/gateways/index.js.map +1 -0
- package/dist/gateways/mellat-constants.d.ts +3 -0
- package/dist/gateways/mellat-constants.d.ts.map +1 -0
- package/dist/gateways/mellat-constants.js +3 -0
- package/dist/gateways/mellat-constants.js.map +1 -0
- package/dist/gateways/mellat.d.ts +30 -0
- package/dist/gateways/mellat.d.ts.map +1 -0
- package/dist/gateways/mellat.js +397 -0
- package/dist/gateways/mellat.js.map +1 -0
- package/dist/gateways/sadad.d.ts +43 -0
- package/dist/gateways/sadad.d.ts.map +1 -0
- package/dist/gateways/sadad.js +541 -0
- package/dist/gateways/sadad.js.map +1 -0
- package/dist/gateways/zarinpal.d.ts +21 -0
- package/dist/gateways/zarinpal.d.ts.map +1 -0
- package/dist/gateways/zarinpal.js +312 -0
- package/dist/gateways/zarinpal.js.map +1 -0
- package/dist/http.d.ts +31 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +101 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/pay.d.ts +114 -0
- package/dist/pay.d.ts.map +1 -0
- package/dist/pay.js +427 -0
- package/dist/pay.js.map +1 -0
- package/dist/report.d.ts +71 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +106 -0
- package/dist/report.js.map +1 -0
- package/dist/store.d.ts +420 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +68 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +110 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +34 -4
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import type { CheckoutRedirect } from "./types.js";
|
|
2
|
+
export type PaymentStatus = "pending" | "completed" | "failed" | "cancelled" | "expired";
|
|
3
|
+
export type PaymentEnvironment = "live" | "test";
|
|
4
|
+
export type InstallmentInfo = {
|
|
5
|
+
/** Gateway purchase type, e.g. `BNPL` or `CREDIT`. */
|
|
6
|
+
purchaseType: string;
|
|
7
|
+
count: number | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* One payment attempt as the service stores it. A customer retrying the same
|
|
11
|
+
* order creates a new record (a new `reference` and `attempt`), never a
|
|
12
|
+
* mutation of a failed one.
|
|
13
|
+
*/
|
|
14
|
+
export type PaymentRecord = {
|
|
15
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
16
|
+
reference: string;
|
|
17
|
+
/** The service's own order id. */
|
|
18
|
+
orderId: string;
|
|
19
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
20
|
+
attempt: number;
|
|
21
|
+
gateway: string;
|
|
22
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
23
|
+
gatewayOrderId: string;
|
|
24
|
+
/** Whole Rials as a digit string. */
|
|
25
|
+
amount: string;
|
|
26
|
+
currency: "IRR";
|
|
27
|
+
description: string;
|
|
28
|
+
status: PaymentStatus;
|
|
29
|
+
environment: PaymentEnvironment;
|
|
30
|
+
returnUrl: string | null;
|
|
31
|
+
customerMobile: string | null;
|
|
32
|
+
metadata: Record<string, unknown>;
|
|
33
|
+
providerSessionId: string | null;
|
|
34
|
+
providerReference: string | null;
|
|
35
|
+
traceNumber: string | null;
|
|
36
|
+
maskedCardNumber: string | null;
|
|
37
|
+
resultCode: number | null;
|
|
38
|
+
resultText: string | null;
|
|
39
|
+
installment: InstallmentInfo | null;
|
|
40
|
+
redirect: CheckoutRedirect | null;
|
|
41
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
42
|
+
callbackPayload: Record<string, unknown> | null;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
expiresAt: Date | null;
|
|
45
|
+
callbackReceivedAt: Date | null;
|
|
46
|
+
completedAt: Date | null;
|
|
47
|
+
failedAt: Date | null;
|
|
48
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
49
|
+
reportedStatus: PaymentStatus | null;
|
|
50
|
+
reportedAt: Date | null;
|
|
51
|
+
};
|
|
52
|
+
export type PaymentPatch = Partial<Omit<PaymentRecord, "reference">>;
|
|
53
|
+
/**
|
|
54
|
+
* Persistence the host application provides. Everything the package needs is
|
|
55
|
+
* a handful of lookups and one compare-and-set, so it maps onto any SQL or
|
|
56
|
+
* document database. `MemoryPaymentStore` is the reference implementation.
|
|
57
|
+
*/
|
|
58
|
+
export interface PaymentStore {
|
|
59
|
+
/** Returns the next digits-only order number for `gateway`. */
|
|
60
|
+
nextGatewayOrderId(gateway: string): Promise<string>;
|
|
61
|
+
insert(record: PaymentRecord): Promise<PaymentRecord>;
|
|
62
|
+
findByReference(reference: string): Promise<PaymentRecord | null>;
|
|
63
|
+
/** Attempts for one order, oldest first. */
|
|
64
|
+
listByOrderId(orderId: string): Promise<PaymentRecord[]>;
|
|
65
|
+
findByGatewayOrderId(gateway: string, gatewayOrderId: string): Promise<PaymentRecord | null>;
|
|
66
|
+
findBySessionId(gateway: string, sessionId: string): Promise<PaymentRecord | null>;
|
|
67
|
+
/** Unconditional patch of fields that do not change `status`. */
|
|
68
|
+
update(reference: string, patch: PaymentPatch): Promise<PaymentRecord>;
|
|
69
|
+
/**
|
|
70
|
+
* Applies `patch` only while the stored status equals `from`. Returns the
|
|
71
|
+
* updated record, or `null` when another request already moved it. This is
|
|
72
|
+
* what keeps a double callback from completing a payment twice.
|
|
73
|
+
*/
|
|
74
|
+
transition(reference: string, from: PaymentStatus, patch: PaymentPatch & {
|
|
75
|
+
status: PaymentStatus;
|
|
76
|
+
}): Promise<PaymentRecord | null>;
|
|
77
|
+
/** Pending payments created before `before`, oldest first. */
|
|
78
|
+
listPending(before: Date, limit: number): Promise<PaymentRecord[]>;
|
|
79
|
+
/** Records whose `status` differs from `reportedStatus`. */
|
|
80
|
+
listUnreported(limit: number): Promise<PaymentRecord[]>;
|
|
81
|
+
}
|
|
82
|
+
/** In-process store for tests and local development. Not for production. */
|
|
83
|
+
export declare class MemoryPaymentStore implements PaymentStore {
|
|
84
|
+
private readonly records;
|
|
85
|
+
private counter;
|
|
86
|
+
nextGatewayOrderId(): Promise<string>;
|
|
87
|
+
insert(record: PaymentRecord): Promise<{
|
|
88
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
89
|
+
reference: string;
|
|
90
|
+
/** The service's own order id. */
|
|
91
|
+
orderId: string;
|
|
92
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
93
|
+
attempt: number;
|
|
94
|
+
gateway: string;
|
|
95
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
96
|
+
gatewayOrderId: string;
|
|
97
|
+
/** Whole Rials as a digit string. */
|
|
98
|
+
amount: string;
|
|
99
|
+
currency: "IRR";
|
|
100
|
+
description: string;
|
|
101
|
+
status: PaymentStatus;
|
|
102
|
+
environment: PaymentEnvironment;
|
|
103
|
+
returnUrl: string | null;
|
|
104
|
+
customerMobile: string | null;
|
|
105
|
+
metadata: Record<string, unknown>;
|
|
106
|
+
providerSessionId: string | null;
|
|
107
|
+
providerReference: string | null;
|
|
108
|
+
traceNumber: string | null;
|
|
109
|
+
maskedCardNumber: string | null;
|
|
110
|
+
resultCode: number | null;
|
|
111
|
+
resultText: string | null;
|
|
112
|
+
installment: InstallmentInfo | null;
|
|
113
|
+
redirect: CheckoutRedirect | null;
|
|
114
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
115
|
+
callbackPayload: Record<string, unknown> | null;
|
|
116
|
+
createdAt: Date;
|
|
117
|
+
expiresAt: Date | null;
|
|
118
|
+
callbackReceivedAt: Date | null;
|
|
119
|
+
completedAt: Date | null;
|
|
120
|
+
failedAt: Date | null;
|
|
121
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
122
|
+
reportedStatus: PaymentStatus | null;
|
|
123
|
+
reportedAt: Date | null;
|
|
124
|
+
}>;
|
|
125
|
+
findByReference(reference: string): Promise<{
|
|
126
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
127
|
+
reference: string;
|
|
128
|
+
/** The service's own order id. */
|
|
129
|
+
orderId: string;
|
|
130
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
131
|
+
attempt: number;
|
|
132
|
+
gateway: string;
|
|
133
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
134
|
+
gatewayOrderId: string;
|
|
135
|
+
/** Whole Rials as a digit string. */
|
|
136
|
+
amount: string;
|
|
137
|
+
currency: "IRR";
|
|
138
|
+
description: string;
|
|
139
|
+
status: PaymentStatus;
|
|
140
|
+
environment: PaymentEnvironment;
|
|
141
|
+
returnUrl: string | null;
|
|
142
|
+
customerMobile: string | null;
|
|
143
|
+
metadata: Record<string, unknown>;
|
|
144
|
+
providerSessionId: string | null;
|
|
145
|
+
providerReference: string | null;
|
|
146
|
+
traceNumber: string | null;
|
|
147
|
+
maskedCardNumber: string | null;
|
|
148
|
+
resultCode: number | null;
|
|
149
|
+
resultText: string | null;
|
|
150
|
+
installment: InstallmentInfo | null;
|
|
151
|
+
redirect: CheckoutRedirect | null;
|
|
152
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
153
|
+
callbackPayload: Record<string, unknown> | null;
|
|
154
|
+
createdAt: Date;
|
|
155
|
+
expiresAt: Date | null;
|
|
156
|
+
callbackReceivedAt: Date | null;
|
|
157
|
+
completedAt: Date | null;
|
|
158
|
+
failedAt: Date | null;
|
|
159
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
160
|
+
reportedStatus: PaymentStatus | null;
|
|
161
|
+
reportedAt: Date | null;
|
|
162
|
+
} | null>;
|
|
163
|
+
listByOrderId(orderId: string): Promise<{
|
|
164
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
165
|
+
reference: string;
|
|
166
|
+
/** The service's own order id. */
|
|
167
|
+
orderId: string;
|
|
168
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
169
|
+
attempt: number;
|
|
170
|
+
gateway: string;
|
|
171
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
172
|
+
gatewayOrderId: string;
|
|
173
|
+
/** Whole Rials as a digit string. */
|
|
174
|
+
amount: string;
|
|
175
|
+
currency: "IRR";
|
|
176
|
+
description: string;
|
|
177
|
+
status: PaymentStatus;
|
|
178
|
+
environment: PaymentEnvironment;
|
|
179
|
+
returnUrl: string | null;
|
|
180
|
+
customerMobile: string | null;
|
|
181
|
+
metadata: Record<string, unknown>;
|
|
182
|
+
providerSessionId: string | null;
|
|
183
|
+
providerReference: string | null;
|
|
184
|
+
traceNumber: string | null;
|
|
185
|
+
maskedCardNumber: string | null;
|
|
186
|
+
resultCode: number | null;
|
|
187
|
+
resultText: string | null;
|
|
188
|
+
installment: InstallmentInfo | null;
|
|
189
|
+
redirect: CheckoutRedirect | null;
|
|
190
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
191
|
+
callbackPayload: Record<string, unknown> | null;
|
|
192
|
+
createdAt: Date;
|
|
193
|
+
expiresAt: Date | null;
|
|
194
|
+
callbackReceivedAt: Date | null;
|
|
195
|
+
completedAt: Date | null;
|
|
196
|
+
failedAt: Date | null;
|
|
197
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
198
|
+
reportedStatus: PaymentStatus | null;
|
|
199
|
+
reportedAt: Date | null;
|
|
200
|
+
}[]>;
|
|
201
|
+
findByGatewayOrderId(gateway: string, gatewayOrderId: string): Promise<{
|
|
202
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
203
|
+
reference: string;
|
|
204
|
+
/** The service's own order id. */
|
|
205
|
+
orderId: string;
|
|
206
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
207
|
+
attempt: number;
|
|
208
|
+
gateway: string;
|
|
209
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
210
|
+
gatewayOrderId: string;
|
|
211
|
+
/** Whole Rials as a digit string. */
|
|
212
|
+
amount: string;
|
|
213
|
+
currency: "IRR";
|
|
214
|
+
description: string;
|
|
215
|
+
status: PaymentStatus;
|
|
216
|
+
environment: PaymentEnvironment;
|
|
217
|
+
returnUrl: string | null;
|
|
218
|
+
customerMobile: string | null;
|
|
219
|
+
metadata: Record<string, unknown>;
|
|
220
|
+
providerSessionId: string | null;
|
|
221
|
+
providerReference: string | null;
|
|
222
|
+
traceNumber: string | null;
|
|
223
|
+
maskedCardNumber: string | null;
|
|
224
|
+
resultCode: number | null;
|
|
225
|
+
resultText: string | null;
|
|
226
|
+
installment: InstallmentInfo | null;
|
|
227
|
+
redirect: CheckoutRedirect | null;
|
|
228
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
229
|
+
callbackPayload: Record<string, unknown> | null;
|
|
230
|
+
createdAt: Date;
|
|
231
|
+
expiresAt: Date | null;
|
|
232
|
+
callbackReceivedAt: Date | null;
|
|
233
|
+
completedAt: Date | null;
|
|
234
|
+
failedAt: Date | null;
|
|
235
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
236
|
+
reportedStatus: PaymentStatus | null;
|
|
237
|
+
reportedAt: Date | null;
|
|
238
|
+
} | null>;
|
|
239
|
+
findBySessionId(gateway: string, sessionId: string): Promise<{
|
|
240
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
241
|
+
reference: string;
|
|
242
|
+
/** The service's own order id. */
|
|
243
|
+
orderId: string;
|
|
244
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
245
|
+
attempt: number;
|
|
246
|
+
gateway: string;
|
|
247
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
248
|
+
gatewayOrderId: string;
|
|
249
|
+
/** Whole Rials as a digit string. */
|
|
250
|
+
amount: string;
|
|
251
|
+
currency: "IRR";
|
|
252
|
+
description: string;
|
|
253
|
+
status: PaymentStatus;
|
|
254
|
+
environment: PaymentEnvironment;
|
|
255
|
+
returnUrl: string | null;
|
|
256
|
+
customerMobile: string | null;
|
|
257
|
+
metadata: Record<string, unknown>;
|
|
258
|
+
providerSessionId: string | null;
|
|
259
|
+
providerReference: string | null;
|
|
260
|
+
traceNumber: string | null;
|
|
261
|
+
maskedCardNumber: string | null;
|
|
262
|
+
resultCode: number | null;
|
|
263
|
+
resultText: string | null;
|
|
264
|
+
installment: InstallmentInfo | null;
|
|
265
|
+
redirect: CheckoutRedirect | null;
|
|
266
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
267
|
+
callbackPayload: Record<string, unknown> | null;
|
|
268
|
+
createdAt: Date;
|
|
269
|
+
expiresAt: Date | null;
|
|
270
|
+
callbackReceivedAt: Date | null;
|
|
271
|
+
completedAt: Date | null;
|
|
272
|
+
failedAt: Date | null;
|
|
273
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
274
|
+
reportedStatus: PaymentStatus | null;
|
|
275
|
+
reportedAt: Date | null;
|
|
276
|
+
} | null>;
|
|
277
|
+
update(reference: string, patch: PaymentPatch): Promise<{
|
|
278
|
+
installment: InstallmentInfo | null;
|
|
279
|
+
amount: string;
|
|
280
|
+
providerSessionId: string | null;
|
|
281
|
+
providerReference: string | null;
|
|
282
|
+
resultCode: number | null;
|
|
283
|
+
redirect: CheckoutRedirect | null;
|
|
284
|
+
expiresAt: Date | null;
|
|
285
|
+
status: PaymentStatus;
|
|
286
|
+
traceNumber: string | null;
|
|
287
|
+
maskedCardNumber: string | null;
|
|
288
|
+
metadata: Record<string, unknown>;
|
|
289
|
+
orderId: string;
|
|
290
|
+
attempt: number;
|
|
291
|
+
gateway: string;
|
|
292
|
+
gatewayOrderId: string;
|
|
293
|
+
currency: "IRR";
|
|
294
|
+
description: string;
|
|
295
|
+
environment: PaymentEnvironment;
|
|
296
|
+
returnUrl: string | null;
|
|
297
|
+
customerMobile: string | null;
|
|
298
|
+
resultText: string | null;
|
|
299
|
+
callbackPayload: Record<string, unknown> | null;
|
|
300
|
+
createdAt: Date;
|
|
301
|
+
callbackReceivedAt: Date | null;
|
|
302
|
+
completedAt: Date | null;
|
|
303
|
+
failedAt: Date | null;
|
|
304
|
+
reportedStatus: PaymentStatus | null;
|
|
305
|
+
reportedAt: Date | null;
|
|
306
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
307
|
+
reference: string;
|
|
308
|
+
}>;
|
|
309
|
+
transition(reference: string, from: PaymentStatus, patch: PaymentPatch & {
|
|
310
|
+
status: PaymentStatus;
|
|
311
|
+
}): Promise<{
|
|
312
|
+
installment: InstallmentInfo | null;
|
|
313
|
+
amount: string;
|
|
314
|
+
providerSessionId: string | null;
|
|
315
|
+
providerReference: string | null;
|
|
316
|
+
resultCode: number | null;
|
|
317
|
+
redirect: CheckoutRedirect | null;
|
|
318
|
+
expiresAt: Date | null;
|
|
319
|
+
status: "failed" | "pending" | "completed" | "cancelled" | "expired";
|
|
320
|
+
traceNumber: string | null;
|
|
321
|
+
maskedCardNumber: string | null;
|
|
322
|
+
metadata: Record<string, unknown>;
|
|
323
|
+
orderId: string;
|
|
324
|
+
attempt: number;
|
|
325
|
+
gateway: string;
|
|
326
|
+
gatewayOrderId: string;
|
|
327
|
+
currency: "IRR";
|
|
328
|
+
description: string;
|
|
329
|
+
environment: PaymentEnvironment;
|
|
330
|
+
returnUrl: string | null;
|
|
331
|
+
customerMobile: string | null;
|
|
332
|
+
resultText: string | null;
|
|
333
|
+
callbackPayload: Record<string, unknown> | null;
|
|
334
|
+
createdAt: Date;
|
|
335
|
+
callbackReceivedAt: Date | null;
|
|
336
|
+
completedAt: Date | null;
|
|
337
|
+
failedAt: Date | null;
|
|
338
|
+
reportedStatus: PaymentStatus | null;
|
|
339
|
+
reportedAt: Date | null;
|
|
340
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
341
|
+
reference: string;
|
|
342
|
+
} | null>;
|
|
343
|
+
listPending(before: Date, limit: number): Promise<{
|
|
344
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
345
|
+
reference: string;
|
|
346
|
+
/** The service's own order id. */
|
|
347
|
+
orderId: string;
|
|
348
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
349
|
+
attempt: number;
|
|
350
|
+
gateway: string;
|
|
351
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
352
|
+
gatewayOrderId: string;
|
|
353
|
+
/** Whole Rials as a digit string. */
|
|
354
|
+
amount: string;
|
|
355
|
+
currency: "IRR";
|
|
356
|
+
description: string;
|
|
357
|
+
status: PaymentStatus;
|
|
358
|
+
environment: PaymentEnvironment;
|
|
359
|
+
returnUrl: string | null;
|
|
360
|
+
customerMobile: string | null;
|
|
361
|
+
metadata: Record<string, unknown>;
|
|
362
|
+
providerSessionId: string | null;
|
|
363
|
+
providerReference: string | null;
|
|
364
|
+
traceNumber: string | null;
|
|
365
|
+
maskedCardNumber: string | null;
|
|
366
|
+
resultCode: number | null;
|
|
367
|
+
resultText: string | null;
|
|
368
|
+
installment: InstallmentInfo | null;
|
|
369
|
+
redirect: CheckoutRedirect | null;
|
|
370
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
371
|
+
callbackPayload: Record<string, unknown> | null;
|
|
372
|
+
createdAt: Date;
|
|
373
|
+
expiresAt: Date | null;
|
|
374
|
+
callbackReceivedAt: Date | null;
|
|
375
|
+
completedAt: Date | null;
|
|
376
|
+
failedAt: Date | null;
|
|
377
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
378
|
+
reportedStatus: PaymentStatus | null;
|
|
379
|
+
reportedAt: Date | null;
|
|
380
|
+
}[]>;
|
|
381
|
+
listUnreported(limit: number): Promise<{
|
|
382
|
+
/** Unique id of this attempt, e.g. `PAY-3F9A…`. */
|
|
383
|
+
reference: string;
|
|
384
|
+
/** The service's own order id. */
|
|
385
|
+
orderId: string;
|
|
386
|
+
/** 1 for the first attempt on `orderId`, then 2, 3, … */
|
|
387
|
+
attempt: number;
|
|
388
|
+
gateway: string;
|
|
389
|
+
/** Digits-only number sent to the gateway; unique per gateway. */
|
|
390
|
+
gatewayOrderId: string;
|
|
391
|
+
/** Whole Rials as a digit string. */
|
|
392
|
+
amount: string;
|
|
393
|
+
currency: "IRR";
|
|
394
|
+
description: string;
|
|
395
|
+
status: PaymentStatus;
|
|
396
|
+
environment: PaymentEnvironment;
|
|
397
|
+
returnUrl: string | null;
|
|
398
|
+
customerMobile: string | null;
|
|
399
|
+
metadata: Record<string, unknown>;
|
|
400
|
+
providerSessionId: string | null;
|
|
401
|
+
providerReference: string | null;
|
|
402
|
+
traceNumber: string | null;
|
|
403
|
+
maskedCardNumber: string | null;
|
|
404
|
+
resultCode: number | null;
|
|
405
|
+
resultText: string | null;
|
|
406
|
+
installment: InstallmentInfo | null;
|
|
407
|
+
redirect: CheckoutRedirect | null;
|
|
408
|
+
/** Sanitised gateway callback body, kept for audit and retried verifies. */
|
|
409
|
+
callbackPayload: Record<string, unknown> | null;
|
|
410
|
+
createdAt: Date;
|
|
411
|
+
expiresAt: Date | null;
|
|
412
|
+
callbackReceivedAt: Date | null;
|
|
413
|
+
completedAt: Date | null;
|
|
414
|
+
failedAt: Date | null;
|
|
415
|
+
/** Last status OBH acknowledged. `null` until the first successful report. */
|
|
416
|
+
reportedStatus: PaymentStatus | null;
|
|
417
|
+
reportedAt: Date | null;
|
|
418
|
+
}[]>;
|
|
419
|
+
}
|
|
420
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,WAAW,GACX,QAAQ,GACR,WAAW,GACX,SAAS,CAAA;AAEb,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAA;AAEhD,MAAM,MAAM,eAAe,GAAG;IAC5B,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAA;IACjB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,KAAK,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,aAAa,CAAA;IACrB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAEjC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,gBAAgB,EAAE,MAAM,GAAG,I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M,GAAG,IAAI;2BACb,MAAM,GAAG,IAAI;qBACnB,MAAM,GAAG,IAAI;0BACR,MAAM,GAAG,IAAI;oBACnB,MAAM,GAAG,IAAI;oBACb,MAAM,GAAG,IAAI;qBACZ,eAAe,GAAG,IAAI;kBACzB,gBAAgB,GAAG,IAAI;QACjC,4EAA4E;yBAC3D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;mBAEpC,IAAI;mBACJ,IAAI,GAAG,IAAI;4BACF,IAAI,GAAG,IAAI;qBAClB,IAAI,GAAG,IAAI;kBACd,IAAI,GAAG,IAAI;QAErB,8EAA8E;wBAC9D,aAAa,GAAG,IAAI;oBACxB,IAAI,GAAG,IAAI;;CAoIxB"}
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** In-process store for tests and local development. Not for production. */
|
|
2
|
+
export class MemoryPaymentStore {
|
|
3
|
+
records = new Map();
|
|
4
|
+
counter = 0;
|
|
5
|
+
async nextGatewayOrderId() {
|
|
6
|
+
this.counter += 1;
|
|
7
|
+
return String(Date.now()) + String(this.counter).padStart(3, "0");
|
|
8
|
+
}
|
|
9
|
+
async insert(record) {
|
|
10
|
+
if (this.records.has(record.reference)) {
|
|
11
|
+
throw new Error(`Payment ${record.reference} already exists.`);
|
|
12
|
+
}
|
|
13
|
+
this.records.set(record.reference, { ...record });
|
|
14
|
+
return { ...record };
|
|
15
|
+
}
|
|
16
|
+
async findByReference(reference) {
|
|
17
|
+
const record = this.records.get(reference);
|
|
18
|
+
return record ? { ...record } : null;
|
|
19
|
+
}
|
|
20
|
+
async listByOrderId(orderId) {
|
|
21
|
+
return [...this.records.values()]
|
|
22
|
+
.filter((record) => record.orderId === orderId)
|
|
23
|
+
.sort((a, b) => a.attempt - b.attempt)
|
|
24
|
+
.map((record) => ({ ...record }));
|
|
25
|
+
}
|
|
26
|
+
async findByGatewayOrderId(gateway, gatewayOrderId) {
|
|
27
|
+
const found = [...this.records.values()].find((record) => record.gateway === gateway && record.gatewayOrderId === gatewayOrderId);
|
|
28
|
+
return found ? { ...found } : null;
|
|
29
|
+
}
|
|
30
|
+
async findBySessionId(gateway, sessionId) {
|
|
31
|
+
const found = [...this.records.values()].find((record) => record.gateway === gateway && record.providerSessionId === sessionId);
|
|
32
|
+
return found ? { ...found } : null;
|
|
33
|
+
}
|
|
34
|
+
async update(reference, patch) {
|
|
35
|
+
const current = this.records.get(reference);
|
|
36
|
+
if (!current) {
|
|
37
|
+
throw new Error(`Payment ${reference} was not found.`);
|
|
38
|
+
}
|
|
39
|
+
const next = { ...current, ...patch };
|
|
40
|
+
this.records.set(reference, next);
|
|
41
|
+
return { ...next };
|
|
42
|
+
}
|
|
43
|
+
async transition(reference, from, patch) {
|
|
44
|
+
const current = this.records.get(reference);
|
|
45
|
+
if (!current || current.status !== from) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const next = { ...current, ...patch };
|
|
49
|
+
this.records.set(reference, next);
|
|
50
|
+
return { ...next };
|
|
51
|
+
}
|
|
52
|
+
async listPending(before, limit) {
|
|
53
|
+
return [...this.records.values()]
|
|
54
|
+
.filter((record) => record.status === "pending" &&
|
|
55
|
+
record.createdAt.getTime() < before.getTime())
|
|
56
|
+
.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())
|
|
57
|
+
.slice(0, limit)
|
|
58
|
+
.map((record) => ({ ...record }));
|
|
59
|
+
}
|
|
60
|
+
async listUnreported(limit) {
|
|
61
|
+
return [...this.records.values()]
|
|
62
|
+
.filter((record) => record.status !== record.reportedStatus)
|
|
63
|
+
.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())
|
|
64
|
+
.slice(0, limit)
|
|
65
|
+
.map((record) => ({ ...record }));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"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I,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;aAC7D,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;aACf,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway-level types. An adapter talks to one bank gateway; it knows nothing
|
|
3
|
+
* about storage or OBH. The orchestrator in `pay.ts` combines adapters with a
|
|
4
|
+
* `PaymentStore` and the finance reporter.
|
|
5
|
+
*/
|
|
6
|
+
export type ProviderPaymentStatus = "COMPLETED" | "FAILED" | "PENDING";
|
|
7
|
+
export type CheckoutSessionInput = {
|
|
8
|
+
paymentReference: string;
|
|
9
|
+
/** Digits-only order number sent to the gateway (unique per terminal). */
|
|
10
|
+
gatewayOrderId: string;
|
|
11
|
+
serviceSlug: string;
|
|
12
|
+
/** Whole Rials, as a digit string. */
|
|
13
|
+
amount: string;
|
|
14
|
+
currency: "IRR";
|
|
15
|
+
description: string;
|
|
16
|
+
returnUrl: string | null;
|
|
17
|
+
/** Public URL the gateway sends the customer back to. */
|
|
18
|
+
callbackUrl: string;
|
|
19
|
+
metadata: Record<string, unknown>;
|
|
20
|
+
/** Customer mobile number (`09xxxxxxxxx`). Required by Digipay. */
|
|
21
|
+
customerMobile?: string | null;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* How the customer's browser gets to the bank. Most gateways take a plain
|
|
25
|
+
* redirect; Mellat (Behpardakht) needs an auto-submitted POST form.
|
|
26
|
+
*/
|
|
27
|
+
export type CheckoutRedirect = {
|
|
28
|
+
method: "GET";
|
|
29
|
+
url: string;
|
|
30
|
+
} | {
|
|
31
|
+
method: "POST";
|
|
32
|
+
url: string;
|
|
33
|
+
fields: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
export type CheckoutSession = {
|
|
36
|
+
providerSessionId: string;
|
|
37
|
+
providerReference: string | null;
|
|
38
|
+
checkoutUrl: string | null;
|
|
39
|
+
/** Set when the redirect is not a plain GET of `checkoutUrl`. */
|
|
40
|
+
redirect?: CheckoutRedirect;
|
|
41
|
+
expiresAt: Date;
|
|
42
|
+
resultCode: number;
|
|
43
|
+
resultMessage: string;
|
|
44
|
+
};
|
|
45
|
+
export type VerifyPaymentInput = {
|
|
46
|
+
providerSessionId: string | null;
|
|
47
|
+
providerReference: string | null;
|
|
48
|
+
gatewayOrderId?: string;
|
|
49
|
+
expectedAmount?: string;
|
|
50
|
+
payload?: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
export type VerifyPaymentResult = {
|
|
53
|
+
status: ProviderPaymentStatus;
|
|
54
|
+
providerReference: string;
|
|
55
|
+
traceNumber: string | null;
|
|
56
|
+
maskedCardNumber: string | null;
|
|
57
|
+
resultCode: number;
|
|
58
|
+
resultMessage: string;
|
|
59
|
+
verifiedAmount: string | null;
|
|
60
|
+
verifiedOrderId: string | null;
|
|
61
|
+
verifiedAt: Date | null;
|
|
62
|
+
failureReason: string | null;
|
|
63
|
+
metadata: Record<string, unknown>;
|
|
64
|
+
};
|
|
65
|
+
export type PaymentGatewayKind = "card" | "installment";
|
|
66
|
+
/** Public description of a gateway. Credentials never appear here. */
|
|
67
|
+
export type PaymentGatewayDescriptor = {
|
|
68
|
+
code: string;
|
|
69
|
+
name: string;
|
|
70
|
+
/** Persian label suitable for a checkout page. */
|
|
71
|
+
displayName: string;
|
|
72
|
+
description: string;
|
|
73
|
+
kind: PaymentGatewayKind;
|
|
74
|
+
requiresCustomerMobile: boolean;
|
|
75
|
+
minAmount: string | null;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* What an adapter learned from the bank's callback request, before any
|
|
79
|
+
* server-to-server verification.
|
|
80
|
+
*/
|
|
81
|
+
export type ParsedCallback = {
|
|
82
|
+
/** Token / authority / RefId the gateway issued when the session opened. */
|
|
83
|
+
sessionId: string | null;
|
|
84
|
+
/** Numeric order number echoed back by the gateway. */
|
|
85
|
+
gatewayOrderId: string | null;
|
|
86
|
+
/** `verify` when the bank reports success; `failed` for cancel/decline. */
|
|
87
|
+
outcome: "verify" | "failed";
|
|
88
|
+
resultCode: number;
|
|
89
|
+
resultText: string;
|
|
90
|
+
providerReference: string | null;
|
|
91
|
+
maskedCardNumber: string | null;
|
|
92
|
+
/** Sanitised copy of the callback body, kept for audit and re-verify. */
|
|
93
|
+
payload: Record<string, unknown>;
|
|
94
|
+
};
|
|
95
|
+
export interface PaymentGatewayAdapter {
|
|
96
|
+
readonly code: string;
|
|
97
|
+
readonly descriptor: PaymentGatewayDescriptor;
|
|
98
|
+
/** True when credentials are present in the environment. */
|
|
99
|
+
isConfigured(): boolean;
|
|
100
|
+
createCheckoutSession(input: CheckoutSessionInput): Promise<CheckoutSession>;
|
|
101
|
+
verifyPayment(input: VerifyPaymentInput): Promise<VerifyPaymentResult>;
|
|
102
|
+
/** Reads the callback request body or query into a normalized shape. */
|
|
103
|
+
parseCallback(payload: Record<string, string | null | undefined>): ParsedCallback;
|
|
104
|
+
}
|
|
105
|
+
export declare class PaymentProviderError extends Error {
|
|
106
|
+
code: string;
|
|
107
|
+
resultCode?: number;
|
|
108
|
+
constructor(code: string, message: string, resultCode?: number);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEtE,MAAM,MAAM,oBAAoB,GAAG;IACjC,gBAAgB,EAAE,MAAM,CAAA;IACxB,0EAA0E;IAC1E,cAA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AAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAA;IAC7C,4DAA4D;IAC5D,YAAY,IAAI,OAAO,CAAA;IACvB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC5E,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACtE,wEAAwE;IACxE,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,cAAc,CAAA;CAClF;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;gBAEP,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAM/D"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway-level types. An adapter talks to one bank gateway; it knows nothing
|
|
3
|
+
* about storage or OBH. The orchestrator in `pay.ts` combines adapters with a
|
|
4
|
+
* `PaymentStore` and the finance reporter.
|
|
5
|
+
*/
|
|
6
|
+
export class PaymentProviderError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
resultCode;
|
|
9
|
+
constructor(code, message, resultCode) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "PaymentProviderError";
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.resultCode = resultCode;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0GH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,CAAQ;IACZ,UAAU,CAAS;IAEnB,YAAY,IAAY,EAAE,OAAe,EAAE,UAAmB;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF"}
|