Payment_Process
[ class tree: Payment_Process ] [ index: Payment_Process ] [ all elements ]

Source for file TrustCommerce_creditcard.php

Documentation is available at TrustCommerce_creditcard.php

  1. <?php
  2.  
  3.   if(!function_exists('is_a')) {
  4.       function is_a($object,$string{
  5.           if(stristr(get_class($object),$string|| 
  6.              stristr(get_parent_class($object),$string)) {
  7.               return TRUE;
  8.           else {
  9.               return FALSE;
  10.           }
  11.       }
  12.   }
  13.  
  14.   require_once('Payment/Process.php');
  15.  
  16.   $options = array();
  17.   $options['debug'= TRUE;
  18.  
  19.   $process Payment_Process::factory('TrustCommerce',$options);
  20.   $process->_debug = true;
  21.   $process->login = 'TestMerchant';
  22.   $process->password = 'password';
  23.   $process->action = PAYMENT_PROCESS_ACTION_NORMAL;
  24.   $process->amount = 99.99;
  25.  
  26.   $card Payment_Process_Type::factory('CreditCard');
  27.   $card->type = PAYMENT_PROCESS_CC_VISA;
  28.   $card->cardNumber = '4111111111111111';
  29.   $card->expDate = '01/2005';
  30.   if(!$process->setPayment($card)) {
  31.       die("Unable to set payment\n");
  32.   }
  33.   $result $process->process();
  34.   if (PEAR::isError($result)) {
  35.       echo "---------------------- ERROR ------------------------\n";
  36.       echo $result->getMessage()."\n";
  37.       echo "---------------------- ERROR ------------------------\n";
  38.   else {
  39.       echo "---------------------- RESPONSE ------------------------\n";
  40.       echo 'Processor result: ';
  41.       echo $result->getCode()." - ";
  42.       echo $result->getMessage();
  43.       echo "---------------------- RESPONSE ------------------------\n";
  44.   }
  45. ?>

Documentation generated on Mon, 11 Mar 2019 15:41:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.