allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
25
vendor/fedapay/fedapay-php/lib/ApiOperations/All.php
vendored
Normal file
25
vendor/fedapay/fedapay-php/lib/ApiOperations/All.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait All
|
||||
*/
|
||||
trait All
|
||||
{
|
||||
/**
|
||||
* Static method to retrive a list of resources
|
||||
* @param array $params
|
||||
* @param array $headers
|
||||
*
|
||||
* @return array FedaPay\FedaPayObject
|
||||
*/
|
||||
public static function all($params = [], $headers = [])
|
||||
{
|
||||
self::_validateParams($params);
|
||||
$path = static::classPath();
|
||||
list($response, $opts) = static::_staticRequest('get', $path, $params, $headers);
|
||||
|
||||
return \FedaPay\Util\Util::arrayToFedaPayObject($response, $opts);
|
||||
}
|
||||
}
|
||||
29
vendor/fedapay/fedapay-php/lib/ApiOperations/Create.php
vendored
Normal file
29
vendor/fedapay/fedapay-php/lib/ApiOperations/Create.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait Create
|
||||
*/
|
||||
trait Create
|
||||
{
|
||||
/**
|
||||
* Static method to create a resources
|
||||
* @param array $params
|
||||
* @param array $headers
|
||||
*
|
||||
* @return Resource
|
||||
*/
|
||||
public static function create($params = [], $headers = [])
|
||||
{
|
||||
self::_validateParams($params);
|
||||
$path = static::classPath();
|
||||
$className = static::className();
|
||||
|
||||
list($response, $opts) = static::_staticRequest('post', $path, $params, $headers);
|
||||
|
||||
$object = \FedaPay\Util\Util::arrayToFedaPayObject($response, $opts);
|
||||
|
||||
return $object->$className;
|
||||
}
|
||||
}
|
||||
29
vendor/fedapay/fedapay-php/lib/ApiOperations/CreateInBatch.php
vendored
Normal file
29
vendor/fedapay/fedapay-php/lib/ApiOperations/CreateInBatch.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait CreateInBatch
|
||||
*/
|
||||
trait CreateInBatch
|
||||
{
|
||||
/**
|
||||
* Create resources in batch
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $headers
|
||||
* @return FedaPay\FedaPayObject
|
||||
*/
|
||||
public static function createInBatch($params = [], $headers = [])
|
||||
{
|
||||
$path = static::resourcePath('batch');
|
||||
$className = static::className();
|
||||
|
||||
list($response, $opts) = static::_staticRequest('post', $path, $params, $headers);
|
||||
|
||||
$object = \FedaPay\Util\Util::arrayToFedaPayObject($response, $opts);
|
||||
|
||||
$data = "{$className}_batch";
|
||||
return $object->$data;
|
||||
}
|
||||
}
|
||||
21
vendor/fedapay/fedapay-php/lib/ApiOperations/Delete.php
vendored
Normal file
21
vendor/fedapay/fedapay-php/lib/ApiOperations/Delete.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait Update
|
||||
*/
|
||||
trait Delete
|
||||
{
|
||||
/**
|
||||
* Send a detele request
|
||||
* @param array $headers
|
||||
*/
|
||||
public function delete($headers = [])
|
||||
{
|
||||
$path = $this->instanceUrl();
|
||||
static::_staticRequest('delete', $path, [], $headers);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
48
vendor/fedapay/fedapay-php/lib/ApiOperations/Request.php
vendored
Normal file
48
vendor/fedapay/fedapay-php/lib/ApiOperations/Request.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait Request
|
||||
*/
|
||||
trait Request
|
||||
{
|
||||
/**
|
||||
* Validate request params
|
||||
* @param array $params
|
||||
* @throws Error\InvalidRequest
|
||||
*/
|
||||
protected static function _validateParams($params = null)
|
||||
{
|
||||
if ($params && !is_array($params)) {
|
||||
$message = 'You must pass an array as the first argument to FedaPay API '
|
||||
. 'method calls. (HINT: an example call to create a customer '
|
||||
. "would be: \"FedaPay\\Customer::create(array('firstname' => toto, "
|
||||
. "'lastname' => 'zoro', 'email' => 'admin@gmail.com', 'phone' => '66666666'))\")";
|
||||
throw new FedaPay\Error\InvalidRequest($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Static method to send request
|
||||
* @param string $method
|
||||
* @param string $path
|
||||
* @param array $params
|
||||
* @param array $headers
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function _staticRequest($method, $path, $params = [], $headers = [])
|
||||
{
|
||||
$requestor = self::getRequestor();
|
||||
|
||||
$response = $requestor->request($method, $path, $params, $headers);
|
||||
|
||||
$options = [
|
||||
'apiVersion' => \FedaPay\FedaPay::getApiVersion(),
|
||||
'environment' => \FedaPay\FedaPay::getEnvironment()
|
||||
];
|
||||
|
||||
return [$response, $options];
|
||||
}
|
||||
}
|
||||
25
vendor/fedapay/fedapay-php/lib/ApiOperations/Retrieve.php
vendored
Normal file
25
vendor/fedapay/fedapay-php/lib/ApiOperations/Retrieve.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait Retrieve
|
||||
*/
|
||||
trait Retrieve
|
||||
{
|
||||
/**
|
||||
* Static method to retrive a resource
|
||||
* @param mixed $id
|
||||
* @return FedaPay\FedaPayObject
|
||||
*/
|
||||
public static function retrieve($id, $params = [], $headers = [])
|
||||
{
|
||||
$url = static::resourcePath($id);
|
||||
$className = static::className();
|
||||
|
||||
list($response, $opts) = static::_staticRequest('get', $url, $params, $headers);
|
||||
$object = \FedaPay\Util\Util::arrayToFedaPayObject($response, $opts);
|
||||
|
||||
return $object->$className;
|
||||
}
|
||||
}
|
||||
31
vendor/fedapay/fedapay-php/lib/ApiOperations/Save.php
vendored
Normal file
31
vendor/fedapay/fedapay-php/lib/ApiOperations/Save.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait Save
|
||||
*/
|
||||
trait Save
|
||||
{
|
||||
/**
|
||||
* Update the resource
|
||||
* @param array $headers the request headers
|
||||
*
|
||||
* @return Resource the updated API resource
|
||||
*/
|
||||
public function save($headers = [])
|
||||
{
|
||||
$params = $this->serializeParameters();
|
||||
$className = static::className();
|
||||
$path = $this->instanceUrl();
|
||||
|
||||
list($response, $opts) = static::_staticRequest('put', $path, $params, $headers);
|
||||
|
||||
$klass = $opts['apiVersion'] . '/' . $className;
|
||||
|
||||
$json = $response[$klass];
|
||||
$this->refreshFrom($json, $opts);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
26
vendor/fedapay/fedapay-php/lib/ApiOperations/Search.php
vendored
Normal file
26
vendor/fedapay/fedapay-php/lib/ApiOperations/Search.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait Search
|
||||
*/
|
||||
trait Search
|
||||
{
|
||||
/**
|
||||
* Static method to search resources
|
||||
* @param array $params
|
||||
* @param array $headers
|
||||
*
|
||||
* @return array FedaPay\FedaPayObject
|
||||
*/
|
||||
public static function search($q = '*', $params = [], $headers = [])
|
||||
{
|
||||
$params['search'] = $q;
|
||||
self::_validateParams($params);
|
||||
$path = static::resourcePath('search');
|
||||
list($response, $opts) = static::_staticRequest('get', $path, $params, $headers);
|
||||
|
||||
return \FedaPay\Util\Util::arrayToFedaPayObject($response, $opts);
|
||||
}
|
||||
}
|
||||
29
vendor/fedapay/fedapay-php/lib/ApiOperations/Update.php
vendored
Normal file
29
vendor/fedapay/fedapay-php/lib/ApiOperations/Update.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace FedaPay\ApiOperations;
|
||||
|
||||
/**
|
||||
* trait Update
|
||||
*/
|
||||
trait Update
|
||||
{
|
||||
/**
|
||||
* Static method to update a resource
|
||||
* @param string $id The ID of the API resource to update.
|
||||
* @param array $params The request params
|
||||
* @param array $headers the request headers
|
||||
*
|
||||
* @return Resource the updated API resource
|
||||
*/
|
||||
public static function update($id, $params = [], $headers = [])
|
||||
{
|
||||
self::_validateParams($params);
|
||||
$path = static::resourcePath($id);
|
||||
$className = static::className();
|
||||
|
||||
list($response, $opts) = static::_staticRequest('put', $path, $params, $headers);
|
||||
$object = \FedaPay\Util\Util::arrayToFedaPayObject($response, $opts);
|
||||
|
||||
return $object->$className;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user