react-native-mesmart 0.7.4 → 1.0.1

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 (109) hide show
  1. package/README.md +110 -31
  2. package/android/build.gradle +13 -8
  3. package/android/gradle.properties +6 -5
  4. package/android/src/main/java/com/mesmart/Packages.kt +4 -2
  5. package/android/src/main/java/com/mesmart/Utils.kt +107 -0
  6. package/android/src/main/java/com/pax/PaxImpl.kt +71 -40
  7. package/android/src/main/java/com/pax/PaxModule.kt +52 -29
  8. package/android/src/main/java/com/paystore/PaystoreImpl.kt +53 -0
  9. package/android/src/main/java/com/paystore/PaystoreModule.kt +24 -28
  10. package/android/src/main/java/com/paystore/utils/CredentialsUtils.kt +6 -4
  11. package/android/src/main/java/com/plugpag/PlugpagImpl.kt +66 -45
  12. package/android/src/main/java/com/plugpag/PlugpagModule.kt +49 -39
  13. package/android/src/main/java/com/plugpag/utils/PlugpagUtils.kt +23 -24
  14. package/android/src/main/java/com/stone/StoneImpl.kt +270 -0
  15. package/android/src/main/java/com/stone/StoneModule.kt +121 -0
  16. package/android/src/main/java/com/stone/utils/StoneUtils.kt +282 -0
  17. package/android/src/main/java/com/stone/utils/TransactionObjectMapper.kt +200 -0
  18. package/android/src/main/java/com/sunmi/SunmiImpl.kt +36 -12
  19. package/android/src/main/java/com/sunmi/SunmiModule.kt +49 -36
  20. package/android/src/main/java/com/sunmi/helpers/SunmiPrintHelper.kt +13 -17
  21. package/android/src/main/java/com/sunmi/helpers/SunmiRfidHelper.kt +8 -8
  22. package/android/src/main/java/com/{mesmart → sunmi}/utils/ESCUtil.kt +1 -1
  23. package/lib/commonjs/@types/index.js +0 -48
  24. package/lib/commonjs/@types/index.js.map +1 -1
  25. package/lib/commonjs/@types/pax.d.js +2 -0
  26. package/lib/{module/@types/sunmi.js.map → commonjs/@types/pax.d.js.map} +1 -1
  27. package/lib/commonjs/@types/paystore.d.js +2 -0
  28. package/lib/commonjs/@types/{paystore.js.map → paystore.d.js.map} +1 -1
  29. package/lib/commonjs/@types/plugpag.d.js +36 -0
  30. package/lib/commonjs/@types/plugpag.d.js.map +1 -0
  31. package/lib/commonjs/@types/react-native.d.js +6 -0
  32. package/lib/commonjs/@types/react-native.d.js.map +1 -0
  33. package/lib/commonjs/@types/stone.d.js +6 -0
  34. package/lib/{module/@types/pax.js.map → commonjs/@types/stone.d.js.map} +1 -1
  35. package/lib/commonjs/@types/sunmi.d.js +2 -0
  36. package/lib/commonjs/@types/{pax.js.map → sunmi.d.js.map} +1 -1
  37. package/lib/commonjs/index.js +39 -60
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/pax.js +25 -0
  40. package/lib/commonjs/pax.js.map +1 -0
  41. package/lib/commonjs/paystore.js +21 -0
  42. package/lib/commonjs/paystore.js.map +1 -0
  43. package/lib/commonjs/sunmi.js +28 -0
  44. package/lib/commonjs/sunmi.js.map +1 -0
  45. package/lib/module/@types/index.js +1 -4
  46. package/lib/module/@types/index.js.map +1 -1
  47. package/lib/module/@types/pax.d.js +2 -0
  48. package/lib/{commonjs/@types/sunmi.js.map → module/@types/pax.d.js.map} +1 -1
  49. package/lib/module/@types/paystore.d.js +2 -0
  50. package/lib/module/@types/paystore.d.js.map +1 -0
  51. package/lib/module/@types/plugpag.d.js +30 -0
  52. package/lib/module/@types/{plugpag.js.map → plugpag.d.js.map} +1 -1
  53. package/lib/module/@types/react-native.d.js +2 -0
  54. package/lib/module/@types/react-native.d.js.map +1 -0
  55. package/lib/module/@types/stone.d.js +2 -0
  56. package/lib/module/@types/stone.d.js.map +1 -0
  57. package/lib/module/@types/sunmi.d.js +2 -0
  58. package/lib/module/@types/sunmi.d.js.map +1 -0
  59. package/lib/module/index.js +39 -47
  60. package/lib/module/index.js.map +1 -1
  61. package/lib/module/pax.js +18 -0
  62. package/lib/module/pax.js.map +1 -0
  63. package/lib/module/paystore.js +14 -0
  64. package/lib/module/paystore.js.map +1 -0
  65. package/lib/module/sunmi.js +21 -0
  66. package/lib/module/sunmi.js.map +1 -0
  67. package/lib/typescript/src/@types/index.d.ts +6 -4
  68. package/lib/typescript/src/@types/index.d.ts.map +1 -1
  69. package/lib/typescript/src/index.d.ts +37 -24
  70. package/lib/typescript/src/index.d.ts.map +1 -1
  71. package/lib/typescript/src/pax.d.ts +2 -0
  72. package/lib/typescript/src/pax.d.ts.map +1 -0
  73. package/lib/typescript/src/paystore.d.ts +3 -0
  74. package/lib/typescript/src/paystore.d.ts.map +1 -0
  75. package/lib/typescript/src/sunmi.d.ts +2 -0
  76. package/lib/typescript/src/sunmi.d.ts.map +1 -0
  77. package/package.json +1 -1
  78. package/src/@types/index.ts +13 -4
  79. package/src/@types/pax.d.ts +8 -0
  80. package/src/@types/{paystore.ts → paystore.d.ts} +12 -10
  81. package/src/@types/{plugpag.ts → plugpag.d.ts} +16 -23
  82. package/src/@types/react-native.d.ts +15 -0
  83. package/src/@types/stone.d.ts +310 -0
  84. package/src/@types/sunmi.d.ts +13 -0
  85. package/src/index.ts +41 -107
  86. package/src/pax.ts +28 -0
  87. package/src/paystore.ts +32 -0
  88. package/src/sunmi.ts +29 -0
  89. package/android/src/main/java/com/mesmart/utils/Utils.kt +0 -65
  90. package/lib/commonjs/@types/pax.js +0 -2
  91. package/lib/commonjs/@types/paystore.js +0 -2
  92. package/lib/commonjs/@types/plugpag.js +0 -36
  93. package/lib/commonjs/@types/plugpag.js.map +0 -1
  94. package/lib/commonjs/@types/sunmi.js +0 -2
  95. package/lib/module/@types/pax.js +0 -2
  96. package/lib/module/@types/paystore.js +0 -2
  97. package/lib/module/@types/paystore.js.map +0 -1
  98. package/lib/module/@types/plugpag.js +0 -30
  99. package/lib/module/@types/sunmi.js +0 -2
  100. package/lib/typescript/src/@types/pax.d.ts +0 -7
  101. package/lib/typescript/src/@types/pax.d.ts.map +0 -1
  102. package/lib/typescript/src/@types/paystore.d.ts +0 -34
  103. package/lib/typescript/src/@types/paystore.d.ts.map +0 -1
  104. package/lib/typescript/src/@types/plugpag.d.ts +0 -47
  105. package/lib/typescript/src/@types/plugpag.d.ts.map +0 -1
  106. package/lib/typescript/src/@types/sunmi.d.ts +0 -9
  107. package/lib/typescript/src/@types/sunmi.d.ts.map +0 -1
  108. package/src/@types/pax.ts +0 -6
  109. package/src/@types/sunmi.ts +0 -13
