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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
],
"require": {
"php": "^5.5|>=7.0.8",
"php-http/client-common": "^1.6",
"php-http/client-common": "^2.0",
"php-http/discovery": "^1.3"
},
"require-dev": {
"phpunit/phpunit": "<6.0",
"php-http/mock-client": "^1.0",
"guzzlehttp/psr7": "^1.0",
"php-http/guzzle6-adapter": "^1.1"
"php-http/guzzle7-adapter": "^1.0"
},
"suggest": {
"guzzlehttp/guzzle": "Implements a required PSR-7 Http client"
Expand Down
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ public function getTemplate($locale = null)
*
* @throws ErrorException
*/
public function createPayment($customerExtId, $amount, $description, $service, $extraData = [])
public function createPayment($customerExtId, $amount, $description, $service, $url_post = null, $extraData = [])
{
$request = $this
->apiRequestFactory
->createPaymentRequest($customerExtId, $amount, $description, $this->getOperative(), $service, $extraData);
->createPaymentRequest($customerExtId, $amount, $description, $this->getOperative(), $service, $url_post, $extraData);

return $this->send($request);
}
Expand Down
4 changes: 3 additions & 1 deletion src/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public function retrieveCustomerCards($customerExtId, $status, $unique);
*
* @return array
*/
public function createPayment($customerExtId, $amount, $description, $service, $extraData = []);
public function createPayment($customerExtId, $amount, $description, $service, $url_post = null, $extraData = []);



/**
* Requests Paylands API to pay a previously created order.
Expand Down
3 changes: 2 additions & 1 deletion src/RequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ public function setRequestFactory(HttpRequestFactory $requestFactory = null)
*
* @return RequestInterface
*/
public function createPaymentRequest($customerExtId, $amount, $description, $operative, $service, $extraData = [])
public function createPaymentRequest($customerExtId, $amount, $description, $operative, $service, $url_post = null, $extraData = [])
{
$data = [
'customer_ext_id' => (string) $customerExtId,
'amount' => $amount,
'operative' => $operative,
'service' => $service,
'description' => $description,
'url_post' => $url_post,
];

if (!empty($extraData)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/ClientCreatePaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testCreatePayment()
'Test payment order',
$this->apiPaymentServiceId
);

var_dump($payment);
$this->assertSame('OK', $payment['message']);
$this->assertSame(200, $payment['code']);
$this->assertFalse($payment['order']['paid']);
Expand Down
11 changes: 10 additions & 1 deletion tests/Unit/ClientFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,21 @@ public function tryCreteApiClient()
$apiClientFactory = new ClientFactoryTestClass(
$this->prophesize(RequestFactory::class)->reveal(), $this->prophesize(DiscoveryProxy::class)->reveal(), 'api-key', 'api-url'
);
$uriMock = $this->prophesize(UriInterface::class);
$uriMock
->getPath()
->shouldBeCalled()
->willReturn("api-url");
$uriMock
->getHost()
->shouldBeCalled()
->willReturn("host");

$uriFactoryMock = $this->prophesize(UriFactory::class);
$uriFactoryMock
->createUri('api-url')
->shouldBeCalled()
->willReturn($this->prophesize(UriInterface::class)->reveal());
->willReturn($uriMock->reveal());

$httpClientMock = $this->prophesize(Client::class);

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/RequestFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function tryCreatePaymentRequest()
$data['body']['amount'],
$data['body']['description'],
$data['body']['operative'],
$data['body']['service']
$data['body']['service'],
);

$this->assertSame($request, $requestMock->reveal());
Expand Down