Skip to content

Commit 876dfd9

Browse files
committed
bug-fix transaction cancelled bug
1 parent 93d780e commit 876dfd9

File tree

10 files changed

+29
-15
lines changed

10 files changed

+29
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
## [1.0.0] - September 9, 2021.
22
* Initial release
3+
4+
5+
## [1.0.1] - September 14, 2021.
6+
* Fix bug where response is not returned to initiating screen when user cancels transaction.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Flutterwave version 3 API keys
4141

4242
In your `pubspec.yaml` file add:
4343

44-
1. `flutterwave_standard: 1.0.0`
44+
1. `flutterwave_standard: 1.0.1`
4545
2. run `flutter pub get`
4646

4747
<a id="usage"></a>

example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ android {
3939
defaultConfig {
4040
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4141
applicationId "com.example.flutterwave_beta"
42-
minSdkVersion 16
42+
minSdkVersion 19
4343
targetSdkVersion 28
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName

example/lib/main.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class _MyHomePageState extends State<MyHomePage> {
219219
context: context,
220220
style: style,
221221
publicKey: this.publicKeyController.text.trim().isEmpty
222-
? this.pbk
222+
? this.getPublicKey()
223223
: this.publicKeyController.text.trim(),
224224
currency: this.selectedCurrency,
225225
txRef: Uuid().v1(),
@@ -238,6 +238,11 @@ class _MyHomePageState extends State<MyHomePage> {
238238
}
239239
}
240240

241+
String getPublicKey() {
242+
if (isTestMode) return "FLWPUBK_TEST-X";
243+
return "FLWPUBK-X";
244+
}
245+
241246
void _openBottomSheet() {
242247
showModalBottomSheet(
243248
context: this.context,
@@ -247,7 +252,7 @@ class _MyHomePageState extends State<MyHomePage> {
247252
}
248253

249254
Widget _getCurrency() {
250-
final currencies = ["NGN", "RWF", "UGX", "ZAR", "USD"];
255+
final currencies = ["NGN", "RWF", "UGX", "ZAR", "USD", "GHS"];
251256
return Container(
252257
height: 250,
253258
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),

example/pubspec.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ packages:
9999
name: http
100100
url: "https://pub.dartlang.org"
101101
source: hosted
102-
version: "0.13.0"
102+
version: "0.13.3"
103103
http_parser:
104104
dependency: transitive
105105
description:
@@ -141,7 +141,7 @@ packages:
141141
name: pedantic
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "1.11.0"
144+
version: "1.11.1"
145145
sky_engine:
146146
dependency: transitive
147147
description: flutter
@@ -216,7 +216,7 @@ packages:
216216
name: webview_flutter
217217
url: "https://pub.dartlang.org"
218218
source: hosted
219-
version: "2.0.2"
219+
version: "2.0.13"
220220
sdks:
221221
dart: ">=2.12.0 <3.0.0"
222-
flutter: ">=1.22.0"
222+
flutter: ">=2.0.0"

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies:
1111
sdk: flutter
1212
flutterwave_standard:
1313
path: "../"
14+
# flutterwave_standard: ^1.0.0
1415
cupertino_icons: ^0.1.3
1516
uuid: 3.0.4
1617

lib/core/navigation_controller.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ class NavigationController {
4747
/// Opens browser with URL returned from startTransaction()
4848
Future<Map<String, dynamic>> openBrowser(
4949
final String url,
50-
final String redirectUrl
50+
final String redirectUrl,
51+
[final bool isTestMode = false]
5152
) async {
5253
var response = await Navigator.push(
5354
_buildContext,
5455
MaterialPageRoute(
55-
builder: (context) => FlutterwaveWebview(url, redirectUrl)),
56+
builder: (context) => FlutterwaveWebview(url, redirectUrl, isTestMode)),
5657
);
5758
if (response == null) {
5859
Map<String, dynamic> errorResponse = {

lib/view/payment_widget.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class _PaymentState extends State<PaymentWidget> {
3333

3434
@override
3535
Widget build(BuildContext context) {
36-
controller =
37-
NavigationController(context, Client(), widget.style);
36+
controller = NavigationController(context, Client(), widget.style);
3837
return MaterialApp(
3938
navigatorKey: _navigatorKey,
39+
debugShowCheckedModeBanner: widget.request.isTestMode,
4040
home: Scaffold(
4141
backgroundColor: widget.style.getMainBackgroundColor(),
4242
appBar: FlutterwaveViewUtils.appBar(
@@ -93,11 +93,12 @@ class _PaymentState extends State<PaymentWidget> {
9393
}
9494

9595
void _handlePaymentComplete(ChargeResponse response) {
96-
Navigator.pop(context, response);
96+
Navigator.pop(context, response); // return response to user
9797
}
9898

9999
void _showError(final String errorMessage) {
100100
FlutterwaveViewUtils.showToast(context, errorMessage);
101+
Navigator.pop(context); // return response to user
101102
}
102103

103104
void _showConfirmDialog() {

lib/view/webview.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import '../utils.dart';
99
class FlutterwaveWebview extends StatefulWidget {
1010
final String _url;
1111
final String _redirectUrl;
12+
final bool _isTestMode;
1213

13-
FlutterwaveWebview(this._url, this._redirectUrl);
14+
FlutterwaveWebview(this._url, this._redirectUrl, this._isTestMode);
1415

1516
@override
1617
_FlutterwaveWebviewState createState() => _FlutterwaveWebviewState();
@@ -26,6 +27,7 @@ class _FlutterwaveWebviewState extends State<FlutterwaveWebview> {
2627
@override
2728
Widget build(BuildContext context) {
2829
return MaterialApp(
30+
debugShowCheckedModeBanner: widget._isTestMode,
2931
home: Scaffold(
3032
body: SafeArea(
3133
child: Container(

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutterwave_standard
22
description: Flutterwave's official library that wraps the standard implementation.
3-
version: 1.0.0
3+
version: 1.0.1
44
homepage: https://github.com/Flutterwave/flutter_standard
55
environment:
66
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)