Skip to content

Commit

Permalink
fix: resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mfontosco committed Mar 2, 2025
1 parent a6ef166 commit 21381cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/modules/paystack/paystack.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PaystackService } from './paystack.service';
import { CreatePaystackPaymentPlanDto } from './dto/create-paystack-payment-plan.dto';
import { UserPayload } from '../user/interfaces/user-payload.interface';
import * as crypto from 'crypto';
import { skipAuth } from 'src/helpers/skipAuth';
import { skipAuth } from '@shared/helpers/skipAuth';

@Controller('payments/paystack')
export class PaystackController {
Expand All @@ -12,19 +12,15 @@ export class PaystackController {
@Post('initialize')
@skipAuth()
initiate(@Body() createPaystackPaymentDto: CreatePaystackPaymentPlanDto, @Req() req: { user: UserPayload }) {

return this.paystackService.initiatePaymentForPlan(createPaystackPaymentDto, req.user.id);
}

@Get('verify/:reference')
@skipAuth()
verify(@Param('reference') reference: string, @Req() req: { user: UserPayload }) {

return this.paystackService.verifyPayment(reference);
}

@Post('webhook')
@skipAuth()
handleWebhook(@Body() body: any, @Req() req: { headers: Record<string, string> }) {
const paystackSecret = process.env.PAYSTACK_WEBHOOK_SECRET;
if (!paystackSecret) {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/paystack/paystack.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CreatePaystackPaymentPlanDto } from './dto/create-paystack-payment-plan
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Payment, PaymentStatus } from './entities/payment.entity';
import { CustomHttpException } from '../../helpers/custom-http-filter';
import { CustomHttpException } from '@shared/helpers/custom-http-filter';
import { v4 as uuidv4 } from 'uuid';

@Injectable()
Expand Down Expand Up @@ -48,7 +48,7 @@ export class PaystackService {
// Construct payment payload
const paymentData = {
email: createPaystackPaymentPlanDto.email,
amount,
amount,
reference: uuidv4(),
callback_url: createPaystackPaymentPlanDto.callback_url,
plan: createPaystackPaymentPlanDto.plan_id,
Expand All @@ -68,7 +68,7 @@ export class PaystackService {
user_id: userId,
transaction_id: paymentData.reference,
gateway_id: '',
amount: amount / 100,
amount: amount / 100,
status: PaymentStatus.PENDING,
});

Expand Down

0 comments on commit 21381cb

Please sign in to comment.