BREAKING CHANGE(new TinkUser().getTinkLink()): now expects a tinkLinkOptionsArg
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@mojoio/tink',
|
||||
version: '3.0.0',
|
||||
description: 'an unofficial api abstraction for tink.com'
|
||||
}
|
@ -109,13 +109,24 @@ export class TinkUser {
|
||||
* gets a tink link that can be used by a user to connect accounts
|
||||
* @returns
|
||||
*/
|
||||
public async getTinkLinkForMarket(countryIdArg: string = 'DE', redirectUrlArg = 'https://console.tink.com/callback'): Promise<string> {
|
||||
public async getTinkLinkForMarket(linkOptionsArg: {
|
||||
countryId: string;
|
||||
redirectUrl: string;
|
||||
testProviderBool?: boolean;
|
||||
} = {
|
||||
countryId: 'DE',
|
||||
redirectUrl: 'https://console.tink.com/callback',
|
||||
testProviderBool: true
|
||||
}): Promise<string> {
|
||||
if (typeof linkOptionsArg.testProviderBool !== 'boolean') {
|
||||
linkOptionsArg.testProviderBool = false;
|
||||
}
|
||||
const authorizationCode = await this.tinkAccountRef.getUserAuthorizationCode(
|
||||
this.externalUserIdArg,
|
||||
'df05e4b379934cd09963197cc855bfe9', // this is a hardcoded app id for tink link, as recommended by tink.com
|
||||
'authorization:read,authorization:grant,credentials:refresh,credentials:read,credentials:write,providers:read,user:read'
|
||||
);
|
||||
const tinkLinkUrl = `https://link.tink.com/1.0/business-transactions/connect-accounts?client_id=${'teststate'}&redirect_uri=${redirectUrlArg}&authorization_code=${authorizationCode}&market=${countryIdArg}`;
|
||||
const tinkLinkUrl = `https://link.tink.com/1.0/business-transactions/connect-accounts?client_id=${'teststate'}&redirect_uri=${linkOptionsArg.redirectUrl}&authorization_code=${authorizationCode}&market=${linkOptionsArg.countryId}&test=${linkOptionsArg.testProviderBool}`;
|
||||
return tinkLinkUrl;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
// @pushrocks scope
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
export { smartrequest };
|
||||
export { smartdelay, smartrequest, smartpromise };
|
||||
|
Reference in New Issue
Block a user