SecurePay_DirectOne - Version 1.0.0

Version Notes

Initial release

Download this release

Release Info

Developer Magento Core Team
Extension SecurePay_DirectOne
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/SecurePay/Directone/Block/Form.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class SecurePay_Directone_Block_Form extends Mage_Payment_Block_Form
22
+ {
23
+ protected function _construct()
24
+ {
25
+ $this->setTemplate('directone/form.phtml');
26
+ parent::_construct();
27
+ }
28
+ }
app/code/local/SecurePay/Directone/Block/Redirect.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class SecurePay_Directone_Block_Redirect extends Mage_Core_Block_Abstract
22
+ {
23
+ protected function _toHtml()
24
+ {
25
+ $model = Mage::getModel('directone/directone');
26
+
27
+ $form = new Varien_Data_Form();
28
+ $form->setAction($model->getUrl())
29
+ ->setId('directone_checkout')
30
+ ->setName('directone_checkout')
31
+ ->setMethod('POST')
32
+ ->setUseContainer(true);
33
+ foreach ($model->getCheckoutFormFields() as $field=>$value) {
34
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
35
+ }
36
+ $html = '<html><body>';
37
+ $html.= $this->__('You will be redirected to DirectOne in a few seconds.');
38
+ $html.= $form->toHtml();
39
+ $html.= '<script type="text/javascript">document.getElementById("directone_checkout").submit();</script>';
40
+ $html.= '</body></html>';
41
+
42
+ return $html;
43
+ }
44
+ }
app/code/local/SecurePay/Directone/Helper/Data.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Catalog data helper
23
+ */
24
+ class SecurePay_Directone_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+ }
app/code/local/SecurePay/Directone/Model/Directone.php ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * The heart of the Directone payment model
23
+ * Doesn't do much.
24
+ */
25
+ class SecurePay_Directone_Model_Directone extends Mage_Payment_Model_Method_Abstract
26
+ {
27
+ const REQUEST_AMOUNT_EDITABLE = 'N';
28
+ const RETURN_TEXT_DEFAULT = 'Click here to complete the order';
29
+
30
+ protected $_code = 'directone';
31
+ protected $_formBlockType = 'SecurePay_Directone_block_form';
32
+ protected $_allowCurrencyCode = array('AUD');
33
+
34
+ /**
35
+ * Assign data to info model instance
36
+ */
37
+ public function assignData($data)
38
+ {
39
+ $details = array();
40
+ if ($this->getUsername())
41
+ {
42
+ $details['username'] = $this->getUsername();
43
+ }
44
+ if (!empty($details))
45
+ {
46
+ $this->getInfoInstance()->setAdditionalData(serialize($details));
47
+ }
48
+ return $this;
49
+ }
50
+
51
+ public function getUsername()
52
+ {
53
+ return $this->getConfigData('username');
54
+ }
55
+
56
+ public function getUrl()
57
+ {
58
+ $test = ($this->getConfigData('test')==0?false:true);
59
+
60
+ $url = 'https://vault.safepay.com.au/cgi-bin/'.($test?'test':'make').'_payment.pl';
61
+
62
+ return $url;
63
+ }
64
+
65
+ public function getReturn()
66
+ {
67
+ $text = $this->getConfigData('return_text');
68
+
69
+ if($text==false)
70
+ {
71
+ $text = self::RETURN_TEXT_DEFAULT;
72
+ }
73
+
74
+ return $text;
75
+ }
76
+
77
+ /**
78
+ * Returns the active session instance (SecurePay_Directone_Model_Directone_Session)
79
+ */
80
+ public function getSession()
81
+ {
82
+ return Mage::getSingleton('directone/directone_session');
83
+ }
84
+
85
+ /**
86
+ * Returns the active checkout instance (Mage_Checkout_Model_Session)
87
+ */
88
+ public function getCheckout()
89
+ {
90
+ return Mage::getSingleton('checkout/session');
91
+ }
92
+
93
+ /**
94
+ * Get current quote
95
+ *
96
+ * @return Mage_Sales_Model_Quote
97
+ */
98
+ public function getQuote()
99
+ {
100
+ return $this->getCheckout()->getQuote();
101
+ }
102
+
103
+ /**
104
+ * getCheckoutFormFields
105
+ *
106
+ * Creates an array of fields for submission to DirectOne.
107
+ */
108
+ public function getCheckoutFormFields()
109
+ {
110
+ $saddress = $this->getQuote()->getShippingAddress();
111
+ $baddress = $this->getQuote()->getBillingAddress();
112
+ $currency_code = $this->getQuote()->getBaseCurrencyCode();
113
+ $cost = $saddress->getBaseSubtotal() - $saddress->getBaseDiscountAmount();
114
+ $shipping = $saddress->getBaseShippingAmount();
115
+ $simple = $this->getConfigData('simple');
116
+
117
+ $_shippingTax = $this->getQuote()->getShippingAddress()->getBaseTaxAmount();
118
+ $_billingTax = $this->getQuote()->getBillingAddress()->getBaseTaxAmount();
119
+ $tax = sprintf('%.2f', $_shippingTax + $_billingTax);
120
+ $cost = sprintf('%.2f', $cost + $tax);
121
+ $invoice = $this->getCheckout()->getLastOrderId();
122
+
123
+ $fields = array(
124
+ 'vendor_name' => $this->getUsername(),
125
+ 'Email' => $baddress->getEmail(),
126
+ 'Name' => $baddress->getFirstname() . ' ' . $baddress->getLastname(),
127
+ 'Phone' => $baddress->getTelephone(),
128
+ 'Country' => $baddress->getCountry(),
129
+ 'Address' => $baddress->getStreet(1) .' '. $baddress->getStreet(2),
130
+ 'City' => $baddress->getCity(),
131
+ 'State' => $baddress->getRegion(),
132
+ 'Postcode' => $baddress->getPostcode(),
133
+ 'Invoice' => $invoice,
134
+ 'information_fields'=> 'Name,Invoice,Phone,Email,Address,City,State,Postcode,Country',
135
+ 'suppress_field_names'=> 'form_key',
136
+ );
137
+
138
+ if($simple)
139
+ {
140
+ $fields['Invoice '.$this->getCheckout()->getLastRealOrderId()] = '1,'.($cost + $shipping);
141
+ }
142
+ else
143
+ {
144
+ $products = $this->getQuote()->getAllItems();
145
+
146
+ foreach($products as $item)
147
+ {
148
+ if ($item->getParentItem())
149
+ {
150
+ continue;
151
+ }
152
+
153
+ $value = str_replace("&","and",$item->getName());
154
+ $fields[trim($value)] = ''.$item->getQty().','.sprintf('%.2f', ($item->getBaseCalculationPrice() - $item->getBaseDiscountAmount()));
155
+ }
156
+ if($shipping)
157
+ {
158
+ $fields['Shipping'] = '1,'.$shipping;
159
+ }
160
+ }
161
+
162
+ $filtered_fields = array();
163
+
164
+ foreach ($fields as $k=>$v)
165
+ {
166
+ $value = str_replace("&","and",$v);
167
+ $filtered_fields[$k] = $value;
168
+ }
169
+
170
+ $filtered_fields['return_link_url'] = Mage::getUrl('directone/directone/success');
171
+ $filtered_fields['return_link_text'] = $this->getReturn();
172
+ $filtered_fields['reply_link_url'] = Mage::getUrl('directone/directone/notify',array('_query'=>'response_amount=&amp;Invoice='));
173
+
174
+ return $filtered_fields;
175
+ }
176
+
177
+ public function createFormBlock($name)
178
+ {
179
+ $block = $this->getLayout()->createBlock('directone/directone_form', $name)
180
+ ->setMethod('directone')
181
+ ->setPayment($this->getPayment())
182
+ ->setTemplate('directone/form.phtml');
183
+
184
+ return $block;
185
+ }
186
+
187
+ public function validate()
188
+ {
189
+ parent::validate();
190
+ $currency_code = $this->getQuote()->getBaseCurrencyCode();
191
+ if (!in_array($currency_code,$this->_allowCurrencyCode))
192
+ {
193
+ Mage::throwException(Mage::helper('directone')->__('Selected currency code ('.$currency_code.') is not compatible with Directone'));
194
+ }
195
+ return $this;
196
+ }
197
+
198
+ public function onOrderValidate(Mage_Sales_Model_Order_Payment $payment)
199
+ {
200
+ return $this;
201
+ }
202
+
203
+ public function onInvoiceCreate(Mage_Sales_Model_Invoice_Payment $payment)
204
+ {
205
+
206
+ }
207
+
208
+ public function canCapture()
209
+ {
210
+ return true;
211
+ }
212
+
213
+ public function getOrderPlaceRedirectUrl()
214
+ {
215
+ return Mage::getUrl('directone/directone/redirect');
216
+ }
217
+ }
app/code/local/SecurePay/Directone/Model/Directone/Request.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class SecurePay_Directone_Model_Directone_Request extends Varien_Object
22
+ {
23
+
24
+ }
app/code/local/SecurePay/Directone/Model/Directone/Result.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class SecurePay_Directone_Model_Directone_Result extends Varien_Object
22
+ {
23
+
24
+ }
app/code/local/SecurePay/Directone/Model/Directone/Session.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class SecurePay_Directone_Model_Directone_Session extends Mage_Core_Model_Session_Abstract
22
+ {
23
+ public function __construct()
24
+ {
25
+ $this->init('directone');
26
+ }
27
+ }
app/code/local/SecurePay/Directone/controllers/DirectoneController.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SecurePay Directone Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category SecurePay
16
+ * @package SecurePay_Directone
17
+ * @author Andrew Dubbeld
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Directone Checkout Controller
23
+ *
24
+ * Handles all of the urls under index.php/directone/directone/
25
+ */
26
+ class SecurePay_Directone_DirectoneController extends Mage_Core_Controller_Front_Action
27
+ {
28
+ protected function _expireAjax()
29
+ {
30
+ if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems())
31
+ {
32
+ $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
33
+ exit;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * When a customer chooses Directone on Checkout/Payment page
39
+ */
40
+ public function redirectAction()
41
+ {
42
+ $session = Mage::getSingleton('checkout/session');
43
+ $session->setDirectoneQuoteId($session->getQuoteId());
44
+ $this->getResponse()->setBody($this->getLayout()->createBlock('directone/redirect')->toHtml());
45
+ $session->unsQuoteId();
46
+ }
47
+
48
+ /**
49
+ * Notification serves as an additional level of payment confirmation. It only works on public-facing servers (DirectOne needs to issue a http request to your server).
50
+ *
51
+ * In order to trigger a notification, the order id and correct amount (in cents) must be delivered here via GET.
52
+ *
53
+ * Details of notifications against valid order_ids will be displayed on the order's summary page, in the Comments History, including the notifier's ip and [hostname].
54
+ *
55
+ * Merchants will need to check the hostname to make sure that the notification came from DirectOne. Notifications coming from elsewhere (e.g. the customer) are a good sign of attempted fraud. Generally, merchants should confirm payment before sending items.
56
+ */
57
+ public function notifyAction()
58
+ {
59
+ $orderData = array();
60
+
61
+ $g_order = (isset($_GET['Invoice'])?$_GET['Invoice']:0);
62
+ $g_amount = (isset($_GET['response_amount'])?$_GET['response_amount']:0);
63
+
64
+ preg_match('/(?<invoice>[0-9\-]+) (?<total>[0-9]+)/', $g_order.' '.$g_amount, $orderData);
65
+ $invoice = $orderData['invoice'];
66
+ $amount = ($orderData['total']/100);
67
+
68
+ $ip = $_SERVER['REMOTE_ADDR'];
69
+ $host = gethostbyaddr($ip);
70
+
71
+ if($invoice && $amount)
72
+ {
73
+ $order = Mage::getModel('sales/order');
74
+ $order->load($invoice);
75
+
76
+ if($order->grand_total)
77
+ {
78
+ $notified_state = Mage::getSingleton('directone/directone')->getConfigData('notify_status');
79
+ $original_state = $order->getState();
80
+
81
+ $message = 'DirectOne callback received from '.$ip.' ['.$host.']';
82
+
83
+ if($amount == $order->grand_total)
84
+ {
85
+ $message .= ' for the correct amount of $'.$amount.'.';
86
+ $state = $notified_state;
87
+ }
88
+ else
89
+ {
90
+ $message .= ' for an incorrect amount of $'.$amount.' rather than $'.$order->grand_total.'.';
91
+ $state = $original_state;
92
+ }
93
+
94
+ $order->addStatusToHistory($state,$message,false);
95
+ $order->save();
96
+ }
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Return page from Directone.
102
+ * Always shows success and triggers customer notification (email), but does not modify any of the payment records.
103
+ */
104
+ public function successAction()
105
+ {
106
+ $session = Mage::getSingleton('checkout/session');
107
+ $session->setQuoteId($session->getDirectoneQuoteId(true));
108
+
109
+ //Set the quote as inactive after returning from Directone
110
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
111
+
112
+ //Send a confirmation email to customer
113
+ $order = Mage::getModel('sales/order');
114
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
115
+ if($order->getId())
116
+ {
117
+ $order->sendNewOrderEmail();
118
+ }
119
+
120
+ Mage::getSingleton('checkout/session')->unsQuoteId();
121
+
122
+ $this->_redirect('checkout/onepage/success');
123
+ }
124
+ }
app/code/local/SecurePay/Directone/etc/config.xml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * SecurePay Directone Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category SecurePay
17
+ * @package SecurePay_Directone
18
+ * @author Andrew Dubbeld
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <SecurePay_Directone>
25
+ <version>1.0</version>
26
+ <depends>
27
+ <Mage_Payment />
28
+ </depends>
29
+ </SecurePay_Directone>
30
+ </modules>
31
+ <global>
32
+ <models>
33
+ <directone>
34
+ <class>SecurePay_Directone_Model</class>
35
+ </directone>
36
+ </models>
37
+ <helpers>
38
+ <directone>
39
+ <class>SecurePay_Directone_Helper</class>
40
+ </directone>
41
+ </helpers>
42
+ <blocks>
43
+ <directone>
44
+ <class>SecurePay_Directone_Block</class>
45
+ </directone>
46
+ </blocks>
47
+ <resources>
48
+ <directone_setup>
49
+ <setup>
50
+ <module>SecurePay_Directone</module>
51
+ </setup>
52
+ <connection>
53
+ <use>directory_setup</use>
54
+ </connection>
55
+ </directone_setup>
56
+ <directone_write>
57
+ <connection>
58
+ <use>local_write</use>
59
+ </connection>
60
+ </directone_write>
61
+ <directone_read>
62
+ <connection>
63
+ <use>local_read</use>
64
+ </connection>
65
+ </directone_read>
66
+ </resources>
67
+ </global>
68
+ <frontend>
69
+ <routers>
70
+ <directone>
71
+ <use>standard</use>
72
+ <args>
73
+ <module>SecurePay_Directone</module>
74
+ <frontName>directone</frontName>
75
+ </args>
76
+ </directone>
77
+ </routers>
78
+ </frontend>
79
+ <default>
80
+ <payment>
81
+ <directone>
82
+ <active>1</active>
83
+ <cctypes>VI,MC</cctypes>
84
+ <model>directone/directone</model>
85
+ <order_status>1</order_status>
86
+ <notify_status>2</notify_status>
87
+ <test>1</test>
88
+ <simple>1</simple>
89
+ <title>Credit Card</title>
90
+ <return_text>Click here to complete the payment</return_text>
91
+ <username>replace_me</username>
92
+ <allowspecific>0</allowspecific>
93
+ </directone>
94
+ </payment>
95
+ </default>
96
+ </config>
app/code/local/SecurePay/Directone/etc/system.xml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * SecurePay Directone Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category SecurePay
17
+ * @package SecurePay_Directone
18
+ * @author Andrew Dubbeld
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <sections>
24
+ <payment translate="label" module="payment">
25
+ <groups>
26
+ <directone translate="label">
27
+ <label>SecurePay Hosted Page (AU) / DirectOne</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>1</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>0</show_in_store>
33
+ <fields>
34
+ <active translate="label">
35
+ <label>Enabled</label>
36
+ <frontend_type>select</frontend_type>
37
+ <source_model>adminhtml/system_config_source_yesno</source_model>
38
+ <sort_order>1</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>0</show_in_store>
42
+ </active>
43
+ <order_status translate="label">
44
+ <label>New order status</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_order_status</source_model>
47
+ <sort_order>2</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </order_status>
52
+ <notify_status translate="label">
53
+ <label>Notified order status</label>
54
+ <frontend_type>select</frontend_type>
55
+ <source_model>adminhtml/system_config_source_order_status</source_model>
56
+ <sort_order>3</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>0</show_in_store>
60
+ </notify_status>
61
+ <sort_order translate="label">
62
+ <label>Sort order</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>100</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>0</show_in_store>
68
+ </sort_order>
69
+ <title translate="label">
70
+ <label>Title</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>1</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>0</show_in_store>
76
+ </title>
77
+ <username translate="label">
78
+ <label>Vendor Name</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>61</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </username>
85
+ <test translate="label">
86
+ <label>Test mode</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_yesno</source_model>
89
+ <sort_order>62</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </test>
94
+ <simple translate="label">
95
+ <label>Simplify DirectOne invoices?</label>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>adminhtml/system_config_source_yesno</source_model>
98
+ <sort_order>63</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ </simple>
103
+ <return_text translate="label">
104
+ <label>Return Link Text</label>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>64</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ </return_text>
111
+ <allowspecific translate="label">
112
+ <label>Payment from applicable countries</label>
113
+ <frontend_type>allowspecific</frontend_type>
114
+ <sort_order>80</sort_order>
115
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </allowspecific>
120
+ <specificcountry translate="label">
121
+ <label>Payment from Specific countries</label>
122
+ <frontend_type>multiselect</frontend_type>
123
+ <sort_order>81</sort_order>
124
+ <source_model>adminhtml/system_config_source_country</source_model>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ </specificcountry>
129
+ <min_order_total>
130
+ <label>Minimum Order Total</label>
131
+ <frontend_type>text</frontend_type>
132
+ <sort_order>98</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>0</show_in_store>
136
+ </min_order_total>
137
+ <max_order_total>
138
+ <label>Maximum Order Total</label>
139
+ <frontend_type>text</frontend_type>
140
+ <sort_order>99</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>0</show_in_store>
144
+ </max_order_total>
145
+ <model>
146
+ </model>
147
+ </fields>
148
+ </directone>
149
+ </groups>
150
+ </payment>
151
+ </sections>
152
+ </config>
app/design/frontend/default/default/template/directone/form.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontis Paymate Extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Fontis
16
+ * @package Fontis_Paymate
17
+ * @author Lloyd Hazlett
18
+ * @author Chris Norton
19
+ * @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ ?>
23
+ <fieldset class="form-list">
24
+ <?php $_code=$this->getMethodCode() ?>
25
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
26
+ <li>
27
+ <?php echo $this->__('You will be redirected to the DirectOne website when you place an order.') ?>
28
+ </li>
29
+ </ul>
30
+ </fieldset>
app/etc/modules/SecurePay_Directone.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SecurePay_Directone>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </SecurePay_Directone>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>SecurePay_DirectOne</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>DirectOne module for Magento</summary>
10
+ <description>Provides support for credit-card payments through the DirectOne hosted payment service.
11
+
12
+ All card details are collected on the DirectOne server, minimising your security requirements.</description>
13
+ <notes>Initial release</notes>
14
+ <authors><author><name>Andrew Dubbeld</name><user>auto-converted</user><email>support@securepay.com.au</email></author></authors>
15
+ <date>2009-12-23</date>
16
+ <time>04:21:16</time>
17
+ <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="directone"><file name="form.phtml" hash="a2e2fe6f33095392c4c6a48e1449d04c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SecurePay_Directone.xml" hash="58bdc2900b324d9df7da478d2faf3dbb"/></dir></target><target name="magelocal"><dir name="SecurePay"><dir name="Directone"><dir name="Block"><file name="Form.php" hash="9822da8ca2dce1a2afcadae432be04c8"/><file name="Redirect.php" hash="9ae2a452f79bd7303f8004892598927b"/></dir><dir name="controllers"><file name="DirectoneController.php" hash="fa035fad9b4527e6f7b57dd39e6ef056"/></dir><dir name="etc"><file name="config.xml" hash="ba250a625c0e707a86fea4ba04faeb94"/><file name="system.xml" hash="cd7dbcee0f87ed76ee76b1670c7261fc"/></dir><dir name="Helper"><file name="Data.php" hash="c382cb57818a80808d42b3e61bfe1c33"/></dir><dir name="Model"><dir name="Directone"><file name="Request.php" hash="9de15a5a5862402fb3e1c522f5d8c1bc"/><file name="Result.php" hash="51001ff42edf9cc0acec1b765e829f1a"/><file name="Session.php" hash="3686130c5ac1cf390058b00adc55cf0d"/></dir><file name="Directone.php" hash="cae028836cd7a2600adf8ac75dd3f52f"/></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies/>
20
+ </package>