parent
7207527052
commit
8d24888d58
23 changed files with 344 additions and 225 deletions
@ -0,0 +1,18 @@ |
||||
# Generated by Django 2.0.7 on 2019-02-22 02:14 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('payment', '0032_auto_20190207_1233'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AddField( |
||||
model_name='payment', |
||||
name='payment_platform', |
||||
field=models.PositiveSmallIntegerField(choices=[(1, 'PaymentWall'), (2, 'Cloudpayments')], null=True), |
||||
), |
||||
] |
||||
@ -0,0 +1,21 @@ |
||||
# Generated by Django 2.0.7 on 2019-02-22 02:14 |
||||
|
||||
from django.db import migrations |
||||
|
||||
|
||||
def forwards(apps, schema_editor): |
||||
Payment = apps.get_model('payment', 'Payment') |
||||
for payment in Payment.objects.filter(payment_platform__isnull=True): |
||||
payment.payment_platform = 1 # PAYMENT_PLATFORM_PAYMENTWALL |
||||
payment.save() |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('payment', '0033_payment_payment_platform'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.RunPython(forwards), |
||||
] |
||||
@ -0,0 +1,18 @@ |
||||
# Generated by Django 2.0.7 on 2019-02-22 02:33 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('payment', '0034_fill_payment_platform'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AlterField( |
||||
model_name='payment', |
||||
name='payment_platform', |
||||
field=models.PositiveSmallIntegerField(choices=[(1, 'PaymentWall'), (2, 'Cloudpayments')], default=2), |
||||
), |
||||
] |
||||
@ -1,30 +0,0 @@ |
||||
{% extends "templates/lilcity/index.html" %} {% load static %} |
||||
|
||||
{% block head %} |
||||
<script src="https://widget.cloudpayments.ru/bundles/cloudpayments"></script> |
||||
{% endblock head %} |
||||
|
||||
{% block content %} |
||||
<button class="btn" id="pay_btn">Pay</button> |
||||
{% endblock content %} |
||||
|
||||
{% block foot_js %} |
||||
<script> |
||||
document.getElementById('pay_btn').onclick = function() { |
||||
var widget = new cp.CloudPayments(); |
||||
widget.charge({ // options |
||||
publicId: 'pk_9ae020cd5fed74499dee247067d17', //id из личного кабинета |
||||
description: 'Пример оплаты (деньги сниматься не будут)', //назначение |
||||
amount: 1, //сумма |
||||
currency: 'RUB', //валюта |
||||
invoiceId: '{{ invoice_id }}', //номер заказа (необязательно) |
||||
// accountId: 'user@example.com', //идентификатор плательщика (необязательно) |
||||
data: { |
||||
test: true //произвольный набор параметров |
||||
} |
||||
}, |
||||
"{% url 'cloud_payments_callback_test' %}?invoice_id={{ invoice_id }}", |
||||
"{% url 'cloud_payments_callback_test' %}?invoice_id={{ invoice_id }}"); |
||||
} |
||||
</script> |
||||
{% endblock foot_js %} |
||||
@ -0,0 +1,55 @@ |
||||
{% extends "templates/lilcity/index.html" %} {% load static settings %} |
||||
|
||||
{% block head %} |
||||
<script src="https://widget.cloudpayments.ru/bundles/cloudpayments"></script> |
||||
{% endblock head %} |
||||
|
||||
{% block content %} |
||||
<!--<div class="section"> |
||||
<div class="section__center center"> |
||||
<div style="margin-bottom: 25px;"> |
||||
{% if payment.course %} |
||||
Курс <b>{{ payment.course.title }}</b> |
||||
{% endif %} |
||||
{% if payment.gift_certificate %} |
||||
Подарочный сертификат на {{ payment.gift_certificate.price }} руб. |
||||
{% endif %} |
||||
{% if not payment.course and not payment.gift_certificate %} |
||||
Подписка на онлайн школу до {{ payment.date_end_humanize }}, {{ payment.weekdays_str }} |
||||
{% endif %} |
||||
</div> |
||||
<button class="btn" id="pay_btn">Оплатить {{ payment.amount }} руб.</button> |
||||
</div> |
||||
</div> --> |
||||
{% endblock content %} |
||||
|
||||
{% block foot_js %} |
||||
<script> |
||||
function pay() { |
||||
var widget = new cp.CloudPayments(); |
||||
widget.charge({ // options |
||||
publicId: '{% setting "CLOUD_PAYMENTS_PUBLIC_ID" %}', //id из личного кабинета |
||||
{% if payment.course %} |
||||
description: 'Оплата курса {{ payment.course.title }}', |
||||
{% endif %} |
||||
{% if payment.gift_certificate %} |
||||
description: 'Оплата подарочного сертификата на {{ payment.gift_certificate.price }} руб.', |
||||
{% endif %} |
||||
{% if not payment.course and not payment.gift_certificate %} |
||||
description: 'Оплата школы до {{ payment.date_end_humanize }}, {{ payment.weekdays_str }}', |
||||
{% endif %} |
||||
amount: {{ payment.amount|floatformat }}, //сумма |
||||
currency: 'RUB', //валюта |
||||
invoiceId: '{{ payment.id }}', //номер заказа (необязательно) |
||||
requireEmail: false, |
||||
}, |
||||
function(payment_data){ |
||||
var url = "{% url 'payment-success' payment.id %}"; |
||||
}, |
||||
function(reason){ |
||||
showNotification(reason); |
||||
}); |
||||
} |
||||
pay(); |
||||
</script> |
||||
{% endblock foot_js %} |
||||
Loading…
Reference in new issue