Skip to content

Commit 7674872

Browse files
authored
Merge pull request #171 from jeremiahVaris/sa-bank-integration
Sa bank integration
2 parents 63150d5 + d68d632 commit 7674872

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1807
-134
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Set the public key, encryption key and other required parameters. The `RavePayMa
6060
.acceptUgMobileMoneyPayments(boolean)
6161
.acceptZmMobileMoneyPayments(boolean)
6262
.acceptRwfMobileMoneyPayments(boolean)
63+
.acceptSaBankPayments(boolean)
6364
.acceptUkPayments(boolean)
6465
.acceptBankTransferPayments(boolean)
6566
.acceptUssdPayments(boolean)
@@ -95,6 +96,7 @@ Set the public key, encryption key and other required parameters. The `RavePayMa
9596
| acceptUgMobileMoneyPayments(boolean) | Set to `true` if you want to accept Uganda mobile money payments, else set to `false` . For this option to work, you should set your country to `UG` and your currency to `UGX`| `boolean` | Not Required |
9697
| acceptZmMobileMoneyPayments(boolean) | Set to `true` if you want to accept Zambia mobile money payments, else set to `false` . For this option to work, you should set your country to `NG` and your currency to `ZMW`. `MTN` is the only available network at the moment, see more details in the [API documentation](https://developer.flutterwave.com/reference#zambia-mobile-money).| `boolean` | Not Required |
9798
| acceptRwfMobileMoneyPayments(boolean) | Set to `true` if you want to accept Rwanda mobile money payments, else set to `false` . For this option to work, you should set your country to `NG` and your currency to `RWF`. See more details in the [API documentation](https://developer.flutterwave.com/reference#rwanda-mobile-money).| `boolean` | Not Required |
99+
| acceptSaBankPayments(boolean) | Set to `true` if you want to accept South African direct bank account payments, else set to `false` . For this option to work, you should set your country to `ZA` and your currency to `ZAR`.| `boolean` | Not Required |
98100
| acceptUkPayments(boolean) | Set to `true` if you want to accept UK Bank Account payments, else set to `false` . For this option to work, you should set your country to `NG`, set currency to `GBP`, set accountbank `String`, set accountname `String`, set accountnumber `String`, set is_uk_bank_charge2 `true`, set payment_type `account`. `Please use your live credentials for this` | `boolean` | Not Required |
99101
| acceptAchPayments(boolean) | Set to `true` if you want to accept US ACH charges from your customers, else set to `false` . For this option to work, you should set your country to `US` and your currency to `USD`. You also have to set `acceptAccountPayments(true)`| `boolean` | Not Required |
100102
| acceptBankTransferPayments(boolean) | Set to `true` if you want to accept payments via bank transfer from your customers, else set to `false`. This option is currently only available for Nigerian Naira. <br/><br/><strong>Note:</strong> By default, the account numbers generated are dynamic. This method has been overloaded for more options as shown below:<br><ul><li>To generate static (permanent) accounts instead, pass in `true` as a second parameter. E.g. <br/>```acceptBankTransferPayments(true, true)```</li><li>To generate accounts that expire at a certain date, or after a certain number of payments, pass in integer values for `duration` and `frequency` as such: <br/>```acceptBankTransferPayments(true, duration, frequency)``` </li></ul>You can get more details in the [API documentation](https://developer.flutterwave.com/v2.0/reference#pay-with-bank-transfer-nigeria).| `boolean`<br/><br/>Optional overloads:<br/>`boolean`, `boolean`<br/><br/>`boolean`, `int`, `int` | Not Required |

app/src/main/java/com/flutterwave/rave_android/MainActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class MainActivity extends AppCompatActivity {
4949
SwitchCompat ghMobileMoneySwitch;
5050
SwitchCompat ugMobileMoneySwitch;
5151
SwitchCompat ukbankSwitch;
52+
SwitchCompat saBankSwitch;
5253
SwitchCompat francMobileMoneySwitch;
5354
SwitchCompat rwfMobileMoneySwitch;
5455
SwitchCompat zmMobileMoneySwitch;
@@ -100,6 +101,7 @@ protected void onCreate(Bundle savedInstanceState) {
100101
ghMobileMoneySwitch = findViewById(R.id.accountGHMobileMoneySwitch);
101102
ugMobileMoneySwitch = findViewById(R.id.accountUgMobileMoneySwitch);
102103
ukbankSwitch = findViewById(R.id.accountUkbankSwitch);
104+
saBankSwitch = findViewById(R.id.accountSaBankSwitch);
103105
francMobileMoneySwitch = findViewById(R.id.accountfrancMobileMoneySwitch);
104106
zmMobileMoneySwitch = findViewById(R.id.accountZmMobileMoneySwitch);
105107
rwfMobileMoneySwitch = findViewById(R.id.accountRwfMobileMoneySwitch);
@@ -288,6 +290,7 @@ private void validateEntries() {
288290
.acceptZmMobileMoneyPayments(zmMobileMoneySwitch.isChecked())
289291
.acceptRwfMobileMoneyPayments(rwfMobileMoneySwitch.isChecked())
290292
.acceptUkPayments(ukbankSwitch.isChecked())
293+
.acceptSaBankPayments(saBankSwitch.isChecked())
291294
.acceptFrancMobileMoneyPayments(francMobileMoneySwitch.isChecked())
292295
.acceptBankTransferPayments(bankTransferSwitch.isChecked())
293296
.acceptUssdPayments(ussdSwitch.isChecked())

app/src/main/res/layout/activity_main.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@
233233
android:checked="false"
234234
android:text="@string/uk_bank" />
235235

236+
<android.support.v7.widget.SwitchCompat
237+
android:id="@+id/accountSaBankSwitch"
238+
android:layout_width="match_parent"
239+
android:layout_height="wrap_content"
240+
android:layout_marginBottom="10dp"
241+
android:checked="false"
242+
android:text="@string/sa_bank" />
243+
244+
236245
<android.support.v7.widget.SwitchCompat
237246
android:id="@+id/cardPaymentSwitch"
238247
android:layout_width="match_parent"

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<string name="encryption_key">Encryption key</string>
1818
<string name="francophone">Accept Franc Mobile Money Payments</string>
1919
<string name="uk_bank">Accept UK Bank Payments</string>
20+
<string name="sa_bank">Accept South Africa Bank Payments</string>
2021
<string name="live">Live</string>
2122
<string name="bank_transfer">Accept Bank Transfer Payments</string>
2223
<string name="zambia">Accept ZM Mobile money payments</string>

raveandroid/src/main/java/com/flutterwave/raveandroid/Payload.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,16 @@ public void setIs_mobile_money_franco(boolean is_mobile_money_franco) {
430430
this.is_mobile_money_franco = is_mobile_money_franco;
431431
}
432432

433+
private String is_sa_call_pay;
434+
435+
public void setIs_sa_call_pay(String is_sa_call_pay){
436+
this.is_sa_call_pay = is_sa_call_pay;
437+
}
438+
439+
private String getIs_sa_call_pay(){
440+
return is_sa_call_pay;
441+
}
442+
433443
public String getPhonenumber() {
434444
return phonenumber;
435445
}

raveandroid/src/main/java/com/flutterwave/raveandroid/PayloadBuilder.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,19 @@ public Payload createUKPayload() {
300300
return payload;
301301
}
302302

303+
304+
public Payload createSaBankAccountPayload() {
305+
List<Meta> metaObj = Utils.pojofyMetaString(meta);
306+
List<SubAccount> subaccountsObj = Utils.pojofySubaccountString(subAccounts);
307+
Payload payload = new Payload(phonenumber, metaObj, subaccountsObj, narration, ip, lastname,
308+
firstname, currency, country, amount, email, device_fingerprint, txRef, pbfPubKey);
309+
payload.setPayment_type("account");
310+
payload.setIs_sa_call_pay("1");
311+
payload.setAccountnumber("00000");
312+
payload.setAccountbank("093");
313+
return payload;
314+
}
315+
303316
public Payload createBarterPayload() {
304317
List<Meta> metaObj = Utils.pojofyMetaString(meta);
305318
List<SubAccount> subaccountsObj = Utils.pojofySubaccountString(subAccounts);

raveandroid/src/main/java/com/flutterwave/raveandroid/PaymentTypesCurrencyChecker.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_GH_MOBILE_MONEY;
1010
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_MPESA;
1111
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_RW_MOBILE_MONEY;
12+
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_SA_BANK_ACCOUNT;
1213
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_UG_MOBILE_MONEY;
1314
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_UK;
1415
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_USSD;
@@ -65,6 +66,10 @@ public ArrayList<Integer> applyCurrencyChecks(
6566
if (acceptedCurrency.equalsIgnoreCase("GBP"))
6667
currencyCheckedPaymentTypesList.add(orderedPaymentTypesList.get(index));
6768
break;
69+
case PAYMENT_TYPE_SA_BANK_ACCOUNT:
70+
if (acceptedCurrency.equalsIgnoreCase("ZAR"))
71+
currencyCheckedPaymentTypesList.add(orderedPaymentTypesList.get(index));
72+
break;
6873
default:
6974
currencyCheckedPaymentTypesList.add(orderedPaymentTypesList.get(index));
7075
}

raveandroid/src/main/java/com/flutterwave/raveandroid/RaveConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public class RaveConstants {
6363
public static String invalidBvnMessage = "Enter a valid BVN";
6464
public static String invalidBankCodeMessage = "You need to select bank";
6565
public static String defaultAccounNumber = "0000000000";
66+
public static String inValidRedirectUrl = "Invalid redirect url returned";
6667

6768
public static String response = "response";
6869
public static String mtn = "mtn";
@@ -125,6 +126,7 @@ public class RaveConstants {
125126
public static final int PAYMENT_TYPE_USSD = 111;
126127
public static final int PAYMENT_TYPE_FRANCO_MOBILE_MONEY = 112;
127128
public static final int PAYMENT_TYPE_BARTER = 113;
129+
public static final int PAYMENT_TYPE_SA_BANK_ACCOUNT = 114;
128130

129131
public static HashMap<Integer, String> paymentTypesNamesList = new HashMap<Integer, String>() {{
130132
put(PAYMENT_TYPE_CARD, "Card");
@@ -140,6 +142,7 @@ public class RaveConstants {
140142
put(PAYMENT_TYPE_UK, "UK Bank Account");
141143
put(PAYMENT_TYPE_BARTER, "Barter");
142144
put(PAYMENT_TYPE_USSD, "USSD");
145+
put(PAYMENT_TYPE_SA_BANK_ACCOUNT, "South Africa Bank Account");
143146
}};
144147

145148

raveandroid/src/main/java/com/flutterwave/raveandroid/RavePayActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.flutterwave.raveandroid.ghmobilemoney.GhMobileMoneyFragment;
4242
import com.flutterwave.raveandroid.mpesa.MpesaFragment;
4343
import com.flutterwave.raveandroid.rwfmobilemoney.RwfMobileMoneyFragment;
44+
import com.flutterwave.raveandroid.sabankaccount.SaBankAccountFragment;
4445
import com.flutterwave.raveandroid.ugmobilemoney.UgMobileMoneyFragment;
4546
import com.flutterwave.raveandroid.uk.UkFragment;
4647
import com.flutterwave.raveandroid.ussd.UssdFragment;
@@ -64,6 +65,7 @@
6465
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_GH_MOBILE_MONEY;
6566
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_MPESA;
6667
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_RW_MOBILE_MONEY;
68+
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_SA_BANK_ACCOUNT;
6769
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_UG_MOBILE_MONEY;
6870
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_UK;
6971
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_USSD;
@@ -434,6 +436,9 @@ private void addFragmentToLayout(PaymentTile foundPaymentTile) {
434436
case PAYMENT_TYPE_ZM_MOBILE_MONEY:
435437
transaction.replace(R.id.payment_fragment_container, new ZmMobileMoneyFragment());
436438
break;
439+
case PAYMENT_TYPE_SA_BANK_ACCOUNT:
440+
transaction.replace(R.id.payment_fragment_container, new SaBankAccountFragment());
441+
break;
437442
default:
438443
Log.d("Adding Payment Fragment", "Payment type does not exist in payment types list");
439444
render();// Show default view

raveandroid/src/main/java/com/flutterwave/raveandroid/RavePayManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_GH_MOBILE_MONEY;
2727
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_MPESA;
2828
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_RW_MOBILE_MONEY;
29+
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_SA_BANK_ACCOUNT;
2930
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_UG_MOBILE_MONEY;
3031
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_UK;
3132
import static com.flutterwave.raveandroid.RaveConstants.PAYMENT_TYPE_USSD;
@@ -149,6 +150,12 @@ public RavePayManager acceptUkPayments(boolean withUk) {
149150
return this;
150151
}
151152

153+
public RavePayManager acceptSaBankPayments(boolean withSaBankAccount) {
154+
if (!orderedPaymentTypesList.contains(PAYMENT_TYPE_SA_BANK_ACCOUNT) && withSaBankAccount)
155+
orderedPaymentTypesList.add(PAYMENT_TYPE_SA_BANK_ACCOUNT);
156+
return this;
157+
}
158+
152159
public RavePayManager acceptFrancMobileMoneyPayments(boolean withFrancMobileMoney) {
153160
if (!orderedPaymentTypesList.contains(PAYMENT_TYPE_FRANCO_MOBILE_MONEY) && withFrancMobileMoney)
154161
orderedPaymentTypesList.add(PAYMENT_TYPE_FRANCO_MOBILE_MONEY);

0 commit comments

Comments
 (0)