@tineon/t9n 0.1.9 → 0.2.1

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 +0 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -185,7 +185,6 @@ export class T9nCheckout {
185
185
  }
186
186
  async confirmPayment() {
187
187
  this.hasAttemptedConfirm = true;
188
- console.log("[T9N] confirmPayment: start", { sessionId: this.sessionId });
189
188
  this.modal?.setConfirmPending(true);
190
189
  try {
191
190
  const res = await this.fetchWithTimeout(`${this.getApiBaseUrl()}/api/merchant/checkout/sessions/${this.sessionId}/confirm-payment`, {
@@ -197,7 +196,6 @@ export class T9nCheckout {
197
196
  body: "{}",
198
197
  });
199
198
  if (!res.ok) {
200
- console.log("[T9N] confirmPayment: non-ok response", { status: res.status, sessionId: this.sessionId });
201
199
  this.modal?.setConfirmPending(false);
202
200
  this.modal?.showResult("failed", "Verification failed. Please try again.");
203
201
  this.lastResultFailed = true;
@@ -209,10 +207,8 @@ export class T9nCheckout {
209
207
  let payload = {};
210
208
  try {
211
209
  payload = (await res.json());
212
- console.log("[T9N] confirmPayment: response payload", { payload, sessionId: this.sessionId });
213
210
  }
214
211
  catch (_) {
215
- console.log("[T9N] confirmPayment: invalid json response", { sessionId: this.sessionId });
216
212
  this.modal?.setConfirmPending(false);
217
213
  this.modal?.showResult("failed", "Verification failed. Please try again.");
218
214
  this.lastResultFailed = true;
@@ -223,10 +219,8 @@ export class T9nCheckout {
223
219
  }
224
220
  this.modal?.setConfirmPending(false);
225
221
  const normalized = this.normalizeStatus(payload.status || "");
226
- console.log("[T9N] confirmPayment: normalized status", { status: payload.status, normalized, sessionId: this.sessionId });
227
222
  this.emitStatus(normalized);
228
223
  if (normalized === "settled") {
229
- console.log("[T9N] confirmPayment: showing success", { sessionId: this.sessionId });
230
224
  this.modal?.setConfirmLabel("I have made the payment");
231
225
  this.modal?.showResult("success", "Payment received successfully.");
232
226
  this.lastResultFailed = false;
@@ -234,7 +228,6 @@ export class T9nCheckout {
234
228
  return;
235
229
  }
236
230
  if (normalized === "expired") {
237
- console.log("[T9N] confirmPayment: showing expired", { sessionId: this.sessionId });
238
231
  this.modal?.showResult("failed", "This session has expired.");
239
232
  this.lastResultFailed = false;
240
233
  this.emitFailOnce({ sessionId: this.sessionId, error: "checkout expired" });
@@ -242,7 +235,6 @@ export class T9nCheckout {
242
235
  return;
243
236
  }
244
237
  if (normalized === "failed") {
245
- console.log("[T9N] confirmPayment: showing failed", { sessionId: this.sessionId });
246
238
  this.modal?.showResult("failed", "Payment failed. Please try again.");
247
239
  this.lastResultFailed = true;
248
240
  this.modal?.setConfirmLabel("Retry check");
@@ -250,21 +242,18 @@ export class T9nCheckout {
250
242
  return;
251
243
  }
252
244
  if (normalized === "closed") {
253
- console.log("[T9N] confirmPayment: showing closed", { sessionId: this.sessionId });
254
245
  this.modal?.showResult("failed", "Checkout was closed. Please try again.");
255
246
  this.lastResultFailed = true;
256
247
  this.modal?.setConfirmLabel("Retry check");
257
248
  this.emitFailOnce({ sessionId: this.sessionId || undefined, error: "checkout closed" });
258
249
  return;
259
250
  }
260
- console.log("[T9N] confirmPayment: showing no-funds retry", { sessionId: this.sessionId });
261
251
  this.modal?.showResult("failed", "No payment detected yet. Please try again.");
262
252
  this.lastResultFailed = true;
263
253
  this.modal?.setConfirmLabel("Retry check");
264
254
  this.emitFailOnce({ sessionId: this.sessionId || undefined, error: "payment not detected" });
265
255
  }
266
256
  catch (err) {
267
- console.log("[T9N] confirmPayment: error", { error: err?.message || err, sessionId: this.sessionId });
268
257
  this.modal?.setConfirmPending(false);
269
258
  this.modal?.showResult("failed", "Verification failed. Please try again.");
270
259
  this.lastResultFailed = true;
@@ -316,10 +305,8 @@ export class T9nCheckout {
316
305
  const payload = (await res.json());
317
306
  if (payload.status) {
318
307
  const normalized = this.normalizeStatus(payload.status);
319
- console.log("[T9N] poll: status", { status: payload.status, normalized, sessionId: this.sessionId });
320
308
  this.emitStatus(normalized);
321
309
  if (normalized === "settled") {
322
- console.log("[T9N] poll: showing success", { sessionId: this.sessionId });
323
310
  this.modal?.showResult("success", "Payment received successfully.");
324
311
  this.lastResultFailed = false;
325
312
  if (this.intervalId)
@@ -330,7 +317,6 @@ export class T9nCheckout {
330
317
  }
331
318
  if (normalized === "failed") {
332
319
  if (this.hasAttemptedConfirm) {
333
- console.log("[T9N] poll: showing failed", { sessionId: this.sessionId });
334
320
  this.modal?.showResult("failed", "No payment detected yet. Please try again.");
335
321
  this.lastResultFailed = true;
336
322
  this.emitFailOnce({ sessionId: this.sessionId, error: "checkout failed" });
@@ -338,7 +324,6 @@ export class T9nCheckout {
338
324
  }
339
325
  if (normalized === "pending_confirmation" || normalized === "awaiting_payment") {
340
326
  if (this.hasAttemptedConfirm) {
341
- console.log("[T9N] poll: showing pending no-funds", { sessionId: this.sessionId });
342
327
  this.modal?.showResult("failed", "No payment detected yet. Please try again.");
343
328
  this.lastResultFailed = true;
344
329
  this.emitFailOnce({ sessionId: this.sessionId || undefined, error: "payment not detected" });
@@ -346,7 +331,6 @@ export class T9nCheckout {
346
331
  }
347
332
  }
348
333
  if (payload.status === "expired") {
349
- console.log("[T9N] poll: showing expired", { sessionId: this.sessionId });
350
334
  this.modal?.showResult("failed", "This session has expired.");
351
335
  this.lastResultFailed = false;
352
336
  if (this.intervalId)
@@ -533,14 +517,12 @@ export class T9nCheckout {
533
517
  if (this.successNotified)
534
518
  return;
535
519
  this.successNotified = true;
536
- console.log("[T9N] onSuccess", payload);
537
520
  this.cfg.hooks?.onSuccess?.(payload);
538
521
  }
539
522
  emitFailOnce(payload) {
540
523
  if (this.successNotified || this.failureNotified)
541
524
  return;
542
525
  this.failureNotified = true;
543
- console.log("[T9N] onFail", payload);
544
526
  this.cfg.hooks?.onFail?.(payload);
545
527
  }
546
528
  getApiBaseUrl() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tineon/t9n",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",