@tapayadot/accept-react-native 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +262 -0
- package/android/build.gradle +49 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/AcceptSdkReactNativeModule.kt +418 -0
- package/app.json +5 -0
- package/app.plugin.js +1 -0
- package/build/AcceptSdkReactNative.types.d.ts +117 -0
- package/build/AcceptSdkReactNative.types.d.ts.map +1 -0
- package/build/AcceptSdkReactNative.types.js +2 -0
- package/build/AcceptSdkReactNative.types.js.map +1 -0
- package/build/AcceptSdkReactNativeModule.d.ts +24 -0
- package/build/AcceptSdkReactNativeModule.d.ts.map +1 -0
- package/build/AcceptSdkReactNativeModule.js +4 -0
- package/build/AcceptSdkReactNativeModule.js.map +1 -0
- package/build/index.d.ts +144 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +180 -0
- package/build/index.js.map +1 -0
- package/expo-module.config.json +11 -0
- package/ios/.xcode.env +11 -0
- package/ios/AcceptSdkReactNative.podspec +33 -0
- package/ios/AcceptSdkReactNativeAppDelegate.swift +13 -0
- package/ios/AcceptSdkReactNativeModule.swift +412 -0
- package/ios/Podfile +63 -0
- package/ios/Podfile.properties.json +4 -0
- package/ios/acceptsdkreactnative.xcodeproj/project.pbxproj +540 -0
- package/ios/acceptsdkreactnative.xcodeproj/xcshareddata/xcschemes/acceptsdkreactnative.xcscheme +88 -0
- package/package.json +85 -0
- package/plugin/withCustomRepoModule.js +78 -0
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { type CardPaymentResult, type SepaPaymentResult, type CertisPaymentResult, type CardPaymentIntent, type CertisPaymentIntent, type SepaPaymentIntent, type KybPrefillData, type SdkStatus, CardPaymentStatus, SepaInstantPaymentStatus, CertisInstantPaymentStatus, Currency } from './AcceptSdkReactNative.types';
|
|
2
|
+
export type { CardPaymentResult, SepaPaymentResult, CertisPaymentResult, CardPaymentIntent, SepaPaymentIntent, CertisPaymentIntent, CardPaymentStatus, SepaInstantPaymentStatus, CertisInstantPaymentStatus, SdkStatus, KybPrefillData, };
|
|
3
|
+
export { Currency };
|
|
4
|
+
/**
|
|
5
|
+
* Initializes the SDK. Must be called before any other method.
|
|
6
|
+
* @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).
|
|
7
|
+
*/
|
|
8
|
+
export declare const initialize: (demo?: boolean) => Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Authenticates a merchant session using a token obtained from your backend.
|
|
11
|
+
* Call after {@link initialize}.
|
|
12
|
+
* @param token - Merchant authentication token.
|
|
13
|
+
* @throws If authentication fails (invalid token, network error, etc.).
|
|
14
|
+
*/
|
|
15
|
+
export declare const authenticate: (token: string) => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the current SDK status.
|
|
18
|
+
* - `IDLE` — not initialized
|
|
19
|
+
* - `INITIALIZED` — initialized, not authenticated
|
|
20
|
+
* - `LOGGED_IN` — authenticated and ready
|
|
21
|
+
*/
|
|
22
|
+
export declare const getStatus: () => Promise<SdkStatus>;
|
|
23
|
+
/**
|
|
24
|
+
* Fetches the current status and details of a payment by its intent ID.
|
|
25
|
+
* @param paymentIntentId - The payment intent identifier.
|
|
26
|
+
* @returns The payment result typed to the appropriate payment method.
|
|
27
|
+
* @throws If the payment intent is not found or the request fails.
|
|
28
|
+
*/
|
|
29
|
+
export declare const getPaymentStatus: (paymentIntentId: string) => Promise<CardPaymentResult | SepaPaymentResult | CertisPaymentResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Logs out the current merchant session.
|
|
32
|
+
* The SDK remains initialized — call {@link authenticate} again to sign in a different merchant.
|
|
33
|
+
*/
|
|
34
|
+
export declare const logOut: () => Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Requests fine and coarse location permissions required for card (tap-to-pay) payments.
|
|
37
|
+
* @returns `true` if all location permissions were granted.
|
|
38
|
+
*/
|
|
39
|
+
export declare const requestLocationPermission: () => Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Pairs the merchant app with the Tapaya companion app via deep link.
|
|
42
|
+
* @platform ios
|
|
43
|
+
*/
|
|
44
|
+
export declare const pairWithCompanionApp: () => Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether the Tapaya companion app is installed on the device.
|
|
47
|
+
* @platform ios
|
|
48
|
+
*/
|
|
49
|
+
export declare const isCompanionAppInstalled: () => Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Presents the App Store product page sheet for the Tapaya companion app.
|
|
52
|
+
* Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.
|
|
53
|
+
* @platform ios
|
|
54
|
+
*/
|
|
55
|
+
export declare const presentCompanionAppSheet: () => Promise<void>;
|
|
56
|
+
/** Identity and onboarding methods. */
|
|
57
|
+
export declare const identity: {
|
|
58
|
+
/**
|
|
59
|
+
* Presents the KYB (Know Your Business) onboarding flow.
|
|
60
|
+
* Fire-and-forget — resolves as soon as the flow is presented.
|
|
61
|
+
* @param prefilling - Optional data to pre-populate the onboarding form.
|
|
62
|
+
*/
|
|
63
|
+
presentKyb: (prefilling?: KybPrefillData) => Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
/** Payment methods for card and bank transfer terminals. */
|
|
66
|
+
export declare const payments: {
|
|
67
|
+
/**
|
|
68
|
+
* Starts a card (tap-to-pay) payment flow.
|
|
69
|
+
* Resolves with the final result when the payment completes or fails.
|
|
70
|
+
* @param paymentIntent - Payment details.
|
|
71
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
72
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
73
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
74
|
+
*/
|
|
75
|
+
startCardPayment: (paymentIntent: CardPaymentIntent, statusCallback: (status: CardPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<CardPaymentResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Starts a SEPA Instant bank transfer payment flow.
|
|
78
|
+
* Resolves with the final result when the payment completes or fails.
|
|
79
|
+
* @param paymentIntent - Payment details.
|
|
80
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
81
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
82
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
83
|
+
*/
|
|
84
|
+
startSepaPayment: (paymentIntent: SepaPaymentIntent, statusCallback: (status: SepaInstantPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<SepaPaymentResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Starts a Certis Instant bank transfer payment flow.
|
|
87
|
+
* Resolves with the final result when the payment completes or fails.
|
|
88
|
+
* @param paymentIntent - Payment details.
|
|
89
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
90
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
91
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
92
|
+
*/
|
|
93
|
+
startCertisPayment: (paymentIntent: CertisPaymentIntent, statusCallback: (status: CertisInstantPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<CertisPaymentResult>;
|
|
94
|
+
};
|
|
95
|
+
declare const AcceptSDK: {
|
|
96
|
+
initialize: (demo?: boolean) => Promise<void>;
|
|
97
|
+
authenticate: (token: string) => Promise<void>;
|
|
98
|
+
getStatus: () => Promise<SdkStatus>;
|
|
99
|
+
getPaymentStatus: (paymentIntentId: string) => Promise<CardPaymentResult | SepaPaymentResult | CertisPaymentResult>;
|
|
100
|
+
logOut: () => Promise<void>;
|
|
101
|
+
requestLocationPermission: () => Promise<boolean>;
|
|
102
|
+
pairWithCompanionApp: () => Promise<void>;
|
|
103
|
+
isCompanionAppInstalled: () => Promise<boolean>;
|
|
104
|
+
presentCompanionAppSheet: () => Promise<void>;
|
|
105
|
+
identity: {
|
|
106
|
+
/**
|
|
107
|
+
* Presents the KYB (Know Your Business) onboarding flow.
|
|
108
|
+
* Fire-and-forget — resolves as soon as the flow is presented.
|
|
109
|
+
* @param prefilling - Optional data to pre-populate the onboarding form.
|
|
110
|
+
*/
|
|
111
|
+
presentKyb: (prefilling?: KybPrefillData) => Promise<void>;
|
|
112
|
+
};
|
|
113
|
+
payments: {
|
|
114
|
+
/**
|
|
115
|
+
* Starts a card (tap-to-pay) payment flow.
|
|
116
|
+
* Resolves with the final result when the payment completes or fails.
|
|
117
|
+
* @param paymentIntent - Payment details.
|
|
118
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
119
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
120
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
121
|
+
*/
|
|
122
|
+
startCardPayment: (paymentIntent: CardPaymentIntent, statusCallback: (status: CardPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<CardPaymentResult>;
|
|
123
|
+
/**
|
|
124
|
+
* Starts a SEPA Instant bank transfer payment flow.
|
|
125
|
+
* Resolves with the final result when the payment completes or fails.
|
|
126
|
+
* @param paymentIntent - Payment details.
|
|
127
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
128
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
129
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
130
|
+
*/
|
|
131
|
+
startSepaPayment: (paymentIntent: SepaPaymentIntent, statusCallback: (status: SepaInstantPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<SepaPaymentResult>;
|
|
132
|
+
/**
|
|
133
|
+
* Starts a Certis Instant bank transfer payment flow.
|
|
134
|
+
* Resolves with the final result when the payment completes or fails.
|
|
135
|
+
* @param paymentIntent - Payment details.
|
|
136
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
137
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
138
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
139
|
+
*/
|
|
140
|
+
startCertisPayment: (paymentIntent: CertisPaymentIntent, statusCallback: (status: CertisInstantPaymentStatus) => void, errorCallback: (message: string, exception: string) => void) => Promise<CertisPaymentResult>;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
export default AcceptSDK;
|
|
144
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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,EAC1B,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,SAAS,EACT,cAAc,GACf,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAM,OAAe,KAAG,OAAO,CAAC,IAAI,CAE9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAAO,CAAC,IAAI,CAExD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QAAO,OAAO,CAAC,SAAS,CAE7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,iBAAiB,MAAM,KAAG,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,CAiB7H,CAAC;AAEF;;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AS,CAAC;wCAUG,MAAM,KAAG,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;kBAuBrG,OAAO,CAAC,IAAI,CAAC;qCAQM,OAAO,CAAC,OAAO,CAAC;gCAQrB,OAAO,CAAC,IAAI,CAAC;mCAQV,OAAO,CAAC,OAAO,CAAC;oCASf,OAAO,CAAC,IAAI,CAAC;;QAMvD;;;;WAIG;kCACuB,cAAc,KAAG,OAAO,CAAC,IAAI,CAAC;;;QAOxD;;;;;;;WAOG;0CAEc,iBAAiB,kBAChB,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,iBACpC,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,KAC1D,OAAO,CAAC,iBAAiB,CAAC;QAsB7B;;;;;;;WAOG;0CAEc,iBAAiB,kBAChB,CAAC,MAAM,EAAE,wBAAwB,KAAK,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;;CAmChC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import AcceptSdkReactNative from './AcceptSdkReactNativeModule';
|
|
2
|
+
/**
|
|
3
|
+
* Initializes the SDK. Must be called before any other method.
|
|
4
|
+
* @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).
|
|
5
|
+
*/
|
|
6
|
+
export const initialize = (demo = false) => {
|
|
7
|
+
return AcceptSdkReactNative.initialize(demo).then(() => Promise.resolve(undefined));
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Authenticates a merchant session using a token obtained from your backend.
|
|
11
|
+
* Call after {@link initialize}.
|
|
12
|
+
* @param token - Merchant authentication token.
|
|
13
|
+
* @throws If authentication fails (invalid token, network error, etc.).
|
|
14
|
+
*/
|
|
15
|
+
export const authenticate = (token) => {
|
|
16
|
+
return AcceptSdkReactNative.authenticate(token).then(() => Promise.resolve(undefined));
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns the current SDK status.
|
|
20
|
+
* - `IDLE` — not initialized
|
|
21
|
+
* - `INITIALIZED` — initialized, not authenticated
|
|
22
|
+
* - `LOGGED_IN` — authenticated and ready
|
|
23
|
+
*/
|
|
24
|
+
export const getStatus = () => {
|
|
25
|
+
return AcceptSdkReactNative.getStatus();
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Fetches the current status and details of a payment by its intent ID.
|
|
29
|
+
* @param paymentIntentId - The payment intent identifier.
|
|
30
|
+
* @returns The payment result typed to the appropriate payment method.
|
|
31
|
+
* @throws If the payment intent is not found or the request fails.
|
|
32
|
+
*/
|
|
33
|
+
export const getPaymentStatus = (paymentIntentId) => {
|
|
34
|
+
let obj = AcceptSdkReactNative.getPaymentStatus(paymentIntentId);
|
|
35
|
+
return obj.then((o) => {
|
|
36
|
+
let r = JSON.parse(o);
|
|
37
|
+
switch (r.type) {
|
|
38
|
+
case "card":
|
|
39
|
+
return r;
|
|
40
|
+
case "certis":
|
|
41
|
+
return r;
|
|
42
|
+
case "sepa":
|
|
43
|
+
return r;
|
|
44
|
+
default:
|
|
45
|
+
throw new Error("Unknown payment result");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Logs out the current merchant session.
|
|
51
|
+
* The SDK remains initialized — call {@link authenticate} again to sign in a different merchant.
|
|
52
|
+
*/
|
|
53
|
+
export const logOut = () => {
|
|
54
|
+
return AcceptSdkReactNative.logOut().then(() => Promise.resolve(undefined));
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Requests fine and coarse location permissions required for card (tap-to-pay) payments.
|
|
58
|
+
* @returns `true` if all location permissions were granted.
|
|
59
|
+
*/
|
|
60
|
+
export const requestLocationPermission = () => {
|
|
61
|
+
return AcceptSdkReactNative.requestLocationPermission();
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Pairs the merchant app with the Tapaya companion app via deep link.
|
|
65
|
+
* @platform ios
|
|
66
|
+
*/
|
|
67
|
+
export const pairWithCompanionApp = () => {
|
|
68
|
+
return AcceptSdkReactNative.pairWithCompanionApp();
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Returns whether the Tapaya companion app is installed on the device.
|
|
72
|
+
* @platform ios
|
|
73
|
+
*/
|
|
74
|
+
export const isCompanionAppInstalled = () => {
|
|
75
|
+
return AcceptSdkReactNative.isCompanionAppInstalled();
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Presents the App Store product page sheet for the Tapaya companion app.
|
|
79
|
+
* Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.
|
|
80
|
+
* @platform ios
|
|
81
|
+
*/
|
|
82
|
+
export const presentCompanionAppSheet = () => {
|
|
83
|
+
return AcceptSdkReactNative.presentCompanionAppSheet();
|
|
84
|
+
};
|
|
85
|
+
/** Identity and onboarding methods. */
|
|
86
|
+
export const identity = {
|
|
87
|
+
/**
|
|
88
|
+
* Presents the KYB (Know Your Business) onboarding flow.
|
|
89
|
+
* Fire-and-forget — resolves as soon as the flow is presented.
|
|
90
|
+
* @param prefilling - Optional data to pre-populate the onboarding form.
|
|
91
|
+
*/
|
|
92
|
+
presentKyb: (prefilling) => {
|
|
93
|
+
return AcceptSdkReactNative.presentKyb(prefilling);
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
/** Payment methods for card and bank transfer terminals. */
|
|
97
|
+
export const payments = {
|
|
98
|
+
/**
|
|
99
|
+
* Starts a card (tap-to-pay) payment flow.
|
|
100
|
+
* Resolves with the final result when the payment completes or fails.
|
|
101
|
+
* @param paymentIntent - Payment details.
|
|
102
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
103
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
104
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
105
|
+
*/
|
|
106
|
+
startCardPayment: async (paymentIntent, statusCallback, errorCallback) => {
|
|
107
|
+
let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();
|
|
108
|
+
if (isPaymentPending) {
|
|
109
|
+
throw Error("Payment is already pending, cancel payment first.");
|
|
110
|
+
}
|
|
111
|
+
let eventStatus = AcceptSdkReactNative.addListener('onCardPaymentStatusChange', (status) => {
|
|
112
|
+
statusCallback(status.data);
|
|
113
|
+
});
|
|
114
|
+
AcceptSdkReactNative.addListener('onCardPaymentException', (map) => {
|
|
115
|
+
errorCallback(map.message, map.exception);
|
|
116
|
+
});
|
|
117
|
+
let result = AcceptSdkReactNative.startCardPayment(paymentIntent);
|
|
118
|
+
result.then(() => {
|
|
119
|
+
eventStatus.remove();
|
|
120
|
+
});
|
|
121
|
+
return result;
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* Starts a SEPA Instant bank transfer payment flow.
|
|
125
|
+
* Resolves with the final result when the payment completes or fails.
|
|
126
|
+
* @param paymentIntent - Payment details.
|
|
127
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
128
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
129
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
130
|
+
*/
|
|
131
|
+
startSepaPayment: async (paymentIntent, statusCallback, errorCallback) => {
|
|
132
|
+
let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();
|
|
133
|
+
if (isPaymentPending) {
|
|
134
|
+
throw Error("Payment is already pending, cancel payment first.");
|
|
135
|
+
}
|
|
136
|
+
let eventStatus = AcceptSdkReactNative.addListener('onSepaPaymentStatusChange', (status) => statusCallback(status.data));
|
|
137
|
+
AcceptSdkReactNative.addListener('onSepaPaymentException', (map) => errorCallback(map.message, map.exception));
|
|
138
|
+
let result = AcceptSdkReactNative.startSepaPayment(paymentIntent);
|
|
139
|
+
result.then(() => {
|
|
140
|
+
eventStatus.remove();
|
|
141
|
+
});
|
|
142
|
+
return result;
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Starts a Certis Instant bank transfer payment flow.
|
|
146
|
+
* Resolves with the final result when the payment completes or fails.
|
|
147
|
+
* @param paymentIntent - Payment details.
|
|
148
|
+
* @param statusCallback - Called with intermediate status updates during the payment flow.
|
|
149
|
+
* @param errorCallback - Called with error details if the terminal encounters an exception.
|
|
150
|
+
* @throws If a payment is already in progress, or if the payment flow fails critically.
|
|
151
|
+
*/
|
|
152
|
+
startCertisPayment: async (paymentIntent, statusCallback, errorCallback) => {
|
|
153
|
+
let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();
|
|
154
|
+
if (isPaymentPending) {
|
|
155
|
+
throw Error("Payment is already pending, cancel payment first.");
|
|
156
|
+
}
|
|
157
|
+
let eventStatus = AcceptSdkReactNative.addListener('onCertisPaymentStatusChange', (status) => statusCallback(status.data));
|
|
158
|
+
AcceptSdkReactNative.addListener('onCertisPaymentException', (map) => errorCallback(map.message, map.exception));
|
|
159
|
+
let result = AcceptSdkReactNative.startCertisPayment(paymentIntent);
|
|
160
|
+
result.then(() => {
|
|
161
|
+
eventStatus.remove();
|
|
162
|
+
});
|
|
163
|
+
return result;
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
const AcceptSDK = {
|
|
167
|
+
initialize,
|
|
168
|
+
authenticate,
|
|
169
|
+
getStatus,
|
|
170
|
+
getPaymentStatus,
|
|
171
|
+
logOut,
|
|
172
|
+
requestLocationPermission,
|
|
173
|
+
pairWithCompanionApp,
|
|
174
|
+
isCompanionAppInstalled,
|
|
175
|
+
presentCompanionAppSheet,
|
|
176
|
+
identity,
|
|
177
|
+
payments,
|
|
178
|
+
};
|
|
179
|
+
export default AcceptSDK;
|
|
180
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAkBhE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAgB,KAAK,EAAiB,EAAE;IACjE,OAAO,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACtF,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAiB,EAAE;IAC3D,OAAO,oBAAoB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACzF,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAuB,EAAE;IAChD,OAAO,oBAAoB,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,eAAuB,EAAwE,EAAE;IAChI,IAAI,GAAG,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAEjE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEtB,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;YACf,KAAK,MAAM;gBACT,OAAO,CAAsB,CAAC;YAChC,KAAK,QAAQ;gBACX,OAAO,CAAwB,CAAC;YAClC,KAA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ult,\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 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 */\nexport const initialize = (demo: boolean = false): Promise<void> => {\n return AcceptSdkReactNative.initialize(demo).then(() => Promise.resolve(undefined));\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 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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"platforms": ["apple", "android"],
|
|
3
|
+
"apple": {
|
|
4
|
+
"modules": ["AcceptSdkReactNativeModule"],
|
|
5
|
+
"appDelegateSubscribers": ["AcceptSdkReactNativeAppDelegate"],
|
|
6
|
+
"podspecPath": "ios/AcceptSdkReactNative.podspec"
|
|
7
|
+
},
|
|
8
|
+
"android": {
|
|
9
|
+
"modules": ["com.tapaya.acceptsdkreactnative.AcceptSdkReactNativeModule"]
|
|
10
|
+
}
|
|
11
|
+
}
|
package/ios/.xcode.env
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This `.xcode.env` file is versioned and is used to source the environment
|
|
2
|
+
# used when running script phases inside Xcode.
|
|
3
|
+
# To customize your local environment, you can create an `.xcode.env.local`
|
|
4
|
+
# file that is not versioned.
|
|
5
|
+
|
|
6
|
+
# NODE_BINARY variable contains the PATH to the node executable.
|
|
7
|
+
#
|
|
8
|
+
# Customize the NODE_BINARY variable here.
|
|
9
|
+
# For example, to use nvm with brew, add the following line
|
|
10
|
+
# . "$(brew --prefix nvm)/nvm.sh" --no-use
|
|
11
|
+
export NODE_BINARY=$(command -v node)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'AcceptSdkReactNative'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = package['description']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = {
|
|
14
|
+
:ios => '26.0'
|
|
15
|
+
}
|
|
16
|
+
s.swift_version = '6.0'
|
|
17
|
+
s.source = { git: 'https://github.com/tapayadot/accept-react-native' }
|
|
18
|
+
s.static_framework = true
|
|
19
|
+
|
|
20
|
+
s.dependency 'ExpoModulesCore'
|
|
21
|
+
|
|
22
|
+
# Swift/Objective-C compatibility
|
|
23
|
+
# AcceptSDK is a static SPM lib — its .swiftmodule lands directly in
|
|
24
|
+
# PODS_CONFIGURATION_BUILD_DIR. Dynamic SPM frameworks (Sentry, Lottie) also
|
|
25
|
+
# land there (not in a PackageFrameworks/ subdirectory).
|
|
26
|
+
s.pod_target_xcconfig = {
|
|
27
|
+
'DEFINES_MODULE' => 'YES',
|
|
28
|
+
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PODS_CONFIGURATION_BUILD_DIR)"',
|
|
29
|
+
'SWIFT_INCLUDE_PATHS' => '$(inherited) "$(PODS_CONFIGURATION_BUILD_DIR)"',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
s.source_files = "*.{h,m,mm,swift,hpp,cpp}"
|
|
33
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import AcceptSDK
|
|
2
|
+
import ExpoModulesCore
|
|
3
|
+
import UIKit
|
|
4
|
+
|
|
5
|
+
public class AcceptSdkReactNativeAppDelegate: ExpoAppDelegateSubscriber {
|
|
6
|
+
public func application(
|
|
7
|
+
_ app: UIApplication,
|
|
8
|
+
open url: URL,
|
|
9
|
+
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
|
|
10
|
+
) -> Bool {
|
|
11
|
+
Accept.handle(url: url)
|
|
12
|
+
}
|
|
13
|
+
}
|