@@ -1,32 +1,45 @@
1
- import { type PlugPagTransactionTypes, type PlugPagEventData, type PlugPagTransactionResult, type PaystorePaymentTypes, type PaystorePaymentStatus, type PaystoreCaptureType, type PaystoreCard, type PaystoreReceipts, type PaystorePaymentResult, PlugPagEvent, PlugPagResult } from './@types';
2
1
  export declare const IOS_ERROR = "\u26A0\uFE0F The package 'react-native-mesmart' doesn't work in iOS environment!";
3
- export declare const LINKING_ERROR: string;
4
- declare const Sunmi: {
5
- searchRfid: () => Promise<string>;
6
- cancelCardSearch: () => void;
7
- printText: (str: string, fontSize?: number, isBold?: boolean, isUnderline?: boolean) => void;
8
- printEmptyLine: () => void;
9
- printBpLogo: () => void;
10
- setPrinterAlign: (align: 'left' | 'center' | 'right') => void;
11
- };
12
2
  declare const Plugpag: {
13
- init: (activationCode: string) => void;
14
- abortPayment: () => void;
15
- printEstablishmentReceipt: () => void;
16
- printClientReceipt: () => void;
17
- customDialogClientViaPrinter: (color: string) => void;
18
- pay: (rechargeValue: string, transactionType: PlugPagTransactionTypes) => Promise<PlugPagTransactionResult>;
19
- resolveTransactionEvent: (data: PlugPagEventData) => string;
3
+ init: (code: string) => Promise<null>;
4
+ destroy: () => Promise<null>;
5
+ pay: (value: string, paymentMethod: import("./@types").PaymentMethod) => Promise<import("./@types").PlugpagTransactionResult>;
6
+ abortPayment: () => Promise<null>;
7
+ resolveEvent: (data: import("./@types").PlugpagEventData) => Promise<string>;
8
+ isActivated: () => Promise<boolean>;
9
+ };
10
+ declare const Sunmi: {
11
+ scanRfid: () => Promise<string>;
12
+ cancelScan: () => Promise<null>;
13
+ printClientReceipt: (date: string, rechargeType: string, name: string, document: string, paymentMethod: string, rfid: string, rechargeValue: string) => Promise<void>;
14
+ printText: (str: string, fontSize?: number, isBold?: boolean, isUnderline?: boolean) => Promise<null>;
15
+ printEmptyLine: () => Promise<null>;
16
+ printBpLogo: () => Promise<null>;
17
+ setPrinterAlign: (align: "left" | "center" | "right") => Promise<null>;
20
18
  };
