@tapayadot/accept-react-native 1.3.2 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +196 -363
- package/android/build.gradle +23 -34
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/AcceptSdkReactNativeModule.kt +191 -673
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/Errors.kt +81 -0
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/Parsing.kt +166 -0
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/Serialization.kt +216 -0
- package/app.json +2 -2
- package/app.plugin.js +1 -1
- package/build/Accept.d.ts +255 -0
- package/build/Accept.d.ts.map +1 -0
- package/build/Accept.js +387 -0
- package/build/Accept.js.map +1 -0
- package/build/Accept.types.d.ts +352 -0
- package/build/Accept.types.d.ts.map +1 -0
- package/build/Accept.types.js +9 -0
- package/build/Accept.types.js.map +1 -0
- package/build/AcceptError.d.ts +53 -0
- package/build/AcceptError.d.ts.map +1 -0
- package/build/AcceptError.js +107 -0
- package/build/AcceptError.js.map +1 -0
- package/build/AcceptSdkReactNativeModule.d.ts +67 -26
- package/build/AcceptSdkReactNativeModule.d.ts.map +1 -1
- package/build/AcceptSdkReactNativeModule.js +53 -3
- package/build/AcceptSdkReactNativeModule.js.map +1 -1
- package/build/index.d.ts +7 -237
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -254
- package/build/index.js.map +1 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +2 -2
- package/build/utils.js.map +1 -1
- package/expo-module.config.json +1 -6
- package/package.json +8 -12
- package/plugin/withAcceptSdk.js +45 -0
- package/build/AcceptSdkReactNative.types.d.ts +0 -259
- package/build/AcceptSdkReactNative.types.d.ts.map +0 -1
- package/build/AcceptSdkReactNative.types.js +0 -2
- package/build/AcceptSdkReactNative.types.js.map +0 -1
- package/ios/.xcode.env +0 -11
- package/ios/AcceptSdkReactNative.podspec +0 -33
- package/ios/AcceptSdkReactNativeAppDelegate.swift +0 -13
- package/ios/AcceptSdkReactNativeModule.swift +0 -749
- package/ios/Podfile +0 -63
- package/ios/Podfile.properties.json +0 -4
- package/ios/acceptsdkreactnative.xcodeproj/project.pbxproj +0 -540
- package/ios/acceptsdkreactnative.xcodeproj/xcshareddata/xcschemes/acceptsdkreactnative.xcscheme +0 -88
- package/plugin/withCustomRepoModule.js +0 -96
package/build/index.js
CHANGED
|
@@ -1,258 +1,11 @@
|
|
|
1
|
-
import AcceptSdkReactNative from './AcceptSdkReactNativeModule';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).
|
|
5
|
-
* @param theme - Optional UI theme overrides applied at startup.
|
|
6
|
-
*/
|
|
7
|
-
export const initialize = (demo = false, theme) => {
|
|
8
|
-
return AcceptSdkReactNative.initialize(demo, theme);
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Applies a UI theme after initialization. Can be called any time after {@link initialize}.
|
|
12
|
-
* @param theme - UI theme overrides. Omit `colors` or `images` to keep SDK defaults for those slots.
|
|
13
|
-
*/
|
|
14
|
-
export const setTheme = (theme) => {
|
|
15
|
-
return AcceptSdkReactNative.setTheme(theme);
|
|
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
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Authenticates a merchant session using a token obtained from your backend.
|
|
28
|
-
* Call after {@link initialize}.
|
|
29
|
-
* @param token - Merchant authentication token.
|
|
30
|
-
* @throws If authentication fails (invalid token, network error, etc.).
|
|
31
|
-
*/
|
|
32
|
-
export const authenticate = (token) => {
|
|
33
|
-
return AcceptSdkReactNative.authenticate(token).then(() => Promise.resolve(undefined));
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Returns the current SDK status.
|
|
37
|
-
* - `IDLE` — not initialized
|
|
38
|
-
* - `INITIALIZED` — initialized, not authenticated
|
|
39
|
-
* - `LOGGED_IN` — authenticated and ready
|
|
40
|
-
*/
|
|
41
|
-
export const getStatus = () => {
|
|
42
|
-
return AcceptSdkReactNative.getStatus();
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Fetches the current status and details of a payment by its intent ID.
|
|
46
|
-
* @param paymentIntentId - The payment intent identifier.
|
|
47
|
-
* @returns The payment result typed to the appropriate payment method.
|
|
48
|
-
* @throws If the payment intent is not found or the request fails.
|
|
49
|
-
*/
|
|
50
|
-
export const getPaymentStatus = (paymentIntentId) => {
|
|
51
|
-
let obj = AcceptSdkReactNative.getPaymentStatus(paymentIntentId);
|
|
52
|
-
return obj.then((o) => {
|
|
53
|
-
let r = JSON.parse(o);
|
|
54
|
-
switch (r.type) {
|
|
55
|
-
case "card":
|
|
56
|
-
return r;
|
|
57
|
-
case "certis":
|
|
58
|
-
return r;
|
|
59
|
-
case "sepa":
|
|
60
|
-
return r;
|
|
61
|
-
default:
|
|
62
|
-
throw new Error("Unknown payment result");
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Logs out the current merchant session.
|
|
68
|
-
* The SDK remains initialized — call {@link authenticate} again to sign in a different merchant.
|
|
69
|
-
*/
|
|
70
|
-
export const logOut = () => {
|
|
71
|
-
return AcceptSdkReactNative.logOut().then(() => Promise.resolve(undefined));
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Requests fine and coarse location permissions required for card (tap-to-pay) payments.
|
|
75
|
-
* @returns `true` if all location permissions were granted.
|
|
76
|
-
*/
|
|
77
|
-
export const requestLocationPermission = () => {
|
|
78
|
-
return AcceptSdkReactNative.requestLocationPermission();
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Pairs the merchant app with the Tapaya companion app.
|
|
2
|
+
* Accept SDK for React Native / Expo — Android.
|
|
82
3
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
export const pairWithCompanionApp = () => {
|
|
87
|
-
return AcceptSdkReactNative.pairWithCompanionApp();
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Returns whether the Tapaya companion app is installed on the device.
|
|
91
|
-
*/
|
|
92
|
-
export const isCompanionAppInstalled = () => {
|
|
93
|
-
return AcceptSdkReactNative.isCompanionAppInstalled();
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Presents the store product page for the Tapaya companion app (App Store sheet on iOS,
|
|
97
|
-
* Play Store on Android).
|
|
98
|
-
* Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.
|
|
99
|
-
*/
|
|
100
|
-
export const presentCompanionAppSheet = () => {
|
|
101
|
-
return AcceptSdkReactNative.presentCompanionAppSheet();
|
|
102
|
-
};
|
|
103
|
-
/** Identity and onboarding methods. */
|
|
104
|
-
export const identity = {
|
|
105
|
-
/**
|
|
106
|
-
* Presents the KYB (Know Your Business) onboarding flow.
|
|
107
|
-
* Fire-and-forget — resolves as soon as the flow is presented.
|
|
108
|
-
* @param prefilling - Optional data to pre-populate the onboarding form.
|
|
109
|
-
*/
|
|
110
|
-
presentKyb: (prefilling) => {
|
|
111
|
-
return AcceptSdkReactNative.presentKyb(prefilling);
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* Returns the merchant's aggregate onboarding status and per-method statuses.
|
|
115
|
-
* Requires an authenticated session.
|
|
116
|
-
*/
|
|
117
|
-
getOnboardingStatus: () => {
|
|
118
|
-
return AcceptSdkReactNative.getOnboardingStatus();
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* Returns the onboarding status for a single payment method.
|
|
122
|
-
* Requires an authenticated session.
|
|
123
|
-
* @param method - The payment method to query.
|
|
124
|
-
*/
|
|
125
|
-
getPaymentMethodStatus: (method) => {
|
|
126
|
-
return AcceptSdkReactNative.getPaymentMethodStatus(method);
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
/** Payment methods for card and bank transfer terminals. */
|
|
130
|
-
export const payments = {
|
|
131
|
-
/**
|
|
132
|
-
* Starts a card (tap-to-pay) payment flow.
|
|
133
|
-
* Resolves with the final result when the payment completes or fails.
|
|
134
|
-
* @param paymentIntent - Payment details.
|
|
135
|
-
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
136
|
-
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
137
|
-
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
138
|
-
*/
|
|
139
|
-
startCardPayment: async (paymentIntent, statusCallback, errorCallback) => {
|
|
140
|
-
let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();
|
|
141
|
-
if (isPaymentPending) {
|
|
142
|
-
throw Error("Payment is already pending, cancel payment first.");
|
|
143
|
-
}
|
|
144
|
-
let eventStatus = AcceptSdkReactNative.addListener('onCardPaymentStatusChange', (status) => {
|
|
145
|
-
statusCallback(status.data);
|
|
146
|
-
});
|
|
147
|
-
AcceptSdkReactNative.addListener('onCardPaymentException', (map) => {
|
|
148
|
-
errorCallback(map.message, map.exception);
|
|
149
|
-
});
|
|
150
|
-
let result = AcceptSdkReactNative.startCardPayment(paymentIntent);
|
|
151
|
-
result.then(() => {
|
|
152
|
-
eventStatus.remove();
|
|
153
|
-
});
|
|
154
|
-
return result;
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* Starts a SEPA Instant bank transfer payment flow.
|
|
158
|
-
* Resolves with the final result when the payment completes or fails.
|
|
159
|
-
* @param paymentIntent - Payment details.
|
|
160
|
-
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
161
|
-
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
162
|
-
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
163
|
-
*/
|
|
164
|
-
startSepaPayment: async (paymentIntent, statusCallback, errorCallback) => {
|
|
165
|
-
let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();
|
|
166
|
-
if (isPaymentPending) {
|
|
167
|
-
throw Error("Payment is already pending, cancel payment first.");
|
|
168
|
-
}
|
|
169
|
-
let eventStatus = AcceptSdkReactNative.addListener('onSepaPaymentStatusChange', (status) => statusCallback(status.data));
|
|
170
|
-
AcceptSdkReactNative.addListener('onSepaPaymentException', (map) => errorCallback(map.message, map.exception));
|
|
171
|
-
let result = AcceptSdkReactNative.startSepaPayment(paymentIntent);
|
|
172
|
-
result.then(() => {
|
|
173
|
-
eventStatus.remove();
|
|
174
|
-
});
|
|
175
|
-
return result;
|
|
176
|
-
},
|
|
177
|
-
/**
|
|
178
|
-
* Starts a Certis Instant bank transfer payment flow.
|
|
179
|
-
* Resolves with the final result when the payment completes or fails.
|
|
180
|
-
* @param paymentIntent - Payment details.
|
|
181
|
-
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
182
|
-
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
183
|
-
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
184
|
-
*/
|
|
185
|
-
startCertisPayment: async (paymentIntent, statusCallback, errorCallback) => {
|
|
186
|
-
let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();
|
|
187
|
-
if (isPaymentPending) {
|
|
188
|
-
throw Error("Payment is already pending, cancel payment first.");
|
|
189
|
-
}
|
|
190
|
-
let eventStatus = AcceptSdkReactNative.addListener('onCertisPaymentStatusChange', (status) => statusCallback(status.data));
|
|
191
|
-
AcceptSdkReactNative.addListener('onCertisPaymentException', (map) => errorCallback(map.message, map.exception));
|
|
192
|
-
let result = AcceptSdkReactNative.startCertisPayment(paymentIntent);
|
|
193
|
-
result.then(() => {
|
|
194
|
-
eventStatus.remove();
|
|
195
|
-
});
|
|
196
|
-
return result;
|
|
197
|
-
},
|
|
198
|
-
/**
|
|
199
|
-
* Refunds a previously completed card payment.
|
|
200
|
-
*
|
|
201
|
-
* Runs headlessly — no UI is shown.
|
|
202
|
-
* @param intent - Refund details.
|
|
203
|
-
* @returns The refund result. On iOS, fully populated. On Android, only `status` and `refundReason` are guaranteed —
|
|
204
|
-
* call {@link getPaymentStatus} on the source payment for richer state.
|
|
205
|
-
* @throws If the source payment is not found, the refund is in conflict (already refunded, wrong state),
|
|
206
|
-
* or the SDK is not initialized / authenticated.
|
|
207
|
-
*/
|
|
208
|
-
refund: (intent) => {
|
|
209
|
-
return AcceptSdkReactNative.refund(intent);
|
|
210
|
-
},
|
|
211
|
-
/**
|
|
212
|
-
* Cancels the currently active payment flow.
|
|
213
|
-
*
|
|
214
|
-
* Dismisses any payment UI and — if still pending — cancels the transaction server-side.
|
|
215
|
-
* The in-flight `startCardPayment` / `startSepaPayment` / `startCertisPayment` promise resolves
|
|
216
|
-
* to an aborted result.
|
|
217
|
-
* @throws If no payment flow is currently in progress.
|
|
218
|
-
*/
|
|
219
|
-
cancelActivePayment: () => {
|
|
220
|
-
return AcceptSdkReactNative.cancelActivePayment();
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
/**
|
|
224
|
-
* Demo mode toggles. When enabled, payment flows bypass real terminals and return
|
|
225
|
-
* synthetic results — useful for development and screenshots.
|
|
4
|
+
* A thin wrapper over the Accept SDK for Android (`com.tapaya:accept`), which in turn drives the
|
|
5
|
+
* Accept plugin app installed on the terminal. The surfaces here mirror the Android SDK 1:1, so its
|
|
6
|
+
* reference documentation applies unchanged: https://docs.tapaya.com
|
|
226
7
|
*/
|
|
227
|
-
export
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return AcceptSdkReactNative.enableDemoMode();
|
|
231
|
-
},
|
|
232
|
-
/** Disables demo mode and returns to real terminal flows. */
|
|
233
|
-
disable: () => {
|
|
234
|
-
return AcceptSdkReactNative.disableDemoMode();
|
|
235
|
-
},
|
|
236
|
-
/** Returns whether demo mode is currently enabled. */
|
|
237
|
-
isEnabled: () => {
|
|
238
|
-
return AcceptSdkReactNative.isDemoMode();
|
|
239
|
-
},
|
|
240
|
-
};
|
|
241
|
-
const Accept = {
|
|
242
|
-
initialize,
|
|
243
|
-
setTheme,
|
|
244
|
-
setUiBehavior,
|
|
245
|
-
authenticate,
|
|
246
|
-
getStatus,
|
|
247
|
-
getPaymentStatus,
|
|
248
|
-
logOut,
|
|
249
|
-
requestLocationPermission,
|
|
250
|
-
pairWithCompanionApp,
|
|
251
|
-
isCompanionAppInstalled,
|
|
252
|
-
presentCompanionAppSheet,
|
|
253
|
-
identity,
|
|
254
|
-
payments,
|
|
255
|
-
demo,
|
|
256
|
-
};
|
|
257
|
-
export default Accept;
|
|
8
|
+
export { Accept, Accept as default } from "./Accept";
|
|
9
|
+
export { AcceptError } from "./AcceptError";
|
|
10
|
+
export * from "./Accept.types";
|
|
258
11
|
//# 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":"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,CA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AC,eAAe,EAAE,CAAC;IAChD,CAAC;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.\n *\n * On iOS this hands over via deep link; on Android it binds the companion app and runs a\n * readiness handshake. Rejects if the companion app is not installed or not ready to pair.\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 */\nexport const isCompanionAppInstalled = (): Promise<boolean> => {\n return AcceptSdkReactNative.isCompanionAppInstalled();\n};\n\n/**\n * Presents the store product page for the Tapaya companion app (App Store sheet on iOS,\n * Play Store on Android).\n * Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.\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"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,gBAAgB,CAAC","sourcesContent":["/**\n * Accept SDK for React Native / Expo — Android.\n *\n * A thin wrapper over the Accept SDK for Android (`com.tapaya:accept`), which in turn drives the\n * Accept plugin app installed on the terminal. The surfaces here mirror the Android SDK 1:1, so its\n * reference documentation applies unchanged: https://docs.tapaya.com\n */\n\nexport { Accept, Accept as default } from \"./Accept\";\nexport { AcceptError } from \"./AcceptError\";\nexport * from \"./Accept.types\";\n"]}
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWnE"}
|
package/build/utils.js
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export async function assetToBase64(source) {
|
|
11
11
|
// Dynamic imports so the SDK core has no hard dependency on these packages.
|
|
12
|
-
const { Asset } = await import(
|
|
13
|
-
const { File } = await import(
|
|
12
|
+
const { Asset } = await import("expo-asset");
|
|
13
|
+
const { File } = await import("expo-file-system");
|
|
14
14
|
const asset = Asset.fromModule(source);
|
|
15
15
|
await asset.downloadAsync();
|
|
16
16
|
const uri = asset.localUri ?? asset.uri;
|
package/build/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc;IAChD,4EAA4E;IAC5E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAElD,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC;IACxC,IAAI,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc;IAChD,4EAA4E;IAC5E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAElD,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC;IACxC,IAAI,CAAC,GAAG;QACN,MAAM,IAAI,KAAK,CAAC,kDAAkD,MAAM,EAAE,CAAC,CAAC;IAC9E,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * Resolves a React Native asset reference (from `require('./image.png')`) to a base64 string.\n *\n * Requires `expo-asset` and `expo-file-system` to be installed. Both are included in\n * managed Expo projects by default. Bare React Native consumers must install them manually.\n *\n * @param source - Asset reference returned by `require('./image.png')`.\n * @returns Base64-encoded image data.\n */\nexport async function assetToBase64(source: number): Promise<string> {\n // Dynamic imports so the SDK core has no hard dependency on these packages.\n const { Asset } = await import(\"expo-asset\");\n const { File } = await import(\"expo-file-system\");\n\n const asset = Asset.fromModule(source);\n await asset.downloadAsync();\n const uri = asset.localUri ?? asset.uri;\n if (!uri)\n throw new Error(`assetToBase64: could not resolve URI for asset ${source}`);\n return new File(uri).base64();\n}\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"platforms": ["
|
|
3
|
-
"apple": {
|
|
4
|
-
"modules": ["AcceptSdkReactNativeModule"],
|
|
5
|
-
"appDelegateSubscribers": ["AcceptSdkReactNativeAppDelegate"],
|
|
6
|
-
"podspecPath": "ios/AcceptSdkReactNative.podspec"
|
|
7
|
-
},
|
|
2
|
+
"platforms": ["android"],
|
|
8
3
|
"android": {
|
|
9
4
|
"modules": ["com.tapaya.acceptsdkreactnative.AcceptSdkReactNativeModule"]
|
|
10
5
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapayadot/accept-react-native",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Accept SDK for React Native/Expo",
|
|
3
|
+
"version": "1.14.1",
|
|
4
|
+
"description": "Accept SDK for React Native/Expo (Android)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"expo",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"tapaya",
|
|
10
10
|
"terminal",
|
|
11
11
|
"softpos",
|
|
12
|
-
"tap-to-pay"
|
|
12
|
+
"tap-to-pay",
|
|
13
|
+
"android"
|
|
13
14
|
],
|
|
14
15
|
"homepage": "https://github.com/tapayadot/accept-react-native#readme",
|
|
15
16
|
"repository": {
|
|
@@ -46,7 +47,6 @@
|
|
|
46
47
|
},
|
|
47
48
|
"files": [
|
|
48
49
|
"build",
|
|
49
|
-
"ios",
|
|
50
50
|
"android",
|
|
51
51
|
"plugin",
|
|
52
52
|
"app.json",
|
|
@@ -61,10 +61,8 @@
|
|
|
61
61
|
"test": "expo-module test",
|
|
62
62
|
"prepare": "expo-module prepare",
|
|
63
63
|
"prepublishOnly": "expo-module prepublishOnly",
|
|
64
|
-
"
|
|
65
|
-
"open:android": "open -a \"Android Studio\" example/android"
|
|
66
|
-
"android": "expo run:android",
|
|
67
|
-
"ios": "expo run:ios"
|
|
64
|
+
"android": "npm run --workspace accept-react-native-example android",
|
|
65
|
+
"open:android": "open -a \"Android Studio\" example/android"
|
|
68
66
|
},
|
|
69
67
|
"expo": {
|
|
70
68
|
"plugins": [
|
|
@@ -72,11 +70,11 @@
|
|
|
72
70
|
]
|
|
73
71
|
},
|
|
74
72
|
"peerDependencies": {
|
|
75
|
-
"expo": "
|
|
73
|
+
"expo": ">=54.0.0",
|
|
76
74
|
"expo-asset": "*",
|
|
77
75
|
"expo-file-system": "*",
|
|
78
76
|
"react": "*",
|
|
79
|
-
"react-native": "
|
|
77
|
+
"react-native": ">=0.76.0"
|
|
80
78
|
},
|
|
81
79
|
"peerDependenciesMeta": {
|
|
82
80
|
"expo-asset": {
|
|
@@ -88,9 +86,7 @@
|
|
|
88
86
|
},
|
|
89
87
|
"devDependencies": {
|
|
90
88
|
"@expo/npm-proofread": "1.0.1",
|
|
91
|
-
"@react-native-community/cli": "20.1.3",
|
|
92
89
|
"@types/react": "19.2.14",
|
|
93
|
-
"expo-build-properties": "55.0.13",
|
|
94
90
|
"expo-module-scripts": "55.0.2",
|
|
95
91
|
"typescript": "5.9.3"
|
|
96
92
|
},
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const { withGradleProperties } = require("expo/config-plugins");
|
|
2
|
+
|
|
3
|
+
const MIN_SDK_VERSION = 30;
|
|
4
|
+
const MIN_SDK_PROPERTY = "android.minSdkVersion";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Expo config plugin for the Accept SDK.
|
|
8
|
+
*
|
|
9
|
+
* The Accept SDK for Android requires API 30, above the Expo default, so the host app's
|
|
10
|
+
* `minSdkVersion` is raised to match. Everything else the SDK needs — the `INTERNET`,
|
|
11
|
+
* `ACCESS_NETWORK_STATE`, and location permissions, the `<queries>` entries that make the plugin
|
|
12
|
+
* app visible on API 30+, and the activities that run a payment on a customer-facing display —
|
|
13
|
+
* ships in the SDK's own manifest and merges in automatically. The SDK is published to Maven
|
|
14
|
+
* Central, so no repository declaration is needed either.
|
|
15
|
+
*
|
|
16
|
+
* Imports from `expo/config-plugins` rather than `@expo/config-plugins`: the subpath export is the
|
|
17
|
+
* one Expo guarantees to module authors, and it resolves from the consuming app's own `expo`
|
|
18
|
+
* install. `@expo/config-plugins` is not resolvable from this package in SDK 57+.
|
|
19
|
+
*
|
|
20
|
+
* Writing the Gradle property directly, rather than going through `expo-build-properties`, keeps
|
|
21
|
+
* the plugin free of any dependency this package doesn't ship — `expo-build-properties` is not a
|
|
22
|
+
* runtime dependency here, so requiring it would fail in a consumer's project.
|
|
23
|
+
*/
|
|
24
|
+
module.exports = function withAcceptSdk(config) {
|
|
25
|
+
return withGradleProperties(config, (config) => {
|
|
26
|
+
const existing = config.modResults.find(
|
|
27
|
+
(item) => item.type === "property" && item.key === MIN_SDK_PROPERTY,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// Never lower a host app that already targets a higher API than the SDK needs.
|
|
31
|
+
if (existing) {
|
|
32
|
+
const current = Number.parseInt(existing.value, 10);
|
|
33
|
+
if (Number.isFinite(current) && current >= MIN_SDK_VERSION) return config;
|
|
34
|
+
existing.value = String(MIN_SDK_VERSION);
|
|
35
|
+
return config;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
config.modResults.push({
|
|
39
|
+
type: "property",
|
|
40
|
+
key: MIN_SDK_PROPERTY,
|
|
41
|
+
value: String(MIN_SDK_VERSION),
|
|
42
|
+
});
|
|
43
|
+
return config;
|
|
44
|
+
});
|
|
45
|
+
};
|