mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Simplifies States
This commit is contained in:
parent
28861ca2de
commit
091ab9f48f
@ -20,8 +20,8 @@ package io.bitsquare.gui.main.portfolio.closed;
|
||||
import io.bitsquare.common.viewfx.model.ActivatableWithDataModel;
|
||||
import io.bitsquare.common.viewfx.model.ViewModel;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
@ -71,8 +71,8 @@ class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTradesDataMod
|
||||
String getState(ClosedTradesListItem item) {
|
||||
if (item != null && item.getTrade() != null) {
|
||||
Trade.LifeCycleState lifeCycleState = item.getTrade().lifeCycleStateProperty().get();
|
||||
if (lifeCycleState instanceof TakerAsBuyerTrade.LifeCycleState) {
|
||||
switch ((TakerAsBuyerTrade.LifeCycleState) lifeCycleState) {
|
||||
if (lifeCycleState instanceof TakerState.LifeCycleState) {
|
||||
switch ((TakerState.LifeCycleState) lifeCycleState) {
|
||||
case COMPLETED:
|
||||
return "Completed";
|
||||
case FAILED:
|
||||
@ -81,8 +81,8 @@ class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTradesDataMod
|
||||
throw new RuntimeException("That must not happen. We got a pending state but we are in the closed trades list.");
|
||||
}
|
||||
}
|
||||
else if (lifeCycleState instanceof OffererAsSellerTrade.LifeCycleState) {
|
||||
switch ((OffererAsSellerTrade.LifeCycleState) lifeCycleState) {
|
||||
else if (lifeCycleState instanceof OffererState.LifeCycleState) {
|
||||
switch ((OffererState.LifeCycleState) lifeCycleState) {
|
||||
case OFFER_CANCELED:
|
||||
return "Canceled";
|
||||
case COMPLETED:
|
||||
|
@ -27,10 +27,8 @@ import io.bitsquare.gui.main.portfolio.closed.ClosedTradesView;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.validation.BtcAddressValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.utils.Fiat;
|
||||
@ -276,7 +274,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||
}
|
||||
|
||||
private void updateTakerAsSellerState() {
|
||||
TakerAsSellerTrade.ProcessState processState = (TakerAsSellerTrade.ProcessState) dataModel.takerAsSellerProcessState.get();
|
||||
TakerState.ProcessState processState = (TakerState.ProcessState) dataModel.takerAsSellerProcessState.get();
|
||||
log.debug("updateTakerAsSellerState " + processState);
|
||||
if (processState != null) {
|
||||
switch (processState) {
|
||||
@ -319,7 +317,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||
}
|
||||
|
||||
private void updateOffererAsBuyerState() {
|
||||
OffererAsBuyerTrade.ProcessState processState = (OffererAsBuyerTrade.ProcessState) dataModel.offererAsBuyerProcessState.get();
|
||||
OffererState.ProcessState processState = (OffererState.ProcessState) dataModel.offererAsBuyerProcessState.get();
|
||||
log.debug("updateOffererAsBuyerState " + processState);
|
||||
if (processState != null) {
|
||||
switch (processState) {
|
||||
@ -355,7 +353,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||
}
|
||||
|
||||
private void updateTakerAsBuyerState() {
|
||||
TakerAsBuyerTrade.ProcessState processState = (TakerAsBuyerTrade.ProcessState) dataModel.takerAsBuyerProcessState.get();
|
||||
TakerState.ProcessState processState = (TakerState.ProcessState) dataModel.takerAsBuyerProcessState.get();
|
||||
log.debug("updateTakerAsBuyerState " + processState);
|
||||
if (processState != null) {
|
||||
switch (processState) {
|
||||
@ -398,7 +396,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||
}
|
||||
|
||||
private void updateOffererAsSellerState() {
|
||||
OffererAsSellerTrade.ProcessState processState = (OffererAsSellerTrade.ProcessState) dataModel.offererAsSellerProcessState.get();
|
||||
OffererState.ProcessState processState = (OffererState.ProcessState) dataModel.offererAsSellerProcessState.get();
|
||||
log.debug("updateOffererAsSellerState " + processState);
|
||||
if (processState != null) {
|
||||
switch (processState) {
|
||||
|
@ -28,6 +28,7 @@ import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.offer.Offer;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.Coin;
|
||||
@ -234,7 +235,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
msg = "\nError message: " + trade.getErrorMessage();
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade) {
|
||||
switch ((TakerAsBuyerTrade.ProcessState) newValue) {
|
||||
switch ((TakerState.ProcessState) newValue) {
|
||||
case TAKE_OFFER_FEE_TX_CREATED:
|
||||
break;
|
||||
case DEPOSIT_PUBLISHED:
|
||||
@ -266,7 +267,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
}
|
||||
}
|
||||
else if (trade instanceof TakerAsSellerTrade) {
|
||||
switch ((TakerAsSellerTrade.ProcessState) newValue) {
|
||||
switch ((TakerState.ProcessState) newValue) {
|
||||
case TAKE_OFFER_FEE_TX_CREATED:
|
||||
break;
|
||||
case DEPOSIT_PUBLISHED:
|
||||
|
@ -39,28 +39,6 @@ public class OffererAsBuyerTrade extends Trade implements Serializable {
|
||||
// Enum
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public enum LifeCycleState implements Trade.LifeCycleState {
|
||||
OFFER_OPEN,
|
||||
OFFER_RESERVED,
|
||||
OFFER_CANCELED,
|
||||
PENDING,
|
||||
COMPLETED,
|
||||
FAILED
|
||||
}
|
||||
|
||||
public enum ProcessState implements Trade.ProcessState {
|
||||
UNDEFINED,
|
||||
DEPOSIT_PUBLISHED,
|
||||
DEPOSIT_CONFIRMED,
|
||||
|
||||
FIAT_PAYMENT_STARTED,
|
||||
|
||||
PAYOUT_PUBLISHED,
|
||||
|
||||
MESSAGE_SENDING_FAILED,
|
||||
EXCEPTION
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor, initialization
|
||||
@ -86,8 +64,8 @@ public class OffererAsBuyerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void initStates() {
|
||||
processState = ProcessState.UNDEFINED;
|
||||
lifeCycleState = LifeCycleState.OFFER_OPEN;
|
||||
processState = OffererState.ProcessState.UNDEFINED;
|
||||
lifeCycleState = OffererState.LifeCycleState.OFFER_OPEN;
|
||||
initStateProperties();
|
||||
}
|
||||
|
||||
@ -110,10 +88,10 @@ public class OffererAsBuyerTrade extends Trade implements Serializable {
|
||||
public void setProcessState(Trade.ProcessState processState) {
|
||||
super.setProcessState(processState);
|
||||
|
||||
switch ((ProcessState) processState) {
|
||||
switch ((OffererState.ProcessState) processState) {
|
||||
case EXCEPTION:
|
||||
disposeProtocol();
|
||||
setLifeCycleState(LifeCycleState.FAILED);
|
||||
setLifeCycleState(OffererState.LifeCycleState.FAILED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -122,7 +100,7 @@ public class OffererAsBuyerTrade extends Trade implements Serializable {
|
||||
public void setLifeCycleState(Trade.LifeCycleState lifeCycleState) {
|
||||
super.setLifeCycleState(lifeCycleState);
|
||||
|
||||
switch ((LifeCycleState) lifeCycleState) {
|
||||
switch ((OffererState.LifeCycleState) lifeCycleState) {
|
||||
case FAILED:
|
||||
disposeProtocol();
|
||||
break;
|
||||
@ -136,7 +114,7 @@ public class OffererAsBuyerTrade extends Trade implements Serializable {
|
||||
@Override
|
||||
public void setThrowable(Throwable throwable) {
|
||||
super.setThrowable(throwable);
|
||||
setProcessState(ProcessState.EXCEPTION);
|
||||
setProcessState(OffererState.ProcessState.EXCEPTION);
|
||||
}
|
||||
|
||||
|
||||
@ -146,7 +124,7 @@ public class OffererAsBuyerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void handleConfidenceResult() {
|
||||
if (((ProcessState) processState).ordinal() < ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(ProcessState.DEPOSIT_CONFIRMED);
|
||||
if (((OffererState.ProcessState) processState).ordinal() < OffererState.ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(OffererState.ProcessState.DEPOSIT_CONFIRMED);
|
||||
}
|
||||
}
|
||||
|
@ -35,35 +35,6 @@ public class OffererAsSellerTrade extends Trade implements Serializable {
|
||||
transient private static final Logger log = LoggerFactory.getLogger(OffererAsSellerTrade.class);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Enum
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public enum LifeCycleState implements Trade.LifeCycleState {
|
||||
OFFER_OPEN,
|
||||
OFFER_RESERVED,
|
||||
OFFER_CANCELED,
|
||||
PENDING,
|
||||
COMPLETED,
|
||||
FAILED
|
||||
}
|
||||
|
||||
public enum ProcessState implements Trade.ProcessState {
|
||||
UNDEFINED,
|
||||
DEPOSIT_PUBLISHED,
|
||||
DEPOSIT_CONFIRMED,
|
||||
|
||||
FIAT_PAYMENT_STARTED,
|
||||
|
||||
FIAT_PAYMENT_RECEIVED,
|
||||
|
||||
PAYOUT_PUBLISHED,
|
||||
|
||||
MESSAGE_SENDING_FAILED,
|
||||
EXCEPTION
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor, initialization
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -88,8 +59,8 @@ public class OffererAsSellerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void initStates() {
|
||||
processState = ProcessState.UNDEFINED;
|
||||
lifeCycleState = LifeCycleState.OFFER_OPEN;
|
||||
processState = OffererState.ProcessState.UNDEFINED;
|
||||
lifeCycleState = OffererState.LifeCycleState.OFFER_OPEN;
|
||||
initStateProperties();
|
||||
}
|
||||
|
||||
@ -112,10 +83,10 @@ public class OffererAsSellerTrade extends Trade implements Serializable {
|
||||
public void setProcessState(Trade.ProcessState processState) {
|
||||
super.setProcessState(processState);
|
||||
|
||||
switch ((ProcessState) processState) {
|
||||
switch ((OffererState.ProcessState) processState) {
|
||||
case EXCEPTION:
|
||||
disposeProtocol();
|
||||
setLifeCycleState(LifeCycleState.FAILED);
|
||||
setLifeCycleState(OffererState.LifeCycleState.FAILED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -124,7 +95,7 @@ public class OffererAsSellerTrade extends Trade implements Serializable {
|
||||
public void setLifeCycleState(Trade.LifeCycleState lifeCycleState) {
|
||||
super.setLifeCycleState(lifeCycleState);
|
||||
|
||||
switch ((LifeCycleState) lifeCycleState) {
|
||||
switch ((OffererState.LifeCycleState) lifeCycleState) {
|
||||
case FAILED:
|
||||
disposeProtocol();
|
||||
break;
|
||||
@ -137,7 +108,7 @@ public class OffererAsSellerTrade extends Trade implements Serializable {
|
||||
@Override
|
||||
public void setThrowable(Throwable throwable) {
|
||||
super.setThrowable(throwable);
|
||||
setProcessState(ProcessState.EXCEPTION);
|
||||
setProcessState(OffererState.ProcessState.EXCEPTION);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -146,8 +117,8 @@ public class OffererAsSellerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void handleConfidenceResult() {
|
||||
if (((ProcessState) processState).ordinal() < ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(ProcessState.DEPOSIT_CONFIRMED);
|
||||
if (((OffererState.ProcessState) processState).ordinal() < OffererState.ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(OffererState.ProcessState.DEPOSIT_CONFIRMED);
|
||||
}
|
||||
|
||||
}
|
||||
|
48
core/src/main/java/io/bitsquare/trade/OffererState.java
Normal file
48
core/src/main/java/io/bitsquare/trade/OffererState.java
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OffererState {
|
||||
private static final Logger log = LoggerFactory.getLogger(OffererState.class);
|
||||
|
||||
public enum LifeCycleState implements Trade.LifeCycleState {
|
||||
OFFER_OPEN,
|
||||
OFFER_RESERVED,
|
||||
OFFER_CANCELED,
|
||||
PENDING,
|
||||
COMPLETED,
|
||||
FAILED
|
||||
}
|
||||
|
||||
public enum ProcessState implements Trade.ProcessState {
|
||||
UNDEFINED,
|
||||
DEPOSIT_PUBLISHED,
|
||||
DEPOSIT_CONFIRMED,
|
||||
|
||||
FIAT_PAYMENT_STARTED,
|
||||
|
||||
FIAT_PAYMENT_RECEIVED,
|
||||
PAYOUT_PUBLISHED,
|
||||
|
||||
MESSAGE_SENDING_FAILED,
|
||||
EXCEPTION
|
||||
}
|
||||
}
|
@ -37,35 +37,6 @@ public class TakerAsBuyerTrade extends Trade implements Serializable {
|
||||
transient private static final Logger log = LoggerFactory.getLogger(TakerAsBuyerTrade.class);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Enum
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public enum LifeCycleState implements Trade.LifeCycleState {
|
||||
PENDING,
|
||||
COMPLETED,
|
||||
FAILED
|
||||
}
|
||||
|
||||
public enum ProcessState implements Trade.ProcessState {
|
||||
UNDEFINED,
|
||||
TAKE_OFFER_FEE_TX_CREATED,
|
||||
TAKE_OFFER_FEE_PUBLISHED,
|
||||
TAKE_OFFER_FEE_PUBLISH_FAILED,
|
||||
|
||||
DEPOSIT_PUBLISHED,
|
||||
DEPOSIT_CONFIRMED,
|
||||
|
||||
FIAT_PAYMENT_STARTED,
|
||||
|
||||
FIAT_PAYMENT_RECEIVED,
|
||||
PAYOUT_PUBLISHED,
|
||||
|
||||
MESSAGE_SENDING_FAILED,
|
||||
EXCEPTION
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor, initialization
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -86,8 +57,8 @@ public class TakerAsBuyerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void initStates() {
|
||||
processState = ProcessState.UNDEFINED;
|
||||
lifeCycleState = TakerAsBuyerTrade.LifeCycleState.PENDING;
|
||||
processState = TakerState.ProcessState.UNDEFINED;
|
||||
lifeCycleState = TakerState.LifeCycleState.PENDING;
|
||||
initStateProperties();
|
||||
}
|
||||
|
||||
@ -121,10 +92,10 @@ public class TakerAsBuyerTrade extends Trade implements Serializable {
|
||||
public void setProcessState(Trade.ProcessState processState) {
|
||||
super.setProcessState(processState);
|
||||
|
||||
switch ((ProcessState) processState) {
|
||||
switch ((TakerState.ProcessState) processState) {
|
||||
case EXCEPTION:
|
||||
disposeProtocol();
|
||||
setLifeCycleState(TakerAsBuyerTrade.LifeCycleState.FAILED);
|
||||
setLifeCycleState(TakerState.LifeCycleState.FAILED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -133,7 +104,7 @@ public class TakerAsBuyerTrade extends Trade implements Serializable {
|
||||
public void setLifeCycleState(Trade.LifeCycleState lifeCycleState) {
|
||||
super.setLifeCycleState(lifeCycleState);
|
||||
|
||||
switch ((LifeCycleState) lifeCycleState) {
|
||||
switch ((TakerState.LifeCycleState) lifeCycleState) {
|
||||
case FAILED:
|
||||
disposeProtocol();
|
||||
break;
|
||||
@ -146,7 +117,7 @@ public class TakerAsBuyerTrade extends Trade implements Serializable {
|
||||
@Override
|
||||
public void setThrowable(Throwable throwable) {
|
||||
super.setThrowable(throwable);
|
||||
setProcessState(ProcessState.EXCEPTION);
|
||||
setProcessState(TakerState.ProcessState.EXCEPTION);
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +127,7 @@ public class TakerAsBuyerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void handleConfidenceResult() {
|
||||
if (((ProcessState) processState).ordinal() < ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(ProcessState.DEPOSIT_CONFIRMED);
|
||||
if (((TakerState.ProcessState) processState).ordinal() < TakerState.ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(TakerState.ProcessState.DEPOSIT_CONFIRMED);
|
||||
}
|
||||
}
|
||||
|
@ -34,36 +34,7 @@ public class TakerAsSellerTrade extends Trade implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(TakerAsSellerTrade.class);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Enum
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public enum LifeCycleState implements Trade.LifeCycleState {
|
||||
PENDING,
|
||||
COMPLETED,
|
||||
FAILED
|
||||
}
|
||||
|
||||
public enum ProcessState implements Trade.ProcessState {
|
||||
UNDEFINED,
|
||||
TAKE_OFFER_FEE_TX_CREATED,
|
||||
TAKE_OFFER_FEE_PUBLISHED,
|
||||
TAKE_OFFER_FEE_PUBLISH_FAILED,
|
||||
|
||||
DEPOSIT_PUBLISHED,
|
||||
DEPOSIT_CONFIRMED,
|
||||
|
||||
FIAT_PAYMENT_STARTED,
|
||||
|
||||
FIAT_PAYMENT_RECEIVED,
|
||||
PAYOUT_PUBLISHED,
|
||||
|
||||
MESSAGE_SENDING_FAILED,
|
||||
EXCEPTION
|
||||
}
|
||||
transient private static final Logger log = LoggerFactory.getLogger(TakerState.class);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -86,8 +57,8 @@ public class TakerAsSellerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void initStates() {
|
||||
processState = ProcessState.UNDEFINED;
|
||||
lifeCycleState = TakerAsSellerTrade.LifeCycleState.PENDING;
|
||||
processState = TakerState.ProcessState.UNDEFINED;
|
||||
lifeCycleState = TakerState.LifeCycleState.PENDING;
|
||||
initStateProperties();
|
||||
}
|
||||
|
||||
@ -119,21 +90,21 @@ public class TakerAsSellerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
public void setProcessState(Trade.ProcessState processState) {
|
||||
ProcessState state = (ProcessState) processState;
|
||||
TakerState.ProcessState state = (TakerState.ProcessState) processState;
|
||||
this.processState = processState;
|
||||
processStateProperty.set(processState);
|
||||
|
||||
switch (state) {
|
||||
case EXCEPTION:
|
||||
disposeProtocol();
|
||||
setLifeCycleState(TakerAsSellerTrade.LifeCycleState.FAILED);
|
||||
setLifeCycleState(TakerState.LifeCycleState.FAILED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLifeCycleState(Trade.LifeCycleState lifeCycleState) {
|
||||
LifeCycleState state = (LifeCycleState) lifeCycleState;
|
||||
TakerState.LifeCycleState state = (TakerState.LifeCycleState) lifeCycleState;
|
||||
switch (state) {
|
||||
case FAILED:
|
||||
disposeProtocol();
|
||||
@ -149,7 +120,7 @@ public class TakerAsSellerTrade extends Trade implements Serializable {
|
||||
@Override
|
||||
public void setThrowable(Throwable throwable) {
|
||||
super.setThrowable(throwable);
|
||||
setProcessState(ProcessState.EXCEPTION);
|
||||
setProcessState(TakerState.ProcessState.EXCEPTION);
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +130,7 @@ public class TakerAsSellerTrade extends Trade implements Serializable {
|
||||
|
||||
@Override
|
||||
protected void handleConfidenceResult() {
|
||||
if (((ProcessState) processState).ordinal() < ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(ProcessState.DEPOSIT_CONFIRMED);
|
||||
if (((TakerState.ProcessState) processState).ordinal() < TakerState.ProcessState.DEPOSIT_CONFIRMED.ordinal())
|
||||
setProcessState(TakerState.ProcessState.DEPOSIT_CONFIRMED);
|
||||
}
|
||||
}
|
||||
|
49
core/src/main/java/io/bitsquare/trade/TakerState.java
Normal file
49
core/src/main/java/io/bitsquare/trade/TakerState.java
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TakerState {
|
||||
private static final Logger log = LoggerFactory.getLogger(TakerState.class);
|
||||
|
||||
public enum LifeCycleState implements Trade.LifeCycleState {
|
||||
PENDING,
|
||||
COMPLETED,
|
||||
FAILED
|
||||
}
|
||||
|
||||
public enum ProcessState implements Trade.ProcessState {
|
||||
UNDEFINED,
|
||||
TAKE_OFFER_FEE_TX_CREATED,
|
||||
TAKE_OFFER_FEE_PUBLISHED,
|
||||
TAKE_OFFER_FEE_PUBLISH_FAILED,
|
||||
|
||||
DEPOSIT_PUBLISHED,
|
||||
DEPOSIT_CONFIRMED,
|
||||
|
||||
FIAT_PAYMENT_STARTED,
|
||||
|
||||
FIAT_PAYMENT_RECEIVED,
|
||||
PAYOUT_PUBLISHED,
|
||||
|
||||
MESSAGE_SENDING_FAILED,
|
||||
EXCEPTION
|
||||
}
|
||||
}
|
@ -169,9 +169,9 @@ public class TradeManager {
|
||||
|
||||
boolean failed = false;
|
||||
if (trade instanceof TakerAsSellerTrade)
|
||||
failed = trade.lifeCycleState == TakerAsSellerTrade.LifeCycleState.FAILED;
|
||||
failed = trade.lifeCycleState == TakerState.LifeCycleState.FAILED;
|
||||
else if (trade instanceof TakerAsBuyerTrade)
|
||||
failed = trade.lifeCycleState == TakerAsBuyerTrade.LifeCycleState.FAILED;
|
||||
failed = trade.lifeCycleState == TakerState.LifeCycleState.FAILED;
|
||||
|
||||
if (failed) {
|
||||
failedTrades.add(trade);
|
||||
@ -291,7 +291,7 @@ public class TradeManager {
|
||||
private void setupDepositPublishedListener(Trade trade) {
|
||||
trade.processStateProperty().addListener((ov, oldValue, newValue) -> {
|
||||
log.debug("setupDepositPublishedListener state = " + newValue);
|
||||
if (newValue == OffererAsBuyerTrade.ProcessState.DEPOSIT_PUBLISHED || newValue == OffererAsSellerTrade.ProcessState.DEPOSIT_PUBLISHED) {
|
||||
if (newValue == OffererState.ProcessState.DEPOSIT_PUBLISHED || newValue == OffererState.ProcessState.DEPOSIT_PUBLISHED) {
|
||||
removeOpenOffer(trade.getOffer(),
|
||||
() -> log.debug("remove offer was successful"),
|
||||
log::error,
|
||||
@ -320,9 +320,9 @@ public class TradeManager {
|
||||
|
||||
if (isCancelRequest) {
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_CANCELED);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_CANCELED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_CANCELED);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_CANCELED);
|
||||
closedTrades.add(trade);
|
||||
trade.disposeProtocol();
|
||||
}
|
||||
@ -411,13 +411,13 @@ public class TradeManager {
|
||||
if (transaction != null) {
|
||||
log.info("onWithdraw onSuccess tx ID:" + transaction.getHashAsString());
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.COMPLETED);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.COMPLETED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setLifeCycleState(TakerAsSellerTrade.LifeCycleState.COMPLETED);
|
||||
trade.setLifeCycleState(TakerState.LifeCycleState.COMPLETED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.COMPLETED);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.COMPLETED);
|
||||
else if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setLifeCycleState(TakerAsBuyerTrade.LifeCycleState.COMPLETED);
|
||||
trade.setLifeCycleState(TakerState.LifeCycleState.COMPLETED);
|
||||
|
||||
pendingTrades.remove(trade);
|
||||
closedTrades.add(trade);
|
||||
|
@ -24,6 +24,7 @@ import io.bitsquare.p2p.MessageHandler;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.protocol.Protocol;
|
||||
import io.bitsquare.trade.protocol.availability.messages.ReportOfferAvailabilityMessage;
|
||||
import io.bitsquare.trade.protocol.availability.messages.RequestIsOfferAvailableMessage;
|
||||
@ -109,7 +110,7 @@ public class BuyerAsOffererProtocol implements Protocol {
|
||||
// to take the
|
||||
// offer
|
||||
// at the same time
|
||||
boolean isOfferOpen = offererAsBuyerTrade.lifeCycleStateProperty().get() == OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN;
|
||||
boolean isOfferOpen = offererAsBuyerTrade.lifeCycleStateProperty().get() == OffererState.LifeCycleState.OFFER_OPEN;
|
||||
ReportOfferAvailabilityMessage reportOfferAvailabilityMessage = new ReportOfferAvailabilityMessage(processModel.getId(), isOfferOpen);
|
||||
processModel.getMessageService().sendMessage(sender, reportOfferAvailabilityMessage, new SendMessageListener() {
|
||||
@Override
|
||||
@ -136,7 +137,7 @@ public class BuyerAsOffererProtocol implements Protocol {
|
||||
processModel.setTradeMessage(tradeMessage);
|
||||
offererAsBuyerTrade.setTradingPeer(taker);
|
||||
|
||||
offererAsBuyerTrade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_RESERVED);
|
||||
offererAsBuyerTrade.setLifeCycleState(OffererState.LifeCycleState.OFFER_RESERVED);
|
||||
|
||||
TaskRunner<OffererAsBuyerTrade> taskRunner = new TaskRunner<>(offererAsBuyerTrade,
|
||||
() -> log.debug("taskRunner at handleRequestDepositTxInputsMessage completed"),
|
||||
|
@ -22,6 +22,7 @@ import io.bitsquare.btc.TradeWalletService;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
|
||||
@ -54,10 +55,10 @@ public class OffererCreatesDepositTxInputs extends OffererTradeTask {
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade) {
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
}
|
||||
else if (trade instanceof OffererAsSellerTrade) {
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
}
|
||||
|
||||
failed(t);
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.buyer.offerer.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PayoutTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -47,9 +48,9 @@ public class OffererProcessPayoutTxPublishedMessage extends OffererTradeTask {
|
||||
trade.setPayoutTx(checkNotNull(message.payoutTx));
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(OffererState.ProcessState.PAYOUT_PUBLISHED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(OffererState.ProcessState.PAYOUT_PUBLISHED);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.buyer.offerer.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestDepositTxInputsMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -54,9 +55,9 @@ public class OffererProcessRequestDepositTxInputsMessage extends OffererTradeTas
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
|
||||
failed(t);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.buyer.offerer.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPublishDepositTxMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -61,9 +62,9 @@ public class OffererProcessRequestPublishDepositTxMessage extends OffererTradeTa
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
|
||||
failed(t);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.DepositTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -53,9 +54,9 @@ public class OffererSendsDepositTxPublishedMessage extends OffererTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
failed();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.FiatTransferStartedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -53,10 +54,10 @@ public class OffererSendsFiatTransferStartedMessage extends OffererTradeTask {
|
||||
log.trace("Sending FiatTransferStartedMessage succeeded.");
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade) {
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererAsBuyerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
}
|
||||
else if (trade instanceof OffererAsSellerTrade) {
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererAsSellerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
}
|
||||
|
||||
complete();
|
||||
@ -68,10 +69,10 @@ public class OffererSendsFiatTransferStartedMessage extends OffererTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade) {
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
}
|
||||
else if (trade instanceof OffererAsSellerTrade) {
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
}
|
||||
|
||||
failed();
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPayDepositMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -60,12 +61,12 @@ public class OffererSendsRequestSellerDepositPaymentMessage extends OffererTrade
|
||||
appendToErrorMessage("Sending RequestTakerDepositPaymentMessage failed");
|
||||
trade.setErrorMessage(errorMessage);
|
||||
if (trade instanceof OffererAsBuyerTrade) {
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsBuyerTrade) trade).setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsBuyerTrade) trade).setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
}
|
||||
else if (trade instanceof OffererAsSellerTrade) {
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsSellerTrade) trade).setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsSellerTrade) trade).setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
}
|
||||
|
||||
failed();
|
||||
@ -76,12 +77,12 @@ public class OffererSendsRequestSellerDepositPaymentMessage extends OffererTrade
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade) {
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsSellerTrade) trade).setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
((OffererAsBuyerTrade) trade).setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsSellerTrade) trade).setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
}
|
||||
else if (trade instanceof OffererAsSellerTrade) {
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsSellerTrade) trade).setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
((OffererAsSellerTrade) trade).setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((OffererAsSellerTrade) trade).setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
}
|
||||
|
||||
failed(t);
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
|
||||
@ -63,12 +64,12 @@ public class OffererSignsAndPublishDepositTx extends OffererTradeTask {
|
||||
trade.setDepositTx(transaction);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade) {
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.PENDING);
|
||||
trade.setProcessState(OffererState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.PENDING);
|
||||
}
|
||||
else if (trade instanceof OffererAsSellerTrade) {
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.PENDING);
|
||||
trade.setProcessState(OffererState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.PENDING);
|
||||
}
|
||||
|
||||
complete();
|
||||
@ -80,9 +81,9 @@ public class OffererSignsAndPublishDepositTx extends OffererTradeTask {
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
|
||||
failed(t);
|
||||
}
|
||||
@ -92,9 +93,9 @@ public class OffererSignsAndPublishDepositTx extends OffererTradeTask {
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
|
||||
failed(t);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.Contract;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
import io.bitsquare.util.Utilities;
|
||||
@ -63,9 +64,9 @@ public class OffererVerifiesAndSignsContract extends OffererTradeTask {
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
|
||||
failed(t);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.buyer.taker.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PayoutTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -47,9 +48,9 @@ public class TakerProcessPayoutTxPublishedMessage extends TakerTradeTask {
|
||||
trade.setPayoutTx(checkNotNull(message.payoutTx));
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.PAYOUT_PUBLISHED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.PAYOUT_PUBLISHED);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.DepositTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -53,9 +54,9 @@ public class TakerSendsDepositTxPublishedMessage extends TakerTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
failed();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.FiatTransferStartedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -53,10 +54,10 @@ public class TakerSendsFiatTransferStartedMessage extends TakerTradeTask {
|
||||
log.trace("Sending FiatTransferStartedMessage succeeded.");
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade) {
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
trade.setProcessState(TakerState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
}
|
||||
else if (trade instanceof TakerAsSellerTrade) {
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
trade.setProcessState(TakerState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
}
|
||||
|
||||
complete();
|
||||
@ -68,10 +69,10 @@ public class TakerSendsFiatTransferStartedMessage extends TakerTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade) {
|
||||
((TakerAsBuyerTrade) trade).setProcessState(TakerAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
((TakerAsBuyerTrade) trade).setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
}
|
||||
else if (trade instanceof TakerAsSellerTrade) {
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
}
|
||||
|
||||
failed();
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestDepositTxInputsMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -73,9 +74,9 @@ public class TakerSendsRequestDepositTxInputsMessage extends TakerTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
|
||||
failed();
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPayDepositFromOffererMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -61,9 +62,9 @@ public class TakerSendsRequestPayDepositMessage extends TakerTradeTask {
|
||||
appendToErrorMessage("Sending RequestTakerDepositPaymentMessage failed");
|
||||
trade.setErrorMessage(errorMessage);
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
failed();
|
||||
}
|
||||
@ -73,10 +74,10 @@ public class TakerSendsRequestPayDepositMessage extends TakerTradeTask {
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade) {
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
}
|
||||
else if (trade instanceof TakerAsSellerTrade) {
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
}
|
||||
|
||||
failed(t);
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPublishDepositTxMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -63,9 +64,9 @@ public class TakerSendsRequestPublishDepositTxMessage extends TakerTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
failed();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
|
||||
@ -63,12 +64,12 @@ public class TakerSignsAndPublishDepositTx extends TakerTradeTask {
|
||||
trade.setDepositTx(transaction);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade) {
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(TakerAsBuyerTrade.LifeCycleState.PENDING);
|
||||
trade.setProcessState(TakerState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(TakerState.LifeCycleState.PENDING);
|
||||
}
|
||||
else if (trade instanceof TakerAsSellerTrade) {
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(TakerAsSellerTrade.LifeCycleState.PENDING);
|
||||
trade.setProcessState(TakerState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setLifeCycleState(TakerState.LifeCycleState.PENDING);
|
||||
}
|
||||
|
||||
complete();
|
||||
|
@ -24,6 +24,7 @@ import io.bitsquare.p2p.MessageHandler;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.protocol.Protocol;
|
||||
import io.bitsquare.trade.protocol.availability.messages.ReportOfferAvailabilityMessage;
|
||||
import io.bitsquare.trade.protocol.availability.messages.RequestIsOfferAvailableMessage;
|
||||
@ -107,7 +108,7 @@ public class SellerAsOffererProtocol implements Protocol {
|
||||
// to take the
|
||||
// offer
|
||||
// at the same time
|
||||
boolean isOfferOpen = offererAsSellerTrade.lifeCycleStateProperty().get() == OffererAsSellerTrade.LifeCycleState.OFFER_OPEN;
|
||||
boolean isOfferOpen = offererAsSellerTrade.lifeCycleStateProperty().get() == OffererState.LifeCycleState.OFFER_OPEN;
|
||||
|
||||
ReportOfferAvailabilityMessage reportOfferAvailabilityMessage = new ReportOfferAvailabilityMessage(processModel.getId(), isOfferOpen);
|
||||
processModel.getMessageService().sendMessage(sender, reportOfferAvailabilityMessage, new SendMessageListener() {
|
||||
@ -185,7 +186,7 @@ public class SellerAsOffererProtocol implements Protocol {
|
||||
|
||||
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
||||
public void onFiatPaymentReceived() {
|
||||
offererAsSellerTrade.setProcessState(OffererAsSellerTrade.ProcessState.FIAT_PAYMENT_RECEIVED);
|
||||
offererAsSellerTrade.setProcessState(OffererState.ProcessState.FIAT_PAYMENT_RECEIVED);
|
||||
|
||||
TaskRunner<OffererAsSellerTrade> taskRunner = new TaskRunner<>(offererAsSellerTrade,
|
||||
() -> {
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.seller.offerer.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.DepositTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -47,9 +48,9 @@ public class OffererProcessDepositTxPublishedMessage extends OffererTradeTask {
|
||||
trade.setDepositTx(checkNotNull(message.depositTx));
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setProcessState(OffererState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setProcessState(OffererState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.seller.offerer.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.FiatTransferStartedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -50,9 +51,9 @@ public class OffererProcessFiatTransferStartedMessage extends OffererTradeTask {
|
||||
processModel.tradingPeer.setPayoutAddressString(nonEmptyStringOf(message.buyerPayoutAddress));
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
trade.setProcessState(OffererState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
trade.setProcessState(OffererState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PayoutTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -56,9 +57,9 @@ public class OffererSendsPayoutTxPublishedMessage extends OffererTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
failed();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPublishDepositTxFromTakerMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
@ -64,9 +65,9 @@ public class OffererSendsRequestPublishDepositTxFromTakerMessage extends Offerer
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(OffererState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
failed();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.seller.offerer.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
|
||||
@ -58,9 +59,9 @@ public class OffererSignsAndPublishPayoutTx extends OffererTradeTask {
|
||||
processModel.setPayoutTx(transaction);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setProcessState(OffererAsBuyerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(OffererState.ProcessState.PAYOUT_PUBLISHED);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setProcessState(OffererAsSellerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(OffererState.ProcessState.PAYOUT_PUBLISHED);
|
||||
|
||||
complete();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import io.bitsquare.p2p.Message;
|
||||
import io.bitsquare.p2p.MessageHandler;
|
||||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.Protocol;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSendsRequestDepositTxInputsMessage;
|
||||
@ -162,7 +163,7 @@ public class SellerAsTakerProtocol implements Protocol {
|
||||
|
||||
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
||||
public void onFiatPaymentReceived() {
|
||||
takerAsSellerTrade.setProcessState(TakerAsSellerTrade.ProcessState.FIAT_PAYMENT_RECEIVED);
|
||||
takerAsSellerTrade.setProcessState(TakerState.ProcessState.FIAT_PAYMENT_RECEIVED);
|
||||
|
||||
TaskRunner<TakerAsSellerTrade> taskRunner = new TaskRunner<>(takerAsSellerTrade,
|
||||
() -> {
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.seller.taker.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.DepositTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -47,9 +48,9 @@ public class TakerProcessDepositTxPublishedMessage extends TakerTradeTask {
|
||||
trade.setDepositTx(checkNotNull(message.depositTx));
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.DEPOSIT_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.DEPOSIT_PUBLISHED);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.seller.taker.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.FiatTransferStartedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -50,9 +51,9 @@ public class TakerProcessFiatTransferStartedMessage extends TakerTradeTask {
|
||||
processModel.tradingPeer.setPayoutAddressString(nonEmptyStringOf(message.buyerPayoutAddress));
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
trade.setProcessState(TakerState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
trade.setProcessState(TakerState.ProcessState.FIAT_PAYMENT_STARTED);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
@ -21,6 +21,7 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.p2p.listener.SendMessageListener;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PayoutTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
@ -56,9 +57,9 @@ public class TakerSendsPayoutTxPublishedMessage extends TakerTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.MESSAGE_SENDING_FAILED);
|
||||
|
||||
failed();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.seller.taker.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
|
||||
@ -58,9 +59,9 @@ public class TakerSignsAndPublishPayoutTx extends TakerTradeTask {
|
||||
processModel.setPayoutTx(transaction);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.PAYOUT_PUBLISHED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.PAYOUT_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.PAYOUT_PUBLISHED);
|
||||
|
||||
complete();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.shared.offerer.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.OffererAsBuyerTrade;
|
||||
import io.bitsquare.trade.OffererAsSellerTrade;
|
||||
import io.bitsquare.trade.OffererState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.OffererTradeTask;
|
||||
|
||||
@ -53,18 +54,18 @@ public class VerifyTakerAccount extends OffererTradeTask {
|
||||
failed("Account registration validation for peer failed.");
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
trade.setThrowable(t);
|
||||
|
||||
if (trade instanceof OffererAsBuyerTrade)
|
||||
trade.setLifeCycleState(OffererAsBuyerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
else if (trade instanceof OffererAsSellerTrade)
|
||||
trade.setLifeCycleState(OffererAsSellerTrade.LifeCycleState.OFFER_OPEN);
|
||||
trade.setLifeCycleState(OffererState.LifeCycleState.OFFER_OPEN);
|
||||
|
||||
failed(t);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.shared.taker.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
|
||||
@ -49,9 +50,9 @@ public class BroadcastTakeOfferFeeTx extends TakerTradeTask {
|
||||
log.debug("Take offer fee published successfully. Transaction ID = " + transaction.getHashAsString());
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.TAKE_OFFER_FEE_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.TAKE_OFFER_FEE_PUBLISHED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.TAKE_OFFER_FEE_PUBLISHED);
|
||||
trade.setProcessState(TakerState.ProcessState.TAKE_OFFER_FEE_PUBLISHED);
|
||||
complete();
|
||||
}
|
||||
|
||||
@ -62,9 +63,9 @@ public class BroadcastTakeOfferFeeTx extends TakerTradeTask {
|
||||
trade.setErrorMessage(errorMessage);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.TAKE_OFFER_FEE_PUBLISH_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.TAKE_OFFER_FEE_PUBLISH_FAILED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.TAKE_OFFER_FEE_PUBLISH_FAILED);
|
||||
trade.setProcessState(TakerState.ProcessState.TAKE_OFFER_FEE_PUBLISH_FAILED);
|
||||
|
||||
failed(t);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.protocol.trade.shared.taker.tasks;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerState;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.taker.tasks.TakerTradeTask;
|
||||
|
||||
@ -43,9 +44,9 @@ public class CreateTakeOfferFeeTx extends TakerTradeTask {
|
||||
processModel.setTakeOfferFeeTx(createTakeOfferFeeTx);
|
||||
|
||||
if (trade instanceof TakerAsBuyerTrade)
|
||||
trade.setProcessState(TakerAsBuyerTrade.ProcessState.TAKE_OFFER_FEE_TX_CREATED);
|
||||
trade.setProcessState(TakerState.ProcessState.TAKE_OFFER_FEE_TX_CREATED);
|
||||
else if (trade instanceof TakerAsSellerTrade)
|
||||
trade.setProcessState(TakerAsSellerTrade.ProcessState.TAKE_OFFER_FEE_TX_CREATED);
|
||||
trade.setProcessState(TakerState.ProcessState.TAKE_OFFER_FEE_TX_CREATED);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
Loading…
Reference in New Issue
Block a user