@@ -35,6 +35,9 @@ import { generateKycManualReviewRuntimeAndToken } from './workflows/runtime/gene
3535import { generateInitialCollectionFlowExample } from './workflows/runtime/generate-initial-collection-flow-example' ;
3636import { uiKybParentWithAssociatedCompanies } from './workflows/ui-definition/kyb-with-associated-companies/ui-kyb-parent-dynamic-example' ;
3737import { generateWebsiteMonitoringExample } from './workflows/website-monitoring-workflow' ;
38+ import { CustomerService } from '@/customer/customer.service' ;
39+ import { NestFactory } from '@nestjs/core' ;
40+ import { AppModule } from '@/app.module' ;
3841
3942const BCRYPT_SALT : string | number = 10 ;
4043
@@ -69,14 +72,14 @@ function generateAvatarImageUri(imageTemplate: string, countOfBusiness: number,
6972}
7073
7174async function createCustomer (
72- client : PrismaClient ,
75+ customerService : CustomerService ,
7376 id : string ,
7477 apiKey : string ,
7578 logoImageUri : string ,
7679 faviconImageUri : string ,
7780 webhookSharedSecret : string ,
7881) {
79- return client . customer . create ( {
82+ return customerService . create ( {
8083 data : {
8184 id : `customer-${ id } ` ,
8285 name : `customer-${ id } ` ,
@@ -93,9 +96,28 @@ async function createCustomer(
9396 faviconImageUri,
9497 country : 'GB' ,
9598 language : 'en' ,
96- config : {
97- isMerchantMonitoringEnabled : true ,
98- isExample : true ,
99+ config : { isDemo : true , withQualityControl : true , isMerchantMonitoringEnabled : true } ,
100+ features : {
101+ createBusinessReport : {
102+ enabled : true ,
103+ options : { type : 'MERCHANT_REPORT_T1' , version : '2' } ,
104+ } ,
105+ createBusinessReportBatch : {
106+ enabled : true ,
107+ options : { type : 'MERCHANT_REPORT_T1' , version : '2' } ,
108+ } ,
109+ ONGOING_MERCHANT_REPORT : {
110+ name : 'ONGOING_MERCHANT_REPORT' ,
111+ enabled : true ,
112+ options : {
113+ reportType : 'ONGOING_MERCHANT_REPORT_T1' ,
114+ runByDefault : true ,
115+ scheduleType : 'interval' ,
116+ intervalInDays : 30 ,
117+ proxyViaCountry : 'GB' ,
118+ workflowVersion : '2' ,
119+ } ,
120+ } ,
99121 } ,
100122 } ,
101123 } ) ;
@@ -120,10 +142,16 @@ const DEFAULT_TOKENS = {
120142
121143async function seed ( ) {
122144 console . info ( 'Seeding database...' ) ;
145+ const app = await NestFactory . createApplicationContext ( AppModule , { logger : false } ) ;
146+
147+ app . enableShutdownHooks ( ) ;
148+
149+ const customerService = app . get ( CustomerService ) ;
150+
123151 const client = new PrismaClient ( ) ;
124152 await generateDynamicDefinitionForE2eTest ( client ) ;
125153 const customer = ( await createCustomer (
126- client ,
154+ customerService ,
127155 '1' ,
128156 env . API_KEY ,
129157 'https://cdn.ballerine.io/images/ballerine_logo.svg' ,
@@ -132,7 +160,7 @@ async function seed() {
132160 ) ) as Customer ;
133161
134162 const customer2 = ( await createCustomer (
135- client ,
163+ customerService ,
136164 '2' ,
137165 `${ env . API_KEY } 2` ,
138166 'https://cdn.ballerine.io/images/ballerine_logo.svg' ,
@@ -1044,6 +1072,8 @@ async function seed() {
10441072 token : DEFAULT_TOKENS . KYC ,
10451073 } ) ;
10461074
1075+ await app . close ( ) ;
1076+
10471077 console . info ( 'Seeded database successfully' ) ;
10481078}
10491079async function createUsers ( { project1, project2 } : any , client : PrismaClient ) {
0 commit comments