-
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.
Add payment methods Tikkie and TransferWise-USD
- Loading branch information
jmacxx
committed
Nov 11, 2021
1 parent
284eaf2
commit f72b6c0
Showing
15 changed files
with
677 additions
and
2 deletions.
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
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,56 @@ | ||
/* | ||
* 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.payment.payload.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
import bisq.core.payment.payload.TikkieAccountPayload; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
public final class TikkieAccount extends CountryBasedPaymentAccount { | ||
public TikkieAccount() { | ||
super(PaymentMethod.TIKKIE); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new TikkieAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setIban(String iban) { | ||
((TikkieAccountPayload) paymentAccountPayload).setIban(iban); | ||
} | ||
|
||
public String getIban() { | ||
return ((TikkieAccountPayload) paymentAccountPayload).getIban(); | ||
} | ||
|
||
public String getMessageForBuyer() { | ||
return "payment.tikkie.info.buyer"; | ||
} | ||
|
||
public String getMessageForSeller() { | ||
return "payment.tikkie.info.seller"; | ||
} | ||
|
||
public String getMessageForAccountCreation() { | ||
return "payment.tikkie.info.account"; | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
core/src/main/java/bisq/core/payment/TransferwiseUsdAccount.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,72 @@ | ||
/* | ||
* 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.payment.payload.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
import bisq.core.payment.payload.TransferwiseUsdAccountPayload; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
public final class TransferwiseUsdAccount extends CountryBasedPaymentAccount { | ||
public TransferwiseUsdAccount() { | ||
super(PaymentMethod.TRANSFERWISE_USD); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new TransferwiseUsdAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setEmail(String email) { | ||
((TransferwiseUsdAccountPayload) paymentAccountPayload).setEmail(email); | ||
} | ||
|
||
public String getEmail() { | ||
return ((TransferwiseUsdAccountPayload) paymentAccountPayload).getEmail(); | ||
} | ||
|
||
public void setHolderName(String accountId) { | ||
((TransferwiseUsdAccountPayload) paymentAccountPayload).setHolderName(accountId); | ||
} | ||
|
||
public String getHolderName() { | ||
return ((TransferwiseUsdAccountPayload) paymentAccountPayload).getHolderName(); | ||
} | ||
|
||
public void setBeneficiaryAddress(String address) { | ||
((TransferwiseUsdAccountPayload) paymentAccountPayload).setBeneficiaryAddress(address); | ||
} | ||
|
||
public String getBeneficiaryAddress() { | ||
return ((TransferwiseUsdAccountPayload) paymentAccountPayload).getBeneficiaryAddress(); | ||
} | ||
|
||
public String getMessageForBuyer() { | ||
return "payment.transferwiseUsd.info.buyer"; | ||
} | ||
|
||
public String getMessageForSeller() { | ||
return "payment.transferwiseUsd.info.seller"; | ||
} | ||
|
||
public String getMessageForAccountCreation() { | ||
return "payment.transferwiseUsd.info.account"; | ||
} | ||
} |
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
99 changes: 99 additions & 0 deletions
99
core/src/main/java/bisq/core/payment/payload/TikkieAccountPayload.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,99 @@ | ||
/* | ||
* 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 com.google.protobuf.Message; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
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; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@ToString | ||
@Setter | ||
@Getter | ||
@Slf4j | ||
public final class TikkieAccountPayload extends CountryBasedPaymentAccountPayload { | ||
private String iban = ""; | ||
|
||
public TikkieAccountPayload(String paymentMethod, String id) { | ||
super(paymentMethod, id); | ||
} | ||
|
||
private TikkieAccountPayload(String paymentMethod, | ||
String id, | ||
String countryCode, | ||
String iban, | ||
long maxTradePeriod, | ||
Map<String, String> excludeFromJsonDataMap) { | ||
super(paymentMethod, | ||
id, | ||
countryCode, | ||
maxTradePeriod, | ||
excludeFromJsonDataMap); | ||
|
||
this.iban = iban; | ||
} | ||
|
||
@Override | ||
public Message toProtoMessage() { | ||
protobuf.TikkieAccountPayload.Builder builder = protobuf.TikkieAccountPayload.newBuilder() | ||
.setIban(iban); | ||
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder() | ||
.getCountryBasedPaymentAccountPayloadBuilder() | ||
.setTikkieAccountPayload(builder); | ||
return getPaymentAccountPayloadBuilder() | ||
.setCountryBasedPaymentAccountPayload(countryBasedPaymentAccountPayload) | ||
.build(); | ||
} | ||
|
||
public static TikkieAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { | ||
protobuf.CountryBasedPaymentAccountPayload countryBasedPaymentAccountPayload = proto.getCountryBasedPaymentAccountPayload(); | ||
protobuf.TikkieAccountPayload accountPayloadPB = countryBasedPaymentAccountPayload.getTikkieAccountPayload(); | ||
return new TikkieAccountPayload(proto.getPaymentMethodId(), | ||
proto.getId(), | ||
countryBasedPaymentAccountPayload.getCountryCode(), | ||
accountPayloadPB.getIban(), | ||
proto.getMaxTradePeriod(), | ||
new HashMap<>(proto.getExcludeFromJsonDataMap())); | ||
} | ||
|
||
@Override | ||
public String getPaymentDetails() { | ||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.iban") + " " + iban; | ||
} | ||
|
||
@Override | ||
public String getPaymentDetailsForTradePopup() { | ||
return getPaymentDetails(); | ||
} | ||
|
||
@Override | ||
public byte[] getAgeWitnessInputData() { | ||
return super.getAgeWitnessInputData(iban.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} |
Oops, something went wrong.