@tineon/t9n 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -197,11 +197,16 @@ export class T9nCheckout {
197
197
  }
198
198
  const payload = (await res.json());
199
199
  this.modal?.setConfirmPending(false);
200
- this.emitStatus(this.normalizeStatus(payload.status));
201
- if (payload.status === "pending" || payload.status === "processing") {
200
+ const normalized = this.normalizeStatus(payload.status);
201
+ this.emitStatus(normalized);
202
+ if (payload.status === "pending" ||
203
+ payload.status === "processing" ||
204
+ normalized === "pending_confirmation" ||
205
+ normalized === "awaiting_payment") {
202
206
  this.modal?.showResult("failed", "No payment detected yet. Please try again.");
203
207
  this.lastResultFailed = true;
204
208
  this.modal?.setConfirmLabel("Retry check");
209
+ this.emitFailOnce({ sessionId: this.sessionId || undefined, error: "payment not detected" });
205
210
  return;
206
211
  }
207
212
  this.modal?.setConfirmLabel("I have made the payment");
@@ -267,6 +272,13 @@ export class T9nCheckout {
267
272
  this.emitFailOnce({ sessionId: this.sessionId, error: "checkout failed" });
268
273
  }
269
274
  }
275
+ if (normalized === "pending_confirmation" || normalized === "awaiting_payment") {
276
+ if (this.hasAttemptedConfirm) {
277
+ this.modal?.showResult("failed", "No payment detected yet. Please try again.");
278
+ this.lastResultFailed = true;
279
+ this.emitFailOnce({ sessionId: this.sessionId || undefined, error: "payment not detected" });
280
+ }
281
+ }
270
282
  }
271
283
  if (payload.status === "expired") {
272
284
  this.modal?.showResult("failed", "This session has expired.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tineon/t9n",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",