Skip to content

Commit c8a489b

Browse files
authored
Merge pull request #4 from Flutterwave/master
Update
2 parents 09b25c9 + 7dded77 commit c8a489b

File tree

14 files changed

+116
-63
lines changed

14 files changed

+116
-63
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Set the public key, encryption key and other required parameters. The `RavePayMa
7070
.isPreAuth(boolean)
7171
.setSubAccounts(List<SubAccount>)
7272
.shouldDisplayFee(boolean)
73+
.showStagingLabel(boolean)
7374
.initialize();
7475

7576
| function | parameter | type | required |
@@ -97,6 +98,7 @@ Set the public key, encryption key and other required parameters. The `RavePayMa
9798
| withTheme(styleId) | Sets the theme of the UI. | `int` | Not Required
9899
| setPaymentPlan(payment_plan) | If you want to do recurrent payment, this is the payment plan ID to use for the recurring payment, you can see how to create payment plans [here](https://flutterwavedevelopers.readme.io/v2.0/reference#create-payment-plan) and [here](https://flutterwavedevelopers.readme.io/docs/recurring-billing). This is only available for card payments | `String` | Not Required
99100
| shouldDisplayFee(boolean) | Set to `false` to not display a dialog for confirming total amount(including charge fee) that Rave will charge. By default this is set to `true` | `boolean` | Not Required
101+
| showStagingLabel(boolean) | Set to `false` to not display a staging label when in staging environment. By default this is set to `true` | `boolean` | Not Required
100102
| initialize() | Launch the Rave Payment UI | N/A | Required
101103

102104
### 2. Handle the response
@@ -124,7 +126,7 @@ In the calling activity, override the `onActivityResult` method to receive the p
124126
super.onActivityResult(requestCode, resultCode, data);
125127
}
126128
}
127-
The intent's `message` object contains the raw JSON response from the Rave API. This can be parsed to retrieve any additional payment information needed.
129+
The intent's `message` object contains the raw JSON response from the Rave API. This can be parsed to retrieve any additional payment information needed. Typical success response can be found [here](https://gist.github.com/BolajisBrain/305ef5a6df7744694d9c35787580a2d2) and failed response [here](https://gist.github.com/BolajisBrain/afa972cbca782bbb942984ddec9f5262).
128130

129131
> **PLEASE NOTE**
130132
> We advise you to do a further verification of transaction's details on your server to be

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ dependencies {
2323
androidTestImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', {
2424
exclude group: 'com.android.support', module: 'support-annotations'
2525
})
26-
implementation 'com.android.support:appcompat-v7:27.0.2'
27-
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
26+
implementation 'com.android.support:appcompat-v7:27.1.1'
27+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
2828
testImplementation 'junit:junit:4.12'
2929
implementation project(':raveandroid')
3030
}

