Comments (1)
Hi @dmitry-blackwave ,
The below fix worked for me after editing index.js
import {NativeEventEmitter, NativeModules} from 'react-native';
const Adyen = NativeModules.Adyen || NativeModules.AdyenReactNative;
const events = new NativeEventEmitter(Adyen);
let onRequestPaymentSessionListener;
let onPaymentResultListener;
let onErrorListener;
let onSelectPaymentMethodListener;
export default {
/**
* The Quick integration of the SDK provides UI components for payment method selection, entering payment method details (credit card entry form, iDEAL issuer selection, etc.).
* @returns {}
/
startPayment() {
return Adyen.startPayment();
},
/*
* Generating StartPaymentParameters
*
* @param {String} encodedToken
*
* @returns {}
*/
confirmPayment(encodedToken) {
this._validateParam(encodedToken, 'confirmPayment', 'string');
return Adyen.confirmPayment(encodedToken);
},
/**
* @param {String} encodedToken
* @returns {*}
*/
createPaymentSession(encodedToken) {
this._validateParam(encodedToken, 'createPaymentSession', 'string');
return Adyen.createPaymentSession(encodedToken);
},
/**
* Starting payment process.
* @returns {*}
*/
initPayment() {
return Adyen.initPayment();
},
/**
* @callback mOnRequestPaymentSession
* @param {String} token
* @param {String} returnUrl
*/
/**
* Native event. Calling when CheckoutController calls delegate in the native call.
* It calling with token and returnUrl (can be empty, no worries)
* @param {mOnRequestPaymentSession} mOnRequestPaymentSession
*/
onRequestPaymentSession(mOnRequestPaymentSession) {
this._validateParam(mOnRequestPaymentSession, 'onRequestPaymentSession', 'function');
onRequestPaymentSessionListener = events.addListener('onRequestPaymentSession', (response) => {
mOnRequestPaymentSession(response['token'], response['returnUrl']);
});
},
/**
* @callback mOnPaymentResult
* @param {Number} code
* @param {String} payload
*/
/**
* After successfully payment, added payload data for confirmation payments
* @param {mOnPaymentResult} mOnPaymentResult
*/
onPaymentResult(mOnPaymentResult) {
this._validateParam(mOnPaymentResult, 'onPaymentResult', 'function');
onPaymentResultListener = events.addListener('onPaymentResult', (response) => {
mOnPaymentResult(response['code'], response['payload']);
});
},
/**
* @callback mOnError
* @param {Number} code
* @param {String} message
*/
/**
* If payment was cancelled or something else. Calling instead of onPaymentResult event.
* @param {mOnError} mOnError
*/
onError(mOnError) {
this._validateParam(mOnError, 'onError', 'function');
onErrorListener = events.addListener('onError', (response) => {
mOnError(response['code'], response['message']);
});
},
/**
* @callback mOnSelectPaymentMethod
* @param {Array<>} preferred
* @param {Array<>} other
* @param {number} count
*/
/**
* //TODO custom integration
* @param {mOnSelectPaymentMethod} mOnSelectPaymentMethod
*/
onSelectPaymentMethod(mOnSelectPaymentMethod) {
this._validateParam(mOnSelectPaymentMethod, 'onSelectPaymentMethod', 'function');
**onSelectPaymentMethodListener =** events.addListener('onSelectPaymentMethodListener;', (response) => {
mOnSelectPaymentMethod(response['preferred'], response['other'], response['count']);
});
},
/**
* @param {*} param
* @param {String} methodName
* @param {String} requiredType
* @private
*/
_validateParam(param, methodName, requiredType) {
if (typeof param !== requiredType) {
throw new Error(`Error: Adyen.${methodName}() requires a ${requiredType === 'function' ? 'callback function' : requiredType} but got a ${typeof param}`);
}
},
events,
**removeListeners(){
if(null != onRequestPaymentSessionListener)
onRequestPaymentSessionListener.remove();
if(null != onPaymentResultListener)
onPaymentResultListener.remove();
if(null != onErrorListener)
onErrorListener.remove();
if(null != onSelectPaymentMethodListener)
onSelectPaymentMethodListener.remove();
}**
};
from adyen-react-native.
Related Issues (18)
- onActivityResultComplete is undefined HOT 1
- Device Finger Print
- Swift Compiler Errors on iOS implementation HOT 2
- Expo
- Anybody know how to do this with React Native 60 HOT 14
- Updated documentation and examples
- .idea and .gradle folders in /android folder
- Google Pay HOT 1
- Working versions? HOT 4
- Initate payment HOT 1
- Adyen 3.x Support Update HOT 1
- App crash on android HOT 1
- Cannot get property 'lifecycleVersion' on extra properties extension as it does not exist
- problem with ios implementation HOT 2
- Custom integration help / ETA
- XCode 10 ios 12 Could not find module Adyen for arm64 architecture HOT 19
- Adyen ios 3.0.0 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adyen-react-native.