diff --git a/src/common/rest/index.ts b/src/common/rest/index.ts index 65f83616..e9eebec5 100644 --- a/src/common/rest/index.ts +++ b/src/common/rest/index.ts @@ -5,9 +5,11 @@ import * as accounts from './accounts'; import * as getCountries from './get-countries'; import * as postCountry from './post-country'; -import * as getVezgoProviders from './vezgo/get-providers'; import * as getVezgoLink from './vezgo/get-link'; -import * as storeVezgoAccount from './vezgo/store-account'; +import * as listVezgoProviders from './vezgo/list-providers'; +import * as listVezgoAccounts from './vezgo/list-accounts'; +import * as listVezgoTransactions from './vezgo/list-transactions'; +import * as syncVezgo from './vezgo/sync-vezgo'; import * as getPlaidAccount from './plaid/get-plaid-account'; import * as getPlaidLinkToken from './plaid/get-plaid-link-token'; @@ -17,6 +19,7 @@ import * as listPlaidTransaction from './plaid/list-plaid-transactions'; import * as getPlaidAccessToken from './plaid/get-plaid-access-token'; import * as savePlaidAccounts from './plaid/save-plaid-accounts'; import * as savePlaidTransaction from './plaid/save-plaid-transactions'; +import * as syncPlaid from './plaid/sync-plaid'; import * as postUser from './post-user'; import * as getProductInterests from './get-product-interests'; @@ -43,17 +46,20 @@ export const masaRestClient = { accounts, getClient, postClient, - getVezgoProviders, getVezgoLink, - storeVezgoAccount, + listVezgoProviders, + listVezgoAccounts, + listVezgoTransactions, + syncVezgo, getPlaidAccount, getPlaidLinkToken, getPlaidTransaction, + getPlaidAccessToken, listPlaidAccounts, listPlaidTransaction, - getPlaidAccessToken, savePlaidAccounts, savePlaidTransaction, + syncPlaid, getCountries, postUser, postCountry, diff --git a/src/common/rest/plaid/list-plaid-transactions/index.ts b/src/common/rest/plaid/list-plaid-transactions/index.ts index 830ab0d5..53b5f826 100644 --- a/src/common/rest/plaid/list-plaid-transactions/index.ts +++ b/src/common/rest/plaid/list-plaid-transactions/index.ts @@ -2,7 +2,8 @@ import { MethodMetadata, Parameter } from '../..'; import { useRestCall } from '../../../helpers/rest-calls'; import { Headers } from '../../../helpers/axios'; -const path = 'plaid-transactions/:userId'; +const path = + 'plaid-transactions/:accountId/?pageNbr=:pageNbr&pageSize=:pageSize'; export function useMethod({ pathParameters, body }: any) { const { data, error, loading, getData } = useRestCall({ @@ -17,18 +18,34 @@ export function useMethod({ pathParameters, body }: any) { const parameters: Parameter[] = [ { key: 1, - name: 'userId', - description: 'User ID', + name: 'accountId', + description: 'Account ID', required: 'yes', default: '', - dataType: 'string' + dataType: 'string', + }, + { + key: 2, + name: 'pageNbr', + description: 'Pagination page number', + required: 'no', + default: '', + dataType: 'number', + }, + { + key: 3, + name: 'pageSize', + description: 'pageSize', + required: 'no', + default: '', + dataType: 'number', }, ]; export const metadata: MethodMetadata = { author: 'Aaron Knott', authorPicture: '', - description: "Get a list of user's Plaid Account Transactions", + description: 'Get a list of Plaid transactions for a given account', name: path, method: 'GET', parameters, diff --git a/src/common/rest/plaid/sync-plaid/index.ts b/src/common/rest/plaid/sync-plaid/index.ts new file mode 100644 index 00000000..7690bff8 --- /dev/null +++ b/src/common/rest/plaid/sync-plaid/index.ts @@ -0,0 +1,44 @@ +import { MethodMetadata, Parameter } from '../..'; +import { useRestCall } from '../../../helpers/rest-calls'; +import { Headers } from '../../../helpers/axios'; + +const path = 'sync-plaid/:userId/?publicToken=:publicToken'; + +export function useMethod({ pathParameters, body }: any) { + const { data, error, loading, getData } = useRestCall({ + pathParameters, + headers: Headers, + body, + metadata, + }); + return { data, error, loading, getData }; +} + +const parameters: Parameter[] = [ + { + key: 1, + name: 'userId', + description: 'User ID', + required: 'yes', + default: '', + dataType: 'string', + }, + { + key: 2, + name: 'publicToken', + description: 'Public Token', + required: 'yes', + default: '', + dataType: 'string', + }, +]; + +export const metadata: MethodMetadata = { + author: 'Aaron Knott', + authorPicture: '', + description: + 'Send Public Token to be exchanged for access token and to sync plaid data with user accounts', + name: path, + method: 'GET', + parameters, +}; diff --git a/src/common/rest/vezgo/get-link/index.ts b/src/common/rest/vezgo/get-link/index.ts index 97798631..aca4c5ac 100644 --- a/src/common/rest/vezgo/get-link/index.ts +++ b/src/common/rest/vezgo/get-link/index.ts @@ -4,7 +4,7 @@ import { Headers } from '../../../helpers/axios'; import { useRestCall } from '../../../helpers/rest-calls'; -const path = 'vezgo-connect/:userProfileId/:provider'; +const path = 'vezgo-url/:userProfileId/?provider=:provider'; export function useMethod({ pathParameters, body }: any) { const { data, error, loading, getData } = useRestCall({ diff --git a/src/common/rest/vezgo/list-accounts/index.ts b/src/common/rest/vezgo/list-accounts/index.ts new file mode 100644 index 00000000..aace343f --- /dev/null +++ b/src/common/rest/vezgo/list-accounts/index.ts @@ -0,0 +1,35 @@ +import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; +import { useRestCall } from '../../helpers/rest-calls'; + +const path = 'vezgo-accounts/:userId'; + +export function useMethod({ pathParameters, body }: any) { + const { data, error, loading, getData } = useRestCall({ + pathParameters, + headers: Headers, + body, + metadata, + }); + return { data, error, loading, getData }; +} + +const parameters: Parameter[] = [ + { + key: 1, + name: 'userId', + description: 'User ID', + required: 'yes', + default: '', + dataType: 'string', + }, +]; + +export const metadata: MethodMetadata = { + author: 'Aaron Knott', + authorPicture: '', + description: 'Get all Vezgo Accounts of a user', + name: path, + method: 'GET', + parameters, +}; diff --git a/src/common/rest/vezgo/get-providers/index.ts b/src/common/rest/vezgo/list-providers/index.ts similarity index 100% rename from src/common/rest/vezgo/get-providers/index.ts rename to src/common/rest/vezgo/list-providers/index.ts diff --git a/src/common/rest/vezgo/list-transactions/index.ts b/src/common/rest/vezgo/list-transactions/index.ts new file mode 100644 index 00000000..9f304b3b --- /dev/null +++ b/src/common/rest/vezgo/list-transactions/index.ts @@ -0,0 +1,52 @@ +import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; +import { useRestCall } from '../../helpers/rest-calls'; + +const path = + 'vezgo-transactions/:accountId/?pageNbr=:pageNbr&pageSize=:pageSize'; + +export function useMethod({ pathParameters, body }: any) { + const { data, error, loading, getData } = useRestCall({ + pathParameters, + headers: Headers, + body, + metadata, + }); + return { data, error, loading, getData }; +} + +const parameters: Parameter[] = [ + { + key: 1, + name: 'accountId', + description: 'Account ID', + required: 'yes', + default: '', + dataType: 'string', + }, + { + key: 2, + name: 'pageNbr', + description: 'Pagination page number', + required: 'no', + default: '', + dataType: 'number', + }, + { + key: 3, + name: 'pageSize', + description: 'pageSize', + required: 'no', + default: '', + dataType: 'number', + }, +]; + +export const metadata: MethodMetadata = { + author: 'Aaron Knott', + authorPicture: '', + description: 'Get list of Vezgo Transactions for a given account', + name: path, + method: 'GET', + parameters, +}; diff --git a/src/common/rest/vezgo/store-account/index.ts b/src/common/rest/vezgo/sync-vezgo/index.ts similarity index 68% rename from src/common/rest/vezgo/store-account/index.ts rename to src/common/rest/vezgo/sync-vezgo/index.ts index 26a25507..5e011ed5 100644 --- a/src/common/rest/vezgo/store-account/index.ts +++ b/src/common/rest/vezgo/sync-vezgo/index.ts @@ -2,7 +2,7 @@ import { MethodMetadata, Parameter } from "../.."; import { useRestCall } from "../../../helpers/rest-calls"; -const path = 'store-account/'; +const path = 'sync-vezgo/:userId'; export function useMethod({ pathParameters, body }: any) { const { data, error, loading, getData } = useRestCall({ @@ -17,16 +17,8 @@ export function useMethod({ pathParameters, body }: any) { const parameters: Parameter[] = [ { key: 1, - name: 'code', - description: 'Vezgo Account ID', - required: 'yes', - default: '', - dataType: 'string', - }, - { - key: 2, - name: 'institution', - description: 'Vezgo Account Name', + name: 'userId', + description: 'User ID', required: 'yes', default: '', dataType: 'string', @@ -36,7 +28,7 @@ const parameters: Parameter[] = [ export const metadata: MethodMetadata = { author: 'Aaron Knott', authorPicture: '', - description: 'Store account credentials ', + description: 'Initialize BE sync of Vezgo data', name: path, method: 'POST', parameters,