Exemplo n.º 1
0
 /**
  * Initialise the static $arrCreditcards array with all creditcards
  * found in the database
  *
  * The array created is of the form
  *  array(
  *    creditcard ID => array(
  *      'id'   => creditcard ID,
  *      'name' => creditcard name,
  *      'ord'  => ordinal value,
  *    ),
  *    ... more ...
  *  )
  * The array is sorted by the ordinal values.
  * @global  ADONewConnection  $objDatabase
  * @return  boolean                     True on success, false otherwise
  */
 function init()
 {
     global $objDatabase;
     $query = "\n            SELECT `id`, `name`, `ord`\n              FROM " . DBPREFIX . "core_creditcard\n             ORDER BY `ord` ASC\n        ";
     $objResult = $objDatabase->Execute($query);
     if (!$objResult) {
         return self::errorHandler();
     }
     self::$arrCreditcards = array();
     while (!$objResult->EOF) {
         $id = $objResult->fields['id'];
         self::$arrCreditcards[$id] = array('id' => $id, 'name' => $objResult->fields['name'], 'ord' => $objResult->fields['ord']);
         $objResult->MoveNext();
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * check if the expired Date is ok
  * @param $storedCreditCards
  */
 function isValidExpiredDate($creditCards)
 {
     if (!class_exists('Creditcard')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'creditcard.php';
     }
     foreach ($creditCards as $creditCard) {
         $exp_date = $this->explodeExpDate($creditCard->realex_hpp_api_saved_pmt_expdate);
         $creditCard->validExpiredDate = Creditcard::validate_credit_card_date('', $exp_date['mm'], $exp_date['yy']);
     }
     return $creditCards;
 }
Exemplo n.º 3
0
 function _validate_creditcard_data($enqueueMessage = TRUE)
 {
     $html = '';
     $this->_cc_valid = TRUE;
     if (!Creditcard::validate_credit_card_number($this->_cc_type, $this->_cc_number)) {
         $this->_errormessage[] = 'VMPAYMENT_AUTHORIZENET_CARD_NUMBER_INVALID';
         $this->_cc_valid = FALSE;
     }
     if (!Creditcard::validate_credit_card_cvv($this->_cc_type, $this->_cc_cvv)) {
         $this->_errormessage[] = 'VMPAYMENT_AUTHORIZENET_CARD_CVV_INVALID';
         $this->_cc_valid = FALSE;
     }
     if (!Creditcard::validate_credit_card_date($this->_cc_type, $this->_cc_expire_month, $this->_cc_expire_year)) {
         $this->_errormessage[] = 'VMPAYMENT_AUTHORIZENET_CARD_EXPIRATION_DATE_INVALID';
         $this->_cc_valid = FALSE;
     }
     if (!$this->_cc_valid) {
         //$html.= "<ul>";
         foreach ($this->_errormessage as $msg) {
             //$html .= "<li>" . vmText::_($msg) . "</li>";
             $html .= vmText::_($msg) . "<br/>";
         }
         //$html.= "</ul>";
     }
     if (!$this->_cc_valid && $enqueueMessage) {
         $app = JFactory::getApplication();
         $app->enqueueMessage($html);
     }
     return $this->_cc_valid;
 }
Exemplo n.º 4
0
 /**
  * @param bool $enqueueMessage
  * @return bool
  */
 function validateRemoteCCForm($enqueueMessage = true)
 {
     if (!class_exists('Creditcard')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'creditcard.php';
     }
     $html = '';
     $cc_valid = true;
     $errormessages = array();
     $saved_cc_selected = $this->customerData->getVar('saved_cc_selected');
     $cc_type = $this->customerData->getVar('cc_type');
     $cc_number = $this->customerData->getVar('cc_number');
     $cc_name = $this->customerData->getVar('cc_name');
     $cc_cvv = $this->customerData->getVar('cc_cvv');
     $cc_expire_month = $this->customerData->getVar('cc_expire_month');
     $cc_expire_year = $this->customerData->getVar('cc_expire_year');
     if (!Creditcard::validate_credit_card_number($cc_type, $cc_number)) {
         $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_NUMBER_INVALID';
         $cc_valid = false;
     }
     if ($this->_method->cvn_checking and !Creditcard::validate_credit_card_cvv($cc_type, $cc_cvv, true, $cc_number)) {
         $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_CVV_INVALID';
         $cc_valid = false;
     }
     if (!Creditcard::validate_credit_card_date($cc_type, $cc_expire_month, $cc_expire_year)) {
         $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_EXPIRATION_DATE_INVALID';
         $cc_valid = false;
     }
     if (empty($cc_name)) {
         $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_NAME_INVALID';
         $cc_valid = false;
     }
     if (!$cc_valid) {
         foreach ($errormessages as $msg) {
             $html .= vmText::_($msg) . "<br/>";
         }
     }
     if (!$cc_valid) {
         $app = JFactory::getApplication();
         $app->enqueueMessage($html, 'error');
         return false;
     }
     return true;
 }
Exemplo n.º 5
0
 function validate($enqueueMessage = true)
 {
     if (!class_exists('Creditcard')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'creditcard.php';
     }
     $html = '';
     $cc_valid = true;
     $errormessages = array();
     $cc_type = $this->customerData->getVar('cc_type');
     $cc_number = $this->customerData->getVar('cc_number');
     $cc_cvv = $this->customerData->getVar('cc_cvv');
     $cc_expire_month = $this->customerData->getVar('cc_expire_month');
     $cc_expire_year = $this->customerData->getVar('cc_expire_year');
     if (!Creditcard::validate_credit_card_number($cc_type, $cc_number)) {
         $errormessages[] = 'VMPAYMENT_PAYPAL_CC_CARD_NUMBER_INVALID';
         $cc_valid = false;
     }
     if ($this->_method->cvv_required or $cc_type == 'Maestro') {
         $required = true;
     } else {
         $required = false;
     }
     if (!Creditcard::validate_credit_card_cvv($cc_type, $cc_cvv, $required)) {
         $errormessages[] = 'VMPAYMENT_PAYPAL_CC_CARD_CVV_INVALID';
         $cc_valid = false;
     }
     if (!Creditcard::validate_credit_card_date($cc_type, $cc_expire_month, $cc_expire_year)) {
         $errormessages[] = 'VMPAYMENT_PAYPAL_CC_CARD_DATE_INVALID';
         $cc_valid = false;
     }
     if (!$cc_valid) {
         foreach ($errormessages as $msg) {
             $html .= tsmText::_($msg) . "<br/>";
         }
     }
     if (!$cc_valid && $enqueueMessage) {
         $app = JFactory::getApplication();
         $app->enqueueMessage($html, 'error');
     }
     $displayInfoMsg = "";
     if (!$cc_valid) {
         $displayInfoMsg = false;
         return false;
     } else {
         return parent::validate($displayInfoMsg);
     }
 }
Exemplo n.º 6
0
 function _validate_velocity_creditcard_data($enqueueMessage = TRUE)
 {
     static $force = true;
     if (empty($this->_cc_number) and empty($this->_cc_cvv)) {
         return false;
     }
     $html = '';
     $this->_cc_valid = !empty($this->_cc_number) and !empty($this->_cc_cvv) and !empty($this->_cc_expire_month) and !empty($this->_cc_expire_year);
     if (!empty($this->_cc_number) and !Creditcard::validate_credit_card_number($this->_cc_type, $this->_cc_number)) {
         $this->_errormessage[] = 'VMPAYMENT_VELOCITY_CARD_NUMBER_INVALID';
         $this->_cc_valid = FALSE;
     }
     if (!Creditcard::validate_credit_card_cvv($this->_cc_type, $this->_cc_cvv)) {
         $this->_errormessage[] = 'VMPAYMENT_VELOCITY_CARD_CVV_INVALID';
         $this->_cc_valid = FALSE;
     }
     if (!Creditcard::validate_credit_card_date($this->_cc_type, $this->_cc_expire_month, $this->_cc_expire_year)) {
         $this->_errormessage[] = 'VMPAYMENT_VELOCITY_CARD_EXPIRATION_DATE_INVALID';
         $this->_cc_valid = FALSE;
     }
     if (!$this->_cc_valid) {
         //$html.= "<ul>";
         foreach ($this->_errormessage as $msg) {
             //$html .= "<li>" . vmText::_($msg) . "</li>";
             $html .= vmText::_($msg) . "<br/>";
         }
         //$html.= "</ul>";
     }
     if (!$this->_cc_valid && $enqueueMessage && $force) {
         $app = JFactory::getApplication();
         $app->enqueueMessage($html);
         $force = false;
     }
     return $this->_cc_valid;
 }
Exemplo n.º 7
0
 /**
  * @param bool $enqueueMessage
  * @return bool
  */
 function validateCvv($enqueueMessage = true)
 {
     if (!class_exists('Creditcard')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'creditcard.php';
     }
     if (!$this->_method->cvn_checking) {
         return true;
     }
     $cc_cvv_realvault = vRequest::getInt('cc_cvv_realvault', '');
     if (!Creditcard::validate_credit_card_cvv('', $cc_cvv_realvault, true)) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CARD_CVV_INVALID'), 'error');
         return false;
     }
     return true;
 }
Exemplo n.º 8
0
	public function actionCurrent($id_sched,$id=null){
  		$id_control = Yii::app()->user->id;
                $guide = User::model()->findByPk($id_control);
		$sched = SegScheduledTours::model()->with(array('guidestourinvoices'=>array('guidestourinvoicescustomers','contact')))->findByPk($id_sched);
		if(is_null($sched)) 	throw new CHttpException(404,'The requested tour does not exist.');

            $json=$this->PaymentLand();
            $jcode['result']="none";
            $jcode['message']="";
            if($json!='nodata')
            {
                $jarr=  json_decode($json);
//                var_dump($jarr);
//                return;
                if(isset($jarr->result->code))
                {
                    

                    if(preg_match("/^(000\.000\.|000\.100\.1|000\.[36])/",$jarr->result->code))
                    {
                            $jcode['result']="success";	
                            $rec=  new Creditcard();
                            $rec->trans_id=$jarr->id;
                            $rec->card_type=$jarr->paymentBrand;
                            $rec->amount=(float)$jarr->amount;
                            $rec->result_code=$jarr->result->code;
                            $rec->trans_date=$jarr->timestamp;
                            $rec->text=$jarr->result->description;
                            if($rec->save())
                            {
                                if(Yii::app()->user->hasState("payers"))
                                {
                                        $postdata= json_decode(Yii::app()->user->getState("payers"));
                                        $jcode['message']=  "Payment was done. Sum:".$rec->amount." &euro;";
                                        $post=array();
                                         Yii::app()->user->setState('payers', null);
                                         foreach ($postdata as $value) {
                                             $post['customersName'.$value[0]]=$value[1];
                                             $post['discounttype_id'.$value[0]]=  strlen($value[2])>0 ? (int) $value[2] : null;
                                             $post['price'.$value[0]]=  strlen($value[3])>0 ? (float) $value[3] : null;
                                             $post['payoption'.$value[0]]=3;
                                             $post['option'.$value[0]]=0;
                                         }
                                         $this->saveGIC($sched, $post,$rec->id);
                                }
                            }
                    }  else {
                            $jcode['result']="error";					

                    }
                 }
            }
                            Yii::app()->user->setState('payers', null);
 	
		if($sched->additional_info2) $this->redirect(array('schedule'));
 			$date_format = strtotime($sched->date);
			$date_bd = date('Y-m-d',$date_format);
			$dt =$date_bd.' '.$sched->starttime;
	
			//mainoption

			$criteria_vat = new CDbCriteria;
			$criteria_vat->condition = 'name=:name ';
			$criteria_vat->params = array(':name'=>'Vat');
			$vat_nds = Mainoptions::model()->find($criteria_vat)->value;
			$criteria = new CDbCriteria;
                        $criteria->addCondition("idpayoptions in (1,2,3,4)");
			$pay = Payoptions::model()->findAll($criteria);
			$invoiceoptions_array = Invoiceoptions::model()->findAll(array('order'=>'id ASC')); 
			$dis = Bonus::model()->findAll(array('order'=>'sort ASC')); 
				if(!empty($_POST))
				{
                                   $pdf=$_POST['pdf'];
                                    $this->saveGIC($sched,$_POST);
 
 				if($pdf){
					if(!$this->createpdf($sched)) return;
//					$this->redirect(Yii::app()->createUrl("/filespdf/".$sched->additional_info2.".pdf"));
					return;
				}
			}
	$test=array('guide'=>$this->loadGuide(),'tours'=>$this->loadTours(),'todo'=>$this->loadUnreported());

	$this->render('current',array(
//					'model'=>$model,
		'guide'=>$guide,
		'sched'=>$sched,
		'id_sched'=>$id_sched,
		'vat_nds'=>$vat_nds,
		'pay'=>$pay,
		'jcode'=>$jcode,
		'dis'=>$dis,
		'invoiceoptions_array'=>$invoiceoptions_array,
		'info'=>$test,
	));

        }
Exemplo n.º 9
0
 function _validate_creditcard_data($enqueueMessage = true)
 {
     static $force = true;
     $emptyEssentialFields = empty(self::$_cc_number) || empty(self::$_cc_cvv) || empty(self::$_cc_name);
     if ($emptyEssentialFields) {
         return false;
     }
     $html = '';
     $this->_cc_valid = true;
     if (!Creditcard::validate_credit_card_cvv(self::$_cc_type, self::$_cc_cvv)) {
         $this->_errormessage[] = 'VMPAYMENT_EVERYPAY_CARD_CVV_INVALID';
         $this->_cc_valid = false;
     }
     if (!Creditcard::validate_credit_card_date(self::$_cc_type, self::$_cc_expire_month, self::$_cc_expire_year)) {
         $this->_errormessage[] = 'VMPAYMENT_EVERYPAY_CARD_EXPIRATION_DATE_INVALID';
         $this->_cc_valid = false;
     }
     if (!$this->_cc_valid) {
         //$html.= "<ul>";
         foreach ($this->_errormessage as $msg) {
             //$html .= "<li>" . vmText::_($msg) . "</li>";
             $html .= vmText::_($msg) . "<br/>";
         }
         //$html.= "</ul>";
     }
     if (!$this->_cc_valid && $enqueueMessage && $force) {
         $app = JFactory::getApplication();
         $app->enqueueMessage($html);
         $force = false;
     }
     return $this->_cc_valid;
 }