Update modules/gateways/hutko/hutko_helper.php
This commit is contained in:
@@ -265,6 +265,7 @@ class Hutko_Helper
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Builds a base64 encoded JSON string containing reservation-related data.
|
||||
*
|
||||
@@ -279,22 +280,33 @@ class Hutko_Helper
|
||||
{
|
||||
|
||||
// 3. Construct the data array.
|
||||
$data = [
|
||||
|
||||
$phone = isset($params['clientdetails']['phonenumber']) ? $params['clientdetails']['phonenumber'] : '';
|
||||
$addr1 = isset($params['clientdetails']['address1']) ? $params['clientdetails']['address1'] : '';
|
||||
$country = isset($params['clientdetails']['country']) ? $params['clientdetails']['country'] : '';
|
||||
$state = isset($params['clientdetails']['state']) ? $params['clientdetails']['state'] : '';
|
||||
$city = isset($params['clientdetails']['city']) ? $params['clientdetails']['city'] : '';
|
||||
$zip = isset($params['clientdetails']['postcode']) ? $params['clientdetails']['postcode'] : '';
|
||||
$last = isset($params['clientdetails']['lastname']) ? $params['clientdetails']['lastname'] : '';
|
||||
$first = isset($params['clientdetails']['firstname']) ? $params['clientdetails']['firstname'] : '';
|
||||
$email = isset($params['clientdetails']['email']) ? $params['clientdetails']['email'] : '';
|
||||
|
||||
$data = array(
|
||||
"cms_name" => "WHMCS",
|
||||
"cms_version" => $params['whmcsVersion'],
|
||||
"shop_domain" => $params['systemurl'],
|
||||
"phonemobile" => $params['clientdetails']['phonenumber'],
|
||||
"customer_address" => self::getSlug($params['clientdetails']['address1']),
|
||||
"customer_country" => self::getSlug($params['clientdetails']['country']),
|
||||
"customer_state" => self::getSlug($params['clientdetails']['state']),
|
||||
"customer_name" => self::getSlug($params['clientdetails']['lastname'] . ' ' . $params['clientdetails']['firstname']),
|
||||
"customer_city" => self::getSlug($params['clientdetails']['city']),
|
||||
"customer_zip" => $params['clientdetails']['postcode'],
|
||||
"account" => $params['clientdetails']['email'],
|
||||
"uuid" => hash('sha256', $params['clientdetails']['email'] . '|' . $params['systemurl']),
|
||||
];
|
||||
|
||||
"phonemobile" => $phone,
|
||||
"customer_address" => self::getSlug($addr1),
|
||||
"customer_country" => self::getSlug($country),
|
||||
"customer_state" => self::getSlug($state),
|
||||
"customer_name" => self::getSlug($last . ' ' . $first),
|
||||
"customer_city" => self::getSlug($city),
|
||||
"customer_zip" => $zip,
|
||||
"account" => $email,
|
||||
"uuid" => hash('sha256', $email . '|' . $params['systemurl']),
|
||||
);
|
||||
|
||||
return base64_encode(json_encode($data));
|
||||
|
||||
|
||||
return base64_encode(json_encode($data));
|
||||
@@ -319,8 +331,9 @@ class Hutko_Helper
|
||||
// Assuming validateResponse returns true on success, or a string error message on failure.
|
||||
$isSignatureValid = self::validateResponse($calbackContent, $gatewayParams);
|
||||
if ($isSignatureValid !== true) {
|
||||
\logTransaction($gatewayParams['name'] . ' [callback]', $calbackContent, 'Invalid hutko signature');
|
||||
|
||||
if (function_exists('logTransaction')) {
|
||||
logTransaction($gatewayParams['name'] . ' [callback]', $calbackContent, 'Invalid hutko signature');
|
||||
}
|
||||
throw new Exception('Invalid hutko signature');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user