app/src/main/java/com/flutterwave/rave_android/MainActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class MainActivity extends AppCompatActivity {
5050
SwitchCompat accountAchSwitch;
5151
SwitchCompat addSubAccountsSwitch;
5252
SwitchCompat isPreAuthSwitch;
53+
SwitchCompat shouldShowStagingLabelSwitch;
5354
List<Meta> meta = new ArrayList<>();
5455
List<SubAccount> subAccounts = new ArrayList<>();
5556
LinearLayout addSubaccountsLayout;
@@ -80,6 +81,7 @@ protected void onCreate(Bundle savedInstanceState) {
8081
ugMobileMoneySwitch = findViewById(R.id.accountUgMobileMoneySwitch);
8182
isLiveSwitch = findViewById(R.id.isLiveSwitch);
8283
addSubAccountsSwitch = findViewById(R.id.addSubAccountsSwitch);
84+
shouldShowStagingLabelSwitch = findViewById(R.id.shouldShowStagingLabelSwitch);
8385
addVendorBtn = findViewById(R.id.addVendorBtn);
8486
clearVendorBtn = findViewById(R.id.clearVendorsBtn);
8587
vendorListTXT = findViewById(R.id.refIdsTV);
@@ -202,6 +204,7 @@ private void validateEntries() {
202204
.onStagingEnv(!isLiveSwitch.isChecked())
203205
.setSubAccounts(subAccounts)
204206
.isPreAuth(isPreAuthSwitch.isChecked())
207+
.showStagingLabel(shouldShowStagingLabelSwitch.isChecked())
205208
// .setMeta(meta)
206209
// .withTheme(R.style.TestNewTheme)
207210
.initialize();

app/src/main/res/layout/activity_main.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@
5757
android:id="@+id/isDisplayFeeSwitch"
5858
/>
5959

60+
<android.support.v7.widget.SwitchCompat
61+
android:layout_width="match_parent"
62+
android:layout_height="wrap_content"
63+
android:layout_marginBottom="10dp"
64+
android:text="Show Staging Label"
65+
android:checked="true"
66+
android:id="@+id/shouldShowStagingLabelSwitch"
67+
/>
68+
69+
6070
<android.support.v7.widget.SwitchCompat
6171
android:layout_width="match_parent"
6272
android:layout_height="wrap_content"

build.gradle

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

33
buildscript {
44
repositories {
5-
jcenter()
65
google()
6+
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.2.1'
9+
classpath 'com.android.tools.build:gradle:3.3.0'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
@@ -15,8 +15,8 @@ buildscript {
1515

1616
allprojects {
1717
repositories {
18-
jcenter()
1918
google()
19+
jcenter()
2020
}
2121
}
2222

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Oct 11 09:31:48 WAT 2018
1+
#Wed Jan 23 18:21:35 WAT 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

raveandroid/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ apply plugin: 'com.github.dcendents.android-maven'
33
group = 'com.github.flutterwave'
44

55
android {
6-
compileSdkVersion 25
6+
compileSdkVersion 27
77

88
defaultConfig {
99
minSdkVersion 15
10-
targetSdkVersion 25
10+
targetSdkVersion 27
1111
versionCode 1
1212
versionName "1.0"
1313

@@ -27,9 +27,9 @@ dependencies {
2727
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
2828
exclude group: 'com.android.support', module: 'support-annotations'
2929
})
30-
implementation 'com.android.support:appcompat-v7:25.4.0'
31-
implementation 'com.android.support:design:25.4.0'
32-
implementation 'com.android.support:support-v4:25.4.0'
30+
implementation 'com.android.support:appcompat-v7:27.1.1'
31+
implementation 'com.android.support:design:27.1.1'
32+
implementation 'com.android.support:support-v4:27.1.1'
3333
implementation 'com.squareup.picasso:picasso:2.71828'
3434
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
3535
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class RaveConstants {
1616
public static String LIVE_URL = "https://raveapi.azurewebsites.net";
1717
public static String VBV = "VBVSECURECODE";
1818
public static String GTB_OTP = "GTB_OTP";
19+
public static String ACCESS_OTP = "ACCESS_OTP";
1920
public static String NOAUTH = "NOAUTH";
2021
public static String PIN = "PIN";
2122
public static String AVS_VBVSECURECODE = "AVS_VBVSECURECODE";

raveandroid/src/main/java/com/flutterwave/raveandroid/RavePayActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ protected void onCreate(Bundle savedInstanceState) {
7979

8080
if (ravePayInitializer.isStaging()) {
8181
BASE_URL = RaveConstants.STAGING_URL;
82+
if(ravePayInitializer.getShowStagingLabel()){
83+
findViewById(R.id.stagingModeBannerLay).setVisibility(View.VISIBLE);
84+
}
8285
}
8386
else {
8487
BASE_URL = RaveConstants.LIVE_URL;

raveandroid/src/main/java/com/flutterwave/raveandroid/RavePayInitializer.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class RavePayInitializer {
3333
boolean staging = true;
3434
boolean isPreAuth = false;
3535
boolean displayFee = true;
36+
boolean showStagingLabel;
3637

3738
public RavePayInitializer(String email, double amount, String publicKey,
3839
String encryptionKey, String txRef, String narration,
@@ -41,7 +42,8 @@ public RavePayInitializer(String email, double amount, String publicKey,
4142
boolean withAccount, boolean withMpesa, boolean withGHMobileMoney,
4243
boolean withUgMobileMoney,
4344
boolean withAch, int theme,
44-
boolean staging, String meta, String subAccounts, String payment_plan, boolean isPreAuth) {
45+
boolean staging, String meta, String subAccounts, String payment_plan, boolean isPreAuth,
46+
boolean showStagingLabel) {
4547
this.email = email;
4648
this.amount = amount;
4749
this.publicKey = publicKey;
@@ -64,11 +66,20 @@ public RavePayInitializer(String email, double amount, String publicKey,
6466
this.subAccounts = subAccounts;
6567
this.payment_plan = payment_plan;
6668
this.isPreAuth = isPreAuth;
69+
this.showStagingLabel = showStagingLabel;
6770
}
6871

6972
public RavePayInitializer() {
7073
}
7174

75+
public boolean getShowStagingLabel() {
76+
return showStagingLabel;
77+
}
78+
79+
public void showStagingLabel(boolean showStagingLabel) {
80+
this.showStagingLabel = showStagingLabel;
81+
}
82+
7283
public boolean isWithMpesa() {
7384
return withMpesa;
7485
}

0 commit comments

Comments
 (0)