コード例 #1
0
ファイル: USA_EPAY.php プロジェクト: hbustun/agilebill
 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;
     }
     $tran = new umTransaction();
     $tran->key = $this->cfg['key'];
     $tran->testmode = $this->cfg['mode'];
     $tran->ip = USER_IP;
     $tran->card = $this->billing["cc_no"];
     $tran->exp = $this->billing["exp_month"] . $this->billing["exp_year"];
     $tran->amount = $amount;
     $tran->invoice = $invoice;
     $tran->cardholder = $this->account["first_name"] . ' ' . $this->account["last_name"];
     $tran->street = $this->account["address1"] . ' ' . $this->account["address2"];
     $tran->zip = $this->account["zip"];
     $tran->description = "Invoice {$invoice}";
     $tran->cvv2 = $this->billing["ccv"];
     if ($tran->Process()) {
         $ret['status'] = 1;
         $ret['avs'] = $tran->avs;
         $ret['msg'] = $tran->authcode . '  ' . $tran->cvv2;
     } else {
         $ret['status'] = 0;
         $ret['msg'] = "Card Declined (" . $tran->result . ")";
         $ret['msg'] .= " " . $tran->error;
         if ($tran->curlerror) {
             echo "<b>Curl Error:</b> " . $tran->curlerror . "<br>";
             exit;
         }
     }
     if ($ret['status'] == 1) {
         return $ret;
     } else {
         global $VAR;
         @($VAR['msg'] = $ret["msg"]);
         return false;
     }
 }
コード例 #2
0
 function USAePayCreateProfile($orderInfo, $creditInfo, $params = array())
 {
     require_once OSEMSC_B_LIB . DS . 'usaepay.php';
     $tran = new umTransaction();
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $source_key = $pConfig->usaepay_source_key;
     $testmode = $pConfig->usaepay_testmode;
     $sendReceipt = empty($pConfig->usaepay_sendReceipt) ? 'no' : 'yes';
     $payment = oseRegistry::call('payment');
     $paymentOrder = $payment->getInstance('Order');
     $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
     $orderInfoParams = oseJson::decode($orderInfo->params);
     $redirectUrl = urldecode($orderInfoParams->returnUrl);
     $redirectUrl = $redirectUrl ? $redirectUrl : JURI::base() . "index.php?option=com_osemsc&view=member";
     $tran->key = $source_key;
     $tran->testmode = $testmode;
     $tran->usesandbox = $pConfig->usaepay_usesandbox;
     $tran->custreceipt = $sendReceipt;
     //Credit Card Info
     $tran->cardholder = $creditInfo['creditcard_name'];
     $tran->card = $creditInfo['creditcard_number'];
     $tran->cvv2 = $creditInfo['creditcard_cvv'];
     $tran->exp = $creditInfo['creditcard_month'] . substr($creditInfo['creditcard_year'], 2, 2);
     $tran->street = $billinginfo->addr1 . ' ' . $billinginfo->addr2;
     $tran->zip = $billinginfo->postcode;
     //Item Info
     $tran->currency = $this->transCurrency($orderInfo->payment_currency);
     // international currency, full list of codes: http://wiki.usaepay.com/developer/currencycode
     if (empty($tran->currency)) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = 'Currency Error';
         return $result;
     }
     $tran->amount = $orderInfo->payment_price;
     $tran->billamount = $orderInfoParams->next_total;
     $tran->invoice = $orderInfo->order_number;
     $tran->description = self::generateDesc($orderInfo->order_id);
     $tran->command = 'sale';
     $tran->addcustomer = 'yes';
     $tran->schedule = $this->transUnit($orderInfoParams->t3);
     //billing Info
     $tran->billfname = $billinginfo->firstname;
     $tran->billlname = $billinginfo->lastname;
     $tran->billcompany = $billinginfo->company;
     $tran->billstreet = $billinginfo->addr1;
     $tran->billstreet2 = $billinginfo->addr2;
     $tran->billcity = $billinginfo->city;
     $tran->billstate = $billinginfo->state;
     $tran->billzip = $billinginfo->postcode;
     $tran->billcountry = $billinginfo->country;
     $tran->billphone = $billinginfo->telephone;
     $tran->email = $billinginfo->email;
     $result = array();
     if ($tran->Process()) {
         $paymentOrder->confirmOrder($orderInfo->order_id, array());
         $result['success'] = true;
         $result['title'] = JText::_('SUCCESSFUL_ACTIVATION');
         $result['content'] = JText::_('MEMBERSHIP_ACTIVATED_CONTINUE');
         $result['returnUrl'] = $redirectUrl;
     } else {
         $result['success'] = false;
         $result['title'] = $tran->result;
         $result['content'] = $tran->error;
         $result['returnUrl'] = JURI::base() . "index.php?option=com_osemsc&view=register";
     }
     return $result;
 }
