8
8
PaymentStatus ,
9
9
} from 'src/dto/adminWinning.dto' ;
10
10
import { WalletDetailDto } from 'src/dto/wallet.dto' ;
11
+ import { TaxFormRepository } from '../repository/taxForm.repo' ;
12
+ import { PaymentMethodRepository } from '../repository/paymentMethod.repo' ;
11
13
12
14
/**
13
15
* The winning service.
@@ -18,7 +20,11 @@ export class WalletService {
18
20
* Constructs the admin winning service with the given dependencies.
19
21
* @param prisma the prisma service.
20
22
*/
21
- constructor ( private readonly prisma : PrismaService ) { }
23
+ constructor (
24
+ private readonly prisma : PrismaService ,
25
+ private readonly taxFormRepo : TaxFormRepository ,
26
+ private readonly paymentMethodRepo : PaymentMethodRepository ,
27
+ ) { }
22
28
23
29
/**
24
30
* Get wallet detail.
@@ -63,6 +69,7 @@ export class WalletService {
63
69
64
70
// count PAYMENT and REWARD totals
65
71
let paymentTotal = 0 ;
72
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
66
73
let rewardTotal = 0 ;
67
74
winnings . forEach ( ( item ) => {
68
75
if ( item . type === WinningsType . PAYMENT ) {
@@ -90,6 +97,10 @@ export class WalletService {
90
97
}
91
98
} ) ;
92
99
100
+ const hasActiveTaxForm = await this . taxFormRepo . hasActiveTaxForm ( userId ) ;
101
+ const hasVerifiedPaymentMethod =
102
+ await this . paymentMethodRepo . hasVerifiedPaymentMethod ( userId ) ;
103
+
93
104
const winningTotals : WalletDetailDto = {
94
105
account : {
95
106
balances : [
@@ -98,18 +109,19 @@ export class WalletService {
98
109
amount : paymentTotal ,
99
110
unit : 'currency' ,
100
111
} ,
101
- {
102
- type : WinningsType . REWARD ,
103
- amount : rewardTotal ,
104
- unit : 'points' ,
105
- } ,
112
+ // hide rewards for now
113
+ // {
114
+ // type: WinningsType.REWARD,
115
+ // amount: rewardTotal,
116
+ // unit: 'points',
117
+ // },
106
118
] ,
107
119
} ,
108
120
withdrawalMethod : {
109
- isSetupComplete : true ,
121
+ isSetupComplete : hasVerifiedPaymentMethod ,
110
122
} ,
111
123
taxForm : {
112
- isSetupComplete : true ,
124
+ isSetupComplete : hasActiveTaxForm ,
113
125
} ,
114
126
} ;
115
127
0 commit comments