関数
LinePay::init()
戻り値 戻り値
ファイル: src/LinePay.php
public function init() {
$this->clientErrorStore = new Errors\ClientErrorStore($this);
$this->adminErrorStore = new Errors\AdminErrorStore($this);
$this->clientErrorStore->populate();
$this->adminErrorStore->populate();
$opts = $this->getActingOpts();
$this->api = new Api\Client(
$this,
$opts['sandbox'] === true ? Config\Constants::SANDBOX_API : Config\Constants::LIVE_API,
$opts['channel_id'],
$opts['channel_secret_key']
);
$ready = $this->ready();
add_action('init', function () use ($ready) {
if ($ready === true) {
$this->routes = new Routes\Routes($this);
$this->routes->dispatcher->listen();
}
}, 11);
(new DeliveryPage($this))->init();
(new Views\ConfirmPage\ConfirmPage($this))->init()->addHooks();
if (is_admin()) {
// create settlement module settings page
(new Admin\SettlementSettings($this))->init();
if ($ready === true) {
(new Admin\Views\OrderEditPage\OrderEditPage($this))->addHooks();
(new Admin\Views\OrderListPage($this))->init()->addHooks();
}
}
usces_register_action(
'wcexalpCompletePurchase',
'get',
'wcexalpCompletePurchase',
null,
function () {
$confirm = new Api\Confirm($this);
$confirm->init()->addHooks();
$confirm->middleware($_GET); // route guards
$confirm->fulfillOrder($_GET);
}
);
}