public static function process_transaction($values) { global $a; $wsdl = ACTIVITY_CENTER_TRANSACTION_URL . '/soap/gate/0AE595C1/usaepay.wsdl'; // instantiate SoapClient object as $client $client = new SoapClient($wsdl); $sourcekey = ACTIVITY_CENTER_USAEPAY_KEY; $pin = '3532'; // generate random seed value $seed = time() . rand(); // make hash value using sha1 function $clear = $sourcekey . $seed . $pin; $hash = sha1($clear); // assembly ueSecurityToken as an array $token = array('SourceKey' => $sourcekey, 'PinHash' => array('Type' => 'sha1', 'Seed' => $seed, 'HashValue' => $hash), 'ClientIP' => $_SERVER['REMOTE_ADDR']); try { $lineItems[] = array('ProductRefNum' => $a->ID, 'SKU' => $a->post_title, 'ProductName' => 'Activity Fee', 'Description' => $a->desc_short, 'UnitPrice' => $a->fee, 'Qty' => AC::load_saved_data('number_of_registrants'), 'Taxable' => $a->include_tax); if (AC::is_addon_in_cart()) { foreach (AC::get_addons_in_cart() as $tax_status_group) { foreach ($tax_status_group as $addon) { $tax_status_group == 'taxable' ? $tax = true : ($tax = false); $lineItems[] = array('ProductRefNum' => $a->ID, 'SKU' => $a->post_title, 'ProductName' => $a->addon_group[$addon['index']]['title'], 'Description' => $a->addon_group[$addon['index']]['desc'], 'UnitPrice' => $a->addon_group[$addon['index']]['cost'], 'Qty' => $addon['quantity'], 'Taxable' => $tax); } } } if (AC::load_saved_data('gratuity')) { $lineItems[] = array('ProductRefNum' => $a->ID, 'SKU' => $a->post_title, 'ProductName' => 'Gratuity', 'Description' => AC::load_saved_data('gratuity') . '% gratuity', 'UnitPrice' => AC::calculate_gratuity(), 'Qty' => 1, 'Taxable' => false); } if (AC::load_saved_data('donation')) { $lineItems[] = array('ProductRefNum' => $a->ID, 'SKU' => $a->post_title, 'ProductName' => 'Donation', 'Description' => 'Donation to the Vetri Foundation', 'UnitPrice' => AC::load_saved_data('donation'), 'Qty' => 1, 'Taxable' => false); } $values['number_of_registrants'] < 2 ? $seats = 'seat' : ($seats = 'seats'); $Request = array('AccountHolder' => $values['cc_name'], 'Details' => array('Description' => $values['number_of_registrants'] . ' ' . $seats . ' for ' . $a->post_title, 'Amount' => AC::get_total(), 'OrderID' => $_SESSION['edgimo-reservation-form']['timer_id'], 'Currency' => 'USD'), 'CreditCardData' => array('CardNumber' => $values['cc_number'], 'CardExpiration' => $values['cc_exp_month'] . $values['cc_exp_year'], 'AvsStreet' => $values['billing_address'], 'AvsZip' => $values['billing_zip'], 'CardCode' => $values['cc_ccv']), 'BillingAddress' => array('City' => $values['billing_city'], 'Email' => $values['registrant_1_email'], 'FirstName' => $values['billing_first_name'], 'LastName' => $values['billing_last_name'], 'Phone' => $values['billing_phone'], 'State' => $values['billing_state'], 'Street' => $values['billing_address'], 'Zip' => $values['billing_zip']), 'LineItems' => $lineItems); $res = $client->runTransaction($token, $Request); if (ACTIVITY_CENTER_TESTMODE) { var_dump($res); } $result = array(); if ($res->Result == 'Error') { $result['success'] = false; $result['message'] = 'There was an error with your transaction:<br /><strong>' . $res->Error . '</strong>'; } if ($res->Result == 'Approved') { $result['success'] = true; $result['message'] = 'Your reservation has been approved!'; $result['RefNum'] = $res->RefNum; $result['AuthCode'] = $res->AuthCode; $result['CardType'] = $res->CardLevelResult; $result['Last4'] = substr($values['cc_number'], -4); } if ($res->Result == 'Declined') { $result['success'] = false; $result['message'] = 'Your transaction was declined. Please check your information and try again.<br />Error: <strong>' . $res->Error . '</strong>.'; } return $result; } catch (SoapFault $e) { echo $client->__getLastRequest(); echo $client->__getLastResponse(); die("runTransaction failed :" . $e->getMessage()); } }
?> <tr> <td colspan="2" class="darker"><strong>Items</strong></td> </tr> <tr> <td class="padded">Activity Fee (x<?php echo AC::load_saved_data('number_of_registrants'); ?> ):</td> <td><?php echo '$' . $a->fee * AC::load_saved_data('number_of_registrants'); ?> </td> </tr> <?php if (AC::is_addon_in_cart()) { ?> <?php $addons_in_cart = AC::get_addons_in_cart(); ?> <?php foreach ($addons_in_cart as $addon_group) { ?> <?php foreach ($addon_group as $addon) { ?> <tr> <td class="padded"><?php echo $addon['title'];