Refactor payment execution to use PaymentJobData for improved data handling
This commit is contained in:
parent
2ab9284c85
commit
bad88f2016
@ -4,6 +4,7 @@ import { HttpService } from '@nestjs/axios';
|
|||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { Payment } from '../entities/payment.entity';
|
import { Payment } from '../entities/payment.entity';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
|
import { PaymentJobData } from '../../queue/queue.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MakePaymentToProcessorService {
|
export class MakePaymentToProcessorService {
|
||||||
@ -14,10 +15,10 @@ export class MakePaymentToProcessorService {
|
|||||||
@InjectRepository(Payment) private readonly repository: Repository<Payment>,
|
@InjectRepository(Payment) private readonly repository: Repository<Payment>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async execute(payment: Payment, url: string): Promise<boolean> {
|
async execute(payment: PaymentJobData, url: string): Promise<boolean> {
|
||||||
const paymentData = {
|
const paymentData = {
|
||||||
amount: payment.amount,
|
amount: payment.paymentData.amount,
|
||||||
correlationId: payment.correlationId,
|
correlationId: payment.paymentData.correlationId,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await firstValueFrom(
|
const response = await firstValueFrom(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user