Beispiel #1
0
        public HostedActionRequest GetPaymentMethods(GetPaymentMethods getPaymentMethods)
        {
            var xml = string.Format(@"<?xml version=""1.0"" encoding=""UTF-8""?>
                <getpaymentmethods>
                <merchantid>{0}</merchantid>
                </getpaymentmethods>", getPaymentMethods.MerchantId);

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

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

            Assert.That(response.StatusCode, Is.EqualTo(107));
            Assert.That(response.Accepted, Is.False);
            Assert.That(response.ErrorMessage, Is.EqualTo("Transaction rejected by bank."));
            Assert.That(response.PaymentMethods.Count, Is.EqualTo(0));
        }
        public static void Initialize(TestContext context)
        {
            var config = new TestConfig
            {
                ResetHttpContext = true
            };

            var cartAdd         = new BaseIntegrationTest <CartAdd, CartResponse>(config);
            var cartAddRequest  = RequestBuilder.GetCartAddRequest();
            var cartAddResponse = (Response <CartResponse>)cartAdd.TestObject.Execute(cartAddRequest);

            var getPaymentMethods        = new BaseIntegrationTest <GetPaymentMethods, GetPaymentMethodsResponse>();
            var getPaymentMethodsRequest = new EmptyRequest();

            _result = (Response <GetPaymentMethodsResponse>)getPaymentMethods.TestObject.Execute(getPaymentMethodsRequest);

            _testObject = getPaymentMethods.TestObject;
        }
        public void TestGetPaymentMethodsResponse()
        {
            var responseXml = new XmlDocument();

            responseXml.LoadXml(@"<?xml version='1.0' encoding='UTF-8'?>
                        <response>
                            <statuscode>0</statuscode>
                            <paymentmethods>
                                <paymentmethod>BANKAXESS</paymentmethod>
                                <paymentmethod>DBNORDEASE</paymentmethod>
                            </paymentmethods>
                        </response>");
            GetPaymentMethodsResponse response = GetPaymentMethods.Response(responseXml);

            Assert.That(response.StatusCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
            Assert.That(response.ErrorMessage, Is.Empty);
            Assert.That(response.PaymentMethods.Count, Is.EqualTo(2));
            Assert.That(response.PaymentMethods[0], Is.EqualTo("BANKAXESS"));
            Assert.That(response.PaymentMethods[1], Is.EqualTo("DBNORDEASE"));
        }