public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs) { $invoice = $this->getDi()->invoiceTable->findBySecureId($request->getFiltered('id'), $this->getId()); if (!$invoice) { throw new Am_Exception_InputError(___("Sorry, seems you have used wrong link")); } $view = new Am_View(); $html = $this->getConfig('html', 'SITE OWNER DID NOT PROVIDE INSTRUCTIONS FOR OFFLINE PAYMENT YET'); $tpl = new Am_SimpleTemplate(); $tpl->receipt_html = $view->partial('_receipt.phtml', array('invoice' => $invoice)); $tpl->invoice = $invoice; $tpl->user = $this->getDi()->userTable->load($invoice->user_id); $tpl->invoice_id = $invoice->invoice_id; $tpl->cancel_url = REL_ROOT_URL . '/cancel?id=' . $invoice->getSecureId('CANCEL'); $tpl->invoice_title = $invoice->getLineDescription(); $view->content = $tpl->render($html); $view->title = $this->getTitle(); $response->setBody($view->render("layout.phtml")); }
protected function displayReuse() { $result = new Am_Paysystem_Result(); $tr = new Am_Paysystem_Transaction_Stripe_GetCustomer($this->plugin, $this->invoice, $this->invoice->getUser()->data()->get(Am_Paysystem_Stripe::TOKEN)); $tr->run($result); if (!$result->isSuccess()) { throw new Am_Exception_Paysystem("Stored customer profile not found"); } $card = $tr->getInfo(); if ($card['active_card']['last4']) { $card = 'XXXX XXXX XXXX ' . $card['active_card']['last4']; } else { $last4 = 'XXXX'; foreach (@(array) $card['cards']['data'] as $c) { if (@$c['id'] == @$card['default_card']) { $last4 = $c['last4']; } } $card = 'XXXX XXXX XXXX ' . $last4; } $text = ___('Click "Continue" to pay this order using stored credit card %s', $card); $continue = ___('Continue'); $cancel = ___('Cancel'); $action = $this->plugin->getPluginUrl('cc'); $id = Am_Controller::escape($this->_request->get('id')); $action = Am_Controller::escape($action); $view = new Am_View(); $receipt = $view->partial('_receipt.phtml', array('invoice' => $this->invoice)); $this->view->content .= <<<CUT <div class='am-reuse-card-confirmation'> {$receipt} {$text} <form method='get' action='{$action}'> <input type='hidden' name='id' value='{$id}' /> <input type='submit' class='tb-btn tb-btn-primary' name='reuse_ok' value='{$continue}' /> <input type='submit' class='tb-btn' name='reuse_cancel' value='{$cancel}' /> </form> </div> CUT; $this->view->display('layout.phtml'); }