Skip to content

Commit 1329de6

Browse files
committed
Zambia Mobile Money
Created Contract, Fragment, Presenter Created Scope, Module and Component Added Zambia to the Switch as a payment option Reviewed the Payload sent Performed Test Transaction
1 parent 56bbd86 commit 1329de6

File tree

16 files changed

+874
-2
lines changed

16 files changed

+874
-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 zmMobileMoneySwitch;
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+
zmMobileMoneySwitch = findViewById(R.id.accountZmMobileMoneySwitch);
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+
.acceptZmMobileMoneyPayments(zmMobileMoneySwitch.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/accountZmMobileMoneySwitch"
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 ZM 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,18 @@ public Payload createGhMobileMoneyPayload() {
243243
return payload;
244244
}
245245

246+
public Payload createZmMobileMoneyPayload() {
247+
List<Meta> metaObj = Utils.pojofyMetaString(meta);
248+
List<SubAccount> subaccountsObj = Utils.pojofySubaccountString(subAccounts);
249+
Payload payload = new Payload(phonenumber, metaObj, subaccountsObj, narration, ip, lastname,
250+
firstname, currency, country, amount, email, device_fingerprint, txRef, pbfPubKey);
251+
payload.setIs_mobile_money_ug("1");
252+
payload.setPayment_type("mobilemoneyzambia");
253+
payload.setVoucher(voucher);
254+
payload.setNetwork(network);
255+
return payload;
256+
}
257+
246258
public Payload createUgMobileMoneyPayload() {
247259
List<Meta> metaObj = Utils.pojofyMetaString(meta);
248260
List<SubAccount> subaccountsObj = Utils.pojofySubaccountString(subAccounts);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class RaveConstants {
2323
public static String UGX = "UGX";
2424
public static String NOAUTH = "NOAUTH";
2525
public static String PIN = "PIN";
26+
public static String selectNetwork = "Select network";
2627
public static String AVS_VBVSECURECODE = "AVS_VBVSECURECODE";
2728
public static String enterOTP = "Enter your one time password (OTP)";
2829
public static String NOAUTH_INTERNATIONAL = "NOAUTH_INTERNATIONAL";

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.flutterwave.raveandroid.ghmobilemoney.GhMobileMoneyFragment;
2727
import com.flutterwave.raveandroid.mpesa.MpesaFragment;
2828
import com.flutterwave.raveandroid.ugmobilemoney.UgMobileMoneyFragment;
29+
import com.flutterwave.raveandroid.zmmobilemoney.ZmMobileMoneyFragment;
2930

3031
import org.parceler.Parcels;
3132

@@ -117,6 +118,10 @@ else if (ravePayInitializer.getCountry().equalsIgnoreCase("ng") && ravePayInitia
117118
raveFragments.add(new RaveFragment(new GhMobileMoneyFragment(), "GHANA MOBILE MONEY"));
118119
}
119120

121+
if (ravePayInitializer.isWithZmMobileMoney()) {
122+
raveFragments.add(new RaveFragment(new ZmMobileMoneyFragment(), "ZAMBIA MOBILE MONEY"));
123+
}
124+
120125
if (ravePayInitializer.isWithUgMobileMoney()) {
121126
raveFragments.add(new RaveFragment(new UgMobileMoneyFragment(), "UGANDA MOBILE MONEY"));
122127
}

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 withZmMobileMoney = 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 withZmMobileMoney,
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.withZmMobileMoney = withZmMobileMoney;
5961
this.withBankTransfer = withBankTransfer;
6062
this.withMpesa = withMpesa;
6163
this.withCard = withCard;
@@ -133,6 +135,9 @@ public boolean isWithUgMobileMoney() {
133135
return withUgMobileMoney;
134136
}
135137

138+
public boolean isWithZmMobileMoney() {
139+
return withZmMobileMoney;
140+
}
136141

137142
public boolean isWithBankTransfer() {
138143
return withBankTransfer;
@@ -253,6 +258,7 @@ public void setPreAuth(boolean isPreAuth) {
253258
public boolean getIsDisplayFee() {
254259
return displayFee;
255260
}
261+
256262
public void setIsDisplayFee() {
257263
this.displayFee = displayFee;
258264
}

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 withZmMobileMoney = 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 acceptZmMobileMoneyPayments(boolean withZmMobileMoney) {
97+
this.withZmMobileMoney = withZmMobileMoney;
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, withZmMobileMoney, 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
@@ -11,6 +11,7 @@
1111
import com.flutterwave.raveandroid.di.modules.MpesaModule;
1212
import com.flutterwave.raveandroid.di.modules.NetworkModule;
1313
import com.flutterwave.raveandroid.di.modules.UgandaModule;
14+
import com.flutterwave.raveandroid.di.modules.ZambiaModule;
1415

1516
import javax.inject.Singleton;
1617

@@ -30,6 +31,8 @@ public interface AppComponent {
3031

3132
GhanaComponent plus(GhanaModule ghanaModule);
3233

34+
ZambiaComponent plus(ZambiaModule zambiaModule);
35+
3336
CardComponent plus(CardModule cardModule);
3437

3538
BankTransferComponent plus(BankTransferModule bankTransferModule);
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.ZambiaModule;
5+
import com.flutterwave.raveandroid.di.scopes.ZambiaScope;
6+
import com.flutterwave.raveandroid.zmmobilemoney.ZmMobileMoneyFragment;
7+
8+
import dagger.Subcomponent;
9+
10+
@ZambiaScope
11+
@Subcomponent(modules = {ZambiaModule.class})
12+
public interface ZambiaComponent {
13+
void inject(ZmMobileMoneyFragment zmMobileMoneyFragment);
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.zmmobilemoney.ZmMobileMoneyContract;
4+
5+
import javax.inject.Inject;
6+
7+
import dagger.Module;
8+
import dagger.Provides;
9+
10+
@Module
11+
public class ZambiaModule {
12+
13+
private ZmMobileMoneyContract.View view;
14+
15+
@Inject
16+
public ZambiaModule(ZmMobileMoneyContract.View view) {
17+
this.view = view;
18+
}
19+
20+
@Provides
21+
public ZmMobileMoneyContract.View providesContract() {
22+
return view;
23+
}
24+
}

0 commit comments

Comments
 (0)