public function ccAction() { $pageForm = new LandlordsInsuranceQuote_Form_CreditCard(); $pageForm->setAction($this->_params->secpay->get('host')); $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($this->_quoteID); $premiums = $quoteManager->calculatePremiums(); $fees = $quoteManager->getFees(); $remotePassword = $this->_params->secpay->get('remotepassword'); // TODO: We need the payment frequency here, for testing I'm assuming monthly $this->view->payMonthly = $paymentFequency = $quoteManager->getPayFrequency(); if ($paymentFequency == "MONTHLY") { $amount = number_format($premiums['totalGrossMonthlyPremium'] + $premiums['totalGrossMonthlyIPT'] + $fees['landlords_insurance_plus_monthly_admin'], 2, '.', ''); } else { $amount = number_format($premiums['totalGrossAnnualPremium'] + $premiums['totalGrossAnnualIPT'] + $fees['landlords_insurance_plus_yearly_admin'], 2, '.', ''); } $this->view->amount = $amount; $policyNumber = str_replace("Q", "P", $quoteManager->getPolicyNumber()); $formData = array(); $formData['merchant'] = $this->_params->secpay->get('merchant'); $formData['policynumber'] = $policyNumber; $formData['trans_id'] = $policyNumber; $formData['refno'] = $this->_customerReferenceNumber; $formData['paymentfrequency'] = $paymentFequency; $formData['amount'] = $amount; $successCallback = $this->_params->secpay->landlords->get('success_callback'); $failedCallback = $this->_params->secpay->landlords->get('failed_callback'); // Secpay uses semicolon seperated values for the two calbacks; $formData['callback'] = $successCallback . ";" . $failedCallback; $formData['template'] = $this->_params->secpay->landlords->get('template'); $formData['repeat'] = $this->_params->secpay->get('repeat'); $formData['test_status'] = $this->_params->secpay->get('test_status'); $formData['test_mpi_status'] = $this->_params->secpay->get('test_mpi_status'); $formData['usage_type'] = $this->_params->secpay->get('usage_type'); $formData['cb_flds'] = "refno:card_type:policynumber:paymentfrequency:webleadsummaryid"; $formData['cb_card_type'] = ""; $formData['webleadsummaryid'] = $this->_webLeadSummaryId; $digestkey = md5($policyNumber . $amount . $remotePassword); $formData['digest'] = $digestkey; // Render the page unless we have been redirected $this->view->formAction = $this->_params->secpay->get('host'); $pageForm->populate($formData); $html = $pageForm->render(); $this->view->form = $pageForm; }