Skip to content

Commit

Permalink
Merge pull request #20 from Muhammadali-Akbarov/enhancement/version
Browse files Browse the repository at this point in the history
bugs fixes and improvements
  • Loading branch information
Muhammadali-Akbarov authored Nov 8, 2024
2 parents 5d76fd9 + ff8635b commit 5b39e1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions payme/classes/initializer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import base64

from django.conf import settings

from payme.util import input_type_checker


Expand All @@ -17,8 +19,6 @@ class Initializer:
def __init__(self, payme_id: str = None):
self.payme_id = payme_id

# pylint: disable=W0622
@input_type_checker
def generate_pay_link(
self,
id: int,
Expand Down Expand Up @@ -54,7 +54,7 @@ def generate_pay_link(
"""
amount = amount * 100 # Convert amount to the smallest currency unit
params = (
f'm={self.payme_id};ac.id={id};a={amount};c={return_url}'
f'm={self.payme_id};ac.{settings.PAYME_ACCOUNT_FIELD}={id};a={amount};c={return_url}'
)
params = base64.b64encode(params.encode("utf-8")).decode("utf-8")
return f"https://checkout.paycom.uz/{params}"
Expand Down
5 changes: 5 additions & 0 deletions payme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,15 @@ def fetch_account(self, params: dict):
Fetch account based on settings and params.
"""
account_field = settings.PAYME_ACCOUNT_FIELD

account_value = params['account'].get(account_field)
if not account_value:
raise exceptions.InvalidAccount("Missing account field in parameters.")

# hard change
if account_field == "order_id":
account_field = "id"

account = AccountModel.objects.get(**{account_field: account_value})

return account
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='payme-pkg',
version='3.0.3',
version='3.0.6',
license='MIT',
author="Muhammadali Akbarov",
author_email='[email protected]',
Expand Down

0 comments on commit 5b39e1c

Please sign in to comment.