# Generated by Django 3.0.5 on 2020-04-23 02:53

from decimal import Decimal
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='BankAccount',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('token', models.CharField(db_index=True, help_text='A bank account token provided by Pin', max_length=40, verbose_name='Pin API Bank account token')),
                ('bank_name', models.CharField(help_text='The name of the bank at which this account is held', max_length=100, verbose_name='Bank Name')),
                ('branch', models.CharField(blank=True, help_text='The name of the branch at which this account is held', max_length=100, verbose_name='Branch name')),
                ('name', models.CharField(help_text='The name of the bank account', max_length=100, verbose_name='Recipient Name')),
                ('bsb', models.IntegerField(help_text='The BSB (Bank State Branch) code of the bank account.', verbose_name='BSB')),
                ('number', models.CharField(help_text='The account number of the bank account', max_length=20, verbose_name='BSB')),
                ('environment', models.CharField(blank=True, db_index=True, help_text='The name of the Pin environment to use, eg test or live.', max_length=25)),
            ],
        ),
        migrations.CreateModel(
            name='CustomerToken',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('environment', models.CharField(blank=True, db_index=True, help_text='The name of the Pin environment to use, eg test or live.', max_length=25)),
                ('token', models.CharField(help_text='Generated by Card API or Customers API', max_length=100, verbose_name='Token')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Created')),
                ('active', models.BooleanField(default=True, verbose_name='Active')),
                ('card_type', models.CharField(blank=True, choices=[('master', 'Mastercard'), ('visa', 'Visa')], help_text='Determined automatically by Pin', max_length=20, null=True, verbose_name='Card Type')),
                ('card_number', models.CharField(blank=True, help_text='Cleansed by Pin API', max_length=100, null=True, verbose_name='Card Number')),
                ('card_name', models.CharField(blank=True, max_length=100, null=True, verbose_name='Name on Card')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='PinRecipient',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('token', models.CharField(db_index=True, help_text='A recipient token provided by Pin', max_length=40)),
                ('email', models.EmailField(help_text='As passed to Pin.', max_length=100)),
                ('name', models.CharField(blank=True, help_text='Optional. The name by which the recipient is referenced', max_length=100, null=True)),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Time created')),
                ('environment', models.CharField(blank=True, db_index=True, help_text='The name of the Pin environment to use, eg test or live.', max_length=25)),
                ('bank_account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='pinpayments.BankAccount')),
            ],
        ),
        migrations.CreateModel(
            name='PinTransfer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transfer_token', models.CharField(blank=True, db_index=True, help_text='Unique ID from Pin for this transfer', max_length=100, null=True, verbose_name='Pin API Transfer Token')),
                ('status', models.CharField(blank=True, help_text='Status of transfer at time of saving', max_length=100, null=True)),
                ('currency', models.CharField(help_text='currency of transfer', max_length=10)),
                ('description', models.CharField(blank=True, help_text='Description as shown on statement', max_length=100, null=True)),
                ('amount', models.IntegerField(help_text='Transfer amount, in the base unit of the currency (e.g.: cents for AUD, yen for JPY)')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('pin_response_text', models.TextField(blank=True, help_text='The full JSON response from the Pin API', null=True, verbose_name='Complete API Response')),
                ('recipient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='pinpayments.PinRecipient')),
            ],
        ),
        migrations.CreateModel(
            name='PinTransaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(db_index=True, help_text='Time this transaction was put in the database. May differ from the time that PIN reports the transaction.', verbose_name='Date')),
                ('environment', models.CharField(blank=True, db_index=True, help_text='The name of the Pin environment to use, eg test or live.', max_length=25)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Amount (Dollars)')),
                ('fees', models.DecimalField(blank=True, decimal_places=2, default=Decimal('0.00'), help_text='Fees charged to you by Pin, for this transaction, in dollars', max_digits=10, null=True, verbose_name='Transaction Fees')),
                ('description', models.TextField(blank=True, help_text='As provided when you initiated the transaction', null=True, verbose_name='Description')),
                ('processed', models.BooleanField(default=False, help_text='Has this been sent to Pin yet?', verbose_name='Processed?')),
                ('succeeded', models.BooleanField(default=False, help_text='Was the transaction approved?', verbose_name='Success?')),
                ('currency', models.CharField(default='AUD', help_text='Currency transaction was processed in', max_length=100, verbose_name='Currency')),
                ('transaction_token', models.CharField(blank=True, db_index=True, help_text='Unique ID from Pin for this transaction', max_length=100, null=True, verbose_name='Pin API Transaction Token')),
                ('card_token', models.CharField(blank=True, help_text='Card token used for this transaction (Card API and Web Forms)', max_length=40, null=True, verbose_name='Pin API Card Token')),
                ('pin_response', models.CharField(blank=True, help_text='Response text, usually Success!', max_length=255, null=True, verbose_name='API Response')),
                ('ip_address', models.GenericIPAddressField(help_text='IP Address used for payment')),
                ('email_address', models.EmailField(help_text='As passed to Pin.', max_length=100, verbose_name='E-Mail Address')),
                ('card_address1', models.CharField(blank=True, help_text='Address entered by customer to process this transaction', max_length=100, null=True, verbose_name='Cardholder Street Address')),
                ('card_address2', models.CharField(blank=True, max_length=100, null=True, verbose_name='Cardholder Street Address Line 2')),
                ('card_city', models.CharField(blank=True, max_length=100, null=True, verbose_name='Cardholder City')),
                ('card_state', models.CharField(blank=True, max_length=100, null=True, verbose_name='Cardholder State')),
                ('card_postcode', models.CharField(blank=True, max_length=100, null=True, verbose_name='Cardholder Postal / ZIP Code')),
                ('card_country', models.CharField(blank=True, max_length=100, null=True, verbose_name='Cardholder Country')),
                ('card_number', models.CharField(blank=True, help_text='Cleansed by Pin API', max_length=100, null=True, verbose_name='Card Number')),
                ('card_type', models.CharField(blank=True, choices=[('master', 'Mastercard'), ('visa', 'Visa')], help_text='Determined automatically by Pin', max_length=20, null=True, verbose_name='Card Type')),
                ('pin_response_text', models.TextField(blank=True, help_text='The full JSON response from the Pin API', null=True, verbose_name='Complete API Response')),
                ('customer_token', models.ForeignKey(blank=True, help_text='Provided by Customer API', null=True, on_delete=django.db.models.deletion.SET_NULL, to='pinpayments.CustomerToken')),
            ],
            options={
                'verbose_name': 'PIN.net.au Transaction',
                'verbose_name_plural': 'PIN.net.au Transactions',
                'ordering': ['-date'],
            },
        ),
    ]