21
19
  declare const Pax: {
22
- searchRfid: () => Promise<string>;
23
- cancelCardSearch: () => void;
24
- printText: (str: string, fontSize?: number) => void;
25
- printBpLogo: () => void;
20
+ scanRfid: () => Promise<string>;
21
+ cancelScan: () => Promise<null>;
22
+ printClientReceipt: (date: string, rechargeType: string, name: string, document: string, paymentMethod: string, rfid: string, rechargeValue: string) => Promise<void>;
23
+ printerInit: () => Promise<null>;
24
+ printerStart: () => Promise<null>;
25
+ addText: (str: string, fontSize?: number) => Promise<null>;
26
+ addBpLogo: () => Promise<null>;
26
27
  };
27
28
  declare const Paystore: {
28
- pay: (value: string, transactionId: string, showReceipt: boolean, paymentType: PaystorePaymentTypes[], installments: number) => Promise<void>;
29
+ init: () => Promise<null>;
30
+ pay: (value: string, transactionId: string, showReceipt: boolean, paymentMethods: import("./@types").PaymentMethod[], installments: number) => Promise<void>;
31
+ isActivated: () => Promise<boolean>;
32
+ };
33
+ declare const Stone: {
34
+ init: (keys: import("./@types").StoneKeys, appName: string) => Promise<null>;
35
+ isActivated: () => Promise<boolean>;
36
+ getStoneCode: () => Promise<string>;
37
+ pay: (value: string, paymentType: import("./@types").PaymentMethod, isCapture: boolean) => Promise<import("./@types").StoneTransaction>;
38
+ abortPayment: () => Promise<null>;
39
+ printVia: (transaction: import("./@types").StoneTransaction, type: import("./@types").StoneReceiptType) => Promise<null>;
40
+ captureTransaction: (transaction: import("./@types").StoneTransaction) => Promise<import("./@types").StoneCaptureResponse>;
41
+ cancelTransaction: (transaction: import("./@types").StoneTransaction) => Promise<import("./@types").StoneCancelResponse>;
29
42
  };
