Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #2064 from gittip/fix-payday-regressions
Browse files Browse the repository at this point in the history
Fix payday regressions
  • Loading branch information
zbynekwinkler committed Feb 20, 2014
2 parents 8168ad8 + ea9d1dd commit f517096
Show file tree
Hide file tree
Showing 3 changed files with 1,011 additions and 348 deletions.
17 changes: 11 additions & 6 deletions gittip/billing/payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""
from __future__ import unicode_literals

import sys
from decimal import Decimal, ROUND_UP

import balanced
Expand Down Expand Up @@ -625,18 +626,18 @@ def ach_credit(self, ts_start, participant, tips, total):
return # not in Balanced

customer = balanced.Customer.fetch(balanced_customer_href)
if customer.merchant_status == 'underwritten':
log("%s is not a merchant." % participant.username)
return # not a merchant

customer.bank_accounts.one()\
.credit(amount=cents,
description=participant.username)

error = ""
log(msg + "succeeded.")
error = ""
except balanced.exc.HTTPError as err:
error = err.message
error = err.message.message
except:
error = repr(sys.exc_info()[1])

if error:
log(msg + "failed: %s" % error)

self.record_credit(credit_amount, fee, error, participant.username)
Expand All @@ -660,6 +661,10 @@ def charge_on_balanced(self, username, balanced_customer_href, amount):
error = ""
except balanced.exc.HTTPError as err:
error = err.message.message
except:
error = repr(sys.exc_info()[1])

if error:
log(msg + "failed: %s" % error)

return charge_amount, fee, error
Expand Down
Loading

0 comments on commit f517096

Please sign in to comment.