|
| 1 | +# BankConnect: Ionic Capacitor |
| 2 | + |
| 3 | +Bank Connect Ionic Capacitor SDK helps user submits their bank statements via upload or net banking credentials in your Android application. |
| 4 | + |
| 5 | +## Requirements |
| 6 | + |
| 7 | +Bank Connect SDK works on Android 5.0+ (API level 21+), Java 8+ and AndroidX. In addition to the changes, enable desugaring to support older versions. |
| 8 | + |
| 9 | +<CodeSwitcher :languages="{kotlin:'Kotlin',groovy:'Groovy'}"> |
| 10 | +<template v-slot:kotlin> |
| 11 | + |
| 12 | +```kotlin |
| 13 | +android { |
| 14 | + ... |
| 15 | + defaultConfig { |
| 16 | + ... |
| 17 | + // Minimum 5.0+ devices |
| 18 | + minSdkVersion(21) |
| 19 | + ... |
| 20 | + } |
| 21 | + ... |
| 22 | + compileOptions { |
| 23 | + // Flag to enable support for the new language APIs |
| 24 | + coreLibraryDesugaringEnabled = true |
| 25 | + // Sets Java compatibility to Java 8 |
| 26 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 27 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 28 | + } |
| 29 | + // For Kotlin projects |
| 30 | + kotlinOptions { |
| 31 | + jvmTarget = "1.8" |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +dependencies { |
| 36 | + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5") |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +</template> |
| 41 | +<template v-slot:groovy> |
| 42 | + |
| 43 | +```groovy |
| 44 | +android { |
| 45 | + ... |
| 46 | + defaultConfig { |
| 47 | + ... |
| 48 | + // Minimum 5.0+ devices |
| 49 | + minSdkVersion 21 |
| 50 | + ... |
| 51 | + } |
| 52 | + ... |
| 53 | + compileOptions { |
| 54 | + // Flag to enable support for the new language APIs |
| 55 | + coreLibraryDesugaringEnabled true |
| 56 | + // Sets Java compatibility to Java 8 |
| 57 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 58 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 59 | + } |
| 60 | + // For Kotlin projects |
| 61 | + kotlinOptions { |
| 62 | + jvmTarget = "1.8" |
| 63 | + } |
| 64 | +} |
| 65 | +
|
| 66 | +dependencies { |
| 67 | + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +</template> |
| 72 | +</CodeSwitcher> |
| 73 | + |
| 74 | +## Add Plugin |
| 75 | + |
| 76 | +Specify the following in `local.properties` file: |
| 77 | + |
| 78 | +```properties |
| 79 | +ACCESS_KEY=<ACCESS_KEY> |
| 80 | +SECRET_KEY=<SECRET_KEY> |
| 81 | +BC_SDK_VERSION=<BC_SDK_VERSION> |
| 82 | +``` |
| 83 | + |
| 84 | +In the project level `build.gradle` file or `settings.gradle`, add the repository URLs to all `allprojects` block or `repositories` block inside `dependencyResolutionManagement`. |
| 85 | + |
| 86 | +<CodeSwitcher :languages="{kotlin:'Kotlin',groovy:'Groovy'}"> |
| 87 | +<template v-slot:kotlin> |
| 88 | + |
| 89 | +```kotlin |
| 90 | +maven { |
| 91 | + setUrl("s3://risk-manager-android-sdk/artifacts") |
| 92 | + credentials(AwsCredentials::class) { |
| 93 | + accessKey = <ACCESS_KEY> |
| 94 | + secretKey = <SECRET_KEY> |
| 95 | + } |
| 96 | + content { |
| 97 | + includeGroup("in.finbox.bankconnect") |
| 98 | + } |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +</template> |
| 103 | +<template v-slot:groovy> |
| 104 | + |
| 105 | +```groovy |
| 106 | +maven { |
| 107 | + url "s3://risk-manager-android-sdk/artifacts" |
| 108 | + credentials(AwsCredentials) { |
| 109 | + accessKey = <ACCESS_KEY> |
| 110 | + secretKey = <SECRET_KEY> |
| 111 | + } |
| 112 | + content { |
| 113 | + includeGroup("in.finbox.bankconnect") |
| 114 | + } |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +</template> |
| 119 | +</CodeSwitcher> |
| 120 | + |
| 121 | +Add plugin dependency |
| 122 | + |
| 123 | +<CodeSwitcher :languages="{npm:'NPM',yarn:'Yarn'}"> |
| 124 | +<template v-slot:yarn> |
| 125 | + |
| 126 | +```sh |
| 127 | +yarn add ionic-bank-connect-sdk |
| 128 | +``` |
| 129 | + |
| 130 | +</template> |
| 131 | +<template v-slot:npm> |
| 132 | + |
| 133 | +```sh |
| 134 | +yarn add ionic-bank-connect-sdk |
| 135 | +``` |
| 136 | + |
| 137 | +</template> |
| 138 | +</CodeSwitcher> |
| 139 | + |
| 140 | +::: warning NOTE |
| 141 | +Following will be shared by FinBox team at the time of integration: |
| 142 | + |
| 143 | +- `ACCESS_KEY` |
| 144 | +- `SECRET_KEY` |
| 145 | +- `BC_SDK_VERSION` |
| 146 | +- `CLIENT_API_KEY` |
| 147 | +::: |
| 148 | + |
| 149 | +## Integration Workflow |
| 150 | + |
| 151 | +The diagram below illustrates the integration workflow in a nutshell: |
| 152 | +<img src="/client_sdk.jpg" alt="Client SDK Workflow" /> |
| 153 | + |
| 154 | +## Sample Project |
| 155 | + |
| 156 | +We have hosted a sample project on GitHub, you can check it out here: |
| 157 | +<div class="button_holder"> |
| 158 | +<a class="download_button" target="_blank" href="https://github.com/finbox-in/bank-connect-sample-ionic-capacitor">Open GitHub Repository</a> |
| 159 | +</div> |
| 160 | + |
| 161 | +## Build Bank Connect |
| 162 | + |
| 163 | +Build the `IonicBankConnectSdk` object by passing `apiKey`, `linkId`, `fromDate`, `toDate`, `bank`, `mode` and others. |
| 164 | + |
| 165 | +```javascript |
| 166 | +// Build BankConnect |
| 167 | +IonicBankConnectSdk.buildBankConnect(options: { |
| 168 | + apiKey: "CLIENT_API_KEY", |
| 169 | + linkId: "LINK_ID", |
| 170 | + fromDate: "FROM_DATE", // Optional: Default 6 months old date |
| 171 | + toDate: "TO_DATE", // Optional: Default value 1 day less than current date |
| 172 | + bank: "BANK_NAME", // Optional: Short code of the bank |
| 173 | + mode: "MODE", // Optional: PDF Mode |
| 174 | + mobileNumber: "MOBILE_NUMBER", // Optional: Mobile number |
| 175 | + journeyMode: "JOURNEY_MODE", // Optional: Multi PDF journey |
| 176 | + aaJourneyMode: "AA_JOURNEY_MODE", // Optional: Recurring AA pulls |
| 177 | + aaRecurringTenureMonthCount: "AA_RECURRING_TENURE_MONTH_COUNT", // Optional: Consent duration is valid for 3 months |
| 178 | + aaRecurringFrequencyUnit: "AA_RECURRING_FREQUENCY_UNIT", // Optional: Frequency value is in Days |
| 179 | + aaRecurringFrequencyValue: "AA_RECURRING_FREQUENCY_VALUE", // Optional: Number of times to pull the data |
| 180 | +}); |
| 181 | +``` |
| 182 | + |
| 183 | +| Builder Property | Description | Required | |
| 184 | +| - | - | - | |
| 185 | +| `apiKey` | specifies the `api_key` | Yes | |
| 186 | +| `linkId` | specifies the `link_id` | Yes | |
| 187 | +| `fromDate` | specifies the starting period of the statement in `DD/MM/YYYY`format | No | |
| 188 | +| `toDate` | specifies the end period of the statement in `DD/MM/YYYY` format | No | |
| 189 | +| `bank` | pass the [bank identifier](/bank-connect/appendix.html#bank-identifiers) to skip the bank selection screen and directly open a that bank's screen instead | No | |
| 190 | +| `mode` | set the mode as pdf (manual upload) or aa (Account Aggregator) or online (Net Banking) | No | |
| 191 | +| `mobile_number` | Prefills phone number in Account Aggregator mode | No | |
| 192 | +| `journey_mode` | Optional parameter to set the journey (i.e.multi_pdf or multi_banking) | No | |
| 193 | +| `aa_journey_mode` | set the journey mode for AA (i.e only_once or only_recurring) | No | |
| 194 | +| `aa_recurring_tenure_month_count` | set the recurring consent duration (min: 1 and max: 24) | No | |
| 195 | +| `aa_recurring_frequency_unit` | set the frequency unit to pull the data during the recurring consent duration (year, month, day, hour) | No | |
| 196 | +| `aa_recurring_frequency_value` | set the frequency value to pull the data during the recurring consent duration (min: 1 and max: 3) | No | |
| 197 | + |
| 198 | +`fromDate` and `toDate` specify the period for which the statements will be fetched. For example, if you need the last 6 months of statements, `fromDate` will be today's date - 6 months and `toDate` will be today's date - 1 day. If not provided the default date range is 6 months from the current date. It should be in `DD/MM/YYYY` format. |
| 199 | + |
| 200 | +Once the above statement is added, a series of checks are done to make sure the SDK is implemented correctly. A `RunTimeException` will be thrown while trying to build the project in case any of the checks are not completed. |
| 201 | + |
| 202 | +::: warning Minimal Requirements for SDK to work: |
| 203 | + |
| 204 | +1. `apiKey` is is mandatory |
| 205 | +2. `linkId` is mandatory, and should be at least 8 characters long |
| 206 | +3. In case `fromDate` / `toDate` is provided, make sure they are of correct date format: `DD/MM/YYYY`. |
| 207 | +4. Make sure `fromDate` is always less than `toDate` |
| 208 | +5. Make sure `toDate` is never today's date, the maximum possible value for it is today's date - 1 day |
| 209 | +Once all these conditions are met, the BankConnect object will build. |
| 210 | +::: |
| 211 | + |
| 212 | +## Show SDK Screen |
| 213 | + |
| 214 | +Start Bank Screen and listen for the result |
| 215 | + |
| 216 | +```javascript |
| 217 | +// Show BankConnect UI |
| 218 | +IonicBankConnectSdk.showBankConnect((error: any) => { |
| 219 | + // error callback |
| 220 | + }, (entityId: any, sessionId: any) => { |
| 221 | + // Success callback |
| 222 | + }); |
| 223 | +``` |
| 224 | + |
| 225 | +## Parse Results |
| 226 | + |
| 227 | +Once the user navigates through the banks and uploads the bank statement, the sdk automatically closes `IonicBankConnectSdk` and returns the results. |
| 228 | + |
| 229 | +Success callback contains `entityId` (or `sessionId`). A successful upload contains a unique `entityId` (or `sessionId`). |
| 230 | + |
| 231 | +- entityId - Unique id of a successful statement upload during Entity flow |
| 232 | +- sessionId - Session id of a successful statement upload during Session flow |
0 commit comments