public static function chStatusOld($id, $status) { try { self::$o_erip = new \Dm\Erip(); self::$opt_status = \Bitrix\Main\Config\Option::get(self::$module_id, "order_status_code_erip"); self::$opt_payment = \Bitrix\Main\Config\Option::get(self::$module_id, "payment_system_id"); self::$values = CSaleOrder::GetList(array(), array("ID" => $id), false, false, array("ID", "PAY_SYSTEM_ID", "PRICE", "CURRENCY", "STATUS_ID"))->Fetch(); if (self::$values["PAY_SYSTEM_ID"] == self::$opt_payment && $status != self::$values["STATUS_ID"] && $status == self::$opt_status) { static::setTehnicalInfo(); static::setUserInfo(); static::setMoneyInfo(); $r = self::$o_erip->submit(); self::$o_response = json_decode($r); if (isset(self::$o_response->errors)) { throw new \Exception(self::$o_response->message); } if (CSaleOrder::Update($id, array("COMMENTS" => "status: " . self::$o_response->transaction->status . "\n" . "transaction_id: " . self::$o_response->transaction->transaction_id . "\n" . "order_id: " . self::$o_response->transaction->order_id . "\n" . "account_number: " . self::$o_response->transaction->erip->account_number . "\n"))) { static::sendMail(); } return true; } } catch (Exception $e) { $GLOBALS["APPLICATION"]->ThrowException($e->getMessage()); return false; } }
public static function setEripOrderAutomatic($id, $status) { try { self::$o_erip = new \Dm\Erip(); self::$opt_status = \Bitrix\Main\Config\Option::get(self::$module_id, "order_status_code_erip"); self::$opt_payment = \Bitrix\Main\Config\Option::get(self::$module_id, "payment_system_id"); self::$values = CSaleOrder::GetList(array(), array("ID" => $id), false, false, array("ID", "PAY_SYSTEM_ID", "PRICE", "CURRENCY", "STATUS_ID"))->Fetch(); if (self::$values["PAY_SYSTEM_ID"] == self::$opt_payment && $status != self::$values["STATUS_ID"] && $status == self::$opt_status) { self::set_and_send(); if (CSaleOrder::Update($id, array("COMMENTS" => "status: " . self::$o_response->transaction->status . "\n" . "transaction_id: " . self::$o_response->transaction->transaction_id . "\n" . "order_id: " . self::$o_response->transaction->order_id . "\n" . "account_number: " . self::$o_response->transaction->erip->account_number . "\n"))) { static::sendMail(); } return true; } } catch (Exception $e) { return $e->getMessage(); } }