diff --git a/payme/views.py b/payme/views.py index ac9d264..491f6d9 100644 --- a/payme/views.py +++ b/payme/views.py @@ -126,11 +126,18 @@ def validate_amount(self, account, amount): """ Validates if the amount matches for one-time payment accounts. """ - if settings.PAYME_ONE_TIME_PAYMENT: - account_amount = getattr(account, settings.PAYME_AMOUNT_FIELD) - if Decimal(account_amount) != Decimal(amount): - message = f"Invalid amount. Expected: {account_amount}, received: {amount}" - raise exceptions.IncorrectAmount(message) + if not settings.PAYME_ONE_TIME_PAYMENT: + return True + + expected_amount = Decimal(getattr(account, settings.PAYME_AMOUNT_FIELD)) * 100 + received_amount = Decimal(amount) + + if expected_amount != received_amount: + raise exceptions.IncorrectAmount( + f"Invalid amount. Expected: {expected_amount}, received: {received_amount}" + ) + + return True @handle_exceptions def check_perform_transaction(self, params) -> response.CheckPerformTransaction: diff --git a/setup.py b/setup.py index c56de95..24aeb18 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='payme-pkg', - version='3.0.0b8', + version='3.0.0b9', license='MIT', author="Muhammadali Akbarov", author_email='muhammadali17abc@gmail.com',