@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.
package/dist/index.d.ts CHANGED
@@ -430,7 +430,7 @@ interface PointOfSale {
430
430
  serialNumber: string;
431
431
  status: PEMStatus;
432
432
  address: Address;
433
- operationalStatus: string;
433
+ journalStatus: string;
434
434
  }
435
435
  interface PointOfSaleDetailed extends PointOfSale {
436
436
  registrationKey?: string;
@@ -453,6 +453,10 @@ interface PEMStatusOfflineRequest {
453
453
  timestamp: string;
454
454
  reason: string;
455
455
  }
456
+ interface PEMInactivityPeriodInput {
457
+ startAt: string;
458
+ endAt: string;
459
+ }
456
460
 
457
461
  interface PemData {
458
462
  version: string;
@@ -476,7 +480,6 @@ interface IPemRepository {
476
480
  findBySerialNumber(serialNumber: string): Promise<PointOfSaleMf2>;
477
481
  findAllByMerchant(merchantUuid: string, page?: number): Promise<PointOfSaleMf2[]>;
478
482
  getCertificates(serialNumber: string): Promise<PemCertificates>;
479
- downloadData(serialNumber: string): Promise<ArrayBuffer>;
480
483
  }
481
484
 
482
485
  interface IPointOfSaleRepository {
@@ -484,8 +487,9 @@ interface IPointOfSaleRepository {
484
487
  findAll(params?: PointOfSaleListParams): Promise<Page<PointOfSale>>;
485
488
  activate(serialNumber: string, input: ActivationRequest): Promise<void>;
486
489
  closeJournal(serialNumber: string): Promise<void>;
487
- createInactivity(serialNumber: string): Promise<void>;
490
+ createInactivityPeriod(serialNumber: string, input: PEMInactivityPeriodInput): Promise<void>;
488
491
  communicateOffline(serialNumber: string, input: PEMStatusOfflineRequest): Promise<void>;
492
+ downloadData(serialNumber: string): Promise<ArrayBuffer>;
489
493
  }
490
494
 
491
495
  type GoodOrService = 'goods' | 'service';
@@ -1479,7 +1483,7 @@ interface PointOfSaleApiOutput {
1479
1483
  serial_number: string;
1480
1484
  status: PEMStatus;
1481
1485
  address: AddressApiOutput;
1482
- operational_status: string;
1486
+ journal_status: string;
1483
1487
  }
1484
1488
  interface PointOfSaleDetailedApiOutput extends PointOfSaleApiOutput {
1485
1489
  registration_key?: string;
@@ -1491,12 +1495,17 @@ interface PEMStatusOfflineRequestApiInput {
1491
1495
  timestamp: string;
1492
1496
  reason: string;
1493
1497
  }
1498
+ interface PEMInactivityInputApiInput {
1499
+ start_at: string;
1500
+ end_at: string;
1501
+ }
1494
1502
  declare class PointOfSaleMapper {
1495
1503
  static toActivationApiInput(input: ActivationRequest): ActivationRequestApiInput;
1496
1504
  static toOfflineApiInput(input: PEMStatusOfflineRequest): PEMStatusOfflineRequestApiInput;
1497
1505
  static fromApiOutput(output: PointOfSaleApiOutput): PointOfSale;
1498
1506
  static fromDetailedApiOutput(output: PointOfSaleDetailedApiOutput): PointOfSaleDetailed;
1499
1507
  static pageFromApi(response: Page<PointOfSaleApiOutput>): Page<PointOfSale>;
1508
+ static toInactivityApiInput(input: PEMInactivityPeriodInput): PEMInactivityInputApiInput;
1500
1509
  }
1501
1510
 
1502
1511
  interface SupplierApiOutput {
@@ -1810,4 +1819,4 @@ declare function loadPlatformAdapters(options?: PlatformAdapterOptions): Platfor
1810
1819
  declare function createACubeMTLSConfig(baseUrl: string, timeout?: number, autoInitialize?: boolean, forcePort444?: boolean): MTLSAdapterConfig;
1811
1820
 
1812
1821
  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 };
1822
+ 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, 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
@@ -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 {