@a-cube-io/ereceipts-js-sdk 2.1.1 → 2.2.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.
package/dist/index.d.ts CHANGED
@@ -476,6 +476,7 @@ interface IPemRepository {
476
476
  findBySerialNumber(serialNumber: string): Promise<PointOfSaleMf2>;
477
477
  findAllByMerchant(merchantUuid: string, page?: number): Promise<PointOfSaleMf2[]>;
478
478
  getCertificates(serialNumber: string): Promise<PemCertificates>;
479
+ downloadData(serialNumber: string): Promise<ArrayBuffer>;
479
480
  }
480
481
 
481
482
  interface IPointOfSaleRepository {
package/dist/index.esm.js CHANGED
@@ -2510,6 +2510,14 @@ class AuthStrategy {
2510
2510
  if (userRole === 'SUPPLIER') {
2511
2511
  return { mode: 'jwt', usePort444: false };
2512
2512
  }
2513
+ if (url.includes('/download-data')) {
2514
+ if (platform === 'mobile') {
2515
+ return { mode: 'mtls', usePort444: true };
2516
+ }
2517
+ else {
2518
+ return { mode: 'jwt', usePort444: true };
2519
+ }
2520
+ }
2513
2521
  if (userRole === 'CASHIER') {
2514
2522
  if (!isReceiptEndpoint) {
2515
2523
  return { mode: 'jwt', usePort444: false };
@@ -4939,6 +4947,12 @@ class PemRepositoryImpl {
4939
4947
  const response = await this.http.get(`/mf2/pems/${serialNumber}/certificates`);
4940
4948
  return PemMapper.fromCertificatesApiOutput(response.data);
4941
4949
  }
4950
+ async downloadData(serialNumber) {
4951
+ const response = await this.http.get(`/mf1/pems/${serialNumber}/download-data`, {
4952
+ responseType: 'arraybuffer',
4953
+ });
4954
+ return response.data;
4955
+ }
4942
4956
  }
4943
4957
 
4944
4958
  class DailyReportMapper {