|
| 1 | +/** |
| 2 | + * This is a template for new plugin wrappers |
| 3 | + * |
| 4 | + */ |
| 5 | +import { Injectable } from '@angular/core'; |
| 6 | +import { |
| 7 | + Plugin, |
| 8 | + Cordova, |
| 9 | + CordovaProperty, |
| 10 | + CordovaInstance, |
| 11 | + InstanceProperty, |
| 12 | + AwesomeCordovaNativePlugin, |
| 13 | +} from '@awesome-cordova-plugins/core'; |
| 14 | +import { Observable } from 'rxjs'; |
| 15 | + |
| 16 | +/** |
| 17 | + * @name CustomUiSdk |
| 18 | + * @description |
| 19 | + * This plugin is used to access Paytmpayments native CustomUiSdk framework's apis. |
| 20 | + * |
| 21 | + * @usage |
| 22 | + * ```typescript |
| 23 | + * import { CustomUiSdk } from '@awesome-cordova-plugins/custom-ui-sdk/ngx'; |
| 24 | + * |
| 25 | + * |
| 26 | + * constructor(private customUiSdk: CustomUiSdk) { } |
| 27 | + * |
| 28 | + * ... |
| 29 | + * |
| 30 | + * |
| 31 | + * this.customUiSdk.functionName('Hello', 123) |
| 32 | + * .then((res: any) => console.log(res)) |
| 33 | + * .catch((error: any) => console.error(error)); |
| 34 | + * |
| 35 | + * ``` |
| 36 | + */ |
| 37 | +@Plugin({ |
| 38 | + pluginName: 'cordova-paytmpayments-customuisdk', |
| 39 | + plugin: 'cordova-paytmpayments-customuisdk', |
| 40 | + pluginRef: 'paytmpayments.customuisdk', |
| 41 | + repo: '', |
| 42 | + install: '', |
| 43 | + installVariables: [], |
| 44 | + platforms: ['Android, iOS'], |
| 45 | +}) |
| 46 | +@Injectable() |
| 47 | +export class CustomUiSdk extends AwesomeCordovaNativePlugin { |
| 48 | + /** |
| 49 | + * This function show dialog to ask user permision to fetch authcode |
| 50 | + * |
| 51 | + * @param clientId {string} unique id give to each merchant |
| 52 | + * @param mid {string} merchant id |
| 53 | + * @returns {Promise<string>} Returns authcode |
| 54 | + */ |
| 55 | + @Cordova() |
| 56 | + fetchAuthCode(clientId: string, mid: string): Promise<string> { |
| 57 | + return; |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * This function check that paytm app is installed or not |
| 62 | + * |
| 63 | + * @returns {Promise<boolean>} Returns installed - true or not -false |
| 64 | + */ |
| 65 | + @Cordova() |
| 66 | + isPaytmAppInstalled(): Promise<boolean> { |
| 67 | + return; |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * @param mid {string} merchant id |
| 72 | + * @param orderId {string} order id |
| 73 | + * @param txnToken {string} transaction token |
| 74 | + * @param amount {string} transaction amount |
| 75 | + * @param isStaging {boolean} staging or production |
| 76 | + * @param callbackUrl {string} callback url only required for custom url page |
| 77 | + */ |
| 78 | + @Cordova() |
| 79 | + initPaytmSDK( |
| 80 | + mid: string, |
| 81 | + orderId: string, |
| 82 | + txnToken: string, |
| 83 | + amount: string, |
| 84 | + isStaging: boolean, |
| 85 | + callbackUrl: string |
| 86 | + ) { |
| 87 | + return; |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * @param paymentFlow {string} payment type NONE, ADDANDPAY |
| 92 | + * @returns {Promise<any>} Returns object of response |
| 93 | + */ |
| 94 | + @Cordova() |
| 95 | + goForWalletTransaction(paymentFlow: string): Promise<any> { |
| 96 | + return; |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * @returns {Promise<any>} Returns object of response |
| 101 | + */ |
| 102 | + @Cordova() |
| 103 | + appInvoke(): Promise<any> { |
| 104 | + return; |
| 105 | + } |
| 106 | + |
| 107 | + /** |
| 108 | + * @param cardNumber {string} card number |
| 109 | + * @param cardExpiry {string} card expiry |
| 110 | + * @param cardCvv {string} card cvv |
| 111 | + * @param cardType {string} card type debit or credit |
| 112 | + * @param paymentFlow {string} payment type NONE, ADDANDPAY |
| 113 | + * @param channelCode {string} bank channel code |
| 114 | + * @param issuingBankCode {string} issuing bank code |
| 115 | + * @param emiChannelId {string} emi plan id |
| 116 | + * @param authMode {string} authentication mode 'otp' 'pin' |
| 117 | + * @param saveCard {boolean} save card for next time |
| 118 | + * @returns {Promise<any>} Returns object of response |
| 119 | + */ |
| 120 | + @Cordova() |
| 121 | + goForNewCardTransaction( |
| 122 | + cardNumber: string, |
| 123 | + cardExpiry: string, |
| 124 | + cardCvv: string, |
| 125 | + cardType: string, |
| 126 | + paymentFlow: string, |
| 127 | + channelCode: string, |
| 128 | + issuingBankCode: string, |
| 129 | + emiChannelId: string, |
| 130 | + authMode: string, |
| 131 | + saveCard: boolean |
| 132 | + ): Promise<any> { |
| 133 | + return; |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | + * @param cardId {string} card id of saved card |
| 138 | + * @param cardCvv {string} card cvv |
| 139 | + * @param cardType {string} card type debit or credit |
| 140 | + * @param paymentFlow {string} payment type NONE, ADDANDPAY |
| 141 | + * @param channelCode {string} bank channel code |
| 142 | + * @param issuingBankCode {string} issuing bank code |
| 143 | + * @param emiChannelId {string} emi plan id |
| 144 | + * @param authMode {string} authentication mode 'otp' 'pin' |
| 145 | + * @returns {Promise<any>} Returns object of response |
| 146 | + */ |
| 147 | + @Cordova() |
| 148 | + goForSavedCardTransaction( |
| 149 | + cardId: string, |
| 150 | + cardCvv: string, |
| 151 | + cardType: string, |
| 152 | + paymentFlow: string, |
| 153 | + channelCode: string, |
| 154 | + issuingBankCode: string, |
| 155 | + emiChannelId: string, |
| 156 | + authMode: string |
| 157 | + ): Promise<any> { |
| 158 | + return; |
| 159 | + } |
| 160 | + |
| 161 | + /** |
| 162 | + * @param netBankingCode {string} bank channel code |
| 163 | + * @param paymentFlow {string} payment type NONE, ADDANDPAY |
| 164 | + * @returns {Promise<any>} Returns object of response |
| 165 | + */ |
| 166 | + @Cordova() |
| 167 | + goForNetBankingTransaction(netBankingCode: string, paymentFlow: string): Promise<any> { |
| 168 | + return; |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * @param upiCode {string} upi code |
| 173 | + * @param paymentFlow {string} payment type NONE, ADDANDPAY |
| 174 | + * @param saveVPA {boolean} save vpa for future transaction |
| 175 | + * @returns {Promise<any>} Returns object of response |
| 176 | + */ |
| 177 | + @Cordova() |
| 178 | + goForUpiCollectTransaction(upiCode: string, paymentFlow: string, saveVPA: boolean): Promise<any> { |
| 179 | + return; |
| 180 | + } |
| 181 | + |
| 182 | + /** |
| 183 | + * @returns {Promise<any>} Returns upi app list names |
| 184 | + */ |
| 185 | + @Cordova() |
| 186 | + getUpiIntentList(): Promise<any> { |
| 187 | + return; |
| 188 | + } |
| 189 | + |
| 190 | + /** |
| 191 | + * @returns {Promise<any>} Returns upi app list names |
| 192 | + */ |
| 193 | + @Cordova() |
| 194 | + getUpiIntentSubscriptionList(): Promise<any> { |
| 195 | + return; |
| 196 | + } |
| 197 | + |
| 198 | + /** |
| 199 | + * @param appName {string} upi app name |
| 200 | + * @param paymentFlow {string} payment type NONE, ADDANDPAY |
| 201 | + * @returns {Promise<any>} Returns object of response |
| 202 | + */ |
| 203 | + @Cordova() |
| 204 | + goForUpiIntentTransaction(appName: string, paymentFlow: string): Promise<any> { |
| 205 | + return; |
| 206 | + } |
| 207 | + |
| 208 | + /** |
| 209 | + * @param appName {string} upi app name |
| 210 | + * @param paymentFlow {string} payment type NONE, ADDANDPAY |
| 211 | + * @returns {Promise<any>} Returns object of response |
| 212 | + */ |
| 213 | + @Cordova() |
| 214 | + goForUpiIntentSubscriptionTransaction(appName: string, paymentFlow: string): Promise<any> { |
| 215 | + return; |
| 216 | + } |
| 217 | + |
| 218 | + /** |
| 219 | + * @param cardSixDigit {string} card starting six digit |
| 220 | + * @param tokenType {string} token type ACCESS or TXN_TOKEN |
| 221 | + * @param token {string} token fetch from api |
| 222 | + * @param mid {string} merchant id |
| 223 | + * @param referenceId {string} reference id |
| 224 | + * @returns {Promise<any>} Returns object of response |
| 225 | + */ |
| 226 | + @Cordova() |
| 227 | + getBin(cardSixDigit: string, tokenType: string, token: string, mid: string, referenceId: string): Promise<any> { |
| 228 | + return; |
| 229 | + } |
| 230 | + |
| 231 | + /** |
| 232 | + * @param tokenType {string} token type ACCESS or TXN_TOKEN |
| 233 | + * @param token {string} token fetch from api |
| 234 | + * @param mid {string} merchant id |
| 235 | + * @param orderId {string} order id required only if token type is TXN_TOKEN |
| 236 | + * @param referenceId {string} reference id required only if token type is ACCESS |
| 237 | + * @returns {Promise<any>} Returns object of response |
| 238 | + */ |
| 239 | + @Cordova() |
| 240 | + fetchNBList(tokenType: string, token: string, mid: string, orderId: string, referenceId: string): Promise<any> { |
| 241 | + return; |
| 242 | + } |
| 243 | + |
| 244 | + /** |
| 245 | + * @param channelCode {string} bank channel code |
| 246 | + * @param cardType {string} card type debit or credit |
| 247 | + * @returns {Promise<any>} Returns object of response |
| 248 | + */ |
| 249 | + @Cordova() |
| 250 | + fetchEmiDetails(channelCode: string, cardType: string): Promise<any> { |
| 251 | + return; |
| 252 | + } |
| 253 | + |
| 254 | + /** |
| 255 | + * @returns {Promise<any>} Returns last successfully used net backing code |
| 256 | + */ |
| 257 | + |
| 258 | + @Cordova() |
| 259 | + getLastNBSavedBank(): Promise<any> { |
| 260 | + return; |
| 261 | + } |
| 262 | + |
| 263 | + /** |
| 264 | + * @returns {Promise<any>} Returns last successfully used vpa code |
| 265 | + */ |
| 266 | + |
| 267 | + @Cordova() |
| 268 | + getLastSavedVPA(): Promise<any> { |
| 269 | + return; |
| 270 | + } |
| 271 | + |
| 272 | + /** |
| 273 | + * @param clientId {string} unique id give to each merchant |
| 274 | + * @param authCode {string} fetched auth code |
| 275 | + * @returns {Promise<any>} Returns last successfully used vpa code |
| 276 | + */ |
| 277 | + @Cordova() |
| 278 | + isAuthCodeValid(clientId: string, authCode: string): Promise<any> { |
| 279 | + return; |
| 280 | + } |
| 281 | + |
| 282 | + /** |
| 283 | + * @returns {Promise<any>} Returns current environment |
| 284 | + */ |
| 285 | + @Cordova() |
| 286 | + getEnvironment(): Promise<string> { |
| 287 | + return; |
| 288 | + } |
| 289 | + |
| 290 | + /** |
| 291 | + * @param environment {string} setting environment PRODUCTION or STAGING |
| 292 | + */ |
| 293 | + @Cordova() |
| 294 | + setEnvironment(environment: string): void { |
| 295 | + return; |
| 296 | + } |
| 297 | +} |
0 commit comments