-
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 #5745 from jmacxx/add_monese_satispay
Add payment methods Monese and Satispay
- Loading branch information
Showing
15 changed files
with
606 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
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.MoneseAccountPayload; | ||
import bisq.core.payment.payload.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
public final class MoneseAccount extends PaymentAccount { | ||
public MoneseAccount() { | ||
super(PaymentMethod.MONESE); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new MoneseAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setMobileNr(String accountId) { | ||
((MoneseAccountPayload) paymentAccountPayload).setMobileNr(accountId); | ||
} | ||
|
||
public String getMobileNr() { | ||
return ((MoneseAccountPayload) paymentAccountPayload).getMobileNr(); | ||
} | ||
|
||
public String getMessageForBuyer() { | ||
return "payment.monese.info.buyer"; | ||
} | ||
|
||
public String getMessageForSeller() { | ||
return "payment.monese.info.seller"; | ||
} | ||
|
||
public String getMessageForAccountCreation() { | ||
return "payment.monese.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
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.SatispayAccountPayload; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
public final class SatispayAccount extends CountryBasedPaymentAccount { | ||
public SatispayAccount() { | ||
super(PaymentMethod.SATISPAY); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new SatispayAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setMobileNr(String accountId) { | ||
((SatispayAccountPayload) paymentAccountPayload).setMobileNr(accountId); | ||
} | ||
|
||
public String getMobileNr() { | ||
return ((SatispayAccountPayload) paymentAccountPayload).getMobileNr(); | ||
} | ||
|
||
public String getMessageForBuyer() { | ||
return "payment.satispay.info.buyer"; | ||
} | ||
|
||
public String getMessageForSeller() { | ||
return "payment.satispay.info.seller"; | ||
} | ||
|
||
public String getMessageForAccountCreation() { | ||
return "payment.satispay.info.account"; | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
core/src/main/java/bisq/core/payment/payload/MoneseAccountPayload.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,89 @@ | ||
/* | ||
* 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 MoneseAccountPayload extends PaymentAccountPayload { | ||
private String mobileNr = ""; | ||
|
||
public MoneseAccountPayload(String paymentMethod, String id) { | ||
super(paymentMethod, id); | ||
} | ||
|
||
private MoneseAccountPayload(String paymentMethod, | ||
String id, | ||
String mobileNr, | ||
long maxTradePeriod, | ||
Map<String, String> excludeFromJsonDataMap) { | ||
super(paymentMethod, | ||
id, | ||
maxTradePeriod, | ||
excludeFromJsonDataMap); | ||
|
||
this.mobileNr = mobileNr; | ||
} | ||
|
||
@Override | ||
public Message toProtoMessage() { | ||
return getPaymentAccountPayloadBuilder() | ||
.setMoneseAccountPayload(protobuf.MoneseAccountPayload.newBuilder().setMobileNr(mobileNr)) | ||
.build(); | ||
} | ||
|
||
public static MoneseAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { | ||
return new MoneseAccountPayload(proto.getPaymentMethodId(), | ||
proto.getId(), | ||
proto.getMoneseAccountPayload().getMobileNr(), | ||
proto.getMaxTradePeriod(), | ||
new HashMap<>(proto.getExcludeFromJsonDataMap())); | ||
} | ||
|
||
@Override | ||
public String getPaymentDetails() { | ||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.mobile") + " " + mobileNr; | ||
} | ||
|
||
@Override | ||
public String getPaymentDetailsForTradePopup() { | ||
return getPaymentDetails(); | ||
} | ||
|
||
@Override | ||
public byte[] getAgeWitnessInputData() { | ||
return super.getAgeWitnessInputData(mobileNr.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} |
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/SatispayAccountPayload.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 SatispayAccountPayload extends CountryBasedPaymentAccountPayload { | ||
private String mobileNr = ""; | ||
|
||
public SatispayAccountPayload(String paymentMethod, String id) { | ||
super(paymentMethod, id); | ||
} | ||
|
||
private SatispayAccountPayload(String paymentMethod, | ||
String id, | ||
String countryCode, | ||
String mobileNr, | ||
long maxTradePeriod, | ||
Map<String, String> excludeFromJsonDataMap) { | ||
super(paymentMethod, | ||
id, | ||
countryCode, | ||
maxTradePeriod, | ||
excludeFromJsonDataMap); | ||
|
||
this.mobileNr = mobileNr; | ||
} | ||
|
||
@Override | ||
public Message toProtoMessage() { | ||
protobuf.SatispayAccountPayload.Builder builder = protobuf.SatispayAccountPayload.newBuilder() | ||
.setMobileNr(mobileNr); | ||
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder() | ||
.getCountryBasedPaymentAccountPayloadBuilder() | ||
.setSatispayAccountPayload(builder); | ||
return getPaymentAccountPayloadBuilder() | ||
.setCountryBasedPaymentAccountPayload(countryBasedPaymentAccountPayload) | ||
.build(); | ||
} | ||
|
||
public static SatispayAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { | ||
protobuf.CountryBasedPaymentAccountPayload countryBasedPaymentAccountPayload = proto.getCountryBasedPaymentAccountPayload(); | ||
protobuf.SatispayAccountPayload paytmAccountPayloadPB = countryBasedPaymentAccountPayload.getSatispayAccountPayload(); | ||
return new SatispayAccountPayload(proto.getPaymentMethodId(), | ||
proto.getId(), | ||
countryBasedPaymentAccountPayload.getCountryCode(), | ||
paytmAccountPayloadPB.getMobileNr(), | ||
proto.getMaxTradePeriod(), | ||
new HashMap<>(proto.getExcludeFromJsonDataMap())); | ||
} | ||
|
||
@Override | ||
public String getPaymentDetails() { | ||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.mobile") + " " + mobileNr; | ||
} | ||
|
||
@Override | ||
public String getPaymentDetailsForTradePopup() { | ||
return getPaymentDetails(); | ||
} | ||
|
||
@Override | ||
public byte[] getAgeWitnessInputData() { | ||
return super.getAgeWitnessInputData(mobileNr.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} |
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
Oops, something went wrong.