Skip to content

Commit

Permalink
check with stripe for identity verification
Browse files Browse the repository at this point in the history
  • Loading branch information
jdungan committed Oct 21, 2016
1 parent e10d8dd commit f2e8878
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
7 changes: 5 additions & 2 deletions payments/management/commands/check_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

email_template = get_template('../templates/email/need_validation.html')


class Command(BaseCommand):

def handle(self, *args, **options):
Expand All @@ -23,10 +24,12 @@ def handle(self, *args, **options):
try:
stripe_account = stripe.Account.retrieve(account.account_id)
if account.verification != stripe_account.verification:
account.verification = json.dumps(stripe_account.verification)
account.verification = json.dumps(
stripe_account.verification)
account.save()
if stripe_account.verification.fields_needed:
email_context = ({'expiration':stripe_account.verification.due_by})
email_context = (
{'expiration': stripe_account.verification.due_by})
message = email_template.render(email_context)
send_mail(
'[codesy] Account validation needed',
Expand Down
13 changes: 13 additions & 0 deletions payments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ class StripeAccount(models.Model):
verification = models.TextField(default='', blank=True)

def identity_verified(self):
# codesy verification field holds verification requirement from stripe
# identity is verified if verification is blank or due_by is None

# first, see if an account_id has been assigned by stripe
# and check on verification
if self.account_id:
stripe_account = stripe.Account.retrieve(self.account_id)
self.verification = json.dumps(stripe_account.verification)
self.save()
else:
# returning True will allow the bank account_id to be assigned
return True

if not self.verification:
return True
else:
Expand Down
5 changes: 3 additions & 2 deletions payments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def stripe_debug_values():
'zip': '74103',
'state': 'OK',
'ssn_last_4': '0000',
'ssn_full': '000000000'
'ssn_full': '000000000',
'business_name': 'Howdy Dammit LLC'
},
'card': {
'cc_number': '4111111111111111',
Expand Down Expand Up @@ -127,7 +128,7 @@ def post(self, *args, **kwargs):
class VerifyIdentityView(TemplateView):
template_name = 'verify_identity.html'
identity_fields = ('first_name', 'last_name', 'ssn_last_4',
'personal_id_number', 'type',)
'personal_id_number', 'type', 'business_name')
address_fields = ('line1', 'city', 'postal_code', 'state', )
dob_fields = ('day', 'month', 'year',)

Expand Down

0 comments on commit f2e8878

Please sign in to comment.