def _ready_for_settlement( self, account_id: str, cmd: offchain.PaymentCommand) -> offchain.Command: if cmd.is_sender(): return cmd.new_command(status=Status.ready_for_settlement) sig_msg = cmd.travel_rule_metadata_signature_message( self.app.diem_account.hrp) sig = self.app.diem_account.sign_by_compliance_key(sig_msg).hex() kyc_data = self.app.store.find(Account, id=account_id).kyc_data_object() return cmd.new_command(recipient_signature=sig, kyc_data=kyc_data, status=Status.ready_for_settlement)
def _create_payment_command(self, account_id: str, cmd: offchain.PaymentCommand, validate: bool = False) -> None: self.app.store.create( PaymentCommand, before_create=lambda _: cmd.validate(None) if validate else None, account_id=account_id, is_sender=cmd.is_sender(), reference_id=cmd.reference_id(), is_inbound=cmd.is_inbound(), cid=cmd.id(), payment_object=asdict(cmd.payment), )