Skip to content

Commit

Permalink
adding new gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Nov 29, 2023
1 parent 2a55ed5 commit eead145
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions say/api/payment_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ def _verify_payment(payment_id, order_id):
)

if not payment_id or not order_id:
return 1
# return make_response(unsuccessful_response)
return make_response(unsuccessful_response)

pending_payment = (
session.query(Payment)
Expand All @@ -271,23 +270,20 @@ def _verify_payment(payment_id, order_id):
)

if pending_payment is None:
return 2
# return make_response(unsuccessful_response)
return make_response(unsuccessful_response)

user = session.query(User).with_for_update().get(pending_payment.id_user)
need = session.query(Need).with_for_update().get(pending_payment.id_need)

if need.isDone:
return 3
# return make_response(unsuccessful_response)
return make_response(unsuccessful_response)

try:
response = zibal.verify(
pending_payment.gateway_payment_id,
)
except requests.exceptions.RequestException:
return 4
# return make_response(unsuccessful_response)
return make_response(unsuccessful_response)

if (
not response
Expand All @@ -299,7 +295,7 @@ def _verify_payment(payment_id, order_id):
200,
)
):
return 5
return response
# return make_response(unsuccessful_response)

transaction_date = datetime.fromtimestamp(int(response["date"]))
Expand Down

0 comments on commit eead145

Please sign in to comment.