-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolling.php
36 lines (30 loc) · 1008 Bytes
/
polling.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace ascio\lib;
require_once(__DIR__."/vendor/autoload.php");
use ascio\lib\Ascio;
use ascio\lib\AscioEnvironment;
use ascio\lib\v2\Callback;
use ascio\v3\GetOrder;
use ascio\v3\GetOrderRequest;
use ascio\v2\AckMessage;
Ascio::setEnvironment(AscioEnvironment::Testing);
Ascio::setConfigFile("/Users/ml/ownCloud/Keys/ascio/ascio.json");
function poll() {
$callback = new Callback();
try {
$callback->pollCron();
} catch (AscioException $e) {
$client = Ascio::getClientV3();
$request = new GetOrderRequest();
$request->setOrderId($callback->getOrder()->getOrderId());
$result = $client->GetOrder(new GetOrder($request));
if($result->getOrderInfo()) {
//TODO: Replace with V3 Polling
Tools::debug("Skip SSL Certificate");
$msgId = $callback->getQueueItem()->getMsgId();
Ascio::getClientV2()->AckMessage(new AckMessage(0,$msgId));
poll();
}
}
}
poll();