Skip to content

Instantly share code, notes, and snippets.

View mjallday's full-sized avatar
🏠
WFH

Marshall Jones mjallday

🏠
WFH
View GitHub Profile
@mjallday
mjallday / invalid.rb
Last active December 14, 2015 22:19
Balanced Ruby Bank Account Invalidates
require 'balanced'
host = ENV.fetch('BALANCED_HOST') { nil }
options = {}
if host
options[:scheme] = 'http'
options[:host] = host
options[:port] = 5000
end
def merchant
after_redirection = "#{root_url}balanced/success"
current_user = User.find(session[:user_id])
begin
existing=Balanced::Account.find_by_email(current_user.email)
if existing.nil?
@market = marketplace_creation
marketplace = @market
bank_account = marketplace.create_bank_account(
:account_number => params[:account_number],
require 'balanced'
# PUT your old API key here
Balanced.configure('')
new_key = Balanced::ApiKey.new().save()
Balanced::ApiKey.find('/v1/api_keys/AK6f4Ue2NQDW0YhiBgBSQvLE').destroy()
# this is your new key.
@mjallday
mjallday / ember.html
Last active December 14, 2015 12:38
Ember.js teething issues
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My HTML File</title>
<link rel="stylesheet"
href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://raw.github.com/wycats/handlebars.js/1.0.0-rc.3/dist/handlebars.js"></script>
<script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-rc.1.js"></script>
@mjallday
mjallday / example.rb
Created March 4, 2013 17:12
No funding destination
cwd = File.dirname(File.dirname(File.absolute_path(__FILE__)))
$:.unshift(cwd + "/lib")
require 'balanced'
api_key = Balanced::ApiKey.new.save
secret = api_key.secret
Balanced.configure(secret)
marketplace = Balanced::Marketplace.new.save
@mjallday
mjallday / meta.py
Created February 14, 2013 00:42
on_behalf_of for multiple recipients
# your meta field should include something like:
meta = {
on_behalf_of: {
'/v1/accounts/1': 50, # account 1's cut of the debit
'/v1/accounts/2': 100, # account 2's cut of the debit
}
}
#!/usr/bin/env python
from __future__ import unicode_literals
import pymongo
import threading
DB_NAME = 'events'
COLLECTION_NAME = 'events'
class Subscriber(threading.Thread):
@mjallday
mjallday / example.sh
Created November 30, 2012 18:49
Add a card by PUTting directly on an account
curl -X POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts \
-u 7b7a51ccb10c11e19c0a026ba7e239a9:
curl -X PUT https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts/AC2hJSp3FgpVlAe976Lc3txR \
-u 7b7a51ccb10c11e19c0a026ba7e239a9: -d card[card_number]="5105105105105100" -d card[expiration_month]="12" -d card[expiration_year]=2020
curl https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts/AC2hJSp3FgpVlAe976Lc3txR/cards \
-u 7b7a51ccb10c11e19c0a026ba7e239a9:
@mjallday
mjallday / example.sh
Created November 29, 2012 16:23
Attach bank account to an existing account
# create a bank account
curl -X POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/bank_accounts \
-u 7b7a51ccb10c11e19c0a026ba7e239a9: \
-d name="WHC III Checking" \
-d account_number="12341234" \
-d routing_number="321174851"
# create an account
curl -X POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts \
-u 7b7a51ccb10c11e19c0a026ba7e239a9:
@mjallday
mjallday / balanced-bank-account.html
Created November 28, 2012 19:26
Balanced bank account collection form with Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tokenize Bank Account Form - Balanced</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le styles -->
<link href="https://twitter.github.com/bootstrap/assets/css/bootstrap.css"
rel="stylesheet">