Closed pperzyna closed 2 years ago
@pperzyna Is it a test environment refund or production?
@emilleszczak2 It was on sandbox, but on the production is the same problem
Thanks, I'll check it. What kind of http client do you use?
Symfony\Component\HttpClient\Psr18Client {#2232 ▼
-client: Symfony\Component\HttpClient\CurlHttpClient {#2222 ▶}
-responseFactory: Nyholm\Psr7\Factory\Psr17Factory {#2235}
-streamFactory: Nyholm\Psr7\Factory\Psr17Factory {#2227}
}
@emilleszczak2 Any news regarding this one?
Not yet, API returns 404 Not Found for wrong Payment ID. It maybe a problem with the client or SDK
@pperzyna I checked two variants and both works
{
"name": "emilleszczak2/curl-paynow-test",
"type": "project",
"require": {
"php-http/curl-client": "^2.2",
"pay-now/paynow-php-sdk": "^2.2",
"nyholm/psr7": "^1.5"
},
"minimum-stability": "stable"
}
and with guzzle/psr7 - there is needed change for SDK, see https://github.com/pay-now/paynow-php-sdk/pull/62
{
"name": "emilleszczak2/curl-paynow-test",
"type": "project",
"require": {
"php-http/curl-client": "^2.2",
"guzzlehttp/psr7": "^2.1",
"pay-now/paynow-php-sdk": "^2.2",
},
"minimum-stability": "stable"
}
<?php
use Paynow\Exception\PaynowException;
use Paynow\HttpClient\HttpClientException;
require 'vendor/autoload.php';
$apiKey = 'xxxxxxxxxxx';
$signatureKey = 'yyyyyyyyyy';
$paynow = new \Paynow\Client(
$apiKey,
$signatureKey,
\Paynow\Environment::SANDBOX,
'curl-paynow-test'
);
$refund = new \Paynow\Service\Refund($paynow);
try {
$refund->create('CXU-XYZ-123', uniqid(), 100, 'RMA');
} catch (PaynowException $exception) {
var_dump($exception->getCode());
var_dump($exception->getMessage());
var_dump($exception->getPrevious()->getStatus());
var_dump($exception->getPrevious()->getBody());
}
@emilleszczak2 Thanks for the update! Please release new version
@pperzyna Released v2.2.1
Dear PayNow,
I've tried to use your Refund Service, but it looks like there is an API error. The underlying HTTP request in the create function returns null.
How to replicate it?
Expected output: The Status object