Example #1
0
 def _close_claim(self, claim):
     claim_address = helper.make_claim_address(claim.id)
     claim_data = claim.SerializeToString()
     states = {
         claim_address: claim_data
     }
     LOGGER.debug("_close_claim: " + str(states))
     self._context.set_state(
         states,
         timeout=self.TIMEOUT)
Example #2
0
 def _load_claim2(self, claim_id):
     claim = None
     claim_hex = helper.make_claim_address(claim_id)
     state_entries = self._context.get_state(
         [claim_hex],
         timeout=self.TIMEOUT)
     if state_entries:
         claim = payload_pb2.Claim()
         claim.ParseFromString(state_entries[0].data)
     return claim
Example #3
0
 def _load_claim(self, claim_id, clinic_pkey):
     claim = None
     claim_hex = [] if clinic_pkey is None and claim_id is None \
         else [helper.make_claim_address(claim_id, clinic_pkey)]
     state_entries = self._context.get_state(
         claim_hex,
         timeout=self.TIMEOUT)
     if state_entries:
         claim = payload_pb2.CreateClaim()
         claim.ParseFromString(state_entries[0].data)
     return claim
Example #4
0
    def _store_claim(self, claim):
        claim_address = helper.make_claim_address(claim.id)
        claim_patient_relation_address = helper.make_claim_patient__relation_address(claim.id,
                                                                                     claim.client_pkey)
        patient_claim_relation_address = helper.make_patient_claim__relation_address(claim.client_pkey,
                                                                                     claim.id)

        claim_data = claim.SerializeToString()
        states = {
            claim_address: claim_data,
            claim_patient_relation_address: str.encode(claim.client_pkey),
            patient_claim_relation_address: str.encode(claim.id)
        }
        LOGGER.debug("_store_claim: " + str(states))
        self._context.set_state(
            states,
            timeout=self.TIMEOUT)