-
Notifications
You must be signed in to change notification settings - Fork 2
/
os_creditcard.php
78 lines (69 loc) · 2.19 KB
/
os_creditcard.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* @version 2.12.0
* @package Membership Pro
* @subpackage Payment Plugins
* @author Tuan Pham Ngoc
* @copyright Copyright (C) 2012 - 2018 Ossolution Team
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
class os_creditcard extends MPFPayment
{
/**
* Constructor functions, init some parameter
*
* @param \Joomla\Registry\Registry $params
* @param array $config
*/
public function __construct($params, $config = array('type' => 1))
{
parent::__construct($params, $config);
/*if ($params->get('mode'))
{
$this->url = 'the_payment_gateway_url_in_live_mode';
}
else
{
$this->url = 'the_payment_gateway_url_in_test_mode';
}*/
}
/**
* Process Payment
*
* @param OSMembershipTableSubscriber $row
* @param array $data
*/
public function processPayment($row, $data)
{
$app = JFactory::getApplication();
$Itemid = $app->input->getInt('Itemid');
/**
* Write code to pass the data to the payment gateway for payment processing. Below are some of the import data which you can
* access and pass to the payment gateway:
* $data['amount'] : Payment amount
* $data['item_name'] : The payment description
* $data['x_card_num']: Credit card number
* $data['exp_month']: Credit card expiration month
* $data['exp_year']: Credit card expiration year
* $['card_holder_name']: Credit card holder name
* $['card_type']: Credit card type, for example Visa
*/
$success = true;
if ($success)
{
$transactionId = 'the_id_of_the_transaction';
$this->onPaymentSuccess($row, $transactionId);
// Redirect to the registration complete page
$app->redirect(JRoute::_('index.php?option=com_eventbooking&view=complete&Itemid=' . $Itemid, false));
}
else
{
// Store the reason of the error so that it is being displayed on payment failure page
$errorReason = 'the_returned_error_message';
JFactory::getSession()->set('omnipay_payment_error_reason', $errorReason);
// Redirect to payment failure page
$app->redirect(JRoute::_('index.php?option=com_eventbooking&view=failure&Itemid=' . $Itemid, false));
}
}
}