Exemple #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 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");
                }
            }
        }