private void RequestPayment(IElectronicPayment payment, string paymentType) { XmlDocument requestDoc = CreatePaymentXml(payment, paymentType); //Record this request LogRequest(payment); LogXml("Sent request", requestDoc.DocumentElement.OuterXml); string response = HttpUtils.ReadHtmlPage(PaymentPageUrl, "POST", PAYMENT_POSTED_FIELD_NAME + "=" + requestDoc.DocumentElement.OuterXml); LogXml("Received response", response); //Doesn't seem to like header. Hope this isn't a problem XMLObject responseXml = new XMLObject(XMLUtils.StripXmlHeader(response)); string authCode = responseXml["//" + XML_TAG_TRANSACTION + "/" + XML_TAG_AUTH_CODE]; int ccErrCode = responseXml.GetInt32Value("//" + XML_TAG_TRANSACTION + "/" + XML_TAG_CARD_PROCESS_RESPONSE + "/" + XML_TAG_CC_ERROR_CODE); string transactionReference = responseXml["//" + XML_TAG_TRANSACTION + "/" + XML_TAG_ID]; payment.PaymentDate = DateTime.Now; payment.TransactionStatus = TranslatePaymentStatusCode(ccErrCode); payment.TransactionReference = transactionReference; payment.AuthorisationCode = authCode; }
public static object XmlToObject(string xml, object dest) { XMLObject obj = new XMLObject(xml); obj.PopulateObject(dest); return dest; }
public static string ObjectToXml(object objSource) { XMLObject obj = new XMLObject(objSource); return obj.XML; }
public void AppendXMLObject(XMLObject obj) { XmlNode newXml = _doc.ImportNode(obj.Node, true); Node.AppendChild(newXml); }