Last minute updates before going live.

git-svn-id: http://svn.cleancode.org/svn/pickles@104 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
Josh Sherman 2009-03-07 00:57:56 +00:00
parent d1f5e44ae0
commit ad3e003a5a
2 changed files with 34 additions and 12 deletions

View file

@ -29,8 +29,11 @@
*/
class WebService_AuthorizeNet_AIM extends WebService_Common {
private $url = 'https://test.authorize.net/gateway/transact.dll';
// $auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
private $test_url = 'https://test.authorize.net/gateway/transact.dll';
private $prod_url = 'https://secure.authorize.net/gateway/transact.dll';
private $test_login = '7wYB5c6R';
private $test_transaction_key = '4px54kx6ZZ7489Gq';
private $response_variables = array(
'response_code',
@ -78,20 +81,33 @@ class WebService_AuthorizeNet_AIM extends WebService_Common {
public function process() {
if (preg_match("/{$this->config->webservices->authorizenet_aim->domain}/", $_SERVER['HTTP_HOST'])) {
$url = $this->prod_url;
$login = $this->config->webservices->authorizenet_aim->login;
$transaction_key = $this->config->webservices->authorizenet_aim->transaction_key;
$test_request = 'FALSE';
}
else {
$url = $this->test_url;
$login = $this->test_login;
$transaction_key = $this->test_transaction_key;
$test_request = 'TRUE';
}
// Assembles an array of all our transaction variables and values
$post_variables = array(
'x_test_request' => 'TRUE',
'x_test_request' => $test_request,
'x_invoice_num' => $this->order_id,
'x_cust_id' => trim($this->customer_id) != '' ? $this->customer_id : 'N/A',
'x_cust_up' => $this->customer_ip,
'x_description' => 'Menopause Solutions',
'x_login' => $this->config->gateway->authorizenet_aim->test->login,
'x_login' => $login,
'x_version' => '3.1',
'x_delim_char' => '|',
'x_delim_data' => 'TRUE',
'x_type' => 'AUTH_CAPTURE', // @todo let the user pass this in for more functionality
'x_method' => 'CC',
'x_tran_key' => $this->config->gateway->authorizenet_aim->test->transaction_key,
'x_tran_key' => $transaction_key,
'x_relay_response' => 'FALSE',
// Payment information
@ -158,7 +174,7 @@ class WebService_AuthorizeNet_AIM extends WebService_Common {
}
// POSTs the transaction to Authorize.Net
$curl = curl_init($this->url);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($curl, CURLOPT_POSTFIELDS, rtrim($fields, '& ')); // use HTTP POST to send form data

View file

@ -170,7 +170,7 @@ class store_checkout extends store {
'password' => md5($_REQUEST['password']),
'billing_address_id' => $billing_address_id,
'shipping_address_id' => $shipping_address_id,
'created_at' => datE('Y-m-d H:i:s')
'created_at' => date('Y-m-d H:i:s')
);
if (!isset($cart['customer_id']) || $cart['customer_id'] == 0) {
@ -241,10 +241,16 @@ URL: http://www.menopausesolutions.net
return false;
}
}
// Updates the existing customer account
else {
$this->db->execute('customers', $customer, array('id' => $cart['customer_id']));
}
}
// Updates the existing customer account
else if (isset($cart['customer_id']) && $cart['customer_id'] != 0) {
$customer = array(
'billing_address_id' => $billing_address_id,
'shipping_address_id' => $shipping_address_id,
'updated_at' => date('Y-m-d H:i:s')
);
$this->db->update('customers', $customer, array('id' => $cart['customer_id']));
}
if ($this->error->getErrors()) {
@ -324,7 +330,7 @@ URL: http://www.menopausesolutions.net
$receipt_products .= "
Item : {$product['sku']}
Description : >
{$product['name']} {$product['description']}
{$product['name']}
Quantity : {$product['quantity']}
Unit Price : US \${$product['price']}
";