Skip to content

Commit

Permalink
Some initial refactor and draft code
Browse files Browse the repository at this point in the history
Add code framework for endpoints

Get endpoint implementation done

WIP implement post endpoint
  • Loading branch information
diderikvw committed Oct 24, 2024
1 parent 17471ae commit 79634ab
Show file tree
Hide file tree
Showing 25 changed files with 215 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { IntersolveVisaParentWalletEntity } from '@121-service/src/payments/fsp-
import { IntersolveVisaWalletEntity } from '@121-service/src/payments/fsp-integration/intersolve-visa/entities/intersolve-visa-wallet.entity';
import { IntersolveBlockTokenReasonCodeEnum } from '@121-service/src/payments/fsp-integration/intersolve-visa/enums/intersolve-block-token-reason-code.enum';
import { IntersolveVisaTokenStatus } from '@121-service/src/payments/fsp-integration/intersolve-visa/enums/intersolve-visa-token-status.enum';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';
import { CustomHttpService } from '@121-service/src/shared/services/custom-http.service';

const intersolveVisaApiUrl = process.env.MOCK_INTERSOLVE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { PaymentProcessorCommercialBankEthiopia } from '@121-service/src/payment
import { RedisModule } from '@121-service/src/payments/redis/redis.module';
import { TransactionEntity } from '@121-service/src/payments/transactions/transaction.entity';
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 { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';
import { ProgramEntity } from '@121-service/src/programs/program.entity';
import { RegistrationEntity } from '@121-service/src/registration/registration.entity';
import { QueueNamePayment } from '@121-service/src/shared/enum/queue-process.names.enum';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
} from '@121-service/src/payments/redis/redis-client';
import { TransactionEntity } from '@121-service/src/payments/transactions/transaction.entity';
import { TransactionsService } from '@121-service/src/payments/transactions/transactions.service';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';
import { ProgramEntity } from '@121-service/src/programs/program.entity';
import { RegistrationEntity } from '@121-service/src/registration/registration.entity';
import { ScopedRepository } from '@121-service/src/scoped.repository';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ImageCodeModule } from '@121-service/src/payments/imagecode/image-code.
import { RedisModule } from '@121-service/src/payments/redis/redis.module';
import { TransactionEntity } from '@121-service/src/payments/transactions/transaction.entity';
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 { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { IntersolveIssueVoucherRequestEntity } from '@121-service/src/payments/f
import { IntersolveVoucherEntity } from '@121-service/src/payments/fsp-integration/intersolve-voucher/intersolve-voucher.entity';
import { IntersolveVoucherService } from '@121-service/src/payments/fsp-integration/intersolve-voucher/intersolve-voucher.service';
import { TransactionEntity } from '@121-service/src/payments/transactions/transaction.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';
import { ProgramEntity } from '@121-service/src/programs/program.entity';
import { CustomDataAttributes } from '@121-service/src/registration/enum/custom-data-attributes';
import { RegistrationDataService } from '@121-service/src/registration/modules/registration-data/registration-data.service';
Expand Down
2 changes: 1 addition & 1 deletion services/121-service/src/payments/payments.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { PaymentReturnDto } from '@121-service/src/payments/transactions/dto/get-transaction.dto';
import { TransactionEntity } from '@121-service/src/payments/transactions/transaction.entity';
import { TransactionsService } from '@121-service/src/payments/transactions/transactions.service';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { LatestTransactionEntity } from '@121-service/src/payments/transactions/
import { ProgramEntity } from '@121-service/src/programs/program.entity';
import { RegistrationEntity } from '@121-service/src/registration/registration.entity';
import { UserEntity } from '@121-service/src/user/user.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';

@Entity('transaction')
export class TransactionEntity extends Base121AuditedEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LatestTransactionRepository } from '@121-service/src/payments/transacti
import { TransactionEntity } from '@121-service/src/payments/transactions/transaction.entity';
import { TransactionsController } from '@121-service/src/payments/transactions/transactions.controller';
import { TransactionsService } from '@121-service/src/payments/transactions/transactions.service';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';
import { ProgramEntity } from '@121-service/src/programs/program.entity';
import { RegistrationUtilsModule } from '@121-service/src/registration/modules/registration-utilts/registration-utils.module';
import { RegistrationScopedRepository } from '@121-service/src/registration/repositories/registration-scoped.repository';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {
FinancialServiceProviderConfigurationEnum,
FinancialServiceProviderName,
} from '@121-service/src/financial-service-providers/enum/financial-service-provider-name.enum';
import { LocalizedString } from '@121-service/src/shared/types/localized-string.type';
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString } from 'class-validator';

