public function completeTransferAction($transferId) { $transfer = Money\Transfer::get($transferId); $result = new Server\Result(); $result->success = $transfer->complete(); $result->successMsg = 'Перевод был завершен'; $result->content = 'Не удалось завершить перевод'; $result->send(); }
public function cancelTransferAction($transferId = 0) { $transfer = Money\Transfer::get((int) $transferId); if (!$transfer || $transfer->user_id != \Users\User::$cur->id || $transfer->complete || $transfer->canceled) { Tools::redirect('/', 'Такой перевод не найден'); } $transfer->cancel(); Tools::redirect('/users/cabinet', 'Перевод был успешно отменен', 'success'); }
if ($rate->currency_id == $wallet->currency_id && !empty($wallets[$rate->target_currency_id])) { echo "<a href = '/money/exchange?currency_id={$wallet->currency_id}'>Обменять</a>"; break; } } if ($wallet->currency->transfer) { echo " <a href ='/money/transfer?currency_id={$wallet->currency_id}'>Перевести</a><br />"; } echo " <a href ='/users/cabinet/walletHistory?currency_id={$wallet->currency_id}'>История</a>"; echo " <a href ='/users/cabinet/walletBlocked?currency_id={$wallet->currency_id}'>Блокировки</a>"; ?> </div> <?php } ?> </div> <?php $transfers = Money\Transfer::getList(['where' => [['user_id', \Users\User::$cur->id], ['complete', 0], ['canceled', 0]]]); if ($transfers) { echo "<h3>У вас есть незаконченные переводы</h3>"; echo "<ul>"; foreach ($transfers as $transfer) { echo "<li><a href = '/money/confirmTransfer/{$transfer->id}'>{$transfer->name()}</a></li>"; } echo "</ul>"; } $pays = \Money\Pay::getList(['where' => [['pay_status_id', 1], ['user_id', \Users\User::$cur->id]]]); if ($pays) { echo "<h3>У вас есть неоплаченные счета</h3>"; $this->content(['module' => \App::$cur->money, 'content' => 'pays', 'data' => compact('pays')]); }