* @package AgileBill * @version 1.4.93 */ include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); class plg_chout_SUREPAY extends base_checkout_plugin { # Get the config values for this checkout plugin: function plg_chout_SUREPAY ($checkout_id=false) { $this->name = 'SUREPAY'; $this->type = 'gateway'; // redirect, gateway, or other $this->recurr_only = false; $this->checkout_id = $checkout_id; $this->support_cur = Array ('USD'); $this->host_test = 'xml.test.surepay.com'; $this->host_live = 'xml.surepay.com'; $this->url = '/'; $this->getDetails($checkout_id); } # Validate the user submitted billing details at checkout: function validate($VAR) { return true; } # Perform the checkout transaction (new purchase): 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 = ''; $xml_request.=' account["last_name"] .'" ipaddress="' . USER_IP .'" shippingcost="0.00USD" taxamount="0.00USD" referringurl="NA" browsertype="NA"> billing["exp_year"] .'" cvv2="'.$this->billing["ccv"].'" cvv2status="1"> 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"] .'" /> Payment for order ' . $invoice .' 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"] .'" /> '; # 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; $isaveCreditCardDetails($VAR); } # Perform a transaction for an (new invoice): function bill_invoice($VAR) { return true; } # Issue a refund for a paid invoice (captured charges w/gateway) function refund($VAR) { return true; } # Void a authorized charge (gateways only) function void($VAR) { return true; } } ?>