mirror of
https://github.com/YunoHost/pepettes.git
synced 2024-09-03 20:06:20 +02:00
[fix] Check POST value
This commit is contained in:
parent
336d162a21
commit
870f26096a
1 changed files with 5 additions and 1 deletions
|
@ -41,8 +41,12 @@ def get_publishable_key():
|
||||||
def create_checkout_session():
|
def create_checkout_session():
|
||||||
data = json.loads(request.data)
|
data = json.loads(request.data)
|
||||||
domain_url = os.getenv('DOMAIN')
|
domain_url = os.getenv('DOMAIN')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if data['frequency'] not in ['RECURING', 'ONE_TIME'] or
|
||||||
|
data['currency'] not in ['EUR', 'USD'] or
|
||||||
|
int(data['quantity']) <= 0:
|
||||||
|
return jsonify(error="Bad value"), 400
|
||||||
|
|
||||||
# Create new Checkout Session for the order
|
# Create new Checkout Session for the order
|
||||||
price = f"{data['frequency']}_{data['currency']}_DONATION"
|
price = f"{data['frequency']}_{data['currency']}_DONATION"
|
||||||
mode = "payment" if data['frequency'] == 'ONE_TIME' else "subscription"
|
mode = "payment" if data['frequency'] == 'ONE_TIME' else "subscription"
|
||||||
|
|
Loading…
Reference in a new issue