Example #1
0
 /**
  * Credit card payment form
  * Different form for administrators
  */
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     $form = new \Foundation\Form();
     if (\is_a($this->_controller, 'ApplyPageController')) {
         $form->newHiddenElement('ucla_ref_no', uniqid(rand()));
         $form->newHiddenElement('amount1', $amount);
         $form->newHiddenElement('itemcode1', $this->_paymentType->getVar('itemCode'));
         $form->newHiddenElement('desc1', $this->_paymentType->getVar('itemDescription'));
         $form->newHiddenElement('ref1type1', $this->_paymentType->getVar('reftypeApplicantId'));
         $form->newHiddenElement('ref1val1', $applicant->getId());
         $form->newHiddenElement('ref2type1', $this->_paymentType->getVar('reftypeForwardUrl'));
         $form->newHiddenElement('ref2val1', $this->_controller->getServerPath() . $this->_controller->getActionPath());
         $form->newHiddenElement('signouturl', $this->_controller->absolutePath('transaction/' . \urlencode(get_class($this))));
         if ($this->_controller->getConfig()->getStatus() == 'PRODUCTION') {
             $form->setAction(self::CASHNET_URL . $this->_paymentType->getVar('liveSiteName'));
         } else {
             $form->setAction(self::CASHNET_URL . $this->_paymentType->getVar('devSiteName'));
         }
         $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> &#36;{$amount}</p>");
         $form->newButton('submit', 'Pay with Credit Card');
     } else {
         $field = $form->newField();
         $field->setLegend($this->_paymentType->getName());
         $field->setInstructions("<p>Credit card details should be enterd directly at the cashnet website and then the transaction ID entered here.</p>");
         $element = $field->newElement('TextInput', 'transactionId');
         $element->setLabel('Transaction ID');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         //we pass the amount back as a hidden element so PaymentPage will have it again
         $form->newHiddenElement('amount', $amount);
         $form->newButton('submit', 'Lookup Transaction');
     }
     return $form;
 }
Example #2
0
 /**
  * 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> &#36;{$amount}</p>");
         $form->newButton('submit', 'Pay with Credit Card');
     } else {
         $form = parent::paymentForm($applicant, $amount);
     }
     return $form;
 }
Example #3
0
 /**
  * Lock Pages are always incomplete
  */
 public function getStatus()
 {
     if ($this->_applicant->isLocked()) {
         return self::COMPLETE;
     }
     return self::INCOMPLETE;
 }
Example #4
0
 public function getXmlAnswers(\DOMDocument $dom, $version)
 {
     $answers = array();
     foreach ($this->_applicant->findAnswersByPage($this->_applicationPage->getPage()) as $answer) {
         $answers[] = $this->xmlAnswer($dom, $answer, $version);
     }
     return $answers;
 }
Example #5
0
 public function do_unskip()
 {
     $answers = $this->_applicant->findAnswersByPage($this->_applicationPage->getPage());
     if (count($answers) and $answers[0]->getPageStatus() == self::SKIPPED) {
         $this->_applicant->getAnswers()->removeElement($answers[0]);
         $this->_controller->getEntityManager()->remove($answers[0]);
     }
 }
 /**
  * Check credentials and intialize members
  */
 public function beforeAction()
 {
     parent::beforeAction();
     if (!isset($this->_store->applicantID)) {
         //Not authenticated
         $this->addMessage('error', "You are not logged in or your session has expired.  Please log in again");
         $this->redirectApplyPath('applicant/login');
     }
     $this->_applicant = $this->_em->getRepository('\\Jazzee\\Entity\\Applicant')->find($this->_store->applicantID);
     //make sure the url path is the actual application
     if ($this->_application != $this->_applicant->getApplication()) {
         $this->redirectApplyPath('applicant/login');
     }
     foreach ($this->_pages as $applicationPage) {
         $applicationPage->getJazzeePage()->setApplicant($this->_applicant);
     }
     $this->setVar('applicant', $this->_applicant);
 }
