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
28 changes: 28 additions & 0 deletions migration/1768325447128-RefRewardLiqPipeline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @typedef {import('typeorm').MigrationInterface} MigrationInterface
* @typedef {import('typeorm').QueryRunner} QueryRunner
*/

/**
* @class
* @implements {MigrationInterface}
*/
module.exports = class RefRewardLiqPipeline1768325447128 {
name = 'RefRewardLiqPipeline1768325447128'

/**
* @param {QueryRunner} queryRunner
*/
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "ref_reward" ADD "liquidityPipelineId" int`);
await queryRunner.query(`ALTER TABLE "ref_reward" ADD CONSTRAINT "FK_0bdf973ad618dffd7a7c6c53dc8" FOREIGN KEY ("liquidityPipelineId") REFERENCES "liquidity_management_pipeline"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
}

/**
* @param {QueryRunner} queryRunner
*/
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "ref_reward" DROP CONSTRAINT "FK_0bdf973ad618dffd7a7c6c53dc8"`);
await queryRunner.query(`ALTER TABLE "ref_reward" DROP COLUMN "liquidityPipelineId"`);
}
}
150 changes: 47 additions & 103 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@
"forceExit": true
},
"overrides": {
"body-parser": "1.20.3",
"qs": "^6.14.1",
"request": {
"form-data": "2.5.5"
},
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function bootstrap() {
AppInsights.start();
}

const app = await NestFactory.create(AppModule);
const app = await NestFactory.create(AppModule, { bodyParser: false });

app.use(morgan('dev'));
app.use(helmet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ export class TransactionController {
if (!dto.creditorData) throw new BadRequestException('Creditor data is required for bank refunds');

return this.bankTxReturnService.refundBankTx(transaction.targetEntity, {
refundIban: refundData.refundTarget ?? dto.refundTarget,
refundIban: dto.refundTarget ?? refundData.refundTarget,
chargebackCurrency,
creditorData: dto.creditorData,
...refundDto,
Expand Down Expand Up @@ -476,7 +476,7 @@ export class TransactionController {
if (!dto.creditorData) throw new BadRequestException('Creditor data is required for bank refunds');

return this.buyCryptoService.refundBankTx(transaction.targetEntity, {
refundIban: refundData.refundTarget ?? dto.refundTarget,
refundIban: dto.refundTarget ?? refundData.refundTarget,
chargebackCurrency,
creditorData: dto.creditorData,
...refundDto,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IEntity } from 'src/shared/models/entity';
import { Column, Entity, Index, JoinTable, ManyToOne, OneToMany } from 'typeorm';
import { BuyCrypto } from '../../buy-crypto/process/entities/buy-crypto.entity';
import { RefReward } from '../../referral/reward/ref-reward.entity';
import {
LiquidityManagementExchanges,
LiquidityManagementOrderStatus,
Expand Down Expand Up @@ -28,6 +29,9 @@ export class LiquidityManagementPipeline extends IEntity {
@OneToMany(() => BuyCrypto, (buyCrypto) => buyCrypto.liquidityPipeline)
buyCryptos: BuyCrypto[];

@OneToMany(() => RefReward, (refReward) => refReward.liquidityPipeline)
refRewards: RefReward[];

@OneToMany(() => LiquidityManagementOrder, (orders) => orders.pipeline)
orders: LiquidityManagementOrder[];

Expand Down
2 changes: 2 additions & 0 deletions src/subdomains/core/referral/referral.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { forwardRef, Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { BlockchainModule } from 'src/integration/blockchain/blockchain.module';
import { SharedModule } from 'src/shared/shared.module';
import { LiquidityManagementModule } from 'src/subdomains/core/liquidity-management/liquidity-management.module';
import { UserModule } from 'src/subdomains/generic/user/user.module';
import { DexModule } from 'src/subdomains/supporting/dex/dex.module';
import { NotificationModule } from 'src/subdomains/supporting/notification/notification.module';
Expand Down Expand Up @@ -32,6 +33,7 @@ import { RefRewardService } from './reward/services/ref-reward.service';
NotificationModule,
PricingModule,
forwardRef(() => TransactionModule),
LiquidityManagementModule,
],
controllers: [RefController, RefRewardController],
providers: [
Expand Down
4 changes: 4 additions & 0 deletions src/subdomains/core/referral/reward/ref-reward.entity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Blockchain } from 'src/integration/blockchain/shared/enums/blockchain.enum';
import { UpdateResult } from 'src/shared/models/entity';
import { LiquidityManagementPipeline } from 'src/subdomains/core/liquidity-management/entities/liquidity-management-pipeline.entity';
import { UserData } from 'src/subdomains/generic/user/models/user-data/user-data.entity';
import { User } from 'src/subdomains/generic/user/models/user/user.entity';
import { Transaction } from 'src/subdomains/supporting/payment/entities/transaction.entity';
Expand Down Expand Up @@ -40,6 +41,9 @@ export class RefReward extends Reward {
@JoinColumn()
sourceTransaction?: Transaction;

@ManyToOne(() => LiquidityManagementPipeline, { nullable: true })
liquidityPipeline?: LiquidityManagementPipeline;

//*** FACTORY METHODS ***//

readyToPayout(outputAmount: number): UpdateResult<RefReward> {
Expand Down
Loading
Loading