Skip to content

Commit b8acd89

Browse files
committed
Merge branch 'RwandaMobileMoney' of https://github.com/mikelis135/rave-android into mikelis135-RwandaMobileMoney
2 parents 3771af6 + c6ef764 commit b8acd89

File tree

17 files changed

+851
-2
lines changed

17 files changed

+851
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class MainActivity extends AppCompatActivity {
4545
SwitchCompat accountSwitch;
4646
SwitchCompat ghMobileMoneySwitch;
4747
SwitchCompat ugMobileMoneySwitch;
48+
SwitchCompat rwfMobileMoneySwitch;
4849
SwitchCompat bankTransferSwitch;
4950
SwitchCompat isLiveSwitch;
5051
SwitchCompat isMpesaSwitch;
@@ -82,6 +83,7 @@ protected void onCreate(Bundle savedInstanceState) {
8283
shouldDisplayFeeSwitch = findViewById(R.id.isDisplayFeeSwitch);
8384
ghMobileMoneySwitch = findViewById(R.id.accountGHMobileMoneySwitch);
8485
ugMobileMoneySwitch = findViewById(R.id.accountUgMobileMoneySwitch);
86+
rwfMobileMoneySwitch = findViewById(R.id.accountRwfMobileMoneySwitch);
8587
bankTransferSwitch = findViewById(R.id.bankTransferSwitch);
8688
isLiveSwitch = findViewById(R.id.isLiveSwitch);
8789
addSubAccountsSwitch = findViewById(R.id.addSubAccountsSwitch);
@@ -206,6 +208,7 @@ private void validateEntries() {
206208
.acceptAchPayments(accountAchSwitch.isChecked())
207209
.acceptGHMobileMoneyPayments(ghMobileMoneySwitch.isChecked())
208210
.acceptUgMobileMoneyPayments(ugMobileMoneySwitch.isChecked())
211+
.acceptRwfMobileMoneyPayments(rwfMobileMoneySwitch.isChecked())
209212
.acceptBankTransferPayments(bankTransferSwitch.isChecked())
210213
.onStagingEnv(!isLiveSwitch.isChecked())
211214
.setSubAccounts(subAccounts)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@
9494
android:id="@+id/accountUgMobileMoneySwitch"
9595
/>
9696

97+
<android.support.v7.widget.SwitchCompat
98+
android:id="@+id/accountRwfMobileMoneySwitch"
99+
android:layout_width="match_parent"
100+
android:layout_height="wrap_content"
101+
android:layout_marginBottom="10dp"
102+
android:checked="false"
103+
android:text="Accept RWF Mobile money payments" />
104+
97105
<android.support.v7.widget.SwitchCompat
98106
android:layout_width="match_parent"
99107
android:layout_height="wrap_content"

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public PayloadBuilder setIs_mobile_money_ug(String is_mobile_money_ug) {
3737
return this;
3838
}
3939

40+
private String is_mobile_money_rwf;
41+
4042
public PayloadBuilder setIs_bank_transfer(boolean is_bank_transfer) {
4143
this.is_bank_transfer = is_bank_transfer;
4244
return this;
@@ -46,6 +48,11 @@ public PayloadBuilder setIs_bank_transfer(boolean is_bank_transfer) {
4648
private String is_mobile_money_gh;
4749
private String is_mobile_money_ug;
4850

51+
public PayloadBuilder setIs_mobile_money_rwf(String is_mobile_money_rwf) {
52+
this.is_mobile_money_rwf = is_mobile_money_rwf;
53+
return this;
54+
}
55+
4956
private String phonenumber;
5057

5158
private String txRef;
@@ -255,6 +262,17 @@ public Payload createUgMobileMoneyPayload() {
255262
return payload;
256263
}
257264

265+
public Payload createRwfMobileMoneyPayload() {
266+
List<Meta> metaObj = Utils.pojofyMetaString(meta);
267+
List<SubAccount> subaccountsObj = Utils.pojofySubaccountString(subAccounts);
268+
Payload payload = new Payload(phonenumber, metaObj, subaccountsObj, narration, ip, lastname,
269+
firstname, currency, country, amount, email, device_fingerprint, txRef, pbfPubKey);
270+
payload.setIs_mobile_money_gh("1");
271+
payload.setPayment_type("mobilemoneygh");
272+
payload.setNetwork(network);
273+
return payload;
274+
}
275+
258276

259277

260278
public PayloadBuilder setMeta(String meta) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class RaveConstants {
2121
public static String NG = "NG";
2222
public static String NGN = "NGN";
2323
public static String UGX = "UGX";
24+
public static String RWF = "RWF";
2425
public static String NOAUTH = "NOAUTH";
2526
public static String PIN = "PIN";
2627
public static String AVS_VBVSECURECODE = "AVS_VBVSECURECODE";

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.flutterwave.raveandroid.di.modules.NetworkModule;
2626
import com.flutterwave.raveandroid.ghmobilemoney.GhMobileMoneyFragment;
2727
import com.flutterwave.raveandroid.mpesa.MpesaFragment;
28+
import com.flutterwave.raveandroid.rwfmobilemoney.RwfMobileMoneyFragment;
2829
import com.flutterwave.raveandroid.ugmobilemoney.UgMobileMoneyFragment;
2930

3031
import org.parceler.Parcels;
@@ -121,6 +122,10 @@ else if (ravePayInitializer.getCountry().equalsIgnoreCase("ng") && ravePayInitia
121122
raveFragments.add(new RaveFragment(new UgMobileMoneyFragment(), "UGANDA MOBILE MONEY"));
122123
}
123124

125+
if (ravePayInitializer.isWithRwfMobileMoney()) {
126+
raveFragments.add(new RaveFragment(new RwfMobileMoneyFragment(), "RWANDA MOBILE MONEY"));
127+
}
128+
124129
if (ravePayInitializer.isWithBankTransfer()) {
125130
if (ravePayInitializer.getCountry().equalsIgnoreCase("ng") && ravePayInitializer.getCurrency().equalsIgnoreCase("ngn")){
126131
raveFragments.add(new RaveFragment(new BankTransferFragment(), "Bank Transfer"));

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class RavePayInitializer {
2727
boolean withAccount = true;
2828
boolean withGHMobileMoney = false;
2929
boolean withUgMobileMoney = false;
30+
boolean withRwfMobileMoney = false;
3031
boolean withBankTransfer = false;
3132
int theme;
3233
boolean staging = true;
@@ -39,7 +40,7 @@ public RavePayInitializer(String email, double amount, String publicKey,
3940
String currency, String country, String fName,
4041
String lName, boolean withCard,
4142
boolean withAccount, boolean withMpesa, boolean withGHMobileMoney,
42-
boolean withUgMobileMoney,
43+
boolean withUgMobileMoney, boolean withRwfMobileMoney,
4344
boolean withAch, boolean withBankTransfer, int theme,
4445
boolean staging, String meta, String subAccounts, String payment_plan, boolean isPreAuth,
4546
boolean showStagingLabel, boolean displayFee) {
@@ -56,6 +57,7 @@ public RavePayInitializer(String email, double amount, String publicKey,
5657
this.withAccount = withAccount;
5758
this.withGHMobileMoney = withGHMobileMoney;
5859
this.withUgMobileMoney = withUgMobileMoney;
60+
this.withRwfMobileMoney = withRwfMobileMoney;
5961
this.withBankTransfer = withBankTransfer;
6062
this.withMpesa = withMpesa;
6163
this.withCard = withCard;
@@ -133,6 +135,10 @@ public boolean isWithUgMobileMoney() {
133135
return withUgMobileMoney;
134136
}
135137

138+
public boolean isWithRwfMobileMoney() {
139+
return withRwfMobileMoney;
140+
}
141+
136142

137143
public boolean isWithBankTransfer() {
138144
return withBankTransfer;

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class RavePayManager {
3535
boolean withMpesa = false;
3636
boolean withGHMobileMoney = false;
3737
boolean withUgMobileMoney = false;
38+
boolean withRwfMobileMoney = false;
3839
boolean withBankTransfer = false;
3940
private int theme = R.style.DefaultTheme;
4041
boolean staging = true;
@@ -92,6 +93,11 @@ public RavePayManager acceptUgMobileMoneyPayments(boolean withUgMobileMoney) {
9293
return this;
9394
}
9495

96+
public RavePayManager acceptRwfMobileMoneyPayments(boolean withRwfMobileMoney) {
97+
this.withRwfMobileMoney = withRwfMobileMoney;
98+
return this;
99+
}
100+
95101
public RavePayManager acceptBankTransferPayments(boolean withBankTransfer) {
96102
this.withBankTransfer = withBankTransfer;
97103
return this;
@@ -195,7 +201,7 @@ public RavePayManager shouldDisplayFee(boolean displayFee) {
195201
public RavePayInitializer createRavePayInitializer() {
196202
return new RavePayInitializer(email, amount, publicKey, encryptionKey, txRef, narration,
197203
currency, country, fName, lName, withCard, withAccount, withMpesa,
198-
withGHMobileMoney, withUgMobileMoney, withAch, withBankTransfer, theme, staging, meta, subAccounts,
204+
withGHMobileMoney, withUgMobileMoney, withRwfMobileMoney, withAch, withBankTransfer, theme, staging, meta, subAccounts,
199205
payment_plan,
200206
isPreAuth, showStagingLabel,displayFee);
201207
}

raveandroid/src/main/java/com/flutterwave/raveandroid/di/components/AppComponent.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.flutterwave.raveandroid.di.modules.GhanaModule;
1111
import com.flutterwave.raveandroid.di.modules.MpesaModule;
1212
import com.flutterwave.raveandroid.di.modules.NetworkModule;
13+
import com.flutterwave.raveandroid.di.modules.RwandaModule;
1314
import com.flutterwave.raveandroid.di.modules.UgandaModule;
1415

1516
import javax.inject.Singleton;
@@ -28,6 +29,8 @@ public interface AppComponent {
2829

2930
UgandaComponent plus(UgandaModule ugandaModule);
3031

32+
RwandaComponent plus(RwandaModule rwandaModule);
33+
3134
GhanaComponent plus(GhanaModule ghanaModule);
3235

3336
CardComponent plus(CardModule cardModule);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.flutterwave.raveandroid.di.components;
2+
3+
4+
import com.flutterwave.raveandroid.di.modules.RwandaModule;
5+
import com.flutterwave.raveandroid.di.scopes.RwandaScope;
6+
import com.flutterwave.raveandroid.rwfmobilemoney.RwfMobileMoneyFragment;
7+
8+
import dagger.Subcomponent;
9+
10+
@RwandaScope
11+
@Subcomponent(modules = {RwandaModule.class})
12+
public interface RwandaComponent {
13+
void inject(RwfMobileMoneyFragment rwfMobileMoneyFragment);
14+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.flutterwave.raveandroid.di.modules;
2+
3+
import com.flutterwave.raveandroid.rwfmobilemoney.RwfMobileMoneyContract;
4+
5+
import javax.inject.Inject;
6+
7+
import dagger.Module;
8+
import dagger.Provides;
9+
10+
@Module
11+
public class RwandaModule {
12+
13+
private RwfMobileMoneyContract.View view;
14+
15+
@Inject
16+
public RwandaModule(RwfMobileMoneyContract.View view) {
17+
this.view = view;
18+
}
19+
20+
@Provides
21+
public RwfMobileMoneyContract.View providesContract() {
22+
return view;
23+
}
24+
}

0 commit comments

Comments
 (0)