Skip to content

Commit

Permalink
Add MerchantAccountService to SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
kostya-p-dev committed Feb 1, 2018
1 parent 38c3250 commit 6670086
Show file tree
Hide file tree
Showing 32 changed files with 2,144 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "paysafegroup/paysafe_sdk_php",
"name": "renttrack/paysafe_sdk_php",
"type": "library",
"description": "PHP SDK for the Paysafe API",
"keywords" : ["payment", "payment processing", "netbanx", "optimal", "sdk"],
Expand Down
22 changes: 22 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<php>
<server name="KERNEL_DIR" value="tests/" />
</php>

<testsuites>
<testsuite name="RentTrack PaySafeClientBundle Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion sample/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$paysafeApiKeyId = 'your-key-id';
$paysafeApiKeySecret = 'your-key-secret';
$paysafeAccountNumber = 'your-account-number';
// The currencyCode should match the currency of your Paysafe account.
// The currencyCode should match the currency of your Paysafe account
// The currencyBaseUnitsMultipler should in turn match the currencyCode.
// Since the API accepts only integer values, the currencyBaseUnitMultiplier is used convert the decimal amount into the accepted base units integer value.
$currencyCode = 'your-account-currency-code'; // for example: CAD
Expand Down
13 changes: 13 additions & 0 deletions sample/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ <h2>Sample Scripts</h2>
<li><a href="direct-debit_purchase.php">Direct debit purchase</a></li>
<li><a href="direct-debit_standalone.php">Direct debit standalone</a></li>
<li><a href="threed-secure.php">ThreeD secure </a></li>
<li><a href="merchant-account-simple.php">Creation Merchant Account</a>
<ul>
<li><a href="merchant-account-new-user-simple.php">Creation New User</a></li>
<li><a href="merchant-account-add-address-simple.php">Add an Address</a></li>
<li><a href="merchant-account-create-business-owner-simple.php">Create a Business Owner</a></li>
<li><a href="merchant-account-create-business-owner-address.php">Add a Business Owner Address</a></li>
<li><a href="merchant-account-create-business-owner-government-id.php">Add a Business Owner Government ID</a></li>
<li><a href="merchant-account-add-bank-account.php">Add a Merchant Bank Account</a></li>
<li><a href="merchant-account-terms-and-conditions.php">Accept Our Terms and Conditions</a></li>
<li><a href="merchant-account-activate.php">Activate Merchant Account</a></li>
</ul>
</li>
<li><a href="merchant-create-sub-account.php">Creation Merchant Sub Account</a>
</ul>
</body>
</html>
47 changes: 47 additions & 0 deletions sample/merchant-account-activate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
require_once('config.php');

use Paysafe\PaysafeApiClient;
use Paysafe\Environment;
use Paysafe\CardPayments\Authorization;

