From d942f735f1ad48266d27bde3e241efaeb3c0dbf9 Mon Sep 17 00:00:00 2001 From: matthias zimmermann Date: Thu, 28 Jul 2022 10:23:07 +0200 Subject: [PATCH] add claim closing, refine payout handling --- contracts/components/Product.sol | 12 ++++++++---- contracts/modules/IPolicy.sol | 18 +++++++----------- contracts/services/IProductService.sol | 5 +++-- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/contracts/components/Product.sol b/contracts/components/Product.sol index bf09ba3..eaf5a20 100644 --- a/contracts/components/Product.sol +++ b/contracts/components/Product.sol @@ -174,10 +174,6 @@ abstract contract Product is data); } - function _declineClaim(bytes32 processId, uint256 claimId) internal { - _productService.declineClaim(processId, claimId); - } - function _confirmClaim( bytes32 processId, uint256 claimId, @@ -194,6 +190,14 @@ abstract contract Product is data); } + function _declineClaim(bytes32 processId, uint256 claimId) internal { + _productService.declineClaim(processId, claimId); + } + + function _closeClaim(bytes32 processId, uint256 claimId) internal { + _productService.closeClaim(processId, claimId); + } + function _newPayout( bytes32 processId, uint256 claimId, diff --git a/contracts/modules/IPolicy.sol b/contracts/modules/IPolicy.sol index c067c3f..a6ef910 100644 --- a/contracts/modules/IPolicy.sol +++ b/contracts/modules/IPolicy.sol @@ -32,14 +32,16 @@ interface IPolicy { event LogPremiumCollected(bytes32 processId, uint256 amount); - event LogClaimCreated(bytes32 processId, uint256 claimId); - event LogClaimConfirmed(bytes32 processId, uint256 claimId); + event LogClaimCreated(bytes32 processId, uint256 claimId, uint256 claimAmount); + event LogClaimConfirmed(bytes32 processId, uint256 claimId, uint256 confirmedAmount); event LogClaimDeclined(bytes32 processId, uint256 claimId); + event LogClaimClosed(bytes32 processId, uint256 claimId); event LogPayoutCreated( bytes32 processId, uint256 claimId, - uint256 payoutId + uint256 payoutId, + uint256 amount ); event LogPayoutProcessed( @@ -47,11 +49,6 @@ interface IPolicy { uint256 payoutId ); - event LogPayoutCompleted( - bytes32 processId, - uint256 payoutId - ); - // States enum PolicyFlowState {Started, Paused, Finished} enum ApplicationState {Applied, Revoked, Underwritten, Declined} @@ -145,6 +142,7 @@ interface IPolicy { function confirmClaim(bytes32 processId, uint256 claimId) external; function declineClaim(bytes32 processId, uint256 claimId) external; + function closeClaim(bytes32 processId, uint256 claimId) external; function createPayout( bytes32 processId, @@ -155,8 +153,6 @@ interface IPolicy { function processPayout( bytes32 processId, - uint256 payoutId, - bool isComplete, - bytes calldata data + uint256 payoutId ) external; } diff --git a/contracts/services/IProductService.sol b/contracts/services/IProductService.sol index 93d9ca8..653fa1f 100644 --- a/contracts/services/IProductService.sol +++ b/contracts/services/IProductService.sol @@ -31,8 +31,6 @@ interface IProductService { bytes calldata data ) external returns(uint256 claimId); - function declineClaim(bytes32 processId, uint256 claimId) external; - function confirmClaim( bytes32 processId, uint256 claimId, @@ -40,6 +38,9 @@ interface IProductService { bytes calldata data ) external returns(uint256 payoutId); + function declineClaim(bytes32 processId, uint256 claimId) external; + function closeClaim(bytes32 processId, uint256 claimId) external; + function newPayout( bytes32 processId, uint256 claimId,