mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-11 01:08:34 +02:00
Fixes in Crypto payments module
This commit is contained in:
parent
6916e8accb
commit
dd78602ae0
1 changed files with 11 additions and 8 deletions
|
@ -312,7 +312,7 @@ class FinancialsController extends Controller
|
||||||
$apiKey = envi('NOW_API_KEY');
|
$apiKey = envi('NOW_API_KEY');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $client->request('POST', 'https://api.nowpayments.io/v1/invoice', [
|
$apiResponse = $client->request('POST', 'https://api.nowpayments.io/v1/invoice', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'x-api-key' => $apiKey,
|
'x-api-key' => $apiKey,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
@ -320,14 +320,17 @@ class FinancialsController extends Controller
|
||||||
'json' => $data,
|
'json' => $data,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$statusCode = $response->getStatusCode();
|
$body = $apiResponse->getBody()->getContents();
|
||||||
$body = $response->getBody()->getContents();
|
$response->getBody()->write($body);
|
||||||
|
|
||||||
$response->getBody()->write(json_encode($body));
|
|
||||||
return $response->withHeader('Content-Type', 'application/json');
|
return $response->withHeader('Content-Type', 'application/json');
|
||||||
} catch (GuzzleException $e) {
|
} catch (GuzzleException $e) {
|
||||||
$this->container->get('flash')->addMessage('error', 'We encountered an issue while processing your payment. Details: ' . $e->getMessage());
|
$errorResponse = [
|
||||||
return $response->withHeader('Location', '/deposit')->withStatus(302);
|
'error' => 'We encountered an issue while processing your payment.',
|
||||||
|
'details' => $e->getMessage(),
|
||||||
|
];
|
||||||
|
|
||||||
|
$response->getBody()->write(json_encode($errorResponse));
|
||||||
|
return $response->withStatus(500)->withHeader('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue