Skip to content

Commit

Permalink
Merge pull request #1 from wahyuief/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
wahyuief authored Feb 1, 2023
2 parents 3f2d594 + f0ba0e0 commit b51b22c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static function download($cert_id, $cert_format)

public static function download_by_order($order_id, $cert_format)
{
return Client::request('get', Util::base_url('certificate', 'download/order', $order_id, 'format', $cert_format));
return Client::request('get', Util::base_url('certificate/download/order', $order_id, 'format', $cert_format));
}

public static function chain($cert_id)
Expand All @@ -24,7 +24,7 @@ public static function chain($cert_id)

public static function revoke($cert_id)
{
return Client::request('put', Util::base_url('certificate', $cert_id, 'revoke'));
return Client::request('put', Util::base_url('certificate', $cert_id, 'revoke'), json_encode(['skip_approval' => true]));
}

}
31 changes: 31 additions & 0 deletions src/Order.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace wahyuief\phpcertcentral;

use Wahyuief\PhpCertcentral\Util;
use Wahyuief\PhpCertcentral\Client;

class Order {

public static function submit($product_id, $data)
{
return Client::request('post', Util::base_url('order/certificate', $product_id), json_encode($data));
}

public static function get($param = '')
{
return Client::request('get', Util::base_url('order/certificate', $param));
}

public static function get_by_domain($domain)
{
$datas = json_decode(self::get(), true);
$data = array();
$data['orders'] = array_filter($datas['orders'], function ($key) use ($domain) {
return str_contains(strtolower($key['certificate']['common_name']), strtolower($domain));
});

return json_encode($data);
}

}

0 comments on commit b51b22c

Please sign in to comment.