* @link http://www.phpfour.com */ abstract class PaymentGateway { /** * Holds the last error encountered * * @var string */ public $lastError; /** * Do we need to log IPN results ? * * @var boolean */ public $logIpn; /** * File to log IPN results * * @var string */ public $ipnLogFile; /** * Payment gateway IPN response * * @var string */ public $ipnResponse; /** * Are we in test mode ? * * @var boolean */ public $testMode; /** * Field array to submit to gateway * * @var array */ public $fields = array(); /** * IPN post values as array * * @var array */ public $ipnData = array(); /** * Payment gateway URL * * @var string */ public $gatewayUrl; /** * Initialization constructor * * @param none * @return void */ public function __construct() { // Some default values of the class $this->lastError = ''; $this->logIpn = TRUE; $this->ipnResponse = ''; $this->testMode = FALSE; } /** * Adds a key=>value pair to the fields array * * @param string key of field * @param string value of field * @return */ public function addField($field, $value) { $this->fields["$field"] = $value; } /** * Submit Payment Request * * Generates a form with hidden elements from the fields array * and submits it to the payment gateway URL. The user is presented * a redirecting message along with a button to click. * * @param none * @return void */ public function submitPayment() { $this->prepareSubmit(); echo "\n"; echo "