function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Test Transaction if ($this->cfg['mode'] = "0") { $test = "FALSE"; } else { $test = "TRUE"; } # Set the post vars: $vars = array(array('reqtype', "authorize"), array('saletype', "sale"), array('account', $this->cfg['account']), array('password', $this->cfg['password']), array('amount', $amount), array('crefnum', $invoice), array('cardnum', $this->billing["cc_no"]), array('cardexp', $this->billing["exp_month"] . '' . $this->billing["exp_year"]), array('noc', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('address1', $this->account["address1"] . ' ' . $this->account["address2"]), array('zipcode', $this->account["zip"])); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { return false; } else { $response = explode(',', $response); } # Transaction Status: if ($response[0] == 'authorized') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Auth code: $ret['authorization_id'] = $response[1]; # Transaction ID: $ret['transaction_id'] = $response[4]; # Message: $ret['msg'] = $response[1]; # AVS Details: if ($response[6] == 'N') { $ret['avs'] = 'avs_no_match'; } elseif ($response[6] == 'X') { $ret['avs'] = 'avs_na'; } elseif ($response[6] == 'Y') { $ret['avs'] = 'avs_address_zip'; } else { $ret['avs'] = 'avs_na'; } if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { #if(!$this->validate_currency($currency_iso)) return false; $ret = false; $this->validate_eft_details($ret); /** Determine $acctType 27 => Debit to checking account. 37 => Debit to savings account. */ if ($this->billing['eft_check_acct_type'] == 'b') { $acctType = 27; } else { $acctType = 37; } if (empty($this->cfg['batchid'])) { $batchid = $invoice . time(); } else { $batchid = $this->cfg['batchid']; } # Set the post vars: $vars = array(array('usermode', "cgi"), array('action', "submit"), array('replymode', "csv"), array('login', $this->cfg['login']), array('password', $this->cfg['password']), array('merchantid', $this->cfg['merchantid']), array('verstr', $this->cfg['verstr']), array('sec', $this->cfg['sec']), array('batchid', $batchid), array('routing', $this->billing['eft_trn']), array('account', $this->billing['eft_check_acct']), array('checknum', $this->billing['eft_check_checkno']), array('fname', $this->account['first_name']), array('lname', $this->account['last_name']), array('individualid', $invoice), array('amount', round($amount, 2)), array('trancode', $acctType), array('paymentdesc', "Payment for Invoice No. {$invoice}")); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { $response = explode('|', $response); } $return_codes = array('000' => 'Accepted', '001' => 'STAR Accepted: Non PPS participant', '002' => 'STAR Accepted: Non-DDA', '003' => 'STAR Accepted: No account info', '100' => 'Failed modulus check', '101' => 'Failed Thompson Financial lookup', '110' => 'Failed Equifax check', '200' => 'Authentication Error', '300' => 'Missing or invalid routing number', '301' => 'Missing or invalid merchant id', '302' => 'Missing or invalid batch id', '303' => 'Missing or invalid account number', '304' => 'Missing or invalid fname', '305' => 'Missing or invalid lname', '306' => 'Missing or invalid individual id', '307' => 'Missing or invalid check number', '308' => 'Missing or invalid amount', '309' => 'Invalid transaction code', '310' => 'Invalid standard entry class', '311' => 'Invalid effective entry date', '401' => 'STAR Failed: STAR CHEK error', '402' => 'STAR Failed: Non-DDA', '403' => 'STAR Failed: No account info', '500' => 'Invalid Data, no action ', '900' => 'Unable to connect to database', '901' => 'Unable to query database', '902' => 'Unable to prepare query', '903' => 'Unable to contact STAR'); $response_code = $response[0]; if ($response_code == '000') { $ret['status'] = 1; } else { $ret['status'] = 0; foreach ($return_codes as $code => $msg) { if ($code == $response_code) { $ret["msg"] = $msg; } } } /* echo "<pre>"; print_r($vars); print_r($response); exit; */ # return if ($ret['status'] == 1) { $this->redirect = '<script language=Javascript>document.location = "?_page=invoice:thankyou&_next_page=checkout_plugin:plugin_ord_MANUAL_ALERT&id=' . $invoice . '";</script>'; return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Test Transaction if ($this->cfg['mode'] = "0") { $test = "FALSE"; } else { $test = "TRUE"; } # Set the post vars: $vars = array(array('s', $this->cfg['store']), array('p', $this->cfg['store'] . 'agile'), array('vp', $amount), array('vt', $invoice), array('d', '0'), array('q', '1'), array('t', '(null)'), array('a', ''), array('pt', '1'), array('cn', $this->billing["cc_no"]), array('in', @$this->billing["ccv"]), array('mm', $this->billing["exp_month"]), array('yy', $this->billing["exp_year"]), array('pn', $this->billing["phone_number"]), array('fn', $this->account["first_name"]), array('sn', $this->account["last_name"]), array('co', $this->account["company"]), array('a1', $this->account["address1"]), array('a2', $this->account["address2"]), array('a3', $this->account["city"]), array('st', $this->account["state"]), array('zp', $this->account["zip"]), array('em', $acct_fields["email"]), array('ct', $country), array('ip', USER_IP), array('dfn', ''), array('dsn', ''), array('dco', ''), array('da1', ''), array('da2', ''), array('da3', ''), array('dst', ''), array('dzp', ''), array('dct', ''), array('ins', ''), array('ra', '')); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Test Mode if ($this->cfg['mode'] = "1") { echo '<script language=Javascript>alert(\'Gateway response: ' . $response . '\') </script>'; } # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { foreach (explode("&", $response) as $pair) { list($key, $val) = explode("=", $pair); $swreg[$key] = $val; } } # IF SWREG RETURNED ERROR CODE OR WE HAVE NO ORDER NUMBER DISPLAY ERROR if ($swreg["result"] != 0 || $swreg["ordernumber"] == "") { $ret['status'] = 0; } else { $ret['status'] = 1; } # Transaction ID: @($ret['transaction_id'] = @$swreg["ordernumber"]); # DEFINE ERROR CODES $messages = array("", "You must supply an ip address", "You must supply a contact phone number", "You must supply an email address", "You must supply a first name", "You must supply a surname", "You must supply an address", "You must supply a country", "You must supply a country for the delivery address", "You must supply your shop id", "You must supply a product code ", "Attempt to purchase a non existent item", "Del_id/Product_id count wrong", "Var_id/Product_id count wrong", "Qty/Product_id count wrong", "Email address used by fraudsters in the past unable to accept this order", "IP address used by fraudsters in the past unable to accept this order", "Invalid card details", "Declined Card", "You must supply a payment method", "Payment method must be in the range 1 - 5", "Call Authorisation Centre", "Comms failure - Thankyou for the order, do NOT re-order as we will keep trying every 15 minutes to get an authorisation.", "Incorrect expiry date", "Value enterted into Switch /Solo issue number field despite not being a Switch or Solo card. (We have also had this result code when the expiry date is way too far in the future).", "Affiliate account is closed. <A HREF=\"a.php?affil=\">Click here</a> and try again.", "SWREG down for maintenance (probably only for 15 minutes)", "Discover card will be processed manually same or following business day. Please do not reorder.", "Store closed for sales - get this one and it shows we no longer wish to sell your products!", "Problem with the card data - the bank doesn't like it.", "Failed country check - On the banned country list", "Problem with bin range - we do not (yet) know how to deal with the card (Bin range is first 6 numbers of the card so we do not know who owns it to route the payment request).", "Duplicate order trap (if you sent us a value in variable &vt=)", "Country name not valid - use our list of country names to avoid this error. A list of country names we accept is available by going to https://usd.swreg.org/cgi-bin/b.cgi?s=2034&p=2034get1&v=0&d=0&q=1&t= and grabbing the list from our html code. "); $ret['msg'] = $messages[$swreg["result"]]; # AVS Details: $ret['avs'] = 'avs_na'; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Get the data submitted from the customer: $billing = @$VAR['checkout_plugin_data']; # Test mode: if ($this->cfg['mode']) { $test = 'false'; } else { $test = 'true'; } # Set the post vars: $vars = array(array('merchant', $this->cfg['account']), array('options', "dups=false,test_status=" . $test), array('currency', $currency_iso), array('amount', $amount), array('trans_id', $invoice), array('cardtype', $this->billing["card_type"]), array('card_no', $this->billing["cc_no"]), array('expiry', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]), array('customer', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('shipping', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('bill_name', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('bill_addr_1', $this->account["address1"] . ' ' . $this->account["address2"]), array('bill_post_code', $this->account["city"]), array('bill_city', $this->account["state"]), array('bill_state', $this->account["zip"]), array('bill_email', $acct_fields["email"]), array('bill_country', $country)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { return false; } else { $respond = explode('&', $response); } for ($i = 0; $i < count($respond); $i++) { @($arr1 = explode('=', $respond[$i])); @($response1[urldecode($arr1[0])] = urldecode($arr1[1])); } # Transaction Status: if (trim($response1['?valid']) == 'true') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: $ret['transaction_id'] = $response1["trans_id"]; $ret['authorization_id'] = $response1["auth_code"]; # Message: $ret['msg'] = $response1['message']; # AVS Details: $ret['avs'] = 'avs_na'; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Test Transaction if (ereg('100', $this->cfg['mode'])) { $demo = "n"; } else { $demo = "y"; } # Set the post vars: $vars = array(array('custid', $this->cfg['x_Login']), array('password', $this->cfg['x_Password']), array('action', $this->cfg['x_Transaction_Type']), array('avs', $this->cfg['x_AVS']), array('demo', $demo), array('ticket', $invoice), array('media', 'cc'), array('cc', $this->billing["cc_no"]), array('exp', $this->billing["exp_month"] . $this->billing["exp_year"]), array('cvv', $this->billing["ccv"]), array('amount', $amount * 100), array('name', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('address1', $this->account["address1"] . ' ' . $this->account["address2"]), array('city', $this->account["city"]), array('state', $this->account["state"]), array('zip', $this->account["zip"])); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $return = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$return) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { $response = explode("\n", trim($return)); for ($i = 0; $i < count($response); $i++) { if (!empty($response[$i])) { unset($thisone); $thisone = explode("=", $response[$i]); $varr[$thisone[0]] = $thisone[1]; } } } # Message: @($ret['msg'] = $varr["transid"]); # AVS: @($ret['avs'] = $varr["avs"]); # Transaction Status: if ($varr["status"] == 'approved' || $varr["status"] == 'accepted') { $ret['status'] = 1; } else { $ret['status'] = 0; @($ret['msg'] = 'Charge declined, please double check your card details.'); } if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); if ($this->cfg['mode']) { $mode = 'LIVE'; } else { $mode = 'TEST'; } # Set the post vars: $vars = array(array('TAMPER_PROOF_SEAL', md5($this->cfg['secret'] . $this->cfg['account'] . $this->cfg['type'] . $amount . $mode)), array('MODE', $mode), array('MERCHANT', $this->cfg['account']), array('TRANSACTION_TYPE', $this->cfg['type']), array('AMOUNT', $amount), array('AMOUNT_TAX', 0), array('AMOUNT_TYPE', 0), array('COMMENT', ''), array('PHONE', '18885551212'), array('CC_NUM', $this->billing["cc_no"]), array('CC_EXPIRES', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]), array('CVCCVV2', $this->billing["ccv"]), array('ORDER_ID', $invoice), array('INVOICE_ID', $invoice), array('NAME', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('ADDR1', $this->account["address1"]), array('ADDR2', $this->account["address2"]), array('CITY', $this->account["city"]), array('STATE', $this->account["state"]), array('ZIPCODE', $this->account["zip"]), array('EMAIL', $acct_fields["email"])); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Transaction Status: if (eregi("Result=APPROVED", $response)) { $ret['status'] = 1; $ret['msg'] = 'Approved!'; } else { $ret['status'] = 0; $ret['msg'] = $response; } # Transaction ID: $tran = explode('ApprovalCode=', $response); $tran1 = explode('&', $response); $ret['transaction_id'] = @$tran1[0]; # AVS Details: $tran = explode('AVS=', $response); $tran1 = explode('&', $response); if (@$tran1[0] == 'y') { $ret['avs'] = 'avs_exact'; } else { $ret['avs'] = 'avs_no_match'; } # return if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Test Transaction if ($this->cfg['mode'] == "100") { $this->url = $this->url; } else { $this->url = $this->url_test; } $amount *= 100; $xml_request = '<ewaygateway>' . '<ewayCustomerID>' . $this->cfg['customer_id'] . '</ewayCustomerID>' . '<ewayTotalAmount>' . $amount . '</ewayTotalAmount>' . '<ewayCustomerFirstName>' . $this->account["first_name"] . '</ewayCustomerFirstName>' . '<ewayCustomerLastName>' . $this->account["last_name"] . '</ewayCustomerLastName>' . '<ewayCustomerEmail>' . $acct_fields["email"] . '</ewayCustomerEmail>' . '<ewayCustomerAddress>' . $this->account["address1"] . '</ewayCustomerAddress>' . '<ewayCustomerPostcode>' . $this->account["zip"] . '</ewayCustomerPostcode>' . '<ewayCustomerInvoiceDescription>Payment for Invoice No. ' . $invoice . '</ewayCustomerInvoiceDescription>' . '<ewayCustomerInvoiceRef>' . $invoice . '</ewayCustomerInvoiceRef>' . '<ewayCardHoldersName>' . $this->account["first_name"] . ' ' . $this->account["last_name"] . '</ewayCardHoldersName>' . '<ewayCardNumber>' . $this->billing["cc_no"] . '</ewayCardNumber>' . '<ewayCardExpiryMonth>' . $this->billing["exp_month"] . '</ewayCardExpiryMonth>' . '<ewayCardExpiryYear>' . $this->billing["exp_year"] . '</ewayCardExpiryYear>' . '<ewayTrxnNumber></ewayTrxnNumber>' . '<ewayOption1>' . $invoice . '</ewayOption1>' . '<ewayOption2></ewayOption2>' . '<ewayOption3></ewayOption3>' . '</ewaygateway>'; # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $xml_request, true, 1); # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } # Transaction Status: if (preg_match('@<ewayTrxnStatus>True</ewayTrxnStatus>@i', $response)) { $ret['status'] = 1; } else { $ret['status'] = 0; $ret['msg'] = 'Transaction failed, please verify your details.'; } # Transaction ID: $ret['transaction_id'] = ''; # AVS Details: $ret['avs'] = 'avs_na'; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Set the post vars: $vars = array(array('publisher-name', $this->cfg['account']), array('publisher-email', $this->cfg['email']), array('authtype', "authpostauth"), array('dontsndmail', "yes"), array('tax', "0.00"), array('shipping', "0.00"), array('currency', $currency_iso), array('card-amount', $amount), array('orderID', $invoice), array('card-cvv', $this->billing["ccv"]), array('card-number', $this->billing["cc_no"]), array('card_exp', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]), array('card-name', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('card-address1', $this->account["address1"] . ' ' . $this->account["address2"]), array('card-city', $this->account["city"]), array('card-state', $this->account["state"]), array('card-zip', $this->account["zip"]), array('email', $acct_fields["email"]), array('card-country', $country), array('ipaddress', USER_IP)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { return false; } else { $response = explode('&', $response); } for ($i = 0; $i < count($response); $i++) { $arr1 = explode('=', $response[$i]); $response[urldecode($arr1[0])] = urldecode($arr1[1]); } # Transaction Status: if ($response['FinalStatus'] == 'success') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: $ret['transaction_id'] = $response["auth-code"]; # Message: $ret['msg'] = $response["auth-msg"]; # AVS Details: $ret['avs'] = 'avs_na'; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Set the post vars: $vars = array(array('GEN_DESCRIPTION', "Payment For Invoice " . $invoice), array('GEN_TRANS_TYPE', "SALE"), array('GEN_PAYMENT_TYPE', "C"), array('GEN_ACCOUNT', $this->cfg['account']), array('GEN_SITETAG', $this->cfg['sitetag']), array('CARD_NUMBER', $this->billing["cc_no"]), array('CARD_EXPIRE', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]), array('CVV2', $this->billing["ccv"]), array('GEN_AMOUNT', $amount), array('CUST_NAME1', $this->account["first_name"]), array('CUST_NAME2', $this->account["last_name"]), array('CUST_ADDR_STREET', $this->account["address1"] . ' ' . $this->account["address2"]), array('CUST_ADDR_CITY', $this->account["city"]), array('CUST_ADDR_STATE', $this->account["state"]), array('CUST_ADDR_ZIP', $this->account["zip"]), array('CUST_ADDR_COUNTRY', $country), array('CUST_EMAIL', $acct_fields["email"]), array('CUST_IP', USER_IP)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Transaction Status: if (eregi("RET_STATUS=1", $response)) { $ret['status'] = 1; } elseif (eregi("RET_STATUS=0", $response)) { $ret['status'] = 0; $mydata = explode("\\&", $response); foreach ($mydata as $key => $value) { $newdata = explode('=', $value); $ret[$newdata[0]] = $newdata[1]; } $reason = urldecode($ret['RET_AUTH_MSG']); $ret['msg'] = @$reason; } else { $ret['status'] = 0; $ret['msg'] = 'SORRY, THE TRANSACTION FAILED'; } # Transaction ID: $ret['transaction_id'] = 0; # AVS Details: $ret['avs'] = 'avs_na'; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Set the post vars: $vars = array(array('M_id', $this->cfg['M_id']), array('M_key', $this->cfg['M_key']), array('C_name', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('C_address', $this->account["address1"] . ' ' . $this->account["address2"]), array('C_city', $this->account["city"]), array('C_state', $this->account["state"]), array('C_zip', $this->account["zip"]), array('C_country', $country), array('C_email', $acct_fields["email"]), array('C_cardnumer', $this->billing["cc_no"]), array('C_exp', $this->billing["exp_month"] . $this->billing["exp_year"]), array('C_ccv', $this->billing["ccv"]), array('T_amt', $amount), array('T_code', "01"), array('T_ordernum', $invoice)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); echo $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } # Transaction Status: if ($response[1] == 'A') { $ret['status'] = 1; } else { $ret['status'] = 0; } # AVS @($ret['avs'] = @$response[45]); # Message: $ret['msg'] = $response[2] . $response[3] . $response[4] . $response[5] . $response[6] . $response[7] . " - "; for ($i = 8; $i <= 39; $i++) { $ret['msg'] .= $response[$i]; } if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Test Transaction if ($this->cfg['mode'] = "1") { $test = "Y"; } else { $test = "N"; } # Set the post vars: $vars = array(array("testTransaction", $test), array("transactionCode", $this->cfg['type']), array("DPIAccountNum", $this->cfg['account']), array("password", $this->cfg['password']), array("cardHolderName", $this->account["first_name"] . '' . $this->account["last_name"]), array("cardHolderEmail", $this->account["email"]), array("cardHolderAddress", $this->account["address1"]), array("cardHolderCity", $this->account["city"]), array("cardHolderState", $this->account["state"]), array("cardHolderZip", $this->account["zip"]), array("customerNume", $acct_fields["id"]), array("orderNum", $invoice), array("cardAccountNum", $this->billing["cc_no"]), array("expirationDate", $this->billing["exp_month"] . '' . $this->billing["exp_year"]), array("CVV2", $this->billing["ccv"]), array("Serialnumber", $this->cfg['account']), array("transactionAmount", $amount)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $results = $n->connect($this->host, $this->url, $vars, true, 1); $response = explode('|', $results); # Transaction Status: if ($response[10] == '00') { $ret['status'] = 1; } else { $ret['status'] = 0; $ret['msg'] = 'The details you provided are invalid or declined.'; } # Transaction ID: $ret['transaction_id'] = $response[14]; $ret['authorization_id'] = $response[13]; # AVS Details: $ret['avs'] = $response[22]; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Set the post vars: $vars = array(array('MerchantID', $this->cfg['account']), array('ChargeType', "1"), array('ThanksURL', $this->success_url), array('ItemID1', "Payment for Invoice No. " . $invoice), array('Description1', "Payment for Invoice No. " . $invoice), array('Userid', "HTML Posting"), array('Price1', $amount), array('Quantity1', "1"), array('CardNumber', $this->billing["cc_no"]), array('ExpMonth', $this->billing["exp_month"]), array('ExpYear', $this->billing["exp_year"]), array('Bname', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('Baddr1', $this->account["address1"] . ' ' . $this->account["address2"]), array('Bcity', $this->account["city"]), array('Bstate', $this->account["state"]), array('Bzip', $this->account["zip"]), array('Email', $acct_fields["email"]), array('Bcountry', $country)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Transaction Status: if (!preg_match('/ErrMsg=/i', $response) && preg_match('/TranID=/i', $response)) { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: $ret['avs'] = 'avs_na'; # Message: $ret['msg'] = 'Sorry, the information entered is invalid or declined.'; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Test Transaction if ($this->cfg['mode'] = "0") { $test = "FALSE"; } else { $test = "TRUE"; } # Set the post vars: $vars = array(array('x_ADC_URL', "FALSE"), array('x_ADC_Delim_Data', "TRUE"), array('x_Version', "3.0"), array('x_Version', "3.0"), array('x_Currency_Code', $currency_iso), array('x_Method', "CC"), array('x_Transaction_Type', $this->cfg['x_Transaction_Type']), array('x_Test_Request', $test), array('x_Password', $this->cfg['x_Password']), array('x_Login', $this->cfg['x_Login']), array('x_Amount', $amount), array('x_Invoice_Num', $invoice), array('x_Description', "Payment for Invoice No. " . $invoice), array('x_Card_Code', $this->billing["ccv"]), array('x_Card_Num', $this->billing["cc_no"]), array('x_Exp_Date', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]), array('x_Cust_ID', $acct_fields["id"]), array('x_First_Name', $this->account["first_name"]), array('x_Last_Name', $this->account["last_name"]), array('x_Company', $this->account["company"]), array('x_Address', $this->account["address1"] . ' ' . $this->account["address2"]), array('x_City', $this->account["city"]), array('x_State', $this->account["state"]), array('x_Zip', $this->account["zip"]), array('x_Email', $acct_fields["email"]), array('x_Country', $country), array('x_Ship_To_First_Name', $this->account["first_name"]), array('x_Ship_To_Last_Name', $this->account["last_name"]), array('x_Ship_To_Company', $this->account["company"]), array('x_Ship_To_Address', $this->account["address1"] . ' ' . $this->account["address2"]), array('x_Ship_To_City', $this->account["city"]), array('x_Ship_To_State', $this->account["state"]), array('x_Ship_To_Zip', $this->account["zip"]), array('x_Ship_To_Country', $country), array('x_Customer_IP', USER_IP)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { return false; } else { $response = explode(',', $response); } # Transaction Status: if ($response[0] == '1') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: $ret['avs'] = $response[4]; # Message: $ret['msg'] = $response[3]; # AVS Details: if ($response[5] == 'A') { $ret['avs'] = 'avs_address_only'; } elseif ($response[5] == 'E') { $ret['avs'] = 'avs_error'; } elseif ($response[5] == 'N') { $ret['avs'] = 'avs_no_match'; } elseif ($response[5] == 'P') { $ret['avs'] = 'avs_na'; } elseif ($response[5] == 'R') { $ret['avs'] = 'avs_retry'; } elseif ($response[5] == 'S') { $ret['avs'] = 'avs_not_supported'; } elseif ($response[5] == 'U') { $ret['avs'] = 'avs_address_unavail'; } elseif ($response[5] == 'W') { $ret['avs'] = 'avs_fullzip_only'; } elseif ($response[5] == 'X') { $ret['avs'] = 'avs_exact'; } elseif ($response[5] == 'Y') { $ret['avs'] = 'avs_address_zip'; } elseif ($response[5] == 'Z') { $ret['avs'] = 'avs_partzip_only'; } else { $ret['avs'] = 'avs_na'; } if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
* License as published at http://www.agileco.com/agilebill/license1-4.txt * * For questions, help, comments, discussion, etc., please join the * Agileco community forums at http://forum.agileco.com/ * * @link http://www.agileco.com/ * @copyright 2004-2008 Agileco, LLC. * @license http://www.agileco.com/agilebill/license1-4.txt * @author Tony Landis <*****@*****.**> * @package AgileBill * @version 1.4.93 */ # Debug if (empty($VAR) && empty($VAR['do']) && !defined("PATH_AGILE")) { include_once '../../config.inc.php'; $test = new CORE_ssl(); $test->test(); } class CORE_ssl { function CORE_ssl($type = false) { $disabled_functions = ini_get('disable_functions'); if (defined("PATH_CURL") && is_file(PATH_CURL)) { $this->connect_curl_binary = true; } if (function_exists('curl_init') && ($curl_version = curl_version())) { if (phpversion() >= 5) { if (preg_match('/openssl/i', @$curl_version['ssl_version'])) { $this->connect_curl_module = true; }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('two_code', $acct_fields["country_id"]); # Test Transaction if ($this->cfg['mode'] != "1") { $test = "TRUE"; } else { $test = "FALSE"; } # Split up the credit card number the way goemerchant likes it. :( # They sure are weird aren't they? Who else does this? It sure is # harder to take a string apart than to put it together. End of rant. $cc1 = substr($this->billing['cc_no'], 0, 4); $cc2 = substr($this->billing['cc_no'], 4, 4); $cc3 = substr($this->billing['cc_no'], 8, 4); $cc4 = substr($this->billing['cc_no'], 12, 4); # Get the card type, apparently goemerchant does not know how to do # this on their end. Woe is me! (Visa, Amex, Discover, MasterCard) if (ereg('^4(.{12}|.{15})$', $cc_no)) { $cardname = 'Visa'; } elseif (ereg('^5[1-5].{14}$', $cc_no)) { $cardname = 'MasterCard'; } elseif (ereg('^3[47].{13}$', $cc_no)) { $cardname = 'Amex'; } elseif (ereg('^6011.{12}$', $cc_no)) { $cardname = 'Discover'; } # Set the post vars: $vars = array(array('operation_type', 'auth'), array('password', $this->cfg['x_Password']), array('merchant', $this->cfg['x_Login']), array('total', $amount), array('orderid', $invoice), array('cardname', $cardname), array('cardnum1', $cc1), array('cardnum2', $cc2), array('cardnum3', $cc3), array('cardnum4', $cc4), array('CCV2', $this->billing["ccv"]), array('cardexpm', $this->billing["exp_month"]), array('cardexpy', $this->billing["exp_year"]), array('nameoncard', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('cardstreet', $this->account["address1"] . ' ' . $this->account["address2"]), array('cardcity', $this->account["city"]), array('cardstate', $this->account["state"]), array('cardzip', $this->account["zip"]), array('cardcountry', $country)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Test Mode if ($this->cfg['mode'] == "1") { echo '<script language=Javascript>alert(\'Gateway response: ' . $response . '\') </script>'; } # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { $response = explode('|', $response); } # Transaction Status: if ($response[0] == '1') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: @($ret['avs'] = @$response[4]); # Message: @($ret['msg'] = @$response[2]); # AVS Details: if (@$response[3] == 'Y') { $ret['avs'] = 'avs_exact'; } else { $ret['avs'] = 'avs_no_match'; } if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('two_code', $acct_fields["country_id"]); # Test Transaction if ($this->cfg['mode'] != "1") { $this->host = 'realtime.test.firepay.com'; $this->url = '/servlet/DPServlet'; } else { $this->host = 'realtime.firepay.com'; $this->url = '/servlet/DPServlet'; } if (empty($this->billing["ccv"])) { $cvdind = 0; } else { $cvdind = 1; } switch (@$this->billing["card_type"]) { case 'visa': $ctype = 'VI'; break; case 'mc': $ctype = 'MC'; break; case 'amex': $ctype = 'AM'; break; case 'discover': $ctype = 'DI'; break; case 'delta': $ctype = ''; break; case 'solo': $ctype = 'SO'; break; case 'switch': $ctype = 'SW'; break; case 'jcb': $ctype = ''; break; case 'diners': $ctype = 'DC'; break; case 'carteblanche': $ctype = ''; break; case 'enroute': $ctype = ''; break; } # Set the post vars: $vars = array(array('account', $this->cfg['account']), array('merchantTxn', $invoice . microtime()), array('merchantId', $this->cfg['merchantId']), array('merchantPwd', $this->cfg['merchantPwd']), array('merchantData', "AgileBill Invoice Id : " . $invoice), array('amount', $amount * 100), array('cardNumber', $this->billing["cc_no"]), array('cardExp', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]), array('cvdIndicator', $cvdind), array('cvdValue', $this->billing["ccv"]), array('cardType', $ctype), array('operation', 'P'), array('clientVersion', '1.1'), array('custName1', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('StreetAddr', $this->account["address1"]), array('StreetAddr2', $this->account["address2"]), array('email', $acct_fields["email"]), array('city', $this->account["city"]), array('province', $this->account["state"]), array('zip', $this->account["zip"]), array('country', $country), array('phone', '18885551212')); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { $response = ereg_replace('\\+', ' ', $response); $response = explode('&', $response); foreach ($response as $var) { $item[] = explode("=", $var); } foreach ($item as $var) { ${$var}[0] = $var[1]; } } /* if($this->cfg['mode'] != "1") { print_r($response); print_r($item); exit; } */ # Transaction Status: if (@$status == 'SP') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: @($ret['transaction_id'] = @$authCode); # Message: @($ret['msg'] = @$avsInfo); if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Get the submitted billing details: global $VAR; @($billing = $VAR['checkout_plugin_data']); # Validate the currency: if (!$this->validate_currency($currency_iso)) { return false; } # validate the card type and number, and exp date: $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country name: $country = $this->getCountry('name', $this->account["country_id"]); # Get the data submitted from the customer: $billing = @$VAR['checkout_plugin_data']; # Set the post vars: $vars = array(array('Vendor', $this->cfg['account']), array('VPSProtocol', "2.20"), array('TxType', "PAYMENT"), array('Description', "Payment For Invoice " . $invoice), array('Currency', $currency_iso), array('Amount', $amount), array('VendorTxCode', $invoice), array('CardType', $this->billing["card_type"]), array('CV2', $this->billing["ccv"]), array('CardNumber', $this->billing["cc_no"]), array('ExpiryDate', $this->billing["exp_month"] . '' . $this->billing["exp_year"]), array('CardHolder', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('ClientNumber', $acct_fields["id"]), array('Address', $this->account["address1"] . ' ' . $this->account["address2"]), array('PostCode', $this->account["zip"])); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); $retval = "\r\n"; # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { $respond = explode($retval, $response); } for ($i = 0; $i < count($respond); $i++) { @($arr1 = explode('=', $respond[$i])); @($response1[urldecode($arr1[0])] = urldecode($arr1[1])); } /* echo $response1['StatusDetail']; print_r($response1); exit; */ # Transaction Status: if (trim($response1['Status']) == 'OK') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: $ret['transaction_id'] = $response1["TxAuthNo"]; # Message: $ret['msg'] = $response1['StatusDetail']; # AVS Details: $ret['avs'] = $response1["AVSCV2"]; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function postback($VAR) { # needed for return $ret['invoice_id'] = $VAR['order_id']; $ret['transaction_id'] = $VAR['transaction_id']; $ret['amount'] = $VAR['amount']; $ret['currency'] = DEFAULT_CURRENCY; # get the processor details: $db =& DB(); $q = "SELECT id,active,plugin_data FROM " . AGILE_DB_PREFIX . "checkout WHERE\n\t\t\t site_id \t\t= " . $db->qstr(DEFAULT_SITE) . " AND\n\t\t\t checkout_plugin\t= " . $db->qstr($this->name); $rs = $db->Execute($q); while (!$rs->EOF) { $ret['checkout_id'] = $rs->fields["id"]; $do = true; $this->cfg = unserialize($rs->fields["plugin_data"]); # Validate agains the posted 2checkout id: if ($this->cfg['email'] != $VAR['to_email']) { $do = false; } # Contact the nochex server for validation if ($do) { $this->host = 'www.nochex.com'; $this->url = '/nochex.dll/apc/apc'; while (list($key, $value) = each($VAR)) { $vars[] = array($key, $value); } # POST the variables back to NOCHEX: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); if (empty($response) || eregi("DECLINED", $response)) { $do = false; } elseif (eregi("AUTHORISED", $response)) { $do = true; } else { $do = false; } } if ($do) { include_once PATH_MODULES . 'checkout/checkout.inc.php'; $checkout = new checkout(); $checkout->postback($ret); echo '<SCRIPT LANGUAGE="JavaScript"> window.location="' . $this->success_url . '&id=' . $ret['invoice_id'] . '"; </script>'; return true; } $rs->MoveNext(); } echo '<SCRIPT LANGUAGE="JavaScript"> window.location="' . $this->decline_url . '&id=' . $ret['invoice_id'] . '"; </script>'; }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Set the post vars: $vars = array(array('x_ADC_URL', "FALSE"), array('x_ADC_Delim_Data', "TRUE"), array('x_Version', "3.0"), array('x_Currency_Code', $currency_iso), array('x_Method', "CC"), array('x_Transaction_Type', $this->cfg['x_Transaction_Type']), array('x_Login', $this->cfg['x_Login']), array('x_Invoice_Num', $invoice), array('xxxRequestMode', "A"), array('template', "0"), array('MerchantNumber', $this->cfg['x_Login']), array('Products', "{$amount}::1::P001::Payment%20for%20Invoice%20No.%{$invoice}::"), array('CVV2', $this->billing["ccv"]), array('xxxCard_Number', $this->billing["cc_no"]), array('xxxCCMonth', $this->billing["exp_month"]), array('xxxCCYear', $this->billing["exp_year"]), array('xxxCustomerID', $acct_fields["id"]), array('xxxName', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('xxxCard_Name', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('xxxCompany', $this->account["company"]), array('xxxAddress', $this->account["address1"] . ' ' . $this->account["address2"]), array('xxxCity', $this->account["city"]), array('xxxProvince', $this->account["state"]), array('xxxPostal', $this->account["zip"]), array('xxxEmail', $acct_fields["email"]), array('xxxCountry', $country), array('xxxShippingName', $this->account["first_name"] . ' ' . $this->account["last_name"]), array('xxxShippingCompany', $this->account["company"]), array('xxxShippingAddress', $this->account["address1"] . ' ' . $this->account["address2"]), array('xxxShippingCity', $this->account["city"]), array('xxxShippingProvince', $this->account["state"]), array('xxxShippingPostal', $this->account["zip"]), array('xxxShippingCountry', $country), array('xxxCustomerIP', USER_IP)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); echo $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { $response = explode(',', $response); } # Transaction Status: if ($response[0] == '1') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: @($ret['avs'] = @$response[4]); # Message: @($ret['msg'] = @$response[3]); # AVS Details: if (@$response[5] == 'A') { $ret['avs'] = 'avs_address_only'; } elseif (@$response[5] == 'E') { $ret['avs'] = 'avs_error'; } elseif (@$response[5] == 'N') { $ret['avs'] = 'avs_no_match'; } elseif (@$response[5] == 'P') { $ret['avs'] = 'avs_na'; } elseif (@$response[5] == 'R') { $ret['avs'] = 'avs_retry'; } elseif (@$response[5] == 'S') { $ret['avs'] = 'avs_not_supported'; } elseif (@$response[5] == 'U') { $ret['avs'] = 'avs_address_unavail'; } elseif (@$response[5] == 'W') { $ret['avs'] = 'avs_fullzip_only'; } elseif (@$response[5] == 'X') { $ret['avs'] = 'avs_exact'; } elseif (@$response[5] == 'Y') { $ret['avs'] = 'avs_address_zip'; } elseif (@$response[5] == 'Z') { $ret['avs'] = 'avs_partzip_only'; } else { $ret['avs'] = 'avs_na'; } if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Test Transaction if ($this->cfg['mode'] == "0") { $this->host = 'test5x.clearcommerce.com:11500'; $mode = 'Y'; } else { $mode = 'P'; $this->host = 'xmlic.payfuse.com'; } $xml = "<EngineDocList>\n\t<DocVersion>1.0</DocVersion>\n\t<EngineDoc>\n\t\t<ContentType>OrderFormDoc</ContentType>\n\t\t<User>\n\t\t\t<Name>{$this->cfg['name']}</Name>\n\t\t\t<Password>{$this->cfg['password']}</Password>\n\t\t\t<Alias>{$this->cfg['alias']}</Alias>\n\t\t</User>\n\t\t<Instructions>\n\t\t\t<Pipeline>Payment</Pipeline>\n\t\t</Instructions>\n\t\t<OrderFormDoc>\n\t\t\t<Mode>{$mode}</Mode>\n\t\t\t<Comments/>\n\t\t\t<Consumer>\n\t\t\t\t<Email/>\n\t\t\t\t<PaymentMech>\n\t\t\t\t\t<CreditCard>\n\t\t\t\t\t\t<Number>{$this->billing["cc_no"]}</Number>\n\t\t\t\t\t\t<Expires DataType=\"ExpirationDate\" Locale=\"840\">{$this->billing["exp_month"]}/{$this->billing["exp_year"]}</Expires>\n\t\t\t\t\t\t<Cvv2Val>{$this->billing["ccv"]}</Cvv2Val>\n\t\t\t\t\t\t<Cvv2Indicator>1</Cvv2Indicator>\n\t\t\t\t\t</CreditCard>\n\t\t\t\t</PaymentMech>\n\t\t\t\t<BillTo>\n\t\t\t\t\t<Location>\n\t\t\t\t\t\t<TelVoice/>\n\t\t\t\t\t\t<TelFax/>\n\t\t\t\t\t\t<Address>\n\t\t\t\t\t\t\t<Name>{$this->account["first_name"]} {$acct_fields["last_name"]}</Name>\n\t\t\t\t\t\t\t<Street1>{$this->account["address1"]}</Street1>\n\t\t\t\t\t\t\t<Street2>{$this->account["address2"]}</Street2>\n\t\t\t\t\t\t\t<City>{$this->account["city"]}</City>\n\t\t\t\t\t\t\t<StateProv>{$this->account["state"]}</StateProv>\n\t\t\t\t\t\t\t<PostalCode>{$this->account["zip"]}</PostalCode>\n\t\t\t\t\t\t\t<Country>840</Country>\n\t\t\t\t\t\t\t<Company/>\n\t\t\t\t\t\t</Address>\n\t\t\t\t\t</Location>\n\t\t\t\t</BillTo>\n\t\t\t</Consumer>\n\t\t\t<Transaction>\n\t\t\t\t<Type>Auth</Type>\n\t\t\t\t<CurrentTotals>\n\t\t\t\t\t<Totals>\n\t\t\t\t\t\t<Total DataType=\"Money\" Currency=\"840\">" . $amount * 100 . "</Total>\n\t\t\t\t\t</Totals>\n\t\t\t\t</CurrentTotals>\n\t\t\t</Transaction>\n\t\t</OrderFormDoc>\n\t</EngineDoc>\n</EngineDocList>"; $vars = array(array('xml', $xml)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, '', $vars, true, 1); # Get return response if (!$response) { echo '<script language=Javascript>alert(\'SSL Failed!\') </script>'; return false; } else { preg_match_all("/<(.*?)>(.*?)\\</", $response, $out, PREG_SET_ORDER); $n = 0; while (isset($out[$n])) { $arr[$out[$n][1]] = strip_tags($out[$n][0]); $n++; } } /* echo '<pre>'; print_r($arr); print_r($response); exit; */ # Transaction Status: $str = 'CcErrCode DataType="S32"'; if ($arr["{$str}"] == '1') { $ret['status'] = 1; } else { $ret['status'] = 0; } # AVS: $str = 'FraudResult DataType="String"'; @($ret['avs'] = @$arr["{$str}"]); # Message: $str = 'CcReturnMsg DataType="String"'; @($ret['msg'] = @$arr["{$str}"]); # Transaction ID $str = 'TransactionId DataType="String"'; @($ret['transaction_id'] = $arr["{$str}"]); if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }
function register() { global $VAR; $VAR['test'] = 1; # generate the xml string $xml_request = '?<?xml version="1.0" ?><request version="1.0" id="REQUEST-123456">' . '<reseller id="' . $this->registrar['user'] . '">' . '<password>secret' . $this->registrar['password'] . '</password>' . '<plan-id>' . $this->registrar['plan_id'] . '</plan-id>' . '</reseller>' . '<add-domain fqdn="' . $this->domain_name . '">' . '<password>' . $this->account['password'] . '</password>' . '<organization>' . $this->account['company'] . '</organization>' . '<ns priority="1" fqdn="' . $this->ns1 . '">' . '<ip>' . $this->nsip1 . '</ip>' . '</ns>' . '<ns priority="2" fqdn="' . $this->ns2 . '">' . '<ip>' . $this->nsip2 . '</ip>' . '</ns>' . '<contact type="admin">' . '<first-name>' . $this->account['first_name'] . 'e</first-name>' . '<last-name>' . $this->account['last_name'] . '</last-name>' . '<organization>' . $this->account['company'] . '</organization>' . '<address>' . '<street>' . $this->account['address1'] . '</street>' . '<city>' . $this->account['city'] . '</city>' . '<state>' . $this->account['state'] . '</state>' . '<postalcode>' . $this->account['zip'] . '</postalcode>' . '<country>' . $this->country . '</country>' . '</address>' . '<voice>+1 (888) 555-1212</voice>' . '<email>' . $this->account['email'] . '</email>' . '</contact>' . '<registration-period>' . $this->term . '</registration-period>' . '</add-domain>' . '</request>'; # Test mode: if ($this->registrar['mode'] == 1) { $this->url = '/PirinLink/Pirin.exe'; } else { $this->url = '/PirinLink/PirinTest.exe'; } # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect('names4ever.com', $this->url, $xml_request, true, 1); # debug #if($this->registrar['debug'] == 1) #echo "<textarea>$response</textarea>"; if (preg_match('@<status code="0">@', $response)) { return TRUE; } else { return FALSE; } }
function register() { # Set the user/pass: $pass_len = 8; $user_len = 14; # Generate a new username/login: $domain = $this->domain_name; # set the username $username = trim($domain); $username = preg_replace("/[-_\\.]/", "", $username); if (strlen($username) < $user_len) { $rand = md5(md5($username) . time()); $diff = $user_len - strlen($username); $username = $username . substr($rand, 0, $diff); } else { $rand = md5(microtime() . md5($username) . microtime()); $username = substr($username, 0, $user_len - 5); $username = $username . substr($rand, 0, 5); } # Set the password $password = substr(md5(md5(time()) . $domain . $username), 0, 10); # Set the user/pass for the XML queries $this->username = strtolower($username); $this->password = strtolower($password); ### create an account $vars = array(array('operation', 'user.add'), array('admin.username', $this->registrar['username']), array('admin.password', $this->registrar['password']), array('reseller.id', $this->registrar['reseller']), array('response.format', 'KEY_VALUE'), array('user.lastname', $this->account['last_name']), array('user.firstname', $this->account['first_name']), array('user.address1', $this->account['address1']), array('user.suburb', $this->account['city']), array('user.postcode', $this->account['zip']), array('user.state', $this->account['state']), array('user.country', $this->country), array('user.phone', '+1.8885551212'), array('user.email', $this->account['email']), array('user.username', $this->username), array('user.password', $this->password)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $result = $n->connect($this->host, $this->url, $vars, true, 1); # Debugging $this->debug($vars, $result); preg_match("/(user.id=)+([a-zA-Z0-9]){1,30}/i", $result, $arr); if (is_array($arr) && count($arr) > 0) { $id = preg_replace("/user.id=/", "", $arr[0]); if (!is_string($id)) { return false; } else { $user_id = $id; } } else { return false; } # register the domain; unset($vars); $vars = array(array('operation', 'domain.register'), array('admin.username', $this->registrar['username']), array('admin.password', $this->registrar['password']), array('reseller.id', $this->registrar['reseller']), array('response.format', 'KEY_VALUE'), array('domain.name', $this->domain_name), array('owner.id', $user_id), array('tech.id', $this->registrar['reseller']), array('admin.id', $this->registrar['reseller']), array('billing.id', $this->registrar['reseller']), array('register.period', $this->term), array('ns.name.0', $this->ns1), array('ns.ip.0', $this->nsip1), array('ns.name.1', $this->ns2), array('ns.ip.1', $this->nsip2)); ### .us parameters if ($this->tld == 'us') { $vars[] = array('us.intended_use', ''); $vars[] = array('us.nexus_category', ''); } elseif (preg_match('/au/', $this->tld)) { $vars[] = array('au.registrant.name', $this->account['first_name'] . ' ' . $this->account['last_name']); if ($this->tld == 'asn.au' || $this->tld == 'com.au' || $this->tld == 'net.au' || $this->tld == 'org.au') { $vars[] = array('au.org.type', 'OTHER'); } elseif ($this->tld == 'id.au') { $vars[] = array('au.org.type', 'CITIZEN'); $vars[] = array('au.registrant.address', $this->account['address1'] . ', ' . $this->account['city'] . ', ' . $this->account['state'] . ' ' . $this->account['zip']); } } # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $result = $n->connect($this->host, $this->url, $vars, true, 1); # Debug $this->debug($vars, $result); # Result if (preg_match('/success=TRUE/i', $result)) { return true; } else { return false; } }
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('name', $this->account["country_id"]); # Get the data submitted from the customer: $billing = @$VAR['checkout_plugin_data']; # Test mode: if ($this->cfg['mode']) { $this->host = $this->host_live; } else { $this->host = $this->host_test; } # Assemble the XML request $xml_request = '<!DOCTYPE pp.request PUBLIC "-//IMALL//DTD PUREPAYMENTS 1.0//EN" "http://www.purepayments.com/dtd/purepayments.dtd">'; $xml_request .= ' <pp.request merchant="' . $this->cfg['account'] . '" password="******"> <pp.auth ordernumber="' . $invoice . '" ecommerce="true" ecommercecode="07" ponumber="' . $this->account["first_name"] . ' ' . $this->account["last_name"] . '" ipaddress="' . USER_IP . '" shippingcost="0.00USD" taxamount="0.00USD" referringurl="NA" browsertype="NA"> <pp.lineitem quantity="1" sku="NA" description="Invoice ' . $invoice . '" unitprice="' . $amount . 'USD" taxrate="0.00" /> <pp.creditcard number="' . $this->billing["cc_no"] . '" expiration="' . $this->billing["exp_month"] . '/' . $this->billing["exp_year"] . '" cvv2="' . $this->billing["ccv"] . '" cvv2status="1"> <pp.address type="billing" fullname="' . $this->account["first_name"] . ' ' . $this->account["last_name"] . '" address1="' . $this->account["address1"] . '" address2="' . $this->account["address2"] . '" city="' . $this->account["city"] . '" state="' . $this->account["state"] . '" zip="' . $this->account["zip"] . '" country="' . $country . '" phone="" email="' . $acct_fields["email"] . '" /> </pp.creditcard> <pp.ordertext type="instructions">Payment for order ' . $invoice . '</pp.ordertext> <pp.address type="shipping" fullname="' . $this->account["first_name"] . ' ' . $this->account["last_name"] . '" address1="' . $this->account["address1"] . '" address2="' . $this->account["address2"] . '" city="' . $this->account["city"] . '" state="' . $this->account["state"] . '" zip="' . $this->account["zip"] . '" country="' . $country . '" phone="" email="' . $acct_fields["email"] . '" /> </pp.auth> </pp.request>'; # Set the post vars: $vars = array(array('xml', $xml_request)); # Create the SSL connection & get response from the gateway: include_once PATH_CORE . 'ssl.inc.php'; $n = new CORE_ssl(); $response = $n->connect($this->host, $this->url, $vars, true, 1); # Get return response if (!$response) { return false; } else { $respond = explode('&', $response); } for ($i = 0; $i < count($respond); $i++) { @($arr1 = explode('=', $respond[$i])); @($response1[urldecode($arr1[0])] = urldecode($arr1[1])); } # Transaction Status: if (trim($response1['?valid']) == 'true') { $ret['status'] = 1; } else { $ret['status'] = 0; } # Transaction ID: $ret['transaction_id'] = $response1["trans_id"]; $ret['authorization_id'] = $response1["auth_code"]; # Message: $ret['msg'] = $response; # AVS Details: $ret['avs'] = 'avs_na'; if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }