Skip to content

Instantly share code, notes, and snippets.

@rserna2010
rserna2010 / gist:8290521
Created January 6, 2014 21:56
CURL Credit Reversal
curl https://api.balancedpayments.com/v1/credits/:credit_uri/reversals \
-u key_secret: \
-d "credit_uri=/v1/marketplaces/:marketplace_uri/bank_accounts/:bank_account_uri/credits" \
-d "description=Reversal for Order #1111" \
@rserna2010
rserna2010 / gist:8426433
Created January 14, 2014 21:46
debit on specific card
curl https://api.balancedpayments.com/v1/customers/CU6hFfogMISo58cfwCoe8zbp/debits \
-u ak-test-2n5nNOMaPjkA5GCbOWlIeCNO79mdZ8cfQ: \
-d "appears_on_statement_as=Statement text" \
-d "amount=5000" \
-d "description=Some descriptive text for the debit in the dashboard"
-d "source_uri=card_uri"
@rserna2010
rserna2010 / gist:8427433
Created January 14, 2014 22:45
failing test
asyncTest('debit bank account', 2, function(assert) {
var stub = sinon.stub(Balanced.Adapter, "create");
visit(Testing.BANK_ACCOUNT_ROUTE).then(function() {
var controller = Balanced.__container__.lookup('controller:bankAccounts');
var model = controller.get('model');
model.set('can_debit', true);
stop();
Ember.run.next(function() {
@rserna2010
rserna2010 / gist:8430560
Last active January 3, 2016 07:39
Setting up PHP
git clone https://github.com/balanced/balanced-php.git
cd balanced-php
curl -s https://getcomposer.org/installer | php -d detect_unicode=Off
php composer.phar update
curl -s -L -o httpful.phar https://github.com/downloads/nategood/httpful/httpful.phar
curl -s -L -o restful.phar https://github.com/bninja/restful/downloads/restful-\{VERSION\}.phar
@rserna2010
rserna2010 / gist:8464382
Created January 16, 2014 22:05
Example
$result = $marketplace ->bank_accounts ->query() ->filter(Balanced\Customer::$f->email_address->eq('jim@test.com')) ->all();
@rserna2010
rserna2010 / gist:8563723
Created January 22, 2014 17:53
ruby scenarios/render_mako.rb
/Users/ryan/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require': no such file to load -- balanced/version (LoadError)
from /Users/ryan/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from ./lib/balanced.rb:5
from /Users/ryan/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
from /Users/ryan/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from scenarios/render_mako.rb:6
@rserna2010
rserna2010 / gist:8564396
Created January 22, 2014 18:27
Render_mako error
➜ balanced-ruby git:(1.1.0) ✗ ruby scenarios/render_mako.rb
/Users/ryan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- account (LoadError)
from /Users/ryan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/ryan/.rvm/gems/ruby-1.9.2-p320/gems/balanced-0.7.1/lib/balanced/resources.rb:3:in `<top (required)>'
from /Users/ryan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/ryan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/ryan/Desktop/balanced-ruby/lib/balanced.rb:87:in `<top (required)>'
from /Users/ryan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
@rserna2010
rserna2010 / gist:8695977
Created January 29, 2014 20:11
Debit marketplace PHP
$marketplace = \Balanced\Marketplace::mine();
$marketplace->owner_account->credit(
"5000",
);
@rserna2010
rserna2010 / gist:8868988
Created February 7, 2014 18:41
Change name python
customer.name ='Neil deGrasse Tyson 2'
customer.save()
Customer(twitter=None, meta={}, id=u'AC6Lfc3vAEoiJPSxHhikovOU', email=u'neil.degrasse.tyson65@example.com', _type=u'customer', source_uri=u'/v1/customers/AC6Lfc3vAEoiJPSxHhikovOU/bank_accounts/BA5HkUe00xTi8u9soYkalwwy', bank_accounts_uri=u'/v1/customers/AC6Lfc3vAEoiJPSxHhikovOU/bank_accounts', phone=None, _uris={u'transactions_uri': {u'_type': u'page', u'key': u'transactions'}, u'source_uri': {u'_type': u'bank_account', u'key': u'source'}, u'bank_accounts_uri': {u'_type': u'page', u'key': u'bank_accounts'}, u'refunds_uri': {u'_type': u'page', u'key': u'refunds'}, u'debits_uri': {u'_type': u'page', u'key': u'debits'}, u'destination_uri': {u'_type': u'bank_account', u'key': u'destination'}, u'holds_uri': {u'_type': u'page', u'key': u'holds'}, u'reversals_uri': {u'_type': u'page', u'key': u'reversals'}, u'credits_uri': {u'_type': u'page', u'key': u'credits'}, u'cards_uri': {u'_type': u'page', u'key': u'cards'}}, facebook=None, address={u'country_code': u'USA'}, destination_uri=u'/v1/customers/AC6Lfc3vAEoiJPSxHhi