diff --git a/src/services/donationService.test.ts b/src/services/donationService.test.ts index e1133d4bb..b9bae5beb 100644 --- a/src/services/donationService.test.ts +++ b/src/services/donationService.test.ts @@ -187,7 +187,7 @@ function syncDonationStatusWithBlockchainNetworkTestCases() { assert.isOk(updateDonation); assert.equal(updateDonation.id, donation.id); assert.equal(updateDonation.status, DONATION_STATUS.VERIFIED); - assert.equal(updateDonation.earlyAccessRoundId, ea.id); + // assert.equal(updateDonation.earlyAccessRoundId, ea.id); }); it('should associate donation to overlapping qf round after verification', async () => { @@ -222,7 +222,7 @@ function syncDonationStatusWithBlockchainNetworkTestCases() { assert.isOk(updateDonation); assert.equal(updateDonation.id, donation.id); assert.equal(updateDonation.status, DONATION_STATUS.VERIFIED); - assert.equal(updateDonation.qfRoundId, qf.id); + // assert.equal(updateDonation.qfRoundId, qf.id); }); } diff --git a/src/services/donationService.ts b/src/services/donationService.ts index 4a8ce6495..762b2edab 100644 --- a/src/services/donationService.ts +++ b/src/services/donationService.ts @@ -50,8 +50,6 @@ import { CustomToken, getTokenPrice } from './priceService'; import { updateProjectStatistics } from './projectService'; import { updateOrCreateProjectRoundRecord } from '../repositories/projectRoundRecordRepository'; import { updateOrCreateProjectUserRecord } from '../repositories/projectUserRecordRepository'; -import { findActiveEarlyAccessRound } from '../repositories/earlyAccessRoundRepository'; -import { findActiveQfRound } from '../repositories/qfRoundRepository'; import { ProjectAddress } from '../entities/projectAddress'; import { processAnkrTransfers } from './ankrService'; import { User } from '../entities/user'; @@ -61,7 +59,6 @@ import { QACC_DONATION_TOKEN_SYMBOL, } from '../constants/qacc'; import { ApolloContext } from '../types/ApolloContext'; -import qAccService from './qAccService'; export const TRANSAK_COMPLETED_STATUS = 'COMPLETED'; @@ -295,28 +292,28 @@ export const syncDonationStatusWithBlockchainNetwork = async (params: { const transactionDate = new Date(transaction.timestamp * 1000); // Only double check if the donation is not already assigned to a round - if (!donation.earlyAccessRoundId && !donation.qfRoundId) { - const cap = await qAccService.getQAccDonationCap({ - userId: donation.userId, - projectId: donation.projectId, - donateTime: transactionDate, - }); - - logger.debug( - `the available cap at time ${transaction.timestamp} is ${cap}, and donation amount is ${donation.amount}`, - ); - if (cap >= donation.amount) { - const [earlyAccessRound, qfRound] = await Promise.all([ - findActiveEarlyAccessRound(transactionDate), - findActiveQfRound({ date: transactionDate }), - ]); - donation.earlyAccessRound = earlyAccessRound; - donation.qfRound = qfRound; - } else { - donation.earlyAccessRound = null; - donation.qfRound = null; - } - } + // if (!donation.earlyAccessRoundId && !donation.qfRoundId) { + // const cap = await qAccService.getQAccDonationCap({ + // userId: donation.userId, + // projectId: donation.projectId, + // donateTime: transactionDate, + // }); + + // logger.debug( + // `the available cap at time ${transaction.timestamp} is ${cap}, and donation amount is ${donation.amount}`, + // ); + // if (cap >= donation.amount) { + // const [earlyAccessRound, qfRound] = await Promise.all([ + // findActiveEarlyAccessRound(transactionDate), + // findActiveQfRound({ date: transactionDate }), + // ]); + // donation.earlyAccessRound = earlyAccessRound; + // donation.qfRound = qfRound; + // } else { + // donation.earlyAccessRound = null; + // donation.qfRound = null; + // } + // } await donation.save(); // ONLY verified donations should be accumulated @@ -721,6 +718,7 @@ const ankrTransferHandler = async (transfer: TokenTransfer) => { await Donation.update(Number(donationId), { origin: DONATION_ORIGINS.CHAIN, + status: DONATION_STATUS.VERIFIED, }); logger.debug(