-
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 new payment method: Japan Bank Transfer (furikomi)
- Loading branch information
Showing
13 changed files
with
1,383 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
119 changes: 119 additions & 0 deletions
119
core/src/main/java/bisq/core/payment/JapanBankAccount.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,119 @@ | ||
/* | ||
* 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.JapanBankAccountPayload; | ||
import bisq.core.payment.payload.PaymentAccountPayload; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
import bisq.core.payment.payload.JapanBankAccountPayload; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import bisq.core.locale.Country; | ||
import bisq.core.locale.FiatCurrency; | ||
import bisq.core.payment.payload.JapanBankAccountPayload; | ||
|
||
public final class JapanBankAccount extends PaymentAccount | ||
{ | ||
public JapanBankAccount() | ||
{ | ||
super(PaymentMethod.JAPAN_BANK); | ||
setSingleTradeCurrency(new FiatCurrency("JPY")); | ||
} | ||
|
||
@Override | ||
protected PaymentAccountPayload createPayload() | ||
{ | ||
return new JapanBankAccountPayload(paymentMethod.getId(), id); | ||
} | ||
|
||
// bank name | ||
public String getBankName() | ||
{ | ||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankName(); | ||
} | ||
public void setBankName(String bankName) | ||
{ | ||
System.out.println("setBankName(): "+bankName); | ||
System.out.println("paymentAccountPayload is null? "+(paymentAccountPayload == null)); | ||
((JapanBankAccountPayload) paymentAccountPayload).setBankName(bankName); | ||
} | ||
|
||
// bank number | ||
public String getBankCode() | ||
{ | ||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankCode(); | ||
} | ||
public void setBankCode(String bankCode) | ||
{ | ||
((JapanBankAccountPayload) paymentAccountPayload).setBankCode(bankCode); | ||
} | ||
|
||
// branch name | ||
public String getBankBranchName() | ||
{ | ||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankBranchName(); | ||
} | ||
public void setBankBranchName(String bankBranchName) | ||
{ | ||
((JapanBankAccountPayload) paymentAccountPayload).setBankBranchName(bankBranchName); | ||
} | ||
|
||
// branch number | ||
public String getBankBranchCode() | ||
{ | ||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankBranchCode(); | ||
} | ||
public void setBankBranchCode(String bankBranchCode) | ||
{ | ||
((JapanBankAccountPayload) paymentAccountPayload).setBankBranchCode(bankBranchCode); | ||
} | ||
|
||
// account type | ||
public String getBankAccountType() | ||
{ | ||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankAccountType(); | ||
} | ||
public void setBankAccountType(String bankAccountType) | ||
{ | ||
((JapanBankAccountPayload) paymentAccountPayload).setBankAccountType(bankAccountType); | ||
} | ||
|
||
// account number | ||
public String getBankAccountNumber() | ||
{ | ||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankAccountNumber(); | ||
} | ||
public void setBankAccountNumber(String bankAccountNumber) | ||
{ | ||
((JapanBankAccountPayload) paymentAccountPayload).setBankAccountNumber(bankAccountNumber); | ||
} | ||
|
||
// account name | ||
public String getBankAccountName() | ||
{ | ||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankAccountName(); | ||
} | ||
public void setBankAccountName(String bankAccountName) | ||
{ | ||
((JapanBankAccountPayload) paymentAccountPayload).setBankAccountName(bankAccountName); | ||
} | ||
} |
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
147 changes: 147 additions & 0 deletions
147
core/src/main/java/bisq/core/payment/payload/JapanBankAccountPayload.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,147 @@ | ||
/* | ||
* 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 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 JapanBankAccountPayload extends PaymentAccountPayload { | ||
// bank | ||
private String bankName = ""; | ||
private String bankCode = ""; | ||
// branch | ||
private String bankBranchName = ""; | ||
private String bankBranchCode = ""; | ||
// account | ||
private String bankAccountType = ""; | ||
private String bankAccountName = ""; | ||
private String bankAccountNumber = ""; | ||
|
||
public JapanBankAccountPayload(String paymentMethod, String id) { | ||
super(paymentMethod, id); | ||
} | ||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
// PROTO BUFFER | ||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
private JapanBankAccountPayload(String paymentMethod, | ||
String id, | ||
String bankName, | ||
String bankCode, | ||
String bankBranchName, | ||
String bankBranchCode, | ||
String bankAccountType, | ||
String bankAccountName, | ||
String bankAccountNumber, | ||
long maxTradePeriod, | ||
Map<String, String> excludeFromJsonDataMap) { | ||
super(paymentMethod, | ||
id, | ||
maxTradePeriod, | ||
excludeFromJsonDataMap); | ||
|
||
this.bankName = bankName; | ||
this.bankCode = bankCode; | ||
this.bankBranchName = bankBranchName; | ||
this.bankBranchCode = bankBranchCode; | ||
this.bankAccountType = bankAccountType; | ||
this.bankAccountName = bankAccountName; | ||
this.bankAccountNumber = bankAccountNumber; | ||
} | ||
|
||
@Override | ||
public Message toProtoMessage() { | ||
return getPaymentAccountPayloadBuilder() | ||
.setJapanBankAccountPayload( | ||
protobuf.JapanBankAccountPayload.newBuilder() | ||
.setBankName(bankName) | ||
.setBankCode(bankCode) | ||
.setBankBranchName(bankBranchName) | ||
.setBankBranchCode(bankBranchCode) | ||
.setBankAccountType(bankAccountType) | ||
.setBankAccountName(bankAccountName) | ||
.setBankAccountNumber(bankAccountNumber) | ||
).build(); | ||
} | ||
|
||
public static JapanBankAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { | ||
protobuf.JapanBankAccountPayload japanBankAccountPayload = proto.getJapanBankAccountPayload(); | ||
return new JapanBankAccountPayload(proto.getPaymentMethodId(), | ||
proto.getId(), | ||
japanBankAccountPayload.getBankName(), | ||
japanBankAccountPayload.getBankCode(), | ||
japanBankAccountPayload.getBankBranchName(), | ||
japanBankAccountPayload.getBankBranchCode(), | ||
japanBankAccountPayload.getBankAccountType(), | ||
japanBankAccountPayload.getBankAccountName(), | ||
japanBankAccountPayload.getBankAccountNumber(), | ||
proto.getMaxTradePeriod(), | ||
CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap())); | ||
} | ||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
// API | ||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
@Override | ||
public String getPaymentDetails() | ||
{ | ||
return Res.get(paymentMethodId) + " - " + getPaymentDetailsForTradePopup().replace("\n", ", "); | ||
} | ||
|
||
@Override | ||
public String getPaymentDetailsForTradePopup() | ||
{ | ||
return bankName + "(" + bankCode + ")\n" + | ||
bankBranchName + "(" + bankBranchCode + ")\n" + | ||
bankAccountType + ": " + bankAccountNumber + "\n" + | ||
bankAccountName + "\n"; | ||
} | ||
|
||
|
||
@Override | ||
public byte[] getAgeWitnessInputData() { | ||
String all = this.bankName + this.bankBranchName + this.bankAccountType + this.bankAccountNumber + this.bankAccountName; | ||
return super.getAgeWitnessInputData(all.getBytes(Charset.forName("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
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.