public InitializeResult Initialize(Cart cart, PaymentInformation payment, bool ignoreOrderLines = false, bool ignoreCustomerAddress = false) { Log.InfoFormat("Calling Initialize for cart with ID:{0}. PaymentInformation:{1}", cart.Id, payment); string hash = _hasher.Create(_payExSettings.AccountNumber, payment, _payExSettings.EncryptionKey); string xmlResult = _orderFacade.Initialize(_payExSettings.AccountNumber, payment, hash); InitializeResult result = _resultParser.Deserialize <InitializeResult>(xmlResult); if (!result.Status.Success) { Log.ErrorFormat("Error when calling Initialize for cart with ID:{0}. Result:{1}", cart.Id, xmlResult); return(result); } Log.InfoFormat("Successfully called Initialize for cart with ID:{0}. Result:{1}", cart.Id, xmlResult); if (!ignoreOrderLines && _payExSettings.IncludeOrderLines) { AddOrderLineItems(cart, payment, result); } if (!ignoreCustomerAddress && _payExSettings.IncludeCustomerAddress) { AddOrderAddress(cart, payment, result); } return(result); }