mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 19:30:57 +00:00
UAT fixes and enhancements
This commit is contained in:
@@ -24,6 +24,14 @@ type IamUserRow = {
|
||||
verified_by: string | null;
|
||||
};
|
||||
|
||||
function resolvePreferredCurrency(nationality: string | null | undefined, faydaVerified: boolean): string {
|
||||
if (faydaVerified) return 'ETB';
|
||||
const n = (nationality ?? '').toLowerCase();
|
||||
if (n.includes('ethiopi')) return 'ETB';
|
||||
if (n.includes('djibout')) return 'DJF';
|
||||
return 'USD';
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class PassengerAuthService {
|
||||
private readonly logger = new Logger(PassengerAuthService.name);
|
||||
@@ -250,6 +258,8 @@ export class PassengerAuthService {
|
||||
|
||||
if (!passenger) throw new Error('Passenger not found');
|
||||
const iam = iamRows[0];
|
||||
const faydaVerified = iam?.verified_by === 'fayda';
|
||||
const nationality = iam?.metadata?.nationality ?? null;
|
||||
|
||||
return {
|
||||
iamUserId,
|
||||
@@ -259,7 +269,9 @@ export class PassengerAuthService {
|
||||
email: iam?.email ?? null,
|
||||
phone: iam?.phone_number ?? null,
|
||||
fullName: iam?.name?.en ?? iam?.name?.am ?? null,
|
||||
faydaVerified: iam?.verified_by === 'fayda',
|
||||
nationality,
|
||||
faydaVerified,
|
||||
preferredCurrency: resolvePreferredCurrency(nationality, faydaVerified),
|
||||
createdAt: passenger.createdAt,
|
||||
passenger: {
|
||||
id: passenger.id,
|
||||
|
||||
Reference in New Issue
Block a user