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 / example.rb
Created October 18, 2012 17:49
Balanced - Attach a card to an account without loading the account first
require 'balanced'
key = Balanced::ApiKey.new.save
Balanced.configure(key.secret)
Balanced::Marketplace.new.save
card = Balanced::Card.new(
:card_number => "5105105105105100",
:expiration_month => "12",
:expiration_year => "2015",
@mjallday
mjallday / example.py
Created October 23, 2012 22:38
Balanced - Minimum fields for a business
import balanced
import random
balanced.configure('7b7a51ccb10c11e19c0a026ba7e239a9') # test marketplace
business = {
'type': 'business',
'name': 'Bobs Used Auto Emporium',
@mjallday
mjallday / upgrade.sh
Created October 24, 2012 01:27
Balanced force ACH upgrade
rails new balancedachtest
cd balancedachtest
echo "gem 'balanced-ach', '~>0.2'" >> Gemfile
bundle install
@mjallday
mjallday / Instructions.md
Created October 30, 2012 00:56
Balanced PHP Install without Composer

Run these from a terminal

curl http://cloud.github.com/downloads/nategood/httpful/httpful-0.2.0.phar > httpful.phar
curl http://cloud.github.com/downloads/balanced/balanced-php/balanced-0.6.6.phar > balanced.phar
curl https://raw.github.com/balanced/balanced-php/master/example/example.php > balanced-example.php

Edit balanced-example.php and make sure the first 7 lines match this:

<?php
@mjallday
mjallday / example.rb
Created October 31, 2012 15:46
Balanced minimal buyer creation
require 'balanced'
Balanced.configure('7b7a51ccb10c11e19c0a026ba7e239a9')
card = Balanced::Card.new({'card_number' => '5105105105105100', 'expiration_month' => '12', 'expiration_year' => '2020'}).save
Balanced::Account.new({'name' => 'bob', 'card_uri' => card.uri}).save
@mjallday
mjallday / redisbuffer.py
Created October 31, 2012 17:06
Redis Circular Buffer
class RedisCircularBuffer(object):
def __init__(self, namespace, size):
self.namespace = namespace
self.size = size
import redis
self.redis = redis.Redis()
def append(self, item):
self.redis.lpush(self.namespace, item)
@mjallday
mjallday / balanced.py
Created November 1, 2012 19:01
Balanced Payments Card Error Map
response_codes = {
'201': 'Invalid CC Account Number',
'202': 'Bad Amount, Non-Numeric Amount',
'203': 'Zero Amount',
'204': 'Other Error',
'205': 'Bad Total Auth Amount',
'218': 'Invalid SKU Number',
'219': 'Invalid Credit Plan',
'220': 'Invalid Store Number',
@mjallday
mjallday / example.md
Created November 1, 2012 21:25
Balanced Card Rejection

Example of a card that will not tokenize

curl -X POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/cards \
  -u 7b7a51ccb10c11e19c0a026ba7e239a9: \
  -d card_number="4222222222222220" \
  -d expiration_month="12" \
  -d expiration_year="2020" \
  -d security_code="123"

Response

@mjallday
mjallday / example.py
Created November 22, 2012 01:45
no update
In [1]: import balanced
In [2]: balanced.configure('a36f5e0c342911e2af92026ba7f8ec28')
In [3]: ba = BankAccount.query[0]
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-8eadeddd5edb> in <module>()
----> 1 ba = BankAccount.query[0]
@mjallday
mjallday / balanced-bank-account.html
Created November 27, 2012 17:55
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="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"
rel="stylesheet">