Exemple #1
0
        public void Serialize()
        {
            // From SageDocs - response are in form:
            // Name=Value/r/n

            var fakeResponse = new FakePaymentTextResponse();
            fakeResponse.Collection = new Dictionary<string,string>();
            fakeResponse.Collection.Add("Test1", "TestValue1");
            fakeResponse.Collection.Add("Test2", "TestValue2");

            var expected = "Test1=TestValue1\r\nTest2=TestValue2";
            Assert.Equal(expected, fakeResponse.Write());
        }
Exemple #2
0
            public void AllFields()
            {
                var response = new FakePaymentTextResponse();
                var decode = SagePay.Request.Payment.WebSagePayment.Decode(response.Write());

                Assert.Equal(response.Collection["VPSProtocol"], decode.VPSProtocol);
                Assert.Equal(response.Collection["Status"], decode.Status.ToString().ToUpper());
                Assert.Equal(response.Collection["StatusDetail"], decode.StatusDetail);
                Assert.Equal(response.Collection["VPSTxId"], decode.VPSTxId);
                Assert.Equal(response.Collection["SecurityKey"], decode.SecurityKey);
                Assert.Equal(response.Collection["TxAuthNo"], decode.TxAuthNo.ToString());
                Assert.Equal(response.Collection["AVSCV2"].Replace(" ", ""), decode.AVSCV2.ToString().ToUpper());
                Assert.Equal(response.Collection["AddressResult"], decode.AddressResult.ToString().ToUpper());
                Assert.Equal(response.Collection["PostCodeResult"], decode.PostCodeResult.ToString().ToUpper());
                Assert.Equal(response.Collection["CV2Result"], decode.CV2Result.ToString().ToUpper());
                Assert.Equal(response.Collection["3DSecureStatus"], decode.ThreeDSecure.ToString().ToUpper());
                Assert.Equal(response.Collection["CAVV"], decode.Caav);
            }
Exemple #3
0
            public void ThreeDSecureTypes(SagePay.Response.ThreeDSecureStatus status)
            {
                var response = new FakePaymentTextResponse();
                response.Collection["3DSecureStatus"] = status.ToString().ToUpper();
                var decode = SagePay.Request.Payment.WebSagePayment.Decode(response.Write());

                Assert.Equal(status, decode.ThreeDSecure);
            }
Exemple #4
0
            public void AddressResultTypes(SagePay.Response.MatchStatus status, string code)
            {
                var response = new FakePaymentTextResponse();
                response.Collection["AddressResult"] = code;
                var decode = SagePay.Request.Payment.WebSagePayment.Decode(response.Write());

                Assert.Equal(status, decode.AddressResult);
            }
Exemple #5
0
            public void AVSCV2Types(SagePay.Response.CV2Status status, string code)
            {
                var response = new FakePaymentTextResponse();
                response.Collection["AVSCV2"] = code;
                var decode = SagePay.Request.Payment.WebSagePayment.Decode(response.Write());

                Assert.Equal(status, decode.AVSCV2);
            }