Skip to content

Commit 9e76455

Browse files
committed
Merge branch 'release/1.0.7' of github.com:Flutterwave/Flutter_Standard into develop
2 parents e09b254 + c3d2096 commit 9e76455

15 files changed

+204
-38
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.0.7] - February, 2023
2+
* Fixed iOS bug where webview couldn't close when close buttons are clicked
3+
* Removed required `name` and `phone number` fields in `Customer` object
4+
15
## [1.0.6] - October, 2022
26
* Fixed bug where transaction gets stuck after redirecting on webview
37
* Fixed iOS build bug by removing inAppBrowser library

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Available features include:
3434

3535
## Installation
3636

37-
1. Add the dependency to your project. In your `pubspec.yaml` file add: `flutterwave_standard: 1.0.5`
37+
1. Add the dependency to your project. In your `pubspec.yaml` file add: `flutterwave_standard: 1.0.7`
3838
2. Run `flutter pub get`
3939

4040

example/ios/Podfile.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
11
PODS:
22
- Flutter (1.0.0)
3+
- flutter_inappwebview (0.0.1):
4+
- Flutter
5+
- flutter_inappwebview/Core (= 0.0.1)
6+
- OrderedSet (~> 5.0)
7+
- flutter_inappwebview/Core (0.0.1):
8+
- Flutter
9+
- OrderedSet (~> 5.0)
310
- fluttertoast (0.0.2):
411
- Flutter
512
- Toast
13+
- OrderedSet (5.0.0)
614
- Toast (4.0.0)
715
- webview_flutter_wkwebview (0.0.1):
816
- Flutter
917

1018
DEPENDENCIES:
1119
- Flutter (from `Flutter`)
20+
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
1221
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
1322
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
1423

1524
SPEC REPOS:
1625
trunk:
26+
- OrderedSet
1727
- Toast
1828

1929
EXTERNAL SOURCES:
2030
Flutter:
2131
:path: Flutter
32+
flutter_inappwebview:
33+
:path: ".symlinks/plugins/flutter_inappwebview/ios"
2234
fluttertoast:
2335
:path: ".symlinks/plugins/fluttertoast/ios"
2436
webview_flutter_wkwebview:
2537
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
2638

2739
SPEC CHECKSUMS:
2840
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
41+
flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721
2942
fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
43+
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
3044
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
3145
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f
3246

