This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

168
vendor/culqi/culqi-php/.gitignore vendored Normal file
View File

@@ -0,0 +1,168 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
#added for RIA/Silverlight projects
Generated_Code
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store
.idea
vendor/*
composer.lock

11
vendor/culqi/culqi-php/.travis.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
install: composer install
script: phpunit --configuration phpunit.xml

75
vendor/culqi/culqi-php/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,75 @@
### 1.3.4 10-10-2018
* Se agrega recurso de Orders
### 1.3.3 17-03-2017
* Actualización de composer.json
### 1.3.2 15-03-2017
* Se cambia el metodo getCapture de Cargo por capture
* Corección en el composer.json.
### 1.3.1 16-02-2017
* Se corrige el metodo DELETE
* Se cambia el nombre del metodo "getList" por "all"
* Se corrige Transfers
* Se agrega el metodo update a Tokens
### 1.3.0 16-02-2017
* Se utiliza API v2.0
* Cambios en Cargos.php a Charges.php
* Cambios en Client.php
* Cambios en Culqi.php
* Cambios en Devoluciones.php a Refunds.php
* Cambios en Planes.php a Plan.php
* Cambios en Suscripciones.php a Subscriptions.php
* Se agrega Cards.php
* Se agrega Events.php
* Se agrega Iins.php
* Se agrega Customers.php
* Cambios en Tokens.php
* Cambios en /examples/
* Cambios en /tests/
### 1.2.5 16-11-2016
* Cambios en Client.php
* Cambios en /examples/
### 1.2.4 03-11-2016
* Ejemplo de Planes añadido.
### 1.2.3 08-10-2016
* Cambio en el timeout de la conexión a 120 segundos.
### 1.2.2 23-09-2016
* Cambios en los ejemplos.
* Nuevo método: setEnv() para definir entorno.
### 1.2.1 05-09-2016
* Añadidos ejemplos de "Crear Cargo" y "Crear Suscripción".
* Correcciones menores en el composer.json.
### 1.2.0 31-08-2016
* Conexión con la API v1.2.
* Reescritura completa de la biblioteca.
* Ya no usa cURL, gracias a la dependencia "Requests".
### 1.1.1 26-07-2016
* Desofuscación de la librería.
* Nuevos ejemplos
* Pequeños fixes en las rutas de los ejemplos.
### 1.1.0 15-10-2015
* Actualización de las rutas del nuevo API(v1) de Culqi.
* Nuevos parámetros de envío para la creación de una venta.
### 1.0.1 10-09-2015
* Segunda versión de la librería, mejoras en las validaciones.
### 1.0.0 17-08-2015
* Primera versión de la librería, soporta las operaciones de Anulación, Consulta, Autorización.

21
vendor/culqi/culqi-php/LICENSE.md vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 CULQI
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.

207
vendor/culqi/culqi-php/README.md vendored Normal file
View File

@@ -0,0 +1,207 @@
# Culqi PHP
[![Latest Stable Version](https://poser.pugx.org/culqi/culqi-php/v/stable)](https://packagist.org/packages/culqi/culqi-php)
[![Total Downloads](https://poser.pugx.org/culqi/culqi-php/downloads)](https://packagist.org/packages/culqi/culqi-php)
[![License](https://poser.pugx.org/culqi/culqi-php/license)](https://packagist.org/packages/culqi/culqi-php)
Biblioteca PHP oficial de CULQI, pagos simples en tu sitio web.
Esta biblioteca trabaja con la [v2.0](https://culqi.com/api/) de Culqi API.
## Requisitos
* PHP 5.3 o superiores.
* Credenciales de comercio Culqi (1).
(1) Debes registrarte [aquí](https://integ-panel.culqi.com/#/registro). Luego, crear un comercio y estando en el panel, acceder a Desarrollo > [***API Keys***](https://integ-panel.culqi.com/#/panel/comercio/desarrollo/llaves).
![alt tag](http://i.imgur.com/NhE6mS9.png)
## Instalación
### Vía Composer
```json
{
"require": {
"culqi/culqi-php": "1.3.4"
}
}
```
Y cargar todo usando el autoloader de Composer.
```php
require 'vendor/autoload.php';
```
### Manualmente
Clonarse el repositorio o bajarse el código fuente
```bash
git clone git@github.com:culqi/culqi-php.git
```
Ahora, incluir en la cabecera a `culqi-php` y también la dependencia [`Requests`](https://github.com/rmccue/requests). Debes hacer el llamado correctamente a la carpeta y/o archivo dependiendo de tu estructura.
```php
<?php
// Cargamos Requests y Culqi PHP
include_once dirname(__FILE__).'/libraries/Requests/library/Requests.php';
Requests::register_autoloader();
include_once dirname(__FILE__).'/libraries/culqi-php/lib/culqi.php';
```
## Modo de uso
En todos ejemplos, inicialmente hay que configurar la credencial `$API_KEY `
```php
// Configurar tu API Key y autenticación
$SECRET_KEY = "vk9Xjpe2YZMEOSBzEwiRcPDibnx2NlPBYsusKbDobAk";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
```
### Crear un token (Usarlo SOLO en DESARROLLO)
Antes de crear un Cargo, Plan o un Suscriptor es necesario crear un `token` de tarjeta. Dentro de esta librería se encuentra una funcionalidad para generar 'tokens', pero solo
debe ser usada para **desarrollo**. Lo recomendable es generar los 'tokens' con **CULQI.JS** cuando pases a producción, **debido a que es muy importante que los datos de tarjeta sean enviados desde el dispositivo de tus clientes directamente a los servidores de Culqi**, para no poner en riesgo información sensible.
### Crear un cargo (Cargos)
Crear un cargo significa cobrar una venta a una tarjeta. Para esto previamente
deberías obtener el `token` que refiera a la tarjeta de tu cliente.
```php
// Creamos Cargo a una tarjeta
$charge = $culqi->Charges->create(
array(
"amount" => 1000,
"capture" => true,
"currency_code" => "PEN",
"description" => "Venta de prueba",
"email" => "test@culqi.com",
"installments" => 0,
"antifraud_details" => array(
"address" => "Av. Lima 123",
"address_city" => "LIMA",
"country_code" => "PE",
"first_name" => "Will",
"last_name" => "Muro",
"phone_number" => "9889678986",
),
"source_id" => "{token_id o card_id}"
)
);
//Respuesta
print_r($charge);
```
### Crear un Plan
```php
$plan = $culqi->Plans->create(
array(
"alias" => "plan-culqi".uniqid(),
"amount" => 10000,
"currency_code" => "PEN",
"interval" => "dias",
"interval_count" => 1,
"limit" => 12,
"name" => "Plan de Prueba ".uniqid(),
"trial_days" => 15
)
);
//Respuesta
print_r($plan);
```
### Crear un Customer
```php
$customer = $culqi->Customers->create(
array(
"address" => "av lima 123",
"address_city" => "lima",
"country_code" => "PE",
"email" => "www@".uniqid()."me.com",
"first_name" => "Will",
"last_name" => "Muro",
"metadata" => array("test"=>"test"),
"phone_number" => 899898999
)
);
print_r($customer);
```
### Crear un Card
```php
$card = $culqi->Cards->create(
array(
"customer_id" => "{customer_id}",
"token_id" => "{token_id}"
)
);
print_r($card);
```
### Crear un Suscripción a un plan
```php
// Creando Suscriptor a un plan
$subscription = $culqi->Subscriptions->create(
array(
"card_id" => "{card_id}",
"plan_id" => "{plan_id}"
)
);
//Respuesta
print_r($subscription);
```
### Crear un Order
[Ver ejemplo completo](/examples/08-create-order.php)
```php
// Creando orden (con 1 dia de duracion)
$order = $culqi->Orders->create(
array(
"amount" => 1000,
"currency_code" => "PEN",
"description" => 'Venta de prueba',
"order_number" => 'pedido-9999',
"client_details" => array(
"first_name"=> "Brayan",
"last_name" => "Cruces",
"email" => "micorreo@gmail.com",
"phone_number" => "51945145222"
),
"expiration_date" => time() + 24*60*60 // Orden con un dia de validez
)
);
print_r($order);
```
## Probar ejemplos
```bash
git clone https://github.com/culqi/culqi-php.git
composer install
cd culqi-php/examples
php -S 0.0.0.0:8000
```
## Documentación
¿Necesitas más información para integrar `culqi-php`? La documentación completa se encuentra en [https://culqi.com/docs/](https://culqi.com/docs/)
## Tests
```bash
composer install
phpunit --verbose --tap tests/*
```
## Licencia
Licencia MIT. Revisar el LICENSE.md.

1
vendor/culqi/culqi-php/VERSION vendored Normal file
View File

@@ -0,0 +1 @@
1.3.4

25
vendor/culqi/culqi-php/composer.json vendored Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "culqi/culqi-php",
"description": "Cliente Culqi API para PHP",
"keywords": ["culqi", "client", "api", "peru", "php", "payments", "pagos"],
"homepage": "https://culqi.com",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Culqi and contributors",
"homepage": "https://github.com/culqi/culqi-php/contributors"
}
],
"require": {
"php": ">=5.3.3",
"rmccue/requests": ">=1.0"
},
"require-dev": {
"phpunit/phpunit": "4.4.*"
},
"autoload": {
"classmap": ["lib/Culqi/"]
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Ejemplo 1
* Como crear un token a una tarjeta Culqi PHP.
*/
try {
// Usando Composer (o puedes incluir las dependencias manualmente)
require '../vendor/autoload.php';
// Codigo de Comercio
$PUBLIC_KEY = "{PUBLIC KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $PUBLIC_KEY));
// Creando Cargo a una tarjeta
$token = $culqi->Tokens->create(
array(
"card_number" => "4111111111111111",
"cvv" => "123",
"email" => "wmuro".uniqid()."@me.com", //email must not repeated
"expiration_month" => 9,
"expiration_year" => 2020,
"fingerprint" => uniqid()
)
);
// Respuesta
echo json_encode("Token: ".$token->id);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Ejemplo 2
* Como crear un charge a una tarjeta usando Culqi PHP.
*/
try {
// Usando Composer (o puedes incluir las dependencias manualmente)
require '../vendor/autoload.php';
// Configurar tu API Key y autenticación
$SECRET_KEY = "{SECRET KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
// Creando Cargo a una tarjeta
$charge = $culqi->Charges->create(
array(
"amount" => 1000,
"capture" => true,
"currency_code" => "PEN",
"description" => "Venta de prueba",
"installments" => 0,
"email" => "test@culqi.com",
"metadata" => array("test"=>"test"),
"source_id" => "{token_id}"
)
);
// Respuesta
echo json_encode($charge);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Ejemplo 3
* Como crear un plan usando Culqi PHP.
*/
try {
// Usando Composer (o puedes incluir las dependencias manualmente)
require '../vendor/autoload.php';
// Configurar tu API Key y autenticación
$SECRET_KEY = "{SECRET KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
// Creando Cargo a una tarjeta
$plan = $culqi->Plans->create(
array(
"amount" => 10000,
"currency_code" => "PEN",
"interval" => "months",
"interval_count" => 1,
"limit" => 12,
"name" => "Plan de Prueba ".uniqid(),
"trial_days" => 15
)
);
// Respuesta
echo json_encode($plan);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,28 @@
|<?php
/**
* Ejemplo 4
* Como añadir un suscriptor a un plan específico usando Culqi PHP.
*/
try {
// Usando Composer
require '../vendor/autoload.php';
// Configurar tu API Key y autenticación
$SECRET_KEY = "{SECRET KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
// Creando Cargo a una tarjeta
$subscription = $culqi->Subscriptions->create(
array(
"card_id"=> "{card_id}",
"plan_id" => "{plan_id}"
)
);
// Respuesta
echo json_encode($subscription);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Ejemplo 5
* Como crear una devolution usando Culqi PHP.
*/
try {
// Usando Composer (o puedes incluir las dependencias manualmente)
require '../vendor/autoload.php';
// Configurar tu API Key y autenticación
$SECRET_KEY = "{SECRET KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
// Creando Cargo a una tarjeta
$refund = $culqi->Refunds->create(
array(
"amount" => 500,
"charge_id" => "{charge_id}",
"reason" => "bought an incorrect product"
)
);
// Respuesta
echo json_encode($refund);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Ejemplo 6
* Como crear un customer usando Culqi PHP.
*/
try {
// Usando Composer (o puedes incluir las dependencias manualmente)
require '../vendor/autoload.php';
// Configurar tu API Key y autenticación
$SECRET_KEY = "{SECRET KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
// Creando Cargo a una tarjeta
$customer = $culqi->Customers->create(
array(
"address" => "av lima 123",
"address_city" => "lima",
"country_code" => "PE",
"email" => "www@".uniqid()."me.com",
"first_name" => "Will",
"last_name" => "Muro",
"metadata" => array("test"=>"test"),
"phone_number" => 899898999
)
);
// Respuesta
echo json_encode($customer);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,27 @@
<?php
/**
* Ejemplo 2
* Como crear un charge a una tarjeta usando Culqi PHP.
*/
try {
// Usando Composer (o puedes incluir las dependencias manualmente)
require '../vendor/autoload.php';
// Configurar tu API Key y autenticación
$SECRET_KEY = "{SECRET KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
// Creando Cargo a una tarjeta
$card = $culqi->Cards->create(
array(
"customer_id" => "{customer_id}",
"token_id" => "{token_id}"
)
);
// Respuesta
echo json_encode($card);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Ejemplo 8
* Como crear una orden usando Culqi PHP.
*/
try {
// Usando Composer (o puedes incluir las dependencias manualmente)
require '../vendor/autoload.php';
// Configurar tu API Key y autenticación
$SECRET_KEY = "{SECRET KEY}";
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_KEY));
// Creando Cargo a una tarjeta
$order = $culqi->Orders->create(
array(
"amount" => 1000,
"currency_code" => "PEN",
"description" => 'Venta de prueba',
"order_number" => 'pedido-9999',
"client_details" => array(
"first_name"=> "Brayan",
"last_name" => "Cruces",
"email" => "micorreo@gmail.com",
"phone_number" => "51945145222"
),
"expiration_date" => time() + 24*60*60, // Orden con un dia de validez
"metadata" => array("dni" => "71702935")
)
);
// Respuesta
echo json_encode($order);
} catch (Exception $e) {
echo json_encode($e->getMessage());
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Culqi;
/**
* Class Cards
*
* @package Culqi
*/
class Cards extends Resource {
const URL_CARDS = "/cards/";
/**
* @param array|null $options
*
* @return all Cards.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_CARDS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Card response.
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_CARDS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return delete a Card response.
*/
public function delete($id = NULL) {
return $this->request("DELETE", self::URL_CARDS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
*
* @return get a Card.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_CARDS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Card response.
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_CARDS . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Culqi;
/**
* Class Charges
*
* @package Culqi
*/
class Charges extends Resource {
const URL_CHARGES = "/charges/";
/**
* @param array|null $options
*
* @return all Charges.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_CHARGES, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Charge response.
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_CHARGES, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return get a Charge.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_CHARGES . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
*
* @return get a capture of Charge.
*/
public function capture($id = NULL) {
return $this->request("POST", self::URL_CHARGES . $id . "/capture/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Charge response.
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_CHARGES . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace Culqi;
use Culqi\Error as Errors;
/**
* Class Client
*
* @package Culqi
*/
class Client {
public function request($method, $url, $api_key, $data = NULL) {
try {
$url_params = is_array($data) ? '?' . http_build_query($data) : '';
$headers= array("Authorization" => "Bearer ".$api_key, "Content-Type" => "application/json", "Accept" => "application/json");
$options = array(
'timeout' => 120
);
if($method == "GET") {
$response = \Requests::get(Culqi::BASE_URL. $url . $url_params, $headers, $options);
} else if($method == "POST") {
$response = \Requests::post(Culqi::BASE_URL . $url, $headers, json_encode($data), $options);
} else if($method == "PATCH") {
$response = \Requests::patch(Culqi::BASE_URL . $url, $headers, json_encode($data), $options);
} else if($method == "DELETE") {
$response = \Requests::delete(Culqi::BASE_URL. $url . $url_params, $headers, $options);
}
} catch (\Exception $e) {
throw new Errors\UnableToConnect();
}
if ($response->status_code >= 200 && $response->status_code <= 206) {
return json_decode($response->body);
}
if ($response->status_code == 400) {
throw new Errors\UnhandledError($response->body, $response->status_code);
}
if ($response->status_code == 401) {
throw new Errors\AuthenticationError();
}
if ($response->status_code == 404) {
throw new Errors\NotFound();
}
if ($response->status_code == 403) {
throw new Errors\InvalidApiKey();
}
if ($response->status_code == 405) {
throw new Errors\MethodNotAllowed();
}
throw new Errors\UnhandledError($response->body, $response->status_code);
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Culqi;
use Culqi\Error as Errors;
/**
* Class Culqi
*
* @package Culqi
*/
class Culqi
{
public $api_key;
/**
* La versión de API usada
*/
const API_VERSION = "v2.0";
/**
* La URL Base por defecto
*/
const BASE_URL = "https://api.culqi.com/v2";
/**
* Constructor.
*
* @param array|null $options
*
* @throws Error\InvalidApiKey
*
* @example array('api_key' => "{api_key}")
*
*/
public function __construct($options)
{
$this->api_key = $options["api_key"];
if (!$this->api_key) {
throw new Errors\InvalidApiKey();
}
$this->Tokens = new Tokens($this);
$this->Charges = new Charges($this);
$this->Subscriptions = new Subscriptions($this);
$this->Refunds = new Refunds($this);
$this->Plans = new Plans($this);
$this->Transfers = new Transfers($this);
$this->Iins = new Iins($this);
$this->Cards = new Cards($this);
$this->Events = new Events($this);
$this->Customers = new Customers($this);
$this->Orders = new Orders($this);
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Culqi;
/**
* Class Customers
*
* @package Culqi
*/
class Customers extends Resource {
const URL_CUSTOMERS = "/customers/";
/**
* @param array|null $options
*
* @return all Customers.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_CUSTOMERS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Customer response.
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_CUSTOMERS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return delete a Customer response.
*/
public function delete($id = NULL) {
return $this->request("DELETE", self::URL_CUSTOMERS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
*
* @return get a Customer.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_CUSTOMERS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Charge response.
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_CUSTOMERS . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace Culqi\Error;
/**
* Culqi Exceptions
*/
/**
* Base Culqi Exception
*/
class CulqiException extends \Exception {
protected $message = "Base Culqi Exception";
}
/**
* Input validation error
*/
namespace Culqi\Error;
class InputValidationError extends CulqiException {
protected $message = "Error de validacion en los campos";
}
/**
* Authentication error
*/
namespace Culqi\Error;
class AuthenticationError extends CulqiException {
protected $message = "Error de autenticación";
}
/**
* Resource not found
*/
namespace Culqi\Error;
class NotFound extends CulqiException {
protected $message = "Recurso no encontrado";
}
/**
* Method not allowed
*/
namespace Culqi\Error;
class MethodNotAllowed extends CulqiException {
protected $message = "Method not allowed";
}
/**
* Unhandled error
*/
namespace Culqi\Error;
class UnhandledError extends CulqiException {
protected $message = "Unhandled error";
}
/**
* Invalid API Key
*/
namespace Culqi\Error;
class InvalidApiKey extends CulqiException {
protected $message = "API Key invalido";
}
/**
* Unable to connect to Culqi API
*/
class UnableToConnect extends CulqiException {
protected $message = "Imposible conectar a Culqi API";
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Culqi;
/**
* Class Events
*
* @package Culqi
*/
class Events extends Resource {
const URL_EVENTS = "/events/";
/**
* @param array|null $options
*
* @return all Events.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_EVENTS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return get a Event.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_EVENTS . $id . "/", $api_key = $this->culqi->api_key);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Culqi;
/**
* Class Iins
*
* @package Culqi
*/
class Iins extends Resource {
const URL_IINS = "/iins/";
/**
* @param array|null $options
*
* @return all Iins.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_IINS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return get a Iin.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_IINS . $id . "/", $api_key = $this->culqi->api_key);
}
}

View File

@@ -0,0 +1,2 @@
<?php
namespace Culqi\Lang\messages;

View File

@@ -0,0 +1,2 @@
<?php
namespace Culqi\Lang\messages;

View File

@@ -0,0 +1,70 @@
<?php
namespace Culqi;
/**
* Class Orders
*
* @package Culqi
*/
class Orders extends Resource {
const URL_ORDERS = "/orders/";
/**
* @param array|null $options
*
* @return Get all Orders
*/
public function all($options) {
return $this->request("GET", self::URL_ORDERS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Order
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_ORDERS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return confirm Order
*/
public function confirm($id = NULL) {
return $this->request("POST", self::URL_ORDERS . $id . "/confirm/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
*
* @return get a Order
*/
public function get($id) {
return $this->request("GET", self::URL_ORDERS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
*
* @return delete a Order
*/
public function delete($id) {
return $this->request("DELETE", self::URL_ORDERS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Order
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_ORDERS . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Culqi;
/**
* Class Plans
*
* @package Culqi
*/
class Plans extends Resource {
const URL_PLANS = "/plans/";
/**
* @param array|null $options
*
* @return all Plans.
*/
public function all($options) {
return $this->request("GET", self::URL_PLANS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Plan response.
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_PLANS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return get a Plan.
*/
public function get($id) {
return $this->request("GET", self::URL_PLANS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
*
* @return delete a Plan.
*/
public function delete($id) {
return $this->request("DELETE", self::URL_PLANS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Plan response.
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_PLANS . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace Culqi;
/**
* Class Plans
*
* @package Culqi
*/
class Refunds extends Resource {
const URL_REFUNDS = "/refunds/";
/**
* @param array|null $options
*
* @return all Refunds.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_REFUNDS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Refund response.
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_REFUNDS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return get a Refund.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_REFUNDS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Refund response.
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_REFUNDS . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Culqi;
/**
* Class Resource
*
* @package Culqi
*/
class Resource extends Client {
/**
* Constructor.
*/
public function __construct($culqi)
{
$this->culqi = $culqi;
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Culqi;
/**
* Class Subscriptions
*
* @package Culqi
*/
class Subscriptions extends Resource {
const URL_SUBSCRIPTIONS = "/subscriptions/";
/**
* @param array|null $options
*
* @return all Subscriptions.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_SUBSCRIPTIONS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Subscription response.
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_SUBSCRIPTIONS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return delete a Subscription response.
*/
public function delete($id = NULL) {
return $this->request("DELETE", self::URL_SUBSCRIPTIONS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
*
* @return get a Subscription.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_SUBSCRIPTIONS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Subscription response.
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_SUBSCRIPTIONS . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace Culqi;
/**
* Class Tokens
*
* @package Culqi
*/
class Tokens extends Resource {
const URL_TOKENS = "/tokens/";
/**
* @param array|string|null $options
*
* @return all Tokens.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_TOKENS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param array|null $options
*
* @return create Token response.
*/
public function create($options = NULL) {
return $this->request("POST", self::URL_TOKENS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return get a Token.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_TOKENS . $id . "/", $api_key = $this->culqi->api_key);
}
/**
* @param string|null $id
* @param array|null $options
*
* @return update Token response.
*/
public function update($id = NULL, $options = NULL) {
return $this->request("PATCH", self::URL_TOKENS . $id . "/", $api_key = $this->culqi->api_key, $options);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Culqi;
/**
* Class Transfers
*
* @package Culqi
*/
class Transfers extends Resource {
const URL_TRANSFERS = "/transfers/";
/**
* @param array|null $options
*
* @return all Transfers.
*/
public function all($options = NULL) {
return $this->request("GET", self::URL_TRANSFERS, $api_key = $this->culqi->api_key, $options);
}
/**
* @param string|null $id
*
* @return get a Transfers.
*/
public function get($id = NULL) {
return $this->request("GET", self::URL_TRANSFERS . $id . "/", $api_key = $this->culqi->api_key);
}
}

32
vendor/culqi/culqi-php/lib/culqi.php vendored Normal file
View File

@@ -0,0 +1,32 @@
<?php
/**
* CULQI PHP SDK
*
* Init, cargamos todos los archivos necesarios
*
* @version 1.3.0
* @package Culqi
* @copyright Copyright (c) 2015-2017 Culqi
* @license MIT
* @license https://opensource.org/licenses/MIT MIT License
* @link https://developers.culqi.com/ Culqi Developers
*/
// Errors
include_once dirname(__FILE__).'/Culqi/Error/Errors.php';
include_once dirname(__FILE__).'/Culqi/Client.php';
include_once dirname(__FILE__).'/Culqi/Resource.php';
// Culqi API
include_once dirname(__FILE__).'/Culqi/Transfers.php';
include_once dirname(__FILE__).'/Culqi/Cards.php';
include_once dirname(__FILE__).'/Culqi/Events.php';
include_once dirname(__FILE__).'/Culqi/Customers.php';
include_once dirname(__FILE__).'/Culqi/Tokens.php';
include_once dirname(__FILE__).'/Culqi/Charges.php';
include_once dirname(__FILE__).'/Culqi/Refunds.php';
include_once dirname(__FILE__).'/Culqi/Subscriptions.php';
include_once dirname(__FILE__).'/Culqi/Plans.php';
include_once dirname(__FILE__).'/Culqi/Iins.php';
include_once dirname(__FILE__).'/Culqi/Orders.php';
include_once dirname(__FILE__).'/Culqi/Culqi.php';

12
vendor/culqi/culqi-php/phpunit.xml vendored Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="tests/TestAutoLoad.php">
<testsuites>
<testsuite name="Culqi PHP Tests">
<directory suffix="Test.php">tests</directory>
<file>Test.php</file>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="true"/>
</php>
</phpunit>

View File

@@ -0,0 +1,61 @@
<?php
require_once('TestAutoLoad.php');
use Culqi\Culqi;
class CaptureTest extends PHPUnit_Framework_TestCase {
protected $API_KEY;
protected $PUBLIC_API_KEY;
protected function setUp() {
$this->PUBLIC_API_KEY = getenv("PUBLIC_API_KEY");
$this->API_KEY = getenv("API_KEY");
$this->culqi_token = new Culqi(array("api_key" => $this->PUBLIC_API_KEY ));
$this->culqi = new Culqi(array("api_key" => $this->API_KEY ));
}
protected function createToken() {
$token = $this->culqi_token->Tokens->create(
array(
"card_number" => "4111111111111111",
"cvv" => "123",
"email" => "wmuro".uniqid()."@me.com",
"expiration_month" => 9,
"expiration_year" => 2020,
"fingerprint" => "q352454534"
)
);
return $token;
}
public function testVerifyToken() {
$this->assertEquals('token', $this->createToken()->object);
}
public function createCharge() {
$charge = $this->culqi->Charges->create(
array(
"amount" => 1000,
"capture" => false,
"currency_code" => "PEN",
"description" => "Venta de prueba",
"email" => "test@culqi.com",
"installments" => 0,
"source_id" => $this->createToken()->id
)
);
return $charge;
}
public function testCreateCharge() {
$this->assertEquals('charge', $this->createCharge()->object);
}
public function testCaptureCharge() {
$captureCharge = $this->culqi->Charges->capture($this->createCharge()->id);
$this->assertEquals('charge', $captureCharge->object);
}
}

View File

@@ -0,0 +1,105 @@
<?php
require_once('TestAutoLoad.php');
use Culqi\Culqi;
class DeleteTest extends PHPUnit_Framework_TestCase
{
protected $API_KEY;
protected $PUBLIC_API_KEY;
protected function setUp() {
$this->PUBLIC_API_KEY = getenv("PUBLIC_API_KEY");
$this->API_KEY = getenv("API_KEY");
$this->culqi_token = new Culqi(array("api_key" => $this->PUBLIC_API_KEY ));
$this->culqi = new Culqi(array("api_key" => $this->API_KEY ));
}
protected function createToken() {
$token = $this->culqi_token->Tokens->create(
array(
"card_number" => "4111111111111111",
"cvv" => "123",
"email" => "wmuro".uniqid()."@me.com",
"expiration_month" => 9,
"expiration_year" => 2020,
"fingerprint" => "q352454534"
)
);
return $token;
}
public function createCustomer() {
$customer = $this->culqi->Customers->create(
array(
"address" => "av lima 123",
"address_city" => "lima",
"country_code" => "PE",
"email" => "www@".uniqid()."me.com",
"first_name" => "Will",
"last_name" => "Muro",
"metadata" => array("test"=>"test"),
"phone_number" => 899898999
)
);
return $customer;
}
public function createCard() {
$card = $this->culqi->Cards->create(
array(
"customer_id" => $this->createCustomer()->id,
"token_id" => $this->createToken()->id
)
);
return $card;
}
public function createPlan() {
$plan = $this->culqi->Plans->create(
array(
"amount" => 10000,
"currency_code" => "PEN",
"interval" => "dias",
"interval_count" => 1,
"limit" => 12,
"name" => "plan-culqi".uniqid(),
"trial_days" => 15
)
);
return $plan;
}
public function createSubscription() {
$subscription = $this->culqi->Subscriptions->create(
array(
"card_id" => $this->createCard()->id,
"plan_id" => $this->createPlan()->id
)
);
return $subscription;
}
public function testDeleteSubscription() {
$subscriptionDeleted = $this->culqi->Subscriptions->delete($this->createSubscription()->id);
$this->assertTrue($subscriptionDeleted->deleted);
}
public function testDeletePlan() {
$planDeleted = $this->culqi->Plans->delete($this->createPlan()->id);
$this->assertTrue($planDeleted->deleted);
}
public function testDeleteCard() {
$cardDeleted = $this->culqi->Cards->delete($this->createCard()->id);
$this->assertTrue($cardDeleted->deleted);
}
public function testDeleteCustomer() {
$customerDeleted = $this->culqi->Customers->delete($this->createCustomer()->id);
$this->assertTrue($customerDeleted->deleted);
}
}

View File

@@ -0,0 +1,88 @@
<?php
require_once('TestAutoLoad.php');
use Culqi\Culqi;
class ListTest extends PHPUnit_Framework_TestCase {
protected $API_KEY;
protected function setUp() {
$this->API_KEY = getenv("API_KEY");
$this->culqi = new Culqi(array("api_key" => $this->API_KEY ));
}
public function testListTokens() {
$tokens = $this->culqi->Tokens->all(array("limit" => 50));
$valid = false;
if(count($tokens->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
public function testListCharges() {
$charges = $this->culqi->Charges->all(array("min_amount" => 1000, "max_amount" => 1000000, "limit" => 50));
$valid = false;
if(count($charges->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
public function testListPlans() {
$plans = $this->culqi->Plans->all(array("limit" => 50));
$valid = false;
if(count($plans->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
public function testListCustomers() {
$customers = $this->culqi->Customers->all(array("limit" => 50));
$valid = false;
if(count($customers->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
public function testListCards() {
$cards = $this->culqi->Cards->all(array("limit" => 50));
$valid = false;
if(count($cards->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
public function testListSubscriptions() {
$subscriptions = $this->culqi->Subscriptions->all(array("limit" => 50));
$valid = false;
if(count($subscriptions->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
public function testListRefunds() {
$refunds = $this->culqi->Refunds->all(array("limit" => 50));
$valid = false;
if(count($refunds->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
public function testListTransfers() {
$transfers = $this->culqi->Transfers->all(array("limit" => 50));
$valid = false;
if(count($transfers->data) >= 0) {
$valid = true;
}
$this->assertTrue($valid);
}
}

189
vendor/culqi/culqi-php/tests/Test.php vendored Normal file
View File

@@ -0,0 +1,189 @@
<?php
require_once('TestAutoLoad.php');
use Culqi\Culqi;
/**
* Test Create
*/
class Test extends PHPUnit_Framework_TestCase {
protected $API_KEY;
protected $PUBLIC_API_KEY;
protected function setUp() {
$this->PUBLIC_API_KEY = getenv("PUBLIC_API_KEY");
$this->API_KEY = getenv("API_KEY");
$this->culqi_token = new Culqi(array("api_key" => $this->PUBLIC_API_KEY ));
$this->culqi = new Culqi(array("api_key" => $this->API_KEY ));
}
public function testValidIins() {
$iin = $this->culqi_token->Iins->get("411111");
$this->assertEquals('iin', $iin->object);
}
/**
* Creación de un token con los datos de una tarjeta de prueba
*/
protected function createToken() {
$token = $this->culqi_token->Tokens->create(
array(
"card_number" => "4111111111111111",
"cvv" => "123",
"email" => "wmuro".uniqid()."@me.com",
"expiration_month" => 9,
"expiration_year" => 2020,
"fingerprint" => "q352454534"
)
);
return $token;
}
/**
* Verificar creación de Token
*/
public function testVerifyToken() {
$this->assertEquals('token', $this->createToken()->object);
}
public function testFindToken() {
$token = $this->culqi->Tokens->get($this->createToken()->id);
$this->assertEquals('token', $token->object);
}
public function createCharge() {
$charge = $this->culqi->Charges->create(
array(
"amount" => 1000,
"capture" => true,
"currency_code" => "PEN",
"description" => "Venta de prueba",
"email" => "test@culqi.com",
"installments" => 0,
"source_id" => $this->createToken()->id
)
);
return $charge;
}
public function testCreateCharge() {
// Verificacion del campo object no tenga el valor 'error'
$this->assertEquals('charge', $this->createCharge()->object);
}
public function testFindCharge() {
$charge = $this->culqi->Charges->get($this->createCharge()->id);
$this->assertEquals('charge', $charge->object);
}
public function createPlan() {
$plan = $this->culqi->Plans->create(
array(
"amount" => 10000,
"currency_code" => "PEN",
"interval" => "dias",
"interval_count" => 1,
"limit" => 12,
"name" => "plan-culqi".uniqid(),
"trial_days" => 15
)
);
return $plan;
}
public function testCreatePlan() {
// Verificacion del campo object no tenga el valor 'error'
$this->assertEquals('plan', $this->createPlan()->object);
}
public function testFindPlan() {
$plan = $this->culqi->Plans->get($this->createPlan()->id);
$this->assertEquals('plan', $plan->object);
}
public function createCustomer() {
$customer = $this->culqi->Customers->create(
array(
"address" => "av lima 123",
"address_city" => "lima",
"country_code" => "PE",
"email" => "www@".uniqid()."me.com",
"first_name" => "Will",
"last_name" => "Muro",
"metadata" => array("test"=>"test"),
"phone_number" => 899898999
)
);
return $customer;
}
public function testCreateCustomer() {
$this->assertEquals('customer', $this->createCustomer()->object);
}
public function testFindCustomer() {
$customer = $this->culqi->Customers->get($this->createCustomer()->id);
$this->assertEquals('customer', $customer->object);
}
public function createCard() {
$card = $this->culqi->Cards->create(
array(
"customer_id" => $this->createCustomer()->id,
"token_id" => $this->createToken()->id
)
);
return $card;
}
public function testCreateCard() {
$this->assertEquals('card', $this->createCard()->object);
}
public function testFindCard() {
$card = $this->culqi->Cards->get($this->createCard()->id);
$this->assertEquals('card', $card->object);
}
public function createSubscription() {
$subscription = $this->culqi->Subscriptions->create(
array(
"card_id" => $this->createCard()->id,
"plan_id" => $this->createPlan()->id
)
);
return $subscription;
}
public function testCreateSubscription() {
$this->assertEquals('subscription',$this->createSubscription()->object);
}
public function testFindSubscription() {
$subscription = $this->culqi->Subscriptions->get($this->createSubscription()->id);
$this->assertEquals('subscription', $subscription->object);
}
public function createRefund() {
$refund = $this->culqi->Refunds->create(
array(
"amount" => 500,
"charge_id" => $this->createCharge()->id,
"reason" => "solicitud_comprador"
)
);
return $refund;
}
public function testCreateRefund() {
$this->assertEquals('refund',$this->createRefund()->object);
}
public function testFindRefund() {
$refund = $this->culqi->Refunds->get($this->createRefund()->id);
$this->assertEquals('refund',$refund->object);
}
}

View File

@@ -0,0 +1,4 @@
<?php
require_once(__DIR__.'/../vendor/autoload.php');
require_once(__DIR__.'/../lib/culqi.php');

View File

@@ -0,0 +1,29 @@
<?php
require_once('TestAutoLoad.php');
use Culqi\Culqi;
/**
* Test Patch
*/
class TestPatch extends PHPUnit_Framework_TestCase
{
protected $API_KEY;
protected function setUp() {
$this->API_KEY = getenv("API_KEY");
$this->culqi = new Culqi(array("api_key" => $this->API_KEY ));
}
public function testUpdatePlan() {
$plan = $this->culqi->Plans->update("pln_test_pLFzcWkwj33xFGF1",
array(
"metadata" => array(
"test" => "test555"
)
)
);
$this->assertEquals('plan', $plan->object);
}
}