edfapay-softpos-sdk-rn 1.0.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 (160) hide show
  1. package/EdfapaySoftposSdkRn.podspec +20 -0
  2. package/LICENSE +20 -0
  3. package/README.md +37 -0
  4. package/android/build.gradle +82 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/com/edfapaysoftpossdkrn/EdfapaySoftposSdkRnModule.kt +185 -0
  7. package/android/src/main/java/com/edfapaysoftpossdkrn/EdfapaySoftposSdkRnPackage.kt +14 -0
  8. package/ios/EdfapaySoftposSdkRn.h +6 -0
  9. package/ios/EdfapaySoftposSdkRn.mm +21 -0
  10. package/lib/module/EdfaPayPlugin.js +324 -0
  11. package/lib/module/EdfaPayPlugin.js.map +1 -0
  12. package/lib/module/NativeEdfapaySoftposSdkRn.js +5 -0
  13. package/lib/module/NativeEdfapaySoftposSdkRn.js.map +1 -0
  14. package/lib/module/bridge.js +91 -0
  15. package/lib/module/bridge.js.map +1 -0
  16. package/lib/module/enums/Env.js +11 -0
  17. package/lib/module/enums/Env.js.map +1 -0
  18. package/lib/module/enums/FlowType.js +9 -0
  19. package/lib/module/enums/FlowType.js.map +1 -0
  20. package/lib/module/enums/FunctionCode.js +12 -0
  21. package/lib/module/enums/FunctionCode.js.map +1 -0
  22. package/lib/module/enums/PaymentMethod.js +8 -0
  23. package/lib/module/enums/PaymentMethod.js.map +1 -0
  24. package/lib/module/enums/Presentation.js +16 -0
  25. package/lib/module/enums/Presentation.js.map +1 -0
  26. package/lib/module/enums/PurchaseSecondaryAction.js +9 -0
  27. package/lib/module/enums/PurchaseSecondaryAction.js.map +1 -0
  28. package/lib/module/enums/TransactionType.js +15 -0
  29. package/lib/module/enums/TransactionType.js.map +1 -0
  30. package/lib/module/globals.d.js +2 -0
  31. package/lib/module/globals.d.js.map +1 -0
  32. package/lib/module/index.js +41 -0
  33. package/lib/module/index.js.map +1 -0
  34. package/lib/module/models/BnplResponse.js +26 -0
  35. package/lib/module/models/BnplResponse.js.map +1 -0
  36. package/lib/module/models/EdfaPayCredentials.js +32 -0
  37. package/lib/module/models/EdfaPayCredentials.js.map +1 -0
  38. package/lib/module/models/InvoiceRequest.js +92 -0
  39. package/lib/module/models/InvoiceRequest.js.map +1 -0
  40. package/lib/module/models/Location.js +16 -0
  41. package/lib/module/models/Location.js.map +1 -0
  42. package/lib/module/models/Pagination.js +33 -0
  43. package/lib/module/models/Pagination.js.map +1 -0
  44. package/lib/module/models/PresentationConfig.js +93 -0
  45. package/lib/module/models/PresentationConfig.js.map +1 -0
  46. package/lib/module/models/SdkTheme.js +76 -0
  47. package/lib/module/models/SdkTheme.js.map +1 -0
  48. package/lib/module/models/Terminal.js +39 -0
  49. package/lib/module/models/Terminal.js.map +1 -0
  50. package/lib/module/models/TerminalBindingTask.js +31 -0
  51. package/lib/module/models/TerminalBindingTask.js.map +1 -0
  52. package/lib/module/models/Transaction.js +33 -0
  53. package/lib/module/models/Transaction.js.map +1 -0
  54. package/lib/module/models/TxnParams.js +21 -0
  55. package/lib/module/models/TxnParams.js.map +1 -0
  56. package/lib/module/models/UserInfo.js +39 -0
  57. package/lib/module/models/UserInfo.js.map +1 -0
  58. package/lib/module/multiply.js +6 -0
  59. package/lib/module/multiply.js.map +1 -0
  60. package/lib/module/multiply.native.js +7 -0
  61. package/lib/module/multiply.native.js.map +1 -0
  62. package/lib/module/namespaces/Extension.js +112 -0
  63. package/lib/module/namespaces/Extension.js.map +1 -0
  64. package/lib/module/namespaces/RemoteChannel.js +43 -0
  65. package/lib/module/namespaces/RemoteChannel.js.map +1 -0
  66. package/lib/module/namespaces/Utils.js +78 -0
  67. package/lib/module/namespaces/Utils.js.map +1 -0
  68. package/lib/module/package.json +1 -0
  69. package/lib/module/types.js +4 -0
  70. package/lib/module/types.js.map +1 -0
  71. package/lib/typescript/package.json +1 -0
  72. package/lib/typescript/src/EdfaPayPlugin.d.ts +171 -0
  73. package/lib/typescript/src/EdfaPayPlugin.d.ts.map +1 -0
  74. package/lib/typescript/src/NativeEdfapaySoftposSdkRn.d.ts +7 -0
  75. package/lib/typescript/src/NativeEdfapaySoftposSdkRn.d.ts.map +1 -0
  76. package/lib/typescript/src/bridge.d.ts +13 -0
  77. package/lib/typescript/src/bridge.d.ts.map +1 -0
  78. package/lib/typescript/src/enums/Env.d.ts +8 -0
  79. package/lib/typescript/src/enums/Env.d.ts.map +1 -0
  80. package/lib/typescript/src/enums/FlowType.d.ts +6 -0
  81. package/lib/typescript/src/enums/FlowType.d.ts.map +1 -0
  82. package/lib/typescript/src/enums/FunctionCode.d.ts +9 -0
  83. package/lib/typescript/src/enums/FunctionCode.d.ts.map +1 -0
  84. package/lib/typescript/src/enums/PaymentMethod.d.ts +5 -0
  85. package/lib/typescript/src/enums/PaymentMethod.d.ts.map +1 -0
  86. package/lib/typescript/src/enums/Presentation.d.ts +13 -0
  87. package/lib/typescript/src/enums/Presentation.d.ts.map +1 -0
  88. package/lib/typescript/src/enums/PurchaseSecondaryAction.d.ts +6 -0
  89. package/lib/typescript/src/enums/PurchaseSecondaryAction.d.ts.map +1 -0
  90. package/lib/typescript/src/enums/TransactionType.d.ts +12 -0
  91. package/lib/typescript/src/enums/TransactionType.d.ts.map +1 -0
  92. package/lib/typescript/src/index.d.ts +26 -0
  93. package/lib/typescript/src/index.d.ts.map +1 -0
  94. package/lib/typescript/src/models/BnplResponse.d.ts +11 -0
  95. package/lib/typescript/src/models/BnplResponse.d.ts.map +1 -0
  96. package/lib/typescript/src/models/EdfaPayCredentials.d.ts +14 -0
  97. package/lib/typescript/src/models/EdfaPayCredentials.d.ts.map +1 -0
  98. package/lib/typescript/src/models/InvoiceRequest.d.ts +43 -0
  99. package/lib/typescript/src/models/InvoiceRequest.d.ts.map +1 -0
  100. package/lib/typescript/src/models/Location.d.ts +7 -0
  101. package/lib/typescript/src/models/Location.d.ts.map +1 -0
  102. package/lib/typescript/src/models/Pagination.d.ts +16 -0
  103. package/lib/typescript/src/models/Pagination.d.ts.map +1 -0
  104. package/lib/typescript/src/models/PresentationConfig.d.ts +33 -0
  105. package/lib/typescript/src/models/PresentationConfig.d.ts.map +1 -0
  106. package/lib/typescript/src/models/SdkTheme.d.ts +20 -0
  107. package/lib/typescript/src/models/SdkTheme.d.ts.map +1 -0
  108. package/lib/typescript/src/models/Terminal.d.ts +15 -0
  109. package/lib/typescript/src/models/Terminal.d.ts.map +1 -0
  110. package/lib/typescript/src/models/TerminalBindingTask.d.ts +13 -0
  111. package/lib/typescript/src/models/TerminalBindingTask.d.ts.map +1 -0
  112. package/lib/typescript/src/models/Transaction.d.ts +12 -0
  113. package/lib/typescript/src/models/Transaction.d.ts.map +1 -0
  114. package/lib/typescript/src/models/TxnParams.d.ts +10 -0
  115. package/lib/typescript/src/models/TxnParams.d.ts.map +1 -0
  116. package/lib/typescript/src/models/UserInfo.d.ts +17 -0
  117. package/lib/typescript/src/models/UserInfo.d.ts.map +1 -0
  118. package/lib/typescript/src/multiply.d.ts +2 -0
  119. package/lib/typescript/src/multiply.d.ts.map +1 -0
  120. package/lib/typescript/src/multiply.native.d.ts +2 -0
  121. package/lib/typescript/src/multiply.native.d.ts.map +1 -0
  122. package/lib/typescript/src/namespaces/Extension.d.ts +74 -0
  123. package/lib/typescript/src/namespaces/Extension.d.ts.map +1 -0
  124. package/lib/typescript/src/namespaces/RemoteChannel.d.ts +25 -0
  125. package/lib/typescript/src/namespaces/RemoteChannel.d.ts.map +1 -0
  126. package/lib/typescript/src/namespaces/Utils.d.ts +28 -0
  127. package/lib/typescript/src/namespaces/Utils.d.ts.map +1 -0
  128. package/lib/typescript/src/types.d.ts +12 -0
  129. package/lib/typescript/src/types.d.ts.map +1 -0
  130. package/package.json +171 -0
  131. package/src/EdfaPayPlugin.ts +551 -0
  132. package/src/NativeEdfapaySoftposSdkRn.ts +7 -0
  133. package/src/bridge.ts +106 -0
  134. package/src/enums/Env.ts +7 -0
  135. package/src/enums/FlowType.ts +5 -0
  136. package/src/enums/FunctionCode.ts +8 -0
  137. package/src/enums/PaymentMethod.ts +4 -0
  138. package/src/enums/Presentation.ts +12 -0
  139. package/src/enums/PurchaseSecondaryAction.ts +5 -0
  140. package/src/enums/TransactionType.ts +11 -0
  141. package/src/globals.d.ts +1 -0
  142. package/src/index.tsx +52 -0
  143. package/src/models/BnplResponse.ts +31 -0
  144. package/src/models/EdfaPayCredentials.ts +36 -0
  145. package/src/models/InvoiceRequest.ts +93 -0
  146. package/src/models/Location.ts +14 -0
  147. package/src/models/Pagination.ts +29 -0
  148. package/src/models/PresentationConfig.ts +105 -0
  149. package/src/models/SdkTheme.ts +64 -0
  150. package/src/models/Terminal.ts +41 -0
  151. package/src/models/TerminalBindingTask.ts +32 -0
  152. package/src/models/Transaction.ts +39 -0
  153. package/src/models/TxnParams.ts +26 -0
  154. package/src/models/UserInfo.ts +50 -0
  155. package/src/multiply.native.tsx +5 -0
  156. package/src/multiply.tsx +5 -0
  157. package/src/namespaces/Extension.ts +194 -0
  158. package/src/namespaces/RemoteChannel.ts +43 -0
  159. package/src/namespaces/Utils.ts +91 -0
  160. package/src/types.ts +30 -0
