Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #186 fix ❤️😍 #187

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ group 'co.paystack.flutterpaystack'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.7.20'
ext.kotlin_version = '1.9.21'
repositories {
mavenCentral()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.0-rc02'
classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 32
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android {

defaultConfig {
applicationId "co.paystack.flutterpaystack"
minSdkVersion 16
minSdkVersion flutter.minSdkVersion
targetSdkVersion 32
versionCode 1
versionName "1.0"
Expand All @@ -44,4 +44,4 @@ android {

flutter {
source '../..'
}
}
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class _HomePageState extends State<HomePage> {
charge: charge,
fullscreen: false,
logo: MyLogo(),
uploadInformation: null,
);
print('Response = $response');
setState(() => _inProgress = false);
Expand Down
4 changes: 4 additions & 0 deletions lib/src/common/paystack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class PaystackPlugin {
Future<CheckoutResponse> checkout(
BuildContext context, {
required Charge charge,
required dynamic uploadInformation,
CheckoutMethod method = CheckoutMethod.selectable,
bool fullscreen = false,
Widget? logo,
Expand All @@ -135,6 +136,7 @@ class PaystackPlugin {
logo: logo,
hideAmount: hideAmount,
hideEmail: hideEmail,
uploadInformation: uploadInformation,
);
}

Expand Down Expand Up @@ -167,6 +169,7 @@ class _Paystack {
required Charge charge,
required CheckoutMethod method,
required bool fullscreen,
required dynamic uploadInformation,
bool hideEmail = false,
bool hideAmount = false,
Widget? logo,
Expand Down Expand Up @@ -202,6 +205,7 @@ class _Paystack {
logo: logo,
hideAmount: hideAmount,
hideEmail: hideEmail,
uploadInformation: uploadInformation,
),
);
return response == null ? CheckoutResponse.defaults() : response;
Expand Down
12 changes: 12 additions & 0 deletions lib/src/models/checkout_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ class CheckoutResponse {
this.account})
: assert(card != null || account != null);

Map<String, dynamic> toMap() {
return {
'message': message.toString(),
'card': card.toString(),
'account': account.toString(),
'reference': reference.toString(),
'status': status.toString(),
'method': method.toString(),
'verify': verify.toString(),
};
}

@override
String toString() {
return 'CheckoutResponse{message: $message, card: $card, account: $account, reference: $reference, status: $status, method: $method, verify: $verify}';
Expand Down
10 changes: 8 additions & 2 deletions lib/src/widgets/checkout/checkout_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ class CheckoutWidget extends StatefulWidget {
final BankServiceContract bankService;
final CardServiceContract cardsService;
final String publicKey;
final dynamic uploadInformation;

CheckoutWidget({
required this.method,
required this.charge,
required this.bankService,
required this.cardsService,
required this.publicKey,
required this.uploadInformation,
this.fullscreen = false,
this.logo,
this.hideEmail = false,
Expand Down Expand Up @@ -188,7 +190,8 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
Text(
'Pay',
style: TextStyle(
fontSize: 14.0, color: context.textTheme().headline1?.color),
fontSize: 14.0,
color: context.textTheme().headline1?.color),
),
SizedBox(
width: 5.0,
Expand Down Expand Up @@ -353,6 +356,9 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
_paymentSuccessful = true;
_paymentError = null;
_onProcessingChange(false);

// Upload information to database
widget.uploadInformation();
});
}

Expand Down Expand Up @@ -421,7 +427,7 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
if (_response!.card != null) {
_response!.card!.nullifyNumber();
}
Navigator.of(context).pop(_response);
Navigator.of(context).pop(_response);
},
);

Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: flutter_paystack
description: A Flutter plugin for making payments via Paystack Payment Gateway. Completely supports Android and iOS.
version: 1.0.7
version: 1.0.8
homepage: https://github.com/wilburt/flutter_paystack

dependencies:
flutter:
sdk: flutter
http: ^0.13.5
intl: ^0.17.0
http: ^1.2.1
intl: ^0.18.1
meta: ^1.8.0
async: ^2.9.0

Expand Down
10 changes: 10 additions & 0 deletions test/src/widgets/checkout/checkout_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void main() {
charge: charge,
fullscreen: false,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -62,6 +63,7 @@ void main() {
charge: charge,
fullscreen: false,
logo: null,
uploadInformation: null,
),
);

Expand Down Expand Up @@ -90,6 +92,7 @@ void main() {
charge: charge,
fullscreen: false,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -108,6 +111,7 @@ void main() {
charge: charge,
fullscreen: false,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -132,6 +136,7 @@ void main() {
charge: charge,
fullscreen: false,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -153,6 +158,7 @@ void main() {
fullscreen: false,
hideEmail: false,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -172,6 +178,7 @@ void main() {
fullscreen: false,
hideEmail: true,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -191,6 +198,7 @@ void main() {
fullscreen: false,
hideEmail: true,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -212,6 +220,7 @@ void main() {
fullscreen: false,
hideAmount: false,
logo: Container(),
uploadInformation: null,
),
);

Expand All @@ -231,6 +240,7 @@ void main() {
fullscreen: false,
hideAmount: true,
logo: Container(),
uploadInformation: null,
),
);

Expand Down