if ($_POST) {
$client = new PaysafeApiClient($paysafeApiKeyId, $paysafeApiKeySecret, Environment::TEST, $paysafeAccountNumber);
try {
$result = $client->merchantAccountService()->activateMerchantAccount(new \Paysafe\AccountManagement\MerchantAccount(array(
)));
die('successful! ID: ' . $result->id);
} catch (Paysafe\PaysafeException $e) {
echo '<pre>';
var_dump($e->getMessage());
if ($e->fieldErrors) {
var_dump($e->fieldErrors);
}
if ($e->links) {
var_dump($e->links);
}
echo '</pre>';
} catch (Paysafe\PaysafeException $e) {
var_dump($e->getMessage());
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Paysafe SDK - Activate Merchant Account</title>
</head>
<body>
<form method="post">
<fieldset>
<legend>Activate Merchant Account</legend>
<div>
<label>
<input type="hidden" name="test" value=""/>
</label>
</div>
</fieldset>
<input type="submit" />
</form>
</body>
</html>
111 changes: 111 additions & 0 deletions sample/merchant-account-add-address-simple.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?php
require_once('config.php');

use Paysafe\PaysafeApiClient;
use Paysafe\Environment;
use Paysafe\CardPayments\Authorization;

if ($_POST) {
$client = new PaysafeApiClient($paysafeApiKeyId, $paysafeApiKeySecret, Environment::TEST, $paysafeAccountNumber);
try {

$auth = $client->merchantAccountService()->createMerchantAccountAddress(new \Paysafe\AccountManagement\MerchantAccountAddress(array(
'street' => $_POST['street'],
'city' => $_POST['city'],
'state' => $_POST['state'],
'country' => $_POST['country'],
'zip' => $_POST['zip'],
)));


// var_dump($auth);die;
die('successful! ID: ' . $auth->id);
} catch (Paysafe\PaysafeException $e) {
echo '<pre>';
var_dump($e->getMessage());
if ($e->fieldErrors) {
var_dump($e->fieldErrors);
}
if ($e->links) {
var_dump($e->links);
}
echo '</pre>';
} catch (Paysafe\PaysafeException $e) {
var_dump($e->getMessage());
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Paysafe SDK - Creation Merchant Account Address</title>
</head>
<body>
<form method="post">
<fieldset>
<legend>Creation Merchant Account Address</legend>
<div>
<label>
street:
<input type="input" name="street" value="<?php
if (isset($_POST['street'])) {
echo $_POST['street'];
} else {
echo "100 Queen Street West";
}
?>"/>
</label>
</div>
<div>
<label>
city:
<input type="input" name="city" value="<?php
if (isset($_POST['city'])) {
echo $_POST['city'];
} else {
echo "Toronto";
}
?>"/>
</label>
</div>
<div>
<label>
state:
<input type="input" name="state" value="<?php
if (isset($_POST['state'])) {
echo $_POST['state'];
} else {
echo "ON";
}
?>"/>
</label>
</div>
<div>
<label>
country:
<input type="input" name="country" value="<?php
if (isset($_POST['country'])) {
echo $_POST['country'];
} else {
echo "CA";
}
?>"/>
</label>
</div>
<div>
<label>
zip:
<input type="input" name="zip" value="<?php
if (isset($_POST['zip'])) {
echo $_POST['zip'];
} else {
echo "M5H 2N2";
}
?>"/>
</label>
</div>
</fieldset>
<input type="submit" />
</form>
</body>
</html>
97 changes: 97 additions & 0 deletions sample/merchant-account-add-bank-account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php
require_once('config.php');

use Paysafe\PaysafeApiClient;
use Paysafe\Environment;
use Paysafe\CardPayments\Authorization;

if ($_POST) {
$client = new PaysafeApiClient($paysafeApiKeyId, $paysafeApiKeySecret, Environment::TEST, $paysafeAccountNumber);
try {
$auth = $client->merchantAccountService()->addMerchantEftBankAccount(new \Paysafe\AccountManagement\MerchantEftBankAccount(array(
'accountNumber' => $_POST['accountNumber'],
'transitNumber' => $_POST['transitNumber'],
'institutionId' => $_POST['institutionId'],
'merchantId' => $_POST['merchantId'],
)));
// var_dump($auth);die;


die('successful! ID: ' . $auth->id);
} catch (Paysafe\PaysafeException $e) {
echo '<pre>';
var_dump($e->getMessage());
if ($e->fieldErrors) {
var_dump($e->fieldErrors);
}
if ($e->links) {
var_dump($e->links);
}
echo '</pre>';
} catch (Paysafe\PaysafeException $e) {
var_dump($e->getMessage());
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Paysafe SDK - Creation Merchant Banka Account</title>
</head>
<body>
<form method="post">
<fieldset>
<legend>Creation Merchant Banka Account (EFT)</legend>
<div>
<label>
merchantId:
<input type="input" name="merchantId" value="<?php
if (isset($_POST['merchantId'])) {
echo $_POST['merchantId'];
} else {
echo "";
}
?>"/>
</label>
</div>
<div>
<label>
accountNumber:
<input type="input" name="accountNumber" value="<?php
if (isset($_POST['accountNumber'])) {
echo $_POST['accountNumber'];
} else {
echo "5807560412853954";
}
?>"/>
</label>
</div>
<div>
<label>
transitNumber:
<input type="input" name="transitNumber" value="<?php
if (isset($_POST['transitNumber'])) {
echo $_POST['transitNumber'];
} else {
echo "52487";
}
?>"/>
</label>
</div>
<div>
<label>
institutionId:
<input type="input" name="institutionId" value="<?php
if (isset($_POST['institutionId'])) {
echo $_POST['institutionId'];
} else {
echo "052";
}
?>"/>
</label>
</div>
</fieldset>
<input type="submit" />
</form>
</body>
</html>
Loading

0 comments on commit 6670086

Please sign in to comment.