30
- export { Sunmi, Plugpag, Pax, Paystore, PlugPagEvent, PlugPagResult };
31
- export type { PlugPagEventData, PlugPagTransactionResult, PlugPagTransactionTypes, PaystorePaymentTypes, PaystorePaymentStatus, PaystoreCaptureType, PaystoreCard, PaystoreReceipts, PaystorePaymentResult, };
43
+ export { Plugpag, Sunmi, Pax, Paystore, Stone };
44
+ export type * from './@types';
32
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAE7B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,YAAY,EACZ,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,SAAS,qFACoD,CAAC;AAE3E,eAAO,MAAM,aAAa,QAGQ,CAAC;AAgDnC,QAAA,MAAM,KAAK;;;qBAIF,MAAM,aACD,MAAM,WACR,OAAO,gBACF,OAAO;;;6BAIG,MAAM,GAAG,QAAQ,GAAG,OAAO;CAKrD,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;;;;CAQZ,CAAC;AAEF,QAAA,MAAM,GAAG;;;qBAGU,MAAM,aAAY,MAAM;;CAG1C,CAAC;AAEF,QAAA,MAAM,QAAQ;;CAEb,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AAEtE,YAAY,EACV,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,GACtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,qFACoD,CAAC;AAI3E,QAAA,MAAM,OAAO;;;;;;;CAOZ,CAAC;AACF,QAAA,MAAM,KAAK;;;;qBAKF,MAAM,aACD,MAAM,WACR,OAAO,gBACF,OAAO;;;;CAKvB,CAAC;AACF,QAAA,MAAM,GAAG;;;;;;mBAMQ,MAAM,aAAY,MAAM;;CAGxC,CAAC;AACF,QAAA,MAAM,QAAQ;;;;CAIb,CAAC;AACF,QAAA,MAAM,KAAK;;;;;;;;;CASV,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAChD,mBAAmB,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const printClientReceiptInPax: (date: string, rechargeType: string, name: string, document: string, paymentMethod: string, rfid: string, rechargeValue: string) => Promise<void>;
2
+ //# sourceMappingURL=pax.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pax.d.ts","sourceRoot":"","sources":["../../../src/pax.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,SAC5B,MAAM,gBACE,MAAM,QACd,MAAM,YACF,MAAM,iBACD,MAAM,QACf,MAAM,iBACG,MAAM,KACpB,QAAQ,IAAI,CAiBd,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PaymentMethod } from './';
2
+ export declare const payWithPaystore: (value: string, transactionId: string, showReceipt: boolean, paymentMethods: PaymentMethod[], installments: number) => Promise<void>;
3
+ //# sourceMappingURL=paystore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paystore.d.ts","sourceRoot":"","sources":["../../../src/paystore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAgBxC,eAAO,MAAM,eAAe,UACnB,MAAM,iBACE,MAAM,eACR,OAAO,kBACJ,aAAa,EAAE,gBACjB,MAAM,KACnB,QAAQ,IAAI,CAQd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const printClientReceiptInSunmi: (date: string, rechargeType: string, name: string, document: string, paymentMethod: string, rfid: string, rechargeValue: string) => Promise<void>;
2
+ //# sourceMappingURL=sunmi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sunmi.d.ts","sourceRoot":"","sources":["../../../src/sunmi.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,SAC9B,MAAM,gBACE,MAAM,QACd,MAAM,YACF,MAAM,iBACD,MAAM,QACf,MAAM,iBACG,MAAM,KACpB,QAAQ,IAAI,CAkBd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mesmart",
3
- "version": "0.7.4",
3
+ "version": "1.0.1",
4
4
  "description": "Sunmi P2 utilities and Plugpag wrapper for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,4 +1,13 @@
