Skip to content

Commit

Permalink
cart finalized
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Aug 23, 2024
1 parent 825105c commit 0150fc4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/features/payment/payment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import config from 'src/config';
import axios from 'axios';
import { ValidatePaymentPipe } from './pipes/validate-campaign.pipe';
import {
CreateFlaskCartPaymentDto,
CreateFlaskPaymentDto,
VerifyFlaskPaymentDto,
} from 'src/types/dtos/CreatePayment.dto';
Expand Down Expand Up @@ -98,7 +99,7 @@ export class PaymentController {
@ApiOperation({ description: 'Create new cart payment' })
async newCartPayment(
@Req() req: Request,
@Body(ValidatePaymentPipe) body: CreateFlaskPaymentDto,
@Body(ValidatePaymentPipe) body: CreateFlaskCartPaymentDto,
) {
const dappFlaskUserId = Number(req.headers['dappFlaskUserId']);

Expand All @@ -119,8 +120,8 @@ export class PaymentController {
const { data } = await axios.put(
'https://api.sayapp.company/api/v2/mycart/payment',
{
donate: Number(body.donation),
useCredit: Boolean(body.useCredit),
donation: Number(body.donation),
use_credit: Boolean(body.useCredit),
gateWay: Number(body.gateWay),
},
configs,
Expand Down
10 changes: 10 additions & 0 deletions src/types/dtos/CreatePayment.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ export class CreateFlaskPaymentDto {
useCredit: boolean;
}


export class CreateFlaskCartPaymentDto {
@IsNotEmpty()
gateWay: number;
@IsNotEmpty()
donation: number;
@IsNotEmpty()
useCredit: boolean;
}

export class VerifyFlaskPaymentDto {
// idpay
@IsNotEmpty()
Expand Down

0 comments on commit 0150fc4

Please sign in to comment.