Skip to content

Commit

Permalink
new payment gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Nov 29, 2023
1 parent ebd8c9b commit e9ee4ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions say/api/payment_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def post(self, data: NewPaymentSchema):
need_id = data.need_id
donation = data.donate
use_credit = data.use_credit
second_gateWay = data.second_gateWay # added for second payment gateway
gateWay = data.gateWay # added for second payment gateway

need = session.query(Need).get(need_id)
if need is None or need.isDeleted:
Expand Down Expand Up @@ -210,7 +210,7 @@ def post(self, data: NewPaymentSchema):
payment.credit_amount -= configs.MIN_BANK_AMOUNT - payment.bank_amount

# idpay gateway
if second_gateWay is None:
if gateWay == 1:
api_data = {
"order_id": payment.order_id,
"amount": payment.bank_amount,
Expand All @@ -230,7 +230,7 @@ def post(self, data: NewPaymentSchema):
payment.link = transaction["link"]

# zibal gateway
if second_gateWay:
if gateWay == 2:
zibal_request = zibal.request(payment.bank_amount, payment.order_id, desc)
if zibal_request["result"] != 100:
raise HTTPException(
Expand Down
2 changes: 1 addition & 1 deletion say/schema/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class NewPaymentSchema(CamelModel):
amount: conint(gt=0)
donate: conint(ge=0) = 0
use_credit: bool = True
second_gateWay: bool = False
gateWay: int = 1


class PaymentSchema(CamelModel):
Expand Down

0 comments on commit e9ee4ad

Please sign in to comment.