array(
'label' => '',
'type' => 'custom',
'html' => '
'
),
'merchantid' => array(
'label' => 'Merchant ID',
'type' => 'text'
),
'testmode' => array(
'label' => 'Test Mode',
'type' => 'select',
'options' => array('Yes', 'No'),
),
);
}
public function __construct ($order, $params=array()) {
$this->order_info = $order;
$this->params = $params;
}
public function showPayment () {
$merchant_id = $this->params['merchantid'];
$action_url = "https://yourbankgateway.com/";
if( $this->params['testmode'] == 'Yes' ) {
$action_url = "https://test.yourbankgateway.com/";
}
$form='
';
echo $form;
}
public function validatePayment () {
$array_result = array();
$array_result['verified'] = 0;
$array_result['tot_paid'] = ''; /** This value will be stored in the DB */
/** In case of error the logs will be sent via email to the admin */
$array_result['log'] = '';
$status = $_POST['status'];
/** Process your gateway response here */
if($status == 'success') {
$array_result['verified'] = 1;
/** Set a value for $array_result['tot_paid'] */
$array_result['tot_paid'] = $_POST['amount'];
} else {
$array_result['log'] = "Transaction Error!\n".$_POST['error_msg'];
}
/** Return the array result to VikBooking */
return $array_result;
}
public function afterValidation ($esit = 0) {
$mainframe = JFactory::getApplication();
//URL to order details page
$redirect_url = 'index.php?option=com_vikbooking&task=vieworder&sid='.$this->order_info['sid'].'&ts='.$this->order_info['ts'];
if($esit < 1) {
JError::raiseWarning('', 'The payment was not verified, please try again.');
$mainframe->redirect($redirect_url);
} else {
$mainframe->enqueueMessage('Thank you! The payment was verified successfully.');
$mainframe->redirect($redirect_url);
}
exit;
//No page rendering
}
}
?>