From 6cf96b46f058c4746ef12a9ea5fd6e96ecfff26b Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 18 Sep 2023 17:14:02 +0200 Subject: [PATCH 1/4] ref: moved Plaid lib to TS --- src/libs/actions/{Plaid.js => Plaid.ts} | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) rename src/libs/actions/{Plaid.js => Plaid.ts} (81%) diff --git a/src/libs/actions/Plaid.js b/src/libs/actions/Plaid.ts similarity index 81% rename from src/libs/actions/Plaid.js rename to src/libs/actions/Plaid.ts index 53763980d285..08e894058277 100644 --- a/src/libs/actions/Plaid.js +++ b/src/libs/actions/Plaid.ts @@ -6,13 +6,14 @@ import * as PlaidDataProps from '../../pages/ReimbursementAccount/plaidDataPropT /** * Gets the Plaid Link token used to initialize the Plaid SDK - * @param {Boolean} allowDebit - * @param {Number} bankAccountID */ -function openPlaidBankLogin(allowDebit, bankAccountID) { - const params = getPlaidLinkTokenParameters(); - params.allowDebit = allowDebit; - params.bankAccountID = bankAccountID; +function openPlaidBankLogin(allowDebit: boolean, bankAccountID: number) { + const {redirect_uri} = getPlaidLinkTokenParameters(); + const params = { + redirect_uri, + allowDebit, + bankAccountID, + }; const optimisticData = [ { onyxMethod: Onyx.METHOD.SET, @@ -36,13 +37,7 @@ function openPlaidBankLogin(allowDebit, bankAccountID) { API.read('OpenPlaidBankLogin', params, {optimisticData}); } -/** - * @param {String} publicToken - * @param {String} bankName - * @param {Boolean} allowDebit - * @param {Number} bankAccountID - */ -function openPlaidBankAccountSelector(publicToken, bankName, allowDebit, bankAccountID) { +function openPlaidBankAccountSelector(publicToken: string, bankName: string, allowDebit: boolean, bankAccountID: number) { API.read( 'OpenPlaidBankAccountSelector', { From 1d1bc722d3e5fb64521f953e6ccdab01d24a31e7 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Wed, 20 Sep 2023 11:13:06 +0200 Subject: [PATCH 2/4] fix: added eslint disable to file --- src/libs/actions/Plaid.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/actions/Plaid.ts b/src/libs/actions/Plaid.ts index 08e894058277..fdfe64a19461 100644 --- a/src/libs/actions/Plaid.ts +++ b/src/libs/actions/Plaid.ts @@ -8,8 +8,11 @@ import * as PlaidDataProps from '../../pages/ReimbursementAccount/plaidDataPropT * Gets the Plaid Link token used to initialize the Plaid SDK */ function openPlaidBankLogin(allowDebit: boolean, bankAccountID: number) { + // redirect_uri need to be in kebab case convention because its how its passed to backend + // eslint-disable-next-line @typescript-eslint/naming-convention const {redirect_uri} = getPlaidLinkTokenParameters(); const params = { + // eslint-disable-next-line @typescript-eslint/naming-convention redirect_uri, allowDebit, bankAccountID, From 301e1147754b6f7669572e5fb3cf8d4e62fd3850 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Wed, 20 Sep 2023 13:07:13 +0200 Subject: [PATCH 3/4] fix: resolve comment --- src/libs/actions/Plaid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Plaid.ts b/src/libs/actions/Plaid.ts index fdfe64a19461..f2668cf93307 100644 --- a/src/libs/actions/Plaid.ts +++ b/src/libs/actions/Plaid.ts @@ -8,7 +8,7 @@ import * as PlaidDataProps from '../../pages/ReimbursementAccount/plaidDataPropT * Gets the Plaid Link token used to initialize the Plaid SDK */ function openPlaidBankLogin(allowDebit: boolean, bankAccountID: number) { - // redirect_uri need to be in kebab case convention because its how its passed to backend + // redirect_uri needs to be in kebab case convention because that's how it's passed to the backend // eslint-disable-next-line @typescript-eslint/naming-convention const {redirect_uri} = getPlaidLinkTokenParameters(); const params = { From e3802cfa7ef6fab6208cc0a421fb900d035e579d Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 28 Sep 2023 14:05:47 +0200 Subject: [PATCH 4/4] fix: get correct redirect uri --- src/libs/actions/Plaid.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Plaid.ts b/src/libs/actions/Plaid.ts index f2668cf93307..410a8c57d176 100644 --- a/src/libs/actions/Plaid.ts +++ b/src/libs/actions/Plaid.ts @@ -9,11 +9,9 @@ import * as PlaidDataProps from '../../pages/ReimbursementAccount/plaidDataPropT */ function openPlaidBankLogin(allowDebit: boolean, bankAccountID: number) { // redirect_uri needs to be in kebab case convention because that's how it's passed to the backend - // eslint-disable-next-line @typescript-eslint/naming-convention - const {redirect_uri} = getPlaidLinkTokenParameters(); + const {redirectURI} = getPlaidLinkTokenParameters(); const params = { - // eslint-disable-next-line @typescript-eslint/naming-convention - redirect_uri, + redirectURI, allowDebit, bankAccountID, };