@a-cube-io/ereceipts-js-sdk 2.2.0 → 2.2.2

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.
@@ -2510,15 +2510,13 @@ 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 {
2513
+ if (userRole === 'CASHIER') {
2514
+ if (url.includes('/inactivity-period')) {
2515
+ if (platform === 'mobile') {
2516
+ return { mode: 'mtls', usePort444: true };
2517
+ }
2518
2518
  return { mode: 'jwt', usePort444: true };
2519
2519
  }
2520
- }
2521
- if (userRole === 'CASHIER') {
2522
2520
  if (!isReceiptEndpoint) {
2523
2521
  return { mode: 'jwt', usePort444: false };
2524
2522
  }
@@ -4763,7 +4761,7 @@ class PointOfSaleMapper {
4763
4761
  serialNumber: output.serial_number,
4764
4762
  status: output.status,
4765
4763
  address: AddressMapper.fromApi(output.address),
4766
- operationalStatus: output.operational_status,
4764
+ journalStatus: output.journal_status,
4767
4765
  };
4768
4766
  }
4769
4767
  static fromDetailedApiOutput(output) {
@@ -4781,8 +4779,15 @@ class PointOfSaleMapper {
4781
4779
  pages: response.pages,
4782
4780
  };
4783
4781
  }
4782
+ static toInactivityApiInput(input) {
4783
+ return {
4784
+ start_at: input.startAt,
4785
+ end_at: input.endAt,
4786
+ };
4787
+ }
4784
4788
  }
4785
4789
 
4790
+ // this repository is used for MF1 endpoints
4786
4791
  class PointOfSaleRepositoryImpl {
4787
4792
  constructor(http) {
4788
4793
  this.http = http;
@@ -4808,13 +4813,20 @@ class PointOfSaleRepositoryImpl {
4808
4813
  async closeJournal(serialNumber) {
4809
4814
  await this.http.post(`/mf1/pems/${serialNumber}/close`);
4810
4815
  }
4811
- async createInactivity(serialNumber) {
4812
- await this.http.post(`/mf1/pems/${serialNumber}/inactivity`);
4816
+ async createInactivityPeriod(serialNumber, input) {
4817
+ const apiInput = PointOfSaleMapper.toInactivityApiInput(input);
4818
+ await this.http.post(`/mf1/pems/${serialNumber}/inactivity-period`, apiInput);
4813
4819
  }
4814
4820
  async communicateOffline(serialNumber, input) {
4815
4821
  const apiInput = PointOfSaleMapper.toOfflineApiInput(input);
4816
4822
  await this.http.post(`/mf1/pems/${serialNumber}/communicate-offline`, apiInput);
4817
4823
  }
4824
+ async downloadData(serialNumber) {
4825
+ const response = await this.http.get(`/mf1/pems/${serialNumber}/download-data`, {
4826
+ responseType: 'arraybuffer',
4827
+ });
4828
+ return response.data;
4829
+ }
4818
4830
  }
4819
4831
 
4820
4832
  class SupplierMapper {
@@ -4926,6 +4938,7 @@ class PemMapper {
4926
4938
  }
4927
4939
  }
4928
4940
 
4941
+ // this repository is used for MF2 endpoints
4929
4942
  class PemRepositoryImpl {
4930
4943
  constructor(http) {
4931
4944
  this.http = http;
@@ -4947,12 +4960,6 @@ class PemRepositoryImpl {
4947
4960
  const response = await this.http.get(`/mf2/pems/${serialNumber}/certificates`);
4948
4961
  return PemMapper.fromCertificatesApiOutput(response.data);
4949
4962
  }
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
- }
4956
4963
  }
4957
4964
 
4958
4965
  class DailyReportMapper {