Skip to content

Commit

Permalink
Fix config
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmr committed Apr 10, 2024
1 parent 33150a3 commit 1b47513
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
15 changes: 12 additions & 3 deletions inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,18 @@ public function preconfig($type)
$infos = $supplier->getSupplierInfo();
$this->fields["name"] = $infos["name"];
$this->fields["supplier_url"] = $infos["supplier_url"];

if ($type == self::HP) {
$this->fields["supplier_secret"] = 'abcdefabcdefAaBBBBB';
$this->fields["token_url"] = $infos["token_url"];
$this->fields["warranty_url"] = $infos["warranty_url"];
}
if ($type == self::DELL) {
$this->fields["token_url"] = $infos["token_url"];
$this->fields["warranty_url"] = $infos["warranty_url"];
}

if ($type == self::HP || $type == self::DELL) {
$this->fields["supplier_key"] = '123456789';
$this->fields["supplier_secret"] = '987654321';
}
break;
default:
Expand Down Expand Up @@ -367,7 +376,7 @@ public function showForm($ID, $options = [])
echo "</td>";
echo "</tr>";

if ($this->fields["name"] == self::DELL) {
if ($this->fields["name"] == self::DELL || $this->fields["name"] == self::HP) {
echo "<tr>";
echo "<td class='tab_bg_2 center' colspan='2'>" . __('Access token API address', 'manufacturersimports') . "</td>";
echo "<td class='tab_bg_2 left' colspan='2'>";
Expand Down
7 changes: 3 additions & 4 deletions inc/hp.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ public function getSupplierInfo(
public static function getToken($config)
{
$token = false;
$info['token_url'] = "https://warranty.api.hp.com/oauth/v1/token";
// $info['token_url'] = "https://warranty.api.hp.com/oauth/v1/token";
// must manage token
$options = [
"url" => $info["token_url"],
"url" => $config->fields["token_url"],
"download" => false,
"file" => false,
"post" => [
Expand Down Expand Up @@ -189,7 +189,6 @@ public function getWarrantyInfo($contents)
*/
public static function getWarrantyUrl($config, $compSerial)
{
$info['warranty_url'] = "https://warranty.api.hp.com/productwarranty/v2/queries";
return ["url" => $info['warranty_url']];
return ["url" => $config->fields['warranty_url']];
}
}

0 comments on commit 1b47513

Please sign in to comment.