Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 49 additions & 11 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ $customer = $epayco->customer->get("id_client");
#### List

```php
$customer = $epayco->customer->getList();
$customer = $epayco->customer->getList([
"page"=>6,
"perPage"=>10
]);
```

#### Update
Expand Down Expand Up @@ -137,7 +140,20 @@ $plan = $epayco->plan->create(array(
"currency" => "cop",
"interval" => "month",
"interval_count" => 1,
"trial_days" => 30
"trial_days" => 30,
"ip" => "127.0.0.1",
"iva" => 5700,
"ico" => 0,
"planLink" => "https://github.com/epayco",
"greetMessage" => "discounted react and redux course",
"linkExpirationDate" => "2025-03-11",
"subscriptionLimit"=> 10, #Subscription limit between 0 and 10000
"imgUrl"=>"https://epayco.com/wp-content/uploads/2023/04/logo-blanco.svg",
"discountValue"=>5000, #discount value
"discountPercentage"=>19, #discount percentage
"transactionalLimit"=> 2, #transactional Limit
"additionalChargePercentage"=>0.0, #Additional charge percentage limit
"firstPaymentAdditionalCost"=>45700 #Installation Cost
));
```

Expand All @@ -153,6 +169,26 @@ $plan = $epayco->plan->get("coursereact");
$plan = $epayco->plan->getList();
```

#### Upadte

```php
$plan = $epayco->plan->update("coursereact",array(
"name" => "Course react js",
"description" => "Course react and redux",
"amount" => 35700,
"currency" => "cop",
"interval" => "month",
"interval_count" => 1,
"trial_days" => 30,
"ip"=> "127.0.0.1",
"iva" => 1900,
"ico" => 0,
"transactionalLimit"=> 3,
"additionalChargePercentage"=>0.0,
"afterPayment"=>"message after paying"
));
```

#### Remove

```php
Expand Down Expand Up @@ -400,15 +436,17 @@ $pay = $epayco->charge->create(array(
"cell_phone"=> "3010000001",
"ip" => "190.000.000.000", // This is the client's IP, it is required
"url_response" => "https://tudominio.com/respuesta.php",
"url_confirmation" => "https://tudominio.com/confirmacion.php",\
"method_confirmation" => "GET".
"use_default_card_customer" => true,/*if the user wants to be charged with the card that the customer currently has as default = true*/
//Los parámetros extras deben ser enviados tipo string, si se envía tipo array generara error.
"extra1" => "data 1",
"extra2" => "data 2",
"extra3" => "data 3",
"extra4" => "data 4",
"extra5" => "data 5"
"url_confirmation" => "https://tudominio.com/confirmacion.php",
"method_confirmation" => "GET",
"use_default_card_customer" => true, // if the user wants to be charged with the card that the customer currently has as default = true
// Los parámetros "extras" deben ser enviados como cadenas de texto (string). Aunque se agrupen dentro de un array, cada parámetro individual debe ser un string. Si se envían como otro tipo de datos, como arrays anidados, se generará un error.
"extras"=> array(
"extra1" => "data 1",
"extra2" => "data 2",
"extra3" => "data 3",
"extra4" => "data 4",
"extra5" => "data 5"
)
));
```

