Skip to content

Commit

Permalink
fix(core): Really correctly handle multiple payment refunds
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Mar 16, 2021
1 parent 633728d commit ba8d411
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/service/services/payment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ export class PaymentService {
items: OrderItem[],
payment: Payment,
): Promise<Refund | RefundStateTransitionError> {
const { paymentMethod, handler } = await this.paymentMethodService.getMethodAndOperations(
ctx,
payment.method,
);
const orderWithRefunds = await this.connection.getEntityOrThrow(ctx, Order, order.id, {
relations: ['payments', 'payments.refunds'],
});
Expand Down Expand Up @@ -224,6 +220,10 @@ export class PaymentService {
state: 'Pending',
metadata: {},
});
const { paymentMethod, handler } = await this.paymentMethodService.getMethodAndOperations(
ctx,
paymentToRefund.method,
);
const createRefundResult = await handler.createRefund(
ctx,
input,
Expand Down

0 comments on commit ba8d411

Please sign in to comment.