Skip to content

Commit

Permalink
Merge pull request #7 from vr-dev-team/hotfix/curl-errors
Browse files Browse the repository at this point in the history
hotfix: log curl errors
  • Loading branch information
zullkas authored Jun 8, 2021
2 parents fde5bd2 + f5085d8 commit 892ea6e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/gateways/vrcoinify.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

define('vrcoinify_plugin_name', 'VR Coinify WHMCS');
define('vrcoinify_plugin_version', '0.1');
define('vrcoinify_plugin_version', '0.7');
define('vrcoinify_error_not_available', 'Coinify Gateway is not available right now. Please choose another payment gateway or contact support.');
define('vrcoinify_error_amount_too_low', 'The amount to pay is too small for Coinify. Please choose another payment gateway.');

Expand Down Expand Up @@ -49,14 +49,19 @@ function vrcoinify_link($params)
);

if (empty($result)) {
$result['last_curl_error'] = $api->getLastCurlError();
$result['last_curl_errno'] = $api->getLastCurlErrno();
logModuleCall('vrcoinify', 'invoiceCreation', $params, $result, null, null);

return renderError(vrcoinify_error_not_available);
}

$error = $result['error'] ?? null;

if ($error) {
$code = $error['code'] ?? null;
$result['last_curl_error'] = $api->getLastCurlError();
$result['last_curl_errno'] = $api->getLastCurlErrno();
logModuleCall('vrcoinify', 'invoiceCreation', $params, $result, null, null);

if ($code && 'amount_too_low' === $code) {
Expand Down
15 changes: 15 additions & 0 deletions modules/gateways/vrcoinify/CoinifyAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,19 @@ private function generateAuthorizationHeader() {
return $auth_header;
}

/**
* @return string|null
*/
public function getLastCurlError()
{
return $this->last_curl_error;
}

/**
* @return string|null
*/
public function getLastCurlErrno()
{
return $this->last_curl_errno;
}
}

0 comments on commit 892ea6e

Please sign in to comment.