Skip to content

Commit

Permalink
Merge pull request #5696 from jmacxx/add_indian_payment
Browse files Browse the repository at this point in the history
Add five Indian payment methods
  • Loading branch information
ripcurlx authored Sep 27, 2021
2 parents ccb73a3 + 2add403 commit c4d0117
Show file tree
Hide file tree
Showing 31 changed files with 1,642 additions and 49 deletions.
48 changes: 48 additions & 0 deletions core/src/main/java/bisq/core/payment/ImpsAccount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.ImpsAccountPayload;

import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
public final class ImpsAccount extends CountryBasedPaymentAccount {
public ImpsAccount() {
super(PaymentMethod.IMPS);
}

@Override
protected PaymentAccountPayload createPayload() {
return new ImpsAccountPayload(paymentMethod.getId(), id);
}

public String getMessageForBuyer() {
return "payment.imps.info.buyer";
}

public String getMessageForSeller() {
return "payment.imps.info.seller";
}

public String getMessageForAccountCreation() {
return "payment.imps.info.account";
}
}
48 changes: 48 additions & 0 deletions core/src/main/java/bisq/core/payment/NeftAccount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.NeftAccountPayload;

import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
public final class NeftAccount extends CountryBasedPaymentAccount {
public NeftAccount() {
super(PaymentMethod.NEFT);
}

@Override
protected PaymentAccountPayload createPayload() {
return new NeftAccountPayload(paymentMethod.getId(), id);
}

public String getMessageForBuyer() {
return "payment.neft.info.buyer";
}

public String getMessageForSeller() {
return "payment.neft.info.seller";
}

public String getMessageForAccountCreation() {
return "payment.neft.info.account";
}
}
23 changes: 23 additions & 0 deletions core/src/main/java/bisq/core/payment/PaymentAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,27 @@ public void onAddToUser() {
// We are in the process to get added to the user. This is called just before saving the account and the
// last moment we could apply some special handling if needed (e.g. as it happens for Revolut)
}

public String getPreTradeMessage(boolean isBuyer) {
if (isBuyer) {
return getMessageForBuyer();
} else {
return getMessageForSeller();
}
}

// will be overridden by specific account when necessary
public String getMessageForBuyer() {
return null;
}

// will be overridden by specific account when necessary
public String getMessageForSeller() {
return null;
}

// will be overridden by specific account when necessary
public String getMessageForAccountCreation() {
return null;
}
}
10 changes: 10 additions & 0 deletions core/src/main/java/bisq/core/payment/PaymentAccountFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ public static PaymentAccount getPaymentAccount(PaymentMethod paymentMethod) {
return new PayseraAccount();
case PaymentMethod.PAXUM_ID:
return new PaxumAccount();
case PaymentMethod.NEFT_ID:
return new NeftAccount();
case PaymentMethod.RTGS_ID:
return new RtgsAccount();
case PaymentMethod.IMPS_ID:
return new ImpsAccount();
case PaymentMethod.UPI_ID:
return new UpiAccount();
case PaymentMethod.PAYTM_ID:
return new PaytmAccount();
case PaymentMethod.AMAZON_GIFT_CARD_ID:
return new AmazonGiftCardAccount();
case PaymentMethod.BLOCK_CHAINS_INSTANT_ID:
Expand Down
56 changes: 56 additions & 0 deletions core/src/main/java/bisq/core/payment/PaytmAccount.java
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.PaytmAccountPayload;

import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
public final class PaytmAccount extends CountryBasedPaymentAccount {
public PaytmAccount() {
super(PaymentMethod.PAYTM);
}

@Override
protected PaymentAccountPayload createPayload() {
return new PaytmAccountPayload(paymentMethod.getId(), id);
}

public void setEmailOrMobileNr(String emailOrMobileNr) {
((PaytmAccountPayload) paymentAccountPayload).setEmailOrMobileNr(emailOrMobileNr);
}

public String getEmailOrMobileNr() {
return ((PaytmAccountPayload) paymentAccountPayload).getEmailOrMobileNr();
}

public String getMessageForBuyer() {
return "payment.paytm.info.buyer";
}

public String getMessageForSeller() {
return "payment.paytm.info.seller";
}

public String getMessageForAccountCreation() {
return "payment.paytm.info.account";
}
}
48 changes: 48 additions & 0 deletions core/src/main/java/bisq/core/payment/RtgsAccount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.RtgsAccountPayload;

import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
public final class RtgsAccount extends CountryBasedPaymentAccount {
public RtgsAccount() {
super(PaymentMethod.RTGS);
}

@Override
protected PaymentAccountPayload createPayload() {
return new RtgsAccountPayload(paymentMethod.getId(), id);
}

public String getMessageForBuyer() {
return "payment.rtgs.info.buyer";
}

public String getMessageForSeller() {
return "payment.rtgs.info.seller";
}

public String getMessageForAccountCreation() {
return "payment.rtgs.info.account";
}
}
12 changes: 12 additions & 0 deletions core/src/main/java/bisq/core/payment/SwiftAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,16 @@ public void selectAllTradeCurrencies() {
.collect(Collectors.toList());
tradeCurrencies.addAll(currencyCodesSorted);
}

public String getMessageForBuyer() {
return "payment.swift.info.buyer";
}

public String getMessageForSeller() {
return "payment.swift.info.seller";
}

public String getMessageForAccountCreation() {
return "payment.swift.info.account";
}
}
56 changes: 56 additions & 0 deletions core/src/main/java/bisq/core/payment/UpiAccount.java
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.UpiAccountPayload;

import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
public final class UpiAccount extends CountryBasedPaymentAccount {
public UpiAccount() {
super(PaymentMethod.UPI);
}

@Override
protected PaymentAccountPayload createPayload() {
return new UpiAccountPayload(paymentMethod.getId(), id);
}

public void setVirtualPaymentAddress(String virtualPaymentAddress) {
((UpiAccountPayload) paymentAccountPayload).setVirtualPaymentAddress(virtualPaymentAddress);
}

public String getVirtualPaymentAddress() {
return ((UpiAccountPayload) paymentAccountPayload).getVirtualPaymentAddress();
}

public String getMessageForBuyer() {
return "payment.upi.info.buyer";
}

public String getMessageForSeller() {
return "payment.upi.info.seller";
}

public String getMessageForAccountCreation() {
return "payment.upi.info.account";
}
}
Loading

0 comments on commit c4d0117

Please sign in to comment.