private function processCard() { //build the receipt $total = $this->receipt->getTotal(); //get list of prouct ids from order $products = ''; $del = ''; foreach ($this->receipt->getContentsByType(array('product')) as $entry) { $products .= $del . $entry->id; $del = '-*-'; } App::import('Lib', 'class_paypal'); try { //NEW METHOD USING CURL $txn = new PayflowTransaction(); $txn->environment = 'live'; //test or live //set up user/pass etc... $txn->PARTNER = 'verisign'; $txn->USER = '******'; $txn->PWD = 'will1480'; $txn->VENDOR = 'fcpackage'; $txn->TENDER = 'C'; //sets to a cc transaction $txn->ACCT = $this->data['card_number']; //cc number $txn->TRXTYPE = 'S'; //txn type: sale $txn->COMMENT1 = 'FlyFoenix.com transaction'; $txn->COMMENT2 = $products; $txn->AMT = $total * 1.0; //amount: 1 dollar $txn->EXPDATE = $this->data['card_exp_mm'] . $this->data['card_exp_yy']; //4 digit expiration date $txn->COUNTRY = 'US'; $result = $txn->process(); } catch (TransactionDataException $tde) { $msg = 'bad transaction data ' . $tde->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (InvalidCredentialsException $e) { $msg = 'Invalid credentials'; $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (InvalidResponseCodeException $irc) { $msg = 'bad response code: ' . $irc->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (AVSException $avse) { $msg = 'AVS error: ' . $avse->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (CVV2Exception $cvve) { $msg = 'CVV2 error: ' . $cvve->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (FraudProtectionException $fpe) { $msg = 'Fraud Protection error: ' . $fpe->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (Exception $e) { $msg = $e->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } return $result; }
<?php echo "|1|"; exit; //include ($_SERVER['DOCUMENT_ROOT'] . '/include/dBug.php'); //new dbug($_POST);exit(); //echo date("mdY", strtotime("+3 month")); try { require_once dirname(__FILE__) . '/Payflow-paypal-pro.php'; $txn = new PayflowTransaction(); //these are provided by your payflow reseller $txn->PARTNER = 'paypal'; $txn->USER = '******'; $txn->PWD = '69h#3M##DgDA'; $txn->VENDOR = 'MyPentairHome'; // transaction information $txn->ACCT = $_POST["BillingCC"]; //cc number $txn->AMT = 19.99; //$_POST["BillingAmount"]; $txn->EXPDATE = substr($_POST["BillingExpireMonth"], 0, 2) . substr($_POST["BillingExpireYear"], -2); //'0214'; //4 digit expiration date $txn->FIRSTNAME = $_POST["BillingFirstName"]; $txn->LASTNAME = $_POST["BillingLastName"]; $txn->STREET = $_POST["BillingAddress1"]; $txn->CITY = $_POST["BillingCity"]; $txn->STATE = $_POST["BillingState"]; $txn->ZIP = $_POST["BillingZip"]; $txn->COUNTRY = 'US'; //https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/transaction_type_codes.htm $txn->TRXTYPE = 'A';