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); }
public ConsumerLegalAddressResult GetConsumerLegalAddress(string socialSecurityNumber, string countryCode) { Log.InfoFormat("Calling GetConsumerLegalAddress for SocialSecurityNumber:{0}. CountryCode:{1}.", socialSecurityNumber, countryCode); string hash = _hasher.Create(_payExSettings.AccountNumber, socialSecurityNumber, countryCode, _payExSettings.EncryptionKey); string xmlResult = _verificationFacade.GetConsumerLegalAddress(_payExSettings.AccountNumber, socialSecurityNumber, countryCode, hash); ConsumerLegalAddressResult result = _resultParser.Deserialize <ConsumerLegalAddressResult>(xmlResult); if (result.Status.Success) { Log.InfoFormat("Successfully called GetConsumerLegalAddress for SocialSecurityNumber:{0}. CountryCode:{1}. Result:{2}", socialSecurityNumber, countryCode, xmlResult); } else { Log.ErrorFormat("Error when calling GetConsumerLegalAddress for SocialSecurityNumber:{0}. CountryCode:{1}. Result:{2}", socialSecurityNumber, countryCode, xmlResult); } return(result); }