Skip to content

Commit f131cc7

Browse files
committed
Merge branch 'adjustValidateMessage'
# Conflicts: # rave_java_commons/src/main/java/com/flutterwave/raveandroid/rave_java_commons/RaveConstants.java
2 parents cb9a41f + 3435cca commit f131cc7

File tree

7 files changed

+42
-13
lines changed

7 files changed

+42
-13
lines changed

rave_android/src/main/java/com/flutterwave/raveandroid/ghmobilemoney/GhMobileMoneyFragment.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,20 @@ public void onPaymentError(String message) {
360360
}
361361

362362
@Override
363-
public void showPollingIndicator(boolean active) {
363+
public void showPollingIndicator(boolean active, String validateInstruction) {
364364
if (getActivity() == null || getActivity().isFinishing()) {
365365
return;
366366
}
367367

368368
if (pollingProgressDialog == null) {
369369
pollingProgressDialog = new ProgressDialog(getActivity());
370370
pollingProgressDialog.setCanceledOnTouchOutside(false);
371-
pollingProgressDialog.setMessage(Html.fromHtml(validateInstructions));
371+
372+
if (validateInstruction.isEmpty()) {
373+
pollingProgressDialog.setMessage(Html.fromHtml(validateInstructions));
374+
}else {
375+
pollingProgressDialog.setMessage(Html.fromHtml(validateInstruction));
376+
}
372377
}
373378

374379
if (active && !pollingProgressDialog.isShowing()) {

rave_android/src/main/java/com/flutterwave/raveandroid/ghmobilemoney/NullGhMobileMoneyView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void onPaymentError(String message) {
2323
}
2424

2525
@Override
26-
public void showPollingIndicator(boolean active) {
26+
public void showPollingIndicator(boolean active, String validateInstruction) {
2727

2828
}
2929

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,5 @@ public class RaveConstants {
171171

172172
public static final String responseParsingError = "Error parsing server response";
173173
public static String errorParsingError = "An error occurred parsing the error response";
174+
public static String eTransact_GH = "ETRANZACT_GH";
174175
}

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/ghmobilemoney/GhMobileMoneyContract.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import com.flutterwave.raveandroid.rave_java_commons.Payload;
44
import com.flutterwave.raveandroid.rave_logger.Event;
5+
import com.flutterwave.raveandroid.rave_remote.responses.MobileMoneyChargeResponse;
56

67

78
public interface GhMobileMoneyContract {
89

910
interface Interactor {
1011
void showFetchFeeFailed(String s);
1112
void onPaymentError(String message);
12-
void showPollingIndicator(boolean active);
13+
void showPollingIndicator(boolean active, String validateInstruction);
1314
void showProgressIndicator(boolean active);
1415

1516
void onTransactionFeeRetrieved(String chargeAmount, Payload payload, String fee);
@@ -21,7 +22,7 @@ interface Interactor {
2122

2223
interface Handler {
2324
void fetchFee(Payload payload);
24-
void requeryTx(String flwRef, String txRef, String publicKey);
25+
void requeryTx(String flwRef, String txRef, String publicKey, MobileMoneyChargeResponse.Data data);
2526
void chargeGhMobileMoney(Payload payload, String encryptionKey);
2627
void logEvent(Event event, String publicKey);
2728

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/ghmobilemoney/GhMobileMoneyHandler.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.util.Log;
44

55
import com.flutterwave.raveandroid.rave_java_commons.Payload;
6+
import com.flutterwave.raveandroid.rave_java_commons.RaveConstants;
67
import com.flutterwave.raveandroid.rave_logger.Event;
78
import com.flutterwave.raveandroid.rave_logger.EventLogger;
89
import com.flutterwave.raveandroid.rave_presentation.data.PayloadEncryptor;
@@ -92,7 +93,6 @@ public void chargeGhMobileMoney(final Payload payload, final String encryptionKe
9293

9394
logEvent(new ChargeAttemptEvent("GH Mobile Money").getEvent(), payload.getPBFPubKey());
9495

95-
9696
networkRequest.chargeMobileMoneyWallet(body, new ResultCallback<MobileMoneyChargeResponse>() {
9797
@Override
9898
public void onSuccess(MobileMoneyChargeResponse response) {
@@ -106,7 +106,7 @@ public void onSuccess(MobileMoneyChargeResponse response) {
106106
} else {
107107
String flwRef = data.getFlwRef();
108108
String txRef = data.getTx_ref();
109-
requeryTx(flwRef, txRef, payload.getPBFPubKey());
109+
requeryTx(flwRef, txRef, payload.getPBFPubKey(), data);
110110
}
111111
} else {
112112
mInteractor.onPaymentError(noResponse);
@@ -124,18 +124,23 @@ public void onError(String message) {
124124

125125
@Override
126126
public void requeryTx(final String publicKey) {
127-
requeryTx(null, txRef, publicKey);
127+
requeryTx(null, txRef, publicKey, null);
128128
}
129129

130130
@Override
131-
public void requeryTx(final String flwRef, final String txRef, final String publicKey) {
131+
public void requeryTx(final String flwRef, final String txRef, final String publicKey, final MobileMoneyChargeResponse.Data data) {
132132

133133
RequeryRequestBody body = new RequeryRequestBody();
134134
body.setFlw_ref(flwRef);
135135
body.setTx_ref(txRef);
136136
body.setPBFPubKey(publicKey);
137137

138-
mInteractor.showPollingIndicator(true);
138+
if (data.getProvider().equalsIgnoreCase(RaveConstants.eTransact_GH)){
139+
mInteractor.showPollingIndicator(true, data.getValidateInstructions());
140+
}else{
141+
mInteractor.showPollingIndicator(true, "");
142+
}
143+
139144

140145
logEvent(new RequeryEvent().getEvent(), publicKey);
141146

@@ -149,10 +154,10 @@ public void onSuccess(RequeryResponse response, String responseAsJSONString) {
149154
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
150155
} else if (response.getData().getChargeResponseCode().equals("02")) {
151156
if (!pollingCancelled) {
152-
requeryTx(flwRef, txRef, publicKey);
157+
requeryTx(flwRef, txRef, publicKey, data);
153158
} else mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
154159
} else if (response.getData().getChargeResponseCode().equals("00")) {
155-
mInteractor.showPollingIndicator(false);
160+
mInteractor.showPollingIndicator(false, "");
156161
mInteractor.onPaymentSuccessful(flwRef, txRef, responseAsJSONString);
157162
} else {
158163
mInteractor.showProgressIndicator(false);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/ghmobilemoney/GhMobileMoneyInteractorImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void onPaymentError(String errorMessage) {
6666
}
6767

6868
@Override
69-
public void showPollingIndicator(boolean active) {
69+
public void showPollingIndicator(boolean active, String validateInstruction) {
7070
// Todo: share validation message
7171
callback.showProgressIndicator(active);
7272
}

rave_remote/src/main/java/com/flutterwave/raveandroid/rave_remote/responses/MobileMoneyChargeResponse.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,24 @@ public static class Data {
4747
@SerializedName("link")
4848
String captchaLink;
4949
String code;
50+
String provider;
51+
String validateInstructions;
5052

53+
public String getProvider() {
54+
return provider;
55+
}
56+
57+
public void setProvider(String provider) {
58+
this.provider = provider;
59+
}
60+
61+
public String getValidateInstructions() {
62+
return validateInstructions;
63+
}
64+
65+
public void setValidateInstructions(String validateInstructions) {
66+
this.validateInstructions = validateInstructions;
67+
}
5168

5269
public void setFlwRef(String flwRef) {
5370
this.flwRef = flwRef;

0 commit comments

Comments
 (0)