Skip to content

Commit 61fa94b

Browse files
committed
Parse correct account details and sort code
1 parent 4c2aed5 commit 61fa94b

File tree

10 files changed

+55
-13
lines changed

10 files changed

+55
-13
lines changed

rave_android/src/main/java/com/flutterwave/raveandroid/uk/NullUkView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void onPaymentSuccessful(String status, String flwRef, String responseAsS
5959
}
6060

6161
@Override
62-
public void showTransactionPage(String amount, String paymentCode, String flwRef, String txRef) {
62+
public void showTransactionPage(String amount, String paymentCode, String accountNumber, String sortCode, String flwRef, String txRef) {
6363

6464
}
6565

rave_android/src/main/java/com/flutterwave/raveandroid/uk/UkFragment.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public void showToast(String message) {
218218
}
219219

220220
@Override
221-
public void showTransactionPage(String amount, String paymentCode, final String flwRef, final String txRef) {
221+
public void showTransactionPage(String amount, String paymentCode, String accountNumber, String sortCode, final String flwRef, final String txRef) {
222222

223223
if (getContext() != null) {
224224
final Dialog dialog = new Dialog(getContext());
@@ -227,8 +227,9 @@ public void showTransactionPage(String amount, String paymentCode, final String
227227
presenter.logEvent(new InstructionsDisplayedEvent("UK").getEvent(), ravePayInitializer.getPublicKey());
228228

229229
((TextView) dialog.findViewById(R.id.amount)).setText(String.format("%s %s", "GBP", amount));
230-
((TextView) dialog.findViewById(R.id.accountNumber)).setText(getString(R.string.flutterwave_ukaccount));
231-
((TextView) dialog.findViewById(R.id.sortCode)).setText(getString(R.string.flutterwave_sortcode));
230+
((TextView) dialog.findViewById(R.id.accountNumber)).setText(
231+
accountNumber != null ? accountNumber : getString(R.string.flutterwave_ukaccount));
232+
((TextView) dialog.findViewById(R.id.sortCode)).setText(sortCode != null ? sortCode : getString(R.string.flutterwave_sortcode));
232233
((TextView) dialog.findViewById(R.id.reference)).setText(paymentCode);
233234

234235
dialog.findViewById(R.id.ukPaymentButton).setOnClickListener(new View.OnClickListener() {

rave_android/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@
155155

156156
<string name="uk_instruction">Please complete this transaction on your Mobile Banking App or Online Banking Platform using the following details</string>
157157
<string name="i_have_completed_this_payment">I have completed this payment → </string>
158-
<string name="flutterwave_ukaccount">4327122</string>
158+
<string name="flutterwave_ukaccount">43271228</string>
159159
<string name="flutterwave_sortcode">04-00-53</string>
160-
<string name="barter_funnding">Barter Funnding</string>
160+
<string name="barter_funnding">Barter Funding</string>
161161

162162
<string name="reference_code">Reference Code</string>
163163
<string name="reference_code_placeholder">4990</string>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class RaveConstants {
3333
public static String STAGING_URL = "https://ravesandboxapi.flutterwave.com";
3434
public static String LIVE_URL = "https://api.ravepay.co";
3535
public static String EVENT_LOGGING_URL = "https://kgelfdz7mf.execute-api.us-east-1.amazonaws.com/";
36-
public static String FLUTTERWAVE_UK_ACCOUNT = "4327122";
36+
public static String FLUTTERWAVE_UK_ACCOUNT = "43271228";
3737
public static String FLUTTERWAVE_UK_SORT_CODE = "04-00-53";
3838
public static String FLUTTERWAVE_UK_BENEFICIARY_NAME = "Barter Funding";
3939

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface Interactor {
2121

2222
void onPaymentSuccessful(String status, String flwRef, String responseAsString);
2323

24-
void showTransactionPage(String amount, String paymentCode, String flwRef, String txRef);
24+
void showTransactionPage(String amount, String paymentCode, String accountNumber, String sortCode, String flwRef, String txRef);
2525
}
2626

2727
interface Handler {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ public void onSuccess(ChargeResponse response) {
108108
String amount = response.getAmount();
109109
String paymentCode = response.getPaymentCode();
110110
String flwRef = response.getFlwRef();
111+
String accountNumber = response.getAccountNumber();
112+
String sortCode = response.getSortCode();
111113
if (amount != null && paymentCode != null) {
112114
mInteractor.showProgressIndicator(false);
113-
mInteractor.showTransactionPage(amount, paymentCode, flwRef, txRef);
115+
mInteractor.showTransactionPage(amount, paymentCode, accountNumber, sortCode, flwRef, txRef);
114116
} else if (response.getPingUrl() != null) {
115117
callPingUrl(response.getPingUrl());
116118
} else {
@@ -145,8 +147,10 @@ public void onSuccess(PollingResponse response) {
145147
String amount = response.getAmount();
146148
String paymentCode = response.getPaymentCode();
147149
String flwRef = response.getFlwRef();
150+
String accountNumber = response.getAccountNumber();
151+
String sortCode = response.getSortCode();
148152
if (amount != null && paymentCode != null)
149-
mInteractor.showTransactionPage(amount, paymentCode, flwRef, txRef);
153+
mInteractor.showTransactionPage(amount, paymentCode, accountNumber, sortCode, flwRef, txRef);
150154
else mInteractor.onPaymentError(noResponse);
151155
} else callPingUrl(pingUrl);
152156
} else {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ public void onPaymentSuccessful(String status, String flwRef, String responseAsS
5656
}
5757

5858
@Override
59-
public void showTransactionPage(String amount, String paymentCode, final String flwRef, final String txRef) {
59+
public void showTransactionPage(String amount, String paymentCode, String accountNumber, String sortCode, final String flwRef, final String txRef) {
6060
callback.showTransactionDetails(
6161
amount,
62-
FLUTTERWAVE_UK_ACCOUNT,
63-
FLUTTERWAVE_UK_SORT_CODE,
62+
accountNumber != null ? accountNumber : FLUTTERWAVE_UK_ACCOUNT,
63+
sortCode != null ? sortCode : FLUTTERWAVE_UK_SORT_CODE,
6464
FLUTTERWAVE_UK_BENEFICIARY_NAME,
6565
paymentCode
6666
);

rave_remote/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ dependencies {
4444

4545
//dagger
4646
implementation 'com.google.dagger:dagger:2.27'
47+
implementation 'org.jetbrains:annotations-java5:15.0'
4748
annotationProcessor 'com.google.dagger:dagger-compiler:2.27'
4849

4950
testImplementation 'junit:junit:4.12'

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.flutterwave.raveandroid.rave_remote.responses;
22

3+
import androidx.annotation.Nullable;
4+
5+
import com.google.gson.JsonObject;
6+
37
/**
48
* Created by hamzafetuga on 18/07/2017.
59
*/
@@ -42,6 +46,28 @@ public String getPaymentCode() {
4246
return data.getData() == null ? null : data.getData().payment_code;
4347
}
4448

49+
@Nullable
50+
private JsonObject getMeta() {
51+
return data.getData() == null ? null : data.getData().meta_data;
52+
}
53+
54+
public String getAccountNumber() {
55+
try {
56+
return getMeta() == null ? null : getMeta().get("account_number").getAsString();
57+
} catch (Exception ignored) {
58+
return null;
59+
}
60+
}
61+
62+
public String getSortCode() {
63+
try {
64+
return getMeta() == null ? null : getMeta().get("sort_code").getAsString();
65+
} catch (Exception ignored) {
66+
return null;
67+
}
68+
}
69+
70+
4571
public String getFlwRef() {
4672
return (data.getData() == null) ? null : data.getData().getFlwRef();
4773
}
@@ -69,6 +95,7 @@ public void setInstruction(String instruction) {
6995

7096
public static class Data {
7197

98+
JsonObject meta_data;
7299
String ping_url;
73100
Data data;
74101
String suggested_auth;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ public String getFlwRef() {
2020
return (getResponse() == null) ? null : getResponse().getFlwRef();
2121
}
2222

23+
public String getAccountNumber() {
24+
return (getResponse() == null) ? null : getResponse().getAccountNumber();
25+
}
26+
27+
public String getSortCode() {
28+
return (getResponse() == null) ? null : getResponse().getSortCode();
29+
}
30+
31+
2332
class Data {
2433
ChargeResponse response_parsed;
2534
}

0 commit comments

Comments
 (0)