Skip to content

Commit

Permalink
Merge pull request #36 from mercadolibre/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
luana-ogawa authored Jun 7, 2023
2 parents 49b9ebd + 55c1343 commit f6f9a7d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mp-plugins/php-sdk",
"description": "Mercado Pago Plugins PHP-SDK",
"version": "1.0.0",
"version": "1.1.0",
"type": "library",
"scripts": {
"lint": "./vendor/bin/phpcs -q --report=checkstyle --standard=PSR2 src",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Entity/Notification/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function getHeaders(): array
public function getUris(): array
{
return array(
'get' => '/v1/bifrost/notification/status/:id',
'get' => '/v1/asgard/notification/:id',
);
}
}
18 changes: 18 additions & 0 deletions src/Entity/Payment/PaymentV2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace MercadoPago\PP\Sdk\Entity\Payment;

class PaymentV2 extends Payment
{
/**
* Get uris.
*
* @return array
*/
public function getUris(): array
{
return array(
'post' => '/v2/asgard/payments',
);
}
}
9 changes: 9 additions & 0 deletions src/Sdk.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use MercadoPago\PP\Sdk\Common\Manager;
use MercadoPago\PP\Sdk\Entity\Notification\Notification;
use MercadoPago\PP\Sdk\Entity\Payment\Payment;
use MercadoPago\PP\Sdk\Entity\Payment\PaymentV2;
use MercadoPago\PP\Sdk\Entity\Preference\Preference;
use MercadoPago\PP\Sdk\HttpClient\HttpClient;
use MercadoPago\PP\Sdk\HttpClient\Requester\CurlRequester;
Expand Down Expand Up @@ -86,4 +87,12 @@ public function getPaymentInstance()
{
return $this->getEntityInstance('MercadoPago\PP\Sdk\Entity\Payment\Payment', Constants::BASEURL_MP);
}

/**
* @return PaymentV2
*/
public function getPaymentV2Instance()
{
return $this->getEntityInstance('MercadoPago\PP\Sdk\Entity\Payment\PaymentV2', Constants::BASEURL_MP);
}
}
2 changes: 1 addition & 1 deletion tests/Entity/Notification/NotificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function testReadSuccess()
$this->responseMock->expects(self::any())->method('getStatus')->willReturn(200);
$this->responseMock->expects(self::any())->method('getData')->willReturn($this->notificationMock);

$this->managerMock->expects(self::any())->method('getEntityUri')->willReturn('/bifrost/notification/status/:id');
$this->managerMock->expects(self::any())->method('getEntityUri')->willReturn('/v1/asgard/notification/:id');
$this->managerMock->expects(self::any())->method('getHeader')->willReturn([]);
$this->managerMock->expects(self::any())->method('execute')->willReturn($this->responseMock);
$this->managerMock->expects(self::any())->method('handleResponse')->willReturn($this->notificationMock);
Expand Down
7 changes: 7 additions & 0 deletions tests/SdkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,11 @@ function testGetPaymentSuccess()

$this->assertInstanceOf('MercadoPago\PP\Sdk\Entity\Payment\Payment', $actual);
}

function testGetPaymentV2Success()
{
$actual = $this->sdk->getPaymentV2Instance();

$this->assertInstanceOf('MercadoPago\PP\Sdk\Entity\Payment\PaymentV2', $actual);
}
}

0 comments on commit f6f9a7d

Please sign in to comment.