Example #7
0
 /**
  * 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> &#36;{$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;
 }
Example #8
0
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     $form = new \Foundation\Form();
     $form->setAction($this->_controller->getActionPath());
     $form->newHiddenElement('amount', $amount);
     $field = $form->newField();
     $field->setLegend($this->_paymentType->getName());
     $field = $form->newField();
     $instructions = "<p><strong>Application Fee:</strong> &#36;{$amount}</p>";
     $instructions .= '<p><strong>Make Checks Payable to:</strong> ' . $this->_paymentType->getVar('payable') . '</p>';
     if ($this->_paymentType->getVar('address')) {
         $instructions .= '<p><h4>Mail Check to:</h4>' . nl2br($this->_paymentType->getVar('address')) . '</p>';
     }
     if ($this->_paymentType->getVar('coupon')) {
         $instructions .= '<p><h4>Include the following information with your payment:</h4> ' . nl2br($this->_paymentType->getVar('coupon')) . '</p>';
     }
     $search = array('_Applicant_Name_', '_Applicant_ID_', '_Program_Name_', '_Program_ID_');
     $replace = array();
     $replace[] = $applicant->getFirstName() . ' ' . $applicant->getLastName();
     $replace[] = $applicant->getId();
     $replace[] = $applicant->getApplication()->getProgram()->getName();
     $replace[] = $applicant->getApplication()->getProgram()->getId();
     $instructions = str_ireplace($search, $replace, $instructions);
     $instructions .= '<p>Click the Pay By Check button to pay your fee by check.  Your account will be temporarily credited and you can complete your application.  Your application will not be reviewed until your check is recieved.</p>';
     $field->setInstructions($instructions);
     $form->newButton('submit', 'Pay By Check');
     return $form;
 }
Example #9
0
 /**
  * PDF a full single applicant
  * @param \Jazzee\Entity\Applicant $applicant
  * @return string the PDF buffer suitable for display
  */
 public function pdf(\Jazzee\Entity\Applicant $applicant)
 {
     $this->setFont('p');
     $this->pdf->set_info("Title", $this->pdf->convert_to_unicode('utf8', $applicant->getFullName(), '') . ' Application');
     $this->addText($applicant->getFullName() . "\n", 'h1');
     $this->addText('Email Address: ' . $applicant->getEmail() . "\n", 'p');
     $this->write();
     foreach ($applicant->getApplication()->getApplicationPages(\Jazzee\Entity\ApplicationPage::APPLICATION) as $page) {
         if ($page->getJazzeePage() instanceof \Jazzee\Interfaces\PdfPage) {
             $page->getJazzeePage()->setApplicant($applicant);
             $page->getJazzeePage()->setController($this->_controller);
             $page->getJazzeePage()->renderPdfSection($this);
         }
     }
     $this->write();
     $this->pdf->end_page_ext("");
     $this->attachPdfs();
     $this->pdf->end_document("");
     return $this->pdf->get_buffer();
 }
Example #10
0
 /**
  * PDF a full single applicant
  * @param \Jazzee\Entity\Applicant $applicant
  * @return string the PDF buffer suitable for display
  */
 public function pdf(\Jazzee\Entity\Applicant $applicant)
 {
     $this->pdf->set_info("Title", $this->pdf->convert_to_unicode('utf8', $applicant->getFullName(), '') . ' Application');
     $this->addText($applicant->getFullName() . "\n", 'h1');
     $this->addText('Email Address: ' . $applicant->getEmail() . "\n", 'p');
     if ($applicant->isLocked()) {
         switch ($applicant->getDecision()->status()) {
             case 'finalDeny':
                 $status = 'Denied';
                 break;
             case 'finalAdmit':
                 $status = 'Admited';
                 break;
             case 'acceptOffer':
                 $status = 'Accepted';
                 break;
             case 'declineOffer':
                 $status = 'Declined';
                 break;
             default:
                 $status = 'No Decision';
         }
     } else {
         $status = 'Not Locked';
     }
     $this->addText("Admission Status: {$status}\n", 'p');
     $this->write();
     foreach ($applicant->getApplication()->getApplicationPages(\Jazzee\Entity\ApplicationPage::APPLICATION) as $page) {
         if ($page->getJazzeePage() instanceof \Jazzee\Interfaces\PdfPage) {
             $page->getJazzeePage()->setApplicant($applicant);
             $page->getJazzeePage()->setController($this->_controller);
             $page->getJazzeePage()->renderPdfSection($this);
         }
     }
     $this->write();
     $this->pdf->end_page_ext("");
     foreach ($applicant->getAttachments() as $attachment) {
         $this->addPdf($attachment->getAttachment());
     }
     $this->attachPdfs();
     $this->pdf->end_document("");
     return $this->pdf->get_buffer();
 }
