public function onCount() { return; $settings_model = new waAppSettingsModel(); $settings = $settings_model->get('wacab'); if (!isset($settings['count']) || $settings['count'] == 0) { return null; } if (!isset($settings['count_ts'])) { $settings_model->set('wacab', 'count_ts', time()); return null; } if (!isset($settings['timeout'])) { $settings['timeout'] = 60; } if (time() - $settings['count_ts'] < $settings['timeout'] * 60) { return null; } $auth = new wacabWaauth(); $new = new wacabGetpayment(); $ps = $new->getPayment($auth); if (isset($settings['new_count'])) { $newcount = $settings['new_count'] + $ps; } else { $newcount = 0; } $settings_model->set('wacab', 'new_count', $newcount); $settings['count_ts'] = time(); unset($auth); if ($newcount == 0) { return null; } else { return array('count' => $newcount, 'url' => wa()->getUrl(true) . 'wacab/#/transactions/'); } }
/** * Получение и обработка данных о платежах из кабинета WA в формате json */ public function execute() { $auth = new wacabWaauth(); $new = new wacabGetpayment(); $ps = $new->getPayment($auth); unset($auth); $this->response = $ps; }