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