Exemplo n.º 1
0
        public CreditEditBuilder CreditEdit(decimal?amount = null)
        {
            if (!_settings.DeviceId.HasValue || !_settings.SiteId.HasValue || !_settings.LicenseId.HasValue || string.IsNullOrEmpty(_settings.UserName) || string.IsNullOrEmpty(_settings.Password))
            {
                throw new HpsConfigurationException("Device is not configured properly for Credit Edit. Please provide the device credentials in the ConnectionConfig.");
            }

            var service = new HpsFluentCreditService(new HpsServicesConfig()
            {
                DeviceId   = _settings.DeviceId.Value,
                SiteId     = _settings.SiteId.Value,
                LicenseId  = _settings.LicenseId.Value,
                UserName   = _settings.UserName,
                Password   = _settings.Password,
                ServiceUrl = _settings.Url
            });

            return(new CreditEditBuilder(service).WithAmount(amount));
        }
Exemplo n.º 2
0
        public void ChargeWithOutRewards()
        {
            var client = new HpsFluentCreditService(new HpsServicesConfig {
                SecretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A"
            });

            var card = new HpsCreditCard {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2020,
                Cvv      = "123"
            };

            var response = client.Charge(11m)
                           .WithCard(card)
                           .WithAllowDuplicates(true)
                           .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            Assert.IsNull(response.RewardsResponse);
        }