paymentGatewayCheckoutService.markPaymentAsInvalid(payment.getId());
}
}
//Create a new Order Payment of the passed in type
OrderPayment passthroughPayment = orderPaymentService.create();
passthroughPayment.setType(paymentType);
passthroughPayment.setPaymentGatewayType(PaymentGatewayType.PASSTHROUGH);
passthroughPayment.setAmount(cart.getTotalAfterAppliedPayments());
passthroughPayment.setOrder(cart);
// Create the transaction for the payment
PaymentTransaction transaction = orderPaymentService.createTransaction();
transaction.setAmount(cart.getTotalAfterAppliedPayments());
transaction.setRawResponse("Passthrough Payment");
transaction.setSuccess(true);
transaction.setType(PaymentTransactionType.AUTHORIZE_AND_CAPTURE);
transaction.getAdditionalFields().put(PassthroughPaymentConstants.PASSTHROUGH_PAYMENT_TYPE, paymentType.getType());
transaction.setOrderPayment(passthroughPayment);
passthroughPayment.addTransaction(transaction);
orderService.addPaymentToOrder(cart, passthroughPayment, null);
orderService.save(cart, true);
return processCompleteCheckoutOrderFinalized(redirectAttributes);