-
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.
- Loading branch information
jmacxx
committed
Sep 28, 2021
1 parent
852b9a6
commit 25e8779
Showing
12 changed files
with
334 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.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
import bisq.core.payment.payload.CelPayAccountPayload; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
public final class CelPayAccount extends PaymentAccount { | ||
public CelPayAccount() { | ||
super(PaymentMethod.CELPAY); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() { | ||
return new CelPayAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
public void setEmail(String accountId) { | ||
((CelPayAccountPayload) paymentAccountPayload).setEmail(accountId); | ||
} | ||
|
||
public String getEmail() { | ||
return ((CelPayAccountPayload) paymentAccountPayload).getEmail(); | ||
} | ||
|
||
public String getMessageForBuyer() { | ||
return "payment.celpay.info.buyer"; | ||
} | ||
|
||
public String getMessageForSeller() { | ||
return "payment.celpay.info.seller"; | ||
} | ||
|
||
public String getMessageForAccountCreation() { | ||
return "payment.celpay.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
89 changes: 89 additions & 0 deletions
89
core/src/main/java/bisq/core/payment/payload/CelPayAccountPayload.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 CelPayAccountPayload extends PaymentAccountPayload { | ||
private String email = ""; | ||
|
||
public CelPayAccountPayload(String paymentMethod, String id) { | ||
super(paymentMethod, id); | ||
} | ||
|
||
private CelPayAccountPayload(String paymentMethod, | ||
String id, | ||
String email, | ||
long maxTradePeriod, | ||
Map<String, String> excludeFromJsonDataMap) { | ||
super(paymentMethod, | ||
id, | ||
maxTradePeriod, | ||
excludeFromJsonDataMap); | ||
|
||
this.email = email; | ||
} | ||
|
||
@Override | ||
public Message toProtoMessage() { | ||
return getPaymentAccountPayloadBuilder() | ||
.setCelPayAccountPayload(protobuf.CelPayAccountPayload.newBuilder().setEmail(email)) | ||
.build(); | ||
} | ||
|
||
public static CelPayAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { | ||
return new CelPayAccountPayload(proto.getPaymentMethodId(), | ||
proto.getId(), | ||
proto.getCelPayAccountPayload().getEmail(), | ||
proto.getMaxTradePeriod(), | ||
new HashMap<>(proto.getExcludeFromJsonDataMap())); | ||
} | ||
|
||
@Override | ||
public String getPaymentDetails() { | ||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.email") + " " + email; | ||
} | ||
|
||
@Override | ||
public String getPaymentDetailsForTradePopup() { | ||
return getPaymentDetails(); | ||
} | ||
|
||
@Override | ||
public byte[] getAgeWitnessInputData() { | ||
return super.getAgeWitnessInputData(email.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
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 |
---|---|---|
|
@@ -161,7 +161,8 @@ private enum PaymentMethodMapper { | |
RTGS, | ||
IMPS, | ||
UPI, | ||
PAYTM | ||
PAYTM, | ||
CELPAY | ||
} | ||
|
||
@Getter | ||
|
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.