Skip to content

Commit bdc922e

Browse files
authored
Merge pull request #234 from finbox-in/BANC-6900
BANC-6900: bank connect session flow changes
2 parents 673cb0f + 0e1dd02 commit bdc922e

File tree

14 files changed

+7677
-15751
lines changed

14 files changed

+7677
-15751
lines changed

docs/.vuepress/config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,36 @@ module.exports = {
256256
{
257257
title: 'Frontend Integration',
258258
path: '/session-flow/submit-data-frontend.html',
259+
children: [
260+
{
261+
title: 'JavaScript SDK',
262+
path: '/session-flow/javascript.html'
263+
},
264+
{
265+
title: 'Android SDK',
266+
path: '/session-flow/android.html'
267+
},
268+
{
269+
title: 'iOS SDK',
270+
path: '/session-flow/ios.html'
271+
},
272+
{
273+
title: 'React Native SDK',
274+
path: '/session-flow/react-native.html'
275+
},
276+
{
277+
title: 'Flutter SDK',
278+
path: '/session-flow/flutter.html'
279+
},
280+
{
281+
title: 'Cordova SDK',
282+
path: '/session-flow/cordova.html'
283+
},
284+
{
285+
title: 'Ionic/Capacitor SDK',
286+
path: '/session-flow/ionic-capacitor.html'
287+
},
288+
]
259289
},
260290
{
261291
title: 'Backend Integration',

docs/session-flow/android.md

Lines changed: 65 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# BankConnect: Android
2+
23
The Android SDK helps user submits their bank statements via upload or net banking credentials in your Android application.
34

45
## Requirements
@@ -70,7 +71,7 @@ dependencies {
7071
</template>
7172
</CodeSwitcher>
7273

73-
## Adding Dependency
74+
## Add Dependency
7475

7576
In the project level `build.gradle` file or `settings.gradle`, add the repository URLs to all `allprojects` block or `repositories` block inside `dependencyResolutionManagement`.
7677

@@ -132,38 +133,48 @@ implementation('in.finbox.bankconnect:hybrid:<BC_SDK_VERSION>:release@aar') {
132133
</template>
133134
</CodeSwitcher>
134135

135-
136136
::: warning NOTE
137137
Following will be shared by FinBox team at the time of integration:
138+
138139
- `ACCESS_KEY`
139140
- `SECRET_KEY`
140141
- `BC_SDK_VERSION`
141142
- `CLIENT_API_KEY`
142143
:::
143144

144145
## Integration Workflow
146+
145147
The diagram below illustrates the integration workflow in a nutshell:
146148
<img src="/client_sdk.jpg" alt="Client SDK Workflow" />
147149

148150
## Sample Project
151+
149152
We have hosted a sample project on GitHub, you can check it out here:
150153
<div class="button_holder">
151154
<a class="download_button" target="_blank" href="https://github.com/finbox-in/bankconnect-android">Open GitHub Repository</a>
152155
</div>
153156

154157
## Build Bank Connect
155-
Build the `FinBoxBankConnect` object by passing `apiKey`, `linkId`, `fromDate`, `toDate` and `bank`.
158+
159+
Build the `FinBoxBankConnect` object by passing `apiKey`, `linkId`, `fromDate`, `toDate`, `bank`, `mode` and others.
156160

157161
<CodeSwitcher :languages="{kotlin:'Kotlin',java:'Java'}">
158162
<template v-slot:kotlin>
159163

160164
```kotlin
161165
FinBoxBankConnect.Builder(applicationContext)
162166
.apiKey("CLIENT_API_KEY")
163-
.linkId("your_link_id")
164-
.fromDate("01/01/2021") // Optional: Default 6 months old date
165-
.toDate("01/04/2021") // Optional: Default value 1 day less than current date
166-
.bank("sbi") // Optional
167+
.linkId("LINK_ID")
168+
.fromDate("01/01/2021") // Optional: Default 6 months old date
169+
.toDate("01/04/2021") // Optional: Default value 1 day less than current date
170+
.bank("sbi") // Optional: Short code of the bank
171+
.mode(PDF) // Optional: PDF Mode
172+
.mobileNumber("9876543210") // Optional: Mobile number
173+
.journeyMode(MULTI_PDF) // Optional: Multi PDF journey
174+
.aaJourneyMode(ONLY_RECURRING) // Optional: Recurring AA pulls
175+
.aaRecurringTenureMonthCount(3) // Optional: Consent duration is valid for 3 months
176+
.aaRecurringFrequencyUnit(TimeUnit.DAYS) // Optional: Frequency value is in Days
177+
.aaRecurringFrequencyValue(2) // Optional: Number of times to pull the data
167178
.build()
168179
```
169180

@@ -172,31 +183,45 @@ FinBoxBankConnect.Builder(applicationContext)
172183

173184
```java
174185
new FinBoxBankConnect.Builder(getApplicationContext())
175-
.apiKey("your_api_key")
176-
.linkId("your_link_id")
177-
.fromDate("01/01/2021") // Optional: Default 6 months old date
178-
.toDate("01/04/2021") // Optional: Default value 1 day less than current date
179-
.bank("sbi") // Optional
186+
.apiKey("CLIENT_API_KEY")
187+
.linkId("LINK_ID")
188+
.fromDate("01/01/2021") // Optional: Default 6 months old date
189+
.toDate("01/04/2021") // Optional: Default value 1 day less than current date
190+
.bank("sbi") // Optional: Short code of the bank
191+
.mode(PDF) // Optional: PDF Mode
192+
.mobileNumber("9876543210") // Optional: Mobile number
193+
.journeyMode(MULTI_PDF) // Optional: Multi PDF journey
194+
.aaJourneyMode(ONLY_RECURRING) // Optional: Recurring AA pulls
195+
.aaRecurringTenureMonthCount(3) // Optional: Consent duration is valid for 3 months
196+
.aaRecurringFrequencyUnit(TimeUnit.DAYS) // Optional: Frequency value is in Days
197+
.aaRecurringFrequencyValue(2) // Optional: Number of times to pull the data
180198
.build();
181199
```
182200

183201
</template>
184202
</CodeSwitcher>
185203

186-
187204
| Builder Property | Description | Required |
188205
| - | - | - |
189206
| `apiKey` | specifies the `api_key` | Yes |
190207
| `linkId` | specifies the `link_id` | Yes |
191208
| `fromDate` | specifies the starting period of the statement in `DD/MM/YYYY`format | No |
192209
| `toDate` | specifies the end period of the statement in `DD/MM/YYYY` format | No |
193210
| `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 |
211+
| `mode` | set the mode as pdf (manual upload) or aa (Account Aggregator) or online (Net Banking) | No |
212+
| `mobile_number` | Prefills phone number in Account Aggregator mode | No |
213+
| `journey_mode` | Optional parameter to set the journey (i.e.multi_pdf or multi_banking) | No |
214+
| `aa_journey_mode` | set the journey mode for AA (i.e only_once or only_recurring) | No |
215+
| `aa_recurring_tenure_month_count` | set the recurring consent duration (min: 1 and max: 24) | No |
216+
| `aa_recurring_frequency_unit` | set the frequency unit to pull the data during the recurring consent duration (year, month, day, hour) | No |
217+
| `aa_recurring_frequency_value` | set the frequency value to pull the data during the recurring consent duration (min: 1 and max: 3) | No |
194218

195219
`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.
196220

197221
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.
198222

199223
::: warning Minimal Requirements for SDK to work:
224+
200225
1. `apiKey` is is mandatory
201226
2. `linkId` is mandatory, and should be at least 8 characters long
202227
3. In case `fromDate` / `toDate` is provided, make sure they are of correct date format: `DD/MM/YYYY`.
@@ -206,7 +231,8 @@ Once all these conditions are met, the BankConnect object will build.
206231
:::
207232

208233
## Show SDK Screen
209-
Start BankActivity and listten for the result
234+
235+
Start BankActivity and listen for the result
210236

211237
<CodeSwitcher :languages="{kotlin:'Kotlin',java:'Java'}">
212238
<template v-slot:kotlin>
@@ -246,11 +272,14 @@ result.launch(new Intent(this, BankActivity.class));
246272
</CodeSwitcher>
247273

248274
## Parse Results
249-
Once the user navigates through the banks and uploads the bank statement, the sdk automatically closes `BankActivity` and returns `FinboxOnSuccessPayload`.
250275

251-
`FinboxOnSuccessPayload` contains `linkId` and `entityId`. A successful upload contains a unique `entityId`.
252-
* linkId - Unique id passed when building the Bank Connect object
253-
* entityId - Unique id of a successful statement upload
276+
Once the user navigates through the banks and uploads the bank statement, the sdk automatically closes `BankActivity` and returns `FinBoxPayload`.
277+
278+
`FinBoxPayload` contains `linkId` and `entityId` (or `sessionId`). A successful upload contains a unique `entityId` (or `sessionId`).
279+
280+
- linkId - Unique id passed when building the Bank Connect object
281+
- entityId - Unique id of a successful statement upload during Entity flow
282+
- sessionId - Session id of a successful statement upload during Session flow
254283

255284
<CodeSwitcher :languages="{kotlin:'Kotlin',java:'Java'}">
256285
<template v-slot:kotlin>
@@ -261,18 +290,19 @@ if (result?.resultCode == Activity.RESULT_OK) {
261290
// Read extras
262291
val extras = result.data?.extras
263292
// Read success payload
264-
val payload = extras?.getParcelable<FinboxOnSuccessPayload>(
265-
FinboxBankConstants.BUNDLE_EXTRA_SUCCESS_PAYLOAD
266-
)
293+
val payload = extras?.getParcelable<FinBoxPayload>(FINBOX_JOURNEY_RESULT)
267294
when {
268295
payload == null -> {
269296
// Failed to Receive Payload
270297
}
271-
payload.entityId.isNullOrBlank() -> {
272-
// Failed to Upload Document
298+
payload.entityId.isNullOrBlank() && payload.sessionId.isNullOrBlank() -> {
299+
// Failed to Upload Document during Entity flow or
300+
// Failed to Upload Document for Session Flow
273301
}
274302
else -> {
275303
// Upload Success
304+
// Read the session id for session flow or
305+
// Read the entity id
276306
}
277307
}
278308
} else {
@@ -290,14 +320,16 @@ if (result != null && result.getResultCode() == Activity.RESULT_OK) {
290320
@Nullable final Bundle extras = result.getData() != null ? result.getData().getExtras() : null;
291321
if (extras != null) {
292322
// Read success payload
293-
@Nullable final FinboxOnSuccessPayload payload =
294-
extras.getParcelable(FinboxBankConstants.BUNDLE_EXTRA_SUCCESS_PAYLOAD);
323+
@Nullable final FinBoxPayload payload = extras.getParcelable(FINBOX_JOURNEY_RESULT);
295324
if (payload == null) {
296325
// Failed to Receive Payload
297-
} else if (payload.getEntityId() == null || payload.getEntityId().length() == 0) {
298-
// Failed to Upload Document
326+
} else if ((payload.getEntityId() == null || payload.getEntityId().length() == 0) && (payload.getSessionId() == null || payload.getSessionId().length() == 0)) {
327+
// Failed to Upload Document during Entity flow or
328+
// Failed to Upload Document for Session Flow
299329
} else {
300330
// Upload Success
331+
// Read the session id for session flow or
332+
// Read the entity id
301333
}
302334
} else {
303335
// Failed to Receive data
@@ -310,29 +342,30 @@ if (result != null && result.getResultCode() == Activity.RESULT_OK) {
310342
</template>
311343
</CodeSwitcher>
312344

313-
314345
:::warning Webhook
315346
To track detailed errors, and transaction process completion at the server-side, it is recommended to also integrate [Webhook](/bank-connect/webhook.html).
316347
:::
317348

318349
## Customization
350+
319351
`BankActivity` inherits the themes and color from Material Dark Action Bar Theme. Most of the case, there would be less customization requried but if there is a mismatch in colors, you can customize it through your `styles.xml` file.
320352

321353
1. The sdk Toolbar color uses `colorPrimary`. If your app toolbar color is different from `colorPrimary` then change the color by updating the background color
322-
```xml
354+
355+
```xml
323356
<style name="BankConnectTheme.Toolbar">
324357
<item name="android:background">@color/colorWhite</item>
325358
</style>
326-
```
359+
```
327360

328361
2. `BankConnectTheme` is the base theme of the sdk and it inherits `Theme.MaterialComponents.Light.DarkActionBar`. If your app doesn't inherit Dark Action Bar theme then you can change the sdk theme to inherit your app base theme.
329362

330-
```xml
363+
```xml
331364
<style name="BankConnectTheme" parent="AppTheme">
332365

333366
</style>
334367

335368
<style name="BankConnectTheme.AppBarOverlay" parent="AppTheme.AppBarOverlay" />
336369

337370
<style name="BankConnectTheme.PopupOverLay" parent="AppTheme.PopupOverlay" />
338-
```
371+
```

0 commit comments

Comments
 (0)