|
Source for file AMI_PaymentSystemDriver.php
Documentation is available at AMI_PaymentSystemDriver.php
* @copyright Amiro.CMS. All rights reserved. The changes are undesirable and dangerous.
* @package Driver_PaymentSystem
* @version $Id: AMI_PaymentSystemDriver.php 47361 2014-02-03 05:48:50Z Leontiev Anton $
* @package Driver_PaymentSystem
* Driver path relative to pay_drivers/
* @param GUI_Template $vGui GUI_Template object, required for process templates data
final public function __construct(GUI_Template $vGui){
parent::__construct($vGui);
* Get checkout button HTML form.
* @param array &$aRes Will contain "error" (error description, 'Success by default') and "errno" (error code, 0 by default). "forms" will contain a created form
* @param array $aData The data list for button generation
* @param bool $bAutoRedirect If form autosubmit required (directly from checkout page)
* @return bool true if form is generated, false otherwise
public function getPayButton(array &$aRes, array $aData, $bAutoRedirect = false){
if(!isset ($aRes['error'])){
$aRes["error"] = "Success";
if(!isset ($aRes['errno'])){
return parent::getPayButton($aRes, $aData, $bAutoRedirect);
* Get the form that will be autosubmitted to payment system. This step is required for some shooping cart actions.
* @param array $aData The data list for button generation
* @param array &$aRes Will contain "error" (error description, 'Success by default') and "errno" (error code, 0 by default). "forms" will contain a created form
* @return bool true if form is generated, false otherwise
if(!isset ($aRes['error'])){
$aRes["error"] = "Success";
if(!isset ($aRes['errno'])){
return parent::getPayButtonParams($aData, $aRes);
* Verify the order from user back link. In success case 'accepted' status will be setup for order.
* @param array $aGet HTTP GET variables
* @param array $aPost HTTP POST variables
* @param array &$aRes Reserved array reference
* @param array $aCheckData Data that provided in driver configuration
* @param array $aOrderData Order data that contains such fields as id, total, order_date, status
* @return bool true if order is correct and false otherwise
public function payProcess(array $aGet, array $aPost, array &$aRes, array $aCheckData, array $aOrderData){
if(!empty($aParams['status'])){
$status = $aParams['status'];
// Do your return url checking here
* Verify the order by payment system background responce. In success case 'confirmed' status will be setup for order.
* @param array $aGet HTTP GET variables
* @param array $aPost HTTP POST variables
* @param array &$aRes Reserved array reference
* @param array $aCheckData Data that provided in driver configuration
* @param array $aOrderData Order data that contains such fields as id, total, order_date, status
* @return int -1 - ignore post, 0 - reject(cancel) order, 1 - confirm order
public function payCallback(array $aGet, array $aPost, array &$aRes, array $aCheckData, array $aOrderData){
// Do your parameters checking here
* Return real system order id from data that provided by payment system.
* @param array $aGet HTTP GET variables
* @param array $aPost HTTP POST variables
* @param array &$aRes Reserved array reference
* @param array $aAdditionalParams Reserved array
public function getProcessOrder(array $aGet, array $aPost, array &$aRes, array $aAdditionalParams){
$aData = (is_array($aGet) ? $aGet : array())+ (is_array($aPost) ? $aPost : array());
if(isset ($aAdditionalParams['aPossibleVarNames'])){
$aPossibleVarNames = $aAdditionalParams['aPossibleVarNames'];
$aPossibleVarNames = array('order_id', 'item_number', 'InvId', 'inv_id', 'shopping-cart.items.item-1.item-name', 'shopping-cart_items_item-1_item-name', 'transaction_id');
foreach($aPossibleVarNames as $varName){
if(isset ($aData[$varName])){
$orderId = intval($aData[$varName]);
* Do required operations after the payment is confirmed with payment system call.
* @param int $orderId Id of order in the system will be passed to this function
* Returns scope as HTML form hidden fields.
* @param array $aScope Varisbles
foreach($aScope as $name => $value){
$hiddens .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />' . "\n";
|