コード例 #1
0
ファイル: payflow.php プロジェクト: grlf/eyedock
 public function ccAction()
 {
     // invoice must be set to this point by the plugin
     if (!$this->invoice) {
         throw new Am_Exception_InternalError('Empty invoice - internal error!');
     }
     $this->form = $this->createForm();
     $this->getDi()->hook->call(Bootstrap_Cc::EVENT_CC_FORM, array('form' => $this->form));
     $trans = new Am_Paysystem_Payflow_Transaction_CreateSecureToken($this->plugin, $this->invoice, true);
     $res = new Am_Paysystem_Result();
     $trans->run($res);
     //var_dump($res);exit();
     //if (!$res->isSuccess())
     //    throw new Am_Exception_Paysystem("Internal error - cannot get secure token from PayPal API");
     $token = $trans->getToken();
     $frm = new Am_Form();
     $params = array('SECURETOKENID' => $trans->getTokenId(), 'SECURETOKEN' => $trans->getToken(), 'CANCELURL' => $this->plugin->getCancelUrl(), 'DISABLERECEIPT' => true, 'EMAILCUSTOMER' => true, 'INVNUM' => $this->invoice->public_id, 'TEMPLATE' => 'MINLAYOUT', 'SHOWAMOUNT' => (double) $this->invoice->first_total <= 0 ? false : true);
     if ($this->plugin->getConfig('testing')) {
         $params['MODE'] = 'TEST';
     }
     $params = http_build_query($params);
     $html = '<iframe src="https://payflowlink.paypal.com?' . $params . '" ' . 'name="payflow_iframe" scrolling="no" width="570px" height="540px"></iframe>';
     $frm->addHtml()->setHtml($html)->addClass('no-label');
     $this->view->form = $frm;
     $this->view->invoice = $this->invoice;
     $this->view->display_receipt = true;
     $this->view->layoutNoMenu = true;
     $this->view->display('cc/info.phtml');
 }