parent
0f5b11f3d7
commit
34cf929b60
8 changed files with 222 additions and 25 deletions
@ -0,0 +1,8 @@ |
||||
{% extends "notification/email/_base.html" %} |
||||
|
||||
{% block content %} |
||||
<p style="margin: 0 0 20px">К сожалению вам отказано в выводе средств!</p> |
||||
<div style="margin-bottom: 10px;"> |
||||
<p>{{ author_balance.cause }}</p> |
||||
</div> |
||||
{% endblock content %} |
||||
@ -0,0 +1,36 @@ |
||||
# Generated by Django 2.0.2 on 2018-03-04 17:57 |
||||
|
||||
import django.core.validators |
||||
from django.db import migrations, models |
||||
import django.utils.timezone |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('payment', '0012_auto_20180302_0740'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AddField( |
||||
model_name='authorbalance', |
||||
name='card', |
||||
field=models.CharField(blank=True, max_length=20, null=True, validators=[django.core.validators.RegexValidator(regex='^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\\\d{3})\\d{11})$')]), |
||||
), |
||||
migrations.AddField( |
||||
model_name='authorbalance', |
||||
name='created_at', |
||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), |
||||
preserve_default=False, |
||||
), |
||||
migrations.AddField( |
||||
model_name='authorbalance', |
||||
name='declined_send_at', |
||||
field=models.DateTimeField(blank=True, null=True), |
||||
), |
||||
migrations.AddField( |
||||
model_name='authorbalance', |
||||
name='update_at', |
||||
field=models.DateTimeField(auto_now=True), |
||||
), |
||||
] |
||||
@ -0,0 +1,25 @@ |
||||
import re |
||||
|
||||
from django import forms |
||||
from django.utils.translation import ugettext_lazy as _ |
||||
|
||||
CREDIT_CARD_RE = r'^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\d{11})$' |
||||
|
||||
|
||||
class CreditCardField(forms.CharField): |
||||
""" |
||||
Form field that validates credit card numbers. |
||||
""" |
||||
|
||||
default_error_messages = { |
||||
'required': _(u'Номер карты обязателен.'), |
||||
'invalid': _(u'Неверный номер карты.'), |
||||
} |
||||
|
||||
def clean(self, value): |
||||
value = value.replace(' ', '').replace('-', '') |
||||
if self.required and not value: |
||||
raise forms.utils.ValidationError(self.error_messages['required']) |
||||
if value and not re.match(CREDIT_CARD_RE, value): |
||||
raise forms.utils.ValidationError(self.error_messages['invalid']) |
||||
return value |
||||
Loading…
Reference in new issue