Skip to content

Commit 55c1343

Browse files
authored
Merge pull request #35 from mercadolibre/feature/PPCO-2086
Feature/ppco 2086
2 parents 1ba42d3 + 7d184df commit 55c1343

File tree

7 files changed

+38
-4
lines changed

7 files changed

+38
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mp-plugins/php-sdk",
33
"description": "Mercado Pago Plugins PHP-SDK",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"type": "library",
66
"scripts": {
77
"lint": "./vendor/bin/phpcs -q --report=checkstyle --standard=PSR2 src",

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Entity/Notification/Notification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function getHeaders(): array
177177
public function getUris(): array
178178
{
179179
return array(
180-
'get' => '/v1/bifrost/notification/status/:id',
180+
'get' => '/v1/asgard/notification/:id',
181181
);
182182
}
183183
}

src/Entity/Payment/PaymentV2.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace MercadoPago\PP\Sdk\Entity\Payment;
4+
5+
class PaymentV2 extends Payment
6+
{
7+
/**
8+
* Get uris.
9+
*
10+
* @return array
11+
*/
12+
public function getUris(): array
13+
{
14+
return array(
15+
'post' => '/v2/asgard/payments',
16+
);
17+
}
18+
}

src/Sdk.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use MercadoPago\PP\Sdk\Common\Manager;
99
use MercadoPago\PP\Sdk\Entity\Notification\Notification;
1010
use MercadoPago\PP\Sdk\Entity\Payment\Payment;
11+
use MercadoPago\PP\Sdk\Entity\Payment\PaymentV2;
1112
use MercadoPago\PP\Sdk\Entity\Preference\Preference;
1213
use MercadoPago\PP\Sdk\HttpClient\HttpClient;
1314
use MercadoPago\PP\Sdk\HttpClient\Requester\CurlRequester;
@@ -86,4 +87,12 @@ public function getPaymentInstance()
8687
{
8788
return $this->getEntityInstance('MercadoPago\PP\Sdk\Entity\Payment\Payment', Constants::BASEURL_MP);
8889
}
90+
91+
/**
92+
* @return PaymentV2
93+
*/
94+
public function getPaymentV2Instance()
95+
{
96+
return $this->getEntityInstance('MercadoPago\PP\Sdk\Entity\Payment\PaymentV2', Constants::BASEURL_MP);
97+
}
8998
}

tests/Entity/Notification/NotificationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function testReadSuccess()
8888
$this->responseMock->expects(self::any())->method('getStatus')->willReturn(200);
8989
$this->responseMock->expects(self::any())->method('getData')->willReturn($this->notificationMock);
9090

91-
$this->managerMock->expects(self::any())->method('getEntityUri')->willReturn('/bifrost/notification/status/:id');
91+
$this->managerMock->expects(self::any())->method('getEntityUri')->willReturn('/v1/asgard/notification/:id');
9292
$this->managerMock->expects(self::any())->method('getHeader')->willReturn([]);
9393
$this->managerMock->expects(self::any())->method('execute')->willReturn($this->responseMock);
9494
$this->managerMock->expects(self::any())->method('handleResponse')->willReturn($this->notificationMock);

tests/SdkTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,11 @@ function testGetPaymentSuccess()
8686

8787
$this->assertInstanceOf('MercadoPago\PP\Sdk\Entity\Payment\Payment', $actual);
8888
}
89+
90+
function testGetPaymentV2Success()
91+
{
92+
$actual = $this->sdk->getPaymentV2Instance();
93+
94+
$this->assertInstanceOf('MercadoPago\PP\Sdk\Entity\Payment\PaymentV2', $actual);
95+
}
8996
}

0 commit comments

Comments
 (0)