コード例 #3
0
ファイル: process.php プロジェクト: paydunk/usa-epay
<?php

include dirname(__FILE__) . "/usaepay.php";
// Change this path to the location you have save usaepay.php
$tran = new umTransaction();
$tran->key = "H1qyx3Oe8RP68wumRFJ8Pn3PO2DNq24v";
// Your Source Key
$tran->pin = "1234";
// Source Key Pin
$tran->usesandbox = true;
// Sandbox true/false
$tran->ip = $REMOTE_ADDR;
// This allows fraud blocking on the customers ip address
$tran->testmode = 0;
// Change this to 0 for the transaction to process
$tran->command = "cc:sale";
// Command to run; Possible values are: cc:sale, cc:authonly, cc:capture, cc:credit, cc:postauth, check:sale, check:credit, void, void:release, refund, creditvoid and cc:save. Default is cc:sale.
$tran->card = $_POST['card_number'];
// card number, no dashes, no spaces
$tran->exp = str_replace('/', '', $_POST['expiration_date']);
// expiration date 4 digits no /
$tran->amount = $_POST['order_number'];
// charge amount in dollars
$tran->invoice = $_POST['transaction_uuid'];
// invoice number.  must be unique.
$tran->cardholder = $_POST['billing_name'];
// name of card holder
$tran->street = $_POST['billing_address_1'] . ', ' . $_POST['billing_address_2'];
// street address
$tran->zip = $_POST['billing_zip'];
// zip code
コード例 #4
0
ファイル: axia.php プロジェクト: uiDeveloper116/webstore
 /**
  * The run() function is called from Web Store to run the process.
  * @return array
  */
 public function run()
 {
     require_once "usaepay.php";
     $DEBUGGING = 1;
     # Display additional information to track down problems
     $TESTING = 1;
     # Set the testing flag so that transactions are not live
     $ERROR_RETRIES = 2;
     # Number of transactions to post if soft errors occur
     $source_key = $this->config['source_key'];
     $source_key_pin = isset($this->config['source_key_pin']) ? $this->config['source_key_pin'] : false;
     $tran = new umTransaction();
     $tran->key = $source_key;
     if ($source_key_pin) {
         $tran->pin = $source_key_pin;
     }
     $tran->ip = $_SERVER['REMOTE_ADDR'];
     // This allows fraud blocking on the customers ip address
     if ($this->config['live'] == 'test') {
         $tran->testmode = 1;
     } else {
         $tran->testmode = 0;
     }
     $tran->card = _xls_number_only($this->CheckoutForm->cardNumber);
     // card number, no dashes, no spaces
     $tran->exp = $this->CheckoutForm->cardExpiryMonth . substr($this->CheckoutForm->cardExpiryYear, 2, 2);
     // expiration date 4 digits no /
     $tran->amount = $this->objCart->total;
     // charge amount in dollars
     $tran->invoice = $this->objCart->id_str;
     // invoice number.  must be unique.
     $tran->cardholder = $this->CheckoutForm->cardNameOnCard;
     // name of card holder
     $tran->street = $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2;
     // street address
     $tran->zip = str_replace(" ", "", $this->CheckoutForm->billingPostal);
     // zip code
     $tran->description = _xls_get_conf('STORE_NAME') . " " . $this->objCart->id_str;
     // description of charge
     $tran->cvv2 = $this->CheckoutForm->cardCVV;
     // cvv2 code
     $tran->billfname = $this->CheckoutForm->contactFirstName;
     $tran->billlname = $this->CheckoutForm->contactLastName;
     $tran->billstreet = $this->CheckoutForm->billingAddress1;
     $tran->billstreet2 = $this->CheckoutForm->billingAddress2;
     $tran->billcity = $this->CheckoutForm->billingCity;
     $tran->billstate = $this->CheckoutForm->billingStateCode;
     $tran->billzip = $this->CheckoutForm->billingPostal;
     $tran->billcountry = $this->CheckoutForm->billingCountryCode;
     $tran->billphone = $this->CheckoutForm->contactPhone;
     $tran->email = $this->CheckoutForm->contactEmail;
     $tran->shipfname = $this->CheckoutForm->shippingFirstName;
     $tran->shiplname = $this->CheckoutForm->shippingLastName;
     $tran->shipstreet = $this->CheckoutForm->shippingAddress1;
     $tran->shipstreet2 = $this->CheckoutForm->shippingAddress2;
     $tran->shipcity = $this->CheckoutForm->shippingCity;
     $tran->shipstate = $this->CheckoutForm->shippingStateCode;
     $tran->shipzip = $this->CheckoutForm->shippingPostal;
     $tran->shipcountry = $this->CheckoutForm->shippingCountryCode;
     $tran->custid = Yii::app()->user->id;
     $tranTemp = clone $tran;
     Yii::log(sprintf("%s sending %s for amt %s\nRequest %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, print_r($this->obfuscateRequestArray($tranTemp), true)), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     if ($tran->Process()) {
         //We have success
         $arrReturn['success'] = true;
         $arrReturn['amount_paid'] = $this->objCart->total;
         $arrReturn['result'] = $tran->refnum;
     } else {
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $errortext = Yii::t('global', $tran->error);
         $arrReturn['result'] = Yii::t('global', $errortext);
         Yii::log("Declined: " . $errortext, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
     unset($tran->card);
     unset($tran->exp);
     unset($tran->key);
     unset($tran->pin);
     Yii::log(sprintf("%s receiving %s", __CLASS__, print_r($tran, true)), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     return $arrReturn;
 }
コード例 #5
0
<?php

// USA ePay PHP Library.
//      v1.6
//
//      Copyright (c) 2002-2007 USA ePay
//      For assistance please contact devsupport@usaepay.com
//
//  The following script uses the Test function to verify
//  that your PHP installation can properly communicate with
//  the USAePay Gateway.  If a problem is detected, potential
//  solutions will be suggested.  If none of the suggestions
//  work for you, please contact support for additional
//  assistance.
//
// Change this path to match the location of your usaepay.php file
include "/home/usaepay-php/usaepay.php";
$tran = new umTransaction();
// Uncomment this line to specify a root ca bundle location for Windows
//$tran->cabundle='c:\windows\curl-ca-bundle.crt';
// Uncomment this line to specify a root ca bundle location for Unix
//$tran->cabundle='/usr/share/curl/curl-ca-bundle.crt';
$tran->Test();
コード例 #6
0
ファイル: usaepay.php プロジェクト: rrecurse/IntenseCart
 function before_process()
 {
     global $HTTP_POST_VARS, $order;
     require DIR_FS_CATALOG_MODULES . "payment/usaepay/usaepay.php";
     $tran = new umTransaction();
     $tran->key = MODULE_PAYMENT_INTENSEPAY_KEY;
     $tran->testmode = MODULE_PAYMENT_INTENSEPAY_TEST == 'True';
     $tran->card = $_POST['intensepay_cc_num'];
     // card number, no dashes, no spaces
     $tran->exp = $_POST['intensepay_cc_exp_mon'] . $_POST['intensepay_cc_exp_year'];
     // expiration date 4 digits no /
     $tran->amount = $order->info['total'];
     // charge amount in dollars (no international support yet)
     $tran->invoice = "1234";
     // invoice number.  must be unique.
     $tran->cardholder = $_POST['intensepay_cc_name'];
     // name of card holder
     $tran->street = $order->billing['address1'];
     // street address
     $tran->zip = $order->billing['postcode'];
     // zip code
     $tran->description = "Online Order - @ " . STORE_NAME;
     // description of charge
     $tran->cvv2 = $_POST['intensepay_cvv2'];
     // cvv2 code
     if ($tran->Process()) {
         return true;
         echo "<b>Card approved</b><br>";
         echo "<b>Authcode:</b> " . $tran->authcode . "<br>";
         echo "<b>AVS Result:</b> " . $tran->avs_result . "<br>";
         echo "<b>Cvv2 Result:</b> " . $tran->cvv2_result . "<br>";
     } else {
         echo "<b>Card Declined</b> (" . $tran->result . ")<br>";
         echo "<b>Reason:</b> " . $tran->error . "<br>";
         if ($tran->curlerror) {
             echo "<b>Curl Error:</b> " . $tran->curlerror . "<br>";
         }
     }
 }
コード例 #7
0
// USA ePay PHP Library.
//      v1.6
//
//      Copyright (c) 2002-2008 USA ePay
//      For support please contact devsupport@usaepay.com
//
//  The following is an example of running a quicksale, which is a new transaction
//  against a prior sale or credit.  Credit card (or ACH) data is retrieved from
//  prior transaction and does not need to be provided.  The only required information
//  is the transaction reference number (refnum) and the amount.
//
//  Please see the README file for more information on usage.
//
// Change this path to the location you have save usaepay.php to
include "./usaepay.php";
$tran = new umTransaction();
$tran->key = "897asdfjha98ds6f76324hbmnBZc9769374ybndfs876";
$tran->usesandbox = true;
$tran->pin = "1234";
$tran->ip = $REMOTE_ADDR;
// This allows fraud blocking on the customers ip address
$tran->testmode = 0;
// Change this to 0 for the transaction to process
$tran->usesandbox = 1;
$tran->amount = "10.00";
// charge amount in dollars
$tran->invoice = "1234";
// invoice number.  must be unique.
$tran->description = "Online Order";
// description of charge
$tran->refnum = "47100443";