Version Notes
In the config options, select Authorize for preauth/complete mode, or Authorize and Capture for standard payment mode.
If there is a problem with the initial transaction, the bank response code and text will be displayed to the user.
/magento/var/log needs to exist and be writable in order to use Debug mode.
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | SecurePay_SecureXML |
| Version | 1.0.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.3 to 1.0.4
- app/code/local/SecurePay/Directone/Block/Form.php +28 -0
- app/code/local/SecurePay/Directone/Block/Redirect.php +44 -0
- app/code/local/SecurePay/Directone/Helper/Data.php +27 -0
- app/code/local/SecurePay/Directone/Model/Directone.php +212 -0
- app/code/local/SecurePay/Directone/Model/Directone/Request.php +24 -0
- app/code/local/SecurePay/Directone/Model/Directone/Result.php +24 -0
- app/code/local/SecurePay/Directone/Model/Directone/Session.php +27 -0
- app/code/local/SecurePay/Directone/controllers/DirectoneController.php +124 -0
- app/code/local/SecurePay/Directone/etc/config.xml +96 -0
- app/code/local/SecurePay/Directone/etc/system.xml +152 -0
- app/code/local/SecurePay/Sxml/Model/Sxml.php +6 -33
- app/code/local/SecurePay/Sxml/etc/config.xml +5 -17
- app/code/local/SecurePay/Sxml/etc/system.xml +3 -12
- app/code/local/SecurePay/securepay_xml_api.php +1 -1
- app/design/frontend/default/default/template/sxml/form/cc.phtml +9 -2
- package.xml +7 -5
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,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
$value = str_replace('"','',str_replace("&","and",$item->getName()));
|
| 149 |
+
$fields[trim($value)] = ''.$item->getQty().','.($item->getBaseCalculationPrice() - $item->getBaseDiscountAmount());
|
| 150 |
+
}
|
| 151 |
+
if($shipping)
|
| 152 |
+
{
|
| 153 |
+
$fields['Shipping'] = '1,'.$shipping;
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
$filtered_fields = array();
|
| 158 |
+
|
| 159 |
+
foreach ($fields as $k=>$v)
|
| 160 |
+
{
|
| 161 |
+
$value = str_replace("&","and",$v);
|
| 162 |
+
$filtered_fields[$k] = $value;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
$filtered_fields['return_link_url'] = Mage::getUrl('directone/directone/success');
|
| 166 |
+
$filtered_fields['return_link_text'] = $this->getReturn();
|
| 167 |
+
$filtered_fields['reply_link_url'] = Mage::getUrl('directone/directone/notify',array('_query'=>'response_amount=&Invoice='));
|
| 168 |
+
|
| 169 |
+
return $filtered_fields;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
public function createFormBlock($name)
|
| 173 |
+
{
|
| 174 |
+
$block = $this->getLayout()->createBlock('directone/directone_form', $name)
|
| 175 |
+
->setMethod('directone')
|
| 176 |
+
->setPayment($this->getPayment())
|
| 177 |
+
->setTemplate('directone/form.phtml');
|
| 178 |
+
|
| 179 |
+
return $block;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
public function validate()
|
| 183 |
+
{
|
| 184 |
+
parent::validate();
|
| 185 |
+
$currency_code = $this->getQuote()->getBaseCurrencyCode();
|
| 186 |
+
if (!in_array($currency_code,$this->_allowCurrencyCode))
|
| 187 |
+
{
|
| 188 |
+
Mage::throwException(Mage::helper('directone')->__('Selected currency code ('.$currency_code.') is not compatible with Directone'));
|
| 189 |
+
}
|
| 190 |
+
return $this;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
public function onOrderValidate(Mage_Sales_Model_Order_Payment $payment)
|
| 194 |
+
{
|
| 195 |
+
return $this;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
public function onInvoiceCreate(Mage_Sales_Model_Invoice_Payment $payment)
|
| 199 |
+
{
|
| 200 |
+
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
public function canCapture()
|
| 204 |
+
{
|
| 205 |
+
return true;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
public function getOrderPlaceRedirectUrl()
|
| 209 |
+
{
|
| 210 |
+
return Mage::getUrl('directone/directone/redirect');
|
| 211 |
+
}
|
| 212 |
+
}
|
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>DirectOne</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>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/code/local/SecurePay/Sxml/Model/Sxml.php
CHANGED
|
@@ -168,19 +168,12 @@ class SecurePay_Sxml_Model_Sxml extends Mage_Payment_Model_Method_Cc
|
|
| 168 |
}
|
| 169 |
}
|
| 170 |
|
| 171 |
-
if($
|
| 172 |
-
{
|
| 173 |
-
if ($approved==false)
|
| 174 |
-
{
|
| 175 |
-
$this->setError(array('message' => $txnResultCodeText,));
|
| 176 |
-
Mage::throwException("" . $txnResultCodeText);
|
| 177 |
-
}
|
| 178 |
-
}
|
| 179 |
-
else
|
| 180 |
{
|
| 181 |
$this->setError(array('message' => $txnResultCodeText,));
|
| 182 |
Mage::throwException("" . $txnResultCodeText);
|
| 183 |
}
|
|
|
|
| 184 |
|
| 185 |
return $this;
|
| 186 |
}
|
|
@@ -271,14 +264,7 @@ class SecurePay_Sxml_Model_Sxml extends Mage_Payment_Model_Method_Cc
|
|
| 271 |
}
|
| 272 |
}
|
| 273 |
|
| 274 |
-
if($
|
| 275 |
-
{
|
| 276 |
-
if ($approved==false)
|
| 277 |
-
{
|
| 278 |
-
Mage::throwException("" . $txnResultCodeText);
|
| 279 |
-
}
|
| 280 |
-
}
|
| 281 |
-
else
|
| 282 |
{
|
| 283 |
Mage::throwException("" . $txnResultCodeText);
|
| 284 |
}
|
|
@@ -345,14 +331,7 @@ class SecurePay_Sxml_Model_Sxml extends Mage_Payment_Model_Method_Cc
|
|
| 345 |
}
|
| 346 |
}
|
| 347 |
|
| 348 |
-
if($
|
| 349 |
-
{
|
| 350 |
-
if ($approved==false)
|
| 351 |
-
{
|
| 352 |
-
Mage::throwException("" . $txnResultCodeText);
|
| 353 |
-
}
|
| 354 |
-
}
|
| 355 |
-
else
|
| 356 |
{
|
| 357 |
Mage::throwException("" . $txnResultCodeText);
|
| 358 |
}
|
|
@@ -411,17 +390,11 @@ class SecurePay_Sxml_Model_Sxml extends Mage_Payment_Model_Method_Cc
|
|
| 411 |
}
|
| 412 |
}
|
| 413 |
|
| 414 |
-
if($
|
| 415 |
-
{
|
| 416 |
-
if ($approved==false)
|
| 417 |
-
{
|
| 418 |
-
Mage::throwException("" . $txnResultCodeText);
|
| 419 |
-
}
|
| 420 |
-
}
|
| 421 |
-
else
|
| 422 |
{
|
| 423 |
Mage::throwException("" . $txnResultCodeText);
|
| 424 |
}
|
|
|
|
| 425 |
return $this;
|
| 426 |
}
|
| 427 |
}
|
| 168 |
}
|
| 169 |
}
|
| 170 |
|
| 171 |
+
if ($approved==false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
{
|
| 173 |
$this->setError(array('message' => $txnResultCodeText,));
|
| 174 |
Mage::throwException("" . $txnResultCodeText);
|
| 175 |
}
|
| 176 |
+
|
| 177 |
|
| 178 |
return $this;
|
| 179 |
}
|
| 264 |
}
|
| 265 |
}
|
| 266 |
|
| 267 |
+
if ($approved==false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
{
|
| 269 |
Mage::throwException("" . $txnResultCodeText);
|
| 270 |
}
|
| 331 |
}
|
| 332 |
}
|
| 333 |
|
| 334 |
+
if ($approved==false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
{
|
| 336 |
Mage::throwException("" . $txnResultCodeText);
|
| 337 |
}
|
| 390 |
}
|
| 391 |
}
|
| 392 |
|
| 393 |
+
if ($approved==false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
{
|
| 395 |
Mage::throwException("" . $txnResultCodeText);
|
| 396 |
}
|
| 397 |
+
|
| 398 |
return $this;
|
| 399 |
}
|
| 400 |
}
|
app/code/local/SecurePay/Sxml/etc/config.xml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<SecurePay_Sxml>
|
| 6 |
-
<version>
|
| 7 |
<depends>
|
| 8 |
<Mage_payment />
|
| 9 |
</depends>
|
|
@@ -45,31 +45,19 @@
|
|
| 45 |
</connection>
|
| 46 |
</sxml_read>
|
| 47 |
</resources>
|
| 48 |
-
<payment>
|
| 49 |
-
<cc>
|
| 50 |
-
<types>
|
| 51 |
-
<DN>
|
| 52 |
-
<code>DN</code>
|
| 53 |
-
<name>Diners</name>
|
| 54 |
-
<order>100</order>
|
| 55 |
-
</DN>
|
| 56 |
-
</types>
|
| 57 |
-
</cc>
|
| 58 |
-
</payment>
|
| 59 |
</global>
|
| 60 |
<default>
|
| 61 |
<payment>
|
| 62 |
<Sxml>
|
| 63 |
-
<active>
|
| 64 |
<model>Sxml/Sxml</model>
|
| 65 |
<username>Change me</username>
|
| 66 |
<password>Change me</password>
|
| 67 |
-
<title>Credit Card
|
| 68 |
<allowspecific>0</allowspecific>
|
| 69 |
-
<debug>
|
| 70 |
<test>1</test>
|
| 71 |
-
<usecvv>
|
| 72 |
-
<cctypes>OT</cctypes>
|
| 73 |
<payment_action>authorize</payment_action>
|
| 74 |
</Sxml>
|
| 75 |
</payment>
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<SecurePay_Sxml>
|
| 6 |
+
<version>1.0.4</version>
|
| 7 |
<depends>
|
| 8 |
<Mage_payment />
|
| 9 |
</depends>
|
| 45 |
</connection>
|
| 46 |
</sxml_read>
|
| 47 |
</resources>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
</global>
|
| 49 |
<default>
|
| 50 |
<payment>
|
| 51 |
<Sxml>
|
| 52 |
+
<active>0</active>
|
| 53 |
<model>Sxml/Sxml</model>
|
| 54 |
<username>Change me</username>
|
| 55 |
<password>Change me</password>
|
| 56 |
+
<title>Credit Card</title>
|
| 57 |
<allowspecific>0</allowspecific>
|
| 58 |
+
<debug>0</debug>
|
| 59 |
<test>1</test>
|
| 60 |
+
<usecvv>1</usecvv>
|
|
|
|
| 61 |
<payment_action>authorize</payment_action>
|
| 62 |
</Sxml>
|
| 63 |
</payment>
|
app/code/local/SecurePay/Sxml/etc/system.xml
CHANGED
|
@@ -5,12 +5,12 @@
|
|
| 5 |
<payment translate="label">
|
| 6 |
<groups>
|
| 7 |
<Sxml translate="label">
|
| 8 |
-
<label>
|
| 9 |
<frontend_type>text</frontend_type>
|
| 10 |
<sort_order>1</sort_order>
|
| 11 |
<show_in_default>1</show_in_default>
|
| 12 |
<show_in_website>1</show_in_website>
|
| 13 |
-
<show_in_store>
|
| 14 |
<fields>
|
| 15 |
<active translate="label">
|
| 16 |
<label>Enabled</label>
|
|
@@ -83,7 +83,7 @@
|
|
| 83 |
<payment_action translate="label">
|
| 84 |
<label>Action</label>
|
| 85 |
<frontend_type>select</frontend_type>
|
| 86 |
-
<source_model>Sxml/
|
| 87 |
<sort_order>22</sort_order>
|
| 88 |
<show_in_default>1</show_in_default>
|
| 89 |
<show_in_website>1</show_in_website>
|
|
@@ -116,15 +116,6 @@
|
|
| 116 |
<show_in_website>1</show_in_website>
|
| 117 |
<show_in_store>1</show_in_store>
|
| 118 |
</specificcountry>
|
| 119 |
-
<cctypes translate="label">
|
| 120 |
-
<label>Credit Card Types</label>
|
| 121 |
-
<frontend_type>multiselect</frontend_type>
|
| 122 |
-
<source_model>Sxml/source_cctype</source_model>
|
| 123 |
-
<sort_order>15</sort_order>
|
| 124 |
-
<show_in_default>0</show_in_default>
|
| 125 |
-
<show_in_website>0</show_in_website>
|
| 126 |
-
<show_in_store>0</show_in_store>
|
| 127 |
-
</cctypes>
|
| 128 |
</fields>
|
| 129 |
</Sxml>
|
| 130 |
</groups>
|
| 5 |
<payment translate="label">
|
| 6 |
<groups>
|
| 7 |
<Sxml translate="label">
|
| 8 |
+
<label>SecurePay XML API (AU)</label>
|
| 9 |
<frontend_type>text</frontend_type>
|
| 10 |
<sort_order>1</sort_order>
|
| 11 |
<show_in_default>1</show_in_default>
|
| 12 |
<show_in_website>1</show_in_website>
|
| 13 |
+
<show_in_store>1</show_in_store>
|
| 14 |
<fields>
|
| 15 |
<active translate="label">
|
| 16 |
<label>Enabled</label>
|
| 83 |
<payment_action translate="label">
|
| 84 |
<label>Action</label>
|
| 85 |
<frontend_type>select</frontend_type>
|
| 86 |
+
<source_model>Sxml/Sxml_paymentAction</source_model>
|
| 87 |
<sort_order>22</sort_order>
|
| 88 |
<show_in_default>1</show_in_default>
|
| 89 |
<show_in_website>1</show_in_website>
|
| 116 |
<show_in_website>1</show_in_website>
|
| 117 |
<show_in_store>1</show_in_store>
|
| 118 |
</specificcountry>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
</fields>
|
| 120 |
</Sxml>
|
| 121 |
</groups>
|
app/code/local/SecurePay/securepay_xml_api.php
CHANGED
|
@@ -1086,7 +1086,7 @@ class securepay_xml_transaction
|
|
| 1086 |
if ((strcasecmp( $responseArray["approved"], "Yes" ) == 0) &&
|
| 1087 |
(strcmp( $responseArray["responseCode"], "00" ) === 0 ||
|
| 1088 |
strcmp( $responseArray["responseCode"], "08" ) === 0 ||
|
| 1089 |
-
strcmp( $responseArray["responseCode"], "77" ) === 0 )
|
| 1090 |
{
|
| 1091 |
return true;
|
| 1092 |
}
|
| 1086 |
if ((strcasecmp( $responseArray["approved"], "Yes" ) == 0) &&
|
| 1087 |
(strcmp( $responseArray["responseCode"], "00" ) === 0 ||
|
| 1088 |
strcmp( $responseArray["responseCode"], "08" ) === 0 ||
|
| 1089 |
+
strcmp( $responseArray["responseCode"], "77" ) === 0 ))
|
| 1090 |
{
|
| 1091 |
return true;
|
| 1092 |
}
|
app/design/frontend/default/default/template/sxml/form/cc.phtml
CHANGED
|
@@ -33,7 +33,14 @@
|
|
| 33 |
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="required-entry input-text" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
|
| 34 |
</div>
|
| 35 |
</li-->
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
<li>
|
| 38 |
<div class="input-box">
|
| 39 |
<label for="<?php echo $_code ?>_cc_number"><?php echo $this->__('Credit Card Number') ?> <span class="required">*</span></label><br/>
|
|
@@ -72,4 +79,4 @@
|
|
| 72 |
</li>
|
| 73 |
<?php endif; ?>
|
| 74 |
</ul>
|
| 75 |
-
</fieldset>
|
| 33 |
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="required-entry input-text" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
|
| 34 |
</div>
|
| 35 |
</li-->
|
| 36 |
+
<!--<li>
|
| 37 |
+
<div class="input-box">
|
| 38 |
+
<label for="<?php echo $_code ?>_cc_type"><?php echo $this->__('Credit Card Type') ?> <span class="required">*</span></label><br />
|
| 39 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-sxml-cc-type-select">
|
| 40 |
+
<option value="OT">Other</option>
|
| 41 |
+
</select>
|
| 42 |
+
</div>
|
| 43 |
+
</li>-->
|
| 44 |
<li>
|
| 45 |
<div class="input-box">
|
| 46 |
<label for="<?php echo $_code ?>_cc_number"><?php echo $this->__('Credit Card Number') ?> <span class="required">*</span></label><br/>
|
| 79 |
</li>
|
| 80 |
<?php endif; ?>
|
| 81 |
</ul>
|
| 82 |
+
</fieldset>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>SecurePay_SecureXML</name>
|
| 4 |
-
<version>1.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -17,11 +17,13 @@
|
|
| 17 |
Fraudguard, Direct Entry (Credit/Debit) and Periodic/Triggered payments are not supported.</description>
|
| 18 |
<notes>In the config options, select Authorize for preauth/complete mode, or Authorize and Capture for standard payment mode.
|
| 19 |
|
| 20 |
-
If there is a problem with the initial transaction, the bank response code and text will be displayed to the user
|
|
|
|
|
|
|
| 21 |
<authors><author><name>Andrew Dubbeld</name><user>auto-converted</user><email>support@securepay.com.au</email></author></authors>
|
| 22 |
-
<date>2009-
|
| 23 |
-
<time>
|
| 24 |
-
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="sxml"><dir name="form"><file name="cc.phtml" hash="
|
| 25 |
<compatible/>
|
| 26 |
<dependencies/>
|
| 27 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>SecurePay_SecureXML</name>
|
| 4 |
+
<version>1.0.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 17 |
Fraudguard, Direct Entry (Credit/Debit) and Periodic/Triggered payments are not supported.</description>
|
| 18 |
<notes>In the config options, select Authorize for preauth/complete mode, or Authorize and Capture for standard payment mode.
|
| 19 |
|
| 20 |
+
If there is a problem with the initial transaction, the bank response code and text will be displayed to the user.
|
| 21 |
+
|
| 22 |
+
/magento/var/log needs to exist and be writable in order to use Debug mode.</notes>
|
| 23 |
<authors><author><name>Andrew Dubbeld</name><user>auto-converted</user><email>support@securepay.com.au</email></author></authors>
|
| 24 |
+
<date>2009-11-18</date>
|
| 25 |
+
<time>23:34:18</time>
|
| 26 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="sxml"><dir name="form"><file name="cc.phtml" hash="6c04dbd1934b9dbf8b0dec3d33c8c735"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SecurePay_Sxml.xml" hash="e466d9b1db62c1844ccf17cca44bee5e"/></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="8821ff26d06b3316a08014d318ac26ef"/><file name="system.xml" hash="a5fca83459edc52148ab79e4256fc8ee"/></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="0d368e95ae08ecef37541d2295a72093"/></dir></dir><dir name="Sxml"><dir name="Block"><dir name="Form"><file name="Cc.php" hash="412525e5c8c79ebd26cbf6033618b615"/></dir></dir><dir name="etc"><file name="config.xml" hash="39e7804fc46c7ab67eb05ad68f556097"/><file name="system.xml" hash="8a54e354b1f5cc65c458a1ce3a8271ae"/></dir><dir name="Helper"><file name="Data.php" hash="393c88c60eca919c13f255156355c536"/></dir><dir name="Model"><dir name="Source"><file name="Cctype.php" hash="bfe90747333890f72c94bd57b8b288c0"/></dir><dir name="Sxml"><file name="PaymentAction.php" hash="a5b8594da33b6113f3e9cc759c364d03"/><file name="Request.php" hash="95c4749da03d4e68b83706c8ce70ef0f"/><file name="Result.php" hash="f3f463587b5293a897f5c7e2bd4fc139"/></dir><file name="Sxml.php" hash="c149dac0d8e8727e3dd127d91ef6f5de"/></dir></dir><file name="securepay_xml_api.php" hash="8aa43ac414a01fce5d1d5c26f32c1790"/></dir></target></contents>
|
| 27 |
<compatible/>
|
| 28 |
<dependencies/>
|
| 29 |
</package>
|
