예제 #1
0
 public AuthorizationBuilder WithFraudFilter(FraudFilterMode fraudFilter, FraudRuleCollection fraudRules = null)
 {
     FraudFilterMode = fraudFilter;
     if (fraudRules != null)
     {
         FraudRules = fraudRules;
     }
     return(this);
 }
예제 #2
0
        private FraudRuleCollection getFraudFilterRules(JsonDoc json)
        {
            var hppKeys = json.Keys.Where(x => x.StartsWith("HPP_FRAUDFILTER_RULE_")).ToList();

            if (hppKeys == null || !hppKeys.Any())
            {
                return(null);
            }
            FraudRuleCollection rules = new FraudRuleCollection();

            foreach (var key in hppKeys)
            {
                rules.AddRule(key.Replace("HPP_FRAUDFILTER_RULE_", ""), (FraudFilterMode)Enum.Parse(typeof(FraudFilterMode), json.GetValue <string>(key)));
            }
            return(rules);
        }
예제 #3
0
        public void FraudManagement_withFraudRules()
        {
            string              ruleId = "853c1d37-6e9f-467e-9ffc-182210b40c6b";
            FraudFilterMode     mode   = FraudFilterMode.OFF;
            FraudRuleCollection fraudRuleCollection = new FraudRuleCollection();

            fraudRuleCollection.AddRule(ruleId, mode);

            Transaction response = card.Charge(199.99m)
                                   .WithCurrency("EUR")
                                   .WithFraudFilter(FraudFilterMode.ACTIVE, fraudRuleCollection)
                                   .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            var rule = response?.FraudResponse?.Rules?.FirstOrDefault(x => x.Id == ruleId);

            Assert.IsNotNull(rule);
            Assert.AreEqual(rule.Action, "NOT_EXECUTED");
        }