@esolve/ng-esolve-connect 0.60.0 → 0.62.0

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.
@@ -1467,12 +1467,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImpor
1467
1467
  }] });
1468
1468
 
1469
1469
  class EsolveLinkedAsset {
1470
+ /**
1471
+ * Shortcut to `getImagePath()`
1472
+ */
1473
+ get image_src() {
1474
+ return this.getImagePath();
1475
+ }
1470
1476
  constructor(record) {
1477
+ this.image_name = '';
1471
1478
  this.id = +record.id;
1472
1479
  this.name = record.name;
1473
1480
  this.type = record.type;
1474
1481
  this.description = record.description;
1475
1482
  this.src = record.src;
1483
+ this.image_name = record.image_name ?? '';
1484
+ }
1485
+ /**
1486
+ * Retrieve image path
1487
+ *
1488
+ * @returns Image path on CDN, else empty string if no image exists
1489
+ */
1490
+ getImagePath() {
1491
+ if (this.image_name !== '') {
1492
+ return `/images/documents/${this.image_name}`;
1493
+ }
1494
+ return '';
1476
1495
  }
1477
1496
  }
1478
1497
 
@@ -4572,6 +4591,36 @@ class EsolveAccountService {
4572
4591
  return throwError(() => error);
4573
4592
  }
4574
4593
  }
4594
+ genrateStatementDownloadLink(clients_id) {
4595
+ try {
4596
+ this.loginGuard();
4597
+ if (clients_id <= 0) {
4598
+ return '';
4599
+ }
4600
+ const base_url = `${this.config.api_url}/get-genrated-pdf.php`;
4601
+ const queries = [
4602
+ {
4603
+ key: 'ws_id',
4604
+ value: this.config.wsid,
4605
+ },
4606
+ {
4607
+ key: 'clients_id',
4608
+ value: clients_id,
4609
+ },
4610
+ {
4611
+ key: 'key',
4612
+ value: this.sessionService.getToken(),
4613
+ },
4614
+ ];
4615
+ const query_string = queries
4616
+ .map((query) => `${query.key}=${query.value}`)
4617
+ .join('&');
4618
+ return `${base_url}?${query_string}`;
4619
+ }
4620
+ catch (error) {
4621
+ return '';
4622
+ }
4623
+ }
4575
4624
  processUserAccount(record) {
4576
4625
  if (!record) {
4577
4626
  throw new Error('Invalid record');
@@ -6362,12 +6411,18 @@ class EsolveVaultItem {
6362
6411
  get masked_number() {
6363
6412
  return this.last4.padStart(19, '**** ');
6364
6413
  }
6365
- constructor(id, payment_methods_id, last4, brand, expiry_timestamp) {
6366
- this.id = id;
6367
- this.payment_methods_id = payment_methods_id;
6368
- this.last4 = last4;
6369
- this.brand = brand;
6370
- this.expiry = new Date(expiry_timestamp * 1000);
6414
+ constructor(record) {
6415
+ this.id = 0;
6416
+ this.payment_methods_id = 0;
6417
+ this.description = '';
6418
+ this.last4 = '';
6419
+ this.brand = '';
6420
+ this.id = +record.id;
6421
+ this.payment_methods_id = +record.payment_methods_id;
6422
+ this.description = record.description;
6423
+ this.last4 = record.last4;
6424
+ this.brand = record.brand;
6425
+ this.expiry = new Date(record.expiry_timestamp * 1000);
6371
6426
  }
6372
6427
  }
6373
6428
 
@@ -6562,8 +6617,7 @@ class EsolvePaymentService {
6562
6617
  const vault = [];
6563
6618
  if (records) {
6564
6619
  for (const record of records) {
6565
- const vault_item = new EsolveVaultItem(+record.id, +record.payment_methods_id, record.last4, record.brand, record.expiry_timestamp);
6566
- vault.push(vault_item);
6620
+ vault.push(new EsolveVaultItem(record));
6567
6621
  }
6568
6622
  }
6569
6623
  return vault;