throw new OrderStateException("Order has not been completed");
}
String paymentGateway = orderHeader.getPaymentGatewayProvider();
if (paymentGateway != null) {
PaymentEngine paymentEngine = PaymentManager.getPaymentEngine(paymentGateway, orderHeader.getSiteCurrency());
paymentEngine.voidPayment(invoiceHeader);
PaymentTran paymentTran = new PaymentTran();
paymentTran.setAuthCode(paymentEngine.getAuthCode());
paymentTran.setPaymentReference1(paymentEngine.getPaymentReference1());
paymentTran.setPaymentReference2(paymentEngine.getPaymentReference2());
paymentTran.setPaymentReference3(paymentEngine.getPaymentReference3());