Version Notes
1.3.6
- show error messages and last order number on payment failure
- visual changes
1.3.5
- don't show expired tokens in checkout
- use iframe method with token payment even if redirect method configured
- link to order history on checkout failure page
1.3.4
- card type logos in checkout
- separate callback url
- verify order number
1.3.3
- card type logos in token handling
- FIX: token duplicate check
- FIX: default token change
1.3.2
- Saved cards/token handling
- Saved cards/token payment
1.2.5
FIX: removed newline in multiline street data
1.2.4
link jquery in header, iframe changes
1.2.3
New log
No redirect after failed payment
1.2.2
NEW: Live/Test url selection, separate credentials
1.2.1
NEW: Support iframe payment form
1.2.0
API protocol update
FIX: remove SID from callback_url
1.1.1
Use billing address if shipping address not present (downloadable products)
1.1.0
Converted to stand-alone community extension
1.0.6
Description and contact info
1.0.5
API protocol update: separated fail/cancelled transaction status
1.0.4
API protocol update
1.0.3
add account id
1.0.2
FIX: return url
FIX: return verification
new gateway url
1.0.1
FIX: redirect template
1.0.0
Stable release
Release Info
| Developer | Multon |
| Extension | multon_everypay |
| Version | 1.3.6 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.6 to 1.3.6
- app/code/community/Multon/Everypay/Block/Customer/Token.php +19 -0
- app/code/community/Multon/Everypay/Block/Everypay.php +28 -26
- app/code/community/Multon/Everypay/Block/Form.php +39 -0
- app/code/community/Multon/Everypay/Model/Everypay.php +40 -31
- app/code/community/Multon/Everypay/Model/Resource/Token.php +9 -0
- app/code/community/Multon/Everypay/Model/Resource/Token/Collection.php +9 -0
- app/code/community/Multon/Everypay/Model/Token.php +9 -0
- app/code/community/Multon/Everypay/controllers/EverypayController.php +126 -81
- app/code/community/Multon/Everypay/controllers/TokenController.php +77 -0
- app/code/community/Multon/Everypay/etc/config.xml +28 -7
- app/code/community/Multon/Everypay/etc/system.xml +6 -6
- app/code/community/Multon/Everypay/sql/everypay_setup/upgrade-1.2.5-1.3.0.php +34 -0
- app/code/community/Multon/Everypay/sql/everypay_setup/upgrade-1.3.0-1.3.1.php +9 -0
- app/code/community/Multon/Everypay/sql/everypay_setup/upgrade-1.3.2-1.3.3.php +23 -0
- app/design/frontend/base/default/layout/multon/everypay.xml +37 -11
- app/design/frontend/base/default/template/multon/everypay/everypay.phtml +42 -6
- app/design/frontend/base/default/template/multon/everypay/form.phtml +54 -0
- app/design/frontend/base/default/template/multon/everypay/link.phtml +3 -0
- app/design/frontend/base/default/template/multon/everypay/tokens.phtml +74 -0
- app/locale/et_EE/Multon_Everypay.csv +16 -0
- package.xml +26 -6
- skin/frontend/base/default/images/multon/everypay/master_card.png +0 -0
- skin/frontend/base/default/images/multon/everypay/visa.png +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Multon_Everypay_Block_Customer_Token extends Mage_Core_Block_Template
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function __construct()
|
| 7 |
+
{
|
| 8 |
+
parent::__construct();
|
| 9 |
+
$this->setTemplate('multon/everypay/tokens.phtml');
|
| 10 |
+
|
| 11 |
+
$tokens = Mage::getResourceModel('everypay/token_collection')
|
| 12 |
+
->addFieldToSelect('*')
|
| 13 |
+
->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
|
| 14 |
+
;
|
| 15 |
+
|
| 16 |
+
$this->setTokens($tokens);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
}
|
|
@@ -11,6 +11,11 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
|
|
| 11 |
return Mage::getUrl('everypay/everypay/return', array('_nosid' => true));
|
| 12 |
}
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
/**
|
| 15 |
* Returns payment gateway URL
|
| 16 |
*
|
|
@@ -31,25 +36,6 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
|
|
| 31 |
return $this->getSkinUrl('images/multon/everypay/mastercard_visa_acceptance.png');
|
| 32 |
}
|
| 33 |
|
| 34 |
-
/**
|
| 35 |
-
* Adds payment mehtod logotypes after method name
|
| 36 |
-
*
|
| 37 |
-
* @return string
|
| 38 |
-
*/
|
| 39 |
-
public function getMethodLabelAfterHtml()
|
| 40 |
-
{
|
| 41 |
-
if (!Mage::getStoreConfig('payment/' . $this->_code . '/show_logo'))
|
| 42 |
-
return '';
|
| 43 |
-
|
| 44 |
-
$blockHtml = sprintf(
|
| 45 |
-
'<img src="%1$s"
|
| 46 |
-
title="%2$s"
|
| 47 |
-
alt="%2$s"
|
| 48 |
-
class="payment-method-logo"/>', $this->getMethodLogoUrl(), ucfirst($this->_gateway)
|
| 49 |
-
);
|
| 50 |
-
return $blockHtml;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
/**
|
| 54 |
* Checks if quick redirect is enabled and
|
| 55 |
* returns javascript block that redirects user
|
|
@@ -69,6 +55,12 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
|
|
| 69 |
return $outstr;
|
| 70 |
}
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
/**
|
| 73 |
* Populates and returns array of fields to be submitted
|
| 74 |
* to a bank for payment
|
|
@@ -77,8 +69,7 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
|
|
| 77 |
*/
|
| 78 |
public function getFields()
|
| 79 |
{
|
| 80 |
-
$
|
| 81 |
-
$order = Mage::getModel('sales/order')->load($orderId);
|
| 82 |
/* @var $order Mage_Sales_Model_Order */
|
| 83 |
switch (Mage::app()->getLocale()->getLocaleCode())
|
| 84 |
{
|
|
@@ -104,6 +95,9 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
|
|
| 104 |
else
|
| 105 |
$username = Mage::getStoreConfig('payment/' . $this->_code . '/api_username_test');
|
| 106 |
|
|
|
|
|
|
|
|
|
|
| 107 |
$fields = array(
|
| 108 |
'account_id' => Mage::getStoreConfig('payment/' . $this->_code . '/account_id'),
|
| 109 |
'amount' => number_format($order->getTotalDue(), 2, '.', ''),
|
|
@@ -112,25 +106,33 @@ class Multon_Everypay_Block_Everypay extends Mage_Payment_Block_Form
|
|
| 112 |
'billing_city' => $billing->getCity(),
|
| 113 |
'billing_country' => $billing->getCountry(),
|
| 114 |
'billing_postcode' => $billing->getPostcode(),
|
| 115 |
-
'callback_url' => $this->
|
| 116 |
'customer_url' => $this->getReturnUrl(),
|
| 117 |
'delivery_address' => str_replace("\n", ' ', $shipping->getStreetFull()),
|
| 118 |
'delivery_city' => $shipping->getCity(),
|
| 119 |
'delivery_country' => $shipping->getCountry(),
|
| 120 |
'delivery_postcode' => $shipping->getPostcode(),
|
| 121 |
'email' => $billing->getEmail(),
|
| 122 |
-
'hmac_fields' => '
|
| 123 |
-
'delivery_country,delivery_postcode,email,hmac_fields,nonce,order_reference,timestamp,transaction_type,user_ip',
|
| 124 |
'nonce' => $this->getNonce(),
|
| 125 |
'order_reference' => $order->getIncrementId(),
|
| 126 |
'timestamp' => time(),
|
| 127 |
-
'transaction_type' =>
|
| 128 |
'user_ip' => $_SERVER['REMOTE_ADDR'],
|
| 129 |
);
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
$fields['hmac'] = $this->signData($this->prepareData($fields));
|
| 132 |
$fields['locale'] = $language;
|
| 133 |
-
if (Mage::getStoreConfig('payment/multon_everypay/connection_type'))
|
| 134 |
$fields['skin_name'] = Mage::getStoreConfig('payment/multon_everypay/skin_name');
|
| 135 |
|
| 136 |
// Mage::log(print_r($fields, 1), null, $this->logFile);
|
| 11 |
return Mage::getUrl('everypay/everypay/return', array('_nosid' => true));
|
| 12 |
}
|
| 13 |
|
| 14 |
+
protected function getCallbackUrl()
|
| 15 |
+
{
|
| 16 |
+
return Mage::getUrl('everypay/everypay/callback', array('_nosid' => true));
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
/**
|
| 20 |
* Returns payment gateway URL
|
| 21 |
*
|
| 36 |
return $this->getSkinUrl('images/multon/everypay/mastercard_visa_acceptance.png');
|
| 37 |
}
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
/**
|
| 40 |
* Checks if quick redirect is enabled and
|
| 41 |
* returns javascript block that redirects user
|
| 55 |
return $outstr;
|
| 56 |
}
|
| 57 |
|
| 58 |
+
public function getOrder()
|
| 59 |
+
{
|
| 60 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
| 61 |
+
return Mage::getModel('sales/order')->load($orderId);
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
/**
|
| 65 |
* Populates and returns array of fields to be submitted
|
| 66 |
* to a bank for payment
|
| 69 |
*/
|
| 70 |
public function getFields()
|
| 71 |
{
|
| 72 |
+
$order = $this->getOrder();
|
|
|
|
| 73 |
/* @var $order Mage_Sales_Model_Order */
|
| 74 |
switch (Mage::app()->getLocale()->getLocaleCode())
|
| 75 |
{
|
| 95 |
else
|
| 96 |
$username = Mage::getStoreConfig('payment/' . $this->_code . '/api_username_test');
|
| 97 |
|
| 98 |
+
$use_token = $order->getPayment()->getMethodInstance()->getInfoInstance()->getAdditionalInformation('everypay_use_token');
|
| 99 |
+
$save_token = !empty($use_token) ? 0 : (int)$order->getPayment()->getMethodInstance()->getInfoInstance()->getAdditionalInformation('everypay_save_token');
|
| 100 |
+
|
| 101 |
$fields = array(
|
| 102 |
'account_id' => Mage::getStoreConfig('payment/' . $this->_code . '/account_id'),
|
| 103 |
'amount' => number_format($order->getTotalDue(), 2, '.', ''),
|
| 106 |
'billing_city' => $billing->getCity(),
|
| 107 |
'billing_country' => $billing->getCountry(),
|
| 108 |
'billing_postcode' => $billing->getPostcode(),
|
| 109 |
+
'callback_url' => $this->getCallbackUrl(),
|
| 110 |
'customer_url' => $this->getReturnUrl(),
|
| 111 |
'delivery_address' => str_replace("\n", ' ', $shipping->getStreetFull()),
|
| 112 |
'delivery_city' => $shipping->getCity(),
|
| 113 |
'delivery_country' => $shipping->getCountry(),
|
| 114 |
'delivery_postcode' => $shipping->getPostcode(),
|
| 115 |
'email' => $billing->getEmail(),
|
| 116 |
+
'hmac_fields' => '',
|
|
|
|
| 117 |
'nonce' => $this->getNonce(),
|
| 118 |
'order_reference' => $order->getIncrementId(),
|
| 119 |
'timestamp' => time(),
|
| 120 |
+
'transaction_type' => 'charge',
|
| 121 |
'user_ip' => $_SERVER['REMOTE_ADDR'],
|
| 122 |
);
|
| 123 |
|
| 124 |
+
if (!empty($use_token))
|
| 125 |
+
$fields['cc_token'] = $use_token;
|
| 126 |
+
else if ($save_token)
|
| 127 |
+
$fields['request_cc_token'] = $save_token;
|
| 128 |
+
|
| 129 |
+
ksort($fields);
|
| 130 |
+
|
| 131 |
+
$fields['hmac_fields'] = implode(',', array_keys($fields));
|
| 132 |
+
|
| 133 |
$fields['hmac'] = $this->signData($this->prepareData($fields));
|
| 134 |
$fields['locale'] = $language;
|
| 135 |
+
if (Mage::getStoreConfig('payment/multon_everypay/connection_type') || isset($fields['cc_token']))
|
| 136 |
$fields['skin_name'] = Mage::getStoreConfig('payment/multon_everypay/skin_name');
|
| 137 |
|
| 138 |
// Mage::log(print_r($fields, 1), null, $this->logFile);
|
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Multon_Everypay_Block_Form extends Multon_Everypay_Block_Everypay
|
| 4 |
+
{
|
| 5 |
+
protected function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
if (Mage::getStoreConfig('payment/' . $this->_code . '/enable_token'))
|
| 9 |
+
$this->setTemplate('multon/everypay/form.phtml');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Adds payment mehtod logotypes after method name
|
| 14 |
+
*
|
| 15 |
+
* @return string
|
| 16 |
+
*/
|
| 17 |
+
public function getMethodLabelAfterHtml()
|
| 18 |
+
{
|
| 19 |
+
if (!Mage::getStoreConfig('payment/' . $this->_code . '/show_logo'))
|
| 20 |
+
return '';
|
| 21 |
+
|
| 22 |
+
$blockHtml = sprintf(
|
| 23 |
+
'<img src="%1$s"
|
| 24 |
+
title="%2$s"
|
| 25 |
+
alt="%2$s"
|
| 26 |
+
class="payment-method-logo"/>', $this->getMethodLogoUrl(), ucfirst($this->_gateway)
|
| 27 |
+
);
|
| 28 |
+
return $blockHtml;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function getTokens()
|
| 32 |
+
{
|
| 33 |
+
return Mage::getResourceModel('everypay/token_collection')
|
| 34 |
+
->addFieldToSelect('*')
|
| 35 |
+
->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
|
| 36 |
+
->addFieldToFilter('cc_year', array('gteq' => date('Y')))
|
| 37 |
+
;
|
| 38 |
+
}
|
| 39 |
+
}
|
|
@@ -11,7 +11,7 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
|
|
| 11 |
protected $_canUseCheckout = true;
|
| 12 |
protected $logFile = 'everypay.log';
|
| 13 |
protected $_code = 'multon_everypay';
|
| 14 |
-
protected $_formBlockType = 'everypay/
|
| 15 |
private $statuses = array(
|
| 16 |
'completed' => self::_VERIFY_SUCCESS,
|
| 17 |
'failed' => self::_VERIFY_CANCEL,
|
|
@@ -23,6 +23,19 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
|
|
| 23 |
return Mage::getUrl('everypay/everypay/redirect');
|
| 24 |
}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
/**
|
| 27 |
* Verifies response from Everypay
|
| 28 |
*
|
|
@@ -89,16 +102,13 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
|
|
| 89 |
return self::_VERIFY_CORRUPT;
|
| 90 |
}
|
| 91 |
|
| 92 |
-
// !! background return message does not have session !!
|
| 93 |
-
// $session = Mage::getSingleton('checkout/session');
|
| 94 |
-
/* @var $session Mage_Checkout_Model_Session */
|
| 95 |
// Reference number doesn't match.
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
|
| 103 |
if (!$this->verifyNonce($params['nonce']))
|
| 104 |
{
|
|
@@ -142,14 +152,15 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
|
|
| 142 |
*/
|
| 143 |
public function createInvoice()
|
| 144 |
{
|
| 145 |
-
$
|
|
|
|
| 146 |
|
| 147 |
-
if (!$this->isLocked($
|
| 148 |
{
|
| 149 |
if ($order->canInvoice())
|
| 150 |
{
|
| 151 |
|
| 152 |
-
if ($this->createLock($
|
| 153 |
{
|
| 154 |
|
| 155 |
$invoice = $order->prepareInvoice();
|
|
@@ -160,7 +171,7 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
|
|
| 160 |
$order->save();
|
| 161 |
|
| 162 |
/* Release lock file right after creating invoice */
|
| 163 |
-
$this->releaseLock($
|
| 164 |
|
| 165 |
/* Send invoice */
|
| 166 |
if (Mage::getStoreConfig('payment/' . $this->_code . '/invoice_confirmation') == '1')
|
|
@@ -172,46 +183,44 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
|
|
| 172 |
}
|
| 173 |
} else
|
| 174 |
{
|
| 175 |
-
$this->log('Failed to create invoice for order ' . $
|
| 176 |
-
__METHOD__, __LINE__);
|
| 177 |
}
|
| 178 |
} else
|
| 179 |
{
|
| 180 |
-
$this->log('Failed to create invoice for order ' . $
|
| 181 |
-
__LINE__);
|
| 182 |
}
|
| 183 |
}
|
| 184 |
|
| 185 |
/**
|
| 186 |
*
|
| 187 |
-
* @param string $
|
| 188 |
* @return string
|
| 189 |
*/
|
| 190 |
-
private function getLockfilePath($
|
| 191 |
{
|
| 192 |
-
return Mage::getBaseDir('var') . DS . 'locks' . DS . 'order_' . $
|
| 193 |
}
|
| 194 |
|
| 195 |
/**
|
| 196 |
* Checks if given invoice is locked, i.e if it has
|
| 197 |
* a file in var/locks folder
|
| 198 |
*
|
| 199 |
-
* @param string $
|
| 200 |
*/
|
| 201 |
-
public function isLocked($
|
| 202 |
{
|
| 203 |
-
return file_exists($this->getLockfilePath($
|
| 204 |
}
|
| 205 |
|
| 206 |
/**
|
| 207 |
* Locks order, i.e creates a lock file
|
| 208 |
* in var/locks folder
|
| 209 |
-
* @param string $
|
| 210 |
*/
|
| 211 |
-
public function createLock($
|
| 212 |
{
|
| 213 |
-
$path = $this->getLockfilePath($
|
| 214 |
-
if (!touch($this->getLockfilePath($
|
| 215 |
{
|
| 216 |
$this->log('Failed to create lockfile ' . $path, __METHOD__, __LINE__);
|
| 217 |
return false;
|
|
@@ -224,11 +233,11 @@ class Multon_Everypay_Model_Everypay extends Mage_Payment_Model_Method_Abstract
|
|
| 224 |
* Releases lock for order, i.e deletes
|
| 225 |
* lock file from var/locks folder
|
| 226 |
*
|
| 227 |
-
* @param string $
|
| 228 |
*/
|
| 229 |
-
public function releaseLock($
|
| 230 |
{
|
| 231 |
-
$path = $this->getLockfilePath($
|
| 232 |
if (!unlink($path))
|
| 233 |
{
|
| 234 |
$this->log('Failed to delete lockfile ' . $path, __METHOD__, __LINE__);
|
| 11 |
protected $_canUseCheckout = true;
|
| 12 |
protected $logFile = 'everypay.log';
|
| 13 |
protected $_code = 'multon_everypay';
|
| 14 |
+
protected $_formBlockType = 'everypay/form';
|
| 15 |
private $statuses = array(
|
| 16 |
'completed' => self::_VERIFY_SUCCESS,
|
| 17 |
'failed' => self::_VERIFY_CANCEL,
|
| 23 |
return Mage::getUrl('everypay/everypay/redirect');
|
| 24 |
}
|
| 25 |
|
| 26 |
+
/**
|
| 27 |
+
* Assign data to info model instance
|
| 28 |
+
*
|
| 29 |
+
* @param mixed $data
|
| 30 |
+
* @return Mage_Payment_Model_Method_Abstract
|
| 31 |
+
*/
|
| 32 |
+
public function assignData($data)
|
| 33 |
+
{
|
| 34 |
+
$this->getInfoInstance()
|
| 35 |
+
->setAdditionalInformation('everypay_use_token', $data->getData('everypay_use_token'))
|
| 36 |
+
->setAdditionalInformation('everypay_save_token', $data->getData('everypay_save_token'));
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
/**
|
| 40 |
* Verifies response from Everypay
|
| 41 |
*
|
| 102 |
return self::_VERIFY_CORRUPT;
|
| 103 |
}
|
| 104 |
|
|
|
|
|
|
|
|
|
|
| 105 |
// Reference number doesn't match.
|
| 106 |
+
if ($this->getOrderNumber() != $params['order_reference'])
|
| 107 |
+
{
|
| 108 |
+
$this->log('(Everypay): Order number doesn\'t match (potential tampering attempt). Expecting: ' . $this->getOrderNumber(), __METHOD__, __LINE__);
|
| 109 |
+
Mage::getSingleton('checkout/session')->addError('Order number error.');
|
| 110 |
+
return self::_VERIFY_CORRUPT;
|
| 111 |
+
}
|
| 112 |
|
| 113 |
if (!$this->verifyNonce($params['nonce']))
|
| 114 |
{
|
| 152 |
*/
|
| 153 |
public function createInvoice()
|
| 154 |
{
|
| 155 |
+
$orderNumber = $this->getOrderNumber();
|
| 156 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderNumber);
|
| 157 |
|
| 158 |
+
if (!$this->isLocked($orderNumber))
|
| 159 |
{
|
| 160 |
if ($order->canInvoice())
|
| 161 |
{
|
| 162 |
|
| 163 |
+
if ($this->createLock($orderNumber))
|
| 164 |
{
|
| 165 |
|
| 166 |
$invoice = $order->prepareInvoice();
|
| 171 |
$order->save();
|
| 172 |
|
| 173 |
/* Release lock file right after creating invoice */
|
| 174 |
+
$this->releaseLock($orderNumber);
|
| 175 |
|
| 176 |
/* Send invoice */
|
| 177 |
if (Mage::getStoreConfig('payment/' . $this->_code . '/invoice_confirmation') == '1')
|
| 183 |
}
|
| 184 |
} else
|
| 185 |
{
|
| 186 |
+
$this->log('Failed to create invoice for order ' . $orderNumber . '. Reason: invoice already created', __METHOD__, __LINE__);
|
|
|
|
| 187 |
}
|
| 188 |
} else
|
| 189 |
{
|
| 190 |
+
$this->log('Failed to create invoice for order ' . $orderNumber . '. Reason: order locked', __METHOD__, __LINE__);
|
|
|
|
| 191 |
}
|
| 192 |
}
|
| 193 |
|
| 194 |
/**
|
| 195 |
*
|
| 196 |
+
* @param string $orderNumber
|
| 197 |
* @return string
|
| 198 |
*/
|
| 199 |
+
private function getLockfilePath($orderNumber)
|
| 200 |
{
|
| 201 |
+
return Mage::getBaseDir('var') . DS . 'locks' . DS . 'order_' . $orderNumber . '.lock';
|
| 202 |
}
|
| 203 |
|
| 204 |
/**
|
| 205 |
* Checks if given invoice is locked, i.e if it has
|
| 206 |
* a file in var/locks folder
|
| 207 |
*
|
| 208 |
+
* @param string $orderNumber
|
| 209 |
*/
|
| 210 |
+
public function isLocked($orderNumber)
|
| 211 |
{
|
| 212 |
+
return file_exists($this->getLockfilePath($orderNumber));
|
| 213 |
}
|
| 214 |
|
| 215 |
/**
|
| 216 |
* Locks order, i.e creates a lock file
|
| 217 |
* in var/locks folder
|
| 218 |
+
* @param string $orderNumber
|
| 219 |
*/
|
| 220 |
+
public function createLock($orderNumber)
|
| 221 |
{
|
| 222 |
+
$path = $this->getLockfilePath($orderNumber);
|
| 223 |
+
if (!touch($this->getLockfilePath($orderNumber)))
|
| 224 |
{
|
| 225 |
$this->log('Failed to create lockfile ' . $path, __METHOD__, __LINE__);
|
| 226 |
return false;
|
| 233 |
* Releases lock for order, i.e deletes
|
| 234 |
* lock file from var/locks folder
|
| 235 |
*
|
| 236 |
+
* @param string $orderNumber
|
| 237 |
*/
|
| 238 |
+
public function releaseLock($orderNumber)
|
| 239 |
{
|
| 240 |
+
$path = $this->getLockfilePath($orderNumber);
|
| 241 |
if (!unlink($path))
|
| 242 |
{
|
| 243 |
$this->log('Failed to delete lockfile ' . $path, __METHOD__, __LINE__);
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Multon_Everypay_Model_Resource_Token extends Mage_Core_Model_Resource_Db_Abstract
|
| 4 |
+
{
|
| 5 |
+
protected function _construct()
|
| 6 |
+
{
|
| 7 |
+
$this->_init('everypay/token', 'token_id');
|
| 8 |
+
}
|
| 9 |
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Multon_Everypay_Model_Resource_Token_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
protected function _construct()
|
| 6 |
+
{
|
| 7 |
+
$this->_init('everypay/token');
|
| 8 |
+
}
|
| 9 |
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Multon_Everypay_Model_Token extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
$this->_init('everypay/token');
|
| 8 |
+
}
|
| 9 |
+
}
|
|
@@ -1,96 +1,141 @@
|
|
| 1 |
<?php
|
| 2 |
class Multon_Everypay_EverypayController extends Mage_Core_Controller_Front_Action
|
| 3 |
{
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
protected $_model = 'everypay/everypay';
|
| 10 |
|
| 11 |
/**
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
protected $orderNoField = 'order_reference';
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
/* Send order confirmation */
|
| 37 |
-
if (Mage::getStoreConfig('payment/' . $this->_code . '/order_confirmation') == '1') {
|
| 38 |
-
try {
|
| 39 |
-
$order = Mage::getModel('sales/order');
|
| 40 |
-
$order->load(
|
| 41 |
-
Mage::getSingleton('checkout/session')->getLastOrderId()
|
| 42 |
-
);
|
| 43 |
-
$order->sendNewOrderEmail();
|
| 44 |
-
$order->save();
|
| 45 |
-
} catch (Exception $e) {
|
| 46 |
-
Mage::log(sprintf('%s(%s): %s', __METHOD__, __LINE__, print_r($e->getMessage(), true)), null, $this->logFile);
|
| 47 |
-
}
|
| 48 |
-
}
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
}
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
Mage::log(sprintf('%s(%s)@%s: Order number not found in session or \'%s\'', __METHOD__, __LINE__, $_SERVER['REMOTE_ADDR'], $this->orderNoField),null, $this->logFile);
|
| 72 |
-
$this->_redirect('checkout/onepage/failure');
|
| 73 |
-
return;
|
| 74 |
-
}
|
| 75 |
-
$model = Mage::getModel($this->_model);
|
| 76 |
-
$model->setOrderId($orderId);
|
| 77 |
-
$verify = $model->verify($this->getRequest()->getParams());
|
| 78 |
-
switch ($verify) {
|
| 79 |
-
case Multon_Everypay_Model_Everypay::_VERIFY_SUCCESS:
|
| 80 |
-
$model->createInvoice();
|
| 81 |
-
$this->_redirect('checkout/onepage/success');
|
| 82 |
-
break;
|
| 83 |
-
case Multon_Everypay_Model_Everypay::_VERIFY_CANCEL:
|
| 84 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 85 |
-
$order->cancel()->save();
|
| 86 |
-
$this->_redirect('checkout/onepage/failure');
|
| 87 |
-
break;
|
| 88 |
-
case Multon_Everypay_Model_Everypay::_VERIFY_CORRUPT:
|
| 89 |
-
default:
|
| 90 |
-
$this->_redirect('checkout/onepage/failure');
|
| 91 |
-
break;
|
| 92 |
-
}
|
| 93 |
-
}
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
}
|
| 1 |
<?php
|
| 2 |
class Multon_Everypay_EverypayController extends Mage_Core_Controller_Front_Action
|
| 3 |
{
|
| 4 |
+
/**
|
| 5 |
+
*
|
| 6 |
+
* @var Specifies model to be used to verify response from bank
|
| 7 |
+
*/
|
| 8 |
+
protected $_model = 'everypay/everypay';
|
|
|
|
| 9 |
|
| 10 |
/**
|
| 11 |
+
*
|
| 12 |
+
* @var Specifies payment method code in magento
|
| 13 |
+
*/
|
| 14 |
+
protected $_code = 'multon_everypay';
|
| 15 |
|
| 16 |
+
/**
|
| 17 |
+
*
|
| 18 |
+
* @var Fieldname of order number in return data (used on automatic response from bank)
|
| 19 |
+
*/
|
| 20 |
protected $orderNoField = 'order_reference';
|
| 21 |
|
| 22 |
+
/**
|
| 23 |
+
*
|
| 24 |
+
* @var specifies log file name for Payment
|
| 25 |
+
*/
|
| 26 |
+
protected $logFile = 'everypay.log';
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* This action redirects user to bank for payment
|
| 30 |
+
*
|
| 31 |
+
* @return void
|
| 32 |
+
*/
|
| 33 |
+
public function redirectAction()
|
| 34 |
+
{
|
| 35 |
+
/* Send order confirmation */
|
| 36 |
+
if (Mage::getStoreConfig('payment/' . $this->_code . '/order_confirmation') == '1') {
|
| 37 |
+
try {
|
| 38 |
+
$order = Mage::getModel('sales/order');
|
| 39 |
+
$order->load(
|
| 40 |
+
Mage::getSingleton('checkout/session')->getLastOrderId()
|
| 41 |
+
);
|
| 42 |
+
$order->sendNewOrderEmail();
|
| 43 |
+
$order->save();
|
| 44 |
+
} catch (Exception $e) {
|
| 45 |
+
Mage::log(sprintf('%s(%s): %s', __METHOD__, __LINE__, print_r($e->getMessage(), true)), null, $this->logFile);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
$this->loadLayout();
|
| 50 |
+
$this->renderLayout();
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
public function callbackAction()
|
| 54 |
+
{
|
| 55 |
+
$params = $this->getRequest()->getParams();
|
| 56 |
+
$this->log($params, __METHOD__, __LINE__);
|
| 57 |
+
|
| 58 |
+
$orderNumber = $params[$this->orderNoField];
|
| 59 |
+
if (!$orderNumber) {
|
| 60 |
+
$this->log('Order number not found in \''.$this->orderNoField.'\'', __METHOD__, __LINE__);
|
| 61 |
+
$this->_redirect('checkout/onepage/failure');
|
| 62 |
+
return;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
$this->dealWithIt($params, $orderNumber, true);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
public function returnAction()
|
| 69 |
+
{
|
| 70 |
+
$params = $this->getRequest()->getParams();
|
| 71 |
+
$this->log($params, __METHOD__, __LINE__);
|
| 72 |
|
| 73 |
+
$session = Mage::getSingleton('checkout/session');
|
| 74 |
+
$orderNumber = $session->getLastRealOrderId();
|
| 75 |
+
if (!$orderNumber) {
|
| 76 |
+
$this->log('Order number not found in session', __METHOD__, __LINE__);
|
| 77 |
+
$this->_redirect('checkout/onepage/failure');
|
| 78 |
+
return;
|
| 79 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
$this->dealWithIt($params, $orderNumber);
|
| 82 |
+
}
|
|
|
|
| 83 |
|
| 84 |
+
protected function dealWithIt($params, $orderNumber, $isCallback = false)
|
| 85 |
+
{
|
| 86 |
+
$model = Mage::getModel($this->_model);
|
| 87 |
+
$model->setOrderNumber($orderNumber);
|
| 88 |
+
$verify = $model->verify($params);
|
| 89 |
+
switch ($verify) {
|
| 90 |
+
case Multon_Everypay_Model_Everypay::_VERIFY_SUCCESS:
|
| 91 |
+
if ($isCallback)
|
| 92 |
+
{
|
| 93 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderNumber);
|
| 94 |
+
$customerId = $order->getCustomerId();
|
| 95 |
+
} else
|
| 96 |
+
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
| 97 |
|
| 98 |
+
if ($customerId && isset($params['cc_token']))
|
| 99 |
+
{
|
| 100 |
+
// number of customer card tokens
|
| 101 |
+
$tokenCount = Mage::getResourceModel('everypay/token_collection')
|
| 102 |
+
->addFieldToFilter('customer_id', $customerId)
|
| 103 |
+
->getSize();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
+
// check if card token already exists
|
| 106 |
+
if (Mage::getResourceModel('everypay/token_collection')
|
| 107 |
+
->addFieldToFilter('customer_id', $customerId)
|
| 108 |
+
->addFieldToFilter('cc_token', $params['cc_token'])
|
| 109 |
+
->getSize() == 0)
|
| 110 |
+
{
|
| 111 |
+
Mage::getModel('everypay/token')
|
| 112 |
+
->setCustomerId($customerId)
|
| 113 |
+
->setCcToken($params['cc_token'])
|
| 114 |
+
->setCcLastFourDigits($params['cc_last_four_digits'])
|
| 115 |
+
->setCcYear($params['cc_year'])
|
| 116 |
+
->setCcMonth($params['cc_month'])
|
| 117 |
+
->setCcType($params['cc_type'])
|
| 118 |
+
->setIsDefault($tokenCount ? 0 : 1) // set first one to default
|
| 119 |
+
->save();
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
$model->createInvoice();
|
| 123 |
+
$this->_redirect('checkout/onepage/success');
|
| 124 |
+
break;
|
| 125 |
+
case Multon_Everypay_Model_Everypay::_VERIFY_CANCEL:
|
| 126 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderNumber);
|
| 127 |
+
$order->cancel()->save();
|
| 128 |
+
$this->_redirect('checkout/onepage/failure');
|
| 129 |
+
break;
|
| 130 |
+
case Multon_Everypay_Model_Everypay::_VERIFY_CORRUPT:
|
| 131 |
+
default:
|
| 132 |
+
$this->_redirect('checkout/onepage/failure');
|
| 133 |
+
break;
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
|
| 137 |
+
protected function log($txt, $method = __METHOD__, $line = __LINE__)
|
| 138 |
+
{
|
| 139 |
+
Mage::log(sprintf('%s(%s)@%s: %s', $method, $line, $_SERVER['REMOTE_ADDR'], print_r($txt, true)), null, $this->logFile);
|
| 140 |
+
}
|
| 141 |
}
|
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Multon_Everypay_TokenController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
protected function _getSession()
|
| 7 |
+
{
|
| 8 |
+
return Mage::getSingleton('customer/session');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
public function preDispatch()
|
| 12 |
+
{
|
| 13 |
+
parent::preDispatch();
|
| 14 |
+
|
| 15 |
+
if (!Mage::getSingleton('customer/session')->authenticate($this))
|
| 16 |
+
{
|
| 17 |
+
$this->setFlag('', 'no-dispatch', true);
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
public function indexAction()
|
| 22 |
+
{
|
| 23 |
+
$this->loadLayout();
|
| 24 |
+
$this->_initLayoutMessages('customer/session');
|
| 25 |
+
$this->_initLayoutMessages('catalog/session');
|
| 26 |
+
$this->renderLayout();
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function setDefaultAction()
|
| 30 |
+
{
|
| 31 |
+
$id = $this->getRequest()->getParam('token', false);
|
| 32 |
+
if ($id)
|
| 33 |
+
{
|
| 34 |
+
$customerId = $this->_getSession()->getCustomerId();
|
| 35 |
+
$token = Mage::getModel('everypay/token')->load($id);
|
| 36 |
+
if ($token && ($token->getCustomerId() == $customerId))
|
| 37 |
+
{
|
| 38 |
+
Mage::getModel('everypay/token')
|
| 39 |
+
->getCollection()
|
| 40 |
+
->addFieldToFilter('customer_id', $customerId)
|
| 41 |
+
->load()
|
| 42 |
+
->setDataToAll('is_default', 0)
|
| 43 |
+
->save();
|
| 44 |
+
$token->setIsDefault(1)->save();
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
$this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function deleteAction()
|
| 51 |
+
{
|
| 52 |
+
$id = $this->getRequest()->getParam('token', false);
|
| 53 |
+
|
| 54 |
+
if ($id)
|
| 55 |
+
{
|
| 56 |
+
$token = Mage::getModel('everypay/token')->load($id);
|
| 57 |
+
|
| 58 |
+
// Validate address_id <=> customer_id
|
| 59 |
+
if ($token->getCustomerId() != $this->_getSession()->getCustomerId())
|
| 60 |
+
{
|
| 61 |
+
$this->_getSession()->addError($this->__('The token does not belong to this customer.'));
|
| 62 |
+
$this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
|
| 63 |
+
return;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
try
|
| 67 |
+
{
|
| 68 |
+
$token->delete();
|
| 69 |
+
$this->_getSession()->addSuccess($this->__('The token has been deleted.'));
|
| 70 |
+
} catch (Exception $e)
|
| 71 |
+
{
|
| 72 |
+
$this->_getSession()->addException($e, $this->__('An error occurred while deleting the token.'));
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
$this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
|
| 76 |
+
}
|
| 77 |
+
}
|
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Multon_Everypay>
|
| 5 |
-
<version>1.
|
| 6 |
</Multon_Everypay>
|
| 7 |
</modules>
|
| 8 |
<global>
|
|
@@ -17,6 +17,9 @@
|
|
| 17 |
<nonce>
|
| 18 |
<table>everypay_nonce</table>
|
| 19 |
</nonce>
|
|
|
|
|
|
|
|
|
|
| 20 |
</entities>
|
| 21 |
</everypay_resource>
|
| 22 |
</models>
|
|
@@ -25,6 +28,11 @@
|
|
| 25 |
<class>Multon_Everypay_Block</class>
|
| 26 |
</everypay>
|
| 27 |
</blocks>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
<resources>
|
| 29 |
<everypay_setup>
|
| 30 |
<setup>
|
|
@@ -32,11 +40,6 @@
|
|
| 32 |
</setup>
|
| 33 |
</everypay_setup>
|
| 34 |
</resources>
|
| 35 |
-
<helpers>
|
| 36 |
-
<everypay>
|
| 37 |
-
<class>Multon_Everypay_Helper</class>
|
| 38 |
-
</everypay>
|
| 39 |
-
</helpers>
|
| 40 |
</global>
|
| 41 |
<adminhtml>
|
| 42 |
<layout>
|
|
@@ -46,6 +49,15 @@
|
|
| 46 |
</Multon_Everypay>
|
| 47 |
</updates>
|
| 48 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
</adminhtml>
|
| 50 |
<frontend>
|
| 51 |
<layout>
|
|
@@ -64,6 +76,15 @@
|
|
| 64 |
</args>
|
| 65 |
</everypay>
|
| 66 |
</routers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
</frontend>
|
| 68 |
<default>
|
| 69 |
<payment>
|
|
@@ -77,11 +98,11 @@
|
|
| 77 |
<api_username></api_username>
|
| 78 |
<api_secret></api_secret>
|
| 79 |
<account_id></account_id>
|
| 80 |
-
<transaction_type>charge</transaction_type>
|
| 81 |
<order_confirmation>0</order_confirmation>
|
| 82 |
<invoice_confirmation>1</invoice_confirmation>
|
| 83 |
<model>everypay/everypay</model>
|
| 84 |
<payment_action>authorize</payment_action>
|
|
|
|
| 85 |
<show_logo>1</show_logo>
|
| 86 |
<show_title>0</show_title>
|
| 87 |
</multon_everypay>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Multon_Everypay>
|
| 5 |
+
<version>1.3.6</version>
|
| 6 |
</Multon_Everypay>
|
| 7 |
</modules>
|
| 8 |
<global>
|
| 17 |
<nonce>
|
| 18 |
<table>everypay_nonce</table>
|
| 19 |
</nonce>
|
| 20 |
+
<token>
|
| 21 |
+
<table>everypay_token</table>
|
| 22 |
+
</token>
|
| 23 |
</entities>
|
| 24 |
</everypay_resource>
|
| 25 |
</models>
|
| 28 |
<class>Multon_Everypay_Block</class>
|
| 29 |
</everypay>
|
| 30 |
</blocks>
|
| 31 |
+
<helpers>
|
| 32 |
+
<everypay>
|
| 33 |
+
<class>Multon_Everypay_Helper</class>
|
| 34 |
+
</everypay>
|
| 35 |
+
</helpers>
|
| 36 |
<resources>
|
| 37 |
<everypay_setup>
|
| 38 |
<setup>
|
| 40 |
</setup>
|
| 41 |
</everypay_setup>
|
| 42 |
</resources>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
</global>
|
| 44 |
<adminhtml>
|
| 45 |
<layout>
|
| 49 |
</Multon_Everypay>
|
| 50 |
</updates>
|
| 51 |
</layout>
|
| 52 |
+
<translate>
|
| 53 |
+
<modules>
|
| 54 |
+
<everypay>
|
| 55 |
+
<files>
|
| 56 |
+
<default>Multon_Everypay.csv</default>
|
| 57 |
+
</files>
|
| 58 |
+
</everypay>
|
| 59 |
+
</modules>
|
| 60 |
+
</translate>
|
| 61 |
</adminhtml>
|
| 62 |
<frontend>
|
| 63 |
<layout>
|
| 76 |
</args>
|
| 77 |
</everypay>
|
| 78 |
</routers>
|
| 79 |
+
<translate>
|
| 80 |
+
<modules>
|
| 81 |
+
<Multon_Everypay>
|
| 82 |
+
<files>
|
| 83 |
+
<default>Multon_Everypay.csv</default>
|
| 84 |
+
</files>
|
| 85 |
+
</Multon_Everypay>
|
| 86 |
+
</modules>
|
| 87 |
+
</translate>
|
| 88 |
</frontend>
|
| 89 |
<default>
|
| 90 |
<payment>
|
| 98 |
<api_username></api_username>
|
| 99 |
<api_secret></api_secret>
|
| 100 |
<account_id></account_id>
|
|
|
|
| 101 |
<order_confirmation>0</order_confirmation>
|
| 102 |
<invoice_confirmation>1</invoice_confirmation>
|
| 103 |
<model>everypay/everypay</model>
|
| 104 |
<payment_action>authorize</payment_action>
|
| 105 |
+
<quick_redirect>1</quick_redirect>
|
| 106 |
<show_logo>1</show_logo>
|
| 107 |
<show_title>0</show_title>
|
| 108 |
</multon_everypay>
|
|
@@ -113,15 +113,15 @@
|
|
| 113 |
<show_in_website>1</show_in_website>
|
| 114 |
<show_in_store>0</show_in_store>
|
| 115 |
</account_id>
|
| 116 |
-
<
|
| 117 |
-
<label>
|
| 118 |
<frontend_type>select</frontend_type>
|
| 119 |
-
<source_model>
|
| 120 |
<sort_order>21</sort_order>
|
| 121 |
<show_in_default>1</show_in_default>
|
| 122 |
<show_in_website>1</show_in_website>
|
| 123 |
-
<show_in_store>
|
| 124 |
-
</
|
| 125 |
<order_confirmation translate="label">
|
| 126 |
<label>Send Order Confirmation</label>
|
| 127 |
<frontend_type>select</frontend_type>
|
|
@@ -192,4 +192,4 @@
|
|
| 192 |
</groups>
|
| 193 |
</payment>
|
| 194 |
</sections>
|
| 195 |
-
</config>
|
| 113 |
<show_in_website>1</show_in_website>
|
| 114 |
<show_in_store>0</show_in_store>
|
| 115 |
</account_id>
|
| 116 |
+
<enable_token translate="label">
|
| 117 |
+
<label>Enable payments with saved cards</label>
|
| 118 |
<frontend_type>select</frontend_type>
|
| 119 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 120 |
<sort_order>21</sort_order>
|
| 121 |
<show_in_default>1</show_in_default>
|
| 122 |
<show_in_website>1</show_in_website>
|
| 123 |
+
<show_in_store>1</show_in_store>
|
| 124 |
+
</enable_token>
|
| 125 |
<order_confirmation translate="label">
|
| 126 |
<label>Send Order Confirmation</label>
|
| 127 |
<frontend_type>select</frontend_type>
|
| 192 |
</groups>
|
| 193 |
</payment>
|
| 194 |
</sections>
|
| 195 |
+
</config>
|
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$this->startSetup();
|
| 4 |
+
|
| 5 |
+
$tableName = $this->getTable('everypay/token');
|
| 6 |
+
|
| 7 |
+
$table = $this->getConnection()
|
| 8 |
+
->newTable($tableName)
|
| 9 |
+
->addColumn('token_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null,
|
| 10 |
+
array(
|
| 11 |
+
'identity' => true,
|
| 12 |
+
'unsigned' => true,
|
| 13 |
+
'nullable' => false,
|
| 14 |
+
'primary' => true,
|
| 15 |
+
), 'Token Id')
|
| 16 |
+
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true), 'Customer ID')
|
| 17 |
+
->addColumn('cc_token', Varien_Db_Ddl_Table::TYPE_TEXT, 25, array(), 'Payment token')
|
| 18 |
+
->addColumn('cc_last_four_digits', Varien_Db_Ddl_Table::TYPE_NUMERIC, array(4,0), array('unsigned' => true), 'Last four digits')
|
| 19 |
+
->addColumn('cc_year', Varien_Db_Ddl_Table::TYPE_NUMERIC, array(4,0), array('unsigned' => true), 'Card expiration year (YYYY)')
|
| 20 |
+
->addColumn('cc_month', Varien_Db_Ddl_Table::TYPE_NUMERIC, array(2,0), array('unsigned' => true), 'Card expiration month (MM)')
|
| 21 |
+
->addColumn('cc_type', Varien_Db_Ddl_Table::TYPE_TEXT, 10, array(), 'Card type')
|
| 22 |
+
->addIndex(
|
| 23 |
+
$this->getIdxName($tableName, array('customer_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX), 'customer_id',
|
| 24 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
| 25 |
+
)
|
| 26 |
+
->addForeignKey(
|
| 27 |
+
$this->getFkName('everypay/token', 'customer_id', 'customer/entity', 'entity_id'), 'customer_id',
|
| 28 |
+
$this->getTable('customer/entity'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE,
|
| 29 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
| 30 |
+
)
|
| 31 |
+
;
|
| 32 |
+
$con = $this->getConnection()->createTable($table);
|
| 33 |
+
|
| 34 |
+
$this->endSetup();
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$this->getConnection()->addColumn($this->getTable('everypay/token'), 'is_default', array(
|
| 4 |
+
'type' => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
|
| 5 |
+
'unsigned' => true,
|
| 6 |
+
'nullable' => false,
|
| 7 |
+
'default' => 0,
|
| 8 |
+
'comment' => 'Default payment token'
|
| 9 |
+
));
|
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$this->getConnection()->modifyColumn(
|
| 4 |
+
$this->getTable('everypay/token'),
|
| 5 |
+
'cc_type',
|
| 6 |
+
array(
|
| 7 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
| 8 |
+
'length' => 11,
|
| 9 |
+
'nullable' => false,
|
| 10 |
+
'comment' => 'Card Type'
|
| 11 |
+
)
|
| 12 |
+
);
|
| 13 |
+
|
| 14 |
+
$this->getConnection()->modifyColumn(
|
| 15 |
+
$this->getTable('everypay/token'),
|
| 16 |
+
'cc_last_four_digits',
|
| 17 |
+
array(
|
| 18 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
| 19 |
+
'length' => 4,
|
| 20 |
+
'nullable' => false,
|
| 21 |
+
'comment' => 'Last 4 digits of credit card'
|
| 22 |
+
)
|
| 23 |
+
);
|
|
@@ -1,16 +1,5 @@
|
|
| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<layout version="0.1.0">
|
| 3 |
-
<everypay_everypay_redirect>
|
| 4 |
-
<reference name="content">
|
| 5 |
-
<block type="everypay/everypay" name="everypay" template="multon/everypay/everypay.phtml">
|
| 6 |
-
<block type="cms/block" name="everypay_description">
|
| 7 |
-
<action method="setBlockId">
|
| 8 |
-
<block_id>everypay_description</block_id>
|
| 9 |
-
</action>
|
| 10 |
-
</block>
|
| 11 |
-
</block>
|
| 12 |
-
</reference>
|
| 13 |
-
</everypay_everypay_redirect>
|
| 14 |
<default>
|
| 15 |
<reference name="head">
|
| 16 |
<block type="core/text" name="cdn.jquery">
|
|
@@ -23,4 +12,41 @@
|
|
| 23 |
<block type="everypay/info" name="everypay_info" template="multon/everypay/info.phtml" />
|
| 24 |
</reference>
|
| 25 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
</layout>
|
| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<layout version="0.1.0">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
<default>
|
| 4 |
<reference name="head">
|
| 5 |
<block type="core/text" name="cdn.jquery">
|
| 12 |
<block type="everypay/info" name="everypay_info" template="multon/everypay/info.phtml" />
|
| 13 |
</reference>
|
| 14 |
</default>
|
| 15 |
+
|
| 16 |
+
<everypay_everypay_redirect>
|
| 17 |
+
<reference name="content">
|
| 18 |
+
<block type="everypay/everypay" name="everypay" template="multon/everypay/everypay.phtml">
|
| 19 |
+
<block type="cms/block" name="everypay_description">
|
| 20 |
+
<action method="setBlockId">
|
| 21 |
+
<block_id>everypay_description</block_id>
|
| 22 |
+
</action>
|
| 23 |
+
</block>
|
| 24 |
+
</block>
|
| 25 |
+
</reference>
|
| 26 |
+
</everypay_everypay_redirect>
|
| 27 |
+
|
| 28 |
+
<customer_account>
|
| 29 |
+
<reference name="customer_account_navigation">
|
| 30 |
+
<action method="addLink" translate="label" module="everypay"><name>everypay</name><path>everypay/token/</path><label>Saved cards</label></action>
|
| 31 |
+
</reference>
|
| 32 |
+
</customer_account>
|
| 33 |
+
|
| 34 |
+
<everypay_token_index>
|
| 35 |
+
<update handle="customer_account"/>
|
| 36 |
+
<reference name="my.account.wrapper">
|
| 37 |
+
<block type="everypay/customer_token" name="everypay.customer.token">
|
| 38 |
+
<block type="core/text_list" name="everypay.customer.token.info" as="info" translate="label">
|
| 39 |
+
<label>Saved cards</label>
|
| 40 |
+
</block>
|
| 41 |
+
</block>
|
| 42 |
+
<block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
|
| 43 |
+
</reference>
|
| 44 |
+
</everypay_token_index>
|
| 45 |
+
|
| 46 |
+
<checkout_onepage_failure>
|
| 47 |
+
<reference name="content">
|
| 48 |
+
<block type="core/template" template="multon/everypay/link.phtml"/>
|
| 49 |
+
</reference>
|
| 50 |
+
</checkout_onepage_failure>
|
| 51 |
+
|
| 52 |
</layout>
|
|
@@ -1,16 +1,45 @@
|
|
| 1 |
<?php
|
| 2 |
-
$
|
|
|
|
| 3 |
|
| 4 |
-
if ($
|
| 5 |
{
|
| 6 |
?>
|
| 7 |
-
<iframe id="iframe-payment-container" name="iframe-payment-container" width="460" height="400"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
<?php } ?>
|
| 9 |
|
| 10 |
<div class="payment_everyay_container payment_method_everypay">
|
| 11 |
<?php echo $this->getChildHtml('everypay_everypay_description') ?>
|
| 12 |
<form
|
| 13 |
-
<?php if (!$
|
| 14 |
{
|
| 15 |
?>
|
| 16 |
id="GatewayForm" target="_top"
|
|
@@ -21,13 +50,13 @@ if ($type)
|
|
| 21 |
<?php } ?>
|
| 22 |
name="everypay" action="<?php echo $this->getGatewayUrl() ?>transactions/" method="POST">
|
| 23 |
<input type="image" src="<?php echo $this->getMethodLogoUrl(); ?>" onclick="this.form.submit()" class="payment-gateway-logo everypay_logo"/>
|
| 24 |
-
<?php foreach ($
|
| 25 |
{ ?>
|
| 26 |
<input type="hidden" name="<?php echo $key ?>" value="<?php echo $value ?>"/>
|
| 27 |
<?php } ?>
|
| 28 |
</form>
|
| 29 |
<?php
|
| 30 |
-
if (!$
|
| 31 |
echo $this->getQuickRedirectScript();
|
| 32 |
else
|
| 33 |
{
|
|
@@ -94,6 +123,13 @@ if ($type)
|
|
| 94 |
if (message.transaction_result === "completed")
|
| 95 |
{
|
| 96 |
window.location="<?php echo Mage::getUrl('checkout/onepage/success'); ?>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
}
|
| 98 |
}
|
| 99 |
}, false);
|
| 1 |
<?php
|
| 2 |
+
$fields = $this->getFields();
|
| 3 |
+
$useIframe = Mage::getStoreConfig('payment/multon_everypay/connection_type') || isset($fields['cc_token']);
|
| 4 |
|
| 5 |
+
if ($useIframe)
|
| 6 |
{
|
| 7 |
?>
|
| 8 |
+
<iframe id="iframe-payment-container" name="iframe-payment-container" width="460" height="400"
|
| 9 |
+
style="border: none; <?php if (isset($fields['cc_token'])) echo 'display: none'; ?>"
|
| 10 |
+
></iframe>
|
| 11 |
+
<div id="iframe-messages" <?php if (!isset($fields['cc_token'])) echo 'style="display: none"'; ?>>
|
| 12 |
+
<div class="page-title">
|
| 13 |
+
<h1 id="message_title"></h1>
|
| 14 |
+
</div>
|
| 15 |
+
<p id="message_error"></p>
|
| 16 |
+
<p id="message_action"></p>
|
| 17 |
+
<p id="message_contact"></p>
|
| 18 |
+
</div>
|
| 19 |
+
<div id="link-to-orders" style="display: none">
|
| 20 |
+
|
| 21 |
+
<?php
|
| 22 |
+
$order = $this->getOrder();
|
| 23 |
+
$isVisible = !in_array($order->getState(), Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
|
| 24 |
+
|
| 25 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible)
|
| 26 |
+
{
|
| 27 |
+
?>
|
| 28 |
+
<p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getUrl('sales/order/view/', array('order_id' => $order->getId()))), $this->escapeHtml($order->getIncrementId()))) ?></p>
|
| 29 |
+
<?php } else { ?>
|
| 30 |
+
<p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($order->getIncrementId())) ?></p>
|
| 31 |
+
<?php } ?>
|
| 32 |
+
|
| 33 |
+
<div class="buttons-set">
|
| 34 |
+
<button type="button" class="button" title="<?php echo $this->__('My previous orders') ?>" onclick="window.location='<?php echo $this->getUrl('sales/order/history') ?>'"><span><span><?php echo $this->__('My previous orders') ?></span></span></button>
|
| 35 |
+
</div>
|
| 36 |
+
</div>
|
| 37 |
<?php } ?>
|
| 38 |
|
| 39 |
<div class="payment_everyay_container payment_method_everypay">
|
| 40 |
<?php echo $this->getChildHtml('everypay_everypay_description') ?>
|
| 41 |
<form
|
| 42 |
+
<?php if (!$useIframe)
|
| 43 |
{
|
| 44 |
?>
|
| 45 |
id="GatewayForm" target="_top"
|
| 50 |
<?php } ?>
|
| 51 |
name="everypay" action="<?php echo $this->getGatewayUrl() ?>transactions/" method="POST">
|
| 52 |
<input type="image" src="<?php echo $this->getMethodLogoUrl(); ?>" onclick="this.form.submit()" class="payment-gateway-logo everypay_logo"/>
|
| 53 |
+
<?php foreach ($fields as $key => $value)
|
| 54 |
{ ?>
|
| 55 |
<input type="hidden" name="<?php echo $key ?>" value="<?php echo $value ?>"/>
|
| 56 |
<?php } ?>
|
| 57 |
</form>
|
| 58 |
<?php
|
| 59 |
+
if (!$useIframe)
|
| 60 |
echo $this->getQuickRedirectScript();
|
| 61 |
else
|
| 62 |
{
|
| 123 |
if (message.transaction_result === "completed")
|
| 124 |
{
|
| 125 |
window.location="<?php echo Mage::getUrl('checkout/onepage/success'); ?>";
|
| 126 |
+
} else
|
| 127 |
+
{
|
| 128 |
+
jQuery('#message_title').append(message.message_title);
|
| 129 |
+
jQuery('#message_error').append(message.message_error);
|
| 130 |
+
jQuery('#message_action').append(message.message_action);
|
| 131 |
+
jQuery('#message_contact').append(message.message_contact);
|
| 132 |
+
jQuery('#link-to-orders').show() // link to order history
|
| 133 |
}
|
| 134 |
}
|
| 135 |
}, false);
|
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="form-list everypay-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
|
| 2 |
+
<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 3 |
+
echo $this->__("To save your card securely for easy and faster payments in the future, please <a href=\"%s\">log in</a> to your account or create a <a href=\"%s\">new account</a>.",$this->getUrl('customer/account/login'),$this->getUrl('customer/account/create'));
|
| 4 |
+
} else {
|
| 5 |
+
?>
|
| 6 |
+
<script type="text/javascript">
|
| 7 |
+
function toggleCheckbox(onOff)
|
| 8 |
+
{
|
| 9 |
+
var box = $('save_token_box');
|
| 10 |
+
if (onOff)
|
| 11 |
+
box.show();
|
| 12 |
+
else
|
| 13 |
+
box.hide();
|
| 14 |
+
}
|
| 15 |
+
</script>
|
| 16 |
+
<?php
|
| 17 |
+
$tokens = $this->getTokens();
|
| 18 |
+
if (count($tokens))
|
| 19 |
+
{
|
| 20 |
+
?>
|
| 21 |
+
<ul>
|
| 22 |
+
<?php
|
| 23 |
+
$def = false;
|
| 24 |
+
foreach($tokens as $i => $token) {
|
| 25 |
+
if (
|
| 26 |
+
($token['cc_year'] < date('Y')) ||
|
| 27 |
+
(
|
| 28 |
+
($token['cc_year'] == date('Y')) &&
|
| 29 |
+
($token['cc_month'] < date('m'))
|
| 30 |
+
)
|
| 31 |
+
)
|
| 32 |
+
continue;
|
| 33 |
+
?>
|
| 34 |
+
<li>
|
| 35 |
+
<input type="radio" id="tok<?php echo $i ?>" name="payment[everypay_use_token]" value="<?php echo $token['cc_token']; ?>" onclick="toggleCheckbox(false)" <?php if ($token['is_default']) { echo 'checked="checked"'; $def=true; } ?>>
|
| 36 |
+
<label for="tok<?php echo $i ?>" style="float: none">
|
| 37 |
+
<img src="<?php echo $this->getSkinUrl('images/multon/everypay/'.$token['cc_type'].'.png'); ?>" alt="<?php echo $token['cc_type'] ?>" height="25px" />
|
| 38 |
+
**** **** **** <?php echo $token['cc_last_four_digits'] ?> (<?php echo $this->__('expires %02d/%4d', $token['cc_month'], $token['cc_year']) ?>)
|
| 39 |
+
</label>
|
| 40 |
+
</li>
|
| 41 |
+
<?php } ?>
|
| 42 |
+
<li>
|
| 43 |
+
<input type="radio" id="tokx" name="payment[everypay_use_token]" value="" onclick="toggleCheckbox(true)" <?php if (!$def) echo 'checked="checked"' ?>>
|
| 44 |
+
<label for="tokx" style="float: none"><?php echo $this->__('Use a new card') ?></label>
|
| 45 |
+
</li>
|
| 46 |
+
</ul>
|
| 47 |
+
<?php
|
| 48 |
+
}
|
| 49 |
+
?>
|
| 50 |
+
<p id="save_token_box" <?php if ($def) echo 'style="display:none"' ?>>
|
| 51 |
+
<input type="checkbox" name="payment[everypay_save_token]" value="1" id="save_token"> <label for="save_token"><?php echo $this->__('Save card securely') ?></label>
|
| 52 |
+
</p>
|
| 53 |
+
<?php } ?>
|
| 54 |
+
</div>
|
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="buttons-set">
|
| 2 |
+
<button type="button" class="button" title="<?php echo $this->__('My previous orders') ?>" onclick="window.location='<?php echo $this->getUrl('sales/order/history') ?>'"><span><span><?php echo $this->__('My previous orders') ?></span></span></button>
|
| 3 |
+
</div>
|
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
echo $this->getMessagesBlock()->getGroupedHtml();
|
| 3 |
+
$tokens = $this->getTokens();
|
| 4 |
+
?>
|
| 5 |
+
<div class="page-title">
|
| 6 |
+
<h1><?php echo $this->__('Saved cards') ?></h1>
|
| 7 |
+
</div>
|
| 8 |
+
<?php
|
| 9 |
+
echo $this->getPagerHtml();
|
| 10 |
+
if($tokens->getSize()) {
|
| 11 |
+
?>
|
| 12 |
+
<table class="data-table" id="my-tokens-table">
|
| 13 |
+
<thead>
|
| 14 |
+
<tr>
|
| 15 |
+
<th><?php echo $this->__('Card type') ?></th>
|
| 16 |
+
<th><?php echo $this->__('Card number') ?></th>
|
| 17 |
+
<th><?php echo $this->__('Expires') ?></th>
|
| 18 |
+
<th> </th>
|
| 19 |
+
<th> </th>
|
| 20 |
+
</tr>
|
| 21 |
+
</thead>
|
| 22 |
+
<tbody>
|
| 23 |
+
<?php
|
| 24 |
+
$_odd = '';
|
| 25 |
+
foreach ($tokens as $token)
|
| 26 |
+
{
|
| 27 |
+
$expired = false;
|
| 28 |
+
if (
|
| 29 |
+
($token->getCcYear() < date('Y')) ||
|
| 30 |
+
(
|
| 31 |
+
($token->getCcYear() == date('Y')) &&
|
| 32 |
+
($token->getCcMonth() < date('m'))
|
| 33 |
+
)
|
| 34 |
+
)
|
| 35 |
+
$expired = true;
|
| 36 |
+
?>
|
| 37 |
+
<tr>
|
| 38 |
+
<td><img src="<?php echo $this->getSkinUrl('images/multon/everypay/'.$token->getCcType().'.png'); ?>" alt="<?php echo $token->getCcType() ?>" height="25px" /></td>
|
| 39 |
+
<td <?php if ($expired) echo 'style="color: red"'; ?> > **** **** **** <?php echo $token->getCcLastFourDigits() ?></td>
|
| 40 |
+
<td <?php if ($expired) echo 'style="color: red"'; ?> ><?php printf('%02d', $token->getCcMonth()) ?>/<?php echo $token->getCcYear() ?></td>
|
| 41 |
+
<td class="a-center">
|
| 42 |
+
<?php if ($token->getIsDefault()) {
|
| 43 |
+
echo $this->__('Default');
|
| 44 |
+
} else { ?>
|
| 45 |
+
<span class="nobr">
|
| 46 |
+
<a href="<?php echo $this->getUrl('everypay/token/setDefault') ?>token/<?php echo $token->getId() ?>"><?php echo $this->__('Set as default') ?></a>
|
| 47 |
+
</span>
|
| 48 |
+
<?php } ?>
|
| 49 |
+
</td>
|
| 50 |
+
<td class="a-center">
|
| 51 |
+
<span class="nobr">
|
| 52 |
+
<a href="#" onclick="return deleteToken('<?php echo $token->getId() ?>');" class="red-link"><?php echo $this->__('Delete') ?></a>
|
| 53 |
+
</span>
|
| 54 |
+
</td>
|
| 55 |
+
</tr>
|
| 56 |
+
<?php } ?>
|
| 57 |
+
</tbody>
|
| 58 |
+
</table>
|
| 59 |
+
<script type="text/javascript">
|
| 60 |
+
decorateTable('my-tokens-table');
|
| 61 |
+
|
| 62 |
+
function deleteToken(tokenId) {
|
| 63 |
+
if (confirm('<?php echo $this->__('Are you sure you want to delete this token?') ?>'))
|
| 64 |
+
{
|
| 65 |
+
window.location='<?php echo $this->getUrl('everypay/token/delete') ?>token/'+tokenId;
|
| 66 |
+
}
|
| 67 |
+
return false;
|
| 68 |
+
}
|
| 69 |
+
</script>
|
| 70 |
+
<?php
|
| 71 |
+
echo $this->getPagerHtml();
|
| 72 |
+
} else { ?>
|
| 73 |
+
<p><?php echo $this->__('You have no saved cards.'); ?></p>
|
| 74 |
+
<?php } ?>
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"Save card securely","Salvesta kaart turvaliselt"
|
| 2 |
+
"expires %02d/%4d","aegub %02d/%4d"
|
| 3 |
+
"Use a new card","Kasuta uut kaarti"
|
| 4 |
+
"Saved cards","Salvestatud kaardid"
|
| 5 |
+
"Manage saved cards","Halda salvestatud kaarte"
|
| 6 |
+
"Card type","Kaardi tüüp"
|
| 7 |
+
"Card number","Kaardi number"
|
| 8 |
+
"Expires","Aegub"
|
| 9 |
+
"Default","Vaikimisi"
|
| 10 |
+
"Set as default","Kasuta vaikimisi"
|
| 11 |
+
"Delete","Kustuta"
|
| 12 |
+
"Are you sure you want to delete this token?","Olete kindel, et soovite selle kaardi kustutada?"
|
| 13 |
+
"You have no saved cards.","Teil ei ole salvestatud kaarte"
|
| 14 |
+
"Enable payments with saved cards","Võimalda maksed salvestatud kaartidega"
|
| 15 |
+
"To save your card securely for easy and faster payments in the future, please <a href=""%s"">log in</a> to your account or create a <a href=""%s"">new account</a>.","Selleks, et oma kaardiandmed turvaliselt salvestada ning tulevikus teostada makseid lihtsalt ja kiirelt, palun <a href=""%s"">sisene</a> enda kontole või loo <a href=""%s"">uus konto</a>."
|
| 16 |
+
"My previous orders","Minu eelmised tellimused"
|
|
@@ -1,15 +1,35 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>multon_everypay</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Multon Everypay</summary>
|
| 10 |
<description>Multon Everypay</description>
|
| 11 |
-
<notes>1.
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |

|
| 14 |
1.2.5
|
| 15 |
FIX: removed newline in multiline street data
|
|
@@ -60,9 +80,9 @@ FIX: redirect template
|
|
| 60 |
1.0.0
|
| 61 |
Stable release</notes>
|
| 62 |
<authors><author><name>Multon</name><user>eepohs</user><email>magento@multon.ee</email></author><author><name>Jaanus Vapper</name><user>hullkuri</user><email>hullkuri@gmail.com</email></author><author><name>Tanel Raja</name><user>Pronto</user><email>tanel.raja@gmail.com</email></author></authors>
|
| 63 |
-
<date>2015-12-
|
| 64 |
-
<time>
|
| 65 |
-
<contents><target name="magecommunity"><dir name="Multon"><dir name="Everypay"><dir name="Block"><dir name="Adminhtml"><file name="Fieldset.php" hash="324c82a14594133019deef5c98e8ec78"/><dir name="System"><dir name="Config"><file name="Intro.php" hash="25a5c87ee274de259ede0decc040f643"/><file name="Outro.php" hash="21e9865c5f85cc0c8a601cc171d3f5d0"/><file name="Version.php" hash="63d888085e44f1b99e77aec70f12f62a"/></dir></dir></dir><file name="Everypay.php" hash="
|
| 66 |
<compatible/>
|
| 67 |
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
| 68 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>multon_everypay</name>
|
| 4 |
+
<version>1.3.6</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Multon Everypay</summary>
|
| 10 |
<description>Multon Everypay</description>
|
| 11 |
+
<notes>1.3.6
|
| 12 |
+
- show error messages and last order number on payment failure
|
| 13 |
+
- visual changes
|
| 14 |
+

|
| 15 |
+
1.3.5
|
| 16 |
+
- don't show expired tokens in checkout
|
| 17 |
+
- use iframe method with token payment even if redirect method configured
|
| 18 |
+
- link to order history on checkout failure page
|
| 19 |
+

|
| 20 |
+
1.3.4
|
| 21 |
+
- card type logos in checkout
|
| 22 |
+
- separate callback url
|
| 23 |
+
- verify order number
|
| 24 |
+

|
| 25 |
+
1.3.3
|
| 26 |
+
- card type logos in token handling
|
| 27 |
+
- FIX: token duplicate check
|
| 28 |
+
- FIX: default token change
|
| 29 |
+

|
| 30 |
+
1.3.2
|
| 31 |
+
- Saved cards/token handling
|
| 32 |
+
- Saved cards/token payment
|
| 33 |

|
| 34 |
1.2.5
|
| 35 |
FIX: removed newline in multiline street data
|
| 80 |
1.0.0
|
| 81 |
Stable release</notes>
|
| 82 |
<authors><author><name>Multon</name><user>eepohs</user><email>magento@multon.ee</email></author><author><name>Jaanus Vapper</name><user>hullkuri</user><email>hullkuri@gmail.com</email></author><author><name>Tanel Raja</name><user>Pronto</user><email>tanel.raja@gmail.com</email></author></authors>
|
| 83 |
+
<date>2015-12-30</date>
|
| 84 |
+
<time>13:24:29</time>
|
| 85 |
+
<contents><target name="magecommunity"><dir name="Multon"><dir name="Everypay"><dir name="Block"><dir name="Adminhtml"><file name="Fieldset.php" hash="324c82a14594133019deef5c98e8ec78"/><dir name="System"><dir name="Config"><file name="Intro.php" hash="25a5c87ee274de259ede0decc040f643"/><file name="Outro.php" hash="21e9865c5f85cc0c8a601cc171d3f5d0"/><file name="Version.php" hash="63d888085e44f1b99e77aec70f12f62a"/></dir></dir></dir><dir name="Customer"><file name="Token.php" hash="0a2ac90e46d7b58c9e81c730c3c72f58"/></dir><file name="Everypay.php" hash="85ee8f94d595a6fbdcc31ae736e7f6de"/><file name="Form.php" hash="fd13823c3435792c84d17f498c3c5461"/><file name="Info.php" hash="4755af2b544c9f5de39098046e6da0fb"/></dir><dir name="Helper"><file name="Data.php" hash="b30009b1c08d4c4e798ab717d69b0468"/></dir><dir name="Model"><file name="Everypay.php" hash="8b249b45ed688c048a9f537e7583f4ec"/><dir name="Resource"><dir name="Token"><file name="Collection.php" hash="44a5139db44ea7d7fbf11ef604879c1b"/></dir><file name="Token.php" hash="ac8e40281383dadae78afada6fafaeab"/></dir><dir name="Source"><file name="ApiUrl.php" hash="e1b55560b85996fccd3492d45f02844f"/><file name="ConnectionType.php" hash="0857dfbb0deee17ca3459dc2bf5f8569"/><file name="PaymentAction.php" hash="27787205d1886997aeccecb4028d488f"/></dir><file name="Token.php" hash="10c74bf2db00665a00bd0b3fa153d73d"/></dir><dir name="controllers"><file name="EverypayController.php" hash="bd3537d58711c43cfe95e910b5b05e60"/><file name="TokenController.php" hash="92d411f00972a19b418a2bfb083c095b"/></dir><dir name="etc"><file name="config.xml" hash="942b1f4b0ff16508d0658a2c84e1040c"/><file name="system.xml" hash="a25348e537657dec3afcca2bc7441e54"/></dir><dir name="sql"><dir name="everypay_setup"><file name="install-1.0.0.php" hash="201924647c609f33835712ab2c81e4d4"/><file name="upgrade-1.2.0-1.2.1.php" hash="1ff58987d6575a8c018e80fc600897bd"/><file name="upgrade-1.2.5-1.3.0.php" hash="cd85a057eb95ed1159aa563a62a3ad3e"/><file name="upgrade-1.3.0-1.3.1.php" hash="8af504ab53bf91dbd71ac11c7a240959"/><file name="upgrade-1.3.2-1.3.3.php" hash="f8008edc166d264d6be8e32edc3c471b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Multon_Everypay.xml" hash="99a2dd0a396a3a1b937d767e48ce237f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="multon"><file name="everypay.xml" hash="749125ff359cc8b59576fbe0626c2e9f"/></dir></dir><dir name="template"><dir name="multon"><dir name="everypay"><file name="everypay.phtml" hash="1129761bb8052ff72cb2f184eb2db62b"/><file name="form.phtml" hash="7579dca8cd189978493db9bfdda7e1f1"/><file name="info.phtml" hash="91eb9c88527bc6b0076f382df0f6809c"/><file name="link.phtml" hash="07568d519f18c363c3910a862cc3039e"/><file name="tokens.phtml" hash="518b3aeb47eb4126e743a0b5188aec51"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="multon"><dir name="everypay"><file name="master_card.png" hash="cf5e00ccdfb963017e2557b0564b1e61"/><file name="mastercard_visa_acceptance.png" hash="d448d1eff4e623c1b35c67ad80c189fb"/><file name="visa.png" hash="e74115ef4a8f92e96a59a30be03189e5"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="everypay-logo.jpg" hash="909c46f5e89be9de1d0d2ad7fdfb8bc6"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="et_EE"><file name="Multon_Everypay.csv" hash="e19e10cc89d991bd075d18ebb2bd667d"/></dir></target></contents>
|
| 86 |
<compatible/>
|
| 87 |
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
| 88 |
</package>
|
|
Binary file
|
|
Binary file
|
