-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2505 from ManfredKarrer/add-deprecated-payment-me…
…thods-again Add removed deprecated payment methods again as it would break trade history
- Loading branch information
Showing
11 changed files
with
537 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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.core.payment; | ||
|
||
import bisq.core.locale.FiatCurrency; | ||
import bisq.core.payment.payload.CashAppAccountPayload; | ||
import bisq.core.payment.payload.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
// Removed due too high chargeback risk | ||
// Cannot be deleted as it would break old trade history entries | ||
@Deprecated | ||
@EqualsAndHashCode(callSuper = true) | ||
public final class CashAppAccount extends PaymentAccount { | ||
public CashAppAccount() { | ||
super(PaymentMethod.CASH_APP); | ||
setSingleTradeCurrency(new FiatCurrency("USD")); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new CashAppAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setCashTag(String cashTag) { | ||
((CashAppAccountPayload) paymentAccountPayload).setCashTag(cashTag); | ||
} | ||
|
||
public String getCashTag() { | ||
return ((CashAppAccountPayload) paymentAccountPayload).getCashTag(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.core.payment; | ||
|
||
import bisq.core.locale.CurrencyUtil; | ||
import bisq.core.payment.payload.OKPayAccountPayload; | ||
import bisq.core.payment.payload.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
// Cannot be deleted as it would break old trade history entries | ||
@Deprecated | ||
@EqualsAndHashCode(callSuper = true) | ||
public final class OKPayAccount extends PaymentAccount { | ||
public OKPayAccount() { | ||
super(PaymentMethod.OK_PAY); | ||
|
||
// Incorrect call but we don't want to keep Deprecated code in CurrencyUtil if not needed... | ||
tradeCurrencies.addAll(CurrencyUtil.getAllUpholdCurrencies()); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new OKPayAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setAccountNr(String accountNr) { | ||
((OKPayAccountPayload) paymentAccountPayload).setAccountNr(accountNr); | ||
} | ||
|
||
public String getAccountNr() { | ||
return ((OKPayAccountPayload) paymentAccountPayload).getAccountNr(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* 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.core.payment; | ||
|
||
import bisq.core.locale.FiatCurrency; | ||
import bisq.core.payment.payload.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
import bisq.core.payment.payload.VenmoAccountPayload; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
// Removed due too high chargeback risk | ||
// Cannot be deleted as it would break old trade history entries | ||
@Deprecated | ||
@EqualsAndHashCode(callSuper = true) | ||
public final class VenmoAccount extends PaymentAccount { | ||
public VenmoAccount() { | ||
super(PaymentMethod.VENMO); | ||
setSingleTradeCurrency(new FiatCurrency("USD")); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new VenmoAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setVenmoUserName(String venmoUserName) { | ||
((VenmoAccountPayload) paymentAccountPayload).setVenmoUserName(venmoUserName); | ||
} | ||
|
||
public String getVenmoUserName() { | ||
return ((VenmoAccountPayload) paymentAccountPayload).getVenmoUserName(); | ||
} | ||
|
||
public void setHolderName(String holderName) { | ||
((VenmoAccountPayload) paymentAccountPayload).setHolderName(holderName); | ||
} | ||
|
||
public String getHolderName() { | ||
return ((VenmoAccountPayload) paymentAccountPayload).getHolderName(); | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
core/src/main/java/bisq/core/payment/payload/CashAppAccountPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* 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.core.payment.payload; | ||
|
||
import bisq.core.locale.Res; | ||
|
||
import io.bisq.generated.protobuffer.PB; | ||
|
||
import com.google.protobuf.Message; | ||
|
||
import org.springframework.util.CollectionUtils; | ||
|
||
import java.nio.charset.Charset; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
// Cannot be deleted as it would break old trade history entries | ||
// Removed due too high chargeback risk | ||
@Deprecated | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString | ||
@Setter | ||
@Getter | ||
@Slf4j | ||
public final class CashAppAccountPayload extends PaymentAccountPayload { | ||
private String cashTag = ""; | ||
|
||
public CashAppAccountPayload(String paymentMethod, String id) { | ||
super(paymentMethod, id); | ||
} | ||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
// PROTO BUFFER | ||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
private CashAppAccountPayload(String paymentMethod, | ||
String id, | ||
String cashTag, | ||
long maxTradePeriod, | ||
Map<String, String> excludeFromJsonDataMap) { | ||
super(paymentMethod, | ||
id, | ||
maxTradePeriod, | ||
excludeFromJsonDataMap); | ||
|
||
this.cashTag = cashTag; | ||
} | ||
|
||
@Override | ||
public Message toProtoMessage() { | ||
return getPaymentAccountPayloadBuilder() | ||
.setCashAppAccountPayload(PB.CashAppAccountPayload.newBuilder() | ||
.setCashTag(cashTag)) | ||
.build(); | ||
} | ||
|
||
public static CashAppAccountPayload fromProto(PB.PaymentAccountPayload proto) { | ||
return new CashAppAccountPayload(proto.getPaymentMethodId(), | ||
proto.getId(), | ||
proto.getCashAppAccountPayload().getCashTag(), | ||
proto.getMaxTradePeriod(), | ||
CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap())); | ||
} | ||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
// API | ||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
@Override | ||
public String getPaymentDetails() { | ||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account") + " " + cashTag; | ||
} | ||
|
||
@Override | ||
public String getPaymentDetailsForTradePopup() { | ||
return getPaymentDetails(); | ||
} | ||
|
||
@Override | ||
public byte[] getAgeWitnessInputData() { | ||
return super.getAgeWitnessInputData(cashTag.getBytes(Charset.forName("UTF-8"))); | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
core/src/main/java/bisq/core/payment/payload/OKPayAccountPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* 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.core.payment.payload; | ||
|
||
import bisq.core.locale.Res; | ||
|
||
import io.bisq.generated.protobuffer.PB; | ||
|
||
import com.google.protobuf.Message; | ||
|
||
import org.springframework.util.CollectionUtils; | ||
|
||
import java.nio.charset.Charset; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
// Cannot be deleted as it would break old trade history entries | ||
@Deprecated | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString | ||
@Setter | ||
@Getter | ||
@Slf4j | ||
public final class OKPayAccountPayload extends PaymentAccountPayload { | ||
private String accountNr = ""; | ||
|
||
public OKPayAccountPayload(String paymentMethod, String id) { | ||
super(paymentMethod, id); | ||
} | ||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
// PROTO BUFFER | ||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
private OKPayAccountPayload(String paymentMethod, | ||
String id, | ||
String accountNr, | ||
long maxTradePeriod, | ||
Map<String, String> excludeFromJsonDataMap) { | ||
super(paymentMethod, | ||
id, | ||
maxTradePeriod, | ||
excludeFromJsonDataMap); | ||
|
||
this.accountNr = accountNr; | ||
} | ||
|
||
@Override | ||
public Message toProtoMessage() { | ||
return getPaymentAccountPayloadBuilder() | ||
.setOKPayAccountPayload(PB.OKPayAccountPayload.newBuilder() | ||
.setAccountNr(accountNr)) | ||
.build(); | ||
} | ||
|
||
public static OKPayAccountPayload fromProto(PB.PaymentAccountPayload proto) { | ||
return new OKPayAccountPayload(proto.getPaymentMethodId(), | ||
proto.getId(), | ||
proto.getOKPayAccountPayload().getAccountNr(), | ||
proto.getMaxTradePeriod(), | ||
CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap())); | ||
} | ||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
// API | ||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
@Override | ||
public String getPaymentDetails() { | ||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.no") + " " + accountNr; | ||
} | ||
|
||
@Override | ||
public String getPaymentDetailsForTradePopup() { | ||
return getPaymentDetails(); | ||
} | ||
|
||
@Override | ||
public byte[] getAgeWitnessInputData() { | ||
return super.getAgeWitnessInputData(accountNr.getBytes(Charset.forName("UTF-8"))); | ||
} | ||
} |
Oops, something went wrong.