1
- export * from './plugpag';
2
- export * from './sunmi';
3
- export * from './pax';
4
- export * from './paystore';
1
+ export type PaymentMethod =
2
+ | 'debitCard'
3
+ | 'creditCard'
4
+ | 'pix'
5
+ | 'voucher'
6
+ | 'money'
7
+ | 'bonus';
8
+
9
+ export type * from './plugpag';
10
+ export type * from './paystore';
11
+ export type * from './sunmi';
12
+ export type * from './pax';
13
+ export type * from './stone';
@@ -0,0 +1,8 @@
1
+ export interface PaxAPI {
2
+ scanRfid: () => Promise<string>;
3
+ cancelScan: () => Promise<null>;
4
+ printerInit: () => Promise<null>;
5
+ printerStart: () => Promise<null>;
6
+ addText: (str: string, fontSize: number) => Promise<null>;
7
+ addBpLogo: () => Promise<null>;
8
+ }
@@ -1,3 +1,15 @@
1
+ export interface PaystoreAPI {
2
+ init: () => Promise<null>;
3
+ pay: (
4
+ value: string,
5
+ transactionId: string,
6
+ showReceipt: boolean,
7
+ paymentType: Array<'CREDIT' | 'DEBIT' | 'VOUCHER'>,
8
+ installments: number
9
+ ) => Promise<null>;
10
+ isActivated: () => Promise<boolean>;
11
+ }
12
+
1
13
  export type PaystorePaymentTypes =
2
14
  | 'CREDIT'
3
15
  | 'DEBIT'
@@ -62,13 +74,3 @@ export interface PaystorePaymentResult {
62
74
  receipt: PaystoreReceipts;
63
75
  value: number;
64
76
  }
65
-
66
- export interface PaystoreAPI {
67
- pay: (
68
- value: string,
69
- transactionId: string,
70
- showReceipt: boolean,
71
- paymentType: PaystorePaymentTypes[],
72
- installments: number
73
- ) => Promise<void>;
74
- }
@@ -1,30 +1,23 @@
1
+ import type { PaymentMethod } from '.';
2
+
1
3
  export interface PlugpagAPI {
2
- init: (activationCode: string) => void;
4
+ init: (code: string) => Promise<null>;
5
+ destroy: () => Promise<null>;
3
6
  pay: (
4
- rechargeValue: string,
5
- transactionType: PlugPagTransactionTypes
6
- ) => Promise<PlugPagTransactionResult>;
7
- abortPayment: () => void;
8
- printEstablishmentReceipt: () => void;
9
- printClientReceipt: () => void;
10
- customDialogClientViaPrinter: (color: string) => void;
11
- resolveTransactionEvent: (data: PlugPagEventData) => string;
7
+ value: string,
8
+ paymentMethod: PaymentMethod
9
+ ) => Promise<PlugpagTransactionResult>;
10
+ abortPayment: () => Promise<null>;
11
+ resolveEvent: (data: PlugpagEventData) => Promise<string>;
12
+ isActivated: () => Promise<boolean>;
12
13
  }
13
14
 
