예제 #1
0
        public void TestGetPolicy()
        {
            // Manually added this policy to contract
            var result = ContractsExecutorClient.GetPolicy("0x1c301Fa05f3aAb1C4479CD8E823d7b83297ac2d6", "3",
                                                           "c36ad8690cb7462286948da2ef152a17");

            Assert.AreEqual(15, result.Premium);
        }
        public void ClaimPoliciesInContract()
        {
            var claimablePolicies = _policiesRepository.GetClaimablePolicies();

            foreach (var policy in claimablePolicies)
            {
                var txId = ContractsExecutorClient.ClaimPolicy(policy);

                if (!string.IsNullOrEmpty(txId))
                {
                    _policiesRepository.UpdatePolicyAfterClaim(policy.Id, txId);
                    _logger.Info($"Policy status updated {policy.Id} to paidout");
                }
            }
        }
예제 #3
0
        public void TestClaimPolicy()
        {
            // Manually added this policy to contract
            var policy = new Policy
            {
                Id              = "c36ad8690cb7462286948da2ef152a17",
                ProductAddress  = "0x1c301Fa05f3aAb1C4479CD8E823d7b83297ac2d6",
                ProductTypeId   = "3",
                Payout          = 20,
                ClaimProperties = "Fake properties",
            };

            var result = ContractsExecutorClient.ClaimPolicy(policy);

            Assert.IsNotNull(result);
        }
        public void AddPoliciesToContract()
        {
            var draftPolicies = _policiesRepository.GetDraftPolicies();

            foreach (var policy in draftPolicies)
            {
                var contractPolicy = ContractsExecutorClient.GetPolicy(policy.ProductAddress, policy.ProductTypeId, policy.Id);

                if (contractPolicy.Premium > 0)
                {
                    var txId = ContractsExecutorClient.AddPolicy(policy);
                    _policiesRepository.UpdatePolicyAfterAdd(policy.Id, txId);
                    _logger.Info($"Policy status updated {policy.Id} to paid");
                }
            }
        }
예제 #5
0
        public void TestAddPolicy()
        {
            // Manually added this policy to contract
            var policy = new Policy
            {
                Id             = "c36ad8690cb7462286948da2ef152a17",
                ProductAddress = "0x1c301Fa05f3aAb1C4479CD8E823d7b83297ac2d6",
                ProductTypeId  = "3",
                Premium        = 15,
                Status         = PolicyStatus.Paid,
                StartUtc       = DateTime.Now,
                EndUtc         = DateTime.Now.AddDays(10),
                Payout         = 20,
                Properties     = "Fake properties",
                CreatedUtc     = DateTime.Now,
                ModifiedUtc    = DateTime.Now
            };

            var result = ContractsExecutorClient.AddPolicy(policy);

            Assert.IsNotNull(result);
        }