@a-cube-io/ereceipts-js-sdk 2.2.1 → 2.2.3

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.
@@ -2511,6 +2511,12 @@ class AuthStrategy {
2511
2511
  return { mode: 'jwt', usePort444: false };
2512
2512
  }
2513
2513
  if (userRole === 'CASHIER') {
2514
+ if (url.includes('/inactivity-period')) {
2515
+ if (platform === 'mobile') {
2516
+ return { mode: 'mtls', usePort444: true };
2517
+ }
2518
+ return { mode: 'jwt', usePort444: true };
2519
+ }
2514
2520
  if (!isReceiptEndpoint) {
2515
2521
  return { mode: 'jwt', usePort444: false };
2516
2522
  }
@@ -4773,6 +4779,40 @@ class PointOfSaleMapper {
4773
4779
  pages: response.pages,
4774
4780
  };
4775
4781
  }
4782
+ static toInactivityApiInput(input) {
4783
+ return {
4784
+ start_at: input.startAt,
4785
+ end_at: input.endAt,
4786
+ };
4787
+ }
4788
+ static toEmergencyReportApiInput(input) {
4789
+ return {
4790
+ datetime: input.datetime,
4791
+ documents_count: input.documentsCount,
4792
+ cash_payment_amount: input.cashPaymentAmount,
4793
+ electronic_payment_amount: input.electronicPaymentAmount,
4794
+ ticket_restaurant_payment_amount: input.ticketRestaurantPaymentAmount,
4795
+ ticket_restaurant_quantity: input.ticketRestaurantQuantity,
4796
+ entries: input.entries.map((entry) => this.toDailyReportEntryApiInput(entry)),
4797
+ discount: input.discount,
4798
+ };
4799
+ }
4800
+ static toDailyReportEntryApiInput(input) {
4801
+ return {
4802
+ vat_rate_code: input.vatRateCode,
4803
+ vat_amount: input.vatAmount,
4804
+ simplified_vat_allocation: input.simplifiedVatAllocation,
4805
+ partial_amount: input.partialAmount,
4806
+ total_returned_amount: input.totalReturnedAmount,
4807
+ total_voided_amount: input.totalVoidedAmount,
4808
+ total_prepaid_or_voucher_amount: input.totalPrepaidOrVoucherAmount,
4809
+ total_uncollected_services: input.totalUncollectedServices,
4810
+ total_uncollected_invoiced: input.totalUncollectedInvoiced,
4811
+ total_uncollected_dcr_to_ssn: input.totalUncollectedDcrToSsn,
4812
+ total_uncollected_complimentary: input.totalUncollectedComplimentary,
4813
+ ateco_code: input.atecoCode,
4814
+ };
4815
+ }
4776
4816
  }
4777
4817
 
4778
4818
  // this repository is used for MF1 endpoints
@@ -4801,8 +4841,13 @@ class PointOfSaleRepositoryImpl {
4801
4841
  async closeJournal(serialNumber) {
4802
4842
  await this.http.post(`/mf1/pems/${serialNumber}/close`);
4803
4843
  }
4804
- async createInactivity(serialNumber) {
4805
- await this.http.post(`/mf1/pems/${serialNumber}/inactivity`);
4844
+ async createInactivityPeriod(serialNumber, input) {
4845
+ const apiInput = PointOfSaleMapper.toInactivityApiInput(input);
4846
+ await this.http.post(`/mf1/pems/${serialNumber}/inactivity-period`, apiInput);
4847
+ }
4848
+ async uploadEmergencyReport(serialNumber, input) {
4849
+ const apiInput = PointOfSaleMapper.toEmergencyReportApiInput(input);
4850
+ await this.http.post(`/mf1/pems/${serialNumber}/emergency-report`, apiInput);
4806
4851
  }
4807
4852
  async communicateOffline(serialNumber, input) {
4808
4853
  const apiInput = PointOfSaleMapper.toOfflineApiInput(input);