CashByMail show terms and conditions upon taking an offer

This commit is contained in:
jmacxx 2021-04-06 08:23:00 -05:00
parent b6f9231af9
commit 42428b79b9
No known key found for this signature in database
GPG Key ID: 155297BABFE94A1B
4 changed files with 93 additions and 2 deletions

View File

@ -3419,6 +3419,13 @@ payment.f2f.city.prompt=The city will be displayed with the offer
payment.shared.optionalExtra=Optional additional information
payment.shared.extraInfo=Additional information
payment.shared.extraInfo.prompt=Define any special terms, conditions, or details you would like to be displayed with your offers for this payment account (users will see this info before accepting offers).
payment.cashByMail.extraInfo.prompt=Please state on your offers: \n\n\
Country you are located (eg France); \n\
Countries / regions you would accept trades from (eg France, EU, or any European country); \n\
Any special terms/conditions; \n\
Any other details.
payment.cashByMail.tradingRestrictions=Please review the maker's terms and conditions.\n\
If you do not meet the requirements do not take this trade.
payment.f2f.info='Face to Face' trades have different rules and come with different risks than online transactions.\n\n\
The main differences are:\n\
The trading peers need to exchange information about the meeting location and time by using their provided contact details.\n\

View File

@ -96,7 +96,7 @@ public class CashByMailForm extends PaymentMethodForm {
});
TextArea extraTextArea = addTopLabelTextArea(gridPane, ++gridRow,
Res.get("payment.shared.optionalExtra"), Res.get("payment.shared.extraInfo.prompt")).second;
Res.get("payment.shared.optionalExtra"), Res.get("payment.cashByMail.extraInfo.prompt")).second;
extraTextArea.setMinHeight(70);
((JFXTextArea) extraTextArea).setLabelFloat(false);
extraTextArea.textProperty().addListener((ov, oldValue, newValue) -> {

View File

@ -40,6 +40,7 @@ import bisq.desktop.main.offer.OfferView;
import bisq.desktop.main.offer.OfferViewUtil;
import bisq.desktop.main.overlays.notifications.Notification;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.GenericMessageWindow;
import bisq.desktop.main.overlays.windows.OfferDetailsWindow;
import bisq.desktop.main.overlays.windows.QRCodeWindow;
import bisq.desktop.main.portfolio.PortfolioView;
@ -161,7 +162,8 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
isOfferAvailableSubscription;
private int gridRow = 0;
private boolean offerDetailsWindowDisplayed, clearXchangeWarningDisplayed, fasterPaymentsWarningDisplayed, takeOfferFromUnsignedAccountWarningDisplayed;
private boolean offerDetailsWindowDisplayed, clearXchangeWarningDisplayed, fasterPaymentsWarningDisplayed,
takeOfferFromUnsignedAccountWarningDisplayed, cashByMailWarningDisplayed;
private SimpleBooleanProperty errorPopupDisplayed;
private ChangeListener<Boolean> amountFocusedListener, getShowWalletFundedNotificationListener;
@ -307,6 +309,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
maybeShowTakeOfferFromUnsignedAccountWarning(model.dataModel.getOffer());
maybeShowClearXchangeWarning(lastPaymentAccount);
maybeShowFasterPaymentsWarning(lastPaymentAccount);
maybeShowCashByMailWarning(lastPaymentAccount, model.dataModel.getOffer());
if (!DevEnv.isDaoActivated() && !model.isRange()) {
nextButton.setVisible(false);
@ -1269,6 +1272,23 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
}
}
private void maybeShowCashByMailWarning(PaymentAccount paymentAccount, Offer offer) {
if (paymentAccount.getPaymentMethod().getId().equals(PaymentMethod.CASH_BY_MAIL_ID) &&
!cashByMailWarningDisplayed && !offer.getExtraInfo().isEmpty()) {
cashByMailWarningDisplayed = true;
UserThread.runAfter(() -> {
new GenericMessageWindow()
.preamble(Res.get("payment.cashByMail.tradingRestrictions"))
.instruction(offer.getExtraInfo())
.actionButtonText(Res.get("shared.iConfirm"))
.closeButtonText(Res.get("shared.close"))
.width(Layout.INITIAL_WINDOW_WIDTH)
.onClose(() -> close(false))
.show();
}, 500, TimeUnit.MILLISECONDS);
}
}
private Tuple2<Label, VBox> getTradeInputBox(HBox amountValueBox, String promptText) {
Label descriptionLabel = new AutoTooltipLabel(promptText);
descriptionLabel.setId("input-description-label");

View File

@ -0,0 +1,64 @@
/*
* This file is part of Bisq.
*
* Bisq 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.
*
* Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.desktop.main.overlays.windows;
import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.util.Layout;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import static bisq.desktop.util.FormBuilder.addMultilineLabel;
import static bisq.desktop.util.FormBuilder.addTextArea;
import static com.google.common.base.Preconditions.checkNotNull;
public class GenericMessageWindow extends Overlay<GenericMessageWindow> {
private String preamble;
public GenericMessageWindow() {
super();
}
public void show() {
createGridPane();
addHeadLine();
addContent();
addButtons();
applyStyles();
display();
}
public GenericMessageWindow preamble(String preamble) {
this.preamble = preamble;
return this;
}
private void addContent() {
if (preamble != null) {
Label label = addMultilineLabel(gridPane, ++rowIndex, preamble, 10);
label.setPrefSize(Layout.INITIAL_WINDOW_WIDTH, Layout.INITIAL_WINDOW_HEIGHT * 0.1);
}
checkNotNull(message, "message must not be null");
TextArea textArea = addTextArea(gridPane, ++rowIndex, "", 10);
textArea.setText(message);
textArea.setEditable(false);
textArea.setWrapText(true);
// sizes the textArea to fit within its parent container
textArea.setPrefSize(Layout.INITIAL_WINDOW_WIDTH, Layout.INITIAL_WINDOW_HEIGHT * 0.9);
}
}