@achyutlabsau/vue-payment-gateway 0.2.17 → 0.2.19

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
@@ -46,3 +46,15 @@ declare global {
46
46
  interface DocumentEventMap extends CustomEventMap {
47
47
  }
48
48
  }
49
+
50
+
51
+ declare global {
52
+ interface CustomEventMap {
53
+ [TimApiEvents.TxnCompleted]: CustomEvent<{
54
+ event: timapi.TimEvent;
55
+ data: timapi.TransactionResponse;
56
+ }>;
57
+ }
58
+ interface DocumentEventMap extends CustomEventMap {
59
+ }
60
+ }
package/dist/linkly.d.ts CHANGED
@@ -419,3 +419,15 @@ declare global {
419
419
  interface DocumentEventMap extends CustomEventMap {
420
420
  }
421
421
  }
422
+
423
+
424
+ declare global {
425
+ interface CustomEventMap {
426
+ [TimApiEvents.TxnCompleted]: CustomEvent<{
427
+ event: timapi.TimEvent;
428
+ data: timapi.TransactionResponse;
429
+ }>;
430
+ }
431
+ interface DocumentEventMap extends CustomEventMap {
432
+ }
433
+ }
package/dist/mx51.d.ts CHANGED
@@ -128,3 +128,15 @@ declare global {
128
128
  interface DocumentEventMap extends CustomEventMap {
129
129
  }
130
130
  }
131
+
132
+
133
+ declare global {
134
+ interface CustomEventMap {
135
+ [TimApiEvents.TxnCompleted]: CustomEvent<{
136
+ event: timapi.TimEvent;
137
+ data: timapi.TransactionResponse;
138
+ }>;
139
+ }
140
+ interface DocumentEventMap extends CustomEventMap {
141
+ }
142
+ }
package/dist/mx51.js CHANGED
@@ -143,8 +143,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
143
143
  });
144
144
  };
