/** * @param Request $request * @return Response * @throws \Exception */ public function __invoke(Request $request) { $walletId = $request->get('walletId'); $walletDto = $this->walletServiceFacade->getWallet($walletId); $this->checkAuthorizationForWallet($walletDto); $createTransactionCommand = $this->createCreateTransactionCommand($walletId); $user = $this->getUser(); $createTransactionForm = $this->transactionFormFactory->createCreateForm($createTransactionCommand, $user->getId()->getValue()); $createTransactionForm->handleRequest($request); if (!$createTransactionForm->isValid()) { $validationMsg = $this->getAllFormErrorMessagesAsString($createTransactionForm); $this->addFlash('error', $this->trans('create_transaction_form.flash.invalid_form') . ' ' . $validationMsg); } else { /** @var CreateTransactionCommand $createTransactionCommand */ $createTransactionCommand = $createTransactionForm->getData(); try { $commandValidator = new CreateTransactionCommandValidator(); $commandValidator->validate($createTransactionCommand); $this->commandBus->handle($createTransactionCommand); $this->addFlash('success', $this->trans('transaction.flash.create_successfully')); $url = $this->router->generate('bc_app_wallet_transaction.index', array('walletId' => $createTransactionCommand->getWalletId())); return new RedirectResponse($url); } catch (\Exception $e) { $this->addFlash('error', $e->getMessage()); } } $walletDto = $this->walletServiceFacade->getWallet($walletId); return $this->renderTransactionShowNew($request, $createTransactionForm->createView(), $walletDto); }
/** * @param Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function __invoke(Request $request) { $walletId = $request->get('walletId'); $walletDto = $this->walletServiceFacade->getWallet($walletId); $this->checkAuthorizationForWallet($walletDto); $AddressListItemDtos = $this->walletServiceFacade->listWalletAddresses($walletId); $template = $this->getBaseTemplatePrefix() . ':Address:index.html'; // TODO: paging $currentPage = 1; $maxPages = 0; // get_max_pages(num_items=address_details['final_n_tx'], items_per_page=TXNS_PER_PAGE), return $this->templating->renderResponse($template . '.' . $this->getEngine(), array_merge($this->getBasicTemplateVariables($request), array('current_page' => $currentPage, 'max_pages' => $maxPages, 'num_all_addresses' => count($AddressListItemDtos), 'wallet' => $walletDto, 'addresses' => $AddressListItemDtos))); }
/** * @param Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function __invoke(Request $request) { $user = $this->getUser(); //$token = $this->tokenStorage->getToken(); //var_dump($token); //die(); if (!$user) { throw $this->createAccessDeniedException(); } $walletListItemDtos = $this->walletServiceFacade->listWalletsOfUserId($user->getId()->getValue()); $template = $this->getBaseTemplatePrefix() . ':Wallet:index.html'; // TODO: paging $currentPage = 1; $maxPages = 0; // get_max_pages(num_items=address_details['final_n_tx'], items_per_page=TXNS_PER_PAGE), return $this->templating->renderResponse($template . '.' . $this->getEngine(), array_merge($this->getBasicTemplateVariables($request), array('current_page' => $currentPage, 'max_pages' => $maxPages, 'num_all_wallets' => count($walletListItemDtos), 'wallets' => $walletListItemDtos))); }
/** * @param Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function __invoke(Request $request) { $walletId = $request->get('walletId'); $walletDto = $this->walletServiceFacade->getWallet($walletId); $this->checkAuthorizationForWallet($walletDto); $walletTransactionDto = $this->walletServiceFacade->listWalletTransactions($walletId); $transactions = $walletTransactionDto->getTransactionListItemDtos(); $template = $this->getBaseTemplatePrefix() . ':Transaction:index.html'; // TODO: paging $currentPage = 1; $maxPages = 0; // get_max_pages(num_items=address_details['final_n_tx'], items_per_page=TXNS_PER_PAGE), // DEBUG //var_dump($this->getBasicTemplateVariables($request)); //die(); return $this->templating->renderResponse($template . '.' . $this->getEngine(), array_merge($this->getBasicTemplateVariables($request), array('current_page' => $currentPage, 'max_pages' => $maxPages, 'wallet' => $walletDto, 'num_all_txns' => $walletTransactionDto->getNTx(), 'num_unconfirmed_txns' => $walletTransactionDto->getUnconfirmedNTx(), 'all_transactions' => $transactions))); }