@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.d.ts CHANGED
@@ -453,6 +453,34 @@ interface PEMStatusOfflineRequest {
453
453
  timestamp: string;
454
454
  reason: string;
455
455
  }
456
+ interface PEMInactivityPeriodInput {
457
+ startAt: string;
458
+ endAt: string;
459
+ }
460
+ interface EmergencyReportInput {
461
+ datetime: string;
462
+ documentsCount: number;
463
+ cashPaymentAmount: string;
464
+ electronicPaymentAmount: string;
465
+ discount?: string;
466
+ ticketRestaurantPaymentAmount: string;
467
+ ticketRestaurantQuantity: number;
468
+ entries: DailyReportEntry[];
469
+ }
470
+ interface DailyReportEntry {
471
+ vatRateCode: string;
472
+ vatAmount: string;
473
+ simplifiedVatAllocation: boolean;
474
+ partialAmount: string;
475
+ totalReturnedAmount?: string;
476
+ totalVoidedAmount?: string;
477
+ totalPrepaidOrVoucherAmount?: string;
478
+ totalUncollectedServices?: string;
479
+ totalUncollectedInvoiced?: string;
480
+ totalUncollectedDcrToSsn?: string;
481
+ totalUncollectedComplimentary?: string;
482
+ atecoCode?: string;
483
+ }
456
484
 
