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

65 lines
3.6 KiB
Python
Raw Permalink Normal View History

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