Spaces:
Sleeping
Sleeping
Update paypal_integration.py
Browse files- paypal_integration.py +11 -12
paypal_integration.py
CHANGED
@@ -192,7 +192,7 @@ def create_plan(product_id, name, price, interval="MONTH", interval_count=1):
|
|
192 |
"pricing_scheme": {
|
193 |
"fixed_price": {
|
194 |
"value": str(price),
|
195 |
-
"currency_code": "
|
196 |
}
|
197 |
}
|
198 |
}
|
@@ -201,7 +201,7 @@ def create_plan(product_id, name, price, interval="MONTH", interval_count=1):
|
|
201 |
"auto_bill_outstanding": True,
|
202 |
"setup_fee": {
|
203 |
"value": "0",
|
204 |
-
"currency_code": "
|
205 |
},
|
206 |
"setup_fee_failure_action": "CONTINUE",
|
207 |
"payment_failure_threshold": 3
|
@@ -271,8 +271,8 @@ def initialize_subscription_plans():
|
|
271 |
"total_cycles": 0,
|
272 |
"pricing_scheme": {
|
273 |
"fixed_price": {
|
274 |
-
"value": "
|
275 |
-
"currency_code": "
|
276 |
}
|
277 |
}
|
278 |
}
|
@@ -281,7 +281,7 @@ def initialize_subscription_plans():
|
|
281 |
"auto_bill_outstanding": True,
|
282 |
"setup_fee": {
|
283 |
"value": "0",
|
284 |
-
"currency_code": "
|
285 |
},
|
286 |
"setup_fee_failure_action": "CONTINUE",
|
287 |
"payment_failure_threshold": 3
|
@@ -302,8 +302,8 @@ def initialize_subscription_plans():
|
|
302 |
"total_cycles": 0,
|
303 |
"pricing_scheme": {
|
304 |
"fixed_price": {
|
305 |
-
"value": "
|
306 |
-
"currency_code": "
|
307 |
}
|
308 |
}
|
309 |
}
|
@@ -312,7 +312,7 @@ def initialize_subscription_plans():
|
|
312 |
"auto_bill_outstanding": True,
|
313 |
"setup_fee": {
|
314 |
"value": "0",
|
315 |
-
"currency_code": "
|
316 |
},
|
317 |
"setup_fee_failure_action": "CONTINUE",
|
318 |
"payment_failure_threshold": 3
|
@@ -534,10 +534,9 @@ def update_user_subscription(user_email, subscription_id, tier):
|
|
534 |
|
535 |
# Add this near the top with other path definitions
|
536 |
# Update the PLAN_IDS_PATH definition to use the correct path
|
537 |
-
PLAN_IDS_PATH = os.path.abspath(
|
538 |
-
|
539 |
-
# Make sure the data directory exists
|
540 |
os.makedirs(os.path.dirname(PLAN_IDS_PATH), exist_ok=True)
|
|
|
541 |
|
542 |
# Add this debug log to see where the file is expected
|
543 |
logger.info(f"PayPal plans will be stored at: {PLAN_IDS_PATH}")
|
@@ -545,7 +544,7 @@ logger.info(f"PayPal plans will be stored at: {PLAN_IDS_PATH}")
|
|
545 |
# Add this function if it's not defined elsewhere
|
546 |
def get_db_connection():
|
547 |
"""Get a connection to the SQLite database"""
|
548 |
-
DB_PATH = os.
|
549 |
# Make sure the data directory exists
|
550 |
os.makedirs(os.path.dirname(DB_PATH), exist_ok=True)
|
551 |
return sqlite3.connect(DB_PATH)
|
|
|
192 |
"pricing_scheme": {
|
193 |
"fixed_price": {
|
194 |
"value": str(price),
|
195 |
+
"currency_code": "INR"
|
196 |
}
|
197 |
}
|
198 |
}
|
|
|
201 |
"auto_bill_outstanding": True,
|
202 |
"setup_fee": {
|
203 |
"value": "0",
|
204 |
+
"currency_code": "INR"
|
205 |
},
|
206 |
"setup_fee_failure_action": "CONTINUE",
|
207 |
"payment_failure_threshold": 3
|
|
|
271 |
"total_cycles": 0,
|
272 |
"pricing_scheme": {
|
273 |
"fixed_price": {
|
274 |
+
"value": "799",
|
275 |
+
"currency_code": "INR"
|
276 |
}
|
277 |
}
|
278 |
}
|
|
|
281 |
"auto_bill_outstanding": True,
|
282 |
"setup_fee": {
|
283 |
"value": "0",
|
284 |
+
"currency_code": "INR"
|
285 |
},
|
286 |
"setup_fee_failure_action": "CONTINUE",
|
287 |
"payment_failure_threshold": 3
|
|
|
302 |
"total_cycles": 0,
|
303 |
"pricing_scheme": {
|
304 |
"fixed_price": {
|
305 |
+
"value": "1499",
|
306 |
+
"currency_code": "INR"
|
307 |
}
|
308 |
}
|
309 |
}
|
|
|
312 |
"auto_bill_outstanding": True,
|
313 |
"setup_fee": {
|
314 |
"value": "0",
|
315 |
+
"currency_code": "INR"
|
316 |
},
|
317 |
"setup_fee_failure_action": "CONTINUE",
|
318 |
"payment_failure_threshold": 3
|
|
|
534 |
|
535 |
# Add this near the top with other path definitions
|
536 |
# Update the PLAN_IDS_PATH definition to use the correct path
|
537 |
+
PLAN_IDS_PATH = os.path.abspath("/tmp/data/plan_ids.json")
|
|
|
|
|
538 |
os.makedirs(os.path.dirname(PLAN_IDS_PATH), exist_ok=True)
|
539 |
+
# Make sure the data directory exists
|
540 |
|
541 |
# Add this debug log to see where the file is expected
|
542 |
logger.info(f"PayPal plans will be stored at: {PLAN_IDS_PATH}")
|
|
|
544 |
# Add this function if it's not defined elsewhere
|
545 |
def get_db_connection():
|
546 |
"""Get a connection to the SQLite database"""
|
547 |
+
DB_PATH = os.path.abspath("/tmp/user_data.db")
|
548 |
# Make sure the data directory exists
|
549 |
os.makedirs(os.path.dirname(DB_PATH), exist_ok=True)
|
550 |
return sqlite3.connect(DB_PATH)
|