Example #11
0
 /**
  * Single applicants xml
  * @param \Jazzee\Entity\Applicant $applicant
  * @param boolean $partial - fetch only applicant not answers
  * @return DOMElement
  */
 protected function singleApplicant(\Jazzee\Entity\Applicant $applicant, $partial = true)
 {
     $xml = $applicant->toXml($this, $partial, $this->version);
     $node = $this->dom->importNode($xml->documentElement, true);
     return $node;
 }
Example #12
0
 /**
  * Get an applicants pdfs
  * @param \Jazzee\Entity\Applicant $applicant
  */
 public function getAttachments(\Jazzee\Entity\Applicant $applicant)
 {
     $attachments = array('attachments' => array(), 'allowAttach' => $this->checkIsAllowed($this->controllerName, 'attachApplicantPdf'), 'allowDelete' => $this->checkIsAllowed($this->controllerName, 'deleteApplicantPdf'));
     foreach ($applicant->getAttachments() as $attachment) {
         $base = $applicant->getFullName() . '_attachment_' . $attachment->getId();
         //remove slashes in path to fix an apache issues with encoding slashes in redirects
         $base = str_replace(array('/', '\\'), 'slash', $base);
         $pdfName = $base . '.pdf';
         $pngName = $base . 'preview.png';
         \Jazzee\Globals::getFileStore()->createSessionFile($pdfName, $attachment->getAttachmentHash());
         if ($attachment->getThumbnailHash() != null) {
             \Jazzee\Globals::getFileStore()->createSessionFile($pngName, $attachment->getThumbnailHash());
             $thumbnailPath = \Jazzee\Globals::path('file/' . \urlencode($pngName));
         } else {
             $thumbnailPath = \Jazzee\Globals::path('resource/foundation/media/default_pdf_logo.png');
         }
         $attachments['attachments'][] = array('id' => $attachment->getId(), 'filePath' => $this->path('file/' . \urlencode($pdfName)), 'previewPath' => $this->path('file/' . $thumbnailPath));
     }
     return $attachments;
 }
Example #13
0
 /**
  * PDF a full single applicant
  * @param \Jazzee\Entity\Applicant $applicant
  * @return string the PDF buffer suitable for display
  */
 public function pdf(\Jazzee\Entity\Applicant $applicant)
 {
     $elements = array('applicant' => array(), 'pages' => array());
     $elements['applicant']['firstName'] = $applicant->getFirstName();
     $elements['applicant']['lastName'] = $applicant->getLastName();
     $elements['applicant']['middleName'] = $applicant->getMiddleName();
     $elements['applicant']['fullName'] = $applicant->getFullName();
     $elements['applicant']['suffix'] = $applicant->getSuffix();
     $elements['applicant']['email'] = $applicant->getEmail();
     $elements['applicant']['id'] = $applicant->getId();
     $elements['applicant']['externalid'] = $applicant->getExternalId();
     if ($applicant->isLocked()) {
         switch ($applicant->getDecision()->status()) {
             case 'finalDeny':
                 $status = 'Denied';
                 break;
             case 'finalAdmit':
                 $status = 'Admited';
                 break;
             case 'acceptOffer':
                 $status = 'Accepted';
                 break;
             case 'declineOffer':
                 $status = 'Declined';
                 break;
             default:
                 $status = 'No Decision';
         }
     } else {
         $status = 'Not Locked';
     }
     $elements['applicant']['status'] = $status;
     foreach ($applicant->getApplication()->getApplicationPages() as $applicationPage) {
         if ($applicationPage->getJazzeePage() instanceof \Jazzee\Interfaces\PdfPage) {
             $applicationPage->getJazzeePage()->setApplicant($applicant);
             $applicationPage->getJazzeePage()->setController($this->_controller);
             $elements['pages'][$applicationPage->getPage()->getId()] = $applicationPage->getJazzeePage()->getPdfTemplateValues();
         }
     }
     return $this->generatePDF($elements);
 }