Skip to content

Commit aa00cfe

Browse files
authored
Merge pull request #33 from teacoder-team/dev
feat(payment): throw MethodNotAllowedException outside dev
2 parents 5e531bd + 5bc87f9 commit aa00cfe

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/api/payment/payment.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { BadRequestException, Injectable } from '@nestjs/common'
1+
import {
2+
BadRequestException,
3+
Injectable,
4+
MethodNotAllowedException
5+
} from '@nestjs/common'
26
import { PaymentMethod, type User } from '@prisma/generated'
37
import {
48
ConfirmationEnum,
@@ -8,6 +12,7 @@ import {
812
} from 'nestjs-yookassa'
913
import { VatCodesEnum } from 'nestjs-yookassa/dist/interfaces/receipt-details.interface'
1014

15+
import { IS_DEV_ENV } from '@/common/utils'
1116
import { PrismaService } from '@/infra/prisma/prisma.service'
1217
import { HeleketService } from '@/libs/heleket/heleket.service'
1318

@@ -26,6 +31,9 @@ export class PaymentService {
2631
public async create(dto: InitPaymentRequest, user: User) {
2732
const { method } = dto
2833

34+
if (!IS_DEV_ENV)
35+
throw new MethodNotAllowedException('Method not allowed')
36+
2937
const payment = await this.prismaService.payment.create({
3038
data: {
3139
amount: this.SUBSCRIPTION_PRICE,

0 commit comments

Comments
 (0)