array(
'label' => '',
'type' => 'custom',
'html' => '
',
),
'merchantid' => array(
'label' => 'Merchant ID',
'type' => 'text',
),
'testmode' => array(
'label' => 'Test Mode',
'type' => 'select',
'options' => array(
1 => 'Yes',
0 => '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'] == 1)
{
$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 log will be sent via email to the admin */
$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 to VikAppointments */
return $array_result;
}
public function afterValidation($res = 0)
{
$app = JFactory::getApplication();
if ($res == 1)
{
$app->enqueueMessage('Thank you! The payment was verified successfully.');
$app->redirect($this->order_info['return_url']);
}
else
{
$app->enqueueMessage('The payment was not verified, please try again.', 'error');
$app->redirect($this->order_info['error_url']);
}
exit;
}
}