find all
This commit is contained in:
@@ -15,6 +15,7 @@ import { CreditRepository } from 'src/modules/user/repositories/credit.repositor
|
||||
import { CreditService } from 'src/modules/user/providers/credit.service';
|
||||
import { CreditTransactionType } from 'src/modules/user/interface/credit';
|
||||
import { Payment } from '../entities/payment.entity';
|
||||
import { FindPaymentsDto } from '../dto/find-payments.dto';
|
||||
|
||||
|
||||
|
||||
@@ -170,11 +171,10 @@ export class PaymentService {
|
||||
};
|
||||
}
|
||||
|
||||
async verifyOnlinePayment(transactionId: string): Promise<Payment> {
|
||||
async verifyOnlinePayment(token: string): Promise<Payment> {
|
||||
const payment = await this.em.transactional(async em => {
|
||||
const payment = await em.findOne(
|
||||
Payment,
|
||||
{ transactionId },
|
||||
const payment = await this.paymentRepository.findOne(
|
||||
{ token },
|
||||
{ populate: ['order'] },
|
||||
);
|
||||
|
||||
@@ -222,17 +222,17 @@ export class PaymentService {
|
||||
return payment;
|
||||
}
|
||||
|
||||
// findAllPaymentsBy(: string, userId: string) {
|
||||
// return this.em.find(
|
||||
// Payment,
|
||||
// { order: { restaurant: { id: }, user: { id: userId } } },
|
||||
// { populate: ['order', 'order.paymentMethod'] },
|
||||
// );
|
||||
// }
|
||||
findAll(dto: FindPaymentsDto) {
|
||||
return this.paymentRepository.findAllPaginated(dto)
|
||||
}
|
||||
|
||||
async verifyCashPayment(id: string): Promise<Payment> {
|
||||
findAllByUser(dto: FindPaymentsDto, userId: string) {
|
||||
return this.paymentRepository.findAllPaginated({ ...dto, userId })
|
||||
}
|
||||
|
||||
async verifyCashPayment(paymentId: string): Promise<Payment> {
|
||||
const payment = await this.em.transactional(async em => {
|
||||
const payment = await em.findOne(Payment, id, { populate: ['order'] });
|
||||
const payment = await em.findOne(Payment, paymentId, { populate: ['order'] });
|
||||
if (!payment) {
|
||||
throw new NotFoundException(PaymentMessage.PAYMENT_NOT_FOUND);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user