@@ -9,9 +9,9 @@ import { JobRepository } from '@/server/repositories/JobRepository';
99import { VerifiedCredentialRepository } from '@/server/repositories/VerifiedCredentialRepository' ;
1010import {
1111 applicationCreateSchema ,
12+ applicationExtrasSchema ,
1213 applicationIdSchema ,
1314 applicationVerificationSchema ,
14- applicationExtrasSchema ,
1515} from '@/server/schemas/application' ;
1616
1717import { IssuerService } from './IssuerService' ;
@@ -65,7 +65,7 @@ export class ApplicationService {
6565 const initVerificationResponse = await this . verifier . initVerification (
6666 application . getId ( ) ,
6767 newRequesParamsFor . sameDeviceFlow ,
68- 'PID' ,
68+ [ 'PID' ] ,
6969 ) ;
7070
7171 // Create PENDING VerifiedCredential record for PID
@@ -128,7 +128,9 @@ export class ApplicationService {
128128 const extrasCredentials = await this . verifiedCredentialRepo . findByApplicationId ( applicationId ) ;
129129 const extrasCredential = extrasCredentials . find (
130130 ( c ) =>
131- ( c . credentialType === 'DIPLOMA' || c . credentialType === 'SEAFARER' ) &&
131+ ( c . credentialType === 'DIPLOMA' ||
132+ c . credentialType === 'SEAFARER' ||
133+ c . credentialType === 'TAXRESIDENCY' ) &&
132134 c . status === 'PENDING' ,
133135 ) ;
134136
@@ -264,7 +266,7 @@ export class ApplicationService {
264266 @ValidateInput ( applicationExtrasSchema )
265267 public async requestAdditionalCredentials ( data : {
266268 applicationId : string ;
267- credentialType : 'DIPLOMA' | 'SEAFARER' | 'BOTH' ;
269+ credentialType : CredentialType [ ] ;
268270 sameDeviceFlow : boolean ;
269271 } ) : Promise < { url : string } > {
270272 const { applicationId, credentialType, sameDeviceFlow } = data ;
@@ -289,20 +291,31 @@ export class ApplicationService {
289291 // Create PENDING VerifiedCredential records for requested credentials
290292 const credentialsToCreate : Array < { type : CredentialType ; namespace : string } > = [ ] ;
291293
292- if ( credentialType === 'DIPLOMA' || credentialType === 'BOTH' ) {
294+ console . log ( credentialType ) ;
295+
296+ if ( credentialType . includes ( 'DIPLOMA' ) ) {
293297 credentialsToCreate . push ( {
294298 type : 'DIPLOMA' ,
295299 namespace : 'urn:eu.europa.ec.eudi:diploma:1:1' ,
296300 } ) ;
297301 }
298302
299- if ( credentialType === 'SEAFARER' || credentialType === 'BOTH' ) {
303+ if ( credentialType . includes ( 'SEAFARER' ) ) {
300304 credentialsToCreate . push ( {
301305 type : 'SEAFARER' ,
302306 namespace : 'eu.europa.ec.eudi.seafarer.1' ,
303307 } ) ;
304308 }
305309
310+ if ( credentialType . includes ( 'TAXRESIDENCY' ) ) {
311+ credentialsToCreate . push ( {
312+ type : 'TAXRESIDENCY' ,
313+ namespace : 'urn:eu.europa.ec.eudi:tax:1:1' ,
314+ } ) ;
315+ }
316+
317+ console . log ( credentialsToCreate ) ;
318+
306319 // Create PENDING records for each credential
307320 for ( const { type, namespace } of credentialsToCreate ) {
308321 await this . verifiedCredentialRepo . create ( {
@@ -334,7 +347,9 @@ export class ApplicationService {
334347 const extrasCredentials = await this . verifiedCredentialRepo . findByApplicationId ( applicationId ) ;
335348 const extrasCredential = extrasCredentials . find (
336349 ( c ) =>
337- ( c . credentialType === 'DIPLOMA' || c . credentialType === 'SEAFARER' ) &&
350+ ( c . credentialType === 'DIPLOMA' ||
351+ c . credentialType === 'SEAFARER' ||
352+ c . credentialType === 'TAXRESIDENCY' ) &&
338353 c . status === 'PENDING' ,
339354 ) ;
340355
0 commit comments