@@ -0,0 +1,12 @@
1
+ export enum Presentation {
2
+ FULLSCREEN = 'FULLSCREEN',
3
+ DIALOG_CENTER = 'DIALOG_CENTER',
4
+ DIALOG_TOP_FILL = 'DIALOG_TOP_FILL',
5
+ DIALOG_TOP_START = 'DIALOG_TOP_START',
6
+ DIALOG_TOP_END = 'DIALOG_TOP_END',
7
+ DIALOG_TOP_CENTER = 'DIALOG_TOP_CENTER',
8
+ DIALOG_BOTTOM_FILL = 'DIALOG_BOTTOM_FILL',
9
+ DIALOG_BOTTOM_START = 'DIALOG_BOTTOM_START',
10
+ DIALOG_BOTTOM_END = 'DIALOG_BOTTOM_END',
11
+ DIALOG_BOTTOM_CENTER = 'DIALOG_BOTTOM_CENTER',
12
+ }
@@ -0,0 +1,5 @@
1
+ export enum PurchaseSecondaryAction {
2
+ NONE = 'NONE',
3
+ REVERSE = 'REVERSE',
4
+ REFUND = 'REFUND',
5
+ }
@@ -0,0 +1,11 @@
1
+ export enum TransactionType {
2
+ PURCHASE = 'PURCHASE',
3
+ AUTHORIZE = 'AUTHORIZE',
4
+ CAPTURE = 'CAPTURE',
5
+ REFUND = 'REFUND',
6
+ REVERSAL = 'REVERSAL',
7
+ VOID = 'VOID',
8
+ CASHBACK = 'CASHBACK',
9
+ CHANGE_PIN = 'CHANGE_PIN',
10
+ CARD_ACTIVATION = 'CARD_ACTIVATION',
11
+ }
@@ -0,0 +1 @@
1
+ declare const __DEV__: boolean;
package/src/index.tsx ADDED
@@ -0,0 +1,52 @@
1
+ export { multiply } from './multiply';
2
+
3
+ // ─────────────────────────────────────────────────────────────────────────────
4
+ // EdfaPay React Native SDK — barrel export
5
+ // ─────────────────────────────────────────────────────────────────────────────
6
+
7
+ // Main plugin
8
+ export { EdfaPayPlugin } from './EdfaPayPlugin';
9
+
10
+ // Callback type aliases
11
+ export type {
12
+ ProcessCompleteCallback,
13
+ OnProcessComplete,
14
+ TimeOutCallback,
15
+ CancelByUserCallback,
16
+ OnErrorCallback,
17
+ OnSuccessCallback,
18
+ OnTerminalBindingTask,
19
+ } from './types';
20
+
21
+ // Enums
22
+ export { Env } from './enums/Env';
23
+ export { FlowType } from './enums/FlowType';
24
+ export { TransactionType } from './enums/TransactionType';
25
+ export { Presentation } from './enums/Presentation';
26
+ export { PurchaseSecondaryAction } from './enums/PurchaseSecondaryAction';
27
+ export { FunctionCode } from './enums/FunctionCode';
28
+ export { PaymentMethod } from './enums/PaymentMethod';
29
+
30
+ // Models
31
+ export { Location } from './models/Location';
32
+ export { Terminal } from './models/Terminal';
33
+ export { TerminalBindingTask } from './models/TerminalBindingTask';
34
+ export { EdfaPayCredentials } from './models/EdfaPayCredentials';
35
+ export { Transaction } from './models/Transaction';
36
+ export { TxnParams } from './models/TxnParams';
37
+ export { Pagination, SortOrder, SortField } from './models/Pagination';
38
+ export { BnplResponse } from './models/BnplResponse';
39
+ export {
40
+ InvoiceRequest,
41
+ Invoice,
42
+ InvoiceLineItem,
43
+ AdditionalData,
44
+ } from './models/InvoiceRequest';
45
+ export { UserInfo } from './models/UserInfo';
46
+ export { PresentationConfig } from './models/PresentationConfig';
47
+ export { SdkTheme } from './models/SdkTheme';
48
+
49
+ // Namespaces (also accessible as EdfaPayPlugin.Extension, .Utils, .RemoteChannel)
50
+ export { PluginExtension } from './namespaces/Extension';
51
+ export { PluginUtils } from './namespaces/Utils';
52
+ export { RemoteAccess, LocalNetworkChannel } from './namespaces/RemoteChannel';
@@ -0,0 +1,31 @@
1
+ /// BNPL checkout response. Mirrors native BnplResponse class.
2
+ export class BnplResponse {
3
+ constructor(
4
+ public readonly checkoutId: string,
5
+ public readonly paymentGatewayTransactionId: string,
6
+ public readonly checkoutDeeplink: string,
7
+ public readonly transactionId: string,
8
+ ) {}
9
+
10
+ static fromJSON(json: Record<string, any>): BnplResponse {
11
+ return new BnplResponse(
12
+ (json['checkoutId'] as string) ?? '',
13
+ (json['paymentGatewayTransactionId'] as string) ?? '',
14
+ (json['checkoutDeeplink'] as string) ?? '',
15
+ (json['transactionId'] as string) ?? '',
16
+ );
17
+ }
18
+
19
+ toJSON(): Record<string, any> {
20
+ return {
21
+ checkoutId: this.checkoutId,
22
+ paymentGatewayTransactionId: this.paymentGatewayTransactionId,
23
+ checkoutDeeplink: this.checkoutDeeplink,
24
+ transactionId: this.transactionId,
25
+ };
26
+ }
27
+
28
+ toString(): string {
29
+ return `BnplResponse(checkoutId: ${this.checkoutId}, transactionId: ${this.transactionId}, checkoutDeeplink: ${this.checkoutDeeplink})`;
30
+ }
31
+ }
@@ -0,0 +1,36 @@
1
+ import { Env } from '../enums/Env';
2
+
3
+ /// Credentials for SDK initialization. Matches: EdfaPayCredentials in native SDK.
4
+ export class EdfaPayCredentials {
5
+ constructor(
6
+ public readonly environment: Env,
7
+ public readonly token?: string,
8
+ public readonly email?: string,
9
+ public readonly password?: string,
10
+ ) {}
11
+
12
+ static withToken(environment: Env, token: string): EdfaPayCredentials {
13
+ return new EdfaPayCredentials(environment, token);
14
+ }
15
+
16
+ static withEmailPassword(environment: Env, email: string, password: string): EdfaPayCredentials {
17
+ return new EdfaPayCredentials(environment, undefined, email, password);
18
+ }
19
+
20
+ static withInput(environment: Env): EdfaPayCredentials {
21
+ return new EdfaPayCredentials(environment);
22
+ }
23
+
24
+ static withEmail(environment: Env, email: string): EdfaPayCredentials {
25
+ return new EdfaPayCredentials(environment, undefined, email);
26
+ }
27
+
28
+ toJSON(): Record<string, any> {
29
+ return {
30
+ environment: this.environment,
31
+ token: this.token,
32
+ email: this.email,
33
+ password: this.password,
34
+ };
35
+ }
36
+ }
@@ -0,0 +1,93 @@
1
+ import { PaymentMethod } from '../enums/PaymentMethod';
2
+
3
+ /// Line item in BNPL invoice. Mirrors native InvoiceLineItem class.
4
+ export class InvoiceLineItem {
5
+ constructor(
6
+ public readonly sku: string,
7
+ public readonly description: string,
8
+ public readonly unitCost: number,
9
+ public readonly quantity: number,
10
+ public readonly netTotal: number,
11
+ public readonly discountAmount: number = 0,
12
+ public readonly taxTotal: number = 0,
13
+ public readonly total: number,
14
+ ) {}
15
+
16
+ toJSON(): Record<string, any> {
17
+ return {
18
+ sku: this.sku,
19
+ description: this.description,
20
+ unitCost: this.unitCost,
21
+ quantity: this.quantity,
22
+ netTotal: this.netTotal,
23
+ discountAmount: this.discountAmount,
24
+ taxTotal: this.taxTotal,
25
+ total: this.total,
26
+ };
27
+ }
28
+ }
29
+
30
+ /// Invoice details for BNPL checkout. Mirrors native Invoice class.
31
+ export class Invoice {
32
+ constructor(
33
+ public readonly total: number,
34
+ public readonly lineItems: InvoiceLineItem[],
35
+ public readonly shippingCharges: number = 0,
36
+ public readonly extraDiscount: number = 0,
37
+ ) {}
38
+
39
+ toJSON(): Record<string, any> {
40
+ return {
41
+ shippingCharges: this.shippingCharges,
42
+ extraDiscount: this.extraDiscount,
43
+ total: this.total,
44
+ lineItems: this.lineItems.map((item) => item.toJSON()),
45
+ };
46
+ }
47
+ }
48
+
49
+ /// Additional data for BNPL checkout. Mirrors native AdditionalData class.
50
+ export class AdditionalData {
51
+ constructor(public readonly storeId: string) {}
52
+
53
+ toJSON(): Record<string, any> {
54
+ return {
55
+ storeId: this.storeId,
56
+ };
57
+ }
58
+ }
59
+
60
+ /// BNPL/Invoice checkout request. Mirrors native InvoiceRequest class.
61
+ export class InvoiceRequest {
62
+ constructor(
63
+ public readonly paymentMethod: PaymentMethod,
64
+ public readonly merchantId: string,
65
+ public readonly amount: number,
66
+ public readonly currency: string,
67
+ public readonly phoneNumber: string,
68
+ public readonly email: string,
69
+ public readonly orderReferenceId: string,
70
+ public readonly orderNumber: string,
71
+ public readonly invoice: Invoice,
72
+ public readonly additionalData: AdditionalData,
73
+ public readonly locale: string = 'en_US',
74
+ public readonly paymentType: string = 'PAY_BY_INSTALMENTS',
75
+ ) {}
76
+
77
+ toJSON(): Record<string, any> {
78
+ return {
79
+ paymentMethod: this.paymentMethod,
80
+ merchantId: this.merchantId,
81
+ amount: this.amount,
82
+ currency: this.currency,
83
+ phoneNumber: this.phoneNumber,
84
+ email: this.email,
85
+ orderReferenceId: this.orderReferenceId,
86
+ orderNumber: this.orderNumber,
87
+ locale: this.locale,
88
+ paymentType: this.paymentType,
89
+ invoice: this.invoice.toJSON(),
90
+ additionalData: this.additionalData.toJSON(),
91
+ };
92
+ }
93
+ }
@@ -0,0 +1,14 @@
1
+ /// Device location. Matches: Location in native SDK.
2
+ export class Location {
3
+ constructor(
4
+ public readonly latitude: number,
5
+ public readonly longitude: number,
6
+ ) {}
7
+
8
+ toJSON(): Record<string, any> {
9
+ return {
10
+ latitude: this.latitude,
11
+ longitude: this.longitude,
12
+ };
13
+ }
14
+ }
@@ -0,0 +1,29 @@
1
+ /// Sort order for pagination. Matches: SortOrder in native SDK.
2
+ export enum SortOrder {
3
+ ASCENDING = 'ASCENDING',
4
+ DESCENDING = 'DESCENDING',
5
+ }
6
+
7
+ /// Sort field for pagination. Matches: SortField in native SDK.
8
+ export enum SortField {
9
+ CREATED = 'CREATED',
10
+ }
11
+
12
+ /// Pagination parameters. Matches: Pagination in native SDK.
13
+ export class Pagination {
14
+ constructor(
15
+ public readonly pageNumber: number = 0,
16
+ public readonly pageSize: number = 50,
17
+ public readonly sortOrder: SortOrder = SortOrder.DESCENDING,
18
+ public readonly sortBy: SortField = SortField.CREATED,
19
+ ) {}
20
+
21
+ toJSON(): Record<string, any> {
22
+ return {
23
+ pageNumber: this.pageNumber,
24
+ pageSize: this.pageSize,
25
+ sortOrder: this.sortOrder,
26
+ sortBy: this.sortBy,
27
+ };
28
+ }
29
+ }
@@ -0,0 +1,105 @@
1
+ import { Presentation } from '../enums/Presentation';
2
+ import { PurchaseSecondaryAction } from '../enums/PurchaseSecondaryAction';
3
+
4
+ /// Chainable presentation configuration.
5
+ /// Matches: Presentation.DIALOG_BOTTOM_FILL.cornerRadius(16)... in native SDK.
6
+ export class PresentationConfig {
7
+ private _dismissOnTouchOutside: boolean = true;
8
+ private _dismissOnBackPress: boolean = true;
9
+ private _animateEntry: boolean = true;
10
+ private _animateExit: boolean = true;
11
+ private _dimBackground: boolean = true;
12
+ private _dimAmount: number = 0.5;
13
+ private _cornerRadius: number = 16;
14
+ private _marginHorizontal: number = 0;
15
+ private _marginVertical: number = 0;
16
+ private _sizePercent?: number;
17
+ private _purchaseSecondaryAction: PurchaseSecondaryAction = PurchaseSecondaryAction.NONE;
18
+ private _shufflePinPad: boolean = false;
19
+
20
+ constructor(public readonly presentation: Presentation) {}
21
+
22
+ dismissOnTouchOutside(value: boolean): PresentationConfig {
23
+ this._dismissOnTouchOutside = value;
24
+ return this;
25
+ }
26
+
27
+ dismissOnBackPress(value: boolean): PresentationConfig {
28
+ this._dismissOnBackPress = value;
29
+ return this;
30
+ }
31
+
32
+ animateEntry(value: boolean): PresentationConfig {
33
+ this._animateEntry = value;
34
+ return this;
35
+ }
36
+
37
+ animateExit(value: boolean): PresentationConfig {
38
+ this._animateExit = value;
39
+ return this;
40
+ }
41
+
42
+ dimBackground(value: boolean): PresentationConfig {
43
+ this._dimBackground = value;
44
+ return this;
45
+ }
46
+
47
+ dimAmount(amount: number): PresentationConfig {
48
+ this._dimAmount = amount;
49
+ return this;
50
+ }
51
+
52
+ cornerRadius(radius: number): PresentationConfig {
53
+ this._cornerRadius = radius;
54
+ return this;
55
+ }
56
+
57
+ marginHorizontal(margin: number): PresentationConfig {
58
+ this._marginHorizontal = margin;
59
+ return this;
60
+ }
61
+
62
+ marginVertical(margin: number): PresentationConfig {
63
+ this._marginVertical = margin;
64
+ return this;
65
+ }
66
+
67
+ marginAll(margin: number): PresentationConfig {
68
+ this._marginHorizontal = margin;
69
+ this._marginVertical = margin;
70
+ return this;
71
+ }
72
+
73
+ sizePercent(percent: number): PresentationConfig {
74
+ this._sizePercent = percent;
75
+ return this;
76
+ }
77
+
78
+ setPurchaseSecondaryAction(action: PurchaseSecondaryAction): PresentationConfig {
79
+ this._purchaseSecondaryAction = action;
80
+ return this;
81
+ }
82
+
83
+ setShufflePinPad(shuffle: boolean = true): PresentationConfig {
84
+ this._shufflePinPad = shuffle;
85
+ return this;
86
+ }
87
+
88
+ toJSON(): Record<string, any> {
89
+ return {
90
+ presentation: this.presentation,
91
+ dismissOnTouchOutside: this._dismissOnTouchOutside,
92
+ dismissOnBackPress: this._dismissOnBackPress,
93
+ animateEntry: this._animateEntry,
94
+ animateExit: this._animateExit,
95
+ dimBackground: this._dimBackground,
96
+ dimAmount: this._dimAmount,
97
+ cornerRadius: this._cornerRadius,
98
+ marginHorizontal: this._marginHorizontal,
99
+ marginVertical: this._marginVertical,
100
+ sizePercent: this._sizePercent,
101
+ purchaseSecondaryAction: this._purchaseSecondaryAction,
102
+ shufflePinPad: this._shufflePinPad,
103
+ };
104
+ }
105
+ }
@@ -0,0 +1,64 @@
1
+ import { EdfaPayBridge } from '../bridge';
2
+ import { Presentation } from '../enums/Presentation';
3
+ import { PresentationConfig } from './PresentationConfig';
4
+
5
+ /// Chainable theme builder. Access via EdfaPayPlugin.theme().
6
+ /// Matches: SdkTheme in native SDK.
7
+ export class SdkTheme {
8
+ private constructor() {}
9
+
10
+ static create(): SdkTheme {
11
+ return new SdkTheme();
12
+ }
13
+
14
+ setPrimaryColor(color: string): SdkTheme {
15
+ EdfaPayBridge.invoke('setPrimaryColor', { color });
16
+ return this;
17
+ }
18
+
19
+ setSecondaryColor(color: string): SdkTheme {
20
+ EdfaPayBridge.invoke('setSecondaryColor', { color });
21
+ return this;
22
+ }
23
+
24
+ setFontScale(scale: number): SdkTheme {
25
+ EdfaPayBridge.invoke('setFontScale', { scale });
26
+ return this;
27
+ }
28
+
29
+ setHeaderImage(base64: string): SdkTheme {
30
+ EdfaPayBridge.invoke('setHeaderImage', { base64 });
31
+ return this;
32
+ }
33
+
34
+ setPoweredByImage(base64: string): SdkTheme {
35
+ EdfaPayBridge.invoke('setPoweredByImage', { base64 });
36
+ return this;
37
+ }
38
+
39
+ setRegisterCelebrationAnimation(lottieJsonBase64: string | null, speed: number = 1.0): SdkTheme {
40
+ EdfaPayBridge.invoke('setRegisterCelebrationAnimation', { lottieJsonBase64, speed });
41
+ return this;
42
+ }
43
+
44
+ setPurchaseCelebrationAnimation(lottieJsonBase64: string | null, speed: number = 1.0): SdkTheme {
45
+ EdfaPayBridge.invoke('setPurchaseCelebrationAnimation', { lottieJsonBase64, speed });
46
+ return this;
47
+ }
48
+
49
+ /**
50
+ * Accepts a Presentation enum value or a PresentationConfig instance.
51
+ * Usage: .setPresentation(Presentation.DIALOG_CENTER)
52
+ * .setPresentation(new PresentationConfig(Presentation.DIALOG_BOTTOM_FILL).cornerRadius(20))
53
+ */
54
+ setPresentation(presentation: Presentation | PresentationConfig): SdkTheme {
55
+ let config: Record<string, any>;
56
+ if (presentation instanceof PresentationConfig) {
57
+ config = presentation.toJSON();
58
+ } else {
59
+ config = new PresentationConfig(presentation).toJSON();
60
+ }
61
+ EdfaPayBridge.invoke('setPresentation', { presentation: config });
62
+ return this;
63
+ }
64
+ }
@@ -0,0 +1,41 @@
1
+ import { EdfaPayBridge } from "../bridge";
2
+
3
+ /// Terminal available for binding. Mirrors native Terminal class.
4
+ export class Terminal {
5
+ constructor(
6
+ public readonly terminalId: string,
7
+ public readonly trsm: string,
8
+ public readonly providerTid: string
9
+ ) {}
10
+
11
+ static fromJSON(json: Record<string, any>): Terminal {
12
+ console.log('>>> Terminal.fromJSON called with', json);
13
+ return new Terminal(
14
+ (json.terminalId as string) ?? '',
15
+ (json.trsm as string) ?? '',
16
+ (json.providerTid as string) ?? ''
17
+ );
18
+ }
19
+
20
+ toJSON(): Record<string, any> {
21
+ return {
22
+ terminalId: this.terminalId,
23
+ trsm: this.trsm,
24
+ providerTid: this.providerTid,
25
+ };
26
+ }
27
+
28
+ toString(): string {
29
+ return `Terminal(terminalId: ${this.terminalId}, trsm: ${this.trsm}, providerTid: ${this.providerTid})`;
30
+ }
31
+
32
+ /**
33
+ * Show native terminal selection UI (no arg), or bind a specific terminal.
34
+ * On completion, initiate()'s onSuccess or onError will be called.
35
+ */
36
+ bind(): void {
37
+ console.log('>>> Terminal Binding Task received, showing binding UI');
38
+ console.log(this.toJSON());
39
+ EdfaPayBridge.invoke('bindTerminal', { trsm: this.trsm });
40
+ }
41
+ }
@@ -0,0 +1,32 @@
1
+ import { EdfaPayBridge } from '../bridge';
2
+ import type { OnTerminalRefresh } from '../types';
3
+ import { Terminal } from './Terminal';
4
+
5
+ /// Task for binding a terminal. Mirrors native TerminalBindingTask.
6
+ ///
7
+ /// When binding completes (success or error), the original callbacks
8
+ /// from initiate() are triggered automatically.
9
+ ///
10
+ /// The _invoke function is injected by the bridge at construction time
11
+ /// to avoid a circular import between bridge.ts and TerminalBindingTask.ts.
12
+ export class TerminalBindingTask {
13
+ constructor(public readonly terminals: Terminal[]) {}
14
+
15
+ /**
16
+ * Show native terminal selection UI (no arg), or bind a specific terminal.
17
+ * On completion, initiate()'s onSuccess or onError will be called.
18
+ */
19
+ bind(): void {
20
+ console.log('>>> Terminal Binding Task received, showing binding UI');
21
+ EdfaPayBridge.invoke('showBindingUI');
22
+ }
23
+
24
+ refresh(onRefresh: OnTerminalRefresh): void {
25
+ console.log('>>> Terminal Binding Task received, refreshing terminal list');
26
+ EdfaPayBridge.invoke(
27
+ 'refreshTerminal',
28
+ {},
29
+ { OnTerminalRefresh: onRefresh }
30
+ );
31
+ }
32
+ }
@@ -0,0 +1,39 @@
1
+ import { TransactionType } from '../enums/TransactionType';
2
+
3
+ /// Lightweight transaction reference used for reverse/void/capture/refund.
4
+ /// Matches: Transaction.withRRN(...) / Transaction.withTxnNumber(...) in native SDK.
5
+ export class Transaction {
6
+ private constructor(
7
+ public readonly rrn?: string,
8
+ public readonly txnNumber?: string,
9
+ public readonly txnDate?: string, // ISO date string formatted as YYYY-MM-DD
10
+ public readonly type?: TransactionType
11
+ ) {}
12
+
13
+ /// Create a transaction reference using RRN (for refund, capture, reversal).
14
+ static withRRN(
15
+ rrn: string,
16
+ txnDate?: string,
17
+ type?: TransactionType
18
+ ): Transaction {
19
+ return new Transaction(rrn, undefined, txnDate, type);
20
+ }
21
+
22
+ /// Create a transaction reference using transaction number.
23
+ static withTxnNumber(
24
+ txnNumber: string,
25
+ txnDate?: string,
26
+ type?: TransactionType
27
+ ): Transaction {
28
+ return new Transaction(undefined, txnNumber, txnDate, type);
29
+ }
30
+
31
+ toJSON(): Record<string, any> {
32
+ return {
33
+ rrn: this.rrn,
34
+ txnNumber: this.txnNumber,
35
+ txnDate: this.txnDate,
36
+ type: this.type,
37
+ };
38
+ }
39
+ }
@@ -0,0 +1,26 @@
1
+ import { Transaction } from './Transaction';
2
+
3
+ /// Transaction parameters. Matches: TxnParams in native SDK.
4
+ export class TxnParams {
5
+ public originalTransaction?: Transaction;
6
+
7
+ constructor(
8
+ public readonly amount: string,
9
+ public readonly orderId?: string,
10
+ originalTransaction?: Transaction,
11
+ ) {
12
+ this.originalTransaction = originalTransaction;
13
+ }
14
+
15
+ setOriginalTransaction(txn: Transaction): void {
16
+ this.originalTransaction = txn;
17
+ }
18
+
19
+ toJSON(): Record<string, any> {
20
+ return {
21
+ amount: this.amount,
22
+ orderId: this.orderId,
23
+ originalTransaction: this.originalTransaction?.toJSON(),
24
+ };
25
+ }
26
+ }
@@ -0,0 +1,50 @@
1
+ /// User information returned by Extension.getUserInfo().
2
+ /// Mirrors native UserInfo class.
3
+ export class UserInfo {
4
+ constructor(
5
+ public readonly id: number,
6
+ public readonly userId: string,
7
+ public readonly username: string,
8
+ public readonly businessUnitId: string,
9
+ public readonly keyHash: string,
10
+ public readonly status: boolean,
11
+ public readonly deleted: boolean,
12
+ public readonly role: string,
13
+ public readonly createdAt: number,
14
+ public readonly updatedAt?: number,
15
+ ) {}
16
+
17
+ static fromJSON(json: Record<string, any>): UserInfo {
18
+ return new UserInfo(
19
+ (json['id'] as number) ?? 0,
20
+ (json['userID'] as string) ?? '',
21
+ (json['username'] as string) ?? '',
22
+ (json['businessUnitID'] as string) ?? '',
23
+ (json['keyHash'] as string) ?? '',
24
+ (json['status'] as boolean) ?? false,
25
+ (json['deleted'] as boolean) ?? false,
26
+ (json['role'] as string) ?? '',
27
+ (json['createdAt'] as number) ?? 0,
28
+ json['updatedAt'] as number | undefined,
29
+ );
30
+ }
31
+
32
+ toJSON(): Record<string, any> {
33
+ return {
34
+ id: this.id,
35
+ userID: this.userId,
36
+ username: this.username,
37
+ businessUnitID: this.businessUnitId,
38
+ keyHash: this.keyHash,
39
+ status: this.status,
40
+ deleted: this.deleted,
41
+ role: this.role,
42
+ createdAt: this.createdAt,
43
+ updatedAt: this.updatedAt,
44
+ };
45
+ }
46
+
47
+ toString(): string {
48
+ return `UserInfo(id: ${this.id}, username: ${this.username}, role: ${this.role})`;
49
+ }
50
+ }
@@ -0,0 +1,5 @@
1
+ import EdfapaySoftposSdkRn from './NativeEdfapaySoftposSdkRn';
2
+
3
+ export function multiply(a: number, b: number): number {
4
+ return EdfapaySoftposSdkRn.multiply(a, b);
5
+ }
@@ -0,0 +1,5 @@
1
+ export function multiply(_a: number, _b: number): number {
2
+ throw new Error(
3
+ "'edfapay-softpos-sdk-rn' is only supported on native platforms."
4
+ );
5
+ }