@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.
package/dist/index.cjs.js CHANGED
@@ -2534,6 +2534,12 @@ class AuthStrategy {
2534
2534
  return { mode: 'jwt', usePort444: false };
2535
2535
  }
2536
2536
  if (userRole === 'CASHIER') {
2537
+ if (url.includes('/inactivity-period')) {
2538
+ if (platform === 'mobile') {
2539
+ return { mode: 'mtls', usePort444: true };
2540
+ }
2541
+ return { mode: 'jwt', usePort444: true };
2542
+ }
2537
2543
  if (!isReceiptEndpoint) {
2538
2544
  return { mode: 'jwt', usePort444: false };
2539
2545
  }
@@ -4796,6 +4802,40 @@ class PointOfSaleMapper {
4796
4802
  pages: response.pages,
4797
4803
  };
4798
4804
  }
4805
+ static toInactivityApiInput(input) {
4806
+ return {
4807
+ start_at: input.startAt,
4808
+ end_at: input.endAt,
4809
+ };
4810
+ }
4811
+ static toEmergencyReportApiInput(input) {
4812
+ return {
4813
+ datetime: input.datetime,
4814
+ documents_count: input.documentsCount,
4815
+ cash_payment_amount: input.cashPaymentAmount,
4816
+ electronic_payment_amount: input.electronicPaymentAmount,
4817
+ ticket_restaurant_payment_amount: input.ticketRestaurantPaymentAmount,
4818
+ ticket_restaurant_quantity: input.ticketRestaurantQuantity,
4819
+ entries: input.entries.map((entry) => this.toDailyReportEntryApiInput(entry)),
4820
+ discount: input.discount,
4821
+ };
4822
+ }
4823
+ static toDailyReportEntryApiInput(input) {
4824
+ return {
4825
+ vat_rate_code: input.vatRateCode,
4826
+ vat_amount: input.vatAmount,
4827
+ simplified_vat_allocation: input.simplifiedVatAllocation,
4828
+ partial_amount: input.partialAmount,
4829
+ total_returned_amount: input.totalReturnedAmount,
4830
+ total_voided_amount: input.totalVoidedAmount,
4831
+ total_prepaid_or_voucher_amount: input.totalPrepaidOrVoucherAmount,
4832
+ total_uncollected_services: input.totalUncollectedServices,
4833
+ total_uncollected_invoiced: input.totalUncollectedInvoiced,
4834
+ total_uncollected_dcr_to_ssn: input.totalUncollectedDcrToSsn,
4835
+ total_uncollected_complimentary: input.totalUncollectedComplimentary,
4836
+ ateco_code: input.atecoCode,
4837
+ };
4838
+ }
4799
4839
  }
4800
4840
 
4801
4841
  // this repository is used for MF1 endpoints
@@ -4824,8 +4864,13 @@ class PointOfSaleRepositoryImpl {
4824
4864
  async closeJournal(serialNumber) {
4825
4865
  await this.http.post(`/mf1/pems/${serialNumber}/close`);
4826
4866
  }
4827
- async createInactivity(serialNumber) {
4828
- await this.http.post(`/mf1/pems/${serialNumber}/inactivity`);
4867
+ async createInactivityPeriod(serialNumber, input) {
4868
+ const apiInput = PointOfSaleMapper.toInactivityApiInput(input);
4869
+ await this.http.post(`/mf1/pems/${serialNumber}/inactivity-period`, apiInput);
4870
+ }
4871
+ async uploadEmergencyReport(serialNumber, input) {
4872
+ const apiInput = PointOfSaleMapper.toEmergencyReportApiInput(input);
4873
+ await this.http.post(`/mf1/pems/${serialNumber}/emergency-report`, apiInput);
4829
4874
  }
4830
4875
  async communicateOffline(serialNumber, input) {
4831
4876
  const apiInput = PointOfSaleMapper.toOfflineApiInput(input);