| 676 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Srmklive\PayPal\Tests\Unit\Client;
|
|
|
4 |
|
|
|
5 |
use GuzzleHttp\Utils;
|
|
|
6 |
use PHPUnit\Framework\TestCase;
|
|
|
7 |
use Srmklive\PayPal\Tests\MockClientClasses;
|
|
|
8 |
use Srmklive\PayPal\Tests\MockResponsePayloads;
|
|
|
9 |
|
|
|
10 |
class PaymentRefundsTest extends TestCase
|
|
|
11 |
{
|
|
|
12 |
use MockClientClasses;
|
|
|
13 |
use MockResponsePayloads;
|
|
|
14 |
|
|
|
15 |
/** @test */
|
|
|
16 |
public function it_can_show_details_for_a_refund()
|
|
|
17 |
{
|
|
|
18 |
$expectedResponse = $this->mockGetRefundDetailsResponse();
|
|
|
19 |
|
|
|
20 |
$expectedEndpoint = 'https://api-m.sandbox.paypal.com/v2/payments/refunds/1JU08902781691411';
|
|
|
21 |
$expectedParams = [
|
|
|
22 |
'headers' => [
|
|
|
23 |
'Accept' => 'application/json',
|
|
|
24 |
'Accept-Language' => 'en_US',
|
|
|
25 |
'Authorization' => 'Bearer some-token',
|
|
|
26 |
],
|
|
|
27 |
];
|
|
|
28 |
|
|
|
29 |
$mockHttpClient = $this->mock_http_request(Utils::jsonEncode($expectedResponse), $expectedEndpoint, $expectedParams, 'get');
|
|
|
30 |
|
|
|
31 |
$this->assertEquals($expectedResponse, Utils::jsonDecode($mockHttpClient->get($expectedEndpoint, $expectedParams)->getBody(), true));
|
|
|
32 |
}
|
|
|
33 |
}
|