mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
Passenger portal and api updates
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
import { Body, Controller, Post, Get, Query } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiQuery, ApiResponse } from '@nestjs/swagger';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { FareEngineService } from './fare-engine.service';
|
||||
import { FareCalculateDto, FareBreakdownDto } from './fare-engine.dto';
|
||||
import { FaydaConfig } from '../../config/fayda.config';
|
||||
|
||||
@ApiTags('Fare Engine')
|
||||
@Controller('fare-engine')
|
||||
export class FareEngineController {
|
||||
constructor(private service: FareEngineService) {}
|
||||
constructor(
|
||||
private service: FareEngineService,
|
||||
private configService: ConfigService,
|
||||
) {}
|
||||
|
||||
@Post('calculate')
|
||||
@ApiOperation({
|
||||
@@ -63,3 +68,36 @@ Returns a full breakdown including a human-readable calculation trace.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiTags('Config')
|
||||
@Controller('config')
|
||||
export class ConfigController {
|
||||
constructor(private configService: ConfigService) {}
|
||||
|
||||
@Get('fayda-status')
|
||||
@ApiOperation({
|
||||
summary: 'Check Verifayda 2.0 configuration status',
|
||||
description: 'Returns whether Verifayda integration is enabled and ready to use'
|
||||
})
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Verifayda status retrieved successfully',
|
||||
schema: {
|
||||
example: {
|
||||
enabled: true,
|
||||
mode: 'production',
|
||||
apiUrl: 'https://api.verifayda.gov.et/v2'
|
||||
}
|
||||
}
|
||||
})
|
||||
getFaydaStatus() {
|
||||
const faydaConfig = this.configService.get<FaydaConfig>('fayda');
|
||||
const verifaydaEnabled = this.configService.get<boolean>('VERIFAYDA_ENABLED', false);
|
||||
|
||||
return {
|
||||
enabled: faydaConfig?.enabled || verifaydaEnabled,
|
||||
mode: verifaydaEnabled ? 'production' : 'development',
|
||||
apiUrl: this.configService.get<string>('VERIFAYDA_API_URL', 'https://api.verifayda.gov.et/v2'),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user