Skip to content

Commit 8e5835f

Browse files
committed
PM-2561 - for challenges with prize sets other than USD, skip payments creation
1 parent 8669b20 commit 8e5835f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/api/challenges/challenges.service.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,22 @@ export class ChallengesService {
411411
);
412412
}
413413

414+
const paymentTypes = [
415+
...new Set(
416+
challenge.prizeSets
417+
.map((set) => set.prizes.map((prize) => prize.type))
418+
.flat(),
419+
),
420+
];
421+
const isRewardsPayment = paymentTypes.some((type) => type !== 'USD');
422+
423+
if (isRewardsPayment) {
424+
this.logger.log(
425+
`Rewards system detected: ${paymentTypes.join(', ')}. Skipping payments generation for challenge ${challenge.name} (${challenge.id}).`,
426+
);
427+
return;
428+
}
429+
414430
const payments = await this.getChallengePayments(challenge);
415431
const totalAmount = payments.reduce(
416432
(sum, payment) => sum + payment.details[0].totalAmount,

0 commit comments

Comments
 (0)