gap-nodejs-sdk 1.0.69 → 1.0.72
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/clover/Clover.d.ts +8 -14
- package/dist/clover/Clover.d.ts.map +1 -1
- package/dist/clover/Clover.js +16 -49
- package/dist/gap-sdk.js +1 -1
- package/dist/go_check_in_api/1.0.0/api/service.js +2 -2
- package/dist/go_check_in_api/1.0.0/types/request/service.d.ts +3 -4
- package/dist/go_check_in_api/1.0.0/types/request/service.d.ts.map +1 -1
- package/dist/http_client/http_client.d.ts.map +1 -1
- package/dist/http_client/http_client.js +2 -2
- package/dist/pos_client_api/1.0.0/api/service.d.ts +1 -0
- package/dist/pos_client_api/1.0.0/api/service.d.ts.map +1 -1
- package/dist/pos_client_api/1.0.0/api/service.js +11 -0
- package/dist/pos_client_api/1.0.0/endpoints/service.d.ts +1 -0
- package/dist/pos_client_api/1.0.0/endpoints/service.d.ts.map +1 -1
- package/dist/pos_client_api/1.0.0/endpoints/service.js +1 -0
- package/dist/pos_client_api/1.0.0/models/service.d.ts +1 -0
- package/dist/pos_client_api/1.0.0/models/service.d.ts.map +1 -1
- package/dist/pos_client_api/1.0.0/models/service.js +12 -0
- package/dist/pos_client_api/1.0.0/types/request/service.d.ts +3 -0
- package/dist/pos_client_api/1.0.0/types/request/service.d.ts.map +1 -1
- package/dist/pos_client_api/1.0.0/types/response/service.d.ts +9 -0
- package/dist/pos_client_api/1.0.0/types/response/service.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/clover/payment_response_model.d.ts +0 -27
- package/dist/clover/payment_response_model.d.ts.map +0 -1
- package/dist/clover/payment_response_model.js +0 -93
package/dist/clover/Clover.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as clover from "@xuantan97/remote-pay-cloud";
|
|
2
|
-
import { PaymentResponseModel } from "./payment_response_model";
|
|
3
2
|
import { AdjustInput, PaymentInput, RefundInput, RetrieveInput, VoidInput } from "./types";
|
|
4
3
|
export default class Clover {
|
|
5
4
|
static instance: Clover | null;
|
|
@@ -10,10 +9,8 @@ export default class Clover {
|
|
|
10
9
|
cloverConfig: any;
|
|
11
10
|
cloverConnectionListener: clover.remotepay.ICloverConnectorListener;
|
|
12
11
|
isReady: boolean;
|
|
13
|
-
onPairingCode
|
|
14
|
-
onPairingSuccess
|
|
15
|
-
deviceError: clover.remotepay.CloverDeviceErrorEvent | null;
|
|
16
|
-
deviceDisconnected: boolean;
|
|
12
|
+
onPairingCode: (pairingCode: string) => void;
|
|
13
|
+
onPairingSuccess: (authToken: string) => void;
|
|
17
14
|
saleResponse: clover.remotepay.SaleResponse | null;
|
|
18
15
|
authResponse: clover.remotepay.AuthResponse | null;
|
|
19
16
|
tipAdjustAuthResponse: clover.remotepay.TipAdjustAuthResponse | null;
|
|
@@ -22,22 +19,20 @@ export default class Clover {
|
|
|
22
19
|
closeoutResponse: clover.remotepay.CloseoutResponse | null;
|
|
23
20
|
retrievePaymentResponse: clover.remotepay.RetrievePaymentResponse | null;
|
|
24
21
|
retrievePendingPaymentsResponse: clover.remotepay.RetrievePendingPaymentsResponse | null;
|
|
25
|
-
retrieveDeviceStatusResponse: clover.remotepay.RetrieveDeviceStatusResponse | null;
|
|
26
|
-
paymentResponse: PaymentResponseModel | null;
|
|
27
22
|
constructor({ cloverConfig, onPairingCode, onPairingSuccess }: {
|
|
28
23
|
cloverConfig: any;
|
|
29
|
-
onPairingCode
|
|
30
|
-
onPairingSuccess
|
|
24
|
+
onPairingCode: (pairingCode: string) => void;
|
|
25
|
+
onPairingSuccess: (authToken: string) => void;
|
|
31
26
|
});
|
|
32
27
|
static createInstance(options?: {
|
|
33
28
|
cloverConfig: any;
|
|
34
|
-
onPairingCode
|
|
35
|
-
onPairingSuccess
|
|
29
|
+
onPairingCode: (pairingCode: string) => void;
|
|
30
|
+
onPairingSuccess: (authToken: string) => void;
|
|
36
31
|
}): Clover;
|
|
37
32
|
static getInstance(options?: {
|
|
38
33
|
cloverConfig: any;
|
|
39
|
-
onPairingCode
|
|
40
|
-
onPairingSuccess
|
|
34
|
+
onPairingCode: (pairingCode: string) => void;
|
|
35
|
+
onPairingSuccess: (authToken: string) => void;
|
|
41
36
|
}): Clover;
|
|
42
37
|
connect(): void;
|
|
43
38
|
doSale(paymentInput: PaymentInput): void;
|
|
@@ -50,7 +45,6 @@ export default class Clover {
|
|
|
50
45
|
doCloseout(): void;
|
|
51
46
|
cleanup(): void;
|
|
52
47
|
showMessage(message: any): void;
|
|
53
|
-
checkDeviceStatus(): void;
|
|
54
48
|
private buildCloverConnectionListener;
|
|
55
49
|
private getDeviceConfigurationForNetwork;
|
|
56
50
|
private resetDevice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clover.d.ts","sourceRoot":"","sources":["../../src/clover/Clover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Clover.d.ts","sourceRoot":"","sources":["../../src/clover/Clover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3F,MAAM,CAAC,OAAO,OAAO,MAAM;IACvB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAQ;IACjE,WAAW,EAAE,GAAG,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAIlB,kBAAkB,EAAE,GAAG,CAAQ;IAC/B,YAAY,EAAE,GAAG,CAAC;IAClB,wBAAwB,EAAE,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC;IACpE,OAAO,EAAE,OAAO,CAAS;IAEzB,aAAa,EAAE,CAAC,W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AAC;QAC7C,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;KACjD;IASD,OAAO;IAYP,MAAM,CAAC,YAAY,EAAE,YAAY;IAmBjC,MAAM,CAAC,YAAY,EAAE,YAAY;IAmBjC,WAAW,CAAC,WAAW,EAAE,WAAW;IAgBpC,MAAM,CAAC,SAAS,EAAE,SAAS;IAgB3B,QAAQ,CAAC,WAAW,EAAE,WAAW;IAgBjC,iBAAiB,CAAC,aAAa,EAAE,aAAa;IAc9C,wBAAwB;IAUxB,UAAU;IAcV,OAAO;IAMP,WAAW,CAAC,OAAO,KAAA;IAInB,OAAO,CAAC,6BAA6B;IAuLrC,OAAO,CAAC,gCAAgC;IAwBxC,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,kBAAkB;CAmB7B"}
|
package/dist/clover/Clover.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as clover from "@xuantan97/remote-pay-cloud";
|
|
2
|
-
import { PaymentResponseModel } from "./payment_response_model";
|
|
3
2
|
export default class Clover {
|
|
4
3
|
constructor({ cloverConfig, onPairingCode, onPairingSuccess }) {
|
|
5
4
|
this.cloverConnector = null;
|
|
@@ -8,8 +7,6 @@ export default class Clover {
|
|
|
8
7
|
// across page refreshes, etc.
|
|
9
8
|
this.pendingSaleRequest = null;
|
|
10
9
|
this.isReady = false;
|
|
11
|
-
this.deviceError = null;
|
|
12
|
-
this.deviceDisconnected = true;
|
|
13
10
|
this.saleResponse = null;
|
|
14
11
|
this.authResponse = null;
|
|
15
12
|
this.tipAdjustAuthResponse = null;
|
|
@@ -18,8 +15,6 @@ export default class Clover {
|
|
|
18
15
|
this.closeoutResponse = null;
|
|
19
16
|
this.retrievePaymentResponse = null;
|
|
20
17
|
this.retrievePendingPaymentsResponse = null;
|
|
21
|
-
this.retrieveDeviceStatusResponse = null;
|
|
22
|
-
this.paymentResponse = null;
|
|
23
18
|
this.cloverConfig = cloverConfig;
|
|
24
19
|
this.onPairingCode = onPairingCode;
|
|
25
20
|
this.onPairingSuccess = onPairingSuccess;
|
|
@@ -54,7 +49,6 @@ export default class Clover {
|
|
|
54
49
|
doSale(paymentInput) {
|
|
55
50
|
var _a;
|
|
56
51
|
this.saleResponse = null;
|
|
57
|
-
this.paymentResponse = null;
|
|
58
52
|
if (!this.pendingSaleRequest) {
|
|
59
53
|
this.pendingSaleRequest = new clover.remotepay.SaleRequest();
|
|
60
54
|
this.pendingSaleRequest.setExternalId(paymentInput.refId);
|
|
@@ -75,7 +69,6 @@ export default class Clover {
|
|
|
75
69
|
doAuth(paymentInput) {
|
|
76
70
|
var _a;
|
|
77
71
|
this.authResponse = null;
|
|
78
|
-
this.paymentResponse = null;
|
|
79
72
|
if (!this.pendingSaleRequest) {
|
|
80
73
|
this.pendingSaleRequest = new clover.remotepay.AuthRequest();
|
|
81
74
|
this.pendingSaleRequest.setExternalId(paymentInput.refId);
|
|
@@ -96,7 +89,6 @@ export default class Clover {
|
|
|
96
89
|
doTipAdjust(adjustInput) {
|
|
97
90
|
var _a;
|
|
98
91
|
this.tipAdjustAuthResponse = null;
|
|
99
|
-
this.paymentResponse = null;
|
|
100
92
|
if (!this.pendingSaleRequest) {
|
|
101
93
|
this.pendingSaleRequest = new clover.remotepay.TipAdjustAuthRequest();
|
|
102
94
|
this.pendingSaleRequest.setOrderId(adjustInput.orderId);
|
|
@@ -114,7 +106,6 @@ export default class Clover {
|
|
|
114
106
|
doVoid(voidInput) {
|
|
115
107
|
var _a;
|
|
116
108
|
this.voidPaymentResponse = null;
|
|
117
|
-
this.paymentResponse = null;
|
|
118
109
|
if (!this.pendingSaleRequest) {
|
|
119
110
|
this.pendingSaleRequest = new clover.remotepay.VoidPaymentRequest();
|
|
120
111
|
this.pendingSaleRequest.setOrderId(voidInput.orderId);
|
|
@@ -132,7 +123,6 @@ export default class Clover {
|
|
|
132
123
|
doRefund(refundInput) {
|
|
133
124
|
var _a;
|
|
134
125
|
this.refundPaymentResponse = null;
|
|
135
|
-
this.paymentResponse = null;
|
|
136
126
|
if (!this.pendingSaleRequest) {
|
|
137
127
|
this.pendingSaleRequest = new clover.remotepay.RefundPaymentRequest();
|
|
138
128
|
this.pendingSaleRequest.setOrderId(refundInput.orderId);
|
|
@@ -150,7 +140,6 @@ export default class Clover {
|
|
|
150
140
|
doRetrievePayment(retrieveInput) {
|
|
151
141
|
var _a;
|
|
152
142
|
this.retrievePaymentResponse = null;
|
|
153
|
-
this.paymentResponse = null;
|
|
154
143
|
if (!this.pendingSaleRequest) {
|
|
155
144
|
this.pendingSaleRequest = new clover.remotepay.RetrievePaymentRequest();
|
|
156
145
|
this.pendingSaleRequest.setExternalId(retrieveInput.refId);
|
|
@@ -166,7 +155,6 @@ export default class Clover {
|
|
|
166
155
|
doRetrievePendingPayment() {
|
|
167
156
|
var _a;
|
|
168
157
|
this.retrievePendingPaymentsResponse = null;
|
|
169
|
-
this.paymentResponse = null;
|
|
170
158
|
if (!this.pendingSaleRequest) {
|
|
171
159
|
console.log({ message: "Sending retrieve pending payments" });
|
|
172
160
|
(_a = this.cloverConnector) === null || _a === void 0 ? void 0 : _a.retrievePendingPayments();
|
|
@@ -178,7 +166,6 @@ export default class Clover {
|
|
|
178
166
|
doCloseout() {
|
|
179
167
|
var _a;
|
|
180
168
|
this.closeoutResponse = null;
|
|
181
|
-
this.paymentResponse = null;
|
|
182
169
|
if (!this.pendingSaleRequest) {
|
|
183
170
|
this.pendingSaleRequest = new clover.remotepay.CloseoutRequest();
|
|
184
171
|
this.pendingSaleRequest.setAllowOpenTabs(false);
|
|
@@ -200,17 +187,8 @@ export default class Clover {
|
|
|
200
187
|
var _a;
|
|
201
188
|
(_a = this.cloverConnector) === null || _a === void 0 ? void 0 : _a.showMessage(message);
|
|
202
189
|
}
|
|
203
|
-
checkDeviceStatus() {
|
|
204
|
-
var _a;
|
|
205
|
-
this.retrieveDeviceStatusResponse = null;
|
|
206
|
-
let retrieveDeviceStatus = new clover.remotepay.RetrieveDeviceStatusRequest();
|
|
207
|
-
(_a = this.cloverConnector) === null || _a === void 0 ? void 0 : _a.retrieveDeviceStatus(retrieveDeviceStatus);
|
|
208
|
-
}
|
|
209
190
|
buildCloverConnectionListener() {
|
|
210
191
|
return Object.assign({}, clover.remotepay.ICloverConnectorListener.prototype, {
|
|
211
|
-
onDeviceConnected: () => {
|
|
212
|
-
this.deviceDisconnected = false;
|
|
213
|
-
},
|
|
214
192
|
onSaleResponse: (response) => {
|
|
215
193
|
var _a;
|
|
216
194
|
console.log({ message: "Payment response received", response: response });
|
|
@@ -218,7 +196,6 @@ export default class Clover {
|
|
|
218
196
|
const requestExternalId = this.pendingSaleRequest.getExternalId();
|
|
219
197
|
this.pendingSaleRequest = null; // The sale is complete
|
|
220
198
|
this.saleResponse = response;
|
|
221
|
-
this.paymentResponse = PaymentResponseModel.build(response);
|
|
222
199
|
if (response.getSuccess()) {
|
|
223
200
|
const payment = response.getPayment();
|
|
224
201
|
// We are choosing to void the payment if it was not authorized for the full amount.
|
|
@@ -246,7 +223,6 @@ export default class Clover {
|
|
|
246
223
|
const requestExternalId = this.pendingSaleRequest.getExternalId();
|
|
247
224
|
this.pendingSaleRequest = null; // The sale is complete
|
|
248
225
|
this.authResponse = response;
|
|
249
|
-
this.paymentResponse = PaymentResponseModel.build(response);
|
|
250
226
|
if (response.getSuccess()) {
|
|
251
227
|
const payment = response.getPayment();
|
|
252
228
|
//auto tip = 0 on auth
|
|
@@ -277,7 +253,6 @@ export default class Clover {
|
|
|
277
253
|
console.log({ message: "Payment response received", response: response });
|
|
278
254
|
this.pendingSaleRequest = null; // The sale is complete
|
|
279
255
|
this.tipAdjustAuthResponse = response;
|
|
280
|
-
this.paymentResponse = PaymentResponseModel.build(response);
|
|
281
256
|
if (response.getSuccess()) {
|
|
282
257
|
}
|
|
283
258
|
else {
|
|
@@ -288,7 +263,6 @@ export default class Clover {
|
|
|
288
263
|
console.log({ message: "Payment response received", response: response });
|
|
289
264
|
this.pendingSaleRequest = null; // The sale is complete
|
|
290
265
|
this.voidPaymentResponse = response;
|
|
291
|
-
this.paymentResponse = PaymentResponseModel.build(response);
|
|
292
266
|
if (response.getSuccess()) {
|
|
293
267
|
}
|
|
294
268
|
else {
|
|
@@ -299,7 +273,6 @@ export default class Clover {
|
|
|
299
273
|
console.log({ message: "Payment response received", response: response });
|
|
300
274
|
this.pendingSaleRequest = null; // The sale is complete
|
|
301
275
|
this.refundPaymentResponse = response;
|
|
302
|
-
this.paymentResponse = PaymentResponseModel.build(response);
|
|
303
276
|
if (response.getSuccess()) {
|
|
304
277
|
}
|
|
305
278
|
else {
|
|
@@ -310,7 +283,6 @@ export default class Clover {
|
|
|
310
283
|
console.log({ message: "Payment response received", response: response });
|
|
311
284
|
this.pendingSaleRequest = null; // The sale is complete
|
|
312
285
|
this.closeoutResponse = response;
|
|
313
|
-
this.paymentResponse = PaymentResponseModel.build(response);
|
|
314
286
|
if (response.getSuccess()) {
|
|
315
287
|
}
|
|
316
288
|
else {
|
|
@@ -372,7 +344,6 @@ export default class Clover {
|
|
|
372
344
|
if (!this.pendingSaleRequest) {
|
|
373
345
|
console.log({ message: "Device Ready to process requests!", merchantInfo: merchantInfo });
|
|
374
346
|
this.isReady = true;
|
|
375
|
-
this.deviceError = null;
|
|
376
347
|
}
|
|
377
348
|
else {
|
|
378
349
|
// We have an unresolved sale. The connection to the device was lost and the customer is in the
|
|
@@ -384,31 +355,27 @@ export default class Clover {
|
|
|
384
355
|
(_a = this.cloverConnector) === null || _a === void 0 ? void 0 : _a.retrieveDeviceStatus(retrieveDeviceStatusRequest);
|
|
385
356
|
}
|
|
386
357
|
},
|
|
387
|
-
onDeviceError: (cloverDeviceErrorEvent)
|
|
388
|
-
|
|
358
|
+
onDeviceError: function (cloverDeviceErrorEvent) {
|
|
359
|
+
console.log({ message: `An error has occurred: ${cloverDeviceErrorEvent.getMessage()}` });
|
|
360
|
+
console.log(`An error has occurred: ${cloverDeviceErrorEvent.getMessage()}`, false);
|
|
389
361
|
},
|
|
390
|
-
onDeviceDisconnected: ()
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
onRetrieveDeviceStatusResponse: (response) => {
|
|
394
|
-
this.retrieveDeviceStatusResponse = response;
|
|
362
|
+
onDeviceDisconnected: function () {
|
|
363
|
+
console.log({ message: "You have been disconnected from the Clover device." });
|
|
364
|
+
console.log("The connection to your Clover Device has been dropped.", false);
|
|
395
365
|
}
|
|
396
366
|
});
|
|
397
367
|
}
|
|
398
368
|
getDeviceConfigurationForNetwork() {
|
|
399
|
-
const onPairingCode = (pairingCode) => {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
if (typeof this.onPairingSuccess === 'undefined') {
|
|
410
|
-
this.pairingCode = onPairingSuccess;
|
|
411
|
-
}
|
|
369
|
+
// const onPairingCode = (pairingCode) => {
|
|
370
|
+
// const pairingCodeMessage = `Please enter pairing code ${pairingCode} on the device`;
|
|
371
|
+
// console.log(` > ${pairingCodeMessage}`);
|
|
372
|
+
// this.pairingCode = pairingCode;
|
|
373
|
+
// };
|
|
374
|
+
// const onPairingSuccess = (authTokenFromPairing) => {
|
|
375
|
+
// console.log(` > Got Pairing Auth Token: ${authTokenFromPairing}`);
|
|
376
|
+
// this.authToken = authTokenFromPairing;
|
|
377
|
+
// this.pairingCode = null;
|
|
378
|
+
// };
|
|
412
379
|
const configBuilder = new clover.WebSocketPairedCloverDeviceConfigurationBuilder(this.cloverConfig.applicationId, this.cloverConfig.endpoint, this.cloverConfig.posName, this.cloverConfig.serialNumber, this.cloverConfig.authToken, this.onPairingCode, this.onPairingSuccess);
|
|
413
380
|
return configBuilder.build();
|
|
414
381
|
}
|