Exemple #1
0
 /**
  * Payments are pending with no verification
  * @see ApplyPaymentInterface::pendingPayment()
  */
 function pendingPayment(\Jazzee\Entity\Payment $payment, \Foundation\Form\Input $input)
 {
     $payment->setAmount($input->get('amount'));
     $payment->setVar('justification', $input->get('justification'));
     $payment->pending();
     return true;
 }
Exemple #2
0
 /**
  * Record transaction information pending
  * $input isn't used here becuase the DPM method uses the post data directly off the global $_POST
  */
 public function pendingPayment(\Jazzee\Entity\Payment $payment, \Foundation\Form\Input $input)
 {
     $input = false;
     $response = new \AuthorizeNetSIM($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayHash'));
     if ($response->isAuthorizeNet()) {
         if ($response->approved) {
             $payment->setAmount($response->amount);
             $payment->setVar('transactionId', $response->transaction_id);
             $payment->setVar('authorizationCode', $response->authorization_code);
             $payment->pending();
             return true;
         } else {
             $payment->setAmount($response->amount);
             $payment->setVar('transactionId', $response->transaction_id);
             $payment->setVar('rejectedReasonCode', $response->response_reason_code);
             $payment->setVar('rejectedReason', $response->response_reason_text);
             $payment->rejected();
             return true;
         }
     }
     return false;
 }
Exemple #3
0
 /**
  * Record transaction information pending
  */
 public function pendingPayment(\Jazzee\Entity\Payment $payment, \Foundation\Form\Input $input)
 {
     if (\is_a($this->_controller, 'TransactionController')) {
         foreach ($payment->getAnswer()->getApplicant()->getAnswers() as $answer) {
             if ($existingPayment = $answer->getPayment()) {
                 if ($existingPayment->getType() == $payment->getType() and $existingPayment->getVar('UCLA_REF_NO') == $input->get('UCLA_REF_NO')) {
                     //UCLA double posts transactions so if we have already stored this answer then we shouldn't store it again.
                     return false;
                 }
             }
         }
         $payment->setAmount($input->get('amount1') ? $input->get('amount1') : 0);
         if ($input->get('result') == '0') {
             $payment->setVar('tx', $input->get('tx'));
             $payment->pending();
             $client = new \SoapClient(self::CASHNET_WSDL);
             $parameters = array('OperatorID' => $this->_paymentType->getVar('operatorId'), 'Password' => $this->_paymentType->getVar('operatorPassword'), 'VirtualDirectory' => $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? self::CASHNET_VIRTUALDIRECTORY : self::CASHNET_TEST_VIRTUALDIRECTORY, 'TransactionNo' => $payment->getVar('tx'));
             $results = $client->CASHNetSOAPRequestInquiry(array('inquiryParams' => $parameters));
             $xml = new \SimpleXMLElement($results->CASHNetSOAPRequestInquiryResult);
             if ($xml->result != 0) {
                 $this->_controller->log("Unable to get transaction details from cashnet for transaction: {$payment->getVar('tx')} for applicant {$payment->getAnswer()->getApplicant()->getId()}.  Cashnet said: {$xml->respmessage}", \Monolog\Logger::ERROR);
             } else {
                 if ($xml->transactions[0]->transaction->txno == $payment->getVar('tx') and $xml->transactions[0]->transaction->totalamount == $payment->getAmount()) {
                     if (strtolower($xml->transactions[0]->transaction->txstatus) == 'c') {
                         $payment->setVar('tx', $xml->transactions[0]->transaction->txno);
                         $payment->settled();
                     } else {
                         //for unspecified reasons sometimes a voided/cancled transaction gets sent, these need to be marked
                         //as rejected.  Its unclear if they would normally have a transaction 'result' or zero so we have to be carefull
                         $payment->setVar('rejectedReason', $xml->transactions[0]->transaction->respmessage);
                         $payment->rejected();
                     }
                 } else {
                     throw new \Jazzee\Exception("Transaction details differ between cashnet and payment for applicant {$payment->getAnswer()->getApplicant()->getId()}.  Payment (TX: {$payment->getVar('tx')}, Ammount: {$payment->getAmount()}) Cashnet Payment (TX: {$xml->transactions[0]->transaction->txno}, Amount: {$xml->transactions[0]->transaction->totalamount}) ");
                 }
             }
         } else {
             $payment->setVar('tx', $input->get('failedtx'));
             $payment->setVar('rejectedReason', $input->get('respmessage'));
             $payment->rejected();
         }
         $payment->setVar('custcode', $input->get('custcode'));
         $payment->setVar('pmtcode', $input->get('pmtcode'));
         $payment->setVar('itemcode', $input->get('itemcode1'));
         $payment->setVar('UCLA_REF_NO', $input->get('UCLA_REF_NO'));
     } else {
         if (\is_a($this->_controller, 'ApplicantsSingleController')) {
             $client = new \SoapClient(self::CASHNET_WSDL);
             $parameters = array('OperatorID' => $this->_paymentType->getVar('operatorId'), 'Password' => $this->_paymentType->getVar('operatorPassword'), 'VirtualDirectory' => $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? self::CASHNET_VIRTUALDIRECTORY : self::CASHNET_TEST_VIRTUALDIRECTORY, 'TransactionNo' => $input->get('transactionId'));
             $results = $client->CASHNetSOAPRequestInquiry(array('inquiryParams' => $parameters));
             $xml = new \SimpleXMLElement($results->CASHNetSOAPRequestInquiryResult);
             if ($xml->result != 0) {
                 throw new \Jazzee\Exception("Unable to get transaction details from cashnet for transaction: {$input->get('transactionId')} for applicant {$payment->getAnswer()->getApplicant()->getId()}.  Cashnet said: {$xml->respmessage}");
             }
             $payment->setVar('tx', $xml->transactions[0]->transaction->txno);
             $payment->setAmount($xml->transactions[0]->transaction->totalamount);
             $payment->setVar('custcode', $xml->transactions[0]->transaction->custcode);
             $payment->setVar('pmtcode', $xml->transactions[0]->transaction->pmtcode);
             $payment->setVar('itemcode', $xml->transactions[0]->transaction->itemcode);
             foreach ($xml->transactions[0]->transaction->trefs->tref as $tref) {
                 $payment->setVar($tref->reftype, $tref->refvalue);
             }
             if (strtolower($xml->transactions[0]->transaction->txstatus) == 'c') {
                 $payment->settled();
             } else {
                 //for unspecified reasons sometimes a voided/cancled transaction gets sent, these need to be marked
                 //as rejected.  Its unclear if they would normally have a transaction 'result' or zero so we have to be carefull
                 $payment->setVar('rejectedReason', $xml->transactions[0]->transaction->respmessage);
                 $payment->rejected();
             }
         } else {
             throw new \Jazzee\Exception("UCLACashNET::pendingPayment called form invalid controller: " . get_class($this->_controller));
         }
     }
     return true;
 }
Exemple #4
0
 /**
  * Record transaction information pending until it is settled with the bank
  */
 public function pendingPayment(\Jazzee\Entity\Payment $payment, \Foundation\Form\Input $input)
 {
     if (\is_a($this->_controller, 'ApplyPageController')) {
         $aim = new \AuthorizeNetAIM($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayKey'));
         $aim->setSandBox($this->_paymentType->getVar('testAccount'));
         //test accounts get sent to the sandbox
         $aim->amount = $input->get('amount');
         $aim->cust_id = $payment->getAnswer()->getApplicant()->getId();
         $aim->customer_ip = $_SERVER['REMOTE_ADDR'];
         $aim->email = $payment->getAnswer()->getApplicant()->getEmail();
         $aim->email_customer = 0;
         $aim->card_num = $input->get('cardNumber');
         $aim->exp_date = $input->get('expirationDate');
         $aim->card_code = $input->get('cardCode');
         $aim->zip = $input->get('postalCode');
         $aim->description = $this->_paymentType->getVar('description');
         $aim->test_request = $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? 0 : 1;
         $response = $aim->authorizeAndCapture();
         if ($response->approved) {
             $payment->setAmount($response->amount);
             $payment->setVar('transactionId', $response->transaction_id);
             $payment->setVar('authorizationCode', $response->authorization_code);
             $payment->pending();
             return true;
         } else {
             $payment->setAmount($response->amount);
             $payment->setVar('transactionId', $response->transaction_id);
             $payment->setVar('rejectedReasonCode', $response->response_reason_code);
             $payment->setVar('rejectedReason', $response->response_reason_text);
             $payment->rejected();
             return false;
         }
     } else {
         if (\is_a($this->_controller, 'ApplicantsSingleController')) {
             $transactionDetails = new \AuthorizeNetTD($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayKey'));
             $transactionDetails->setSandBox($this->_paymentType->getVar('testAccount'));
             //test accounts get sent to the sandbox
             // Get Transaction Details
             $transactionId = $input->get('transactionId');
             $response = $transactionDetails->getTransactionDetails($transactionId);
             if (!$response->response or $response->isError()) {
                 throw new \Jazzee\Exception("Unable to get transaction details for transcation id {$transactionId}", E_ERROR, 'There was a problem getting payment information.');
             }
             if ((int) $response->xml->transaction->customer->id != $payment->getAnswer()->getApplicant()->getId()) {
                 throw new \Jazzee\Exception("Transaction {$transactionId} does not belong to applicant #" . $payment->getAnswer()->getApplicant()->getId());
             }
             if ((int) $response->xml->transaction->responseCode == 1) {
                 $payment->setAmount((string) $response->xml->transaction->authAmount);
                 $payment->setVar('transactionId', $transactionId);
                 $payment->setVar('authorizationCode', (string) $response->xml->transaction->authorization_code);
                 $payment->pending();
                 return true;
             }
             $payment->setAmount((string) $response->xml->transaction->authAmount);
             $payment->setVar('transactionId', (string) $response->xml->transaction->transid);
             $payment->setVar('rejectedReasonCode', (string) $response->xml->transaction->responseReasonCode);
             $payment->setVar('rejectedReason', (string) $response->xml->transaction->responseReasonDescription);
             $payment->rejected();
         }
     }
     return false;
 }