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 = [
|
urlpatterns = [
|
||||||
path('page/charge/<uuid>/', PaymentRequestView.as_view(), name='payment-request-view'),
|
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/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/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'),
|
path('api/calculate_commission/', CalculateCommissionView.as_view(), name='calculate-commission-view'),
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class PaymentRequestView(UpdateView):
|
||||||
|
|
||||||
@method_decorator(csrf_exempt, name='dispatch')
|
@method_decorator(csrf_exempt, name='dispatch')
|
||||||
class PaymentConfirmView(UpdateView):
|
class PaymentConfirmView(UpdateView):
|
||||||
template_name = 'pg/payment_failure.html'
|
template_name = 'pg/payment_confirm.html'
|
||||||
# template_name = 'pg/payment_success.html'
|
# template_name = 'pg/payment_success.html'
|
||||||
form_class = PaymentRequestForm
|
form_class = PaymentRequestForm
|
||||||
# pk_url_kwarg = 'uuid'
|
# pk_url_kwarg = 'uuid'
|
||||||
|
|
@ -131,13 +131,19 @@ class PaymentConfirmView(UpdateView):
|
||||||
# return Charge.objects.filter(state__in=[StateChoices.CREATED.value, StateChoices.SUCCESS.value])
|
# return Charge.objects.filter(state__in=[StateChoices.CREATED.value, StateChoices.SUCCESS.value])
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
|
||||||
print('get')
|
print('get')
|
||||||
print(args)
|
print(args)
|
||||||
print(kwargs)
|
print(kwargs)
|
||||||
self.object = self.get_object()
|
self.object = self.get_object()
|
||||||
tool = self.object.get_gateway_tools()
|
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()
|
context = self.get_context_data()
|
||||||
return self.render_to_response(context)
|
return self.render_to_response(context)
|
||||||
|
|
@ -161,30 +167,3 @@ class PaymentConfirmView(UpdateView):
|
||||||
context = self.get_context_data(object=self.object)
|
context = self.get_context_data(object=self.object)
|
||||||
context['message'] = message
|
context['message'] = message
|
||||||
return self.render_to_response(context)
|
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 %}
|
|
||||||
|
|
@ -1,179 +1,179 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
{% load jalali_tags %}
|
{% load jalali_tags %}
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fa" dir="rtl">
|
<html lang="fa" dir="rtl">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Payment Unsuccessful</title>
|
<title>Payment Unsuccessful</title>
|
||||||
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: 'Vazirmatn', sans-serif;
|
font-family: 'Vazirmatn', sans-serif;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.mobile-frame {
|
.mobile-frame {
|
||||||
width: 100vh;
|
width: 100vh;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.screen-content {
|
.screen-content {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.message-section {
|
.message-section {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-icon {
|
.error-icon {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
background-color: #e53935; /* Red for error */
|
background-color: #e53935; /* Red for error */
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-text {
|
.error-text {
|
||||||
color: #e53935;
|
color: #e53935;
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background-color: #eeeeee;
|
background-color: #eeeeee;
|
||||||
border: none;
|
border: none;
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.details-text {
|
.details-text {
|
||||||
color: #757575;
|
color: #757575;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.details-text .code {
|
.details-text .code {
|
||||||
color: #424242;
|
color: #424242;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder-link {
|
.placeholder-link {
|
||||||
color: #bdbdbd;
|
color: #bdbdbd;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.button-container {
|
.button-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 15px;
|
gap: 15px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-family: 'Vazirmatn', sans-serif;
|
font-family: 'Vazirmatn', sans-serif;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-retry {
|
.btn-retry {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border: 2px solid #6931c9;
|
border: 2px solid #6931c9;
|
||||||
color: #6931c9;
|
color: #6931c9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-retry:hover {
|
.btn-retry:hover {
|
||||||
background-color: #f9f7fd;
|
background-color: #f9f7fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
background-color: #6931c9;
|
background-color: #6931c9;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary:hover {
|
.btn-primary:hover {
|
||||||
background-color: #7745ce;
|
background-color: #7745ce;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="mobile-frame">
|
<div class="mobile-frame">
|
||||||
<div class="screen-content">
|
<div class="screen-content">
|
||||||
|
|
||||||
<div class="message-section">
|
<div class="message-section">
|
||||||
<div class="error-icon">!</div>
|
<div class="error-icon">!</div>
|
||||||
{% if message %}
|
{% if message %}
|
||||||
<p class="error-text">{{ message }}</p>
|
<p class="error-text">{{ message }}</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="error-text">پرداخت شما ناموفق بود</p>
|
<p class="error-text">پرداخت شما ناموفق بود</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<hr class="divider">
|
<hr class="divider">
|
||||||
<div class="details-text">
|
<div class="details-text">
|
||||||
<p>کد پیگیری تراکنش شما: <span class="code">{{ object.reference_number }}</span></p>
|
<p>کد پیگیری تراکنش شما: <span class="code">{{ object.reference_number }}</span></p>
|
||||||
<p>در صورت کسر از موجودی، مبلغ پرداختی طی یک تا 72 ساعت آینده به حساب شما بازگردانده خواهد شد.</p>
|
<p>در صورت کسر از موجودی، مبلغ پرداختی طی یک تا 72 ساعت آینده به حساب شما بازگردانده خواهد شد.</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="https://addwin.ir" class="placeholder-link">addwin</a>
|
<a href="https://winsoo.ir" class="placeholder-link">وینسو</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
<form action="{{ request.get_full_path }}" method="post" enctype="multipart/form-data">
|
<form action="{{ request.get_full_path }}" method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
<button class="btn btn-primary" name="redirect-to-app" value="true">بازگشت به صفحه اصلی</button>
|
<button class="btn btn-primary" name="redirect-to-app" value="true">بازگشت به صفحه اصلی</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -155,9 +155,9 @@
|
||||||
<hr class="divider">
|
<hr class="divider">
|
||||||
<div class="amount-row">
|
<div class="amount-row">
|
||||||
<span class="amount-label">مقدار پرداخت شده:</span>
|
<span class="amount-label">مقدار پرداخت شده:</span>
|
||||||
<span class="amount-value">{{ object.amount }} تومان</span>
|
<span class="amount-value">{{ object.amount }} ریال</span>
|
||||||
</div>
|
</div>
|
||||||
<a href="https://addwin.ir" class="placeholder-link">addwin</a>
|
<a href="https://winsoo.ir" class="placeholder-link">وینسو</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
|
|
@ -167,7 +167,6 @@
|
||||||
<button class="btn btn-primary" name="redirect-to-app" value="true">بازگشت به صفحه اصلی</button>
|
<button class="btn btn-primary" name="redirect-to-app" value="true">بازگشت به صفحه اصلی</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue