cleanup
This commit is contained in:
parent
8f99f97cbb
commit
c6cd842b72
5 changed files with 190 additions and 245 deletions
|
|
@ -6,7 +6,7 @@ app_name = "pg"
|
|||
|
||||
urlpatterns = [
|
||||
path('page/charge/<uuid>/', PaymentRequestView.as_view(), name='payment-request-view'),
|
||||
path('page/pna_callback/<uuid>/', PaymentConfirmView.as_view(), name='payment-confirm-view'),
|
||||
path('page/confirm/<uuid>/', PaymentConfirmView.as_view(), name='payment-confirm-view'),
|
||||
path('api/charge_create/', PaymentRequestCreateApiView.as_view(), name='charge-request-create-api-view'),
|
||||
path('api/application/charge_create/<uuid>', ApplicationPaymentRequestCreateApiView.as_view(), name='application-user-charge-request-create-api-view'),
|
||||
path('api/calculate_commission/', CalculateCommissionView.as_view(), name='calculate-commission-view'),
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class PaymentRequestView(UpdateView):
|
|||
|
||||
@method_decorator(csrf_exempt, name='dispatch')
|
||||
class PaymentConfirmView(UpdateView):
|
||||
template_name = 'pg/payment_failure.html'
|
||||
template_name = 'pg/payment_confirm.html'
|
||||
# template_name = 'pg/payment_success.html'
|
||||
form_class = PaymentRequestForm
|
||||
# pk_url_kwarg = 'uuid'
|
||||
|
|
@ -131,13 +131,19 @@ class PaymentConfirmView(UpdateView):
|
|||
# return Charge.objects.filter(state__in=[StateChoices.CREATED.value, StateChoices.SUCCESS.value])
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
print('get')
|
||||
print(args)
|
||||
print(kwargs)
|
||||
self.object = self.get_object()
|
||||
tool = self.object.get_gateway_tools()
|
||||
tool.confirm_request(request)
|
||||
# state, message = tool.confirm_request(request)
|
||||
# if state:
|
||||
# self.template_name = 'pg/payment_success.html'
|
||||
#
|
||||
#
|
||||
# # TODO:
|
||||
# context = self.get_context_data(object=self.object)
|
||||
# context['message'] = message
|
||||
|
||||
context = self.get_context_data()
|
||||
return self.render_to_response(context)
|
||||
|
|
@ -161,30 +167,3 @@ class PaymentConfirmView(UpdateView):
|
|||
context = self.get_context_data(object=self.object)
|
||||
context['message'] = message
|
||||
return self.render_to_response(context)
|
||||
|
||||
|
||||
# def form_valid(self, form):
|
||||
# self.object = form.save()
|
||||
# charge_request: ChargeRequest = self.get_object()
|
||||
# try:
|
||||
#
|
||||
# # transaction = Transaction.objects.create(
|
||||
# # uuid=charge.uuid,
|
||||
# # payee_id=charge.user.pk,
|
||||
# # payee_type=1,
|
||||
# # payer_id=payer_pk,
|
||||
# # payer_type=2,
|
||||
# # amount=amount,
|
||||
# # details={'description': 'شارژ مجازی کیف پول'}
|
||||
# # )
|
||||
# # transaction.submit()
|
||||
# # transaction.verify()
|
||||
# # charge.change_state(from_state=StateChoices.PENDING.value, to_state=StateChoices.SUCCESS.value)
|
||||
#
|
||||
# except Exception as e:
|
||||
# print(e)
|
||||
# messages.error(self.request, 'خطایی رخ داده است')
|
||||
# charge_request.change_state(from_state=StateChoices.PENDING.value, to_state=StateChoices.EXPECTED_FAILURE.value)
|
||||
#
|
||||
# return HttpResponseRedirect(self.get_success_url())
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% load jalali_tags %}
|
||||
|
||||
{% block title %}بازگشت{% endblock %}
|
||||
{% block page_title %}بازگشت{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
مبلغ {{ object.amount }} ریال با وضعیت {{ object.get_state_display }}<br>
|
||||
<form action="{{ request.get_full_path }}" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="row g-3">
|
||||
<div class="col-md-12 col-lg-12" id="formset">
|
||||
{# <div class="card">#}
|
||||
{# <div class="card-body">#}
|
||||
{{ form|crispy }}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
</div>
|
||||
<h6 class="h6">بازگشت به برنامه</h6>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="submit" name="redirect-to-app" value="true" class="btn mx-auto d-block">
|
||||
<img class="img-thumbnail" width="128" height="128" src="{% static "image/icon.png" %}"/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
<p>کد پیگیری تراکنش شما: <span class="code">{{ object.reference_number }}</span></p>
|
||||
<p>در صورت کسر از موجودی، مبلغ پرداختی طی یک تا 72 ساعت آینده به حساب شما بازگردانده خواهد شد.</p>
|
||||
</div>
|
||||
<a href="https://addwin.ir" class="placeholder-link">addwin</a>
|
||||
<a href="https://winsoo.ir" class="placeholder-link">وینسو</a>
|
||||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
|
|
@ -155,9 +155,9 @@
|
|||
<hr class="divider">
|
||||
<div class="amount-row">
|
||||
<span class="amount-label">مقدار پرداخت شده:</span>
|
||||
<span class="amount-value">{{ object.amount }} تومان</span>
|
||||
<span class="amount-value">{{ object.amount }} ریال</span>
|
||||
</div>
|
||||
<a href="https://addwin.ir" class="placeholder-link">addwin</a>
|
||||
<a href="https://winsoo.ir" class="placeholder-link">وینسو</a>
|
||||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
|
|
@ -167,7 +167,6 @@
|
|||
<button class="btn btn-primary" name="redirect-to-app" value="true">بازگشت به صفحه اصلی</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue