Skip to content

Commit

Permalink
Update integration logic (#38)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Sundberg <[email protected]>
  • Loading branch information
seansund authored Sep 20, 2023
1 parent c582439 commit 355bd22
Show file tree
Hide file tree
Showing 17 changed files with 497 additions and 261 deletions.
3 changes: 3 additions & 0 deletions src/components/CustomerRisk/CustomerRisk.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.craTitle {
font-weight: bold;
}
33 changes: 33 additions & 0 deletions src/components/CustomerRisk/CustomerRisk.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import React from 'react';

import './CustomerRisk.scss';
import {CustomerRiskAssessmentModel} from "../../models";

export interface CustomerRiskProps {
customerRisk?: CustomerRiskAssessmentModel
}

export const CustomerRisk: React.FunctionComponent<CustomerRiskProps> = (props: CustomerRiskProps) => {

const getContent = (): string => {
if (!props.customerRisk) {
return 'Pending'
}

if (props.customerRisk.error) {
return 'Error'
}

return `${props.customerRisk.rating} - ${props.customerRisk.score}`
}

return (
<div style={{width: '100%', textAlign: 'left'}}>
<div className="craTitle">Customer risk</div>
<div>{getContent()}</div>
</div>
)
}
1 change: 1 addition & 0 deletions src/components/CustomerRisk/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './CustomerRisk';
4 changes: 4 additions & 0 deletions src/components/KycSummary/KycSummary.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

.kycSummaryTitle {
font-weight: bold;
}
33 changes: 33 additions & 0 deletions src/components/KycSummary/KycSummary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import React from 'react';

import './KycSummary.scss';
import {KycCaseSummaryModel} from "../../models";

export interface KycSummaryProps {
kycSummary: KycCaseSummaryModel;
}

export const KycSummary: React.FunctionComponent<KycSummaryProps> = (props: KycSummaryProps) => {

const getContent = (): string => {
if (!props.kycSummary) {
return 'Pending'
}

if (props.kycSummary.error) {
return 'Error'
}

return props.kycSummary.summary || '--'
}

return (
<div style={{width: '100%', textAlign: 'left'}}>
<div className="kycSummaryTitle">KYC Summary</div>
<div>{getContent()}</div>
</div>
)
}
2 changes: 2 additions & 0 deletions src/components/KycSummary/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export * from './KycSummary';
4 changes: 4 additions & 0 deletions src/components/NegativeNews/NegativeNews.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

.negNewsTitle {
font-weight: bold;
}
34 changes: 34 additions & 0 deletions src/components/NegativeNews/NegativeNews.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import React from 'react';

import './NegativeNews.scss';
import {NegativeScreeningModel} from "../../models";

export interface NegativeNewsProps {
type: string;
news?: NegativeScreeningModel;
}

export const NegativeNews: React.FunctionComponent<NegativeNewsProps> = (props: NegativeNewsProps) => {

const getContent = (): string => {
if (!props.news) {
return 'Pending'
}

if (props.news.error) {
return 'Error'
}

return props.news.result || '--'
}

return (
<div style={{width: '100%', textAlign: 'left'}}>
<div className="negNewsTitle">Negative news - {props.type}</div>
<div>{getContent()}</div>
</div>
)
}
2 changes: 2 additions & 0 deletions src/components/NegativeNews/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export * from './NegativeNews';
3 changes: 3 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ export * from './CountrySelect'
export * from './EntityTypeSelect'
export * from './IndustryTypeSelect'
export * from './AtomSelect'
export * from './CustomerRisk'
export * from './NegativeNews'
export * from './KycSummary'
8 changes: 4 additions & 4 deletions src/models/kyc-case.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export interface DocumentInputModel {
export const createEmptyCustomer = (): CustomerModel => {
return {
name: '',
countryOfResidence: 'US',
countryOfResidence: 'United States',
personalIdentificationNumber: '',
industryType: '',
entityType: '',
industryType: 'Private Limited Company',
entityType: 'Growing of rice',
}
}

Expand All @@ -119,7 +119,7 @@ export const createEmptyReviewCase = (id: string): ReviewCaseModel => {
id,
counterparty: {
name: '',
countryOfResidence: 'US'
countryOfResidence: 'United States'
},
customerOutreach: '',
documents: []
Expand Down
2 changes: 1 addition & 1 deletion src/services/menu-options/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {MenuOptionsMock} from "./menu-options.mock.ts";
import {MenuOptionsMock} from "./menu-options.mock";

export * from './menu-options.api';

Expand Down
2 changes: 2 additions & 0 deletions src/services/menu-options/menu-options.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ import {FormOptionModel} from "../../models";

export abstract class MenuOptionsApi {
abstract getCountryList(): Promise<FormOptionModel[]>;
abstract getIndustries(): Promise<FormOptionModel[]>;
abstract getEntityTypes(): Promise<FormOptionModel[]>;
}
63 changes: 63 additions & 0 deletions src/services/menu-options/menu-options.graphql.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {ApolloClient, gql} from "@apollo/client";

import {MenuOptionsApi} from "./menu-options.api";
import {getApolloClient} from "../../backends";
import {FormOptionModel} from "../../models";

const LIST_COUNTRIES = gql`
query ListCountries {
listCountries {
text
value
}
}
`
const LIST_ENTITY_TYPES = gql`
query ListEntityTypes {
listEntityTypes {
text
value
}
}
`
const LIST_INDUSTRY_TYPES = gql`
query ListIndustryTypes {
listIndustryTypes {
text
value
}
}
`

export class MenuOptionsGraphql implements MenuOptionsApi {
client: ApolloClient<unknown>;

constructor() {
this.client = getApolloClient();
}

getCountryList(): Promise<FormOptionModel[]> {
return this.client
.query<{listCountries: FormOptionModel[]}>({
query: LIST_COUNTRIES,
})
.then(result => result.data.listCountries)
}

getEntityTypes(): Promise<FormOptionModel[]> {
return this.client
.query<{listEntityTypes: FormOptionModel[]}>({
query: LIST_ENTITY_TYPES,
})
.then(result => result.data.listEntityTypes)
}

getIndustries(): Promise<FormOptionModel[]> {
return this.client
.query<{listIndustryTypes: FormOptionModel[]}>({
query: LIST_INDUSTRY_TYPES,
})
.then(result => result.data.listIndustryTypes)
}

}
Loading

0 comments on commit 355bd22

Please sign in to comment.