示例#1
0
        public HostedActionRequest Annul(Annul annul)
        {
            var xml = string.Format(@"<?xml version=""1.0"" encoding=""UTF-8""?>
                <annul>
                <transactionid>{0}</transactionid>
                </annul>", annul.TransactionId);

            return(new HostedActionRequest(xml, CountryCode, MerchantId, ConfigurationProvider, "/annul"));
        }
        public void TestAnnulResponseFailure()
        {
            var responseXml = new XmlDocument();

            responseXml.LoadXml(@"<?xml version='1.0' encoding='UTF-8'?>
                        <response>
                            <statuscode>107</statuscode>
                        </response>");
            AnnulResponse response = Annul.Response(responseXml);

            Assert.That(response.TransactionId, Is.Null);
            Assert.That(response.CustomerRefNo, Is.Null);
            Assert.That(response.ClientOrderNumber, Is.Null);
            Assert.That(response.StatusCode, Is.EqualTo(107));
            Assert.That(response.Accepted, Is.False);
            Assert.That(response.ErrorMessage, Is.EqualTo("Transaction rejected by bank."));
        }
        public void TestAnnulResponse()
        {
            var responseXml = new XmlDocument();

            responseXml.LoadXml(@"<?xml version='1.0' encoding='UTF-8'?>
                        <response>
                            <transaction id=""598972"">
                            <customerrefno>1ba66a0d653ca4cf3a5bc3eeb9ed1a2b4</customerrefno>
                            </transaction><statuscode>0</statuscode>
                        </response>");
            AnnulResponse response = Annul.Response(responseXml);

            Assert.That(response.TransactionId, Is.EqualTo(598972));
            Assert.That(response.CustomerRefNo, Is.EqualTo("1ba66a0d653ca4cf3a5bc3eeb9ed1a2b4"));
            Assert.That(response.ClientOrderNumber, Is.EqualTo("1ba66a0d653ca4cf3a5bc3eeb9ed1a2b4"));
            Assert.That(response.StatusCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
            Assert.That(response.ErrorMessage, Is.Empty);
        }