Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ Transaction objects::

transaction.refund()


E-Checks
^^^^^^^^
Only authorize.net is supported for now.

::
transaction = dinero.Transaction.create(100,
check={
'account_type': 'checking', # 'checking', 'savings', 'businessChecking'
'routing_number': '122242607', # must be a valid routing number, even during testing.
'account_number': '411111111',
'name': 'John Doe',
'check_type': 'WEB', #optional, WEB is the default
'bank_name': 'Bank of Dinero',
})


Customer Objects
~~~~~~~~~~~~~~~~

Expand Down
3 changes: 3 additions & 0 deletions dinero/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class RefundError(PaymentError):
class InvalidTransactionError(PaymentError):
pass

class RoutingNumberError(PaymentError):
pass


##|
##| CUSTOMER
Expand Down
18 changes: 18 additions & 0 deletions dinero/gateways/authorizenet_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def get_first_of(dict, possibilities, default=None):


RESPONSE_CODE_EXCEPTION_MAP = {
'9': [RoutingNumberError],
'8': [ExpiryError],
'6': [InvalidCardError],
'37': [InvalidCardError],
Expand Down Expand Up @@ -262,7 +263,24 @@ def _transaction_xml(self, price, options):
]))
return xml

def _payment_check_xml(self, options):
return OrderedDict([
('bankAccount', OrderedDict([
('accountType', options['account_type']),
('routingNumber', options['routing_number']),
('accountNumber', options['account_number']),
('nameOnAccount', options['name']),
# don't know what this default should be
('echeckType', options.get('check_type', 'WEB')),
('bankName', options.get('bank_name')),
])
),
])

def _payment_xml(self, options):
if 'check' in options:
return self._payment_check_xml(options['check'])

year = str(options.get('year', '0'))
if year != 'XXXX' and int(year) < 100:
century = date.today().year // 100
Expand Down