chore: complete the payment service

This commit is contained in:
mahyargdz
2025-02-04 16:12:33 +03:30
parent 5d91afcc6e
commit 626206c389
25 changed files with 296 additions and 82 deletions
+18 -3
View File
@@ -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);
}
}