From d8c4504e15a4c1762620f97bc8cd5cee849fe1b0 Mon Sep 17 00:00:00 2001 From: Sumrender Singh Date: Tue, 10 Dec 2024 10:36:07 +0530 Subject: [PATCH] fix: add mfa flow to sync/fetch txns personal card --- .../core/services/personal-cards.service.ts | 24 +++++++- .../personal-cards/personal-cards.page.ts | 56 +++++++++++++------ 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/src/app/core/services/personal-cards.service.ts b/src/app/core/services/personal-cards.service.ts index 8a69f88dea..9b6d550ace 100644 --- a/src/app/core/services/personal-cards.service.ts +++ b/src/app/core/services/personal-cards.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; +import { Observable, of } from 'rxjs'; import { map } from 'rxjs/operators'; import { PersonalCard } from '../models/personal_card.model'; import { YodleeAccessToken } from '../models/yoodle-token.model'; @@ -190,10 +190,28 @@ export class PersonalCardsService { return this.expenseAggregationService.get('/yodlee/personal/access_token') as Observable; } - htmlFormUrl(url: string, accessToken: string): string { + isMfaEnabled(personalCardId: string, usePlatformApi): Observable { + if (!usePlatformApi) { + return of(false); // TODO sumrender: hack, this will be removed with old personalCards removal in next pr; + } + const payload = { + data: { + id: personalCardId, + }, + }; + return this.spenderPlatformV1ApiService + .post>('/personal_cards/mfa', payload) + .pipe(map((res) => res.data.is_mfa_enabled)); + } + + htmlFormUrl(url: string, accessToken: string, isMfaFlow: boolean): string { + let extraParams = 'configName=Aggregation&callback=https://www.fylehq.com'; + if (isMfaFlow) { + extraParams = 'configName=Aggregation&flow=refresh&callback=https://www.fylehq.com'; + } const pageContent = `