chore: rename model
This commit is contained in:
+8
-8
@@ -10,7 +10,7 @@ from decimal import Decimal
|
||||
from django.utils.text import gettext_lazy as _
|
||||
|
||||
from tpv.exceptions import RedsysValidationException, RedsysPaymentException
|
||||
from tpv.models import PaymentTPV
|
||||
from tpv.models import PaymentTransaction
|
||||
from tpv.settings import ERROR_CODES
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ def compare_signatures(signature_1, signature_2):
|
||||
return sig1safe == sig2safe
|
||||
|
||||
|
||||
def validate_payment_for_order(request, order: PaymentTPV) -> Decimal:
|
||||
def validate_payment_for_transaction(request, transaction: PaymentTransaction) -> Decimal:
|
||||
"""
|
||||
example_response_data = {
|
||||
'Ds_MerchantCode': '999008881',
|
||||
@@ -64,7 +64,7 @@ def validate_payment_for_order(request, order: PaymentTPV) -> Decimal:
|
||||
}
|
||||
|
||||
:param request:
|
||||
:param order:
|
||||
:param transaction:
|
||||
:return:
|
||||
"""
|
||||
data = request.POST
|
||||
@@ -79,8 +79,8 @@ def validate_payment_for_order(request, order: PaymentTPV) -> Decimal:
|
||||
merchant_params = base64.b64decode(merchant_parameters).decode()
|
||||
result = json.loads(merchant_params)
|
||||
|
||||
order_hex = result.get("Ds_Order")
|
||||
assert order_hex == order.hash.hex
|
||||
transaction_hex = result.get("Ds_Order")
|
||||
assert transaction_hex == transaction.hash.hex
|
||||
|
||||
status_code = result.get("Ds_Response")
|
||||
|
||||
@@ -94,6 +94,6 @@ def validate_payment_for_order(request, order: PaymentTPV) -> Decimal:
|
||||
return amount
|
||||
|
||||
|
||||
def pay_order(order: PaymentTPV, amount_paid: Decimal):
|
||||
order.status = PaymentTPV.StatusChoices.PAID
|
||||
order.save()
|
||||
def pay_transaction(transaction: PaymentTransaction, amount_paid: Decimal):
|
||||
transaction.status = PaymentTransaction.StatusChoices.PAID
|
||||
transaction.save()
|
||||
|
||||
Reference in New Issue
Block a user