@tapayadot/accept-react-native 1.1.0 → 1.2.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/README.md +143 -30
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/AcceptSdkReactNativeModule.kt +241 -20
- package/build/AcceptSdkReactNative.types.d.ts +107 -15
- package/build/AcceptSdkReactNative.types.d.ts.map +1 -1
- package/build/AcceptSdkReactNative.types.js.map +1 -1
- package/build/AcceptSdkReactNativeModule.d.ts +10 -1
- package/build/AcceptSdkReactNativeModule.d.ts.map +1 -1
- package/build/AcceptSdkReactNativeModule.js.map +1 -1
- package/build/index.d.ts +94 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +70 -2
- package/build/index.js.map +1 -1
- package/ios/AcceptSdkReactNativeModule.swift +267 -41
- package/package.json +3 -6
- package/plugin/withCustomRepoModule.js +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { NativeModule } from 'expo';
|
|
2
|
-
import { AcceptThemeConfiguration, CardPaymentIntent, CardPaymentResult, SepaPaymentIntent, SepaPaymentResult, CertisPaymentIntent, CertisPaymentResult, KybPrefillData, AcceptSdkReactNativeModuleEvents } from './AcceptSdkReactNative.types';
|
|
2
|
+
import { AcceptThemeConfiguration, AcceptUiBehavior, CardPaymentIntent, CardPaymentResult, SepaPaymentIntent, SepaPaymentResult, CertisPaymentIntent, CertisPaymentResult, KybPrefillData, AcceptSdkReactNativeModuleEvents, AcceptOnboardingStatus, PaymentMethod, PaymentMethodStatus, RefundIntent, RefundResult } from './AcceptSdkReactNative.types';
|
|
3
3
|
declare class AcceptSdkReactNativeModule extends NativeModule<AcceptSdkReactNativeModuleEvents> {
|
|
4
4
|
initialize(demo: boolean, theme?: AcceptThemeConfiguration): Promise<void>;
|
|
5
5
|
setTheme(theme: AcceptThemeConfiguration): Promise<void>;
|
|
6
|
+
/** @platform android */
|
|
7
|
+
setUiBehavior(behavior: AcceptUiBehavior): Promise<void>;
|
|
6
8
|
authenticate(token: string): Promise<boolean>;
|
|
7
9
|
getStatus(): Promise<'IDLE' | 'INITIALIZED' | 'LOGGED_IN'>;
|
|
8
10
|
getPaymentStatus(paymentIntentId: string): Promise<string>;
|
|
@@ -13,6 +15,13 @@ declare class AcceptSdkReactNativeModule extends NativeModule<AcceptSdkReactNati
|
|
|
13
15
|
startCardPayment(paymentIntent: CardPaymentIntent): Promise<CardPaymentResult>;
|
|
14
16
|
startSepaPayment(paymentIntent: SepaPaymentIntent): Promise<SepaPaymentResult>;
|
|
15
17
|
startCertisPayment(paymentIntent: CertisPaymentIntent): Promise<CertisPaymentResult>;
|
|
18
|
+
refund(intent: RefundIntent): Promise<RefundResult>;
|
|
19
|
+
cancelActivePayment(): Promise<void>;
|
|
20
|
+
enableDemoMode(): Promise<void>;
|
|
21
|
+
disableDemoMode(): Promise<void>;
|
|
22
|
+
isDemoMode(): Promise<boolean>;
|
|
23
|
+
getOnboardingStatus(): Promise<AcceptOnboardingStatus>;
|
|
24
|
+
getPaymentMethodStatus(method: PaymentMethod): Promise<PaymentMethodStatus>;
|
|
16
25
|
/** @platform ios */
|
|
17
26
|
pairWithCompanionApp(): Promise<void>;
|
|
18
27
|
/** @platform ios */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcceptSdkReactNativeModule.d.ts","sourceRoot":"","sources":["../src/AcceptSdkReactNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,cAAc,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"AcceptSdkReactNativeModule.d.ts","sourceRoot":"","sources":["../src/AcceptSdkReactNativeModule.ts"],"names":[],"mapp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C,mBAAmB,CAAC;IACpF,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IACnD,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IACpC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAC/B,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAChC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAC9B,mBAAmB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IACtD,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAC3E,oBAAoB;IACpB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAErC,oBAAoB;IACpB,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IAE3C,oBAAoB;IACpB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;CAC1C;;AAGD,wBAAuF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcceptSdkReactNativeModule.js","sourceRoot":"","sources":["../src/AcceptSdkReactNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"AcceptSdkReactNativeModule.js","sourceRoot":"","sources":["../src/AcceptSdkReactNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAoCzD,yDAAyD;AACzD,eAAe,mBAAmB,CAA6B,sBAAsB,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport { AcceptThemeConfiguration, AcceptUiBehavior, CardPaymentIntent, CardPaymentResult, SepaPaymentIntent, SepaPaymentResult, CertisPaymentIntent, CertisPaymentResult, KybPrefillData, AcceptSdkReactNativeModuleEvents, AcceptOnboardingStatus, PaymentMethod, PaymentMethodStatus, RefundIntent, RefundResult } from './AcceptSdkReactNative.types';\n\ndeclare class AcceptSdkReactNativeModule extends NativeModule<AcceptSdkReactNativeModuleEvents> {\n initialize(demo: boolean, theme?: AcceptThemeConfiguration): Promise<void>;\n setTheme(theme: AcceptThemeConfiguration): Promise<void>;\n /** @platform android */\n setUiBehavior(behavior: AcceptUiBehavior): Promise<void>;\n authenticate(token: string): Promise<boolean>;\n getStatus(): Promise<'IDLE' | 'INITIALIZED' | 'LOGGED_IN'>;\n getPaymentStatus(paymentIntentId: string): Promise<string>;\n logOut(): Promise<boolean>;\n requestLocationPermission(): Promise<boolean>;\n presentKyb(prefilling?: KybPrefillData): Promise<void>;\n isPaymentPending(): Promise<boolean>;\n startCardPayment(paymentIntent: CardPaymentIntent): Promise<CardPaymentResult>;\n startSepaPayment(paymentIntent: SepaPaymentIntent): Promise<SepaPaymentResult>;\n startCertisPayment(paymentIntent: CertisPaymentIntent): Promise<CertisPaymentResult>;\n refund(intent: RefundIntent): Promise<RefundResult>;\n cancelActivePayment(): Promise<void>;\n enableDemoMode(): Promise<void>;\n disableDemoMode(): Promise<void>;\n isDemoMode(): Promise<boolean>;\n getOnboardingStatus(): Promise<AcceptOnboardingStatus>;\n getPaymentMethodStatus(method: PaymentMethod): Promise<PaymentMethodStatus>;\n /** @platform ios */\n pairWithCompanionApp(): Promise<void>;\n\n /** @platform ios */\n isCompanionAppInstalled(): Promise<boolean>;\n\n /** @platform ios */\n presentCompanionAppSheet(): Promise<void>;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<AcceptSdkReactNativeModule>('AcceptSdkReactNative');\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type AcceptThemeConfiguration, type AcceptColorTheme, type AcceptImageTheme, type GradientColors, type CardPaymentResult, type SepaPaymentResult, type CertisPaymentResult, type CardPaymentIntent, type CertisPaymentIntent, type SepaPaymentIntent, type KybPrefillData, type SdkStatus, CardPaymentStatus, SepaInstantPaymentStatus, CertisInstantPaymentStatus
|
|
2
|
-
export type { AcceptThemeConfiguration, AcceptColorTheme, AcceptImageTheme, GradientColors, CardPaymentResult, SepaPaymentResult, CertisPaymentResult, CardPaymentIntent, SepaPaymentIntent, CertisPaymentIntent, CardPaymentStatus, SepaInstantPaymentStatus, CertisInstantPaymentStatus, SdkStatus, KybPrefillData, };
|
|
3
|
-
export { Currency };
|
|
1
|
+
import { type AcceptThemeConfiguration, type AcceptColorTheme, type AcceptImageTheme, type AcceptUiBehavior, type NfcIndicator, type NfcPosition, type NfcZone, type GradientColors, type CardPaymentResult, type SepaPaymentResult, type CertisPaymentResult, type CardPaymentIntent, type CertisPaymentIntent, type SepaPaymentIntent, type KybPrefillData, type SdkStatus, type AcceptOnboardingStatus, type AcceptPaymentMethodStatus, type PaymentMethod, type PaymentMethodStatus, type RefundIntent, type RefundResult, type RefundReason, type TransactionStatus, CardPaymentStatus, SepaInstantPaymentStatus, CertisInstantPaymentStatus } from './AcceptSdkReactNative.types';
|
|
2
|
+
export type { AcceptThemeConfiguration, AcceptColorTheme, AcceptImageTheme, AcceptUiBehavior, NfcIndicator, NfcPosition, NfcZone, GradientColors, CardPaymentResult, SepaPaymentResult, CertisPaymentResult, CardPaymentIntent, SepaPaymentIntent, CertisPaymentIntent, CardPaymentStatus, SepaInstantPaymentStatus, CertisInstantPaymentStatus, SdkStatus, KybPrefillData, AcceptOnboardingStatus, AcceptPaymentMethodStatus, PaymentMethod, PaymentMethodStatus, RefundIntent, RefundResult, RefundReason, TransactionStatus, };
|
|
4
3
|
/**
|
|
5
4
|
* Initializes the SDK. Must be called before any other method.
|
|
6
5
|
* @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).
|
|
@@ -12,6 +11,13 @@ export declare const initialize: (demo?: boolean, theme?: AcceptThemeConfigurati
|
|
|
12
11
|
* @param theme - UI theme overrides. Omit `colors` or `images` to keep SDK defaults for those slots.
|
|
13
12
|
*/
|
|
14
13
|
export declare const setTheme: (theme: AcceptThemeConfiguration) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Configures SDK-owned UI behavior around a transaction —
|
|
16
|
+
* result-screen visibility/duration and Tap-to-Pay NFC zone overrides.
|
|
17
|
+
* No-op on iOS.
|
|
18
|
+
* @platform android
|
|
19
|
+
*/
|
|
20
|
+
export declare const setUiBehavior: (behavior: AcceptUiBehavior) => Promise<void>;
|
|
15
21
|
/**
|
|
16
22
|
* Authenticates a merchant session using a token obtained from your backend.
|
|
17
23
|
* Call after {@link initialize}.
|
|
@@ -67,6 +73,17 @@ export declare const identity: {
|
|
|
67
73
|
* @param prefilling - Optional data to pre-populate the onboarding form.
|
|
68
74
|
*/
|
|
69
75
|
presentKyb: (prefilling?: KybPrefillData) => Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the merchant's aggregate onboarding status and per-method statuses.
|
|
78
|
+
* Requires an authenticated session.
|
|
79
|
+
*/
|
|
80
|
+
getOnboardingStatus: () => Promise<AcceptOnboardingStatus>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the onboarding status for a single payment method.
|
|
83
|
+
* Requires an authenticated session.
|
|
84
|
+
* @param method - The payment method to query.
|
|
85
|
+
*/
|
|
86
|
+
getPaymentMethodStatus: (method: PaymentMethod) => Promise<PaymentMethodStatus>;
|
|
70
87
|
};
|
|
71
88
|
/** Payment methods for card and bank transfer terminals. */
|
|
72
89
|
export declare const payments: {
|
|
@@ -97,10 +114,43 @@ export declare const payments: {
|
|
|
97
114
|
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
98
115
|
*/
|
|
99
116
|
startCertisPayment: (paymentIntent: CertisPaymentIntent, statusCallback: (status: CertisInstantPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<CertisPaymentResult>;
|
|
117
|
+
/**
|
|
118
|
+
* Refunds a previously completed card payment.
|
|
119
|
+
*
|
|
120
|
+
* Runs headlessly — no UI is shown.
|
|
121
|
+
* @param intent - Refund details.
|
|
122
|
+
* @returns The refund result. On iOS, fully populated. On Android, only `status` and `refundReason` are guaranteed —
|
|
123
|
+
* call {@link getPaymentStatus} on the source payment for richer state.
|
|
124
|
+
* @throws If the source payment is not found, the refund is in conflict (already refunded, wrong state),
|
|
125
|
+
* or the SDK is not initialized / authenticated.
|
|
126
|
+
*/
|
|
127
|
+
refund: (intent: RefundIntent) => Promise<RefundResult>;
|
|
128
|
+
/**
|
|
129
|
+
* Cancels the currently active payment flow.
|
|
130
|
+
*
|
|
131
|
+
* Dismisses any payment UI and — if still pending — cancels the transaction server-side.
|
|
132
|
+
* The in-flight `startCardPayment` / `startSepaPayment` / `startCertisPayment` promise resolves
|
|
133
|
+
* to an aborted result.
|
|
134
|
+
* @throws If no payment flow is currently in progress.
|
|
135
|
+
*/
|
|
136
|
+
cancelActivePayment: () => Promise<void>;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Demo mode toggles. When enabled, payment flows bypass real terminals and return
|
|
140
|
+
* synthetic results — useful for development and screenshots.
|
|
141
|
+
*/
|
|
142
|
+
export declare const demo: {
|
|
143
|
+
/** Enables demo mode. Subsequent payments will be simulated. */
|
|
144
|
+
enable: () => Promise<void>;
|
|
145
|
+
/** Disables demo mode and returns to real terminal flows. */
|
|
146
|
+
disable: () => Promise<void>;
|
|
147
|
+
/** Returns whether demo mode is currently enabled. */
|
|
148
|
+
isEnabled: () => Promise<boolean>;
|
|
100
149
|
};
|
|
101
|
-
declare const
|
|
150
|
+
declare const Accept: {
|
|
102
151
|
initialize: (demo?: boolean, theme?: AcceptThemeConfiguration) => Promise<void>;
|
|
103
152
|
setTheme: (theme: AcceptThemeConfiguration) => Promise<void>;
|
|
153
|
+
setUiBehavior: (behavior: AcceptUiBehavior) => Promise<void>;
|
|
104
154
|
authenticate: (token: string) => Promise<void>;
|
|
105
155
|
getStatus: () => Promise<SdkStatus>;
|
|
106
156
|
getPaymentStatus: (paymentIntentId: string) => Promise<CardPaymentResult | SepaPaymentResult | CertisPaymentResult>;
|
|
@@ -116,6 +166,17 @@ declare const AcceptSDK: {
|
|
|
116
166
|
* @param prefilling - Optional data to pre-populate the onboarding form.
|
|
117
167
|
*/
|
|
118
168
|
presentKyb: (prefilling?: KybPrefillData) => Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Returns the merchant's aggregate onboarding status and per-method statuses.
|
|
171
|
+
* Requires an authenticated session.
|
|
172
|
+
*/
|
|
173
|
+
getOnboardingStatus: () => Promise<AcceptOnboardingStatus>;
|
|
174
|
+
/**
|
|
175
|
+
* Returns the onboarding status for a single payment method.
|
|
176
|
+
* Requires an authenticated session.
|
|
177
|
+
* @param method - The payment method to query.
|
|
178
|
+
*/
|
|
179
|
+
getPaymentMethodStatus: (method: PaymentMethod) => Promise<PaymentMethodStatus>;
|
|
119
180
|
};
|
|
120
181
|
payments: {
|
|
121
182
|
/**
|
|
@@ -145,7 +206,35 @@ declare const AcceptSDK: {
|
|
|
145
206
|
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
146
207
|
*/
|
|
147
208
|
startCertisPayment: (paymentIntent: CertisPaymentIntent, statusCallback: (status: CertisInstantPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<CertisPaymentResult>;
|
|
209
|
+
/**
|
|
210
|
+
* Refunds a previously completed card payment.
|
|
211
|
+
*
|
|
212
|
+
* Runs headlessly — no UI is shown.
|
|
213
|
+
* @param intent - Refund details.
|
|
214
|
+
* @returns The refund result. On iOS, fully populated. On Android, only `status` and `refundReason` are guaranteed —
|
|
215
|
+
* call {@link getPaymentStatus} on the source payment for richer state.
|
|
216
|
+
* @throws If the source payment is not found, the refund is in conflict (already refunded, wrong state),
|
|
217
|
+
* or the SDK is not initialized / authenticated.
|
|
218
|
+
*/
|
|
219
|
+
refund: (intent: RefundIntent) => Promise<RefundResult>;
|
|
220
|
+
/**
|
|
221
|
+
* Cancels the currently active payment flow.
|
|
222
|
+
*
|
|
223
|
+
* Dismisses any payment UI and — if still pending — cancels the transaction server-side.
|
|
224
|
+
* The in-flight `startCardPayment` / `startSepaPayment` / `startCertisPayment` promise resolves
|
|
225
|
+
* to an aborted result.
|
|
226
|
+
* @throws If no payment flow is currently in progress.
|
|
227
|
+
*/
|
|
228
|
+
cancelActivePayment: () => Promise<void>;
|
|
229
|
+
};
|
|
230
|
+
demo: {
|
|
231
|
+
/** Enables demo mode. Subsequent payments will be simulated. */
|
|
232
|
+
enable: () => Promise<void>;
|
|
233
|
+
/** Disables demo mode and returns to real terminal flows. */
|
|
234
|
+
disable: () => Promise<void>;
|
|
235
|
+
/** Returns whether demo mode is currently enabled. */
|
|
236
|
+
isEnabled: () => Promise<boolean>;
|
|
148
237
|
};
|
|
149
238
|
};
|
|
150
|
-
export default
|
|
239
|
+
export default Accept;
|
|
151
240
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,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K,IAAI,iBAC3C,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,KAC1D,OAAO,CAAC,iBAAiB,CAAC;QAsB7B;;;;;;;WAOG;4CAEc,mBAAmB,kBAClB,CAAC,MAAM,EAAE,0BAA0B,KAAK,IAAI,iBAC7C,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,KAC1D,OAAO,CAAC,mBAAmB,CAAC;QAsB/B;;;;;;;;;WASG;yBACc,YAAY,KAAG,OAAO,CAAC,YAAY,CAAC;QAIrD;;;;;;;WAOG;mCACsB,OAAO,CAAC,IAAI,CAAC;;;QAUtC,gEAAgE;sBACpD,OAAO,CAAC,IAAI,CAAC;QAIzB,6DAA6D;uBAChD,OAAO,CAAC,IAAI,CAAC;QAI1B,sDAAsD;yBACvC,OAAO,CAAC,OAAO,CAAC;;CAoBhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -14,6 +14,15 @@ export const initialize = (demo = false, theme) => {
|
|
|
14
14
|
export const setTheme = (theme) => {
|
|
15
15
|
return AcceptSdkReactNative.setTheme(theme);
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Configures SDK-owned UI behavior around a transaction —
|
|
19
|
+
* result-screen visibility/duration and Tap-to-Pay NFC zone overrides.
|
|
20
|
+
* No-op on iOS.
|
|
21
|
+
* @platform android
|
|
22
|
+
*/
|
|
23
|
+
export const setUiBehavior = (behavior) => {
|
|
24
|
+
return AcceptSdkReactNative.setUiBehavior(behavior);
|
|
25
|
+
};
|
|
17
26
|
/**
|
|
18
27
|
* Authenticates a merchant session using a token obtained from your backend.
|
|
19
28
|
* Call after {@link initialize}.
|
|
@@ -100,6 +109,21 @@ export const identity = {
|
|
|
100
109
|
presentKyb: (prefilling) => {
|
|
101
110
|
return AcceptSdkReactNative.presentKyb(prefilling);
|
|
102
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* Returns the merchant's aggregate onboarding status and per-method statuses.
|
|
114
|
+
* Requires an authenticated session.
|
|
115
|
+
*/
|
|
116
|
+
getOnboardingStatus: () => {
|
|
117
|
+
return AcceptSdkReactNative.getOnboardingStatus();
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* Returns the onboarding status for a single payment method.
|
|
121
|
+
* Requires an authenticated session.
|
|
122
|
+
* @param method - The payment method to query.
|
|
123
|
+
*/
|
|
124
|
+
getPaymentMethodStatus: (method) => {
|
|
125
|
+
return AcceptSdkReactNative.getPaymentMethodStatus(method);
|
|
126
|
+
},
|
|
103
127
|
};
|
|
104
128
|
/** Payment methods for card and bank transfer terminals. */
|
|
105
129
|
export const payments = {
|
|
@@ -170,10 +194,53 @@ export const payments = {
|
|
|
170
194
|
});
|
|
171
195
|
return result;
|
|
172
196
|
},
|
|
197
|
+
/**
|
|
198
|
+
* Refunds a previously completed card payment.
|
|
199
|
+
*
|
|
200
|
+
* Runs headlessly — no UI is shown.
|
|
201
|
+
* @param intent - Refund details.
|
|
202
|
+
* @returns The refund result. On iOS, fully populated. On Android, only `status` and `refundReason` are guaranteed —
|
|
203
|
+
* call {@link getPaymentStatus} on the source payment for richer state.
|
|
204
|
+
* @throws If the source payment is not found, the refund is in conflict (already refunded, wrong state),
|
|
205
|
+
* or the SDK is not initialized / authenticated.
|
|
206
|
+
*/
|
|
207
|
+
refund: (intent) => {
|
|
208
|
+
return AcceptSdkReactNative.refund(intent);
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Cancels the currently active payment flow.
|
|
212
|
+
*
|
|
213
|
+
* Dismisses any payment UI and — if still pending — cancels the transaction server-side.
|
|
214
|
+
* The in-flight `startCardPayment` / `startSepaPayment` / `startCertisPayment` promise resolves
|
|
215
|
+
* to an aborted result.
|
|
216
|
+
* @throws If no payment flow is currently in progress.
|
|
217
|
+
*/
|
|
218
|
+
cancelActivePayment: () => {
|
|
219
|
+
return AcceptSdkReactNative.cancelActivePayment();
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Demo mode toggles. When enabled, payment flows bypass real terminals and return
|
|
224
|
+
* synthetic results — useful for development and screenshots.
|
|
225
|
+
*/
|
|
226
|
+
export const demo = {
|
|
227
|
+
/** Enables demo mode. Subsequent payments will be simulated. */
|
|
228
|
+
enable: () => {
|
|
229
|
+
return AcceptSdkReactNative.enableDemoMode();
|
|
230
|
+
},
|
|
231
|
+
/** Disables demo mode and returns to real terminal flows. */
|
|
232
|
+
disable: () => {
|
|
233
|
+
return AcceptSdkReactNative.disableDemoMode();
|
|
234
|
+
},
|
|
235
|
+
/** Returns whether demo mode is currently enabled. */
|
|
236
|
+
isEnabled: () => {
|
|
237
|
+
return AcceptSdkReactNative.isDemoMode();
|
|
238
|
+
},
|
|
173
239
|
};
|
|
174
|
-
const
|
|
240
|
+
const Accept = {
|
|
175
241
|
initialize,
|
|
176
242
|
setTheme,
|
|
243
|
+
setUiBehavior,
|
|
177
244
|
authenticate,
|
|
178
245
|
getStatus,
|
|
179
246
|
getPaymentStatus,
|
|
@@ -184,6 +251,7 @@ const AcceptSDK = {
|
|
|
184
251
|
presentCompanionAppSheet,
|
|
185
252
|
identity,
|
|
186
253
|
payments,
|
|
254
|
+
demo,
|
|
187
255
|
};
|
|
188
|
-
export default
|
|
256
|
+
export default Accept;
|
|
189
257
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAsBhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAgB,KAAK,EAAE,KAAgC,EAAiB,EAAE;IACnG,OAAO,oBAAoB,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAA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gB,GAAG,MAAM,oBAAoB,CAAC,gBAAgB,EAAE,CAAC;QAErE,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,KAAK,CAAC,mDAAmD,CAAC,CAAA;QAClE,CAAC;QAED,IAAI,WAAW,GAAG,oBAAoB,CAAC,WAAW,CAAC,6BAA6B,EAAE,CAAC,MAAW,EAAE,EAAE,CAChG,cAAc,CAAC,MAAM,CAAC,IAAkC,CAAC,CAAC,CAAA;QAE5D,oBAAoB,CAAC,WAAW,CAAC,0BAA0B,EAAE,CAAC,GAAQ,EAAE,EAAE,CACxE,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAA;QAE5C,IAAI,MAAM,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;QAEpE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACf,WAAW,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAC;AAEF,MAAM,SAAS,GAAG;IAChB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,gBAAgB;IAChB,MAAM;IACN,yBAAyB;IACzB,oBAAoB;IACpB,uBAAuB;IACvB,wBAAwB;IACxB,QAAQ;IACR,QAAQ;CACT,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n type AcceptThemeConfiguration,\n type AcceptColorTheme,\n type AcceptImageTheme,\n type GradientColors,\n type CardPaymentResult,\n type SepaPaymentResult,\n type CertisPaymentResult,\n type CardPaymentIntent,\n type CertisPaymentIntent,\n type SepaPaymentIntent,\n type KybPrefillData,\n type SdkStatus,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n Currency,\n} from './AcceptSdkReactNative.types';\nimport AcceptSdkReactNative from './AcceptSdkReactNativeModule';\n\nexport type {\n AcceptThemeConfiguration,\n AcceptColorTheme,\n AcceptImageTheme,\n GradientColors,\n CardPaymentResult,\n SepaPaymentResult,\n CertisPaymentResult,\n CardPaymentIntent,\n SepaPaymentIntent,\n CertisPaymentIntent,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n SdkStatus,\n KybPrefillData,\n};\n\nexport { Currency };\n\n/**\n * Initializes the SDK. Must be called before any other method.\n * @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).\n * @param theme - Optional UI theme overrides applied at startup.\n */\nexport const initialize = (demo: boolean = false, theme?: AcceptThemeConfiguration): Promise<void> => {\n return AcceptSdkReactNative.initialize(demo, theme);\n};\n\n/**\n * Applies a UI theme after initialization. Can be called any time after {@link initialize}.\n * @param theme - UI theme overrides. Omit `colors` or `images` to keep SDK defaults for those slots.\n */\nexport const setTheme = (theme: AcceptThemeConfiguration): Promise<void> => {\n return AcceptSdkReactNative.setTheme(theme);\n};\n\n/**\n * Authenticates a merchant session using a token obtained from your backend.\n * Call after {@link initialize}.\n * @param token - Merchant authentication token.\n * @throws If authentication fails (invalid token, network error, etc.).\n */\nexport const authenticate = (token: string): Promise<void> => {\n return AcceptSdkReactNative.authenticate(token).then(() => Promise.resolve(undefined));\n};\n\n/**\n * Returns the current SDK status.\n * - `IDLE` — not initialized\n * - `INITIALIZED` — initialized, not authenticated\n * - `LOGGED_IN` — authenticated and ready\n */\nexport const getStatus = (): Promise<SdkStatus> => {\n return AcceptSdkReactNative.getStatus();\n};\n\n/**\n * Fetches the current status and details of a payment by its intent ID.\n * @param paymentIntentId - The payment intent identifier.\n * @returns The payment result typed to the appropriate payment method.\n * @throws If the payment intent is not found or the request fails.\n */\nexport const getPaymentStatus = (paymentIntentId: string): Promise<CardPaymentResult | SepaPaymentResult | CertisPaymentResult> => {\n let obj = AcceptSdkReactNative.getPaymentStatus(paymentIntentId);\n\n return obj.then((o) => {\n let r = JSON.parse(o);\n\n switch (r.type) {\n case \"card\":\n return r as CardPaymentResult;\n case \"certis\":\n return r as CertisPaymentResult;\n case \"sepa\":\n return r as SepaPaymentResult;\n default:\n throw new Error(\"Unknown payment result\");\n }\n });\n};\n\n/**\n * Logs out the current merchant session.\n * The SDK remains initialized — call {@link authenticate} again to sign in a different merchant.\n */\nexport const logOut = (): Promise<void> => {\n return AcceptSdkReactNative.logOut().then(() => Promise.resolve(undefined));\n};\n\n/**\n * Requests fine and coarse location permissions required for card (tap-to-pay) payments.\n * @returns `true` if all location permissions were granted.\n */\nexport const requestLocationPermission = (): Promise<boolean> => {\n return AcceptSdkReactNative.requestLocationPermission();\n};\n\n/**\n * Pairs the merchant app with the Tapaya companion app via deep link.\n * @platform ios\n */\nexport const pairWithCompanionApp = (): Promise<void> => {\n return AcceptSdkReactNative.pairWithCompanionApp();\n};\n\n/**\n * Returns whether the Tapaya companion app is installed on the device.\n * @platform ios\n */\nexport const isCompanionAppInstalled = (): Promise<boolean> => {\n return AcceptSdkReactNative.isCompanionAppInstalled();\n};\n\n/**\n * Presents the App Store product page sheet for the Tapaya companion app.\n * Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.\n * @platform ios\n */\nexport const presentCompanionAppSheet = (): Promise<void> => {\n return AcceptSdkReactNative.presentCompanionAppSheet();\n};\n\n/** Identity and onboarding methods. */\nexport const identity = {\n /**\n * Presents the KYB (Know Your Business) onboarding flow.\n * Fire-and-forget — resolves as soon as the flow is presented.\n * @param prefilling - Optional data to pre-populate the onboarding form.\n */\n presentKyb: (prefilling?: KybPrefillData): Promise<void> => {\n return AcceptSdkReactNative.presentKyb(prefilling);\n },\n};\n\n/** Payment methods for card and bank transfer terminals. */\nexport const payments = {\n /**\n * Starts a card (tap-to-pay) payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCardPayment: async (\n paymentIntent: CardPaymentIntent,\n statusCallback: (status: CardPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CardPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCardPaymentStatusChange', (status: any) => {\n statusCallback(status.data as CardPaymentStatus)})\n\n AcceptSdkReactNative.addListener('onCardPaymentException', (map: any) => {\n errorCallback(map.message, map.exception)})\n\n let result = AcceptSdkReactNative.startCardPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a SEPA Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startSepaPayment: async (\n paymentIntent: SepaPaymentIntent,\n statusCallback: (status: SepaInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<SepaPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onSepaPaymentStatusChange', (status: any) =>\n statusCallback(status.data as SepaInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onSepaPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startSepaPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a Certis Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCertisPayment: async (\n paymentIntent: CertisPaymentIntent,\n statusCallback: (status: CertisInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CertisPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCertisPaymentStatusChange', (status: any) =>\n statusCallback(status.data as CertisInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onCertisPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startCertisPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n};\n\nconst AcceptSDK = {\n initialize,\n setTheme,\n authenticate,\n getStatus,\n getPaymentStatus,\n logOut,\n requestLocationPermission,\n pairWithCompanionApp,\n isCompanionAppInstalled,\n presentCompanionAppSheet,\n identity,\n payments,\n};\n\nexport default AcceptSDK;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAgChE;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAgB,KAAK,EAAE,KAAgC,EAAiB,EAAE;IACnG,OAAO,oBAAoB,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAA+B,EAAiB,EAAE;IACzE,OAAO,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA0B,EAAiB,EAAE;IACzE,OAAO,oBAAoB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,C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IAED,sDAAsD;IACtD,SAAS,EAAE,GAAqB,EAAE;QAChC,OAAO,oBAAoB,CAAC,UAAU,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,GAAG;IACb,UAAU;IACV,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,SAAS;IACT,gBAAgB;IAChB,MAAM;IACN,yBAAyB;IACzB,oBAAoB;IACpB,uBAAuB;IACvB,wBAAwB;IACxB,QAAQ;IACR,QAAQ;IACR,IAAI;CACL,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n type AcceptThemeConfiguration,\n type AcceptColorTheme,\n type AcceptImageTheme,\n type AcceptUiBehavior,\n type NfcIndicator,\n type NfcPosition,\n type NfcZone,\n type GradientColors,\n type CardPaymentResult,\n type SepaPaymentResult,\n type CertisPaymentResult,\n type CardPaymentIntent,\n type CertisPaymentIntent,\n type SepaPaymentIntent,\n type KybPrefillData,\n type SdkStatus,\n type AcceptOnboardingStatus,\n type AcceptPaymentMethodStatus,\n type PaymentMethod,\n type PaymentMethodStatus,\n type RefundIntent,\n type RefundResult,\n type RefundReason,\n type TransactionStatus,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n} from './AcceptSdkReactNative.types';\nimport AcceptSdkReactNative from './AcceptSdkReactNativeModule';\n\nexport type {\n AcceptThemeConfiguration,\n AcceptColorTheme,\n AcceptImageTheme,\n AcceptUiBehavior,\n NfcIndicator,\n NfcPosition,\n NfcZone,\n GradientColors,\n CardPaymentResult,\n SepaPaymentResult,\n CertisPaymentResult,\n CardPaymentIntent,\n SepaPaymentIntent,\n CertisPaymentIntent,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n SdkStatus,\n KybPrefillData,\n AcceptOnboardingStatus,\n AcceptPaymentMethodStatus,\n PaymentMethod,\n PaymentMethodStatus,\n RefundIntent,\n RefundResult,\n RefundReason,\n TransactionStatus,\n};\n\n/**\n * Initializes the SDK. Must be called before any other method.\n * @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).\n * @param theme - Optional UI theme overrides applied at startup.\n */\nexport const initialize = (demo: boolean = false, theme?: AcceptThemeConfiguration): Promise<void> => {\n return AcceptSdkReactNative.initialize(demo, theme);\n};\n\n/**\n * Applies a UI theme after initialization. Can be called any time after {@link initialize}.\n * @param theme - UI theme overrides. Omit `colors` or `images` to keep SDK defaults for those slots.\n */\nexport const setTheme = (theme: AcceptThemeConfiguration): Promise<void> => {\n return AcceptSdkReactNative.setTheme(theme);\n};\n\n/**\n * Configures SDK-owned UI behavior around a transaction —\n * result-screen visibility/duration and Tap-to-Pay NFC zone overrides.\n * No-op on iOS.\n * @platform android\n */\nexport const setUiBehavior = (behavior: AcceptUiBehavior): Promise<void> => {\n return AcceptSdkReactNative.setUiBehavior(behavior);\n};\n\n/**\n * Authenticates a merchant session using a token obtained from your backend.\n * Call after {@link initialize}.\n * @param token - Merchant authentication token.\n * @throws If authentication fails (invalid token, network error, etc.).\n */\nexport const authenticate = (token: string): Promise<void> => {\n return AcceptSdkReactNative.authenticate(token).then(() => Promise.resolve(undefined));\n};\n\n/**\n * Returns the current SDK status.\n * - `IDLE` — not initialized\n * - `INITIALIZED` — initialized, not authenticated\n * - `LOGGED_IN` — authenticated and ready\n */\nexport const getStatus = (): Promise<SdkStatus> => {\n return AcceptSdkReactNative.getStatus();\n};\n\n/**\n * Fetches the current status and details of a payment by its intent ID.\n * @param paymentIntentId - The payment intent identifier.\n * @returns The payment result typed to the appropriate payment method.\n * @throws If the payment intent is not found or the request fails.\n */\nexport const getPaymentStatus = (paymentIntentId: string): Promise<CardPaymentResult | SepaPaymentResult | CertisPaymentResult> => {\n let obj = AcceptSdkReactNative.getPaymentStatus(paymentIntentId);\n\n return obj.then((o) => {\n let r = JSON.parse(o);\n\n switch (r.type) {\n case \"card\":\n return r as CardPaymentResult;\n case \"certis\":\n return r as CertisPaymentResult;\n case \"sepa\":\n return r as SepaPaymentResult;\n default:\n throw new Error(\"Unknown payment result\");\n }\n });\n};\n\n/**\n * Logs out the current merchant session.\n * The SDK remains initialized — call {@link authenticate} again to sign in a different merchant.\n */\nexport const logOut = (): Promise<void> => {\n return AcceptSdkReactNative.logOut().then(() => Promise.resolve(undefined));\n};\n\n/**\n * Requests fine and coarse location permissions required for card (tap-to-pay) payments.\n * @returns `true` if all location permissions were granted.\n */\nexport const requestLocationPermission = (): Promise<boolean> => {\n return AcceptSdkReactNative.requestLocationPermission();\n};\n\n/**\n * Pairs the merchant app with the Tapaya companion app via deep link.\n * @platform ios\n */\nexport const pairWithCompanionApp = (): Promise<void> => {\n return AcceptSdkReactNative.pairWithCompanionApp();\n};\n\n/**\n * Returns whether the Tapaya companion app is installed on the device.\n * @platform ios\n */\nexport const isCompanionAppInstalled = (): Promise<boolean> => {\n return AcceptSdkReactNative.isCompanionAppInstalled();\n};\n\n/**\n * Presents the App Store product page sheet for the Tapaya companion app.\n * Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.\n * @platform ios\n */\nexport const presentCompanionAppSheet = (): Promise<void> => {\n return AcceptSdkReactNative.presentCompanionAppSheet();\n};\n\n/** Identity and onboarding methods. */\nexport const identity = {\n /**\n * Presents the KYB (Know Your Business) onboarding flow.\n * Fire-and-forget — resolves as soon as the flow is presented.\n * @param prefilling - Optional data to pre-populate the onboarding form.\n */\n presentKyb: (prefilling?: KybPrefillData): Promise<void> => {\n return AcceptSdkReactNative.presentKyb(prefilling);\n },\n\n /**\n * Returns the merchant's aggregate onboarding status and per-method statuses.\n * Requires an authenticated session.\n */\n getOnboardingStatus: (): Promise<AcceptOnboardingStatus> => {\n return AcceptSdkReactNative.getOnboardingStatus();\n },\n\n /**\n * Returns the onboarding status for a single payment method.\n * Requires an authenticated session.\n * @param method - The payment method to query.\n */\n getPaymentMethodStatus: (method: PaymentMethod): Promise<PaymentMethodStatus> => {\n return AcceptSdkReactNative.getPaymentMethodStatus(method);\n },\n};\n\n/** Payment methods for card and bank transfer terminals. */\nexport const payments = {\n /**\n * Starts a card (tap-to-pay) payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCardPayment: async (\n paymentIntent: CardPaymentIntent,\n statusCallback: (status: CardPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CardPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCardPaymentStatusChange', (status: any) => {\n statusCallback(status.data as CardPaymentStatus)})\n\n AcceptSdkReactNative.addListener('onCardPaymentException', (map: any) => {\n errorCallback(map.message, map.exception)})\n\n let result = AcceptSdkReactNative.startCardPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a SEPA Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startSepaPayment: async (\n paymentIntent: SepaPaymentIntent,\n statusCallback: (status: SepaInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<SepaPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onSepaPaymentStatusChange', (status: any) =>\n statusCallback(status.data as SepaInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onSepaPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startSepaPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a Certis Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCertisPayment: async (\n paymentIntent: CertisPaymentIntent,\n statusCallback: (status: CertisInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CertisPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCertisPaymentStatusChange', (status: any) =>\n statusCallback(status.data as CertisInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onCertisPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startCertisPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Refunds a previously completed card payment.\n *\n * Runs headlessly — no UI is shown.\n * @param intent - Refund details.\n * @returns The refund result. On iOS, fully populated. On Android, only `status` and `refundReason` are guaranteed —\n * call {@link getPaymentStatus} on the source payment for richer state.\n * @throws If the source payment is not found, the refund is in conflict (already refunded, wrong state),\n * or the SDK is not initialized / authenticated.\n */\n refund: (intent: RefundIntent): Promise<RefundResult> => {\n return AcceptSdkReactNative.refund(intent);\n },\n\n /**\n * Cancels the currently active payment flow.\n *\n * Dismisses any payment UI and — if still pending — cancels the transaction server-side.\n * The in-flight `startCardPayment` / `startSepaPayment` / `startCertisPayment` promise resolves\n * to an aborted result.\n * @throws If no payment flow is currently in progress.\n */\n cancelActivePayment: (): Promise<void> => {\n return AcceptSdkReactNative.cancelActivePayment();\n },\n};\n\n/**\n * Demo mode toggles. When enabled, payment flows bypass real terminals and return\n * synthetic results — useful for development and screenshots.\n */\nexport const demo = {\n /** Enables demo mode. Subsequent payments will be simulated. */\n enable: (): Promise<void> => {\n return AcceptSdkReactNative.enableDemoMode();\n },\n\n /** Disables demo mode and returns to real terminal flows. */\n disable: (): Promise<void> => {\n return AcceptSdkReactNative.disableDemoMode();\n },\n\n /** Returns whether demo mode is currently enabled. */\n isEnabled: (): Promise<boolean> => {\n return AcceptSdkReactNative.isDemoMode();\n },\n};\n\nconst Accept = {\n initialize,\n setTheme,\n setUiBehavior,\n authenticate,\n getStatus,\n getPaymentStatus,\n logOut,\n requestLocationPermission,\n pairWithCompanionApp,\n isCompanionAppInstalled,\n presentCompanionAppSheet,\n identity,\n payments,\n demo,\n};\n\nexport default Accept;\n"]}
|