Spaces:
Sleeping
Sleeping
Create models/salesforce.py
Browse files- models/salesforce.py +17 -0
models/salesforce.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from simple_salesforce import Salesforce
|
2 |
+
from config import SALESFORCE_USERNAME, SALESFORCE_PASSWORD, SALESFORCE_SECURITY_TOKEN
|
3 |
+
|
4 |
+
# Initialize Salesforce Connection
|
5 |
+
sf = Salesforce(username='[email protected]', password='Sati@1020', security_token='sSSjyhInIsUohKpG8sHzty2q')
|
6 |
+
|
7 |
+
# Example Salesforce Query Functions
|
8 |
+
def fetch_menu_items():
|
9 |
+
query = "SELECT Name, Price__c, Description__c, Image1__c, Veg_NonVeg__c, Section__c FROM Menu_Item__c"
|
10 |
+
return sf.query(query)['records']
|
11 |
+
|
12 |
+
def place_order_in_salesforce(email, order_details, total):
|
13 |
+
sf.Order__c.create({
|
14 |
+
'Customer_Email__c': email,
|
15 |
+
'Order_Items__c': order_details,
|
16 |
+
'Total_Amount__c': total
|
17 |
+
})
|