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

public key invalid error test mode page routing fixes #1

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
14 changes: 7 additions & 7 deletions .flutter-plugins
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This is a generated file; do not edit or check into version control.
connectivity_plus=C:\\Users\\Hp\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\connectivity_plus-2.3.9\\
connectivity_plus_linux=C:\\Users\\Hp\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\connectivity_plus_linux-1.3.1\\
connectivity_plus_macos=C:\\Users\\Hp\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\connectivity_plus_macos-1.2.6\\
connectivity_plus_web=C:\\Users\\Hp\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\connectivity_plus_web-1.2.5\\
connectivity_plus_windows=C:\\Users\\Hp\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\connectivity_plus_windows-1.2.2\\
flutter_inappwebview=C:\\Users\\Hp\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\flutter_inappwebview-5.7.2+3\\
fluttertoast=C:\\Users\\Hp\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\fluttertoast-8.1.2\\
connectivity_plus=C:\\Users\\User\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\connectivity_plus-5.0.2\\
flutter_inappwebview=C:\\Users\\User\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_inappwebview-6.0.0\\
flutter_inappwebview_android=C:\\Users\\User\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_inappwebview_android-1.0.13\\
flutter_inappwebview_ios=C:\\Users\\User\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_inappwebview_ios-1.0.13\\
flutter_inappwebview_macos=C:\\Users\\User\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_inappwebview_macos-1.0.11\\
flutter_inappwebview_web=C:\\Users\\User\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_inappwebview_web-1.0.8\\
fluttertoast=C:\\Users\\User\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\fluttertoast-8.2.4\\
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_plus-2.3.9\\\\","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_inappwebview-5.7.2+3\\\\","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-8.1.2\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_plus-2.3.9\\\\","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_inappwebview-5.7.2+3\\\\","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-8.1.2\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_plus_macos-1.2.6\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_plus_linux-1.3.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_plus_windows-1.2.2\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_plus_web-1.2.5\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\Hp\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-8.1.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"fluttertoast","dependencies":[]}],"date_created":"2023-01-25 18:26:27.856179","version":"3.3.5"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\connectivity_plus-5.0.2\\\\","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_ios","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview_ios-1.0.13\\\\","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.4\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\connectivity_plus-5.0.2\\\\","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_android","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview_android-1.0.13\\\\","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.4\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\connectivity_plus-5.0.2\\\\","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_macos","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview_macos-1.0.11\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\connectivity_plus-5.0.2\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\connectivity_plus-5.0.2\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\connectivity_plus-5.0.2\\\\","dependencies":[]},{"name":"flutter_inappwebview_web","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_inappwebview_web-1.0.8\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\User\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.4\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]},{"name":"flutter_inappwebview","dependencies":["flutter_inappwebview_android","flutter_inappwebview_ios","flutter_inappwebview_macos","flutter_inappwebview_web"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"fluttertoast","dependencies":[]}],"date_created":"2024-03-09 15:03:15.240380","version":"3.16.9"}
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Chapa.paymentParameters(
email: '[email protected]',
firstName: 'fullName',
lastName: 'lastName',
txRef: '34TXTHHgb',
companyName: 'XYZCrop',
title: 'title',
desc:'desc',
namedRouteFallBack: '/second', // fall back route name
Expand All @@ -71,6 +71,20 @@ Chapa.paymentParameters(

#### Should my fallBack route should be named route?

Answer Yes, the fallBackRoute comes with an information such as payment is successfull, user cancelled payment and connectivity issue messages. Those informations will help you to update your backend, to generate new transaction refrence.
Answer Yes, the fallBackRoute comes with an information such as payment is successfully, user cancelled payment and connectivity issue messages. Those informations will help you to update your backend, to generate new transaction refrence.

#### what is invalid key mean?

Answer If you get an invalid key error try to generate new key or use test secrete key while testing.

#### why company name is required?

Answer in the old version ttx will be handled by developer and this version supports automatic generation of ttx reference for company name.

## Demo

screen shots

https://ethiomappsgebeta.com/image_one.jpg
https://ethiomappsgebeta.com/image_two.jpg
https://ethiomappsgebeta.com/image_three.jpg
11 changes: 10 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,22 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {

main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.shopping_cart_app"
Expand Down
6 changes: 3 additions & 3 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/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-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
17 changes: 7 additions & 10 deletions example/lib/screens/cart_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:badges/badges.dart';
import 'package:badges/badges.dart' as badges;
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shopping_cart_app/database/db_helper.dart';
Expand All @@ -21,17 +21,14 @@ class _CartScreenState extends State<CartScreen> {

@override
void initState() {

// get data after payment charm update your database now
Future.delayed(Duration.zero,(){
setState(() {
if(ModalRoute.of(context)?.settings.arguments!= null)
{
args=ModalRoute.of(context)?.settings.arguments;
print('message after payment');
print(args['message']);
print(args['transactionReference']);
print(args['paidAmount']);
print(args['ttx']);

}
});
Expand All @@ -50,8 +47,8 @@ class _CartScreenState extends State<CartScreen> {
centerTitle: true,
title: const Text('My Shopping Cart'),
actions: [
Badge(
badgeContent: Consumer<CartProvider>(
badges.Badge(
badgeContent: Consumer<CartProvider>(
builder: (context, value, child) {
return Text(
value.getCounter().toString(),
Expand All @@ -60,7 +57,7 @@ class _CartScreenState extends State<CartScreen> {
);
},
),
position: const BadgePosition(start: 30, bottom: 30),
position: badges.BadgePosition.topEnd(),
child: IconButton(
onPressed: () {},
icon: const Icon(Icons.shopping_cart),
Expand Down Expand Up @@ -257,13 +254,13 @@ class _CartScreenState extends State<CartScreen> {
///
Chapa.paymentParameters(
context: context, // context
publicKey: 'CHASECK_TEST-',
publicKey: 'CHASECK_TEST-7LNY26k8aIcWkgsoHoPgZhNjiYhnOMQ9',
currency: 'etb',
amount: '300',
email: '[email protected]',
firstName: 'testname',
lastName: 'lastName',
txRef: '55ttyyy',
companyName: 'LeyuCars',
title: 'title',
desc:'desc',
namedRouteFallBack: '/checkoutPage', // fall back route name
Expand Down
7 changes: 3 additions & 4 deletions example/lib/screens/product_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:shopping_cart_app/provider/cart_provider.dart';
import 'package:shopping_cart_app/database/db_helper.dart';
import 'package:shopping_cart_app/model/cart_model.dart';
import 'package:shopping_cart_app/screens/cart_screen.dart';
import 'package:badges/badges.dart' as badges;

class ProductList extends StatefulWidget {
const ProductList({Key? key}) : super(key: key);
Expand Down Expand Up @@ -80,9 +81,7 @@ class _ProductListState extends State<ProductList> {
.then((value) {
cart.addTotalPrice(products[index].price.toDouble());
cart.addCounter();
print('Product Added to cart');
}).onError((error, stackTrace) {
print(error.toString());
});
}

Expand All @@ -91,7 +90,7 @@ class _ProductListState extends State<ProductList> {
centerTitle: true,
title: const Text('Product List'),
actions: [
Badge(
badges.Badge(
badgeContent: Consumer<CartProvider>(
builder: (context, value, child) {
return Text(
Expand All @@ -101,7 +100,7 @@ class _ProductListState extends State<ProductList> {
);
},
),
position: const BadgePosition(start: 30, bottom: 30),
position: badges.BadgePosition.topEnd(),
child: IconButton(
onPressed: () {
Navigator.push(
Expand Down
Loading