public function __construct() { $this->params['interval_length'] = 1; $this->params['interval_unit'] = 'months'; //$this->params['startDate']= date("Y-m-d", strtotime("+ 1 month")); $this->params['totalOccurrences'] = 9999; $this->params['trialOccurrences'] = 0; $this->params['trialAmount'] = 0.0; } public function __toString() { if (!$this->params) { return (string) $this; } $output = ""; $output .= '<table summary="Authnet Results" id="authnet">' . "\n"; $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Outgoing Parameters</b></th>' . "\n" . '</tr>' . "\n"; foreach ($this->params as $key => $value) { $output .= "\t" . '<tr>' . "\n\t\t" . '<td><b>' . $key . '</b></td>';
function BeanStreamDeleteProfile($orderInfo, $params = array()) { require_once OSEMSC_B_LIB . DS . 'class.connection.php'; //$orderInfo = oseRegistry::call('payment')->getOrder(array('order_id'=>319),'obj'); $pConfig = oseRegistry::call('msc')->getConfig('payment', 'obj'); $merchant_id = $pConfig->beanstream_merchant_id; $passcode = $pConfig->beanstream_passcode; $orderInfoParams = oseJson::decode($orderInfo->params); $postVar = array(); $postVar['serviceVersion'] = '1.0'; $postVar['operationType'] = 'M'; $postVar['merchantId'] = $merchant_id; $postVar['passcode'] = $passcode; $postVar['rbAccountID'] = $orderInfo->payment_serial_number; $postVar['rbBillingState'] = 'C'; $postVar['processBackPayments'] = '0'; $postVar['ref5'] = ''; $hostname = 'www.beanstream.com'; $workstring = http_build_query($postVar); $uri = "/scripts/recurring_billing.asp"; $res = OSECONNECTOR::send_request_via_fsockopen($hostname, $uri, $workstring, 'urlencoded'); $res = stristr($res, "\r\n\r\n"); $res = trim($res); //$post = array(); //parse_str($res,$post); $result = array(); $code = OSECONNECTOR::substring_between($res, '<code>', '</code>'); $message = OSECONNECTOR::substring_between($res, '<message>', '</message>'); $result['success'] = $code == 1 ? true : false; $result['title'] = JText::_('Cancel'); $result['content'] = $code == 1 ? JText::_('Your membership subscription is cancelled.') : JText::_('Error') . ':' . $message; return $result; }
private function eWayRebillAPIConnect($eWayCustomerID, $eWayUsername, $eWayPassword = null, $test_mode = true, $postVar, $rebill = true) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_osemsc' . DS . 'libraries' . DS . 'class.connection.php'; //$pConfig= oseMscConfig :: getConfig('payment', 'obj'); //if(!isset($pConfig->cc_testmode) || $pConfig->cc_testmode == true) { // $test_mode= true; //} else { // $test_mode= false; //} //$eWayCustomerID= $pConfig->eWayCustomerID; //$eWayUsername= $pConfig->eWayUsername; //$eWayPassword= $pConfig->eWayPassword; // Double check, not quite necessary, just in case; //if($test_mode == false && empty($eWayCustomerID) || empty($eWayUsername)) { // return false; //} $API_Endpoint = 'www.eway.com.au'; if ($test_mode == true) { //$eWayCustomerID = '87654321'; //$eWayUsername = '******'; //$eWayPassword = '******'; $API_Path = '/gateway/rebill/test/Upload_test.aspx'; } else { $API_Path = '/gateway/rebill/upload.aspx'; } $xmlRequest = "<RebillUpload>\n" . "<NewRebill>\n" . "<eWayCustomerID>" . $eWayCustomerID . "</eWayCustomerID>\n" . "<Customer>\n" . "<CustomerRef>" . $postVar['CustomerRef'] . "</CustomerRef>\n" . "<CustomerTitle></CustomerTitle>\n" . "<CustomerFirstName>" . $postVar['CustomerFirstName'] . "</CustomerFirstName>\n" . "<CustomerLastName>" . $postVar['CustomerLastName'] . "</CustomerLastName>\n" . "<CustomerCompany></CustomerCompany>\n" . "<CustomerJobDesc></CustomerJobDesc>\n" . "<CustomerEmail>" . $postVar['CustomerEmail'] . "</CustomerEmail>\n" . "<CustomerAddress>" . $postVar['CustomerAddress'] . " St</CustomerAddress>\n" . "<CustomerSuburb></CustomerSuburb>\n" . "<CustomerState>" . $postVar['CustomerState'] . "</CustomerState>\n" . "<CustomerPostCode>" . $postVar['CustomerPostCode'] . "</CustomerPostCode>\n" . "<CustomerCountry>" . $postVar['CustomerCountry'] . "</CustomerCountry>\n" . "<CustomerPhone1></CustomerPhone1>\n" . "<CustomerPhone2></CustomerPhone2>\n" . "<CustomerFax></CustomerFax>\n" . "<CustomerURL></CustomerURL>\n" . "<CustomerComments></CustomerComments>\n" . "</Customer>\n" . "<RebillEvent>\n" . "<RebillInvRef>" . $postVar['RebillInvRef'] . "</RebillInvRef>\n" . "<RebillInvDesc>" . $postVar['RebillInvDesc'] . "</RebillInvDesc>\n" . "<RebillCCName>" . $postVar['RebillCCName'] . "</RebillCCName>\n" . "<RebillCCNumber>" . $postVar['RebillCCNumber'] . "</RebillCCNumber>\n" . "<RebillCCExpMonth>" . $postVar['RebillCCExpMonth'] . "</RebillCCExpMonth>\n" . "<RebillCCExpYear>" . $postVar['RebillCCExpYear'] . "</RebillCCExpYear>\n" . "<RebillInitAmt>" . $postVar['RebillInitAmt'] . "</RebillInitAmt>\n" . "<RebillInitDate>" . $postVar['RebillInitDate'] . "</RebillInitDate>" . "<RebillRecurAmt>" . $postVar['RebillRecurAmt'] . "</RebillRecurAmt>\n" . "<RebillStartDate>" . $postVar['RebillStartDate'] . "</RebillStartDate>\n" . "<RebillInterval>" . $postVar['RebillInterval'] . "</RebillInterval>\n" . "<RebillIntervalType>" . $postVar['RebillIntervalType'] . "</RebillIntervalType>\n" . "<RebillEndDate>" . $postVar['RebillEndDate'] . "</RebillEndDate>\n" . "</RebillEvent>\n" . "</NewRebill>\n" . "</RebillUpload>"; $response = OSECONNECTOR::send_request_via_fsockopen($API_Endpoint, $API_Path, $xmlRequest); $resArray = self::parseResponse($response, $rebill); return $resArray; }
private function PaypalAPIConnect($postString) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_osemsc' . DS . 'libraries' . DS . 'class.connection.php'; $pConfig = oseMscConfig::getConfig('payment', 'obj'); $test_mode = $pConfig->paypal_testmode; $API_UserName = $pConfig->paypal_api_username; $API_Password = $pConfig->paypal_api_passwd; $API_Signature = $pConfig->paypal_api_signature; $subject = ''; if (empty($API_UserName) || empty($API_Password) || empty($API_Signature)) { return false; } define('VERSION', '64.0'); define('ACK_SUCCESS', 'SUCCESS'); define('ACK_SUCCESS_WITH_WARNING', 'SUCCESSWITHWARNING'); if ($test_mode == true) { $API_Endpoint = 'api-3t.sandbox.paypal.com'; $Paypal_URL = 'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token='; } else { $API_Endpoint = 'api-3t.paypal.com'; $Paypal_URL = 'https://www.paypal.com/webscr&cmd=_express-checkout&token='; } $postVar['PWD'] = $API_Password; $postVar['USER'] = $API_UserName; $postVar['SIGNATURE'] = $API_Signature; $postVar['VERSION'] = VERSION; $postHead = ''; foreach ($postVar as $key => $val) { $postHead .= "&" . urlencode($key) . "=" . $val; } $postString = $postString . $postHead; $response = OSECONNECTOR::send_request_via_fsockopen($API_Endpoint, '/nvp', $postString, 'urlencoded'); $resArray = self::parseResults($response); $resArray["Paypal_URL"] = $Paypal_URL; return $resArray; }
private function eWayRebillAPIConnect($eWayCustomerID, $eWayUsername, $eWayPassword = null, $test_mode = true, $postVar, $rebill = true) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_osemsc' . DS . 'libraries' . DS . 'class.connection.php'; $API_Endpoint = 'www.eway.com.au'; if ($test_mode == true) { $API_Path = '/gateway/rebill/test/Upload_test.aspx'; } else { $API_Path = '/gateway/rebill/upload.aspx'; } $xmlRequest = "<RebillUpload>\n" . "<NewRebill>\n" . "<eWayCustomerID>" . $eWayCustomerID . "</eWayCustomerID>\n" . "<Customer>\n" . "<CustomerRef>" . $postVar['CustomerRef'] . "</CustomerRef>\n" . "<CustomerTitle></CustomerTitle>\n" . "<CustomerFirstName>" . $postVar['CustomerFirstName'] . "</CustomerFirstName>\n" . "<CustomerLastName>" . $postVar['CustomerLastName'] . "</CustomerLastName>\n" . "<CustomerCompany></CustomerCompany>\n" . "<CustomerJobDesc></CustomerJobDesc>\n" . "<CustomerEmail>" . $postVar['CustomerEmail'] . "</CustomerEmail>\n" . "<CustomerAddress>" . $postVar['CustomerAddress'] . " St</CustomerAddress>\n" . "<CustomerSuburb></CustomerSuburb>\n" . "<CustomerState>" . $postVar['CustomerState'] . "</CustomerState>\n" . "<CustomerPostCode>" . $postVar['CustomerPostCode'] . "</CustomerPostCode>\n" . "<CustomerCountry>" . $postVar['CustomerCountry'] . "</CustomerCountry>\n" . "<CustomerPhone1></CustomerPhone1>\n" . "<CustomerPhone2></CustomerPhone2>\n" . "<CustomerFax></CustomerFax>\n" . "<CustomerURL></CustomerURL>\n" . "<CustomerComments></CustomerComments>\n" . "</Customer>\n" . "<RebillEvent>\n" . "<RebillInvRef>" . $postVar['RebillInvRef'] . "</RebillInvRef>\n" . "<RebillInvDesc>" . $postVar['RebillInvDesc'] . "</RebillInvDesc>\n" . "<RebillCCName>" . $postVar['RebillCCName'] . "</RebillCCName>\n" . "<RebillCCNumber>" . $postVar['RebillCCNumber'] . "</RebillCCNumber>\n" . "<RebillCCExpMonth>" . $postVar['RebillCCExpMonth'] . "</RebillCCExpMonth>\n" . "<RebillCCExpYear>" . $postVar['RebillCCExpYear'] . "</RebillCCExpYear>\n" . "<RebillInitAmt>" . $postVar['RebillInitAmt'] . "</RebillInitAmt>\n" . "<RebillInitDate>" . $postVar['RebillInitDate'] . "</RebillInitDate>" . "<RebillRecurAmt>" . $postVar['RebillRecurAmt'] . "</RebillRecurAmt>\n" . "<RebillStartDate>" . $postVar['RebillStartDate'] . "</RebillStartDate>\n" . "<RebillInterval>" . $postVar['RebillInterval'] . "</RebillInterval>\n" . "<RebillIntervalType>" . $postVar['RebillIntervalType'] . "</RebillIntervalType>\n" . "<RebillEndDate>" . $postVar['RebillEndDate'] . "</RebillEndDate>\n" . "</RebillEvent>\n" . "</NewRebill>\n" . "</RebillUpload>"; $response = OSECONNECTOR::send_request_via_fsockopen($API_Endpoint, $API_Path, $xmlRequest); $resArray = self::parseResponse($response, $rebill); return $resArray; }
public function process($retries = 1) { $this->prepareParameters(); //build the post string $poststring = ''; foreach ($this->params as $key => $val) { if ($key == "x_card_num") { $poststring .= urlencode($key) . "=" . $val . "&"; } else { $poststring .= urlencode($key) . "=" . urlencode($val) . "&"; } } $count = 0; while ($count < $retries) { // strip off trailing ampersand $poststring = substr($poststring, 0, -1); require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_osemsc' . DS . 'libraries' . DS . 'class.connection.php'; $this->response = OSECONNECTOR::send_request_via_fsockopen($this->url, '/gateway/transact.dll', $poststring); $this->parseResults(); if ($this->getResultResponseFull() == "Approved") { $this->approved = true; $this->declined = false; $this->error = false; break; } else { if ($this->getResultResponseFull() == "Declined") { $this->approved = false; $this->declined = true; $this->error = false; break; } } $count++; } }