public override String CaptureOrder(Order order) { decimal amount = order.Total(true);; GatewayMoneybookers.PaymentType paymentType = GatewayMoneybookers.PaymentType.Capture; // Generate payment request GatewayMoneybookers.PaymentRequestBuilder requestBuilder = new GatewayMoneybookers.PaymentRequestBuilder(); var paymentRequest = requestBuilder.BuildReferencedPaymentRequest <GatewayMoneybookers.CreditCardPaymentMethod>( paymentType, order.OrderNumber, order.AuthorizationPNREF.Substring(5), // Trim off "AUTH=" amount); GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod> paymentTransformer = new GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod>(); var paymentRequestData = paymentTransformer.TransformRequest(paymentRequest, null); // Submit request and get response string paymentResponseData = null; string result = String.Empty; int maxAttempts = AppLogic.AppConfigUSInt("GatewayRetries") + 1; for (int attemptCount = 0; attemptCount < maxAttempts; attemptCount++) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestUri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; try { using (var requestStream = request.GetRequestStream()) { using (StreamWriter requestWriter = new StreamWriter(requestStream)) { requestWriter.Write("load={0}", Uri.EscapeDataString(paymentRequestData)); requestWriter.Close(); } requestStream.Close(); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (var responseStream = response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { paymentResponseData = responseReader.ReadToEnd(); responseReader.Close(); } responseStream.Close(); } break; } #if DEBUG catch (WebException exception) { using (var responseStream = exception.Response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}{1}", exception.Message, responseReader.ReadToEnd()); responseReader.Close(); } responseStream.Close(); } } #endif catch (Exception exception) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}", exception.Message); } } // Process response if (paymentResponseData != null) { GatewayMoneybookers.PaymentResponse paymentResponse = paymentTransformer.TransformResponse(paymentResponseData); order.CaptureTXCommand = paymentRequestData; order.CaptureTXResult = paymentResponseData; if (paymentResponse.Result.ToUpperInvariant() == "ACK") { order.AuthorizationPNREF = order.AuthorizationPNREF + "|CAPTURE=" + paymentResponse.TransactionUniqueId; result = AppLogic.ro_OK; } else { result = String.Format("{0} - {1} - {2} - {3}", paymentResponse.Result, paymentResponse.Status, paymentResponse.Reason, paymentResponse.Return); if (result.Length == 0) { result = "Unspecified Error"; } } } return(result); }
public ExternalPaymentMethodContext Process3DSecureResponse(Dictionary <string, string> responseData) { try { if (responseData == null || responseData["response"] == null) { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", Customer.Current.SkinID, Customer.Current.LocaleSetting))); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext("No response data", redirectUrl, new Dictionary <string, string>())); } GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod> paymentTransformer = new GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod>(); GatewayMoneybookers.PaymentResponse paymentResponse = paymentTransformer.TransformResponse(responseData["response"]); string result = String.Format("{0} - {1} - {2} - {3}", paymentResponse.Result, paymentResponse.Status, paymentResponse.Reason, paymentResponse.Return); int customerId = Int32.Parse(paymentResponse.SessionId); Customer customer = new Customer(customerId, true); customer.RequireCustomerRecord(); ShoppingCart cart = new ShoppingCart(customer.SkinID, customer, CartTypeEnum.ShoppingCart, 0, false); if (cart.IsEmpty()) { string redirectUrl = "shoppingcart.aspx"; return(new ExternalPaymentMethodContext("Shopping cart empty", redirectUrl, new Dictionary <string, string>())); } int orderNumber = customer.ThisCustomerSession.SessionUSInt("Moneybookers_3DSecure_OrderNumber"); if (orderNumber == 0) { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", Customer.Current.SkinID, Customer.Current.LocaleSetting))); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } if (paymentResponse.Result.ToUpperInvariant() != "ACK") { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(AppLogic.GetString("secureprocess.aspx.3", Customer.Current.SkinID, Customer.Current.LocaleSetting))); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } CustomerSession customerSession = new CustomerSession(customerId); customerSession["Moneybookers_3DSecure_Approved"] = Boolean.TrueString; customerSession["Moneybookers_3DSecure_Response"] = responseData["response"]; customerSession["Moneybookers_3DSecure_VerificationPath"] = responseData["threedsecure_verificationpath"]; string status = Gateway.MakeOrder(String.Empty, AppLogic.TransactionMode(), cart, orderNumber, String.Empty, String.Empty, String.Empty, String.Empty); if (status != AppLogic.ro_OK) { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(status)); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } CustomerSession.StaticClear(customer.CustomerID); return(new ExternalPaymentMethodContext(result, AppLogic.GetStoreHTTPLocation(false) + "orderconfirmation.aspx?paymentmethod=Credit+Card&ordernumber=" + orderNumber, new Dictionary <string, string>())); } catch (Exception exception) { string result = "Error processing order: " + exception.ToString(); ErrorMessage errorMessage = new ErrorMessage(AspDotNetStorefrontCore.AppLogic.GetString("checkoutpayment.aspx.35", Customer.Current.SkinID, Customer.Current.LocaleSetting)); string redirectUrl = String.Format("{0}shoppingcart.aspx?error=1&ErrorMsg={1}", AppLogic.GetStoreHTTPLocation(false), errorMessage.MessageId); return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } }
private string ProcessOrderThroughGateway(int OrderNumber, int CustomerID, Decimal OrderTotal, TransactionModeEnum TransactionMode, Address UseBillingAddress, String CardExtraCode, ref String AuthorizationResult, ref String AuthorizationCode, ref String AuthorizationTransID, ref String TransactionCommandOut, ref String TransactionResponse, Customer customer, GatewayMoneybookers.IPaymentType paymentType, string customerIpAddress, string cardType) { GatewayMoneybookers.PaymentRequestBuilder requestBuilder = new GatewayMoneybookers.PaymentRequestBuilder(); var paymentRequest = requestBuilder.BuildCreditCardPaymentRequest( paymentType, OrderNumber, null, CustomerID, customer.EMail, UseBillingAddress.FirstName, UseBillingAddress.LastName, UseBillingAddress.Address1, UseBillingAddress.City, CommonLogic.IIF(String.IsNullOrEmpty(UseBillingAddress.State), null, UseBillingAddress.State), UseBillingAddress.Zip, UseBillingAddress.Country, customerIpAddress, OrderTotal, cardType, UseBillingAddress.CardNumber, UseBillingAddress.CardExpirationMonth.PadLeft(2, '0'), UseBillingAddress.CardExpirationYear, CommonLogic.IIF(String.IsNullOrEmpty(UseBillingAddress.CardIssueNumber), null, UseBillingAddress.CardIssueNumber), CardExtraCode); GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod> paymentTransformer = new GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod>(); GatewayMoneybookers.CreditCardPaymentMethodXmlTransformer paymentMethodTransformer = new GatewayMoneybookers.CreditCardPaymentMethodXmlTransformer(); var paymentRequestData = paymentTransformer.TransformRequest(paymentRequest, paymentMethodTransformer); // Submit request and get response string paymentResponseData = null; string result = String.Empty; int maxAttempts = AppLogic.AppConfigUSInt("GatewayRetries") + 1; for (int attemptCount = 0; attemptCount < maxAttempts; attemptCount++) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestUri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; try { using (var requestStream = request.GetRequestStream()) { using (StreamWriter requestWriter = new StreamWriter(requestStream)) { requestWriter.Write("load={0}", Uri.EscapeDataString(paymentRequestData)); requestWriter.Close(); } requestStream.Close(); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (var responseStream = response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { paymentResponseData = responseReader.ReadToEnd(); responseReader.Close(); } responseStream.Close(); } break; } #if DEBUG catch (WebException exception) { using (var responseStream = exception.Response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { result = String.Format("Error calling Moneybookers payment gateway. {0}{1}", exception.Message, responseReader.ReadToEnd()); responseReader.Close(); } responseStream.Close(); } } #endif catch (Exception exception) { result = String.Format("Error calling Moneybookers payment gateway. {0}", exception.Message); } } // Process response if (paymentResponseData != null) { GatewayMoneybookers.PaymentResponse paymentResponse = paymentTransformer.TransformResponse(paymentResponseData); AuthorizationCode = paymentResponse.ProcessingCode; AuthorizationResult = paymentResponse.Return; AuthorizationTransID = CommonLogic.IIF(TransactionMode == TransactionModeEnum.auth, "AUTH=", "CAPTURE=") + paymentResponse.TransactionUniqueId; TransactionCommandOut = paymentRequestData; TransactionResponse = paymentResponseData; if (paymentResponse.Result.ToUpperInvariant() == "ACK") { if (paymentResponse.ResponseMode == GatewayMoneybookers.ResponseMode.Async) { string redirectUrl = paymentResponse.RedirectUrl; string parameterKeys = String.Join(";", paymentResponse.RedirectParameters.Keys.Select(s => "Moneybookers_3DSecure_Parameter_" + s).ToArray()); CustomerSession customerSession = new CustomerSession(CustomerID); customerSession["Moneybookers_3DSecure_OrderNumber"] = OrderNumber.ToString(); customerSession["Moneybookers_3DSecure_RedirectUrl"] = paymentResponse.RedirectUrl; customerSession["Moneybookers_3DSecure_ParameterKeys"] = parameterKeys; foreach (var kvp in paymentResponse.RedirectParameters) { customerSession["Moneybookers_3DSecure_Parameter_" + kvp.Key] = kvp.Value; } result = AppLogic.ro_3DSecure; } else { result = AppLogic.ro_OK; } } else { result = String.Format("{0} - {1} - {2} - {3}", paymentResponse.Result, paymentResponse.Status, paymentResponse.Reason, paymentResponse.Return); if (result.Length == 0) { result = "Unspecified Error"; } } } return(result); }
private string ProcessOrderThrough3DSecure(int OrderNumber, int CustomerID, Decimal OrderTotal, TransactionModeEnum TransactionMode, Address UseBillingAddress, String CardExtraCode, ref String AuthorizationResult, ref String AuthorizationCode, ref String AuthorizationTransID, ref String TransactionCommandOut, ref String TransactionResponse, Customer customer, GatewayMoneybookers.IPaymentType paymentType, string customerIpAddress, string cardType, CustomerSession customerSession) { string originalResponseData = customerSession["Moneybookers_3DSecure_Response"]; var paymentXmlTransformer = new GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod>(); var paymentResponse = paymentXmlTransformer.TransformResponse(originalResponseData); AuthorizationCode = paymentResponse.ProcessingCode; AuthorizationResult = paymentResponse.Return; AuthorizationTransID = CommonLogic.IIF(TransactionMode == TransactionModeEnum.auth, "AUTH=", "CAPTURE=") + paymentResponse.TransactionUniqueId; TransactionResponse = originalResponseData; // Check for timeout if (paymentResponse.ReturnCode == "100.380.501") { return("3D Secure payment verification timed out."); } // Verify 3D secure response string verificationRequestUri = ThreeDSecureRequestUri + customerSession["Moneybookers_3DSecure_VerificationPath"]; // Submit request and get response string responseData = null; string result = String.Empty; int maxAttempts = AppLogic.AppConfigUSInt("GatewayRetries") + 1; for (int attemptCount = 0; attemptCount < maxAttempts; attemptCount++) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(verificationRequestUri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; try { using (var requestStream = request.GetRequestStream()) { using (StreamWriter requestWriter = new StreamWriter(requestStream)) { requestWriter.Write("response={0}", Uri.EscapeDataString(originalResponseData)); requestWriter.Close(); } requestStream.Close(); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (var responseStream = response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { responseData = responseReader.ReadToEnd(); responseReader.Close(); } responseStream.Close(); } break; } #if DEBUG catch (WebException exception) { using (var responseStream = exception.Response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}{1}", exception.Message, responseReader.ReadToEnd()); responseReader.Close(); } responseStream.Close(); } } #endif catch (Exception exception) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}", exception.Message); } } // Process response if (String.IsNullOrEmpty(responseData)) { result = "Empty response from 3D Secure validation call."; } else if (responseData == "VERIFIED") { result = AppLogic.ro_OK; } else { result = "Payment method was not validated. Please try submitting your payment again"; } return(result); }
private String RefundOrder <TPaymentMethod>(Order order, int originalOrderNumber, int newOrderNumber, decimal refundAmount, String refundReason, Address useBillingAddress, GatewayMoneybookers.IPaymentMethodXmlTransformer <TPaymentMethod> paymentMethodXmlTransformer) where TPaymentMethod : GatewayMoneybookers.PaymentMethod { decimal amount = refundAmount; GatewayMoneybookers.PaymentType paymentType = GatewayMoneybookers.PaymentType.Refund; DB.ExecuteSQL("update orders set RefundTXCommand=NULL, RefundTXResult=NULL where OrderNumber=" + originalOrderNumber.ToString()); // Generate payment request GatewayMoneybookers.PaymentRequestBuilder requestBuilder = new GatewayMoneybookers.PaymentRequestBuilder(); var paymentRequest = requestBuilder.BuildReferencedPaymentRequest <TPaymentMethod>( paymentType, order.OrderNumber, order.AuthorizationPNREF.Substring(order.AuthorizationPNREF.IndexOf("|CAPTURE=") + 9), amount); GatewayMoneybookers.PaymentXmlTransformer <TPaymentMethod> paymentTransformer = new GatewayMoneybookers.PaymentXmlTransformer <TPaymentMethod>(); var paymentRequestData = paymentTransformer.TransformRequest(paymentRequest, paymentMethodXmlTransformer); // Submit request and get response string paymentResponseData = null; string result = String.Empty; int maxAttempts = AppLogic.AppConfigUSInt("GatewayRetries") + 1; DB.ExecuteSQL("update orders set RefundTXCommand=" + DB.SQuote(paymentRequestData) + " where OrderNumber=" + originalOrderNumber.ToString()); for (int attemptCount = 0; attemptCount < maxAttempts; attemptCount++) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestUri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; try { using (var requestStream = request.GetRequestStream()) { using (StreamWriter requestWriter = new StreamWriter(requestStream)) { requestWriter.Write("load={0}", Uri.EscapeDataString(paymentRequestData)); requestWriter.Close(); } requestStream.Close(); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (var responseStream = response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { paymentResponseData = responseReader.ReadToEnd(); responseReader.Close(); } responseStream.Close(); } break; } #if DEBUG catch (WebException exception) { using (var responseStream = exception.Response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}{1}", exception.Message, responseReader.ReadToEnd()); responseReader.Close(); } responseStream.Close(); } } #endif catch (Exception exception) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}", exception.Message); } } // Process response if (paymentResponseData != null) { GatewayMoneybookers.PaymentResponse paymentResponse = paymentTransformer.TransformResponse(paymentResponseData); DB.ExecuteSQL("update orders set RefundTXResult=" + DB.SQuote(paymentResponseData) + " where OrderNumber=" + originalOrderNumber.ToString()); if (paymentResponse.Result.ToUpperInvariant() == "ACK") { result = AppLogic.ro_OK; // We can't record the transaction ID because the field is not long enough //DB.ExecuteSQL("update orders set AuthorizationPNREF=AuthorizationPNREF+" + DB.SQuote("|REFUND=" + paymentResponse.TransactionUniqueId) + " where OrderNumber=" + originalOrderNumber.ToString()); } else { result = String.Format("{0} - {1} - {2} - {3}", paymentResponse.Result, paymentResponse.Status, paymentResponse.Reason, paymentResponse.Return); if (result.Length == 0) { result = "Unspecified Error"; } } } return(result); }
public ExternalPaymentMethodContext BeginCheckout(AspDotNetStorefrontCore.ShoppingCart cart) { decimal amount = cart.Total(true); GatewayMoneybookers.PaymentType paymentType = GatewayMoneybookers.PaymentType.Capture; string customerIpAddress = CommonLogic.CustomerIpAddress(); if (customerIpAddress == "::1") { customerIpAddress = "127.0.0.1"; } else if (customerIpAddress.Contains(":")) { throw new Exception("The Moneybookers payment gateway does not support IPv6."); } // Generate payment request GatewayMoneybookers.PaymentRequestBuilder requestBuilder = new GatewayMoneybookers.PaymentRequestBuilder(); var paymentRequest = requestBuilder.BuildQuickCheckoutRequest( GetEncryptedTransactionId(cart, amount), cart.ThisCustomer.CustomerID, cart.ThisCustomer.EMail, cart.ThisCustomer.PrimaryBillingAddress.FirstName, cart.ThisCustomer.PrimaryBillingAddress.LastName, cart.ThisCustomer.PrimaryBillingAddress.Address1, cart.ThisCustomer.PrimaryBillingAddress.City, CommonLogic.IIF(String.IsNullOrEmpty(cart.ThisCustomer.PrimaryBillingAddress.State), null, cart.ThisCustomer.PrimaryBillingAddress.State), cart.ThisCustomer.PrimaryBillingAddress.Zip, cart.ThisCustomer.PrimaryBillingAddress.Country, customerIpAddress, amount); GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.VirtualAccountPaymentMethod> paymentTransformer = new GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.VirtualAccountPaymentMethod>(); var paymentRequestData = paymentTransformer.TransformRequest(paymentRequest, new VirtualAccountPaymentMethodXmlTransformer()); // Submit request and get response string paymentResponseData = null; string result = String.Empty; int maxAttempts = AppLogic.AppConfigUSInt("GatewayRetries") + 1; for (int attemptCount = 0; attemptCount < maxAttempts; attemptCount++) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestUri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; try { using (var requestStream = request.GetRequestStream()) { using (StreamWriter requestWriter = new StreamWriter(requestStream)) { requestWriter.Write("load={0}", Uri.EscapeDataString(paymentRequestData)); requestWriter.Close(); } requestStream.Close(); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (var responseStream = response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { paymentResponseData = responseReader.ReadToEnd(); responseReader.Close(); } responseStream.Close(); } break; } #if DEBUG catch (WebException exception) { using (var responseStream = exception.Response.GetResponseStream()) { using (StreamReader responseReader = new StreamReader(responseStream)) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}{1}", exception.Message, responseReader.ReadToEnd()); responseReader.Close(); } responseStream.Close(); } } #endif catch (Exception exception) { result = String.Format("Error calling Skrill (Moneybookers) payment gateway. {0}", exception.Message); } } // Process response if (paymentResponseData != null) { GatewayMoneybookers.PaymentResponse paymentResponse = paymentTransformer.TransformResponse(paymentResponseData); result = String.Format("{0} - {1} - {2} - {3}", paymentResponse.Result, paymentResponse.Status, paymentResponse.Reason, paymentResponse.Return); if (paymentResponse.Result.ToUpperInvariant() == "ACK") { return(new ExternalPaymentMethodContext(result, paymentResponse.RedirectUrl, paymentResponse.RedirectParameters)); } else { if (result.Length == 0) { result = "Unspecified Error"; } return(new ExternalPaymentMethodContext(result)); } } else { return(new ExternalPaymentMethodContext(result)); } }
public ExternalPaymentMethodContext ProcessCallback(Dictionary <string, string> responseData) { try { GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.VirtualAccountPaymentMethod> paymentTransformer = new GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.VirtualAccountPaymentMethod>(); GatewayMoneybookers.PaymentResponse paymentResponse = paymentTransformer.TransformResponse(responseData["response"]); string result = String.Format("{0} - {1} - {2} - {3}", paymentResponse.Result, paymentResponse.Status, paymentResponse.Reason, paymentResponse.Return); if (paymentResponse.Result.ToUpperInvariant() != "ACK") { ErrorMessage errorMessage = new ErrorMessage(AspDotNetStorefrontCore.AppLogic.GetString("checkoutpayment.aspx.35", Customer.Current.SkinID, Customer.Current.LocaleSetting)); string redirectUrl = String.Format("{0}shoppingcart.aspx?ErrorMsg={1}", AppLogic.GetStoreHTTPLocation(false), errorMessage.MessageId); return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } int customerId = Int32.Parse(paymentResponse.SessionId); Customer customer = new Customer(customerId); ShoppingCart cart = new ShoppingCart(customer.SkinID, customer, CartTypeEnum.ShoppingCart, 0, false); Address billingAddress = new Address(); billingAddress.LoadByCustomer(customer.CustomerID, customer.PrimaryBillingAddressID, AddressTypes.Billing); billingAddress.ClearCCInfo(); billingAddress.UpdateDB(); var expectedTransactionId = GenerateTransactionId(cart, cart.Total(true)); var receivedTransactionId = DecryptTransactionId(paymentResponse.TransactionId); if (receivedTransactionId != expectedTransactionId) { ErrorMessage errorMessage = new ErrorMessage(AspDotNetStorefrontCore.AppLogic.GetString("checkoutpayment.aspx.38", Customer.Current.SkinID, Customer.Current.LocaleSetting)); string redirectUrl = String.Format("{0}shoppingcart.aspx?ErrorMsg={1}", AppLogic.GetStoreHTTPLocation(false), errorMessage.MessageId); return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } int orderNumber = AppLogic.GetNextOrderNumber(); String status = Gateway.MakeOrder(Gateway.ro_GWMONEYBOOKERS, AppLogic.TransactionMode(), cart, orderNumber, String.Empty, String.Empty, String.Empty, String.Empty); if (status != AppLogic.ro_OK) { throw new Exception("Gateway processing error: " + result); } string sql = String.Format("update Orders set AuthorizationResult={0}, PaymentGateway='MoneybookersQuickCheckout', AuthorizationPNREF={1}, TransactionCommand=null, AuthorizedOn=getDate() where OrderNumber={2}", DB.SQuote(paymentResponse.Return), DB.SQuote(String.Format("AUTH={0}|CAPTURE={0}", paymentResponse.TransactionUniqueId)), orderNumber); DB.ExecuteSQL(sql); Gateway.ProcessOrderAsCaptured(orderNumber); return(new ExternalPaymentMethodContext(result, AppLogic.GetStoreHTTPLocation(false) + "orderconfirmation.aspx?ordernumber=" + orderNumber, new Dictionary <string, string>())); } catch (Exception exception) { string result = "Error processing order: " + exception.ToString(); ErrorMessage errorMessage = new ErrorMessage(AspDotNetStorefrontCore.AppLogic.GetString("checkoutpayment.aspx.35", Customer.Current.SkinID, Customer.Current.LocaleSetting)); string redirectUrl = String.Format("{0}shoppingcart.aspx?ErrorMsg={1}", AppLogic.GetStoreHTTPLocation(false), errorMessage.MessageId); return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } }