<s> from __future__ import unicode_literals <EOL> import balanced <EOL> print "<STR_LIT>" <EOL> api_key = balanced . APIKey ( ) . save ( ) <EOL> print "<STR_LIT>" , api_key . secret <EOL> print "<STR_LIT>" + api_key . secret <EOL> balanced . configure ( api_key . secret ) <EOL> print "<STR_LIT>" <EOL> marketplace = balanced . Marketplace ( ) . save ( ) <EOL> if not balanced . Marketplace . my_marketplace : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> print "<STR_LIT>" . format ( <EOL> balanced . Marketplace . my_marketplace <EOL> ) <EOL> print "<STR_LIT>" . format ( marketplace . name ) <EOL> print "<STR_LIT>" <EOL> marketplace . name = "<STR_LIT>" <EOL> marketplace . save ( ) <EOL> print "<STR_LIT>" . format ( marketplace . name ) <EOL> if marketplace . name != '<STR_LIT>' : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> print "<STR_LIT>" <EOL> card = balanced . Card ( <EOL> number = "<STR_LIT>" , <EOL> expiration_month = "<STR_LIT>" , <EOL> expiration_year = "<STR_LIT>" , <EOL> ) . save ( ) <EOL> print "<STR_LIT>" + card . href <EOL> print "<STR_LIT>" <EOL> buyer = balanced . Customer ( email = "<STR_LIT>" , source = card ) . save ( ) <EOL> print "<STR_LIT>" + buyer . href <EOL> print "<STR_LIT>" <EOL> the_hold = card . hold ( <NUM_LIT> ) <EOL> print "<STR_LIT>" <EOL> debit = the_hold . capture ( ) <EOL> print "<STR_LIT>" <EOL> marketplace = balanced . Marketplace . my_marketplace <EOL> if marketplace . in_escrow != <NUM_LIT> : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> print "<STR_LIT>" . format ( marketplace . in_escrow ) <EOL> print "<STR_LIT>" <EOL> refund = debit . refund ( ) <EOL> print ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> bank_account = balanced . BankAccount ( <EOL> account_number = "<STR_LIT>" , <EOL> routing_number = "<STR_LIT>" , <EOL> name = "<STR_LIT>" , <EOL> ) . save ( ) <EOL> merchant = balanced . Customer ( <EOL> email_address = "<STR_LIT>" , <EOL> name = "<STR_LIT>" , <EOL> address = { <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> } , <EOL> dob = "<STR_LIT>" , <EOL> phone_number = "<STR_LIT>" , <EOL> destination = bank_account , <EOL> ) . save ( ) <EOL> print "<STR_LIT>" <EOL> another_debit = card . debit ( <NUM_LIT> , appears_on_statement_as = "<STR_LIT>" ) <EOL> print "<STR_LIT>" <EOL> credit = bank_account . credit ( <EOL> <NUM_LIT> , description = "<STR_LIT>" ) <EOL> print "<STR_LIT>" <EOL> mp_credit = marketplace . owner_customer . bank_accounts . first ( ) . credit ( <EOL> <NUM_LIT> , description = "<STR_LIT>" ) <EOL> print "<STR_LIT>" <EOL> card . delete ( ) <EOL> assert buyer . cards . count ( ) == <NUM_LIT:0> <EOL> print "<STR_LIT>" <EOL> bank_account . delete ( ) <EOL> print "<STR_LIT>" <EOL> card = balanced . Card ( <EOL> number = "<STR_LIT>" , <EOL> expiration_month = "<STR_LIT>" , <EOL> expiration_year = "<STR_LIT>" , <EOL> ) . save ( ) <EOL> card . associate_to_customer ( buyer ) <EOL> assert buyer . cards . count ( ) == <NUM_LIT:1> <EOL> print "<STR_LIT>" </s>
