Skip to content

Commit

Permalink
Added filename to funds-in-out API calls (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayg10 authored Feb 21, 2022
1 parent f575a35 commit 0bcae00
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
11 changes: 10 additions & 1 deletion docs/external-api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## External API

`reporting-hub-bop-settlements-ui` is reliant on two mojaloop services.
`reporting-hub-bop-settlements-ui` is reliant on three mojaloop services.
When running locally, you can use the environment variables
`CENTRAL_SETTLEMENTS_ENDPOINT`, `CENTRAL_LEDGER_ENDPOINT` and `REPORTING_API_ENDPOINT`
in `.env` to specify the location of the api services.
Expand All @@ -13,3 +13,12 @@ NOTE: These endpoints are a stopgap. In the future these environment variables
for the Settlements microfrontend instead of calling Mojaloop services directly.

For more information's on React variables check [here](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables).


## Port forwarding
If you want connect to the live services deployed in K8S, you can port forward the services using the following commands.
```
kubectl port-forward -n mojaloop service/moja-centralledger-service 3001:80 &
kubectl port-forward -n mojaloop service/moja-centralsettlement-service 3007:80 &
kubectl port-forward -n mojaloop service/bof-reporting-hub-bop-api-svc 3080:80 &
```
1 change: 0 additions & 1 deletion src/App/DFSPs/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function* fetchDfsps() {
variables: {},
},
});
console.log(response);
yield put(setDfsps(response.data.data.dfsps));
} catch (e) {
yield put(setDfspsError(e.message));
Expand Down
1 change: 1 addition & 0 deletions src/App/Settlements/SettlementFinalizingModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const SettlementFinalizingModal: FC<SettlementFinalizingModalProps> = ({
signal.addEventListener('abort', () => reject(new Error('aborted')));
readFileAsArrayBuffer(file)
.then((fileBuf) => deserializeReport(fileBuf))
.then((report) => ({ ...report, reportFileName: file.name }))
.then(resolve, reject);
})
.catch((err) => {
Expand Down
7 changes: 5 additions & 2 deletions src/App/Settlements/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ function* processAdjustments({
// One partial resolution to this problem might be to process the NDC updates serially and
// perform all other processing concurrently. At the time of writing, modifying the following
// (working) code to do so was not considered a priority.

// @ts-ignore
const report: SettlementReport = yield select(getSettlementReport);
const results: FinalizeSettlementProcessAdjustmentsError[] = [];
for (let i = 0; i < adjustments.length; i++) {
const adjustment = adjustments[i];
Expand Down Expand Up @@ -188,7 +191,7 @@ function* processAdjustments({
participantName: adjustment.participant.name,
accountId: adjustment.settlementAccount.id,
body: {
externalReference: description,
externalReference: report?.reportFileName,
action: 'recordFundsIn',
reason: description,
amount: {
Expand Down Expand Up @@ -219,7 +222,7 @@ function* processAdjustments({
participantName: adjustment.participant.name,
accountId: adjustment.settlementAccount.id,
body: {
externalReference: description,
externalReference: report?.reportFileName,
action: 'recordFundsOutPrepareReserve',
reason: description,
amount: {
Expand Down
1 change: 1 addition & 0 deletions src/App/Settlements/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ export interface SettlementReportEntry {
export interface SettlementReport {
settlementId: SettlementId;
entries: SettlementReportEntry[];
reportFileName?: string;
}

export enum DateRanges {
Expand Down
9 changes: 5 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const config = {
const { ModuleFederationPlugin } = webpack.container;

module.exports = {
// mode: "development",
// Class names are needed for integration testing of the production build
// `testcafe-react-selector` needs these classnames to be present
optimization: {
Expand All @@ -35,7 +36,7 @@ module.exports = {
],
},
entry: './src/index',
devtool: 'cheap-module-source-map',
devtool: 'source-map',
devServer: {
disableHostCheck: true,
// Enable gzip compression of generated files.
Expand Down Expand Up @@ -66,21 +67,21 @@ module.exports = {
'/central-settlements': {
// For local testing update `target` to point to your
// locally hosted or port-forwarded `central-settlements` service
target: 'http://host:port',
target: 'http://localhost:3007',
pathRewrite: { '^/central-settlements': '/v2' },
secure: false,
},
'/central-ledger': {
// For local testing update `target` to point to your
// locally hosted or port-forwarded `central-ledger` service
target: 'http://host:port',
target: 'http://localhost:3001',
pathRewrite: { '^/central-ledger': '' },
secure: false,
},
'/reporting-api': {
// For local testing update `target` to point to your
// locally hosted or port-forwarded `reporting-hub-bop-api-svc` service
target: 'http://localhost:port',
target: 'http://localhost:3080',
pathRewrite: { '^/reporting-api': '' },
secure: false,
},
Expand Down

0 comments on commit 0bcae00

Please sign in to comment.