/**
* Сюда будет перенаправлен результат оплаты
* @throws NotFoundHttpException
* @throws \Exception
* @throws \Throwable
* @throws \yii\db\StaleObjectException
*/
public function actionComplete()
{
/* @var $model Invoice */
if (is_null(Yii::$app->request->get('orderId'))) {
throw new NotFoundHttpException();
}
$model = Invoice::find()
->where([
'AND',
['=', 'status', 'I'],
['=', 'orderId', Yii::$app->request->get('orderId')],
])
->one();
if (is_null($model)) {
throw new NotFoundHttpException();
}
$result = $this->module->sberbank->complete(Yii::$app->request->get('orderId'));
//Проверяем статус оплаты если всё хорошо обновим инвойс и редерекним
if (isset($result['OrderStatus']) && ($result['OrderStatus'] == $this->module->sberbank->classRegister->successStatus())) {
$model->attributes = $this->module->sberbank->classRegister->getDataForUpdate();
$model->update();
if ($this->module->successCallback) {
$callback = $this->module->successCallback;
$callback($model);
}
$this->redirect($this->module->successUrl);
} else {
if ($this->module->failCallback) {
$callback = $this->module->failCallback;
$callback($model);
}
$this->redirect($this->module->failUrl);
}
}
В модели Invoice не вижу такого свойства, attributes.... (( Что это за "магическое" свойство такое?