Search in sources :

Example 6 with DisputeCommunicationMessage

use of bisq.core.arbitration.messages.DisputeCommunicationMessage in project bisq-core by bisq-network.

the class DisputeManager method sendDisputeResultMessage.

// arbitrator send result to trader
public void sendDisputeResultMessage(DisputeResult disputeResult, Dispute dispute, String text) {
    DisputeCommunicationMessage disputeCommunicationMessage = new DisputeCommunicationMessage(dispute.getTradeId(), dispute.getTraderPubKeyRing().hashCode(), false, text, null, p2PService.getAddress(), new Date().getTime(), false, false, UUID.randomUUID().toString());
    dispute.addDisputeMessage(disputeCommunicationMessage);
    disputeResult.setDisputeCommunicationMessage(disputeCommunicationMessage);
    NodeAddress peerNodeAddress;
    Contract contract = dispute.getContract();
    if (contract.getBuyerPubKeyRing().equals(dispute.getTraderPubKeyRing()))
        peerNodeAddress = contract.getBuyerNodeAddress();
    else
        peerNodeAddress = contract.getSellerNodeAddress();
    p2PService.sendEncryptedMailboxMessage(peerNodeAddress, dispute.getTraderPubKeyRing(), new DisputeResultMessage(disputeResult, p2PService.getAddress(), UUID.randomUUID().toString()), new SendMailboxMessageListener() {

        @Override
        public void onArrived() {
            log.info("Message arrived at peer. tradeId={}", disputeCommunicationMessage.getTradeId());
            disputeCommunicationMessage.setArrived(true);
        }

        @Override
        public void onStoredInMailbox() {
            log.info("Message stored in mailbox. tradeId={}", disputeCommunicationMessage.getTradeId());
            disputeCommunicationMessage.setStoredInMailbox(true);
        }

        @Override
        public void onFault(String errorMessage) {
            log.error("sendEncryptedMailboxMessage failed. disputeCommunicationMessage=" + disputeCommunicationMessage);
        }
    });
}
Also used : DisputeResultMessage(bisq.core.arbitration.messages.DisputeResultMessage) NodeAddress(bisq.network.p2p.NodeAddress) SendMailboxMessageListener(bisq.network.p2p.SendMailboxMessageListener) Contract(bisq.core.trade.Contract) DisputeCommunicationMessage(bisq.core.arbitration.messages.DisputeCommunicationMessage) Date(java.util.Date)

Aggregations

DisputeCommunicationMessage (bisq.core.arbitration.messages.DisputeCommunicationMessage)6 Contract (bisq.core.trade.Contract)5 Date (java.util.Date)5 NodeAddress (bisq.network.p2p.NodeAddress)4 SendMailboxMessageListener (bisq.network.p2p.SendMailboxMessageListener)4 PubKeyRing (bisq.common.crypto.PubKeyRing)3 Timer (bisq.common.Timer)2 Trade (bisq.core.trade.Trade)2 UserThread (bisq.common.UserThread)1 Version (bisq.common.app.Version)1 KeyRing (bisq.common.crypto.KeyRing)1 Utilities (bisq.common.util.Utilities)1 PrivateNotificationManager (bisq.core.alert.PrivateNotificationManager)1 AppOptionKeys (bisq.core.app.AppOptionKeys)1 Attachment (bisq.core.arbitration.Attachment)1 Dispute (bisq.core.arbitration.Dispute)1 DisputeManager (bisq.core.arbitration.DisputeManager)1 DisputeResultMessage (bisq.core.arbitration.messages.DisputeResultMessage)1 OpenNewDisputeMessage (bisq.core.arbitration.messages.OpenNewDisputeMessage)1 PeerOpenedDisputeMessage (bisq.core.arbitration.messages.PeerOpenedDisputeMessage)1