@@ -84,22 +84,30 @@ export async function setupNewUser(user: { id: string; email: string; name: stri
8484
8585 logger . info ( { orgId, orgName, email : user . email } , 'created default organization' ) ;
8686
87- const credited = await creditInternalWallet (
88- orgId ,
89- WELCOME_BONUS_CENTS ,
90- 'Welcome bonus - $5 promotional balance' ,
91- `welcome_bonus_${ user . id } ` ,
92- ) ;
93- if ( credited ) {
94- logger . info ( { orgId, userId : user . id , amountCents : WELCOME_BONUS_CENTS } , 'welcome bonus credited' ) ;
87+ try {
88+ const credited = await creditInternalWallet (
89+ orgId ,
90+ WELCOME_BONUS_CENTS ,
91+ 'Welcome bonus - $5 promotional balance' ,
92+ `welcome_bonus_${ user . id } ` ,
93+ ) ;
94+ if ( credited ) {
95+ logger . info ( { orgId, userId : user . id , amountCents : WELCOME_BONUS_CENTS } , 'welcome bonus credited' ) ;
96+ } else {
97+ logger . warn ( { orgId, userId : user . id } , 'welcome bonus skipped (duplicate or failed)' ) ;
98+ }
99+ } catch ( creditErr ) {
100+ logger . error ( { err : creditErr , orgId, userId : user . id } , 'welcome bonus credit failed' ) ;
95101 }
96102
97103 setTimeout ( ( ) => {
98104 creditDodoWelcomeBonus (
99105 user . email ,
100106 WELCOME_BONUS_CENTS ,
101107 `welcome_bonus_${ user . id } ` ,
102- ) . catch ( ( ) => { } ) ;
108+ ) . catch ( ( err ) => {
109+ logger . warn ( { err, email : user . email } , 'Dodo welcome bonus failed' ) ;
110+ } ) ;
103111 } , DODO_CREDIT_DELAY_MS ) ;
104112
105113 await loadSSHCredentials ( user . id , orgId , user . email ) ;
0 commit comments