Expand Down
Empty file modified composer.json
100644 → 100755
Empty file.
Empty file modified phpunit.xml
100644 → 100755
Empty file.
57 changes: 29 additions & 28 deletions src/Client.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public function request(
* Resources ip, traslate keys
*/
$util = new Util();
if(!isset($data['extras_epayco'])){
if(!is_null($data) && is_array($data) && !isset($data['extras_epayco'])){
$data['extras_epayco']= array();
$data['extras_epayco'] = ["extra5" => "P42"];
}
/**
Expand All @@ -65,32 +66,32 @@ public function request(
/**
* Set heaToken bearer
*/
$cookie_name = $api_key . ($apify ? "_apify" : "");
if(!isset($_COOKIE[$cookie_name])) {
// echo "Cookie named '" . $cookie_name . "' is not set!";
$dataAuth =$this->authentication($api_key,$private_key, $apify);
$json = json_decode($dataAuth);
if(!is_object($json)) {
throw new ErrorException("Error get bearer_token.", 106);
}
$bearer_token = false;
if(isset($json->bearer_token)) {
$bearer_token=$json->bearer_token;
}else if(isset($json->token)){
$bearer_token= $json->token;
}
if(!$bearer_token) {
$msj = isset($json->message) ? $json->message : "Error get bearer_token";
if($msj == "Error get bearer_token" && isset($json->error)){
$msj = $json->error;
}
throw new ErrorException($msj, 422);
}
$cookie_value = $bearer_token;
setcookie($cookie_name, $cookie_value, time() + (60 * 14), "/");
// echo "token con login".$bearer_token;
}else{

$cookie_name = $api_key . ($apify ? "_apify" : "");
if(!isset($_COOKIE[$cookie_name])) {
// echo "Cookie named '" . $cookie_name . "' is not set!";
$dataAuth =$this->authentication($api_key,$private_key, $apify);
$json = json_decode($dataAuth);
if(!is_object($json)) {
throw new ErrorException("Error get bearer_token.", 106);
}
$bearer_token = false;
if(isset($json->bearer_token)) {
$bearer_token=$json->bearer_token;
}else if(isset($json->token)){
$bearer_token= $json->token;
}
if(!$bearer_token) {
$msj = isset($json->message) ? $json->message : "Error get bearer_token";
if($msj == "Error get bearer_token" && isset($json->error)){
$msj = $json->error;
}
throw new ErrorException($msj, 422);
}
$cookie_value = $bearer_token;
setcookie($cookie_name, $cookie_value, time() + (60 * 14), "/");
// echo "token con login".$bearer_token;
}else{
$bearer_token = $_COOKIE[$cookie_name];
}

Expand Down Expand Up @@ -220,7 +221,7 @@ public function graphql(
}

public function authentication($api_key, $private_key, $apify)
{
{
$data = array(
'public_key' => $api_key,
'private_key' => $private_key
Expand Down
Empty file modified src/Epayco.php
100644 → 100755
Empty file.
Empty file modified src/EpaycoException.php
100644 → 100755
Empty file.
Empty file modified src/Exceptions/ErrorException.php
100644 → 100755
Empty file.
Empty file modified src/GraphqlClient.php
100644 → 100755
Empty file.
Empty file modified src/Resource.php
100644 → 100755
Empty file.
Empty file modified src/Resources/Bank.php
100644 → 100755
Empty file.
Empty file modified src/Resources/Cash.php
100644 → 100755
Empty file.
Empty file modified src/Resources/Charge.php
100644 → 100755
Empty file.
10 changes: 6 additions & 4 deletions src/Resources/Customers.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ public function get($uid)
* Get list customer from client epayco
* @return object
*/
public function getList()
public function getList($options = null)
{
$path= isset($options) ? "?page=".$options['page']."&perPage=".$options['perPage']:"";
$url = "/payment/v1/customers".$path;
return $this->request(
"GET",
"/payment/v1/customers/" . $this->epayco->api_key,
$url,
$api_key = $this->epayco->api_key,
$options = null,
$options,
$private_key = $this->epayco->private_key,
$test = $this->epayco->test,
$switch = false,
Expand Down Expand Up @@ -151,4 +153,4 @@ public function query($query,$type,$custom_key = null){

return $this->graphql($query,'customer',$this->epayco->api_key,$type,$custom_key);
}
}
}
Empty file modified src/Resources/Daviplata.php
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/Resources/Plan.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function update($uid, $options = null)
{
return $this->request(
"POST",
"/recurring/v1/plan/edit/" . $this->epayco->api_key . "/" . $uid . "/",
"/recurring/v1/plan/edit/" . $uid,
$api_key = $this->epayco->api_key,
$options,
$private_key = $this->epayco->private_key,
Expand Down
Empty file modified src/Resources/Safetypay.php
100644 → 100755
Empty file.
Empty file modified src/Resources/Subscriptions.php
100644 → 100755
Empty file.
Empty file modified src/Resources/Token.php
100644 → 100755
Empty file.
Empty file modified src/Util.php
100644 → 100755
Empty file.
Empty file modified src/Utils/McryptEncrypt.php
100644 → 100755
Empty file.
Empty file modified src/Utils/OpensslEncrypt.php
100644 → 100755
Empty file.
Empty file modified src/Utils/PaycoAes.php
100644 → 100755
Empty file.
Empty file modified src/Utils/key_lang.json
100644 → 100755
Empty file.
Empty file modified src/Utils/key_lang_apify.json
100644 → 100755
Empty file.
Empty file modified tests/test.php
100644 → 100755
Empty file.