edfapay-softpos-sdk-rn 1.0.2 → 1.0.3-dev.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.
- package/android/build.gradle +5 -1
- package/package.json +4 -3
- package/src/EdfaPayPlugin.ts +0 -551
- package/src/NativeEdfapaySoftposSdkRn.ts +0 -7
- package/src/bridge.ts +0 -106
- package/src/enums/Env.ts +0 -7
- package/src/enums/FlowType.ts +0 -5
- package/src/enums/FunctionCode.ts +0 -8
- package/src/enums/PaymentMethod.ts +0 -4
- package/src/enums/Presentation.ts +0 -12
- package/src/enums/PurchaseSecondaryAction.ts +0 -5
- package/src/enums/TransactionType.ts +0 -11
- package/src/globals.d.ts +0 -1
- package/src/index.tsx +0 -52
- package/src/models/BnplResponse.ts +0 -31
- package/src/models/EdfaPayCredentials.ts +0 -36
- package/src/models/InvoiceRequest.ts +0 -93
- package/src/models/Location.ts +0 -14
- package/src/models/Pagination.ts +0 -29
- package/src/models/PresentationConfig.ts +0 -105
- package/src/models/SdkTheme.ts +0 -64
- package/src/models/Terminal.ts +0 -41
- package/src/models/TerminalBindingTask.ts +0 -32
- package/src/models/Transaction.ts +0 -39
- package/src/models/TxnParams.ts +0 -26
- package/src/models/UserInfo.ts +0 -50
- package/src/multiply.native.tsx +0 -5
- package/src/multiply.tsx +0 -5
- package/src/namespaces/Extension.ts +0 -194
- package/src/namespaces/RemoteChannel.ts +0 -43
- package/src/namespaces/Utils.ts +0 -91
- package/src/types.ts +0 -30
package/src/bridge.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
// ignore-file: avoid-console
|
|
2
|
-
import { NativeModules, DeviceEventEmitter } from 'react-native';
|
|
3
|
-
import { Terminal } from './models/Terminal';
|
|
4
|
-
import { TerminalBindingTask } from './models/TerminalBindingTask';
|
|
5
|
-
|
|
6
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
-
// EdfaPayBridge (INTERNAL — do not use directly, use EdfaPayPlugin)
|
|
8
|
-
//
|
|
9
|
-
// Invoke channel : JS → Native via NativeModules.EdfapaySoftposSdkRn
|
|
10
|
-
// Callback event : Native → JS via RCTDeviceEventEmitter "EdfaPayCallback"
|
|
11
|
-
// payload: { method: String, args: Array<Any> }
|
|
12
|
-
//
|
|
13
|
-
// Flutter equivalents:
|
|
14
|
-
// invoke channel = com.edfapay.invoke MethodChannel
|
|
15
|
-
// callback channel= com.edfapay.callback MethodChannel (replaced by DeviceEventEmitter)
|
|
16
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
17
|
-
|
|
18
|
-
const { EdfapaySoftposSdkRn } = NativeModules;
|
|
19
|
-
|
|
20
|
-
if (!EdfapaySoftposSdkRn && __DEV__) {
|
|
21
|
-
console.warn(
|
|
22
|
-
'[EdfaPayBridge] Native module "EdfapaySoftposSdkRn" not found. ' +
|
|
23
|
-
'Make sure the native module is linked and the app has been rebuilt.'
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Callback storage — same structure as Flutter: Map<callbackName, Function>
|
|
28
|
-
// Replaced entirely on each invoke (same as Flutter: _callbacks = callbacks)
|
|
29
|
-
let _callbacks: Record<string, Function> = {};
|
|
30
|
-
|
|
31
|
-
// ── Native → JS event handler ──────────────────────────────────────────────
|
|
32
|
-
|
|
33
|
-
DeviceEventEmitter.addListener(
|
|
34
|
-
'EdfaPayCallback',
|
|
35
|
-
(event: { method: string; args: any[] }) => {
|
|
36
|
-
const { method, args } = event;
|
|
37
|
-
// Native SDK may send prefixed names like "initiate.onError" — fall back to
|
|
38
|
-
// the unprefixed key (e.g. "onError") when an exact match isn't found.
|
|
39
|
-
const unprefixed = method.includes('.') ? method.split('.').pop()! : method;
|
|
40
|
-
const cb = _callbacks[method] ?? _callbacks[unprefixed];
|
|
41
|
-
|
|
42
|
-
if (!cb) {
|
|
43
|
-
console.log('[EdfaPayBridge] No callback registered for:', method);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Special handling: onTerminalBindingTask — wrap raw terminal maps in TerminalBindingTask.
|
|
48
|
-
// Pass a bound invoker so TerminalBindingTask.bind() calls back into the bridge
|
|
49
|
-
// without a circular module import.
|
|
50
|
-
if (unprefixed === 'onTerminalBindingTask') {
|
|
51
|
-
const rawList: any[] = args[0] ?? [];
|
|
52
|
-
const terminalList: Terminal[] = rawList.map((t: any) =>
|
|
53
|
-
Terminal.fromJSON(t as Record<string, any>)
|
|
54
|
-
);
|
|
55
|
-
const task = new TerminalBindingTask(terminalList);
|
|
56
|
-
cb(task);
|
|
57
|
-
console.log(
|
|
58
|
-
`[EdfaPayBridge] Triggered onTerminalBindingTask with ${terminalList.length} terminal(s)`
|
|
59
|
-
);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Default handling: normalise each arg (Map stays as-is, primitives pass through)
|
|
64
|
-
const positionalArgs: any[] = (args ?? []).map((arg: any) => {
|
|
65
|
-
if (arg !== null && typeof arg === 'object' && !Array.isArray(arg)) {
|
|
66
|
-
return arg as Record<string, any>;
|
|
67
|
-
}
|
|
68
|
-
return arg;
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
cb(...positionalArgs);
|
|
72
|
-
console.log(
|
|
73
|
-
`[EdfaPayBridge] Triggered "${method}" with ${positionalArgs.length} arg(s)`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
// ── Public bridge API ──────────────────────────────────────────────────────
|
|
79
|
-
|
|
80
|
-
export const EdfaPayBridge = {
|
|
81
|
-
/**
|
|
82
|
-
* Send a method call to native and (optionally) replace the active callback map.
|
|
83
|
-
* Mirrors Flutter: _bridge.invoke(method, params: ..., callbacks: ...)
|
|
84
|
-
*/
|
|
85
|
-
invoke(
|
|
86
|
-
method: string,
|
|
87
|
-
params?: Record<string, any>,
|
|
88
|
-
callbacks?: Record<string, Function>
|
|
89
|
-
): void {
|
|
90
|
-
if (callbacks) {
|
|
91
|
-
_callbacks = callbacks;
|
|
92
|
-
}
|
|
93
|
-
EdfapaySoftposSdkRn?.invoke?.(method, params ?? {});
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Send a method call to native and return a Promise with the result.
|
|
98
|
-
* Mirrors Flutter: await _bridge.invoke(method, params: ...)
|
|
99
|
-
*/
|
|
100
|
-
invokeAsync(method: string, params?: Record<string, any>): Promise<any> {
|
|
101
|
-
return (
|
|
102
|
-
EdfapaySoftposSdkRn?.invokeAsync?.(method, params ?? {}) ??
|
|
103
|
-
Promise.resolve(null)
|
|
104
|
-
);
|
|
105
|
-
},
|
|
106
|
-
};
|
package/src/enums/Env.ts
DELETED
package/src/enums/FlowType.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export enum FunctionCode {
|
|
2
|
-
FULL_TERMINAL_CONFIGURATION = 'FULL_TERMINAL_CONFIGURATION',
|
|
3
|
-
PARTIAL_TERMINAL_CONFIGURATION = 'PARTIAL_TERMINAL_CONFIGURATION',
|
|
4
|
-
FORCE_RECONCILIATION = 'FORCE_RECONCILIATION',
|
|
5
|
-
NORMAL_RECONCILIATION = 'NORMAL_RECONCILIATION',
|
|
6
|
-
REVERSE_TRANSACTION = 'REVERSE_TRANSACTION',
|
|
7
|
-
CANCEL_TRANSACTION = 'CANCEL_TRANSACTION',
|
|
8
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
package/src/globals.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare const __DEV__: boolean;
|
package/src/index.tsx
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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';
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
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
|
-
}
|
package/src/models/Location.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
package/src/models/Pagination.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
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
|
-
}
|
package/src/models/SdkTheme.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
}
|
package/src/models/Terminal.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|