Skip to content

Commit

Permalink
fix(EMS-3434-3435): no pdf - application submission - XLSX - eligibil…
Browse files Browse the repository at this point in the history
…ity, declarations copy (#2517)

* fix(EMS-3434-3435): no pdf - application submission - XLSX - eligibility, declarations copy

* fix(EMS-3434-3435): fix linting issues
  • Loading branch information
ttbarnes authored Jun 4, 2024
1 parent 55424cf commit 4036c84
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
23 changes: 14 additions & 9 deletions src/api/.keystone/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/api/content-strings/XLSX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { AMOUNT_250K, MORE_THAN_250K } = TOTAL_CONTRACT_VALUE;

const {
ACCOUNT: { FIRST_NAME, LAST_NAME },
DECLARATIONS: { AGREE_HOW_YOUR_DATA_WILL_BE_USED, HAS_ANTI_BRIBERY_CODE_OF_CONDUCT, WILL_EXPORT_WITH_CODE_OF_CONDUCT },
ELIGIBILITY: { BUYER_COUNTRY, COMPANIES_HOUSE_NUMBER, COVER_PERIOD, HAS_END_BUYER, HAS_MINIMUM_UK_GOODS_OR_SERVICES },
EXPORTER_BUSINESS: {
COMPANIES_HOUSE: { COMPANY_ADDRESS: EXPORTER_COMPANY_ADDRESS, COMPANY_SIC: EXPORTER_COMPANY_SIC },
Expand Down Expand Up @@ -58,6 +59,7 @@ export const XLSX = {
FIELDS: {
[FIRST_NAME]: 'Applicant first name',
[LAST_NAME]: 'Applicant last name',
[AGREE_HOW_YOUR_DATA_WILL_BE_USED]: 'How the data will be used',
APPLICANT_EMAIL_ADDRESS: 'Applicant email address',
APPLICANT_ROLE: 'Applicants role',
[BUYER_COUNTRY]: 'Where is your buyer based?',
Expand All @@ -68,8 +70,9 @@ export const XLSX = {
},
[COMPANIES_HOUSE_NUMBER]: 'Companies house number',
[COVER_PERIOD]: 'Length of cover',
[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT]: 'Does the exporter have a code of conduct?',
[HAS_END_BUYER]: 'Is there an end buyer?',
[HAS_MINIMUM_UK_GOODS_OR_SERVICES]: 'Is at least 20% of the contract value made up from UK goods or services',
[HAS_MINIMUM_UK_GOODS_OR_SERVICES]: 'Is at least 20% of the contract value made up from UK goods or services?',
[HAS_CREDIT_CONTROL]: 'Do you have a process for dealing with late payments',
[CONTRACT_COMPLETION_DATE]: 'Date expected for contract to complete',
[EXPORTER_COMPANY_ADDRESS]: 'Exporter registered office address',
Expand All @@ -78,7 +81,7 @@ export const XLSX = {
[DIFFERENT_TRADING_NAME]: 'Alternative trading name',
[TRADING_ADDRESS]: 'Different trading address?',
[FULL_ADDRESS_DOT_NOTATION]: 'Alternative trading address',
[MORE_THAN_250K.VALUE]: `Insured for more than ${formatCurrency(AMOUNT_250K, GBP_CURRENCY_CODE)}`,
[MORE_THAN_250K.VALUE]: `Contract value of ${formatCurrency(AMOUNT_250K, GBP_CURRENCY_CODE)} or more?`,
[WEBSITE]: 'Exporter Company website (optional)',
[PHONE_NUMBER]: 'Exporter UK telephone number (optional)',
[GOODS_OR_SERVICES]: 'Goods or services the business supplies',
Expand All @@ -102,6 +105,7 @@ export const XLSX = {
[OUTSTANDING_PAYMENTS]: 'Does the exporter currently have any outstanding or overdue payments from the buyer',
[PREVIOUS_CREDIT_INSURANCE_COVER_WITH_BUYER]: 'Exporter explaining the credit insurance cover they had on the buyer',
[TOTAL_OUTSTANDING_PAYMENTS]: 'Total outstanding payments',
[WILL_EXPORT_WITH_CODE_OF_CONDUCT]: 'Will the exporter export using their code of conduct?',
NO_FINANCIAL_YEAR_END_DATE: 'No data from Companies House',
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import mapYesNoField from '../helpers/map-yes-no-field';
import mapAgreedField from '../helpers/map-agreed-field';
import { mockApplication } from '../../../test-mocks';

const { FIELDS, SECTION_TITLES } = XLSX;

const {
DECLARATIONS: {
AGREE_CONFIDENTIALITY,
Expand All @@ -25,12 +27,12 @@ describe('api/generate-xlsx/map-application-to-xlsx/map-declarations', () => {
const { declaration } = mockApplication;

const expected = [
xlsxRow(XLSX.SECTION_TITLES.DECLARATIONS, ''),
xlsxRow(SECTION_TITLES.DECLARATIONS, ''),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIDENTIALITY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIDENTIALITY])),
xlsxRow(CONTENT_STRINGS[AGREE_ANTI_BRIBERY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_ANTI_BRIBERY])),
xlsxRow(CONTENT_STRINGS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT].SUMMARY.TITLE, mapYesNoField({ answer: declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT] })),
xlsxRow(CONTENT_STRINGS[WILL_EXPORT_WITH_CODE_OF_CONDUCT].SUMMARY.TITLE, mapYesNoField({ answer: declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT] })),
xlsxRow(CONTENT_STRINGS[AGREE_HOW_YOUR_DATA_WILL_BE_USED].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_HOW_YOUR_DATA_WILL_BE_USED])),
xlsxRow(String(FIELDS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT]), mapYesNoField(declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[WILL_EXPORT_WITH_CODE_OF_CONDUCT]), mapYesNoField(declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[AGREE_HOW_YOUR_DATA_WILL_BE_USED]), mapAgreedField(declaration[AGREE_HOW_YOUR_DATA_WILL_BE_USED])),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS])),
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import mapYesNoField from '../helpers/map-yes-no-field';
import mapAgreedField from '../helpers/map-agreed-field';
import { Application } from '../../../types';

