@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.cjs.js +23 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/index.esm.js +23 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.js +23 -16
- package/dist/index.native.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2533,15 +2533,13 @@ class AuthStrategy {
|
|
|
2533
2533
|
if (userRole === 'SUPPLIER') {
|
|
2534
2534
|
return { mode: 'jwt', usePort444: false };
|
|
2535
2535
|
}
|
|
2536
|
-
if (
|
|
2537
|
-
if (
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2536
|
+
if (userRole === 'CASHIER') {
|
|
2537
|
+
if (url.includes('/inactivity-period')) {
|
|
2538
|
+
if (platform === 'mobile') {
|
|
2539
|
+
return { mode: 'mtls', usePort444: true };
|
|
2540
|
+
}
|
|
2541
2541
|
return { mode: 'jwt', usePort444: true };
|
|
2542
2542
|
}
|
|
2543
|
-
}
|
|
2544
|
-
if (userRole === 'CASHIER') {
|
|
2545
2543
|
if (!isReceiptEndpoint) {
|
|
2546
2544
|
return { mode: 'jwt', usePort444: false };
|
|
2547
2545
|
}
|
|
@@ -4786,7 +4784,7 @@ class PointOfSaleMapper {
|
|
|
4786
4784
|
serialNumber: output.serial_number,
|
|
4787
4785
|
status: output.status,
|
|
4788
4786
|
address: AddressMapper.fromApi(output.address),
|
|
4789
|
-
|
|
4787
|
+
journalStatus: output.journal_status,
|
|
4790
4788
|
};
|
|
4791
4789
|
}
|
|
4792
4790
|
static fromDetailedApiOutput(output) {
|
|
@@ -4804,8 +4802,15 @@ class PointOfSaleMapper {
|
|
|
4804
4802
|
pages: response.pages,
|
|
4805
4803
|
};
|
|
4806
4804
|
}
|
|
4805
|
+
static toInactivityApiInput(input) {
|
|
4806
|
+
return {
|
|
4807
|
+
start_at: input.startAt,
|
|
4808
|
+
end_at: input.endAt,
|
|
4809
|
+
};
|
|
4810
|
+
}
|
|
4807
4811
|
}
|
|
4808
4812
|
|
|
4813
|
+
// this repository is used for MF1 endpoints
|
|
4809
4814
|
class PointOfSaleRepositoryImpl {
|
|
4810
4815
|
constructor(http) {
|
|
4811
4816
|
this.http = http;
|
|
@@ -4831,13 +4836,20 @@ class PointOfSaleRepositoryImpl {
|
|
|
4831
4836
|
async closeJournal(serialNumber) {
|
|
4832
4837
|
await this.http.post(`/mf1/pems/${serialNumber}/close`);
|
|
4833
4838
|
}
|
|
4834
|
-
async
|
|
4835
|
-
|
|
4839
|
+
async createInactivityPeriod(serialNumber, input) {
|
|
4840
|
+
const apiInput = PointOfSaleMapper.toInactivityApiInput(input);
|
|
4841
|
+
await this.http.post(`/mf1/pems/${serialNumber}/inactivity-period`, apiInput);
|
|
4836
4842
|
}
|
|
4837
4843
|
async communicateOffline(serialNumber, input) {
|
|
4838
4844
|
const apiInput = PointOfSaleMapper.toOfflineApiInput(input);
|
|
4839
4845
|
await this.http.post(`/mf1/pems/${serialNumber}/communicate-offline`, apiInput);
|
|
4840
4846
|
}
|
|
4847
|
+
async downloadData(serialNumber) {
|
|
4848
|
+
const response = await this.http.get(`/mf1/pems/${serialNumber}/download-data`, {
|
|
4849
|
+
responseType: 'arraybuffer',
|
|
4850
|
+
});
|
|
4851
|
+
return response.data;
|
|
4852
|
+
}
|
|
4841
4853
|
}
|
|
4842
4854
|
|
|
4843
4855
|
class SupplierMapper {
|
|
@@ -4949,6 +4961,7 @@ class PemMapper {
|
|
|
4949
4961
|
}
|
|
4950
4962
|
}
|
|
4951
4963
|
|
|
4964
|
+
// this repository is used for MF2 endpoints
|
|
4952
4965
|
class PemRepositoryImpl {
|
|
4953
4966
|
constructor(http) {
|
|
4954
4967
|
this.http = http;
|
|
@@ -4970,12 +4983,6 @@ class PemRepositoryImpl {
|
|
|
4970
4983
|
const response = await this.http.get(`/mf2/pems/${serialNumber}/certificates`);
|
|
4971
4984
|
return PemMapper.fromCertificatesApiOutput(response.data);
|
|
4972
4985
|
}
|
|
4973
|
-
async downloadData(serialNumber) {
|
|
4974
|
-
const response = await this.http.get(`/mf1/pems/${serialNumber}/download-data`, {
|
|
4975
|
-
responseType: 'arraybuffer',
|
|
4976
|
-
});
|
|
4977
|
-
return response.data;
|
|
4978
|
-
}
|
|
4979
4986
|
}
|
|
4980
4987
|
|
|
4981
4988
|
class DailyReportMapper {
|