2018-06-21 18:03:46 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-07-02 19:13:13 +00:00
|
|
|
# Generated by Django 1.10.7 on 2018-07-02 18:56
|
2018-06-21 18:03:46 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import cotisations.payment_methods.comnpay.aes_field
|
2018-07-02 19:13:13 +00:00
|
|
|
import cotisations.payment_methods.models
|
2018-06-21 18:03:46 +00:00
|
|
|
from django.db import migrations, models
|
|
|
|
import django.db.models.deletion
|
|
|
|
|
|
|
|
|
|
|
|
def add_cheque(apps, schema_editor):
|
|
|
|
ChequePayment = apps.get_model('cotisations', 'ChequePayment')
|
|
|
|
Payment = apps.get_model('cotisations', 'Paiement')
|
|
|
|
for p in Payment.objects.filter(type_paiement=1):
|
|
|
|
cheque = ChequePayment()
|
|
|
|
cheque.payment = p
|
|
|
|
cheque.save()
|
|
|
|
|
|
|
|
|
|
|
|
def add_comnpay(apps, schema_editor):
|
|
|
|
ComnpayPayment = apps.get_model('cotisations', 'ComnpayPayment')
|
|
|
|
Payment = apps.get_model('cotisations', 'Paiement')
|
|
|
|
AssoOption = apps.get_model('preferences', 'AssoOption')
|
|
|
|
options, _created = AssoOption.objects.get_or_create()
|
|
|
|
payment, _created = Payment.objects.get_or_create(
|
|
|
|
moyen='Rechargement en ligne'
|
|
|
|
)
|
|
|
|
comnpay = ComnpayPayment()
|
|
|
|
comnpay.payment_user = options.payment_id
|
|
|
|
comnpay.payment_pass = options.payment_pass
|
|
|
|
comnpay.payment = payment
|
|
|
|
comnpay.save()
|
2018-07-02 19:13:13 +00:00
|
|
|
payment.moyen = "ComnPay"
|
|
|
|
payment.save()
|
2018-06-21 18:03:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('cotisations', '0031_article_allow_self_subscription'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='ChequePayment',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
2018-07-02 19:13:13 +00:00
|
|
|
('payment', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='payment_method', to='cotisations.Paiement')),
|
2018-06-21 18:03:46 +00:00
|
|
|
],
|
2018-07-02 19:13:13 +00:00
|
|
|
bases=(cotisations.payment_methods.models.PaymentMethodMixin, models.Model),
|
2018-06-21 18:03:46 +00:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='ComnpayPayment',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
2018-07-02 19:13:13 +00:00
|
|
|
('payment_credential', models.CharField(blank=True, default='', max_length=255)),
|
2018-06-21 18:03:46 +00:00
|
|
|
('payment_pass', cotisations.payment_methods.comnpay.aes_field.AESEncryptedField(blank=True, max_length=255, null=True)),
|
2018-07-02 19:13:13 +00:00
|
|
|
('payment', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='payment_method', to='cotisations.Paiement')),
|
2018-06-21 18:03:46 +00:00
|
|
|
],
|
2018-07-02 19:13:13 +00:00
|
|
|
bases=(cotisations.payment_methods.models.PaymentMethodMixin, models.Model),
|
2018-06-21 18:03:46 +00:00
|
|
|
),
|
|
|
|
migrations.RunPython(add_comnpay),
|
2018-07-02 19:13:13 +00:00
|
|
|
migrations.RunPython(add_cheque),
|
2018-06-21 18:03:46 +00:00
|
|
|
]
|