const { FIELDS, SECTION_TITLES } = XLSX;

const {
DECLARATIONS: {
AGREE_CONFIDENTIALITY,
Expand All @@ -27,12 +29,12 @@ const mapDeclarations = (application: Application) => {
const { declaration } = application;

const mapped = [
xlsxRow(XLSX.SECTION_TITLES.DECLARATIONS, ''),
xlsxRow(SECTION_TITLES.DECLARATIONS, ''),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIDENTIALITY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIDENTIALITY])),
xlsxRow(CONTENT_STRINGS[AGREE_ANTI_BRIBERY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_ANTI_BRIBERY])),
xlsxRow(CONTENT_STRINGS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT].SUMMARY.TITLE, mapYesNoField({ answer: declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT] })),
xlsxRow(CONTENT_STRINGS[WILL_EXPORT_WITH_CODE_OF_CONDUCT].SUMMARY.TITLE, mapYesNoField({ answer: declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT] })),
xlsxRow(CONTENT_STRINGS[AGREE_HOW_YOUR_DATA_WILL_BE_USED].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_HOW_YOUR_DATA_WILL_BE_USED])),
xlsxRow(String(FIELDS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT]), mapYesNoField(declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[WILL_EXPORT_WITH_CODE_OF_CONDUCT]), mapYesNoField(declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[AGREE_HOW_YOUR_DATA_WILL_BE_USED]), mapAgreedField(declaration[AGREE_HOW_YOUR_DATA_WILL_BE_USED])),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS])),
];

Expand Down

0 comments on commit 4036c84

Please sign in to comment.