export class CreateProgramFinancialServiceProviderConfigurationDto {
// TODO: Do we accept spaces in the name? Any other naming criteria? Special characters? All lowercase?
@ApiProperty({ example: 'VisaDebitCards' })
@IsNotEmpty()
@IsString()
public readonly name: string;

@ApiProperty({
example: {
en: 'Visa Debit Cards',
nl: 'Visa-betaalkaarten',
},
})
@IsNotEmpty()
public readonly label: LocalizedString;

@ApiProperty({
enum: FinancialServiceProviderName,
type: 'enum',
example: FinancialServiceProviderName.intersolveVoucherWhatsapp,
})
@IsNotEmpty()
public readonly financialServiceProviderName: FinancialServiceProviderName;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { ApiProperty } from '@nestjs/swagger';

export class ProgramFinancialServiceProviderConfigurationReturnDto {
@ApiProperty({ example: 1, type: 'number' })
public programId: number;
public readonly programId: number;

@ApiProperty({ enum: FinancialServiceProviderName, type: 'enum' })
public financialServiceProviderName: FinancialServiceProviderName;
public readonly financialServiceProviderName: FinancialServiceProviderName;

@ApiProperty({ example: 'FSP Name', type: 'string' })
public name: string;
public readonly name: string;

@ApiProperty({ type: 'object' })
public label: LocalizedString;
public readonly label: LocalizedString;

@ApiProperty({ type: 'object' })
public financialServiceProvider: FinancialServiceProviderDto;
public readonly financialServiceProvider: FinancialServiceProviderDto;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CascadeDeleteEntity } from '@121-service/src/base.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';
import { isObject } from 'lodash';
import {
Column,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CascadeDeleteEntity } from '@121-service/src/base.entity';
import { FinancialServiceProviderName } from '@121-service/src/financial-service-providers/enum/financial-service-provider-name.enum';
import { TransactionEntity } from '@121-service/src/payments/transactions/transaction.entity';
import { ProgramFinancialServiceProviderConfigurationPropertyEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration-property.entity';
import { ProgramFinancialServiceProviderConfigurationPropertyEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration-property.entity';
import { ProgramEntity } from '@121-service/src/programs/program.entity';
import { LocalizedString } from '@121-service/src/shared/types/localized-string.type';
import {
Expand All @@ -14,6 +14,7 @@ import {
Unique,
} from 'typeorm';

// TODO: REFACTOR: Rename database table to program_financial_service_provider_configuration
@Unique('programFspConfigurationUnique', ['programId', 'name'])
@Entity('program_fsp_configuration')
export class ProgramFinancialServiceProviderConfigurationEntity extends CascadeDeleteEntity {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FINANCIAL_SERVICE_PROVIDERS } from '@121-service/src/financial-service-providers/financial-service-providers.const';
import { ProgramFinancialServiceProviderConfigurationReturnDto } from '@121-service/src/program-financial-service-provider-configurations/dtos/program-financial-service-provider-configuration-return.dto';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/program-financial-service-provider-configuration.entity';
import { ProgramFinancialServiceProviderConfigurationEntity } from '@121-service/src/program-financial-service-provider-configurations/entities/program-financial-service-provider-configuration.entity';

export class ProgramFinancialServiceProviderConfigurationDtoMapper {
public static mapListOfEntitiesToListOfDtos(
Expand Down
Loading

0 comments on commit 79634ab

Please sign in to comment.