BREAKING CHANGE(core): switch to esm and allow specification of redirect url

This commit is contained in:
2022-04-18 18:54:53 +02:00
parent bdd7419d3d
commit dca6f9ef0b
10 changed files with 5562 additions and 13937 deletions

View File

@ -1,3 +1,3 @@
export * from './tink.classes.tinkaccount';
export * from './tink.classes.tinkuser';
export * from './tink.classes.tinkproviderconsent';
export * from './tink.classes.tinkaccount.js';
export * from './tink.classes.tinkuser.js';
export * from './tink.classes.tinkproviderconsent.js';

View File

@ -1,6 +1,6 @@
import * as plugins from './tink.plugins';
import * as plugins from './tink.plugins.js';
import { TinkUser } from './tink.classes.tinkuser';
import { TinkUser } from './tink.classes.tinkuser.js';
export class TinkAccount {
public clientId: string;

View File

@ -1,6 +1,6 @@
import * as plugins from './tink.plugins';
import * as plugins from './tink.plugins.js';
import { TinkUser } from './tink.classes.tinkuser';
import { TinkUser } from './tink.classes.tinkuser.js';
/**
* a provider consent maps to tinks bank consents
@ -19,8 +19,8 @@ export class TinkProviderConsent {
urlArg: '/api/v1/provider-consents',
accessToken,
methodArg: 'GET',
payloadArg: null
})
payloadArg: null,
});
console.log(responseData);
return returnProviderConsents;
}

View File

@ -1,7 +1,7 @@
import * as plugins from './tink.plugins';
import * as plugins from './tink.plugins.js';
import { TinkAccount } from './tink.classes.tinkaccount';
import { TinkProviderConsent } from './tink.classes.tinkproviderconsent';
import { TinkAccount } from './tink.classes.tinkaccount.js';
import { TinkProviderConsent } from './tink.classes.tinkproviderconsent.js';
export class TinkUser {
// STATIC
@ -109,13 +109,13 @@ export class TinkUser {
* gets a tink link that can be used by a user to connect accounts
* @returns
*/
public async getTinkLinkForMarket(countryIdArg: string = 'DE'): Promise<string> {
public async getTinkLinkForMarket(countryIdArg: string = 'DE', redirectUrlArg = 'https://console.tink.com/callback'): Promise<string> {
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=https://console.tink.com/callback&authorization_code=${authorizationCode}&market=${countryIdArg}`;
const tinkLinkUrl = `https://link.tink.com/1.0/business-transactions/connect-accounts?client_id=${'teststate'}&redirect_uri=${redirectUrlArg}&authorization_code=${authorizationCode}&market=${countryIdArg}`;
return tinkLinkUrl;
}

View File

@ -1,6 +1,4 @@
// @pushrocks scope
import * as smartrequest from '@pushrocks/smartrequest';
export {
smartrequest
}
export { smartrequest };