-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Merge remote-tracking branch 'origin/f/orders'""
This reverts commit 394603a.
- Loading branch information
Brayan Cruces
committed
Oct 10, 2018
1 parent
426087b
commit fe7e274
Showing
8 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
### 1.3.4 10-10-2018 | ||
* Se agrega recurso de Orders | ||
|
||
### 1.3.3 17-03-2017 | ||
* Actualización de composer.json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.3.3 | ||
1.3.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters