Skip to content

Instantly share code, notes, and snippets.

@SecurityForUs
Forked from anonymous/gist:4163632
Created November 28, 2012 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SecurityForUs/4164143 to your computer and use it in GitHub Desktop.
Save SecurityForUs/4164143 to your computer and use it in GitHub Desktop.
error--------------------------------------
[friendly_html] => <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="https://www.balancedpayments.com/marketplaces
[01:23:00] Nitish Kumar: Balanced\Exceptions\HTTPError Object
(
[response] => Httpful\Response Object
(
[body] => stdClass Object
(
[friendly_html] => <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="https://www.balancedpayments.com/marketplaces....
code ------------------------------------------------------------------------------------------------------------------
include('balanced/zatada/httpful.phar');
include('balanced/zatada/balanced.phar');
Httpful\Bootstrap::init();
Balanced\Bootstrap::init();
Balanced\Settings::$api_key = "API KEY";
$marketplace = Balanced\Marketplace::mine();
$bank_account = $marketplace->createBankAccount(
$_GET['name'], $_GET['account_number'], /* account_number */ $_GET['bank_code'] /* bank_code (routing number is USA) */
);
$msg = '';
$status = false;
$identity = array(
"type" => "person",
"name" => $_GET['name'],
"street_address" => $_GET['address'],
"postal_code" => $_GET['zip'],
"country" => "USA",
"dob" => $_GET['birth_year'] . '-' . $_GET['birth_month'],
"phone_number" => $_GET['phone']
);
try {
$merchant = $marketplace->createMerchant($_GET['email'], $identity, $bank_account->uri);
//$merchant = $marketplace->createMerchant('merchant8@example.org', $identity, $bank_account->uri);
$msg = 'Successfully Added.';
$status = true;
$query = "UPDATE `user_website` SET is_account_detail = '1' WHERE id = '" . $_SESSION["user_id"] . "' ";
mysql_query($query);
} catch (Balanced\Exceptions\HTTPError $e) {
echo("Category code: https://github.com/balanced/balanced-api/blob/master/errors.rst#" . $e->category_code);
/* if ($e->category_code == 'duplicate-email-address') {
# oops, account for $email_address already exists so just add the card
$merchant = $marketplace
->accounts
->query()
->filter(Balanced\Account::$f->email_address->eq($_GET['email']))
->one();
$msg = 'Already Exist Email Id.';
$status = false;
} else {
$msg = 'Other Errors';
$status = false;
print_r($e);
}*/
}
echo json_encode(array('status' => $status, 'data' => $msg));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment