Skip to content

Commit b51b22c

Browse files
authored
Merge pull request #1 from wahyuief/development
Development
2 parents 3f2d594 + f0ba0e0 commit b51b22c

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

src/Certificate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static function download($cert_id, $cert_format)
1414

1515
public static function download_by_order($order_id, $cert_format)
1616
{
17-
return Client::request('get', Util::base_url('certificate', 'download/order', $order_id, 'format', $cert_format));
17+
return Client::request('get', Util::base_url('certificate/download/order', $order_id, 'format', $cert_format));
1818
}
1919

2020
public static function chain($cert_id)
@@ -24,7 +24,7 @@ public static function chain($cert_id)
2424

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

3030
}

src/Order.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace wahyuief\phpcertcentral;
4+
5+
use Wahyuief\PhpCertcentral\Util;
6+
use Wahyuief\PhpCertcentral\Client;
7+
8+
class Order {
9+
10+
public static function submit($product_id, $data)
11+
{
12+
return Client::request('post', Util::base_url('order/certificate', $product_id), json_encode($data));
13+
}
14+
15+
public static function get($param = '')
16+
{
17+
return Client::request('get', Util::base_url('order/certificate', $param));
18+
}
19+
20+
public static function get_by_domain($domain)
21+
{
22+
$datas = json_decode(self::get(), true);
23+
$data = array();
24+
$data['orders'] = array_filter($datas['orders'], function ($key) use ($domain) {
25+
return str_contains(strtolower($key['certificate']['common_name']), strtolower($domain));
26+
});
27+
28+
return json_encode($data);
29+
}
30+
31+
}

0 commit comments

Comments
 (0)