Skip to content

Commit

Permalink
Excel FSP: multiple per program
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben authored and jannisvisser committed Oct 18, 2024
1 parent 8964eef commit f0928ee
Show file tree
Hide file tree
Showing 31 changed files with 694 additions and 345 deletions.
42 changes: 21 additions & 21 deletions e2e/test-registration-data/test-registrations-westeros-20.csv
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
referenceId,preferredLanguage,paymentAmountMultiplier,maxPayments,firstName,lastName,phoneNumber,fspName,whatsappPhoneNumber,addressStreet,addressHouseNumber,addressHouseNumberAddition,addressPostalCode,addressCity,house
00dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
01dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
02dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
03dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
04dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
05dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
06dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
07dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
08dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
09dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
10dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
11dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
12dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
13dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
14dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238876,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
15dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238856,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
16dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
17dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
18dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
19dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,Intersolve-visa,14155238886,Straat,1,A,1234AB,Den Haag,stark
referenceId,preferredLanguage,paymentAmountMultiplier,maxPayments,firstName,lastName,phoneNumber,programFinancialServiceProviderConfigurationName,whatsappPhoneNumber,addressStreet,addressHouseNumber,addressHouseNumberAddition,addressPostalCode,addressCity,house
00dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
01dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
02dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
03dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
04dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
05dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
06dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
07dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
08dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
09dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,ironBank,14155238886,Straat,1,A,1234AB,Den Haag,stark
10dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
11dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
12dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
13dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
14dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238876,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
15dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238856,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
16dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
17dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
18dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
19dc9451-1273-484c-b2e8-ae21b51a96ab,en,1,,Test,succeed,14155238886,gringotts,14155238886,Straat,1,A,1234AB,Den Haag,stark
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,34 @@ export class ExportFspInstructionsComponent implements OnChanges, OnInit {
.then(
(res) => {
this.isInProgress = false;
if (!res.data || res.data.length === 0) {
if (!res) {
actionResult(
this.alertController,
this.translate,
this.translate.instant('page.program.export-list.no-data'),
);
return;
}
const exportFileName = `payment#${this.payment}-fsp-instructions`;
for (const fspInstructionPerProgramFspConfig of res) {
const exportFileName = `payment#${this.payment}-${fspInstructionPerProgramFspConfig.fileNamePrefix}-fsp-instructions`;

if (res.fileType === ExportFileType.csv) {
downloadAsCsv(res.data, exportFileName);
}
if (res.fileType === ExportFileType.excel) {
downloadAsXlsx(res.data, exportFileName);
if (
fspInstructionPerProgramFspConfig.fileType === ExportFileType.csv
) {
downloadAsCsv(
fspInstructionPerProgramFspConfig.data,
exportFileName,
);
}
if (
fspInstructionPerProgramFspConfig.fileType ===
ExportFileType.excel
) {
downloadAsXlsx(
fspInstructionPerProgramFspConfig.data,
exportFileName,
);
}
}

this.updateSubHeader();
Expand Down
10 changes: 10 additions & 0 deletions services/121-service/package-lock.json

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

1 change: 1 addition & 0 deletions services/121-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"@types/cookie-parser": "^1.4.7",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.7",
"@types/multer": "^1.4.12",
"@types/node": "^18.19.50",
"@types/passport-azure-ad": "^4.3.6",
"@types/passport-jwt": "^4.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export const FinancialServiceProviderConfigurationMapping: {
FinancialServiceProviderConfigurationProperties.displayName,
FinancialServiceProviderConfigurationProperties.fundingTokenCode,
],
[FinancialServiceProviders.vodacash]: [
FinancialServiceProviderConfigurationProperties.displayName,
],
[FinancialServiceProviders.safaricom]: [
FinancialServiceProviderConfigurationProperties.displayName,
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export enum FinancialServiceProviderIntegrationType {
csv = 'csv',
api = 'api',
xml = 'xml',
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const FINANCIAL_SERVICE_PROVIDERS: FinancialServiceProviderDto[] = [
{
name: FinancialServiceProviders.excel,
integrationType: FinancialServiceProviderIntegrationType.csv,
hasReconciliation: false,
hasReconciliation: true,
defaultLabel: {
en: 'Excel Payment Instructions',
},
Expand Down Expand Up @@ -56,25 +56,6 @@ export const FINANCIAL_SERVICE_PROVIDERS: FinancialServiceProviderDto[] = [
},
],
},
{
name: FinancialServiceProviders.vodacash,
integrationType: FinancialServiceProviderIntegrationType.xml,
hasReconciliation: false,
defaultLabel: {
en: 'Vodacash',
},
notifyOnTransaction: false,
attributes: [
{
name: 'phoneNumber',
isRequired: true,
},
{
name: 'healthArea',
isRequired: true,
},
],
},
{
name: 'bank_a',
integrationType: FinancialServiceProviderIntegrationType.api,
Expand Down
5 changes: 3 additions & 2 deletions services/121-service/src/payments/dto/fsp-instructions.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { ExcelFspInstructions } from '@121-service/src/payments/fsp-integration/
export type CsvInstructions = ExcelFspInstructions[];

export class FspInstructions {
public data?: CsvInstructions | string;
public fileType?: ExportFileType;
public data: CsvInstructions | string;
public fileType: ExportFileType;
public fileNamePrefix: string;
}

export enum ExportFileType {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ApiProperty } from '@nestjs/swagger';

import { ReconciliationFeedbackDto } from '@121-service/src/payments/dto/reconciliation-feedback.dto';
import { AggregateImportResultDto } from '@121-service/src/registration/dto/bulk-import.dto';

export class ImportReconciliationResponseDto {
@ApiProperty({
type: [ReconciliationFeedbackDto],
description: 'The import result',
})
importResult: ReconciliationFeedbackDto[];

@ApiProperty({
type: AggregateImportResultDto,
description: 'The aggregate import result',
})
aggregateImportResult: AggregateImportResultDto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ApiProperty } from '@nestjs/swagger';

import { ImportStatus } from '@121-service/src/registration/dto/bulk-import.dto';
import { StatusEnum } from '@121-service/src/shared/enum/status.enum';

export class ReconciliationFeedbackDto {
@ApiProperty({ example: '1234', description: 'The reference ID' })
referenceId?: string | null;

@ApiProperty({
example: StatusEnum.success,
enum: StatusEnum,
})
status?: StatusEnum | null;

@ApiProperty({ example: 'Success', description: 'The message' })
message?: string | null;

@ApiProperty({
example: ImportStatus.imported,
enum: ImportStatus,
})
importStatus: ImportStatus;

[key: string]: string | undefined | null | ImportStatus;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
export class ExcelFspInstructions {
public amount: number;
interface KnownProperties {
amount: number;
id: number;
referenceId: string;
}

export class ExcelReconciliationDto {
public id: number;
public referenceId: string;
public amount: number;
// columnToMatch field is added dynamically based on program fsp configuration
// Allow dynamic fields based on program FSP configuration
[key: string]: string | number;
}
type UnknownProperties = Record<string, string | undefined | number | null>;

interface ExcelFspInstructions extends KnownProperties, UnknownProperties {}

export { ExcelFspInstructions };
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@ import { TypeOrmModule } from '@nestjs/typeorm';
import { LookupService } from '@121-service/src/notifications/lookup/lookup.service';
import { ExcelService } from '@121-service/src/payments/fsp-integration/excel/excel.service';
import { TransactionsModule } from '@121-service/src/payments/transactions/transactions.module';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationRepository } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configurations.repository';
import { ProgramEntity } from '@121-service/src/programs/program.entity';
import { RegistrationsModule } from '@121-service/src/registration/registrations.module';

@Module({
imports: [
HttpModule,
TypeOrmModule.forFeature([ProgramEntity]),
TypeOrmModule.forFeature([
ProgramEntity,
ProgramFinancialServiceProviderConfigurationEntity,
]),
TransactionsModule,
RegistrationsModule,
],
providers: [ExcelService, LookupService],
providers: [
ExcelService,
LookupService,
ProgramFinancialServiceProviderConfigurationRepository,
],
controllers: [],
exports: [ExcelService],
})
Expand Down
Loading

0 comments on commit f0928ee

Please sign in to comment.