Skip to content

Commit

Permalink
feat(core): release v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
m.vela committed Oct 17, 2019
1 parent 079ddeb commit 8a5449f
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 10 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"name": "payvision/payvision-sdk-php",
"description": "Payvision PHP SDK",
"type": "library",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",
"require": {
"php": "^7.0.13|^7.1",
"ext-simplexml": "*",
"ext-json": "*",
"ext-curl": "*",
"guzzlehttp/guzzle": "^6.3",
"firebase/php-jwt": "^5.0"
},
Expand Down
3 changes: 3 additions & 0 deletions src/Application/Request/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class Builder
{
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
* @param object $object
* @return array
* @throws ReflectionException
Expand All @@ -28,6 +29,7 @@ public static function toArray($object): array
}

/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
* @param object $object
* @return array
* @throws ReflectionException
Expand Down Expand Up @@ -61,6 +63,7 @@ private static function reflectObject($object): array
}

/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
* @param string $methodName
* @param object $object
* @return mixed|null
Expand Down
1 change: 1 addition & 0 deletions src/Domain/Service/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
interface Builder
{
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
* @return object
*/
public function build();
Expand Down
2 changes: 2 additions & 0 deletions src/Domain/Service/Builder/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function __construct()
}

/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
* @return object
*/
final protected function buildAndReset()
Expand Down Expand Up @@ -87,6 +88,7 @@ protected function validateRequiredProperties(array $properties)
}

/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
* @return object
*/
abstract protected function buildObject();
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/Api/ErrorResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ErrorResponse extends ApiException
/**
* ErrorResponse constructor.
*
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
* @param object $errorResponse
* @param string $message
* @param int $code
Expand All @@ -39,6 +40,7 @@ public function __construct(
}

/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
* @return object
*/
public function getErrorResponse()
Expand Down
30 changes: 23 additions & 7 deletions src/Infrastructure/ApiConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ private function get(Request $request): array
{
$guzzleResponse = $this->client->get(
$request->getUri(),
[
'query' => $request->getPathParams(),
]
$this->buildRequestArray($request)
);

$this->lastJsonRequest = $request->getPathParams();
Expand Down Expand Up @@ -142,10 +140,7 @@ private function post(Request $request): array
$jsonRequest = $this->prepareJsonRequest($request);
$guzzleResponse = $this->client->post(
$request->getUri(),
[
'json' => $jsonRequest,
'query' => $request->getPathParams(),
]
$this->buildRequestArray($request, $jsonRequest)
);

$this->lastJsonRequest = $jsonRequest;
Expand Down Expand Up @@ -289,4 +284,25 @@ private function prepareJsonRequest(Request $request): array

return $jsonRequest;
}

/**
* @param Request $request
* @param array $jsonRequest
* @return array
*/
private function buildRequestArray(Request $request, array $jsonRequest = null): array
{
$returnValue = [
'query' => $request->getPathParams(),
'curl' => [
\CURLOPT_SSL_CIPHER_LIST => 'DEFAULT@SECLEVEL=1',
],
];

if ($jsonRequest !== null) {
$returnValue['json'] = $jsonRequest;
}

return $returnValue;
}
}
4 changes: 2 additions & 2 deletions tests/Test/Unit/Application/Request/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ protected function setUp()
*/
public function testBasicReflection()
{
$card = new PaymentRequestCard('001', 10, 2020, 'ISAAC', '123', '456');
$card = new PaymentRequestCard('001', 10, 2020, 'Foo', '123', '456');
$result = Builder::toArray($card);
$this->assertEquals([
'cvv' => '001',
'expiryMonth' => '10',
'expiryYear' => '2020',
'holderName' => 'ISAAC',
'holderName' => 'Foo',
'issueNumber' => '123',
'number' => '456',
], $result);
Expand Down
12 changes: 12 additions & 0 deletions tests/Test/Unit/Infrastructure/ApiConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public function testPostRequest()
'query' => [
'id' => '67890',
],
'curl' => [
\CURLOPT_SSL_CIPHER_LIST => 'DEFAULT@SECLEVEL=1',
],
]
);
$this->mockedResponse->method('getStatusCode')->willReturn(200);
Expand Down Expand Up @@ -157,6 +160,9 @@ public function testGetRequest()
'query' => [
'id' => '67890',
],
'curl' => [
\CURLOPT_SSL_CIPHER_LIST => 'DEFAULT@SECLEVEL=1',
],
]
);
$this->mockedResponse->method('getStatusCode')->willReturn(200);
Expand Down Expand Up @@ -286,6 +292,9 @@ public function testTolerantReader()
'query' => [
'id' => '67890',
],
'curl' => [
\CURLOPT_SSL_CIPHER_LIST => 'DEFAULT@SECLEVEL=1',
],
]
);
$this->mockedResponse->method('getStatusCode')->willReturn(200);
Expand Down Expand Up @@ -344,6 +353,9 @@ public function testExceptionOnMissingRequiredField()
'query' => [
'id' => '67890',
],
'curl' => [
\CURLOPT_SSL_CIPHER_LIST => 'DEFAULT@SECLEVEL=1',
],
]
);
$this->mockedResponse->method('getStatusCode')->willReturn(200);
Expand Down

0 comments on commit 8a5449f

Please sign in to comment.