@@ -30,6 +30,7 @@ import {
30
30
ES_INDEX ,
31
31
ES_REFRESH ,
32
32
PrizeSetTypes ,
33
+ TGBillingAccounts ,
33
34
Topics ,
34
35
} from "../common/Constants" ;
35
36
import BusApi from "../helpers/BusApi" ;
@@ -580,6 +581,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
580
581
const completedChallenge = updatedChallenge . items [ 0 ] ;
581
582
const totalAmount = await this . generatePayments (
582
583
completedChallenge . id ,
584
+ completedChallenge . billing ?. billingAccountId ?? 0 ,
583
585
completedChallenge . legacy ?. subTrack ?? "Task" ,
584
586
completedChallenge . name ,
585
587
completedChallenge . payments
@@ -776,6 +778,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
776
778
console . log ( "Payments to Generate" , completedChallenge . payments ) ;
777
779
const totalAmount = await this . generatePayments (
778
780
completedChallenge . id ,
781
+ completedChallenge . billing ?. billingAccountId ?? 0 ,
779
782
completedChallenge . legacy ?. subTrack ?? "Task" ,
780
783
completedChallenge . name ,
781
784
completedChallenge . payments
@@ -901,6 +904,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
901
904
902
905
private async generatePayments (
903
906
challengeId : string ,
907
+ billingAccountId : number ,
904
908
challengeType : string ,
905
909
title : string ,
906
910
payments : UpdateChallengeInputForACL_PaymentACL [ ]
@@ -975,7 +979,16 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
975
979
description,
976
980
externalId : challengeId ,
977
981
details,
982
+ attributes : {
983
+ billingAccountId,
984
+ payroll : false ,
985
+ } ,
978
986
} ;
987
+
988
+ if ( _ . includes ( TGBillingAccounts , billingAccountId ) ) {
989
+ payload . attributes . payroll = true ;
990
+ }
991
+
979
992
console . log ( "Generate payment with payload" , payload ) ;
980
993
await PaymentCreator . createPayment ( payload , await m2mToken . getM2MToken ( ) ) ;
981
994
}
0 commit comments