chore: complete the payment service
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import { Controller, Get } from "@nestjs/common";
|
||||
import { Body, Controller, Get, Param, Post, Query } from "@nestjs/common";
|
||||
import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
||||
|
||||
import { GatewayDepositDto } from "./DTO/deposit-wallet.dto";
|
||||
import { VerifyParamDto, VerifyQueryDto } from "./DTO/verify-payment.dto";
|
||||
import { PaymentsService } from "./providers/payments.service";
|
||||
import { AuthGuards } from "../../common/decorators/auth-guard.decorator";
|
||||
import { Roles } from "../../common/decorators/roles.decorator";
|
||||
import { UserDec } from "../../common/decorators/user.decorator";
|
||||
import { RoleEnum } from "../users/enums/role.enum";
|
||||
|
||||
@Controller("payments")
|
||||
@ApiTags("Payments")
|
||||
@@ -16,6 +21,16 @@ export class PaymentsController {
|
||||
return this.paymentsService.getAvailableGateways();
|
||||
}
|
||||
|
||||
@Get("verify")
|
||||
verifyPayment() {}
|
||||
@ApiOperation({ summary: "Charge wallet ==> user route" })
|
||||
@AuthGuards()
|
||||
@Roles(RoleEnum.USER)
|
||||
@Post("deposit/gateway")
|
||||
chargeWalletWithGateway(@Body() chargeDto: GatewayDepositDto, @UserDec("id") userId: string) {
|
||||
return this.paymentsService.chargeWalletWithGateway(chargeDto, userId);
|
||||
}
|
||||
|
||||
@Get("verify/:gateway")
|
||||
verifyPayment(@Param() paramDto: VerifyParamDto, @Query() queryDto: VerifyQueryDto) {
|
||||
return this.paymentsService.verifyPayment(paramDto.gateway, queryDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user