Beispiel #1
0
        ///<summary>Converts the XML string result from the EdgeExpress API for a QueryPayment to an XWebResponse.</summary>
        private static XWebResponse ConvertEdgeExpressResponse(string result)
        {
            EdgeExpressResponse eeResponse;

            using (StringReader sr = new StringReader(result)) {
                //XWeb's xml references this class as RESULT but OD wants to deserialize to a class called EdgeExpressResponse.
                //We must explicitly specific the XmlRoot node name here to make that conversion.
                eeResponse = (EdgeExpressResponse) new XmlSerializer(typeof(EdgeExpressResponse), new XmlRootAttribute("RESULT")).Deserialize(sr);
            }
            XWebResponse xResponse = new XWebResponse {
                AccountExpirationDate = new DateTime(2000 + eeResponse.EXPYEAR, eeResponse.EXPMONTH, 1),
                Alias               = eeResponse.ALIAS,
                Amount              = (double)eeResponse.APPROVEDAMOUNT,
                ApprovalCode        = eeResponse.APPROVALCODE,
                BatchNum            = eeResponse.BATCHNO,
                CardBrand           = eeResponse.CARDBRAND,
                CardCodeResponse    = eeResponse.CARDCODERESPONSE,
                CardType            = eeResponse.CARDTYPE,
                MaskedAcctNum       = eeResponse.MASKEDCARDNUMBER,
                ProcessorResponse   = eeResponse.PROCESSORRESPONSE,
                ReceiptID           = eeResponse.RECEIPTID,
                ResponseCode        = eeResponse.RESPONSECODE,
                ResponseDescription = eeResponse.RESPONSEDESCRIPTION,
                TransactionID       = eeResponse.TRANSACTIONID,
                TransactionType     = eeResponse.TRANSACTIONTYPE,
                XWebResponseCode    = XWebResponse.ConvertResponseCode(eeResponse.RESPONSECODE),
            };

            return(xResponse);
        }
Beispiel #2
0
 ///<summary>Convert output (in xml) from the XWeb gateway to GatewayResponse.</summary>
 private static XWebResponse CreateGatewayResponse(string xml)
 {
     using (StringReader sr = new StringReader(xml)) {
         //XWeb's xml references this class as GatewayResponse but OD wants to deserialize to a class called XWebResponse.
         //We must explicitly specific the XmlRoot node name here to make that conversion.
         XWebResponse ret = (XWebResponse)(new XmlSerializer(typeof(XWebResponse), new XmlRootAttribute("GatewayResponse")).Deserialize(sr));
         //Convert int to XWebStatus.
         ret.XWebResponseCode      = XWebResponse.ConvertResponseCode(ret.ResponseCode);
         ret.AccountExpirationDate = XWebResponse.ConvertExpDate(ret.ExpDate);
         return(ret);
     }
 }