/** * Display a form which posts to authorize.net's server */ public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount) { if (\is_a($this->_controller, 'ApplyPageController')) { $time = time(); $fpSequence = $applicant->getId() . $time; $form = new \Foundation\Form(); $form->newHiddenElement('x_show_form', 'PAYMENT_FORM'); $form->newHiddenElement('x_amount', $amount); $form->newHiddenElement('x_test_request', $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? 0 : 1); $form->newHiddenElement('x_fp_sequence', $fpSequence); $form->newHiddenElement('x_fp_hash', \AuthorizeNetSIM_Form::getFingerprint($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayKey'), $amount, $fpSequence, $time)); $form->newHiddenElement('x_fp_timestamp', $time); $form->newHiddenElement('x_relay_response', "TRUE"); $form->newHiddenElement('x_relay_url', $this->_controller->getServerPath() . $this->_controller->getActionPath() . '/../../../../../transaction/' . \urlencode(get_class($this))); $form->newHiddenElement('x_cancel_url', $this->_controller->getServerPath() . $this->_controller->getActionPath()); $form->newHiddenElement('redirect_url', $this->_controller->getServerPath() . $this->_controller->getActionPath()); $form->newHiddenElement('x_login', $this->_paymentType->getVar('gatewayId')); $form->newHiddenElement('x_cust_id', $applicant->getId()); $form->newHiddenElement('x_customer_ip', $_SERVER['REMOTE_ADDR']); $form->newHiddenElement('x_email', $applicant->getEmail()); $form->newHiddenElement('x_email_customer', 0); $form->newHiddenElement('x_description', $this->_paymentType->getVar('description')); $form->setAction($this->_paymentType->getVar('testAccount') ? \AuthorizeNetDPM::SANDBOX_URL : \AuthorizeNetDPM::LIVE_URL); $field = $form->newField(); $field->setLegend($this->_paymentType->getName()); $field->setInstructions("<p>Clicking the 'Pay with Credit Card' button will redirect you to a secure payment page. Once you have completed your transaction you will be returned to the application.<strong>Application Fee:</strong> ${$amount}</p>"); $form->newButton('submit', 'Pay with Credit Card'); } else { $form = parent::paymentForm($applicant, $amount); } return $form; }
/** * Display a form which posts to authorize.net's server */ public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount) { if (\is_a($this->_controller, 'ApplyPageController')) { $time = time(); $fpSequence = $applicant->getId() . $time; $form = new \Foundation\Form(); $form->newHiddenElement('x_amount', $amount); $form->newHiddenElement('x_test_request', $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? 0 : 1); $form->newHiddenElement('x_fp_sequence', $fpSequence); $form->newHiddenElement('x_fp_hash', \AuthorizeNetDPM::getFingerprint($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayKey'), $amount, $fpSequence, $time)); $form->newHiddenElement('x_fp_timestamp', $time); $form->newHiddenElement('x_relay_response', "TRUE"); $form->newHiddenElement('x_relay_url', $this->_controller->getServerPath() . $this->_controller->getActionPath() . '/../../../../../transaction/' . \urlencode(get_class($this))); $form->newHiddenElement('redirect_url', $this->_controller->getServerPath() . $this->_controller->getActionPath()); $form->newHiddenElement('x_login', $this->_paymentType->getVar('gatewayId')); $form->newHiddenElement('x_cust_id', $applicant->getId()); $form->newHiddenElement('x_customer_ip', $_SERVER['REMOTE_ADDR']); $form->newHiddenElement('x_email', $applicant->getEmail()); $form->newHiddenElement('x_email_customer', 0); $form->newHiddenElement('x_description', $this->_paymentType->getVar('description')); $form->setAction($this->_paymentType->getVar('testAccount') ? \AuthorizeNetDPM::SANDBOX_URL : \AuthorizeNetDPM::LIVE_URL); $field = $form->newField(); $field->setLegend($this->_paymentType->getName()); $field->setInstructions("<p><strong>Application Fee:</strong> ${$amount}</p>"); $element = $field->newElement('TextInput', 'x_card_num'); $element->setLabel('Credit Card Number'); $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element)); $element = $field->newElement('TextInput', 'x_exp_date'); $element->setLabel('Expiration Date'); $element->setFormat('mm/yy eg ' . date('m/y')); $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element)); $element = $field->newElement('TextInput', 'x_card_code'); $element->setLabel('CCV'); $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element)); $element = $field->newElement('TextInput', 'x_zip'); $element->setLabel('Billing Postal Code'); $element->setInstructions('US Credit Cards which do not provide a postal code will be rejected.'); $form->newButton('submit', 'Pay with Credit Card'); } else { $form = parent::paymentForm($applicant, $amount); } return $form; }