django-orchestra/orchestra/contrib/payments/migrations/0001_initial.py

67 lines
3.7 KiB
Python
Raw Normal View History

2015-04-29 13:55:22 +00:00
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2021-04-22 11:27
2015-04-29 13:55:22 +00:00
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
2015-04-29 13:55:22 +00:00
import jsonfield.fields
import orchestra.models.fields
2015-04-29 13:55:22 +00:00
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('bills', '0001_initial'),
2015-04-29 13:55:22 +00:00
]
operations = [
migrations.CreateModel(
name='PaymentSource',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('method', models.CharField(choices=[('CreditCard', 'Credit card'), ('SEPADirectDebit', 'SEPA Direct Debit')], max_length=32, verbose_name='method')),
('data', jsonfield.fields.JSONField(default={}, verbose_name='data')),
('is_active', models.BooleanField(default=True, verbose_name='active')),
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='paymentsources', to=settings.AUTH_USER_MODEL, verbose_name='account')),
2015-04-29 13:55:22 +00:00
],
),
migrations.CreateModel(
name='Transaction',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('state', models.CharField(choices=[('WAITTING_PROCESSING', 'Waitting processing'), ('WAITTING_EXECUTION', 'Waitting execution'), ('EXECUTED', 'Executed'), ('SECURED', 'Secured'), ('REJECTED', 'Rejected')], default='WAITTING_PROCESSING', max_length=32, verbose_name='state')),
('amount', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='amount')),
('currency', models.CharField(default='Eur', max_length=10)),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created')),
('modified_at', models.DateTimeField(auto_now=True, verbose_name='modified')),
('bill', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='bills.Bill', verbose_name='bill')),
2015-04-29 13:55:22 +00:00
],
),
migrations.CreateModel(
name='TransactionProcess',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
2015-04-29 14:32:38 +00:00
('data', jsonfield.fields.JSONField(blank=True, verbose_name='data')),
('file', orchestra.models.fields.PrivateFileField(blank=True, upload_to='', verbose_name='file')),
('state', models.CharField(choices=[('CREATED', 'Created'), ('EXECUTED', 'Executed'), ('ABORTED', 'Aborted'), ('COMMITED', 'Commited')], default='CREATED', max_length=16, verbose_name='state')),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='created')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='updated')),
2015-04-29 13:55:22 +00:00
],
options={
'verbose_name_plural': 'Transaction processes',
},
),
migrations.AddField(
model_name='transaction',
name='process',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='transactions', to='payments.TransactionProcess', verbose_name='process'),
2015-04-29 13:55:22 +00:00
),
migrations.AddField(
model_name='transaction',
name='source',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='transactions', to='payments.PaymentSource', verbose_name='source'),
2015-04-29 13:55:22 +00:00
),
]