Updates to 'Edit Offer' to allow for change of market and payment method

Display the trading account group on edit offer screen which allows
the market and payment method to be chosen.

When applying the edits to the new offer payload, merge in appropriate
fields that describe the market & payment method:
- base and counter currency codes
- payment method and account
- country code, accepted country codes
- bankid and accepted bankIds

Fixes #4720
This commit is contained in:
jmacxx 2020-10-29 11:06:47 -05:00
parent 50ab4283b2
commit f73aaae3c7
No known key found for this signature in database
GPG Key ID: 155297BABFE94A1B
3 changed files with 18 additions and 15 deletions

View File

@ -286,7 +286,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
Offer createAndGetOffer() {
protected Offer createAndGetOffer() {
return createOfferService.createAndGetOffer(offerId,
direction,
tradeCurrencyCode.get(),

View File

@ -179,28 +179,32 @@ class EditOfferDataModel extends MutableOfferDataModel {
}
public void onPublishOffer(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
// editedPayload is a merge of the original offerPayload and newOfferPayload
// fields which are editable are merged in from newOfferPayload (such as payment account details)
// fields which cannot change (most importantly BTC amount) are sourced from the original offerPayload
final OfferPayload offerPayload = openOffer.getOffer().getOfferPayload();
final OfferPayload newOfferPayload = createAndGetOffer().getOfferPayload();
final OfferPayload editedPayload = new OfferPayload(offerPayload.getId(),
offerPayload.getDate(),
offerPayload.getOwnerNodeAddress(),
offerPayload.getPubKeyRing(),
offerPayload.getDirection(),
getPrice().get().getValue(),
getMarketPriceMargin(),
isUseMarketBasedPriceValue(),
getAmount().get().getValue(),
getMinAmount().get().getValue(),
offerPayload.getBaseCurrencyCode(),
offerPayload.getCounterCurrencyCode(),
newOfferPayload.getPrice(),
newOfferPayload.getMarketPriceMargin(),
newOfferPayload.isUseMarketBasedPrice(),
offerPayload.getAmount(),
offerPayload.getMinAmount(),
newOfferPayload.getBaseCurrencyCode(),
newOfferPayload.getCounterCurrencyCode(),
offerPayload.getArbitratorNodeAddresses(),
offerPayload.getMediatorNodeAddresses(),
offerPayload.getPaymentMethodId(),
offerPayload.getMakerPaymentAccountId(),
newOfferPayload.getPaymentMethodId(),
newOfferPayload.getMakerPaymentAccountId(),
offerPayload.getOfferFeePaymentTxId(),
offerPayload.getCountryCode(),
offerPayload.getAcceptedCountryCodes(),
offerPayload.getBankId(),
offerPayload.getAcceptedBankIds(),
newOfferPayload.getCountryCode(),
newOfferPayload.getAcceptedCountryCodes(),
newOfferPayload.getBankId(),
newOfferPayload.getAcceptedBankIds(),
offerPayload.getVersionNr(),
offerPayload.getBlockHeightAtOfferCreation(),
offerPayload.getTxFee(),

View File

@ -119,7 +119,6 @@ public class EditOfferView extends MutableOfferView<EditOfferViewModel> {
// To force re-validation of payment account validation
onPaymentAccountsComboBoxSelected();
hidePaymentGroup();
}
@Override