} // End of the CreditTransactionTest method /// <summary> /// Credit a production transaction /// </summary> public static Dictionary<string, string> CreditTransactionProduction(Order order, List<OrderRow> orderRows, KeyStringList settings) { // Create the dictionary to return Dictionary<string, string> responseData = new Dictionary<string, string>(10); // Create the PayEx order Annytab.Webshop.Payex.Production.PxOrder pxOrder = new Annytab.Webshop.Payex.Production.PxOrder(); // Get the currency Currency orderCurrency = Currency.GetOneById(order.currency_code); // Calculate the decimal multiplier Int32 decimalMultiplier = (Int32)Math.Pow(10, orderCurrency.decimals); // Get the data Int64 accountNumber = 0; Int64.TryParse(settings.Get("PAYEX-ACCOUNT-NUMBER"), out accountNumber); Int32 transactionNumber = 0; Int32.TryParse(order.payment_token, out transactionNumber); Int64 amount = (Int64)Math.Round(order.total_sum * 100, MidpointRounding.AwayFromZero); Int32 vatAmount = (Int32)Math.Round(order.vat_sum * 100, MidpointRounding.AwayFromZero); string additionalValues = ""; // Create the hash string hash = GetMD5Hash(accountNumber.ToString() + transactionNumber.ToString() + amount.ToString() + order.id.ToString() + vatAmount.ToString() + additionalValues + settings.Get("PAYEX-ENCRYPTION-KEY")); // Get the transaction information string xmlResponse = pxOrder.Credit5(accountNumber, transactionNumber, amount, order.id.ToString(), vatAmount, additionalValues, hash); // Parse the xml response XmlDocument doc = new XmlDocument(); try { // Load the xml document doc.LoadXml(xmlResponse); // Get data from the xml response responseData.Add("error_code", ParseXmlNode(doc, "/payex/status/errorCode")); responseData.Add("description", ParseXmlNode(doc, "/payex/status/description")); responseData.Add("parameter_name", ParseXmlNode(doc, "/payex/paramName")); responseData.Add("transaction_status", ParseXmlNode(doc, "/payex/transactionStatus")); responseData.Add("transaction_number", ParseXmlNode(doc, "/payex/originalTransactionNumber")); } catch (Exception ex) { responseData.Add("exception", ex.Message); } // Return the response data return responseData; } // End of the CreditTransactionProduction method