public TransactionRegistrationResponse Register(CartModel cartModel) { string sagePayUrl = _sagePaySettings.RegistrationUrl; var registration = _transactionRegistrationBuilder.BuildRegistration(cartModel); var serializer = new HttpPostSerializer(); var postData = serializer.Serialize(registration); var response = _httpRequestSender.SendRequest(sagePayUrl, postData); var deserializer = new ResponseSerializer(); var registrationResponse = deserializer.Deserialize<TransactionRegistrationResponse>(response); if (registrationResponse.StatusDetail.StartsWith("4042")) registrationResponse.Status = ResponseType.Invalid; registrationResponse.VendorTxCode = registration.VendorTxCode; registrationResponse.CartTotal = cartModel.TotalToPay; return registrationResponse; }
public TransactionRegistrationResponse Register(CartModel cartModel) { string sagePayUrl = _sagePaySettings.RegistrationUrl; var registration = _transactionRegistrationBuilder.BuildRegistration(cartModel); var serializer = new HttpPostSerializer(); var postData = serializer.Serialize(registration); var response = _httpRequestSender.SendRequest(sagePayUrl, postData); var deserializer = new ResponseSerializer(); var registrationResponse = deserializer.Deserialize <TransactionRegistrationResponse>(response); if (registrationResponse.StatusDetail.StartsWith("4042")) { registrationResponse.Status = ResponseType.Invalid; } registrationResponse.VendorTxCode = registration.VendorTxCode; registrationResponse.CartTotal = cartModel.TotalToPay; return(registrationResponse); }