Skip to content

Instantly share code, notes, and snippets.

View mahmoudimus's full-sized avatar
💭
@_@

Mahmoud Rusty Abdelkader mahmoudimus

💭
@_@
View GitHub Profile
@mahmoudimus
mahmoudimus / hstore.py
Created October 9, 2012 20:36 — forked from dahlia/hstore.py
PostgreSQL hstore + SQLAlchemy
""":mod:`hstore` --- Using PostgreSQL hstore with SQLAlchemy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. note::
I released it under Public Domain. Feel free to use!
It provides :class:`Hstore` type which makes you to store Python
dictionaries into hstore columns in PostgreSQL. For example::
@mahmoudimus
mahmoudimus / scenarios.md
Created November 11, 2012 20:13
Balanced Fee Scenarios

let your buyer's name be Robert

let your merchant's name be Jack

let your marketplace's name be TshirtFooey

scenario 1

  • Robert buys 1 t-shirt on TshirtFooey for $10.00.
  • Balanced charges TshirtFooey 59 cents (2.9% + 0.30c = 0.029 * 1000 + 30)
  • TshirtFooey credits 10.00$ to Jack.
@mahmoudimus
mahmoudimus / gist:4129834
Created November 22, 2012 07:37 — forked from anonymous/gist:4129827
Extended issue
try {
$account = $marketplace->createAccount($email_address);
}
catch (Balanced\Exceptions\HTTPError $e) {
if ($e->category_code == 'duplicate-email-address') {
print_r($mercht
->accounts
->query()
->filter(Balanced\Account::$f->email_address->eq(email_address)));
$account = $mercht
@mahmoudimus
mahmoudimus / runthisonlinux.bash
Created December 2, 2012 08:58
Test that installation works
#!/bin/bash
cd /tmp
mkdir marketplace
cd marketplace/
curl -s -L -o httpful.zip https://github.com/nategood/httpful/zipball/master;
curl -s -L -o restful.zip https://github.com/bninja/restful/zipball/master;
curl -s -L -o balanced.zip https://github.com/balanced/balanced-php/zipball/master
unzip httpful.zip; mv nategood-httpful* httpful; rm httpful.zip
unzip restful.zip; mv bninja-restful* restful; rm restful.zip
@mahmoudimus
mahmoudimus / create.php
Created December 4, 2012 20:13 — forked from anonymous/create
crete
<?php
$card = Balanced\Marketplace::mine()->createCard(
'',
'',
'',
'',
$first_name.' '.$last_name,
$card_number,
/// <summary>
/// PUT https://api.balancedpayments.com/v1/marketplaces/:marketplace_id/accounts/:account_id
/// curl https://api.balancedpayments.com/v1/marketplaces/TEST-MP365nSS4SNSrrlMeJXI7LUC/accounts \
/// -u 657c523c3b8e11e2a893026ba7cd33d0: \
/// </summary>
/// <param name="bankAccountUri">-d "bank_account_uri=/v1/bank_accounts/BA3HRAcWctcPl1Yy18lOXHUb"</param>
/// <returns></returns>
public Account AddBankToAccount(string bankAccountUri, string account_id)
{
Require.Argument("bank_account_uri", bankAccountUri);
@mahmoudimus
mahmoudimus / create-card.php
Created December 7, 2012 18:39
Create a card generated from dockers/scenarios/card_create
<?php
require(__DIR__ . '/vendor/autoload.php');
Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();
Balanced\Settings::configure("http://localhost:5000", "3dd22b803f4e11e2a3243c07546c1efa");
<?php
$merchant = null;
try {
$merchant = $marketplace->accounts-create(array(
'email_address' => $_GET['email'],
'name' => $identity['name'],
'bank_account_uri' => $bank_account_uri
));
#!/usr/bin/env ruby
# make sure you cd to the directory where the balanced-ruby client lives
$:.unshift( Dir.pwd + "balanced-ruby/lib")
require 'balanced'
Balanced.configure(ENV['BALANCED_SECRET_KEY'])
puts Balanced::Account.find('/v1/marketplaces/TEST-MP2BEFU81QZwX4NXmgMo5ccS/accounts/AC6EMcgTdgG7oepcoP8bfJBK')
/*
If you're using us for JUST payouts, the bank account is deleted (to you)
% curl -u xxxxx: https://api.balancedpayments.com/v1/bank_accounts/BA52MGqVN6x5KOoDAm2GPq64
*/
{
"status": "Not Found",
"category_code": "not-found",
"category_type": "request",
"description": "<p>The requested URL was not found on the server.</p><p>If you entered the URL manually please check your spelling and try again.</p> Your request id is OHMbc9509d45c2b11e29bcc026ba7c1aba6.",