example/lib/main.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class MyApp extends StatelessWidget {
1010
@override
1111
Widget build(BuildContext context) {
1212
return MaterialApp(
13+
debugShowCheckedModeBanner: false,
1314
title: 'Flutter Standard Demo',
1415
home: MyHomePage('Flutterwave Standard'),
1516
);
@@ -170,10 +171,7 @@ class _MyHomePageState extends State<MyHomePage> {
170171
}
171172

172173
_handlePaymentInitialization() async {
173-
final Customer customer = Customer(
174-
name: "FLW Developer",
175-
phoneNumber: this.phoneNumberController.text ?? "12345678",
176-
email: "[email protected]");
174+
final Customer customer = Customer(email: "[email protected]");
177175

178176
final Flutterwave flutterwave = Flutterwave(
179177
context: context,
@@ -198,8 +196,7 @@ class _MyHomePageState extends State<MyHomePage> {
198196
}
199197

200198
String getPublicKey() {
201-
if (isTestMode) return "FLWPUBK_TEST--X";
202-
return "FLWPUBK--X";
199+
return "";
203200
}
204201

205202
void _openBottomSheet() {
@@ -248,7 +245,7 @@ class _MyHomePageState extends State<MyHomePage> {
248245
Future<void> showLoading(String message) {
249246
return showDialog(
250247
context: this.context,
251-
barrierDismissible: false,
248+
barrierDismissible: true,
252249
builder: (BuildContext context) {
253250
return AlertDialog(
254251
content: Container(

example/pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ packages:
6969
description: flutter
7070
source: sdk
7171
version: "0.0.0"
72+
flutter_inappwebview:
73+
dependency: transitive
74+
description:
75+
name: flutter_inappwebview
76+
url: "https://pub.dartlang.org"
77+
source: hosted
78+
version: "5.7.2+3"
7279
flutter_test:
7380
dependency: "direct dev"
7481
description: flutter

example/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ dependencies:
1111
sdk: flutter
1212
flutterwave_standard:
1313
path: "../"
14-
# flutterwave_standard: ^1.0.4
1514
cupertino_icons: ^0.1.3
1615
uuid: 3.0.4
1716

lib/core/TransactionCallBack.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import 'package:flutterwave_standard/flutterwave.dart';
2+
13
abstract class TransactionCallBack {
2-
onTransactionSuccess(String id, String txRef);
3-
onTransactionError();
4-
onCancelled();
4+
onTransactionComplete(ChargeResponse? chargeResponse);
55
}

lib/core/flutterwave.dart

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import 'package:flutterwave_standard/models/requests/standard_request.dart';
55
import 'package:flutterwave_standard/models/responses/charge_response.dart';
66
import 'package:flutterwave_standard/models/responses/standard_response.dart';
77
import 'package:flutterwave_standard/models/subaccount.dart';
8+
import 'package:flutterwave_standard/utils.dart';
89
import 'package:flutterwave_standard/view/flutterwave_style.dart';
9-
import 'package:flutterwave_standard/view/standard_webview.dart';
10+
import 'package:flutterwave_standard/view/standard_widget.dart';
1011
import 'package:flutterwave_standard/view/view_utils.dart';
1112
import 'package:http/http.dart';
1213

@@ -20,11 +21,12 @@ class Flutterwave {
2021
String publicKey;
2122
String paymentOptions;
2223
String redirectUrl;
23-
String? currency;
24+
String currency;
2425
String? paymentPlanId;
2526
List<SubAccount>? subAccounts;
2627
Map<dynamic, dynamic>? meta;
2728
FlutterwaveStyle? style;
29+
ChargeResponse? response;
2830

2931
Flutterwave(
3032
{required this.context,
@@ -36,13 +38,13 @@ class Flutterwave {
3638
required this.customization,
3739
required this.redirectUrl,
3840
required this.isTestMode,
39-
this.currency,
41+
required this.currency,
4042
this.paymentPlanId,
4143
this.subAccounts,
4244
this.meta,
4345
this.style});
4446

45-
/// Starts Standard Transaction
47+
/// Starts a transaction by calling the Standard service
4648
Future<ChargeResponse> charge() async {
4749
final request = StandardRequest(
4850
txRef: txRef,
@@ -83,24 +85,17 @@ class Flutterwave {
8385
txRef: request.txRef, status: "error", success: false);
8486
}
8587

86-
final transactionResult = await Navigator.push(
87-
context,
88-
MaterialPageRoute(
89-
builder: (context) => StandardWebView(
90-
url: standardResponse!.data!.link!,
88+
final response = await Navigator.push(
89+
context,
90+
MaterialPageRoute(
91+
builder: (context) => StandardPaymentWidget(
92+
webUrl: standardResponse!.data!.link!,
93+
),
9194
),
92-
),
93-
);
95+
);
9496

95-
if (transactionResult == null) {
96-
return ChargeResponse(
97-
txRef: request.txRef, status: "cancelled", success: false);
98-
}
99-
if (transactionResult.runtimeType == ChargeResponse().runtimeType) {
100-
return transactionResult;
97+
if (response != null) return response!;
98+
return ChargeResponse(txRef: request.txRef, status: "cancelled", success: false);
10199
}
102100

103-
return ChargeResponse(
104-
txRef: request.txRef, status: "cancelled", success: false);
105-
}
106101
}

lib/models/requests/customer.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import '../../utils.dart';
22

33
class Customer {
44
String email;
5-
String phoneNumber;
6-
String name;
5+
String? phoneNumber;
6+
String? name;
77

8-
Customer({required this.name, required this.phoneNumber, required this.email});
8+
Customer({required this.email, this.name, this.phoneNumber});
99

1010
/// Converts instance of Customer to json
1111
Map<String, dynamic> toJson() {
1212
final customer = {
1313
"email": this.email,
14-
"phonenumber": this.phoneNumber,
15-
"name": this.name
14+
"phonenumber": this.phoneNumber ?? "",
15+
"name": this.name ?? ""
1616
};
1717
return Utils.removeKeysWithEmptyValues(customer);
1818
}

lib/utils.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class Utils {
33
static const String STANDARD_PAYMENT = "payments";
44
static const _DEBUG_BASE_URL =
55
"https://ravesandboxapi.flutterwave.com/v3/sdkcheckout/";
6+
static const DEFAULT_CURRENCY = "NGN";
67

78
/// Returns base url depending on test mode
89
static String getBaseUrl(final bool isTestMode) {

0 commit comments

Comments
 (0)