0.0.38-beta • Published 8 days ago

react-native-tink-sdk v0.0.38-beta

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

react-native-tink-sdk

This project contains the RN NPM package for Open Banking with Tink Link SDK and Tink's Money Manager SDK.

Current version of Tink Link SDK used: 2.5.0(Android), 2.3.0(iOS)

Current version of Tink Money Manager SDK used: 1.1.4(Android), 1.3.0(iOS)

Tink Link SDK will be used to connect to bank accounts for continous access - Tink Transactions

Find the official method documentation here:

Android

iOS

Installation

npm install react-native-tink-sdk

Usage of Tink Link SDK

Step 1 and 2 are important for the deeplink configuration for the Tink Link SDK to redirect correctly to your application after finishing the account aggregation flow in external browser or bank app.

Step 1 - Add ConnectAccountActivity in app's AndroidManifest.xml file.

Add ConnectAccountActivity to your application's AndroidManifest file like this:

<activity
    android:name="com.reactnativetink.activity.ConnectAccountActivity"
    android:exported="true"
    android:launchMode="singleInstance">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data
            android:host="wallet"
            android:scheme="pxsplus" />
    </intent-filter>
</activity>

Step 2 - Add deeplink for iOS in your App's plist file.

Make sure to add this deeplink pxsplus://wallet in your application's plist file like this:

<array>
	<dict>
		<key>CFBundleTypeRole</key>
		<string>Editor</string>
		<key>CFBundleURLName</key>
		<string>pxsplus</string>
		<key>CFBundleURLSchemes</key>
		<array>
			<string>pxsplus</string>
		</array>
	</dict>
</array>

Step 2 - Call the function

import { connectAccount } from 'react-native-tink-sdk';

const result = await connectAccount(clientId, redirectUri, authorizationCode, market, locale);
 

where,

  • clientId - client ID retrieved from Tink Console.
  • redirectUri - configured in Tink Console - the page to which the end-user is redirected, along with the response parameters, when completing the flow.
  • authorizationCode - the authorization code generated using API's.
  • market - The market code for which providers should be listed.
  • locale - Locale to be used for end-user facing text.

    connectAccount will return the credentialsId in case of success and will return an object of type TinkLinkError from react-native-tink-sdk in case of error scenario. See TinkLinkError

Usage of Money manager SDK

Step 1 - Initialize the SDK(Only for Android)

import { initTink } from 'react-native-tink-sdk';

const result = await initTink(clientId);
 

where,

  • clientId - client ID retrieved from Tink Console.

Note:

initTink should be called only once. If Tink has already been initialized, it throws an IllegalStateException.

Step 2 - Add the MoneyManagerFinanceOverview view

Currently this is available for Android and iOS. Due to certain issues found in Android, we recommended to use this only for iOS and for Android please use Step 3.

import { MoneyManagerFinanceOverview } from 'react-native-tink-sdk';

 <MoneyManagerFinanceOverview
    style={{
        height: windowHeightOS,
        width: windowWidthOS,
    }}
    clientId={clientId}
    accessToken={accessToken}
    userPressedBack={() => {
        Alert.alert('React-Native event popup', 'Event triggered: userPressedBack');
    }} 
    />

where,

  • style - width and height for the component needs to be passed. This will be taken effect in Andriod only. In iOS, the entire length and width will be taken.
  • clientId - client ID retrieved from Tink Console.
  • accessToken - Access token created with the help of authorization-grant, from the endpoint oauth/token.
  • userPressedBack - This callback method will be invoked when user press the back button. Only for iOS.

Events

To access event data, you will need to use e.nativeEvent. For example, onPress={e => console.log(e.nativeEvent)} will log the entire event object to your console.

Event NameReturnsNotes
userPressedBackCallback that is called when user click on back (arrow) button.

Step 3 - Open the finance overview in Money manager

import { showMoneyManager } from 'react-native-tink-sdk';

showMoneyManager(clientId, accessToken).then((message) => {
        console.log(message)
        Alert.alert('Promise resolved', 'userPressedBack');
    }).catch((error) => {
        console.log(error)
    })
 

where,

  • clientId - client ID retrieved from Tink Console.
  • accessToken - Access token created with the help of authorization-grant, from the endpoint oauth/token.

    The promise will be resolved when user press on back button on Financial overview.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

ChangeLog

See the ChangeLog here

Running tests

yarn run test

Make sure the code coverage is 90+% before committing the code!

Running code quality check

yarn run tsc
yarn run lint
yarn run check_code:native

Make sure there are no flow errors before committing!

Running the build

npm run build

Publishing

npm publish

Make sure to run the build before publishing (the published code is in the lib folder)!

Example App

To run the app see instructions here

How to update translations for Budget manager SDK

The translations inside budget manager can be customized. If need to change any translations, you can find them in the below files:

- Android

EN: android/src/main/res/values/strings.xml

FR: android/src/main/res/values-fr/strings.xml

NL: android/src/main/res/values-nl/strings.xml

DE: android/src/main/res/values-de/strings.xml

- iOS

EN: ios/Resources/en.lproj/TinkMoneyManagerUI.strings

FR: ios/Resources/fr.lproj/TinkMoneyManagerUI.strings

DE: ios/Resources/de.lproj/TinkMoneyManagerUI.strings

NL: ios/Resources/nl.lproj/TinkMoneyManagerUI.strings

- Tink reference doc for adding translations:

Android : https://github.com/tink-ab/tink-money-manager-android/blob/master/string-customization-guide.md

iOS : https://github.com/tink-ab/tink-money-manager-ios/blob/master/LOCALIZABLE_STRINGS.md

0.0.38-beta

8 days ago

0.0.37-beta

8 days ago

0.0.36-beta

10 days ago

0.0.35-beta

14 days ago

0.0.33-beta

17 days ago

0.0.34-beta

17 days ago

0.0.28-beta-2

21 days ago

0.0.30-beta

21 days ago

0.0.32-beta

21 days ago

0.0.31-beta

21 days ago

0.0.29-beta

22 days ago

0.0.28-beta

1 month ago

0.0.27-beta

1 month ago

0.0.26-beta

1 month ago

0.0.25-beta

2 months ago

0.0.24-beta

2 months ago

0.0.22-beta

2 months ago

0.0.23-beta

2 months ago

0.0.21-beta

2 months ago

0.0.20-beta

2 months ago

0.0.19-beta

2 months ago

0.0.18-beta

2 months ago

0.0.15-beta

2 months ago

0.0.17-beta

2 months ago

0.0.16-beta

2 months ago

0.0.14-beta

3 months ago

0.0.13-beta

3 months ago

0.0.11-beta

3 months ago

0.0.12-beta

3 months ago

0.0.10-beta

3 months ago

0.0.9-beta

4 months ago

0.0.8-beta

4 months ago

0.0.7-beta

4 months ago

0.0.6-beta

4 months ago

0.0.5-beta

4 months ago

0.0.4-beta

4 months ago

0.0.3-beta

4 months ago

0.0.2-beta

5 months ago

0.0.1-beta

5 months ago