Skip to content

Commit

Permalink
Add ip functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeison Caro authored and Jeison Caro committed Jul 30, 2019
1 parent 0d6df6b commit 16d577b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Expand Up @@ -80,7 +80,7 @@ public function request(
$data = $util->mergeSet($data, $test, $lang, $private_key, $api_key);
$response = \Requests::post(Client::BASE_URL_SECURE . $url, $headers, json_encode($data), $options);
} else {
$data["ip"] = getHostByName(getHostName());
$data["ip"] = isset($data["ip"]) ? $data["ip"] : getHostByName(getHostName());
$data["test"] = $test;
$response = \Requests::post(Client::BASE_URL . $url, $headers, json_encode($data), $options);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Util.php
Expand Up @@ -23,7 +23,7 @@ public function setKeys($array)

public function mergeSet($data, $test, $lang, $private_key, $api_key)
{
$data["ip"] = getHostByName(getHostName());
$data["ip"] = isset($data["ip"]) ? $data["ip"] : getHostByName(getHostName());
$data["test"] = $test;

/**
Expand Down
27 changes: 25 additions & 2 deletions tests/test.php
Expand Up @@ -201,8 +201,31 @@ public function testPseCreate()
$this->assertGreaterThanOrEqual(1, count($response));
}



public function testCashCreate()
{
$end_date = (new \DateTime())->add((new \DateInterval('P1D')))->format('Y-m-d H:i');
$response = $this->epayco->cash->create("efecty", array(
"invoice" => "1472050778",
"description" => "pay test",
"value" => "20000",
"tax" => "0",
"tax_base" => "0",
"currency" => "COP",
"type_person" => "0",
"doc_type" => "CC",
"doc_number" => "12344545",
"name" => "testing",
"last_name" => "PAYCO",
"email" => "test@test.com",
"cell_phone" => "3010000001",
"end_date" => $end_date,
"url_response" => "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
"url_confirmation" => "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
"method_confirmation" => "GET",
));
$this->assertGreaterThanOrEqual(1, count($response));
}

public function testPsebanks()
{
$response = $this->epayco->bank->pseBank();
Expand Down

0 comments on commit 16d577b

Please sign in to comment.