diff --git a/lib/UpiPayment.js b/lib/UpiPayment.js index eb8b350..792d9d7 100644 --- a/lib/UpiPayment.js +++ b/lib/UpiPayment.js @@ -2,6 +2,13 @@ import { NativeModules } from 'react-native'; const UpiModule = NativeModules.UpiPayment; +function isNull(data) { + if (data === '' || data === 'null' || data === null || data === undefined) { + return true; + } else { + false; + } +} const RNUpiPayment = { requiredFields: [ @@ -80,7 +87,7 @@ const RNUpiPayment = { return object; }, - initializePayment(config, success, failure) { + initializePayment(config, success, failure, payApp) { if (typeof success !== 'function') { throw new Error('Success callback not a function'); } @@ -112,9 +119,10 @@ const RNUpiPayment = { return accumulator; }, ''); const upiConfig = {} - upiConfig.upiString = `upi://pay?${queryString}`; + const app = isNull(payApp) ? "" : (payApp + "://"); + upiConfig.upiString = app +`upi://pay?${queryString}`; UpiModule.intializePayment(upiConfig, this.successCallback(success), this.failureCallback(failure)); } } -module.exports = RNUpiPayment; \ No newline at end of file +module.exports = RNUpiPayment;