Пример #1
0
        public void CC_Order()
        {
            var order = new NewOrderType(_credentials.Username, _credentials.Password, _credentials.MerchantId)
            {
                OrderID       = "100001",
                Amount        = PaymentechHelpers.ConvertAmount(10.00m),
                AVSaddress1   = "101 Main St.",
                AVSaddress2   = "Apt. 4",
                AVScity       = "New York",
                AVSstate      = "NY",
                AVSzip        = "10012",
                CustomerEmail = "*****@*****.**",
                AVSphoneNum   = "9089089080",
                AccountNum    = "4788250000028291",
                Exp           = "1120",
                MessageType   = ValidTransTypes.AC,
            };

            var orderResult = _client.NewOrder(order);

            Assert.NotNull(orderResult?.Response?.Item);
            var orderItem = (newOrderRespType)orderResult.Response.Item;

            Assert.Equal("0", orderItem.ProcStatus);
        }
Пример #2
0
        public void PaymentAmounts()
        {
            var amount1          = "144";
            var convertedAmount1 = PaymentechHelpers.ConvertAmount(amount1);

            Assert.Equal("14400", convertedAmount1);

            var amount2          = "13.2";
            var convertedAmount2 = PaymentechHelpers.ConvertAmount(amount2);

            Assert.Equal("1320", convertedAmount2);

            var amount3          = "9.90";
            var convertedAmount3 = PaymentechHelpers.ConvertAmount(amount3);

            Assert.Equal("990", convertedAmount3);
        }
Пример #3
0
        public void Duplicate_CC_Order()
        {
            var order = new NewOrderType(_credentials.Username, _credentials.Password, _credentials.MerchantId)
            {
                OrderID       = "100001",
                Amount        = PaymentechHelpers.ConvertAmount(10.00m),
                AVSaddress1   = "101 Main St.",
                AVSaddress2   = "Apt. 4",
                AVScity       = "New York",
                AVSstate      = "NY",
                AVSzip        = "10012",
                CustomerEmail = "*****@*****.**",
                AVSphoneNum   = "9089089080",
                AccountNum    = "4788250000028291",
                Exp           = "1124",
                MessageType   = validtranstypes.AC,
            };

            var traceNumber      = _client.NewTraceNumber();
            var cache            = _client.GetCache();
            var previousResponse = cache.GetValue(traceNumber);

            Assert.Null(previousResponse);

            var orderResult = _client.NewOrder(order, traceNumber);

            Assert.NotNull(orderResult?.Response?.Item);
            var orderItem = (newOrderRespType)orderResult.Response.Item;

            Assert.Equal("0", orderItem.ProcStatus);

            previousResponse = cache.GetValue(traceNumber);
            Assert.NotNull(previousResponse);

            var duplicateOrderResult = _client.NewOrder(order, traceNumber);

            Assert.NotNull(orderResult?.Response?.Item);
            var duplicateOrderItem = (newOrderRespType)duplicateOrderResult.Response.Item;

            Assert.Equal("0", duplicateOrderItem.ProcStatus);

            var duplicatePreviousResponse = cache.GetValue(traceNumber);

            Assert.NotNull(duplicatePreviousResponse);
            Assert.Equal(previousResponse, duplicatePreviousResponse);
        }
Пример #4
0
        public void ProfileOrder()
        {
            var profile       = ProfileTests.SetProfileDefaults(ProfileType.CreateProfile(_credentials.Username, _credentials.Password, _credentials.MerchantId));
            var profileResult = _client.Profile(profile);

            Assert.NotNull(profileResult?.Response?.Item);
            var profileItem = (profileRespType)profileResult.Response.Item;

            Assert.Equal("0", profileItem.ProfileProcStatus);
            Assert.False(string.IsNullOrEmpty(profileItem.CustomerRefNum));
            var customerRefNum = profileItem.CustomerRefNum;
            var order          = new NewOrderType(_credentials.Username, _credentials.Password, _credentials.MerchantId)
            {
                CustomerRefNum = customerRefNum,
                OrderID        = "100001",
                Amount         = PaymentechHelpers.ConvertAmount(10.00m),
            };
            var orderResult = _client.NewOrder(order);

            Assert.NotNull(orderResult?.Response?.Item);
            var orderItem = (newOrderRespType)orderResult.Response.Item;

            Assert.Equal("0", orderItem.ProcStatus);
        }