function setExpressCheckout($enqueueMessage = true)
 {
     //if (!$this->customerData->getVar('token') || $this->cart->virtuemart_paymentmethod_id != $this->customerData->getVar('selected_method')) {
     // Checks if there is already a token. If not create one.
     if (!$this->customerData->getVar('token')) {
         $this->getToken();
         //Code stops here as the getToken method should redirect to PayPal
     } else {
         return parent::validate();
     }
     $success = $this->ManageCheckout(true);
     $response = $this->getResponse();
 }
Beispiel #2
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);
     }
 }