Skip to content

Commit

Permalink
Merge pull request #4728 from jmacxx/edit_offer_change_market
Browse files Browse the repository at this point in the history
Updates to 'Edit Offer' to allow for change of market and payment method
  • Loading branch information
sqrrm authored Oct 31, 2020
2 parents 8f4339d + f73aaae commit b3a95ab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void onTabSelected(boolean isSelected) {
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////

Offer createAndGetOffer() {
protected Offer createAndGetOffer() {
return createOfferService.createAndGetOffer(offerId,
direction,
tradeCurrencyCode.get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,28 +179,32 @@ public void onStartEditOffer(ErrorMessageHandler errorMessageHandler) {
}

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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ protected void doActivate() {

// To force re-validation of payment account validation
onPaymentAccountsComboBoxSelected();
hidePaymentGroup();
}

@Override
Expand Down

0 comments on commit b3a95ab

Please sign in to comment.