diff --git a/.gitignore b/.gitignore index 47a72b1..207a68b 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ dist/ .idea/ _build/ coverage.xml +scenario.cache \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 83e5baa..07c01bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,17 @@ language: python python: - - 2.6 - - 2.7 +- 2.6 +- 2.7 install: - - python setup.py develop - - pip install -r requirements.txt - - pip install -r test-requirements.txt -script: - - python setup.py test +- python setup.py develop +- pip install -r requirements.txt +- pip install -r test-requirements.txt +script: +- python setup.py test +deploy: + provider: pypi + user: balanced-butler + password: + secure: jH1XW+hl+KInnde014cvX8mH5ZRiqXsxMRflR2DEs/na5mK/1LFzFt2iwgN9XwkkmXJYLPr6LA3pSLqHTMKXs8RrHaM1uXmEckXL48jcy0YkQ0+2Cl0EKcbmS8OnqIcjY3g5xFBbsFPjuRx6uJYFksJ3QatTuxkDcY/hQOc6IZg= + on: + tags: true diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ed98d26 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,31 @@ +## 1.2 + +* Account and Settlement support + +## 1.1.1 + +* Fix allowing for voiding holds + +## 1.1.0 + +* Push to card support + +## 1.0.2 + +* Return None when there is actually none instead of a page object (#115) +* Fix polymorphic types coming back as resource (#114) +* Fix for query pagination (#109) +* Fix iterator (#21) + + +## 1.0.1 + +* Fix for returned generic Resource instead of expected resource class + + +## 1.0 + +* Requires Balanced API 1.1 +* Hypermedia API support +* Debits and credits are now performed directly on funding instruments and not via Customer +* Support for new Order resource \ No newline at end of file diff --git a/LICENSE b/LICENSE index 5f56fb5..9c6060a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014 Mahmoud Abdelkader +Copyright (c) 2014 Balanced MIT License diff --git a/README.md b/README.md index b32b361..e710576 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ Online Marketplace Payments -[![Build Status](https://secure.travis-ci.org/balanced/balanced-python.png?branch=master)](http://travis-ci.org/balanced/balanced-python) +[![Build Status](https://secure.travis-ci.org/balanced/balanced-python.png?branch=master)](http://travis-ci.org/balanced/balanced-python) [![Latest Version](https://pypip.in/version/balanced/badge.svg)](https://pypi.python.org/pypi/balanced/) [![Downloads](https://pypip.in/download/balanced/badge.svg)](https://pypi.python.org/pypi/balanced/) [![Supported Python versions](https://pypip.in/py_versions/balanced/badge.svg)](https://pypi.python.org/pypi/balanced/) [![License](https://pypip.in/license/balanced/badge.svg)](https://pypi.python.org/pypi/balanced/) + +**v1.x requires Balanced API 1.1. Use [v0.x](https://github.com/balanced/balanced-python/tree/rev0) for Balanced API 1.0.** ## Installation diff --git a/balanced/__init__.py b/balanced/__init__.py index 1f69ea1..ccc88e3 100644 --- a/balanced/__init__.py +++ b/balanced/__init__.py @@ -1,20 +1,22 @@ from __future__ import unicode_literals -__version__ = '1.0beta1' +__version__ = '1.2' from balanced.config import configure from balanced import resources from balanced.resources import ( Resource, Marketplace, APIKey, CardHold, Credit, Debit, Refund, Reversal, - Transaction, BankAccount, Card, + Transaction, BankAccount, Card, Dispute, Callback, Event, EventCallback, EventCallbackLog, - BankAccountVerification, Customer, Order + BankAccountVerification, Customer, Order, + ExternalAccount, Account, Settlement ) from balanced import exc __all__ = [ + Account.__name__, APIKey.__name__, BankAccount.__name__, BankAccountVerification.__name__, @@ -24,6 +26,7 @@ Credit.__name__, Customer.__name__, Debit.__name__, + Dispute.__name__, Event.__name__, EventCallback.__name__, EventCallbackLog.__name__, @@ -32,6 +35,8 @@ Resource.__name__, Refund.__name__, Reversal.__name__, + Settlement.__name__, Transaction.__name__, + ExternalAccount.__name__, str(exc.__name__.partition('.')[-1]) ] diff --git a/balanced/config.py b/balanced/config.py index 418bab7..c746501 100644 --- a/balanced/config.py +++ b/balanced/config.py @@ -18,13 +18,14 @@ def configure( root_url=API_ROOT, api_revision='1.1', user_agent='balanced-python/' + __version__, + accept_type='application/vnd.api+json', **kwargs ): kwargs.setdefault('headers', {}) for key, value in ( - ('content-type', 'application/vnd.api+json;revision=' + api_revision), - ('accept', 'application/json;revision=' + api_revision) + ('content-type', 'application/json;revision=' + api_revision), + ('accept', '{0};revision={1}'.format(accept_type, api_revision)) ): kwargs['headers'].setdefault(key, value) diff --git a/balanced/exc.py b/balanced/exc.py index 2594bed..9ec3811 100644 --- a/balanced/exc.py +++ b/balanced/exc.py @@ -6,7 +6,13 @@ class BalancedError(Exception): - pass + + def __str__(self): + attrs = ', '.join([ + '{0}={1}'.format(k, repr(v)) + for k, v in self.__dict__.iteritems() + ]) + return '{0}({1})'.format(self.__class__.__name__, attrs) class ResourceError(BalancedError): @@ -21,6 +27,10 @@ class MultipleResultsFound(BalancedError): pass +class FundingSourceNotCreditable(Exception): + pass + + def convert_error(ex): if not hasattr(ex.response, 'data'): return ex diff --git a/balanced/resources.py b/balanced/resources.py index d8022d8..a4671bf 100644 --- a/balanced/resources.py +++ b/balanced/resources.py @@ -109,6 +109,14 @@ def extract_variables_from_item(item, variables): if not item_property.endswith('_href'): item_property += '_href' lazy_href = parsed_link + + elif '{' in parsed_link and '}' in parsed_link: + # the link is of the form /asdf/{asdf} which means + # that the variables could not be resolved as it + # was None. Instead of making it into a page object + # we explicitly set it to None to represent the + # attribute is None + lazy_href = None else: # collection lazy_href = JSONSchemaCollection( @@ -122,10 +130,20 @@ class JSONSchemaPage(wac.Page, ObjectifyMixin): @property def items(self): try: - return getattr(self, self.resource_cls.type) + try: + return getattr(self, self.resource_cls.type) + except AttributeError: + # horrid hack because event callbacks are misnamed. + return self.event_callbacks except AttributeError: - # horrid hack because event callbacks are misnamed. - return self.event_callbacks + # Notice: + # there is no resources key in the response from server + # if the list is empty, so when we try to get something like + # `debits`, an AttributeError will be raised. Not sure is this + # behavior a bug of server, but anyway, this is just a workaround + # here for solving the problem. The issue was posted here + # https://github.com/balanced/balanced-python/issues/93 + return [] class JSONSchemaResource(wac.Resource, ObjectifyMixin): @@ -176,7 +194,8 @@ def __getattr__(self, item): if suffix not in item: href = getattr(self, item + suffix, None) if href: - setattr(self, item, Resource.get(href)) + item_type = Resource.registry.get(item + 's', Resource) + setattr(self, item, item_type.get(href)) return getattr(self, item) raise AttributeError( "'{0}' has no attribute '{1}'".format( @@ -200,6 +219,21 @@ def unstore(self): def fetch(cls, href): return cls.get(href) + @classmethod + def get(cls, href): + if href.startswith('/resources'): + # hackety hack hax + # resource is an abstract type, we shouldn't have it comeing back itself + # instead we need to figure out the type based off the api response + resp = cls.client.get(href) + resource = [ + k for k in resp.data.keys() if k != 'links' and k != 'meta' + ] + if resource: + return Resource.registry.get(resource[0], cls)(**resp.data) + return cls(**resp.data) + return super(Resource, cls).get(href) + class Marketplace(Resource): """ @@ -251,7 +285,7 @@ class CardHold(Resource): uri_gen = wac.URIGen('/card_holds', '{card_hold}') def cancel(self): - self.is_void = False + self.is_void = True return self.save() def capture(self, **kwargs): @@ -392,7 +426,10 @@ def credit(self, amount, **kwargs): this FundingInstrument. :rtype: Credit - """ + """ + + if not hasattr(self, 'credits'): + raise exc.FundingSourceNotCreditable() return Credit( href=self.credits.href, amount=amount, @@ -468,6 +505,10 @@ class Customer(Resource): def create_order(self, **kwargs): return Order(href=self.orders.href, **kwargs).save() + @property + def payable_account(self): + return self.accounts.filter(type="payable").first() + class Order(Resource): """ @@ -492,6 +533,7 @@ def debit_from(self, source, amount, **kwargs): amount=amount, **kwargs) + class Callback(Resource): """ A Callback is a publicly accessible location that can receive POSTed JSON @@ -503,6 +545,16 @@ class Callback(Resource): uri_gen = wac.URIGen('/callbacks', '{callback}') +class Dispute(Resource): + """ + A dispute occurs when a customer disputes a transaction that + occurred on their funding instrument. + """ + type = 'disputes' + + uri_gen = wac.URIGen('/disputes', '{dispute}') + + class Event(Resource): """ An Event is a snapshot of another resource at a point in time when @@ -531,3 +583,43 @@ class EventCallbackLog(Resource): """ type = 'event_callback_logs' + + +class ExternalAccount(FundingInstrument): + """ + An External Account represents a source of funds provided by an external, 3rd + party processor. You may Debit funds from the account if can_debit is true. + """ + + type = 'external_accounts' + + uri_gen = wac.URIGen('/external_accounts', '{external_account}') + + +class Account(FundingInstrument): + """ + An Account is a way to transfer funds from multiple Orders into one place, + which can later be bulk credited out. + """ + + type = 'accounts' + + uri_gen = wac.URIGen('/accounts', '{account}') + + def settle(self, funding_instrument, **kwargs): + return Settlement( + href=self.settlements.href, + funding_instrument=funding_instrument, + **kwargs + ).save() + + +class Settlement(Transaction): + """ + A Settlement is the action of moving money out of an Account to a + bank account. + """ + + type = 'settlements' + + uri_gen = wac.URIGen('/settlements', '{settlements}') diff --git a/examples/bank_account_debits.py b/examples/bank_account_debits.py index 8cc9c76..280fea0 100644 --- a/examples/bank_account_debits.py +++ b/examples/bank_account_debits.py @@ -35,10 +35,15 @@ def main(): print 'PROTIP: for TEST bank accounts the valid amount is always 1 and 1' try: - verification.confirm(amount_1=1, amount_2=1) + verification.confirm(amount_1=1, amount_2=2) except balanced.exc.BankAccountVerificationFailure as ex: print 'Authentication error , %s' % ex.message + # reload + verification = balanced.BankAccount.fetch( + bank_account.href + ).bank_account_verification + if verification.confirm(1, 1).verification_status != 'succeeded': raise Exception('unpossible') debit = bank_account.debit(100) diff --git a/examples/error_handling.py b/examples/error_handling.py new file mode 100644 index 0000000..9283d89 --- /dev/null +++ b/examples/error_handling.py @@ -0,0 +1,44 @@ +from __future__ import unicode_literals + +import balanced + + +api_key = balanced.APIKey().save() +balanced.configure(api_key.secret) +marketplace = balanced.Marketplace().save() + +# https://docs.balancedpayments.com/1.1/overview/resources/#test-credit-card-numbers + +declined_card = balanced.Card( + number='4444444444444448', + expiration_month='12', + expiration_year='2015', +).save() + +bank_account = balanced.BankAccount( + account_number='1234567890', + routing_number='321174851', + name='Jack Q Merchant', +).save() + +# see https://github.com/balanced/balanced-api/blob/master/fixtures/_models/error.json for all possible error codes +try: + declined_card.debit(amount=100) +except balanced.exc.BalancedError as ex: + assert ex.category_code == 'card-declined' + +try: + bank_account.credit(amount=1000) +except balanced.exc.HTTPError as ex: + assert ex.category_code == 'insufficient-funds' + +try: + balanced.Card().save() +except balanced.exc.BalancedError as ex: + # generic missing data has a category-code of request + assert ex.category_code == 'request' + # inspect extras to see the exact field that caused the error + print ex.extras + # if you want to talk to a Balanced support person about an error, give + # them the request ID + print ex.request_id diff --git a/examples/events_and_callbacks.py b/examples/events_and_callbacks.py index ee207e7..8597185 100644 --- a/examples/events_and_callbacks.py +++ b/examples/events_and_callbacks.py @@ -26,6 +26,9 @@ def main(): url=request_bin.callback_url, ).save() + print "let's create a customer" + balanced.Customer(name='Bob McTavish').save() + print 'let\'s create a card and associate it with a new account' card = balanced.Card( expiration_month='12', diff --git a/examples/orders.py b/examples/orders.py index 89bc27c..95f8d34 100644 --- a/examples/orders.py +++ b/examples/orders.py @@ -59,3 +59,11 @@ print ex assert ex is not None + +# bring the money back again +reversal = credit.reverse() + +order = balanced.Order.fetch(order.href) + +# order escrow is topped up again +assert order.amount_escrowed == 100 diff --git a/render_scenarios.py b/render_scenarios.py index 261c406..df68c9b 100644 --- a/render_scenarios.py +++ b/render_scenarios.py @@ -3,10 +3,21 @@ import json import balanced import pprint +import requests +import sys + from pprint import PrettyPrinter from mako.template import Template from mako.lookup import TemplateLookup +class colors: + GREEN = '\033[92m' + YELLOW = '\033[93m' + RED = '\033[91m' + RESET = '\033[0m' + +SCENARIO_CACHE_URL = 'https://raw.githubusercontent.com/balanced/balanced-docs/master/scenario.cache' + def construct_response(scenario_name): # load up response data data = json.load(open('scenario.cache','r')) @@ -50,8 +61,8 @@ def render_executables(): request=request, payload=payload).strip() except KeyError: text = '' - print "WARN: Skipped {} since {} not in scenario.cache".format( - path, event_name) + print colors.YELLOW + "WARN: Skipped {} since {} not in scenario.cache".format( + path, event_name) + colors.RESET with open(os.path.join(os.path.dirname(path), 'executable.py'), 'w+') as write_to: write_to.write(text) @@ -68,23 +79,24 @@ def render_mako(): "% elif mode == 'response':\n" + response + "\n% endif" wfile.write(body) -def issue_no_mako_warnings(): - - set_has_mako = set([]) - set_no_python_mako = set([]) - for path in glob2.glob('./scenarios/**/*.mako'): - set_has_mako.add(os.path.dirname(path)) - for path in glob2.glob('./scenarios/**/python.mako'): - set_no_python_mako.add(os.path.dirname(path)) - print 'The following dont have a python.mako file. Look into it!' - print set_has_mako.difference(set_no_python_mako) - +def fetch_scenario_cache(): + try: + os.remove('scenario.cache') + except OSError: + pass + with open('scenario.cache', 'wb') as fo: + response = requests.get(SCENARIO_CACHE_URL) + if not response.ok: + sys.exit() + for block in response.iter_content(): + fo.write(block) if __name__ == "__main__": - print "Making Executables" + print colors.GREEN + "Obtaining scenario cache..." + colors.RESET + fetch_scenario_cache() + print colors.GREEN + "Making Executables..." + colors.RESET render_executables() - print "Rendering new mako files" + print colors.GREEN + "Rendering new mako files..." + colors.RESET render_mako() - issue_no_mako_warnings() diff --git a/requirements.txt b/requirements.txt index 556ea63..77e1d61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -wac==0.22 +wac==0.23 iso8601==0.1.4 uritemplate==0.6 diff --git a/scenario.cache b/scenario.cache deleted file mode 100644 index dc57ab2..0000000 --- a/scenario.cache +++ /dev/null @@ -1,618 +0,0 @@ -{ - "accept_type": "application/vnd.api+json;revision=1.1", - "api_key": "ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc", - "api_key_create": { - "request": { - "uri": "/api_keys" - }, - "response": "{\n \"api_keys\": [\n {\n \"created_at\": \"2014-01-27T22:56:01.641736Z\", \n \"href\": \"/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c\", \n \"id\": \"AK1vqjn1eEHXP0JYXrBrjH5c\", \n \"links\": {}, \n \"meta\": {}, \n \"secret\": \"ak-test-1jlJCdGZjRWWYRF1iLBR69xwqG2NdQifv\"\n }\n ], \n \"links\": {}\n}" - }, - "api_key_delete": { - "request": { - "uri": "/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c" - } - }, - "api_key_list": { - "request": { - "uri": "/api_keys" - }, - "response": "{\n \"api_keys\": [\n {\n \"created_at\": \"2014-01-27T22:56:01.641736Z\", \n \"href\": \"/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c\", \n \"id\": \"AK1vqjn1eEHXP0JYXrBrjH5c\", \n \"links\": {}, \n \"meta\": {}\n }, \n {\n \"created_at\": \"2014-01-27T22:55:46.698536Z\", \n \"href\": \"/api_keys/AK1eDKn7B8vK70hj70S1NMbu\", \n \"id\": \"AK1eDKn7B8vK70hj70S1NMbu\", \n \"links\": {}, \n \"meta\": {}, \n \"secret\": \"ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc\"\n }\n ], \n \"links\": {}, \n \"meta\": {\n \"first\": \"/api_keys?limit=10&offset=0\", \n \"href\": \"/api_keys?limit=10&offset=0\", \n \"last\": \"/api_keys?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 2\n }\n}" - }, - "api_key_show": { - "request": { - "uri": "/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c" - }, - "response": "{\n \"api_keys\": [\n {\n \"created_at\": \"2014-01-27T22:56:01.641736Z\", \n \"href\": \"/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c\", \n \"id\": \"AK1vqjn1eEHXP0JYXrBrjH5c\", \n \"links\": {}, \n \"meta\": {}\n }\n ], \n \"links\": {}\n}" - }, - "api_location": "https://api.balancedpayments.com", - "api_rev": "rev1", - "bank_account_associate_to_customer": { - "request": { - "customer_href": "/customers/CU3eeasZ9yQ86uzzIYZkrPGg", - "payload": { - "customer": "/customers/CU3eeasZ9yQ86uzzIYZkrPGg" - }, - "uri": "/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0" - }, - "response": "{\n \"bank_accounts\": [\n {\n \"account_number\": \"xxxxxx0001\", \n \"account_type\": \"checking\", \n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"bank_name\": \"BANK OF AMERICA, N.A.\", \n \"can_credit\": true, \n \"can_debit\": false, \n \"created_at\": \"2014-01-27T22:57:47.772481Z\", \n \"fingerprint\": \"5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14\", \n \"href\": \"/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0\", \n \"id\": \"BA3qNbYRqFM0Q7MXn3IcjGl0\", \n \"links\": {\n \"bank_account_verification\": null, \n \"customer\": \"CU3eeasZ9yQ86uzzIYZkrPGg\"\n }, \n \"meta\": {}, \n \"name\": \"Johann Bernoulli\", \n \"routing_number\": \"121000358\", \n \"updated_at\": \"2014-01-27T22:57:48.515195Z\"\n }\n ], \n \"links\": {\n \"bank_accounts.bank_account_verification\": \"/verifications/{bank_accounts.bank_account_verification}\", \n \"bank_accounts.bank_account_verifications\": \"/bank_accounts/{bank_accounts.id}/verifications\", \n \"bank_accounts.credits\": \"/bank_accounts/{bank_accounts.id}/credits\", \n \"bank_accounts.customer\": \"/customers/{bank_accounts.customer}\", \n \"bank_accounts.debits\": \"/bank_accounts/{bank_accounts.id}/debits\"\n }\n}" - }, - "bank_account_create": { - "request": { - "payload": { - "account_number": "9900000001", - "name": "Johann Bernoulli", - "routing_number": "121000358", - "type": "checking" - }, - "uri": "/bank_accounts" - }, - "response": "{\n \"bank_accounts\": [\n {\n \"account_number\": \"xxxxxx0001\", \n \"account_type\": \"checking\", \n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"bank_name\": \"BANK OF AMERICA, N.A.\", \n \"can_credit\": true, \n \"can_debit\": false, \n \"created_at\": \"2014-01-27T22:57:47.772481Z\", \n \"fingerprint\": \"5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14\", \n \"href\": \"/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0\", \n \"id\": \"BA3qNbYRqFM0Q7MXn3IcjGl0\", \n \"links\": {\n \"bank_account_verification\": null, \n \"customer\": null\n }, \n \"meta\": {}, \n \"name\": \"Johann Bernoulli\", \n \"routing_number\": \"121000358\", \n \"updated_at\": \"2014-01-27T22:57:47.772483Z\"\n }\n ], \n \"links\": {\n \"bank_accounts.bank_account_verification\": \"/verifications/{bank_accounts.bank_account_verification}\", \n \"bank_accounts.bank_account_verifications\": \"/bank_accounts/{bank_accounts.id}/verifications\", \n \"bank_accounts.credits\": \"/bank_accounts/{bank_accounts.id}/credits\", \n \"bank_accounts.customer\": \"/customers/{bank_accounts.customer}\", \n \"bank_accounts.debits\": \"/bank_accounts/{bank_accounts.id}/debits\"\n }\n}" - }, - "bank_account_credit": { - "request": { - "bank_account_href": "/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0", - "payload": { - "amount": 5000 - }, - "uri": "/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0/credits" - }, - "response": "{\n \"credits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"example.com\", \n \"created_at\": \"2014-01-27T22:58:19.422292Z\", \n \"currency\": \"USD\", \n \"description\": null, \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/credits/CR40neytmVG2HDBp1opfF7sY\", \n \"id\": \"CR40neytmVG2HDBp1opfF7sY\", \n \"links\": {\n \"customer\": \"CU3eeasZ9yQ86uzzIYZkrPGg\", \n \"destination\": \"BA3qNbYRqFM0Q7MXn3IcjGl0\", \n \"order\": null\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"CR816-868-3666\", \n \"updated_at\": \"2014-01-27T22:58:20.346871Z\"\n }\n ], \n \"links\": {\n \"credits.customer\": \"/customers/{credits.customer}\", \n \"credits.destination\": \"/resources/{credits.destination}\", \n \"credits.events\": \"/credits/{credits.id}/events\", \n \"credits.order\": \"/orders/{credits.order}\", \n \"credits.reversals\": \"/credits/{credits.id}/reversals\"\n }\n}" - }, - "bank_account_debit": { - "request": { - "bank_account_href": "/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S", - "payload": { - "amount": 5000, - "appears_on_statement_as": "Statement text", - "description": "Some descriptive text for the debit in the dashboard" - }, - "uri": "/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S/debits" - }, - "response": "{\n \"debits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*Statement text\", \n \"created_at\": \"2014-01-27T22:56:28.702119Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD1ZRRAZnFTryFdFaq7ijcPE\", \n \"id\": \"WD1ZRRAZnFTryFdFaq7ijcPE\", \n \"links\": {\n \"customer\": null, \n \"dispute\": null, \n \"order\": null, \n \"source\": \"BA1D3vL3LjasB0kewMqRGI0S\"\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W081-463-7557\", \n \"updated_at\": \"2014-01-27T22:56:29.235927Z\"\n }\n ], \n \"links\": {\n \"debits.customer\": \"/customers/{debits.customer}\", \n \"debits.dispute\": \"/disputes/{debits.dispute}\", \n \"debits.events\": \"/debits/{debits.id}/events\", \n \"debits.order\": \"/orders/{debits.order}\", \n \"debits.refunds\": \"/debits/{debits.id}/refunds\", \n \"debits.source\": \"/resources/{debits.source}\"\n }\n}" - }, - "bank_account_delete": { - "request": { - "uri": "/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy" - } - }, - "bank_account_list": { - "request": { - "uri": "/bank_accounts" - }, - "response": "{\n \"bank_accounts\": [\n {\n \"account_number\": \"xxxxxx0001\", \n \"account_type\": \"checking\", \n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"bank_name\": \"BANK OF AMERICA, N.A.\", \n \"can_credit\": true, \n \"can_debit\": false, \n \"created_at\": \"2014-01-27T22:56:20.540530Z\", \n \"fingerprint\": \"5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14\", \n \"href\": \"/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy\", \n \"id\": \"BA1QFf0LmIxr8p41msqX46Oy\", \n \"links\": {\n \"bank_account_verification\": null, \n \"customer\": null\n }, \n \"meta\": {}, \n \"name\": \"Johann Bernoulli\", \n \"routing_number\": \"121000358\", \n \"updated_at\": \"2014-01-27T22:56:20.540534Z\"\n }, \n {\n \"account_number\": \"xxxxxx0001\", \n \"account_type\": \"checking\", \n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"bank_name\": \"BANK OF AMERICA, N.A.\", \n \"can_credit\": true, \n \"can_debit\": true, \n \"created_at\": \"2014-01-27T22:56:08.446352Z\", \n \"fingerprint\": \"5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14\", \n \"href\": \"/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S\", \n \"id\": \"BA1D3vL3LjasB0kewMqRGI0S\", \n \"links\": {\n \"bank_account_verification\": \"BZ1FF2MHFH9upRu7C0QUwnby\", \n \"customer\": null\n }, \n \"meta\": {}, \n \"name\": \"Johann Bernoulli\", \n \"routing_number\": \"121000358\", \n \"updated_at\": \"2014-01-27T22:56:18.623674Z\"\n }, \n {\n \"account_number\": \"xxxxxxxxxxx5555\", \n \"account_type\": \"checking\", \n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"bank_name\": \"WELLS FARGO BANK NA\", \n \"can_credit\": true, \n \"can_debit\": true, \n \"created_at\": \"2014-01-27T22:55:49.899228Z\", \n \"fingerprint\": \"6ybvaLUrJy07phK2EQ7pVk\", \n \"href\": \"/bank_accounts/BA1fUvPHaEcIdkRe8HmC2Vee\", \n \"id\": \"BA1fUvPHaEcIdkRe8HmC2Vee\", \n \"links\": {\n \"bank_account_verification\": null, \n \"customer\": \"CU1f8Ygc4t0F2FKNcw235x9I\"\n }, \n \"meta\": {}, \n \"name\": \"TEST-MERCHANT-BANK-ACCOUNT\", \n \"routing_number\": \"121042882\", \n \"updated_at\": \"2014-01-27T22:55:49.899231Z\"\n }\n ], \n \"links\": {\n \"bank_accounts.bank_account_verification\": \"/verifications/{bank_accounts.bank_account_verification}\", \n \"bank_accounts.bank_account_verifications\": \"/bank_accounts/{bank_accounts.id}/verifications\", \n \"bank_accounts.credits\": \"/bank_accounts/{bank_accounts.id}/credits\", \n \"bank_accounts.customer\": \"/customers/{bank_accounts.customer}\", \n \"bank_accounts.debits\": \"/bank_accounts/{bank_accounts.id}/debits\"\n }, \n \"meta\": {\n \"first\": \"/bank_accounts?limit=10&offset=0\", \n \"href\": \"/bank_accounts?limit=10&offset=0\", \n \"last\": \"/bank_accounts?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 3\n }\n}" - }, - "bank_account_show": { - "request": { - "uri": "/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy" - }, - "response": "{\n \"bank_accounts\": [\n {\n \"account_number\": \"xxxxxx0001\", \n \"account_type\": \"checking\", \n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"bank_name\": \"BANK OF AMERICA, N.A.\", \n \"can_credit\": true, \n \"can_debit\": false, \n \"created_at\": \"2014-01-27T22:56:20.540530Z\", \n \"fingerprint\": \"5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14\", \n \"href\": \"/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy\", \n \"id\": \"BA1QFf0LmIxr8p41msqX46Oy\", \n \"links\": {\n \"bank_account_verification\": null, \n \"customer\": null\n }, \n \"meta\": {}, \n \"name\": \"Johann Bernoulli\", \n \"routing_number\": \"121000358\", \n \"updated_at\": \"2014-01-27T22:56:20.540534Z\"\n }\n ], \n \"links\": {\n \"bank_accounts.bank_account_verification\": \"/verifications/{bank_accounts.bank_account_verification}\", \n \"bank_accounts.bank_account_verifications\": \"/bank_accounts/{bank_accounts.id}/verifications\", \n \"bank_accounts.credits\": \"/bank_accounts/{bank_accounts.id}/credits\", \n \"bank_accounts.customer\": \"/customers/{bank_accounts.customer}\", \n \"bank_accounts.debits\": \"/bank_accounts/{bank_accounts.id}/debits\"\n }\n}" - }, - "bank_account_update": { - "request": { - "payload": { - "meta": { - "facebook.user_id": "0192837465", - "my-own-customer-id": "12345", - "twitter.id": "1234987650" - } - }, - "uri": "/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy" - }, - "response": "{\n \"bank_accounts\": [\n {\n \"account_number\": \"xxxxxx0001\", \n \"account_type\": \"checking\", \n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"bank_name\": \"BANK OF AMERICA, N.A.\", \n \"can_credit\": true, \n \"can_debit\": false, \n \"created_at\": \"2014-01-27T22:56:20.540530Z\", \n \"fingerprint\": \"5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14\", \n \"href\": \"/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy\", \n \"id\": \"BA1QFf0LmIxr8p41msqX46Oy\", \n \"links\": {\n \"bank_account_verification\": null, \n \"customer\": null\n }, \n \"meta\": {\n \"facebook.user_id\": \"0192837465\", \n \"my-own-customer-id\": \"12345\", \n \"twitter.id\": \"1234987650\"\n }, \n \"name\": \"Johann Bernoulli\", \n \"routing_number\": \"121000358\", \n \"updated_at\": \"2014-01-27T22:56:25.767386Z\"\n }\n ], \n \"links\": {\n \"bank_accounts.bank_account_verification\": \"/verifications/{bank_accounts.bank_account_verification}\", \n \"bank_accounts.bank_account_verifications\": \"/bank_accounts/{bank_accounts.id}/verifications\", \n \"bank_accounts.credits\": \"/bank_accounts/{bank_accounts.id}/credits\", \n \"bank_accounts.customer\": \"/customers/{bank_accounts.customer}\", \n \"bank_accounts.debits\": \"/bank_accounts/{bank_accounts.id}/debits\"\n }\n}" - }, - "bank_account_verification_create": { - "request": { - "bank_account_uri": "/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S", - "uri": "/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S/verifications" - }, - "response": "{\n \"bank_account_verifications\": [\n {\n \"attempts\": 0, \n \"attempts_remaining\": 3, \n \"created_at\": \"2014-01-27T22:56:10.726455Z\", \n \"deposit_status\": \"succeeded\", \n \"href\": \"/verifications/BZ1FF2MHFH9upRu7C0QUwnby\", \n \"id\": \"BZ1FF2MHFH9upRu7C0QUwnby\", \n \"links\": {\n \"bank_account\": \"BA1D3vL3LjasB0kewMqRGI0S\"\n }, \n \"meta\": {}, \n \"updated_at\": \"2014-01-27T22:56:12.545750Z\", \n \"verification_status\": \"pending\"\n }\n ], \n \"links\": {\n \"bank_account_verifications.bank_account\": \"/bank_accounts/{bank_account_verifications.bank_account}\"\n }\n}" - }, - "bank_account_verification_show": { - "request": { - "uri": "/verifications/BZ1FF2MHFH9upRu7C0QUwnby" - }, - "response": "{\n \"bank_account_verifications\": [\n {\n \"attempts\": 0, \n \"attempts_remaining\": 3, \n \"created_at\": \"2014-01-27T22:56:10.726455Z\", \n \"deposit_status\": \"succeeded\", \n \"href\": \"/verifications/BZ1FF2MHFH9upRu7C0QUwnby\", \n \"id\": \"BZ1FF2MHFH9upRu7C0QUwnby\", \n \"links\": {\n \"bank_account\": \"BA1D3vL3LjasB0kewMqRGI0S\"\n }, \n \"meta\": {}, \n \"updated_at\": \"2014-01-27T22:56:12.545750Z\", \n \"verification_status\": \"pending\"\n }\n ], \n \"links\": {\n \"bank_account_verifications.bank_account\": \"/bank_accounts/{bank_account_verifications.bank_account}\"\n }\n}" - }, - "bank_account_verification_update": { - "request": { - "payload": { - "amount_1": 1, - "amount_2": 1 - }, - "uri": "/verifications/BZ1FF2MHFH9upRu7C0QUwnby" - }, - "response": "{\n \"bank_account_verifications\": [\n {\n \"attempts\": 1, \n \"attempts_remaining\": 2, \n \"created_at\": \"2014-01-27T22:56:10.726455Z\", \n \"deposit_status\": \"succeeded\", \n \"href\": \"/verifications/BZ1FF2MHFH9upRu7C0QUwnby\", \n \"id\": \"BZ1FF2MHFH9upRu7C0QUwnby\", \n \"links\": {\n \"bank_account\": \"BA1D3vL3LjasB0kewMqRGI0S\"\n }, \n \"meta\": {}, \n \"updated_at\": \"2014-01-27T22:56:18.631337Z\", \n \"verification_status\": \"succeeded\"\n }\n ], \n \"links\": {\n \"bank_account_verifications.bank_account\": \"/bank_accounts/{bank_account_verifications.bank_account}\"\n }\n}" - }, - "callback_create": { - "request": { - "payload": { - "url": "http://www.example.com/callback" - }, - "uri": "/callbacks" - }, - "response": "{\n \"callbacks\": [\n {\n \"href\": \"/callbacks/CB224374R2NSyoYBpDV4r7C2\", \n \"id\": \"CB224374R2NSyoYBpDV4r7C2\", \n \"links\": {}, \n \"method\": \"post\", \n \"revision\": \"1.1\", \n \"url\": \"http://www.example.com/callback\"\n }\n ], \n \"links\": {}\n}" - }, - "callback_delete": { - "request": { - "uri": "/callbacks/CB224374R2NSyoYBpDV4r7C2" - } - }, - "callback_list": { - "request": { - "uri": "/callbacks" - }, - "response": "{\n \"callbacks\": [\n {\n \"href\": \"/callbacks/CB224374R2NSyoYBpDV4r7C2\", \n \"id\": \"CB224374R2NSyoYBpDV4r7C2\", \n \"links\": {}, \n \"method\": \"post\", \n \"revision\": \"1.1\", \n \"url\": \"http://www.example.com/callback\"\n }\n ], \n \"links\": {}, \n \"meta\": {\n \"first\": \"/callbacks?limit=10&offset=0\", \n \"href\": \"/callbacks?limit=10&offset=0\", \n \"last\": \"/callbacks?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 1\n }\n}" - }, - "callback_show": { - "request": { - "uri": "/callbacks/CB224374R2NSyoYBpDV4r7C2" - }, - "response": "{\n \"callbacks\": [\n {\n \"href\": \"/callbacks/CB224374R2NSyoYBpDV4r7C2\", \n \"id\": \"CB224374R2NSyoYBpDV4r7C2\", \n \"links\": {}, \n \"method\": \"post\", \n \"revision\": \"1.1\", \n \"url\": \"http://www.example.com/callback\"\n }\n ], \n \"links\": {}\n}" - }, - "card": { - "address": { - "city": null, - "country_code": "USA", - "line1": null, - "line2": null, - "postal_code": "10023", - "state": null - }, - "avs_postal_match": "yes", - "avs_result": "Postal code matches, but street address not verified.", - "avs_street_match": null, - "brand": "Visa", - "created_at": "2014-01-27T22:55:54.558589Z", - "cvv": null, - "cvv_match": null, - "cvv_result": null, - "expiration_month": 4, - "expiration_year": 2016, - "fingerprint": "979a26c05f2fb1c7ae38656312b176da2c9be1d938d442040bc79539caac6c0d", - "href": "/cards/CC1nrXVKmfh0ouOS7zxI6X8q", - "id": "CC1nrXVKmfh0ouOS7zxI6X8q", - "is_verified": true, - "links": { - "customer": "CU1iDnBalzHoZg47Np92rNrV" - }, - "meta": {}, - "name": "Benny Riemann", - "number": "xxxxxxxxxxxx1111", - "updated_at": "2014-01-27T22:55:54.558592Z" - }, - "card_associate_to_customer": { - "request": { - "payload": { - "customer": "/customers/CU3eeasZ9yQ86uzzIYZkrPGg" - }, - "uri": "/cards/CC3kqm84fxh50avenrUsSKbu" - }, - "response": "{\n \"cards\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"avs_postal_match\": null, \n \"avs_result\": null, \n \"avs_street_match\": null, \n \"brand\": \"MasterCard\", \n \"created_at\": \"2014-01-27T22:57:42.092923Z\", \n \"cvv\": null, \n \"cvv_match\": null, \n \"cvv_result\": null, \n \"expiration_month\": 12, \n \"expiration_year\": 2020, \n \"fingerprint\": \"fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788\", \n \"href\": \"/cards/CC3kqm84fxh50avenrUsSKbu\", \n \"id\": \"CC3kqm84fxh50avenrUsSKbu\", \n \"is_verified\": true, \n \"links\": {\n \"customer\": \"CU3eeasZ9yQ86uzzIYZkrPGg\"\n }, \n \"meta\": {}, \n \"name\": null, \n \"number\": \"xxxxxxxxxxxx5100\", \n \"updated_at\": \"2014-01-27T22:57:42.724392Z\"\n }\n ], \n \"links\": {\n \"cards.card_holds\": \"/cards/{cards.id}/card_holds\", \n \"cards.customer\": \"/customers/{cards.customer}\", \n \"cards.debits\": \"/cards/{cards.id}/debits\"\n }\n}" - }, - "card_create": { - "request": { - "payload": { - "expiration_month": "12", - "expiration_year": "2020", - "number": "5105105105105100", - "security_code": "123" - }, - "uri": "/cards" - }, - "response": "{\n \"cards\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"avs_postal_match\": null, \n \"avs_result\": null, \n \"avs_street_match\": null, \n \"brand\": \"MasterCard\", \n \"created_at\": \"2014-01-27T22:57:42.092923Z\", \n \"cvv\": null, \n \"cvv_match\": null, \n \"cvv_result\": null, \n \"expiration_month\": 12, \n \"expiration_year\": 2020, \n \"fingerprint\": \"fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788\", \n \"href\": \"/cards/CC3kqm84fxh50avenrUsSKbu\", \n \"id\": \"CC3kqm84fxh50avenrUsSKbu\", \n \"is_verified\": true, \n \"links\": {\n \"customer\": null\n }, \n \"meta\": {}, \n \"name\": null, \n \"number\": \"xxxxxxxxxxxx5100\", \n \"updated_at\": \"2014-01-27T22:57:42.092926Z\"\n }\n ], \n \"links\": {\n \"cards.card_holds\": \"/cards/{cards.id}/card_holds\", \n \"cards.customer\": \"/customers/{cards.customer}\", \n \"cards.debits\": \"/cards/{cards.id}/debits\"\n }\n}" - }, - "card_debit": { - "request": { - "card_href": "/cards/CC3kqm84fxh50avenrUsSKbu", - "payload": { - "amount": 5000, - "appears_on_statement_as": "Statement text", - "description": "Some descriptive text for the debit in the dashboard" - }, - "uri": "/cards/CC3kqm84fxh50avenrUsSKbu/debits" - }, - "response": "{\n \"debits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*Statement text\", \n \"created_at\": \"2014-01-27T22:58:07.291226Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD3MKNxNTKBGgA7mX50yogiu\", \n \"id\": \"WD3MKNxNTKBGgA7mX50yogiu\", \n \"links\": {\n \"customer\": \"CU3eeasZ9yQ86uzzIYZkrPGg\", \n \"dispute\": null, \n \"order\": null, \n \"source\": \"CC3kqm84fxh50avenrUsSKbu\"\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W180-465-2000\", \n \"updated_at\": \"2014-01-27T22:58:09.706862Z\"\n }\n ], \n \"links\": {\n \"debits.customer\": \"/customers/{debits.customer}\", \n \"debits.dispute\": \"/disputes/{debits.dispute}\", \n \"debits.events\": \"/debits/{debits.id}/events\", \n \"debits.order\": \"/orders/{debits.order}\", \n \"debits.refunds\": \"/debits/{debits.id}/refunds\", \n \"debits.source\": \"/resources/{debits.source}\"\n }\n}" - }, - "card_delete": { - "request": { - "uri": "/cards/CC2uc8iPDjgyxOXHVtnZloyI" - } - }, - "card_hold_capture": { - "request": { - "card_hold_href": "/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S", - "payload": { - "appears_on_statement_as": "ShowsUpOnStmt", - "description": "Some descriptive text for the debit in the dashboard" - }, - "uri": "/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S/debits" - }, - "response": "{\n \"debits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*ShowsUpOnStmt\", \n \"created_at\": \"2014-01-27T22:56:45.623268Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD2iSCukjXyeRdkvX3cW0PmC\", \n \"id\": \"WD2iSCukjXyeRdkvX3cW0PmC\", \n \"links\": {\n \"customer\": \"CU1f8Ygc4t0F2FKNcw235x9I\", \n \"dispute\": null, \n \"order\": null, \n \"source\": \"CC2abDOQVm5aNFhHpcRvWS02\"\n }, \n \"meta\": {\n \"holding.for\": \"user1\", \n \"meaningful.key\": \"some.value\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W744-719-1832\", \n \"updated_at\": \"2014-01-27T22:56:47.926021Z\"\n }\n ], \n \"links\": {\n \"debits.customer\": \"/customers/{debits.customer}\", \n \"debits.dispute\": \"/disputes/{debits.dispute}\", \n \"debits.events\": \"/debits/{debits.id}/events\", \n \"debits.order\": \"/orders/{debits.order}\", \n \"debits.refunds\": \"/debits/{debits.id}/refunds\", \n \"debits.source\": \"/resources/{debits.source}\"\n }\n}" - }, - "card_hold_create": { - "request": { - "card_href": "/cards/CC2abDOQVm5aNFhHpcRvWS02", - "payload": { - "amount": 5000, - "description": "Some descriptive text for the debit in the dashboard" - }, - "uri": "/cards/CC2abDOQVm5aNFhHpcRvWS02/card_holds" - }, - "response": "{\n \"card_holds\": [\n {\n \"amount\": 5000, \n \"created_at\": \"2014-01-27T22:56:49.446376Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"expires_at\": \"2014-02-03T22:56:50.793698Z\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG\", \n \"id\": \"HL2ncCO5Bir2S0PCdsDHV3cG\", \n \"links\": {\n \"card\": \"CC2abDOQVm5aNFhHpcRvWS02\", \n \"debit\": null\n }, \n \"meta\": {}, \n \"transaction_number\": \"HL102-313-8003\", \n \"updated_at\": \"2014-01-27T22:56:51.115729Z\"\n }\n ], \n \"links\": {\n \"card_holds.card\": \"/resources/{card_holds.card}\", \n \"card_holds.debit\": \"/debits/{card_holds.debit}\", \n \"card_holds.debits\": \"/card_holds/{card_holds.id}/debits\", \n \"card_holds.events\": \"/card_holds/{card_holds.id}/events\"\n }\n}" - }, - "card_hold_list": { - "request": { - "uri": "/card_holds" - }, - "response": "{\n \"card_holds\": [\n {\n \"amount\": 5000, \n \"created_at\": \"2014-01-27T22:56:39.379941Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"expires_at\": \"2014-02-03T22:56:39.876902Z\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S\", \n \"id\": \"HL2bT9uMRkTZkfSPmA2pBD9S\", \n \"links\": {\n \"card\": \"CC2abDOQVm5aNFhHpcRvWS02\", \n \"debit\": null\n }, \n \"meta\": {}, \n \"transaction_number\": \"HL500-842-5492\", \n \"updated_at\": \"2014-01-27T22:56:40.238140Z\"\n }, \n {\n \"amount\": 10000000, \n \"created_at\": \"2014-01-27T22:55:56.619097Z\", \n \"currency\": \"USD\", \n \"description\": null, \n \"expires_at\": \"2014-02-03T22:55:57.540880Z\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/card_holds/HL1pMPzS1JEE4lMCBnKh32Oa\", \n \"id\": \"HL1pMPzS1JEE4lMCBnKh32Oa\", \n \"links\": {\n \"card\": \"CC1nrXVKmfh0ouOS7zxI6X8q\", \n \"debit\": \"WD1pU48nHJzorOySkTaQGQ9U\"\n }, \n \"meta\": {}, \n \"transaction_number\": \"HL464-208-0908\", \n \"updated_at\": \"2014-01-27T22:56:00.845902Z\"\n }\n ], \n \"links\": {\n \"card_holds.card\": \"/resources/{card_holds.card}\", \n \"card_holds.debit\": \"/debits/{card_holds.debit}\", \n \"card_holds.debits\": \"/card_holds/{card_holds.id}/debits\", \n \"card_holds.events\": \"/card_holds/{card_holds.id}/events\"\n }, \n \"meta\": {\n \"first\": \"/card_holds?limit=10&offset=0\", \n \"href\": \"/card_holds?limit=10&offset=0\", \n \"last\": \"/card_holds?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 2\n }\n}" - }, - "card_hold_show": { - "request": { - "uri": "/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S" - }, - "response": "{\n \"card_holds\": [\n {\n \"amount\": 5000, \n \"created_at\": \"2014-01-27T22:56:39.379941Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"expires_at\": \"2014-02-03T22:56:39.876902Z\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S\", \n \"id\": \"HL2bT9uMRkTZkfSPmA2pBD9S\", \n \"links\": {\n \"card\": \"CC2abDOQVm5aNFhHpcRvWS02\", \n \"debit\": null\n }, \n \"meta\": {}, \n \"transaction_number\": \"HL500-842-5492\", \n \"updated_at\": \"2014-01-27T22:56:40.238140Z\"\n }\n ], \n \"links\": {\n \"card_holds.card\": \"/resources/{card_holds.card}\", \n \"card_holds.debit\": \"/debits/{card_holds.debit}\", \n \"card_holds.debits\": \"/card_holds/{card_holds.id}/debits\", \n \"card_holds.events\": \"/card_holds/{card_holds.id}/events\"\n }\n}" - }, - "card_hold_update": { - "request": { - "payload": { - "description": "update this description", - "meta": { - "holding.for": "user1", - "meaningful.key": "some.value" - } - }, - "uri": "/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S" - }, - "response": "{\n \"card_holds\": [\n {\n \"amount\": 5000, \n \"created_at\": \"2014-01-27T22:56:39.379941Z\", \n \"currency\": \"USD\", \n \"description\": \"update this description\", \n \"expires_at\": \"2014-02-03T22:56:39.876902Z\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S\", \n \"id\": \"HL2bT9uMRkTZkfSPmA2pBD9S\", \n \"links\": {\n \"card\": \"CC2abDOQVm5aNFhHpcRvWS02\", \n \"debit\": null\n }, \n \"meta\": {\n \"holding.for\": \"user1\", \n \"meaningful.key\": \"some.value\"\n }, \n \"transaction_number\": \"HL500-842-5492\", \n \"updated_at\": \"2014-01-27T22:56:44.255042Z\"\n }\n ], \n \"links\": {\n \"card_holds.card\": \"/resources/{card_holds.card}\", \n \"card_holds.debit\": \"/debits/{card_holds.debit}\", \n \"card_holds.debits\": \"/card_holds/{card_holds.id}/debits\", \n \"card_holds.events\": \"/card_holds/{card_holds.id}/events\"\n }\n}" - }, - "card_hold_void": { - "request": { - "payload": { - "is_void": "true" - }, - "uri": "/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG" - }, - "response": "{\n \"card_holds\": [\n {\n \"amount\": 5000, \n \"created_at\": \"2014-01-27T22:56:49.446376Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"expires_at\": \"2014-02-03T22:56:50.793698Z\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG\", \n \"id\": \"HL2ncCO5Bir2S0PCdsDHV3cG\", \n \"links\": {\n \"card\": \"CC2abDOQVm5aNFhHpcRvWS02\", \n \"debit\": null\n }, \n \"meta\": {}, \n \"transaction_number\": \"HL102-313-8003\", \n \"updated_at\": \"2014-01-27T22:56:51.686616Z\"\n }\n ], \n \"links\": {\n \"card_holds.card\": \"/resources/{card_holds.card}\", \n \"card_holds.debit\": \"/debits/{card_holds.debit}\", \n \"card_holds.debits\": \"/card_holds/{card_holds.id}/debits\", \n \"card_holds.events\": \"/card_holds/{card_holds.id}/events\"\n }\n}" - }, - "card_id": "CC1nrXVKmfh0ouOS7zxI6X8q", - "card_list": { - "request": { - "uri": "/cards" - }, - "response": "{\n \"cards\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"avs_postal_match\": null, \n \"avs_result\": null, \n \"avs_street_match\": null, \n \"brand\": \"MasterCard\", \n \"created_at\": \"2014-01-27T22:56:55.656375Z\", \n \"cvv\": null, \n \"cvv_match\": null, \n \"cvv_result\": null, \n \"expiration_month\": 12, \n \"expiration_year\": 2020, \n \"fingerprint\": \"fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788\", \n \"href\": \"/cards/CC2uc8iPDjgyxOXHVtnZloyI\", \n \"id\": \"CC2uc8iPDjgyxOXHVtnZloyI\", \n \"is_verified\": true, \n \"links\": {\n \"customer\": null\n }, \n \"meta\": {}, \n \"name\": null, \n \"number\": \"xxxxxxxxxxxx5100\", \n \"updated_at\": \"2014-01-27T22:56:55.656379Z\"\n }, \n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"avs_postal_match\": null, \n \"avs_result\": null, \n \"avs_street_match\": null, \n \"brand\": \"MasterCard\", \n \"created_at\": \"2014-01-27T22:56:37.869483Z\", \n \"cvv\": null, \n \"cvv_match\": null, \n \"cvv_result\": null, \n \"expiration_month\": 12, \n \"expiration_year\": 2020, \n \"fingerprint\": \"fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788\", \n \"href\": \"/cards/CC2abDOQVm5aNFhHpcRvWS02\", \n \"id\": \"CC2abDOQVm5aNFhHpcRvWS02\", \n \"is_verified\": true, \n \"links\": {\n \"customer\": \"CU1f8Ygc4t0F2FKNcw235x9I\"\n }, \n \"meta\": {}, \n \"name\": null, \n \"number\": \"xxxxxxxxxxxx5100\", \n \"updated_at\": \"2014-01-27T22:56:39.354525Z\"\n }, \n {\n \"address\": {\n \"city\": null, \n \"country_code\": \"USA\", \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": \"10023\", \n \"state\": null\n }, \n \"avs_postal_match\": \"yes\", \n \"avs_result\": \"Postal code matches, but street address not verified.\", \n \"avs_street_match\": null, \n \"brand\": \"Visa\", \n \"created_at\": \"2014-01-27T22:55:54.558589Z\", \n \"cvv\": null, \n \"cvv_match\": null, \n \"cvv_result\": null, \n \"expiration_month\": 4, \n \"expiration_year\": 2016, \n \"fingerprint\": \"979a26c05f2fb1c7ae38656312b176da2c9be1d938d442040bc79539caac6c0d\", \n \"href\": \"/cards/CC1nrXVKmfh0ouOS7zxI6X8q\", \n \"id\": \"CC1nrXVKmfh0ouOS7zxI6X8q\", \n \"is_verified\": true, \n \"links\": {\n \"customer\": \"CU1iDnBalzHoZg47Np92rNrV\"\n }, \n \"meta\": {}, \n \"name\": \"Benny Riemann\", \n \"number\": \"xxxxxxxxxxxx1111\", \n \"updated_at\": \"2014-01-27T22:55:54.558592Z\"\n }\n ], \n \"links\": {\n \"cards.card_holds\": \"/cards/{cards.id}/card_holds\", \n \"cards.customer\": \"/customers/{cards.customer}\", \n \"cards.debits\": \"/cards/{cards.id}/debits\"\n }, \n \"meta\": {\n \"first\": \"/cards?limit=10&offset=0\", \n \"href\": \"/cards?limit=10&offset=0\", \n \"last\": \"/cards?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 3\n }\n}" - }, - "card_show": { - "request": { - "uri": "/cards/CC2uc8iPDjgyxOXHVtnZloyI" - }, - "response": "{\n \"cards\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"avs_postal_match\": null, \n \"avs_result\": null, \n \"avs_street_match\": null, \n \"brand\": \"MasterCard\", \n \"created_at\": \"2014-01-27T22:56:55.656375Z\", \n \"cvv\": null, \n \"cvv_match\": null, \n \"cvv_result\": null, \n \"expiration_month\": 12, \n \"expiration_year\": 2020, \n \"fingerprint\": \"fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788\", \n \"href\": \"/cards/CC2uc8iPDjgyxOXHVtnZloyI\", \n \"id\": \"CC2uc8iPDjgyxOXHVtnZloyI\", \n \"is_verified\": true, \n \"links\": {\n \"customer\": null\n }, \n \"meta\": {}, \n \"name\": null, \n \"number\": \"xxxxxxxxxxxx5100\", \n \"updated_at\": \"2014-01-27T22:56:55.656379Z\"\n }\n ], \n \"links\": {\n \"cards.card_holds\": \"/cards/{cards.id}/card_holds\", \n \"cards.customer\": \"/customers/{cards.customer}\", \n \"cards.debits\": \"/cards/{cards.id}/debits\"\n }\n}" - }, - "card_update": { - "request": { - "payload": { - "meta": { - "facebook.user_id": "0192837465", - "my-own-customer-id": "12345", - "twitter.id": "1234987650" - } - }, - "uri": "/cards/CC2uc8iPDjgyxOXHVtnZloyI" - }, - "response": "{\n \"cards\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"avs_postal_match\": null, \n \"avs_result\": null, \n \"avs_street_match\": null, \n \"brand\": \"MasterCard\", \n \"created_at\": \"2014-01-27T22:56:55.656375Z\", \n \"cvv\": null, \n \"cvv_match\": null, \n \"cvv_result\": null, \n \"expiration_month\": 12, \n \"expiration_year\": 2020, \n \"fingerprint\": \"fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788\", \n \"href\": \"/cards/CC2uc8iPDjgyxOXHVtnZloyI\", \n \"id\": \"CC2uc8iPDjgyxOXHVtnZloyI\", \n \"is_verified\": true, \n \"links\": {\n \"customer\": null\n }, \n \"meta\": {\n \"facebook.user_id\": \"0192837465\", \n \"my-own-customer-id\": \"12345\", \n \"twitter.id\": \"1234987650\"\n }, \n \"name\": null, \n \"number\": \"xxxxxxxxxxxx5100\", \n \"updated_at\": \"2014-01-27T22:57:02.195769Z\"\n }\n ], \n \"links\": {\n \"cards.card_holds\": \"/cards/{cards.id}/card_holds\", \n \"cards.customer\": \"/customers/{cards.customer}\", \n \"cards.debits\": \"/cards/{cards.id}/debits\"\n }\n}" - }, - "card_uri": "/cards/CC1nrXVKmfh0ouOS7zxI6X8q", - "cards_uri": "/customers/CU1iDnBalzHoZg47Np92rNrV/cards", - "credit_list": { - "request": { - "uri": "/credits" - }, - "response": "{\n \"credits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"example.com\", \n \"created_at\": \"2014-01-27T22:57:19.073817Z\", \n \"currency\": \"USD\", \n \"description\": null, \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/credits/CR2UtQgq6L3FPd1YoOc8eyOC\", \n \"id\": \"CR2UtQgq6L3FPd1YoOc8eyOC\", \n \"links\": {\n \"customer\": \"CU2N5goX8AQJE0CCPeapHUsM\", \n \"destination\": \"BA2QAksIxlLt60lqKc1wwgJy\", \n \"order\": null\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"CR408-633-3169\", \n \"updated_at\": \"2014-01-27T22:57:20.208794Z\"\n }\n ], \n \"links\": {\n \"credits.customer\": \"/customers/{credits.customer}\", \n \"credits.destination\": \"/resources/{credits.destination}\", \n \"credits.events\": \"/credits/{credits.id}/events\", \n \"credits.order\": \"/orders/{credits.order}\", \n \"credits.reversals\": \"/credits/{credits.id}/reversals\"\n }, \n \"meta\": {\n \"first\": \"/credits?limit=10&offset=0\", \n \"href\": \"/credits?limit=10&offset=0\", \n \"last\": \"/credits?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 1\n }\n}" - }, - "credit_list_bank_account": { - "request": { - "bank_account_href": "/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy", - "uri": "/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy/credits" - }, - "response": "{\n \"links\": {}, \n \"meta\": {\n \"first\": \"/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy/credits?limit=10&offset=0\", \n \"href\": \"/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy/credits?limit=10&offset=0\", \n \"last\": \"/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy/credits?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 0\n }\n}" - }, - "credit_show": { - "request": { - "uri": "/credits/CR2UtQgq6L3FPd1YoOc8eyOC" - }, - "response": "{\n \"credits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"example.com\", \n \"created_at\": \"2014-01-27T22:57:19.073817Z\", \n \"currency\": \"USD\", \n \"description\": null, \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/credits/CR2UtQgq6L3FPd1YoOc8eyOC\", \n \"id\": \"CR2UtQgq6L3FPd1YoOc8eyOC\", \n \"links\": {\n \"customer\": \"CU2N5goX8AQJE0CCPeapHUsM\", \n \"destination\": \"BA2QAksIxlLt60lqKc1wwgJy\", \n \"order\": null\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"CR408-633-3169\", \n \"updated_at\": \"2014-01-27T22:57:20.208794Z\"\n }\n ], \n \"links\": {\n \"credits.customer\": \"/customers/{credits.customer}\", \n \"credits.destination\": \"/resources/{credits.destination}\", \n \"credits.events\": \"/credits/{credits.id}/events\", \n \"credits.order\": \"/orders/{credits.order}\", \n \"credits.reversals\": \"/credits/{credits.id}/reversals\"\n }\n}" - }, - "credit_update": { - "request": { - "payload": { - "description": "New description for credit", - "meta": { - "anykey": "valuegoeshere", - "facebook.id": "1234567890" - } - }, - "uri": "/credits/CR2UtQgq6L3FPd1YoOc8eyOC" - }, - "response": "{\n \"credits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"example.com\", \n \"created_at\": \"2014-01-27T22:57:19.073817Z\", \n \"currency\": \"USD\", \n \"description\": \"New description for credit\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/credits/CR2UtQgq6L3FPd1YoOc8eyOC\", \n \"id\": \"CR2UtQgq6L3FPd1YoOc8eyOC\", \n \"links\": {\n \"customer\": \"CU2N5goX8AQJE0CCPeapHUsM\", \n \"destination\": \"BA2QAksIxlLt60lqKc1wwgJy\", \n \"order\": null\n }, \n \"meta\": {\n \"anykey\": \"valuegoeshere\", \n \"facebook.id\": \"1234567890\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"CR408-633-3169\", \n \"updated_at\": \"2014-01-27T22:57:25.832930Z\"\n }\n ], \n \"links\": {\n \"credits.customer\": \"/customers/{credits.customer}\", \n \"credits.destination\": \"/resources/{credits.destination}\", \n \"credits.events\": \"/credits/{credits.id}/events\", \n \"credits.order\": \"/orders/{credits.order}\", \n \"credits.reversals\": \"/credits/{credits.id}/reversals\"\n }\n}" - }, - "customer": { - "address": { - "city": null, - "country_code": null, - "line1": null, - "line2": null, - "postal_code": null, - "state": null - }, - "business_name": null, - "created_at": "2014-01-27T22:55:50.253066Z", - "dob_month": null, - "dob_year": null, - "ein": null, - "email": null, - "href": "/customers/CU1iDnBalzHoZg47Np92rNrV", - "id": "CU1iDnBalzHoZg47Np92rNrV", - "links": { - "destination": null, - "source": null - }, - "merchant_status": "no-match", - "meta": {}, - "name": null, - "phone": null, - "ssn_last4": null, - "updated_at": "2014-01-27T22:55:50.767858Z" - }, - "customer_create": { - "request": { - "payload": { - "address": { - "postal_code": "48120" - }, - "dob_month": 7, - "dob_year": 1963, - "name": "Henry Ford" - }, - "uri": "/customers" - }, - "response": "{\n \"customers\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": \"48120\", \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:57:36.586782Z\", \n \"dob_month\": 7, \n \"dob_year\": 1963, \n \"ein\": null, \n \"email\": null, \n \"href\": \"/customers/CU3eeasZ9yQ86uzzIYZkrPGg\", \n \"id\": \"CU3eeasZ9yQ86uzzIYZkrPGg\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"underwritten\", \n \"meta\": {}, \n \"name\": \"Henry Ford\", \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:57:37.740442Z\"\n }\n ], \n \"links\": {\n \"customers.bank_accounts\": \"/customers/{customers.id}/bank_accounts\", \n \"customers.card_holds\": \"/customers/{customers.id}/card_holds\", \n \"customers.cards\": \"/customers/{customers.id}/cards\", \n \"customers.credits\": \"/customers/{customers.id}/credits\", \n \"customers.debits\": \"/customers/{customers.id}/debits\", \n \"customers.destination\": \"/resources/{customers.destination}\", \n \"customers.orders\": \"/customers/{customers.id}/orders\", \n \"customers.refunds\": \"/customers/{customers.id}/refunds\", \n \"customers.reversals\": \"/customers/{customers.id}/reversals\", \n \"customers.source\": \"/resources/{customers.source}\", \n \"customers.transactions\": \"/customers/{customers.id}/transactions\"\n }\n}" - }, - "customer_delete": { - "request": { - "uri": "/customers/CU3eeasZ9yQ86uzzIYZkrPGg" - } - }, - "customer_list": { - "request": { - "uri": "/customers" - }, - "response": "{\n \"customers\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": \"48120\", \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:57:27.459187Z\", \n \"dob_month\": 7, \n \"dob_year\": 1963, \n \"ein\": null, \n \"email\": null, \n \"href\": \"/customers/CU33Y4cut21qu1d1lGYDBseQ\", \n \"id\": \"CU33Y4cut21qu1d1lGYDBseQ\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"underwritten\", \n \"meta\": {}, \n \"name\": \"Henry Ford\", \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:57:29.488272Z\"\n }, \n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": \"48120\", \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:57:12.447565Z\", \n \"dob_month\": 7, \n \"dob_year\": 1963, \n \"ein\": null, \n \"email\": null, \n \"href\": \"/customers/CU2N5goX8AQJE0CCPeapHUsM\", \n \"id\": \"CU2N5goX8AQJE0CCPeapHUsM\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"underwritten\", \n \"meta\": {}, \n \"name\": \"Henry Ford\", \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:57:13.581358Z\"\n }, \n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:55:50.253066Z\", \n \"dob_month\": null, \n \"dob_year\": null, \n \"ein\": null, \n \"email\": null, \n \"href\": \"/customers/CU1iDnBalzHoZg47Np92rNrV\", \n \"id\": \"CU1iDnBalzHoZg47Np92rNrV\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"no-match\", \n \"meta\": {}, \n \"name\": null, \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:55:50.767858Z\"\n }, \n {\n \"address\": {\n \"city\": \"Nowhere\", \n \"country_code\": \"USA\", \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": \"90210\", \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:55:47.156306Z\", \n \"dob_month\": 2, \n \"dob_year\": 1947, \n \"ein\": null, \n \"email\": \"whc@example.org\", \n \"href\": \"/customers/CU1f8Ygc4t0F2FKNcw235x9I\", \n \"id\": \"CU1f8Ygc4t0F2FKNcw235x9I\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"underwritten\", \n \"meta\": {}, \n \"name\": \"William Henry Cavendish III\", \n \"phone\": \"+16505551212\", \n \"ssn_last4\": \"xxxx\", \n \"updated_at\": \"2014-01-27T22:55:47.781694Z\"\n }\n ], \n \"links\": {\n \"customers.bank_accounts\": \"/customers/{customers.id}/bank_accounts\", \n \"customers.card_holds\": \"/customers/{customers.id}/card_holds\", \n \"customers.cards\": \"/customers/{customers.id}/cards\", \n \"customers.credits\": \"/customers/{customers.id}/credits\", \n \"customers.debits\": \"/customers/{customers.id}/debits\", \n \"customers.destination\": \"/resources/{customers.destination}\", \n \"customers.orders\": \"/customers/{customers.id}/orders\", \n \"customers.refunds\": \"/customers/{customers.id}/refunds\", \n \"customers.reversals\": \"/customers/{customers.id}/reversals\", \n \"customers.source\": \"/resources/{customers.source}\", \n \"customers.transactions\": \"/customers/{customers.id}/transactions\"\n }, \n \"meta\": {\n \"first\": \"/customers?limit=10&offset=0\", \n \"href\": \"/customers?limit=10&offset=0\", \n \"last\": \"/customers?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 4\n }\n}" - }, - "customer_show": { - "request": { - "uri": "/customers/CU33Y4cut21qu1d1lGYDBseQ" - }, - "response": "{\n \"customers\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": \"48120\", \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:57:27.459187Z\", \n \"dob_month\": 7, \n \"dob_year\": 1963, \n \"ein\": null, \n \"email\": null, \n \"href\": \"/customers/CU33Y4cut21qu1d1lGYDBseQ\", \n \"id\": \"CU33Y4cut21qu1d1lGYDBseQ\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"underwritten\", \n \"meta\": {}, \n \"name\": \"Henry Ford\", \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:57:29.488272Z\"\n }\n ], \n \"links\": {\n \"customers.bank_accounts\": \"/customers/{customers.id}/bank_accounts\", \n \"customers.card_holds\": \"/customers/{customers.id}/card_holds\", \n \"customers.cards\": \"/customers/{customers.id}/cards\", \n \"customers.credits\": \"/customers/{customers.id}/credits\", \n \"customers.debits\": \"/customers/{customers.id}/debits\", \n \"customers.destination\": \"/resources/{customers.destination}\", \n \"customers.orders\": \"/customers/{customers.id}/orders\", \n \"customers.refunds\": \"/customers/{customers.id}/refunds\", \n \"customers.reversals\": \"/customers/{customers.id}/reversals\", \n \"customers.source\": \"/resources/{customers.source}\", \n \"customers.transactions\": \"/customers/{customers.id}/transactions\"\n }\n}" - }, - "customer_update": { - "request": { - "payload": { - "email": "email@newdomain.com", - "meta": { - "shipping-preference": "ground" - } - }, - "uri": "/customers/CU33Y4cut21qu1d1lGYDBseQ" - }, - "response": "{\n \"customers\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": \"48120\", \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:57:27.459187Z\", \n \"dob_month\": 7, \n \"dob_year\": 1963, \n \"ein\": null, \n \"email\": \"email@newdomain.com\", \n \"href\": \"/customers/CU33Y4cut21qu1d1lGYDBseQ\", \n \"id\": \"CU33Y4cut21qu1d1lGYDBseQ\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"underwritten\", \n \"meta\": {\n \"shipping-preference\": \"ground\"\n }, \n \"name\": \"Henry Ford\", \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:57:34.512310Z\"\n }\n ], \n \"links\": {\n \"customers.bank_accounts\": \"/customers/{customers.id}/bank_accounts\", \n \"customers.card_holds\": \"/customers/{customers.id}/card_holds\", \n \"customers.cards\": \"/customers/{customers.id}/cards\", \n \"customers.credits\": \"/customers/{customers.id}/credits\", \n \"customers.debits\": \"/customers/{customers.id}/debits\", \n \"customers.destination\": \"/resources/{customers.destination}\", \n \"customers.orders\": \"/customers/{customers.id}/orders\", \n \"customers.refunds\": \"/customers/{customers.id}/refunds\", \n \"customers.reversals\": \"/customers/{customers.id}/reversals\", \n \"customers.source\": \"/resources/{customers.source}\", \n \"customers.transactions\": \"/customers/{customers.id}/transactions\"\n }\n}" - }, - "customers_uri": "/customers", - "debit": { - "debits": [ - { - "amount": 10000000, - "appears_on_statement_as": "BAL*example.com", - "created_at": "2014-01-27T22:55:56.757487Z", - "currency": "USD", - "description": null, - "failure_reason": null, - "failure_reason_code": null, - "href": "/debits/WD1pU48nHJzorOySkTaQGQ9U", - "id": "WD1pU48nHJzorOySkTaQGQ9U", - "links": { - "customer": "CU1iDnBalzHoZg47Np92rNrV", - "dispute": null, - "order": null, - "source": "CC1nrXVKmfh0ouOS7zxI6X8q" - }, - "meta": {}, - "status": "succeeded", - "transaction_number": "W511-688-4504", - "updated_at": "2014-01-27T22:56:00.833870Z" - } - ], - "links": { - "debits.customer": "/customers/{debits.customer}", - "debits.dispute": "/disputes/{debits.dispute}", - "debits.events": "/debits/{debits.id}/events", - "debits.order": "/orders/{debits.order}", - "debits.refunds": "/debits/{debits.id}/refunds", - "debits.source": "/resources/{debits.source}" - } - }, - "debit_list": { - "request": { - "uri": "/debits" - }, - "response": "{\n \"debits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*Statement text\", \n \"created_at\": \"2014-01-27T22:57:05.511023Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD2Fd3jVcMZEWyXHtG3U1LRM\", \n \"id\": \"WD2Fd3jVcMZEWyXHtG3U1LRM\", \n \"links\": {\n \"customer\": null, \n \"dispute\": null, \n \"order\": null, \n \"source\": \"CC2uc8iPDjgyxOXHVtnZloyI\"\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W906-153-1439\", \n \"updated_at\": \"2014-01-27T22:57:10.153696Z\"\n }, \n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*ShowsUpOnStmt\", \n \"created_at\": \"2014-01-27T22:56:45.623268Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD2iSCukjXyeRdkvX3cW0PmC\", \n \"id\": \"WD2iSCukjXyeRdkvX3cW0PmC\", \n \"links\": {\n \"customer\": \"CU1f8Ygc4t0F2FKNcw235x9I\", \n \"dispute\": null, \n \"order\": null, \n \"source\": \"CC2abDOQVm5aNFhHpcRvWS02\"\n }, \n \"meta\": {\n \"holding.for\": \"user1\", \n \"meaningful.key\": \"some.value\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W744-719-1832\", \n \"updated_at\": \"2014-01-27T22:56:47.926021Z\"\n }, \n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*Statement text\", \n \"created_at\": \"2014-01-27T22:56:28.702119Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD1ZRRAZnFTryFdFaq7ijcPE\", \n \"id\": \"WD1ZRRAZnFTryFdFaq7ijcPE\", \n \"links\": {\n \"customer\": null, \n \"dispute\": null, \n \"order\": null, \n \"source\": \"BA1D3vL3LjasB0kewMqRGI0S\"\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W081-463-7557\", \n \"updated_at\": \"2014-01-27T22:56:29.235927Z\"\n }, \n {\n \"amount\": 10000000, \n \"appears_on_statement_as\": \"BAL*example.com\", \n \"created_at\": \"2014-01-27T22:55:56.757487Z\", \n \"currency\": \"USD\", \n \"description\": null, \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD1pU48nHJzorOySkTaQGQ9U\", \n \"id\": \"WD1pU48nHJzorOySkTaQGQ9U\", \n \"links\": {\n \"customer\": \"CU1iDnBalzHoZg47Np92rNrV\", \n \"dispute\": null, \n \"order\": null, \n \"source\": \"CC1nrXVKmfh0ouOS7zxI6X8q\"\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W511-688-4504\", \n \"updated_at\": \"2014-01-27T22:56:00.833870Z\"\n }\n ], \n \"links\": {\n \"debits.customer\": \"/customers/{debits.customer}\", \n \"debits.dispute\": \"/disputes/{debits.dispute}\", \n \"debits.events\": \"/debits/{debits.id}/events\", \n \"debits.order\": \"/orders/{debits.order}\", \n \"debits.refunds\": \"/debits/{debits.id}/refunds\", \n \"debits.source\": \"/resources/{debits.source}\"\n }, \n \"meta\": {\n \"first\": \"/debits?limit=10&offset=0\", \n \"href\": \"/debits?limit=10&offset=0\", \n \"last\": \"/debits?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 4\n }\n}" - }, - "debit_show": { - "request": { - "uri": "/debits/WD2Fd3jVcMZEWyXHtG3U1LRM" - }, - "response": "{\n \"debits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*Statement text\", \n \"created_at\": \"2014-01-27T22:57:05.511023Z\", \n \"currency\": \"USD\", \n \"description\": \"Some descriptive text for the debit in the dashboard\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD2Fd3jVcMZEWyXHtG3U1LRM\", \n \"id\": \"WD2Fd3jVcMZEWyXHtG3U1LRM\", \n \"links\": {\n \"customer\": null, \n \"dispute\": null, \n \"order\": null, \n \"source\": \"CC2uc8iPDjgyxOXHVtnZloyI\"\n }, \n \"meta\": {}, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W906-153-1439\", \n \"updated_at\": \"2014-01-27T22:57:10.153696Z\"\n }\n ], \n \"links\": {\n \"debits.customer\": \"/customers/{debits.customer}\", \n \"debits.dispute\": \"/disputes/{debits.dispute}\", \n \"debits.events\": \"/debits/{debits.id}/events\", \n \"debits.order\": \"/orders/{debits.order}\", \n \"debits.refunds\": \"/debits/{debits.id}/refunds\", \n \"debits.source\": \"/resources/{debits.source}\"\n }\n}" - }, - "debit_update": { - "request": { - "payload": { - "description": "New description for debit", - "meta": { - "anykey": "valuegoeshere", - "facebook.id": "1234567890" - } - }, - "uri": "/debits/WD2Fd3jVcMZEWyXHtG3U1LRM" - }, - "response": "{\n \"debits\": [\n {\n \"amount\": 5000, \n \"appears_on_statement_as\": \"BAL*Statement text\", \n \"created_at\": \"2014-01-27T22:57:05.511023Z\", \n \"currency\": \"USD\", \n \"description\": \"New description for debit\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/debits/WD2Fd3jVcMZEWyXHtG3U1LRM\", \n \"id\": \"WD2Fd3jVcMZEWyXHtG3U1LRM\", \n \"links\": {\n \"customer\": null, \n \"dispute\": null, \n \"order\": null, \n \"source\": \"CC2uc8iPDjgyxOXHVtnZloyI\"\n }, \n \"meta\": {\n \"anykey\": \"valuegoeshere\", \n \"facebook.id\": \"1234567890\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"W906-153-1439\", \n \"updated_at\": \"2014-01-27T22:57:53.776191Z\"\n }\n ], \n \"links\": {\n \"debits.customer\": \"/customers/{debits.customer}\", \n \"debits.dispute\": \"/disputes/{debits.dispute}\", \n \"debits.events\": \"/debits/{debits.id}/events\", \n \"debits.order\": \"/orders/{debits.order}\", \n \"debits.refunds\": \"/debits/{debits.id}/refunds\", \n \"debits.source\": \"/resources/{debits.source}\"\n }\n}" - }, - "event_list": { - "request": { - "uri": "/events" - }, - "response": "{\n \"events\": [\n {\n \"callback_statuses\": {\n \"failed\": 0, \n \"pending\": 0, \n \"retrying\": 0, \n \"succeeded\": 0\n }, \n \"entity\": {\n \"customers\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:55:50.253066Z\", \n \"dob_month\": null, \n \"dob_year\": null, \n \"ein\": null, \n \"email\": null, \n \"href\": \"/customers/CU1iDnBalzHoZg47Np92rNrV\", \n \"id\": \"CU1iDnBalzHoZg47Np92rNrV\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"no-match\", \n \"meta\": {}, \n \"name\": null, \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:55:50.767858Z\"\n }\n ], \n \"links\": {\n \"customers.bank_accounts\": \"/customers/{customers.id}/bank_accounts\", \n \"customers.card_holds\": \"/customers/{customers.id}/card_holds\", \n \"customers.cards\": \"/customers/{customers.id}/cards\", \n \"customers.credits\": \"/customers/{customers.id}/credits\", \n \"customers.debits\": \"/customers/{customers.id}/debits\", \n \"customers.destination\": \"/resources/{customers.destination}\", \n \"customers.orders\": \"/customers/{customers.id}/orders\", \n \"customers.refunds\": \"/customers/{customers.id}/refunds\", \n \"customers.reversals\": \"/customers/{customers.id}/reversals\", \n \"customers.source\": \"/resources/{customers.source}\", \n \"customers.transactions\": \"/customers/{customers.id}/transactions\"\n }\n }, \n \"href\": \"/events/EV2abbb98487a611e3a86f026ba7d31e6f\", \n \"id\": \"EV2abbb98487a611e3a86f026ba7d31e6f\", \n \"links\": {}, \n \"occurred_at\": \"2014-01-27T22:55:50.767000Z\", \n \"type\": \"account.created\"\n }\n ], \n \"links\": {\n \"events.callbacks\": \"/events/{events.self}/callbacks\"\n }, \n \"meta\": {\n \"first\": \"/events?limit=10&offset=0\", \n \"href\": \"/events?limit=10&offset=0\", \n \"last\": \"/events?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 1\n }\n}" - }, - "event_show": { - "request": { - "uri": "/events/EV2abbb98487a611e3a86f026ba7d31e6f" - }, - "response": "{\n \"events\": [\n {\n \"callback_statuses\": {\n \"failed\": 0, \n \"pending\": 0, \n \"retrying\": 0, \n \"succeeded\": 0\n }, \n \"entity\": {\n \"customers\": [\n {\n \"address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"business_name\": null, \n \"created_at\": \"2014-01-27T22:55:50.253066Z\", \n \"dob_month\": null, \n \"dob_year\": null, \n \"ein\": null, \n \"email\": null, \n \"href\": \"/customers/CU1iDnBalzHoZg47Np92rNrV\", \n \"id\": \"CU1iDnBalzHoZg47Np92rNrV\", \n \"links\": {\n \"destination\": null, \n \"source\": null\n }, \n \"merchant_status\": \"no-match\", \n \"meta\": {}, \n \"name\": null, \n \"phone\": null, \n \"ssn_last4\": null, \n \"updated_at\": \"2014-01-27T22:55:50.767858Z\"\n }\n ], \n \"links\": {\n \"customers.bank_accounts\": \"/customers/{customers.id}/bank_accounts\", \n \"customers.card_holds\": \"/customers/{customers.id}/card_holds\", \n \"customers.cards\": \"/customers/{customers.id}/cards\", \n \"customers.credits\": \"/customers/{customers.id}/credits\", \n \"customers.debits\": \"/customers/{customers.id}/debits\", \n \"customers.destination\": \"/resources/{customers.destination}\", \n \"customers.orders\": \"/customers/{customers.id}/orders\", \n \"customers.refunds\": \"/customers/{customers.id}/refunds\", \n \"customers.reversals\": \"/customers/{customers.id}/reversals\", \n \"customers.source\": \"/resources/{customers.source}\", \n \"customers.transactions\": \"/customers/{customers.id}/transactions\"\n }\n }, \n \"href\": \"/events/EV2abbb98487a611e3a86f026ba7d31e6f\", \n \"id\": \"EV2abbb98487a611e3a86f026ba7d31e6f\", \n \"links\": {}, \n \"occurred_at\": \"2014-01-27T22:55:50.767000Z\", \n \"type\": \"account.created\"\n }\n ], \n \"links\": {\n \"events.callbacks\": \"/events/{events.self}/callbacks\"\n }\n}" - }, - "marketplace": { - "created_at": "2014-01-27T22:55:47.104898Z", - "domain_url": "example.com", - "href": "/marketplaces/TEST-MP1f3Hgx3WTYV6DhxJC7yR5Y", - "id": "TEST-MP1f3Hgx3WTYV6DhxJC7yR5Y", - "in_escrow": 0, - "links": { - "owner_customer": "CU1f8Ygc4t0F2FKNcw235x9I" - }, - "meta": {}, - "name": "Test Marketplace", - "production": false, - "support_email_address": "support@example.com", - "support_phone_number": "+16505551234", - "unsettled_fees": 0, - "updated_at": "2014-01-27T22:55:49.874263Z" - }, - "marketplace_id": "TEST-MP1f3Hgx3WTYV6DhxJC7yR5Y", - "marketplace_uri": "/marketplaces/TEST-MP1f3Hgx3WTYV6DhxJC7yR5Y", - "order_create": { - "request": { - "customer_href": "/customers/CU3eeasZ9yQ86uzzIYZkrPGg", - "payload": { - "description": "Order #12341234" - }, - "uri": "/customers/CU3eeasZ9yQ86uzzIYZkrPGg/orders" - }, - "response": "{\n \"links\": {\n \"orders.buyers\": \"/orders/{orders.id}/buyers\", \n \"orders.credits\": \"/orders/{orders.id}/credits\", \n \"orders.debits\": \"/orders/{orders.id}/debits\", \n \"orders.merchant\": \"/customers/{orders.merchant}\", \n \"orders.refunds\": \"/orders/{orders.id}/refunds\", \n \"orders.reversals\": \"/orders/{orders.id}/reversals\"\n }, \n \"orders\": [\n {\n \"amount\": 0, \n \"amount_escrowed\": 0, \n \"created_at\": \"2014-01-27T22:58:01.115720Z\", \n \"currency\": \"USD\", \n \"delivery_address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"description\": \"Order #12341234\", \n \"href\": \"/orders/OR3FOihZa7lMHdAP5p8BJZVY\", \n \"id\": \"OR3FOihZa7lMHdAP5p8BJZVY\", \n \"links\": {\n \"merchant\": \"CU3eeasZ9yQ86uzzIYZkrPGg\"\n }, \n \"meta\": {}, \n \"updated_at\": \"2014-01-27T22:58:01.115723Z\"\n }\n ]\n}" - }, - "order_list": { - "request": { - "uri": "/orders" - }, - "response": "{\n \"links\": {\n \"orders.buyers\": \"/orders/{orders.id}/buyers\", \n \"orders.credits\": \"/orders/{orders.id}/credits\", \n \"orders.debits\": \"/orders/{orders.id}/debits\", \n \"orders.merchant\": \"/customers/{orders.merchant}\", \n \"orders.refunds\": \"/orders/{orders.id}/refunds\", \n \"orders.reversals\": \"/orders/{orders.id}/reversals\"\n }, \n \"meta\": {\n \"first\": \"/orders?limit=10&offset=0\", \n \"href\": \"/orders?limit=10&offset=0\", \n \"last\": \"/orders?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 1\n }, \n \"orders\": [\n {\n \"amount\": 0, \n \"amount_escrowed\": 0, \n \"created_at\": \"2014-01-27T22:58:01.115720Z\", \n \"currency\": \"USD\", \n \"delivery_address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"description\": \"Order #12341234\", \n \"href\": \"/orders/OR3FOihZa7lMHdAP5p8BJZVY\", \n \"id\": \"OR3FOihZa7lMHdAP5p8BJZVY\", \n \"links\": {\n \"merchant\": \"CU3eeasZ9yQ86uzzIYZkrPGg\"\n }, \n \"meta\": {}, \n \"updated_at\": \"2014-01-27T22:58:01.115723Z\"\n }\n ]\n}" - }, - "order_show": { - "request": { - "uri": "/orders/OR3FOihZa7lMHdAP5p8BJZVY" - }, - "response": "{\n \"links\": {\n \"orders.buyers\": \"/orders/{orders.id}/buyers\", \n \"orders.credits\": \"/orders/{orders.id}/credits\", \n \"orders.debits\": \"/orders/{orders.id}/debits\", \n \"orders.merchant\": \"/customers/{orders.merchant}\", \n \"orders.refunds\": \"/orders/{orders.id}/refunds\", \n \"orders.reversals\": \"/orders/{orders.id}/reversals\"\n }, \n \"orders\": [\n {\n \"amount\": 0, \n \"amount_escrowed\": 0, \n \"created_at\": \"2014-01-27T22:58:01.115720Z\", \n \"currency\": \"USD\", \n \"delivery_address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"description\": \"Order #12341234\", \n \"href\": \"/orders/OR3FOihZa7lMHdAP5p8BJZVY\", \n \"id\": \"OR3FOihZa7lMHdAP5p8BJZVY\", \n \"links\": {\n \"merchant\": \"CU3eeasZ9yQ86uzzIYZkrPGg\"\n }, \n \"meta\": {}, \n \"updated_at\": \"2014-01-27T22:58:01.115723Z\"\n }\n ]\n}" - }, - "order_update": { - "request": { - "payload": { - "description": "New description for order", - "meta": { - "anykey": "valuegoeshere", - "product.id": "1234567890" - } - }, - "uri": "/orders/OR3FOihZa7lMHdAP5p8BJZVY" - }, - "response": "{\n \"links\": {\n \"orders.buyers\": \"/orders/{orders.id}/buyers\", \n \"orders.credits\": \"/orders/{orders.id}/credits\", \n \"orders.debits\": \"/orders/{orders.id}/debits\", \n \"orders.merchant\": \"/customers/{orders.merchant}\", \n \"orders.refunds\": \"/orders/{orders.id}/refunds\", \n \"orders.reversals\": \"/orders/{orders.id}/reversals\"\n }, \n \"orders\": [\n {\n \"amount\": 0, \n \"amount_escrowed\": 0, \n \"created_at\": \"2014-01-27T22:58:01.115720Z\", \n \"currency\": \"USD\", \n \"delivery_address\": {\n \"city\": null, \n \"country_code\": null, \n \"line1\": null, \n \"line2\": null, \n \"postal_code\": null, \n \"state\": null\n }, \n \"description\": \"New description for order\", \n \"href\": \"/orders/OR3FOihZa7lMHdAP5p8BJZVY\", \n \"id\": \"OR3FOihZa7lMHdAP5p8BJZVY\", \n \"links\": {\n \"merchant\": \"CU3eeasZ9yQ86uzzIYZkrPGg\"\n }, \n \"meta\": {\n \"anykey\": \"valuegoeshere\", \n \"product.id\": \"1234567890\"\n }, \n \"updated_at\": \"2014-01-27T22:58:05.657463Z\"\n }\n ]\n}" - }, - "refund_create": { - "request": { - "debit_href": "/debits/WD3MKNxNTKBGgA7mX50yogiu", - "payload": { - "amount": 3000, - "description": "Refund for Order #1111", - "meta": { - "fulfillment.item.condition": "OK", - "merchant.feedback": "positive", - "user.refund_reason": "not happy with product" - } - }, - "uri": "/debits/WD3MKNxNTKBGgA7mX50yogiu/refunds" - }, - "response": "{\n \"links\": {\n \"refunds.debit\": \"/debits/{refunds.debit}\", \n \"refunds.dispute\": \"/disputes/{refunds.dispute}\", \n \"refunds.events\": \"/refunds/{refunds.id}/events\", \n \"refunds.order\": \"/orders/{refunds.order}\"\n }, \n \"refunds\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:11.375665Z\", \n \"currency\": \"USD\", \n \"description\": \"Refund for Order #1111\", \n \"href\": \"/refunds/RF3RklPuFgsgI50UuYtr4g6I\", \n \"id\": \"RF3RklPuFgsgI50UuYtr4g6I\", \n \"links\": {\n \"debit\": \"WD3MKNxNTKBGgA7mX50yogiu\", \n \"dispute\": null, \n \"order\": null\n }, \n \"meta\": {\n \"fulfillment.item.condition\": \"OK\", \n \"merchant.feedback\": \"positive\", \n \"user.refund_reason\": \"not happy with product\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RF383-088-7077\", \n \"updated_at\": \"2014-01-27T22:58:12.115131Z\"\n }\n ]\n}" - }, - "refund_list": { - "request": { - "uri": "/refunds" - }, - "response": "{\n \"links\": {\n \"refunds.debit\": \"/debits/{refunds.debit}\", \n \"refunds.dispute\": \"/disputes/{refunds.dispute}\", \n \"refunds.events\": \"/refunds/{refunds.id}/events\", \n \"refunds.order\": \"/orders/{refunds.order}\"\n }, \n \"meta\": {\n \"first\": \"/refunds?limit=10&offset=0\", \n \"href\": \"/refunds?limit=10&offset=0\", \n \"last\": \"/refunds?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 1\n }, \n \"refunds\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:11.375665Z\", \n \"currency\": \"USD\", \n \"description\": \"Refund for Order #1111\", \n \"href\": \"/refunds/RF3RklPuFgsgI50UuYtr4g6I\", \n \"id\": \"RF3RklPuFgsgI50UuYtr4g6I\", \n \"links\": {\n \"debit\": \"WD3MKNxNTKBGgA7mX50yogiu\", \n \"dispute\": null, \n \"order\": null\n }, \n \"meta\": {\n \"fulfillment.item.condition\": \"OK\", \n \"merchant.feedback\": \"positive\", \n \"user.refund_reason\": \"not happy with product\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RF383-088-7077\", \n \"updated_at\": \"2014-01-27T22:58:12.115131Z\"\n }\n ]\n}" - }, - "refund_show": { - "request": { - "uri": "/refunds/RF3RklPuFgsgI50UuYtr4g6I" - }, - "response": "{\n \"links\": {\n \"refunds.debit\": \"/debits/{refunds.debit}\", \n \"refunds.dispute\": \"/disputes/{refunds.dispute}\", \n \"refunds.events\": \"/refunds/{refunds.id}/events\", \n \"refunds.order\": \"/orders/{refunds.order}\"\n }, \n \"refunds\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:11.375665Z\", \n \"currency\": \"USD\", \n \"description\": \"Refund for Order #1111\", \n \"href\": \"/refunds/RF3RklPuFgsgI50UuYtr4g6I\", \n \"id\": \"RF3RklPuFgsgI50UuYtr4g6I\", \n \"links\": {\n \"debit\": \"WD3MKNxNTKBGgA7mX50yogiu\", \n \"dispute\": null, \n \"order\": null\n }, \n \"meta\": {\n \"fulfillment.item.condition\": \"OK\", \n \"merchant.feedback\": \"positive\", \n \"user.refund_reason\": \"not happy with product\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RF383-088-7077\", \n \"updated_at\": \"2014-01-27T22:58:12.115131Z\"\n }\n ]\n}" - }, - "refund_update": { - "request": { - "payload": { - "description": "update this description", - "meta": { - "refund.reason": "user not happy with product", - "user.notes": "very polite on the phone", - "user.refund.count": "3" - } - }, - "uri": "/refunds/RF3RklPuFgsgI50UuYtr4g6I" - }, - "response": "{\n \"links\": {\n \"refunds.debit\": \"/debits/{refunds.debit}\", \n \"refunds.dispute\": \"/disputes/{refunds.dispute}\", \n \"refunds.events\": \"/refunds/{refunds.id}/events\", \n \"refunds.order\": \"/orders/{refunds.order}\"\n }, \n \"refunds\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:11.375665Z\", \n \"currency\": \"USD\", \n \"description\": \"update this description\", \n \"href\": \"/refunds/RF3RklPuFgsgI50UuYtr4g6I\", \n \"id\": \"RF3RklPuFgsgI50UuYtr4g6I\", \n \"links\": {\n \"debit\": \"WD3MKNxNTKBGgA7mX50yogiu\", \n \"dispute\": null, \n \"order\": null\n }, \n \"meta\": {\n \"refund.reason\": \"user not happy with product\", \n \"user.notes\": \"very polite on the phone\", \n \"user.refund.count\": \"3\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RF383-088-7077\", \n \"updated_at\": \"2014-01-27T22:58:17.950799Z\"\n }\n ]\n}" - }, - "reversal_create": { - "request": { - "credit_href": "/credits/CR40neytmVG2HDBp1opfF7sY", - "payload": { - "amount": 3000, - "description": "Reversal for Order #1111", - "meta": { - "fulfillment.item.condition": "OK", - "merchant.feedback": "positive", - "user.refund_reason": "not happy with product" - } - }, - "uri": "/credits/CR40neytmVG2HDBp1opfF7sY/reversals" - }, - "response": "{\n \"links\": {\n \"reversals.credit\": \"/credits/{reversals.credit}\", \n \"reversals.events\": \"/reversals/{reversals.id}/events\", \n \"reversals.order\": \"/orders/{reversals.order}\"\n }, \n \"reversals\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:21.214829Z\", \n \"currency\": \"USD\", \n \"description\": \"Reversal for Order #1111\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/reversals/RV42n8M9XZWna427oPDDi4RG\", \n \"id\": \"RV42n8M9XZWna427oPDDi4RG\", \n \"links\": {\n \"credit\": \"CR40neytmVG2HDBp1opfF7sY\", \n \"order\": null\n }, \n \"meta\": {\n \"fulfillment.item.condition\": \"OK\", \n \"merchant.feedback\": \"positive\", \n \"user.refund_reason\": \"not happy with product\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RV219-169-0008\", \n \"updated_at\": \"2014-01-27T22:58:22.190749Z\"\n }\n ]\n}" - }, - "reversal_list": { - "request": { - "uri": "/reversals" - }, - "response": "{\n \"links\": {\n \"reversals.credit\": \"/credits/{reversals.credit}\", \n \"reversals.events\": \"/reversals/{reversals.id}/events\", \n \"reversals.order\": \"/orders/{reversals.order}\"\n }, \n \"meta\": {\n \"first\": \"/reversals?limit=10&offset=0\", \n \"href\": \"/reversals?limit=10&offset=0\", \n \"last\": \"/reversals?limit=10&offset=0\", \n \"limit\": 10, \n \"next\": null, \n \"offset\": 0, \n \"previous\": null, \n \"total\": 1\n }, \n \"reversals\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:21.214829Z\", \n \"currency\": \"USD\", \n \"description\": \"Reversal for Order #1111\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/reversals/RV42n8M9XZWna427oPDDi4RG\", \n \"id\": \"RV42n8M9XZWna427oPDDi4RG\", \n \"links\": {\n \"credit\": \"CR40neytmVG2HDBp1opfF7sY\", \n \"order\": null\n }, \n \"meta\": {\n \"fulfillment.item.condition\": \"OK\", \n \"merchant.feedback\": \"positive\", \n \"user.refund_reason\": \"not happy with product\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RV219-169-0008\", \n \"updated_at\": \"2014-01-27T22:58:22.190749Z\"\n }\n ]\n}" - }, - "reversal_show": { - "request": { - "uri": "/reversals/RV42n8M9XZWna427oPDDi4RG" - }, - "response": "{\n \"links\": {\n \"reversals.credit\": \"/credits/{reversals.credit}\", \n \"reversals.events\": \"/reversals/{reversals.id}/events\", \n \"reversals.order\": \"/orders/{reversals.order}\"\n }, \n \"reversals\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:21.214829Z\", \n \"currency\": \"USD\", \n \"description\": \"Reversal for Order #1111\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/reversals/RV42n8M9XZWna427oPDDi4RG\", \n \"id\": \"RV42n8M9XZWna427oPDDi4RG\", \n \"links\": {\n \"credit\": \"CR40neytmVG2HDBp1opfF7sY\", \n \"order\": null\n }, \n \"meta\": {\n \"fulfillment.item.condition\": \"OK\", \n \"merchant.feedback\": \"positive\", \n \"user.refund_reason\": \"not happy with product\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RV219-169-0008\", \n \"updated_at\": \"2014-01-27T22:58:22.190749Z\"\n }\n ]\n}" - }, - "reversal_update": { - "request": { - "payload": { - "description": "update this description", - "meta": { - "refund.reason": "user not happy with product", - "user.notes": "very polite on the phone", - "user.satisfaction": "6" - } - }, - "uri": "/reversals/RV42n8M9XZWna427oPDDi4RG" - }, - "response": "{\n \"links\": {\n \"reversals.credit\": \"/credits/{reversals.credit}\", \n \"reversals.events\": \"/reversals/{reversals.id}/events\", \n \"reversals.order\": \"/orders/{reversals.order}\"\n }, \n \"reversals\": [\n {\n \"amount\": 3000, \n \"created_at\": \"2014-01-27T22:58:21.214829Z\", \n \"currency\": \"USD\", \n \"description\": \"update this description\", \n \"failure_reason\": null, \n \"failure_reason_code\": null, \n \"href\": \"/reversals/RV42n8M9XZWna427oPDDi4RG\", \n \"id\": \"RV42n8M9XZWna427oPDDi4RG\", \n \"links\": {\n \"credit\": \"CR40neytmVG2HDBp1opfF7sY\", \n \"order\": null\n }, \n \"meta\": {\n \"refund.reason\": \"user not happy with product\", \n \"user.notes\": \"very polite on the phone\", \n \"user.satisfaction\": \"6\"\n }, \n \"status\": \"succeeded\", \n \"transaction_number\": \"RV219-169-0008\", \n \"updated_at\": \"2014-01-27T22:58:27.354488Z\"\n }\n ]\n}" - }, - "secret": "ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc" -} \ No newline at end of file diff --git a/scenarios/_mj/api_key_create/executable.py b/scenarios/_mj/api_key_create/executable.py index 0a8a0f4..4295a5a 100644 --- a/scenarios/_mj/api_key_create/executable.py +++ b/scenarios/_mj/api_key_create/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') api_key = balanced.APIKey() api_key.save() \ No newline at end of file diff --git a/scenarios/_mj/api_key_create/python.mako b/scenarios/_mj/api_key_create/python.mako index f6fc6ce..ecd59c2 100644 --- a/scenarios/_mj/api_key_create/python.mako +++ b/scenarios/_mj/api_key_create/python.mako @@ -4,10 +4,10 @@ balanced.APIKey % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') api_key = balanced.APIKey() api_key.save() % elif mode == 'response': -APIKey(links={}, created_at=u'2014-01-27T22:56:01.641736Z', secret=u'ak-test-1jlJCdGZjRWWYRF1iLBR69xwqG2NdQifv', href=u'/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c', meta={}, id=u'AK1vqjn1eEHXP0JYXrBrjH5c') +APIKey(links={}, created_at=u'2015-01-09T03:23:00.061959Z', secret=u'ak-test-2i4j501b699lmRiGiCcIg45CM0bBI0JAQ', href=u'/api_keys/AK3DQGzROuoRYulKXMQdHBxX', meta={}, id=u'AK3DQGzROuoRYulKXMQdHBxX') % endif \ No newline at end of file diff --git a/scenarios/account_credit/definition.mako b/scenarios/account_credit/definition.mako new file mode 100644 index 0000000..08eadf0 --- /dev/null +++ b/scenarios/account_credit/definition.mako @@ -0,0 +1 @@ +balanced.Account.credit() \ No newline at end of file diff --git a/scenarios/account_credit/executable.py b/scenarios/account_credit/executable.py new file mode 100644 index 0000000..c832bbd --- /dev/null +++ b/scenarios/account_credit/executable.py @@ -0,0 +1,14 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +payable_account = balanced.Account.fetch('/accounts/AT3ogJE07IErLJYR510QO6sM') +payable_account.credit( + appears_on_statement_as='ThingsCo', + amount=1000, + description='A simple credit', + order='/orders/OR3vURGwVtqDnnkRS9fgH41G', + meta={ + 'rating': '8' + } +) \ No newline at end of file diff --git a/scenarios/account_credit/python.mako b/scenarios/account_credit/python.mako new file mode 100644 index 0000000..c2d2fa3 --- /dev/null +++ b/scenarios/account_credit/python.mako @@ -0,0 +1,20 @@ +% if mode == 'definition': +balanced.Account.credit() +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +payable_account = balanced.Account.fetch('/accounts/AT3ogJE07IErLJYR510QO6sM') +payable_account.credit( + appears_on_statement_as='ThingsCo', + amount=1000, + description='A simple credit', + order='/orders/OR3vURGwVtqDnnkRS9fgH41G', + meta={ + 'rating': '8' + } +) +% elif mode == 'response': +Credit(status=u'succeeded', description=u'A simple credit', links={u'customer': u'CU3o1ZAd8Gtxz6ZTIFK9YmsM', u'destination': u'AT3ogJE07IErLJYR510QO6sM', u'order': u'OR3vURGwVtqDnnkRS9fgH41G'}, amount=1000, created_at=u'2015-01-09T03:22:56.285894Z', updated_at=u'2015-01-09T03:22:56.407717Z', failure_reason=None, currency=u'USD', transaction_number=u'CRMJJ-XQI-MUMX', href=u'/credits/CR3zAL8gnvuDGGTqr1UqehlS', meta={u'rating': u'8'}, failure_reason_code=None, appears_on_statement_as=u'ThingsCo', id=u'CR3zAL8gnvuDGGTqr1UqehlS') +% endif \ No newline at end of file diff --git a/scenarios/account_credit/request.mako b/scenarios/account_credit/request.mako new file mode 100644 index 0000000..e251c32 --- /dev/null +++ b/scenarios/account_credit/request.mako @@ -0,0 +1,13 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +payable_account = balanced.Account.fetch('${request['href']}') +payable_account.credit( + appears_on_statement_as='${request['payload']['appears_on_statement_as']}', + amount=${request['payload']['amount']}, + description='${request['payload']['description']}', + order='${request['payload']['order']}', + meta={ + 'rating': '${request['payload']['meta']['rating']}' + } +) \ No newline at end of file diff --git a/scenarios/account_list/definition.mako b/scenarios/account_list/definition.mako new file mode 100644 index 0000000..19b3dfe --- /dev/null +++ b/scenarios/account_list/definition.mako @@ -0,0 +1 @@ +balanced.Account.query diff --git a/scenarios/account_list/executable.py b/scenarios/account_list/executable.py new file mode 100644 index 0000000..f45e35d --- /dev/null +++ b/scenarios/account_list/executable.py @@ -0,0 +1,5 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +accounts = balanced.Account.query \ No newline at end of file diff --git a/scenarios/account_list/python.mako b/scenarios/account_list/python.mako new file mode 100644 index 0000000..d042f18 --- /dev/null +++ b/scenarios/account_list/python.mako @@ -0,0 +1,12 @@ +% if mode == 'definition': +balanced.Account.query + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +accounts = balanced.Account.query +% elif mode == 'response': + +% endif \ No newline at end of file diff --git a/scenarios/account_list/request.mako b/scenarios/account_list/request.mako new file mode 100644 index 0000000..41d29a7 --- /dev/null +++ b/scenarios/account_list/request.mako @@ -0,0 +1,4 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +accounts = balanced.Account.query \ No newline at end of file diff --git a/scenarios/account_list_customer/definition.mako b/scenarios/account_list_customer/definition.mako new file mode 100644 index 0000000..19b3dfe --- /dev/null +++ b/scenarios/account_list_customer/definition.mako @@ -0,0 +1 @@ +balanced.Account.query diff --git a/scenarios/account_list_customer/executable.py b/scenarios/account_list_customer/executable.py new file mode 100644 index 0000000..1bcc290 --- /dev/null +++ b/scenarios/account_list_customer/executable.py @@ -0,0 +1,6 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +customer = balanced.Customer.fetch('/customers/CU3o1ZAd8Gtxz6ZTIFK9YmsM') +customer.accounts \ No newline at end of file diff --git a/scenarios/account_list_customer/python.mako b/scenarios/account_list_customer/python.mako new file mode 100644 index 0000000..9c6ecbc --- /dev/null +++ b/scenarios/account_list_customer/python.mako @@ -0,0 +1,13 @@ +% if mode == 'definition': +balanced.Account.query + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +customer = balanced.Customer.fetch('/customers/CU3o1ZAd8Gtxz6ZTIFK9YmsM') +customer.accounts +% elif mode == 'response': + +% endif \ No newline at end of file diff --git a/scenarios/account_list_customer/request.mako b/scenarios/account_list_customer/request.mako new file mode 100644 index 0000000..e3e2227 --- /dev/null +++ b/scenarios/account_list_customer/request.mako @@ -0,0 +1,5 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +customer = balanced.Customer.fetch('${request['customer_href']}') +customer.accounts \ No newline at end of file diff --git a/scenarios/account_show/definition.mako b/scenarios/account_show/definition.mako new file mode 100644 index 0000000..ddf0947 --- /dev/null +++ b/scenarios/account_show/definition.mako @@ -0,0 +1 @@ +balanced.Account.fetch() diff --git a/scenarios/account_show/executable.py b/scenarios/account_show/executable.py new file mode 100644 index 0000000..237e2de --- /dev/null +++ b/scenarios/account_show/executable.py @@ -0,0 +1,5 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +account = balanced.Account.fetch('/accounts/AT2V7l4MoUJH8xDse641Xqog') \ No newline at end of file diff --git a/scenarios/account_show/python.mako b/scenarios/account_show/python.mako new file mode 100644 index 0000000..c0b1833 --- /dev/null +++ b/scenarios/account_show/python.mako @@ -0,0 +1,12 @@ +% if mode == 'definition': +balanced.Account.fetch() + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +account = balanced.Account.fetch('/accounts/AT2V7l4MoUJH8xDse641Xqog') +% elif mode == 'response': +Account(links={u'customer': u'CU2V0zJeFwPUCzJsaK48Ly3S'}, can_credit=True, can_debit=True, created_at=u'2015-01-09T03:22:20.308375Z', updated_at=u'2015-01-09T03:22:20.308376Z', currency=u'USD', href=u'/accounts/AT2V7l4MoUJH8xDse641Xqog', meta={}, balance=0, type=u'payable', id=u'AT2V7l4MoUJH8xDse641Xqog') +% endif \ No newline at end of file diff --git a/scenarios/account_show/request.mako b/scenarios/account_show/request.mako new file mode 100644 index 0000000..ac0e000 --- /dev/null +++ b/scenarios/account_show/request.mako @@ -0,0 +1,4 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +account = balanced.Account.fetch('${request['uri']}') \ No newline at end of file diff --git a/scenarios/api_key_create/executable.py b/scenarios/api_key_create/executable.py index a5a5c83..4b934a1 100644 --- a/scenarios/api_key_create/executable.py +++ b/scenarios/api_key_create/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') api_key = balanced.APIKey().save() \ No newline at end of file diff --git a/scenarios/api_key_create/python.mako b/scenarios/api_key_create/python.mako index 934376e..d50a576 100644 --- a/scenarios/api_key_create/python.mako +++ b/scenarios/api_key_create/python.mako @@ -3,9 +3,9 @@ balanced.APIKey() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') api_key = balanced.APIKey().save() % elif mode == 'response': -APIKey(links={}, created_at=u'2014-01-27T22:56:01.641736Z', secret=u'ak-test-1jlJCdGZjRWWYRF1iLBR69xwqG2NdQifv', href=u'/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c', meta={}, id=u'AK1vqjn1eEHXP0JYXrBrjH5c') +APIKey(links={}, created_at=u'2015-01-09T03:23:00.061959Z', secret=u'ak-test-2i4j501b699lmRiGiCcIg45CM0bBI0JAQ', href=u'/api_keys/AK3DQGzROuoRYulKXMQdHBxX', meta={}, id=u'AK3DQGzROuoRYulKXMQdHBxX') % endif \ No newline at end of file diff --git a/scenarios/api_key_delete/executable.py b/scenarios/api_key_delete/executable.py index 89746cc..f726841 100644 --- a/scenarios/api_key_delete/executable.py +++ b/scenarios/api_key_delete/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -key = balanced.APIKey.fetch('/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c') +key = balanced.APIKey.fetch('/api_keys/AK3DQGzROuoRYulKXMQdHBxX') key.delete() \ No newline at end of file diff --git a/scenarios/api_key_delete/python.mako b/scenarios/api_key_delete/python.mako index a633eb4..5bf8c9f 100644 --- a/scenarios/api_key_delete/python.mako +++ b/scenarios/api_key_delete/python.mako @@ -3,9 +3,9 @@ balanced.APIKey().delete() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -key = balanced.APIKey.fetch('/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c') +key = balanced.APIKey.fetch('/api_keys/AK3DQGzROuoRYulKXMQdHBxX') key.delete() % elif mode == 'response': diff --git a/scenarios/api_key_list/executable.py b/scenarios/api_key_list/executable.py index 10a9711..84c6874 100644 --- a/scenarios/api_key_list/executable.py +++ b/scenarios/api_key_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') keys = balanced.APIKey.query \ No newline at end of file diff --git a/scenarios/api_key_list/python.mako b/scenarios/api_key_list/python.mako index 2dc1a09..b5c9132 100644 --- a/scenarios/api_key_list/python.mako +++ b/scenarios/api_key_list/python.mako @@ -4,7 +4,7 @@ balanced.APIKey.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') keys = balanced.APIKey.query % elif mode == 'response': diff --git a/scenarios/api_key_show/executable.py b/scenarios/api_key_show/executable.py index 5d4fa07..50596bf 100644 --- a/scenarios/api_key_show/executable.py +++ b/scenarios/api_key_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -key = balanced.APIKey.fetch('/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c') \ No newline at end of file +key = balanced.APIKey.fetch('/api_keys/AK3DQGzROuoRYulKXMQdHBxX') \ No newline at end of file diff --git a/scenarios/api_key_show/python.mako b/scenarios/api_key_show/python.mako index c66c281..41a278d 100644 --- a/scenarios/api_key_show/python.mako +++ b/scenarios/api_key_show/python.mako @@ -4,9 +4,9 @@ balanced.APIKey.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -key = balanced.APIKey.fetch('/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c') +key = balanced.APIKey.fetch('/api_keys/AK3DQGzROuoRYulKXMQdHBxX') % elif mode == 'response': -APIKey(created_at=u'2014-01-27T22:56:01.641736Z', href=u'/api_keys/AK1vqjn1eEHXP0JYXrBrjH5c', meta={}, id=u'AK1vqjn1eEHXP0JYXrBrjH5c', links={}) +APIKey(created_at=u'2015-01-09T03:23:00.061959Z', href=u'/api_keys/AK3DQGzROuoRYulKXMQdHBxX', meta={}, id=u'AK3DQGzROuoRYulKXMQdHBxX', links={}) % endif \ No newline at end of file diff --git a/scenarios/bank_account_associate_to_customer/definition.mako b/scenarios/bank_account_associate_to_customer/definition.mako index 2090176..e04424c 100644 --- a/scenarios/bank_account_associate_to_customer/definition.mako +++ b/scenarios/bank_account_associate_to_customer/definition.mako @@ -1 +1 @@ -balanced.Card().associate_to_customer() \ No newline at end of file +balanced.BankAccount().associate_to_customer() \ No newline at end of file diff --git a/scenarios/bank_account_associate_to_customer/executable.py b/scenarios/bank_account_associate_to_customer/executable.py index ecb5f3d..56ac6eb 100644 --- a/scenarios/bank_account_associate_to_customer/executable.py +++ b/scenarios/bank_account_associate_to_customer/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0') -card.associate_to_customer('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') \ No newline at end of file +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN') +bank_account.associate_to_customer('/customers/CU3o1ZAd8Gtxz6ZTIFK9YmsM') \ No newline at end of file diff --git a/scenarios/bank_account_associate_to_customer/python.mako b/scenarios/bank_account_associate_to_customer/python.mako index 220c5f8..e2ed620 100644 --- a/scenarios/bank_account_associate_to_customer/python.mako +++ b/scenarios/bank_account_associate_to_customer/python.mako @@ -1,12 +1,12 @@ % if mode == 'definition': -balanced.Card().associate_to_customer() +balanced.BankAccount().associate_to_customer() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0') -card.associate_to_customer('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN') +bank_account.associate_to_customer('/customers/CU3o1ZAd8Gtxz6ZTIFK9YmsM') % elif mode == 'response': -BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': u'CU3eeasZ9yQ86uzzIYZkrPGg', u'bank_account_verification': None}, can_credit=True, created_at=u'2014-01-27T22:57:47.772481Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2014-01-27T22:57:48.515195Z', href=u'/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0', meta={}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA3qNbYRqFM0Q7MXn3IcjGl0') +BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': u'CU3o1ZAd8Gtxz6ZTIFK9YmsM', u'bank_account_verification': None}, can_credit=True, created_at=u'2015-01-09T03:23:24.352488Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2015-01-09T03:23:25.100561Z', href=u'/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN', meta={}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA45anEaEr8g0lOhzhcE9VAN') % endif \ No newline at end of file diff --git a/scenarios/bank_account_associate_to_customer/request.mako b/scenarios/bank_account_associate_to_customer/request.mako index 71ec07b..bafa956 100644 --- a/scenarios/bank_account_associate_to_customer/request.mako +++ b/scenarios/bank_account_associate_to_customer/request.mako @@ -1,5 +1,5 @@ <%namespace file='/_main.mako' name='main'/> <% main.python_boilerplate() %> -card = balanced.Card.fetch('${request['uri']}') -card.associate_to_customer('${request['payload']['customer']}') \ No newline at end of file +bank_account = balanced.BankAccount.fetch('${request['uri']}') +bank_account.associate_to_customer('${request['payload']['customer']}') \ No newline at end of file diff --git a/scenarios/bank_account_create/executable.py b/scenarios/bank_account_create/executable.py index 14ea833..2fd0e6a 100644 --- a/scenarios/bank_account_create/executable.py +++ b/scenarios/bank_account_create/executable.py @@ -1,10 +1,10 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') bank_account = balanced.BankAccount( routing_number='121000358', - type='checking', + account_type='checking', account_number='9900000001', name='Johann Bernoulli' ).save() \ No newline at end of file diff --git a/scenarios/bank_account_create/python.mako b/scenarios/bank_account_create/python.mako index be7eb69..383873d 100644 --- a/scenarios/bank_account_create/python.mako +++ b/scenarios/bank_account_create/python.mako @@ -3,14 +3,14 @@ balanced.BankAccount().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') bank_account = balanced.BankAccount( routing_number='121000358', - type='checking', + account_type='checking', account_number='9900000001', name='Johann Bernoulli' ).save() % elif mode == 'response': -BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': None, u'bank_account_verification': None}, can_credit=True, created_at=u'2014-01-27T22:57:47.772481Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2014-01-27T22:57:47.772483Z', href=u'/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0', meta={}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA3qNbYRqFM0Q7MXn3IcjGl0') +BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': None, u'bank_account_verification': None}, can_credit=True, created_at=u'2015-01-09T03:23:24.352488Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2015-01-09T03:23:24.352490Z', href=u'/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN', meta={}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA45anEaEr8g0lOhzhcE9VAN') % endif \ No newline at end of file diff --git a/scenarios/bank_account_credit/executable.py b/scenarios/bank_account_credit/executable.py index 55283b2..6231551 100644 --- a/scenarios/bank_account_credit/executable.py +++ b/scenarios/bank_account_credit/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN') bank_account.credit( amount=5000 ) \ No newline at end of file diff --git a/scenarios/bank_account_credit/python.mako b/scenarios/bank_account_credit/python.mako index d5fd23b..c6abea0 100644 --- a/scenarios/bank_account_credit/python.mako +++ b/scenarios/bank_account_credit/python.mako @@ -3,12 +3,12 @@ balanced.BankAccount().credit() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3qNbYRqFM0Q7MXn3IcjGl0') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN') bank_account.credit( amount=5000 ) % elif mode == 'response': -Credit(status=u'succeeded', description=None, links={u'customer': u'CU3eeasZ9yQ86uzzIYZkrPGg', u'destination': u'BA3qNbYRqFM0Q7MXn3IcjGl0', u'order': None}, amount=5000, created_at=u'2014-01-27T22:58:19.422292Z', updated_at=u'2014-01-27T22:58:20.346871Z', failure_reason=None, currency=u'USD', transaction_number=u'CR816-868-3666', href=u'/credits/CR40neytmVG2HDBp1opfF7sY', meta={}, failure_reason_code=None, appears_on_statement_as=u'example.com', id=u'CR40neytmVG2HDBp1opfF7sY') +Credit(status=u'pending', description=None, links={u'customer': u'CU3o1ZAd8Gtxz6ZTIFK9YmsM', u'destination': u'BA45anEaEr8g0lOhzhcE9VAN', u'order': None}, amount=5000, created_at=u'2015-01-09T03:25:41.350099Z', updated_at=u'2015-01-09T03:25:41.727056Z', failure_reason=None, currency=u'USD', transaction_number=u'CR6XX-6KR-7GSZ', href=u'/credits/CR6zeufmfv0u1KHrUBCQtAgU', meta={}, failure_reason_code=None, appears_on_statement_as=u'example.com', id=u'CR6zeufmfv0u1KHrUBCQtAgU') % endif \ No newline at end of file diff --git a/scenarios/bank_account_debit/executable.py b/scenarios/bank_account_debit/executable.py index 6c3d98b..e69de29 100644 --- a/scenarios/bank_account_debit/executable.py +++ b/scenarios/bank_account_debit/executable.py @@ -1,10 +0,0 @@ -import balanced - -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') - -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S') -bank_account.debit( - appears_on_statement_as='Statement text', - amount=5000, - description='Some descriptive text for the debit in the dashboard' -) \ No newline at end of file diff --git a/scenarios/bank_account_debit/python.mako b/scenarios/bank_account_debit/python.mako index 7b054e1..a0f10b5 100644 --- a/scenarios/bank_account_debit/python.mako +++ b/scenarios/bank_account_debit/python.mako @@ -1,16 +1,7 @@ % if mode == 'definition': balanced.BankAccount().debit() % elif mode == 'request': -import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') - -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S') -bank_account.debit( - appears_on_statement_as='Statement text', - amount=5000, - description='Some descriptive text for the debit in the dashboard' -) % elif mode == 'response': -Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': None, u'source': u'BA1D3vL3LjasB0kewMqRGI0S', u'order': None, u'dispute': None}, amount=5000, created_at=u'2014-01-27T22:56:28.702119Z', updated_at=u'2014-01-27T22:56:29.235927Z', failure_reason=None, currency=u'USD', transaction_number=u'W081-463-7557', href=u'/debits/WD1ZRRAZnFTryFdFaq7ijcPE', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD1ZRRAZnFTryFdFaq7ijcPE') + % endif \ No newline at end of file diff --git a/scenarios/bank_account_debit_order/definition.mako b/scenarios/bank_account_debit_order/definition.mako new file mode 100644 index 0000000..eda6428 --- /dev/null +++ b/scenarios/bank_account_debit_order/definition.mako @@ -0,0 +1 @@ +balanced.Order().debit_from() diff --git a/scenarios/bank_account_debit_order/executable.py b/scenarios/bank_account_debit_order/executable.py new file mode 100644 index 0000000..7fc5acf --- /dev/null +++ b/scenarios/bank_account_debit_order/executable.py @@ -0,0 +1,10 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3LVXVgJLrzkmB3vUntKJ6t') +order.debit_from( + amount=5000, + source=bank_account, +) \ No newline at end of file diff --git a/scenarios/bank_account_debit_order/python.mako b/scenarios/bank_account_debit_order/python.mako new file mode 100644 index 0000000..accb4ae --- /dev/null +++ b/scenarios/bank_account_debit_order/python.mako @@ -0,0 +1,17 @@ +% if mode == 'definition': +balanced.Order().debit_from() + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3LVXVgJLrzkmB3vUntKJ6t') +order.debit_from( + amount=5000, + source=bank_account, +) +% elif mode == 'response': +Debit(status=u'pending', description=u'Order #12341234', links={u'customer': None, u'source': u'BA3LVXVgJLrzkmB3vUntKJ6t', u'dispute': None, u'order': u'OR3vURGwVtqDnnkRS9fgH41G', u'card_hold': None}, amount=5000, created_at=u'2015-01-09T03:23:26.676705Z', updated_at=u'2015-01-09T03:23:26.949357Z', failure_reason=None, currency=u'USD', transaction_number=u'WULC-EFN-JTW0', href=u'/debits/WD47MlpITdspMYF3lZSxmGtT', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*example.com', id=u'WD47MlpITdspMYF3lZSxmGtT') +% endif \ No newline at end of file diff --git a/scenarios/bank_account_debit_order/request.mako b/scenarios/bank_account_debit_order/request.mako new file mode 100644 index 0000000..11d3115 --- /dev/null +++ b/scenarios/bank_account_debit_order/request.mako @@ -0,0 +1,9 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +order = balanced.Order.fetch('${request['order_href']}') +bank_account = balanced.BankAccount.fetch('${request['bank_account_href']}') +order.debit_from( + amount=${payload['amount']}, + source=bank_account, +) \ No newline at end of file diff --git a/scenarios/bank_account_delete/executable.py b/scenarios/bank_account_delete/executable.py index 117eb6d..919fe06 100644 --- a/scenarios/bank_account_delete/executable.py +++ b/scenarios/bank_account_delete/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q') bank_account.delete() \ No newline at end of file diff --git a/scenarios/bank_account_delete/python.mako b/scenarios/bank_account_delete/python.mako index 5297fe2..330cde6 100644 --- a/scenarios/bank_account_delete/python.mako +++ b/scenarios/bank_account_delete/python.mako @@ -3,9 +3,9 @@ balanced.BankAccount().delete() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q') bank_account.delete() % elif mode == 'response': diff --git a/scenarios/bank_account_list/executable.py b/scenarios/bank_account_list/executable.py index cbbceff..965db18 100644 --- a/scenarios/bank_account_list/executable.py +++ b/scenarios/bank_account_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') bank_accounts = balanced.BankAccount.query \ No newline at end of file diff --git a/scenarios/bank_account_list/python.mako b/scenarios/bank_account_list/python.mako index 7e53691..f260642 100644 --- a/scenarios/bank_account_list/python.mako +++ b/scenarios/bank_account_list/python.mako @@ -4,7 +4,7 @@ balanced.BankAccount.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') bank_accounts = balanced.BankAccount.query % elif mode == 'response': diff --git a/scenarios/bank_account_show/executable.py b/scenarios/bank_account_show/executable.py index b18e802..d55a090 100644 --- a/scenarios/bank_account_show/executable.py +++ b/scenarios/bank_account_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy') \ No newline at end of file +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q') \ No newline at end of file diff --git a/scenarios/bank_account_show/python.mako b/scenarios/bank_account_show/python.mako index 6a2771e..9b2f347 100644 --- a/scenarios/bank_account_show/python.mako +++ b/scenarios/bank_account_show/python.mako @@ -4,9 +4,9 @@ balanced.BankAccount.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q') % elif mode == 'response': -BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': None, u'bank_account_verification': None}, can_credit=True, created_at=u'2014-01-27T22:56:20.540530Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2014-01-27T22:56:20.540534Z', href=u'/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy', meta={}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA1QFf0LmIxr8p41msqX46Oy') +BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': None, u'bank_account_verification': None}, can_credit=True, created_at=u'2015-01-09T03:23:18.120531Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2015-01-09T03:23:18.120532Z', href=u'/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q', meta={}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA3Ya2sAlEQE14O1iS17FN0Q') % endif \ No newline at end of file diff --git a/scenarios/bank_account_update/executable.py b/scenarios/bank_account_update/executable.py index 6707e78..bce9e1a 100644 --- a/scenarios/bank_account_update/executable.py +++ b/scenarios/bank_account_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q') bank_account.meta = { 'twitter.id'='1234987650', 'facebook.user_id'='0192837465', diff --git a/scenarios/bank_account_update/python.mako b/scenarios/bank_account_update/python.mako index dbbf905..af118a7 100644 --- a/scenarios/bank_account_update/python.mako +++ b/scenarios/bank_account_update/python.mako @@ -3,9 +3,9 @@ balanced.BankAccount().debit() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q') bank_account.meta = { 'twitter.id'='1234987650', 'facebook.user_id'='0192837465', @@ -13,5 +13,5 @@ bank_account.meta = { } bank_account.save() % elif mode == 'response': -BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': None, u'bank_account_verification': None}, can_credit=True, created_at=u'2014-01-27T22:56:20.540530Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2014-01-27T22:56:25.767386Z', href=u'/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy', meta={u'twitter.id': u'1234987650', u'facebook.user_id': u'0192837465', u'my-own-customer-id': u'12345'}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA1QFf0LmIxr8p41msqX46Oy') +BankAccount(routing_number=u'121000358', bank_name=u'BANK OF AMERICA, N.A.', account_type=u'checking', name=u'Johann Bernoulli', links={u'customer': None, u'bank_account_verification': None}, can_credit=True, created_at=u'2015-01-09T03:23:18.120531Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, updated_at=u'2015-01-09T03:23:22.310587Z', href=u'/bank_accounts/BA3Ya2sAlEQE14O1iS17FN0Q', meta={u'twitter.id': u'1234987650', u'facebook.user_id': u'0192837465', u'my-own-customer-id': u'12345'}, account_number=u'xxxxxx0001', fingerprint=u'5f0ba9fa3f1122ef13b944a40abfe44e7eba9e16934e64200913cb4c402ace14', can_debit=False, id=u'BA3Ya2sAlEQE14O1iS17FN0Q') % endif \ No newline at end of file diff --git a/scenarios/bank_account_verification_create/executable.py b/scenarios/bank_account_verification_create/executable.py index ec38665..6f99a8d 100644 --- a/scenarios/bank_account_verification_create/executable.py +++ b/scenarios/bank_account_verification_create/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3LVXVgJLrzkmB3vUntKJ6t') verification = bank_account.verify() \ No newline at end of file diff --git a/scenarios/bank_account_verification_create/python.mako b/scenarios/bank_account_verification_create/python.mako index 911905b..6b25b0f 100644 --- a/scenarios/bank_account_verification_create/python.mako +++ b/scenarios/bank_account_verification_create/python.mako @@ -3,10 +3,10 @@ balanced.BankAccountVerification().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1D3vL3LjasB0kewMqRGI0S') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA3LVXVgJLrzkmB3vUntKJ6t') verification = bank_account.verify() % elif mode == 'response': -BankAccountVerification(verification_status=u'pending', links={u'bank_account': u'BA1D3vL3LjasB0kewMqRGI0S'}, created_at=u'2014-01-27T22:56:10.726455Z', attempts_remaining=3, updated_at=u'2014-01-27T22:56:12.545750Z', deposit_status=u'succeeded', attempts=0, href=u'/verifications/BZ1FF2MHFH9upRu7C0QUwnby', meta={}, id=u'BZ1FF2MHFH9upRu7C0QUwnby') +BankAccountVerification(verification_status=u'pending', links={u'bank_account': u'BA3LVXVgJLrzkmB3vUntKJ6t'}, created_at=u'2015-01-09T03:23:13.465191Z', attempts_remaining=3, updated_at=u'2015-01-09T03:23:13.465192Z', deposit_status=u'pending', attempts=0, href=u'/verifications/BZ3SVvXTx85CrYo8045tr2cU', meta={}, id=u'BZ3SVvXTx85CrYo8045tr2cU') % endif \ No newline at end of file diff --git a/scenarios/bank_account_verification_show/executable.py b/scenarios/bank_account_verification_show/executable.py index 667a353..1004d0b 100644 --- a/scenarios/bank_account_verification_show/executable.py +++ b/scenarios/bank_account_verification_show/executable.py @@ -1,4 +1,4 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') -verification = balanced.BankAccountVerification.fetch('/verifications/BZ1FF2MHFH9upRu7C0QUwnby') \ No newline at end of file +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') +verification = balanced.BankAccountVerification.fetch('/verifications/BZ3SVvXTx85CrYo8045tr2cU') \ No newline at end of file diff --git a/scenarios/bank_account_verification_show/python.mako b/scenarios/bank_account_verification_show/python.mako index a1cc9b0..49b5b9d 100644 --- a/scenarios/bank_account_verification_show/python.mako +++ b/scenarios/bank_account_verification_show/python.mako @@ -4,8 +4,8 @@ balanced.BankAccountVerification.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') -verification = balanced.BankAccountVerification.fetch('/verifications/BZ1FF2MHFH9upRu7C0QUwnby') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') +verification = balanced.BankAccountVerification.fetch('/verifications/BZ3SVvXTx85CrYo8045tr2cU') % elif mode == 'response': -BankAccountVerification(verification_status=u'pending', links={u'bank_account': u'BA1D3vL3LjasB0kewMqRGI0S'}, created_at=u'2014-01-27T22:56:10.726455Z', attempts_remaining=3, updated_at=u'2014-01-27T22:56:12.545750Z', deposit_status=u'succeeded', attempts=0, href=u'/verifications/BZ1FF2MHFH9upRu7C0QUwnby', meta={}, id=u'BZ1FF2MHFH9upRu7C0QUwnby') +BankAccountVerification(verification_status=u'pending', links={u'bank_account': u'BA3LVXVgJLrzkmB3vUntKJ6t'}, created_at=u'2015-01-09T03:23:13.465191Z', attempts_remaining=3, updated_at=u'2015-01-09T03:23:13.465192Z', deposit_status=u'pending', attempts=0, href=u'/verifications/BZ3SVvXTx85CrYo8045tr2cU', meta={}, id=u'BZ3SVvXTx85CrYo8045tr2cU') % endif \ No newline at end of file diff --git a/scenarios/bank_account_verification_update/executable.py b/scenarios/bank_account_verification_update/executable.py index 463489f..1e3c80a 100644 --- a/scenarios/bank_account_verification_update/executable.py +++ b/scenarios/bank_account_verification_update/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -verification = balanced.BankAccountVerification.fetch('/verifications/BZ1FF2MHFH9upRu7C0QUwnby') +verification = balanced.BankAccountVerification.fetch('/verifications/BZ3SVvXTx85CrYo8045tr2cU') verification.confirm(amount_1=1, amount_2=1) \ No newline at end of file diff --git a/scenarios/bank_account_verification_update/python.mako b/scenarios/bank_account_verification_update/python.mako index 4f2ae91..afaefe0 100644 --- a/scenarios/bank_account_verification_update/python.mako +++ b/scenarios/bank_account_verification_update/python.mako @@ -3,10 +3,10 @@ balanced.BankAccountVerification().confirm() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -verification = balanced.BankAccountVerification.fetch('/verifications/BZ1FF2MHFH9upRu7C0QUwnby') +verification = balanced.BankAccountVerification.fetch('/verifications/BZ3SVvXTx85CrYo8045tr2cU') verification.confirm(amount_1=1, amount_2=1) % elif mode == 'response': -BankAccountVerification(verification_status=u'succeeded', links={u'bank_account': u'BA1D3vL3LjasB0kewMqRGI0S'}, created_at=u'2014-01-27T22:56:10.726455Z', attempts_remaining=2, updated_at=u'2014-01-27T22:56:18.631337Z', deposit_status=u'succeeded', attempts=1, href=u'/verifications/BZ1FF2MHFH9upRu7C0QUwnby', meta={}, id=u'BZ1FF2MHFH9upRu7C0QUwnby') +BankAccountVerification(verification_status=u'succeeded', links={u'bank_account': u'BA3LVXVgJLrzkmB3vUntKJ6t'}, created_at=u'2015-01-09T03:23:13.465191Z', attempts_remaining=2, updated_at=u'2015-01-09T03:23:16.381292Z', deposit_status=u'succeeded', attempts=1, href=u'/verifications/BZ3SVvXTx85CrYo8045tr2cU', meta={}, id=u'BZ3SVvXTx85CrYo8045tr2cU') % endif \ No newline at end of file diff --git a/scenarios/callback_create/executable.py b/scenarios/callback_create/executable.py index fdcc27f..050574b 100644 --- a/scenarios/callback_create/executable.py +++ b/scenarios/callback_create/executable.py @@ -1,7 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') callback = balanced.Callback( - url='http://www.example.com/callback' + url='http://www.example.com/callback_test', + method='post' ).save() \ No newline at end of file diff --git a/scenarios/callback_create/python.mako b/scenarios/callback_create/python.mako index bb5cefb..6be8c1a 100644 --- a/scenarios/callback_create/python.mako +++ b/scenarios/callback_create/python.mako @@ -3,11 +3,12 @@ balanced.Callback() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') callback = balanced.Callback( - url='http://www.example.com/callback' + url='http://www.example.com/callback_test', + method='post' ).save() % elif mode == 'response': -Callback(links={}, url=u'http://www.example.com/callback', id=u'CB224374R2NSyoYBpDV4r7C2', href=u'/callbacks/CB224374R2NSyoYBpDV4r7C2', method=u'post', revision=u'1.1') +Callback(links={}, url=u'http://www.example.com/callback_test', id=u'CB4a7Q7HSdJJgMVHwPsarIw8', href=u'/callbacks/CB4a7Q7HSdJJgMVHwPsarIw8', method=u'post', revision=u'1.1') % endif \ No newline at end of file diff --git a/scenarios/callback_delete/executable.py b/scenarios/callback_delete/executable.py index fa8b03e..927a678 100644 --- a/scenarios/callback_delete/executable.py +++ b/scenarios/callback_delete/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -callback = balanced.Callback.fetch('/callbacks/CB224374R2NSyoYBpDV4r7C2') +callback = balanced.Callback.fetch('/callbacks/CB4a7Q7HSdJJgMVHwPsarIw8') callback.unstore() \ No newline at end of file diff --git a/scenarios/callback_delete/python.mako b/scenarios/callback_delete/python.mako index cd08f72..359fbca 100644 --- a/scenarios/callback_delete/python.mako +++ b/scenarios/callback_delete/python.mako @@ -3,9 +3,9 @@ balanced.Callback().unstore() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -callback = balanced.Callback.fetch('/callbacks/CB224374R2NSyoYBpDV4r7C2') +callback = balanced.Callback.fetch('/callbacks/CB4a7Q7HSdJJgMVHwPsarIw8') callback.unstore() % elif mode == 'response': diff --git a/scenarios/callback_list/executable.py b/scenarios/callback_list/executable.py index 862aa05..986e0da 100644 --- a/scenarios/callback_list/executable.py +++ b/scenarios/callback_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') callbacks = balanced.Callback.query \ No newline at end of file diff --git a/scenarios/callback_list/python.mako b/scenarios/callback_list/python.mako index 0dfd344..24fa6e3 100644 --- a/scenarios/callback_list/python.mako +++ b/scenarios/callback_list/python.mako @@ -4,7 +4,7 @@ balanced.Callback.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') callbacks = balanced.Callback.query % elif mode == 'response': diff --git a/scenarios/callback_show/executable.py b/scenarios/callback_show/executable.py index 9d65293..b267af9 100644 --- a/scenarios/callback_show/executable.py +++ b/scenarios/callback_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -callback = balanced.Callback.fetch('/callbacks/CB224374R2NSyoYBpDV4r7C2') \ No newline at end of file +callback = balanced.Callback.fetch('/callbacks/CB4a7Q7HSdJJgMVHwPsarIw8') \ No newline at end of file diff --git a/scenarios/callback_show/python.mako b/scenarios/callback_show/python.mako index 894cc4b..2513875 100644 --- a/scenarios/callback_show/python.mako +++ b/scenarios/callback_show/python.mako @@ -4,9 +4,9 @@ balanced.Callback.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -callback = balanced.Callback.fetch('/callbacks/CB224374R2NSyoYBpDV4r7C2') +callback = balanced.Callback.fetch('/callbacks/CB4a7Q7HSdJJgMVHwPsarIw8') % elif mode == 'response': -Callback(links={}, url=u'http://www.example.com/callback', id=u'CB224374R2NSyoYBpDV4r7C2', href=u'/callbacks/CB224374R2NSyoYBpDV4r7C2', method=u'post', revision=u'1.1') +Callback(links={}, url=u'http://www.example.com/callback_test', id=u'CB4a7Q7HSdJJgMVHwPsarIw8', href=u'/callbacks/CB4a7Q7HSdJJgMVHwPsarIw8', method=u'post', revision=u'1.1') % endif \ No newline at end of file diff --git a/scenarios/card_associate_to_customer/executable.py b/scenarios/card_associate_to_customer/executable.py index 4c22a35..b2f4245 100644 --- a/scenarios/card_associate_to_customer/executable.py +++ b/scenarios/card_associate_to_customer/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC3kqm84fxh50avenrUsSKbu') -card.associate_to_customer('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') \ No newline at end of file +card = balanced.Card.fetch('/cards/CC4HDcgvzIltvwv6GSjBVbji') +card.associate_to_customer('/customers/CU3o1ZAd8Gtxz6ZTIFK9YmsM') \ No newline at end of file diff --git a/scenarios/card_associate_to_customer/python.mako b/scenarios/card_associate_to_customer/python.mako index d41f71c..465a99e 100644 --- a/scenarios/card_associate_to_customer/python.mako +++ b/scenarios/card_associate_to_customer/python.mako @@ -3,10 +3,10 @@ balanced.Card().associate_to_customer() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC3kqm84fxh50avenrUsSKbu') -card.associate_to_customer('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') +card = balanced.Card.fetch('/cards/CC4HDcgvzIltvwv6GSjBVbji') +card.associate_to_customer('/customers/CU3o1ZAd8Gtxz6ZTIFK9YmsM') % elif mode == 'response': -Card(cvv_match=None, links={u'customer': u'CU3eeasZ9yQ86uzzIYZkrPGg'}, expiration_year=2020, avs_street_match=None, avs_postal_match=None, created_at=u'2014-01-27T22:57:42.092923Z', cvv_result=None, number=u'xxxxxxxxxxxx5100', updated_at=u'2014-01-27T22:57:42.724392Z', expiration_month=12, cvv=None, href=u'/cards/CC3kqm84fxh50avenrUsSKbu', meta={}, avs_result=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, id=u'CC3kqm84fxh50avenrUsSKbu', fingerprint=u'fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788', is_verified=True, brand=u'MasterCard', name=None) +Card(links={u'customer': u'CU3o1ZAd8Gtxz6ZTIFK9YmsM'}, cvv_result=None, number=u'xxxxxxxxxxxx1118', expiration_month=5, href=u'/cards/CC4HDcgvzIltvwv6GSjBVbji', type=u'debit', id=u'CC4HDcgvzIltvwv6GSjBVbji', category=u'other', is_verified=True, cvv_match=None, bank_name=u'WELLS FARGO BANK, N.A.', avs_street_match=None, brand=u'Visa', updated_at=u'2015-01-09T03:23:59.133903Z', fingerprint=u'7dc93d35b59078a1da8e0ebd2cbec65a6ca205760a1be1b90a143d7f2b00e355', can_debit=True, name=u'Johannes Bach', expiration_year=2020, cvv=None, avs_postal_match=None, avs_result=None, can_credit=True, meta={}, created_at=u'2015-01-09T03:23:58.549644Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}) % endif \ No newline at end of file diff --git a/scenarios/card_create/executable.py b/scenarios/card_create/executable.py index 5371566..84e7b87 100644 --- a/scenarios/card_create/executable.py +++ b/scenarios/card_create/executable.py @@ -1,10 +1,10 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') card = balanced.Card( + cvv='123', expiration_month='12', - security_code='123', number='5105105105105100', expiration_year='2020' ).save() \ No newline at end of file diff --git a/scenarios/card_create/python.mako b/scenarios/card_create/python.mako index a2a4438..98c9693 100644 --- a/scenarios/card_create/python.mako +++ b/scenarios/card_create/python.mako @@ -3,14 +3,14 @@ balanced.Card().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') card = balanced.Card( + cvv='123', expiration_month='12', - security_code='123', number='5105105105105100', expiration_year='2020' ).save() % elif mode == 'response': -Card(cvv_match=None, links={u'customer': None}, expiration_year=2020, avs_street_match=None, avs_postal_match=None, created_at=u'2014-01-27T22:57:42.092923Z', cvv_result=None, number=u'xxxxxxxxxxxx5100', updated_at=u'2014-01-27T22:57:42.092926Z', expiration_month=12, cvv=None, href=u'/cards/CC3kqm84fxh50avenrUsSKbu', meta={}, avs_result=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, id=u'CC3kqm84fxh50avenrUsSKbu', fingerprint=u'fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788', is_verified=True, brand=u'MasterCard', name=None) +Card(links={u'customer': None}, cvv_result=u'Match', number=u'xxxxxxxxxxxx5100', expiration_month=12, href=u'/cards/CC4zyuNpxY0A0eAf87SeULCR', type=u'credit', id=u'CC4zyuNpxY0A0eAf87SeULCR', category=u'other', is_verified=True, cvv_match=u'yes', bank_name=u'BANK OF HAWAII', avs_street_match=None, brand=u'MasterCard', updated_at=u'2015-01-09T03:23:51.373359Z', fingerprint=u'fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788', can_debit=True, name=None, expiration_year=2020, cvv=u'xxx', avs_postal_match=None, avs_result=None, can_credit=False, meta={}, created_at=u'2015-01-09T03:23:51.373358Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}) % endif \ No newline at end of file diff --git a/scenarios/card_create_creditable/definition.mako b/scenarios/card_create_creditable/definition.mako new file mode 100644 index 0000000..1235831 --- /dev/null +++ b/scenarios/card_create_creditable/definition.mako @@ -0,0 +1 @@ +balanced.Card().save() \ No newline at end of file diff --git a/scenarios/card_create_creditable/executable.py b/scenarios/card_create_creditable/executable.py new file mode 100644 index 0000000..11d1569 --- /dev/null +++ b/scenarios/card_create_creditable/executable.py @@ -0,0 +1,10 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +card = balanced.Card( + expiration_month='05', + name='Johannes Bach', + expiration_year='2020', + number='4342561111111118' +).save() \ No newline at end of file diff --git a/scenarios/card_create_creditable/python.mako b/scenarios/card_create_creditable/python.mako new file mode 100644 index 0000000..5b74317 --- /dev/null +++ b/scenarios/card_create_creditable/python.mako @@ -0,0 +1,16 @@ +% if mode == 'definition': +balanced.Card().save() +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +card = balanced.Card( + expiration_month='05', + name='Johannes Bach', + expiration_year='2020', + number='4342561111111118' +).save() +% elif mode == 'response': +Card(links={u'customer': None}, cvv_result=None, number=u'xxxxxxxxxxxx1118', expiration_month=5, href=u'/cards/CC4HDcgvzIltvwv6GSjBVbji', type=u'debit', id=u'CC4HDcgvzIltvwv6GSjBVbji', category=u'other', is_verified=True, cvv_match=None, bank_name=u'WELLS FARGO BANK, N.A.', avs_street_match=None, brand=u'Visa', updated_at=u'2015-01-09T03:23:58.549645Z', fingerprint=u'7dc93d35b59078a1da8e0ebd2cbec65a6ca205760a1be1b90a143d7f2b00e355', can_debit=True, name=u'Johannes Bach', expiration_year=2020, cvv=None, avs_postal_match=None, avs_result=None, can_credit=True, meta={}, created_at=u'2015-01-09T03:23:58.549644Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}) +% endif \ No newline at end of file diff --git a/scenarios/card_create_creditable/request.mako b/scenarios/card_create_creditable/request.mako new file mode 100644 index 0000000..bae039b --- /dev/null +++ b/scenarios/card_create_creditable/request.mako @@ -0,0 +1,6 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +card = balanced.Card( + <% main.payload_expand(request['payload']) %> +).save() \ No newline at end of file diff --git a/scenarios/card_create_dispute/definition.mako b/scenarios/card_create_dispute/definition.mako new file mode 100644 index 0000000..1235831 --- /dev/null +++ b/scenarios/card_create_dispute/definition.mako @@ -0,0 +1 @@ +balanced.Card().save() \ No newline at end of file diff --git a/scenarios/card_create_dispute/executable.py b/scenarios/card_create_dispute/executable.py new file mode 100644 index 0000000..068e3fd --- /dev/null +++ b/scenarios/card_create_dispute/executable.py @@ -0,0 +1,10 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +card = balanced.Card( + cvv='123', + expiration_month='12', + number='6500000000000002', + expiration_year='3000' +).save() \ No newline at end of file diff --git a/scenarios/card_create_dispute/python.mako b/scenarios/card_create_dispute/python.mako new file mode 100644 index 0000000..3b4099f --- /dev/null +++ b/scenarios/card_create_dispute/python.mako @@ -0,0 +1,16 @@ +% if mode == 'definition': +balanced.Card().save() +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +card = balanced.Card( + cvv='123', + expiration_month='12', + number='6500000000000002', + expiration_year='3000' +).save() +% elif mode == 'response': +Card(links={u'customer': None}, cvv_result=u'Match', number=u'xxxxxxxxxxxx0002', expiration_month=12, href=u'/cards/CC5RRvpnZIg0PWdSphR8xxPa', type=u'debit', id=u'CC5RRvpnZIg0PWdSphR8xxPa', category=u'other', is_verified=True, cvv_match=u'yes', bank_name=u'BANK OF AMERICA', avs_street_match=None, brand=u'Discover', updated_at=u'2015-01-09T03:25:02.773172Z', fingerprint=u'3c667a62653e187f29b5781eeb0703f26e99558080de0c0f9490b5f9c4ac2871', can_debit=True, name=None, expiration_year=3000, cvv=u'xxx', avs_postal_match=None, avs_result=None, can_credit=True, meta={}, created_at=u'2015-01-09T03:25:02.773170Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}) +% endif \ No newline at end of file diff --git a/scenarios/card_create_dispute/request.mako b/scenarios/card_create_dispute/request.mako new file mode 100644 index 0000000..bae039b --- /dev/null +++ b/scenarios/card_create_dispute/request.mako @@ -0,0 +1,6 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +card = balanced.Card( + <% main.payload_expand(request['payload']) %> +).save() \ No newline at end of file diff --git a/scenarios/card_credit/definition.mako b/scenarios/card_credit/definition.mako new file mode 100644 index 0000000..d97ded5 --- /dev/null +++ b/scenarios/card_credit/definition.mako @@ -0,0 +1 @@ +balanced.Card().credit() \ No newline at end of file diff --git a/scenarios/card_credit/executable.py b/scenarios/card_credit/executable.py new file mode 100644 index 0000000..e69de29 diff --git a/scenarios/card_credit/python.mako b/scenarios/card_credit/python.mako new file mode 100644 index 0000000..b8a2fa8 --- /dev/null +++ b/scenarios/card_credit/python.mako @@ -0,0 +1,7 @@ +% if mode == 'definition': +balanced.Card().credit() +% elif mode == 'request': + +% elif mode == 'response': + +% endif \ No newline at end of file diff --git a/scenarios/card_credit/request.mako b/scenarios/card_credit/request.mako new file mode 100644 index 0000000..b4350ce --- /dev/null +++ b/scenarios/card_credit/request.mako @@ -0,0 +1,8 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +card = balanced.Card.fetch('${request['card_href']}') +card.credit( + <% main.payload_expand(request['payload']) %> +) + diff --git a/scenarios/card_credit_order/definition.mako b/scenarios/card_credit_order/definition.mako new file mode 100644 index 0000000..a389100 --- /dev/null +++ b/scenarios/card_credit_order/definition.mako @@ -0,0 +1 @@ +balanced.Order().credit_to() diff --git a/scenarios/card_credit_order/executable.py b/scenarios/card_credit_order/executable.py new file mode 100644 index 0000000..ca620d5 --- /dev/null +++ b/scenarios/card_credit_order/executable.py @@ -0,0 +1,10 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +card = balanced.Card.fetch('/cards/CC4HDcgvzIltvwv6GSjBVbji') +order.credit_to( + amount=5000, + source=card, +) \ No newline at end of file diff --git a/scenarios/card_credit_order/python.mako b/scenarios/card_credit_order/python.mako new file mode 100644 index 0000000..5ee0022 --- /dev/null +++ b/scenarios/card_credit_order/python.mako @@ -0,0 +1,17 @@ +% if mode == 'definition': +balanced.Order().credit_to() + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +card = balanced.Card.fetch('/cards/CC4HDcgvzIltvwv6GSjBVbji') +order.credit_to( + amount=5000, + source=card, +) +% elif mode == 'response': +Credit(status=u'succeeded', description=u'Order #12341234', links={u'customer': u'CU3o1ZAd8Gtxz6ZTIFK9YmsM', u'destination': u'CC4HDcgvzIltvwv6GSjBVbji', u'order': u'OR3vURGwVtqDnnkRS9fgH41G'}, amount=5000, created_at=u'2015-01-09T03:24:02.493888Z', updated_at=u'2015-01-09T03:24:02.893852Z', failure_reason=None, currency=u'USD', transaction_number=u'CROCY-7EY-ZRI2', href=u'/credits/CR4M2HpYdKDcG8nh4d5HrKJL', meta={}, failure_reason_code=None, appears_on_statement_as=u'example.com', id=u'CR4M2HpYdKDcG8nh4d5HrKJL') +% endif \ No newline at end of file diff --git a/scenarios/card_credit_order/request.mako b/scenarios/card_credit_order/request.mako new file mode 100644 index 0000000..2d14cdd --- /dev/null +++ b/scenarios/card_credit_order/request.mako @@ -0,0 +1,9 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +order = balanced.Order.fetch('${request['order_href']}') +card = balanced.Card.fetch('${request['card_href']}') +order.credit_to( + amount=${payload['amount']}, + source=card, +) \ No newline at end of file diff --git a/scenarios/card_debit/executable.py b/scenarios/card_debit/executable.py index 4c5948b..7ee7acc 100644 --- a/scenarios/card_debit/executable.py +++ b/scenarios/card_debit/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC3kqm84fxh50avenrUsSKbu') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') card.debit( appears_on_statement_as='Statement text', amount=5000, diff --git a/scenarios/card_debit/python.mako b/scenarios/card_debit/python.mako index a0afbb0..9dccea6 100644 --- a/scenarios/card_debit/python.mako +++ b/scenarios/card_debit/python.mako @@ -3,14 +3,14 @@ balanced.Card().debit() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC3kqm84fxh50avenrUsSKbu') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') card.debit( appears_on_statement_as='Statement text', amount=5000, description='Some descriptive text for the debit in the dashboard' ) % elif mode == 'response': -Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': u'CU3eeasZ9yQ86uzzIYZkrPGg', u'source': u'CC3kqm84fxh50avenrUsSKbu', u'order': None, u'dispute': None}, amount=5000, created_at=u'2014-01-27T22:58:07.291226Z', updated_at=u'2014-01-27T22:58:09.706862Z', failure_reason=None, currency=u'USD', transaction_number=u'W180-465-2000', href=u'/debits/WD3MKNxNTKBGgA7mX50yogiu', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD3MKNxNTKBGgA7mX50yogiu') +Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': None, u'source': u'CC4zyuNpxY0A0eAf87SeULCR', u'dispute': None, u'order': None, u'card_hold': u'HL5NbQRZSxbr0o64QWu7szni'}, amount=5000, created_at=u'2015-01-09T03:24:58.643499Z', updated_at=u'2015-01-09T03:24:59.368094Z', failure_reason=None, currency=u'USD', transaction_number=u'WS4G-1FI-AT4Z', href=u'/debits/WD5Nd61WpdlRk6D39YVNFAEo', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD5Nd61WpdlRk6D39YVNFAEo') % endif \ No newline at end of file diff --git a/scenarios/card_debit_dispute/definition.mako b/scenarios/card_debit_dispute/definition.mako new file mode 100644 index 0000000..91d7e5b --- /dev/null +++ b/scenarios/card_debit_dispute/definition.mako @@ -0,0 +1 @@ +balanced.Card().debit() \ No newline at end of file diff --git a/scenarios/card_debit_dispute/executable.py b/scenarios/card_debit_dispute/executable.py new file mode 100644 index 0000000..eb7fee8 --- /dev/null +++ b/scenarios/card_debit_dispute/executable.py @@ -0,0 +1,10 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +card = balanced.Card.fetch('/cards/CC5RRvpnZIg0PWdSphR8xxPa') +card.debit( + appears_on_statement_as='Statement text', + amount=5000, + description='Some descriptive text for the debit in the dashboard' +) \ No newline at end of file diff --git a/scenarios/card_debit_dispute/python.mako b/scenarios/card_debit_dispute/python.mako new file mode 100644 index 0000000..a2c95d4 --- /dev/null +++ b/scenarios/card_debit_dispute/python.mako @@ -0,0 +1,16 @@ +% if mode == 'definition': +balanced.Card().debit() +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +card = balanced.Card.fetch('/cards/CC5RRvpnZIg0PWdSphR8xxPa') +card.debit( + appears_on_statement_as='Statement text', + amount=5000, + description='Some descriptive text for the debit in the dashboard' +) +% elif mode == 'response': +Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': None, u'source': u'CC5RRvpnZIg0PWdSphR8xxPa', u'dispute': None, u'order': None, u'card_hold': u'HL5Svbmw6nDDP5HO2RblsBCJ'}, amount=5000, created_at=u'2015-01-09T03:25:03.383375Z', updated_at=u'2015-01-09T03:25:04.090381Z', failure_reason=None, currency=u'USD', transaction_number=u'WA4K-D44-O5DR', href=u'/debits/WD5SwXr9jcCfCmmjTH5MCMFD', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD5SwXr9jcCfCmmjTH5MCMFD') +% endif \ No newline at end of file diff --git a/scenarios/card_debit_dispute/request.mako b/scenarios/card_debit_dispute/request.mako new file mode 100644 index 0000000..ed62839 --- /dev/null +++ b/scenarios/card_debit_dispute/request.mako @@ -0,0 +1,8 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +card = balanced.Card.fetch('${request['card_href']}') +card.debit( + <% main.payload_expand(request['payload']) %> +) + diff --git a/scenarios/card_delete/executable.py b/scenarios/card_delete/executable.py index 6d68c1c..4c1bb19 100644 --- a/scenarios/card_delete/executable.py +++ b/scenarios/card_delete/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') card.unstore() \ No newline at end of file diff --git a/scenarios/card_delete/python.mako b/scenarios/card_delete/python.mako index 1b008e2..24f9f5e 100644 --- a/scenarios/card_delete/python.mako +++ b/scenarios/card_delete/python.mako @@ -3,9 +3,9 @@ balanced.Card().unstore() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') card.unstore() % elif mode == 'response': diff --git a/scenarios/card_hold_capture/executable.py b/scenarios/card_hold_capture/executable.py index baee209..190b743 100644 --- a/scenarios/card_hold_capture/executable.py +++ b/scenarios/card_hold_capture/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S') +card_hold = balanced.CardHold.fetch('/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9') debit = card_hold.capture( appears_on_statement_as='ShowsUpOnStmt', description='Some descriptive text for the debit in the dashboard' diff --git a/scenarios/card_hold_capture/python.mako b/scenarios/card_hold_capture/python.mako index fcefda3..22e5dd4 100644 --- a/scenarios/card_hold_capture/python.mako +++ b/scenarios/card_hold_capture/python.mako @@ -3,13 +3,13 @@ balanced.CardHold().capture() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S') +card_hold = balanced.CardHold.fetch('/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9') debit = card_hold.capture( appears_on_statement_as='ShowsUpOnStmt', description='Some descriptive text for the debit in the dashboard' ) % elif mode == 'response': -Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': u'CU1f8Ygc4t0F2FKNcw235x9I', u'source': u'CC2abDOQVm5aNFhHpcRvWS02', u'order': None, u'dispute': None}, amount=5000, created_at=u'2014-01-27T22:56:45.623268Z', updated_at=u'2014-01-27T22:56:47.926021Z', failure_reason=None, currency=u'USD', transaction_number=u'W744-719-1832', href=u'/debits/WD2iSCukjXyeRdkvX3cW0PmC', meta={u'holding.for': u'user1', u'meaningful.key': u'some.value'}, failure_reason_code=None, appears_on_statement_as=u'BAL*ShowsUpOnStmt', id=u'WD2iSCukjXyeRdkvX3cW0PmC') +Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': None, u'source': u'CC3vhL91rWtwtHcOBl0ITshG', u'dispute': None, u'order': None, u'card_hold': u'HL4iHX8OBNW7nVsu6MqyjnQ9'}, amount=5000, created_at=u'2015-01-09T03:23:43.969240Z', updated_at=u'2015-01-09T03:23:44.454341Z', failure_reason=None, currency=u'USD', transaction_number=u'W456-5GN-9ECN', href=u'/debits/WD4relmrBWDQmtlKKKmKLi7z', meta={u'holding.for': u'user1', u'meaningful.key': u'some.value'}, failure_reason_code=None, appears_on_statement_as=u'BAL*ShowsUpOnStmt', id=u'WD4relmrBWDQmtlKKKmKLi7z') % endif \ No newline at end of file diff --git a/scenarios/card_hold_create/executable.py b/scenarios/card_hold_create/executable.py index b4693bd..a2b2fce 100644 --- a/scenarios/card_hold_create/executable.py +++ b/scenarios/card_hold_create/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2abDOQVm5aNFhHpcRvWS02') +card = balanced.Card.fetch('/cards/CC3vhL91rWtwtHcOBl0ITshG') card_hold = card.hold( amount=5000, description='Some descriptive text for the debit in the dashboard' diff --git a/scenarios/card_hold_create/python.mako b/scenarios/card_hold_create/python.mako index 3e4c505..b48c2e4 100644 --- a/scenarios/card_hold_create/python.mako +++ b/scenarios/card_hold_create/python.mako @@ -3,13 +3,13 @@ balanced.Card().hold() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2abDOQVm5aNFhHpcRvWS02') +card = balanced.Card.fetch('/cards/CC3vhL91rWtwtHcOBl0ITshG') card_hold = card.hold( amount=5000, description='Some descriptive text for the debit in the dashboard' ) % elif mode == 'response': -CardHold(description=u'Some descriptive text for the debit in the dashboard', links={u'card': u'CC2abDOQVm5aNFhHpcRvWS02', u'debit': None}, amount=5000, created_at=u'2014-01-27T22:56:49.446376Z', updated_at=u'2014-01-27T22:56:51.115729Z', expires_at=u'2014-02-03T22:56:50.793698Z', failure_reason=None, currency=u'USD', transaction_number=u'HL102-313-8003', href=u'/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG', meta={}, failure_reason_code=None, id=u'HL2ncCO5Bir2S0PCdsDHV3cG') +CardHold(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'order': None, u'card': u'CC3vhL91rWtwtHcOBl0ITshG', u'debit': None}, amount=5000, created_at=u'2015-01-09T03:23:46.500278Z', updated_at=u'2015-01-09T03:23:46.803224Z', expires_at=u'2015-01-16T03:23:46.699907Z', failure_reason=None, currency=u'USD', transaction_number=u'HL07I-F9N-OVPO', href=u'/card_holds/HL4u4T2877PfgYwnbhD2XweV', meta={}, failure_reason_code=None, voided_at=None, id=u'HL4u4T2877PfgYwnbhD2XweV') % endif \ No newline at end of file diff --git a/scenarios/card_hold_list/executable.py b/scenarios/card_hold_list/executable.py index 4b5fd50..8fc7d17 100644 --- a/scenarios/card_hold_list/executable.py +++ b/scenarios/card_hold_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') card_holds = balanced.CardHold.query \ No newline at end of file diff --git a/scenarios/card_hold_list/python.mako b/scenarios/card_hold_list/python.mako index 560878d..5dc8559 100644 --- a/scenarios/card_hold_list/python.mako +++ b/scenarios/card_hold_list/python.mako @@ -4,7 +4,7 @@ balanced.CardHold.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') card_holds = balanced.CardHold.query % elif mode == 'response': diff --git a/scenarios/card_hold_order/definition.mako b/scenarios/card_hold_order/definition.mako new file mode 100644 index 0000000..01df58f --- /dev/null +++ b/scenarios/card_hold_order/definition.mako @@ -0,0 +1 @@ +balanced.Card().hold() \ No newline at end of file diff --git a/scenarios/card_hold_order/executable.py b/scenarios/card_hold_order/executable.py new file mode 100644 index 0000000..4218600 --- /dev/null +++ b/scenarios/card_hold_order/executable.py @@ -0,0 +1,11 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +card = balanced.Card.fetch('/cards/CC3vhL91rWtwtHcOBl0ITshG') +card_hold = card.hold( +amount=5000, + description='Some descriptive text for the debit in the dashboard', + order='/orders/OR3vURGwVtqDnnkRS9fgH41G' +) \ No newline at end of file diff --git a/scenarios/card_hold_order/python.mako b/scenarios/card_hold_order/python.mako new file mode 100644 index 0000000..fbb6bc7 --- /dev/null +++ b/scenarios/card_hold_order/python.mako @@ -0,0 +1,17 @@ +% if mode == 'definition': +balanced.Card().hold() +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +card = balanced.Card.fetch('/cards/CC3vhL91rWtwtHcOBl0ITshG') +card_hold = card.hold( +amount=5000, + description='Some descriptive text for the debit in the dashboard', + order='/orders/OR3vURGwVtqDnnkRS9fgH41G' +) +% elif mode == 'response': +CardHold(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'order': u'OR3vURGwVtqDnnkRS9fgH41G', u'card': u'CC3vhL91rWtwtHcOBl0ITshG', u'debit': None}, amount=5000, created_at=u'2015-01-09T03:23:34.413652Z', updated_at=u'2015-01-09T03:23:34.713108Z', expires_at=u'2015-01-16T03:23:34.647009Z', failure_reason=None, currency=u'USD', transaction_number=u'HLVKB-4MF-JL5N', href=u'/card_holds/HL4gu3SX4Z5LEPYtYhg6HOOp', meta={}, failure_reason_code=None, voided_at=None, id=u'HL4gu3SX4Z5LEPYtYhg6HOOp') +% endif \ No newline at end of file diff --git a/scenarios/card_hold_order/request.mako b/scenarios/card_hold_order/request.mako new file mode 100644 index 0000000..9541409 --- /dev/null +++ b/scenarios/card_hold_order/request.mako @@ -0,0 +1,8 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +order = balanced.Order.fetch('${request['order_href']}') +card = balanced.Card.fetch('${request['card_href']}') +card_hold = card.hold( +<% main.payload_expand(request['payload']) %> +) \ No newline at end of file diff --git a/scenarios/card_hold_show/executable.py b/scenarios/card_hold_show/executable.py index 2631ad5..9f58fcd 100644 --- a/scenarios/card_hold_show/executable.py +++ b/scenarios/card_hold_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S') \ No newline at end of file +card_hold = balanced.CardHold.fetch('/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9') \ No newline at end of file diff --git a/scenarios/card_hold_show/python.mako b/scenarios/card_hold_show/python.mako index 27330d5..0f45e0c 100644 --- a/scenarios/card_hold_show/python.mako +++ b/scenarios/card_hold_show/python.mako @@ -4,9 +4,9 @@ balanced.CardHold.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S') +card_hold = balanced.CardHold.fetch('/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9') % elif mode == 'response': -CardHold(description=u'Some descriptive text for the debit in the dashboard', links={u'card': u'CC2abDOQVm5aNFhHpcRvWS02', u'debit': None}, amount=5000, created_at=u'2014-01-27T22:56:39.379941Z', updated_at=u'2014-01-27T22:56:40.238140Z', expires_at=u'2014-02-03T22:56:39.876902Z', failure_reason=None, currency=u'USD', transaction_number=u'HL500-842-5492', href=u'/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S', meta={}, failure_reason_code=None, id=u'HL2bT9uMRkTZkfSPmA2pBD9S') +CardHold(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'order': None, u'card': u'CC3vhL91rWtwtHcOBl0ITshG', u'debit': None}, amount=5000, created_at=u'2015-01-09T03:23:36.391121Z', updated_at=u'2015-01-09T03:23:36.674542Z', expires_at=u'2015-01-16T03:23:36.585031Z', failure_reason=None, currency=u'USD', transaction_number=u'HLI6T-T0A-HGZI', href=u'/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9', meta={}, failure_reason_code=None, voided_at=None, id=u'HL4iHX8OBNW7nVsu6MqyjnQ9') % endif \ No newline at end of file diff --git a/scenarios/card_hold_update/executable.py b/scenarios/card_hold_update/executable.py index 89676d0..3979709 100644 --- a/scenarios/card_hold_update/executable.py +++ b/scenarios/card_hold_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S') +card_hold = balanced.CardHold.fetch('/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9') card_hold.description = 'update this description' card_hold.meta = { 'holding.for': 'user1', diff --git a/scenarios/card_hold_update/python.mako b/scenarios/card_hold_update/python.mako index 6f49642..eb74e48 100644 --- a/scenarios/card_hold_update/python.mako +++ b/scenarios/card_hold_update/python.mako @@ -3,9 +3,9 @@ balanced.CardHold().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S') +card_hold = balanced.CardHold.fetch('/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9') card_hold.description = 'update this description' card_hold.meta = { 'holding.for': 'user1', @@ -13,5 +13,5 @@ card_hold.meta = { } card_hold.save() % elif mode == 'response': -CardHold(description=u'update this description', links={u'card': u'CC2abDOQVm5aNFhHpcRvWS02', u'debit': None}, amount=5000, created_at=u'2014-01-27T22:56:39.379941Z', updated_at=u'2014-01-27T22:56:44.255042Z', expires_at=u'2014-02-03T22:56:39.876902Z', failure_reason=None, currency=u'USD', transaction_number=u'HL500-842-5492', href=u'/card_holds/HL2bT9uMRkTZkfSPmA2pBD9S', meta={u'holding.for': u'user1', u'meaningful.key': u'some.value'}, failure_reason_code=None, id=u'HL2bT9uMRkTZkfSPmA2pBD9S') +CardHold(status=u'succeeded', description=u'update this description', links={u'order': None, u'card': u'CC3vhL91rWtwtHcOBl0ITshG', u'debit': None}, amount=5000, created_at=u'2015-01-09T03:23:36.391121Z', updated_at=u'2015-01-09T03:23:42.106452Z', expires_at=u'2015-01-16T03:23:36.585031Z', failure_reason=None, currency=u'USD', transaction_number=u'HLI6T-T0A-HGZI', href=u'/card_holds/HL4iHX8OBNW7nVsu6MqyjnQ9', meta={u'holding.for': u'user1', u'meaningful.key': u'some.value'}, failure_reason_code=None, voided_at=None, id=u'HL4iHX8OBNW7nVsu6MqyjnQ9') % endif \ No newline at end of file diff --git a/scenarios/card_hold_void/executable.py b/scenarios/card_hold_void/executable.py index dc3d7a6..6e1f701 100644 --- a/scenarios/card_hold_void/executable.py +++ b/scenarios/card_hold_void/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG') +card_hold = balanced.CardHold.fetch('/card_holds/HL4u4T2877PfgYwnbhD2XweV') card_hold.cancel() \ No newline at end of file diff --git a/scenarios/card_hold_void/python.mako b/scenarios/card_hold_void/python.mako index b24f6a5..7a730b3 100644 --- a/scenarios/card_hold_void/python.mako +++ b/scenarios/card_hold_void/python.mako @@ -3,10 +3,10 @@ balanced.CardHold().cancel() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card_hold = balanced.CardHold.fetch('/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG') +card_hold = balanced.CardHold.fetch('/card_holds/HL4u4T2877PfgYwnbhD2XweV') card_hold.cancel() % elif mode == 'response': -CardHold(description=u'Some descriptive text for the debit in the dashboard', links={u'card': u'CC2abDOQVm5aNFhHpcRvWS02', u'debit': None}, amount=5000, created_at=u'2014-01-27T22:56:49.446376Z', updated_at=u'2014-01-27T22:56:51.686616Z', expires_at=u'2014-02-03T22:56:50.793698Z', failure_reason=None, currency=u'USD', transaction_number=u'HL102-313-8003', href=u'/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG', meta={}, failure_reason_code=None, id=u'HL2ncCO5Bir2S0PCdsDHV3cG') +CardHold(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'order': None, u'card': u'CC3vhL91rWtwtHcOBl0ITshG', u'debit': None}, amount=5000, created_at=u'2015-01-09T03:23:46.500278Z', updated_at=u'2015-01-09T03:23:47.578727Z', expires_at=u'2015-01-16T03:23:46.699907Z', failure_reason=None, currency=u'USD', transaction_number=u'HL07I-F9N-OVPO', href=u'/card_holds/HL4u4T2877PfgYwnbhD2XweV', meta={}, failure_reason_code=None, voided_at=u'2015-01-09T03:23:47.257558Z', id=u'HL4u4T2877PfgYwnbhD2XweV') % endif \ No newline at end of file diff --git a/scenarios/card_list/executable.py b/scenarios/card_list/executable.py index 029c505..abc2c37 100644 --- a/scenarios/card_list/executable.py +++ b/scenarios/card_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') cards = balanced.Card.query \ No newline at end of file diff --git a/scenarios/card_list/python.mako b/scenarios/card_list/python.mako index c8a8838..a0411a3 100644 --- a/scenarios/card_list/python.mako +++ b/scenarios/card_list/python.mako @@ -4,7 +4,7 @@ balanced.Card.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') cards = balanced.Card.query % elif mode == 'response': diff --git a/scenarios/card_show/executable.py b/scenarios/card_show/executable.py index 3be1bbc..5e6f1cc 100644 --- a/scenarios/card_show/executable.py +++ b/scenarios/card_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI') \ No newline at end of file +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') \ No newline at end of file diff --git a/scenarios/card_show/python.mako b/scenarios/card_show/python.mako index 75e88e6..24fede7 100644 --- a/scenarios/card_show/python.mako +++ b/scenarios/card_show/python.mako @@ -3,9 +3,9 @@ balanced.Card.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') % elif mode == 'response': -Card(cvv_match=None, links={u'customer': None}, expiration_year=2020, avs_street_match=None, avs_postal_match=None, created_at=u'2014-01-27T22:56:55.656375Z', cvv_result=None, number=u'xxxxxxxxxxxx5100', updated_at=u'2014-01-27T22:56:55.656379Z', expiration_month=12, cvv=None, href=u'/cards/CC2uc8iPDjgyxOXHVtnZloyI', meta={}, avs_result=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, id=u'CC2uc8iPDjgyxOXHVtnZloyI', fingerprint=u'fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788', is_verified=True, brand=u'MasterCard', name=None) +Card(links={u'customer': None}, cvv_result=u'Match', number=u'xxxxxxxxxxxx5100', expiration_month=12, href=u'/cards/CC4zyuNpxY0A0eAf87SeULCR', type=u'credit', id=u'CC4zyuNpxY0A0eAf87SeULCR', category=u'other', is_verified=True, cvv_match=u'yes', bank_name=u'BANK OF HAWAII', avs_street_match=None, brand=u'MasterCard', updated_at=u'2015-01-09T03:23:51.373359Z', fingerprint=u'fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788', can_debit=True, name=None, expiration_year=2020, cvv=u'xxx', avs_postal_match=None, avs_result=None, can_credit=False, meta={}, created_at=u'2015-01-09T03:23:51.373358Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}) % endif \ No newline at end of file diff --git a/scenarios/card_update/executable.py b/scenarios/card_update/executable.py index ba4b27a..be60c95 100644 --- a/scenarios/card_update/executable.py +++ b/scenarios/card_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') card.meta = { 'twitter.id': '1234987650', 'facebook.user_id': '0192837465', diff --git a/scenarios/card_update/python.mako b/scenarios/card_update/python.mako index 03c02b5..bbd6122 100644 --- a/scenarios/card_update/python.mako +++ b/scenarios/card_update/python.mako @@ -3,9 +3,9 @@ balanced.Card().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -card = balanced.Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') card.meta = { 'twitter.id': '1234987650', 'facebook.user_id': '0192837465', @@ -13,5 +13,5 @@ card.meta = { } card.save() % elif mode == 'response': -Card(cvv_match=None, links={u'customer': None}, expiration_year=2020, avs_street_match=None, avs_postal_match=None, created_at=u'2014-01-27T22:56:55.656375Z', cvv_result=None, number=u'xxxxxxxxxxxx5100', updated_at=u'2014-01-27T22:57:02.195769Z', expiration_month=12, cvv=None, href=u'/cards/CC2uc8iPDjgyxOXHVtnZloyI', meta={u'twitter.id': u'1234987650', u'facebook.user_id': u'0192837465', u'my-own-customer-id': u'12345'}, avs_result=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, id=u'CC2uc8iPDjgyxOXHVtnZloyI', fingerprint=u'fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788', is_verified=True, brand=u'MasterCard', name=None) +Card(links={u'customer': None}, cvv_result=u'Match', number=u'xxxxxxxxxxxx5100', expiration_month=12, href=u'/cards/CC4zyuNpxY0A0eAf87SeULCR', type=u'credit', id=u'CC4zyuNpxY0A0eAf87SeULCR', category=u'other', is_verified=True, cvv_match=u'yes', bank_name=u'BANK OF HAWAII', avs_street_match=None, brand=u'MasterCard', updated_at=u'2015-01-09T03:23:56.070888Z', fingerprint=u'fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788', can_debit=True, name=None, expiration_year=2020, cvv=u'xxx', avs_postal_match=None, avs_result=None, can_credit=False, meta={u'twitter.id': u'1234987650', u'facebook.user_id': u'0192837465', u'my-own-customer-id': u'12345'}, created_at=u'2015-01-09T03:23:51.373358Z', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}) % endif \ No newline at end of file diff --git a/scenarios/credit_list/executable.py b/scenarios/credit_list/executable.py index e810221..673ce94 100644 --- a/scenarios/credit_list/executable.py +++ b/scenarios/credit_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') credits = balanced.Credit.query \ No newline at end of file diff --git a/scenarios/credit_list/python.mako b/scenarios/credit_list/python.mako index f5a160a..c58eafd 100644 --- a/scenarios/credit_list/python.mako +++ b/scenarios/credit_list/python.mako @@ -4,7 +4,7 @@ balanced.Credit.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') credits = balanced.Credit.query % elif mode == 'response': diff --git a/scenarios/credit_list_bank_account/definition.mako b/scenarios/credit_list_bank_account/definition.mako index 5cfd639..8dd38f7 100644 --- a/scenarios/credit_list_bank_account/definition.mako +++ b/scenarios/credit_list_bank_account/definition.mako @@ -1 +1 @@ -balanced.BankAccount().credits \ No newline at end of file +balanced.BankAccount.credits() \ No newline at end of file diff --git a/scenarios/credit_list_bank_account/executable.py b/scenarios/credit_list_bank_account/executable.py index 6c4bb68..e57530c 100644 --- a/scenarios/credit_list_bank_account/executable.py +++ b/scenarios/credit_list_bank_account/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy/credits') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN') credits = bank_account.credits \ No newline at end of file diff --git a/scenarios/credit_list_bank_account/python.mako b/scenarios/credit_list_bank_account/python.mako index e4f6f5a..df7dafa 100644 --- a/scenarios/credit_list_bank_account/python.mako +++ b/scenarios/credit_list_bank_account/python.mako @@ -1,11 +1,11 @@ % if mode == 'definition': -balanced.BankAccount().credits +balanced.BankAccount.credits() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -bank_account = balanced.BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy/credits') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN') credits = bank_account.credits % elif mode == 'response': diff --git a/scenarios/credit_list_bank_account/request.mako b/scenarios/credit_list_bank_account/request.mako index 1043ffc..53542ea 100644 --- a/scenarios/credit_list_bank_account/request.mako +++ b/scenarios/credit_list_bank_account/request.mako @@ -1,5 +1,5 @@ <%namespace file='/_main.mako' name='main'/> <% main.python_boilerplate() %> -bank_account = balanced.BankAccount.fetch('${request['uri']}') +bank_account = balanced.BankAccount.fetch('${request['bank_account_href']}') credits = bank_account.credits \ No newline at end of file diff --git a/scenarios/credit_order/definition.mako b/scenarios/credit_order/definition.mako new file mode 100644 index 0000000..0f57856 --- /dev/null +++ b/scenarios/credit_order/definition.mako @@ -0,0 +1 @@ +balanced.Order().credit_to() \ No newline at end of file diff --git a/scenarios/credit_order/executable.py b/scenarios/credit_order/executable.py new file mode 100644 index 0000000..eb07a69 --- /dev/null +++ b/scenarios/credit_order/executable.py @@ -0,0 +1,10 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN/credits') +order.credit_to( + amount=5000, + destination=bank_account +) \ No newline at end of file diff --git a/scenarios/credit_order/python.mako b/scenarios/credit_order/python.mako new file mode 100644 index 0000000..bf5dc4c --- /dev/null +++ b/scenarios/credit_order/python.mako @@ -0,0 +1,16 @@ +% if mode == 'definition': +balanced.Order().credit_to() +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN/credits') +order.credit_to( + amount=5000, + destination=bank_account +) +% elif mode == 'response': + +% endif \ No newline at end of file diff --git a/scenarios/credit_order/request.mako b/scenarios/credit_order/request.mako new file mode 100644 index 0000000..c35079c --- /dev/null +++ b/scenarios/credit_order/request.mako @@ -0,0 +1,9 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +order = balanced.Order.fetch('${request['order_href']}') +bank_account = balanced.BankAccount.fetch('${request['bank_account_href']}') +order.credit_to( + amount=${payload['amount']}, + destination=bank_account +) \ No newline at end of file diff --git a/scenarios/credit_show/executable.py b/scenarios/credit_show/executable.py index 8e9951e..0a7f6af 100644 --- a/scenarios/credit_show/executable.py +++ b/scenarios/credit_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -credit = balanced.Credit.fetch('/credits/CR2UtQgq6L3FPd1YoOc8eyOC') \ No newline at end of file +credit = balanced.Credit.fetch('/credits/CR4RdgCoOqYhr4sjPdcDjf3T') \ No newline at end of file diff --git a/scenarios/credit_show/python.mako b/scenarios/credit_show/python.mako index 10114a6..e3ee829 100644 --- a/scenarios/credit_show/python.mako +++ b/scenarios/credit_show/python.mako @@ -4,9 +4,9 @@ balanced.Credit.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -credit = balanced.Credit.fetch('/credits/CR2UtQgq6L3FPd1YoOc8eyOC') +credit = balanced.Credit.fetch('/credits/CR4RdgCoOqYhr4sjPdcDjf3T') % elif mode == 'response': -Credit(status=u'succeeded', description=None, links={u'customer': u'CU2N5goX8AQJE0CCPeapHUsM', u'destination': u'BA2QAksIxlLt60lqKc1wwgJy', u'order': None}, amount=5000, created_at=u'2014-01-27T22:57:19.073817Z', updated_at=u'2014-01-27T22:57:20.208794Z', failure_reason=None, currency=u'USD', transaction_number=u'CR408-633-3169', href=u'/credits/CR2UtQgq6L3FPd1YoOc8eyOC', meta={}, failure_reason_code=None, appears_on_statement_as=u'example.com', id=u'CR2UtQgq6L3FPd1YoOc8eyOC') +Credit(status=u'pending', description=None, links={u'customer': u'CU3o1ZAd8Gtxz6ZTIFK9YmsM', u'destination': u'BA45anEaEr8g0lOhzhcE9VAN', u'order': None}, amount=5000, created_at=u'2015-01-09T03:24:07.078171Z', updated_at=u'2015-01-09T03:24:07.425391Z', failure_reason=None, currency=u'USD', transaction_number=u'CRGY7-P5M-OXHO', href=u'/credits/CR4RdgCoOqYhr4sjPdcDjf3T', meta={}, failure_reason_code=None, appears_on_statement_as=u'example.com', id=u'CR4RdgCoOqYhr4sjPdcDjf3T') % endif \ No newline at end of file diff --git a/scenarios/credit_update/executable.py b/scenarios/credit_update/executable.py index 0c39cbf..b51240c 100644 --- a/scenarios/credit_update/executable.py +++ b/scenarios/credit_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -credit = balanced.Credit.fetch('/credits/CR2UtQgq6L3FPd1YoOc8eyOC') +credit = balanced.Credit.fetch('/credits/CR4RdgCoOqYhr4sjPdcDjf3T') credit.meta = { 'twitter.id': '1234987650', 'facebook.user_id': '0192837465', diff --git a/scenarios/credit_update/python.mako b/scenarios/credit_update/python.mako index c0ed43e..465064c 100644 --- a/scenarios/credit_update/python.mako +++ b/scenarios/credit_update/python.mako @@ -3,9 +3,9 @@ balanced.Credit().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -credit = balanced.Credit.fetch('/credits/CR2UtQgq6L3FPd1YoOc8eyOC') +credit = balanced.Credit.fetch('/credits/CR4RdgCoOqYhr4sjPdcDjf3T') credit.meta = { 'twitter.id': '1234987650', 'facebook.user_id': '0192837465', @@ -13,5 +13,5 @@ credit.meta = { } credit.save() % elif mode == 'response': -Credit(status=u'succeeded', description=u'New description for credit', links={u'customer': u'CU2N5goX8AQJE0CCPeapHUsM', u'destination': u'BA2QAksIxlLt60lqKc1wwgJy', u'order': None}, amount=5000, created_at=u'2014-01-27T22:57:19.073817Z', updated_at=u'2014-01-27T22:57:25.832930Z', failure_reason=None, currency=u'USD', transaction_number=u'CR408-633-3169', href=u'/credits/CR2UtQgq6L3FPd1YoOc8eyOC', meta={u'facebook.id': u'1234567890', u'anykey': u'valuegoeshere'}, failure_reason_code=None, appears_on_statement_as=u'example.com', id=u'CR2UtQgq6L3FPd1YoOc8eyOC') +Credit(status=u'pending', description=u'New description for credit', links={u'customer': u'CU3o1ZAd8Gtxz6ZTIFK9YmsM', u'destination': u'BA45anEaEr8g0lOhzhcE9VAN', u'order': None}, amount=5000, created_at=u'2015-01-09T03:24:07.078171Z', updated_at=u'2015-01-09T03:24:15.880088Z', failure_reason=None, currency=u'USD', transaction_number=u'CRGY7-P5M-OXHO', href=u'/credits/CR4RdgCoOqYhr4sjPdcDjf3T', meta={u'facebook.id': u'1234567890', u'anykey': u'valuegoeshere'}, failure_reason_code=None, appears_on_statement_as=u'example.com', id=u'CR4RdgCoOqYhr4sjPdcDjf3T') % endif \ No newline at end of file diff --git a/scenarios/customer_create/executable.py b/scenarios/customer_create/executable.py index 7e9c414..d67d79e 100644 --- a/scenarios/customer_create/executable.py +++ b/scenarios/customer_create/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') customer = balanced.Customer( dob_year=1963, diff --git a/scenarios/customer_create/python.mako b/scenarios/customer_create/python.mako index 3bedec0..55ac777 100644 --- a/scenarios/customer_create/python.mako +++ b/scenarios/customer_create/python.mako @@ -3,7 +3,7 @@ balanced.Customer().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') customer = balanced.Customer( dob_year=1963, @@ -14,5 +14,5 @@ customer = balanced.Customer( } ).save() % elif mode == 'response': -Customer(name=u'Henry Ford', links={u'source': None, u'destination': None}, created_at=u'2014-01-27T22:57:36.586782Z', dob_month=7, updated_at=u'2014-01-27T22:57:37.740442Z', phone=None, href=u'/customers/CU3eeasZ9yQ86uzzIYZkrPGg', meta={}, dob_year=1963, email=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': u'48120', u'country_code': None}, id=u'CU3eeasZ9yQ86uzzIYZkrPGg', business_name=None, ssn_last4=None, merchant_status=u'underwritten', ein=None) +Customer(name=u'Henry Ford', links={u'source': None, u'destination': None}, created_at=u'2015-01-09T03:24:47.364051Z', dob_month=7, updated_at=u'2015-01-09T03:24:47.598887Z', phone=None, href=u'/customers/CU5AxbQrjAcjsbquafnvwaas', meta={}, dob_year=1963, email=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': u'48120', u'country_code': None}, id=u'CU5AxbQrjAcjsbquafnvwaas', business_name=None, ssn_last4=None, merchant_status=u'underwritten', ein=None) % endif \ No newline at end of file diff --git a/scenarios/customer_delete/executable.py b/scenarios/customer_delete/executable.py index 9c125931..0418f8b 100644 --- a/scenarios/customer_delete/executable.py +++ b/scenarios/customer_delete/executable.py @@ -1,6 +1,6 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -customer = balanced.Customer.fetch('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') +customer = balanced.Customer.fetch('/customers/CU5AxbQrjAcjsbquafnvwaas') customer.unstore() \ No newline at end of file diff --git a/scenarios/customer_delete/python.mako b/scenarios/customer_delete/python.mako index fc98d5d..05dde83 100644 --- a/scenarios/customer_delete/python.mako +++ b/scenarios/customer_delete/python.mako @@ -3,9 +3,9 @@ balanced.Customer().unstore() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -customer = balanced.Customer.fetch('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') +customer = balanced.Customer.fetch('/customers/CU5AxbQrjAcjsbquafnvwaas') customer.unstore() % elif mode == 'response': diff --git a/scenarios/customer_list/executable.py b/scenarios/customer_list/executable.py index 4eae1e9..d347509 100644 --- a/scenarios/customer_list/executable.py +++ b/scenarios/customer_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') customers = balanced.Customer.query \ No newline at end of file diff --git a/scenarios/customer_list/python.mako b/scenarios/customer_list/python.mako index 8210aae..70572e1 100644 --- a/scenarios/customer_list/python.mako +++ b/scenarios/customer_list/python.mako @@ -4,7 +4,7 @@ balanced.Customer.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') customers = balanced.Customer.query % elif mode == 'response': diff --git a/scenarios/customer_show/executable.py b/scenarios/customer_show/executable.py index 261e48e..caa72fe 100644 --- a/scenarios/customer_show/executable.py +++ b/scenarios/customer_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -customer = balanced.Customer.fetch('/customers/CU33Y4cut21qu1d1lGYDBseQ') \ No newline at end of file +customer = balanced.Customer.fetch('/customers/CU5aACCvYYfV6mcWJL4TEcK1') \ No newline at end of file diff --git a/scenarios/customer_show/python.mako b/scenarios/customer_show/python.mako index 4e63497..d37dd56 100644 --- a/scenarios/customer_show/python.mako +++ b/scenarios/customer_show/python.mako @@ -4,9 +4,9 @@ balanced.Customer.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -customer = balanced.Customer.fetch('/customers/CU33Y4cut21qu1d1lGYDBseQ') +customer = balanced.Customer.fetch('/customers/CU5aACCvYYfV6mcWJL4TEcK1') % elif mode == 'response': -Customer(name=u'Henry Ford', links={u'source': None, u'destination': None}, created_at=u'2014-01-27T22:57:27.459187Z', dob_month=7, updated_at=u'2014-01-27T22:57:29.488272Z', phone=None, href=u'/customers/CU33Y4cut21qu1d1lGYDBseQ', meta={}, dob_year=1963, email=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': u'48120', u'country_code': None}, id=u'CU33Y4cut21qu1d1lGYDBseQ', business_name=None, ssn_last4=None, merchant_status=u'underwritten', ein=None) +Customer(name=u'Henry Ford', links={u'source': None, u'destination': None}, created_at=u'2015-01-09T03:24:24.298841Z', dob_month=7, updated_at=u'2015-01-09T03:24:24.504781Z', phone=None, href=u'/customers/CU5aACCvYYfV6mcWJL4TEcK1', meta={}, dob_year=1963, email=None, address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': u'48120', u'country_code': None}, id=u'CU5aACCvYYfV6mcWJL4TEcK1', business_name=None, ssn_last4=None, merchant_status=u'underwritten', ein=None) % endif \ No newline at end of file diff --git a/scenarios/customer_update/executable.py b/scenarios/customer_update/executable.py index cd8b092..118e5af 100644 --- a/scenarios/customer_update/executable.py +++ b/scenarios/customer_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -customer = balanced.Debit.fetch('/customers/CU33Y4cut21qu1d1lGYDBseQ') +customer = balanced.Debit.fetch('/customers/CU5aACCvYYfV6mcWJL4TEcK1') customer.email = 'email@newdomain.com' customer.meta = { 'shipping-preference': 'ground' diff --git a/scenarios/customer_update/python.mako b/scenarios/customer_update/python.mako index 026313f..9739721 100644 --- a/scenarios/customer_update/python.mako +++ b/scenarios/customer_update/python.mako @@ -3,14 +3,14 @@ balanced.Customer().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -customer = balanced.Debit.fetch('/customers/CU33Y4cut21qu1d1lGYDBseQ') +customer = balanced.Debit.fetch('/customers/CU5aACCvYYfV6mcWJL4TEcK1') customer.email = 'email@newdomain.com' customer.meta = { 'shipping-preference': 'ground' } customer.save() % elif mode == 'response': -Customer(name=u'Henry Ford', links={u'source': None, u'destination': None}, created_at=u'2014-01-27T22:57:27.459187Z', dob_month=7, updated_at=u'2014-01-27T22:57:34.512310Z', phone=None, href=u'/customers/CU33Y4cut21qu1d1lGYDBseQ', meta={u'shipping-preference': u'ground'}, dob_year=1963, email=u'email@newdomain.com', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': u'48120', u'country_code': None}, id=u'CU33Y4cut21qu1d1lGYDBseQ', business_name=None, ssn_last4=None, merchant_status=u'underwritten', ein=None) +Customer(name=u'Henry Ford', links={u'source': None, u'destination': None}, created_at=u'2015-01-09T03:24:24.298841Z', dob_month=7, updated_at=u'2015-01-09T03:24:42.621096Z', phone=None, href=u'/customers/CU5aACCvYYfV6mcWJL4TEcK1', meta={u'shipping-preference': u'ground'}, dob_year=1963, email=u'email@newdomain.com', address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': u'48120', u'country_code': None}, id=u'CU5aACCvYYfV6mcWJL4TEcK1', business_name=None, ssn_last4=None, merchant_status=u'underwritten', ein=None) % endif \ No newline at end of file diff --git a/scenarios/debit_dispute_show/definition.mako b/scenarios/debit_dispute_show/definition.mako new file mode 100644 index 0000000..ce8c692 --- /dev/null +++ b/scenarios/debit_dispute_show/definition.mako @@ -0,0 +1 @@ +balanced.Debit().dispute diff --git a/scenarios/debit_dispute_show/executable.py b/scenarios/debit_dispute_show/executable.py new file mode 100644 index 0000000..5a01719 --- /dev/null +++ b/scenarios/debit_dispute_show/executable.py @@ -0,0 +1,6 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +debit = balanced.Debit.fetch('/debits/WD5SwXr9jcCfCmmjTH5MCMFD') +dispute = debit.dispute \ No newline at end of file diff --git a/scenarios/debit_dispute_show/python.mako b/scenarios/debit_dispute_show/python.mako new file mode 100644 index 0000000..6be7f8f --- /dev/null +++ b/scenarios/debit_dispute_show/python.mako @@ -0,0 +1,13 @@ +% if mode == 'definition': +balanced.Debit().dispute + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +debit = balanced.Debit.fetch('/debits/WD5SwXr9jcCfCmmjTH5MCMFD') +dispute = debit.dispute +% elif mode == 'response': +Dispute(status=u'pending', links={u'transaction': u'WD5SwXr9jcCfCmmjTH5MCMFD'}, respond_by=u'2015-02-08T03:22:35.440841Z', amount=5000, created_at=u'2015-01-09T03:25:14.170586Z', updated_at=u'2015-01-09T03:25:14.170588Z', initiated_at=u'2015-01-09T03:22:35.440838Z', currency=u'USD', reason=u'fraud', href=u'/disputes/DT64FIXm5agnVqfCMHZVe8dR', meta={}, id=u'DT64FIXm5agnVqfCMHZVe8dR') +% endif \ No newline at end of file diff --git a/scenarios/debit_dispute_show/request.mako b/scenarios/debit_dispute_show/request.mako new file mode 100644 index 0000000..1406a28 --- /dev/null +++ b/scenarios/debit_dispute_show/request.mako @@ -0,0 +1,5 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +debit = balanced.Debit.fetch('${request['debit_href']}') +dispute = debit.dispute \ No newline at end of file diff --git a/scenarios/debit_list/executable.py b/scenarios/debit_list/executable.py index fbe2eef..e2c9191 100644 --- a/scenarios/debit_list/executable.py +++ b/scenarios/debit_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') debits = balanced.Debit.query \ No newline at end of file diff --git a/scenarios/debit_list/python.mako b/scenarios/debit_list/python.mako index a5f3f41..f62fb57 100644 --- a/scenarios/debit_list/python.mako +++ b/scenarios/debit_list/python.mako @@ -4,7 +4,7 @@ balanced.Debit.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') debits = balanced.Debit.query % elif mode == 'response': diff --git a/scenarios/debit_order/definition.mako b/scenarios/debit_order/definition.mako new file mode 100644 index 0000000..eda6428 --- /dev/null +++ b/scenarios/debit_order/definition.mako @@ -0,0 +1 @@ +balanced.Order().debit_from() diff --git a/scenarios/debit_order/executable.py b/scenarios/debit_order/executable.py new file mode 100644 index 0000000..7f34819 --- /dev/null +++ b/scenarios/debit_order/executable.py @@ -0,0 +1,10 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') +order.debit_from( + amount=5000, + source=card, +) \ No newline at end of file diff --git a/scenarios/debit_order/python.mako b/scenarios/debit_order/python.mako new file mode 100644 index 0000000..90b478a --- /dev/null +++ b/scenarios/debit_order/python.mako @@ -0,0 +1,17 @@ +% if mode == 'definition': +balanced.Order().debit_from() + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +order = balanced.Order.fetch('/orders/OR3vURGwVtqDnnkRS9fgH41G') +card = balanced.Card.fetch('/cards/CC4zyuNpxY0A0eAf87SeULCR') +order.debit_from( + amount=5000, + source=card, +) +% elif mode == 'response': +Debit(status=u'succeeded', description=u'Order #12341234', links={u'customer': None, u'source': u'CC4zyuNpxY0A0eAf87SeULCR', u'dispute': None, u'order': u'OR3vURGwVtqDnnkRS9fgH41G', u'card_hold': u'HL4JLr6FnToEyeoEdOCOTpC5'}, amount=5000, created_at=u'2015-01-09T03:24:00.472796Z', updated_at=u'2015-01-09T03:24:01.120118Z', failure_reason=None, currency=u'USD', transaction_number=u'W2W2-G3K-YCMU', href=u'/debits/WD4JMhEQTuXpqzpBvpgDo633', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*example.com', id=u'WD4JMhEQTuXpqzpBvpgDo633') +% endif \ No newline at end of file diff --git a/scenarios/debit_order/request.mako b/scenarios/debit_order/request.mako new file mode 100644 index 0000000..699e0a5 --- /dev/null +++ b/scenarios/debit_order/request.mako @@ -0,0 +1,9 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +order = balanced.Order.fetch('${request['order_href']}') +card = balanced.Card.fetch('${request['card_href']}') +order.debit_from( + amount=${payload['amount']}, + source=card, +) diff --git a/scenarios/debit_show/executable.py b/scenarios/debit_show/executable.py index 78cff4a..213731c 100644 --- a/scenarios/debit_show/executable.py +++ b/scenarios/debit_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -debit = balanced.Debit.fetch('/debits/WD2Fd3jVcMZEWyXHtG3U1LRM') \ No newline at end of file +debit = balanced.Debit.fetch('/debits/WD5EW7vbyXlTsudIGF5AkrEA') \ No newline at end of file diff --git a/scenarios/debit_show/python.mako b/scenarios/debit_show/python.mako index a27ac91..0c27f46 100644 --- a/scenarios/debit_show/python.mako +++ b/scenarios/debit_show/python.mako @@ -4,9 +4,9 @@ balanced.Debit.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -debit = balanced.Debit.fetch('/debits/WD2Fd3jVcMZEWyXHtG3U1LRM') +debit = balanced.Debit.fetch('/debits/WD5EW7vbyXlTsudIGF5AkrEA') % elif mode == 'response': -Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': None, u'source': u'CC2uc8iPDjgyxOXHVtnZloyI', u'order': None, u'dispute': None}, amount=5000, created_at=u'2014-01-27T22:57:05.511023Z', updated_at=u'2014-01-27T22:57:10.153696Z', failure_reason=None, currency=u'USD', transaction_number=u'W906-153-1439', href=u'/debits/WD2Fd3jVcMZEWyXHtG3U1LRM', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD2Fd3jVcMZEWyXHtG3U1LRM') +Debit(status=u'succeeded', description=u'Some descriptive text for the debit in the dashboard', links={u'customer': None, u'source': u'CC4zyuNpxY0A0eAf87SeULCR', u'dispute': None, u'order': None, u'card_hold': u'HL5EUR5M3MniPMPUQM0hDdeg'}, amount=5000, created_at=u'2015-01-09T03:24:51.290112Z', updated_at=u'2015-01-09T03:24:52.004949Z', failure_reason=None, currency=u'USD', transaction_number=u'WMBW-XBR-0C9N', href=u'/debits/WD5EW7vbyXlTsudIGF5AkrEA', meta={}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD5EW7vbyXlTsudIGF5AkrEA') % endif \ No newline at end of file diff --git a/scenarios/debit_update/executable.py b/scenarios/debit_update/executable.py index 4012e22..685698a 100644 --- a/scenarios/debit_update/executable.py +++ b/scenarios/debit_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -debit = balanced.Debit.fetch('/debits/WD2Fd3jVcMZEWyXHtG3U1LRM') +debit = balanced.Debit.fetch('/debits/WD5EW7vbyXlTsudIGF5AkrEA') debit.description = 'New description for debit' debit.meta = { 'facebook.id': '1234567890', diff --git a/scenarios/debit_update/python.mako b/scenarios/debit_update/python.mako index cb4a441..c026387 100644 --- a/scenarios/debit_update/python.mako +++ b/scenarios/debit_update/python.mako @@ -3,9 +3,9 @@ balanced.Debit().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -debit = balanced.Debit.fetch('/debits/WD2Fd3jVcMZEWyXHtG3U1LRM') +debit = balanced.Debit.fetch('/debits/WD5EW7vbyXlTsudIGF5AkrEA') debit.description = 'New description for debit' debit.meta = { 'facebook.id': '1234567890', @@ -13,5 +13,5 @@ debit.meta = { } debit.save() % elif mode == 'response': -Debit(status=u'succeeded', description=u'New description for debit', links={u'customer': None, u'source': u'CC2uc8iPDjgyxOXHVtnZloyI', u'order': None, u'dispute': None}, amount=5000, created_at=u'2014-01-27T22:57:05.511023Z', updated_at=u'2014-01-27T22:57:53.776191Z', failure_reason=None, currency=u'USD', transaction_number=u'W906-153-1439', href=u'/debits/WD2Fd3jVcMZEWyXHtG3U1LRM', meta={u'facebook.id': u'1234567890', u'anykey': u'valuegoeshere'}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD2Fd3jVcMZEWyXHtG3U1LRM') +Debit(status=u'succeeded', description=u'New description for debit', links={u'customer': None, u'source': u'CC4zyuNpxY0A0eAf87SeULCR', u'dispute': None, u'order': None, u'card_hold': u'HL5EUR5M3MniPMPUQM0hDdeg'}, amount=5000, created_at=u'2015-01-09T03:24:51.290112Z', updated_at=u'2015-01-09T03:24:56.837641Z', failure_reason=None, currency=u'USD', transaction_number=u'WMBW-XBR-0C9N', href=u'/debits/WD5EW7vbyXlTsudIGF5AkrEA', meta={u'facebook.id': u'1234567890', u'anykey': u'valuegoeshere'}, failure_reason_code=None, appears_on_statement_as=u'BAL*Statement text', id=u'WD5EW7vbyXlTsudIGF5AkrEA') % endif \ No newline at end of file diff --git a/scenarios/dispute_list/definition.mako b/scenarios/dispute_list/definition.mako new file mode 100644 index 0000000..e3b1ab2 --- /dev/null +++ b/scenarios/dispute_list/definition.mako @@ -0,0 +1 @@ +balanced.Dispute.query \ No newline at end of file diff --git a/scenarios/dispute_list/executable.py b/scenarios/dispute_list/executable.py new file mode 100644 index 0000000..5a9ca78 --- /dev/null +++ b/scenarios/dispute_list/executable.py @@ -0,0 +1,5 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +disputes = balanced.Dispute.query \ No newline at end of file diff --git a/scenarios/dispute_list/python.mako b/scenarios/dispute_list/python.mako new file mode 100644 index 0000000..cb5ece1 --- /dev/null +++ b/scenarios/dispute_list/python.mako @@ -0,0 +1,11 @@ +% if mode == 'definition': +balanced.Dispute.query +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +disputes = balanced.Dispute.query +% elif mode == 'response': + +% endif \ No newline at end of file diff --git a/scenarios/dispute_list/request.mako b/scenarios/dispute_list/request.mako new file mode 100644 index 0000000..cbd6885 --- /dev/null +++ b/scenarios/dispute_list/request.mako @@ -0,0 +1,4 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +disputes = balanced.Dispute.query \ No newline at end of file diff --git a/scenarios/dispute_show/definition.mako b/scenarios/dispute_show/definition.mako new file mode 100644 index 0000000..6fb713f --- /dev/null +++ b/scenarios/dispute_show/definition.mako @@ -0,0 +1 @@ +balanced.Dispute.fetch() diff --git a/scenarios/dispute_show/executable.py b/scenarios/dispute_show/executable.py new file mode 100644 index 0000000..3987715 --- /dev/null +++ b/scenarios/dispute_show/executable.py @@ -0,0 +1,5 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +dispute = balanced.Dispute.fetch('/disputes/DT64FIXm5agnVqfCMHZVe8dR') \ No newline at end of file diff --git a/scenarios/dispute_show/python.mako b/scenarios/dispute_show/python.mako new file mode 100644 index 0000000..a2e607f --- /dev/null +++ b/scenarios/dispute_show/python.mako @@ -0,0 +1,12 @@ +% if mode == 'definition': +balanced.Dispute.fetch() + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +dispute = balanced.Dispute.fetch('/disputes/DT64FIXm5agnVqfCMHZVe8dR') +% elif mode == 'response': +Dispute(status=u'pending', links={u'transaction': u'WD5SwXr9jcCfCmmjTH5MCMFD'}, respond_by=u'2015-02-08T03:22:35.440841Z', amount=5000, created_at=u'2015-01-09T03:25:14.170586Z', updated_at=u'2015-01-09T03:25:14.170588Z', initiated_at=u'2015-01-09T03:22:35.440838Z', currency=u'USD', reason=u'fraud', href=u'/disputes/DT64FIXm5agnVqfCMHZVe8dR', meta={}, id=u'DT64FIXm5agnVqfCMHZVe8dR') +% endif \ No newline at end of file diff --git a/scenarios/dispute_show/request.mako b/scenarios/dispute_show/request.mako new file mode 100644 index 0000000..c9e302e --- /dev/null +++ b/scenarios/dispute_show/request.mako @@ -0,0 +1,4 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +dispute = balanced.Dispute.fetch('${request['uri']}') \ No newline at end of file diff --git a/scenarios/event_list/executable.py b/scenarios/event_list/executable.py index d7b8e96..a5be556 100644 --- a/scenarios/event_list/executable.py +++ b/scenarios/event_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') events = balanced.Event.query \ No newline at end of file diff --git a/scenarios/event_list/python.mako b/scenarios/event_list/python.mako index 382abd2..2704919 100644 --- a/scenarios/event_list/python.mako +++ b/scenarios/event_list/python.mako @@ -4,7 +4,7 @@ balanced.Event.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') events = balanced.Event.query % elif mode == 'response': diff --git a/scenarios/event_show/executable.py b/scenarios/event_show/executable.py index 12d0795..8c898bb 100644 --- a/scenarios/event_show/executable.py +++ b/scenarios/event_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -event = balanced.Event.fetch('/events/EV2abbb98487a611e3a86f026ba7d31e6f') \ No newline at end of file +event = balanced.Event.fetch('/events/EVc7cbc12497ae11e48e4606debca797bb') \ No newline at end of file diff --git a/scenarios/event_show/python.mako b/scenarios/event_show/python.mako index 0e96376..1ed1bc6 100644 --- a/scenarios/event_show/python.mako +++ b/scenarios/event_show/python.mako @@ -4,9 +4,9 @@ balanced.Event.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -event = balanced.Event.fetch('/events/EV2abbb98487a611e3a86f026ba7d31e6f') +event = balanced.Event.fetch('/events/EVc7cbc12497ae11e48e4606debca797bb') % elif mode == 'response': -Event(links={}, occurred_at=u'2014-01-27T22:55:50.767000Z', entity={u'customers': [{u'name': None, u'links': {u'source': None, u'destination': None}, u'updated_at': u'2014-01-27T22:55:50.767858Z', u'created_at': u'2014-01-27T22:55:50.253066Z', u'dob_month': None, u'merchant_status': u'no-match', u'id': u'CU1iDnBalzHoZg47Np92rNrV', u'phone': None, u'href': u'/customers/CU1iDnBalzHoZg47Np92rNrV', u'meta': {}, u'dob_year': None, u'address': {u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, u'business_name': None, u'ssn_last4': None, u'email': None, u'ein': None}], u'links': {u'customers.source': u'/resources/{customers.source}', u'customers.card_holds': u'/customers/{customers.id}/card_holds', u'customers.cards': u'/customers/{customers.id}/cards', u'customers.debits': u'/customers/{customers.id}/debits', u'customers.destination': u'/resources/{customers.destination}', u'customers.bank_accounts': u'/customers/{customers.id}/bank_accounts', u'customers.transactions': u'/customers/{customers.id}/transactions', u'customers.refunds': u'/customers/{customers.id}/refunds', u'customers.reversals': u'/customers/{customers.id}/reversals', u'customers.orders': u'/customers/{customers.id}/orders', u'customers.credits': u'/customers/{customers.id}/credits'}}, href=u'/events/EV2abbb98487a611e3a86f026ba7d31e6f', callback_statuses={u'failed': 0, u'retrying': 0, u'succeeded': 0, u'pending': 0}, type=u'account.created', id=u'EV2abbb98487a611e3a86f026ba7d31e6f') +Event(links={}, occurred_at=u'2015-01-09T03:25:04.090381Z', entity={u'debits': [{u'status': u'succeeded', u'description': u'Some descriptive text for the debit in the dashboard', u'links': {u'customer': None, u'source': u'CC5RRvpnZIg0PWdSphR8xxPa', u'dispute': u'DT64FIXm5agnVqfCMHZVe8dR', u'order': None, u'card_hold': u'HL5Svbmw6nDDP5HO2RblsBCJ'}, u'href': u'/debits/WD5SwXr9jcCfCmmjTH5MCMFD', u'created_at': u'2015-01-09T03:25:03.383375Z', u'transaction_number': u'WA4K-D44-O5DR', u'failure_reason': None, u'updated_at': u'2015-01-09T03:25:04.090381Z', u'currency': u'USD', u'amount': 5000, u'failure_reason_code': None, u'meta': {}, u'appears_on_statement_as': u'BAL*Statement text', u'id': u'WD5SwXr9jcCfCmmjTH5MCMFD'}], u'links': {u'debits.customer': u'/customers/{debits.customer}', u'debits.dispute': u'/disputes/{debits.dispute}', u'debits.card_hold': u'/holds/{debits.card_hold}', u'debits.source': u'/resources/{debits.source}', u'debits.order': u'/orders/{debits.order}', u'debits.refunds': u'/debits/{debits.id}/refunds', u'debits.events': u'/debits/{debits.id}/events'}}, href=u'/events/EVc7cbc12497ae11e48e4606debca797bb', callback_statuses={u'failed': 0, u'retrying': 0, u'succeeded': 0, u'pending': 1}, type=u'debit.succeeded', id=u'EVc7cbc12497ae11e48e4606debca797bb') % endif \ No newline at end of file diff --git a/scenarios/order_create/executable.py b/scenarios/order_create/executable.py index dbfc872..ec309db 100644 --- a/scenarios/order_create/executable.py +++ b/scenarios/order_create/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -merchant_customer = balanced.Customer.fetch('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') +merchant_customer = balanced.Customer.fetch('/customers/CU5AxbQrjAcjsbquafnvwaas') merchant_customer.create_order( description='Order #12341234' ).save() \ No newline at end of file diff --git a/scenarios/order_create/python.mako b/scenarios/order_create/python.mako index 636901b..0a2d64b 100644 --- a/scenarios/order_create/python.mako +++ b/scenarios/order_create/python.mako @@ -3,12 +3,12 @@ balanced.Order() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -merchant_customer = balanced.Customer.fetch('/customers/CU3eeasZ9yQ86uzzIYZkrPGg') +merchant_customer = balanced.Customer.fetch('/customers/CU5AxbQrjAcjsbquafnvwaas') merchant_customer.create_order( description='Order #12341234' ).save() % elif mode == 'response': -Order(delivery_address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, description=u'Order #12341234', links={u'merchant': u'CU3eeasZ9yQ86uzzIYZkrPGg'}, created_at=u'2014-01-27T22:58:01.115720Z', updated_at=u'2014-01-27T22:58:01.115723Z', currency=u'USD', amount=0, href=u'/orders/OR3FOihZa7lMHdAP5p8BJZVY', meta={}, id=u'OR3FOihZa7lMHdAP5p8BJZVY', amount_escrowed=0) +Order(delivery_address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, description=u'Order #12341234', links={u'merchant': u'CU5AxbQrjAcjsbquafnvwaas'}, created_at=u'2015-01-09T03:25:31.087736Z', updated_at=u'2015-01-09T03:25:31.087737Z', currency=u'USD', amount=0, href=u'/orders/OR6nHTLOYehaSU5SoxqQE5WB', meta={}, id=u'OR6nHTLOYehaSU5SoxqQE5WB', amount_escrowed=0) % endif \ No newline at end of file diff --git a/scenarios/order_list/executable.py b/scenarios/order_list/executable.py index 9ca61c4..92d5d98 100644 --- a/scenarios/order_list/executable.py +++ b/scenarios/order_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') orders = balanced.Order.query \ No newline at end of file diff --git a/scenarios/order_list/python.mako b/scenarios/order_list/python.mako index 96c678a..8379c57 100644 --- a/scenarios/order_list/python.mako +++ b/scenarios/order_list/python.mako @@ -4,7 +4,7 @@ balanced.Order.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') orders = balanced.Order.query % elif mode == 'response': diff --git a/scenarios/order_show/executable.py b/scenarios/order_show/executable.py index 2f4dbad..b3ac814 100644 --- a/scenarios/order_show/executable.py +++ b/scenarios/order_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -order = balanced.Order.fetch('/orders/OR3FOihZa7lMHdAP5p8BJZVY') \ No newline at end of file +order = balanced.Order.fetch('/orders/OR6nHTLOYehaSU5SoxqQE5WB') \ No newline at end of file diff --git a/scenarios/order_show/python.mako b/scenarios/order_show/python.mako index 42f5792..36436db 100644 --- a/scenarios/order_show/python.mako +++ b/scenarios/order_show/python.mako @@ -4,9 +4,9 @@ balanced.Order.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -order = balanced.Order.fetch('/orders/OR3FOihZa7lMHdAP5p8BJZVY') +order = balanced.Order.fetch('/orders/OR6nHTLOYehaSU5SoxqQE5WB') % elif mode == 'response': -Order(delivery_address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, description=u'Order #12341234', links={u'merchant': u'CU3eeasZ9yQ86uzzIYZkrPGg'}, created_at=u'2014-01-27T22:58:01.115720Z', updated_at=u'2014-01-27T22:58:01.115723Z', currency=u'USD', amount=0, href=u'/orders/OR3FOihZa7lMHdAP5p8BJZVY', meta={}, id=u'OR3FOihZa7lMHdAP5p8BJZVY', amount_escrowed=0) +Order(delivery_address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, description=u'Order #12341234', links={u'merchant': u'CU5AxbQrjAcjsbquafnvwaas'}, created_at=u'2015-01-09T03:25:31.087736Z', updated_at=u'2015-01-09T03:25:31.087737Z', currency=u'USD', amount=0, href=u'/orders/OR6nHTLOYehaSU5SoxqQE5WB', meta={}, id=u'OR6nHTLOYehaSU5SoxqQE5WB', amount_escrowed=0) % endif \ No newline at end of file diff --git a/scenarios/order_update/executable.py b/scenarios/order_update/executable.py index 65b660a..90b2372 100644 --- a/scenarios/order_update/executable.py +++ b/scenarios/order_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -order = balanced.Order.fetch('/orders/OR3FOihZa7lMHdAP5p8BJZVY') +order = balanced.Order.fetch('/orders/OR6nHTLOYehaSU5SoxqQE5WB') order.description = 'New description for order' order.meta = { 'anykey': 'valuegoeshere', diff --git a/scenarios/order_update/python.mako b/scenarios/order_update/python.mako index f703b5b..67be965 100644 --- a/scenarios/order_update/python.mako +++ b/scenarios/order_update/python.mako @@ -3,9 +3,9 @@ balanced.Order().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -order = balanced.Order.fetch('/orders/OR3FOihZa7lMHdAP5p8BJZVY') +order = balanced.Order.fetch('/orders/OR6nHTLOYehaSU5SoxqQE5WB') order.description = 'New description for order' order.meta = { 'anykey': 'valuegoeshere', @@ -13,5 +13,5 @@ order.meta = { } order.save() % elif mode == 'response': -Order(delivery_address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, description=u'New description for order', links={u'merchant': u'CU3eeasZ9yQ86uzzIYZkrPGg'}, created_at=u'2014-01-27T22:58:01.115720Z', updated_at=u'2014-01-27T22:58:05.657463Z', currency=u'USD', amount=0, href=u'/orders/OR3FOihZa7lMHdAP5p8BJZVY', meta={u'product.id': u'1234567890', u'anykey': u'valuegoeshere'}, id=u'OR3FOihZa7lMHdAP5p8BJZVY', amount_escrowed=0) +Order(delivery_address={u'city': None, u'line2': None, u'line1': None, u'state': None, u'postal_code': None, u'country_code': None}, description=u'New description for order', links={u'merchant': u'CU5AxbQrjAcjsbquafnvwaas'}, created_at=u'2015-01-09T03:25:31.087736Z', updated_at=u'2015-01-09T03:25:34.898356Z', currency=u'USD', amount=0, href=u'/orders/OR6nHTLOYehaSU5SoxqQE5WB', meta={u'product.id': u'1234567890', u'anykey': u'valuegoeshere'}, id=u'OR6nHTLOYehaSU5SoxqQE5WB', amount_escrowed=0) % endif \ No newline at end of file diff --git a/scenarios/refund_create/executable.py b/scenarios/refund_create/executable.py index 4dd71db..545c010 100644 --- a/scenarios/refund_create/executable.py +++ b/scenarios/refund_create/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -debit = balanced.Debit.fetch('/debits/WD3MKNxNTKBGgA7mX50yogiu') +debit = balanced.Debit.fetch('/debits/WD5Nd61WpdlRk6D39YVNFAEo') refund = debit.refund( amount=3000, description="Refund for Order #1111", diff --git a/scenarios/refund_create/python.mako b/scenarios/refund_create/python.mako index eaee0d1..3965138 100644 --- a/scenarios/refund_create/python.mako +++ b/scenarios/refund_create/python.mako @@ -3,9 +3,9 @@ balanced.Debit().refund() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -debit = balanced.Debit.fetch('/debits/WD3MKNxNTKBGgA7mX50yogiu') +debit = balanced.Debit.fetch('/debits/WD5Nd61WpdlRk6D39YVNFAEo') refund = debit.refund( amount=3000, description="Refund for Order #1111", @@ -16,5 +16,5 @@ refund = debit.refund( } ) % elif mode == 'response': -Refund(status=u'succeeded', description=u'Refund for Order #1111', links={u'dispute': None, u'order': None, u'debit': u'WD3MKNxNTKBGgA7mX50yogiu'}, amount=3000, created_at=u'2014-01-27T22:58:11.375665Z', updated_at=u'2014-01-27T22:58:12.115131Z', currency=u'USD', transaction_number=u'RF383-088-7077', href=u'/refunds/RF3RklPuFgsgI50UuYtr4g6I', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, id=u'RF3RklPuFgsgI50UuYtr4g6I') +Refund(status=u'succeeded', description=u'Refund for Order #1111', links={u'dispute': None, u'order': None, u'debit': u'WD5Nd61WpdlRk6D39YVNFAEo'}, amount=3000, created_at=u'2015-01-09T03:25:00.202596Z', updated_at=u'2015-01-09T03:25:00.686907Z', currency=u'USD', transaction_number=u'RFN4R-7JB-96UV', href=u'/refunds/RF5OXw4w1a9g2GsPqQ2Hg9hj', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, id=u'RF5OXw4w1a9g2GsPqQ2Hg9hj') % endif \ No newline at end of file diff --git a/scenarios/refund_list/executable.py b/scenarios/refund_list/executable.py index 96d1062..cff31bf 100644 --- a/scenarios/refund_list/executable.py +++ b/scenarios/refund_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') refunds = balanced.Refund.query \ No newline at end of file diff --git a/scenarios/refund_list/python.mako b/scenarios/refund_list/python.mako index 2159578..002da20 100644 --- a/scenarios/refund_list/python.mako +++ b/scenarios/refund_list/python.mako @@ -4,7 +4,7 @@ balanced.Refund.query % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') refunds = balanced.Refund.query % elif mode == 'response': diff --git a/scenarios/refund_show/executable.py b/scenarios/refund_show/executable.py index 2e6aa9f..43e47b1 100644 --- a/scenarios/refund_show/executable.py +++ b/scenarios/refund_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -refund = balanced.Refund.fetch('/refunds/RF3RklPuFgsgI50UuYtr4g6I') \ No newline at end of file +refund = balanced.Refund.fetch('/refunds/RF5OXw4w1a9g2GsPqQ2Hg9hj') \ No newline at end of file diff --git a/scenarios/refund_show/python.mako b/scenarios/refund_show/python.mako index 9616b46..29bd36a 100644 --- a/scenarios/refund_show/python.mako +++ b/scenarios/refund_show/python.mako @@ -4,9 +4,9 @@ balanced.Refund.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -refund = balanced.Refund.fetch('/refunds/RF3RklPuFgsgI50UuYtr4g6I') +refund = balanced.Refund.fetch('/refunds/RF5OXw4w1a9g2GsPqQ2Hg9hj') % elif mode == 'response': -Refund(status=u'succeeded', description=u'Refund for Order #1111', links={u'dispute': None, u'order': None, u'debit': u'WD3MKNxNTKBGgA7mX50yogiu'}, amount=3000, created_at=u'2014-01-27T22:58:11.375665Z', updated_at=u'2014-01-27T22:58:12.115131Z', currency=u'USD', transaction_number=u'RF383-088-7077', href=u'/refunds/RF3RklPuFgsgI50UuYtr4g6I', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, id=u'RF3RklPuFgsgI50UuYtr4g6I') +Refund(status=u'succeeded', description=u'Refund for Order #1111', links={u'dispute': None, u'order': None, u'debit': u'WD5Nd61WpdlRk6D39YVNFAEo'}, amount=3000, created_at=u'2015-01-09T03:25:00.202596Z', updated_at=u'2015-01-09T03:25:00.686907Z', currency=u'USD', transaction_number=u'RFN4R-7JB-96UV', href=u'/refunds/RF5OXw4w1a9g2GsPqQ2Hg9hj', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, id=u'RF5OXw4w1a9g2GsPqQ2Hg9hj') % endif \ No newline at end of file diff --git a/scenarios/refund_update/executable.py b/scenarios/refund_update/executable.py index 6854534..113fbde 100644 --- a/scenarios/refund_update/executable.py +++ b/scenarios/refund_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -refund = balanced.Refund.fetch('/refunds/RF3RklPuFgsgI50UuYtr4g6I') +refund = balanced.Refund.fetch('/refunds/RF5OXw4w1a9g2GsPqQ2Hg9hj') refund.description = 'update this description' refund.meta = { 'user.refund.count': '3', diff --git a/scenarios/refund_update/python.mako b/scenarios/refund_update/python.mako index fc9978a..35912a7 100644 --- a/scenarios/refund_update/python.mako +++ b/scenarios/refund_update/python.mako @@ -3,9 +3,9 @@ balanced.Refund().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -refund = balanced.Refund.fetch('/refunds/RF3RklPuFgsgI50UuYtr4g6I') +refund = balanced.Refund.fetch('/refunds/RF5OXw4w1a9g2GsPqQ2Hg9hj') refund.description = 'update this description' refund.meta = { 'user.refund.count': '3', @@ -14,5 +14,5 @@ refund.meta = { } refund.save() % elif mode == 'response': -Refund(status=u'succeeded', description=u'update this description', links={u'dispute': None, u'order': None, u'debit': u'WD3MKNxNTKBGgA7mX50yogiu'}, amount=3000, created_at=u'2014-01-27T22:58:11.375665Z', updated_at=u'2014-01-27T22:58:17.950799Z', currency=u'USD', transaction_number=u'RF383-088-7077', href=u'/refunds/RF3RklPuFgsgI50UuYtr4g6I', meta={u'user.refund.count': u'3', u'refund.reason': u'user not happy with product', u'user.notes': u'very polite on the phone'}, id=u'RF3RklPuFgsgI50UuYtr4g6I') +Refund(status=u'succeeded', description=u'update this description', links={u'dispute': None, u'order': None, u'debit': u'WD5Nd61WpdlRk6D39YVNFAEo'}, amount=3000, created_at=u'2015-01-09T03:25:00.202596Z', updated_at=u'2015-01-09T03:25:39.570204Z', currency=u'USD', transaction_number=u'RFN4R-7JB-96UV', href=u'/refunds/RF5OXw4w1a9g2GsPqQ2Hg9hj', meta={u'user.refund.count': u'3', u'refund.reason': u'user not happy with product', u'user.notes': u'very polite on the phone'}, id=u'RF5OXw4w1a9g2GsPqQ2Hg9hj') % endif \ No newline at end of file diff --git a/scenarios/reversal_create/executable.py b/scenarios/reversal_create/executable.py index 11f7cde..ea10993 100644 --- a/scenarios/reversal_create/executable.py +++ b/scenarios/reversal_create/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -credit = balanced.Credit.fetch('/credits/CR40neytmVG2HDBp1opfF7sY') +credit = balanced.Credit.fetch('/credits/CR6zeufmfv0u1KHrUBCQtAgU') reversal = credit.reverse( amount=3000, description="Reversal for Order #1111", diff --git a/scenarios/reversal_create/python.mako b/scenarios/reversal_create/python.mako index bb4249b..cd11f05 100644 --- a/scenarios/reversal_create/python.mako +++ b/scenarios/reversal_create/python.mako @@ -3,9 +3,9 @@ balanced.Credit().reverse() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -credit = balanced.Credit.fetch('/credits/CR40neytmVG2HDBp1opfF7sY') +credit = balanced.Credit.fetch('/credits/CR6zeufmfv0u1KHrUBCQtAgU') reversal = credit.reverse( amount=3000, description="Reversal for Order #1111", @@ -16,5 +16,5 @@ reversal = credit.reverse( } ) % elif mode == 'response': -Reversal(status=u'succeeded', description=u'Reversal for Order #1111', links={u'credit': u'CR40neytmVG2HDBp1opfF7sY', u'order': None}, amount=3000, created_at=u'2014-01-27T22:58:21.214829Z', updated_at=u'2014-01-27T22:58:22.190749Z', failure_reason=None, currency=u'USD', transaction_number=u'RV219-169-0008', href=u'/reversals/RV42n8M9XZWna427oPDDi4RG', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, failure_reason_code=None, id=u'RV42n8M9XZWna427oPDDi4RG') +Reversal(status=u'pending', description=u'Reversal for Order #1111', links={u'credit': u'CR6zeufmfv0u1KHrUBCQtAgU', u'order': None}, amount=3000, created_at=u'2015-01-09T03:25:42.331343Z', updated_at=u'2015-01-09T03:25:42.672661Z', failure_reason=None, currency=u'USD', transaction_number=u'RVYWS-BLM-PY8J', href=u'/reversals/RV6AleFrrhNHBDpr9W9ozGmY', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, failure_reason_code=None, id=u'RV6AleFrrhNHBDpr9W9ozGmY') % endif \ No newline at end of file diff --git a/scenarios/reversal_list/executable.py b/scenarios/reversal_list/executable.py index fa42560..66c2a9e 100644 --- a/scenarios/reversal_list/executable.py +++ b/scenarios/reversal_list/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') reversals = balanced.Reversal.query \ No newline at end of file diff --git a/scenarios/reversal_list/python.mako b/scenarios/reversal_list/python.mako index d3ca438..fe33c78 100644 --- a/scenarios/reversal_list/python.mako +++ b/scenarios/reversal_list/python.mako @@ -4,7 +4,7 @@ balanced.Reversal.query() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') reversals = balanced.Reversal.query % elif mode == 'response': diff --git a/scenarios/reversal_show/executable.py b/scenarios/reversal_show/executable.py index b9ae116..4ae5290 100644 --- a/scenarios/reversal_show/executable.py +++ b/scenarios/reversal_show/executable.py @@ -1,5 +1,5 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -refund = balanced.Reversal.fetch('/reversals/RV42n8M9XZWna427oPDDi4RG') \ No newline at end of file +refund = balanced.Reversal.fetch('/reversals/RV6AleFrrhNHBDpr9W9ozGmY') \ No newline at end of file diff --git a/scenarios/reversal_show/python.mako b/scenarios/reversal_show/python.mako index 6953706..9fea217 100644 --- a/scenarios/reversal_show/python.mako +++ b/scenarios/reversal_show/python.mako @@ -4,9 +4,9 @@ balanced.Reversal.fetch() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -refund = balanced.Reversal.fetch('/reversals/RV42n8M9XZWna427oPDDi4RG') +refund = balanced.Reversal.fetch('/reversals/RV6AleFrrhNHBDpr9W9ozGmY') % elif mode == 'response': -Reversal(status=u'succeeded', description=u'Reversal for Order #1111', links={u'credit': u'CR40neytmVG2HDBp1opfF7sY', u'order': None}, amount=3000, created_at=u'2014-01-27T22:58:21.214829Z', updated_at=u'2014-01-27T22:58:22.190749Z', failure_reason=None, currency=u'USD', transaction_number=u'RV219-169-0008', href=u'/reversals/RV42n8M9XZWna427oPDDi4RG', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, failure_reason_code=None, id=u'RV42n8M9XZWna427oPDDi4RG') +Reversal(status=u'pending', description=u'Reversal for Order #1111', links={u'credit': u'CR6zeufmfv0u1KHrUBCQtAgU', u'order': None}, amount=3000, created_at=u'2015-01-09T03:25:42.331343Z', updated_at=u'2015-01-09T03:25:42.672661Z', failure_reason=None, currency=u'USD', transaction_number=u'RVYWS-BLM-PY8J', href=u'/reversals/RV6AleFrrhNHBDpr9W9ozGmY', meta={u'fulfillment.item.condition': u'OK', u'user.refund_reason': u'not happy with product', u'merchant.feedback': u'positive'}, failure_reason_code=None, id=u'RV6AleFrrhNHBDpr9W9ozGmY') % endif \ No newline at end of file diff --git a/scenarios/reversal_update/executable.py b/scenarios/reversal_update/executable.py index 214189f..134927a 100644 --- a/scenarios/reversal_update/executable.py +++ b/scenarios/reversal_update/executable.py @@ -1,8 +1,8 @@ import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -reversal = balanced.Reversal.fetch('/reversals/RV42n8M9XZWna427oPDDi4RG') +reversal = balanced.Reversal.fetch('/reversals/RV6AleFrrhNHBDpr9W9ozGmY') reversal.description = 'update this description' reversal.meta = { 'user.refund.count': '3', diff --git a/scenarios/reversal_update/python.mako b/scenarios/reversal_update/python.mako index 3a13e61..c2147c8 100644 --- a/scenarios/reversal_update/python.mako +++ b/scenarios/reversal_update/python.mako @@ -3,9 +3,9 @@ balanced.Reversal().save() % elif mode == 'request': import balanced -balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc') +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') -reversal = balanced.Reversal.fetch('/reversals/RV42n8M9XZWna427oPDDi4RG') +reversal = balanced.Reversal.fetch('/reversals/RV6AleFrrhNHBDpr9W9ozGmY') reversal.description = 'update this description' reversal.meta = { 'user.refund.count': '3', @@ -14,5 +14,5 @@ reversal.meta = { } reversal.save() % elif mode == 'response': -Reversal(status=u'succeeded', description=u'update this description', links={u'credit': u'CR40neytmVG2HDBp1opfF7sY', u'order': None}, amount=3000, created_at=u'2014-01-27T22:58:21.214829Z', updated_at=u'2014-01-27T22:58:27.354488Z', failure_reason=None, currency=u'USD', transaction_number=u'RV219-169-0008', href=u'/reversals/RV42n8M9XZWna427oPDDi4RG', meta={u'user.satisfaction': u'6', u'refund.reason': u'user not happy with product', u'user.notes': u'very polite on the phone'}, failure_reason_code=None, id=u'RV42n8M9XZWna427oPDDi4RG') +Reversal(status=u'pending', description=u'update this description', links={u'credit': u'CR6zeufmfv0u1KHrUBCQtAgU', u'order': None}, amount=3000, created_at=u'2015-01-09T03:25:42.331343Z', updated_at=u'2015-01-09T03:25:46.424201Z', failure_reason=None, currency=u'USD', transaction_number=u'RVYWS-BLM-PY8J', href=u'/reversals/RV6AleFrrhNHBDpr9W9ozGmY', meta={u'user.satisfaction': u'6', u'refund.reason': u'user not happy with product', u'user.notes': u'very polite on the phone'}, failure_reason_code=None, id=u'RV6AleFrrhNHBDpr9W9ozGmY') % endif \ No newline at end of file diff --git a/scenarios/settlement_create/definition.mako b/scenarios/settlement_create/definition.mako new file mode 100644 index 0000000..29abd05 --- /dev/null +++ b/scenarios/settlement_create/definition.mako @@ -0,0 +1 @@ +balanced.Account.settle() \ No newline at end of file diff --git a/scenarios/settlement_create/executable.py b/scenarios/settlement_create/executable.py new file mode 100644 index 0000000..267ee37 --- /dev/null +++ b/scenarios/settlement_create/executable.py @@ -0,0 +1,14 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +payable_account = balanced.Account.fetch('/accounts/AT3ogJE07IErLJYR510QO6sM') +payable_account.settle( + appears_on_statement_as='ThingsCo', + funding_instrument='/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN', + description='Payout A', + meta={ + 'group': 'alpha' + } +) +) \ No newline at end of file diff --git a/scenarios/settlement_create/python.mako b/scenarios/settlement_create/python.mako new file mode 100644 index 0000000..c659e2e --- /dev/null +++ b/scenarios/settlement_create/python.mako @@ -0,0 +1,20 @@ +% if mode == 'definition': +balanced.Account.settle() +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +payable_account = balanced.Account.fetch('/accounts/AT3ogJE07IErLJYR510QO6sM') +payable_account.settle( + appears_on_statement_as='ThingsCo', + funding_instrument='/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN', + description='Payout A', + meta={ + 'group': 'alpha' + } +) +) +% elif mode == 'response': +Settlement(status=u'pending', description=u'Payout A', links={u'source': u'AT3ogJE07IErLJYR510QO6sM', u'destination': u'BA45anEaEr8g0lOhzhcE9VAN'}, amount=1000, created_at=u'2015-01-09T03:25:48.587751Z', updated_at=u'2015-01-09T03:25:48.946792Z', failure_reason=None, currency=u'USD', transaction_number=u'SCRGN-RWP-FFSL', href=u'/settlements/ST6HmBuLJSEa82oUwId1AShW', meta={u'group': u'alpha'}, failure_reason_code=None, appears_on_statement_as=u'BAL*ThingsCo', id=u'ST6HmBuLJSEa82oUwId1AShW') +% endif \ No newline at end of file diff --git a/scenarios/settlement_create/request.mako b/scenarios/settlement_create/request.mako new file mode 100644 index 0000000..2cee79d --- /dev/null +++ b/scenarios/settlement_create/request.mako @@ -0,0 +1,13 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +payable_account = balanced.Account.fetch('${request['href']}') +payable_account.settle( + appears_on_statement_as='${request['payload']['appears_on_statement_as']}', + funding_instrument='${request['payload']['funding_instrument']}', + description='${request['payload']['description']}', + meta={ + 'group': '${request['payload']['meta']['group']}' + } +) +) \ No newline at end of file diff --git a/scenarios/settlement_list/definition.mako b/scenarios/settlement_list/definition.mako new file mode 100644 index 0000000..03d6fd8 --- /dev/null +++ b/scenarios/settlement_list/definition.mako @@ -0,0 +1 @@ +balanced.Settlement.query diff --git a/scenarios/settlement_list/executable.py b/scenarios/settlement_list/executable.py new file mode 100644 index 0000000..7d9c1b4 --- /dev/null +++ b/scenarios/settlement_list/executable.py @@ -0,0 +1,5 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +settlements = balanced.Settlement.query \ No newline at end of file diff --git a/scenarios/settlement_list/python.mako b/scenarios/settlement_list/python.mako new file mode 100644 index 0000000..113ba98 --- /dev/null +++ b/scenarios/settlement_list/python.mako @@ -0,0 +1,12 @@ +% if mode == 'definition': +balanced.Settlement.query + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +settlements = balanced.Settlement.query +% elif mode == 'response': + +% endif \ No newline at end of file diff --git a/scenarios/settlement_list/request.mako b/scenarios/settlement_list/request.mako new file mode 100644 index 0000000..257a2d8 --- /dev/null +++ b/scenarios/settlement_list/request.mako @@ -0,0 +1,4 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +settlements = balanced.Settlement.query \ No newline at end of file diff --git a/scenarios/settlement_list_account/definition.mako b/scenarios/settlement_list_account/definition.mako new file mode 100644 index 0000000..03d6fd8 --- /dev/null +++ b/scenarios/settlement_list_account/definition.mako @@ -0,0 +1 @@ +balanced.Settlement.query diff --git a/scenarios/settlement_list_account/executable.py b/scenarios/settlement_list_account/executable.py new file mode 100644 index 0000000..91bac2a --- /dev/null +++ b/scenarios/settlement_list_account/executable.py @@ -0,0 +1,6 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +account = balanced.Account.fetch('/accounts/AT3ogJE07IErLJYR510QO6sM') +account.settlements \ No newline at end of file diff --git a/scenarios/settlement_list_account/python.mako b/scenarios/settlement_list_account/python.mako new file mode 100644 index 0000000..ca953e1 --- /dev/null +++ b/scenarios/settlement_list_account/python.mako @@ -0,0 +1,13 @@ +% if mode == 'definition': +balanced.Settlement.query + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +account = balanced.Account.fetch('/accounts/AT3ogJE07IErLJYR510QO6sM') +account.settlements +% elif mode == 'response': + +% endif \ No newline at end of file diff --git a/scenarios/settlement_list_account/request.mako b/scenarios/settlement_list_account/request.mako new file mode 100644 index 0000000..3e696f4 --- /dev/null +++ b/scenarios/settlement_list_account/request.mako @@ -0,0 +1,5 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +account = balanced.Account.fetch('${request['href']}') +account.settlements \ No newline at end of file diff --git a/scenarios/settlement_show/definition.mako b/scenarios/settlement_show/definition.mako new file mode 100644 index 0000000..633208d --- /dev/null +++ b/scenarios/settlement_show/definition.mako @@ -0,0 +1 @@ +balanced.Settlement.fetch() diff --git a/scenarios/settlement_show/executable.py b/scenarios/settlement_show/executable.py new file mode 100644 index 0000000..b0a772e --- /dev/null +++ b/scenarios/settlement_show/executable.py @@ -0,0 +1,5 @@ +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +settlement = balanced.Settlement.fetch('/settlements/ST6HmBuLJSEa82oUwId1AShW') \ No newline at end of file diff --git a/scenarios/settlement_show/python.mako b/scenarios/settlement_show/python.mako new file mode 100644 index 0000000..4c1b287 --- /dev/null +++ b/scenarios/settlement_show/python.mako @@ -0,0 +1,12 @@ +% if mode == 'definition': +balanced.Settlement.fetch() + +% elif mode == 'request': +import balanced + +balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY') + +settlement = balanced.Settlement.fetch('/settlements/ST6HmBuLJSEa82oUwId1AShW') +% elif mode == 'response': +Settlement(status=u'pending', description=u'Payout A', links={u'source': u'AT3ogJE07IErLJYR510QO6sM', u'destination': u'BA45anEaEr8g0lOhzhcE9VAN'}, amount=1000, created_at=u'2015-01-09T03:25:48.587751Z', updated_at=u'2015-01-09T03:25:48.946792Z', failure_reason=None, currency=u'USD', transaction_number=u'SCRGN-RWP-FFSL', href=u'/settlements/ST6HmBuLJSEa82oUwId1AShW', meta={u'group': u'alpha'}, failure_reason_code=None, appears_on_statement_as=u'BAL*ThingsCo', id=u'ST6HmBuLJSEa82oUwId1AShW') +% endif \ No newline at end of file diff --git a/scenarios/settlement_show/request.mako b/scenarios/settlement_show/request.mako new file mode 100644 index 0000000..69a0d4c --- /dev/null +++ b/scenarios/settlement_show/request.mako @@ -0,0 +1,4 @@ +<%namespace file='/_main.mako' name='main'/> +<% main.python_boilerplate() %> + +settlement = balanced.Settlement.fetch('${request['uri']}') \ No newline at end of file diff --git a/setup.py b/setup.py index f52c72c..2215162 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ setup = setuptools.setup + def _get_version(): path = os.path.join(PATH_TO_FILE, 'balanced', '__init__.py') version_re = r".*__version__ = '(.*?)'" @@ -66,7 +67,7 @@ def parse_dependency_links(file_name): name='balanced', version=VERSION, url='https://balancedpayments.com/', - license='BSD', + license='MIT License', author='Balanced', author_email='dev@balancedpayments.com', description='Payments platform for marketplaces', @@ -77,7 +78,7 @@ def parse_dependency_links(file_name): dependency_links=parse_dependency_links('requirements.txt'), classifiers=[ 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', + 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules', ], diff --git a/snippets/account-balance.py b/snippets/account-balance.py new file mode 100644 index 0000000..059adb9 --- /dev/null +++ b/snippets/account-balance.py @@ -0,0 +1 @@ +account.balance \ No newline at end of file diff --git a/snippets/bank-account-create.py b/snippets/bank-account-create.py new file mode 100644 index 0000000..5c67d51 --- /dev/null +++ b/snippets/bank-account-create.py @@ -0,0 +1,6 @@ +bank_account = balanced.BankAccount( + routing_number='121000358', + type='checking', + account_number='9900000001', + name='Johann Bernoulli' +).save() \ No newline at end of file diff --git a/snippets/bank-account-debit.py b/snippets/bank-account-debit.py new file mode 100644 index 0000000..4948ff7 --- /dev/null +++ b/snippets/bank-account-debit.py @@ -0,0 +1,9 @@ +# bank_account_href is the stored href for the BankAccount +# order_href is the stored href for the Order +bank_account = balanced.BankAccount.fetch(bank_account_href) +bank_account.debit( + appears_on_statement_as='Statement text', + amount=5000, + description='Some descriptive text for the debit in the dashboard', + order=order_href +) \ No newline at end of file diff --git a/snippets/bank-account-verification-confirm.py b/snippets/bank-account-verification-confirm.py new file mode 100644 index 0000000..09f2f24 --- /dev/null +++ b/snippets/bank-account-verification-confirm.py @@ -0,0 +1,3 @@ +# time has elapsed, so find the BankAccountVerification +verification = balanced.BankAccountVerification.find('/verifications/BZ2Sy2Z4Bp2mARnCLztiu2VG') +verification.confirm(amount_1=1, amount_2=1) \ No newline at end of file diff --git a/snippets/bank-account-verification-create.py b/snippets/bank-account-verification-create.py new file mode 100644 index 0000000..f1cc90f --- /dev/null +++ b/snippets/bank-account-verification-create.py @@ -0,0 +1 @@ +verification = bank_account.verify \ No newline at end of file diff --git a/snippets/callback-create.py b/snippets/callback-create.py new file mode 100644 index 0000000..acb3ee8 --- /dev/null +++ b/snippets/callback-create.py @@ -0,0 +1,4 @@ +callback = balanced.Callback( + url='http://www.example.com/callback', + method='post' +).save() \ No newline at end of file diff --git a/snippets/card-associate-to-customer.py b/snippets/card-associate-to-customer.py new file mode 100644 index 0000000..634ae43 --- /dev/null +++ b/snippets/card-associate-to-customer.py @@ -0,0 +1,2 @@ +card = balanced.Card.fetch(card_href) +card.associate_to_customer(customer_href) \ No newline at end of file diff --git a/snippets/card-create-dispute.py b/snippets/card-create-dispute.py new file mode 100644 index 0000000..1291923 --- /dev/null +++ b/snippets/card-create-dispute.py @@ -0,0 +1,6 @@ +card = balanced.Card( + cvv='123', + expiration_month='12', + number='6500000000000002', + expiration_year='2020' +).save() \ No newline at end of file diff --git a/snippets/card-create.py b/snippets/card-create.py new file mode 100644 index 0000000..b02f975 --- /dev/null +++ b/snippets/card-create.py @@ -0,0 +1,6 @@ +card = balanced.Card( + expiration_month='12', + security_code='123', + number='5105105105105100', + expiration_year='2020' +).save() \ No newline at end of file diff --git a/snippets/card-credit.py b/snippets/card-credit.py new file mode 100644 index 0000000..185a1cd --- /dev/null +++ b/snippets/card-credit.py @@ -0,0 +1,9 @@ +# card_href is the stored href for the Card +# order_href is the stored href for the Order +card = balanced.Card.fetch(card_href) +card.credit( + appears_on_statement_as='Some text', + amount=5000, + description='Some descriptive text for the debit in the dashboard', + order=order_href +) \ No newline at end of file diff --git a/snippets/card-debit.py b/snippets/card-debit.py new file mode 100644 index 0000000..58ad26c --- /dev/null +++ b/snippets/card-debit.py @@ -0,0 +1,9 @@ +# card_href is the stored href for the Card +# order_href is the stored href for the Order +card = balanced.Card.fetch(card_href) +card.debit( + appears_on_statement_as='Statement text', + amount=5000, + description='Some descriptive text for the debit in the dashboard', + order=order_href +) \ No newline at end of file diff --git a/snippets/card-hold-capture.py b/snippets/card-hold-capture.py new file mode 100644 index 0000000..545048a --- /dev/null +++ b/snippets/card-hold-capture.py @@ -0,0 +1,6 @@ +# card_hold_href is the stored href for the CardHold +card_hold = balanced.CardHold.fetch(card_hold_href) +debit = card_hold.capture( + appears_on_statement_as='ShowsUpOnStmt', + description='Some descriptive text for the debit in the dashboard' +) \ No newline at end of file diff --git a/snippets/card-hold-create.py b/snippets/card-hold-create.py new file mode 100644 index 0000000..5d833e8 --- /dev/null +++ b/snippets/card-hold-create.py @@ -0,0 +1,6 @@ +# card_href is the stored href for the Card +card = balanced.Card.fetch(card_href) +card_hold = card.hold( + amount=5000, + description='Some descriptive text for the debit in the dashboard' +) \ No newline at end of file diff --git a/snippets/card-hold-void.py b/snippets/card-hold-void.py new file mode 100644 index 0000000..0cd8dc9 --- /dev/null +++ b/snippets/card-hold-void.py @@ -0,0 +1,3 @@ +# card_hold_href is the stored href for the CardHold +card_hold = balanced.CardHold.fetch(card_hold_href) +card_hold.cancel() \ No newline at end of file diff --git a/snippets/create-buyer-and-card.py b/snippets/create-buyer-and-card.py new file mode 100644 index 0000000..8414e0c --- /dev/null +++ b/snippets/create-buyer-and-card.py @@ -0,0 +1,13 @@ +buyer = balanced.Customer( + name='John Buyer' +).save() + +card = balanced.Card( + expiration_month='12', + security_code='123', + number='5105105105105100', + expiration_year='2020', + name='John Buyer' +).save() + +card.associate_to(buyer) \ No newline at end of file diff --git a/snippets/credit-create.py b/snippets/credit-create.py new file mode 100644 index 0000000..6e1887e --- /dev/null +++ b/snippets/credit-create.py @@ -0,0 +1,8 @@ +# bank_account_href is the stored href for the BankAccount +# order_href is the stored href for the Order +bank_account = balanced.BankAccount.fetch(bank_account_href) +credit = bank_account.credit( + amount=100000, + description='Payout for order #1111', + order=order_href +) \ No newline at end of file diff --git a/snippets/credit-fetch.py b/snippets/credit-fetch.py new file mode 100644 index 0000000..3f404e7 --- /dev/null +++ b/snippets/credit-fetch.py @@ -0,0 +1 @@ +credit = balanced.Credit.fetch(credit_href) \ No newline at end of file diff --git a/snippets/credit-marketplace-escrow.py b/snippets/credit-marketplace-escrow.py new file mode 100644 index 0000000..f1e522c --- /dev/null +++ b/snippets/credit-marketplace-escrow.py @@ -0,0 +1,4 @@ +balanced.Marketplace.mine.owner_customer.bank_accounts[0].credit( + amount=2000000, + description='Credit from Balanced escrow' +) \ No newline at end of file diff --git a/snippets/credit-reverse.py b/snippets/credit-reverse.py new file mode 100644 index 0000000..1c28d61 --- /dev/null +++ b/snippets/credit-reverse.py @@ -0,0 +1 @@ +reversal = credit.reverse() \ No newline at end of file diff --git a/snippets/credit-soft-descriptor.py b/snippets/credit-soft-descriptor.py new file mode 100644 index 0000000..abd2f79 --- /dev/null +++ b/snippets/credit-soft-descriptor.py @@ -0,0 +1,9 @@ +# bank_account_href is the stored href for the BankAccount +# order_href is the stored href for the Order +bank_account = balanced.BankAccount.fetch(bank_account_href) +credit = bank_account.credit( + amount=100000, + description='Payout for order #1111', + appears_on_statement_as='GoodCo #1111', + order=order_href +) \ No newline at end of file diff --git a/snippets/credit-split.py b/snippets/credit-split.py new file mode 100644 index 0000000..685dda4 --- /dev/null +++ b/snippets/credit-split.py @@ -0,0 +1,13 @@ +# bank_account_href_a is the stored href for the BankAccount for Person A +bank_account_person_a = balanced.BankAccount.fetch(bank_account_href_a) +credit = bank_account_person_a.credit( + amount=50000, + description='Payout for order #1111' +) + +# bank_account_href_b is the stored href for the BankAccount for Person B +bank_account_person_b = balanced.BankAccount.fetch(bank_account_href_b) +credit = bank_account_person_b.credit( + amount=50000, + description='Payout for order #1111' +) \ No newline at end of file diff --git a/snippets/customer-create.py b/snippets/customer-create.py new file mode 100644 index 0000000..ca1d179 --- /dev/null +++ b/snippets/customer-create.py @@ -0,0 +1,8 @@ +merchant = balanced.Customer( + dob_year=1963, + dob_month=7, + name='Henry Ford', + address={ + 'postal_code': '48120' + } +).save() \ No newline at end of file diff --git a/snippets/debit-dispute-show.py b/snippets/debit-dispute-show.py new file mode 100644 index 0000000..538169d --- /dev/null +++ b/snippets/debit-dispute-show.py @@ -0,0 +1,3 @@ +# debit_href is the stored href of the debit +debit = balanced.Debit.fetch(debit_href) +dispute = debit.dispute \ No newline at end of file diff --git a/snippets/debit-fetch.py b/snippets/debit-fetch.py new file mode 100644 index 0000000..3d1450b --- /dev/null +++ b/snippets/debit-fetch.py @@ -0,0 +1 @@ +debit = balanced.Debit.fetch(debit_href) \ No newline at end of file diff --git a/snippets/debit-marketplace-escrow.py b/snippets/debit-marketplace-escrow.py new file mode 100644 index 0000000..f612b65 --- /dev/null +++ b/snippets/debit-marketplace-escrow.py @@ -0,0 +1,4 @@ +balanced.Marketplace.mine.owner_customer.bank_accounts[0].debit( + amount=2000000, + description='Pre-fund Balanced escrow' +) \ No newline at end of file diff --git a/snippets/debit-refund.py b/snippets/debit-refund.py new file mode 100644 index 0000000..f5eb7fb --- /dev/null +++ b/snippets/debit-refund.py @@ -0,0 +1 @@ +debit.refund() \ No newline at end of file diff --git a/snippets/dispute-list.py b/snippets/dispute-list.py new file mode 100644 index 0000000..753e764 --- /dev/null +++ b/snippets/dispute-list.py @@ -0,0 +1 @@ +disputes = balanced.Dispute.query \ No newline at end of file diff --git a/snippets/dispute-show.py b/snippets/dispute-show.py new file mode 100644 index 0000000..7f66314 --- /dev/null +++ b/snippets/dispute-show.py @@ -0,0 +1,2 @@ +# dispute_href is the stored href of the dispute +dispute = balanced.Dispute.fetch(dispute_href) \ No newline at end of file diff --git a/snippets/examine-order-after-refund.py b/snippets/examine-order-after-refund.py new file mode 100644 index 0000000..03e46f5 --- /dev/null +++ b/snippets/examine-order-after-refund.py @@ -0,0 +1,3 @@ +order = balanced.Order.fetch(order_href) +order.amount # original order amount +order.amount_escrowed # will decrease by amount of reversed credit \ No newline at end of file diff --git a/snippets/examine-order-after-reversal.py b/snippets/examine-order-after-reversal.py new file mode 100644 index 0000000..9c0d264 --- /dev/null +++ b/snippets/examine-order-after-reversal.py @@ -0,0 +1,3 @@ +order = balanced.Order.fetch(order_href) +order.amount # original order amount +order.amount_escrowed # will increase by amount of reversed credit \ No newline at end of file diff --git a/snippets/marketplace-in-escrow.py b/snippets/marketplace-in-escrow.py new file mode 100644 index 0000000..401a4b3 --- /dev/null +++ b/snippets/marketplace-in-escrow.py @@ -0,0 +1 @@ +balanced.Marketplace.my_marketplace.in_escrow \ No newline at end of file diff --git a/snippets/merchant-payable-account-fetch.py b/snippets/merchant-payable-account-fetch.py new file mode 100644 index 0000000..07f461f --- /dev/null +++ b/snippets/merchant-payable-account-fetch.py @@ -0,0 +1,2 @@ +# merchant is a Customer instance +merchant.payable_account \ No newline at end of file diff --git a/snippets/order-amount-escrowed.py b/snippets/order-amount-escrowed.py new file mode 100644 index 0000000..9cb3b33 --- /dev/null +++ b/snippets/order-amount-escrowed.py @@ -0,0 +1,3 @@ +order.reload # reload the order to get recent changes +order.amount +order.amount_escrowed \ No newline at end of file diff --git a/snippets/order-bank-account-create.py b/snippets/order-bank-account-create.py new file mode 100644 index 0000000..350cc21 --- /dev/null +++ b/snippets/order-bank-account-create.py @@ -0,0 +1,8 @@ +bank_account = balanced.BankAccount( + routing_number='121000358', + type='checking', + account_number='9900000001', + name='Henry Ford' +).save() + +bank_account.associate_to(merchant) \ No newline at end of file diff --git a/snippets/order-create.py b/snippets/order-create.py new file mode 100644 index 0000000..a888a46 --- /dev/null +++ b/snippets/order-create.py @@ -0,0 +1 @@ +order = merchant.create_order() \ No newline at end of file diff --git a/snippets/order-credit-marketplace.py b/snippets/order-credit-marketplace.py new file mode 100644 index 0000000..2a7b714 --- /dev/null +++ b/snippets/order-credit-marketplace.py @@ -0,0 +1,6 @@ +marketplace_bank_account = balanced.Marketplace.mine.owner_customer.bank_accounts[0] +order.credit_to( + amount=2000, + description="Credit from order escrow to marketplace bank account", + destination=marketplace_bank_account +) \ No newline at end of file diff --git a/snippets/order-credit-merchant-payable-account.py b/snippets/order-credit-merchant-payable-account.py new file mode 100644 index 0000000..6264dfb --- /dev/null +++ b/snippets/order-credit-merchant-payable-account.py @@ -0,0 +1,4 @@ +order.credit_to( + destination=account_href, + amount=8000 +) \ No newline at end of file diff --git a/snippets/order-credit.py b/snippets/order-credit.py new file mode 100644 index 0000000..19a6dba --- /dev/null +++ b/snippets/order-credit.py @@ -0,0 +1,4 @@ +order.credit_to( + destination=bank_account_href, + amount=8000 +) \ No newline at end of file diff --git a/snippets/order-credits-fetch.py b/snippets/order-credits-fetch.py new file mode 100644 index 0000000..1b76eef --- /dev/null +++ b/snippets/order-credits-fetch.py @@ -0,0 +1 @@ +order.credits \ No newline at end of file diff --git a/snippets/order-debit.py b/snippets/order-debit.py new file mode 100644 index 0000000..d5a76bd --- /dev/null +++ b/snippets/order-debit.py @@ -0,0 +1,4 @@ +debit = order.debit_from( + source=card, + amount=10000 +) \ No newline at end of file diff --git a/snippets/order-debits-fetch.py b/snippets/order-debits-fetch.py new file mode 100644 index 0000000..ef19236 --- /dev/null +++ b/snippets/order-debits-fetch.py @@ -0,0 +1 @@ +order.debits \ No newline at end of file diff --git a/snippets/order-fetch.py b/snippets/order-fetch.py new file mode 100644 index 0000000..809edb8 --- /dev/null +++ b/snippets/order-fetch.py @@ -0,0 +1 @@ +order = balanced.Order.fetch(order_href) \ No newline at end of file diff --git a/snippets/order-update.py b/snippets/order-update.py new file mode 100644 index 0000000..aa543ca --- /dev/null +++ b/snippets/order-update.py @@ -0,0 +1,5 @@ +order.description = 'Item description' +order.meta = { + 'item_url': 'https://neatitems.com/12342134123' +} +order.save() \ No newline at end of file diff --git a/snippets/refund-create.py b/snippets/refund-create.py new file mode 100644 index 0000000..95bad17 --- /dev/null +++ b/snippets/refund-create.py @@ -0,0 +1,13 @@ +# debit_href is the stored href for the Debit +# order_href is the stored href for the Order +debit = balanced.Debit.fetch(debit_href) +refund = debit.refund( + amount=3000, + description="Refund for Order #1111", + meta={ + "merchant.feedback": "positive", + "user.refund_reason": "not happy with product", + "fulfillment.item.condition": "OK", + }, + order=order_href +) \ No newline at end of file diff --git a/snippets/reversal-create.py b/snippets/reversal-create.py new file mode 100644 index 0000000..bc175d3 --- /dev/null +++ b/snippets/reversal-create.py @@ -0,0 +1,13 @@ +# credit_href is the stored href for the Credit +# order_href is the stored href for the Order +credit = balanced.Credit.fetch(credit_href) +reversal = credit.reverse( + amount=100000, + description="Reversal for order #1111", + meta={ + "merchant.feedback": "positive", + "user.refund_reason": "not happy with product", + "fulfillment.item.condition": "OK" + }, + order=order_href +) \ No newline at end of file diff --git a/snippets/settlement-create.py b/snippets/settlement-create.py new file mode 100644 index 0000000..e3d5294 --- /dev/null +++ b/snippets/settlement-create.py @@ -0,0 +1,5 @@ +account.settle( + appears_on_statement_as='ThingsCo', + description='A simple description', + funding_instrument=bank_account_href +) \ No newline at end of file diff --git a/tests/test_client.py b/tests/test_client.py index 273ebab..d9242da 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -12,9 +12,9 @@ def setUp(self): def test_configure(self): expected_headers = { - 'content-type': 'application/vnd.api+json;revision=1.1', - 'accept': 'application/json;revision=1.1', - 'User-Agent': u'balanced-python/1.0beta1' + 'content-type': 'application/json;revision=1.1', + 'accept': 'application/vnd.api+json;revision=1.1', + 'User-Agent': u'balanced-python/' + balanced.__version__, } self.assertDictContainsSubset( expected_headers, balanced.config.client.config.headers diff --git a/tests/test_suite.py b/tests/test_suite.py index 70f50d7..17f6361 100644 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -*- - from __future__ import unicode_literals +import sys +import time from datetime import date import unittest2 as unittest import requests import balanced - +from balanced import exc as bexc # fixtures @@ -69,6 +70,24 @@ } } +#: a card which will always create a dispute when you debit it +DISPUTE_CARD = CARD.copy() +DISPUTE_CARD['number'] = '6500000000000002' + +CREDITABLE_CARD = { + 'name': 'Johannes Bach', + 'number': '4342561111111118', + 'expiration_month': 05, + 'expiration_year': date.today().year + 1, +} + +NON_CREDITABLE_CARD = { + 'name': 'Georg Telemann', + 'number': '4111111111111111', + 'expiration_month': 12, + 'expiration_year': date.today().year + 1, +} + INTERNATIONAL_CARD = { 'name': 'Johnny Fresh', 'number': '4444424444444440', @@ -101,9 +120,21 @@ class BasicUseCases(unittest.TestCase): @classmethod def setUpClass(cls): + cls.marketplace, cls.api_key = cls.create_marketplace() + + def setUp(self): + super(BasicUseCases, self).setUp() + # some test might rewrite api_key, so we need to configure it + # here again + balanced.configure(self.api_key.secret) + + @classmethod + def create_marketplace(self): + balanced.configure(None) api_key = balanced.APIKey().save() balanced.configure(api_key.secret) - cls.marketplace = balanced.Marketplace().save() + marketplace = balanced.Marketplace().save() + return marketplace, api_key def test_create_a_second_marketplace_should_fail(self): with self.assertRaises(requests.HTTPError) as exc: @@ -156,6 +187,7 @@ def test_create_hold_and_void_it(self): hold = card.hold(amount=1500, description='Hold me') self.assertEqual(hold.description, 'Hold me') hold.cancel() + self.assertIsNotNone(hold.voided_at) def test_create_hold_and_capture_it(self): card = balanced.Card(**CARD).save() @@ -185,24 +217,78 @@ def test_create_a_business_customer(self): self.assertEqual(getattr(customer, key), value) def test_credit_a_bank_account(self): + self.create_marketplace() # NOTE: fresh mp for escrow checks card = balanced.Card(**INTERNATIONAL_CARD).save() bank_account = balanced.BankAccount(**BANK_ACCOUNT).save() - card.debit(amount=10000) - original_balance = balanced.Marketplace.mine.in_escrow + debit = card.debit(amount=10000) credit = bank_account.credit(amount=1000) self.assertTrue(credit.id.startswith('CR')) self.assertEqual(credit.amount, 1000) - self.assertEqual( - balanced.Marketplace.mine.in_escrow, - original_balance - credit.amount) + with self.assertRaises(requests.HTTPError) as exc: + bank_account.credit(amount=(debit.amount - credit.amount) + 1) + self.assertEqual(exc.exception.status_code, 409) + self.assertEqual(exc.exception.category_code, 'insufficient-funds') + + def test_credit_existing_card(self): + funding_card = balanced.Card(**CARD).save() + card = balanced.Card(**CREDITABLE_CARD).save() + debit = funding_card.debit(amount=250000) + credit = card.credit(amount=250000) + self.assertTrue(credit.id.startswith('CR')) + self.assertEqual(credit.href, '/credits/{0}'.format(credit.id)) + self.assertEqual(credit.status, 'succeeded') + self.assertEqual(credit.amount, 250000) + + def test_credit_card_in_request(self): + funding_card = balanced.Card(**CARD).save() + debit = funding_card.debit(amount=250000) + credit = balanced.Credit( + amount=250000, + description='A sweet ride', + destination=CREDITABLE_CARD + ).save() + self.assertTrue(credit.id.startswith('CR')) + self.assertEqual(credit.href, '/credits/{0}'.format(credit.id)) + self.assertEqual(credit.status, 'succeeded') + self.assertEqual(credit.amount, 250000) + self.assertEqual(credit.description, 'A sweet ride') + + def test_credit_card_can_credit_false(self): + funding_card = balanced.Card(**CARD).save() + debit = funding_card.debit(amount=250000) + card = balanced.Card(**NON_CREDITABLE_CARD).save() + with self.assertRaises(bexc.FundingSourceNotCreditable) as exc: + card.credit(amount=250000) + + def test_credit_card_limit(self): + funding_card = balanced.Card(**CARD).save() + debit = funding_card.debit(amount=250005) + card = balanced.Card(**CREDITABLE_CARD).save() + with self.assertRaises(requests.HTTPError) as exc: + credit = card.credit(amount=250001) + self.assertEqual(exc.exception.status_code, 409) + self.assertEqual(exc.exception.category_code, 'amount-exceeds-limit') + + def test_credit_card_require_name(self): + funding_card = balanced.Card(**CARD).save() + debit = funding_card.debit(amount=250005) + card_payload = CREDITABLE_CARD.copy() + card_payload.pop("name") + card = balanced.Card(**card_payload).save() + with self.assertRaises(requests.HTTPError) as exc: + credit = card.credit(amount=250001) + self.assertEqual(exc.exception.status_code, 400) + self.assertEqual(exc.exception.category_code, 'name-required-to-credit') def test_escrow_limit(self): + self.create_marketplace() # NOTE: fresh mp for escrow checks bank_account = balanced.BankAccount(**BANK_ACCOUNT).save() - original_balance = balanced.Marketplace.mine.in_escrow + original_balance = 0 with self.assertRaises(requests.HTTPError) as exc: bank_account.credit(amount=original_balance + 1) - the_exception = exc.exception - self.assertEqual(the_exception.status_code, 409) + ex = exc.exception + self.assertEqual(ex.status_code, 409) + self.assertEqual(ex.category_code, 'insufficient-funds') def test_slice_syntax(self): total_debit = balanced.Debit.query.count() @@ -213,7 +299,7 @@ def test_slice_syntax(self): for debit in sliced_debits: self.assertIsInstance(debit, balanced.Debit) all_debits = balanced.Debit.query.all() - last = total_debit * - 1 + last = total_debit * -1 for index, debit in enumerate(all_debits): self.assertEqual(debit.href, balanced.Debit.query[last + index].href) @@ -341,7 +427,7 @@ def test_order_helper_methods(self): order = merchant.create_order() card = balanced.Card(**INTERNATIONAL_CARD).save() - debit = order.debit_from(source=card, amount=1234) + order.debit_from(source=card, amount=1234) bank_account = balanced.BankAccount( account_number='1234567890', routing_number='321174851', @@ -349,3 +435,394 @@ def test_order_helper_methods(self): ).save() bank_account.associate_to_customer(merchant) order.credit_to(destination=bank_account, amount=1234) + + def test_empty_list(self): + # NOTE: we need a whole new marketplace to reproduce the bug, + # otherwise, it's very likely we will consume records created + # by other tests + self.create_marketplace() + self.assertEqual(balanced.Credit.query.all(), []) + + def test_query_pagination(self): + card = balanced.Card(**CARD).save() + for _ in xrange(30): card.debit(amount=100) + self.assertEqual(len(balanced.Debit.query.all()), balanced.Debit.query.count()) + + def test_dispute(self): + card = balanced.Card(**DISPUTE_CARD).save() + debit = card.debit(amount=100) + + # TODO: this is ugly, I think we should provide a more + # reliable way to generate dispute, at least it should not + # take this long + print >> sys.stderr, ( + 'It takes a while before the dispute record created, ' + 'take and nap and wake up, then it should be done :/ ' + '(last time I tried it took 10 minutes...)' + ) + timeout = 12 * 60 + interval = 10 + begin = time.time() + while True: + if balanced.Dispute.query.count(): + break + time.sleep(interval) + elapsed = time.time() - begin + print >> sys.stderr, 'Polling disputes..., elapsed', elapsed + self.assertLess(elapsed, timeout, 'Ouch, timeout') + + dispute = balanced.Dispute.query.one() + self.assertEqual(dispute.status, 'pending') + self.assertEqual(dispute.reason, 'fraud') + self.assertEqual(dispute.transaction.id, debit.id) + + def test_external_accounts(self): + external_account = balanced.ExternalAccount( + token='123123123', + provider='name_of_provider', + ).save() + debit = external_account.debit( + amount=1234 + ) + self.assertEqual(debit.source.id, external_account.id) + + def test_general_resources(self): + card = balanced.Card(**CARD).save() + customer = balanced.Customer().save() + card.associate_to_customer(customer) + debit = card.debit(amount=1000) + self.assertIsNotNone(debit) + self.assertIsNotNone(debit.source) + self.assertTrue(isinstance(debit.source, balanced.Card)) + + def test_get_none_for_none(self): + card = balanced.Card(**CARD).save() + customer = balanced.Customer().save() + self.assertIsNone(card.customer) + card.associate_to_customer(customer) + card = balanced.Card.get(card.href) + self.assertIsNotNone(card.customer) + self.assertTrue(isinstance(card.customer, balanced.Customer)) + + def test_accounts_credit(self): + merchant = balanced.Customer().save() + order = merchant.create_order() + card = balanced.Card(**INTERNATIONAL_CARD).save() + + order.debit_from(source=card, amount=1234) + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 0) + account_credit = payable_account.credit( + amount=1234, order=order.href, + appears_on_statement_as='Payout') + payable_account = merchant.payable_account + self.assertEqual(account_credit.status, 'succeeded') + self.assertEqual(payable_account.balance, 1234) + self.assertEqual(account_credit.appears_on_statement_as, 'Payout') + + def test_accounts_credit_from_multiple_orders(self): + merchant = balanced.Customer().save() + card = balanced.Card(**INTERNATIONAL_CARD).save() + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 0) + amount = 1234 + + order_one = merchant.create_order() + order_one.debit_from(source=card, amount=amount) + payable_account.credit(amount=amount, order=order_one.href) + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, amount) + order_two = merchant.create_order() + order_two.debit_from(source=card, amount=amount) + payable_account.credit(amount=amount, order=order_two.href) + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, amount*2) + + def test_settlement(self): + merchant = balanced.Customer().save() + order = merchant.create_order() + card = balanced.Card(**INTERNATIONAL_CARD).save() + + order.debit_from(source=card, amount=1234) + payable_account = merchant.payable_account + payable_account.credit( + amount=1234, order=order.href, appears_on_statement_as='Payout') + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 1234) + bank_account = balanced.BankAccount( + account_number='1234567890', + routing_number='321174851', + name='Someone', + ).save() + bank_account.associate_to_customer(merchant) + + settlement = payable_account.settle( + funding_instrument=bank_account.href, + appears_on_statement_as="Settlement Oct", + description="Settlement for payouts from October") + self.assertEqual(settlement.amount, 1234) + self.assertEqual(settlement.appears_on_statement_as, + "BAL*Settlement Oct") + self.assertEqual(settlement.description, + "Settlement for payouts from October") + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 0) + + def test_settle_reverse_account_credit(self): + merchant = balanced.Customer().save() + order = merchant.create_order() + card = balanced.Card(**INTERNATIONAL_CARD).save() + + order.debit_from(source=card, amount=1234) + payable_account = merchant.payable_account + account_credit = payable_account.credit( + amount=1234, order=order.href, appears_on_statement_as='Payout') + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 1234) + + bank_account = balanced.BankAccount( + account_number='1234567890', + routing_number='321174851', + name='Someone', + ).save() + bank_account.associate_to_customer(merchant) + + payable_account.settle( + funding_instrument=bank_account.href, + appears_on_statement_as="Settlement Oct", + description="Settlement for payouts from October") + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 0) + + order_two = merchant.create_order() + order_two.debit_from(source=card, amount=1234) + payable_account.credit(amount=1234, order=order_two.href) + + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 1234) + + account_credit.reverse(amount=1234) + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 0) + + def test_settle_account_negative_balance(self): + merchant = balanced.Customer().save() + order = merchant.create_order() + card = balanced.Card(**INTERNATIONAL_CARD).save() + + order.debit_from(source=card, amount=1234) + payable_account = merchant.payable_account + account_credit = payable_account.credit( + amount=1234, order=order.href, appears_on_statement_as='Payout') + bank_account = balanced.BankAccount( + account_number='1234567890', + routing_number='321174851', + name='Someone', + ).save() + bank_account.associate_to_customer(merchant) + + payable_account.settle( + funding_instrument=bank_account.href, + appears_on_statement_as="Settlement Oct", + description="Settlement for payouts from October") + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 0) + + account_credit.reverse(amount=1234) + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, -1234) + + payable_account.settle( + funding_instrument=bank_account.href, + appears_on_statement_as="Settlement Oct", + description="Settlement for payouts from October") + payable_account = merchant.payable_account + self.assertEqual(payable_account.balance, 0) + + +class Rev0URIBasicUseCases(unittest.TestCase): + """This test case ensures all revision 0 URIs can work without a problem + with current revision 1 client + + """ + + @classmethod + def setUpClass(cls): + # ensure we won't consume API key from other test case + balanced.configure() + cls.api_key = balanced.APIKey().save() + balanced.configure(cls.api_key.secret) + cls.marketplace = balanced.Marketplace().save() + + @classmethod + def _iter_customer_uris(cls, marketplace, customer): + args = dict( + mp=marketplace, + customer=customer, + ) + for pattern in [ + '/v1/customers/{customer.id}', + '/v1/marketplaces/{mp.id}/accounts/{customer.id}', + ]: + yield pattern.format(**args) + + @classmethod + def _iter_card_uris(cls, marketplace, customer, card): + args = dict( + mp=marketplace, + customer=customer, + card=card, + ) + for pattern in [ + '/v1/customers/{customer.id}/cards/{card.id}', + '/v1/marketplaces/{mp.id}/cards/{card.id}', + '/v1/marketplaces/{mp.id}/accounts/{customer.id}/cards/{card.id}', + ]: + yield pattern.format(**args) + + @classmethod + def _iter_bank_account_uris(cls, marketplace, customer, bank_account): + args = dict( + mp=marketplace, + customer=customer, + bank_account=bank_account, + ) + for pattern in [ + '/v1/customers/{customer.id}/bank_accounts/{bank_account.id}', + '/v1/marketplaces/{mp.id}/bank_accounts/{bank_account.id}', + '/v1/marketplaces/{mp.id}/accounts/{customer.id}/bank_accounts/{bank_account.id}', + ]: + yield pattern.format(**args) + + def assert_not_rev0(self, resource): + """Ensures the given resouce is not in revision 0 format + + """ + self.assert_(not hasattr(resource, '_uris')) + + def test_marketplace(self): + uri = '/v1/marketplaces/{0}'.format(self.marketplace.id) + marketplace = balanced.Marketplace.fetch(uri) + self.assertEqual(marketplace.id, self.marketplace.id) + self.assert_not_rev0(marketplace) + + def test_customer(self): + customer = balanced.Customer().save() + for uri in self._iter_customer_uris( + marketplace=self.marketplace, + customer=customer, + ): + result_customer = balanced.Customer.fetch(uri) + self.assertEqual(result_customer.id, customer.id) + self.assert_not_rev0(result_customer) + + def test_associate_card(self): + customer = balanced.Customer().save() + cards = set() + for uri in self._iter_customer_uris( + marketplace=self.marketplace, + customer=customer, + ): + card = balanced.Card(**CARD).save() + card.customer = uri + card.save() + cards.add(card.href) + customer_cards = set(card.href for card in customer.cards) + self.assertEqual(cards, customer_cards) + + def test_associate_bank_account(self): + customer = balanced.Customer().save() + bank_accounts = set() + for uri in self._iter_customer_uris( + marketplace=self.marketplace, + customer=customer, + ): + bank_account = balanced.BankAccount(**BANK_ACCOUNT).save() + bank_account.customer = uri + bank_account.save() + bank_accounts.add(bank_account.href) + + customer_bank_accounts = set( + bank_account.href for bank_account in customer.bank_accounts + ) + self.assertEqual(bank_accounts, customer_bank_accounts) + + def test_set_default_card(self): + customer = balanced.Customer().save() + card1 = balanced.Card(**CARD).save() + card1.associate_to_customer(customer) + card2 = balanced.Card(**CARD).save() + card2.associate_to_customer(customer) + # set card 1 as the default source + customer.source = card1.href + customer.save() + self.assertEqual(customer.source.href, card1.href) + for uri in self._iter_card_uris( + marketplace=self.marketplace, + customer=customer, + card=card2, + ): + # set the source to card2 via rev0 URI + customer.source = uri + customer.save() + self.assertEqual(customer.source.href, card2.href) + + # set the source back to card1 + customer.source = card1.href + customer.save() + self.assertEqual(customer.source.href, card1.href) + + def test_set_default_bank_account(self): + customer = balanced.Customer().save() + bank_account1 = balanced.BankAccount(**BANK_ACCOUNT).save() + bank_account1.associate_to_customer(customer) + bank_account2 = balanced.BankAccount(**BANK_ACCOUNT).save() + bank_account2.associate_to_customer(customer) + # set bank account 1 as the default destination + customer.destination = bank_account1.href + customer.save() + self.assertEqual(customer.destination.href, bank_account1.href) + for uri in self._iter_bank_account_uris( + marketplace=self.marketplace, + customer=customer, + bank_account=bank_account2, + ): + # set the destination to bank_account2 via rev0 URI + customer.destination = uri + customer.save() + self.assertEqual(customer.destination.href, bank_account2.href) + + # set the destination back to bank_account1 + customer.destination = bank_account1.href + customer.save() + self.assertEqual(customer.destination.href, bank_account1.href) + + def test_debit(self): + customer = balanced.Customer().save() + card = balanced.Card(**CARD).save() + card.associate_to_customer(customer) + for uri in self._iter_card_uris( + marketplace=self.marketplace, + customer=customer, + card=card, + ): + debit = balanced.Debit(amount=100, source=uri).save() + self.assertEqual(debit.source.href, card.href) + self.assertEqual(debit.amount, 100) + + def test_credit(self): + # make sufficient amount for credit later + card = balanced.Card(**CARD).save() + card.debit(amount=1000000) + + customer = balanced.Customer().save() + bank_account = balanced.BankAccount(**BANK_ACCOUNT).save() + bank_account.associate_to_customer(customer) + for uri in self._iter_bank_account_uris( + marketplace=self.marketplace, + customer=customer, + bank_account=bank_account, + ): + credit = balanced.Credit(amount=100, destination=uri).save() + self.assertEqual(credit.destination.href, bank_account.href) + self.assertEqual(credit.amount, 100)