@wdft/micropayments-sdk 0.0.6 → 0.0.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/package.json +1 -1
  2. package/src/client.ts +11 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wdft/micropayments-sdk",
3
3
  "description": "wdft - we do fintech - micropayments sdk",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/src/client.ts CHANGED
@@ -59,6 +59,10 @@ class Commitment {
59
59
  return this.getStatus() === "resolved";
60
60
  }
61
61
 
62
+ getMessage(): string {
63
+ return this.payload.message || '';
64
+ }
65
+
62
66
  getStatus(): CommitmentStatus {
63
67
  return this.payload.status;
64
68
  }
@@ -345,6 +349,7 @@ export class Client {
345
349
  commitment.startChecking();
346
350
  return on(null, {
347
351
  status: commitment.getStatus(),
352
+ message: commitment.getMessage(),
348
353
  reference_id,
349
354
  commitment_id: commitment.getCommitmentId(),
350
355
  click_url: commitment.getClickUrl(),
@@ -353,6 +358,7 @@ export class Client {
353
358
  .onWaiting((commitment) =>
354
359
  on(null, {
355
360
  status: commitment.getStatus(),
361
+ message: commitment.getMessage(),
356
362
  reference_id,
357
363
  commitment_id: commitment.getCommitmentId(),
358
364
  click_url: commitment.getClickUrl(),
@@ -361,6 +367,7 @@ export class Client {
361
367
  .onDuplicated((commitment) =>
362
368
  on(null, {
363
369
  status: commitment.getStatus(),
370
+ message: commitment.getMessage(),
364
371
  reference_id,
365
372
  commitment_id: commitment.getCommitmentId(),
366
373
  click_url: commitment.getClickUrl(),
@@ -369,6 +376,7 @@ export class Client {
369
376
  .onExpired((commitment) =>
370
377
  on(null, {
371
378
  status: commitment.getStatus(),
379
+ message: commitment.getMessage(),
372
380
  reference_id,
373
381
  commitment_id: commitment.getCommitmentId(),
374
382
  click_url: commitment.getClickUrl(),
@@ -377,6 +385,7 @@ export class Client {
377
385
  .onRejected((commitment) =>
378
386
  on(null, {
379
387
  status: commitment.getStatus(),
388
+ message: commitment.getMessage(),
380
389
  reference_id,
381
390
  commitment_id: commitment.getCommitmentId(),
382
391
  click_url: commitment.getClickUrl(),
@@ -385,6 +394,7 @@ export class Client {
385
394
  .onResolved((commitment) =>
386
395
  on(null, {
387
396
  status: commitment.getStatus(),
397
+ message: commitment.getMessage(),
388
398
  reference_id,
389
399
  commitment_id: commitment.getCommitmentId(),
390
400
  click_url: commitment.getClickUrl(),
@@ -406,6 +416,7 @@ export interface CallbackPayload {
406
416
  status: CommitmentStatus;
407
417
  reference_id: string;
408
418
  commitment_id: string;
419
+ message: string | null;
409
420
  click_url: string;
410
421
  }
411
422