Yaswanth56 commited on
Commit
a420331
·
verified ·
1 Parent(s): 64ae87f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -16,6 +16,7 @@ SF_DOMAIN = os.getenv('SF_DOMAIN')
16
 
17
  # Salesforce connection
18
  try:
 
19
  sf = Salesforce(username=SF_USERNAME,
20
  password=SF_PASSWORD,
21
  security_token=SF_SECURITY_TOKEN,
@@ -28,11 +29,13 @@ except Exception as e:
28
  # Route for login page
29
  @app.route('/')
30
  def login():
 
31
  return render_template('login.html')
32
 
33
  # Route to process login
34
  @app.route('/auth', methods=['POST'])
35
  def auth():
 
36
  email = request.form['email']
37
  password = request.form['password']
38
 
@@ -58,6 +61,7 @@ def auth():
58
  # Route to display rewards page
59
  @app.route('/rewards/<customer_id>')
60
  def rewards(customer_id):
 
61
  try:
62
  customer = sf.Customer_Login__c.get(customer_id)
63
  points = customer['Reward_Points__c']
@@ -70,6 +74,7 @@ def rewards(customer_id):
70
  # Route to apply rewards
71
  @app.route('/apply_rewards', methods=['POST'])
72
  def apply_rewards():
 
73
  customer_id = request.form['customer_id']
74
  bill_amount = float(request.form['bill_amount'])
75
  apply_rewards = request.form.get('apply_rewards')
@@ -100,7 +105,7 @@ def apply_rewards():
100
 
101
  message = f"You earned 10% of your bill amount ({earned_points} points) as reward points!"
102
 
103
- # Render the summary page
104
  return render_template(
105
  'apply_rewards.html',
106
  original_bill=bill_amount,
@@ -114,4 +119,4 @@ def apply_rewards():
114
  return f"Error applying rewards: {e}"
115
 
116
  if __name__ == '__main__':
117
- app.run(debug=True)
 
16
 
17
  # Salesforce connection
18
  try:
19
+ print("Attempting Salesforce connection...")
20
  sf = Salesforce(username=SF_USERNAME,
21
  password=SF_PASSWORD,
22
  security_token=SF_SECURITY_TOKEN,
 
29
  # Route for login page
30
  @app.route('/')
31
  def login():
32
+ print("Login route accessed") # Debug statement
33
  return render_template('login.html')
34
 
35
  # Route to process login
36
  @app.route('/auth', methods=['POST'])
37
  def auth():
38
+ print("Auth route accessed") # Debug statement
39
  email = request.form['email']
40
  password = request.form['password']
41
 
 
61
  # Route to display rewards page
62
  @app.route('/rewards/<customer_id>')
63
  def rewards(customer_id):
64
+ print(f"Rewards route accessed for customer {customer_id}") # Debug statement
65
  try:
66
  customer = sf.Customer_Login__c.get(customer_id)
67
  points = customer['Reward_Points__c']
 
74
  # Route to apply rewards
75
  @app.route('/apply_rewards', methods=['POST'])
76
  def apply_rewards():
77
+ print("Apply rewards route accessed") # Debug statement
78
  customer_id = request.form['customer_id']
79
  bill_amount = float(request.form['bill_amount'])
80
  apply_rewards = request.form.get('apply_rewards')
 
105
 
106
  message = f"You earned 10% of your bill amount ({earned_points} points) as reward points!"
107
 
108
+ # Render the summary page with Dollar symbol
109
  return render_template(
110
  'apply_rewards.html',
111
  original_bill=bill_amount,
 
119
  return f"Error applying rewards: {e}"
120
 
121
  if __name__ == '__main__':
122
+ app.run(debug=True, host="0.0.0.0", port=7860)