@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.
@@ -58,7 +58,7 @@ interface CheckoutConfirmSuccessImmediate extends CheckoutConfirmGeneric {
58
58
  data: {
59
59
  confirmationId: string;
60
60
  amount: number;
61
- currency: string;
61
+ currency: 'USD' | 'EUR' | 'JPY';
62
62
  customerId?: string;
63
63
  };
64
64
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henrylabs-interview/payments",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",