Skip to content

Commit

Permalink
Merge pull request #15 from Mastercard/develop
Browse files Browse the repository at this point in the history
- Reference Application changes for the test cases coverage
  • Loading branch information
AshishChoureMA authored Sep 30, 2024
2 parents 7099fe2 + e80aead commit a831961
Show file tree
Hide file tree
Showing 17 changed files with 677 additions and 319 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia)

## Table of Contents

Expand All @@ -18,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 @@ -108,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 @@ -126,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
Loading

0 comments on commit a831961

Please sign in to comment.