14
- export type PlugPagTransactionTypes =
15
- | 'debitCard'
16
- | 'creditCard'
17
- | 'pix'
18
- | 'voucher'
19
- | 'money'
20
- | 'bonus';
21
-
22
- export interface PlugPagEventData {
15
+ export interface PlugpagEventData {
23
16
  customMessage?: string;
24
- eventCode: PlugPagEvent;
17
+ eventCode: PlugpagEvent;
25
18
  }
26
19
 
27
- export enum PlugPagEvent {
20
+ export enum PlugpagEvent {
28
21
  EVENT_CODE_CUSTOM_MESSAGE = -2,
29
22
  EVENT_CODE_DEFAULT = -1,
30
23
  EVENT_CODE_WAITING_CARD = 0,
@@ -49,12 +42,12 @@ export enum PlugPagEvent {
49
42
  EVENT_CODE_SALE_NOT_APPROVED = 19,
50
43
  }
51
44
 
52
- export interface PlugPagTransactionResult {
45
+ export interface PlugpagTransactionResult {
53
46
  message?: string;
54
47
  errorCode?: string;
55
- result?: PlugPagResult;
48
+ result?: PlugpagResult;
56
49
  }
57
50
 
58
- export enum PlugPagResult {
51
+ export enum PlugpagResult {
59
52
  RET_OK = 0,
60
53
  }
@@ -0,0 +1,15 @@
1
+ import type { PlugpagAPI } from './plugpag';
2
+ import type { SunmiAPI } from './sunmi';
3
+ import type { PaxAPI } from './pax';
4
+ import type { PaystoreAPI } from './paystore';
5
+ import type { StoneAPI } from './stone';
6
+
7
+ declare module 'react-native' {
8
+ interface NativeModulesStatic {
9
+ Plugpag: PlugpagAPI;
10
+ Sunmi: SunmiAPI;
11
+ Pax: PaxAPI;
12
+ Paystore: PaystoreAPI;
13
+ Stone: StoneAPI;
14
+ }
15
+ }
@@ -0,0 +1,310 @@
1
+ import type { PaymentMethod } from '.';
2
+
3
+ export interface StoneAPI {
4
+ init: (keys: StoneKeys, appName: string) => Promise<null>;
5
+ isActivated: () => Promise<boolean>;
6
+ getStoneCode: () => Promise<string>;
7
+ pay: (
8
+ value: string,
9
+ paymentType: PaymentMethod,
10
+ isCapture: boolean
11
+ ) => Promise<StoneTransaction>;
12
+ abortPayment: () => Promise<null>;
13
+ printVia: (
14
+ transaction: StoneTransaction,
15
+ type: StoneReceiptType
16
+ ) => Promise<null>;
17
+ captureTransaction: (
18
+ transaction: StoneTransaction
19
+ ) => Promise<StoneCaptureResponse>;
20
+ cancelTransaction: (
21
+ transaction: StoneTransaction
22
+ ) => Promise<StoneCancelResponse>;
23
+ }
24
+
25
+ export type StoneKeys = {
26
+ providerId: string;
27
+ authorization: string;
28
+ };
29
+
30
+ export type StoneEventData =
31
+ | StoneOnSuccessEvent
32
+ | StoneOnErrorEvent
33
+ | StoneOnStatusChanged;
34
+
35
+ export type StoneOnSuccessEvent = {
36
+ type: 'onSuccess';
37
+ status: string;
38
+ statusEnum: string;
39
+ authorizationCode: string;
40
+ action: string;
41
+ actionCode: StoneActionCode;
42
+ messageFromAuthorize: string;
43
+ };
44
+
45
+ export type StoneOnErrorEvent = {
46
+ type: 'onError';
47
+ status: string;
48
+ statusEnum: string;
49
+ messageFromAuthorize: string;
50
+ action: string;
51
+ actionCode: StoneActionCode;
52
+ listOfErrors: Array<string>;
53
+ listOfErrorsEnum: Array<string>;
54
+ };
55
+
56
+ export type StoneOnStatusChanged = {
57
+ type: 'onStatusChanged';
58
+ action: string;
59
+ actionEnum: string;
60
+ qrCode?: string;
61
+ };
62
+
63
+ export type StoneCaptureResponse = {
64
+ responseCode: StoneResponseCode | '';
65
+ messageFromAuthorize: string;
66
+ transaction: StoneTransaction;
67
+ };
68
+
69
+ export type StoneCancelResponse = {
70
+ action: string;
71
+ actionCode: StoneActionCode | '';
72
+ responseCode: StoneResponseCode | '';
73
+ messageFromAuthorize: string;
74
+ transaction: StoneTransaction;
75
+ };
76
+
77
+ export type StoneTransaction = {
78
+ idFromBase: number;
79
+ amount: string | null;
80
+ // Deprecated
81
+ requestId: string | null;
82
+ emailSent: string | null;
83
+ timeToPassTransaction: string | null;
84
+ initiatorTransactionKey: string;
85
+ acquirerTransactionKey: string | null;
86
+ cardHolderNumber: string | null;
87
+ cardHolderName: string | null;
88
+ date: string;
89
+ time: string;
90
+ aid: string | null;
91
+ arcq: string | null;
92
+ authorizationCode: string | null;
93
+ iccRelatedData: string | null;
94
+ transactionReference: string | null;
95
+ actionCode: string | null;
96
+ commandActionCode: string | null;
97
+ pinpadUsed: string | null;
98
+ saleAffiliationKey: string;
99
+ cne: string | null;
100
+ cvm: string | null;
101
+ balance: string | null;
102
+ serviceCode: string | null;
103
+ subMerchantCategoryCode: string | null;
104
+ entryMode: StoneEntryMode;
105
+ // Deprecated
106
+ cardBrand: StoneCardBrand;
107
+ cardBrandName: string | null;
108
+ cardBrandId: number | null;
109
+ instalmentTransaction: string;
110
+ transactionStatus: StoneTransactionStatus;
111
+ instalmentType: StoneInstalmentType;
112
+ typeOfTransaction: StoneTypeOfTransaction;
113
+ signatureBitmap: string | null;
114
+ cancellationDate: string | null;
115
+ capture: boolean;
116
+ shortName: string | null;
117
+ subMerchantAddress: string | null;
118
+ userModel: StoneUserModel;
119
+ cvv: string | null;
120
+ isFallbackTransaction: boolean;
121
+ subMerchantCity: string | null;
122
+ subMerchantTaxIdentificationNumber: string | null;
123
+ subMerchantRegisteredIdentifier: string | null;
124
+ subMerchantPostalAddress: string | null;
125
+ appLabel: string | null;
126
+ cardExpireDate: string | null;
127
+ cardSequenceNumber: string | null;
128
+ externalId: string | null;
129
+ qrcodeBitmap: string | null;
130
+ };
131
+
132
+ export type StoneUserModel = {
133
+ merchantName: string | null;
134
+ saleAffiliationKey: string | null;
135
+ affiliationKey: string | null;
136
+ merchantPassword: string | null;
137
+ merchantDocumentNumber: string | null;
138
+ stoneCode: string | null;
139
+ currencyCode: string | null;
140
+ merchantAddress: StoneAddress | null;
141
+ merchantUserPhone: StoneUserPhone | null;
142
+ tableVersion: string | null;
143
+ };
144
+
145
+ export type StoneAddress = {
146
+ distric: string | null;
147
+ street: string | null;
148
+ neighborhood: string | null;
149
+ doorNumber: string | null;
150
+ city: string | null;
151
+ };
152
+
153
+ export type StoneUserPhone = {
154
+ merchantAndroidVersion: string | null;
155
+ merchantPhoneModel: string | null;
156
+ merchantPhoneFactory: string | null;
157
+ };
158
+
159
+ export type StoneEntryMode =
160
+ | 'MAGNETIC_STRIPE'
161
+ | 'CHIP_N_PIN'
162
+ | 'CONTACTLESS'
163
+ | 'CONTACTLESS_MAG'
164
+ | 'QRCODE'
165
+ | 'UNKNOWN';
166
+
167
+ export type StoneReceiptType = 'MERCHANT' | 'CLIENT';
168
+
169
+ export type StoneCardBrand =
170
+ | 'UNKNOWN'
171
+ | 'VISA'
172
+ | 'MASTERCARD'
173
+ | 'AMEX'
174
+ | 'EN_ROUTE'
175
+ | 'DINERS_CLUB'
176
+ | 'TICKET'
177
+ | 'ELO'
178
+ | 'ALELO'
179
+ | 'VR'
180
+ | 'HIPER'
181
+ | 'SODEXO'
182
+ | 'HIPERCARD'
183
+ | 'COOPER'
184
+ | 'SENFF'
185
+ | 'VERDECARD'
186
+ | 'CABAL';
187
+
188
+ export type StoneTransactionStatus =
189
+ | 'UNKNOWN'
190
+ | 'APPROVED'
191
+ | 'DECLINED'
192
+ | 'DECLINED_BY_CARD'
193
+ | 'CANCELLED'
194
+ | 'TECHNICAL_ERROR'
195
+ | 'REJECTED'
196
+ | 'WITH_ERROR'
197
+ | 'PENDING_REVERSAL'
198
+ | 'PENDING'
199
+ | 'REVERSED';
200
+
201
+ export type StoneInstalmentType = 'None' | 'Merchant' | 'Issuer';
202
+
203
+ export type StoneTypeOfTransaction =
204
+ | 'DEBIT'
205
+ | 'CREDIT'
206
+ | 'VOUCHER'
207
+ | 'INSTANT_PAYMENT'
208
+ | 'PIX';
209
+
210
+ export type StoneActionCode =
211
+ | '1000'
212
+ | '1001'
213
+ | '1002'
214
+ | '1003'
215
+ | '1004'
216
+ | '1005'
217
+ | '1006'
218
+ | '1007'
219
+ | '1008'
220
+ | '1009'
221
+ | '1010'
222
+ | '1011'
223
+ | '1012'
224
+ | '1014'
225
+ | '1015'
226
+ | '1016'
227
+ | '1017'
228
+ | '1019'
229
+ | '1020'
230
+ | '1021'
231
+ | '1022'
232
+ | '1023'
233
+ | '1024'
234
+ | '1025'
235
+ | '1026'
236
+ | '1027'
237
+ | '1028'
238
+ | '1029'
239
+ | '1030'
240
+ | '1032'
241
+ | '1035'
242
+ | '1036'
243
+ | '1037'
244
+ | '1039'
245
+ | '1041'
246
+ | '1042'
247
+ | '1045'
248
+ | '1047'
249
+ | '1048'
250
+ | '1057'
251
+ | '1060'
252
+ | '1061'
253
+ | '1062'
254
+ | '1063'
255
+ | '1064'
256
+ | '1065'
257
+ | '2000'
258
+ | '2001'
259
+ | '2002'
260
+ | '2003'
261
+ | '2004'
262
+ | '2005'
263
+ | '2006'
264
+ | '2007'
265
+ | '2008'
266
+ | '2009'
267
+ | '2010'
268
+ | '2011'
269
+ | '2012'
270
+ | '9100'
271
+ | '9102'
272
+ | '9103'
273
+ | '9105'
274
+ | '9107'
275
+ | '9108'
276
+ | '9109'
277
+ | '9110'
278
+ | '9111'
279
+ | '9112'
280
+ | '9113'
281
+ | '9114'
282
+ | '9116'
283
+ | '9117'
284
+ | '9118'
285
+ | '9119'
286
+ | '9120'
287
+ | '9121'
288
+ | '9122'
289
+ | '9123'
290
+ | '9124'
291
+ | '9125'
292
+ | '9132'
293
+ | '9133'
294
+ | '9350'
295
+ | '9999'
296
+ | 'UNPR'
297
+ | 'IMSG'
298
+ | 'PARS'
299
+ | 'SECU'
300
+ | 'INTP'
301
+ | 'RCPP'
302
+ | 'DPMG'
303
+ | 'VERS'
304
+ | 'MSGT';
305
+
306
+ export type StoneResponseCode =
307
+ | 'Declined'
308
+ | 'Approved'
309
+ | 'TechnicalError'
310
+ | 'Default';
@@ -0,0 +1,13 @@
1
+ export interface SunmiAPI {
2
+ scanRfid: () => Promise<string>;
3
+ cancelScan: () => Promise<null>;
4
+ printText: (
5
+ str: string,
6
+ fontSize: number,
7
+ isBold: boolean,
8
+ isUnderline: boolean
9
+ ) => Promise<null>;
10
+ printEmptyLine: () => Promise<null>;
11
+ printBpLogo: () => Promise<null>;
12
+ setPrinterAlign: (align: 'left' | 'center' | 'right') => Promise<null>;
13
+ }