457
485
  interface PemData {
458
486
  version: string;
@@ -483,8 +511,9 @@ interface IPointOfSaleRepository {
483
511
  findAll(params?: PointOfSaleListParams): Promise<Page<PointOfSale>>;
484
512
  activate(serialNumber: string, input: ActivationRequest): Promise<void>;
485
513
  closeJournal(serialNumber: string): Promise<void>;
486
- createInactivity(serialNumber: string): Promise<void>;
514
+ createInactivityPeriod(serialNumber: string, input: PEMInactivityPeriodInput): Promise<void>;
487
515
  communicateOffline(serialNumber: string, input: PEMStatusOfflineRequest): Promise<void>;
516
+ uploadEmergencyReport(serialNumber: string, input: EmergencyReportInput): Promise<void>;
488
517
  downloadData(serialNumber: string): Promise<ArrayBuffer>;
489
518
  }
490
519
 
@@ -1491,12 +1520,43 @@ interface PEMStatusOfflineRequestApiInput {
1491
1520
  timestamp: string;
1492
1521
  reason: string;
1493
1522
  }
1523
+ interface PEMInactivityInputApiInput {
1524
+ start_at: string;
1525
+ end_at: string;
1526
+ }
1527
+ interface EmergencyReportInputApiInput {
1528
+ datetime: string;
1529
+ documents_count: number;
1530
+ cash_payment_amount: string;
1531
+ electronic_payment_amount: string;
1532
+ ticket_restaurant_payment_amount: string;
1533
+ discount?: string;
1534
+ ticket_restaurant_quantity: number;
1535
+ entries: DailyReportEntryApiInput[];
1536
+ }
1537
+ interface DailyReportEntryApiInput {
1538
+ vat_rate_code: string;
1539
+ vat_amount: string;
1540
+ simplified_vat_allocation: boolean;
1541
+ partial_amount: string;
1542
+ total_returned_amount?: string;
1543
+ total_voided_amount?: string;
1544
+ total_prepaid_or_voucher_amount?: string;
1545
+ total_uncollected_services?: string;
1546
+ total_uncollected_invoiced?: string;
1547
+ total_uncollected_dcr_to_ssn?: string;
1548
+ total_uncollected_complimentary?: string;
1549
+ ateco_code?: string;
1550
+ }
1494
1551
  declare class PointOfSaleMapper {
1495
1552
  static toActivationApiInput(input: ActivationRequest): ActivationRequestApiInput;
1496
1553
  static toOfflineApiInput(input: PEMStatusOfflineRequest): PEMStatusOfflineRequestApiInput;
1497
1554
  static fromApiOutput(output: PointOfSaleApiOutput): PointOfSale;
1498
1555
  static fromDetailedApiOutput(output: PointOfSaleDetailedApiOutput): PointOfSaleDetailed;
1499
1556
  static pageFromApi(response: Page<PointOfSaleApiOutput>): Page<PointOfSale>;
1557
+ static toInactivityApiInput(input: PEMInactivityPeriodInput): PEMInactivityInputApiInput;
1558
+ static toEmergencyReportApiInput(input: EmergencyReportInput): EmergencyReportInputApiInput;
1559
+ static toDailyReportEntryApiInput(input: DailyReportEntry): DailyReportEntryApiInput;
1500
1560
  }
1501
1561
 
1502
1562
  interface SupplierApiOutput {
@@ -1810,4 +1870,4 @@ declare function loadPlatformAdapters(options?: PlatformAdapterOptions): Platfor
1810
1870
  declare function createACubeMTLSConfig(baseUrl: string, timeout?: number, autoInitialize?: boolean, forcePort444?: boolean): MTLSAdapterConfig;
1811
1871
 
1812
1872
  export { ACubeSDK, ACubeSDKError, AddressMapper, AppStateService, AuthenticationService, CashRegisterMapper, CashierMapper, CertificateService, CertificateValidator, ConfigManager, DAILY_REPORT_STATUS_OPTIONS, DailyReportMapper, EXEMPT_VAT_CODES, GOOD_OR_SERVICE_OPTIONS, GoodOrServiceSchema, JournalMapper, MTLSError, MTLSErrorType, MerchantMapper, NOTIFICATION_CODES, NOTIFICATION_LEVELS, NOTIFICATION_SCOPES, NOTIFICATION_SOURCES, NOTIFICATION_TYPES, NotificationMapper, NotificationService, PEM_STATUS_OPTIONS, PEM_TYPE_OPTIONS, PemMapper, PointOfSaleMapper, RECEIPT_PROOF_TYPE_OPTIONS, RECEIPT_READY, RECEIPT_SENT, RECEIPT_SORT_ASCENDING, RECEIPT_SORT_DESCENDING, ReceiptMapper, ReceiptProofTypeSchema, SDKManager, STANDARD_VAT_RATES, SupplierMapper, TelemetryMapper, TelemetryService, VAT_RATE_CODES, VAT_RATE_CODE_OPTIONS, VatRateCodeSchema, createACubeMTLSConfig, createACubeSDK, createPrefixedLogger, createACubeSDK as default, extractRoles, hasAnyRole, hasRole, isTokenExpired, loadPlatformAdapters, logger, parseJwt };
1813
- export type { ActivationRequest, ActivationRequestApiInput, Address, AddressApiOutput, AppMode, AppState, AuthConfig, AuthCredentials$1 as AuthCredentials, CashRegister, CashRegisterApiOutput, CashRegisterCreateApiInput, CashRegisterCreateInput, CashRegisterDetailed, CashRegisterDetailedApiOutput, CashRegisterListParams, CashRegisterUpdateApiInput, CashRegisterUpdateInput, Cashier, CashierApiOutput, CashierCreateApiInput, CashierCreateInput, CashierListParams, CashierStatus, CertificateData, CertificateInfo, DailyReport, DailyReportApiOutput, DailyReportStatus, DailyReportsParams, Domain, Environment, GoodOrService, GoodOrServiceType, HttpRequestConfig, HttpResponse, IAuthHandler, ICashRegisterRepository, ICashierRepository, ICertificatePort, IDailyReportRepository, IHttpPort, IJournalRepository, IMTLSAdapter, IMTLSAdapterFactory, IMTLSPort, IMerchantRepository, INetworkPort, INotificationRepository, IPemRepository, IPointOfSaleRepository, IReceiptRepository, ISecureStoragePort, IStoragePort, ISupplierRepository, ITelemetryRepository, ITokenStoragePort, JWTPayload, Journal, JournalApiOutput, JournalCloseInput, JournalStatus, JournalsParams, LdJsonPage, LotteryApiOutput, LotterySecretRequestApiOutput, LotterySecretRequestInfo, LotteryTelemetry, MTLSConnectionConfig, MTLSRequestConfig, MTLSResponse, ManagedServices, Merchant, MerchantApiOutput, MerchantCreateApiInput, MerchantCreateInput, MerchantUpdateApiInput, MerchantUpdateInput, MerchantsParams, MessageApiOutput, MessageInfo, Notification, NotificationApiOutput, NotificationCode, NotificationCommunicationRestored, NotificationCommunicationRestoredApiOutput, NotificationEvents, NotificationLevel, NotificationListParams, NotificationMf2Unreachable, NotificationMf2UnreachableApiOutput, NotificationPageApiOutput, NotificationPayloadBlockAt, NotificationScope, NotificationServiceConfig, NotificationSource, NotificationStatusOffline, NotificationStatusOfflineApiOutput, NotificationStatusOnline, NotificationStatusOnlineApiOutput, NotificationSyncState, NotificationType, PEMStatus, PEMStatusOfflineRequest, PEMStatusOfflineRequestApiInput, Page, PemCertificates, PemCertificatesApiOutput, PemCreateApiInput, PemCreateApiOutput, PemCreateInput, PemCreateOutput, PemData, PendingReceipts, PendingReceiptsApiOutput, PlatformAdapters, PointOfSale, PointOfSaleApiOutput, PointOfSaleDetailed, PointOfSaleDetailedApiOutput, PointOfSaleListParams, PointOfSaleMf2, PointOfSaleMf2ApiOutput, PointOfSaleType, Receipt, ReceiptApiInput, ReceiptApiOutput, ReceiptDetails, ReceiptDetailsApiOutput, ReceiptInput, ReceiptItem, ReceiptItemApiInput, ReceiptListParams, ReceiptProofType, ReceiptProofTypeType, ReceiptReturnApiInput, ReceiptReturnInput, ReceiptReturnItem, ReceiptSortOrder, ReceiptStatus, ReceiptType, ReturnViaDifferentDeviceApiInput, ReturnViaDifferentDeviceInput, ReturnWithProofApiInput, ReturnWithProofInput, ReturnableReceiptItem, ReturnableReceiptItemApiOutput, SDKConfig, SDKEvents, SDKManagerConfig, SDKManagerEvents, SoftwareVersionStatus, StoredCertificate, Supplier, SupplierApiOutput, SupplierCreateApiInput, SupplierCreateInput, SupplierUpdateApiInput, SupplierUpdateInput, SuppliersParams, Telemetry, TelemetryApiOutput, TelemetryMerchant, TelemetryMerchantApiOutput, TelemetryOperations, TelemetryServiceConfig, TelemetrySoftware, TelemetrySoftwareApiOutput, TelemetrySoftwareVersion, TelemetrySoftwareVersionApiOutput, TelemetryState, TelemetrySupplier, TelemetrySupplierApiOutput, TransmissionAttemptApiOutput, TransmissionAttemptInfo, User$1 as User, UserRole, UserRoles, VatRateCode, VatRateCodeType, VoidReceiptApiInput, VoidReceiptInput, VoidViaDifferentDeviceApiInput, VoidViaDifferentDeviceInput, VoidWithProofApiInput, VoidWithProofInput, WarningState };
1873
+ export type { ActivationRequest, ActivationRequestApiInput, Address, AddressApiOutput, AppMode, AppState, AuthConfig, AuthCredentials$1 as AuthCredentials, CashRegister, CashRegisterApiOutput, CashRegisterCreateApiInput, CashRegisterCreateInput, CashRegisterDetailed, CashRegisterDetailedApiOutput, CashRegisterListParams, CashRegisterUpdateApiInput, CashRegisterUpdateInput, Cashier, CashierApiOutput, CashierCreateApiInput, CashierCreateInput, CashierListParams, CashierStatus, CertificateData, CertificateInfo, DailyReport, DailyReportApiOutput, DailyReportEntry, DailyReportEntryApiInput, DailyReportStatus, DailyReportsParams, Domain, EmergencyReportInput, EmergencyReportInputApiInput, Environment, GoodOrService, GoodOrServiceType, HttpRequestConfig, HttpResponse, IAuthHandler, ICashRegisterRepository, ICashierRepository, ICertificatePort, IDailyReportRepository, IHttpPort, IJournalRepository, IMTLSAdapter, IMTLSAdapterFactory, IMTLSPort, IMerchantRepository, INetworkPort, INotificationRepository, IPemRepository, IPointOfSaleRepository, IReceiptRepository, ISecureStoragePort, IStoragePort, ISupplierRepository, ITelemetryRepository, ITokenStoragePort, JWTPayload, Journal, JournalApiOutput, JournalCloseInput, JournalStatus, JournalsParams, LdJsonPage, LotteryApiOutput, LotterySecretRequestApiOutput, LotterySecretRequestInfo, LotteryTelemetry, MTLSConnectionConfig, MTLSRequestConfig, MTLSResponse, ManagedServices, Merchant, MerchantApiOutput, MerchantCreateApiInput, MerchantCreateInput, MerchantUpdateApiInput, MerchantUpdateInput, MerchantsParams, MessageApiOutput, MessageInfo, Notification, NotificationApiOutput, NotificationCode, NotificationCommunicationRestored, NotificationCommunicationRestoredApiOutput, NotificationEvents, NotificationLevel, NotificationListParams, NotificationMf2Unreachable, NotificationMf2UnreachableApiOutput, NotificationPageApiOutput, NotificationPayloadBlockAt, NotificationScope, NotificationServiceConfig, NotificationSource, NotificationStatusOffline, NotificationStatusOfflineApiOutput, NotificationStatusOnline, NotificationStatusOnlineApiOutput, NotificationSyncState, NotificationType, PEMInactivityInputApiInput, PEMInactivityPeriodInput, PEMStatus, PEMStatusOfflineRequest, PEMStatusOfflineRequestApiInput, Page, PemCertificates, PemCertificatesApiOutput, PemCreateApiInput, PemCreateApiOutput, PemCreateInput, PemCreateOutput, PemData, PendingReceipts, PendingReceiptsApiOutput, PlatformAdapters, PointOfSale, PointOfSaleApiOutput, PointOfSaleDetailed, PointOfSaleDetailedApiOutput, PointOfSaleListParams, PointOfSaleMf2, PointOfSaleMf2ApiOutput, PointOfSaleType, Receipt, ReceiptApiInput, ReceiptApiOutput, ReceiptDetails, ReceiptDetailsApiOutput, ReceiptInput, ReceiptItem, ReceiptItemApiInput, ReceiptListParams, ReceiptProofType, ReceiptProofTypeType, ReceiptReturnApiInput, ReceiptReturnInput, ReceiptReturnItem, ReceiptSortOrder, ReceiptStatus, ReceiptType, ReturnViaDifferentDeviceApiInput, ReturnViaDifferentDeviceInput, ReturnWithProofApiInput, ReturnWithProofInput, ReturnableReceiptItem, ReturnableReceiptItemApiOutput, SDKConfig, SDKEvents, SDKManagerConfig, SDKManagerEvents, SoftwareVersionStatus, StoredCertificate, Supplier, SupplierApiOutput, SupplierCreateApiInput, SupplierCreateInput, SupplierUpdateApiInput, SupplierUpdateInput, SuppliersParams, Telemetry, TelemetryApiOutput, TelemetryMerchant, TelemetryMerchantApiOutput, TelemetryOperations, TelemetryServiceConfig, TelemetrySoftware, TelemetrySoftwareApiOutput, TelemetrySoftwareVersion, TelemetrySoftwareVersionApiOutput, TelemetryState, TelemetrySupplier, TelemetrySupplierApiOutput, TransmissionAttemptApiOutput, TransmissionAttemptInfo, User$1 as User, UserRole, UserRoles, VatRateCode, VatRateCodeType, VoidReceiptApiInput, VoidReceiptInput, VoidViaDifferentDeviceApiInput, VoidViaDifferentDeviceInput, VoidWithProofApiInput, VoidWithProofInput, WarningState };
package/dist/index.esm.js CHANGED
@@ -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);