lockfile again
This commit is contained in:
99
vendor/payeezy/payeezy-php/src/Payeezy/Client.php
vendored
Normal file
99
vendor/payeezy/payeezy-php/src/Payeezy/Client.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_Client
|
||||
{
|
||||
/**
|
||||
* @var string The Payeezy API key to be used for requests.
|
||||
*/
|
||||
public static $apiKey;
|
||||
|
||||
/**
|
||||
* @var string The Payeezy API Secret to be used for requests.
|
||||
*/
|
||||
public static $apiSecret;
|
||||
|
||||
/**
|
||||
* @var string The Payeezy Merchant Token to be used for requests.
|
||||
*/
|
||||
public static $merchantToken;
|
||||
|
||||
/**
|
||||
* @var string The Payeezy URL to be used for requests.
|
||||
*/
|
||||
public static $url;
|
||||
|
||||
const VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* @return string The API key used for requests.
|
||||
*/
|
||||
public static function getApiKey()
|
||||
{
|
||||
return self::$apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the API key to be used for requests.
|
||||
*
|
||||
* @param string $apiKey
|
||||
*/
|
||||
public static function setApiKey($apiKey)
|
||||
{
|
||||
self::$apiKey = $apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The API key used for requests.
|
||||
*/
|
||||
public static function getApiSecret()
|
||||
{
|
||||
return self::$apiSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the API key to be used for requests.
|
||||
*
|
||||
* @param string $apiKey
|
||||
*/
|
||||
public static function setApiSecret($apiSecret)
|
||||
{
|
||||
self::$apiSecret = $apiSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The API key used for requests.
|
||||
*/
|
||||
public static function getMerchantToken()
|
||||
{
|
||||
return self::$merchantToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the API key to be used for requests.
|
||||
*
|
||||
* @param string $apiKey
|
||||
*/
|
||||
public static function setMerchantToken($merchantToken)
|
||||
{
|
||||
self::$merchantToken = $merchantToken;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string The API key used for requests.
|
||||
*/
|
||||
public static function getUrl()
|
||||
{
|
||||
return self::$url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the API key to be used for requests.
|
||||
*
|
||||
* @param string $apiKey
|
||||
*/
|
||||
public static function setUrl($url)
|
||||
{
|
||||
self::$url = $url;
|
||||
}
|
||||
}
|
||||
10
vendor/payeezy/payeezy-php/src/Payeezy/CreditCard.php
vendored
Normal file
10
vendor/payeezy/payeezy-php/src/Payeezy/CreditCard.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_CreditCard extends Payeezy_TransactionType
|
||||
{
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
parent::__construct('credit_card', $client);
|
||||
}
|
||||
}
|
||||
32
vendor/payeezy/payeezy-php/src/Payeezy/Error.php
vendored
Normal file
32
vendor/payeezy/payeezy-php/src/Payeezy/Error.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_Error extends Exception
|
||||
{
|
||||
public function __construct($correlation_id, $errorResponse)
|
||||
{
|
||||
|
||||
$this->httpStatus = $correlation_id;
|
||||
$httpBodyArray = array();
|
||||
foreach ($errorResponse->messages as $message) {
|
||||
$httpBodyArray[] = $message->description;
|
||||
}
|
||||
$this->httpBody = implode(", ", $httpBodyArray);
|
||||
$this->jsonBody = json_encode($errorResponse, JSON_FORCE_OBJECT);
|
||||
parent::__construct($message = $this->httpBody);
|
||||
}
|
||||
|
||||
public function getHttpStatus()
|
||||
{
|
||||
return $this->httpStatus;
|
||||
}
|
||||
|
||||
public function getHttpBody()
|
||||
{
|
||||
return $this->httpBody;
|
||||
}
|
||||
|
||||
public function getJsonBody()
|
||||
{
|
||||
return $this->jsonBody;
|
||||
}
|
||||
}
|
||||
10
vendor/payeezy/payeezy-php/src/Payeezy/Paypal.php
vendored
Normal file
10
vendor/payeezy/payeezy-php/src/Payeezy/Paypal.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_Paypal extends Payeezy_TransactionType
|
||||
{
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
parent::__construct('paypal', $client);
|
||||
}
|
||||
}
|
||||
10
vendor/payeezy/payeezy-php/src/Payeezy/TeleCheck.php
vendored
Normal file
10
vendor/payeezy/payeezy-php/src/Payeezy/TeleCheck.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_TeleCheck extends Payeezy_TransactionType
|
||||
{
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
parent::__construct('tele_check', $client);
|
||||
}
|
||||
}
|
||||
10
vendor/payeezy/payeezy-php/src/Payeezy/Token.php
vendored
Normal file
10
vendor/payeezy/payeezy-php/src/Payeezy/Token.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_Token extends Payeezy_TransactionType
|
||||
{
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
parent::__construct('token', $client);
|
||||
}
|
||||
}
|
||||
161
vendor/payeezy/payeezy-php/src/Payeezy/Transaction.php
vendored
Executable file
161
vendor/payeezy/payeezy-php/src/Payeezy/Transaction.php
vendored
Executable file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_Transaction
|
||||
{
|
||||
private $url;
|
||||
|
||||
private $baseURL;
|
||||
|
||||
private $apiKey;
|
||||
|
||||
private $apiSecret;
|
||||
|
||||
private $merchantToken;
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
$this->baseURL = $client->getUrl();
|
||||
$this->apiKey = $client->getApiKey();
|
||||
$this->apiSecret = $client->getApiSecret();
|
||||
$this->merchantToken = $client->getMerchantToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* HMAC Authentication
|
||||
*/
|
||||
|
||||
public function hmacAuthorizationToken($payload)
|
||||
{
|
||||
|
||||
$nonce = strval(hexdec(bin2hex(openssl_random_pseudo_bytes(4, $cstrong))));
|
||||
|
||||
$timestamp = strval(time()*1000); //time stamp in milli seconds
|
||||
|
||||
$data = $this->apiKey . $nonce . $timestamp . $this->merchantToken . $payload;
|
||||
|
||||
$hashAlgorithm = "sha256";
|
||||
|
||||
$hmac = hash_hmac($hashAlgorithm, $data, $this->apiSecret, false); // HMAC Hash in hex
|
||||
|
||||
$authorization = base64_encode($hmac);
|
||||
|
||||
return array(
|
||||
'authorization' => $authorization,
|
||||
'nonce' => $nonce,
|
||||
'timestamp' => $timestamp,
|
||||
'apikey' => $this->apiKey,
|
||||
'token' => $this->merchantToken,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* jsonpp - Pretty print JSON data
|
||||
*
|
||||
* In versions of PHP < 5.4.x, the json_encode() function does not yet provide a
|
||||
* pretty-print option. In lieu of forgoing the feature, an additional call can
|
||||
* be made to this function, passing in JSON text, and (optionally) a string to
|
||||
* be used for indentation.
|
||||
*
|
||||
* @param string $json The JSON data, pre-encoded
|
||||
* @param string $istr The indentation string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsonpp($json, $istr = ' ')
|
||||
{
|
||||
$result = '';
|
||||
for ($p=$q=$i=0; isset($json[$p]); $p++) {
|
||||
$json[$p] == '"' && ($p>0?$json[$p-1]:'') != '\\' && $q=!$q;
|
||||
if (strchr('}]', $json[$p]) && !$q && $i--) {
|
||||
strchr('{[', $json[$p-1]) || $result .= "\n".str_repeat($istr, $i);
|
||||
}
|
||||
$result .= $json[$p];
|
||||
if (strchr(',{[', $json[$p]) && !$q) {
|
||||
$i += strchr('{[', $json[$p])===false?0:1;
|
||||
strchr('}]', $json[$p+1]) || $result .= "\n".str_repeat($istr, $i);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* Post Transaction
|
||||
*/
|
||||
|
||||
public function postTransaction($payload, $headers)
|
||||
{
|
||||
|
||||
$request = curl_init();
|
||||
curl_setopt($request, CURLOPT_URL, $this->url);
|
||||
curl_setopt($request, CURLOPT_POST, true);
|
||||
curl_setopt($request, CURLOPT_POSTFIELDS, $payload);
|
||||
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($request, CURLOPT_HEADER, false);
|
||||
//curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt(
|
||||
$request,
|
||||
CURLOPT_HTTPHEADER,
|
||||
array(
|
||||
'Content-Type: application/json',
|
||||
'apikey:'.strval($this->apiKey),
|
||||
'token:'.strval($this->merchantToken),
|
||||
'Authorization:'.$headers['authorization'],
|
||||
'nonce:'.$headers['nonce'],
|
||||
'timestamp:'.$headers['timestamp'],
|
||||
)
|
||||
);
|
||||
|
||||
$response = curl_exec($request);
|
||||
|
||||
if (false === $response) {
|
||||
echo curl_error($request);
|
||||
}
|
||||
|
||||
//$httpcode = curl_getinfo($request, CURLINFO_HTTP_CODE);
|
||||
curl_close($request);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this for primary transactions like Authorize, Purchase
|
||||
* @param transactionRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public function doPrimaryTransaction($args = array())
|
||||
{
|
||||
$this->url = $this->baseURL;
|
||||
$payload = json_encode($args, JSON_FORCE_OBJECT);
|
||||
$headerArray = $this->hmacAuthorizationToken($payload);
|
||||
|
||||
$response_in_JSON = $this->postTransaction($payload, $headerArray);
|
||||
$response = json_decode($response_in_JSON);
|
||||
if (isset($response->Error)) {
|
||||
throw new Payeezy_Error($response->correlation_id, $response->Error);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this for Secondary transactions like void, refund, capture etc
|
||||
*/
|
||||
|
||||
public function doSecondaryTransaction($transaction_id, $args = array())
|
||||
{
|
||||
$this->url = $this->baseURL . '/' . $transaction_id;
|
||||
$payload = json_encode($args, JSON_FORCE_OBJECT);
|
||||
$headerArray = $this->hmacAuthorizationToken($payload);
|
||||
$response_in_JSON = $this->postTransaction($payload, $headerArray);
|
||||
$response = json_decode($response_in_JSON);
|
||||
if (isset($response->Error)) {
|
||||
throw new Payeezy_Error($response->correlation_id, $response->Error);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}//end of class
|
||||
143
vendor/payeezy/payeezy-php/src/Payeezy/TransactionType.php
vendored
Normal file
143
vendor/payeezy/payeezy-php/src/Payeezy/TransactionType.php
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_TransactionType extends Payeezy_Transaction
|
||||
{
|
||||
|
||||
private $method;
|
||||
|
||||
public function __construct($method, $client)
|
||||
{
|
||||
$this->method = $method;
|
||||
parent::__construct($client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* Authorize Transaction
|
||||
*/
|
||||
|
||||
public function authorize($args = array())
|
||||
{
|
||||
$args['transaction_type'] = 'authorize';
|
||||
$args['method'] = $this->method;
|
||||
return parent::doPrimaryTransaction($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* Purchase Transaction
|
||||
*/
|
||||
|
||||
public function purchase($args = array())
|
||||
{
|
||||
$args['transaction_type'] = 'purchase';
|
||||
$args['method'] = $this->method;
|
||||
return parent::doPrimaryTransaction($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* Capture Transaction
|
||||
*/
|
||||
|
||||
public function capture($transaction_id, $args = array())
|
||||
{
|
||||
$args['transaction_type'] = 'capture';
|
||||
$args['method'] = $this->method;
|
||||
return parent::doSecondaryTransaction($transaction_id, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* Void Transaction
|
||||
*/
|
||||
|
||||
public function void($transaction_id, $args = array())
|
||||
{
|
||||
$args['transaction_type'] = "void";
|
||||
$args['method'] = $this->method;
|
||||
return parent::doSecondaryTransaction($transaction_id, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* Refund Transaction
|
||||
*/
|
||||
|
||||
public function refund($transaction_id, $args = array())
|
||||
{
|
||||
$args['transaction_type'] = "refund";
|
||||
$args['method'] = $this->method;
|
||||
return parent::doSecondaryTransaction($transaction_id, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* cashout Transaction
|
||||
*/
|
||||
|
||||
public function cashout($args = array())
|
||||
{
|
||||
$args['transaction_type'] = "cashout";
|
||||
$args['method'] = $this->method;
|
||||
return parent::doPrimaryTransaction($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* reload Transaction
|
||||
*/
|
||||
|
||||
public function reload($args = array())
|
||||
{
|
||||
$args['transaction_type'] = "reload";
|
||||
$args['method'] = $this->method;
|
||||
return parent::doPrimaryTransaction($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* balance_inquiry Transaction
|
||||
*/
|
||||
|
||||
public function balanceInquiry($args = array())
|
||||
{
|
||||
$args['transaction_type'] = "balance_inquiry";
|
||||
$args['method'] = $this->method;
|
||||
return parent::doPrimaryTransaction($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* deactivation Transaction
|
||||
*/
|
||||
|
||||
public function deactivation($args = array())
|
||||
{
|
||||
$args['transaction_type'] = "deactivation";
|
||||
$args['method'] = $this->method;
|
||||
return parent::doPrimaryTransaction($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Payeezy
|
||||
*
|
||||
* activation Transaction
|
||||
*/
|
||||
|
||||
public function activation($args = array())
|
||||
{
|
||||
$args['transaction_type'] = "activation";
|
||||
$args['method'] = $this->method;
|
||||
return parent::doPrimaryTransaction($args);
|
||||
}
|
||||
}
|
||||
13
vendor/payeezy/payeezy-php/src/Payeezy/Util.php
vendored
Normal file
13
vendor/payeezy/payeezy-php/src/Payeezy/Util.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_Util
|
||||
{
|
||||
|
||||
public function processInput($data)
|
||||
{
|
||||
$data = trim($data);
|
||||
$data = stripslashes($data);
|
||||
$data = htmlspecialchars($data);
|
||||
return strval($data);
|
||||
}
|
||||
}
|
||||
10
vendor/payeezy/payeezy-php/src/Payeezy/ValueLink.php
vendored
Normal file
10
vendor/payeezy/payeezy-php/src/Payeezy/ValueLink.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_ValueLink extends Payeezy_TransactionType
|
||||
{
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
parent::__construct('valuelink', $client);
|
||||
}
|
||||
}
|
||||
10
vendor/payeezy/payeezy-php/src/Payeezy/threeDS.php
vendored
Normal file
10
vendor/payeezy/payeezy-php/src/Payeezy/threeDS.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Payeezy_threeDS extends Payeezy_TransactionType
|
||||
{
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
parent::__construct('3ds', $client);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user