fix(core): update

This commit is contained in:
2022-02-19 01:34:07 +01:00
parent 4c10678b17
commit 7bb93a5edf
3 changed files with 130 additions and 47 deletions
+8 -10
View File
@@ -5,11 +5,11 @@ import { TinkAccount } from './tink.classes.tinkaccount';
export class TinkUser {
// STATIC
public static async createNewTinkUser (tinkaccountArg: TinkAccount, externalUserIdArg: string) {
const accessToken = await tinkaccountArg.getClientAccessTokenForScope('user:create');
const response = await tinkaccountArg.request({
externalUserId: null,
urlArg: '/api/v1/user/create',
accessToken,
methodArg: 'POST',
scopeArg: 'user:create',
payloadArg: {
"external_user_id": externalUserIdArg,
"market": "GB",
@@ -17,7 +17,8 @@ export class TinkUser {
}
});
console.log(response);
const newTinkUser = new TinkUser (tinkaccountArg, response.user_id, response.external_user_id);
return newTinkUser;
}
// INSTANCE
@@ -33,21 +34,18 @@ export class TinkUser {
this.externalUserIdArg = externalUserIdArg;
}
public async authorize() {
}
/**
* deletes the user
*/
public async delete() {
const authorizationCode = await this.tinkAccountRef.getUserAuthroizationCode(this.externalUserIdArg, this.tinkAccountRef.clientId, 'user:delete');
const accessToken = await this.tinkAccountRef.getUserAccessToken(authorizationCode);
const response = await this.tinkAccountRef.request({
externalUserId: this.externalUserIdArg,
methodArg: 'POST',
accessToken,
payloadArg: {},
scopeArg: 'user:delete',
urlArg: '/api/v1/user/delete'
});
console.log(response);
console.log(`successfully deleted user with externalId ${this.externalUserIdArg}`);
}
}