Skip to content

Commit

Permalink
v0.9.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivamGoyal1899 committed Nov 24, 2019
1 parent cf1d354 commit 1a3df2b
Show file tree
Hide file tree
Showing 12 changed files with 650 additions and 333 deletions.
Binary file added assets/images/payment.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 66 additions & 3 deletions lib/global.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:barcode_scan/barcode_scan.dart';
import 'package:http/http.dart' as http;
import 'package:random_string/random_string.dart';
import 'package:simple_rsa/simple_rsa.dart';
import 'package:url_launcher/url_launcher.dart';

String publicKey =
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvt4Iixd3XigxqLLHvMp4PDKklFGFbuqnO96AoUdcLl8IHdv6o3gUJnCz3fpj7VFXQzBD0rZ4aOJhJrctfi9F6OGmcazpj7BVk3B1YbjEVLJf3fsZ27PlnwBd8y4te3EcLdUDlFOKErXXb6kCzd4h6azAKik9VYrIn/nnpfuVJLBTenuJEcnHJRY8MyWlL7F3epikHOvqCQRtDcmEqbrMJqLVCLXVjYlZTnPyrzemQ+tGcpVaKKwsjb1EDR9JgDP/Xkpy8eZ18vCDHncpUp2k7FoBM1pg6n1PBMCYGYMN5J76dX7bjeRVeFkRR2Ajh2Ajw2/UL1C+guDeALlUO92fywIDAQAB";
Expand Down Expand Up @@ -30,7 +32,7 @@ List<String> users = [

List<String> listDecryptedTransaction = [];

Future sendTransaction() async {
Future sendMoneyTransaction() async {
String myTID = 'NPC' + randomNumeric(32).toString();
print(
'------------------------------ Previous Hash -------------------------------\n' +
Expand Down Expand Up @@ -81,7 +83,58 @@ Future sendTransaction() async {
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n\n');
}

Future getTransaction() async {
Future requestMoneyTransaction() async {
String myTID = 'NPC' + randomNumeric(32).toString();
print(
'------------------------------ Previous Hash -------------------------------\n' +
myHash);
print(
'----------------------------------------------------------------------------\n\n');
print(
'----------------------------- Transaction ID -------------------------------\n' +
myTID);
print(
'----------------------------------------------------------------------------\n\n');
int selectedUserNumber = randomBetween(0, users.length - 1);
String text =
'$myName,$myID,$myMobileNumber,${users[selectedUserNumber]},${users[selectedUserNumber].toLowerCase().replaceAll(' ', '') + '@upi'},${'+91' + randomBetween(7000000000, 9999999999).toString()},${randomBetween(10, 2000)},$myTID,${DateTime.now()},pending';
print(
'--------------------------------- Text -------------------------------------\n' +
text);
print(
'----------------------------------------------------------------------------\n\n');
String encryptedText = await encryptString(text, publicKey);
encryptedText = encryptedText.replaceAll('\n', '');
print(
'----------------------------- Encrypted Text -------------------------------\n' +
encryptedText);
print(
'----------------------------------------------------------------------------\n');
String url = 'https://npci-database.herokuapp.com/contact';
var body = {
'status': myHash == '' ? 'Y' : 'N',
'hash': myHash == '' ? '' : myHash,
'tid': myTID,
'main': encryptedText,
};
var response = await http.post(url, body: body);
myHash = response.body;
print(
'------------------------------ Updated Hash --------------------------------\n' +
myHash);
print(
'----------------------------------------------------------------------------\n');
print(
' _ \n');
print(
' .__(.)< (AeroCoders) \n');
print(
' \\___) \n');
print(
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n\n');
}

Future getAllTransactions() async {
listDecryptedTransaction.clear();
print(
'------------------------------ Recorded Hash -------------------------------\n' +
Expand All @@ -100,12 +153,13 @@ Future getTransaction() async {
'----------------------------------------------------------------------------\n\n');
print(
'------------------------ All Decrypted Transaction -------------------------\n');
for (int i = 0; i < listEncryptedTransaction.length - 1; i++) {
for (int i = listEncryptedTransaction.length - 2; i >= 0; i--) {
String toBeAddedTransaction =
await decryptString(listEncryptedTransaction[i], privateKey);
print(toBeAddedTransaction);
listDecryptedTransaction.add(toBeAddedTransaction);
}
// listDecryptedTransaction = listEncryptedTransaction.reversed.toList();
print(
'----------------------------------------------------------------------------\n');
print(
Expand All @@ -117,3 +171,12 @@ Future getTransaction() async {
print(
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n\n');
}

Future scan() async {
String barcode = await BarcodeScanner.scan();
if (await canLaunch(barcode)) {
await launch(barcode);
} else {
throw 'Could not launch $barcode';
}
}
7 changes: 1 addition & 6 deletions lib/screens/DrawerScreens/appDrawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ class _MyDrawerState extends State<MyDrawer> {
labelName: 'Transaction History',
icon: new Icon(Icons.history),
),
DrawerList(
index: DrawerIndex.Offers,
labelName: 'Offers',
icon: new Icon(Icons.local_offer),
),
DrawerList(
index: DrawerIndex.Rewardz,
labelName: 'Rewardz',
Expand All @@ -156,7 +151,7 @@ class _MyDrawerState extends State<MyDrawer> {
DrawerList(
index: DrawerIndex.Settings,
labelName: 'Settings',
icon: new Icon(Icons.person),
icon: new Icon(Icons.settings),
),
DrawerList(
index: DrawerIndex.About,
Expand Down
63 changes: 50 additions & 13 deletions lib/screens/DrawerScreens/navigationHomeScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,74 @@ class _NavigationHomeScreenState extends State<NavigationHomeScreen> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Leave App"),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(25),
),
),
title: Text(
'Leave BHIM',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 25.0),
),
content: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text("Are you sure you want to leave?\n"),
Text("Are you sure you want to exit?\n"),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
GestureDetector(
child: Text(
"Cancel",
style: TextStyle(
color: Colors.blue, fontWeight: FontWeight.w700),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: Colors.black,
size: 16.0,
),
),
Text(
'Stay',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 18.0),
),
],
),
onTap: () {
Navigator.of(context).pop(false);
},
),
SizedBox(width: 25.0),
SizedBox(height: 20.0),
GestureDetector(
child: Text(
"Leave",
style: TextStyle(
color: Colors.blue, fontWeight: FontWeight.w700),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Leave',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 18.0),
),
IconButton(
icon: Icon(
Icons.arrow_forward_ios,
color: Colors.black,
size: 16.0,
),
),
],
),
onTap: () {
Navigator.of(context).pop(true);
},
)
),
],
),
],
Expand Down
Loading

0 comments on commit 1a3df2b

Please sign in to comment.