@aptos-scp/scp-component-rn-device-services 0.0.2 → 0.1.0

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.
Files changed (50) hide show
  1. package/ios/SCPRNDeviceServices/AurusPaymentTerminal.m +41 -10
  2. package/lib/AurusDevice/AurusDevice.d.ts +94 -0
  3. package/lib/AurusDevice/{AurusPaymentDevice.js → AurusDevice.js} +226 -97
  4. package/lib/AurusDevice/AurusDevice.js.map +1 -0
  5. package/lib/AurusDevice/constants.d.ts +1 -0
  6. package/lib/AurusDevice/constants.js +1 -0
  7. package/lib/AurusDevice/constants.js.map +1 -1
  8. package/lib/AurusDevice/index.d.ts +1 -1
  9. package/lib/AurusDevice/index.js +1 -1
  10. package/lib/AurusDevice/index.js.map +1 -1
  11. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js +59 -41
  12. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js.map +1 -1
  13. package/lib/AurusDevice/sdk-interface/Barcode.d.ts +15 -0
  14. package/lib/AurusDevice/sdk-interface/Barcode.js +9 -0
  15. package/lib/AurusDevice/sdk-interface/Barcode.js.map +1 -0
  16. package/lib/AurusDevice/sdk-interface/index.d.ts +1 -0
  17. package/lib/PaymentDeviceFactory.d.ts +3 -3
  18. package/lib/PaymentDeviceFactory.js +14 -20
  19. package/lib/PaymentDeviceFactory.js.map +1 -1
  20. package/lib/PaymentDeviceService.d.ts +12 -12
  21. package/lib/PaymentDeviceService.js +99 -70
  22. package/lib/PaymentDeviceService.js.map +1 -1
  23. package/lib/ScannerDeviceFactory.d.ts +11 -0
  24. package/lib/ScannerDeviceFactory.js +27 -0
  25. package/lib/ScannerDeviceFactory.js.map +1 -0
  26. package/lib/ScannerDeviceService.d.ts +13 -0
  27. package/lib/ScannerDeviceService.js +110 -0
  28. package/lib/ScannerDeviceService.js.map +1 -0
  29. package/lib/configs/inversify/inversify.config.d.ts +3 -0
  30. package/lib/configs/inversify/inversify.config.js +18 -0
  31. package/lib/configs/inversify/inversify.config.js.map +1 -0
  32. package/lib/constants/constants.d.ts +4 -3
  33. package/lib/constants/constants.js +5 -4
  34. package/lib/constants/constants.js.map +1 -1
  35. package/lib/index.d.ts +1 -0
  36. package/lib/index.js +1 -0
  37. package/lib/index.js.map +1 -1
  38. package/lib/interfaces/index.d.ts +1 -0
  39. package/lib/interfaces/payment/IPayment.d.ts +20 -16
  40. package/lib/interfaces/scanner/IScanner.d.ts +29 -0
  41. package/lib/interfaces/scanner/IScanner.js +3 -0
  42. package/lib/interfaces/scanner/IScanner.js.map +1 -0
  43. package/lib/interfaces/scanner/index.d.ts +1 -0
  44. package/lib/interfaces/scanner/index.js +3 -0
  45. package/lib/interfaces/scanner/index.js.map +1 -0
  46. package/package.json +1 -1
  47. package/types/es-symbol/index.d.ts +4 -0
  48. package/types/react-native-xml2js/index.d.ts +5 -0
  49. package/lib/AurusDevice/AurusPaymentDevice.d.ts +0 -77
  50. package/lib/AurusDevice/AurusPaymentDevice.js.map +0 -1
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
2
11
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
12
  return new (P || (P = Promise))(function (resolve, reject) {
4
13
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -9,121 +18,141 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
18
  };
10
19
  Object.defineProperty(exports, "__esModule", { value: true });
11
20
  const scp_component_logging_1 = require("@aptos-scp/scp-component-logging");
21
+ const inversify_1 = require("inversify");
12
22
  const PaymentDeviceFactory_1 = require("./PaymentDeviceFactory");
13
23
  const logger = scp_component_logging_1.LogManager.getLogger("com.aptos.deviceservices.PaymentDeviceService");
14
- class PaymentDeviceService {
15
- constructor(configuration, deviceNotificationEmitter) {
16
- this._methodMapper = new Map([
17
- ["initialize", []],
18
- ["start", []],
19
- ["stop", []],
20
- ["tearDown", []],
21
- ["captureSale", []],
22
- ["captureRefund", []],
23
- ["giftcardActivate", []],
24
- ["giftcardBalance", []],
25
- ["giftcardIssue", []],
26
- ["giftcardRedeem", []],
27
- ["void", []]
28
- ]);
29
- this._devices = new Map();
30
- /**
31
- * There are multiple ways in which this can be accomplished. It largely
32
- * depends on how the underlying devices will be utilized and in what way
33
- * they will be configured.
34
- *
35
- * The initial primary idea is to have a mapping of request types and
36
- * cooresponding provider (device) that command should be using.
37
- */
38
- logger.trace("constructor of payment device service.");
39
- let device = PaymentDeviceFactory_1.createPaymentDevice(deviceNotificationEmitter, configuration);
40
- let name = configuration.deviceProvider;
41
- this._devices.set(name, device);
42
- this._methodMapper.get("initialize").push(name);
43
- this._methodMapper.get("start").push(name);
44
- this._methodMapper.get("stop").push(name);
45
- this._methodMapper.get("tearDown").push(name);
46
- this._methodMapper.get("captureSale").push(name);
47
- this._methodMapper.get("captureRefund").push(name);
48
- this._methodMapper.get("giftcardActivate").push(name);
49
- this._methodMapper.get("giftcardBalance").push(name);
50
- this._methodMapper.get("giftcardIssue").push(name);
51
- this._methodMapper.get("giftcardRedeem").push(name);
52
- this._methodMapper.get("void").push(name);
24
+ let PaymentDeviceService = class PaymentDeviceService {
25
+ constructor() {
26
+ const entryMessage = logger.traceEntry("constructor");
27
+ this.reset();
28
+ logger.traceExit(entryMessage);
53
29
  }
54
- initialize() {
30
+ initialize(emitter, configs) {
55
31
  return __awaiter(this, void 0, void 0, function* () {
56
- this._methodMapper.get("initialize").map((name) => this._devices.get(name)).map((device) => device.initialize());
32
+ const entryMessage = logger.traceEntry("initialize", emitter, configs);
33
+ /**
34
+ * There are multiple ways in which this can be accomplished. It largely
35
+ * depends on how the underlying devices will be utilized and in what way
36
+ * they will be configured.
37
+ *
38
+ * The initial primary idea is to have a mapping of request types and
39
+ * cooresponding provider (device) that command should be using.
40
+ */
41
+ /**
42
+ * Update, apparently we can keep lists of object references. So instead of 2 maps, point the method mapper to the
43
+ * desired methods to be called. Then it could be matter of invoking the referenced function. Basically, map a
44
+ * in which all it does is (func) => {func();}
45
+ */
46
+ if (!(configs instanceof Array)) {
47
+ configs = [configs];
48
+ }
49
+ this.reset();
50
+ configs.map((config) => {
51
+ let device = PaymentDeviceFactory_1.createPaymentDevice(emitter, config);
52
+ this._map.get(6 /* StartPaymentDevice */).push(device);
53
+ this._map.get(7 /* StopPaymentDevice */).push(device);
54
+ this._map.get(8 /* TearDownPaymentDevice */).push(device);
55
+ this._map.get(0 /* CaptureSale */).push(device);
56
+ this._map.get(1 /* CaptureRefund */).push(device);
57
+ this._map.get(2 /* GiftcardActivate */).push(device);
58
+ this._map.get(3 /* GiftcardBalance */).push(device);
59
+ this._map.get(4 /* GiftcardIssue */).push(device);
60
+ this._map.get(5 /* GiftcardRedeem */).push(device);
61
+ this._map.get(9 /* Void */).push(device);
62
+ });
63
+ logger.traceExit(entryMessage);
57
64
  });
58
65
  }
59
- ;
60
66
  start() {
61
67
  return __awaiter(this, void 0, void 0, function* () {
62
- this._methodMapper.get("start").map((name) => this._devices.get(name)).map((device) => device.start());
68
+ const entryMessage = logger.traceEntry("start");
69
+ this._map.get(6 /* StartPaymentDevice */).map((device) => device.startPaymentDevice());
70
+ logger.traceExit(entryMessage);
63
71
  });
64
72
  }
65
- ;
66
73
  stop() {
67
74
  return __awaiter(this, void 0, void 0, function* () {
68
- this._methodMapper.get("stop").map((name) => this._devices.get(name)).map((device) => device.stop());
75
+ const entryMessage = logger.traceEntry("stop");
76
+ this._map.get(7 /* StopPaymentDevice */).map((device) => device.stopPaymentDevice());
77
+ logger.traceExit(entryMessage);
69
78
  });
70
79
  }
71
- ;
72
80
  tearDown() {
73
81
  return __awaiter(this, void 0, void 0, function* () {
74
- this._methodMapper.get("tearDown").map((name) => this._devices.get(name)).map((device) => device.tearDown());
82
+ const entryMessage = logger.traceEntry("tearDown");
83
+ this._map.get(8 /* TearDownPaymentDevice */).map((device) => device.tearDownPaymentDevice());
84
+ logger.traceExit(entryMessage);
75
85
  });
76
86
  }
77
- ;
78
87
  captureSale(request) {
79
88
  return __awaiter(this, void 0, void 0, function* () {
80
- this._methodMapper.get("captureSale").map((name) => this._devices.get(name)).map((device) => device.captureSale(request));
81
- return;
89
+ const entryMessage = logger.traceEntry("captureSale", request);
90
+ this._map.get(0 /* CaptureSale */).map((device) => device.captureSale(request));
91
+ logger.traceExit(entryMessage);
82
92
  });
83
93
  }
84
- ;
85
94
  captureRefund(request) {
86
95
  return __awaiter(this, void 0, void 0, function* () {
87
- this._methodMapper.get("captureRefund").map((name) => this._devices.get(name)).map((device) => device.captureRefund(request));
88
- return;
96
+ const entryMessage = logger.traceEntry("captureRefund", request);
97
+ this._map.get(1 /* CaptureRefund */).map((device) => device.captureRefund(request));
98
+ logger.traceExit(entryMessage);
89
99
  });
90
100
  }
91
- ;
92
101
  giftcardActivate(request) {
93
102
  return __awaiter(this, void 0, void 0, function* () {
94
- this._methodMapper.get("giftcardActivate").map((name) => this._devices.get(name)).map((device) => device.giftcardActivate(request));
95
- return;
103
+ const entryMessage = logger.traceEntry("giftcardActivate", request);
104
+ this._map.get(2 /* GiftcardActivate */).map((device) => device.giftcardActivate(request));
105
+ logger.traceExit(entryMessage);
96
106
  });
97
107
  }
98
- ;
99
108
  giftcardBalance(request) {
100
109
  return __awaiter(this, void 0, void 0, function* () {
101
- this._methodMapper.get("giftcardBalance").map((name) => this._devices.get(name)).map((device) => device.giftcardBalance(request));
102
- return;
110
+ const entryMessage = logger.traceEntry("giftcardBalance", request);
111
+ this._map.get(3 /* GiftcardBalance */).map((device) => device.giftcardBalance(request));
112
+ logger.traceExit(entryMessage);
103
113
  });
104
114
  }
105
- ;
106
115
  giftcardIssue(request) {
107
116
  return __awaiter(this, void 0, void 0, function* () {
108
- this._methodMapper.get("giftcardIssue").map((name) => this._devices.get(name)).map((device) => device.giftcardIssue(request));
109
- return;
117
+ const entryMessage = logger.traceEntry("giftcardIssue", request);
118
+ this._map.get(4 /* GiftcardIssue */).map((device) => device.giftcardIssue(request));
119
+ logger.traceExit(entryMessage);
110
120
  });
111
121
  }
112
- ;
113
122
  giftcardRedeem(request) {
114
123
  return __awaiter(this, void 0, void 0, function* () {
115
- this._methodMapper.get("giftcardRedeem").map((name) => this._devices.get(name)).map((device) => device.giftcardRedeem(request));
116
- return;
124
+ const entryMessage = logger.traceEntry("giftcardRedeem", request);
125
+ this._map.get(5 /* GiftcardRedeem */).map((device) => device.giftcardRedeem(request));
126
+ logger.traceExit(entryMessage);
117
127
  });
118
128
  }
119
- ;
120
129
  void(request) {
121
130
  return __awaiter(this, void 0, void 0, function* () {
122
- this._methodMapper.get("void").map((name) => this._devices.get(name)).map((device) => device.void(request));
123
- return;
131
+ const entryMessage = logger.traceEntry("void", request);
132
+ this._map.get(9 /* Void */).map((device) => device.void(request));
133
+ logger.traceExit(entryMessage);
124
134
  });
125
135
  }
126
- ;
127
- }
136
+ reset() {
137
+ const entryMessage = logger.traceEntry("reset");
138
+ this._map = new Map([
139
+ [0 /* CaptureSale */, []],
140
+ [1 /* CaptureRefund */, []],
141
+ [2 /* GiftcardActivate */, []],
142
+ [3 /* GiftcardBalance */, []],
143
+ [4 /* GiftcardIssue */, []],
144
+ [5 /* GiftcardRedeem */, []],
145
+ [6 /* StartPaymentDevice */, []],
146
+ [7 /* StopPaymentDevice */, []],
147
+ [8 /* TearDownPaymentDevice */, []],
148
+ [9 /* Void */, []]
149
+ ]);
150
+ logger.traceExit(entryMessage);
151
+ }
152
+ };
153
+ PaymentDeviceService = __decorate([
154
+ inversify_1.injectable(),
155
+ __metadata("design:paramtypes", [])
156
+ ], PaymentDeviceService);
128
157
  exports.PaymentDeviceService = PaymentDeviceService;
129
158
  //# sourceMappingURL=PaymentDeviceService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentDeviceService.js","sourceRoot":"","sources":["../src/PaymentDeviceService.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,4EAAuE;AAUvE,iEAA6D;AAE7D,MAAM,MAAM,GAAY,kCAAU,CAAC,SAAS,CAAC,+CAA+C,CAAC,CAAC;AAE9F;IAgBE,YAAY,aAA0C,EAAE,yBAAuC;QAfrF,kBAAa,GAA0B,IAAI,GAAG,CAAmB;YACzE,CAAC,YAAY,EAAE,EAAE,CAAC;YAClB,CAAC,OAAO,EAAE,EAAE,CAAC;YACb,CAAC,MAAM,EAAE,EAAE,CAAC;YACZ,CAAC,UAAU,EAAE,EAAE,CAAC;YAChB,CAAC,aAAa,EAAE,EAAE,CAAC;YACnB,CAAC,eAAe,EAAE,EAAE,CAAC;YACrB,CAAC,kBAAkB,EAAE,EAAE,CAAC;YACxB,CAAC,iBAAiB,EAAE,EAAE,CAAC;YACvB,CAAC,eAAe,EAAE,EAAE,CAAC;YACrB,CAAC,gBAAgB,EAAE,EAAE,CAAC;YACtB,CAAC,MAAM,EAAE,EAAE,CAAC;SACb,CAAC,CAAC;QACO,aAAQ,GAAgC,IAAI,GAAG,EAA0B,CAAC;QAGlF;;;;;;;WAOG;QACH,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;QACvD,IAAI,MAAM,GAAmB,0CAAmB,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;QAC3F,IAAI,IAAI,GAAW,aAAa,CAAC,cAAc,CAAC;QAEhD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAA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,CAAC;QACjC,CAAC;KAAA;IAEY,IAAI,CAAC,OAAyB;;YACzC,MAAM,YAAY,GAAqB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC1E,IAAI,CAAC,IAAI,CAAC,GAAG,cAAiB,CAAC,GAAG,CAChC,CAAC,MAA4B,KAAK,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CACvD,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACjC,CAAC;KAAA;IAEO,KAAK;QACX,MAAM,YAAY,GAAqB,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAiC;YAClD,sBAAyB,EAAE,CAAC;YAC5B,wBAA2B,EAAE,CAAC;YAC9B,2BAA8B,EAAE,CAAC;YACjC,0BAA6B,EAAE,CAAC;YAChC,wBAA2B,EAAE,CAAC;YAC9B,yBAA4B,EAAE,CAAC;YAC/B,6BAAgC,EAAE,CAAC;YACnC,4BAA+B,EAAE,CAAC;YAClC,gCAAmC,EAAE,CAAC;YACtC,eAAkB,EAAE,CAAC;SACtB,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;CACF,CAAA;AA7IY,oBAAoB;IADhC,sBAAU,EAAE;;GACA,oBAAoB,CA6IhC;AA7IY,oDAAoB"}
@@ -0,0 +1,11 @@
1
+ import { EventEmitter } from "fbemitter";
2
+ import { IScannerDeviceConfiguration, IVendorScannerDevice } from "./interfaces/scanner/IScanner";
3
+ /**
4
+ * The create method is used to create an instance of deviceProvider matching IPaymentDeviceService. It hides the
5
+ * native component initialization from the caller.
6
+ *
7
+ * @param {EventEmitter} evenEmitter
8
+ * @param {IScannerDeviceConfiguration} configuration
9
+ * @return {IScannerDevice}
10
+ */
11
+ export declare function createScannerDevice(eventEmitter: EventEmitter, configuration: IScannerDeviceConfiguration): IVendorScannerDevice;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const scp_component_logging_1 = require("@aptos-scp/scp-component-logging");
4
+ const inversify_config_1 = require("./configs/inversify/inversify.config");
5
+ const logger = scp_component_logging_1.LogManager.getLogger("com.aptos.deviceservices.ScannerDeviceFactory");
6
+ /**
7
+ * The create method is used to create an instance of deviceProvider matching IPaymentDeviceService. It hides the
8
+ * native component initialization from the caller.
9
+ *
10
+ * @param {EventEmitter} evenEmitter
11
+ * @param {IScannerDeviceConfiguration} configuration
12
+ * @return {IScannerDevice}
13
+ */
14
+ function createScannerDevice(eventEmitter, configuration) {
15
+ const entryMessage = logger.traceEntry("createPaymentDeviceService", eventEmitter, configuration);
16
+ let device = inversify_config_1.deviceServiceContainer.get(configuration.deviceProvider);
17
+ device.configureScannerDevice(eventEmitter, configuration);
18
+ /**
19
+ * note: the starting of listeners and device initialization can happen here as well if desired.
20
+ * this will allow client to create and go without an initial 'start' call. the start is required before
21
+ * initialize because the listeners need to be ready for events sent regarding initialization status.
22
+ */
23
+ logger.traceExit(entryMessage);
24
+ return device;
25
+ }
26
+ exports.createScannerDevice = createScannerDevice;
27
+ //# sourceMappingURL=ScannerDeviceFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScannerDeviceFactory.js","sourceRoot":"","sources":["../src/ScannerDeviceFactory.ts"],"names":[],"mappings":";;AAAA,4EAAyF;AAEzF,2EAA8E;AAG9E,MAAM,MAAM,GAAY,kCAAU,CAAC,SAAS,CAAC,+CAA+C,CAAC,CAAC;AAE9F;;;;;;;GAOG;AACH,6BAAoC,YAA0B,EAC1D,aAA0C;IAE5C,MAAM,YAAY,GACd,MAAM,CAAC,UAAU,CAAC,4BAA4B,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;IAEjF,IAAI,MAAM,GAAyB,yCAAsB,CAAC,GAAG,CAAuB,aAAa,CAAC,cAAc,CAAC,CAAC;IAClH,MAAM,CAAC,sBAAsB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAC3D;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAC/B,MAAM,CAAC,MAAM,CAAC;AAChB,CAAC;AAfD,kDAeC"}
@@ -0,0 +1,13 @@
1
+ import { EventEmitter } from "fbemitter";
2
+ import { IScannerDeviceConfiguration, IScannerDeviceService, IVendorScannerDevice } from "./interfaces/scanner/IScanner";
3
+ export declare class ScannerDeviceService implements IScannerDeviceService {
4
+ protected _map: Map<number, IVendorScannerDevice[]>;
5
+ constructor();
6
+ initialize(emitter: EventEmitter, configs: IScannerDeviceConfiguration[]): Promise<void>;
7
+ start(): Promise<void>;
8
+ stop(): Promise<void>;
9
+ tearDown(): Promise<void>;
10
+ enable(): Promise<void>;
11
+ disable(): Promise<void>;
12
+ private reset();
13
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ return new (P || (P = Promise))(function (resolve, reject) {
13
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
16
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
17
+ });
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const scp_component_logging_1 = require("@aptos-scp/scp-component-logging");
21
+ const inversify_1 = require("inversify");
22
+ const ScannerDeviceFactory_1 = require("./ScannerDeviceFactory");
23
+ const logger = scp_component_logging_1.LogManager.getLogger("com.aptos.deviceservices.ScannerDeviceService");
24
+ ;
25
+ let ScannerDeviceService = class ScannerDeviceService {
26
+ constructor() {
27
+ const entryMessage = logger.traceEntry("constructor");
28
+ this.reset();
29
+ logger.traceExit(entryMessage);
30
+ }
31
+ initialize(emitter, configs) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const entryMessage = logger.traceEntry("initialize", emitter, configs);
34
+ /**
35
+ * There are multiple ways in which this can be accomplished. It largely
36
+ * depends on how the underlying devices will be utilized and in what way
37
+ * they will be configured.
38
+ *
39
+ * The initial primary idea is to have a mapping of request types and
40
+ * cooresponding provider (device) that command should be using.
41
+ */
42
+ if (!(configs instanceof Array)) {
43
+ configs = [configs];
44
+ }
45
+ configs.map((config) => {
46
+ let device = ScannerDeviceFactory_1.createScannerDevice(emitter, config);
47
+ // todo: once configuration integration is in place, add the device to the cooresponding actions.
48
+ // e.g. if enableCameraScanner is specified on config, add it to the enableCameraScanner action.
49
+ this._map.get(2 /* StartScannerDevice */).push(device);
50
+ this._map.get(3 /* StopScannerDevice */).push(device);
51
+ this._map.get(4 /* TearDownScannerDevice */).push(device);
52
+ this._map.get(1 /* EnableScannerDevice */).push(device);
53
+ this._map.get(0 /* DisableScannerDevice */).push(device);
54
+ });
55
+ logger.traceExit(entryMessage);
56
+ });
57
+ }
58
+ start() {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const entryMessage = logger.traceEntry("start");
61
+ this._map.get(2 /* StartScannerDevice */).map((device) => device.startScannerDevice());
62
+ logger.traceExit(entryMessage);
63
+ });
64
+ }
65
+ stop() {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const entryMessage = logger.traceEntry("stop");
68
+ this._map.get(3 /* StopScannerDevice */).map((device) => device.stopScannerDevice());
69
+ logger.traceExit(entryMessage);
70
+ });
71
+ }
72
+ tearDown() {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const entryMessage = logger.traceEntry("tearDown");
75
+ this._map.get(4 /* TearDownScannerDevice */).map((device) => device.tearDownScannerDevice());
76
+ logger.traceExit(entryMessage);
77
+ });
78
+ }
79
+ enable() {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const entryMessage = logger.traceEntry("enable");
82
+ this._map.get(1 /* EnableScannerDevice */).map((device) => device.enableScannerDevice());
83
+ logger.traceExit(entryMessage);
84
+ });
85
+ }
86
+ disable() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const entryMessage = logger.traceEntry("disable");
89
+ this._map.get(0 /* DisableScannerDevice */).map((device) => device.disableScannerDevice());
90
+ logger.traceExit(entryMessage);
91
+ });
92
+ }
93
+ reset() {
94
+ const entryMessage = logger.traceEntry("reset");
95
+ this._map = new Map([
96
+ [2 /* StartScannerDevice */, []],
97
+ [3 /* StopScannerDevice */, []],
98
+ [4 /* TearDownScannerDevice */, []],
99
+ [1 /* EnableScannerDevice */, []],
100
+ [0 /* DisableScannerDevice */, []]
101
+ ]);
102
+ logger.traceExit(entryMessage);
103
+ }
104
+ };
105
+ ScannerDeviceService = __decorate([
106
+ inversify_1.injectable(),
107
+ __metadata("design:paramtypes", [])
108
+ ], ScannerDeviceService);
109
+ exports.ScannerDeviceService = ScannerDeviceService;
110
+ //# sourceMappingURL=ScannerDeviceService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScannerDeviceService.js","sourceRoot":"","sources":["../src/ScannerDeviceService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,4EAAyF;AAEzF,yCAAuC;AAMvC,iEAA6D;AAE7D,MAAM,MAAM,GAAY,kCAAU,CAAC,SAAS,CAAC,+CAA+C,CA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CAAC;QACjC,CAAC;KAAA;IAEO,KAAK;QACX,MAAM,YAAY,GAAqB,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAiC;YAClD,6BAAgC,EAAE,CAAC;YACnC,4BAA+B,EAAE,CAAC;YAClC,gCAAmC,EAAE,CAAC;YACtC,8BAAiC,EAAE,CAAC;YACpC,+BAAkC,EAAE,CAAC;SACtC,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;CACF,CAAA;AAvFY,oBAAoB;IADhC,sBAAU,EAAE;;GACA,oBAAoB,CAuFhC;AAvFY,oDAAoB"}
@@ -0,0 +1,3 @@
1
+ import { Container } from "inversify";
2
+ declare const deviceServiceContainer: Container;
3
+ export { deviceServiceContainer };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const scp_component_logging_1 = require("@aptos-scp/scp-component-logging");
4
+ const inversify_1 = require("inversify");
5
+ const index_1 = require("../../AurusDevice/index");
6
+ const constants_1 = require("../../constants/constants");
7
+ const deviceServiceContainer = new inversify_1.Container({ defaultScope: "Singleton" });
8
+ exports.deviceServiceContainer = deviceServiceContainer;
9
+ const logger = scp_component_logging_1.LogManager.getLogger("com.aptos.deviceservices.inversify");
10
+ //note: functionalize if needed.
11
+ const entryMessage = logger.traceEntry("initializeDeviceServices");
12
+ const aurusDevice = new index_1.AurusDevice();
13
+ deviceServiceContainer.bind(constants_1.DI_TYPES.AurusPaymentDevice)
14
+ .toConstantValue(aurusDevice);
15
+ deviceServiceContainer.bind(constants_1.DI_TYPES.AurusScannerDevice)
16
+ .toConstantValue(aurusDevice);
17
+ logger.traceExit(entryMessage);
18
+ //# sourceMappingURL=inversify.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inversify.config.js","sourceRoot":"","sources":["../../../src/configs/inversify/inversify.config.ts"],"names":[],"mappings":";;AAAA,4EAAyF;AACzF,yCAAsC;AACtC,mDAAsD;AACtD,yDAAqD;AAIrD,MAAM,sBAAsB,GAAc,IAAI,qBAAS,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;AAY9E,wDAAsB;AAX/B,MAAM,MAAM,GAAY,kCAAU,CAAC,SAAS,CAAC,oCAAoC,CAAC,CAAC;AAEnF,gCAAgC;AAChC,MAAM,YAAY,GAAqB,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;AACrF,MAAM,WAAW,GAAgB,IAAI,mBAAW,EAAE,CAAC;AACnD,sBAAsB,CAAC,IAAI,CAAuB,oBAAQ,CAAC,kBAAkB,CAAC;KACzE,eAAe,CAAC,WAAW,CAAC,CAAC;AAClC,sBAAsB,CAAC,IAAI,CAAuB,oBAAQ,CAAC,kBAAkB,CAAC;KACzE,eAAe,CAAC,WAAW,CAAC,CAAC;AAClC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC"}
@@ -1,10 +1,11 @@
1
- export declare const Providers: {
2
- ADYEN: string;
3
- AURUS: string;
1
+ export declare const DI_TYPES: {
2
+ AurusPaymentDevice: string;
3
+ AurusScannerDevice: string;
4
4
  };
5
5
  export declare const EventResponseTypes: {
6
6
  Authorization: string;
7
7
  PaymentDeviceStatus: string;
8
+ Scan: string;
8
9
  };
9
10
  export declare enum CardType {
10
11
  Unknown = 0,
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Providers = {
4
- ADYEN: "Adyen",
5
- AURUS: "Aurus"
3
+ exports.DI_TYPES = {
4
+ AurusPaymentDevice: "AurusPaymentDevice",
5
+ AurusScannerDevice: "AurusScannerDevice"
6
6
  };
7
7
  exports.EventResponseTypes = {
8
8
  Authorization: "AuthorizationResponse",
9
- PaymentDeviceStatus: "PaymentDeviceStatus"
9
+ PaymentDeviceStatus: "PaymentDeviceStatus",
10
+ Scan: "ScanData"
10
11
  };
11
12
  var CardType;
12
13
  (function (CardType) {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants/constants.ts"],"names":[],"mappings":";;AAAa,QAAA,SAAS,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,kBAAkB,GAAG;IAChC,aAAa,EAAE,uBAAuB;IACtC,mBAAmB,EAAE,qBAAqB;CAC3C,CAAC;AAEF,IAAY,QAWX;AAXD,WAAY,QAAQ;IAClB,6CAAO,CAAA;IACP,uCAAI,CAAA;IACJ,mDAAU,CAAA;IACV,6DAAe,CAAA;IACf,mDAAU,CAAA;IACV,+CAAQ,CAAA;IACR,qCAAG,CAAA;IACH,uDAAY,CAAA;IACZ,yCAAK,CAAA;IACL,uCAAI,CAAA;AACN,CAAC,EAXW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAWnB;AAAA,CAAC;AAEF,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,2DAAI,CAAA;IACJ,+DAAM,CAAA;IACN,2DAAI,CAAA;IACJ,mFAAgB,CAAA;IAChB,+FAAsB,CAAA;IACtB,6EAAa,CAAA;IACb,+EAAc,CAAA;IACd,uFAAkB,CAAA;IAClB,uFAAkB,CAAA;IAClB,iFAAe,CAAA;AACjB,CAAC,EAXW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAW7B;AAAA,CAAC;AAEF,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,yDAAQ,CAAA;IACR,mDAAK,CAAA;IACL,uDAAO,CAAA;IACP,uDAAO,CAAA;AACT,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB;AAAA,CAAC;AAEF,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,+EAAsB,CAAA;IACtB,mFAAwB,CAAA;IACxB,iEAAe,CAAA;IACf,qEAAiB,CAAA;AACnB,CAAC,EALW,UAAU,GAAV,kBAAU,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AAA;AACT,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB;AAAA,CAAC;AAEF,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,+EAAsB,CAAA;IACtB,mFAAwB,CAAA;IACxB,iEAAe,CAAA;IACf,qEAAiB,CAAA;AACnB,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB;AAED,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,iDAAO,CAAA;IACP,2CAAI,CAAA;IACJ,6DAAa,CAAA;IACb,+CAAM,CAAA;IACN,6CAAK,CAAA;IACL,2CAAI,CAAA;AACN,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB;AAAA,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./constants";
2
2
  export * from "./interfaces";
3
3
  export * from "./PaymentDeviceService";
4
+ export * from "./ScannerDeviceService";
package/lib/index.js CHANGED
@@ -5,4 +5,5 @@ function __export(m) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  __export(require("./constants"));
7
7
  __export(require("./PaymentDeviceService"));
8
+ __export(require("./ScannerDeviceService"));
8
9
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,iCAA4B;AAE5B,4CAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,iCAA4B;AAE5B,4CAAuC;AACvC,4CAAuC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./IDeviceStatus";
2
2
  export * from "./payment";
3
+ export * from "./scanner";
@@ -1,19 +1,13 @@
1
+ import { EventEmitter } from "fbemitter";
1
2
  import { IBankCardRequest, IGiftCardRequest } from "./messages/requests";
2
- export interface IAuthorizationContext {
3
- sessionId: string;
4
- }
5
- export interface IPaymentDevice {
6
- initialize(): Promise<void>;
7
- start(): Promise<void>;
8
- stop(): Promise<void>;
9
- tearDown(): Promise<void>;
10
- captureSale(authRequest: IBankCardRequest): Promise<IAuthorizationContext>;
11
- captureRefund(authRequest: IBankCardRequest): Promise<IAuthorizationContext>;
12
- giftcardActivate(authRequest: IGiftCardRequest): Promise<IAuthorizationContext>;
13
- giftcardBalance(authRequest: IGiftCardRequest): Promise<IAuthorizationContext>;
14
- giftcardIssue(authRequest: IGiftCardRequest): Promise<IAuthorizationContext>;
15
- giftcardRedeem(authRequest: IGiftCardRequest): Promise<IAuthorizationContext>;
16
- void(authRequest: IBankCardRequest): Promise<IAuthorizationContext>;
3
+ export interface IPaymentDeviceCommon {
4
+ captureSale(authRequest: IBankCardRequest): Promise<void>;
5
+ captureRefund(authRequest: IBankCardRequest): Promise<void>;
6
+ giftcardActivate(authRequest: IGiftCardRequest): Promise<void>;
7
+ giftcardBalance(authRequest: IGiftCardRequest): Promise<void>;
8
+ giftcardIssue(authRequest: IGiftCardRequest): Promise<void>;
9
+ giftcardRedeem(authRequest: IGiftCardRequest): Promise<void>;
10
+ void(authRequest: IBankCardRequest): Promise<void>;
17
11
  }
18
12
  export interface IPaymentDeviceConfiguration {
19
13
  deviceProvider: string;
@@ -21,5 +15,15 @@ export interface IPaymentDeviceConfiguration {
21
15
  storeNumber?: string;
22
16
  terminalNumber?: string;
23
17
  }
24
- export interface IPaymentDeviceService extends IPaymentDevice {
18
+ export interface IPaymentDeviceService extends IPaymentDeviceCommon {
19
+ initialize(emitter: EventEmitter, configs: IPaymentDeviceConfiguration[]): Promise<void>;
20
+ start(): Promise<void>;
21
+ stop(): Promise<void>;
22
+ tearDown(): Promise<void>;
23
+ }
24
+ export interface IVendorPaymentDevice extends IPaymentDeviceCommon {
25
+ configurePaymentDevice(emitter: EventEmitter, config: IPaymentDeviceConfiguration): Promise<void>;
26
+ startPaymentDevice(): Promise<void>;
27
+ stopPaymentDevice(): Promise<void>;
28
+ tearDownPaymentDevice(): Promise<void>;
25
29
  }
@@ -0,0 +1,29 @@
1
+ import { EventEmitter } from "fbemitter";
2
+ export interface IScanDataNotification {
3
+ data: string;
4
+ encoding: string;
5
+ }
6
+ export interface IScannerDeviceCommon {
7
+ }
8
+ export interface IScannerDeviceConfiguration {
9
+ deviceProvider: string;
10
+ encoding?: string;
11
+ useExternalScanner?: boolean;
12
+ treatScannerAsKeyboard?: boolean;
13
+ }
14
+ export interface IScannerDeviceService extends IScannerDeviceCommon {
15
+ initialize(emitter: EventEmitter, configs: IScannerDeviceConfiguration[]): Promise<void>;
16
+ start(): Promise<void>;
17
+ stop(): Promise<void>;
18
+ tearDown(): Promise<void>;
19
+ enable(): Promise<void>;
20
+ disable(): Promise<void>;
21
+ }
22
+ export interface IVendorScannerDevice extends IScannerDeviceCommon {
23
+ configureScannerDevice(emitter: EventEmitter, config: IScannerDeviceConfiguration): Promise<void>;
24
+ startScannerDevice(): Promise<void>;
25
+ stopScannerDevice(): Promise<void>;
26
+ tearDownScannerDevice(): Promise<void>;
27
+ enableScannerDevice(): Promise<void>;
28
+ disableScannerDevice(): Promise<void>;
29
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IScanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IScanner.js","sourceRoot":"","sources":["../../../src/interfaces/scanner/IScanner.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from "./IScanner";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map