Skip to content

Commit

Permalink
Merge pull request #14 from Mastercard/feature/updates
Browse files Browse the repository at this point in the history
Feature/updates
  • Loading branch information
AshishChoureMA authored Sep 30, 2024
2 parents 80f2858 + 3e2e139 commit e80aead
Show file tree
Hide file tree
Showing 17 changed files with 676 additions and 319 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- [Demo](#demo)
1. [Generate your credentials](#1-generate-your-credentials)
2. [Add credentials to the .env file](#2-add-credentials-to-the-env-file)
3. [Run application](#3-run-application)
3. [Setup and run the application](#3-setup-and-run-the-application)
4. [Create your first customer](#4-create-your-first-customer)
5. [Add a bank account to customer](#5-add-a-bank-account-to-customer)
6. [Pull account information](#6-pull-account-information)
Expand Down Expand Up @@ -109,14 +109,19 @@ The Open Banking Reference App needs Sandbox API credentials adding to the `.env
### 3. Setup and Run the application

- ##### Run without docker

The following command will install the required depdendancies on your machine. (This command should be executed during the initial setup)

```
npm i
```

Execute the following command to start the Reference App:

```shell
npm start
```

- ##### Run with docker

**Pre-requisites** - Docker installed and running on your machine: https://docs.docker.com/get-docker/
Expand All @@ -127,6 +132,10 @@ The Open Banking Reference App needs Sandbox API credentials adding to the `.env
docker compose up
```

Launch the web browser and navigate to http://localhost:4000 to view the application.

**Note:** To update the docker image for the reference application, execute the command `docker compose build`, followed by `docker compose up` to run application.

When the application is launched in a browser, it prompts either to proceed with demo or go to GitHub. Select **View Demo**.
This will redirect you to the first step of the user flow.

Expand Down
Binary file modified docs/test_case_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test:coverage": "react-scripts test --env=jsdom --watchAll=false --coverage --collectCoverageFrom='src/components/**/*.tsx'",
"test:coverage": "react-scripts test --env=jsdom --watchAll=false --coverage",
"eject": "react-scripts eject",
"lint": "eslint --fix --ext .ts,.tsx ./src",
"prettier": "npx prettier --write ."
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectForm/data/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const Steps = [
),
panel: 'panel3',
documentationLink:
'https://developer.mastercard.com/open-banking-us/documentation/usecases/',
'https://developer.mastercard.com/open-banking-au/documentation/usecases/',
},
];

Expand Down
18 changes: 6 additions & 12 deletions src/components/DataTable/DatatTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ export default function DataTable({ columns, data, product }: any) {
variant='head'
key={header.id}
>
{header.isPlaceholder
? null
: header.column.columnDef
.header}
{header.column.columnDef.header}
</TableCell>
))}
</TableRow>
Expand All @@ -68,14 +65,11 @@ export default function DataTable({ columns, data, product }: any) {
variant='body'
key={cell.id}
>
{/* Use MRT's cell renderer that provides better logic than flexRender */}
{cell ? (
<MRT_TableBodyCellValue
cell={cell}
table={table}
staticRowIndex={rowIndex} //just for batch row selection to work
/>
) : null}
<MRT_TableBodyCellValue
cell={cell}
table={table}
staticRowIndex={rowIndex} //just for batch row selection to work
/>
</TableCell>
))}
</TableRow>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Product/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const data = {
requestType: 'GET',
description: 'Get a list of transactions for given account. ',
api: '/aggregation/v3/customers/<customerId>/accounts/<accountId>/transactions?sort=desc&fromDate=<startDate>&toDate=<endDate>',
link: 'https://developer.mastercard.com/open-banking-us/documentation/api-reference/?view=api#GetCustomerAccountTransactions',
link: 'https://developer.mastercard.com/open-banking-au/documentation/api-reference/?view=api#GetCustomerAccountTransactions',
columns: [
{
accessorKey: 'date',
Expand Down
28 changes: 0 additions & 28 deletions src/components/Usecases/components/Lend/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,31 +190,3 @@ export const downloadReport = (report: any, filename: string, isPdf = true) => {
alink.download = `${filename}.${isPdf ? 'pdf' : 'json'}`;
alink.click();
};

/**
* Download PDF report
* @param report generated report
* @param filename filename
*/
export const downloadPDf = (report: any, filename: string) => {
const fileURL = window.URL.createObjectURL(report);
const alink = document.createElement('a');
alink.target = '_blank';
alink.href = fileURL;
alink.download = `${filename}.json`;
alink.click();
};

/**
* Download json report
* @param report generated report
*/
export const downloadJson = (report: any) => {
const x: any = window.open();
x.document.open();
x.document.write(
'<html><body><pre>' +
JSON.stringify(report, null, 2) +
'</pre></body></html>'
);
};
8 changes: 4 additions & 4 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Configure App key, Partner ID and Partner Secret */
export const PARTNERID = process.env.REACT_APP_PARTNERID ?? '';
export const PARTNERSECRET = process.env.REACT_APP_SECRET ?? '';
export const APP_KEY = process.env.REACT_APP_KEY ?? '';
export const PARTNERID = process.env.REACT_APP_PARTNERID;
export const PARTNERSECRET = process.env.REACT_APP_SECRET;
export const APP_KEY = process.env.REACT_APP_KEY;
export const AUTO_CREATE_CUSTOMER =
(process.env.REACT_APP_AUTO_CREATE_CUSTOMER ?? '') === 'true';
process.env.REACT_APP_AUTO_CREATE_CUSTOMER === 'true';

/* URL's */
export const url = {
Expand Down
223 changes: 7 additions & 216 deletions src/tests/CurlCommand.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { CurlCommand } from '../components';

import data from '../components/Product/data';
import requestData from './Mocks/request-data';
const writeText = jest.fn();

Object.assign(navigator, {
Expand All @@ -9,224 +12,12 @@ Object.assign(navigator, {
},
});
describe('Testing curl command Component', () => {
const product = {
name: 'Accounts',
identifier: 'accounts',
type: 'pay',
requestType: 'GET',
description: ' Get a list of shared accounts and their properties.',
api: '/aggregation/v1/customers/<customerId>/institutionLogins/<institutionLoginId>/accounts',
link: 'https://developer.mastercard.com/open-banking-au/documentation/api-reference/?view=api#GetCustomerAccounts',
columns: [
{
accessorKey: 'id',
header: 'ID',
},
{
accessorKey: 'name',
header: 'Name ',
},
{
accessorKey: 'type',
header: 'Type',
},
{
accessorKey: 'balance',
header: 'Balance',
},
{
accessorKey: 'currency',
header: 'Currency',
},
],
};
const requestData = {
customerId: '2493226',
institutionLoginId: 2340097,
token: 'L5jdSj5YtX6P0h8Wqa9W',
consentReceiptId: 'fd97cba7-1545-4aae-9fbe-e105c813e092',
accountData: [
{
id: '15430029',
number: '8000008888',
accountNumberDisplay: '8888',
name: 'Auto Loan',
balance: -801.15,
type: 'loan',
aggregationStatusCode: 0,
status: 'active',
customerId: '2493226',
institutionId: '200000',
balanceDate: 1722503718,
aggregationSuccessDate: 1722503720,
aggregationAttemptDate: 1722503720,
createdDate: 1722503705,
lastUpdatedDate: 1722539713,
currency: 'AUD',
lastTransactionDate: 1722503718,
institutionLoginId: 2340097,
displayPosition: 1,
financialinstitutionAccountStatus: 'OPEN',
accountNickname: 'Auto Loan',
marketSegment: 'personal',
displayName: 'Auto Loan 8888',
},
{
id: '15430030',
number: '2000005555',
accountNumberDisplay: '5555',
name: 'Home Mortgage',
balance: -801.15,
type: 'mortgage',
aggregationStatusCode: 0,
status: 'active',
customerId: '2493226',
institutionId: '200000',
balanceDate: 1722503718,
aggregationSuccessDate: 1722503720,
aggregationAttemptDate: 1722503720,
createdDate: 1722503705,
lastUpdatedDate: 1722539713,
currency: 'AUD',
lastTransactionDate: 1722503718,
institutionLoginId: 2340097,
detail: {
payoffAmount: 101.11,
principalBalance: 1021.21,
escrowBalance: 71.45,
interestRate: '1.65',
autoPayEnrolled: 'Y',
collateral: 'test collateral',
currentSchool: 'current school',
firstMortgage: 'N',
loanPaymentFreq: 'loan pay freq',
paymentMinAmount: 232,
originalSchool: 'original school',
recurringPaymentAmount: 232,
lender: 'lender',
availableBalanceAmount: 78.11,
endingBalanceAmount: 66.33,
loanTermType: 'loan term type',
paymentsMade: 4,
balloonAmount: 88.11,
projectedInterest: 54.22,
interestPaidLtd: 12.22,
interestRateType: 'interest rate type',
loanPaymentType: 'loan payment type',
paymentsRemaining: 88,
loanMinAmtDue: 250,
loanMinAmtDueDate: 1724587200,
},
displayPosition: 4,
financialinstitutionAccountStatus: 'OPEN',
accountNickname: 'Home Mortgage',
marketSegment: 'personal',
displayName: 'Home Mortgage 5555',
},
{
id: '15430031',
number: '2000004444',
accountNumberDisplay: '4444',
name: 'Roth IRA',
balance: 801.15,
type: 'investment',
aggregationStatusCode: 0,
status: 'active',
customerId: '2493226',
institutionId: '200000',
balanceDate: 1722503718,
aggregationSuccessDate: 1722503720,
aggregationAttemptDate: 1722503720,
createdDate: 1722503705,
lastUpdatedDate: 1722539713,
currency: 'AUD',
lastTransactionDate: 1722503718,
institutionLoginId: 2340097,
detail: {
marginAllowed: true,
cashAccountAllowed: true,
vestedBalance: 1250,
currentLoanBalance: 4500,
loanRate: 3,
},
displayPosition: 2,
financialinstitutionAccountStatus: 'OPEN',
accountNickname: 'Roth IRA',
marketSegment: 'personal',
displayName: 'Roth IRA 4444',
},
{
id: '15430035',
number: '1000001111',
realAccountNumberLast4: '1111',
accountNumberDisplay: '1111',
name: 'Transaction And Savings',
balance: 801.15,
type: 'transactionAndSavings',
aggregationStatusCode: 0,
status: 'active',
customerId: '2493226',
institutionId: '200000',
balanceDate: 1722503718,
aggregationSuccessDate: 1722503720,
aggregationAttemptDate: 1722503720,
createdDate: 1722503705,
lastUpdatedDate: 1722539713,
currency: 'AUD',
lastTransactionDate: 1722503718,
institutionLoginId: 2340097,
detail: {
availableBalanceAmount: 801.15,
periodInterestRate: '4.5',
openDate: 1639180800,
},
displayPosition: 3,
financialinstitutionAccountStatus: 'OPEN',
accountNickname: 'Transaction And Savings',
marketSegment: 'personal',
displayName: 'Transaction And Savings 1111',
},
],
currentAccount: {
id: '15430029',
number: '8000008888',
accountNumberDisplay: '8888',
name: 'Auto Loan',
balance: -801.15,
type: 'loan',
aggregationStatusCode: 0,
status: 'active',
customerId: '2493226',
institutionId: '200000',
balanceDate: 1722503718,
aggregationSuccessDate: 1722503720,
aggregationAttemptDate: 1722503720,
createdDate: 1722503705,
lastUpdatedDate: 1722539713,
currency: 'AUD',
lastTransactionDate: 1722503718,
institutionLoginId: 2340097,
displayPosition: 1,
financialinstitutionAccountStatus: 'OPEN',
accountNickname: 'Auto Loan',
marketSegment: 'personal',
displayName: 'Auto Loan 8888',
},
accountDisplayNames: [
'Auto Loan 8888',
'Home Mortgage 5555',
'Roth IRA 4444',
'Transaction And Savings 1111',
],
};
const body = undefined;
test('Should open snack bar when severity error', () => {
render(
(
<CurlCommand
product={product}
product={data.products[0]}
requestData={requestData}
body={body}
/>
) as React.ReactElement
);
Expand All @@ -237,9 +28,9 @@ describe('Testing curl command Component', () => {
render(
(
<CurlCommand
product={product}
requestData={requestData}
body={body}
product={data.products[0]}
requestData={{ ...requestData, token: null }}
body={JSON.stringify({ foo: ' bar' })}
/>
) as React.ReactElement
);
Expand Down
File renamed without changes.
Loading

0 comments on commit e80aead

Please sign in to comment.