145
145
  onMounted(async () => {
146
- pairForm.value.posId = "T1";
147
- pairForm.value.serialNumber = "500-099-001";
148
146
  const res = await getTenants(state.productVendorName, state.mx51DeviceApiKey);
149
147
  if (res) {
150
148
  tenants.value = res;
@@ -158,3 +158,15 @@ declare global {
158
158
  interface DocumentEventMap extends CustomEventMap {
159
159
  }
160
160
  }
161
+
162
+
163
+ declare global {
164
+ interface CustomEventMap {
165
+ [TimApiEvents.TxnCompleted]: CustomEvent<{
166
+ event: timapi.TimEvent;
167
+ data: timapi.TransactionResponse;
168
+ }>;
169
+ }
170
+ interface DocumentEventMap extends CustomEventMap {
171
+ }
172
+ }
@@ -358,3 +358,15 @@ declare global {
358
358
  interface DocumentEventMap extends CustomEventMap {
359
359
  }
360
360
  }
361
+
362
+
363
+ declare global {
364
+ interface CustomEventMap {
365
+ [TimApiEvents.TxnCompleted]: CustomEvent<{
366
+ event: timapi.TimEvent;
367
+ data: timapi.TransactionResponse;
368
+ }>;
369
+ }
370
+ interface DocumentEventMap extends CustomEventMap {
371
+ }
372
+ }
@@ -0,0 +1,421 @@
1
+ declare namespace timapi {
2
+ class Enumeration {
3
+ constructor(names: string[], startValue: EnumValue);
4
+ values(): any[];
5
+ toString(): string;
6
+ }
7
+
8
+ class EnumValue {
9
+ name: string;
10
+ _value: any;
11
+ constructor(name: string, value: any);
12
+ toString(): string;
13
+ }
14
+
15
+ // interface EnumValue {
16
+ // name: string;
17
+ // _value: number;
18
+ // toString(): string;
19
+ // }
20
+ type TransactionTypeKeys =
21
+ | "purchase"
22
+ | "credit"
23
+ | "reversal"
24
+ | "preAuthorization"
25
+ | "finalizePurchase"
26
+ | "debtRecovery"
27
+ | "cashAdvance"
28
+ | "purchaseForcedAcceptance"
29
+ | "purchaseWithCashback"
30
+ | "purchasePhoneAuthorized"
31
+ | "purchasePhoneOrdered"
32
+ | "purchaseMailOrdered"
33
+ | "accountVerification"
34
+ | "giro"
35
+ | "combined"
36
+ | "authorizeCredit"
37
+ | "authorizeDeposit"
38
+ | "reservation"
39
+ | "adjustReservation"
40
+ | "cancelReservation"
41
+ | "purchaseReservation"
42
+ | "purchaseReservationPhoneAuthorized"
43
+ | "loadVoucher"
44
+ | "collectPoints"
45
+ | "funding"
46
+ | "refunding"
47
+ | "load"
48
+ | "unload"
49
+ | "activateCard";
50
+
51
+ interface Currency {
52
+ readonly code: string;
53
+ readonly name: string;
54
+ readonly exponent: number;
55
+ readonly _wav: number;
56
+ toString(): string;
57
+ }
58
+
59
+ type CurrencyKeys =
60
+ | "AED"
61
+ | "AFN"
62
+ | "ALL"
63
+ | "AMD"
64
+ | "ANG"
65
+ | "AOA"
66
+ | "ARS"
67
+ | "AUD"
68
+ | "AWG"
69
+ | "AZN"
70
+ | "BAM"
71
+ | "BBD"
72
+ | "BDT"
73
+ | "BGN"
74
+ | "BHD"
75
+ | "BIF"
76
+ | "BMD"
77
+ | "BND"
78
+ | "BOB"
79
+ | "BOV"
80
+ | "BRL"
81
+ | "BSD"
82
+ | "BTN"
83
+ | "BWP"
84
+ | "BYN"
85
+ | "BYR"
86
+ | "BZD"
87
+ | "CAD"
88
+ | "CDF"
89
+ | "CHE"
90
+ | "CHF"
91
+ | "CHW"
92
+ | "CLF"
93
+ | "CLP"
94
+ | "CNY"
95
+ | "COP"
96
+ | "COU"
97
+ | "CRC"
98
+ | "CUC"
99
+ | "CUP"
100
+ | "CVE"
101
+ | "CZK"
102
+ | "DJF"
103
+ | "DKK"
104
+ | "DOP"
105
+ | "DZD"
106
+ | "EGP"
107
+ | "ERN"
108
+ | "ETB"
109
+ | "EUR"
110
+ | "FJD"
111
+ | "FKP"
112
+ | "GBP"
113
+ | "GEL"
114
+ | "GHS"
115
+ | "GIP"
116
+ | "GMD"
117
+ | "GNF"
118
+ | "GTQ"
119
+ | "GYD"
120
+ | "HKD"
121
+ | "HNL"
122
+ | "HRK"
123
+ | "HTG"
124
+ | "HUF"
125
+ | "IDR"
126
+ | "ILS"
127
+ | "INR"
128
+ | "IQD"
129
+ | "IRR"
130
+ | "ISK";
131
+
132
+ /* =========================Request Types ====================== */
133
+
134
+ type RequestTypeKeys =
135
+ | "connect"
136
+ | "activate"
137
+ | "applicationInformation"
138
+ | "balance"
139
+ | "changeSettings"
140
+ | "commit"
141
+ | "counterRequest"
142
+ | "deactivate"
143
+ | "dccRates"
144
+ | "hardwareInformation"
145
+ | "initTransaction"
146
+ | "initTransactionWithDialog"
147
+ | "login"
148
+ | "logout"
149
+ | "reboot"
150
+ | "reconciliation"
151
+ | "receiptRequest"
152
+ | "reconfig"
153
+ | "rollback"
154
+ | "systemInformation"
155
+ | "softwareUpdate"
156
+ | "transaction"
157
+ | "closeReader"
158
+ | "openReader"
159
+ | "ejectCard"
160
+ | "openMaintenanceWindow"
161
+ | "closeMaintenanceWindow"
162
+ | "activateServiceMenu"
163
+ | "openDialogMode"
164
+ | "closeDialogMode"
165
+ | "showSignatureCapture"
166
+ | "showDialog"
167
+ | "sendCardCommand"
168
+ | "printOnTerminal"
169
+ | "loyaltyData"
170
+ | "startCheckout"
171
+ | "finishCheckout"
172
+ | "provideLoyaltyBasket"
173
+ | "provideVasResult"
174
+ | "mobileTopupIssuerInfo"
175
+ | "mobileTopup"
176
+ | "balanceInquiry"
177
+ | "requestAlias"
178
+ | "deviceMaintenance"
179
+ | "clientIdentification"
180
+ | "transactionInfoRequest"
181
+ | "ageCheck";
182
+
183
+ type SettingTypeKeys =
184
+ | "displayBrightness"
185
+ | "displayContrast"
186
+ | "keypadTones"
187
+ | "alertTones"
188
+ | "language"
189
+ | "powerManagementMode";
190
+
191
+ type EcrInfoKeys = "ecrApplication" | "eftApi" | "eftModule" | "os";
192
+
193
+ interface Constants {
194
+ TransactionType: Record<TransactionTypeKeys, EnumValue>;
195
+ Currency: Record<CurrencyKeys, Currency>;
196
+ RequestType: Record<RequestTypeKeys, EnumValue>;
197
+ SettingType: Record<SettingTypeKeys, EnumValue>;
198
+ EcrInfoType: Record<EcrInfoKeys, EnumValue>;
199
+
200
+ ManagementStatus: "";
201
+ ReceiptRequestType: "";
202
+ Recipient: "";
203
+ Theme: "";
204
+ AdditionalInfoItem: "";
205
+ BrandBarBrand: "";
206
+ ProcessingDisposition: "";
207
+ HardwareType: "";
208
+ CardProductType: "";
209
+ SecurityStatus: "";
210
+ ThirdPartyAppId: "";
211
+ TransactionReason: "";
212
+ NgvMode: "";
213
+ CounterType: "";
214
+ AccountType: "";
215
+ ProtocolLevel: "";
216
+ ReceiptItemType: "";
217
+ ImageFileFormat: "";
218
+ PrintFormat: "";
219
+ CustomerDataType: "";
220
+ LoyaltyFunctionType: "";
221
+ ConnectionStatus: "";
222
+ AllowedAccounts: "";
223
+ MobileTopupType: "";
224
+ MerchantOptionType: "";
225
+ ProtocolType: "";
226
+ Outcome: "";
227
+ AdminFunctions: "";
228
+ AgeCheckResult: "";
229
+ Cvm: "";
230
+ PrintFlag: "";
231
+ RemoteFunctions: "";
232
+ MerchantAction: "";
233
+ AdjustmentResult: "";
234
+ UpdateStatus: "";
235
+ ResponseType: "";
236
+ NonFinancialTransactions: "";
237
+
238
+ ResourceParameterType: "";
239
+ SleepModeStatus: "";
240
+ KernelType: "";
241
+ VasInfoType: "";
242
+ BrandMode: "";
243
+ CouponRejectionReason: "";
244
+ ThirdPartyApps: "";
245
+ VasInfoListType: "";
246
+ Reason: "";
247
+ ReceiptType: "";
248
+ TokenPanType: "";
249
+ CardReaderStatus: "";
250
+ ConnectionMode: "";
251
+ MaintenanceType: "";
252
+ CardReader: "";
253
+ FinancialTransactions: "";
254
+ ResultCode: "";
255
+ StatusFunctions: "";
256
+ DialogFunctions: "";
257
+ PaymentProtocol: "";
258
+ TransactionStatus: "";
259
+ FunctionHint: "";
260
+ CurrencyType: "";
261
+ PosEntryMode: "";
262
+ ResourceId: "";
263
+ Guides: "";
264
+ }
265
+ /* ========================= Terminal Status =============================== */
266
+
267
+ export interface TerminalStatus {
268
+ displayContent: string[];
269
+ connectionStatus: EnumValue;
270
+ managementStatus: EnumValue;
271
+ cardReaderStatus: EnumValue;
272
+ transactionStatus: EnumValue;
273
+ receiptInformation: boolean;
274
+ }
275
+
276
+ const constants: Constants;
277
+
278
+ class TimException extends Error {
279
+ additionalErrorInfo: string | undefined;
280
+ errorMessage: string;
281
+ errorText: string;
282
+ localizedMessage: string;
283
+ nativeError: string | undefined;
284
+ ppInfo: string | undefined;
285
+ printData: string | undefined;
286
+ rejectedBasket: string | undefined;
287
+ resultCode: EnumValue;
288
+ constructor();
289
+ }
290
+
291
+ class Receipt {
292
+ recipient: EnumValue;
293
+ value: string;
294
+ constructor();
295
+ }
296
+
297
+ class PrintData {
298
+ receiptItems: string[];
299
+ receipts: Receipt[];
300
+ constructor();
301
+ }
302
+
303
+ interface TimEvent {
304
+ requestType: string;
305
+ exception?: TimException;
306
+ terminal: Terminal;
307
+ }
308
+
309
+ interface TransactionResponse {
310
+ additionalInfo: undefined;
311
+ amount: Amount;
312
+ amountDcc: undefined;
313
+ amountDue: undefined;
314
+ amountLoyaltyCashback: undefined;
315
+ amountOther: undefined;
316
+ amountSaldo: undefined;
317
+ amountSurcharge: undefined;
318
+ amountTip: undefined;
319
+ basket: undefined;
320
+ printData: PrintData;
321
+ transactionInformation: any;
322
+ transactionType: EnumValue;
323
+ }
324
+
325
+ class DefaultTerminalListener {
326
+ constructor();
327
+ terminalStatusChanged(terminal: any): void;
328
+ requestCompleted(event: TimEvent, data: any): void;
329
+ connectCompleted(event: TimEvent): void;
330
+ transactionCompleted(event: TimEvent, data: TransactionResponse): void;
331
+ }
332
+
333
+ class Amount {
334
+ currency: Currency;
335
+ exponent: number;
336
+ value: number;
337
+ constructor(amount: number, currency: Currency);
338
+ }
339
+ class EcrInfo {
340
+ type: EnumValue;
341
+ name: string;
342
+ manufacturerName: string;
343
+ version: string;
344
+ constructor();
345
+ }
346
+
347
+ class Terminal {
348
+ _listenersLocked: boolean;
349
+ _listeners: DefaultTerminalListener[];
350
+ _terminalStatus: TerminalStatus | undefined;
351
+
352
+ constructor(settings: any);
353
+ setPosId(id: string);
354
+ getTerminalStatus(): TerminalStatus;
355
+ setUserId(id: number | string);
356
+ addListener(listener: DefaultTerminalListener);
357
+ addEcrData(info: EcrInfo): void;
358
+
359
+ disconnectAsync(): void;
360
+ connectAsync(): void;
361
+ loginAsync(): void;
362
+ logoutAsync(): void;
363
+ activateAsync(): void;
364
+ deactivateAsync(): void;
365
+ commitAsync(): void;
366
+ rollbackAsync(): void;
367
+ balanceAsync(): void;
368
+ reconfigAsync(): void;
369
+ systemInformationAsync(): void;
370
+ hardwareInformationAsync(): void;
371
+ receiptRequestAsync(requestType: string): void;
372
+ softwareUpdateAsync(): void;
373
+ reconciliationAsync(): void;
374
+ changeSettingsAsync(settings: Map<timapi.EnumValue, string>): void;
375
+ applicationInformationAsync(): void;
376
+ cancel(): void;
377
+ // TODO:
378
+ setTransactionData(trxData: TransactionData): void;
379
+ transactionAsync(txnType: EnumValue, amount?: Amount): void;
380
+ dispose(): void;
381
+ getTransactionData(): TransactionData | undefined;
382
+ }
383
+
384
+ class TerminalSettings {
385
+ /**
386
+ * IP address of the EFT terminal.
387
+ */
388
+ connectionIPString: string;
389
+ /**
390
+ * Listening Port of the EFT terminal.
391
+ */
392
+ connectionIPPort: number;
393
+ fetchBrands: boolean;
394
+ autoCommit: boolean | undefined;
395
+ partialCommit: boolean | undefined;
396
+ /**
397
+ * Enable persistent state if supported. Default is false.
398
+ */
399
+ persistentState: boolean;
400
+
401
+ constructor();
402
+ }
403
+
404
+ class TransactionData {
405
+ transSeq: string;
406
+ constructor();
407
+ }
408
+
409
+ class LogRecord {
410
+ file: string;
411
+ level: { name: string; _value: number };
412
+ line: 16;
413
+ message: string;
414
+ method: string;
415
+ parameters: string[];
416
+ stackTrace: string[];
417
+ thread: string;
418
+ timestamp: string;
419
+ constructor();
420
+ }
421
+ }
@@ -0,0 +1,10 @@
1
+ declare global {
2
+ /**
3
+ * this function "onTimApiReady" will be called as soon as the TimApi is ready
4
+ */
5
+ var onTimApiReady: (() => void) | undefined;
6
+ var onTimApiLog: (message: string) => void;
7
+ var onTimApiPublishLogRecord: (record: timapi.LogRecord) => void;
8
+ }
9
+
10
+ export {};
package/dist/tyro.d.ts CHANGED
@@ -172,3 +172,15 @@ declare global {
172
172
  interface DocumentEventMap extends CustomEventMap {
173
173
  }
174
174
  }
175
+
176
+
177
+ declare global {
178
+ interface CustomEventMap {
179
+ [TimApiEvents.TxnCompleted]: CustomEvent<{
180
+ event: timapi.TimEvent;
181
+ data: timapi.TransactionResponse;
182
+ }>;
183
+ }
184
+ interface DocumentEventMap extends CustomEventMap {
185
+ }
186
+ }
@@ -32,10 +32,6 @@ declare class AdvanceEcr {
32
32
  * Reversal can revoke a previous transaction, referenced by a transaction reference
33
33
  */
34
34
  actionReversal(lastTransactionId: string): void;
35
- /**
36
- * Make a financial transaction of type credit
37
- */
38
- actionCredit(editAmount: number): void;
39
35
  actionPurchase(purchaseAmount: number): void;
40
36
  actionRefund(refundAmount: number): void;
41
37
  actionCancel(): void;
@@ -80,3 +76,15 @@ declare global {
80
76
  interface DocumentEventMap extends CustomEventMap {
81
77
  }
82
78
  }
79
+
80
+
81
+ declare global {
82
+ interface CustomEventMap {
83
+ [TimApiEvents.TxnCompleted]: CustomEvent<{
84
+ event: timapi.TimEvent;
85
+ data: timapi.TransactionResponse;
86
+ }>;
87
+ }
88
+ interface DocumentEventMap extends CustomEventMap {
89
+ }
90
+ }
package/dist/worldline.js CHANGED
@@ -3,11 +3,11 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { EventBus, QForm, QInput, QBtn, QDialog, QCard, QCardSection, Dialog } from "quasar";
5
5
  import { defineComponent, ref, resolveDirective, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, createBlock, toDisplayString, withDirectives, createCommentVNode } from "vue";
6
- import { useLocalStorage } from "@vueuse/core";
6
+ import { useLocalStorage, useEventListener } from "@vueuse/core";
7
7
  const emitter = new EventBus();
8
- const TimApiEvents = {
8
+ const TimApiEvents = Object.freeze({
9
9
  TxnCompleted: "timTxnCompleted"
10
- };
10
+ });
11
11
  ({
12
12
  Purchase: timapi.constants.TransactionType.purchase,
13
13
  Refund: timapi.constants.TransactionType.refunding
@@ -240,17 +240,6 @@ class AdvanceEcr {
240
240
  console.log("Error: " + err);
241
241
  }
242
242
  }
243
- /**
244
- * Make a financial transaction of type credit
245
- */
246
- actionCredit(editAmount) {
247
- try {
248
- var amount = new timapi.Amount(editAmount, timapi.constants.Currency.AUD);
249
- this.ensureTerminal().transactionAsync(timapi.constants.TransactionType.credit, amount);
250
- } catch (err) {
251
- console.log("Error: " + err);
252
- }
253
- }
254
243
  actionPurchase(purchaseAmount) {
255
244
  if (!this.isReady) {
256
245
  return;
@@ -274,7 +263,7 @@ class AdvanceEcr {
274
263
  }
275
264
  try {
276
265
  let amount = new timapi.Amount(refundAmount, timapi.constants.Currency.AUD);
277
- this.ensureTerminal().transactionAsync(timapi.constants.TransactionType.refunding, amount);
266
+ this.ensureTerminal().transactionAsync(timapi.constants.TransactionType.credit, amount);
278
267
  emitter.emit("txnStarted", refundAmount, "refund");
279
268
  } catch (err) {
280
269
  emitter.emit("txnCompleted", {
@@ -510,7 +499,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
510
499
  runningTxData.value.txnAmount = (amount / 100).toFixed(2);
511
500
  runningTxData.value.txType = type ?? "purchase";
512
501
  });
513
- emitter.on("txnCompleted", (event, _data) => {
502
+ useEventListener(document, TimApiEvents.TxnCompleted, (ev) => {
503
+ const { event } = ev.detail;
514
504
  model.value = true;
515
505
  if (event.exception) {
516
506
  pairInfo.value.state = "FAILED";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@achyutlabsau/vue-payment-gateway",
3
3
  "private": false,
4
- "version": "0.2.17",
4
+ "version": "0.2.19",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",