ライブラリ側が完了+キャッシュは「validate」→「resurrect」に名変更

諏訪子 <suwako@076.moe>、2026-05-01 16:27
コミット 2570955b4e816664f2ff003923e98a99842bcb9f ・親 3879ffc ・ファイルを見る

2個のファイル、+825 -33

@@ -108,7 +108,7 @@
108108 * @param string $dataPoint デフォルト=query
109109 * @return bool
110110 */
111- public function validate(array $cache, mixed $data = null, string $dataPoint = 'query'): bool {
111+ public function resurrect(array $cache, mixed $data = null, string $dataPoint = 'query'): bool {
112112 if (NULL === $data) return (!empty($cache) && (isset($cache['lifespan']) && time() < ($cache['lifespan'] + $this->dataDuration)));
113113 else return (!empty($cache)
114114 && (isset($cache[$dataPoint])
@@ -154,7 +154,7 @@
154154 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
155155 $cacheName = 'listdomains';
156156 $cache = $this->cache->get($cacheName);
157- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
157+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
158158
159159 $curl = $this->setupCurl('/domains');
160160 $res = $this->curlResult($curl);
@@ -256,6 +256,245 @@
256256 return Result::Error('ドメインの確認に失敗。');
257257 }
258258
259+ /**
260+ * ドメイン名を勧められる。
261+ * @todo テスト
262+ *
263+ * @param array $payload フォームデータ
264+ * @return Result 結果。
265+ */
266+ public function suggestDomainname(array $payload = []): Result {
267+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
268+
269+ $curl = $this->setupCurl('/domains/suggest-name', 'POST', $payload);
270+ $res = $this->curlResult($curl);
271+ if (isset($res->data['data']['results'])) {
272+ return Result::Success('ドメインを勧められる事に成功。', $res->data['data']['results']);
273+ }
274+
275+ return Result::Error('ドメインを勧められる事に失敗。');
276+ }
277+
278+ /**
279+ * ドメイン名を交換する。
280+ * @todo テスト
281+ *
282+ * @param array $payload フォームデータ
283+ * @return Result 結果。
284+ */
285+ public function tradeDomainname(array $payload = []): Result {
286+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
287+
288+ $curl = $this->setupCurl('/domains/trade', 'POST', $payload);
289+ $res = $this->curlResult($curl);
290+ if (isset($res->data['data']['results'])) {
291+ $this->cache->murder('listdomains');
292+ return Result::Success('ドメインの交換に成功。', $res->data['data']['results']);
293+ }
294+
295+ return Result::Error('ドメインの交換に失敗。');
296+ }
297+
298+ /**
299+ * ドメイン名を移転する。
300+ * @todo テスト
301+ *
302+ * @param array $payload フォームデータ
303+ * @return Result 結果。
304+ */
305+ public function transferDomainname(array $payload = []): Result {
306+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
307+
308+ $curl = $this->setupCurl('/domains/transfer', 'POST', $payload);
309+ $res = $this->curlResult($curl);
310+ if (isset($res->data['data']['results'])) {
311+ $this->cache->murder('listdomains');
312+ return Result::Success('ドメインの移転に成功。', $res->data['data']['results']);
313+ }
314+
315+ return Result::Error('ドメインの移転に失敗。');
316+ }
317+
318+ /**
319+ * ドメイン名の受け取り
320+ * @todo テスト
321+ *
322+ * @param int $id ドメインID
323+ * @param array $payload フォームデータ
324+ * @return Result 結果。
325+ */
326+ public function getDomainname(int $id, array $payload = []): Result {
327+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
328+ $cacheName = "getdomain-{$id}";
329+ $cache = $this->cache->get($cacheName);
330+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
331+
332+ $curl = $this->setupCurl("/domains/{$id}", 'POST', $payload);
333+ $res = $this->curlResult($curl);
334+ if (isset($res->data['data']['results'])) {
335+ $this->cache->set($cacheName, $data->data);
336+ return Result::Success('ドメインの受け取りに成功。', $res->data['data']['results']);
337+ }
338+
339+ return Result::Error('ドメインの受け取りに失敗。');
340+ }
341+
342+ /**
343+ * ドメイン名の更新
344+ * @todo テスト
345+ *
346+ * @param int $id ドメインID
347+ * @param array $payload フォームデータ
348+ * @return Result
349+ */
350+ public function updateDomainname(int $id, array $payload = []): Result {
351+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
352+
353+ $uri = "/domains/{$id}";
354+ $curl = $this->setupCurl($uri, 'PUT', $payload);
355+ $res = $this->curlResult($curl);
356+ if (isset($res->data['data'])) {
357+ $this->cache->murder('listdomains');
358+ $this->cache->murder("listdomain-{$id}");
359+ if ($res->data['data']['success']) return Result::Success('ドメイン名の更新に成功。', $res->data);
360+ }
361+
362+ return Result::Error('ドメイン名の更新に失敗。');
363+ }
364+
365+ /**
366+ * ドメイン名の削除
367+ * @todo テスト
368+ *
369+ * @param int $id ドメインID
370+ * @param array $payload フォームデータ
371+ * @return Result
372+ */
373+ public function deleteDomainname(int $id, array $payload = []): Result {
374+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
375+
376+ $uri = "/domains/{$id}";
377+ $curl = $this->setupCurl($uri, 'DELETE', $payload);
378+ $res = $this->curlResult($curl);
379+ if (isset($res->data['data'])) {
380+ $this->cache->murder('listdomains');
381+ $this->cache->murder("listdomain-{$id}");
382+ if ($res->data['data']['success']) return Result::Success('ドメイン名の削除に成功。', $res->data);
383+ }
384+
385+ return Result::Error('ドメイン名の削除に失敗。');
386+ }
387+
388+ /**
389+ * ドメイン名の最後行動の再度実行
390+ * @todo テスト
391+ *
392+ * @param int $id ドメインID
393+ * @param array $payload フォームデータ
394+ * @return Result 結果。
395+ */
396+ public function retryLastDomainnameOperation(int $id, array $payload = []): Result {
397+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
398+
399+ $curl = $this->setupCurl("/domains/{$id}/last-operation/restart", 'POST', $payload);
400+ $res = $this->curlResult($curl);
401+ if (isset($res->data['data']['results'])) {
402+ $this->cache->murder('listdomains');
403+ $this->cache->murder("listdomain-{$id}");
404+ return Result::Success('ドメインの最後行動の再度実行に成功。', $res->data['data']['results']);
405+ }
406+
407+ return Result::Error('ドメインの最後行動の再度実行に失敗。');
408+ }
409+
410+ /**
411+ * ドメイン名の有効期限の更新
412+ * @todo テスト
413+ *
414+ * @param int $id ドメインID
415+ * @param array $payload フォームデータ
416+ * @return Result 結果。
417+ */
418+ public function renewDomainname(int $id, array $payload = []): Result {
419+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
420+
421+ $curl = $this->setupCurl("/domains/{$id}/renew", 'POST', $payload);
422+ $res = $this->curlResult($curl);
423+ if (isset($res->data['data']['results'])) {
424+ $this->cache->murder('listdomains');
425+ $this->cache->murder("listdomain-{$id}");
426+ return Result::Success('ドメインの有効期限の更新に成功。', $res->data['data']['results']);
427+ }
428+
429+ return Result::Error('ドメインの有効期限の更新に失敗。');
430+ }
431+
432+ /**
433+ * 削除済みドメイン名の復活
434+ * @todo テスト
435+ *
436+ * @param int $id ドメインID
437+ * @param array $payload フォームデータ
438+ * @return Result 結果。
439+ */
440+ public function restoreDomainname(int $id, array $payload = []): Result {
441+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
442+
443+ $curl = $this->setupCurl("/domains/{$id}/restore", 'POST', $payload);
444+ $res = $this->curlResult($curl);
445+ if (isset($res->data['data']['results'])) {
446+ $this->cache->murder('listdomains');
447+ $this->cache->murder("listdomain-{$id}");
448+ return Result::Success('削除済みドメイン名の復活に成功。', $res->data['data']['results']);
449+ }
450+
451+ return Result::Error('削除済みドメイン名の復活に失敗。');
452+ }
453+
454+ /**
455+ * ドメイン名の移動の承諾
456+ * @todo テスト
457+ *
458+ * @param int $id ドメインID
459+ * @param array $payload フォームデータ
460+ * @return Result 結果。
461+ */
462+ public function approveDomainnameTransfer(int $id, array $payload = []): Result {
463+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
464+
465+ $curl = $this->setupCurl("/domains/{$id}/transfer/approve", 'POST', $payload);
466+ $res = $this->curlResult($curl);
467+ if (isset($res->data['data']['results'])) {
468+ $this->cache->murder('listdomains');
469+ $this->cache->murder("listdomain-{$id}");
470+ return Result::Success('ドメイン名の移動の承諾に成功。', $res->data['data']['results']);
471+ }
472+
473+ return Result::Error('ドメイン名の移動の承諾に失敗。');
474+ }
475+
476+ /**
477+ * ドメイン名のfoa1の送信
478+ * @todo テスト
479+ *
480+ * @param int $id ドメインID
481+ * @param array $payload フォームデータ
482+ * @return Result 結果。
483+ */
484+ public function sendDomainnameFoa1(int $id, array $payload = []): Result {
485+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
486+
487+ $curl = $this->setupCurl("/domains/{$id}/transfer/send-foa1", 'POST', $payload);
488+ $res = $this->curlResult($curl);
489+ if (isset($res->data['data']['results'])) {
490+ $this->cache->murder('listdomains');
491+ $this->cache->murder("listdomain-{$id}");
492+ return Result::Success('ドメイン名のfoa1の送信に成功。', $res->data['data']['results']);
493+ }
494+
495+ return Result::Error('ドメイン名のfoa1の送信に失敗。');
496+ }
497+
259498 //// 追加データ
260499
261500 /**
@@ -274,7 +513,7 @@
274513 $cacheName = $name && $ext ? "domainadditionaldata-{$name}.{$ext}" : 'domainadditionaldata';
275514
276515 $cache = $this->cache->get($cacheName);
277- if ($this->cache->validate($cache)) return Result::Success('', $cache);
516+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
278517
279518 $uri = "/domains/additional-data?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
280519 $curl = $this->setupCurl($uri);
@@ -305,7 +544,7 @@
305544 $cacheName = $name && $ext ? "domainadditionaldata-{$name}.{$ext}" : 'domainadditionaldata';
306545
307546 $cache = $this->cache->get($cacheName);
308- if ($this->cache->validate($cache)) return Result::Success('', $cache);
547+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
309548
310549 $uri = "/domains/additional-data/customers?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
311550 $curl = $this->setupCurl($uri);
@@ -336,7 +575,7 @@
336575 $cacheName = $name && $ext ? "domainprices-{$name}.{$ext}" : 'domainprices';
337576
338577 $cache = $this->cache->get($cacheName);
339- if ($this->cache->validate($cache)) return Result::Success('', $cache);
578+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
340579
341580 $uri = "/domains/prices?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
342581 $curl = $this->setupCurl($uri);
@@ -406,7 +645,7 @@
406645 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
407646 $cacheName = 'listtlds';
408647 $cache = $this->cache->get($cacheName);
409- if ($this->cache->validate($cache)) return Result::Success('', $cache);
648+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
410649
411650 if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0, 'order' => 'ASC' ];
412651 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -433,7 +672,7 @@
433672 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
434673 $cacheName = "gettld-{$tld}";
435674 $cache = $this->cache->get($cacheName);
436- if ($this->cache->validate($cache)) return Result::Success('', $cache);
675+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
437676
438677 if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ];
439678 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -463,7 +702,7 @@
463702 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
464703 $cacheName = 'listinvoices';
465704 $cache = $this->cache->get($cacheName);
466- if ($this->cache->validate($cache)) return Result::Success('', $cache);
705+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
467706
468707 if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ];
469708 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -492,7 +731,7 @@
492731 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
493732 $cacheName = 'listpayments';
494733 $cache = $this->cache->get($cacheName);
495- if ($this->cache->validate($cache)) return Result::Success('', $cache);
734+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
496735
497736 if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ];
498737 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -521,7 +760,7 @@
521760 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
522761 $cacheName = 'listtransactions';
523762 $cache = $this->cache->get($cacheName);
524- if ($this->cache->validate($cache)) return Result::Success('', $cache);
763+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
525764
526765 if (empty($query)) $query = [ 'limit' => 10, 'offset' => 0 ];
527766 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -573,7 +812,7 @@
573812 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
574813 $cacheName = 'listnameservers';
575814 $cache = $this->cache->get($cacheName);
576- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
815+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
577816
578817 if (empty($query)) $query = [ 'limit' => 25, 'offset' => 0, 'order_by.name' => 'asc' ];
579818 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -622,7 +861,7 @@
622861 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
623862 $cacheName = "listnameserver-{$domain}";
624863 $cache = $this->cache->get($cacheName);
625- if ($this->cache->validate($cache)) return Result::Success('', $cache);
864+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
626865
627866 if (empty($query)) $query = [ 'limit' => 100, 'offset' => 0, 'order_by.name' => 'asc' ];
628867 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -696,7 +935,7 @@
696935 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
697936 $cacheName = 'listnsgroups';
698937 $cache = $this->cache->get($cacheName);
699- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
938+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
700939
701940 if (empty($query)) $query = [ 'limit' => 25, 'offset' => 0, 'order_by.name' => 'asc' ];
702941 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -745,7 +984,7 @@
745984 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
746985 $cacheName = "listnsgroup-{$nsGroup}";
747986 $cache = $this->cache->get($cacheName);
748- if ($this->cache->validate($cache)) return Result::Success('', $cache);
987+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
749988
750989 if (empty($query)) $query = [ 'limit' => 100, 'offset' => 0, 'order_by.name' => 'asc' ];
751990 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -819,7 +1058,7 @@
8191058 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
8201059 $cacheName = 'listdnstemplates';
8211060 $cache = $this->cache->get($cacheName);
822- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
1061+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
8231062
8241063 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
8251064 $uri = '/dns/templates?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -866,7 +1105,7 @@
8661105 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
8671106 $cacheName = "getdnstemplate-{$id}";
8681107 $cache = $this->cache->get($cacheName);
869- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
1108+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
8701109
8711110 $uri = "/dns/templates/{$id}";
8721111 $curl = $this->setupCurl($uri);
@@ -913,7 +1152,7 @@
9131152 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
9141153 $cacheName = 'listdnszones';
9151154 $cache = $this->cache->get($cacheName);
916- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
1155+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
9171156
9181157 if (empty($query)) $query = [ 'limit' => 25, 'offset' => 0, 'order_by.name' => 'asc' ];
9191158 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -961,7 +1200,7 @@
9611200 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
9621201 $cacheName = "getdnszone-{$domain}";
9631202 $cache = $this->cache->get($cacheName);
964- if ($this->cache->validate($cache)) return Result::Success('', $cache);
1203+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
9651204
9661205 if (empty($query)) $query = [ 'limit' => 100, 'offset' => 0, 'order_by.name' => 'asc' ];
9671206 foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
@@ -1034,7 +1273,7 @@
10341273 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
10351274 $cacheName = "getzonerecords-{$domain}";
10361275 $cache = $this->cache->get($cacheName);
1037- if ($this->cache->validate($cache)) return Result::Success('', $cache);
1276+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
10381277
10391278 $curl = $this->setupCurl("/dns/zones/{$domain}/records");
10401279 $res = $this->curlResult($curl);
@@ -1048,6 +1287,168 @@
10481287
10491288 // Easydmarc
10501289
1290+ /**
1291+ * Easydmarc一覧
1292+ * @todo テスト
1293+ *
1294+ * @param string $domain ドメイン名
1295+ * @return Result
1296+ */
1297+ public function getEasydmarc(string $domain): Result {
1298+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1299+ $cacheName = "listeasydmarc-{$domain}";
1300+ $cache = $this->cache->get($cacheName);
1301+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
1302+
1303+ $parts = explode('.', $domain, 2);
1304+ assert_exists($parts[0]);
1305+ assert_exists($parts[1]);
1306+ $query = [ 'name' => $parts[0], 'extension' => $parts[1] ];
1307+
1308+ $uri = "/dns/easydmarcs?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
1309+ $curl = $this->setupCurl($uri);
1310+ $res = $this->curlResult($curl);
1311+ if (isset($res->data['data'])) {
1312+ $this->cache->set($cacheName, $res->data);
1313+ return Result::Success('', $res->data);
1314+ }
1315+
1316+ return Result::Error('Easydmarc一覧の受け取りに失敗。');
1317+ }
1318+
1319+ /**
1320+ * Easydmarcの作成
1321+ * @todo テスト
1322+ *
1323+ * @param string $domain ドメイン名
1324+ * @return Result
1325+ */
1326+ public function createEasydmarc(string $domain): Result {
1327+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1328+
1329+ $parts = explode('.', $domain, 2);
1330+ assert_exists($parts[0]);
1331+ assert_exists($parts[1]);
1332+ $payload = [ 'name' => $parts[0], 'extension' => $parts[1] ];
1333+
1334+ $uri = '/dns/easydmarcs';
1335+ $curl = $this->setupCurl($uri, 'POST', $payload);
1336+ $res = $this->curlResult($curl);
1337+ if (isset($res->data['data'])) {
1338+ $this->cache->murder('listeasydmarcs');
1339+ return Result::Success('Easydmarcの追加に成功。', $res->data);
1340+ }
1341+
1342+ return Result::Error('Easydmarcの追加に失敗。');
1343+ }
1344+
1345+ /**
1346+ * Easydmarc一覧
1347+ * @todo テスト
1348+ *
1349+ * @param array $query
1350+ * @return Result
1351+ */
1352+ public function listEasydmarcs(array $query = []): Result {
1353+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1354+ $cacheName = 'listeasydmarcs';
1355+ $cache = $this->cache->get($cacheName);
1356+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
1357+
1358+ if (!empty($query) && isset($query['domain'])) {
1359+ $parts = explode('.', $query['domain'], 2);
1360+ assert_exists($parts[0]);
1361+ assert_exists($parts[1]);
1362+ $query['domain.name'] = $parts[0];
1363+ $query['domain.extension'] = $parts[1];
1364+ }
1365+
1366+ if (empty($query)) $query = [ 'limit' => 100, 'offset' => 0, 'order_by.id' => 'asc' ];
1367+ foreach ($query as $k => $v) if (is_bool($v)) $query[$k] = $v ? 'true' : 'false';
1368+
1369+ $uri = "/dns/easydmarcs/list?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
1370+ $curl = $this->setupCurl($uri);
1371+ $res = $this->curlResult($curl);
1372+ if (isset($res->data['data'])) {
1373+ $this->cache->set($cacheName, $res->data);
1374+ return Result::Success('', $res->data);
1375+ }
1376+
1377+ return Result::Error('Easydmarc一覧の受け取りに失敗。');
1378+ }
1379+
1380+ /**
1381+ * Easydmarcの削除
1382+ * @todo テスト
1383+ *
1384+ * @param int $orderId 注文ID
1385+ * @return Result
1386+ */
1387+ public function deleteEasydmarc(int $orderId): Result {
1388+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1389+
1390+ $uri = "/dns/easydmarcs/{$domain}";
1391+ $curl = $this->setupCurl($uri, 'DELETE');
1392+ $res = $this->curlResult($curl);
1393+ if (isset($res->data['data'])) {
1394+ $this->cache->murder('listeasydmarcs');
1395+ $this->cache->murder("listeasydmarc-{$domain}");
1396+ $this->cache->murder("geteasydmarcssso-{$orderId}");
1397+ if ($res->data['data']['success']) return Result::Success('Easydmarcの削除に成功。', $res->data);
1398+ }
1399+
1400+ return Result::Error('Easydmarcの削除に失敗。');
1401+ }
1402+
1403+ /**
1404+ * Easydmarcを再度注文してみる
1405+ * @todo テスト
1406+ *
1407+ * @param int $orderId 注文ID
1408+ * @return Result
1409+ */
1410+ public function retryEasydmarc(int $orderId): Result {
1411+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1412+
1413+ $uri = "/dns/easydmarcs/{$domain}/retry";
1414+ $curl = $this->setupCurl($uri, 'POST');
1415+ $res = $this->curlResult($curl);
1416+ if (isset($res->data['data'])) {
1417+ $this->cache->murder('listeasydmarcs');
1418+ $this->cache->murder("listeasydmarc-{$domain}");
1419+ $this->cache->murder("geteasydmarcssso-{$orderId}");
1420+ if ($res->data['data']['success']) return Result::Success('Easydmarcを再度注文してみる事に成功。', $res->data);
1421+ }
1422+
1423+ return Result::Error('Easydmarcを再度注文してみる事に失敗。');
1424+ }
1425+
1426+ /**
1427+ * Easydmarcの削除
1428+ * @todo テスト
1429+ *
1430+ * @param int $orderId 注文ID
1431+ * @return Result
1432+ */
1433+ public function getEasydmarcSso(int $orderId): Result {
1434+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1435+ $cacheName = "geteasydmarcssso-{$orderId}";
1436+ $cache = $this->cache->get($cacheName);
1437+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
1438+
1439+ $uri = "/dns/easydmarcs/{$domain}/sso";
1440+ $curl = $this->setupCurl($uri);
1441+ $res = $this->curlResult($curl);
1442+ if (isset($res->data['data'])) {
1443+ $this->cache->set($cacheName, $data->data);
1444+ $this->cache->murder('listeasydmarcs');
1445+ $this->cache->murder("listeasydmarc-{$domain}");
1446+ if ($res->data['data']['success']) return Result::Success('Easydmarcの削除に成功。', $res->data);
1447+ }
1448+
1449+ return Result::Error('Easydmarcの削除に失敗。');
1450+ }
1451+
10511452 // メールテンプレート
10521453
10531454 //// メール
@@ -1063,7 +1464,7 @@
10631464 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
10641465 $cacheName = 'listemails';
10651466 $cache = $this->cache->get($cacheName);
1066- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
1467+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
10671468
10681469 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
10691470 $uri = '/emails?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1144,12 +1545,235 @@
11441545
11451546 // ライセンス
11461547
1548+ /**
1549+ * ライセンス一覧
1550+ * @todo テスト
1551+ *
1552+ * @param array $query 検索クエリー
1553+ * @return Result
1554+ */
1555+ public function listLicenses(array $query = []): Result {
1556+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1557+ $cacheName = 'listlicenses';
1558+ $cache = $this->cache->get($cacheName);
1559+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
1560+
1561+ foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
1562+ $uri = '/licenses?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
1563+ $curl = $this->setupCurl($uri);
1564+ $res = $this->curlResult($curl);
1565+ if (isset($res->data['data'])) {
1566+ $res->data['query'] = $query;
1567+ $this->cache->set($cacheName, $res->data);
1568+ return Result::Success('ライセンス一覧の受け取りに成功。', $res->data);
1569+ }
1570+
1571+ return Result::Error('ライセンス一覧の受け取りに失敗。');
1572+ }
1573+
1574+ /**
1575+ * HWIDの再設定
1576+ * @todo テスト
1577+ *
1578+ * @param string $product 商品種類(Pleskのみ)
1579+ * @param int $keyId ライセンスキーID
1580+ * @return Result
1581+ */
1582+ public function resetLicenseHwid(string $product, int $keyId): Result {
1583+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1584+
1585+ $payload = ['key_id' => $keyId, 'product' => $product];
1586+ $uri = "/licenses/hwids/reset/{$product}/{$keyId}";
1587+ $curl = $this->setupCurl($uri, 'POST', $payload);
1588+ $res = $this->curlResult($curl);
1589+ if (isset($res)) {
1590+ $this->cache->murder('listlicenses');
1591+ return Result::Success('HWIDの再設定に成功。', $res->data);
1592+ }
1593+
1594+ return Result::Error("HWIDの再設定に失敗。");
1595+ }
1596+
1597+ /**
1598+ * 商品一覧
1599+ * @todo テスト
1600+ *
1601+ * @param array $query 検索クエリー
1602+ * @return Result
1603+ */
1604+ public function listLicenseItems(array $query = []): Result {
1605+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1606+ $cacheName = 'listitems';
1607+ $cache = $this->cache->get($cacheName);
1608+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
1609+
1610+ foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
1611+ $uri = '/licenses/items?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
1612+ $curl = $this->setupCurl($uri);
1613+ $res = $this->curlResult($curl);
1614+ if (isset($res->data['data'])) {
1615+ $res->data['query'] = $query;
1616+ $this->cache->set($cacheName, $res->data);
1617+ return Result::Success('商品一覧の受け取りに成功。', $res->data);
1618+ }
1619+
1620+ return Result::Error('商品一覧の受け取りに失敗。');
1621+ }
1622+
1623+ /**
1624+ * Pleskライセンス一覧
1625+ * @todo テスト
1626+ *
1627+ * @param array $query 検索クエリー
1628+ * @return Result
1629+ */
1630+ public function listPleskLicenses(array $query = []): Result {
1631+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1632+ $cacheName = 'listplesklicenses';
1633+ $cache = $this->cache->get($cacheName);
1634+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
1635+
1636+ foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
1637+ $uri = '/licenses/plesk?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
1638+ $curl = $this->setupCurl($uri);
1639+ $res = $this->curlResult($curl);
1640+ if (isset($res->data['data'])) {
1641+ $res->data['query'] = $query;
1642+ $this->cache->set($cacheName, $res->data);
1643+ return Result::Success('Pleskライセンス一覧の受け取りに成功。', $res->data);
1644+ }
1645+
1646+ return Result::Error('Pleskライセンス一覧の受け取りに失敗。');
1647+ }
1648+
1649+ /**
1650+ * Pleskライセンスの作成
1651+ * @todo テスト
1652+ *
1653+ * @param array $payload フォームデータ
1654+ * @return Result
1655+ */
1656+ public function createPleskLicense(array $payload): Result {
1657+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1658+
1659+ $uri = "/licenses/plesk";
1660+ $curl = $this->setupCurl($uri, 'POST', $payload);
1661+ $res = $this->curlResult($curl);
1662+ if (isset($res)) {
1663+ $this->cache->murder('listlicenses');
1664+ $this->cache->murder('listplesklicenses');
1665+ return Result::Success('Pleskライセンスの作成に成功。', $res->data);
1666+ }
1667+
1668+ return Result::Error("Pleskライセンスの作成に失敗。");
1669+ }
1670+
1671+ /**
1672+ * Plesk鍵の受け取り
1673+ * @todo テスト
1674+ *
1675+ * @param int $keyId 鍵ID
1676+ * @return Result
1677+ */
1678+ public function getPleskKey(int $keyId): Result {
1679+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1680+ $cacheName = "getpleskkey-{$keyId}";
1681+ $cache = $this->cache->get($cacheName);
1682+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
1683+
1684+ $uri = "/licenses/plesk/key/{$keyId}";
1685+ $curl = $this->setupCurl($uri);
1686+ $res = $this->curlResult($curl);
1687+ if (isset($res->data['data'])) {
1688+ $res->data['query'] = $query;
1689+ $this->cache->set($cacheName, $res->data);
1690+ return Result::Success('Plesk鍵の受け取りに成功。', $res->data);
1691+ }
1692+
1693+ return Result::Error('Plesk鍵の受け取りに失敗。');
1694+ }
1695+
1696+ /**
1697+ * Pleskライセンスの受け取り
1698+ * @todo テスト
1699+ *
1700+ * @param int $keyId 鍵ID
1701+ * @return Result
1702+ */
1703+ public function getPleskLicense(int $keyId): Result {
1704+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1705+ $cacheName = "getplesklicense-{$keyId}";
1706+ $cache = $this->cache->get($cacheName);
1707+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
1708+
1709+ $uri = "/licenses/plesk/{$keyId}";
1710+ $curl = $this->setupCurl($uri);
1711+ $res = $this->curlResult($curl);
1712+ if (isset($res->data['data'])) {
1713+ $res->data['query'] = $query;
1714+ $this->cache->set($cacheName, $res->data);
1715+ return Result::Success('Pleskライセンスの受け取りに成功。', $res->data);
1716+ }
1717+
1718+ return Result::Error('Pleskライセンスの受け取りに失敗。');
1719+ }
1720+
1721+ /**
1722+ * 連絡先の更新
1723+ * @todo テスト
1724+ *
1725+ * @param int $keyId 鍵ID
1726+ * @param array $payload フォームデータ
1727+ * @return Result
1728+ */
1729+ public function updatePleskLicense(int $keyId, array $payload = []): Result {
1730+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1731+
1732+ $uri = "/licenses/plesk/{$keyId}";
1733+ $curl = $this->setupCurl($uri, 'PUT', $payload);
1734+ $res = $this->curlResult($curl);
1735+ if (isset($res->data['data'])) {
1736+ $this->cache->murder("getpleskkey-{$keyId}");
1737+ $this->cache->murder("getplesklicense-{$keyId}");
1738+ $this->cache->murder('listlicenses');
1739+ $this->cache->murder('listplesklicenses');
1740+ if ($res->data['data']['success']) return Result::Success('連絡先の更新に成功。', $res->data);
1741+ }
1742+
1743+ return Result::Error('連絡先の更新に失敗。');
1744+ }
1745+
1746+ /**
1747+ * 連絡先の削除
1748+ * @todo テスト
1749+ *
1750+ * @param int $keyId 鍵ID
1751+ * @return Result
1752+ */
1753+ public function deletePleskLicense(int $keyId): Result {
1754+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
1755+
1756+ $uri = "/licenses/plesk/{$keyId}";
1757+ $curl = $this->setupCurl($uri, 'DELETE');
1758+ $res = $this->curlResult($curl);
1759+ if (isset($res->data['data'])) {
1760+ $this->cache->murder("getpleskkey-{$keyId}");
1761+ $this->cache->murder("getplesklicense-{$keyId}");
1762+ $this->cache->murder('listlicenses');
1763+ $this->cache->murder('listplesklicenses');
1764+ if ($res->data['data']['success']) return Result::Success('連絡先の削除に成功。');
1765+ }
1766+
1767+ return Result::Error('連絡先の削除に失敗。');
1768+ }
1769+
11471770 // リセラー・顧客様
11481771
11491772 //// 連絡先
11501773
11511774 /**
11521775 * 連絡先の一覧
1776+ * @todo テスト
11531777 *
11541778 * @param array $query 検索クエリー
11551779 * @return Result
@@ -1158,7 +1782,7 @@
11581782 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
11591783 $cacheName = 'listcontacts';
11601784 $cache = $this->cache->get($cacheName);
1161- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
1785+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
11621786
11631787 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
11641788 $uri = '/contacts?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1175,6 +1799,7 @@
11751799
11761800 /**
11771801 * 連絡先の作成
1802+ * @todo テスト
11781803 *
11791804 * @param array $payload
11801805 * @return Result
@@ -1195,6 +1820,7 @@
11951820
11961821 /**
11971822 * 連絡先の表示
1823+ * @todo テスト
11981824 *
11991825 * @param int $id 連絡先ID
12001826 * @param bool $withAdditionalData 詳細データ含むか?
@@ -1204,7 +1830,7 @@
12041830 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
12051831 $cacheName = "getcontact-{$id}";
12061832 $cache = $this->cache->get($cacheName);
1207- if ($this->cache->validate($cache, $id, 'id')) return Result::Success('', $cache);
1833+ if ($this->cache->resurrect($cache, $id, 'id')) return Result::Success('', $cache);
12081834
12091835 $query = [ 'with_additional_data' => $withAdditionalData ? 'true' : 'false' ];
12101836 $uri = "/contacts/{$id}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1245,6 +1871,7 @@
12451871
12461872 /**
12471873 * 連絡先の削除
1874+ * @todo テスト
12481875 *
12491876 * @param int $id 連絡先ID
12501877 * @return Result
@@ -1276,7 +1903,7 @@
12761903 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
12771904 $cacheName = 'listcustomers';
12781905 $cache = $this->cache->get($cacheName);
1279- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
1906+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
12801907
12811908 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
12821909 $uri = '/customers?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1322,7 +1949,7 @@
13221949 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
13231950 $cacheName = "getcustomer-{$handle}";
13241951 $cache = $this->cache->get($cacheName);
1325- if ($this->cache->validate($cache, $handle, 'handle')) return Result::Success('', $cache);
1952+ if ($this->cache->resurrect($cache, $handle, 'handle')) return Result::Success('', $cache);
13261953
13271954 $query = [ 'with_additional_data' => $withAdditionalData ? 'true' : 'false' ];
13281955 $uri = "/customers/{$handle}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1395,7 +2022,7 @@
13952022 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
13962023 $cacheName = 'listemailverifications';
13972024 $cache = $this->cache->get($cacheName);
1398- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
2025+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
13992026
14002027 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
14012028 $uri = '/customers/verifications/emails/domains?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1468,7 +2095,7 @@
14682095 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
14692096 $cacheName = 'getreseller';
14702097 $cache = $this->cache->get($cacheName);
1471- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
2098+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
14722099
14732100 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
14742101 $uri = '/resellers?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1517,7 +2144,7 @@
15172144 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
15182145 $cacheName = 'listsettings';
15192146 $cache = $this->cache->get($cacheName);
1520- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
2147+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
15212148
15222149 $uri = '/resellers/settings';
15232150 $curl = $this->setupCurl($uri);
@@ -1543,7 +2170,7 @@
15432170 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
15442171 $cacheName = 'liststatistics';
15452172 $cache = $this->cache->get($cacheName);
1546- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
2173+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
15472174
15482175 $uri = '/resellers/statistics';
15492176 $curl = $this->setupCurl($uri);
@@ -1570,7 +2197,7 @@
15702197 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
15712198 $cacheName = 'listtags';
15722199 $cache = $this->cache->get($cacheName);
1573- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
2200+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
15742201
15752202 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
15762203 $uri = '/tags?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1664,7 +2291,7 @@
16642291 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
16652292 $cacheName = "getsedomain-{$domain}";
16662293 $cache = $this->cache->get($cacheName);
1667- if ($this->cache->validate($cache, $domain, 'domain')) return Result::Success('', $cache);
2294+ if ($this->cache->resurrect($cache, $domain, 'domain')) return Result::Success('', $cache);
16682295
16692296 $uri = "/spam-expert/domains/{$domain}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
16702297 // kys($uri);
@@ -1739,7 +2366,7 @@
17392366 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
17402367 $cacheName = 'listapproveremails';
17412368 $cache = $this->cache->get($cacheName);
1742- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
2369+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
17432370
17442371 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
17452372 $uri = '/ssl/approver-emails?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1798,6 +2425,171 @@
17982425
17992426 //// 注文
18002427
2428+ /**
2429+ * 連絡先の一覧
2430+ * @todo テスト
2431+ *
2432+ * @param array $query 検索クエリー
2433+ * @return Result
2434+ */
2435+ public function listSslOrders(array $query = []): Result {
2436+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
2437+ $cacheName = 'listsslorders';
2438+ $cache = $this->cache->get($cacheName);
2439+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
2440+
2441+ foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
2442+ $uri = '/ssl/orders?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
2443+ $curl = $this->setupCurl($uri);
2444+ $res = $this->curlResult($curl);
2445+ if (isset($res->data['data'])) {
2446+ $res->data['query'] = $query;
2447+ $this->cache->set($cacheName, $res->data);
2448+ return Result::Success('連絡先一覧の受け取りに成功。', $res->data);
2449+ }
2450+
2451+ return Result::Error('連絡先一覧の受け取りに失敗。');
2452+ }
2453+
2454+ /**
2455+ * SSL注文の作成
2456+ * @todo テスト
2457+ *
2458+ * @param array $payload
2459+ * @return Result
2460+ */
2461+ public function createSslOrder(array $payload): Result {
2462+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
2463+
2464+ $uri = '/ssl/orders';
2465+ $curl = $this->setupCurl($uri, 'POST', $payload);
2466+ $res = $this->curlResult($curl);
2467+ if (isset($res)) {
2468+ $this->cache->murder('listsslorders');
2469+ return Result::Success('SSL注文の作成に成功。', $res->data);
2470+ }
2471+
2472+ return Result::Error("SSL注文の作成に失敗。");
2473+ }
2474+
2475+ /**
2476+ * SSL注文の表示
2477+ * @todo テスト
2478+ *
2479+ * @param int $id SSL注文ID
2480+ * @return Result
2481+ */
2482+ public function getSslOrder(int $id): Result {
2483+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
2484+ $cacheName = "getsslorder-{$id}";
2485+ $cache = $this->cache->get($cacheName);
2486+ if ($this->cache->resurrect($cache)) return Result::Success('', $cache);
2487+
2488+ $uri = "/ssl/orders/{$id}";
2489+ // kys($uri);
2490+ $curl = $this->setupCurl($uri);
2491+ $res = $this->curlResult($curl);
2492+ if (isset($res->data['data'])) {
2493+ $res->data['id'] = $id;
2494+ $this->cache->set($cacheName, $res->data);
2495+ return Result::Success('SSL注文の受け取りに成功。', $res->data);
2496+ }
2497+
2498+ return Result::Error('SSL注文の受け取りに失敗。');
2499+ }
2500+
2501+ /**
2502+ * SSL注文の更新
2503+ * @todo テスト
2504+ *
2505+ * @param int $id SSL注文ID
2506+ * @param array $payload フォームデータ
2507+ * @return Result
2508+ */
2509+ public function updateSslOrder(int $id, array $payload = []): Result {
2510+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
2511+
2512+ $uri = "/ssl/orders/{$id}";
2513+ $curl = $this->setupCurl($uri, 'PUT', $payload);
2514+ $res = $this->curlResult($curl);
2515+ if (isset($res->data['data'])) {
2516+ $this->cache->murder("getsslorder-{$id}");
2517+ $this->cache->murder('listsslorders');
2518+ if ($res->data['data']['success']) return Result::Success('SSL注文の更新に成功。', $res->data);
2519+ }
2520+
2521+ return Result::Error('SSL注文の更新に失敗。');
2522+ }
2523+
2524+ /**
2525+ * SSL注文のキャンセル
2526+ * @todo テスト
2527+ *
2528+ * @param int $id SSL注文ID
2529+ * @return Result
2530+ */
2531+ public function cancelSslOrder(int $id): Result {
2532+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
2533+
2534+ $payload = ['id' => $id];
2535+ $uri = "/ssl/orders/{$id}/cancel";
2536+ $curl = $this->setupCurl($uri, 'POST', $payload);
2537+ $res = $this->curlResult($curl);
2538+ if (isset($res)) {
2539+ $this->cache->murder("getsslorder-{$id}");
2540+ $this->cache->murder('listsslorders');
2541+ return Result::Success('SSL注文のキャンセルに成功。', $res->data);
2542+ }
2543+
2544+ return Result::Error("SSL注文のキャンセルに失敗。");
2545+ }
2546+
2547+ /**
2548+ * SSL注文の再発行
2549+ * @todo テスト
2550+ *
2551+ * @param int $id SSL注文ID
2552+ * @param array $payload フォームデータ
2553+ * @return Result
2554+ */
2555+ public function reissueSslOrder(int $id, array $payload = []): Result {
2556+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
2557+
2558+ $uri = "/ssl/orders/{$id}/reissue";
2559+ $curl = $this->setupCurl($uri, 'POST', $payload);
2560+ $res = $this->curlResult($curl);
2561+ if (isset($res)) {
2562+ $this->cache->murder("getsslorder-{$id}");
2563+ $this->cache->murder('listsslorders');
2564+ return Result::Success('SSL注文の再発行に成功。', $res->data);
2565+ }
2566+
2567+ return Result::Error("SSL注文の再発行に失敗。");
2568+ }
2569+
2570+ /**
2571+ * SSL注文の更新
2572+ * @todo テスト
2573+ *
2574+ * @param int $id SSL注文ID
2575+ * @param array $payload フォームデータ
2576+ * @return Result
2577+ */
2578+ public function renewSslOrder(int $id, array $payload = []): Result {
2579+ if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
2580+
2581+ $uri = "/ssl/orders/{$id}/renew";
2582+ $curl = $this->setupCurl($uri, 'POST', $payload);
2583+ $res = $this->curlResult($curl);
2584+ if (isset($res)) {
2585+ $this->cache->murder("getsslorder-{$id}");
2586+ $this->cache->murder('listsslorders');
2587+ return Result::Success('SSL注文の更新に成功。', $res->data);
2588+ }
2589+
2590+ return Result::Error("SSL注文の更新に失敗。");
2591+ }
2592+
18012593 //// 注文確認担当者メール
18022594
18032595 /**
@@ -1878,7 +2670,7 @@
18782670 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
18792671 $cacheName = 'listsslproducts';
18802672 $cache = $this->cache->get($cacheName);
1881- if ($this->cache->validate($cache, $query)) return Result::Success('', $cache);
2673+ if ($this->cache->resurrect($cache, $query)) return Result::Success('', $cache);
18822674
18832675 foreach ($query as $k => $v) { if (is_bool($v)) $query[$k] = $v ? 'true' : 'false'; }
18842676 $uri = '/ssl/products?'.http_build_query($query, '', '&', PHP_QUERY_RFC3986);
@@ -1904,7 +2696,7 @@
19042696 if (!OPENPROVIDER_ENABLED) return Result::error('エラー:OpenProviderは無効です。');
19052697 $cacheName = "getsslproduct-{$id}";
19062698 $cache = $this->cache->get($cacheName);
1907- if ($this->cache->validate($cache, $id, 'id')) return Result::Success('', $cache);
2699+ if ($this->cache->resurrect($cache, $id, 'id')) return Result::Success('', $cache);
19082700 // kys($uri);
19092701 $curl = $this->setupCurl($uri);
19102702 $res = $this->curlResult($curl);