From f3cec676e3d2349078f2277d1be4aab96c1e5353 Mon Sep 17 00:00:00 2001 From: Raj Goenka Date: Fri, 25 Sep 2020 15:53:36 +0545 Subject: [PATCH 1/4] added custom-uisdk index file --- .../plugins/custom-uisdk/index.ts | 310 ++++++++++++++++++ 1 file changed, 310 insertions(+) create mode 100755 src/@ionic-native/plugins/custom-uisdk/index.ts diff --git a/src/@ionic-native/plugins/custom-uisdk/index.ts b/src/@ionic-native/plugins/custom-uisdk/index.ts new file mode 100755 index 0000000000..f554e66ff7 --- /dev/null +++ b/src/@ionic-native/plugins/custom-uisdk/index.ts @@ -0,0 +1,310 @@ +import { Injectable } from '@angular/core'; +import { + Plugin, + Cordova, + CordovaProperty, + CordovaInstance, + InstanceProperty, + IonicNativePlugin, +} from '@ionic-native/core'; + +/** + * @name CustomUISDK + * @description + * This plugin is used to access Paytm's native CustomUISDK framework's apis. + * + * @usage + * ```typescript + * import { CustomUISDK } from '@ionic-native/custom-uisdk'; + * + * + * constructor(private customuisdk: CustomUISDK) { } + * + * ... + * + * + * this.customuisdk.functionName('Hello', 123) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'cordova-paytm-customuisdk', + plugin: 'cordova-paytm-customuisdk', // npm package name, example: cordova-plugin-camera + pluginRef: 'paytm.customuisdk', // the variable reference to call the plugin, example: navigator.geolocation + repo: '', // the github repository URL for the plugin + install: '', // OPTIONAL install command, in case the plugin requires variables + installVariables: [], // OPTIONAL the plugin requires variables + platforms: ['Android, iOS'], // Array of platforms supported, example: ['Android', 'iOS'] +}) +@Injectable() +export class CustomUISDK extends IonicNativePlugin { + /** + * This function show dialog to ask user permision to fetch authcode + * @param clientId {string} unique id give to each merchant + * @param mid {string} merchant id + * @return {Promise} Returns authcode + */ + @Cordova() + fetchAuthCode(clientId: string, mid: string): Promise { + return; + } + + /** + * This function check that paytm app is installed or not + * @return {Promise} Returns installed - true or not -false + */ + @Cordova() + isPaytmAppInstalled(): Promise { + return; + } + + /** + * @param mid {string} merchant id + * @return {Promise} Returns if has payment methods - true or not -false + */ + @Cordova() + checkHasInstrument(mid: string): Promise { + return; + } + + /** + * @param mid {string} merchant id + * @param orderId {string} order id + * @param txnToken {string} transaction token + * @param amount {string} transaction amount + * @param isStaging {boolean} staging or production + * @param callbackUrl {string} callback url only required for custom url page + */ + @Cordova() + initPaytmSDK( + mid: string, + orderId: string, + txnToken: string, + amount: string, + isStaging: boolean, + callbackUrl: string + ) { + return; + } + + /** + * @param paymentFlow {string} payment type NONE, ADDANDPAY + * @return {Promise} Returns object of response + */ + @Cordova() + goForWalletTransaction(paymentFlow: string): Promise { + return; + } + + /** + * @param cardNumber {string} card number + * @param cardExpiry {string} card expiry + * @param cardCvv {string} card cvv + * @param cardType {string} card type debit or credit + * @param paymentFlow {string} payment type NONE, ADDANDPAY + * @param channelCode {string} bank channel code + * @param issuingBankCode {string} issuing bank code + * @param emiChannelId {string} emi plan id + * @param authMode {string} authentication mode 'otp' 'pin' + * @param saveCard {boolean} save card for next time + * @return {Promise} Returns object of response + */ + @Cordova() + goForNewCardTransaction( + cardNumber: string, + cardExpiry: string, + cardCvv: string, + cardType: string, + paymentFlow: string, + channelCode: string, + issuingBankCode: string, + emiChannelId: string, + authMode: string, + saveCard: boolean + ): Promise { + return; + } + + /** + * @param cardId {string} card id of saved card + * @param cardCvv {string} card cvv + * @param cardType {string} card type debit or credit + * @param paymentFlow {string} payment type NONE, ADDANDPAY + * @param channelCode {string} bank channel code + * @param issuingBankCode {string} issuing bank code + * @param emiChannelId {string} emi plan id + * @param authMode {string} authentication mode 'otp' 'pin' + * @return {Promise} Returns object of response + */ + @Cordova() + goForSavedCardTransaction( + cardId: string, + cardCvv: string, + cardType: string, + paymentFlow: string, + channelCode: string, + issuingBankCode: string, + emiChannelId: string, + authMode: string + ): Promise { + return; + } + + /** + * @param netBankingCode {string} bank channel code + * @param paymentFlow {string} payment type NONE, ADDANDPAY + * @return {Promise} Returns object of response + */ + @Cordova() + goForNetBankingTransaction(netBankingCode: string, paymentFlow: string): Promise { + return; + } + + /** + * @param upiCode {string} upi code + * @param paymentFlow {string} payment type NONE, ADDANDPAY + * @param saveVPA {boolean} save vpa for future transaction + * @return {Promise} Returns object of response + */ + @Cordova() + goForUpiCollectTransaction(upiCode: string, paymentFlow: string, saveVPA: boolean): Promise { + return; + } + + /** + * @return {Promise} Returns upi app list names + */ + @Cordova() + getUpiIntentList(): Promise { + return; + } + + /** + * @param appName {string} upi app name + * @param paymentFlow {string} payment type NONE, ADDANDPAY + * @return {Promise} Returns object of response + */ + @Cordova() + goForUpiIntentTransaction(appName: string, paymentFlow: string): Promise { + return; + } + + /** + * @param vpaName {string} vpa name + * @param paymentFlow {string} payment type NONE, ADDANDPAY + * @param bankAccountJson {{}} bank account json object + * @param merchantDetailsJson {{}} merchant detail json + * @return {Promise} Returns object of response + */ + @Cordova() + goForUpiPushTransaction( + paymentFlow: string, + bankAccountJson: {}, + vpaName: string, + merchantDetailsJson: {} + ): Promise { + return; + } + + /** + * @param vpaName {string} vpa name + * @param bankAccountJson {{}} bank account json object + * @return {Promise} Returns object of response + */ + @Cordova() + fetchUpiBalance(bankAccountJson: {}, vpaName: string): Promise { + return; + } + + /** + * @param vpaName {string} vpa name + * @param bankAccountJson {{}} bank account json object + * @return {Promise} Returns object of response + */ + @Cordova() + setUpiMpin(bankAccountJson: {}, vpaName: string): Promise { + return; + } + + /** + * @param cardSixDigit {string} card starting six digit + * @param tokenType {string} token type ACCESS or TXN_TOKEN + * @param token {string} token fetch from api + * @param mid {string} merchant id + * @param referenceId {string} reference id + * @return {Promise} Returns object of response + */ + @Cordova() + getBin(cardSixDigit: string, tokenType: string, token: string, mid: string, referenceId: string): Promise { + return; + } + + /** + * @param tokenType {string} token type ACCESS or TXN_TOKEN + * @param token {string} token fetch from api + * @param mid {string} merchant id + * @param orderId {string} order id required only if token type is TXN_TOKEN + * @param referenceId {string} reference id required only if token type is ACCESS + * @return {Promise} Returns object of response + */ + @Cordova() + fetchNBList(tokenType: string, token: string, mid: string, orderId: string, referenceId: string): Promise { + return; + } + + /** + * @param channelCode {string} bank channel code + * @param cardType {string} card type debit or credit + * @return {Promise} Returns object of response + */ + @Cordova() + fetchEmiDetails(channelCode: string, cardType: string): Promise { + return; + } + + /** + * @return {Promise} Returns last successfully used net backing code + */ + + @Cordova() + getLastNBSavedBank(): Promise { + return; + } + + /** + * @return {Promise} Returns last successfully used vpa code + */ + + @Cordova() + getLastSavedVPA(): Promise { + return; + } + + /** + * @param clientId {string} unique id give to each merchant + * @param authCode {string} fetched auth code + * @return {Promise} Returns last successfully used vpa code + */ + @Cordova() + isAuthCodeValid(clientId: string, authCode: string): Promise { + return; + } + + /** + * @return {Promise} Returns current environment + */ + @Cordova() + getEnvironment(): Promise { + return; + } + + /** + * @param environment {string} setting environment PRODUCTION or STAGING + */ + @Cordova() + setEnvironment(environment: string): void { + return; + } +} From 9af0bb7b50e8d068756987b107c4ca0257623e2f Mon Sep 17 00:00:00 2001 From: Raj Goenka Date: Fri, 25 Sep 2020 16:27:09 +0545 Subject: [PATCH 2/4] feat(CustomUiSDK): add plugin for Paytm Custom UI SDK --- src/@ionic-native/plugins/custom-uisdk/index.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/@ionic-native/plugins/custom-uisdk/index.ts b/src/@ionic-native/plugins/custom-uisdk/index.ts index f554e66ff7..09d61764cc 100755 --- a/src/@ionic-native/plugins/custom-uisdk/index.ts +++ b/src/@ionic-native/plugins/custom-uisdk/index.ts @@ -21,12 +21,9 @@ import { * constructor(private customuisdk: CustomUISDK) { } * * ... - * - * * this.customuisdk.functionName('Hello', 123) * .then((res: any) => console.log(res)) * .catch((error: any) => console.error(error)); - * * ``` */ @Plugin({ From 48f76b81e667267450acf79b213f6745d7c922f0 Mon Sep 17 00:00:00 2001 From: Raj Goenka Date: Sat, 17 Oct 2020 10:10:54 +0545 Subject: [PATCH 3/4] removed template generated comments and added ngx at the end to the import --- src/@ionic-native/plugins/custom-uisdk/index.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/plugins/custom-uisdk/index.ts b/src/@ionic-native/plugins/custom-uisdk/index.ts index 09d61764cc..90fe6b4414 100755 --- a/src/@ionic-native/plugins/custom-uisdk/index.ts +++ b/src/@ionic-native/plugins/custom-uisdk/index.ts @@ -15,8 +15,7 @@ import { * * @usage * ```typescript - * import { CustomUISDK } from '@ionic-native/custom-uisdk'; - * + * import { CustomUISDK } from '@ionic-native/custom-uisdk/ngx'; * * constructor(private customuisdk: CustomUISDK) { } * @@ -28,12 +27,12 @@ import { */ @Plugin({ pluginName: 'cordova-paytm-customuisdk', - plugin: 'cordova-paytm-customuisdk', // npm package name, example: cordova-plugin-camera - pluginRef: 'paytm.customuisdk', // the variable reference to call the plugin, example: navigator.geolocation - repo: '', // the github repository URL for the plugin - install: '', // OPTIONAL install command, in case the plugin requires variables - installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['Android, iOS'], // Array of platforms supported, example: ['Android', 'iOS'] + plugin: 'cordova-paytm-customuisdk', + pluginRef: 'paytm.customuisdk', + repo: 'https://github.com/paytm/paytm-customuisdk-cordova', + install: '', + installVariables: [], + platforms: ['Android, iOS'], }) @Injectable() export class CustomUISDK extends IonicNativePlugin { From 408740471b6c38d9300acd13505ab4d2e24d6879 Mon Sep 17 00:00:00 2001 From: Raj Goenka Date: Wed, 7 Jul 2021 13:58:35 +0545 Subject: [PATCH 4/4] feat(CustomUiSDK): added app invoke method --- src/@ionic-native/plugins/custom-uisdk/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/@ionic-native/plugins/custom-uisdk/index.ts b/src/@ionic-native/plugins/custom-uisdk/index.ts index 90fe6b4414..f4bdda431b 100755 --- a/src/@ionic-native/plugins/custom-uisdk/index.ts +++ b/src/@ionic-native/plugins/custom-uisdk/index.ts @@ -94,6 +94,14 @@ export class CustomUISDK extends IonicNativePlugin { return; } + /** + * @return {Promise} Returns object of response + */ + @Cordova() + appInvoke(): Promise { + return; + } + /** * @param cardNumber {string} card number * @param cardExpiry {string} card expiry