add:wallet
This commit is contained in:
@@ -12,12 +12,16 @@ import { CreateResellerAgentDto } from './dto/create-reseller-agent.dto';
|
||||
import { SearchRewardsRequestQueryDto } from './dto/search-reward-requests.dto';
|
||||
import { SearchCustomersDto } from '../users/DTO/search-customers.dto';
|
||||
import { SearchResellerInvoicesQueryDto } from './dto/search-reseller-invoices.dto';
|
||||
import { PaginationDto } from '../../common/DTO/pagination.dto';
|
||||
import { WalletsService } from '../wallets/providers/wallets.service';
|
||||
import { CreateWithdrawRequestDto } from './dto/create-withdraw-request.dto';
|
||||
|
||||
@Controller('reseller')
|
||||
@AuthGuards()
|
||||
export class ResellerController {
|
||||
constructor(
|
||||
private readonly resellerService: ResellerService,
|
||||
private readonly walletsService: WalletsService,
|
||||
) { }
|
||||
|
||||
|
||||
@@ -94,4 +98,37 @@ export class ResellerController {
|
||||
return this.resellerService.findResellerAgentsRewards(userId, query)
|
||||
}
|
||||
|
||||
// ============ Wallet Transactions =============
|
||||
@ApiOperation({ summary: "get Reseller/Agent Wallet Transactions ==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Get('wallet/transaction')
|
||||
getWalletTransactionss(@UserDec("id") userId: string, @Query() query: PaginationDto) {
|
||||
return this.walletsService.getTransaction(userId, query);
|
||||
}
|
||||
|
||||
// ============ Wallet Balance =============
|
||||
|
||||
@ApiOperation({ summary: "get Reseller/Agent Wallet Balance ==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Get('wallet/balance')
|
||||
getWalletBalance(@UserDec("id") userId: string) {
|
||||
return this.walletsService.getBalance(userId)
|
||||
}
|
||||
|
||||
// ============ WithDraw Request =============
|
||||
@ApiOperation({ summary: "Create Reseller/Agent withdraw request ==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Post('wallet/withdraw')
|
||||
withdrawRequest(@UserDec("id") userId: string, @Body() dto: CreateWithdrawRequestDto) {
|
||||
return this.resellerService.createWithdrawRequest(userId, dto.amount)
|
||||
}
|
||||
|
||||
// ============ Remove WithDraw Request =============
|
||||
@ApiOperation({ summary: "remove Reseller/Agent withdraw request ==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Delete('wallet/withdraw/:id')
|
||||
removeWithdrawRequest(@UserDec("id") userId: string) {
|
||||
return this.walletsService.getBalance(userId)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user