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:
26
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/Attribute.php
vendored
Normal file
26
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/Attribute.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace MercadoPago\Annotation;
|
||||
use Doctrine\Common\Annotations\Annotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
class Attribute extends Annotation
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $required = false;
|
||||
public $serialize = true ;
|
||||
public $readOnly;
|
||||
public $primaryKey;
|
||||
public $idempotency;
|
||||
public $defaultValue;
|
||||
public $maxLength;
|
||||
}
|
||||
12
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/DenyDynamicAttribute.php
vendored
Normal file
12
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/DenyDynamicAttribute.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MercadoPago\Annotation;
|
||||
use Doctrine\Common\Annotations\Annotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
class DenyDynamicAttribute extends Annotation
|
||||
{
|
||||
public $value;
|
||||
}
|
||||
15
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/RequestParam.php
vendored
Normal file
15
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/RequestParam.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace MercadoPago\Annotation;
|
||||
use Doctrine\Common\Annotations\Annotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
class RequestParam extends Annotation
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $param;
|
||||
}
|
||||
21
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/RestMethod.php
vendored
Normal file
21
vendor/mercadopago/dx-php/src/MercadoPago/Annotation/RestMethod.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace MercadoPago\Annotation;
|
||||
use Doctrine\Common\Annotations\Annotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
class RestMethod extends Annotation
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $method;
|
||||
public $idempotency;
|
||||
}
|
||||
193
vendor/mercadopago/dx-php/src/MercadoPago/Config.php
vendored
Normal file
193
vendor/mercadopago/dx-php/src/MercadoPago/Config.php
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Config Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class Config
|
||||
extends Config\AbstractConfig
|
||||
{
|
||||
/**
|
||||
* Available parsers
|
||||
* @var array
|
||||
*/
|
||||
private $_supportedFileParsers = [
|
||||
'MercadoPago\\Config\\Json',
|
||||
'MercadoPago\\Config\\Yaml',
|
||||
];
|
||||
|
||||
private $_restclient = null;
|
||||
|
||||
/**
|
||||
* Default values
|
||||
* @return array
|
||||
*/
|
||||
protected function getDefaults()
|
||||
{
|
||||
return [
|
||||
'base_url' => 'https://api.mercadopago.com',
|
||||
'CLIENT_ID' => '',
|
||||
'CLIENT_SECRET' => '',
|
||||
'USER_ID' => '',
|
||||
'APP_ID' => '',
|
||||
'ACCESS_TOKEN' => '',
|
||||
'REFRESH_TOKEN' => '',
|
||||
'sandbox_mode' => true,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $path
|
||||
*
|
||||
* Static load method
|
||||
* @return static
|
||||
*/
|
||||
public static function load($path = null)
|
||||
{
|
||||
return new static($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Config constructor.
|
||||
*
|
||||
* @param string|null $path
|
||||
* @param null $restClient
|
||||
*/
|
||||
public function __construct($path = null, $restClient = null)
|
||||
{
|
||||
$this->data = [];
|
||||
$this->_restclient = $restClient;
|
||||
if (is_file($path ?? '')) {
|
||||
$info = pathinfo($path);
|
||||
$parts = explode('.', $info['basename']);
|
||||
$extension = array_pop($parts);
|
||||
$parser = $this->_getParser($extension);
|
||||
|
||||
foreach ((array)$parser->parse($path) as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $extension
|
||||
*
|
||||
* Get Parser depending on extension
|
||||
* @return null
|
||||
* @throws Exception
|
||||
*/
|
||||
private function _getParser($extension)
|
||||
{
|
||||
$parser = null;
|
||||
foreach ($this->_supportedFileParsers as $fileParser) {
|
||||
$tempParser = new $fileParser;
|
||||
if (in_array($extension, $tempParser->getSupportedExtensions($extension))) {
|
||||
$parser = $tempParser;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($parser === null) {
|
||||
throw new Exception('Unsupported configuration format');
|
||||
}
|
||||
|
||||
return $parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set config value
|
||||
* @param $key
|
||||
* @param $value
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
parent::set($key, $value);
|
||||
|
||||
if ($key == "ACCESS_TOKEN") {
|
||||
$user = $this->getUserId($value);
|
||||
parent::set('USER_ID', $user['id']);
|
||||
parent::set('COUNTRY_ID', $user['country_id']);
|
||||
}
|
||||
|
||||
if (parent::get('CLIENT_ID') != "" && parent::get('CLIENT_SECRET') != "" && empty(parent::get('ACCESS_TOKEN'))) {
|
||||
|
||||
$response = $this->getToken();
|
||||
|
||||
if (isset($response['access_token'])) {
|
||||
parent::set('ACCESS_TOKEN', $response['access_token']);
|
||||
|
||||
|
||||
$user = $this->getUserId($response['access_token']);
|
||||
|
||||
if (isset($user['id'])) {
|
||||
parent::set('USER_ID', $user['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
if (!$this->_restclient) {
|
||||
$this->_restclient = new RestClient();
|
||||
$this->_restclient->setHttpParam('address', $this->get('base_url'));
|
||||
}
|
||||
$response = $this->_restclient->get("/users/me");
|
||||
|
||||
return $response["body"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain token with key and secret
|
||||
* @return mixed
|
||||
*/
|
||||
public function getToken()
|
||||
{
|
||||
if (!$this->_restclient) {
|
||||
$this->_restclient = new RestClient();
|
||||
}
|
||||
$data = ['grant_type' => 'client_credentials',
|
||||
'client_id' => $this->get('CLIENT_ID'),
|
||||
'client_secret' => $this->get('CLIENT_SECRET')];
|
||||
$this->_restclient->setHttpParam('address', $this->get('base_url'));
|
||||
$response = $this->_restclient->post("/oauth/token", ['json_data' => json_encode($data)]);
|
||||
return $response['body'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh token
|
||||
* @return mixed
|
||||
* //TODO check valid response with production credentials
|
||||
*/
|
||||
public function refreshToken()
|
||||
{
|
||||
if (!$this->_restclient) {
|
||||
$this->_restclient = new RestClient();
|
||||
}
|
||||
$data = ['grant_type' => 'refresh_token',
|
||||
'refresh_token' => $this->get('REFRESH_TOKEN'),
|
||||
'client_secret' => $this->get('ACCESS_TOKEN')];
|
||||
$this->_restclient->setHttpParam('address', $this->get('base_url'));
|
||||
$response = $this->_restclient->post("/oauth/token", ['json_data' => json_encode($data)]);
|
||||
if (isset($response['access_token']) && isset($response['refresh_token']) && isset($response['client_id']) && isset($response['client_secret'])) {
|
||||
parent::set('ACCESS_TOKEN', $response['access_token']);
|
||||
parent::set('REFRESH_TOKEN', $response['refresh_token']);
|
||||
}
|
||||
return $response['body'];
|
||||
}
|
||||
|
||||
public function getData(){
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
100
vendor/mercadopago/dx-php/src/MercadoPago/Config/AbstractConfig.php
vendored
Normal file
100
vendor/mercadopago/dx-php/src/MercadoPago/Config/AbstractConfig.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
namespace MercadoPago\Config;
|
||||
|
||||
/**
|
||||
* AbstractConfig Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago\Config
|
||||
*/
|
||||
abstract class AbstractConfig
|
||||
{
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $data = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $cache = [];
|
||||
|
||||
/**
|
||||
* AbstractConfig constructor.
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = array_merge($this->getDefaults(), $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getDefaults()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function clean()
|
||||
{
|
||||
return $this->data = array(
|
||||
'base_url' => 'https://api.mercadopago.com',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param null $default
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
|
||||
if ($this->has($key)) {
|
||||
return $this->data[$key];
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return (array_key_exists($key, $this->data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*/
|
||||
public function configure ($data = [])
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
40
vendor/mercadopago/dx-php/src/MercadoPago/Config/Json.php
vendored
Normal file
40
vendor/mercadopago/dx-php/src/MercadoPago/Config/Json.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace MercadoPago\Config;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Json Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago\Config
|
||||
*/
|
||||
class Json implements ParserInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function parse($path)
|
||||
{
|
||||
$data = json_decode(file_get_contents($path), true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$error_message = 'Syntax error';
|
||||
if (function_exists('json_last_error_msg')) {
|
||||
$error_message = json_last_error_msg();
|
||||
}
|
||||
|
||||
throw new Exception($error_message);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSupportedExtensions()
|
||||
{
|
||||
return array('json');
|
||||
}
|
||||
}
|
||||
22
vendor/mercadopago/dx-php/src/MercadoPago/Config/ParserInterface.php
vendored
Normal file
22
vendor/mercadopago/dx-php/src/MercadoPago/Config/ParserInterface.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace MercadoPago\Config;
|
||||
|
||||
/**
|
||||
* Interface ParserInterface
|
||||
*
|
||||
* @package MercadoPago\Config
|
||||
*/
|
||||
interface ParserInterface
|
||||
{
|
||||
/**
|
||||
* @param $path
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function parse($path);
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSupportedExtensions();
|
||||
}
|
||||
36
vendor/mercadopago/dx-php/src/MercadoPago/Config/Yaml.php
vendored
Normal file
36
vendor/mercadopago/dx-php/src/MercadoPago/Config/Yaml.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace MercadoPago\Config;
|
||||
use Exception;
|
||||
use Symfony\Component\Yaml\Yaml as YamlParser;
|
||||
|
||||
/**
|
||||
* Yaml Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago\Config
|
||||
*/
|
||||
class Yaml implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* @param $path
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function parse($path)
|
||||
{
|
||||
try {
|
||||
$data = YamlParser::parse(file_get_contents($path));
|
||||
} catch (Exception $exception) {
|
||||
throw new Exception('Error parsing YAML file');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSupportedExtensions()
|
||||
{
|
||||
return array('yaml', 'yml');
|
||||
}
|
||||
}
|
||||
163
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AdvancedPayments/AdvancedPayment.php
vendored
Normal file
163
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AdvancedPayments/AdvancedPayment.php
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
namespace MercadoPago\AdvancedPayments;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use MercadoPago\Entity;
|
||||
|
||||
/**
|
||||
* Advanced Payment class
|
||||
* @link https://www.mercadopago.com/developers/en/reference/advanced_payments/_advanced_payments_id_search/get/ Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/v1/advanced_payments", method="create")
|
||||
* @RestMethod(resource="/v1/advanced_payments/:id", method="read")
|
||||
* @RestMethod(resource="/v1/advanced_payments/search", method="search")
|
||||
* @RestMethod(resource="/v1/advanced_payments/:id", method="update")
|
||||
* @RestMethod(resource="/v1/advanced_payments/:id/refunds", method="refund")
|
||||
*/
|
||||
class AdvancedPayment extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* id
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* application_id
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $application_id;
|
||||
|
||||
/**
|
||||
* payments
|
||||
* @var array
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $payments;
|
||||
|
||||
/**
|
||||
* disbursements
|
||||
* @var array
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $disbursements;
|
||||
|
||||
/**
|
||||
* payer
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $payer;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* binary_mode
|
||||
* @var boolean
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $binary_mode;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* capture
|
||||
* @var boolean
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $capture;
|
||||
|
||||
|
||||
/**
|
||||
* cancel
|
||||
* @return bool|mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function cancel() {
|
||||
$this->status = 'cancelled';
|
||||
|
||||
return $this->update();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* capture
|
||||
* @return bool|mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function capture()
|
||||
{
|
||||
$this->capture = true;
|
||||
|
||||
return $this->update();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* refund
|
||||
* @param int $amount
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function refund($amount = 0){
|
||||
$refund = new Refund(["advanced_payment_id" => $this->id]);
|
||||
if ($amount > 0){
|
||||
$refund->amount = $amount;
|
||||
}
|
||||
|
||||
if ($refund->save()){
|
||||
$advanced_payment = self::get($this->id);
|
||||
$this->_fillFromArray($this, $advanced_payment->toArray());
|
||||
return true;
|
||||
}else{
|
||||
$this->error = $refund->error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* refundDisbursement
|
||||
* @param $disbursement_id
|
||||
* @param int $amount
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function refundDisbursement($disbursement_id, $amount = 0){
|
||||
$refund = new DisbursementRefund(["advanced_payment_id" => $this->id, "disbursement_id" => $disbursement_id]);
|
||||
if ($amount > 0){
|
||||
$refund->amount = $amount;
|
||||
}
|
||||
|
||||
if ($refund->save()){
|
||||
$advanced_payment = self::get($this->id);
|
||||
$this->_fillFromArray($this, $advanced_payment->toArray());
|
||||
return true;
|
||||
}else{
|
||||
$this->error = $refund->error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
75
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AdvancedPayments/DisbursementRefund.php
vendored
Normal file
75
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AdvancedPayments/DisbursementRefund.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Disbursement Refund class file
|
||||
*/
|
||||
namespace MercadoPago\AdvancedPayments;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use MercadoPago\Entity;
|
||||
|
||||
/**
|
||||
* Disbursement Refund class
|
||||
* @RestMethod(resource="/v1/advanced_payments/:advanced_payment_id/disbursements/:disbursement_id/refunds", method="create")
|
||||
* @RestMethod(resource="/v1/advanced_payments/:advanced_payment_id/disbursements/:disbursement_id/refunds/:refund_id", method="read")
|
||||
*/
|
||||
class DisbursementRefund extends Entity {
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* payment_id
|
||||
* @Attribute(serialize=false)
|
||||
* @var int
|
||||
*/
|
||||
protected $payment_id;
|
||||
|
||||
/**
|
||||
* amount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* source
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute(readOnly=true)
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* advanced_payment_id
|
||||
* @Attribute(serialize=false)
|
||||
* @var int
|
||||
*/
|
||||
protected $advanced_payment_id;
|
||||
|
||||
/**
|
||||
* disbursement_id
|
||||
* @Attribute(serialize=false)
|
||||
* @var int
|
||||
*/
|
||||
protected $disbursement_id;
|
||||
|
||||
}
|
||||
61
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AdvancedPayments/Refund.php
vendored
Normal file
61
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AdvancedPayments/Refund.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Refund class file
|
||||
*/
|
||||
namespace MercadoPago\AdvancedPayments;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use MercadoPago\Entity;
|
||||
|
||||
/**
|
||||
* Refund class
|
||||
* @RestMethod(resource="/v1/advanced_payments/:advanced_payment_id/refunds", method="create")
|
||||
* @RestMethod(resource="/v1/advanced_payments/:advanced_payment_id/refunds/:refund_id", method="read")
|
||||
*/
|
||||
class Refund extends Entity {
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* payment_id
|
||||
* @Attribute(serialize=false)
|
||||
* @var int
|
||||
*/
|
||||
protected $payment_id;
|
||||
|
||||
/**
|
||||
* amount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* source
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute(readOnly=true)
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
}
|
||||
147
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AuthorizedPayment.php
vendored
Normal file
147
vendor/mercadopago/dx-php/src/MercadoPago/Entities/AuthorizedPayment.php
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* Authorized Payments class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Authorized Payments Class
|
||||
*
|
||||
* @RestMethod(resource="/authorized_payments/:id", method="read")
|
||||
* @RestMethod(resource="/authorized_payments/search", method="search")
|
||||
*/
|
||||
|
||||
class AuthorizedPayment extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute(primaryKey = true)
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* preapprova_id
|
||||
* @Attribute(type = "string")
|
||||
* @var int
|
||||
*/
|
||||
protected $preapproval_id;
|
||||
|
||||
/**
|
||||
* type
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute(type = "date")
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* last_modified
|
||||
* @Attribute(type = "date")
|
||||
* @var string
|
||||
*/
|
||||
protected $last_modified;
|
||||
|
||||
/**
|
||||
* transaction_amount
|
||||
* @Attribute(type = "float")
|
||||
* @var float
|
||||
*/
|
||||
protected $transaction_amount;
|
||||
|
||||
/**
|
||||
* currency_id
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $currency_id;
|
||||
|
||||
/**
|
||||
* reason
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $reason;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* payment
|
||||
* @Attribute(type = "object")
|
||||
* @var object
|
||||
*/
|
||||
protected $payment;
|
||||
|
||||
/**
|
||||
* rejection_code
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $rejection_code;
|
||||
|
||||
/**
|
||||
* retry_attempt
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $retry_attempt;
|
||||
|
||||
/**
|
||||
* next_retry_date
|
||||
* @Attribute(type = "date")
|
||||
* @var string
|
||||
*/
|
||||
protected $next_retry_date;
|
||||
|
||||
/**
|
||||
* last_retry_date
|
||||
* @Attribute(type = "date")
|
||||
* @var string
|
||||
*/
|
||||
protected $last_retry_date;
|
||||
|
||||
/**
|
||||
* expire_date
|
||||
* @Attribute(type = "date")
|
||||
* @var string
|
||||
*/
|
||||
protected $expire_date;
|
||||
|
||||
/**
|
||||
* debit_date
|
||||
* @Attribute(type = "date")
|
||||
* @var string
|
||||
*/
|
||||
protected $debit_date;
|
||||
|
||||
/**
|
||||
* coupon_code
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $coupon_code;
|
||||
|
||||
|
||||
}
|
||||
118
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Card.php
vendored
Normal file
118
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Card.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* The cards class is the way to store card data of your customers safely to improve the shopping experience.
|
||||
*
|
||||
* This will allow your customers to complete their purchases much faster and easily, since they will not have to complete their card data again.
|
||||
*
|
||||
* This class must be used in conjunction with the Customer class.
|
||||
*
|
||||
* @link https://www.mercadopago.com/developers/en/guides/online-payments/web-tokenize-checkout/customers-and-cards Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/v1/customers/:customer_id/cards", method="create")
|
||||
* @RestMethod(resource="/v1/customers/:customer_id/cards", method="list")
|
||||
* @RestMethod(resource="/v1/customers/:customer_id/cards/:id", method="read")
|
||||
* @RestMethod(resource="/v1/customers/:customer_id/cards/:id", method="update")
|
||||
* @RestMethod(resource="/v1/customers/:customer_id/cards/:id", method="delete")
|
||||
*/
|
||||
|
||||
class Card extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute(primaryKey = true)
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* token
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $token;
|
||||
|
||||
/**
|
||||
* customer_id
|
||||
* @Attribute(required = true, serialize = false)
|
||||
* @var string
|
||||
*/
|
||||
protected $customer_id;
|
||||
|
||||
/**
|
||||
* expiration_month
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $expiration_month;
|
||||
|
||||
/**
|
||||
* expiration_year
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $expiration_year;
|
||||
|
||||
/**
|
||||
* first_six_digits
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $first_six_digits;
|
||||
|
||||
/**
|
||||
* last_four_digits
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $last_four_digits;
|
||||
|
||||
/**
|
||||
* payment_method
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $payment_method;
|
||||
|
||||
/**
|
||||
* security_code
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $security_code;
|
||||
|
||||
/**
|
||||
* issuer
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $issuer;
|
||||
|
||||
/**
|
||||
* cardholder
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $cardholder;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* date_last_updated
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_last_updated;
|
||||
|
||||
|
||||
}
|
||||
131
vendor/mercadopago/dx-php/src/MercadoPago/Entities/CardToken.php
vendored
Normal file
131
vendor/mercadopago/dx-php/src/MercadoPago/Entities/CardToken.php
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Card Token class
|
||||
* This class will allow you to send your customers card data for Mercado Pago server and receive a token to complete the payments transactions.
|
||||
*
|
||||
* @RestMethod(resource="/v1/card_tokens?public_key=:public_key", method="create")
|
||||
* @RestMethod(resource="/v1/card_tokens?public_key=:public_key", method="read")
|
||||
* @RestMethod(resource="/v1/card_tokens?public_key=:public_key", method="update")
|
||||
*/
|
||||
|
||||
class CardToken extends Entity
|
||||
{
|
||||
/**
|
||||
* card_id
|
||||
* @Attribute(primaryKey = true)
|
||||
* @var int
|
||||
*/
|
||||
protected $card_id;
|
||||
|
||||
/**
|
||||
* public_key
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $public_key;
|
||||
|
||||
/**
|
||||
* first_six_digits
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $first_six_digits;
|
||||
|
||||
/**
|
||||
* luhn_validation
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $luhn_validation;
|
||||
|
||||
/**
|
||||
* date_used
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_used;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* date_due
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_due;
|
||||
|
||||
/**
|
||||
* card_number_length
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $card_number_length;
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* security_code_length
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $security_code_length;
|
||||
|
||||
/**
|
||||
* expiration_year
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $expiration_year;
|
||||
|
||||
/**
|
||||
* expiration_month
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $expiration_month;
|
||||
|
||||
/**
|
||||
* date_last_updated
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_last_updated;
|
||||
|
||||
/**
|
||||
* last_four_digits
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $last_four_digits;
|
||||
|
||||
/**
|
||||
* cardholder
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $cardholder;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
}
|
||||
103
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Chargeback.php
vendored
Normal file
103
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Chargeback.php
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Chargeback class file
|
||||
* @link https://www.mercadopago.com/developers/en/reference/chargebacks/_chargebacks_id/get/ Click here for more infos
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
|
||||
/**
|
||||
* Chargeback class
|
||||
* @RestMethod(resource="/v1/chargebacks/:id", method="read")
|
||||
*/
|
||||
class Chargeback extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute(primaryKey = true, type = "string", readOnly = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* payments
|
||||
* @Attribute(type = "array", readOnly = true)
|
||||
* @var array
|
||||
*/
|
||||
protected $payments;
|
||||
|
||||
/**
|
||||
* amount
|
||||
* @Attribute(type = "string", readOnly = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
/**
|
||||
* coverage_applied
|
||||
* @Attribute(type = "float", readOnly = true)
|
||||
* @var float
|
||||
*/
|
||||
protected $coverage_applied;
|
||||
|
||||
/**
|
||||
* coverage_elegible
|
||||
* @Attribute(readOnly = true)
|
||||
* @var float
|
||||
*/
|
||||
protected $coverage_elegible;
|
||||
|
||||
/**
|
||||
* documentation_required
|
||||
* @Attribute(readOnly = true)
|
||||
* @var mixed
|
||||
*/
|
||||
protected $documentation_required;
|
||||
|
||||
/**
|
||||
* documentation_status
|
||||
* @Attribute(readOnly = true)
|
||||
* @var mixed
|
||||
*/
|
||||
protected $documentation_status;
|
||||
|
||||
/**
|
||||
* documentation
|
||||
* @Attribute(type = "string", readOnly = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $documentation;
|
||||
|
||||
/**
|
||||
* date_documentation_deadline
|
||||
* @Attribute(type = "array", readOnly = true)
|
||||
* @var array
|
||||
*/
|
||||
protected $date_documentation_deadline;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute(type = "date", readOnly = true)
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* date_last_updated
|
||||
* @Attribute(type = "date", readOnly = true)
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_last_updated;
|
||||
|
||||
/**
|
||||
* live_mode
|
||||
* @Attribute(type = "boolean", readOnly = true)
|
||||
* @var boolean
|
||||
*/
|
||||
protected $live_mode;
|
||||
|
||||
}
|
||||
143
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Customer.php
vendored
Normal file
143
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Customer.php
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* This class allows you to store customers data safely to improve the shopping experience.
|
||||
*
|
||||
* This will allow your customer to complete their purchases much faster and easily when used in conjunction with the Cards class.
|
||||
*
|
||||
* @link https://mercadopago.com/developers/en/guides/online-payments/web-tokenize-checkout/customers-and-cards Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/v1/customers/:id", method="read")
|
||||
* @RestMethod(resource="/v1/customers/search", method="search")
|
||||
* @RestMethod(resource="/v1/customers/", method="create")
|
||||
* @RestMethod(resource="/v1/customers/:id", method="update")
|
||||
* @RestMethod(resource="/v1/customers/:id", method="delete")
|
||||
*/
|
||||
|
||||
class Customer extends Entity
|
||||
{
|
||||
/**
|
||||
* email
|
||||
* @Attribute(primaryKey = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $email;
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* first_name
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $first_name;
|
||||
|
||||
/**
|
||||
* last_name
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $last_name;
|
||||
|
||||
/**
|
||||
* phone
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $phone;
|
||||
|
||||
/**
|
||||
* identification
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $identification;
|
||||
|
||||
/**
|
||||
* default_address
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $default_address;
|
||||
|
||||
/**
|
||||
* address
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
/**
|
||||
* date_registered
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_registered;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* date_last_updated
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_last_updated;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* default_card
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $default_card;
|
||||
|
||||
/**
|
||||
* card
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $cards;
|
||||
|
||||
/**
|
||||
* addresses
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $addresses;
|
||||
|
||||
/**
|
||||
* live_mode
|
||||
* @Attribute(type = "boolean")
|
||||
* @var boolean
|
||||
*/
|
||||
protected $live_mode;
|
||||
|
||||
}
|
||||
73
vendor/mercadopago/dx-php/src/MercadoPago/Entities/DiscountCampaign.php
vendored
Normal file
73
vendor/mercadopago/dx-php/src/MercadoPago/Entities/DiscountCampaign.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Discount Campaign class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use http\Params;
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* discount Campaign class
|
||||
* @RestMethod(resource="/v1/discount_campaigns", method="read")
|
||||
*/
|
||||
|
||||
|
||||
class DiscountCampaign extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute(primaryKey = true)
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* name
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* percent_off
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $percent_off;
|
||||
|
||||
/**
|
||||
* amount_off
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $amount_off;
|
||||
|
||||
/**
|
||||
* coupon_amount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $coupon_amount;
|
||||
|
||||
/**
|
||||
* currency_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $currency_id;
|
||||
|
||||
|
||||
/**
|
||||
* read
|
||||
* @param array $options
|
||||
* @param array $params
|
||||
* @return mixed|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function read($options = [], $params = []){
|
||||
return parent::read([], $options);
|
||||
}
|
||||
}
|
||||
44
vendor/mercadopago/dx-php/src/MercadoPago/Entities/InstoreOrder.php
vendored
Normal file
44
vendor/mercadopago/dx-php/src/MercadoPago/Entities/InstoreOrder.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
|
||||
/**
|
||||
* Instore Order class
|
||||
* @link https://www.mercadopago.com/developers/en/reference/instore_orders/_mpmobile_instore_qr_user_id_external_id/post/ Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/mpmobile/instore/qr/:user_id/:external_id", method="create")
|
||||
*/
|
||||
class InstoreOrder extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* notification_url
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $notification_url;
|
||||
|
||||
/**
|
||||
* items
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $items;
|
||||
|
||||
}
|
||||
125
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Invoice.php
vendored
Normal file
125
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Invoice.php
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Invoice class
|
||||
* @RestMethod(resource="/v1/invoices/:id", method="read")
|
||||
*/
|
||||
|
||||
class Invoice extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* subscription_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $subscription_id;
|
||||
|
||||
/**
|
||||
* plan_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $plan_id;
|
||||
|
||||
/**
|
||||
* payer
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $payer;
|
||||
|
||||
/**
|
||||
* application_fee
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $application_fee;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* last_modified
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $last_modified;
|
||||
|
||||
/**
|
||||
* live_mode
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $live_mode;
|
||||
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* payments
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $payments;
|
||||
|
||||
/**
|
||||
* debit_date
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $debit_date;
|
||||
|
||||
/**
|
||||
* next_payment_date
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $next_payment_date;
|
||||
|
||||
}
|
||||
174
vendor/mercadopago/dx-php/src/MercadoPago/Entities/MerchantOrder.php
vendored
Normal file
174
vendor/mercadopago/dx-php/src/MercadoPago/Entities/MerchantOrder.php
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* This class will allow you to create and manage your orders. You can attach one or more payments in your merchant order.
|
||||
* @link https://www.mercadopago.com/developers/en/reference/merchant_orders/_merchant_orders_search/get/ Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/merchant_orders/:id", method="read")
|
||||
* @RestMethod(resource="/merchant_orders/", method="create")
|
||||
* @RestMethod(resource="/merchant_orders/:id", method="update")
|
||||
*/
|
||||
|
||||
class MerchantOrder extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* preferenceId
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $preferenceId;
|
||||
|
||||
/**
|
||||
* dateCreated
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $dateCreated;
|
||||
|
||||
/**
|
||||
* lastUpdated
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $lastUpdate;
|
||||
|
||||
/**
|
||||
* applicationId
|
||||
* @Attribute
|
||||
* @var string
|
||||
*/
|
||||
protected $applicationId;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* siteId
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $siteId;
|
||||
|
||||
/**
|
||||
* payer
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $payer;
|
||||
|
||||
/**
|
||||
* collector
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $collector;
|
||||
|
||||
/**
|
||||
* sponsorId
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $sponsorId;
|
||||
|
||||
/**
|
||||
* payments
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $payments;
|
||||
|
||||
/**
|
||||
* paidAmount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $paidAmount;
|
||||
|
||||
/**
|
||||
* refundedAmount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $refundedAmount;
|
||||
|
||||
/**
|
||||
* shippingCost
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $shippingCost;
|
||||
|
||||
/**
|
||||
* cancelled
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $cancelled;
|
||||
|
||||
/**
|
||||
* items
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $items;
|
||||
|
||||
/**
|
||||
* shipments
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $shipments;
|
||||
|
||||
/**
|
||||
* notificationUrl
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $notificationUrl;
|
||||
|
||||
/**
|
||||
* additionalInfo
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $additionalInfo;
|
||||
|
||||
/**
|
||||
* externalReference
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $externalReference;
|
||||
|
||||
/**
|
||||
* marketplace
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $marketplace;
|
||||
|
||||
/**
|
||||
* totalAmount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $totalAmount;
|
||||
|
||||
}
|
||||
143
vendor/mercadopago/dx-php/src/MercadoPago/Entities/OAuth.php
vendored
Normal file
143
vendor/mercadopago/dx-php/src/MercadoPago/Entities/OAuth.php
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* OAuth class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* OAuth class
|
||||
* @RestMethod(resource="/oauth/token", method="create")
|
||||
*/
|
||||
|
||||
class OAuth extends Entity
|
||||
{
|
||||
/**
|
||||
* client_secret
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $client_secret;
|
||||
|
||||
/**
|
||||
* grant_type
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $grant_type;
|
||||
|
||||
/**
|
||||
* code
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $code;
|
||||
|
||||
/**
|
||||
* redirect_uri
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $redirect_uri;
|
||||
|
||||
/**
|
||||
* access_token
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $access_token;
|
||||
|
||||
/**
|
||||
* public_key
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $public_key;
|
||||
|
||||
/**
|
||||
* refresh_token
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $refresh_token;
|
||||
|
||||
/**
|
||||
* live_mode
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $live_mode;
|
||||
|
||||
/**
|
||||
* user_id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $user_id;
|
||||
|
||||
/**
|
||||
* token_type
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $token_type;
|
||||
|
||||
/**
|
||||
* expires_in
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $expires_in;
|
||||
|
||||
/**
|
||||
* scope
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $scope;
|
||||
|
||||
|
||||
/**
|
||||
* getAuthorizationURL
|
||||
* @param $app_id
|
||||
* @param $redirect_uri
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthorizationURL($app_id, $redirect_uri){
|
||||
$county_id = strtolower(SDK::getCountryId());
|
||||
return "https://auth.mercadopago.com.{$county_id}/authorization?client_id={$app_id}&response_type=code&platform_id=mp&redirect_uri={$redirect_uri}";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getOAuthCredentials
|
||||
* @param $authorization_code
|
||||
* @param $redirect_uri
|
||||
* @return bool|mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getOAuthCredentials($authorization_code, $redirect_uri){
|
||||
$this->client_secret = SDK::getAccessToken();
|
||||
$this->grant_type = 'authorization_code';
|
||||
$this->code = $authorization_code;
|
||||
$this->redirect_uri = $redirect_uri;
|
||||
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* refreshOAuthCredentials
|
||||
* @param $refresh_token
|
||||
* @return bool|mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function refreshOAuthCredentials($refresh_token){
|
||||
$this->client_secret = SDK::getAccessToken();
|
||||
$this->grant_type = 'refresh_token';
|
||||
$this->refresh_token = $refresh_token;
|
||||
|
||||
return $this->save();
|
||||
}
|
||||
}
|
||||
111
vendor/mercadopago/dx-php/src/MercadoPago/Entities/POS.php
vendored
Normal file
111
vendor/mercadopago/dx-php/src/MercadoPago/Entities/POS.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
|
||||
/**
|
||||
* POS class
|
||||
* @link https://www.mercadopago.com/developers/en/reference/pos/_pos/post/ Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/pos/:id", method="read")
|
||||
* @RestMethod(resource="/pos", method="create")
|
||||
* @RestMethod(resource="/pos/:id", method="update")
|
||||
* @RestMethod(resource="/pos/:id", method="delete")
|
||||
* @RestMethod(resource="/pos", method="search")
|
||||
*/
|
||||
class POS extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* name
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* fixed_amount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $fixed_amount;
|
||||
|
||||
/**
|
||||
* category
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
/**
|
||||
* store_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $store_id;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $external_id;
|
||||
|
||||
/**
|
||||
* qr
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $qr;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* date_last_updated
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_last_updated;
|
||||
|
||||
/**
|
||||
* uuid
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $uuid;
|
||||
|
||||
/**
|
||||
* compatible_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $compatible_id;
|
||||
|
||||
/**
|
||||
* user_id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $user_id;
|
||||
|
||||
}
|
||||
97
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Plan.php
vendored
Normal file
97
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Plan.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Plan class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Plan class
|
||||
* @RestMethod(resource="/v1/plans/:id", method="read")
|
||||
* @RestMethod(resource="/v1/plans/", method="create")
|
||||
* @RestMethod(resource="/v1/plans/:id", method="update")
|
||||
*/
|
||||
|
||||
class Plan extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* application_fee
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $application_fee;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* last_modified
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $last_modified;
|
||||
|
||||
/**
|
||||
* auto_recurring
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $auto_recurring;
|
||||
|
||||
/**
|
||||
* live_mode
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $live_mode;
|
||||
|
||||
/**
|
||||
* setup_fee
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $setup_fee;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
}
|
||||
150
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Preapproval.php
vendored
Normal file
150
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Preapproval.php
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* Preapproval class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* preapproval class
|
||||
* @RestMethod(resource="/preapproval/:id", method="read")
|
||||
* @RestMethod(resource="/preapproval/search", method="search")
|
||||
* @RestMethod(resource="/preapproval/", method="create")
|
||||
* @RestMethod(resource="/preapproval/:id", method="update")
|
||||
*/
|
||||
|
||||
class Preapproval extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* payer_id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $payer_id;
|
||||
|
||||
/**
|
||||
* payer_email
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $payer_email;
|
||||
|
||||
/**
|
||||
* back_url
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $back_url;
|
||||
|
||||
/**
|
||||
* collector_id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $collector_id;
|
||||
|
||||
/**
|
||||
* application_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $application_id;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* auto_recurring
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $auto_recurring;
|
||||
|
||||
/**
|
||||
* init_point
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $init_point;
|
||||
|
||||
/**
|
||||
* sandbox_init_point
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $sandbox_init_point;
|
||||
|
||||
/**
|
||||
* reason
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $reason;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* last_modified
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $last_modified;
|
||||
|
||||
/**
|
||||
* preapproval_plan_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $preapproval_plan_id;
|
||||
|
||||
/**
|
||||
* payment_method_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $payment_method_id;
|
||||
|
||||
/**
|
||||
* card_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $card_id;
|
||||
|
||||
/**
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $next_payment_date;
|
||||
|
||||
/**
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $summarized;
|
||||
}
|
||||
231
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Preference.php
vendored
Normal file
231
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Preference.php
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* This class will allow you to charge your customers through our web form from any device in a simple, fast and secure way.
|
||||
*
|
||||
* @link https://www.mercadopago.com/developers/en/guides/online-payments/checkout-pro/introduction Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/checkout/preferences", method="create")
|
||||
* @RestMethod(resource="/checkout/preferences/:id", method="read")
|
||||
* @RestMethod(resource="/checkout/preferences/search", method="search")
|
||||
* @RestMethod(resource="/checkout/preferences/:id", method="update")
|
||||
*/
|
||||
class Preference extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute(primaryKey = true, type = "string", readOnly = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* auto_return
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $auto_return;
|
||||
|
||||
/**
|
||||
* back_urls
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $back_urls;
|
||||
|
||||
/**
|
||||
* notification_url
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $notification_url;
|
||||
|
||||
/**
|
||||
* init_point
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $init_point;
|
||||
|
||||
/**
|
||||
* sandbox_init_point
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $sandbox_init_point;
|
||||
|
||||
/**
|
||||
* operation_type
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $operation_type;
|
||||
|
||||
/**
|
||||
* additional_info
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $additional_info;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* expires
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $expires;
|
||||
|
||||
/**
|
||||
* expiration_date_from
|
||||
* @Attribute(type = "date")
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $expiration_date_from;
|
||||
|
||||
/**
|
||||
* expiration_date_to
|
||||
* @Attribute(type = "date")
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $expiration_date_to;
|
||||
|
||||
/**
|
||||
* date_of_expiration
|
||||
* @Attribute(type = "date")
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_of_expiration;
|
||||
|
||||
|
||||
/**
|
||||
* collector_id
|
||||
* @Attribute(type = "int")
|
||||
* @var int
|
||||
*/
|
||||
protected $collector_id;
|
||||
|
||||
/**
|
||||
* client_id
|
||||
* @Attribute(type = "int")
|
||||
* @var int
|
||||
*/
|
||||
protected $client_id;
|
||||
|
||||
/**
|
||||
* marktplace
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $marketplace;
|
||||
|
||||
/**
|
||||
* marketplace_fee
|
||||
* @Attribute(type = "float")
|
||||
* @var float
|
||||
*/
|
||||
protected $marketplace_fee;
|
||||
|
||||
/**
|
||||
* differential_pricing
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $differential_pricing;
|
||||
|
||||
/**
|
||||
* payment_methods
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $payment_methods;
|
||||
|
||||
/**
|
||||
* items
|
||||
* @Attribute(type = "array", required = "true")
|
||||
* @var array
|
||||
*/
|
||||
protected $items;
|
||||
|
||||
/**
|
||||
* payer
|
||||
* @Attribute(type = "object")
|
||||
* @var object
|
||||
*/
|
||||
protected $payer;
|
||||
|
||||
/**
|
||||
* shipments
|
||||
* @Attribute(type = "object")
|
||||
* @var object
|
||||
*/
|
||||
protected $shipments;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute(type = "date")
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* sponsor_id
|
||||
* @Attribute(type = "integer")
|
||||
* @var int
|
||||
*/
|
||||
protected $sponsor_id;
|
||||
|
||||
/**
|
||||
* processing_modes
|
||||
* @Attribute(type = "array")
|
||||
* @var array
|
||||
*/
|
||||
protected $processing_modes;
|
||||
|
||||
/**
|
||||
* binary_mode
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $binary_mode;
|
||||
|
||||
/**
|
||||
* taxes
|
||||
* @Attribute(type = "array")
|
||||
* @var array
|
||||
*/
|
||||
protected $taxes;
|
||||
|
||||
/**
|
||||
* statement_descriptor
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $statement_descriptor;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* tracks
|
||||
* @Attribute(type = "array")
|
||||
* @var array
|
||||
*/
|
||||
protected $tracks;
|
||||
|
||||
}
|
||||
60
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Refund.php
vendored
Normal file
60
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Refund.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Refund class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* refund class
|
||||
* @RestMethod(resource="/v1/payments/:payment_id/refunds", method="create")
|
||||
* @RestMethod(resource="/v1/payments/:payment_id/refunds/:id", method="read")
|
||||
*/
|
||||
class Refund extends Entity {
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* payment_id
|
||||
* @Attribute(serialize=false)
|
||||
* @var int
|
||||
*/
|
||||
protected $payment_id;
|
||||
|
||||
/**
|
||||
* amount
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* source
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute(readOnly=true)
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
}
|
||||
36
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Documentation.php
vendored
Normal file
36
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Documentation.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Documentation class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use MercadoPago\Annotation\DenyDynamicAttribute;
|
||||
|
||||
/**
|
||||
* Documentation class
|
||||
*/
|
||||
class Documentation extends Entity
|
||||
{
|
||||
/**
|
||||
* type
|
||||
* @Attribute(type = "string", readOnly = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* url
|
||||
* @Attribute(type = "string", readOnly = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @Attribute(type = "string", readOnly = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
}
|
||||
71
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Item.php
vendored
Normal file
71
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Item.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Item class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use MercadoPago\Annotation\DenyDynamicAttribute;
|
||||
|
||||
/**
|
||||
* Item class
|
||||
*/
|
||||
class Item extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* title
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* category_id
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $category_id;
|
||||
|
||||
/**
|
||||
* picture_url
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $picture_url;
|
||||
|
||||
/**
|
||||
* currency_id
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $currency_id;
|
||||
|
||||
/**
|
||||
* quantity
|
||||
* @Attribute(type = "int")
|
||||
* @var int
|
||||
*/
|
||||
protected $quantity;
|
||||
|
||||
/**
|
||||
* unit_price
|
||||
* @Attribute(type = "float")
|
||||
* @var float
|
||||
*/
|
||||
protected $unit_price;
|
||||
|
||||
}
|
||||
99
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Payer.php
vendored
Normal file
99
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Payer.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Payer class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use MercadoPago\Annotation\DenyDynamicAttribute;
|
||||
|
||||
/**
|
||||
* Payer Class
|
||||
*/
|
||||
class Payer extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* entity_type
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $entity_type;
|
||||
|
||||
/**
|
||||
* type
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* name
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* surname
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $surname;
|
||||
|
||||
/**
|
||||
* first_name
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $first_name;
|
||||
|
||||
/**
|
||||
* last_name
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $last_name;
|
||||
|
||||
/**
|
||||
* email
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $email;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute(type = "date")
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* phone
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $phone;
|
||||
|
||||
/**
|
||||
* identification
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $identification;
|
||||
|
||||
/**
|
||||
* address
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
}
|
||||
644
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Payment.php
vendored
Normal file
644
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Payment.php
vendored
Normal file
@@ -0,0 +1,644 @@
|
||||
<?php
|
||||
/**
|
||||
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* This class provides the methods to access the API that will allow you to create your own payment experience on your website.
|
||||
*
|
||||
* From basic to advanced configurations, you control the whole experience.
|
||||
*
|
||||
* @link https://www.mercadopago.com/developers/en/guides/online-payments/checkout-api/introduction/ Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/v1/payments", method="create")
|
||||
* @RestMethod(resource="/v1/payments/:id", method="read")
|
||||
* @RestMethod(resource="/v1/payments/search", method="search")
|
||||
* @RestMethod(resource="/v1/payments/:id", method="update")
|
||||
* @RestMethod(resource="/v1/payments/:id/refunds", method="refund")
|
||||
*/
|
||||
class Payment extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* id
|
||||
* @var int
|
||||
* @Attribute(primaryKey = true)
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* acquirer
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $acquirer;
|
||||
|
||||
/**
|
||||
* acquirer_reconciliation
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $acquirer_reconciliation;
|
||||
|
||||
/**
|
||||
* site_id
|
||||
* @var string
|
||||
* @Attribute(idempotency = true)
|
||||
*/
|
||||
protected $site_id;
|
||||
|
||||
/**
|
||||
* sponsor_id
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $sponsor_id;
|
||||
|
||||
/**
|
||||
* operation_type
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $operation_type;
|
||||
|
||||
/**
|
||||
* order_id
|
||||
* @var int
|
||||
* @Attribute(idempotency = true)
|
||||
*/
|
||||
protected $order_id;
|
||||
|
||||
/**
|
||||
* order
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $order;
|
||||
|
||||
/**
|
||||
* binary_mode
|
||||
* @var boolean
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $binary_mode;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* status_detail
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $status_detail;
|
||||
|
||||
/**
|
||||
* store_id
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $store_id;
|
||||
|
||||
/**
|
||||
* taxes_amount
|
||||
* @var float
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $taxes_amount;
|
||||
|
||||
/**
|
||||
* payment_type
|
||||
* @var string
|
||||
* @Attribute(type = "string")
|
||||
*/
|
||||
protected $payment_type;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @var \DateTime
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* last_modified
|
||||
* @var \DateTime
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $last_modified;
|
||||
|
||||
/**
|
||||
* live_mode
|
||||
* @var boolean
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $live_mode;
|
||||
|
||||
/**
|
||||
* date_last_update
|
||||
* @var \DateTime
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $date_last_updated;
|
||||
|
||||
/**
|
||||
* date_of_expiration
|
||||
* @var \DateTime
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $date_of_expiration;
|
||||
|
||||
/**
|
||||
* deduction_schema
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $deduction_schema;
|
||||
|
||||
/**
|
||||
* date_approved
|
||||
* @var \DateTime
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $date_approved;
|
||||
|
||||
/**
|
||||
* money_release_date
|
||||
* @var \DateTime
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $money_release_date;
|
||||
|
||||
/**
|
||||
* money_release_days
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $money_release_days;
|
||||
|
||||
/**
|
||||
* money_release_schema
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $money_release_schema;
|
||||
|
||||
/**
|
||||
* money_release_status
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $money_release_status;
|
||||
|
||||
/**
|
||||
* currency_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $currency_id;
|
||||
|
||||
/**
|
||||
* transaction_amount
|
||||
* @var float
|
||||
* @Attribute(type = "float")
|
||||
*/
|
||||
protected $transaction_amount;
|
||||
|
||||
/**
|
||||
* transaction_amount_refunded
|
||||
* @var float
|
||||
* @Attribute(type = "float")
|
||||
*/
|
||||
protected $transaction_amount_refunded;
|
||||
|
||||
/**
|
||||
* shipping_cost
|
||||
* @var float
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $shipping_cost;
|
||||
|
||||
/**
|
||||
* total_paid_amount
|
||||
* @var float
|
||||
* @Attribute(idempotency = true)
|
||||
*/
|
||||
protected $total_paid_amount;
|
||||
|
||||
/**
|
||||
* finance_charge
|
||||
* @var float
|
||||
* @Attribute(type = "float")
|
||||
*/
|
||||
protected $finance_charge;
|
||||
|
||||
/**
|
||||
* net_received_amount
|
||||
* @var float
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $net_received_amount;
|
||||
|
||||
/**
|
||||
* marketplace
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $marketplace;
|
||||
|
||||
/**
|
||||
* marketplace_fee
|
||||
* @var float
|
||||
* @Attribute(type = "float")
|
||||
*/
|
||||
protected $marketplace_fee;
|
||||
|
||||
/**
|
||||
* reason
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $reason;
|
||||
|
||||
/**
|
||||
* payer
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $payer;
|
||||
|
||||
/**
|
||||
* collector
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $collector;
|
||||
|
||||
/**
|
||||
* collector_id
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $collector_id;
|
||||
|
||||
/**
|
||||
* counter_currency
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $counter_currency;
|
||||
|
||||
/**
|
||||
* payment_method_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $payment_method_id;
|
||||
|
||||
/**
|
||||
* payment_type_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $payment_type_id;
|
||||
|
||||
/**
|
||||
* pos_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $pos_id;
|
||||
|
||||
/**
|
||||
* transaction_details
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $transaction_details;
|
||||
|
||||
/**
|
||||
* fee_details
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $fee_details;
|
||||
|
||||
/**
|
||||
* differential_pricing_id
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $differential_pricing_id;
|
||||
|
||||
/**
|
||||
* application_fee
|
||||
* @var float
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $application_fee;
|
||||
|
||||
/**
|
||||
* authorization_code
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $authorization_code;
|
||||
|
||||
/**
|
||||
* capture
|
||||
* @var boolean
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $capture;
|
||||
|
||||
/**
|
||||
* captured
|
||||
* @var boolean
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $captured;
|
||||
|
||||
/**
|
||||
* card
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $card;
|
||||
|
||||
/**
|
||||
* call_for_authorize_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $call_for_authorize_id;
|
||||
|
||||
/**
|
||||
* statement_descriptor
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $statement_descriptor;
|
||||
|
||||
/**
|
||||
* refunds
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $refunds;
|
||||
|
||||
/**
|
||||
* Shipping_amount
|
||||
* @var float
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $shipping_amount;
|
||||
|
||||
/**
|
||||
* additional_info
|
||||
* @var array
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $additional_info;
|
||||
|
||||
/**
|
||||
* campaign_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $campaign_id;
|
||||
|
||||
/**
|
||||
* coupon_amount
|
||||
* @var float
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $coupon_amount;
|
||||
|
||||
/**
|
||||
* installments
|
||||
* @var int
|
||||
* @Attribute(type = "int")
|
||||
*/
|
||||
protected $installments;
|
||||
|
||||
/**
|
||||
* token
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $token;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* notification_url
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $notification_url;
|
||||
|
||||
/**
|
||||
* issuer_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $issuer_id;
|
||||
|
||||
/**
|
||||
* processing_mode
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $processing_mode;
|
||||
|
||||
/**
|
||||
* merchant_account_id
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $merchant_account_id;
|
||||
|
||||
/**
|
||||
* merchant_number
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $merchant_number;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* callback_url
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $callback_url;
|
||||
|
||||
/**
|
||||
* amount_refunded
|
||||
* @var float
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $amount_refunded;
|
||||
|
||||
/**
|
||||
* coupon_code
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $coupon_code;
|
||||
|
||||
/**
|
||||
* barcode
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $barcode;
|
||||
|
||||
/**
|
||||
* marketplace_owner
|
||||
* @var int
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $marketplace_owner;
|
||||
|
||||
/**
|
||||
* integrator_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $integrator_id;
|
||||
|
||||
/**
|
||||
* corporation_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $corporation_id;
|
||||
|
||||
/**
|
||||
* platform_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $platform_id;
|
||||
|
||||
/**
|
||||
* charges details
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $charges_details;
|
||||
|
||||
/**
|
||||
* taxes
|
||||
* @Attribute(type = "array")
|
||||
* @var array
|
||||
*/
|
||||
protected $taxes;
|
||||
|
||||
/**
|
||||
* net_amount
|
||||
* @var float
|
||||
* @Attribute(type = "float")
|
||||
*/
|
||||
protected $net_amount;
|
||||
|
||||
/**
|
||||
* payer
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $point_of_interaction;
|
||||
|
||||
/**
|
||||
* payment_method_option_id
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $payment_method_option_id;
|
||||
|
||||
/**
|
||||
* merchant_services
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $merchant_services;
|
||||
|
||||
/**
|
||||
* build_version
|
||||
* @var string
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $build_version;
|
||||
|
||||
/**
|
||||
* payment_method
|
||||
* @var object
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $payment_method;
|
||||
|
||||
/**
|
||||
* refund
|
||||
* @param int $amount
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function refund($amount = 0){
|
||||
$refund = new Refund(["payment_id" => $this->id]);
|
||||
if ($amount > 0){
|
||||
$refund->amount = $amount;
|
||||
}
|
||||
|
||||
if ($refund->save()){
|
||||
$payment = self::get($this->id);
|
||||
$this->_fillFromArray($this, $payment->toArray());
|
||||
return true;
|
||||
}else{
|
||||
$this->error = $refund->error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* capture
|
||||
* @param int $amount
|
||||
* @return Payment
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function capture($amount = 0)
|
||||
{
|
||||
$this->capture = true;
|
||||
if ($amount > 0){
|
||||
$this->transaction_amount = $amount;
|
||||
}
|
||||
|
||||
return $this->update();
|
||||
}
|
||||
}
|
||||
114
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/PaymentMethod.php
vendored
Normal file
114
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/PaymentMethod.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Payment Method class
|
||||
* @link https://www.mercadopago.com/developers/en/reference/payment_methods/_payment_methods/get/ Click here for more infos
|
||||
*
|
||||
* @RestMethod(resource="/v1/payment_methods", method="list")
|
||||
*/
|
||||
|
||||
class PaymentMethod extends Entity
|
||||
{
|
||||
/**
|
||||
* id
|
||||
* @Attribute(primaryKey = true)
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* name
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* payment_type_id
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $payment_type_id;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* secure_thumbnail
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $secure_thumbnail;
|
||||
|
||||
/**
|
||||
* thumbnail
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $thumbnail;
|
||||
|
||||
/**
|
||||
* deferred_capture
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $deferred_capture;
|
||||
|
||||
/**
|
||||
* settings
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* additional_info_needed
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $additional_info_needed;
|
||||
|
||||
/**
|
||||
* min_allowed_amount
|
||||
* @Attribute(type = "float")
|
||||
* @var float
|
||||
*/
|
||||
protected $min_allowed_amount;
|
||||
|
||||
/**
|
||||
* max_allowed_amount
|
||||
* @Attribute(type = "float")
|
||||
* @var float
|
||||
*/
|
||||
protected $max_allowed_amount;
|
||||
|
||||
/**
|
||||
* accreditation_time
|
||||
* @Attribute(type = "integer")
|
||||
* @var int
|
||||
*/
|
||||
protected $accreditation_time;
|
||||
|
||||
/**
|
||||
* financial_institutions
|
||||
* @Attribute(type = "")
|
||||
* @var object
|
||||
*/
|
||||
protected $financial_institutions;
|
||||
|
||||
/**
|
||||
* processing_modes
|
||||
* @Attribute(type = "")
|
||||
* @var array
|
||||
*/
|
||||
protected $processing_modes;
|
||||
}
|
||||
27
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Tax.php
vendored
Normal file
27
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Tax.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Tax class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Tax class
|
||||
*/
|
||||
class Tax extends Entity
|
||||
{
|
||||
/**
|
||||
* type
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* value
|
||||
* @Attribute(type = "float")
|
||||
* @var float
|
||||
*/
|
||||
protected $value;
|
||||
}
|
||||
27
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Track.php
vendored
Normal file
27
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/Track.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Track class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Track class
|
||||
*/
|
||||
class Track extends Entity
|
||||
{
|
||||
/**
|
||||
* type
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* value
|
||||
* @Attribute(type = "object")
|
||||
* @var object
|
||||
*/
|
||||
protected $value;
|
||||
}
|
||||
34
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/TrackValues.php
vendored
Normal file
34
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shared/TrackValues.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Track Values class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Track Values class
|
||||
*/
|
||||
class TrackValues extends Entity
|
||||
{
|
||||
/**
|
||||
* conversion_id
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $conversion_id;
|
||||
|
||||
/**
|
||||
* conversion_label
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $conversion_label;
|
||||
|
||||
/**
|
||||
* pixel_id
|
||||
* @Attribute(type = "string")
|
||||
* @var string
|
||||
*/
|
||||
protected $pixel_id;
|
||||
}
|
||||
76
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shipments.php
vendored
Normal file
76
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Shipments.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Shipments class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use phpDocumentor\Descriptor\Type\FloatDescriptor;
|
||||
|
||||
/**
|
||||
* Shipments class
|
||||
* @RestMethod(resource="/v1/payments/:payment_id/refunds", method="create")
|
||||
* @RestMethod(resource="/v1/payments/:payment_id/refunds/:id", method="read")
|
||||
* @deprecated This class is deprecated
|
||||
*/
|
||||
class Shipments extends Entity {
|
||||
|
||||
/**
|
||||
* mode
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $mode;
|
||||
|
||||
/**
|
||||
* local_pickup
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $local_pickup;
|
||||
|
||||
/**
|
||||
*free_methods
|
||||
* @Attribute()
|
||||
* @var array
|
||||
*/
|
||||
protected $free_methods;
|
||||
|
||||
/**
|
||||
* cost
|
||||
* @Attribute()
|
||||
* @var Float
|
||||
*/
|
||||
protected $cost;
|
||||
|
||||
/**
|
||||
* free_shipping
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $free_shipping;
|
||||
|
||||
/**
|
||||
* receiver_address
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $receiver_address;
|
||||
|
||||
/**
|
||||
* dimensions
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $dimensions;
|
||||
|
||||
/**
|
||||
* default_shipping_method
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $default_shipping_method;
|
||||
|
||||
}
|
||||
126
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Subscription.php
vendored
Normal file
126
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Subscription.php
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* Subscription class file
|
||||
*/
|
||||
namespace MercadoPago;
|
||||
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
|
||||
/**
|
||||
* Subscription class
|
||||
* @RestMethod(resource="/v1/subscriptions/:id", method="read")
|
||||
* @RestMethod(resource="/v1/subscriptions/", method="create")
|
||||
* @RestMethod(resource="/v1/subscriptions/:id", method="update")
|
||||
*/
|
||||
|
||||
class Subscription extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* plan_id
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $plan_id;
|
||||
|
||||
/**
|
||||
* payer
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $payer;
|
||||
|
||||
/**
|
||||
* application_fee
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $application_fee;
|
||||
|
||||
/**
|
||||
* status
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* description
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* external_reference
|
||||
* @Attribute()
|
||||
* @var string
|
||||
*/
|
||||
protected $external_reference;
|
||||
|
||||
/**
|
||||
* date_created
|
||||
* @Attribute()
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_created;
|
||||
|
||||
/**
|
||||
* last_modified
|
||||
* @Attribute()
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $last_modified;
|
||||
|
||||
/**
|
||||
* live_mode
|
||||
* @Attribute()
|
||||
* @var boolean
|
||||
*/
|
||||
protected $live_mode;
|
||||
|
||||
/**
|
||||
* start_date
|
||||
* @Attribute()
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $start_date;
|
||||
|
||||
/**
|
||||
* end_date
|
||||
* @Attribute()
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $end_date;
|
||||
|
||||
/**
|
||||
* metadata
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* charge_detail
|
||||
* @Attribute()
|
||||
* @var object
|
||||
*/
|
||||
protected $charges_detail;
|
||||
|
||||
/**
|
||||
* setup_fee
|
||||
* @Attribute()
|
||||
* @var float
|
||||
*/
|
||||
protected $setup_fee;
|
||||
|
||||
}
|
||||
528
vendor/mercadopago/dx-php/src/MercadoPago/Entity.php
vendored
Normal file
528
vendor/mercadopago/dx-php/src/MercadoPago/Entity.php
vendored
Normal file
@@ -0,0 +1,528 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
use Exception;
|
||||
/**
|
||||
* Class Entity
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class Entity
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
|
||||
protected static $_custom_headers = array();
|
||||
protected static $_manager;
|
||||
/**
|
||||
* @Attribute(serialize = false)
|
||||
*/
|
||||
protected $_last;
|
||||
protected $error;
|
||||
protected $_pagination_params;
|
||||
/**
|
||||
* @Attribute(serialize = false)
|
||||
*/
|
||||
protected $_empty = false;
|
||||
/**
|
||||
* Entity constructor.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($params = [])
|
||||
{
|
||||
if (empty(self::$_manager)) {
|
||||
throw new \Exception('Please initialize SDK first');
|
||||
}
|
||||
self::$_manager->setEntityMetaData($this);
|
||||
$this->_fillFromArray($this, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function Error()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
/**
|
||||
* @param Manager $manager
|
||||
*/
|
||||
public static function setManager(Manager $manager)
|
||||
{
|
||||
self::$_manager = $manager;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
public static function unSetManager()
|
||||
{
|
||||
self::$_manager = null;
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($id)
|
||||
{
|
||||
return self::read(array("id" => $id));
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function find_by_id($id)
|
||||
{
|
||||
return self::read(array("id" => $id));
|
||||
}
|
||||
public static function setCustomHeader($key, $value)
|
||||
{
|
||||
self::$_custom_headers[$key] = $value;
|
||||
}
|
||||
public static function getCustomHeader($key)
|
||||
{
|
||||
return self::$_custom_headers[$key];
|
||||
}
|
||||
public static function setCustomHeadersFromArray($array){
|
||||
foreach ($array as $key => $value){
|
||||
self::setCustomHeader($key, $value);
|
||||
}
|
||||
}
|
||||
public static function getCustomHeaders()
|
||||
{
|
||||
return self::$_custom_headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function not_found()
|
||||
{
|
||||
return $this->_empty;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function read($params = [], $options = [])
|
||||
{
|
||||
|
||||
$class = get_called_class();
|
||||
$entity = new $class();
|
||||
|
||||
self::$_manager->setEntityUrl($entity, 'read', $params);
|
||||
self::$_manager->cleanEntityDeltaQueryJsonData($entity);
|
||||
|
||||
$response = self::$_manager->execute($entity, 'get', $options);
|
||||
|
||||
if ($response['code'] == "200" || $response['code'] == "201") {
|
||||
$entity->_fillFromArray($entity, $response['body']);
|
||||
$entity->_last = clone $entity;
|
||||
return $entity;
|
||||
} elseif (intval($response['code']) == 404) {
|
||||
return null;
|
||||
} elseif (intval($response['code']) >= 400 && intval($response['code']) < 500) {
|
||||
throw new Exception ($response['body']['message']);
|
||||
} else {
|
||||
throw new Exception ("Internal API Error");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function all($params = [], $options = [])
|
||||
{
|
||||
$class = get_called_class();
|
||||
$entity = new $class();
|
||||
$entities = array();
|
||||
|
||||
self::$_manager->setEntityUrl($entity, 'list', $params);
|
||||
self::$_manager->cleanQueryParams($entity);
|
||||
$response = self::$_manager->execute($entity, 'get');
|
||||
|
||||
if ($response['code'] == "200" || $response['code'] == "201") {
|
||||
$results = $response['body'];
|
||||
foreach ($results as $result) {
|
||||
$entity = new $class();
|
||||
$entity->_fillFromArray($entity, $result);
|
||||
array_push($entities, $entity);
|
||||
}
|
||||
} elseif (intval($response['code']) >= 400 && intval($response['code']) < 500) {
|
||||
throw new Exception ($response['error'] . " " . $response['message']);
|
||||
} else {
|
||||
throw new Exception ("Internal API Error");
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function search($filters = [], $options = [])
|
||||
{
|
||||
$class = get_called_class();
|
||||
$searchResult = new SearchResultsArray();
|
||||
$searchResult->setEntityTypes($class);
|
||||
$entityToQuery = new $class();
|
||||
|
||||
self::$_manager->setEntityUrl($entityToQuery, 'search');
|
||||
self::$_manager->cleanQueryParams($entityToQuery);
|
||||
self::$_manager->setQueryParams($entityToQuery, $filters);
|
||||
|
||||
$response = self::$_manager->execute($entityToQuery, 'get');
|
||||
if ($response['code'] == "200" || $response['code'] == "201") {
|
||||
$searchResult->fetch($filters, $response['body']);
|
||||
} elseif (intval($response['code']) >= 400 && intval($response['code']) < 500) {
|
||||
$searchResult->process_error_body($response['body']);
|
||||
throw new Exception($response['body']['message']);
|
||||
} else {
|
||||
throw new Exception("Internal API Error");
|
||||
}
|
||||
return $searchResult;
|
||||
}
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return mixed
|
||||
*/
|
||||
public function APCIteratorAll()
|
||||
{
|
||||
self::$_manager->setEntityUrl($this, 'list');
|
||||
return self::$_manager->execute($this, 'get');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function update($options = [])
|
||||
{
|
||||
$params = [];
|
||||
self::$_manager->setEntityUrl($this, 'update', $params);
|
||||
self::$_manager->setEntityDeltaQueryJsonData($this);
|
||||
|
||||
$response = self::$_manager->execute($this, 'put');
|
||||
|
||||
if ($response['code'] == "200" || $response['code'] == "201") {
|
||||
|
||||
$this->_fillFromArray($this, $response['body']);
|
||||
return true;
|
||||
} elseif (intval($response['code']) >= 400 && intval($response['code']) < 500) {
|
||||
// A recuperable error
|
||||
$this->process_error_body($response['body']);
|
||||
return false;
|
||||
} else {
|
||||
throw new Exception ("Internal API Error");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return mixed
|
||||
*/
|
||||
public static function destroy()
|
||||
{
|
||||
//return self::$_manager->execute(get_called_class(), '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function custom_action($method, $action)
|
||||
{
|
||||
self::$_manager->setEntityUrl($this, $action);
|
||||
self::$_manager->setEntityQueryJsonData($this);
|
||||
$response = self::$_manager->execute($this, $method);
|
||||
if ($response['code'] == "200" || $response['code'] == "201") {
|
||||
$this->_fillFromArray($this, $response['body']);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function save($options = [])
|
||||
{
|
||||
self::$_manager->setEntityUrl($this, 'create');
|
||||
self::$_manager->setEntityQueryJsonData($this);
|
||||
|
||||
$response = self::$_manager->execute($this, 'post', $options);
|
||||
|
||||
if ($response['code'] == "200" || $response['code'] == "201") {
|
||||
$this->_fillFromArray($this, $response['body']);
|
||||
$this->_last = clone $this;
|
||||
return true;
|
||||
} elseif (intval($response['code']) >= 300 && intval($response['code']) < 500) {
|
||||
// A recuperable error
|
||||
$this->process_error_body($response['body']);
|
||||
return false;
|
||||
} else {
|
||||
// Trigger an exception
|
||||
throw new Exception ("Internal API Error");
|
||||
}
|
||||
}
|
||||
|
||||
function process_error_body($message){
|
||||
$recuperable_error = new RecuperableError(
|
||||
$message['message'],
|
||||
(isset($message['error']) ? $message['error'] : ''),
|
||||
$message['status']
|
||||
);
|
||||
if (isset($message['cause'])) {
|
||||
$recuperable_error->proccess_causes($message['cause']);
|
||||
}
|
||||
$this->error = $recuperable_error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
return $this->{$name};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
return isset($this->{$name});
|
||||
}
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
$this->_setValue($name, $value);
|
||||
return $this->{$name};
|
||||
}
|
||||
/**
|
||||
* @param null $attributes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes() {
|
||||
return get_object_vars($this);
|
||||
}
|
||||
/**
|
||||
* @param null $attributes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($attributes = null)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
$excluded_attributes = self::$_manager->getExcludedAttributes($this);
|
||||
|
||||
if (is_null($attributes)) {
|
||||
$result = get_object_vars($this);
|
||||
} else {
|
||||
$result = array_intersect_key(get_object_vars($this), $attributes);
|
||||
}
|
||||
|
||||
foreach ($excluded_attributes as $excluded_attribute) {
|
||||
unset($result[$excluded_attribute]);
|
||||
}
|
||||
|
||||
foreach ($result as $key => $value) {
|
||||
if (!is_bool($value) && empty($value)) {
|
||||
unset($result[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
/**
|
||||
* @param $property
|
||||
* @param $value
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function _setValue($property, $value, $validate = true)
|
||||
{
|
||||
if ($this->_propertyExists($property)) {
|
||||
if ($validate) {
|
||||
self::$_manager->validateAttribute($this, $property, ['maxLength','readOnly'], $value);
|
||||
}
|
||||
if ($this->_propertyTypeAllowed($property, $value)) {
|
||||
$this->{$property} = $value;
|
||||
} else {
|
||||
$this->{$property} = $this->tryFormat($value, $this->_getPropertyType($property), $property);
|
||||
}
|
||||
} else {
|
||||
if ($this->_getDynamicAttributeDenied()) {
|
||||
throw new \Exception('Dynamic attribute: ' . $property . ' not allowed for entity ' . get_class($this));
|
||||
}
|
||||
$this->{$property} = $value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param $property
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _propertyExists($property)
|
||||
{
|
||||
return array_key_exists($property, get_object_vars($this));
|
||||
}
|
||||
/**
|
||||
* @param $property
|
||||
* @param $type
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _propertyTypeAllowed($property, $type)
|
||||
{
|
||||
$definedType = $this->_getPropertyType($property);
|
||||
if (!$definedType) {
|
||||
return true;
|
||||
}
|
||||
if (is_object($type) && class_exists($definedType, false)) {
|
||||
return ($type instanceof $definedType);
|
||||
}
|
||||
return gettype($type) == $definedType;
|
||||
}
|
||||
/**
|
||||
* @param $property
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _getPropertyType($property)
|
||||
{
|
||||
return self::$_manager->getPropertyType(get_called_class(), $property);
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _getDynamicAttributeDenied()
|
||||
{
|
||||
return self::$_manager->getDynamicAttributeDenied(get_called_class());
|
||||
}
|
||||
/**
|
||||
* @param $value
|
||||
* @param $type
|
||||
* @param $property
|
||||
*
|
||||
* @return array|bool|float|int|string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function tryFormat($value, $type, $property)
|
||||
{
|
||||
try {
|
||||
switch ($type) {
|
||||
case 'float':
|
||||
if (!is_numeric($value)) {
|
||||
break;
|
||||
}
|
||||
return (float)$value;
|
||||
case 'int':
|
||||
if (!is_numeric($value)) {
|
||||
break;
|
||||
}
|
||||
return (int)$value;
|
||||
case 'string':
|
||||
return (string)$value;
|
||||
case 'array':
|
||||
return (array)$value;
|
||||
case 'date':
|
||||
if (empty($value)) {
|
||||
return $value;
|
||||
};
|
||||
if (is_string($value)) {
|
||||
return date("Y-m-d\TH:i:s.000P", strtotime($value));
|
||||
} else {
|
||||
return $value->format('Y-m-d\TH:i:s.000P');
|
||||
}
|
||||
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception('Wrong type ' . gettype($value) . '. Cannot convert ' . $type . ' for property ' . $property);
|
||||
}
|
||||
throw new \Exception('Wrong type ' . gettype($value) . '. It should be ' . $type . ' for property ' . $property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill entity from data with nested object creation
|
||||
*
|
||||
* @param $entity
|
||||
* @param $data
|
||||
*/
|
||||
public function fillFromArray($entity, $data) {
|
||||
$this->_fillFromArray($entity, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill entity from data with nested object creation
|
||||
*
|
||||
* @param $entity
|
||||
* @param $data
|
||||
*/
|
||||
protected function _fillFromArray($entity, $data)
|
||||
{
|
||||
|
||||
if ($data) {
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (!is_null($value)){
|
||||
if (is_array($value)) {
|
||||
$className = 'MercadoPago\\' . $this->_camelize($key);
|
||||
if (class_exists($className, true)) {
|
||||
$entity->_setValue($key, new $className, false);
|
||||
$entity->_fillFromArray($this->{$key}, $value);
|
||||
} else {
|
||||
$entity->_setValue($key, json_decode(json_encode($value)), false);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$entity->_setValue($key, $value, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param $input
|
||||
* @param string $separator
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _camelize($input, $separator = '_')
|
||||
{
|
||||
return str_replace($separator, '', ucwords($input, $separator));
|
||||
}
|
||||
|
||||
|
||||
public function delete($options = [])
|
||||
{
|
||||
$params = [];
|
||||
self::$_manager->setEntityUrl($this, 'delete', $params);
|
||||
|
||||
$response = self::$_manager->execute($this, 'delete');
|
||||
|
||||
if ($response['code'] == "200" || $response['code'] == "201") {
|
||||
$this->_fillFromArray($this, $response['body']);
|
||||
return true;
|
||||
} elseif (intval($response['code']) >= 400 && intval($response['code']) < 500) {
|
||||
if (!is_null($response['body'])){
|
||||
$this->process_error_body($response['body']);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
throw new Exception ("Internal API Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
vendor/mercadopago/dx-php/src/MercadoPago/Generic/ErrorCause.php
vendored
Normal file
12
vendor/mercadopago/dx-php/src/MercadoPago/Generic/ErrorCause.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MercadoPago;
|
||||
|
||||
class ErrorCause {
|
||||
|
||||
public $code = "";
|
||||
public $description = "";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
56
vendor/mercadopago/dx-php/src/MercadoPago/Generic/RecuperableError.php
vendored
Normal file
56
vendor/mercadopago/dx-php/src/MercadoPago/Generic/RecuperableError.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace MercadoPago;
|
||||
|
||||
class RecuperableError {
|
||||
|
||||
public $message = "";
|
||||
public $status = "";
|
||||
public $error = "";
|
||||
|
||||
public $causes = [];
|
||||
|
||||
function __construct($message, $error, $status) {
|
||||
$this->message = $message;
|
||||
$this->status = $status;
|
||||
$this->error = $error;
|
||||
}
|
||||
|
||||
public function add_cause($code, $description) {
|
||||
$error_cause = new ErrorCause();
|
||||
$error_cause->code = $code;
|
||||
$error_cause->description = $description;
|
||||
array_push($this->causes, $error_cause);
|
||||
}
|
||||
|
||||
public function proccess_causes($causes){
|
||||
if(isset($causes['code']) && isset($causes['description'])){
|
||||
$this->add_cause($causes['code'], $causes['description']);
|
||||
}else{
|
||||
foreach ($causes as $cause){
|
||||
if(is_array($cause) && (!isset($cause['code']) && !isset($cause['description']))){
|
||||
$this->proccess_causes($cause);
|
||||
}else{
|
||||
$code = isset($cause['code']) ? $cause['code'] : "";
|
||||
$description = $cause;
|
||||
if (is_array($cause)) {
|
||||
if (isset($cause['description'])) {
|
||||
$description = $cause['description'];
|
||||
} elseif (isset($cause['message'])) {
|
||||
$description = $cause['message'];
|
||||
}
|
||||
}
|
||||
$this->add_cause($code, $description);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->error . ": " . $this->message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
95
vendor/mercadopago/dx-php/src/MercadoPago/Generic/SearchResultsArray.php
vendored
Normal file
95
vendor/mercadopago/dx-php/src/MercadoPago/Generic/SearchResultsArray.php
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use ArrayObject;
|
||||
|
||||
class SearchResultsArray extends ArrayObject {
|
||||
|
||||
public $_filters;
|
||||
public $limit;
|
||||
public $total;
|
||||
public $offset;
|
||||
public $errors;
|
||||
public $_class;
|
||||
|
||||
|
||||
public function setEntityTypes($class){
|
||||
$this->_class = $class;
|
||||
}
|
||||
|
||||
public function setPaginateParams($params){
|
||||
$this->limit = $params["limit"];
|
||||
$this->total = $params["total"];
|
||||
$this->offset = $params["offset"];
|
||||
}
|
||||
|
||||
public function next() {
|
||||
$new_offset = $this->limit + $this->offset;
|
||||
$this->_filters['offset'] = $new_offset;
|
||||
$result = $this->_class::search($this->_filters);
|
||||
|
||||
$this->limit = $result->limit;
|
||||
$this->offset = $result->offset;
|
||||
$this->total = $result->total;
|
||||
|
||||
$this->exchangeArray($result->getArrayCopy());
|
||||
}
|
||||
|
||||
public function fetch($filters, $body) {
|
||||
$this->_filters = $filters;
|
||||
|
||||
if ($body) {
|
||||
$results = [];
|
||||
if (array_key_exists("results", $body)) {
|
||||
$results = $body["results"];
|
||||
} else if (array_key_exists("elements", $body)) {
|
||||
$results = $body["elements"];
|
||||
}
|
||||
|
||||
foreach ($results as $result) {
|
||||
$entity = new $this->_class();
|
||||
$entity->fillFromArray($entity, $result);
|
||||
$this->append($entity);
|
||||
}
|
||||
|
||||
$this->fetchPaging($filters, $body);
|
||||
}
|
||||
}
|
||||
|
||||
public function process_error_body($message){
|
||||
|
||||
$recuperable_error = new RecuperableError(
|
||||
$message['message'],
|
||||
$message['error'],
|
||||
$message['status']
|
||||
);
|
||||
|
||||
foreach ($message['cause'] as $causes) {
|
||||
if(is_array($causes)) {
|
||||
foreach ($causes as $cause) {
|
||||
$recuperable_error->add_cause($cause['code'], $cause['description']);
|
||||
}
|
||||
} else {
|
||||
$recuperable_error->add_cause($cause['code'], $cause['description']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->errors = $recuperable_error;
|
||||
}
|
||||
|
||||
private function fetchPaging($filters, $body) {
|
||||
if (array_key_exists("paging", $body)) {
|
||||
$paging = $body["paging"];
|
||||
$this->limit = $paging["limit"];
|
||||
$this->total = $paging["total"];
|
||||
$this->offset = $paging["offset"];
|
||||
} else {
|
||||
$this->offset = array_key_exists("offset", $filters) ? $filters["offset"] : 0;
|
||||
$this->limit = array_key_exists("limit", $filters) ? $filters["limit"] : 20;
|
||||
$this->total = array_key_exists("total", $body) ? $body["total"] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
81
vendor/mercadopago/dx-php/src/MercadoPago/Http/CurlRequest.php
vendored
Normal file
81
vendor/mercadopago/dx-php/src/MercadoPago/Http/CurlRequest.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace MercadoPago\Http;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* CurlRequest Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago\Http
|
||||
*/
|
||||
class CurlRequest
|
||||
implements HttpRequest
|
||||
{
|
||||
/**
|
||||
* @var null|resource
|
||||
*/
|
||||
private $handle = null;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* CurlRequest constructor.
|
||||
*
|
||||
* @param null $uri
|
||||
*/
|
||||
public function __construct($uri = null)
|
||||
{
|
||||
if (!extension_loaded("curl")) {
|
||||
throw new Exception("cURL extension not found. You need to enable cURL in your php.ini or another configuration you have.");
|
||||
}
|
||||
$this->handle = curl_init($uri);
|
||||
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @param $name
|
||||
* @param $value
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
curl_setopt($this->handle, $name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return curl_exec($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @param $name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo($name)
|
||||
{
|
||||
return curl_getinfo($this->handle, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
*@codeCoverageIgnore
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
curl_close($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return string
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
return curl_error($this->handle);
|
||||
}
|
||||
}
|
||||
39
vendor/mercadopago/dx-php/src/MercadoPago/Http/HttpRequest.php
vendored
Normal file
39
vendor/mercadopago/dx-php/src/MercadoPago/Http/HttpRequest.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace MercadoPago\Http;
|
||||
/**
|
||||
* Interface HttpRequest
|
||||
*
|
||||
* @package MercadoPago\Http
|
||||
*/
|
||||
interface HttpRequest
|
||||
{
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function setOption($name, $value);
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute();
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo($name);
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function close();
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function error();
|
||||
}
|
||||
451
vendor/mercadopago/dx-php/src/MercadoPago/Manager.php
vendored
Normal file
451
vendor/mercadopago/dx-php/src/MercadoPago/Manager.php
vendored
Normal file
@@ -0,0 +1,451 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
/**
|
||||
* Class Manager
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class Manager
|
||||
{
|
||||
/**
|
||||
* @var RestClient
|
||||
*/
|
||||
private $_client;
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
private $_config;
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private $_customTrackingParams=array();
|
||||
|
||||
private $_entityConfiguration;
|
||||
/**
|
||||
* @var MetaDataReader
|
||||
*/
|
||||
private $_metadataReader;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
static $CIPHER = 'sha256';
|
||||
/**
|
||||
* Manager constructor.
|
||||
*
|
||||
* @param RestClient $client
|
||||
* @param Config $config
|
||||
*/
|
||||
public function __construct(RestClient $client, Config $config)
|
||||
{
|
||||
$this->_client = $client;
|
||||
$this->_config = $config;
|
||||
$this->_metadataReader = new MetaDataReader();
|
||||
}
|
||||
protected function _getEntityConfiguration($entity)
|
||||
{
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
if (isset($this->_entityConfiguration[$className])) {
|
||||
return $this->_entityConfiguration[$className];
|
||||
}
|
||||
$this->_entityConfiguration[$className] = $this->_metadataReader->getMetaData($entity);
|
||||
return $this->_entityConfiguration[$className];
|
||||
}
|
||||
|
||||
protected function _updateEntityConfiguration($entity, $new_configuration)
|
||||
{
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
$this->_entityConfiguration[$className] = $new_configuration;
|
||||
}
|
||||
|
||||
public function addCustomTrackingParam($key, $value)
|
||||
{
|
||||
$this->_customTrackingParams[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
* @param string $method
|
||||
* @param null $parameters
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute($entity, $method = 'get', $options = [])
|
||||
{
|
||||
|
||||
$configuration = $this->_getEntityConfiguration($entity);
|
||||
|
||||
if ($method != 'get'){
|
||||
foreach ($configuration->attributes as $key => $attribute) {
|
||||
$this->validateAttribute($entity, $key, ['required']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->processOptions($options, $configuration);
|
||||
|
||||
$this->_setDefaultHeaders($configuration->query);
|
||||
$this->_setCustomHeaders($entity, $configuration->query);
|
||||
$this->_setIdempotencyHeader($configuration->query, $method);
|
||||
$this->setQueryParams($entity);
|
||||
|
||||
return $this->_client->{$method}($configuration->url, $configuration->query);
|
||||
}
|
||||
|
||||
public function processOptions($options, $configuration)
|
||||
{
|
||||
$configuration_vars = $this->_config->all();
|
||||
|
||||
foreach($options as $option => $value) {
|
||||
$configuration->query["url_query"][$option] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function validateAttribute($entity, $attribute, array $properties, $value = null)
|
||||
{
|
||||
$configuration = $this->_getEntityConfiguration($entity);
|
||||
foreach ($properties as $property) {
|
||||
if ($configuration->attributes[$attribute][$property]) {
|
||||
$result = $this->_isValidProperty($attribute, $property, $entity, $configuration->attributes[$attribute], $value);
|
||||
if (!$result) {
|
||||
throw new \Exception('Error ' . $property . ' in attribute ' . $attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function _isValidProperty($key, $property, $entity, $attribute, $value)
|
||||
{
|
||||
switch ($property) {
|
||||
case 'required':
|
||||
return ($entity->{$key} !== null);
|
||||
case 'maxLength':
|
||||
return (strlen($value) <= $attribute['maxLength']);
|
||||
case 'readOnly':
|
||||
return !$attribute['readOnly'];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
* @param $ormMethod
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setEntityUrl($entity, $ormMethod, $params = [])
|
||||
{
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
if (!isset($this->_entityConfiguration[$className]->methods[$ormMethod])) {
|
||||
throw new \Exception('ORM method ' . $ormMethod . ' not available for entity:' . $className);
|
||||
}
|
||||
|
||||
$url = $this->_entityConfiguration[$className]->methods[$ormMethod]['resource'];
|
||||
$matches = [];
|
||||
preg_match_all('/\\:\\w+/', $url, $matches);
|
||||
|
||||
$configuration_vars = $this->_config->all();
|
||||
|
||||
foreach ($matches[0] as $match) {
|
||||
$key = substr($match, 1);
|
||||
|
||||
if (array_key_exists($key, $params)) {
|
||||
$url = str_replace($match, $params[$key], $url);
|
||||
} elseif (array_key_exists(strtoupper($key), $configuration_vars)) {
|
||||
$url = str_replace($match, $configuration_vars[strtoupper($key)], $url);
|
||||
} elseif (!empty($entity->$key)) {
|
||||
$url = str_replace($match, $entity->$key, $url);
|
||||
} else {
|
||||
$url = str_replace($match, $entity->{$key} ?? '', $url);
|
||||
}
|
||||
}
|
||||
$this->_entityConfiguration[$className]->url = $url;
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function setEntityMetadata($entity)
|
||||
{
|
||||
return $this->_getEntityConfiguration($this->_getEntityClassName($entity));
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getEntityClassName($entity)
|
||||
{
|
||||
if (is_object($entity)) {
|
||||
$className = get_class($entity);
|
||||
} else {
|
||||
$className = $entity;
|
||||
}
|
||||
return $className;
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
*/
|
||||
public function getExcludedAttributes($entity){
|
||||
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
$configuration = $this->_getEntityConfiguration($entity);
|
||||
|
||||
$excluded_attributes = array();
|
||||
$attributes = $entity->getAttributes();
|
||||
|
||||
// if ($className == "MercadoPago\Refund") {
|
||||
// print_r($configuration->attributes);
|
||||
// }
|
||||
|
||||
foreach ($attributes as $key => $val) {
|
||||
|
||||
if (array_key_exists($key, $configuration->attributes)){
|
||||
$attribute_conf = $configuration->attributes[$key];
|
||||
|
||||
if ($attribute_conf['serialize'] == False) {
|
||||
// Do nothing
|
||||
array_push($excluded_attributes, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $excluded_attributes;
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
*/
|
||||
public function setEntityQueryJsonData($entity)
|
||||
{
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
$result = [];
|
||||
$this->_attributesToJson($entity, $result, $this->_entityConfiguration[$className]);
|
||||
$this->_entityConfiguration[$className]->query['json_data'] = json_encode($result);
|
||||
}
|
||||
|
||||
public function setRawQueryJsonData($entity, $data)
|
||||
{
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
$this->_entityConfiguration[$className]->query['json_data'] = json_encode($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
*/
|
||||
public function cleanEntityDeltaQueryJsonData($entity)
|
||||
{
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
$this->_entityConfiguration[$className]->query['json_data'] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
*/
|
||||
public function setEntityDeltaQueryJsonData($entity)
|
||||
{
|
||||
$className = $this->_getEntityClassName($entity);
|
||||
$result = [];
|
||||
|
||||
$last_attributes = $entity->_last->toArray();
|
||||
$new_attributes = $entity->toArray();
|
||||
|
||||
$result = $this->_arrayDiffRecursive($last_attributes, $new_attributes);
|
||||
|
||||
$this->_entityConfiguration[$className]->query['json_data'] = json_encode($result);
|
||||
}
|
||||
/**
|
||||
* @param $configuration
|
||||
*/
|
||||
public function cleanQueryParams($entity)
|
||||
{
|
||||
$configuration = $this->_getEntityConfiguration($entity);
|
||||
$configuration->query['url_query'] = null;
|
||||
}
|
||||
/**
|
||||
* @param $configuration
|
||||
*/
|
||||
public function setQueryParams($entity, $urlParams = [])
|
||||
{
|
||||
$configuration = $this->_getEntityConfiguration($entity);
|
||||
|
||||
if (!isset($configuration->query) || !isset($configuration->query['url_query'])) {
|
||||
$configuration->query['url_query'] = [];
|
||||
}
|
||||
|
||||
$params = [];
|
||||
if (isset($configuration->params)) {
|
||||
foreach ($configuration->params as $value) {
|
||||
$params[$value] = $this->_config->get(strtoupper($value));
|
||||
}
|
||||
}
|
||||
|
||||
$arrayMerge = array_merge($urlParams, $params, $configuration->query['url_query']);
|
||||
$configuration->query['url_query'] = $arrayMerge;
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
* @param $result
|
||||
* @param $configuration
|
||||
*/
|
||||
protected function _attributesToJson($entity, &$result)
|
||||
{
|
||||
if (is_array($entity)) {
|
||||
$attributes = array_filter($entity, function($entity) {
|
||||
return ($entity !== null && $entity !== false && $entity !== '');
|
||||
});
|
||||
} else {
|
||||
$attributes = $entity->toArray();
|
||||
}
|
||||
|
||||
foreach ($attributes as $key => $value) {
|
||||
if ($value instanceof Entity || is_array($value)) {
|
||||
$this->_attributesToJson($value, $result[$key]);
|
||||
} else {
|
||||
if ($value != null || is_bool($value) || is_numeric($value)){
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function _arrayDiffRecursive($firstArray, $secondArray)
|
||||
{
|
||||
$difference = [];
|
||||
|
||||
foreach (array_keys($secondArray) as $key) {
|
||||
$secondArray[$key] = $secondArray[$key] instanceof MercadoPagoEntity ? $secondArray[$key]->toArray() : $secondArray[$key];
|
||||
if (array_key_exists($key, $firstArray) && $firstArray[$key] instanceof MercadoPagoEntity){
|
||||
$firstArray[$key] = $firstArray[$key]->toArray();
|
||||
}
|
||||
|
||||
if (!array_key_exists($key, $firstArray)){
|
||||
$difference[$key] = $secondArray[$key];
|
||||
}elseif (is_array($firstArray[$key]) && is_array($secondArray[$key])) {
|
||||
$newDiff = $this->_arrayDiffRecursive($firstArray[$key], $secondArray[$key]);
|
||||
if (!empty($newDiff)) {
|
||||
$difference[$key] = $newDiff;
|
||||
}
|
||||
}elseif ($firstArray[$key] !== $secondArray[$key]){
|
||||
$difference[$key] = $secondArray[$key];
|
||||
}
|
||||
}
|
||||
return $difference;
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
* @param $result
|
||||
* @param $configuration
|
||||
*/
|
||||
protected function _deltaToJson($entity, &$result){
|
||||
$specialAttributes = array("_last"); // TODO: Refactor this
|
||||
|
||||
if (!is_array($entity)) { // TODO: Refactor this
|
||||
$attributes = array_filter($entity->toArray());
|
||||
} else {
|
||||
$attributes = $entity;
|
||||
};
|
||||
|
||||
foreach ($attributes as $key => $value) {
|
||||
if (!in_array($key, $specialAttributes)){
|
||||
if ($value instanceof Entity || is_array($value)) {
|
||||
//$this->_deltaToJson($value, $result[$key]);
|
||||
} else {
|
||||
$last = $entity->_last;
|
||||
$last_value = $last->$key;
|
||||
if ($last_value != $value){
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
* @param $property
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPropertyType($entity, $property)
|
||||
{
|
||||
$metaData = $this->_getEntityConfiguration($entity);
|
||||
return $metaData->attributes[$property]['type'];
|
||||
}
|
||||
/**
|
||||
* @param $entity
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getDynamicAttributeDenied($entity)
|
||||
{
|
||||
$metaData = $this->_getEntityConfiguration($entity);
|
||||
return isset($metaData->denyDynamicAttribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*/
|
||||
protected function _setCustomHeaders(&$entity, &$query)
|
||||
{
|
||||
foreach ($entity::getCustomHeaders() as $key => $value){
|
||||
$query['headers'][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*/
|
||||
protected function _setDefaultHeaders(&$query)
|
||||
{
|
||||
$query['headers']['Accept'] = 'application/json';
|
||||
$query['headers']['Content-Type'] = 'application/json';
|
||||
$query['headers']['User-Agent'] = 'MercadoPago DX-PHP SDK/ v'. Version::$_VERSION;
|
||||
$query['headers']['x-product-id'] = 'BC32A7RU643001OI3940';
|
||||
$query['headers']['x-tracking-id'] = 'platform:' . PHP_MAJOR_VERSION .'|' . PHP_VERSION . ',type:SDK' . Version::$_VERSION . ',so;';
|
||||
foreach ($this->_customTrackingParams as $key => $value){
|
||||
$query['headers'][$key] = $value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param $query
|
||||
* @param $configuration
|
||||
* @param string $method
|
||||
*/
|
||||
protected function _setIdempotencyHeader(&$query, $method)
|
||||
{
|
||||
if ($method != 'get' && $method != 'delete') {
|
||||
if (array_key_exists('headers', array_change_key_case($query)) && !array_key_exists('x-idempotency-key', array_change_key_case($query['headers']))){
|
||||
$query['headers']['x-idempotency-key'] = $this->_generateUUID();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param $attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _generateUUID()
|
||||
{
|
||||
return sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
// 32 bits for "time_low"
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
|
||||
// 16 bits for "time_mid"
|
||||
mt_rand(0, 0xffff),
|
||||
|
||||
// 16 bits for "time_hi_and_version",
|
||||
// four most significant bits holds version number 4
|
||||
mt_rand(0, 0x0fff) | 0x4000,
|
||||
|
||||
// 16 bits, 8 bits for "clk_seq_hi_res",
|
||||
// 8 bits for "clk_seq_low",
|
||||
// two most significant bits holds zero and one for variant DCE1.1
|
||||
mt_rand(0, 0x3fff) | 0x8000,
|
||||
|
||||
// 48 bits for "node"
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff)
|
||||
);
|
||||
}
|
||||
}
|
||||
81
vendor/mercadopago/dx-php/src/MercadoPago/MetaDataReader.php
vendored
Normal file
81
vendor/mercadopago/dx-php/src/MercadoPago/MetaDataReader.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
|
||||
/**
|
||||
* MetaDataReader Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class MetaDataReader
|
||||
{
|
||||
/**
|
||||
* @var Reader
|
||||
*/
|
||||
private $_reader;
|
||||
|
||||
/**
|
||||
* MetaData constructor.
|
||||
*
|
||||
* @param Reader $reader
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
AnnotationRegistry::registerFile(__DIR__ . '/Annotation/RestMethod.php');
|
||||
AnnotationRegistry::registerFile(__DIR__ . '/Annotation/RequestParam.php');
|
||||
AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Attribute.php');
|
||||
AnnotationRegistry::registerFile(__DIR__ . '/Annotation/DenyDynamicAttribute.php');
|
||||
|
||||
$this->_reader = new AnnotationReader();
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
*
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getMetaData($entity)
|
||||
{
|
||||
if (get_parent_class($entity)){
|
||||
$result = $this->getMetaData(get_parent_class($entity));
|
||||
}else {
|
||||
$result = new \stdClass;
|
||||
}
|
||||
|
||||
$propertyAnnotations = [];
|
||||
$class = new \ReflectionClass($entity);
|
||||
$classAnnotations = $this->_reader->getClassAnnotations($class);
|
||||
foreach ($class->getProperties() as $key => $value) {
|
||||
$annotation = $this->_reader->getPropertyAnnotations(new \ReflectionProperty($entity, $value->name));
|
||||
if (count($annotation)) {
|
||||
$propertyAnnotations[$value->name] = array_pop($annotation);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($classAnnotations as $annotation) {
|
||||
if ($annotation instanceof \MercadoPago\Annotation\RestMethod) {
|
||||
$result->methods[$annotation->method] = get_object_vars($annotation);
|
||||
}
|
||||
if ($annotation instanceof \MercadoPago\Annotation\RequestParam) {
|
||||
$result->params[] = $annotation->param;
|
||||
}
|
||||
if ($annotation instanceof \MercadoPago\Annotation\DenyDynamicAttribute) {
|
||||
$result->denyDynamicAttribute = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($propertyAnnotations as $key => $annotation) {
|
||||
if ($annotation instanceof \MercadoPago\Annotation\Attribute) {
|
||||
$result->attributes[$key] = get_object_vars($annotation);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
284
vendor/mercadopago/dx-php/src/MercadoPago/RestClient.php
vendored
Normal file
284
vendor/mercadopago/dx-php/src/MercadoPago/RestClient.php
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* MercadoPago cURL RestClient
|
||||
*/
|
||||
class RestClient
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected static $verbArray = [
|
||||
'get' => 'GET',
|
||||
'post' => 'POST',
|
||||
'put' => 'PUT',
|
||||
'delete' => 'DELETE'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var Http\CurlRequest|null
|
||||
*/
|
||||
protected $httpRequest = null;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $defaultParams = [];
|
||||
protected $customParams = [];
|
||||
|
||||
/**
|
||||
* RestClient constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->httpRequest = new Http\CurlRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Http\HttpRequest $connect
|
||||
* @param $headers
|
||||
*/
|
||||
protected function setHeaders(Http\HttpRequest $connect, $customHeaders)
|
||||
{
|
||||
$default_header = array(
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => 'MercadoPago DX-PHP SDK/ v' . Version::$_VERSION,
|
||||
'x-product-id' => 'BC32A7RU643001OI3940',
|
||||
'x-tracking-id' => 'platform:' . PHP_MAJOR_VERSION .'|' . PHP_VERSION . ',type:SDK' . Version::$_VERSION . ',so;'
|
||||
);
|
||||
|
||||
if ($customHeaders) {
|
||||
$default_header = array_merge($default_header, $customHeaders);
|
||||
}
|
||||
|
||||
if(!isset($default_header['Authorization'])){
|
||||
$default_header['Authorization'] = 'Bearer '.SDK::getAccessToken();
|
||||
}
|
||||
|
||||
foreach ($default_header as $key => $value) {
|
||||
$headers[] = $key . ': ' . $value;
|
||||
}
|
||||
|
||||
$connect->setOption(CURLOPT_HTTPHEADER, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Http\HttpRequest $connect
|
||||
* @param $data
|
||||
* @param string $content_type
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function setData(Http\HttpRequest $connect, $data, $content_type = '')
|
||||
{
|
||||
|
||||
if ($content_type == "application/json") {
|
||||
|
||||
if (gettype($data) == "string") {
|
||||
json_decode($data, true);
|
||||
} else {
|
||||
$data = json_encode($data);
|
||||
}
|
||||
|
||||
if (function_exists('json_last_error')) {
|
||||
$json_error = json_last_error();
|
||||
if ($json_error != JSON_ERROR_NONE) {
|
||||
throw new Exception("JSON Error [{$json_error}] - Data: {$data}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ($data != "[]") {
|
||||
$connect->setOption(CURLOPT_POSTFIELDS, $data);
|
||||
} else {
|
||||
$connect->setOption(CURLOPT_POSTFIELDS, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $request
|
||||
*/
|
||||
public function setHttpRequest($request)
|
||||
{
|
||||
$this->httpRequest = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Http\CurlRequest|null
|
||||
*/
|
||||
public function getHttpRequest()
|
||||
{
|
||||
return $this->httpRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $options
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function exec($options)
|
||||
{
|
||||
$method = key($options);
|
||||
$requestPath = reset($options);
|
||||
$verb = self::$verbArray[$method];
|
||||
|
||||
$headers = $this->getArrayValue($options, 'headers');
|
||||
$url_query = $this->getArrayValue($options, 'url_query');
|
||||
$formData = $this->getArrayValue($options, 'form_data');
|
||||
$jsonData = $this->getArrayValue($options, 'json_data');
|
||||
|
||||
|
||||
$defaultHttpParams = self::$defaultParams;
|
||||
$connectionParams = array_merge($defaultHttpParams, $this->customParams);
|
||||
$query = '';
|
||||
|
||||
if ($url_query > 0) {
|
||||
$query = http_build_query($url_query);
|
||||
}
|
||||
|
||||
$address = $this->getArrayValue($connectionParams, 'address');
|
||||
$uri = $address . $requestPath;
|
||||
if ($query != '') {
|
||||
if (parse_url($uri, PHP_URL_QUERY)) {
|
||||
$uri .= '&' . $query;
|
||||
} else {
|
||||
$uri .= '?' . $query;
|
||||
}
|
||||
}
|
||||
|
||||
$connect = $this->getHttpRequest();
|
||||
$connect->setOption(CURLOPT_URL, $uri);
|
||||
if ($userAgent = $this->getArrayValue($connectionParams, 'user_agent')) {
|
||||
$connect->setOption(CURLOPT_USERAGENT, $userAgent);
|
||||
}
|
||||
$connect->setOption(CURLOPT_RETURNTRANSFER, true);
|
||||
$connect->setOption(CURLOPT_CUSTOMREQUEST, $verb);
|
||||
|
||||
$this->setHeaders($connect, $headers);
|
||||
$proxyAddress = $this->getArrayValue($connectionParams, 'proxy_addr');
|
||||
$proxyPort = $this->getArrayValue($connectionParams, 'proxy_port');
|
||||
if (!empty($proxyAddress)) {
|
||||
$connect->setOption(CURLOPT_PROXY, $proxyAddress);
|
||||
$connect->setOption(CURLOPT_PROXYPORT, $proxyPort);
|
||||
}
|
||||
if ($useSsl = $this->getArrayValue($connectionParams, 'use_ssl')) {
|
||||
$connect->setOption(CURLOPT_SSL_VERIFYPEER, $useSsl);
|
||||
}
|
||||
if ($sslVersion = $this->getArrayValue($connectionParams, 'ssl_version')) {
|
||||
$connect->setOption(CURLOPT_SSLVERSION, $sslVersion);
|
||||
}
|
||||
if ($verifyMode = $this->getArrayValue($connectionParams, 'verify_mode')) {
|
||||
$connect->setOption(CURLOPT_SSL_VERIFYHOST, $verifyMode);
|
||||
}
|
||||
if ($caFile = $this->getArrayValue($connectionParams, 'ca_file')) {
|
||||
$connect->setOption(CURLOPT_CAPATH, $caFile);
|
||||
}
|
||||
|
||||
$connect->setOption(CURLOPT_FOLLOWLOCATION, true);
|
||||
|
||||
if ($formData) {
|
||||
$this->setData($connect, $formData);
|
||||
}
|
||||
if ($jsonData) {
|
||||
$this->setData($connect, $jsonData, "application/json");
|
||||
}
|
||||
|
||||
$apiResult = $connect->execute();
|
||||
$apiHttpCode = $connect->getInfo(CURLINFO_HTTP_CODE);
|
||||
|
||||
if ($apiResult === false) {
|
||||
throw new Exception ($connect->error());
|
||||
}
|
||||
|
||||
$response['response'] = [];
|
||||
|
||||
if ($apiHttpCode != "200" && $apiHttpCode != "201") {
|
||||
error_log($apiResult);
|
||||
}
|
||||
|
||||
$response['response'] = json_decode($apiResult, true);
|
||||
$response['code'] = $apiHttpCode;
|
||||
|
||||
$connect->error();
|
||||
|
||||
return ['code' => $response['code'], 'body' => $response['response']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $uri
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function get($uri, $options = [])
|
||||
{
|
||||
return $this->exec(array_merge(['get' => $uri], $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $uri
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function post($uri, $options = [])
|
||||
{
|
||||
return $this->exec(array_merge(['post' => $uri], $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $uri
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function put($uri, $options = [])
|
||||
{
|
||||
return $this->exec(array_merge(['put' => $uri], $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $uri
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($uri, $options = [])
|
||||
{
|
||||
return $this->exec(array_merge(['delete' => $uri], $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $param
|
||||
* @param $value
|
||||
*/
|
||||
public function setHttpParam($param, $value)
|
||||
{
|
||||
self::$defaultParams[$param] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $array
|
||||
* @param $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function getArrayValue($array, $key)
|
||||
{
|
||||
if (array_key_exists($key, $array)) {
|
||||
return $array[$key];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
197
vendor/mercadopago/dx-php/src/MercadoPago/SDK.php
vendored
Normal file
197
vendor/mercadopago/dx-php/src/MercadoPago/SDK.php
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
/**
|
||||
* MercadoPagoSdk Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class SDK
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
protected static $_config;
|
||||
/**
|
||||
* @var Manager
|
||||
*/
|
||||
protected static $_manager;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected static $_restClient;
|
||||
|
||||
/**
|
||||
* MercadoPagoSdk constructor.
|
||||
*/
|
||||
public static function initialize()
|
||||
{
|
||||
self::$_restClient = new RestClient();
|
||||
self::$_config = new Config(null, self::$_restClient);
|
||||
self::$_restClient->setHttpParam('address', self::$_config->get('base_url'));
|
||||
self::$_manager = new Manager(self::$_restClient, self::$_config);
|
||||
Entity::setManager(self::$_manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Access Token for SDK .
|
||||
*/
|
||||
public static function setAccessToken($access_token){
|
||||
if (!isset(self::$_config)){
|
||||
self::initialize();
|
||||
}
|
||||
self::$_config->configure(['ACCESS_TOKEN' => $access_token]);
|
||||
|
||||
}
|
||||
|
||||
public static function getAccessToken(){
|
||||
return self::$_config->get('ACCESS_TOKEN');
|
||||
}
|
||||
|
||||
public static function getCountryId(){
|
||||
return self::$_config->get('COUNTRY_ID');
|
||||
}
|
||||
|
||||
public static function cleanCredentials(){
|
||||
if (self::$_config == null) {
|
||||
// do nothing
|
||||
} else {
|
||||
self::$_config->clean();
|
||||
}
|
||||
}
|
||||
|
||||
public static function setMultipleCredentials($array){
|
||||
foreach($array as $key => $values) {
|
||||
self::$_config->configure([$key => $values]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Access ClientId for SDK .
|
||||
*/
|
||||
public static function setClientId($client_id){
|
||||
if (!isset(self::$_config)){
|
||||
self::initialize();
|
||||
}
|
||||
self::$_config->configure(['CLIENT_ID' => $client_id]);
|
||||
}
|
||||
|
||||
public static function getClientId(){
|
||||
return self::$_config->get('CLIENT_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Access ClientSecret for SDK .
|
||||
*/
|
||||
public static function setClientSecret($client_secret){
|
||||
if (!isset(self::$_config)){
|
||||
self::initialize();
|
||||
}
|
||||
self::$_config->configure(['CLIENT_SECRET' => $client_secret]);
|
||||
}
|
||||
|
||||
public static function getClientSecret(){
|
||||
return self::$_config->get('CLIENT_SECRET');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Access ClientSecret for SDK .
|
||||
*/
|
||||
public static function setPublicKey($public_key){
|
||||
self::$_config->configure(['PUBLIC_KEY' => $public_key]);
|
||||
}
|
||||
|
||||
public static function getPublicKey(){
|
||||
return self::$_config->get('PUBLIC_KEY');
|
||||
}
|
||||
|
||||
public static function configure($data=[])
|
||||
{
|
||||
self::initialize();
|
||||
self::$_config->configure($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Config
|
||||
*/
|
||||
public static function config()
|
||||
{
|
||||
return self::$_config;
|
||||
}
|
||||
|
||||
public static function addCustomTrackingParam($key, $value)
|
||||
{
|
||||
self::$_manager->addCustomTrackingParam($key, $value);
|
||||
}
|
||||
|
||||
|
||||
// Publishing generic functions
|
||||
|
||||
public static function get($uri, $options=[])
|
||||
{
|
||||
return self::$_restClient->get($uri, $options);
|
||||
}
|
||||
|
||||
public static function post($uri, $options=[])
|
||||
{
|
||||
return self::$_restClient->post($uri, $options);
|
||||
}
|
||||
|
||||
public static function put($uri, $options=[])
|
||||
{
|
||||
return self::$_restClient->put($uri, $options);
|
||||
}
|
||||
|
||||
public static function delete($uri, $options=[])
|
||||
{
|
||||
return self::$_restClient->delete($uri, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Platform Id for SDK .
|
||||
*/
|
||||
public static function setPlatformId($platform_id){
|
||||
if (!isset(self::$_config)){
|
||||
self::initialize();
|
||||
}
|
||||
self::$_config->configure(['x-platform-id' => $platform_id]);
|
||||
self::addCustomTrackingParam('x-platform-id', $platform_id);
|
||||
}
|
||||
|
||||
public static function getPlatformId(){
|
||||
return self::$_config->get('x-platform-id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Corporation Id for SDK .
|
||||
*/
|
||||
public static function setCorporationId($corporation_id){
|
||||
if (!isset(self::$_config)){
|
||||
self::initialize();
|
||||
}
|
||||
self::$_config->configure(['x-corporation-id' => $corporation_id]);
|
||||
self::addCustomTrackingParam('x-corporation-id', $corporation_id);
|
||||
}
|
||||
|
||||
public static function getCorporationId(){
|
||||
return self::$_config->get('x-corporation-id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Integrator Id for SDK .
|
||||
*/
|
||||
public static function setIntegratorId($integrator_id){
|
||||
if (!isset(self::$_config)){
|
||||
self::initialize();
|
||||
}
|
||||
self::$_config->configure(['x-integrator-id' => $integrator_id]);
|
||||
self::addCustomTrackingParam('x-integrator-id', $integrator_id);
|
||||
}
|
||||
|
||||
public static function getIntegratorId(){
|
||||
return self::$_config->get('x-integrator-id');
|
||||
}
|
||||
}
|
||||
|
||||
8
vendor/mercadopago/dx-php/src/MercadoPago/Version.php
vendored
Normal file
8
vendor/mercadopago/dx-php/src/MercadoPago/Version.php
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
|
||||
class Version
|
||||
{
|
||||
public static
|
||||
$_VERSION = '2.6.2';
|
||||
}
|
||||
Reference in New Issue
Block a user