Skip to content

Commit

Permalink
fix: handle missing fsp during payment better AB#32262
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Dec 23, 2024
1 parent 0bfcd0e commit 402d17d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions services/121-service/src/payments/payments.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class PaymentsService {
programFinancialServiceProviderConfigurationName: string,
): Promise<string[]> {
const config =
await this.programFinancialServiceProviderConfigurationRepository.findOneOrFail(
await this.programFinancialServiceProviderConfigurationRepository.findOne(
{
where: {
name: Equal(programFinancialServiceProviderConfigurationName),
Expand All @@ -340,6 +340,14 @@ export class PaymentsService {
},
);

const errorMessages: string[] = [];
if (!config) {
errorMessages.push(
`Missing Program FSP configuration with name ${programFinancialServiceProviderConfigurationName}`,
);
return errorMessages;
}

const requiredConfigurations =
getFinancialServiceProviderConfigurationRequiredProperties(
config.financialServiceProviderName,
Expand All @@ -349,7 +357,6 @@ export class PaymentsService {
return [];
}

const errorMessages: string[] = [];
for (const requiredConfiguration of requiredConfigurations) {
const foundConfig = config.properties.find(
(c) => c.name === requiredConfiguration,
Expand Down

0 comments on commit 402d17d

Please sign in to comment.