Skip to content

Commit

Permalink
fix(core): Payment amount accounts for existing Payments on Order
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Mar 15, 2021
1 parent 8653e83 commit e92d2ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/service/services/order.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,12 @@ export class OrderService {
if (order.state !== 'ArrangingPayment') {
return new OrderPaymentStateError();
}
order.payments = await this.getOrderPayments(ctx, order.id);
const amountToPay = order.totalWithTax - totalCoveredByPayments(order);
const payment = await this.paymentService.createPayment(
ctx,
order,
order.totalWithTax,
amountToPay,
input.method,
input.metadata,
);
Expand Down

0 comments on commit e92d2ce

Please sign in to comment.