@henrylabs-interview/payments 0.2.16 → 0.2.18
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.
|
@@ -18,6 +18,13 @@ export class Checkout {
|
|
|
18
18
|
const hashId = await this.buildHistoryHash(params);
|
|
19
19
|
const history = await readHistory();
|
|
20
20
|
const sameRecords = history.filter((v) => v.id === hashId);
|
|
21
|
+
// Add to history records
|
|
22
|
+
await writeHistory({
|
|
23
|
+
id: hashId,
|
|
24
|
+
amount: params.amount,
|
|
25
|
+
currency: params.currency,
|
|
26
|
+
customerId: params.customerId ?? null,
|
|
27
|
+
});
|
|
21
28
|
// ---------------------------------------
|
|
22
29
|
// Phase 1: Validation
|
|
23
30
|
// ---------------------------------------
|
|
@@ -30,13 +37,6 @@ export class Checkout {
|
|
|
30
37
|
// Phase 3: Webhook Scheduling
|
|
31
38
|
// ---------------------------------------
|
|
32
39
|
this.scheduleCreateWebhook(hashId, response);
|
|
33
|
-
// Add to history records
|
|
34
|
-
await writeHistory({
|
|
35
|
-
id: hashId,
|
|
36
|
-
amount: params.amount,
|
|
37
|
-
currency: params.currency,
|
|
38
|
-
customerId: params.customerId ?? null,
|
|
39
|
-
});
|
|
40
40
|
// Simulate API latency
|
|
41
41
|
await sleep(Math.random() * 2000);
|
|
42
42
|
return response;
|