SecurePay_SecureFrame - Version 1.0.0

Version Notes

Initial Release

Download this release

Release Info

Developer securepay
Extension SecurePay_SecureFrame
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/SecurePay/SecureFrame/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class SecurePay_SecureFrame_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/local/SecurePay/SecureFrame/Model/Cardtype.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SecurePay_SecureFrame_Model_Cardtype
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ $options = array(
7
+ array('value'=>'VISA', 'label'=>'Visa'),
8
+ array('value'=>'AMEX', 'label'=>'American Express'),
9
+ array('value'=>'MASTERCARD', 'label'=>'MasterCard'),
10
+ array('value'=>'DINERS', 'label'=>'Diners'),
11
+ array('value'=>'JCB', 'label'=>'JCB')
12
+ );
13
+ return $options;
14
+ }
15
+ }
16
+ ?>
app/code/local/SecurePay/SecureFrame/Model/Currencytype.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SecurePay_SecureFrame_Model_Currencytype
3
+ {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ $options = array(
8
+ "A" => "AUD",
9
+ "M" => "Multicurrency"
10
+ );
11
+ return $options;
12
+ }
13
+ }
14
+ ?>
app/code/local/SecurePay/SecureFrame/Model/Standard.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SecurePay_SecureFrame_Model_Standard extends Mage_Payment_Model_Method_Abstract {
3
+ protected $_code = 'secureframe';
4
+
5
+ protected $_canAuthorize = true;
6
+ protected $_canCapture = true;
7
+ protected $_canCapturePartial = false;
8
+ protected $_canRefund = false;
9
+ protected $_canRefundInvoicePartial = false;
10
+ protected $_canVoid = false;
11
+ protected $_canUseInternal = true;
12
+ protected $_canUseCheckout = true;
13
+ protected $_canUseForMultishipping = false;
14
+ protected $_canSaveCc = false;
15
+ protected $_isInitializeNeeded = true;
16
+
17
+ public function getOrderPlaceRedirectUrl() {
18
+ return Mage::getUrl('secureframe/payment/redirect', array('_secure' => true));
19
+ }
20
+
21
+ public function capture(Varien_Object $payment, $amount)
22
+ {
23
+ }
24
+
25
+ public function authorize(Varien_Object $payment, $amount)
26
+ {
27
+ }
28
+
29
+ /**
30
+ * Instantiate state and set it to state object
31
+ * @param string $paymentAction
32
+ * @param Varien_Object
33
+ */
34
+ public function initialize($paymentAction, $stateObject)
35
+ {
36
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
37
+ $stateObject->setState($state);
38
+ $stateObject->setStatus('pending_payment');
39
+ $stateObject->setIsNotified(false);
40
+ }
41
+ }
42
+ ?>
app/code/local/SecurePay/SecureFrame/Model/Txntype.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SecurePay_SecureFrame_Model_Txntype
3
+ {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ $options = array(
8
+ "0" => "Payment",
9
+ "2" => "Payment with FraudGuard",
10
+ "4" => "Payment with 3D Secure",
11
+ "6" => "Payment with FraudGuard and 3D Secure"
12
+ );
13
+ return $options;
14
+ }
15
+ }
16
+ ?>
app/code/local/SecurePay/SecureFrame/controllers/PaymentController.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SecurePay_SecureFrame_PaymentController extends Mage_Core_Controller_Front_Action {
4
+ //Build secureframe request and display secureframe to customer.
5
+ public function redirectAction() {
6
+ $model = Mage::getSingleton('secureframe/standard');
7
+ if($model->getConfigData('test_mode') == true){
8
+ $actionUrl = "https://payment.securepay.com.au/test/v2/invoice";
9
+ }else{
10
+ $actionUrl = "https://payment.securepay.com.au/live/v2/invoice";
11
+ }
12
+ $sfRequest = $this->buildSecureFrameRequest();
13
+
14
+ $this->loadLayout();
15
+ $this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
16
+ $block = $this->getLayout()->createBlock('Mage_Core_Block_Template','secureframe',array('template' => 'securepay/secureframe/redirect.phtml'));
17
+ $block->setSfRequest($sfRequest);
18
+ $block->setActionUrl($actionUrl);
19
+ $this->getLayout()->getBlock('content')->append($block);
20
+ $this->renderLayout();
21
+ }
22
+
23
+ // Recieve result url request or callback request.
24
+ public function responseAction() {
25
+ if($this->getRequest()->isPost()) {
26
+ $orderId = $_POST["refid"];
27
+ $amount = $_POST["amount"];
28
+ $amount = (strrpos($amount, ".") === false) ? $amount : ($amount*100); // gotcha: when performing a 3D txn, if declined, the amount seems to come back decimal formatted; this will undoubtedly break fingerprint matching!
29
+
30
+ $txnpw = Mage::getSingleton('secureframe/standard')->getConfigData('transaction_password');
31
+
32
+ $localfingerprint = sha1($_POST["merchant"] . '|' . $txnpw . '|' . $orderId . '|' . $amount . '|' . $_POST["timestamp"] . '|' . $_POST["summarycode"]);
33
+ if($localfingerprint === $_POST["fingerprint"]) {
34
+ $validated = true;
35
+ if($_POST["summarycode"] == "1") {
36
+ $approved = true;
37
+ }
38
+ }
39
+
40
+ if($validated) {
41
+ $order = Mage::getModel('sales/order');
42
+ $order->loadByIncrementId($orderId);
43
+ $payment = $order->getPayment();
44
+ if($_POST['afrescode']){
45
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'SecurePay Fraudguard Result - ' . $_POST['afrestext'] . ' - ' . $_POST['afrescode']);
46
+ }
47
+ if($approved){
48
+ // Payment was successful, so update the order's state, send order email and move to the success page
49
+ if(!$payment->getLastTransId() == $orderId . '_' . $_POST["txnid"]){
50
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.', true);
51
+ $expiry = explode("/", $_POST["expirydate"]);
52
+ $payment->setTransactionId($orderId . '_' . $_POST["txnid"])
53
+ ->setPreparedMessage('SecurePay SecureFrame')
54
+ ->setIsTransactionClosed(0)
55
+ ->registerCaptureNotification($_POST["amount"] / 100);
56
+ $order->sendNewOrderEmail();
57
+ $order->setEmailSent(true);
58
+ $order->save();
59
+ }
60
+
61
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true));
62
+ }else{
63
+ //Dont cancel order until they come back to magento, this lets them attempt payment again from within secureframe.
64
+ if($_POST["callback"] == false){
65
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Payment was declined. Reason: ' . $_POST["restext"] . '(' . $_POST["rescode"] . ')')->save();
66
+ }
67
+ Mage::getSingleton('checkout/session')->setErrorMessage("Your transaction was declined.");
68
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure'=>true));
69
+ }
70
+ }
71
+ else {
72
+ // There is a problem in the response we got
73
+ Mage::getSingleton('checkout/session')->setErrorMessage("Transaction result could not be read.");
74
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure'=>true));
75
+ }
76
+ }
77
+ else
78
+ Mage_Core_Controller_Varien_Action::_redirect('');
79
+ }
80
+
81
+ // The cancel action is triggered when an order is to be cancelled
82
+ public function cancelAction() {
83
+ if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
84
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
85
+ if($order->getId()) {
86
+ // Flag the order as 'cancelled' and save it
87
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Customer canceled during payment.')->save();
88
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/cart');
89
+ }
90
+ }
91
+ }
92
+
93
+ public function buildSecureFrameRequest(){
94
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
95
+ $orderId = $order->getRealOrderId();
96
+ $model = Mage::getSingleton('secureframe/standard');
97
+
98
+ $merchant_id = $model->getConfigData('merchant_id');
99
+ $amount = $order->getTotalDue() * 100;
100
+ $txn_type = $model->getConfigData('transaction_type');
101
+ $txnpassword = $model->getConfigData('transaction_password');
102
+ $time = gmdate("YmdHis");
103
+ $fingerprint = sha1($merchant_id . '|' . $txnpassword . '|' . $txn_type . '|' . $orderId . '|' . $amount . '|' . $time);
104
+ $card_types = str_replace(',', '|', $model->getConfigData('accepted_card_types'));
105
+ $currency_accepted = $model->getConfigData('currency_accepted');
106
+ $shipping = $order->getShippingDescription();
107
+ $billing_meta = "none";
108
+ $delivery_meta = "none";
109
+
110
+ $sfRequest = array(
111
+ "merchant_id" => $merchant_id,
112
+ "fp_timestamp" => $time,
113
+ "fingerprint" => $fingerprint,
114
+ "bill_name" => "transact",
115
+ "txn_type" => $txn_type,
116
+ "primary_ref" => $orderId,
117
+ "amount" => $amount,
118
+ "currency" => ($currency_accepted === 'M') ? $order->getBaseCurrency()->getCurrencyCode() : 'AUD',
119
+ "template" => $model->getConfigData('template'),
120
+ "confirmation" => "no",
121
+ "return_url" => Mage::getBaseUrl() . "secureframe/payment/response?",
122
+ "callback_url" => Mage::getBaseUrl() . "secureframe/payment/response?callback=true",
123
+ "return_url_target" => "parent",
124
+ "return_url_text" => "Continue",
125
+ "cancel_url" => Mage::getBaseUrl() . "secureframe/payment/cancel",
126
+ "card_types" => $card_types,
127
+ "page_style_url" => $model->getConfigData('stylesheet_url'),
128
+ "meta" => $this->getMetaData($order)
129
+ );
130
+ return $sfRequest;
131
+ }
132
+
133
+ public function getMetaData($order) {
134
+ $shipping_meta = $order->getShippingDescription();
135
+ $billing_meta = "none";
136
+ $delivery_meta = "none";
137
+
138
+ $billing = $order->getBillingAddress();
139
+ if (!empty($billing)) {
140
+ $billing_meta = $billing->getFirstname() . " " . $billing->getLastname() . "," . $billing->getCompany() . "," .
141
+ $billing->getStreet(1) . " " . $billing->getCity() . "," .
142
+ $billing->getRegion() . " " . $billing->getPostcode() . " " . $billing->getCountry();
143
+ }
144
+
145
+ $shipping = $order->getShippingAddress();
146
+ if (!empty($shipping)) {
147
+
148
+
149
+ $delivery_meta = $shipping->getFirstname() . " " . $shipping->getLastname() . "," . $shipping->getCompany() . "," .
150
+ $shipping->getStreet(1) . " " . $shipping->getCity() . "," .
151
+ $shipping->getRegion() . " " . $shipping->getPostcode() . " " . $shipping->getCountry();
152
+ }
153
+
154
+ return "cart_post_method_eq_$shipping_meta|cart_billing_address_eq_$billing_meta|cart_delivery_address_eq_$delivery_meta";
155
+
156
+ }
157
+ }
app/code/local/SecurePay/SecureFrame/controllers/PaymentController.php~ ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SecurePay_SecureFrame_PaymentController extends Mage_Core_Controller_Front_Action {
4
+ //Build secureframe request and display secureframe to customer.
5
+ public function redirectAction() {
6
+ $model = Mage::getSingleton('secureframe/standard');
7
+ if($model->getConfigData('test_mode') == true){
8
+ $actionUrl = "https://payment.securepay.com.au/test/v2/invoice";
9
+ }else{
10
+ $actionUrl = "https://payment.securepay.com.au/live/v2/invoice";
11
+ }
12
+ $sfRequest = $this->buildSecureFrameRequest();
13
+
14
+ $this->loadLayout();
15
+ $this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
16
+ $block = $this->getLayout()->createBlock('Mage_Core_Block_Template','secureframe',array('template' => 'securepay/secureframe/redirect.phtml'));
17
+ $block->setSfRequest($sfRequest);
18
+ $block->setActionUrl($actionUrl);
19
+ $this->getLayout()->getBlock('content')->append($block);
20
+ $this->renderLayout();
21
+ }
22
+
23
+ // Recieve result url request or callback request.
24
+ public function responseAction() {
25
+ if($this->getRequest()->isPost()) {
26
+ $orderId = $_POST["refid"];
27
+ $amount = $_POST["amount"];
28
+ $amount = (strrpos($amount, ".") === false) ? $amount : ($amount*100); // gotcha: when performing a 3D txn, if declined, the amount seems to come back decimal formatted; this will undoubtedly break fingerprint matching!
29
+
30
+ $txnpw = Mage::getSingleton('secureframe/standard')->getConfigData('transaction_password');
31
+
32
+ $localfingerprint = sha1($_POST["merchant"] . '|' . $txnpw . '|' . $orderId . '|' . $amount . '|' . $_POST["timestamp"] . '|' . $_POST["summarycode"]);
33
+ if($localfingerprint === $_POST["fingerprint"]) {
34
+ $validated = true;
35
+ if($_POST["summarycode"] == "1") {
36
+ $approved = true;
37
+ }
38
+ }
39
+
40
+ if($validated) {
41
+ $order = Mage::getModel('sales/order');
42
+ $order->loadByIncrementId($orderId);
43
+ $payment = $order->getPayment();
44
+ if($_POST['afrescode']){
45
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'SecurePay Fraudguard Result - ' . $_POST['afrestext'] . ' - ' . $_POST['afrescode']);
46
+ }
47
+ if($approved){
48
+ // Payment was successful, so update the order's state, send order email and move to the success page
49
+ if(!$payment->getLastTransId() == $orderId . '_' . $_POST["txnid"]){
50
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.', true);
51
+ $expiry = explode("/", $_POST["expirydate"]);
52
+ $payment->setTransactionId($orderId . '_' . $_POST["txnid"])
53
+ ->setPreparedMessage('SecurePay SecureFrame')
54
+ ->setIsTransactionClosed(0)
55
+ ->registerCaptureNotification($_POST["amount"] / 100);
56
+ $order->sendNewOrderEmail();
57
+ $order->setEmailSent(true);
58
+ $order->save();
59
+ }
60
+
61
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true));
62
+ }else{
63
+ //Dont cancel order until they come back to magento, this lets them attempt payment again from within secureframe.
64
+ if($_POST["callback"] == false){
65
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Payment was declined. Reason: ' . $_POST["restext"] . '(' . $_POST["rescode"] . ')')->save();
66
+ }
67
+ Mage::getSingleton('checkout/session')->setErrorMessage("Your transaction was declined.");
68
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure'=>true));
69
+ }
70
+ }
71
+ else {
72
+ // There is a problem in the response we got
73
+ Mage::getSingleton('checkout/session')->setErrorMessage("Transaction result could not be read.");
74
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure'=>true));
75
+ }
76
+ }
77
+ else
78
+ Mage_Core_Controller_Varien_Action::_redirect('');
79
+ }
80
+
81
+ // The cancel action is triggered when an order is to be cancelled
82
+ public function cancelAction() {
83
+ if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
84
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
85
+ if($order->getId()) {
86
+ // Flag the order as 'cancelled' and save it
87
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Customer canceled during payment.')->save();
88
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/cart');
89
+ }
90
+ }
91
+ }
92
+
93
+ public function buildSecureFrameRequest(){
94
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
95
+ $orderId = $order->getRealOrderId();
96
+ $model = Mage::getSingleton('secureframe/standard');
97
+
98
+ $merchant_id = $model->getConfigData('merchant_id');
99
+ $amount = $order->getTotalDue() * 100;
100
+ $txn_type = $model->getConfigData('transaction_type');
101
+ $txnpassword = $model->getConfigData('transaction_password');
102
+ $time = gmdate("YmdHis");
103
+ $fingerprint = sha1($merchant_id . '|' . $txnpassword . '|' . $txn_type . '|' . $orderId . '|' . $amount . '|' . $time);
104
+
105
+ $shipping = $order->getShippingDescription();
106
+
107
+ $sfRequest = array(
108
+ "merchant_id" => $merchant_id,
109
+ "fp_timestamp" => $time,
110
+ "fingerprint" => $fingerprint,
111
+ "bill_name" => "transact",
112
+ "txn_type" => $txn_type,
113
+ "primary_ref" => $orderId,
114
+ "amount" => $amount,
115
+ "currency" => $order->getBaseCurrency()->getCurrencyCode(),
116
+ "template" => $model->getConfigData('template'),
117
+ "confirmation" => "no",
118
+ "return_url" => Mage::getBaseUrl() . "secureframe/payment/response",
119
+ "callback_url" => Mage::getBaseUrl() . "secureframe/payment/response?callback=true",
120
+ "return_url_target" => "parent",
121
+ "return_url_text" => "Continue",
122
+ "cancel_url" => Mage::getBaseUrl() . "secureframe/payment/cancel",
123
+ "page_style_url" => $model->getConfigData('stylesheet_url'),
124
+ "meta" => "cart_post_method_eq_$shipping"
125
+ );
126
+ return $sfRequest;
127
+ }
128
+ }
app/code/local/SecurePay/SecureFrame/etc/config.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SecurePay_SecureFrame>
5
+ <version>0.1.0</version>
6
+ </SecurePay_SecureFrame>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <secureframe>
11
+ <class>SecurePay_SecureFrame_Model</class>
12
+ </secureframe>
13
+ </models>
14
+ <helpers>
15
+ <secureframe>
16
+ <class>SecurePay_SecureFrame_Helper</class>
17
+ </secureframe>
18
+ </helpers>
19
+ <blocks>
20
+ <secureframe>
21
+ <class>SecurePay_SecureFrame_Block</class>
22
+ </secureframe>
23
+ </blocks>
24
+ </global>
25
+ <default>
26
+ <payment>
27
+ <secureframe>
28
+ <model>secureframe/standard</model>
29
+ <active>0</active>
30
+ <order_status>pending</order_status>
31
+ <title>Credit Card (powered by SecurePay)</title>
32
+ <payment_action>sale</payment_action>
33
+ <test_mode>1</test_mode>
34
+ <merchant_id></merchant_id>
35
+ <transaction_password></transaction_password>
36
+ <transaction_type></transaction_type>
37
+ <template>iframe</template>
38
+ <stylesheet_url></stylesheet_url>
39
+ <allowspecific>0</allowspecific>
40
+ <accepted_card_types>VISA,MASTERCARD</accepted_card_types>
41
+ <currency_accepted>AUD</currency_accepted>
42
+ <sort_order>1</sort_order>
43
+ </secureframe>
44
+ </payment>
45
+ </default>
46
+ <frontend>
47
+ <routers>
48
+ <secureframe>
49
+ <use>standard</use>
50
+ <args>
51
+ <module>SecurePay_SecureFrame</module>
52
+ <frontName>secureframe</frontName>
53
+ </args>
54
+ </secureframe>
55
+ </routers>
56
+ </frontend>
57
+ </config>
app/code/local/SecurePay/SecureFrame/etc/system.xml ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <secureframe translate="label" module="paygate">
7
+ <label>SecurePay - Two Step Checkout (SecureFrame)</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>100</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <comment><![CDATA[<a href="https://vault.securepay.com.au/ecommerce/sign-up/" target="_blank">Click here to sign up for a SecurePay account</a>]]></comment>
14
+ <fields>
15
+ <active translate="label">
16
+ <label>Enabled</label>
17
+ <comment>Change to 'Yes' to appear as a payment option.</comment>
18
+ <frontend_type>select</frontend_type>
19
+ <source_model>adminhtml/system_config_source_yesno</source_model>
20
+ <sort_order>10</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>0</show_in_store>
24
+ </active>
25
+ <title translate="label">
26
+ <label>Title</label>
27
+ <comment>The name of the payment method shown in the checkout.</comment>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>20</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <validate>validate-length maximum-length-120</validate>
34
+ </title>
35
+ <test_mode translate="label comment">
36
+ <label>Test Mode</label>
37
+ <comment>Change to 'No' to accept live payments.</comment>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>30</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>0</show_in_store>
44
+ </test_mode>
45
+ <order_status translate="label">
46
+ <label>New Order Status</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_order_status</source_model>
49
+ <sort_order>50</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>0</show_in_store>
53
+ </order_status>
54
+ <allowspecific translate="label">
55
+ <label>Payment Applicable From</label>
56
+ <frontend_type>select</frontend_type>
57
+ <sort_order>61</sort_order>
58
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>0</show_in_store>
62
+ </allowspecific>
63
+ <specificcountry translate="label">
64
+ <label>Countries Payment Applicable From</label>
65
+ <comment>Hold Ctrl to select multiple countries.</comment>
66
+ <frontend_type>multiselect</frontend_type>
67
+ <sort_order>62</sort_order>
68
+ <source_model>adminhtml/system_config_source_country</source_model>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>0</show_in_store>
72
+ <depends>
73
+ <allowspecific>1</allowspecific>
74
+ </depends>
75
+ </specificcountry>
76
+ <merchant_id translate="label comment">
77
+ <label>SecurePay Merchant ID</label>
78
+ <comment>Must be 7 characters, e.g. ABC0030</comment>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>71</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
+ <validate>validate-length minimum-length-7 maximum-length-7 required-entry</validate>
85
+ </merchant_id>
86
+ <transaction_password translate="label">
87
+ <label>SecurePay Transaction Password</label>
88
+ <comment>This is different from your merchant login password and may vary between live and test modes. Between 6 and 10 characters</comment>
89
+ <frontend_type>password</frontend_type>
90
+ <sort_order>72</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <validate>validate-length minimum-length-6 maximum-length-10 required-entry</validate>
95
+ </transaction_password>
96
+ <transaction_type translate="label">
97
+ <label>Transaction Type</label>
98
+ <comment><![CDATA[Ensure your SecurePay account has been enabled for <a href="http://www.securepay.com.au/products-services/fraudguard/" target="_blank">FraudGuard</a> or <a href="http://www.securepay.com.au/products-services/3d-secure/" target="_blank">3D Secure</a> before changing this option, for more information, please follow the links.]]></comment>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>secureframe/txntype</source_model>
101
+ <sort_order>51</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ </transaction_type>
106
+ <template translate="label">
107
+ <label>Base Template</label>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>73</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </template>
114
+ <stylesheet_url translate="label">
115
+ <label>Custom Stylesheet URL</label>
116
+ <frontend_type>text</frontend_type>
117
+ <sort_order>74</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ </stylesheet_url>
122
+ <accepted_card_types>
123
+ <label>Accepted Card Types</label>
124
+ <comment><![CDATA[Hold Ctrl to select multiple card types. VISA and MasterCard are accepted by default, please ensure your SecurePay account has been enabled for the other <a href="http://www.securepay.com.au/ecommerce/banks-and-cards-accepted/" target="_blank">card types</a> before changing these settings, for more information, please follow the link.]]></comment>
125
+ <frontend_type>multiselect</frontend_type>
126
+ <source_model>secureframe/cardtype</source_model>
127
+ <sort_order>75</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>0</show_in_store>
131
+ </accepted_card_types>
132
+ <currency_accepted>
133
+ <label>Currency Accepted</label>
134
+ <comment><![CDATA[<a href="http://www.securepay.com.au/products-services/multicurrency/" target="_blank">Click here for more information on multicurrency</a>]]></comment>
135
+ <frontend_type>select</frontend_type>
136
+ <source_model>secureframe/currencytype</source_model>
137
+ <sort_order>76</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>0</show_in_store>
141
+ </currency_accepted>
142
+ <sort_order translate="label">
143
+ <label>Sort Order</label>
144
+ <frontend_type>text</frontend_type>
145
+ <sort_order>100</sort_order>
146
+ <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
+ <show_in_store>1</show_in_store>
149
+ <frontend_class>validate-number</frontend_class>
150
+ <validate>validate-length maximum-length-3</validate>
151
+ </sort_order>
152
+ </fields>
153
+ </secureframe>
154
+ </groups>
155
+ </payment>
156
+ </sections>
157
+ </config>
app/design/frontend/base/default/template/securepay/secureframe/redirect.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form name="secureframeform" method="post" action="<?php echo $this->getActionUrl(); ?>" target="securepay_secureframe">
2
+ <?php
3
+ foreach ($this->getSfRequest() as $key => $value) {
4
+ echo "<input type='hidden' name='$key' value='$value' />\n";
5
+ }
6
+ ?>
7
+ </form>
8
+ <script type="text/javascript">
9
+ function hideLoadingMsg(){
10
+ document.getElementById("loadingmsg").style.display = "none";
11
+ document.getElementById("securepay_secureframe").style.display = "block";
12
+ }
13
+ </script>
14
+ <h1 id="loadingmsg">Loading payment form...</h1>
15
+ <iframe id="securepay_secureframe" name="securepay_secureframe" style="border:0;width:100%;height:500px" src="" onload="hideLoadingMsg()"></iframe>
16
+ <script type="text/javascript">
17
+ document.getElementById("securepay_secureframe").style.display = "none";
18
+ document.secureframeform.submit();
19
+ </script>
app/etc/modules/SecurePay_SecureFrame.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SecurePay_SecureFrame>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </SecurePay_SecureFrame>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>SecurePay_SecureFrame</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL) v3</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Adds the ability to accept payments via SecurePay's SecureFrame interface.</summary>
10
+ <description>This extension adds the ability to accept payments via SecurePay's SecureFrame interface.&#xD;
11
+ It has support for the 3d Secure and Fraudguard options.</description>
12
+ <notes>Initial Release</notes>
13
+ <authors><author><name>Magnus Jason</name><user>securepay</user><email>support@securepay.com.au</email></author></authors>
14
+ <date>2013-05-13</date>
15
+ <time>01:57:18</time>
16
+ <contents><target name="magelocal"><dir name="SecurePay"><dir name="SecureFrame"><dir name="Helper"><file name="Data.php" hash="7a0f3d2f0a9e0e385178cf3f5cdb0947"/></dir><dir name="Model"><file name="Cardtype.php" hash="e9048684e678ca556b540760913923e1"/><file name="Currencytype.php" hash="05058ead2dbc0414462ef54b52ebba43"/><file name="Standard.php" hash="e6fce183df4812f5707bfebd542b76ba"/><file name="Txntype.php" hash="9f67a99e0a91d64bf457a767116147fd"/></dir><dir name="controllers"><file name="PaymentController.php" hash="8838d3a6d6f852aec7ff68933b29b9d4"/><file name="PaymentController.php~" hash="96326a4e3724b67e470d73634a6195b0"/></dir><dir name="etc"><file name="config.xml" hash="766dff2942d0d40fb6843cf6a946566b"/><file name="system.xml" hash="dea19be171fc948e9bd8cea26dc7afd1"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="securepay"><dir name="secureframe"><file name="redirect.phtml" hash="2ee5569bffa9dcf31bf3209d3e1145c1"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SecurePay_SecureFrame.xml" hash="07839513039756e56a3e7dafd769f951"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
+ </package>