Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
31
vendor/mercadopago/dx-php/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
31
vendor/mercadopago/dx-php/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
> For support request no related with bugs or feature requests for this SDK, please use the official developers support channel https://mercadopago.com.ar/developers/es/support/
|
||||
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Using this snippet '....'
|
||||
3. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Server (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- WebServer
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
17
vendor/mercadopago/dx-php/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
17
vendor/mercadopago/dx-php/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
52
vendor/mercadopago/dx-php/.github/workflows/php.yml
vendored
Normal file
52
vendor/mercadopago/dx-php/.github/workflows/php.yml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: PHP Composer
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['7.1', '7.2', '7.3', '7.4', '8.0']
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP ${{ matrix.php-version }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
extensions: mbstring, intl
|
||||
ini-values: post_max_size=256M, short_open_tag=On
|
||||
coverage: xdebug
|
||||
tools: php-cs-fixer, phpunit
|
||||
|
||||
- name: Validate composer.json and composer.lock
|
||||
run: composer validate
|
||||
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.composer-cache.outputs.cache-hit != 'false'
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Run test suite
|
||||
run: composer run-script test
|
||||
env:
|
||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
USER_EMAIL: ${{ secrets.USER_EMAIL }}
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
||||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
||||
22
vendor/mercadopago/dx-php/.gitignore
vendored
Normal file
22
vendor/mercadopago/dx-php/.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
#SOs
|
||||
Thumbs.db
|
||||
*~
|
||||
._*
|
||||
.DS_Store
|
||||
|
||||
#IDEs
|
||||
nbproject
|
||||
/.idea
|
||||
|
||||
#Vagrant
|
||||
/.vagrant
|
||||
/Vagrantfile.local
|
||||
|
||||
#Project
|
||||
/vendor
|
||||
/composer.lock
|
||||
|
||||
#Samples Vendor
|
||||
/samples/vendor
|
||||
|
||||
.env
|
||||
13
vendor/mercadopago/dx-php/.travis.yml
vendored
Normal file
13
vendor/mercadopago/dx-php/.travis.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
language: php
|
||||
php:
|
||||
- "5.6"
|
||||
- "7.0"
|
||||
- "7.1"
|
||||
- "7.2"
|
||||
|
||||
before_script:
|
||||
- composer self-update
|
||||
- composer install --no-interaction
|
||||
|
||||
script:
|
||||
- vendor/bin/phpunit
|
||||
21
vendor/mercadopago/dx-php/LICENSE
vendored
Normal file
21
vendor/mercadopago/dx-php/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 MercadoPago Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
71
vendor/mercadopago/dx-php/README.md
vendored
Normal file
71
vendor/mercadopago/dx-php/README.md
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# Mercado Pago SDK for PHP
|
||||
|
||||
[](https://packagist.org/packages/mercadopago/dx-php)
|
||||
[](https://packagist.org/packages/mercadopago/dx-php)
|
||||
[](https://packagist.org/packages/mercadopago/dx-php)
|
||||
|
||||
This library provides developers with a simple set of bindings to help you integrate Mercado Pago API to a website and start receiving payments.
|
||||
|
||||
## 💡 Requirements
|
||||
|
||||
PHP 5.6, 7.1 or higher
|
||||
|
||||
## 💻 Installation
|
||||
|
||||
First time using Mercado Pago? Create your [Mercado Pago account](https://www.mercadopago.com), if you don’t have one already.
|
||||
|
||||
1. Download [Composer](https://getcomposer.org/doc/00-intro.md) if not already installed
|
||||
|
||||
2. On your project directory run on the command line
|
||||
`composer require "mercadopago/dx-php:2.5.3"` for PHP7 or `composer require "mercadopago/dx-php:1.12.5"` for PHP5.6.
|
||||
|
||||
3. Copy the access_token in the [credentials](https://www.mercadopago.com/mlb/account/credentials) section of the page and replace YOUR_ACCESS_TOKEN with it.
|
||||
|
||||
That's it! Mercado Pago SDK has been successfully installed.
|
||||
|
||||
## 🌟 Getting Started
|
||||
|
||||
Simple usage looks like:
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php'; // You have to require the library from your Composer vendor folder
|
||||
|
||||
MercadoPago\SDK::setAccessToken("YOUR_ACCESS_TOKEN"); // Either Production or SandBox AccessToken
|
||||
|
||||
$payment = new MercadoPago\Payment();
|
||||
|
||||
$payment->transaction_amount = 141;
|
||||
$payment->token = "YOUR_CARD_TOKEN";
|
||||
$payment->description = "Ergonomic Silk Shirt";
|
||||
$payment->installments = 1;
|
||||
$payment->payment_method_id = "visa";
|
||||
$payment->payer = array(
|
||||
"email" => "larue.nienow@email.com"
|
||||
);
|
||||
|
||||
$payment->save();
|
||||
|
||||
echo $payment->status;
|
||||
?>
|
||||
```
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
Visit our Dev Site for further information regarding:
|
||||
- Payments APIs: [Spanish](https://www.mercadopago.com.ar/developers/es/guides/payments/api/introduction/) / [Portuguese](https://www.mercadopago.com.br/developers/pt/guides/payments/api/introduction/)
|
||||
- Mercado Pago checkout: [Spanish](https://www.mercadopago.com.ar/developers/es/guides/payments/web-payment-checkout/introduction/) / [Portuguese](https://www.mercadopago.com.br/developers/pt/guides/payments/web-payment-checkout/introduction/)
|
||||
- Web Tokenize checkout: [Spanish](https://www.mercadopago.com.ar/developers/es/guides/payments/web-tokenize-checkout/introduction/) / [Portuguese](https://www.mercadopago.com.br/developers/pt/guides/payments/web-tokenize-checkout/introduction/)
|
||||
|
||||
Check [our official code reference](https://www.mercadopago.com.br/developers/pt/docs/sdks-library/server-side) to explore all available functionalities.
|
||||
|
||||
## ❤️ Support
|
||||
|
||||
If you require technical support, please contact our support team at [developers.mercadopago.com](https://developers.mercadopago.com)
|
||||
|
||||
## 🏻 License
|
||||
|
||||
```
|
||||
MIT license. Copyright (c) 2018 - Mercado Pago / Mercado Libre
|
||||
For more information, see the LICENSE file.
|
||||
```
|
||||
48
vendor/mercadopago/dx-php/composer.json
vendored
Normal file
48
vendor/mercadopago/dx-php/composer.json
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "mercadopago/dx-php",
|
||||
"description": "Mercado Pago PHP SDK",
|
||||
"type": "library",
|
||||
"homepage": "https://github.com/mercadopago/sdk-php",
|
||||
"license": "MIT",
|
||||
"version": "2.5.3",
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.1"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.0",
|
||||
"doctrine/common": "^2.6 || ^3.0",
|
||||
"doctrine/annotations": "^1.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7",
|
||||
"symfony/yaml": "~2.5",
|
||||
"phpmd/phpmd": "@stable",
|
||||
"squizlabs/php_codesniffer": "2.8.1",
|
||||
"sebastian/phpcpd": "*",
|
||||
"doctrine/orm": "~2.3",
|
||||
"vlucas/phpdotenv": "^2.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MercadoPago\\": [
|
||||
"src/MercadoPago/",
|
||||
"tests/",
|
||||
"src/MercadoPago/Generic/",
|
||||
"src/MercadoPago/Entities/",
|
||||
"src/MercadoPago/Entities/Shared/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "./vendor/bin/phpunit --testdox --colors=auto tests"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://packagist.org"
|
||||
},
|
||||
{ "packagist": false }
|
||||
]
|
||||
}
|
||||
48
vendor/mercadopago/dx-php/img/demo.svg
vendored
Normal file
48
vendor/mercadopago/dx-php/img/demo.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 78 KiB |
BIN
vendor/mercadopago/dx-php/img/ezgif-2-f98e8701825e.gif
vendored
Normal file
BIN
vendor/mercadopago/dx-php/img/ezgif-2-f98e8701825e.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 751 KiB |
65626
vendor/mercadopago/dx-php/phpunit.phar
vendored
Normal file
65626
vendor/mercadopago/dx-php/phpunit.phar
vendored
Normal file
File diff suppressed because one or more lines are too long
17
vendor/mercadopago/dx-php/phpunit.xml
vendored
Normal file
17
vendor/mercadopago/dx-php/phpunit.xml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
backupGlobals="false"
|
||||
beStrictAboutCoversAnnotation="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTestsThatDoNotTestAnything="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
verbose="true">
|
||||
<testsuite name="php_sdk_tests">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
|
||||
|
||||
|
||||
</phpunit>
|
||||
25
vendor/mercadopago/dx-php/samples/checkout-buttons/basic-preference/button.php
vendored
Normal file
25
vendor/mercadopago/dx-php/samples/checkout-buttons/basic-preference/button.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
# Crear un boton de pago a partir de una preferencia con atributos requeridos minimos
|
||||
|
||||
require_once dirname(__FILE__).'/../../index.php';
|
||||
|
||||
$preference = new MercadoPago\Preference();
|
||||
|
||||
# Building an item
|
||||
|
||||
$item = new MercadoPago\Item();
|
||||
$item->id = "00001";
|
||||
$item->title = "item";
|
||||
$item->quantity = 1;
|
||||
$item->unit_price = 100;
|
||||
|
||||
$preference->items = array($item);
|
||||
|
||||
$preference->save(); # Save the preference and send the HTTP Request to create
|
||||
|
||||
# Return the HTML code for button
|
||||
|
||||
echo "<a href='$preference->sandbox_init_point'> Pagar </a>";
|
||||
|
||||
?>
|
||||
40
vendor/mercadopago/dx-php/samples/checkout-buttons/full-preference/button.php
vendored
Normal file
40
vendor/mercadopago/dx-php/samples/checkout-buttons/full-preference/button.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
# Crear un boton de pago a partir de una preferencia con atributos requeridos minimos
|
||||
|
||||
require_once dirname(__FILE__).'/../../index.php';
|
||||
|
||||
$preference = new MercadoPago\Preference();
|
||||
|
||||
# Building an item
|
||||
|
||||
$item1 = new MercadoPago\Item();
|
||||
$item1->id = "00001";
|
||||
$item1->title = "item";
|
||||
$item1->quantity = 1;
|
||||
$item1->unit_price = 100;
|
||||
|
||||
$item2 = new MercadoPago\Item();
|
||||
$item2->id = "00002";
|
||||
$item2->title = "item";
|
||||
$item2->quantity = 1;
|
||||
$item2->unit_price = 100;
|
||||
|
||||
$preference->items = array($item1, $item2);
|
||||
|
||||
$preference->payment_methods = array(
|
||||
"excluded_payment_types" => array(
|
||||
array("id" => "credit_card")
|
||||
),
|
||||
"installments" => 12
|
||||
);
|
||||
|
||||
$preference->external_reference = "A Custom External Reference";
|
||||
|
||||
$preference->save(); # Save the preference and send the HTTP Request to create
|
||||
|
||||
# Return the HTML code for button
|
||||
|
||||
echo "<a href='$preference->sandbox_init_point'> Pagar </a>";
|
||||
|
||||
?>
|
||||
12
vendor/mercadopago/dx-php/samples/composer.json
vendored
Normal file
12
vendor/mercadopago/dx-php/samples/composer.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"repositories": [
|
||||
{
|
||||
"url": "git@github.com:mercadopago/sdk-php.git",
|
||||
"type": "git"
|
||||
}
|
||||
],
|
||||
"name": "mercadopago/sdk-php-sample",
|
||||
"require": {
|
||||
"mercadopago/dx-php": "dev-master"
|
||||
}
|
||||
}
|
||||
861
vendor/mercadopago/dx-php/samples/composer.lock
generated
vendored
Normal file
861
vendor/mercadopago/dx-php/samples/composer.lock
generated
vendored
Normal file
@@ -0,0 +1,861 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "a97932aaf55473222cfd365b741e994b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
"version": "1.13.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/annotations.git",
|
||||
"reference": "e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/annotations/zipball/e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f",
|
||||
"reference": "e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/lexer": "1.*",
|
||||
"ext-tokenizer": "*",
|
||||
"php": "^7.1 || ^8.0",
|
||||
"psr/cache": "^1 || ^2 || ^3"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/cache": "^1.11 || ^2.0",
|
||||
"doctrine/coding-standard": "^6.0 || ^8.1",
|
||||
"phpstan/phpstan": "^0.12.20",
|
||||
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5",
|
||||
"symfony/cache": "^4.4 || ^5.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Docblock Annotations Parser",
|
||||
"homepage": "https://www.doctrine-project.org/projects/annotations.html",
|
||||
"keywords": [
|
||||
"annotations",
|
||||
"docblock",
|
||||
"parser"
|
||||
],
|
||||
"time": "2021-05-16T18:07:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "1.11.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/cache.git",
|
||||
"reference": "3bb5588cec00a0268829cc4a518490df6741af9d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/3bb5588cec00a0268829cc4a518490df6741af9d",
|
||||
"reference": "3bb5588cec00a0268829cc4a518490df6741af9d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "~7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": ">2.2,<2.4",
|
||||
"psr/cache": ">=3"
|
||||
},
|
||||
"require-dev": {
|
||||
"alcaeus/mongo-php-adapter": "^1.1",
|
||||
"cache/integration-tests": "dev-master",
|
||||
"doctrine/coding-standard": "^8.0",
|
||||
"mongodb/mongodb": "^1.1",
|
||||
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
|
||||
"predis/predis": "~1.0",
|
||||
"psr/cache": "^1.0 || ^2.0",
|
||||
"symfony/cache": "^4.4 || ^5.2"
|
||||
},
|
||||
"suggest": {
|
||||
"alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/cache.html",
|
||||
"keywords": [
|
||||
"abstraction",
|
||||
"apcu",
|
||||
"cache",
|
||||
"caching",
|
||||
"couchdb",
|
||||
"memcached",
|
||||
"php",
|
||||
"redis",
|
||||
"xcache"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpdoctrine",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-05-25T09:01:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/collections",
|
||||
"version": "1.6.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/collections.git",
|
||||
"reference": "55f8b799269a1a472457bd1a41b4f379d4cfba4a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/collections/zipball/55f8b799269a1a472457bd1a41b4f379d4cfba4a",
|
||||
"reference": "55f8b799269a1a472457bd1a41b4f379d4cfba4a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^6.0",
|
||||
"phpstan/phpstan-shim": "^0.9.2",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"vimeo/psalm": "^3.8.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/collections.html",
|
||||
"keywords": [
|
||||
"array",
|
||||
"collections",
|
||||
"iterators",
|
||||
"php"
|
||||
],
|
||||
"time": "2020-07-27T17:53:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/common",
|
||||
"version": "2.13.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/common.git",
|
||||
"reference": "f3812c026e557892c34ef37f6ab808a6b567da7f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/common/zipball/f3812c026e557892c34ef37f6ab808a6b567da7f",
|
||||
"reference": "f3812c026e557892c34ef37f6ab808a6b567da7f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/annotations": "^1.0",
|
||||
"doctrine/cache": "^1.0",
|
||||
"doctrine/collections": "^1.0",
|
||||
"doctrine/event-manager": "^1.0",
|
||||
"doctrine/inflector": "^1.0",
|
||||
"doctrine/lexer": "^1.0",
|
||||
"doctrine/persistence": "^1.3.3",
|
||||
"doctrine/reflection": "^1.0",
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^1.0",
|
||||
"phpstan/phpstan": "^0.11",
|
||||
"phpstan/phpstan-phpunit": "^0.11",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"squizlabs/php_codesniffer": "^3.0",
|
||||
"symfony/phpunit-bridge": "^4.0.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.11.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\": "lib/Doctrine/Common"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, persistence interfaces, proxies, event system and much more.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/common.html",
|
||||
"keywords": [
|
||||
"common",
|
||||
"doctrine",
|
||||
"php"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpdoctrine",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcommon",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-06-05T16:46:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/event-manager",
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/event-manager.git",
|
||||
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f",
|
||||
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": "<2.9@dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^6.0",
|
||||
"phpunit/phpunit": "^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\": "lib/Doctrine/Common"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
|
||||
"keywords": [
|
||||
"event",
|
||||
"event dispatcher",
|
||||
"event manager",
|
||||
"event system",
|
||||
"events"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpdoctrine",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-05-29T18:28:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
"version": "1.4.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/inflector.git",
|
||||
"reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/inflector/zipball/4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9",
|
||||
"reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^8.0",
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpstan/phpstan-phpunit": "^0.12",
|
||||
"phpstan/phpstan-strict-rules": "^0.12",
|
||||
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector",
|
||||
"Doctrine\\Inflector\\": "lib/Doctrine/Inflector"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/inflector.html",
|
||||
"keywords": [
|
||||
"inflection",
|
||||
"inflector",
|
||||
"lowercase",
|
||||
"manipulation",
|
||||
"php",
|
||||
"plural",
|
||||
"singular",
|
||||
"strings",
|
||||
"uppercase",
|
||||
"words"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpdoctrine",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-16T17:34:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/lexer.git",
|
||||
"reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/lexer/zipball/1febd6c3ef84253d7c815bed85fc622ad207a9f8",
|
||||
"reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/lexer.html",
|
||||
"keywords": [
|
||||
"annotations",
|
||||
"docblock",
|
||||
"lexer",
|
||||
"parser",
|
||||
"php"
|
||||
],
|
||||
"time": "2019-06-08T11:03:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/persistence",
|
||||
"version": "1.3.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/persistence.git",
|
||||
"reference": "7a6eac9fb6f61bba91328f15aa7547f4806ca288"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/persistence/zipball/7a6eac9fb6f61bba91328f15aa7547f4806ca288",
|
||||
"reference": "7a6eac9fb6f61bba91328f15aa7547f4806ca288",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/annotations": "^1.0",
|
||||
"doctrine/cache": "^1.0",
|
||||
"doctrine/collections": "^1.0",
|
||||
"doctrine/event-manager": "^1.0",
|
||||
"doctrine/reflection": "^1.2",
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": "<2.10@dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^6.0",
|
||||
"phpstan/phpstan": "^0.11",
|
||||
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
|
||||
"vimeo/psalm": "^3.11"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\": "lib/Doctrine/Common",
|
||||
"Doctrine\\Persistence\\": "lib/Doctrine/Persistence"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.",
|
||||
"homepage": "https://doctrine-project.org/projects/persistence.html",
|
||||
"keywords": [
|
||||
"mapper",
|
||||
"object",
|
||||
"odm",
|
||||
"orm",
|
||||
"persistence"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpdoctrine",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fpersistence",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-06-20T12:56:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/reflection",
|
||||
"version": "1.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/reflection.git",
|
||||
"reference": "fa587178be682efe90d005e3a322590d6ebb59a5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/reflection/zipball/fa587178be682efe90d005e3a322590d6ebb59a5",
|
||||
"reference": "fa587178be682efe90d005e3a322590d6ebb59a5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/annotations": "^1.0",
|
||||
"ext-tokenizer": "*",
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": "<2.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^6.0 || ^8.2.0",
|
||||
"doctrine/common": "^2.10",
|
||||
"phpstan/phpstan": "^0.11.0 || ^0.12.20",
|
||||
"phpstan/phpstan-phpunit": "^0.11.0 || ^0.12.16",
|
||||
"phpunit/phpunit": "^7.5 || ^9.1.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\": "lib/Doctrine/Common"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that comes with PHP. It allows you to get the reflection information about classes, methods and properties statically.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/reflection.html",
|
||||
"keywords": [
|
||||
"reflection",
|
||||
"static"
|
||||
],
|
||||
"abandoned": "roave/better-reflection",
|
||||
"time": "2020-10-27T21:46:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mercadopago/dx-php",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:mercadopago/sdk-php.git",
|
||||
"reference": "8f71ba1515105b8a5acd167f7546edadf9e0c531"
|
||||
},
|
||||
"require": {
|
||||
"doctrine/annotations": "^1.8",
|
||||
"doctrine/common": "^2.6",
|
||||
"php": ">=7.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/orm": "~2.3",
|
||||
"phpdocumentor/phpdocumentor": "^2.0",
|
||||
"phpmd/phpmd": "@stable",
|
||||
"phpunit/phpunit": "^5",
|
||||
"sebastian/phpcpd": "*",
|
||||
"squizlabs/php_codesniffer": "2.3.*",
|
||||
"symfony/yaml": "~2.5",
|
||||
"vlucas/phpdotenv": "^2.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MercadoPago\\": [
|
||||
"src/MercadoPago/",
|
||||
"tests/",
|
||||
"src/MercadoPago/Generic/",
|
||||
"src/MercadoPago/Entities/",
|
||||
"src/MercadoPago/Entities/Shared/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"./vendor/bin/phpunit tests"
|
||||
],
|
||||
"generate-doc": [
|
||||
"php phpDocumentor.phar --visibility=\"public,protected\" --template=\"responsive-twig\" --title=\"SDK Mercado Pago\" -d ./src/MercadoPaGo/Entities -t ./docs"
|
||||
]
|
||||
},
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Mercado Pago PHP SDK",
|
||||
"homepage": "https://github.com/mercadopago/sdk-php",
|
||||
"time": "2021-05-19T21:01:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/cache.git",
|
||||
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
|
||||
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Cache\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for caching libraries",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"psr",
|
||||
"psr-6"
|
||||
],
|
||||
"time": "2016-08-06T20:24:11+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"mercadopago/dx-php": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
}
|
||||
11
vendor/mercadopago/dx-php/samples/customer-and-cards/customer/create.php
vendored
Normal file
11
vendor/mercadopago/dx-php/samples/customer-and-cards/customer/create.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__).'/../../index.php';
|
||||
|
||||
$customer = new MercadoPago\Customer();
|
||||
$customer->email = "your.payer@email.com";
|
||||
$customer->save();
|
||||
|
||||
echo "Customer ID: " . $customer->id;
|
||||
|
||||
?>
|
||||
8
vendor/mercadopago/dx-php/samples/customer-and-cards/customer/remove.php
vendored
Normal file
8
vendor/mercadopago/dx-php/samples/customer-and-cards/customer/remove.php
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__).'/../../index.php';
|
||||
require_once dirname(__FILE__).'/create.php';
|
||||
|
||||
$customer->delete();
|
||||
|
||||
?>
|
||||
7
vendor/mercadopago/dx-php/samples/index.php
vendored
Normal file
7
vendor/mercadopago/dx-php/samples/index.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
MercadoPago\SDK::setAccessToken("ACCESS_TOKEN");
|
||||
|
||||
?>
|
||||
21
vendor/mercadopago/dx-php/samples/payment/minimal/create.php
vendored
Normal file
21
vendor/mercadopago/dx-php/samples/payment/minimal/create.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/../../index.php';
|
||||
|
||||
$payment = new MercadoPago\Payment();
|
||||
|
||||
$payment->transaction_amount = 100;
|
||||
$payment->token = "CARD_TOKEN";
|
||||
$payment->description = "Title of what you are paying for";
|
||||
$payment->installments = 1;
|
||||
|
||||
$payer = new MercadoPago\Payer();
|
||||
$payer->email = "your.payer@email.com";
|
||||
|
||||
$payment->payer = $payer;
|
||||
$payment->save();
|
||||
|
||||
echo "Payment ID: " . $payment->id . "\n";
|
||||
echo "Payment Status: " . $payment->status . "\n";
|
||||
|
||||
?>
|
||||
18
vendor/mercadopago/dx-php/samples/payment/minimal/refund.php
vendored
Normal file
18
vendor/mercadopago/dx-php/samples/payment/minimal/refund.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/../../index.php';
|
||||
|
||||
# Create a Payment
|
||||
require_once dirname(__FILE__) . '/create.php';
|
||||
|
||||
# Refunding
|
||||
$refund = new MercadoPago\Refund();
|
||||
$refund->amount = $payment->total_paid_amount;
|
||||
$refund->metadata = "A total refund";
|
||||
$refund->save();
|
||||
|
||||
echo "Refund ID: " . $refund->id . "\n";
|
||||
echo "Payment Refunds: \n";
|
||||
var_dump($payment->refunds);
|
||||
|
||||
?>
|
||||
24
vendor/mercadopago/dx-php/samples/suscriptions/basic-suscription.php
vendored
Normal file
24
vendor/mercadopago/dx-php/samples/suscriptions/basic-suscription.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/../../index.php';
|
||||
|
||||
$preapproval_data = new MercadoPago\Preapproval();
|
||||
|
||||
$preapproval_data->payer_email = "your.payer@email.com";
|
||||
$preapproval_data->back_url = "http://www.my-site.com";
|
||||
$preapproval_data->reason = "Monthly subscription to premium package";
|
||||
$preapproval_data->external_reference = "OP-1234";
|
||||
$preapproval_data->auto_recurring = array(
|
||||
"frequency" => 1,
|
||||
"frequency_type" => "months",
|
||||
"transaction_amount" => 10,
|
||||
"currency_id" => "XXX", // your currency
|
||||
"start_date" => date(DATE_ISO8601),
|
||||
"end_date" => date(DATE_ISO8601, strtotime('+5 years'))
|
||||
);
|
||||
|
||||
$preapproval_data->save();
|
||||
|
||||
var_dump($preapproval_data);
|
||||
|
||||
?>
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
117
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Card.php
vendored
Normal file
117
vendor/mercadopago/dx-php/src/MercadoPago/Entities/Card.php
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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/: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
|
||||
*/
|
||||
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($options = [])
|
||||
{
|
||||
$params = [];
|
||||
$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 = "";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
47
vendor/mercadopago/dx-php/src/MercadoPago/Generic/RecuperableError.php
vendored
Normal file
47
vendor/mercadopago/dx-php/src/MercadoPago/Generic/RecuperableError.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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{
|
||||
$this->add_cause($cause['code'], $cause['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();
|
||||
}
|
||||
440
vendor/mercadopago/dx-php/src/MercadoPago/Manager.php
vendored
Normal file
440
vendor/mercadopago/dx-php/src/MercadoPago/Manager.php
vendored
Normal file
@@ -0,0 +1,440 @@
|
||||
<?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, $configuration, $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, $configuration, $method)
|
||||
{
|
||||
if (!isset($configuration->methods[$method])) {
|
||||
return;
|
||||
}
|
||||
$fields = '';
|
||||
if ($configuration->methods[$method]['idempotency']) {
|
||||
$fields = $this->_getIdempotencyAttributes($configuration->attributes);
|
||||
}
|
||||
if ($fields != '') {
|
||||
$query['headers']['x-idempotency-key'] = hash(self::$CIPHER, $fields);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param $attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getIdempotencyAttributes($attributes)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($attributes as $key => $value) {
|
||||
if ($value['idempotency']) {
|
||||
$result[] = $key;
|
||||
}
|
||||
}
|
||||
return implode('&', $result);
|
||||
}
|
||||
}
|
||||
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.5.3';
|
||||
}
|
||||
60
vendor/mercadopago/dx-php/tests/DummyEntity.php
vendored
Normal file
60
vendor/mercadopago/dx-php/tests/DummyEntity.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
use MercadoPago\Annotation\RestMethod;
|
||||
use MercadoPago\Annotation\RequestParam;
|
||||
use MercadoPago\Annotation\Attribute;
|
||||
/**
|
||||
* @RestMethod(resource="/dummies", method="list")
|
||||
* @RestMethod(resource="/dummy/:id", method="read")
|
||||
* @RestMethod(resource="/dummy/:id", method="update")
|
||||
* @RestMethod(resource="/v1/payments", method="create")
|
||||
* @RestMethod(resource="/v1/dummies/search", method="search")
|
||||
* @RequestParam(param="access_token")
|
||||
*/
|
||||
class DummyEntity extends Entity
|
||||
{
|
||||
/**
|
||||
* @Attribute(primaryKey = true, type="string", idempotency=true)
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* @Attribute(type = "string")
|
||||
*/
|
||||
protected $title;
|
||||
/**
|
||||
* @Attribute(type = "string")
|
||||
*/
|
||||
protected $email;
|
||||
/**
|
||||
* @Attribute(type = "string")
|
||||
*/
|
||||
protected $desc;
|
||||
/**
|
||||
* @Attribute(type = "float")
|
||||
*/
|
||||
protected $price;
|
||||
/**
|
||||
* @Attribute(type = "int")
|
||||
*/
|
||||
protected $quantity;
|
||||
/**
|
||||
* @Attribute(type = "date")
|
||||
*/
|
||||
protected $registered_at;
|
||||
/**
|
||||
* @Attribute(type = "stdClass")
|
||||
*/
|
||||
protected $object;
|
||||
/**
|
||||
* @Attribute()
|
||||
*/
|
||||
protected $other;
|
||||
/**
|
||||
* @Attribute(readOnly="true")
|
||||
*/
|
||||
protected $readOnlyAttribute;
|
||||
/**
|
||||
* @Attribute(maxLength=20)
|
||||
*/
|
||||
protected $maxLengthAttribute;
|
||||
}
|
||||
32
vendor/mercadopago/dx-php/tests/FakeApiHub.php
vendored
Normal file
32
vendor/mercadopago/dx-php/tests/FakeApiHub.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace MercadoPago;
|
||||
class FakeApiHub
|
||||
{
|
||||
private $_files = [
|
||||
'/oauth/token' => 'authorization.json',
|
||||
'/v1/payment_methods' => 'payment_methods.json',
|
||||
'/v1/payments' => 'payment.json',
|
||||
'/dummies' => 'dummies.json',
|
||||
'/v1/dummies/search' => 'customer_search.json',
|
||||
'/dummy/:id' => 'dummy.json'
|
||||
];
|
||||
public function getJson($method, $endPoint)
|
||||
{
|
||||
switch ($method) {
|
||||
case 'GET': {
|
||||
return $this->getFile($endPoint);
|
||||
break;
|
||||
}
|
||||
case 'POST': {
|
||||
return $this->getFile($endPoint);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
private function getFile($endpoint)
|
||||
{
|
||||
return file_get_contents(dirname(__FILE__) . '/json_files/' . $this->_files[$endpoint]);
|
||||
}
|
||||
}
|
||||
46
vendor/mercadopago/dx-php/tests/MercadoPagoSdkTest.php
vendored
Normal file
46
vendor/mercadopago/dx-php/tests/MercadoPagoSdkTest.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace MercadoPago;
|
||||
|
||||
/**
|
||||
* EntityTest Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class MercadopagoSdkTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
Entity::unSetManager();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage Please initialize SDK first
|
||||
*/
|
||||
public function testWrongInitialization()
|
||||
{
|
||||
$entity = new DummyEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testInitialization()
|
||||
{
|
||||
SDK::initialize();
|
||||
$entity = new DummyEntity();
|
||||
$this->assertInstanceOf(DummyEntity::class, $entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
58
vendor/mercadopago/dx-php/tests/SDKTest.php
vendored
Normal file
58
vendor/mercadopago/dx-php/tests/SDKTest.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* EntityTest Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class ConfigTest extends TestCase
|
||||
{
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
|
||||
MercadoPago\SDK::cleanCredentials();
|
||||
|
||||
if (file_exists(__DIR__ . '/../.env')) {
|
||||
$dotenv = new Dotenv\Dotenv(__DIR__, '/../.env');
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
MercadoPago\SDK::setClientId(getenv('CLIENT_ID'));
|
||||
MercadoPago\SDK::setClientSecret(getenv('CLIENT_SECRET'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MercadoPago\SDK
|
||||
*/
|
||||
public function testSettings()
|
||||
{
|
||||
$this->assertEquals(getenv('CLIENT_ID'), MercadoPago\SDK::getClientId());
|
||||
$this->assertEquals(getenv('CLIENT_SECRET'), MercadoPago\SDK::getClientSecret());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers MercadoPago\SDK
|
||||
*/
|
||||
public function testDoGetToken()
|
||||
{
|
||||
$this->assertNotNull(MercadoPago\SDK::getAccessToken());
|
||||
}
|
||||
|
||||
public function testSetMultipleAT(){
|
||||
MercadoPago\SDK::setMultipleCredentials(
|
||||
array(
|
||||
"mla" => "MLA_AT",
|
||||
"mlb" => "MLB_AT"
|
||||
)
|
||||
);
|
||||
$this->assertNotNull(MercadoPago\SDK::config()->getData()['mla']);
|
||||
$this->assertNotNull(MercadoPago\SDK::config()->getData()['mlb']);
|
||||
}
|
||||
|
||||
}
|
||||
3
vendor/mercadopago/dx-php/tests/config_files/settings.ini
vendored
Normal file
3
vendor/mercadopago/dx-php/tests/config_files/settings.ini
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
CLIENT_ID: "CLIENT_ID_YAML"
|
||||
CLIENT_SECRET: "CLIENT_SECRET_YAML"
|
||||
ACCESS_TOKEN: "CLIENT_ACCESS_TOKEN_YAML"
|
||||
5
vendor/mercadopago/dx-php/tests/config_files/settings.json
vendored
Normal file
5
vendor/mercadopago/dx-php/tests/config_files/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"CLIENT_ID": "CLIENT_ID_JSON",
|
||||
"CLIENT_SECRET": "CLIENT_SECRET_JSON",
|
||||
"ACCESS_TOKEN": "CLIENT_ACCESS_TOKEN_JSON"
|
||||
}
|
||||
4
vendor/mercadopago/dx-php/tests/config_files/settings.yml
vendored
Normal file
4
vendor/mercadopago/dx-php/tests/config_files/settings.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
CLIENT_ID: "CLIENT_ID_YAML"
|
||||
CLIENT_SECRET: "CLIENT_SECRET_YAML"
|
||||
ACCESS_TOKEN: "CLIENT_ACCESS_TOKEN_YAML"
|
||||
APP_ID: "CLIENT_APP_ID_YAML"
|
||||
5
vendor/mercadopago/dx-php/tests/config_files/settings_broken.json
vendored
Normal file
5
vendor/mercadopago/dx-php/tests/config_files/settings_broken.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"CLIENT_ID": "CLIENT_ID_JSON",
|
||||
"CLIENT_SECRET" "CLIENT_SECRET_JSON",
|
||||
"ACCESS_TOKEN": "CLIENT_ACCESS_TOKEN_JSON"
|
||||
}
|
||||
3
vendor/mercadopago/dx-php/tests/config_files/settings_broken.yml
vendored
Normal file
3
vendor/mercadopago/dx-php/tests/config_files/settings_broken.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
CLIENT_ID: "CLIENT_ID_YAML"
|
||||
CLIENT_SECRET "CLIENT_SECRET_YAML"
|
||||
ACCESS_TOKEN: "CLIENT_ACCESS_TOKEN_YAML"
|
||||
3
vendor/mercadopago/dx-php/tests/json_files/authorization.json
vendored
Normal file
3
vendor/mercadopago/dx-php/tests/json_files/authorization.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ACCESS_TOKEN": "ACCESS_TOKEN"
|
||||
}
|
||||
1
vendor/mercadopago/dx-php/tests/json_files/customer_search.json
vendored
Normal file
1
vendor/mercadopago/dx-php/tests/json_files/customer_search.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"paging":{"offset":0,"limit":10,"total":1},"results":[{"id":"227166260-QeyHHDJ8TZ4L3R","email":"test_user_99529216@testuser.com","first_name":null,"last_name":null,"phone":{"area_code":null,"number":null},"identification":{"number":null,"type":null},"addresses":null,"address":{"id":null,"zip_code":null,"street_name":null,"street_number":null},"date_registered":null,"description":null,"date_created":"2016-09-09T14:08:58.603-04:00","date_last_updated":"2016-09-09T14:08:58.609-04:00","default_card":null,"default_address":null,"cards":[],"metadata":{},"live_mode":true}]}
|
||||
19
vendor/mercadopago/dx-php/tests/json_files/dummies.json
vendored
Normal file
19
vendor/mercadopago/dx-php/tests/json_files/dummies.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"paging": {
|
||||
"limit": 30,
|
||||
"offset": 0,
|
||||
"total": 1
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"id": 1340404,
|
||||
"title": "Title of what you are paying for. It will be displayed in the payment process.",
|
||||
"description": "Item description",
|
||||
"category_id": "art",
|
||||
"picture_url": "https://www.mercadopago.com/org-img/MP3/home/logomp3.gif",
|
||||
"currency_id": "ARS",
|
||||
"quantity": 1,
|
||||
"unit_price": 100
|
||||
}
|
||||
]
|
||||
}
|
||||
10
vendor/mercadopago/dx-php/tests/json_files/dummy.json
vendored
Normal file
10
vendor/mercadopago/dx-php/tests/json_files/dummy.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": 1340404,
|
||||
"title": "Title of what you are paying for. It will be displayed in the payment process.",
|
||||
"description": "Item description",
|
||||
"category_id": "art",
|
||||
"picture_url": "https://www.mercadopago.com/org-img/MP3/home/logomp3.gif",
|
||||
"currency_id": "ARS",
|
||||
"quantity": 1,
|
||||
"unit_price": 100
|
||||
}
|
||||
88
vendor/mercadopago/dx-php/tests/json_files/payment.json
vendored
Normal file
88
vendor/mercadopago/dx-php/tests/json_files/payment.json
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"id":1340404,
|
||||
"date_created":"2016-08-19T13:50:17.000-04:00",
|
||||
"date_approved":"2016-08-19T13:50:17.000-04:00",
|
||||
"date_last_updated":"2016-08-19T13:50:17.000-04:00",
|
||||
"money_release_date":null,
|
||||
"operation_type":"regular_payment",
|
||||
"issuer_id":"1",
|
||||
"payment_method_id":"visa",
|
||||
"payment_type_id":"credit_card",
|
||||
"status":"approved",
|
||||
"status_detail":"accredited",
|
||||
"currency_id":"ARS",
|
||||
"description":null,
|
||||
"live_mode":false,
|
||||
"sponsor_id":null,
|
||||
"authorization_code":null,
|
||||
"collector_id":192627424,
|
||||
"payer":{
|
||||
"type":"customer",
|
||||
"id":"204943005-G4n3trGt71WZEb",
|
||||
"email":"test_user_58666377@testuser.com",
|
||||
"identification":{
|
||||
"type":"DNI",
|
||||
"number":"1111111"
|
||||
},
|
||||
"phone":{
|
||||
"area_code":"01",
|
||||
"number":"1111-1111",
|
||||
"extension":""
|
||||
},
|
||||
"first_name":"Test",
|
||||
"last_name":"Test"
|
||||
},
|
||||
"metadata":[
|
||||
|
||||
],
|
||||
"order":[
|
||||
|
||||
],
|
||||
"external_reference":null,
|
||||
"transaction_amount":100,
|
||||
"transaction_amount_refunded":0,
|
||||
"coupon_amount":0,
|
||||
"differential_pricing_id":null,
|
||||
"deduction_schema":null,
|
||||
"transaction_details":{
|
||||
"net_received_amount":80.41,
|
||||
"total_paid_amount":100,
|
||||
"overpaid_amount":0,
|
||||
"external_resource_url":null,
|
||||
"installment_amount":100,
|
||||
"financial_institution":null,
|
||||
"payment_method_reference_id":null
|
||||
},
|
||||
"fee_details":[
|
||||
{
|
||||
"type":"mercadopago_fee",
|
||||
"amount":19.59,
|
||||
"fee_payer":"collector"
|
||||
}
|
||||
],
|
||||
"captured":true,
|
||||
"binary_mode":false,
|
||||
"call_for_authorize_id":null,
|
||||
"statement_descriptor":"WWW.MERCADOPAGO.COM",
|
||||
"installments":1,
|
||||
"card":{
|
||||
"id":"1461592544092",
|
||||
"first_six_digits":"407559",
|
||||
"last_four_digits":"3764",
|
||||
"expiration_month":3,
|
||||
"expiration_year":2018,
|
||||
"date_created":"2016-04-25T09:55:00.000-04:00",
|
||||
"date_last_updated":"2016-04-25T09:55:34.000-04:00",
|
||||
"cardholder":{
|
||||
"name":"nam",
|
||||
"identification":{
|
||||
"number":"12345678",
|
||||
"type":"DNI"
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification_url":null,
|
||||
"refunds":[
|
||||
|
||||
]
|
||||
}
|
||||
233
vendor/mercadopago/dx-php/tests/resources/PaymentTest.php
vendored
Normal file
233
vendor/mercadopago/dx-php/tests/resources/PaymentTest.php
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* EntityTest Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class PaymentTest extends TestCase
|
||||
{
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
MercadoPago\SDK::cleanCredentials();
|
||||
|
||||
if (file_exists(__DIR__ . '/../../.env')) {
|
||||
$dotenv = new Dotenv\Dotenv(__DIR__, '../../.env');
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
MercadoPago\SDK::setAccessToken(getenv('ACCESS_TOKEN'));
|
||||
MercadoPago\SDK::setMultipleCredentials(
|
||||
array(
|
||||
"MLA" => "MLA_ACCESS_TOKEN"
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function testCreateApprovedPayment()
|
||||
{
|
||||
|
||||
$payment = new MercadoPago\Payment();
|
||||
$payment->transaction_amount = 141;
|
||||
$payment->token = $this->SingleUseCardToken('approved');
|
||||
$payment->description = "Ergonomic Silk Shirt";
|
||||
$payment->installments = 1;
|
||||
$payment->payment_method_id = "master";
|
||||
$payment->payer = array(
|
||||
"email" => getenv('USER_EMAIL')
|
||||
);
|
||||
$payment->external_reference = "reftest";
|
||||
$payment->save();
|
||||
|
||||
$this->assertEquals($payment->status, 'approved');
|
||||
|
||||
return $payment;
|
||||
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @depends testCreateApprovedPayment
|
||||
// */
|
||||
// public function testRefundPayment(MercadoPago\Payment $payment_created_previously)
|
||||
// {
|
||||
|
||||
// $id = $payment_created_previously->id;
|
||||
|
||||
// $refund = new MercadoPago\Refund();
|
||||
// $refund->payment_id = $id;
|
||||
// $refund->save();
|
||||
|
||||
// sleep(15);
|
||||
|
||||
// $payment = MercadoPago\Payment::find_by_id($id);
|
||||
|
||||
// $this->assertEquals("refunded", $payment->status);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
public function testCreateAnInvalidPayment()
|
||||
{
|
||||
|
||||
$payment = new MercadoPago\Payment();
|
||||
$payment->transaction_amount = -200;
|
||||
|
||||
$payment_status = $payment->save();
|
||||
|
||||
$this->assertFalse($payment_status);
|
||||
$this->assertEquals($payment->error->causes[0]->description, "transaction_amount must be positive");
|
||||
|
||||
}
|
||||
|
||||
public function testSearchWithInvalidQueryFilters()
|
||||
{
|
||||
|
||||
$filters = array(
|
||||
"incorrect_param" => "000"
|
||||
);
|
||||
|
||||
try {
|
||||
$payments = MercadoPago\Payment::search($filters);
|
||||
} catch(Exception $e) {
|
||||
$this->assertEquals($e->getMessage(), "the attribute incorrect_param is not a possible param");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testCreatePendingPayment()
|
||||
{
|
||||
|
||||
$payment = new MercadoPago\Payment();
|
||||
$payment->transaction_amount = 141;
|
||||
$payment->token = $this->SingleUseCardToken('in_process');
|
||||
$payment->description = "Ergonomic Silk Shirt";
|
||||
$payment->installments = 1;
|
||||
$payment->payment_method_id = "master";
|
||||
$payment->payer = array(
|
||||
"email" => getenv('USER_EMAIL')
|
||||
);
|
||||
$payment->external_reference = "reftest";
|
||||
$payment->save();
|
||||
|
||||
$this->assertEquals($payment->status, 'in_process');
|
||||
|
||||
return $payment;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreatePendingPayment
|
||||
*/
|
||||
public function testFindPaymentById(MercadoPago\Payment $payment_created_previously) {
|
||||
$payment = MercadoPago\Payment::find_by_id($payment_created_previously->id);
|
||||
$this->assertEquals($payment->id, $payment_created_previously->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreatePendingPayment
|
||||
*/
|
||||
public function testFindPaymentByNonExistentId(MercadoPago\Payment $payment_created_previously) {
|
||||
$payment = MercadoPago\Payment::find_by_id("123456");
|
||||
$this->assertEquals($payment, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreatePendingPayment
|
||||
*/
|
||||
public function testPaymentsSearch(MercadoPago\Payment $payment_created_previously) {
|
||||
|
||||
$filters = array(
|
||||
"external_reference" => $payment_created_previously->external_reference
|
||||
);
|
||||
|
||||
$payments = MercadoPago\Payment::search($filters);
|
||||
$payments = $payments->getArrayCopy();
|
||||
$payment = end($payments);
|
||||
|
||||
$this->assertEquals($payment->external_reference, $payment_created_previously->external_reference);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreatePendingPayment
|
||||
*/
|
||||
public function testCancelPayment(MercadoPago\Payment $payment_created_previously) {
|
||||
$payment_created_previously->status = "cancelled";
|
||||
$payment_created_previously->update();
|
||||
|
||||
sleep(15);
|
||||
|
||||
$payment = MercadoPago\Payment::find_by_id($payment_created_previously->id);
|
||||
$this->assertEquals("cancelled", $payment->status);
|
||||
|
||||
}
|
||||
|
||||
public function testPaymentWithCustomAccessToken() {
|
||||
$payment = new MercadoPago\Payment();
|
||||
|
||||
$options = array(
|
||||
"custom_access_token" => "MLA"
|
||||
);
|
||||
|
||||
$payment_status = $payment->save($options);
|
||||
|
||||
$this->assertFalse($payment_status); // Marlformed access token error
|
||||
|
||||
$payment_status = $payment->save();
|
||||
|
||||
$this->assertFalse($payment_status);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function SingleUseCardToken($status){
|
||||
|
||||
$cards_name_for_status = array(
|
||||
"approved" => "APRO",
|
||||
"in_process" => "CONT",
|
||||
"call_for_auth" => "CALL",
|
||||
"not_founds" => "FUND",
|
||||
"expirated" => "EXPI",
|
||||
"form_error" => "FORM",
|
||||
"general_error" => "OTHE",
|
||||
);
|
||||
|
||||
$i_current_month = intval(date('m'));
|
||||
$i_current_year = intval(date('Y'));
|
||||
|
||||
$security_code = rand(111, 999);
|
||||
$expiration_month = rand($i_current_month, 12);
|
||||
$expiration_year = rand($i_current_year + 2, 2999);
|
||||
$dni = rand(11111111, 99999999);
|
||||
|
||||
$payload = array(
|
||||
"json_data" => array(
|
||||
"card_number" => "5031433215406351",
|
||||
"security_code" => (string)$security_code,
|
||||
"expiration_month" => str_pad($expiration_month, 2, '0', STR_PAD_LEFT),
|
||||
"expiration_year" => str_pad($expiration_year, 4, '0', STR_PAD_LEFT),
|
||||
"cardholder" => array(
|
||||
"name" => $cards_name_for_status[$status],
|
||||
"identification" => array(
|
||||
"type" => "DNI",
|
||||
"number" => (string)$dni
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$response = MercadoPago\SDK::post('/v1/card_tokens', $payload);
|
||||
|
||||
return $response['body']['id'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
48
vendor/mercadopago/dx-php/tests/resources/PreferenceTest.php
vendored
Normal file
48
vendor/mercadopago/dx-php/tests/resources/PreferenceTest.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* EntityTest Class Doc Comment
|
||||
*
|
||||
* @package MercadoPago
|
||||
*/
|
||||
class PreferenceTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
private static $last_preference;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (file_exists(__DIR__ . '/../../.env')) {
|
||||
$dotenv = new Dotenv\Dotenv(__DIR__, '../../.env');
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
MercadoPago\SDK::setAccessToken(getenv('ACCESS_TOKEN'));
|
||||
|
||||
}
|
||||
|
||||
public function testCreatePrefence()
|
||||
{
|
||||
|
||||
$preference = new MercadoPago\Preference();
|
||||
|
||||
# Building an item
|
||||
$item = new MercadoPago\Item();
|
||||
$item->title = "item";
|
||||
$item->quantity = 1;
|
||||
$item->unit_price = 100;
|
||||
|
||||
$preference->items = array($item);
|
||||
$preference->expiration_date_to = new DateTime('tomorrow');
|
||||
$preference->save();
|
||||
|
||||
self::$last_preference = $preference;
|
||||
|
||||
$this->assertTrue($preference->sandbox_init_point != null);
|
||||
}
|
||||
|
||||
public function testFindPreferenceById(){
|
||||
$preference = MercadoPago\Preference::find_by_id(self::$last_preference->id);
|
||||
$this->assertEquals($preference->id, self::$last_preference->id);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user