Skip to content

Commit 9a887e0

Browse files
committed
Catch Rave Auth Model switching
When a transaction fails with one auth Model, Rave sometimes tries another authModel. This commit catches more auth models after the first charge with auth model
1 parent af02ee2 commit 9a887e0

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

raveandroid/src/main/java/com/flutterwave/raveandroid/card/CardPresenter.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ public void processSavedCardTransaction(SavedCard savedCard, RavePayInitializer
549549

550550

551551
@Override
552-
public void chargeCardWithSuggestedAuthModel(Payload payload, String zipOrPin, String authModel, String encryptionKey) {
552+
public void chargeCardWithSuggestedAuthModel(final Payload payload, String zipOrPin, String authModel, String encryptionKey) {
553553

554554
if (authModel.equalsIgnoreCase(AVS_VBVSECURECODE)) {
555555
payload.setBillingzip(zipOrPin);
@@ -595,6 +595,22 @@ public void onSuccess(ChargeResponse response, String responseAsJSONString) {
595595
} else if (authModelUsed.equalsIgnoreCase(AVS_VBVSECURECODE)) {
596596
String flwRef = response.getData().getFlwRef();
597597
mView.onAVSVBVSecureCodeModelUsed(response.getData().getAuthurl(), flwRef);
598+
} else if (authModelUsed.equalsIgnoreCase(VBV)) {
599+
String authUrlCrude = response.getData().getAuthurl();
600+
String flwRef = response.getData().getFlwRef();
601+
602+
mView.onVBVAuthModelUsed(authUrlCrude, flwRef);
603+
} else if (authModelUsed.equalsIgnoreCase(GTB_OTP)
604+
|| authModelUsed.equalsIgnoreCase(ACCESS_OTP)
605+
|| authModelUsed.toLowerCase().contains("otp")) {
606+
String flwRef = response.getData().getFlwRef();
607+
String chargeResponseMessage = response.getData().getChargeResponseMessage();
608+
chargeResponseMessage = chargeResponseMessage == null ? enterOTP : chargeResponseMessage;
609+
mView.showOTPLayout(flwRef, chargeResponseMessage);
610+
611+
} else if (authModelUsed.equalsIgnoreCase(NOAUTH)) {
612+
String flwRef = response.getData().getFlwRef();
613+
mView.onNoAuthUsed(flwRef, payload.getPBFPubKey());
598614
} else {
599615
mView.onPaymentError(unknownAuthmsg);
600616
}

0 commit comments

Comments
 (0)