Skip to content

Commit

Permalink
gpay pvt account
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul-Vijay committed Jul 21, 2020
1 parent 1e0aecc commit a33044a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 25 deletions.
4 changes: 4 additions & 0 deletions lib/constants/apiCalls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class APIService {
// shopping cart file - _postOrderToServer function
static final String ordersAPI = "$_api/orders/";

// Firebase
static final String setDeviceTokenInFirestore =
"$_api/firestore/consumersettoken";

// OTHERS
// loading.dart - _sendReqToServer function
static final String mainTokenAPI = "https://api.theonestop.co.in/token";
Expand Down
11 changes: 0 additions & 11 deletions lib/models/cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ class CartModel extends ChangeNotifier {
int get listLength => _cartItems.length;
FirestoreCRUD f = new FirestoreCRUD();

// check for items in firestore
// _checkFireStore() async {
// List<DocumentSnapshot> docs;
// QuerySnapshot q;
// StorageSharedPrefs p = new StorageSharedPrefs();
// String id = await p.getId();
// q = await Firestore.instance.collection('$id').getDocuments();
// docs = q.documents;
// return docs;
// }

_checkFireStore1() async {
// List<DocumentSnapshot> docs;
// QuerySnapshot q;
Expand Down
10 changes: 5 additions & 5 deletions lib/screens/payments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ class _PaymentsState extends State<Payments> {
context: context,
builder: (context) {
return AlertDialog(
title: Text("Disclaimer"),
title: Text("Notification"),
content: Text(
"The following payment made will be transacted to a personal account as the app is still in development phase. This personal account belongs to one of the Directors of Onestop Agrotech Private Limited. The next app update will fix this issue. For any queries please contact +918595179521. We apologize for any inconvenice caused. Your payment is safe and secure!"),
"We currently only support UPI payments. We will add more payment options soon! Your payment is safe and secure!"),
actions: <Widget>[
RaisedButton(
onPressed: () {
Navigator.pop(context);
Navigator.pop(context);
},
child: Text('Deny Payment'),
child: Text('Deny'),
color: Colors.red,
textColor: Colors.white,
),
Expand All @@ -70,7 +70,7 @@ class _PaymentsState extends State<Payments> {
onPressed: () {
Navigator.pop(context);
},
child: Text('I Understand'),
child: Text('Okay'),
color: ThemeColoursSeva().lgGreen,
textColor: Colors.white)
],
Expand All @@ -81,7 +81,7 @@ class _PaymentsState extends State<Payments> {
initiateTransaction(String app, cart) async {
var response = await _upiIndia.startTransaction(
app: app,
receiverUpiId: 'vk.rahul318@okaxis',
receiverUpiId: '9663395018@okbizaxis',
receiverName: 'Seva By Onestop',
transactionRefId: 'SevaOrderRefID-000',
transactionNote: 'For Seva Order - Rs ${widget.price}',
Expand Down
26 changes: 18 additions & 8 deletions lib/screens/storesList.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:convert';

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -35,21 +34,32 @@ class _StoresScreenState extends State<StoresScreen> {
_saveDeviceToken();
}

/// Get the token, save it to the database for current user
/// Get the token, save it to firestore for current user
_saveDeviceToken() async {
StorageSharedPrefs p = new StorageSharedPrefs();
// Get the current user
String jwt = await p.getToken();
String uid = await p.getId();

// Get the token for this device
String fcmToken = await _fcm.getToken();
if (fcmToken != null) {
Firestore.instance
.collection('Consumer tokens')
.document('$uid')
.setData({
'token': fcmToken,
});
// Send a post request here to the server to set token
var getJson = json.encode(
{"token": fcmToken, "collection": "Consumer tokens", "userId": uid});
String url = APIService.setDeviceTokenInFirestore;
Map<String, String> headers = {
"Content-Type": "application/json",
"x-auth-token": "$jwt"
};
var response = await http.post(url, body: getJson, headers: headers);
if (response.statusCode == 200) {
// saved device to token
print("saved token");
} else {
// some error
print("some error");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+2
version: 1.0.0+3

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit a33044a

Please sign in to comment.