Skip to content

Commit dc787f4

Browse files
committed
Catch failure case while polling transaction status
1 parent 1afc109 commit dc787f4

File tree

11 files changed

+31
-3
lines changed

11 files changed

+31
-3
lines changed

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/ach/AchHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public void onError(String message) {
9797
}
9898

9999
public void requeryTx(String flwRef, String publicKey) {
100-
//todo call requery
101100

102101
RequeryRequestBody body = new RequeryRequestBody();
103102
body.setFlw_ref(flwRef);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/banktransfer/BankTransferHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ public void onSuccess(RequeryResponse response, String responseAsJSONString) {
165165
if (response.getData() == null) {
166166
mInteractor.showPollingIndicator(false);
167167
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
168+
} else if (response.getData().getStatus().contains("fail")) {
169+
mInteractor.showProgressIndicator(false);
170+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
168171
} else if (response.getData().getChargeResponseCode().equals("01")) {
169172
if (pollingCancelled) {
170173
mInteractor.showPollingIndicator(false);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/barter/BarterHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public void requeryTx(final String flwRef, final String publicKey) {
110110
public void onSuccess(RequeryResponse response, String responseAsJSONString) {
111111
if (response.getData() == null) {
112112
mInteractor.onPaymentFailed(flwRef, responseAsJSONString);
113+
} else if (response.getData().getStatus().contains("fail")) {
114+
mInteractor.showProgressIndicator(false);
115+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
113116
} else if (response.getData().getChargeResponseCode().equals("02")) {
114117
if (pollingCancelled) {
115118
mInteractor.showPollingIndicator(false);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/francmobilemoney/FrancMobileMoneyHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public void onSuccess(RequeryResponse response, String responseAsJSONString) {
134134

135135
if (response.getData() == null) {
136136
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
137+
} else if (response.getData().getStatus().contains("fail")) {
138+
mInteractor.showProgressIndicator(false);
139+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
137140
} else if (response.getData().getChargeResponseCode().equals("02")) {
138141
requeryTx(flwRef, txRef, publicKey);
139142
} else if (response.getData().getChargeResponseCode().equals("00")) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ public void requeryTx(final String flwRef, final String txRef, final String publ
144144
public void onSuccess(RequeryResponse response, String responseAsJSONString) {
145145
if (response.getData() == null) {
146146
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
147+
} else if (response.getData().getStatus().contains("fail")) {
148+
mInteractor.showProgressIndicator(false);
149+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
147150
} else if (response.getData().getChargeResponseCode().equals("02")) {
148151
if (!pollingCancelled) {
149152
requeryTx(flwRef, txRef, publicKey);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/mpesa/MpesaHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ public void requeryTx(final String flwRef, final String txRef, final String publ
136136
public void onSuccess(RequeryResponse response, String responseAsJSONString) {
137137
if (response.getData() == null) {
138138
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
139+
} else if (response.getData().getStatus().contains("fail")) {
140+
mInteractor.showProgressIndicator(false);
141+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
139142
} else if (response.getData().getChargeResponseCode().equals("02")) {
140143
if (!pollingCancelled) {
141144
requeryTx(flwRef, txRef, publicKey);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/rwfmobilemoney/RwfMobileMoneyHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ public void requeryTx(final String flwRef, final String txRef, final String publ
146146
public void onSuccess(RequeryResponse response, String responseAsJSONString) {
147147
if (response.getData() == null) {
148148
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
149+
} else if (response.getData().getStatus().contains("fail")) {
150+
mInteractor.showProgressIndicator(false);
151+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
149152
} else if (response.getData().getChargeResponseCode().equals("02")) {
150153
if (!pollingCancelled) {
151154
requeryTx(flwRef, txRef, publicKey);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/ugmobilemoney/UgMobileMoneyHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,15 @@ public void requeryTx(final String flwRef, final String txRef, final String publ
143143
public void onSuccess(RequeryResponse response, String responseAsJSONString) {
144144
if (response.getData() == null) {
145145
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
146+
} else if (response.getData().getStatus().contains("fail")) {
147+
mInteractor.showProgressIndicator(false);
148+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
146149
} else if (response.getData().getChargeResponseCode().equals("02")) {
147150
// Log.d("Requery response",responseAsJSONString);
148151
if (pollingCancelled) {
149152
mInteractor.showPollingIndicator(false);
150153
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
151-
}
152-
else requeryTx(flwRef, txRef, publicKey);
154+
} else requeryTx(flwRef, txRef, publicKey);
153155

154156
} else if (response.getData().getChargeResponseCode().equals("00")) {
155157
mInteractor.showPollingIndicator(false);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/uk/UkHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ public void requeryTx(final String flwRef, final String txRef, final String publ
181181
public void onSuccess(RequeryResponse response, String responseAsJSONString) {
182182
if (response.getData() == null) {
183183
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
184+
} else if (response.getData().getStatus().contains("fail")) {
185+
mInteractor.showProgressIndicator(false);
186+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
184187
} else if (response.getData().getChargeResponseCode().equals("02")) {
185188
if (pollingCancelled) {
186189
mInteractor.showPollingIndicator(false);

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/ussd/UssdHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ public void onSuccess(RequeryResponse response, String responseAsJSONString) {
152152
if (response.getData() == null) {
153153
mInteractor.showPollingIndicator(false);
154154
mInteractor.onPaymentFailed(response.getStatus(), responseAsJSONString);
155+
} else if (response.getData().getStatus().contains("fail")) {
156+
mInteractor.showProgressIndicator(false);
157+
mInteractor.onPaymentFailed(response.getData().getStatus(), responseAsJSONString);
155158
} else if (response.getData().getChargeResponseCode().equals("02")) {
156159
if (pollingCancelled) {
157160
mInteractor.showPollingIndicator(false);

0 commit comments

Comments
 (0)