Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export enum ErrorJob {
NotFound = 'Job not found',
NotCreated = 'Job has not been created',
NotActiveCard = 'Credit card not found',
NotActiveCard = 'Credit card not found. Please, add a credit card to your account.',
ManifestNotFound = 'Manifest not found',
ManifestValidationFailed = 'Manifest validation failed',
ResultNotFound = 'Result not found',
Expand Down
14 changes: 7 additions & 7 deletions packages/apps/job-launcher/server/src/modules/job/job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -878,13 +878,6 @@ export class JobService {
});
}

const paymentEntity = await this.paymentService.createWithdrawalPayment(
user.id,
totalPaymentAmount,
dto.paymentCurrency,
paymentCurrencyRate,
);

const { createManifest } = this.createJobSpecificActions[requestType];

let jobEntity = new JobEntity();
Expand Down Expand Up @@ -923,6 +916,13 @@ export class JobService {
jobEntity.manifestHash = hash;
}

const paymentEntity = await this.paymentService.createWithdrawalPayment(
user.id,
totalPaymentAmount,
dto.paymentCurrency,
paymentCurrencyRate,
);

jobEntity.chainId = chainId;
jobEntity.reputationOracle = reputationOracle;
jobEntity.exchangeOracle = exchangeOracle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ describe('WhitelistService', () => {
expect(result).toBe(true);
});

// it('should return false if user is not whitelisted', async () => {
// const userId = 2;
// jest
// .spyOn(whitelistRepository, 'findOneByUserId')
// .mockResolvedValue(null);
it('should return false if user is not whitelisted', async () => {
const userId = 2;
jest
.spyOn(whitelistRepository, 'findOneByUserId')
.mockResolvedValue(null);

// const result = await whitelistService.isUserWhitelisted(userId);
const result = await whitelistService.isUserWhitelisted(userId);

// expect(whitelistRepository.findOneByUserId).toHaveBeenCalledWith(userId);
// expect(result).toBe(false);
// });
expect(whitelistRepository.findOneByUserId).toHaveBeenCalledWith(userId);
expect(result).toBe(false);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export class WhitelistService {
constructor(private readonly whitelistRepository: WhitelistRepository) {}

async isUserWhitelisted(userId: number): Promise<boolean> {
// TODO: Enable it when billing system is active
return true;
const user = await this.whitelistRepository.findOneByUserId(userId);
return !!user;
}
Expand Down