Skip to content

Commit 9614a2c

Browse files
authored
Merge pull request #219 from bolaware/master
Prefill phone-number in AccountFragment if available
2 parents b86c83a + 56f8bec commit 9614a2c

File tree

8 files changed

+37
-17
lines changed

8 files changed

+37
-17
lines changed

ChargeVerificationUtils.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This module helps you handle charge verification when not using the default drop
1313
**Step 2.** Add the dependency for the utils library
1414

1515
dependencies {
16-
implementation 'com.github.Flutterwave.rave-android:rave_utils:2.1.5'
16+
implementation 'com.github.Flutterwave.rave-android:rave_utils:2.1.6'
1717
}
1818

1919
**Step 2.** In your payment activity or fragment, create and instance of the `RaveVerificationUtils` class

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ The payment methods currently supported are Cards, USSD, Mpesa, GH Mobile Money,
2929
If you want to use the default Drop In UI, add the `rave_android` module dependency
3030

3131
dependencies {
32-
implementation 'com.github.Flutterwave.rave-android:rave_android:2.1.5'
32+
implementation 'com.github.Flutterwave.rave-android:rave_android:2.1.6'
3333
}
3434

3535
but if you are not interested in our default UI and you want to use yours and only want to interact with our core sdk, use the `rave_presentation` module
3636

3737
dependencies {
38-
implementation 'com.github.Flutterwave.rave-android:rave_presentation:2.1.5'
38+
implementation 'com.github.Flutterwave.rave-android:rave_presentation:2.1.6'
3939
}
4040

4141
**Step 3.** Add the `INTERNET` permission to your android manifest

rave_android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
minSdkVersion 15
1010
targetSdkVersion 28
1111
versionCode 1
12-
versionName "2.1.5"
12+
versionName "2.1.6"
1313

1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1515

rave_android/src/main/java/com/flutterwave/raveandroid/account/AccountFragment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ public void onAmountValidated(String amountToSet, int visibility) {
236236
amountEt.setText(amountToSet);
237237
}
238238

239+
@Override
240+
public void onPhoneNumberValidated(String phoneNumber, int visibility) {
241+
phoneTil.setVisibility(visibility);
242+
phoneEt.setText(phoneNumber);
243+
}
244+
239245
@Override
240246
public void onDataValidationSuccessful(HashMap<String, ViewObject> dataHashMap) {
241247
presenter.processTransaction(dataHashMap, ravePayInitializer);

rave_android/src/main/java/com/flutterwave/raveandroid/account/AccountUiContract.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ interface View extends AccountContract.AccountInteractor {
2626

2727
void onAmountValidated(String amountToSet, int visibility);
2828

29+
void onPhoneNumberValidated(String phoneNumber, int visibility);
30+
2931
void showDateOfBirth(int isVisible);
3032

3133
void showBVN(int isVisible);

rave_android/src/main/java/com/flutterwave/raveandroid/account/AccountUiPresenter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ public void init(RavePayInitializer ravePayInitializer) {
252252

253253
boolean isEmailValid = emailValidator.isEmailValid(ravePayInitializer.getEmail());
254254
boolean isAmountValid = amountValidator.isAmountValid(ravePayInitializer.getAmount());
255+
boolean isPhoneValid = phoneValidator.isPhoneValid(ravePayInitializer.getPhoneNumber());
255256

256257
if (isEmailValid) {
257258
mView.onEmailValidated(ravePayInitializer.getEmail(), View.GONE);
@@ -263,6 +264,11 @@ public void init(RavePayInitializer ravePayInitializer) {
263264
} else {
264265
mView.onAmountValidated("", View.VISIBLE);
265266
}
267+
if(isPhoneValid){
268+
mView.onPhoneNumberValidated(ravePayInitializer.getPhoneNumber(), View.VISIBLE);
269+
} else {
270+
mView.onPhoneNumberValidated("", View.VISIBLE);
271+
}
266272
}
267273
}
268274

rave_android/src/main/java/com/flutterwave/raveandroid/account/NullAccountView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public void onBanksListRetrieved(List<Bank> banks) {
1919

2020
}
2121

22+
@Override
23+
public void onPhoneNumberValidated(String phoneNumber, int visibility) {
24+
25+
}
26+
2227
@Override
2328
public void showProgressIndicator(boolean active) {
2429

rave_android/src/main/res/layout/rave_sdk_fragment_account.xml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@
7777

7878
</com.google.android.material.textfield.TextInputLayout>
7979

80+
<EditText
81+
android:id="@+id/rave_bankEditText"
82+
android:layout_width="match_parent"
83+
android:layout_height="50dp"
84+
android:layout_marginLeft="20dp"
85+
android:layout_marginTop="3dp"
86+
android:layout_marginBottom="5dp"
87+
android:layout_marginRight="20dp"
88+
android:focusableInTouchMode="false"
89+
android:longClickable="false"
90+
android:hint="@string/bank"
91+
android:inputType="numberDecimal" />
92+
93+
8094
<com.google.android.material.textfield.TextInputLayout
8195
app:boxBackgroundColor="@null"
8296
android:id="@+id/rave_accountNumberTil"
@@ -120,19 +134,6 @@
120134

121135
</com.google.android.material.textfield.TextInputLayout>
122136

123-
<EditText
124-
android:id="@+id/rave_bankEditText"
125-
android:layout_width="match_parent"
126-
android:layout_height="50dp"
127-
android:layout_marginLeft="20dp"
128-
android:layout_marginTop="3dp"
129-
android:layout_marginBottom="5dp"
130-
android:layout_marginRight="20dp"
131-
android:focusableInTouchMode="false"
132-
android:longClickable="false"
133-
android:hint="@string/bank"
134-
android:inputType="numberDecimal" />
135-
136137

137138
<EditText
138139
android:id="@+id/rave_dobEditText"

0 commit comments

Comments
 (0)