Version Notes
Please note: After upgrading, the eWAY Rapid payment option will need to be re-enabled.
New Features
- eWAY Rapid IFrame payment method
- Visa Checkout integration
- Saved cards can now be added and edited in the Magento back office
- eWAY Order View - a new report in the Magento back office with details eWAY order information such as Beagle Score and Fraud Actions
- New Responsive Shared Page options:
- Beagle Verify Phone & Email verification
- Choose from one of 13 themes
- Option to pass the Invoice Number & invoice description (an abbreviated list of items) to eWAY
Improvements
- Saved cards are now integrated into the credit card form instead of a separate payment option
- Beagle Score and Beagle Verify displayed in order information if enabled
- If a hosted form is selected as a payment method, the eWAY Rapid IFrame will also be used when placing orders in the back office for additional security
- PayPal & MasterPass now use their appropriate logos
Bug Fixes
- Fix for Transparent Redirect disabling other payment methods
- Fix for some multi-shipping checkout errors
- Fix for invalid responses creating orders (AMEX multi-currency error)
- Fix for some orders failing when no shipping address is present
- Fix for the initial fee sometimes not charging with Recurring Profiles
- Fix for billing address being used for shipping address for some guest checkouts
Release Info
Developer | eWAY Payments |
Extension | eWAY_Payment_Rapid31 |
Version | 1.4.0 |
Comparing to | |
See all releases |
Code changes from version 1.3.2 to 1.4.0
- app/code/community/Eway/Rapid31/Block/Admin/Version.php +7 -7
- app/code/community/Eway/Rapid31/Block/Adminhtml/Customer/Edit/Tab/Cards.php +54 -0
- app/code/community/Eway/Rapid31/Block/Adminhtml/Customer/Edit/Tab/Form.php +105 -0
- app/code/community/Eway/Rapid31/Block/Adminhtml/Customer/Method.php +33 -0
- app/code/community/Eway/Rapid31/Block/Adminhtml/Customer/Savedcard.php +70 -0
- app/code/community/Eway/Rapid31/Block/Adminhtml/Sales/Order.php +12 -0
- app/code/community/Eway/Rapid31/Block/Adminhtml/Sales/Order/Grid.php +188 -0
- app/code/community/Eway/Rapid31/Block/Adminhtml/Sales/Order/Renderer/Items.php +19 -0
- app/code/community/Eway/Rapid31/Block/Form/Direct/Ewayone.php +58 -0
- app/code/community/Eway/Rapid31/Block/Form/Sharedpage/Ewayone.php +54 -0
- app/code/community/Eway/Rapid31/Block/Form/Sharedpage/Notsaved.php +3 -1
- app/code/community/Eway/Rapid31/Block/Form/Transparent/Ewayone.php +91 -0
- app/code/community/Eway/Rapid31/Block/Html/Head.php +83 -0
- app/code/community/Eway/Rapid31/Block/Info/Direct/Ewayone.php +45 -0
- app/code/community/Eway/Rapid31/Block/Info/Sharedpage/Ewayone.php +45 -0
- app/code/community/Eway/Rapid31/Block/Info/Transparent/Ewayone.php +46 -0
- app/code/community/Eway/Rapid31/Block/Redirect/Transparent.php +1 -1
- app/code/community/Eway/Rapid31/Block/Redirect/TransparentCheckout.php +6 -1
- app/code/community/Eway/Rapid31/Helper/Customer.php +8 -0
- app/code/community/Eway/Rapid31/Helper/Data.php +78 -2
- app/code/community/Eway/Rapid31/Model/Config.php +57 -0
- app/code/community/Eway/Rapid31/Model/EwayCron.php +1 -1
- app/code/community/Eway/Rapid31/Model/Method/Ewayone.php +433 -0
- app/code/community/Eway/Rapid31/Model/Method/Notsaved.php +59 -8
- app/code/community/Eway/Rapid31/Model/Method/Saved.php +2 -2
- app/code/community/Eway/Rapid31/Model/Observer.php +292 -292
- app/code/community/Eway/Rapid31/Model/RecurringProfile.php +5 -2
- app/code/community/Eway/Rapid31/Model/Request/Abstract.php +179 -155
- app/code/community/Eway/Rapid31/Model/Request/Direct.php +339 -270
- app/code/community/Eway/Rapid31/Model/Request/Sharedpage.php +638 -532
- app/code/community/Eway/Rapid31/Model/Request/Token.php +543 -524
- app/code/community/Eway/Rapid31/Model/Request/Transparent.php +751 -693
- app/code/community/Eway/Rapid31/Model/Resource/Setup.php +4 -0
- app/code/community/Eway/Rapid31/Model/Response.php +51 -0
- app/code/community/Eway/Rapid31/Model/System/Config/Source/ConnectionType.php +3 -0
- app/code/community/Eway/Rapid31/Model/System/Config/Source/CustomView.php +66 -0
- app/code/community/Eway/Rapid31/Model/System/Config/Source/NoYes.php +16 -0
- app/code/community/Eway/Rapid31/controllers/Adminhtml/EwayadminController.php +20 -3
- app/code/community/Eway/Rapid31/controllers/Adminhtml/Ewayrapid/SavedcardController.php +301 -0
- app/code/community/Eway/Rapid31/controllers/Adminhtml/Sales/Order/CreateController.php +303 -0
- app/code/community/Eway/Rapid31/controllers/MycardsController.php +17 -17
- app/code/community/Eway/Rapid31/controllers/SharedpageController.php +184 -9
- app/code/community/Eway/Rapid31/controllers/TransparentController.php +94 -7
- app/code/community/Eway/Rapid31/etc/config.xml +58 -2
- app/code/community/Eway/Rapid31/etc/system.xml +170 -67
- app/code/community/Eway/Rapid31/sql/ewayrapid_setup/install-0.1.0.php +18 -18
- app/code/community/Eway/Rapid31/sql/ewayrapid_setup/upgrade-0.1.0-1.0.0.php +18 -18
- app/code/community/Eway/Rapid31/sql/ewayrapid_setup/upgrade-1.0.0-1.0.1.php +40 -40
- app/code/community/Eway/Rapid31/sql/ewayrapid_setup/upgrade-1.0.1-1.0.3.php +31 -31
- app/code/community/Eway/Rapid31/sql/ewayrapid_setup/upgrade-1.3.2-1.4.0.php +118 -0
- app/design/adminhtml/default/default/layout/ewayrapid/layout.xml +63 -1
- app/design/adminhtml/default/default/template/ewayrapid/customer/cardcontainer.phtml +1 -0
- app/design/adminhtml/default/default/template/ewayrapid/customer/edit/tab/cards.phtml +36 -0
- app/design/adminhtml/default/default/template/ewayrapid/customer/edit/tab/form.phtml +218 -0
- app/design/adminhtml/default/default/template/ewayrapid/customer/method.phtml +175 -0
- app/design/adminhtml/default/default/template/ewayrapid/form/direct_ewayone.phtml +181 -0
- app/design/adminhtml/default/default/template/ewayrapid/form/direct_notsaved.phtml +12 -2
- app/design/adminhtml/default/default/template/ewayrapid/form/direct_saved.phtml +1 -2
- app/design/adminhtml/default/default/template/ewayrapid/form/sharedpage_ewayone.phtml +87 -0
- app/design/adminhtml/default/default/template/ewayrapid/form/sharedpage_notsaved.phtml +28 -0
- app/design/adminhtml/default/default/template/ewayrapid/info/direct_ewayone.phtml +90 -0
- app/design/adminhtml/default/default/template/ewayrapid/info/direct_notsaved.phtml +28 -2
- app/design/adminhtml/default/default/template/ewayrapid/info/direct_saved.phtml +27 -2
- app/design/adminhtml/default/default/template/ewayrapid/info/sharedpage_notsaved.phtml +103 -0
- app/design/adminhtml/default/default/template/ewayrapid/info/sharedpage_saved.phtml +103 -0
- app/design/adminhtml/default/default/template/ewayrapid/pdf/direct_notsaved.phtml +1 -2
- app/design/frontend/base/default/layout/ewayrapid/layout.xml +22 -8
- app/design/frontend/base/default/template/ewayrapid/customer/edit.phtml +95 -4
- app/design/frontend/base/default/template/ewayrapid/form/direct_ewayone.phtml +172 -0
- app/design/frontend/base/default/template/ewayrapid/form/direct_notsaved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/form/direct_saved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/form/sharedpage_ewayone.phtml +87 -0
- app/design/frontend/base/default/template/ewayrapid/form/sharedpage_notsaved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/form/sharedpage_saved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/form/transparent_ewayone.phtml +374 -0
- app/design/frontend/base/default/template/ewayrapid/form/transparent_saved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/info/direct_ewayone.phtml +38 -0
- app/design/frontend/base/default/template/ewayrapid/info/direct_notsaved.phtml +0 -1
- app/design/frontend/base/default/template/ewayrapid/info/direct_saved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/info/sharedpage_ewayone.phtml +38 -0
- app/design/frontend/base/default/template/ewayrapid/info/sharedpage_notsaved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/info/sharedpage_saved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/info/transparent_ewayone.phtml +38 -0
- app/design/frontend/base/default/template/ewayrapid/info/transparent_notsaved.phtml +1 -2
- app/design/frontend/base/default/template/ewayrapid/js.phtml +741 -306
- app/design/frontend/base/default/template/ewayrapid/redirect/transparent.phtml +0 -1
- app/design/frontend/base/default/template/ewayrapid/redirect/transparent_checkout.phtml +5 -0
- js/ewayrapid/eCrypt.js +0 -1021
- js/ewayrapid/eWAY_Payment_Rapid31.xml +0 -145
- js/ewayrapid/ewayrapid.js +1327 -764
- package.xml +30 -5
- skin/frontend/base/default/css/ewayrapid.css +73 -1
- skin/frontend/base/default/images/masterpass.png +0 -0
- skin/frontend/base/default/images/paypal_button.png +0 -0
- skin/frontend/base/default/images/visa_checkout.png +0 -0
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
class Eway_Rapid31_Block_Admin_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
-
{
|
4 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
-
{
|
6 |
-
return (string) Mage::helper('ewayrapid')->getExtensionVersion();
|
7 |
-
}
|
8 |
}
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Admin_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
return (string) Mage::helper('ewayrapid')->getExtensionVersion();
|
7 |
+
}
|
8 |
}
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Adminhtml_Customer_Edit_Tab_Cards extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
protected $_code = 'ewayrapid';
|
5 |
+
protected $_addressModel = null;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Get stored cards for the currently-active method.
|
9 |
+
*/
|
10 |
+
public function getCards()
|
11 |
+
{
|
12 |
+
$customer = Mage::registry('current_customer');
|
13 |
+
if($customer && $customer->getSavedTokens()){
|
14 |
+
return $customer->getSavedTokens()->getTokens();
|
15 |
+
}else{
|
16 |
+
return array();
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _getAddressModel(){
|
21 |
+
if(!$this->_addressModel){
|
22 |
+
$this->_addressModel = Mage::getModel('customer/address');
|
23 |
+
}
|
24 |
+
|
25 |
+
return $this->_addressModel;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get the current method code.
|
30 |
+
*/
|
31 |
+
public function getCode()
|
32 |
+
{
|
33 |
+
if( parent::hasCode() ) {
|
34 |
+
return parent::getCode();
|
35 |
+
}
|
36 |
+
|
37 |
+
return $this->_code;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function formatAddress($address){
|
41 |
+
$this->_getAddressModel()->unsetData();
|
42 |
+
$this->_getAddressModel()->addData($address->getData());
|
43 |
+
return $this->_getAddressModel()->format('html');
|
44 |
+
}
|
45 |
+
|
46 |
+
public function checkCards(){
|
47 |
+
foreach($this->getCards() as $card){
|
48 |
+
if($card->getActive()){
|
49 |
+
return true;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
}
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eway_Rapid31_Block_Adminhtml_Customer_Edit_Tab_Form extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
protected $_code = 'ewayrapid';
|
6 |
+
protected $_card = null;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Get the address block for dynamic state/country selection on forms.
|
10 |
+
*/
|
11 |
+
public function getAddressBlock()
|
12 |
+
{
|
13 |
+
return Mage::helper('ewayrapid')->getAddressBlock();
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Return active card (if any).
|
18 |
+
*/
|
19 |
+
public function getCard()
|
20 |
+
{
|
21 |
+
if(!$this->_card){
|
22 |
+
$tokenId = $this->getTokenId();
|
23 |
+
if($tokenId && $tokenId > 0){
|
24 |
+
$tokens = Mage::registry('current_customer')->getSavedTokens();
|
25 |
+
$this->_card = $tokens->getTokenById($tokenId);
|
26 |
+
}else{
|
27 |
+
$token = new Varien_Object();
|
28 |
+
$address = new Varien_Object();
|
29 |
+
$addressInfo = array(
|
30 |
+
'token_customer_id' => '',
|
31 |
+
'reference' => '',
|
32 |
+
'title' => '',
|
33 |
+
'first_name' => '',
|
34 |
+
'last_name' => '',
|
35 |
+
'company_name' => '',
|
36 |
+
'job_description' => '',
|
37 |
+
'street_1' => '',
|
38 |
+
'street_2' => '',
|
39 |
+
'city' => '',
|
40 |
+
'state' => '',
|
41 |
+
'postal_code' => '',
|
42 |
+
'country' => 'us',
|
43 |
+
'email' => '',
|
44 |
+
'phone' => '',
|
45 |
+
'mobile' => '',
|
46 |
+
'comments' => '',
|
47 |
+
'fax' => '',
|
48 |
+
'url' => '',
|
49 |
+
'region_id' => ''
|
50 |
+
);
|
51 |
+
$address->addData($addressInfo);
|
52 |
+
|
53 |
+
$tokenInfo = array(
|
54 |
+
'token' => '',
|
55 |
+
'card' => '',
|
56 |
+
'owner' => '',
|
57 |
+
'exp_month' => '',
|
58 |
+
'exp_year' => '',
|
59 |
+
// 'Type' => 'a',
|
60 |
+
'address' => $address,
|
61 |
+
'active' => 0
|
62 |
+
);
|
63 |
+
$token->addData($tokenInfo);
|
64 |
+
$this->_card = $token;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
return $this->_card;
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getRegionId(){
|
72 |
+
$region = Mage::getModel('directory/region')->loadByName($this->getCard()->getAddress()->getState(), $this->getCard()->getAddress()->getData('Country'));
|
73 |
+
return $region->getId();
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Get the current method code.
|
78 |
+
*/
|
79 |
+
public function getCode()
|
80 |
+
{
|
81 |
+
if( parent::hasCode() ) {
|
82 |
+
return parent::getCode();
|
83 |
+
}
|
84 |
+
|
85 |
+
return $this->_code;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Return whether or not this is a card edit.
|
90 |
+
*/
|
91 |
+
public function isEdit()
|
92 |
+
{
|
93 |
+
return ($this->getCard() && $this->getCard()->getToken());
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Retrieve array of prefix that accepted by eWAY
|
98 |
+
*
|
99 |
+
* @return array
|
100 |
+
*/
|
101 |
+
public function getPrefixOptions()
|
102 |
+
{
|
103 |
+
return array('', 'Mr.', 'Ms.', 'Mrs.', 'Miss', 'Dr.', 'Sir.', 'Prof.');
|
104 |
+
}
|
105 |
+
}
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Adminhtml_Customer_Method extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
protected $_code = 'ewayrapid';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Get the current method code.
|
8 |
+
*/
|
9 |
+
public function getCode()
|
10 |
+
{
|
11 |
+
if( parent::hasCode() ) {
|
12 |
+
return parent::getCode();
|
13 |
+
}
|
14 |
+
|
15 |
+
return $this->_code;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Return whether or not this is an AJAX request.
|
20 |
+
*/
|
21 |
+
public function isAjax()
|
22 |
+
{
|
23 |
+
return ( $this->getRequest()->getParam('isAjax') == 1 ) ? true : false;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Return the current customer record.
|
28 |
+
*/
|
29 |
+
public function getCustomer()
|
30 |
+
{
|
31 |
+
return Mage::registry('current_customer');
|
32 |
+
}
|
33 |
+
}
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Adminhtml customer action tab
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class Eway_Rapid31_Block_Adminhtml_Customer_Savedcard extends Mage_Adminhtml_Block_Template
|
8 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
9 |
+
{
|
10 |
+
|
11 |
+
public function getCustomtabInfo()
|
12 |
+
{
|
13 |
+
$customer = Mage::registry('current_customer');
|
14 |
+
$customtab = 'Customer Saved Cards';
|
15 |
+
return $customtab;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Return Tab label
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function getTabLabel()
|
24 |
+
{
|
25 |
+
return $this->__('Saved Cards');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Return Tab title
|
30 |
+
*
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public function getTabTitle()
|
34 |
+
{
|
35 |
+
return $this->__('Saved Cards');
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Can show tab in tabs
|
40 |
+
*
|
41 |
+
* @return boolean
|
42 |
+
*/
|
43 |
+
public function canShowTab()
|
44 |
+
{
|
45 |
+
$customer = Mage::registry('current_customer');
|
46 |
+
|
47 |
+
$saveCardEnable = Mage::helper('ewayrapid')->isSavedMethodEnabled();
|
48 |
+
return (bool)$customer->getId() && $saveCardEnable;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Tab is hidden
|
53 |
+
*
|
54 |
+
* @return boolean
|
55 |
+
*/
|
56 |
+
public function isHidden()
|
57 |
+
{
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Defines after which tab, this tab should be rendered
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function getAfter()
|
67 |
+
{
|
68 |
+
return 'tags';
|
69 |
+
}
|
70 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Adminhtml_Sales_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_blockGroup = 'ewayrapid';
|
7 |
+
$this->_controller = 'adminhtml_sales_order';
|
8 |
+
$this->_headerText = Mage::helper('ewayrapid')->__('Eway Orders');
|
9 |
+
parent::__construct();
|
10 |
+
$this->_removeButton('add');
|
11 |
+
}
|
12 |
+
}
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
const CAPTURED = 1;
|
5 |
+
const NOT_CAPTURED = 0;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
$this->setId('eway_order_grid');
|
11 |
+
$this->setUseAjax(true);
|
12 |
+
$this->setDefaultSort('created_at');
|
13 |
+
$this->setDefaultDir('DESC');
|
14 |
+
$this->setSaveParametersInSession(true);
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function _getCollectionClass()
|
18 |
+
{
|
19 |
+
return 'sales/order_grid_collection';
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Set the orders to display
|
24 |
+
*
|
25 |
+
* @return $this
|
26 |
+
*/
|
27 |
+
protected function _prepareCollection()
|
28 |
+
{
|
29 |
+
// Test that the eWAY columns are present
|
30 |
+
$resource = Mage::getSingleton('core/resource');
|
31 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
32 |
+
$table = $resource->getTableName('sales/order_payment');
|
33 |
+
$rows = $connection->fetchAll("SHOW COLUMNS FROM `{$table}` LIKE 'fraud_action'");
|
34 |
+
|
35 |
+
if (empty($rows)) {
|
36 |
+
echo '<div id="messages"><ul class="messages"><li class="error-msg"><ul><li><span>Error fetching eWAY orders, please check the eWAY extension is properly installed.</span></li></ul></li></ul></div>';
|
37 |
+
return parent::_prepareCollection();
|
38 |
+
}
|
39 |
+
|
40 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
41 |
+
|
42 |
+
$ewayMethodCodes = array(
|
43 |
+
Mage::getModel('ewayrapid/method_notsaved')->getCode(),
|
44 |
+
Mage::getModel('ewayrapid/method_saved')->getCode(),
|
45 |
+
Mage::getModel('ewayrapid/method_ewayone')->getCode()
|
46 |
+
);
|
47 |
+
|
48 |
+
// Add payment method to filter
|
49 |
+
$collection->getSelect()->join(
|
50 |
+
array('payment' => $resource->getTableName('sales/order_payment')),
|
51 |
+
'main_table.entity_id=payment.parent_id',
|
52 |
+
array(
|
53 |
+
'payment_method' => 'payment.method',
|
54 |
+
'fraud_action' => 'payment.fraud_action',
|
55 |
+
'fraud_codes' => 'payment.fraud_codes',
|
56 |
+
'transaction_captured' => 'payment.transaction_captured',
|
57 |
+
'beagle_score' => 'payment.beagle_score'
|
58 |
+
)
|
59 |
+
);
|
60 |
+
|
61 |
+
$collection->addFieldToFilter('payment.method',array('in' => $ewayMethodCodes));
|
62 |
+
|
63 |
+
$this->setCollection($collection);
|
64 |
+
return parent::_prepareCollection();
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function _prepareColumns()
|
68 |
+
{
|
69 |
+
|
70 |
+
$this->addColumn('real_order_id', array(
|
71 |
+
'header'=> Mage::helper('ewayrapid')->__('Magento Order ID'),
|
72 |
+
'width' => '80px',
|
73 |
+
'type' => 'text',
|
74 |
+
'index' => 'increment_id',
|
75 |
+
));
|
76 |
+
|
77 |
+
$this->addColumn('items_ordered', array(
|
78 |
+
'header' => Mage::helper('ewayrapid')->__('Item(s) Ordered'),
|
79 |
+
'index' => 'entity_id',
|
80 |
+
'renderer' => 'Eway_Rapid31_Block_Adminhtml_Sales_Order_Renderer_Items',
|
81 |
+
'filter_condition_callback' => array($this, '_itemsFilter'),
|
82 |
+
));
|
83 |
+
|
84 |
+
$this->addColumn('created_at', array(
|
85 |
+
'header' => Mage::helper('ewayrapid')->__('Purchased On'),
|
86 |
+
'index' => 'created_at',
|
87 |
+
'type' => 'datetime',
|
88 |
+
'width' => '100px',
|
89 |
+
));
|
90 |
+
|
91 |
+
$this->addColumn('billing_name', array(
|
92 |
+
'header' => Mage::helper('ewayrapid')->__('Bill to Name'),
|
93 |
+
'index' => 'billing_name',
|
94 |
+
));
|
95 |
+
|
96 |
+
$this->addColumn('beagle_score', array(
|
97 |
+
'header' => Mage::helper('ewayrapid')->__('Beagle Score'),
|
98 |
+
'index' => 'beagle_score',
|
99 |
+
));
|
100 |
+
|
101 |
+
$this->addColumn('fraud_action', array(
|
102 |
+
'header' => Mage::helper('ewayrapid')->__('Fraud Action'),
|
103 |
+
'index' => 'fraud_action',
|
104 |
+
));
|
105 |
+
|
106 |
+
$this->addColumn('transaction_captured', array(
|
107 |
+
'header' => Mage::helper('ewayrapid')->__('Captured'),
|
108 |
+
'index' => 'transaction_captured',
|
109 |
+
'type' => 'options',
|
110 |
+
'options' => array(
|
111 |
+
self::CAPTURED => Mage::helper('ewayrapid')->__('Yes'),
|
112 |
+
self::NOT_CAPTURED => Mage::helper('ewayrapid')->__('No')
|
113 |
+
),
|
114 |
+
));
|
115 |
+
|
116 |
+
$this->addColumn('fraud_codes', array(
|
117 |
+
'header' => Mage::helper('ewayrapid')->__('Fraud Codes'),
|
118 |
+
'index' => 'fraud_codes',
|
119 |
+
));
|
120 |
+
|
121 |
+
$this->addColumn('status', array(
|
122 |
+
'header' => Mage::helper('ewayrapid')->__('Order Status'),
|
123 |
+
'index' => 'status',
|
124 |
+
'type' => 'options',
|
125 |
+
'width' => '70px',
|
126 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
127 |
+
));
|
128 |
+
|
129 |
+
return parent::_prepareColumns();
|
130 |
+
}
|
131 |
+
|
132 |
+
protected function _prepareMassaction()
|
133 |
+
{
|
134 |
+
$this->setMassactionIdField('entity_id');
|
135 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
136 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
137 |
+
|
138 |
+
// Append new mass action option
|
139 |
+
$this->getMassactionBlock()->addItem(
|
140 |
+
'pending',
|
141 |
+
array(
|
142 |
+
'label' => $this->__('Verify eWAY Order'),
|
143 |
+
'url' => Mage::helper("adminhtml")->getUrl("adminhtml/ewayadmin/massVerifyEwayOrder"), //this should be the url where there will be mass operation
|
144 |
+
'confirm'=> $this->__('Are you sure?')
|
145 |
+
)
|
146 |
+
);
|
147 |
+
}
|
148 |
+
|
149 |
+
public function getGridUrl()
|
150 |
+
{
|
151 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
152 |
+
}
|
153 |
+
|
154 |
+
protected function _itemsFilter($collection, $column)
|
155 |
+
{
|
156 |
+
if (!$value = $column->getFilter()->getValue()) {
|
157 |
+
return $this;
|
158 |
+
}
|
159 |
+
$filteredCollection = Mage::getResourceModel($this->_getCollectionClass());
|
160 |
+
|
161 |
+
$resource = Mage::getSingleton('core/resource');
|
162 |
+
|
163 |
+
$filteredCollection->getSelect()->join(
|
164 |
+
array('items' => $resource->getTableName('sales/order_item')),
|
165 |
+
'main_table.entity_id=items.order_id and items.parent_item_id is null',
|
166 |
+
array('items_ordered' => 'GROUP_CONCAT(items.name)')
|
167 |
+
)->group('main_table.entity_id')->having('items_ordered like "%'. $value .'%"');
|
168 |
+
|
169 |
+
$filteredOrderIds = array();
|
170 |
+
|
171 |
+
foreach($filteredCollection as $filteredOrder){
|
172 |
+
$filteredOrderIds[] = $filteredOrder->getId();
|
173 |
+
}
|
174 |
+
|
175 |
+
$collection->addFieldToFilter('entity_id',array('in' => $filteredOrderIds));
|
176 |
+
|
177 |
+
return $this;
|
178 |
+
}
|
179 |
+
|
180 |
+
public function getRowUrl($row)
|
181 |
+
{
|
182 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
183 |
+
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
184 |
+
}
|
185 |
+
return false;
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Adminhtml_Sales_Order_Renderer_Items extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
public function render(Varien_Object $row)
|
5 |
+
{
|
6 |
+
$value = $row->getData('entity_id');
|
7 |
+
|
8 |
+
$order = Mage::getModel('sales/order')->load($value);
|
9 |
+
|
10 |
+
$html = '';
|
11 |
+
if($order->getId()){
|
12 |
+
foreach($order->getAllVisibleItems() as $item){
|
13 |
+
$html .= $item->getName() . ', ';
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
return trim($html, ', ');
|
18 |
+
}
|
19 |
+
}
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Form_Direct_Ewayone extends Mage_Payment_Block_Form_Cc
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setIsRecurring(Mage::helper('ewayrapid')->isRecurring());
|
8 |
+
$this->setTemplate('ewayrapid/form/direct_ewayone.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get list of active tokens of current customer
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function getTokenList()
|
17 |
+
{
|
18 |
+
$tokenList = array();
|
19 |
+
$tokenList['tokens'] = Mage::helper('ewayrapid/customer')->getActiveTokenList();
|
20 |
+
$tokenList['tokens'][Eway_Rapid31_Model_Config::TOKEN_NEW] =
|
21 |
+
Mage::getModel('ewayrapid/customer_token')->setCard($this->__('Use a new card'))->setOwner('')
|
22 |
+
->setExpMonth('')->setExpYear('');
|
23 |
+
$tokenList['default_token'] = Mage::helper('ewayrapid/customer')->getDefaultToken();
|
24 |
+
|
25 |
+
$tokenListJson = array();
|
26 |
+
foreach($tokenList['tokens'] as $id => $token) {
|
27 |
+
/* @var Eway_Rapid31_Model_Customer_Token $token */
|
28 |
+
$tokenListJson[] = "\"{$id}\":{$token->jsonSerialize()}";
|
29 |
+
}
|
30 |
+
$tokenList['tokens_json'] = '{' . implode(',', $tokenListJson) . '}';
|
31 |
+
|
32 |
+
return $tokenList;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function checkCardName($card)
|
36 |
+
{
|
37 |
+
/* @var Eway_Rapid31_Model_Request_Token $model */
|
38 |
+
$model = Mage::getModel('ewayrapid/request_token');
|
39 |
+
return $model->checkCardName($card);
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getSaveCard(){
|
43 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_card');
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getSaveText(){
|
47 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_text');
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getSaveDefaultCheck(){
|
51 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_card_checked');
|
52 |
+
}
|
53 |
+
|
54 |
+
public function checkSaveCardAvailable(){
|
55 |
+
return Mage::helper('ewayrapid/customer')->getCurrentCustomer()
|
56 |
+
|| Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod() == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER;
|
57 |
+
}
|
58 |
+
}
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Form_Sharedpage_Ewayone extends Mage_Payment_Block_Form_Cc
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('ewayrapid/form/sharedpage_ewayone.phtml');
|
8 |
+
// unset all session's sharedpage
|
9 |
+
if(!Mage::app()->getRequest()->isPost()){
|
10 |
+
Mage::helper('ewayrapid')->clearSessionSharedpage();
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get list of active tokens of current customer
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function getTokenList()
|
20 |
+
{
|
21 |
+
$tokenList = array();
|
22 |
+
$tokenList['tokens'] = Mage::helper('ewayrapid/customer')->getActiveTokenList();
|
23 |
+
$tokenList['tokens'][Eway_Rapid31_Model_Config::TOKEN_NEW] =
|
24 |
+
Mage::getModel('ewayrapid/customer_token')->setCard($this->__('Use a new card'))->setOwner('')
|
25 |
+
->setExpMonth('')->setExpYear('');
|
26 |
+
$tokenList['default_token'] = Mage::helper('ewayrapid/customer')->getDefaultToken();
|
27 |
+
|
28 |
+
$tokenListJson = array();
|
29 |
+
foreach($tokenList['tokens'] as $id => $token) {
|
30 |
+
/* @var Eway_Rapid31_Model_Customer_Token $token */
|
31 |
+
$tokenListJson[] = "\"{$id}\":{$token->jsonSerialize()}";
|
32 |
+
}
|
33 |
+
$tokenList['tokens_json'] = '{' . implode(',', $tokenListJson) . '}';
|
34 |
+
|
35 |
+
return $tokenList;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getSaveCard(){
|
39 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_card');
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getSaveText(){
|
43 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_text');
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getSaveDefaultCheck(){
|
47 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_card_checked');
|
48 |
+
}
|
49 |
+
|
50 |
+
public function checkSaveCardAvailable(){
|
51 |
+
return Mage::helper('ewayrapid/customer')->getCurrentCustomer()
|
52 |
+
|| Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod() == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER;
|
53 |
+
}
|
54 |
+
}
|
@@ -6,6 +6,8 @@ class Eway_Rapid31_Block_Form_Sharedpage_Notsaved extends Mage_Payment_Block_For
|
|
6 |
parent::_construct();
|
7 |
$this->setTemplate('ewayrapid/form/sharedpage_notsaved.phtml');
|
8 |
// unset all session's sharedpage
|
9 |
-
Mage::
|
|
|
|
|
10 |
}
|
11 |
}
|
6 |
parent::_construct();
|
7 |
$this->setTemplate('ewayrapid/form/sharedpage_notsaved.phtml');
|
8 |
// unset all session's sharedpage
|
9 |
+
if(!Mage::app()->getRequest()->isPost()){
|
10 |
+
Mage::helper('ewayrapid')->clearSessionSharedpage();
|
11 |
+
}
|
12 |
}
|
13 |
}
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eway_Rapid31_Block_Form_Transparent_Ewayone extends Mage_Payment_Block_Form_Cc
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->setIsRecurring(Mage::helper('ewayrapid')->isRecurring());
|
9 |
+
$this->setTemplate('ewayrapid/form/transparent_ewayone.phtml');
|
10 |
+
|
11 |
+
//unset all session's transaparent
|
12 |
+
//Mage::getModel('ewayrapid/request_transparent')->unsetSessionData();
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get list of active tokens of current customer
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function getTokenList()
|
21 |
+
{
|
22 |
+
$tokenList = array();
|
23 |
+
$tokenList['tokens'] = Mage::helper('ewayrapid/customer')->getActiveTokenList();
|
24 |
+
$tokenList['tokens'][Eway_Rapid31_Model_Config::TOKEN_NEW] =
|
25 |
+
Mage::getModel('ewayrapid/customer_token')->setCard($this->__('Use a new card'))->setOwner('')
|
26 |
+
->setExpMonth('')->setExpYear('');
|
27 |
+
$tokenList['default_token'] = Mage::helper('ewayrapid/customer')->getDefaultToken();
|
28 |
+
|
29 |
+
$tokenListJson = array();
|
30 |
+
foreach ($tokenList['tokens'] as $id => $token) {
|
31 |
+
/* @var Eway_Rapid31_Model_Customer_Token $token */
|
32 |
+
$tokenListJson[] = "\"{$id}\":{$token->jsonSerialize()}";
|
33 |
+
}
|
34 |
+
$tokenList['tokens_json'] = '{' . implode(',', $tokenListJson) . '}';
|
35 |
+
|
36 |
+
return $tokenList;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @return mixed
|
41 |
+
*/
|
42 |
+
public function getConfig()
|
43 |
+
{
|
44 |
+
return (object)Mage::getStoreConfig('payment/ewayrapid_general');
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getEnablePaypalCheckout()
|
48 |
+
{
|
49 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/enable_paypal_checkout');
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getEnablePaypalStandard()
|
53 |
+
{
|
54 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/enable_paypal_standard');
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getEnableMasterpass()
|
58 |
+
{
|
59 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/enable_masterpass');
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getEnableVisaCheckout()
|
63 |
+
{
|
64 |
+
$_config = Mage::getSingleton('ewayrapid/config');
|
65 |
+
return $_config->getVisaCheckoutEnable();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function checkCardName($card)
|
69 |
+
{
|
70 |
+
/* @var Eway_Rapid31_Model_Request_Token $model */
|
71 |
+
$model = Mage::getModel('ewayrapid/request_token');
|
72 |
+
return $model->checkCardName($card);
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getSaveCard(){
|
76 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_card');
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getSaveText(){
|
80 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_text');
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getSaveDefaultCheck(){
|
84 |
+
return Mage::getStoreConfig('payment/ewayrapid_ewayone/save_card_checked');
|
85 |
+
}
|
86 |
+
|
87 |
+
public function checkSaveCardAvailable(){
|
88 |
+
return Mage::helper('ewayrapid/customer')->getCurrentCustomer()
|
89 |
+
|| Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod() == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER;
|
90 |
+
}
|
91 |
+
}
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Html_Head extends Mage_Adminhtml_Block_Page_Head
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Initialize template
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
$this->setTemplate('page/html/head.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Add HEAD External Item
|
16 |
+
*
|
17 |
+
* Allowed types:
|
18 |
+
* - js
|
19 |
+
* - js_css
|
20 |
+
* - skin_js
|
21 |
+
* - skin_css
|
22 |
+
* - rss
|
23 |
+
*
|
24 |
+
* @param string $type
|
25 |
+
* @param string $name
|
26 |
+
* @param string $params
|
27 |
+
* @param string $if
|
28 |
+
* @param string $cond
|
29 |
+
* @return Mage_Page_Block_Html_Head
|
30 |
+
*/
|
31 |
+
public function addExternalItem($type, $name, $params=null, $if=null, $cond=null)
|
32 |
+
{
|
33 |
+
parent::addItem($type, $name, $params, $if, $cond);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Remove External Item from HEAD entity
|
38 |
+
*
|
39 |
+
* @param string $type
|
40 |
+
* @param string $name
|
41 |
+
* @return Mage_Page_Block_Html_Head
|
42 |
+
*/
|
43 |
+
public function removeExternalItem($type, $name)
|
44 |
+
{
|
45 |
+
parent::removeItem($type, $name);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Classify HTML head item and queue it into "lines" array
|
50 |
+
*
|
51 |
+
* @see self::getCssJsHtml()
|
52 |
+
* @param array &$lines
|
53 |
+
* @param string $itemIf
|
54 |
+
* @param string $itemType
|
55 |
+
* @param string $itemParams
|
56 |
+
* @param string $itemName
|
57 |
+
* @param array $itemThe
|
58 |
+
*/
|
59 |
+
protected function _separateOtherHtmlHeadElements(&$lines, $itemIf, $itemType, $itemParams, $itemName, $itemThe)
|
60 |
+
{
|
61 |
+
$params = $itemParams ? ' ' . $itemParams : '';
|
62 |
+
$href = $itemName;
|
63 |
+
switch ($itemType) {
|
64 |
+
case 'rss':
|
65 |
+
$lines[$itemIf]['other'][] = sprintf('<link href="%s"%s rel="alternate" type="application/rss+xml" />',
|
66 |
+
$href, $params
|
67 |
+
);
|
68 |
+
break;
|
69 |
+
case 'link_rel':
|
70 |
+
$lines[$itemIf]['other'][] = sprintf('<link%s href="%s" />', $params, $href);
|
71 |
+
break;
|
72 |
+
|
73 |
+
case 'external_js':
|
74 |
+
$lines[$itemIf]['other'][] = sprintf('<script type="text/javascript" src="%s" %s></script>', $href, $params);
|
75 |
+
break;
|
76 |
+
|
77 |
+
case 'external_css':
|
78 |
+
$lines[$itemIf]['other'][] = sprintf('<link rel="stylesheet" type="text/css" href="%s" %s/>', $href, $params);
|
79 |
+
break;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Info_Direct_Ewayone extends Mage_Payment_Block_Info
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('ewayrapid/info/direct_ewayone.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Render as PDF
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function toPdf()
|
16 |
+
{
|
17 |
+
$this->setTemplate('ewayrapid/pdf/direct_notsaved.phtml');
|
18 |
+
return $this->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get eWAY Customer Token Id of this transaction
|
24 |
+
*
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
public function getTokenId()
|
28 |
+
{
|
29 |
+
$info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $info */
|
31 |
+
$order = $info->getOrder();
|
32 |
+
if($order->getCustomerIsGuest()) {
|
33 |
+
return '';
|
34 |
+
}
|
35 |
+
|
36 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($info);
|
37 |
+
if(!$info->getSavedToken()) {
|
38 |
+
return '';
|
39 |
+
}
|
40 |
+
|
41 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
42 |
+
$helper = Mage::helper('ewayrapid/customer')->setCurrentCustomer($customer);
|
43 |
+
return $helper->getCustomerTokenId($info->getSavedToken());
|
44 |
+
}
|
45 |
+
}
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Block_Info_Sharedpage_Ewayone extends Mage_Payment_Block_Info
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('ewayrapid/info/sharedpage_saved.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Render as PDF
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function toPdf()
|
16 |
+
{
|
17 |
+
$this->setTemplate('ewayrapid/pdf/direct_notsaved.phtml');
|
18 |
+
return $this->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get eWAY Customer Token Id of this transaction
|
24 |
+
*
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
public function getTokenId()
|
28 |
+
{
|
29 |
+
$info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $info */
|
31 |
+
$order = $info->getOrder();
|
32 |
+
if($order->getCustomerIsGuest()) {
|
33 |
+
return '';
|
34 |
+
}
|
35 |
+
|
36 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($info);
|
37 |
+
if(!$info->getSavedToken()) {
|
38 |
+
return '';
|
39 |
+
}
|
40 |
+
|
41 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
42 |
+
$helper = Mage::helper('ewayrapid/customer')->setCurrentCustomer($customer);
|
43 |
+
return $helper->getCustomerTokenId($info->getSavedToken());
|
44 |
+
}
|
45 |
+
}
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eway_Rapid31_Block_Info_Transparent_Ewayone extends Mage_Payment_Block_Info
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->setTemplate('ewayrapid/info/transparent_ewayone.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Render as PDF
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function toPdf()
|
17 |
+
{
|
18 |
+
$this->setTemplate('ewayrapid/pdf/direct_notsaved.phtml');
|
19 |
+
return $this->toHtml();
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get eWAY Customer Token Id of this transaction
|
25 |
+
*
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
public function getTokenId()
|
29 |
+
{
|
30 |
+
$info = $this->getInfo();
|
31 |
+
/* @var Mage_Sales_Model_Order_Payment $info */
|
32 |
+
$order = $info->getOrder();
|
33 |
+
if ($order->getCustomerIsGuest()) {
|
34 |
+
return '';
|
35 |
+
}
|
36 |
+
|
37 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($info);
|
38 |
+
if (!$info->getSavedToken()) {
|
39 |
+
return '';
|
40 |
+
}
|
41 |
+
|
42 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
43 |
+
$helper = Mage::helper('ewayrapid/customer')->setCurrentCustomer($customer);
|
44 |
+
return $helper->getCustomerTokenId($info->getSavedToken());
|
45 |
+
}
|
46 |
+
}
|
@@ -15,7 +15,7 @@ class Eway_Rapid31_Block_Redirect_Transparent extends Mage_Core_Block_Template
|
|
15 |
$this->transMethod = Mage::getSingleton('core/session')->getTransparentSaved();
|
16 |
}
|
17 |
|
18 |
-
if ($this->methodPayment == 'ewayrapid_saved') {
|
19 |
if ($this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
20 |
$this->paypalSavedToken = Mage::getSingleton('core/session')->getPaypalSavedToken();
|
21 |
} else {
|
15 |
$this->transMethod = Mage::getSingleton('core/session')->getTransparentSaved();
|
16 |
}
|
17 |
|
18 |
+
if ($this->methodPayment == 'ewayrapid_saved' || $this->methodPayment == 'ewayrapid_ewayone') {
|
19 |
if ($this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
20 |
$this->paypalSavedToken = Mage::getSingleton('core/session')->getPaypalSavedToken();
|
21 |
} else {
|
@@ -12,7 +12,6 @@ class Eway_Rapid31_Block_Redirect_TransparentCheckout extends Mage_Core_Block_Te
|
|
12 |
if(!$this->transMethod) {
|
13 |
$this->transMethod = Mage::getSingleton('core/session')->getTransparentSaved();
|
14 |
}
|
15 |
-
|
16 |
$this->setTemplate('ewayrapid/redirect/transparent_checkout.phtml')->toHtml();
|
17 |
}
|
18 |
|
@@ -47,4 +46,10 @@ class Eway_Rapid31_Block_Redirect_TransparentCheckout extends Mage_Core_Block_Te
|
|
47 |
}
|
48 |
return $years;
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
12 |
if(!$this->transMethod) {
|
13 |
$this->transMethod = Mage::getSingleton('core/session')->getTransparentSaved();
|
14 |
}
|
|
|
15 |
$this->setTemplate('ewayrapid/redirect/transparent_checkout.phtml')->toHtml();
|
16 |
}
|
17 |
|
46 |
}
|
47 |
return $years;
|
48 |
}
|
49 |
+
|
50 |
+
public function getEnableVisaCheckout()
|
51 |
+
{
|
52 |
+
$_config = Mage::getSingleton('ewayrapid/config');
|
53 |
+
return $_config->getVisaCheckoutEnable();
|
54 |
+
}
|
55 |
}
|
@@ -37,6 +37,14 @@ class Eway_Rapid31_Helper_Customer extends Mage_Core_Helper_Abstract
|
|
37 |
*/
|
38 |
protected function _getCurrentCustomer()
|
39 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
if(Mage::helper('ewayrapid')->isBackendOrder() && Mage::getSingleton('adminhtml/session_quote')->getCustomer()) {
|
41 |
return Mage::getSingleton('adminhtml/session_quote')->getCustomer();
|
42 |
}
|
37 |
*/
|
38 |
protected function _getCurrentCustomer()
|
39 |
{
|
40 |
+
if(Mage::helper('ewayrapid')->isBackendOrder()){
|
41 |
+
if(Mage::registry('current_customer')){
|
42 |
+
return Mage::registry('current_customer');
|
43 |
+
}elseif($this->_getRequest()->getParam('customer_id')){
|
44 |
+
return Mage::getModel('customer/customer')->load($this->_getRequest()->getParam('customer_id'));
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
if(Mage::helper('ewayrapid')->isBackendOrder() && Mage::getSingleton('adminhtml/session_quote')->getCustomer()) {
|
49 |
return Mage::getSingleton('adminhtml/session_quote')->getCustomer();
|
50 |
}
|
@@ -4,8 +4,15 @@
|
|
4 |
*/
|
5 |
class Eway_Rapid31_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
{
|
|
|
7 |
private $_ccTypeNames = null;
|
8 |
private $_isSaveMethodEnabled = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
public function isBackendOrder()
|
11 |
{
|
@@ -49,7 +56,9 @@ class Eway_Rapid31_Helper_Data extends Mage_Core_Helper_Abstract
|
|
49 |
public function isSavedMethodEnabled()
|
50 |
{
|
51 |
if(is_null($this->_isSaveMethodEnabled)) {
|
52 |
-
$
|
|
|
|
|
53 |
}
|
54 |
return $this->_isSaveMethodEnabled;
|
55 |
}
|
@@ -97,7 +106,11 @@ class Eway_Rapid31_Helper_Data extends Mage_Core_Helper_Abstract
|
|
97 |
{
|
98 |
$lineItems = array();
|
99 |
/** @var Mage_Sales_Model_Quote $quote */
|
100 |
-
|
|
|
|
|
|
|
|
|
101 |
if ($quote) {
|
102 |
// add Shipping item
|
103 |
if ($quote->getShippingAddress()->getBaseShippingInclTax()) {
|
@@ -153,4 +166,67 @@ class Eway_Rapid31_Helper_Data extends Mage_Core_Helper_Abstract
|
|
153 |
Mage::getSingleton('core/session')->unsetData('newToken');
|
154 |
Mage::getSingleton('core/session')->unsetData('sharedpagePaypal');
|
155 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
4 |
*/
|
5 |
class Eway_Rapid31_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
{
|
7 |
+
protected $_address = null;
|
8 |
private $_ccTypeNames = null;
|
9 |
private $_isSaveMethodEnabled = null;
|
10 |
+
private $_beagleVerificationCodes = array(
|
11 |
+
0 => 'Not Verified',
|
12 |
+
1 => 'Attempted',
|
13 |
+
2 => 'Verified',
|
14 |
+
3 => 'Failed'
|
15 |
+
);
|
16 |
|
17 |
public function isBackendOrder()
|
18 |
{
|
56 |
public function isSavedMethodEnabled()
|
57 |
{
|
58 |
if(is_null($this->_isSaveMethodEnabled)) {
|
59 |
+
$savedEnable = Mage::getSingleton('ewayrapid/method_saved')->getConfigData('active');
|
60 |
+
$ewayOneEnable = Mage::getSingleton('ewayrapid/method_ewayone')->getConfigData('active');
|
61 |
+
$this->_isSaveMethodEnabled = $ewayOneEnable ? $ewayOneEnable : $savedEnable;
|
62 |
}
|
63 |
return $this->_isSaveMethodEnabled;
|
64 |
}
|
106 |
{
|
107 |
$lineItems = array();
|
108 |
/** @var Mage_Sales_Model_Quote $quote */
|
109 |
+
if(!$this->isBackendOrder()){
|
110 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
111 |
+
}else{
|
112 |
+
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
|
113 |
+
}
|
114 |
if ($quote) {
|
115 |
// add Shipping item
|
116 |
if ($quote->getShippingAddress()->getBaseShippingInclTax()) {
|
166 |
Mage::getSingleton('core/session')->unsetData('newToken');
|
167 |
Mage::getSingleton('core/session')->unsetData('sharedpagePaypal');
|
168 |
}
|
169 |
+
|
170 |
+
public function limitInvoiceDescriptionLength($description)
|
171 |
+
{
|
172 |
+
if(strlen($description) > 64){
|
173 |
+
$description = substr($description,0,61);
|
174 |
+
$description .= '...';
|
175 |
+
}
|
176 |
+
|
177 |
+
return $description;
|
178 |
+
}
|
179 |
+
|
180 |
+
public function getBeagleVerificationTitle($code)
|
181 |
+
{
|
182 |
+
return $this->_beagleVerificationCodes[$code];
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Get Fraud Codes from ResponseMessage
|
187 |
+
*
|
188 |
+
* @return string
|
189 |
+
*/
|
190 |
+
public function getFraudCodes($codes)
|
191 |
+
{
|
192 |
+
$codes = explode(',', $codes);
|
193 |
+
|
194 |
+
$fraudCodes = array();
|
195 |
+
|
196 |
+
foreach($codes as $code){
|
197 |
+
$code = trim($code);
|
198 |
+
if(substr($code,0,1) == "F"){
|
199 |
+
$fraudCodes[] = $code;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
return implode(',', $fraudCodes);
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Get the address block for dynamic state/country selection on forms.
|
208 |
+
*/
|
209 |
+
public function getAddressBlock()
|
210 |
+
{
|
211 |
+
if( is_null( $this->_address ) ) {
|
212 |
+
$this->_address = Mage::app()->getLayout()->createBlock('directory/data');
|
213 |
+
}
|
214 |
+
|
215 |
+
return $this->_address;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Get customer country dropdown
|
220 |
+
*/
|
221 |
+
public function getCountryHtmlSelect( $name, $default='US', $id=null )
|
222 |
+
{
|
223 |
+
return $this->getAddressBlock()->getCountryHtmlSelect( $default, $name, $id );
|
224 |
+
}
|
225 |
+
|
226 |
+
public function useIframeInBackend(){
|
227 |
+
$_config = Mage::getSingleton('ewayrapid/config');
|
228 |
+
$isBackend = $this->isBackendOrder();
|
229 |
+
|
230 |
+
return $isBackend && ($_config->isSharedPageConnection() || $_config->isRapidIframeConnection());
|
231 |
+
}
|
232 |
}
|
@@ -5,6 +5,7 @@ class Eway_Rapid31_Model_Config
|
|
5 |
const MODE_LIVE = 'live';
|
6 |
const PAYMENT_NOT_SAVED_METHOD = 'ewayrapid_notsaved';
|
7 |
const PAYMENT_SAVED_METHOD = 'ewayrapid_saved';
|
|
|
8 |
|
9 |
const METHOD_PROCESS_PAYMENT = 'ProcessPayment';
|
10 |
const METHOD_CREATE_TOKEN = 'CreateTokenCustomer';
|
@@ -19,11 +20,13 @@ class Eway_Rapid31_Model_Config
|
|
19 |
const CONNECTION_DIRECT = 'direct';
|
20 |
const CONNECTION_TRANSPARENT = 'transparent';
|
21 |
const CONNECTION_SHARED_PAGE = 'sharedpage';
|
|
|
22 |
|
23 |
const CREDITCARD_METHOD = 'creditcard';
|
24 |
const PAYPAL_STANDARD_METHOD = 'paypal';
|
25 |
const PAYPAL_EXPRESS_METHOD = 'paypal_express';
|
26 |
const MASTERPASS_METHOD = 'masterpass';
|
|
|
27 |
|
28 |
const MESSAGE_ERROR_ORDER = 'Billing Frequency is wrong. It must be numeric and greater than 0. Status of recurring profile is changed to cancelled';
|
29 |
|
@@ -116,6 +119,16 @@ class Eway_Rapid31_Model_Config
|
|
116 |
return Mage::getStoreConfig('payment/ewayrapid_general/connection_type') == self::CONNECTION_TRANSPARENT;
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
public function canEditToken()
|
120 |
{
|
121 |
return (bool) Mage::getStoreConfig('payment/ewayrapid_general/can_edit_token');
|
@@ -125,4 +138,48 @@ class Eway_Rapid31_Model_Config
|
|
125 |
{
|
126 |
return explode(',', Mage::getStoreConfig('payment/ewayrapid_general/cctypes'));
|
127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
5 |
const MODE_LIVE = 'live';
|
6 |
const PAYMENT_NOT_SAVED_METHOD = 'ewayrapid_notsaved';
|
7 |
const PAYMENT_SAVED_METHOD = 'ewayrapid_saved';
|
8 |
+
const PAYMENT_EWAYONE_METHOD = 'ewayrapid_ewayone';
|
9 |
|
10 |
const METHOD_PROCESS_PAYMENT = 'ProcessPayment';
|
11 |
const METHOD_CREATE_TOKEN = 'CreateTokenCustomer';
|
20 |
const CONNECTION_DIRECT = 'direct';
|
21 |
const CONNECTION_TRANSPARENT = 'transparent';
|
22 |
const CONNECTION_SHARED_PAGE = 'sharedpage';
|
23 |
+
const CONNECTION_RAPID_IFRAME = 'rapidiframe';
|
24 |
|
25 |
const CREDITCARD_METHOD = 'creditcard';
|
26 |
const PAYPAL_STANDARD_METHOD = 'paypal';
|
27 |
const PAYPAL_EXPRESS_METHOD = 'paypal_express';
|
28 |
const MASTERPASS_METHOD = 'masterpass';
|
29 |
+
const VISA_CHECKOUT_METHOD = 'visa';
|
30 |
|
31 |
const MESSAGE_ERROR_ORDER = 'Billing Frequency is wrong. It must be numeric and greater than 0. Status of recurring profile is changed to cancelled';
|
32 |
|
119 |
return Mage::getStoreConfig('payment/ewayrapid_general/connection_type') == self::CONNECTION_TRANSPARENT;
|
120 |
}
|
121 |
|
122 |
+
public function isSharedPageConnection()
|
123 |
+
{
|
124 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/connection_type') == self::CONNECTION_SHARED_PAGE;
|
125 |
+
}
|
126 |
+
|
127 |
+
public function isRapidIframeConnection()
|
128 |
+
{
|
129 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/connection_type') == self::CONNECTION_RAPID_IFRAME;
|
130 |
+
}
|
131 |
+
|
132 |
public function canEditToken()
|
133 |
{
|
134 |
return (bool) Mage::getStoreConfig('payment/ewayrapid_general/can_edit_token');
|
138 |
{
|
139 |
return explode(',', Mage::getStoreConfig('payment/ewayrapid_general/cctypes'));
|
140 |
}
|
141 |
+
|
142 |
+
public function getVerifyEmail()
|
143 |
+
{
|
144 |
+
return (bool) Mage::getStoreConfig('payment/ewayrapid_general/beagle_verify_email');
|
145 |
+
}
|
146 |
+
|
147 |
+
public function getVerifyPhone()
|
148 |
+
{
|
149 |
+
return (bool) Mage::getStoreConfig('payment/ewayrapid_general/beagle_verify_phone');
|
150 |
+
}
|
151 |
+
|
152 |
+
public function getCustomView()
|
153 |
+
{
|
154 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/custom_view');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function shouldPassingInvoiceDescription()
|
158 |
+
{
|
159 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/invoice_description');
|
160 |
+
}
|
161 |
+
|
162 |
+
public function shouldPassingGuessOrder()
|
163 |
+
{
|
164 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/guess_order');
|
165 |
+
}
|
166 |
+
|
167 |
+
public function getVisaCheckoutApiKey(){
|
168 |
+
return Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/ewayrapid_general/visa_checkout_api_key'));
|
169 |
+
}
|
170 |
+
|
171 |
+
public function getVisaCheckoutEnable(){
|
172 |
+
return Mage::getStoreConfig('payment/ewayrapid_general/enable_visa_checkout')
|
173 |
+
&& Mage::getStoreConfig('payment/ewayrapid_general/visa_checkout_api_key') != '';
|
174 |
+
}
|
175 |
+
|
176 |
+
public function getVisaCheckoutSDK(){
|
177 |
+
if(!$this->getVisaCheckoutEnable()){
|
178 |
+
return false;
|
179 |
+
}else{
|
180 |
+
return $this->_isSandbox
|
181 |
+
? 'https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/integration/v1/sdk.js'
|
182 |
+
: 'https://assets.secure.checkout.visa.com/checkout-widget/resources/js/integration/v1/sdk.js';
|
183 |
+
}
|
184 |
+
}
|
185 |
}
|
@@ -92,7 +92,7 @@ class Eway_Rapid31_Model_EwayCron {
|
|
92 |
// Get new TxnId
|
93 |
$break = true;
|
94 |
for($i = 0; $i < 100; $i++) {
|
95 |
-
$transId
|
96 |
$newTrans = Mage::getModel('sales/order_payment_transaction')
|
97 |
->getCollection()
|
98 |
->addFieldToFilter('txn_id', array('eq' => $transId));
|
92 |
// Get new TxnId
|
93 |
$break = true;
|
94 |
for($i = 0; $i < 100; $i++) {
|
95 |
+
$transId ++;
|
96 |
$newTrans = Mage::getModel('sales/order_payment_transaction')
|
97 |
->getCollection()
|
98 |
->addFieldToFilter('txn_id', array('eq' => $transId));
|
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Model_Method_Ewayone extends Eway_Rapid31_Model_Method_Notsaved implements Mage_Payment_Model_Recurring_Profile_MethodInterface
|
3 |
+
{
|
4 |
+
protected $_code = 'ewayrapid_ewayone';
|
5 |
+
|
6 |
+
protected $_formBlockType = 'ewayrapid/form_direct_ewayone';
|
7 |
+
protected $_infoBlockType = 'ewayrapid/info_direct_ewayone';
|
8 |
+
protected $_canCapturePartial = true;
|
9 |
+
protected $_billing = null;
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
if (!$this->_isBackendOrder) {
|
15 |
+
if (!Mage::helper('ewayrapid')->isBackendOrder()) {
|
16 |
+
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT) {
|
17 |
+
$this->_infoBlockType = 'ewayrapid/info_transparent_ewayone';
|
18 |
+
$this->_formBlockType = 'ewayrapid/form_transparent_ewayone';
|
19 |
+
} elseif ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
|
20 |
+
$this->_infoBlockType = 'ewayrapid/info_sharedpage_ewayone';
|
21 |
+
$this->_formBlockType = 'ewayrapid/form_sharedpage_ewayone';
|
22 |
+
} elseif ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME) {
|
23 |
+
$this->_infoBlockType = 'ewayrapid/info_sharedpage_ewayone';
|
24 |
+
$this->_formBlockType = 'ewayrapid/form_sharedpage_ewayone';
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
if ($this->_isBackendOrder) {
|
30 |
+
if (Mage::helper('ewayrapid')->isBackendOrder()) {
|
31 |
+
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
|
32 |
+
// $this->_infoBlockType = 'ewayrapid/info_sharedpage_ewayone';
|
33 |
+
$this->_formBlockType = 'ewayrapid/form_sharedpage_ewayone';
|
34 |
+
} elseif ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME) {
|
35 |
+
// $this->_infoBlockType = 'ewayrapid/info_sharedpage_ewayone';
|
36 |
+
$this->_formBlockType = 'ewayrapid/form_sharedpage_ewayone';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Use the grandparent isAvailable
|
44 |
+
*
|
45 |
+
* @param Mage_Sales_Model_Quote|null $quote
|
46 |
+
* @return boolean
|
47 |
+
*/
|
48 |
+
public function isAvailable($quote = null) {
|
49 |
+
return Mage_Payment_Model_Method_Abstract::isAvailable($quote);
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Assign data to info model instance
|
54 |
+
*
|
55 |
+
* @param mixed $data
|
56 |
+
* @return Mage_Payment_Model_Info
|
57 |
+
*/
|
58 |
+
public function assignData($data)
|
59 |
+
{
|
60 |
+
if (!($data instanceof Varien_Object)) {
|
61 |
+
$data = new Varien_Object($data);
|
62 |
+
}
|
63 |
+
$info = $this->getInfoInstance();
|
64 |
+
if($data->getSavedToken() == Eway_Rapid31_Model_Config::TOKEN_NEW) {
|
65 |
+
Mage::helper('ewayrapid')->clearSessionSharedpage();
|
66 |
+
Mage::getSingleton('core/session')->unsetData('visa_checkout_call_id');
|
67 |
+
if (($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
68 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME)
|
69 |
+
&& !$this->_isBackendOrder && $data->getSaveCard()
|
70 |
+
) {
|
71 |
+
Mage::getSingleton('core/session')->setData('newToken', 1);
|
72 |
+
}
|
73 |
+
if($data->getSaveCard()){
|
74 |
+
$info->setIsNewToken(true);
|
75 |
+
}
|
76 |
+
|
77 |
+
if($this->_isBackendOrder
|
78 |
+
&& ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
79 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME)
|
80 |
+
&& $data->getSaveCard()
|
81 |
+
){
|
82 |
+
Mage::getSingleton('core/session')->setData('newToken', 1);
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
} else {
|
87 |
+
if ( ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE || $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME)
|
88 |
+
&& !$this->_isBackendOrder
|
89 |
+
) {
|
90 |
+
Mage::getSingleton('core/session')->setData('editToken', $data->getSavedToken());
|
91 |
+
}
|
92 |
+
|
93 |
+
if($this->_isBackendOrder
|
94 |
+
&& ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
95 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME)
|
96 |
+
){
|
97 |
+
Mage::getSingleton('core/session')->setData('editToken', $data->getSavedToken());
|
98 |
+
}
|
99 |
+
|
100 |
+
$info->setSavedToken($data->getSavedToken());
|
101 |
+
// Update token
|
102 |
+
if($data->getCcOwner() && $data->getSaveCard()) {
|
103 |
+
$info->setIsUpdateToken(true);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
if ($this->_isBackendOrder &&
|
108 |
+
($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
109 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME)
|
110 |
+
) {
|
111 |
+
if ($data->getMethod()) {
|
112 |
+
Mage::getSingleton('core/session')->setData('ewayMethod', $data->getMethod());
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
if (!$this->_isBackendOrder &&
|
117 |
+
($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
118 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME)
|
119 |
+
) {
|
120 |
+
if ($data->getMethod()) {
|
121 |
+
Mage::getSingleton('core/session')->setData('ewayMethod', $data->getMethod());
|
122 |
+
}
|
123 |
+
} elseif (!$this->_isBackendOrder && $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT) {
|
124 |
+
if($data->getVisaCheckoutCallId()){
|
125 |
+
Mage::getSingleton('core/session')->setData('visa_checkout_call_id', $data->getVisaCheckoutCallId());
|
126 |
+
}
|
127 |
+
$info->setTransparentNotsaved($data->getTransparentNotsaved());
|
128 |
+
$info->setTransparentSaved($data->getTransparentSaved());
|
129 |
+
|
130 |
+
//Option choice
|
131 |
+
if ($data->getMethod() == 'ewayrapid_ewayone' && !$data->getTransparentSaved()) {
|
132 |
+
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for eWay saved'));
|
133 |
+
} elseif ($data->getMethod() == 'ewayrapid_notsaved' && !$data->getTransparentNotsaved()) {
|
134 |
+
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for eWay not saved'));
|
135 |
+
}
|
136 |
+
|
137 |
+
//New Token
|
138 |
+
if ($data->getMethod() == 'ewayrapid_ewayone'
|
139 |
+
&& $data->getTransparentSaved() == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD
|
140 |
+
&& $data->getSavedToken() == Eway_Rapid31_Model_Config::TOKEN_NEW
|
141 |
+
&& Mage::helper('ewayrapid/customer')->checkTokenListByType(Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD)
|
142 |
+
&& $data->getSaveCard()
|
143 |
+
) {
|
144 |
+
Mage::throwException(Mage::helper('payment')->__('You could only save one PayPal account, please select PayPal account existed to payent.'));
|
145 |
+
}
|
146 |
+
|
147 |
+
if ($data->getTransparentNotsaved())
|
148 |
+
Mage::getSingleton('core/session')->setTransparentNotsaved($data->getTransparentNotsaved());
|
149 |
+
|
150 |
+
if ($data->getTransparentSaved())
|
151 |
+
Mage::getSingleton('core/session')->setTransparentSaved($data->getTransparentSaved());
|
152 |
+
|
153 |
+
if ($data->getMethod())
|
154 |
+
Mage::getSingleton('core/session')->setMethod($data->getMethod());
|
155 |
+
|
156 |
+
// Add Save Card to session
|
157 |
+
Mage::getSingleton('core/session')->setSaveCard($data->getSaveCard());
|
158 |
+
|
159 |
+
if ($data->getSavedToken()) {
|
160 |
+
Mage::getSingleton('core/session')->setSavedToken($data->getSavedToken());
|
161 |
+
if(is_numeric($data->getSavedToken())) {
|
162 |
+
$token = Mage::helper('ewayrapid/customer')->getTokenById($data->getSavedToken());
|
163 |
+
/* @var Eway_Rapid31_Model_Request_Token $model */
|
164 |
+
$model = Mage::getModel('ewayrapid/request_token');
|
165 |
+
$type = $model->checkCardName($token);
|
166 |
+
Mage::getSingleton('core/session')->setTransparentSaved($type);
|
167 |
+
unset($model);
|
168 |
+
unset($token);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
$infoCard = new Varien_Object();
|
173 |
+
Mage::getSingleton('core/session')->setInfoCard(
|
174 |
+
$infoCard->setCcType($data->getCcType())
|
175 |
+
->setOwner($data->getCcOwner())
|
176 |
+
->setLast4($this->_isClientSideEncrypted($data->getCcNumber()) ? 'encrypted' : substr($data->getCcNumber(), -4))
|
177 |
+
->setCard($data->getCcNumber())
|
178 |
+
->setNumber($data->getCcNumber())
|
179 |
+
->setCid($data->getCcCid())
|
180 |
+
->setExpMonth($data->getCcExpMonth())
|
181 |
+
->setExpYear($data->getCcExpYear()
|
182 |
+
));
|
183 |
+
|
184 |
+
} else {
|
185 |
+
$info->setCcType($data->getCcType())
|
186 |
+
->setCcOwner($data->getCcOwner())
|
187 |
+
->setCcLast4($this->_isClientSideEncrypted($data->getCcNumber()) ? 'encrypted' : substr($data->getCcNumber(), -4))
|
188 |
+
->setCcNumber($data->getCcNumber())
|
189 |
+
->setCcCid($data->getCcCid())
|
190 |
+
->setCcExpMonth($data->getCcExpMonth())
|
191 |
+
->setCcExpYear($data->getCcExpYear());
|
192 |
+
}
|
193 |
+
|
194 |
+
Mage::helper('ewayrapid')->serializeInfoInstance($info);
|
195 |
+
|
196 |
+
return $this;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Validate payment method information object
|
201 |
+
*
|
202 |
+
* @param Mage_Payment_Model_Info $info
|
203 |
+
* @return Mage_Payment_Model_Abstract
|
204 |
+
*/
|
205 |
+
public function validate()
|
206 |
+
{
|
207 |
+
$info = $this->getInfoInstance();
|
208 |
+
if($info->getIsNewToken()) {
|
209 |
+
parent::validate();
|
210 |
+
} else {
|
211 |
+
// TODO: Check if this token is still Active using GET /Customer endpoint.
|
212 |
+
}
|
213 |
+
|
214 |
+
return $this;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Authorize & Capture a payment
|
219 |
+
*
|
220 |
+
* @param Varien_Object $payment
|
221 |
+
* @param float $amount
|
222 |
+
*
|
223 |
+
* @return Mage_Payment_Model_Abstract
|
224 |
+
*/
|
225 |
+
public function capture(Varien_Object $payment, $amount)
|
226 |
+
{
|
227 |
+
if (!$this->_isPreauthCapture($payment) && (
|
228 |
+
$this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
229 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME)) {
|
230 |
+
$transID = Mage::getSingleton('core/session')->getData('ewayTransactionID');
|
231 |
+
$payment->setTransactionId($transID);
|
232 |
+
$payment->setIsTransactionClosed(0);
|
233 |
+
Mage::getSingleton('core/session')->unsetData('ewayTransactionID');
|
234 |
+
return $this;
|
235 |
+
} elseif (!$this->_isBackendOrder && $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT ) {
|
236 |
+
//$payment->setTransactionId(Mage::getSingleton('core/session')->getTransactionId());
|
237 |
+
Mage::getModel('ewayrapid/request_transparent')->setTransaction($payment);
|
238 |
+
return $this;
|
239 |
+
}
|
240 |
+
|
241 |
+
/* @var Mage_Sales_Model_Order_Payment $payment */
|
242 |
+
if ($amount <= 0) {
|
243 |
+
Mage::throwException(Mage::helper('payment')->__('Invalid amount for capture.'));
|
244 |
+
}
|
245 |
+
$info = $this->getInfoInstance();
|
246 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($info);
|
247 |
+
|
248 |
+
if(!$info->getIsNewToken() && !$info->getIsUpdateToken()){
|
249 |
+
// Not new/update token
|
250 |
+
if($info->getSavedToken() && is_numeric($info->getSavedToken())){
|
251 |
+
// Saved token is numeric
|
252 |
+
$request = Mage::getModel('ewayrapid/request_token');
|
253 |
+
}else{
|
254 |
+
$request = Mage::getModel('ewayrapid/request_direct');
|
255 |
+
}
|
256 |
+
}else{
|
257 |
+
// New/update token
|
258 |
+
$request = Mage::getModel('ewayrapid/request_token');
|
259 |
+
}
|
260 |
+
|
261 |
+
$amount = round($amount * 100);
|
262 |
+
if($this->_isPreauthCapture($payment)) {
|
263 |
+
$previousCapture = $payment->lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
|
264 |
+
if($previousCapture) {
|
265 |
+
$customer = Mage::getModel('customer/customer')->load($payment->getOrder()->getCustomerId());
|
266 |
+
Mage::helper('ewayrapid/customer')->setCurrentCustomer($customer);
|
267 |
+
|
268 |
+
/* @var Mage_Sales_Model_Order_Payment_Transaction $previousCapture */
|
269 |
+
$request->doTransaction($payment, $amount);
|
270 |
+
$payment->setParentTransactionId($previousCapture->getParentTxnId());
|
271 |
+
} else {
|
272 |
+
$request->doCapturePayment($payment, $amount);
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
if (!$payment->getIsRecurring()) {
|
276 |
+
if($request instanceof Eway_Rapid31_Model_Request_Token){
|
277 |
+
$this->_shouldCreateOrUpdateToken($payment, $request);
|
278 |
+
}
|
279 |
+
|
280 |
+
}
|
281 |
+
$request->doTransaction($payment, $amount);
|
282 |
+
}
|
283 |
+
|
284 |
+
return $this;
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Authorize a payment
|
289 |
+
*
|
290 |
+
* @param Varien_Object $payment
|
291 |
+
* @param float $amount
|
292 |
+
*
|
293 |
+
* @return Mage_Payment_Model_Abstract
|
294 |
+
*/
|
295 |
+
public function authorize(Varien_Object $payment, $amount)
|
296 |
+
{
|
297 |
+
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE || $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME) {
|
298 |
+
$transID = Mage::getSingleton('core/session')->getData('ewayTransactionID');
|
299 |
+
$payment->setTransactionId($transID);
|
300 |
+
$payment->setIsTransactionClosed(0);
|
301 |
+
Mage::getSingleton('core/session')->unsetData('ewayTransactionID');
|
302 |
+
return $this;
|
303 |
+
} elseif (!$this->_isBackendOrder && $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT) {
|
304 |
+
//$payment->setTransactionId(Mage::getSingleton('core/session')->getTransactionId());
|
305 |
+
Mage::getModel('ewayrapid/request_transparent')->setTransaction($payment);
|
306 |
+
return $this;
|
307 |
+
}
|
308 |
+
|
309 |
+
/* @var Mage_Sales_Model_Order_Payment $payment */
|
310 |
+
if ($amount <= 0) {
|
311 |
+
Mage::throwException(Mage::helper('payment')->__('Invalid amount for authorize.'));
|
312 |
+
}
|
313 |
+
$info = $this->getInfoInstance();
|
314 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($info);
|
315 |
+
|
316 |
+
if(!$info->getIsNewToken() && !$info->getIsUpdateToken()){
|
317 |
+
// Not new/update token
|
318 |
+
if($info->getSavedToken() && is_numeric($info->getSavedToken())){
|
319 |
+
// Saved token is numeric
|
320 |
+
$request = Mage::getModel('ewayrapid/request_token');
|
321 |
+
}else{
|
322 |
+
$request = Mage::getModel('ewayrapid/request_direct');
|
323 |
+
}
|
324 |
+
}else{
|
325 |
+
// New/update token
|
326 |
+
$request = Mage::getModel('ewayrapid/request_token');
|
327 |
+
}
|
328 |
+
|
329 |
+
/** @todo there's an error in case recurring profile */
|
330 |
+
if (!$payment->getIsRecurring()) {
|
331 |
+
if($request instanceof Eway_Rapid31_Model_Request_Token){
|
332 |
+
$this->_shouldCreateOrUpdateToken($payment, $request);
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
$amount = round($amount * 100);
|
337 |
+
$request->doAuthorisation($payment, $amount);
|
338 |
+
|
339 |
+
return $this;
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
344 |
+
* @param Eway_Rapid31_Model_Request_Token $request
|
345 |
+
*/
|
346 |
+
public function _shouldCreateOrUpdateToken(Mage_Sales_Model_Order_Payment $payment, Eway_Rapid31_Model_Request_Token $request)
|
347 |
+
{
|
348 |
+
$order = $payment->getOrder();
|
349 |
+
$billing = ($this->_getBilling() == null) ? $order->getBillingAddress() : $this->_getBilling();
|
350 |
+
$info = $this->getInfoInstance();
|
351 |
+
|
352 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($info);
|
353 |
+
if ($info->getIsNewToken()) {
|
354 |
+
$request->createNewToken($billing, $info);
|
355 |
+
$info->setSavedToken(Mage::helper('ewayrapid/customer')->getLastTokenId());
|
356 |
+
Mage::helper('ewayrapid')->serializeInfoInstance($info);
|
357 |
+
} elseif ($info->getIsUpdateToken()) {
|
358 |
+
$request->updateToken($billing, $info);
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
public function _setBilling(Mage_Sales_Model_Quote_Address $billing)
|
363 |
+
{
|
364 |
+
$this->_billing = $billing;
|
365 |
+
}
|
366 |
+
|
367 |
+
public function _getBilling()
|
368 |
+
{
|
369 |
+
return $this->_billing;
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Validate RP data
|
374 |
+
*
|
375 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
376 |
+
*/
|
377 |
+
public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
378 |
+
{
|
379 |
+
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Submit RP to the gateway
|
384 |
+
*
|
385 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
386 |
+
* @param Mage_Payment_Model_Info $paymentInfo
|
387 |
+
*/
|
388 |
+
public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile,
|
389 |
+
Mage_Payment_Model_Info $paymentInfo
|
390 |
+
) {
|
391 |
+
$profile->setReferenceId(strtoupper(uniqid()));
|
392 |
+
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Fetch RP details
|
397 |
+
*
|
398 |
+
* @param string $referenceId
|
399 |
+
* @param Varien_Object $result
|
400 |
+
*/
|
401 |
+
public function getRecurringProfileDetails($referenceId, Varien_Object $result)
|
402 |
+
{
|
403 |
+
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Whether can get recurring profile details
|
408 |
+
*/
|
409 |
+
public function canGetRecurringProfileDetails()
|
410 |
+
{
|
411 |
+
return true;
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Update RP data
|
416 |
+
*
|
417 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
418 |
+
*/
|
419 |
+
public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
420 |
+
{
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Manage status
|
426 |
+
*
|
427 |
+
* @param Mage_Payment_Model_Recurring_Profile $profile
|
428 |
+
*/
|
429 |
+
public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
|
430 |
+
{
|
431 |
+
|
432 |
+
}
|
433 |
+
}
|
@@ -24,7 +24,7 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
24 |
protected $_isInitializeNeeded = false;
|
25 |
protected $_canFetchTransactionInfo = true;
|
26 |
protected $_canReviewPayment = false;
|
27 |
-
protected $_canCreateBillingAgreement =
|
28 |
protected $_canManageRecurringProfiles = true;
|
29 |
protected $_connectionType;
|
30 |
protected $_isBackendOrder;
|
@@ -44,6 +44,25 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
44 |
$this->_formBlockType = 'ewayrapid/form_sharedpage_notsaved';
|
45 |
}
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
public function getConfigData($field, $storeId = null)
|
@@ -100,9 +119,9 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
100 |
|
101 |
//Option choice
|
102 |
if ($data->getMethod() == 'ewayrapid_saved' && !$data->getTransparentSaved()) {
|
103 |
-
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for
|
104 |
} elseif ($data->getMethod() == 'ewayrapid_notsaved' && !$data->getTransparentNotsaved()) {
|
105 |
-
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for
|
106 |
}
|
107 |
|
108 |
//New Token
|
@@ -111,7 +130,7 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
111 |
&& $data->getSavedToken() == Eway_Rapid31_Model_Config::TOKEN_NEW
|
112 |
&& Mage::helper('ewayrapid/customer')->checkTokenListByType(Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD)
|
113 |
) {
|
114 |
-
Mage::throwException(Mage::helper('payment')->__('You
|
115 |
}
|
116 |
|
117 |
if ($data->getTransparentNotsaved())
|
@@ -179,12 +198,20 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
179 |
*/
|
180 |
parent::validate();
|
181 |
if (!$this->_isBackendOrder) {
|
182 |
-
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
|
183 |
return $this;
|
184 |
} elseif ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT ) {
|
185 |
return $this;
|
186 |
}
|
187 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
$info = $this->getInfoInstance();
|
189 |
$errorMsg = false;
|
190 |
$availableTypes = explode(',',$this->getConfigData('cctypes'));
|
@@ -213,6 +240,8 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
213 |
'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
|
214 |
// Master Card
|
215 |
'MC' => '/^5[1-5][0-9]{14}$/',
|
|
|
|
|
216 |
// American Express
|
217 |
'AE' => '/^3[47][0-9]{13}$/',
|
218 |
// JCB
|
@@ -359,9 +388,17 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
359 |
}
|
360 |
}
|
361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
363 |
if ($amount <= 0) {
|
364 |
-
Mage::throwException(Mage::helper('
|
365 |
}
|
366 |
|
367 |
$amount = round($amount * 100);
|
@@ -398,9 +435,17 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
398 |
}
|
399 |
}
|
400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
402 |
if ($amount <= 0) {
|
403 |
-
Mage::throwException(Mage::helper('
|
404 |
}
|
405 |
|
406 |
if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type') === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT
|
@@ -428,7 +473,7 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
428 |
{
|
429 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
430 |
if ($amount <= 0) {
|
431 |
-
Mage::throwException(Mage::helper('
|
432 |
}
|
433 |
|
434 |
$amount = round($amount * 100);
|
@@ -471,6 +516,12 @@ class Eway_Rapid31_Model_Method_Notsaved extends Mage_Payment_Model_Method_Abstr
|
|
471 |
) {
|
472 |
return Mage::getUrl('ewayrapid/sharedpage/start', array('_secure'=>true));
|
473 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
elseif (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
475 |
=== Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT
|
476 |
&& Mage::getSingleton('core/session')->getCheckoutExtension()
|
24 |
protected $_isInitializeNeeded = false;
|
25 |
protected $_canFetchTransactionInfo = true;
|
26 |
protected $_canReviewPayment = false;
|
27 |
+
protected $_canCreateBillingAgreement = false;
|
28 |
protected $_canManageRecurringProfiles = true;
|
29 |
protected $_connectionType;
|
30 |
protected $_isBackendOrder;
|
44 |
$this->_formBlockType = 'ewayrapid/form_sharedpage_notsaved';
|
45 |
}
|
46 |
}
|
47 |
+
|
48 |
+
if($this->_isBackendOrder){
|
49 |
+
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
50 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
51 |
+
) {
|
52 |
+
$this->_infoBlockType = 'ewayrapid/info_sharedpage_notsaved';
|
53 |
+
$this->_formBlockType = 'ewayrapid/form_sharedpage_notsaved';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* As of version 1.4.0 this payment method isn't used.
|
60 |
+
*
|
61 |
+
* @param Mage_Sales_Model_Quote|null $quote
|
62 |
+
* @return boolean
|
63 |
+
*/
|
64 |
+
public function isAvailable($quote = null) {
|
65 |
+
return false;
|
66 |
}
|
67 |
|
68 |
public function getConfigData($field, $storeId = null)
|
119 |
|
120 |
//Option choice
|
121 |
if ($data->getMethod() == 'ewayrapid_saved' && !$data->getTransparentSaved()) {
|
122 |
+
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for saved'));
|
123 |
} elseif ($data->getMethod() == 'ewayrapid_notsaved' && !$data->getTransparentNotsaved()) {
|
124 |
+
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for not saved'));
|
125 |
}
|
126 |
|
127 |
//New Token
|
130 |
&& $data->getSavedToken() == Eway_Rapid31_Model_Config::TOKEN_NEW
|
131 |
&& Mage::helper('ewayrapid/customer')->checkTokenListByType(Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD)
|
132 |
) {
|
133 |
+
Mage::throwException(Mage::helper('payment')->__('You can only save one PayPal account, please select existing PayPal account.'));
|
134 |
}
|
135 |
|
136 |
if ($data->getTransparentNotsaved())
|
198 |
*/
|
199 |
parent::validate();
|
200 |
if (!$this->_isBackendOrder) {
|
201 |
+
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE || $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME) {
|
202 |
return $this;
|
203 |
} elseif ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT ) {
|
204 |
return $this;
|
205 |
}
|
206 |
}
|
207 |
+
|
208 |
+
if($this->_isBackendOrder
|
209 |
+
&& $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
210 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
211 |
+
){
|
212 |
+
return $this;
|
213 |
+
}
|
214 |
+
|
215 |
$info = $this->getInfoInstance();
|
216 |
$errorMsg = false;
|
217 |
$availableTypes = explode(',',$this->getConfigData('cctypes'));
|
240 |
'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
|
241 |
// Master Card
|
242 |
'MC' => '/^5[1-5][0-9]{14}$/',
|
243 |
+
// Master Card 2017 - new MasterCard Range 2221-2720
|
244 |
+
//'MC' => '/(^5[1-5][0-9]{14}$)|(^2221[0-9]{12}$)|(^222[2-9][0-9]{12}$)|(^22[3-9][0-9]{13}$)|(^2[3-6][0-9]{14}$)|(^2720[0-9]{12}$)|(^27[0-1][0-9]{13}$)/',
|
245 |
// American Express
|
246 |
'AE' => '/^3[47][0-9]{13}$/',
|
247 |
// JCB
|
388 |
}
|
389 |
}
|
390 |
|
391 |
+
if ($this->_isBackendOrder) {
|
392 |
+
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
393 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
394 |
+
) {
|
395 |
+
return $this;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
400 |
if ($amount <= 0) {
|
401 |
+
Mage::throwException(Mage::helper('payment')->__('Invalid amount for capture.'));
|
402 |
}
|
403 |
|
404 |
$amount = round($amount * 100);
|
435 |
}
|
436 |
}
|
437 |
|
438 |
+
if ($this->_isBackendOrder) {
|
439 |
+
if ($this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
440 |
+
|| $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
441 |
+
) {
|
442 |
+
return $this;
|
443 |
+
}
|
444 |
+
}
|
445 |
+
|
446 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
447 |
if ($amount <= 0) {
|
448 |
+
Mage::throwException(Mage::helper('payment')->__('Invalid amount for authorize.'));
|
449 |
}
|
450 |
|
451 |
if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type') === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT
|
473 |
{
|
474 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
475 |
if ($amount <= 0) {
|
476 |
+
Mage::throwException(Mage::helper('payment')->__('Invalid amount for refund.'));
|
477 |
}
|
478 |
|
479 |
$amount = round($amount * 100);
|
516 |
) {
|
517 |
return Mage::getUrl('ewayrapid/sharedpage/start', array('_secure'=>true));
|
518 |
}
|
519 |
+
elseif (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
520 |
+
=== Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
521 |
+
&& Mage::getSingleton('core/session')->getCheckoutExtension()
|
522 |
+
){
|
523 |
+
return Mage::getUrl('ewayrapid/sharedpage/iframe', array('_secure'=>true));
|
524 |
+
}
|
525 |
elseif (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
526 |
=== Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT
|
527 |
&& Mage::getSingleton('core/session')->getCheckoutExtension()
|
@@ -125,7 +125,7 @@ class Eway_Rapid31_Model_Method_Saved extends Eway_Rapid31_Model_Method_Notsaved
|
|
125 |
|
126 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
127 |
if ($amount <= 0) {
|
128 |
-
Mage::throwException(Mage::helper('
|
129 |
}
|
130 |
$request = Mage::getModel('ewayrapid/request_token');
|
131 |
|
@@ -178,7 +178,7 @@ class Eway_Rapid31_Model_Method_Saved extends Eway_Rapid31_Model_Method_Notsaved
|
|
178 |
|
179 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
180 |
if ($amount <= 0) {
|
181 |
-
Mage::throwException(Mage::helper('
|
182 |
}
|
183 |
$request = Mage::getModel('ewayrapid/request_token');
|
184 |
|
125 |
|
126 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
127 |
if ($amount <= 0) {
|
128 |
+
Mage::throwException(Mage::helper('payment')->__('Invalid amount for capture.'));
|
129 |
}
|
130 |
$request = Mage::getModel('ewayrapid/request_token');
|
131 |
|
178 |
|
179 |
/* @var Mage_Sales_Model_Order_Payment $payment */
|
180 |
if ($amount <= 0) {
|
181 |
+
Mage::throwException(Mage::helper('payment')->__('Invalid amount for authorize.'));
|
182 |
}
|
183 |
$request = Mage::getModel('ewayrapid/request_token');
|
184 |
|
@@ -1,293 +1,293 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*/
|
5 |
-
class Eway_Rapid31_Model_Observer {
|
6 |
-
|
7 |
-
/* @var Magento_Sales_Model_Order_Invoice*/
|
8 |
-
var $_invoice;
|
9 |
-
|
10 |
-
public function myCards() {
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
public function checkCustomerMark() {
|
15 |
-
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
16 |
-
$fraud_enabled = Mage::getStoreConfig('payment/ewayrapid_general/block_fraud_customers');
|
17 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
18 |
-
$markFraud = $customer->getMarkFraud();
|
19 |
-
$unblock = $customer->getBlockFraudCustomer();
|
20 |
-
if((int)$markFraud === 1
|
21 |
-
&& $fraud_enabled
|
22 |
-
&& (int)$unblock === 0
|
23 |
-
) {
|
24 |
-
Mage::app()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
|
25 |
-
Mage::app()->getResponse()->sendResponse();
|
26 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('Your latest payment is being reviewed and you cannot place a new order temporarily. Please try again later.'));
|
27 |
-
exit;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
public function sales_order_save_before($observer) {
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
public function sales_order_save_after($observer) {
|
37 |
-
|
38 |
-
}
|
39 |
-
|
40 |
-
public function sales_order_place_before($observer) {
|
41 |
-
// Check order fraud here
|
42 |
-
// ...
|
43 |
-
$fraud = Mage::getSingleton('core/session')->getData('fraud');
|
44 |
-
if($fraud === 1) {
|
45 |
-
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
public function sales_order_place_after($observer) {
|
50 |
-
// Check order fraud here
|
51 |
-
// ...
|
52 |
-
|
53 |
-
$fraud = Mage::getSingleton('core/session')->getData('fraud');
|
54 |
-
if($fraud === 1) {
|
55 |
-
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
public function sales_order_invoice_save_after($observer)
|
60 |
-
{
|
61 |
-
try {
|
62 |
-
/* @var $order Magento_Sales_Model_Order_Invoice */
|
63 |
-
$this->_invoice = $observer->getEvent()->getInvoice();
|
64 |
-
$this->_invoice->sendEmail();
|
65 |
-
} catch (Mage_Core_Exception $e) {
|
66 |
-
Mage::log("Error sending invoice email: " . $e->getMessage());
|
67 |
-
}
|
68 |
-
return $this;
|
69 |
-
}
|
70 |
-
|
71 |
-
public function checkout_submit_all_after(Varien_Event_Observer $observer) {
|
72 |
-
$fraud = Mage::getSingleton('core/session')->getData('fraud');
|
73 |
-
$comment = Mage::getSingleton('core/session')->getData('fraudMessage');
|
74 |
-
// Read setting config enabled fraud or not
|
75 |
-
if($fraud === 1 && $order = $observer->getEvent()->getOrder()) {
|
76 |
-
$order->setState('fraud');
|
77 |
-
$order->setStatus('fraud');
|
78 |
-
if ($comment) {
|
79 |
-
$comment = 'An order is marked as Suspected Fraud. Because it contains: ' . $comment;
|
80 |
-
$order->addStatusHistoryComment($comment)
|
81 |
-
->setIsVisibleOnFront(false)
|
82 |
-
->setIsCustomerNotified(false);
|
83 |
-
}
|
84 |
-
$order->save();
|
85 |
-
|
86 |
-
// Update user to fraud
|
87 |
-
$session = Mage::getSingleton('customer/session');
|
88 |
-
if ($session->isLoggedIn()) {
|
89 |
-
$customer = $session->getCustomer();
|
90 |
-
$customer->setData('mark_fraud', 1);
|
91 |
-
$customer->save();
|
92 |
-
}
|
93 |
-
|
94 |
-
Mage::getSingleton('core/session')->unsetData('fraud');
|
95 |
-
Mage::getSingleton('core/session')->unsetData('fraudMessage');
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Update eway transaction for order
|
101 |
-
* @param Varien_Event_Observer $observer
|
102 |
-
*/
|
103 |
-
public function checkout_type_onepage_save_order_after(Varien_Event_Observer $observer) {
|
104 |
-
$order = $observer->getData('order');
|
105 |
-
$order->setEwayTransactionId($order->getPayment()->getTransactionId());
|
106 |
-
$order->save();
|
107 |
-
|
108 |
-
}
|
109 |
-
/*
|
110 |
-
* create order of recurring profile
|
111 |
-
*
|
112 |
-
* @param Varien_Event_Observer $observer
|
113 |
-
*/
|
114 |
-
public function createRecurringOrder(Varien_Event_Observer $observer)
|
115 |
-
{
|
116 |
-
$profiles = $observer->getEvent()->getRecurringProfiles();
|
117 |
-
|
118 |
-
if (isset($profiles[0])) {
|
119 |
-
/** @var Mage_Sales_Model_Recurring_Profile $profile */
|
120 |
-
$profile = $profiles[0];
|
121 |
-
} else {
|
122 |
-
return;
|
123 |
-
}
|
124 |
-
|
125 |
-
//if Billing Frequency <= 0 or isn't numeric, Status of recurring profile changed to canceled
|
126 |
-
if (!$profile->getPeriodFrequency()
|
127 |
-
|| (string)(int) $profile->getPeriodFrequency() !== ltrim($profile->getPeriodFrequency(), '0')
|
128 |
-
|| (int) $profile->getPeriodFrequency() <= 0
|
129 |
-
) {
|
130 |
-
$profile->cancel();
|
131 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('Billing Frequency is wrong. It must be numeric and greater than 0. Status of recurring profile is changed to canceled'));
|
132 |
-
$session = Mage::getSingleton('checkout/type_onepage')->getCheckout();
|
133 |
-
$session->setLastRecurringProfileIds(null);
|
134 |
-
return;
|
135 |
-
}
|
136 |
-
|
137 |
-
$quote = $observer->getEvent()->getQuote();
|
138 |
-
|
139 |
-
/** @var Eway_Rapid31_Model_RecurringProfile $recurringProfile */
|
140 |
-
$recurringProfile = Mage::getModel('ewayrapid/recurringProfile');
|
141 |
-
$orderItemInfo = $profile->getOrderItemInfo();
|
142 |
-
$buyRequest = unserialize($orderItemInfo['info_buyRequest']);
|
143 |
-
|
144 |
-
// timezone used as store's timezone
|
145 |
-
$startDate = isset($buyRequest['recurring_profile_start_datetime']) && $buyRequest['recurring_profile_start_datetime'] ? $buyRequest['recurring_profile_start_datetime'] : null;
|
146 |
-
|
147 |
-
$additional = $profile->getAdditionalInfo();
|
148 |
-
$token = $recurringProfile->processToken($quote);
|
149 |
-
$token = json_decode($token, true);
|
150 |
-
$additional['token'] = $token;
|
151 |
-
$additional['startDate'] = $startDate;
|
152 |
-
$additional['initialFee'] = true;
|
153 |
-
$profile->setAdditionalInfo($additional);
|
154 |
-
$profile->save();
|
155 |
-
|
156 |
-
// charge Initial Fee if It is greater than 0 and is numeric
|
157 |
-
if ($profile->getInitAmount()
|
158 |
-
&& (float) $profile->getInitAmount() > 0
|
159 |
-
//&& (string)(int) $profile->getInitAmount() === ltrim($profile->getInitAmount(), '0')
|
160 |
-
) {
|
161 |
-
try {
|
162 |
-
$recurringProfile->processInitialFee($profile);
|
163 |
-
} catch (Exception $e) {
|
164 |
-
$additional = $profile->getAdditionalInfo();
|
165 |
-
$additional['initialFee'] = false;
|
166 |
-
if ($profile->getInitMayFail() == '1') {
|
167 |
-
// Allow Initial Fee Failure = yes
|
168 |
-
// change status recurring profile = suspended
|
169 |
-
$profile->suspend();
|
170 |
-
$errorMessage = Mage::getSingleton('core/session')->getData('errorMessage');
|
171 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('An error occurred while making the transaction by Initial Fee (Error message: %s). Status of recurring profile is changed to suspended.', $errorMessage));
|
172 |
-
return;
|
173 |
-
|
174 |
-
} else {
|
175 |
-
// Allow Initial Fee Failure = no
|
176 |
-
// Auto Bill on Next Cycle = no
|
177 |
-
// set additionalInfo['outstanding'] = Initial Fee
|
178 |
-
if (!$profile->getBillFailedLater()) {
|
179 |
-
$additional['outstanding'] = $profile->getInitAmount();
|
180 |
-
}
|
181 |
-
}
|
182 |
-
$profile->setAdditionalInfo($additional);
|
183 |
-
$profile->save();
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
-
// check current time >= started time
|
188 |
-
if (!$startDate || $recurringProfile->checkRecurringTimeStart($startDate)) {
|
189 |
-
try {
|
190 |
-
// create order
|
191 |
-
// before day = current date // check if frequency >1day
|
192 |
-
// next day with current date
|
193 |
-
$recurringProfile->processRequest($profile);
|
194 |
-
} catch (Exception $e) {
|
195 |
-
$errorMessage = Mage::getSingleton('core/session')->getData('errorMessage');
|
196 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. (Error message: %s)', $errorMessage));
|
197 |
-
// suspend recurring profile when response data contains error and/or TransactionID is null
|
198 |
-
$checkPaymentFailures = $recurringProfile->checkMaxPaymentFailures($profile);
|
199 |
-
if (!$checkPaymentFailures) {
|
200 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('Out of Payment failures. Status of recurring profile is changed to suspended.'));
|
201 |
-
}
|
202 |
-
return;
|
203 |
-
}
|
204 |
-
} else {
|
205 |
-
// not created order
|
206 |
-
// before day = null
|
207 |
-
// next day = date of started time
|
208 |
-
$additionalInfo = $profile->getAdditionalInfo();
|
209 |
-
$additionalInfo['nextDate'] = $startDate;
|
210 |
-
$profile->setAdditionalInfo($additionalInfo);
|
211 |
-
$profile->save();
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* load recurring
|
217 |
-
*
|
218 |
-
* @param
|
219 |
-
* @return array
|
220 |
-
*/
|
221 |
-
protected function _loadProfileByMethod($methodCode = 'ewayrapid_saved')
|
222 |
-
{
|
223 |
-
$modelRecurringProfile = Mage::getModel('sales/recurring_profile')->getCollection()
|
224 |
-
->addFieldToFilter('method_code', $methodCode)
|
225 |
-
->addFieldToFilter('state', 'active')
|
226 |
-
->addFieldToFilter('additional_info', array('notnull' => true))
|
227 |
-
->addFieldToFilter('period_max_cycles', array(
|
228 |
-
array('null' => true),
|
229 |
-
array('gt' => 0)
|
230 |
-
)
|
231 |
-
);
|
232 |
-
$profiles = array();
|
233 |
-
|
234 |
-
foreach ($modelRecurringProfile as $item) {
|
235 |
-
/** @var Mage_Sales_Model_Recurring_Profile $item */
|
236 |
-
$additionalInfo = unserialize($item->getAdditionalInfo());
|
237 |
-
$billingInfo = unserialize($item->getBillingAddressInfo());
|
238 |
-
$addressInfo = unserialize($item->getShippingAddressInfo());
|
239 |
-
$orderItemInfo = unserialize($item->getOrderItemInfo());
|
240 |
-
$orderInfo = unserialize($item->getOrderInfo());
|
241 |
-
$item->setBillingAddressInfo($billingInfo);
|
242 |
-
$item->setShippingAddressInfo($addressInfo);
|
243 |
-
$item->setOrderItemInfo($orderItemInfo);
|
244 |
-
$item->setAdditionalInfo($additionalInfo);
|
245 |
-
$item->setOrderInfo($orderInfo);
|
246 |
-
$profiles[] = $item;
|
247 |
-
}
|
248 |
-
return $profiles;
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* cron recurring profile to create order
|
253 |
-
*/
|
254 |
-
public function cronRecurringOrder()
|
255 |
-
{
|
256 |
-
$profiles = $this->_loadProfileByMethod();
|
257 |
-
foreach ($profiles as $profile) {
|
258 |
-
/** @var Mage_Sales_Model_Recurring_Profile $profile */
|
259 |
-
/** @var Eway_Rapid31_Model_RecurringProfile $recurringProfile */
|
260 |
-
$recurringProfile = Mage::getModel('ewayrapid/recurringProfile');
|
261 |
-
|
262 |
-
$recurringProfile->updateNextDate($profile);
|
263 |
-
|
264 |
-
// check run cron job conditions
|
265 |
-
if ($recurringProfile->checkRecurringProfileRunCronJob($profile)) {
|
266 |
-
// check charge money initial Fee
|
267 |
-
$additional = $profile->getAdditionalInfo();
|
268 |
-
if ($additional['initialFee'] == false) {
|
269 |
-
if (!$profile->getInitMayFail() && $profile->getBillFailedLater()) {
|
270 |
-
try {
|
271 |
-
$recurringProfile->processInitialFee($profile);
|
272 |
-
$additional['initialFee'] = true;
|
273 |
-
$profile->setAdditionalInfo($additional);
|
274 |
-
$profile->save();
|
275 |
-
} catch (Exception $e) {
|
276 |
-
Mage::logException($e);
|
277 |
-
}
|
278 |
-
}
|
279 |
-
}
|
280 |
-
|
281 |
-
$profile->setIsCronJob(true);
|
282 |
-
|
283 |
-
try {
|
284 |
-
$recurringProfile->processRequest($profile);
|
285 |
-
} catch (Exception $e) {
|
286 |
-
$paymentFailures = $recurringProfile->checkMaxPaymentFailures($profile);
|
287 |
-
Mage::logException($e);
|
288 |
-
}
|
289 |
-
}
|
290 |
-
}
|
291 |
-
return;
|
292 |
-
}
|
293 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*/
|
5 |
+
class Eway_Rapid31_Model_Observer {
|
6 |
+
|
7 |
+
/* @var Magento_Sales_Model_Order_Invoice*/
|
8 |
+
var $_invoice;
|
9 |
+
|
10 |
+
public function myCards() {
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
public function checkCustomerMark() {
|
15 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
16 |
+
$fraud_enabled = Mage::getStoreConfig('payment/ewayrapid_general/block_fraud_customers');
|
17 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
18 |
+
$markFraud = $customer->getMarkFraud();
|
19 |
+
$unblock = $customer->getBlockFraudCustomer();
|
20 |
+
if((int)$markFraud === 1
|
21 |
+
&& $fraud_enabled
|
22 |
+
&& (int)$unblock === 0
|
23 |
+
) {
|
24 |
+
Mage::app()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
|
25 |
+
Mage::app()->getResponse()->sendResponse();
|
26 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('Your latest payment is being reviewed and you cannot place a new order temporarily. Please try again later.'));
|
27 |
+
exit;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
public function sales_order_save_before($observer) {
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
public function sales_order_save_after($observer) {
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
public function sales_order_place_before($observer) {
|
41 |
+
// Check order fraud here
|
42 |
+
// ...
|
43 |
+
$fraud = Mage::getSingleton('core/session')->getData('fraud');
|
44 |
+
if($fraud === 1) {
|
45 |
+
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function sales_order_place_after($observer) {
|
50 |
+
// Check order fraud here
|
51 |
+
// ...
|
52 |
+
|
53 |
+
$fraud = Mage::getSingleton('core/session')->getData('fraud');
|
54 |
+
if($fraud === 1) {
|
55 |
+
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
public function sales_order_invoice_save_after($observer)
|
60 |
+
{
|
61 |
+
try {
|
62 |
+
/* @var $order Magento_Sales_Model_Order_Invoice */
|
63 |
+
$this->_invoice = $observer->getEvent()->getInvoice();
|
64 |
+
$this->_invoice->sendEmail();
|
65 |
+
} catch (Mage_Core_Exception $e) {
|
66 |
+
Mage::log("Error sending invoice email: " . $e->getMessage());
|
67 |
+
}
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
|
71 |
+
public function checkout_submit_all_after(Varien_Event_Observer $observer) {
|
72 |
+
$fraud = Mage::getSingleton('core/session')->getData('fraud');
|
73 |
+
$comment = Mage::getSingleton('core/session')->getData('fraudMessage');
|
74 |
+
// Read setting config enabled fraud or not
|
75 |
+
if($fraud === 1 && $order = $observer->getEvent()->getOrder()) {
|
76 |
+
$order->setState('fraud');
|
77 |
+
$order->setStatus('fraud');
|
78 |
+
if ($comment) {
|
79 |
+
$comment = 'An order is marked as Suspected Fraud. Because it contains: ' . $comment;
|
80 |
+
$order->addStatusHistoryComment($comment)
|
81 |
+
->setIsVisibleOnFront(false)
|
82 |
+
->setIsCustomerNotified(false);
|
83 |
+
}
|
84 |
+
$order->save();
|
85 |
+
|
86 |
+
// Update user to fraud
|
87 |
+
$session = Mage::getSingleton('customer/session');
|
88 |
+
if ($session->isLoggedIn()) {
|
89 |
+
$customer = $session->getCustomer();
|
90 |
+
$customer->setData('mark_fraud', 1);
|
91 |
+
$customer->save();
|
92 |
+
}
|
93 |
+
|
94 |
+
Mage::getSingleton('core/session')->unsetData('fraud');
|
95 |
+
Mage::getSingleton('core/session')->unsetData('fraudMessage');
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Update eway transaction for order
|
101 |
+
* @param Varien_Event_Observer $observer
|
102 |
+
*/
|
103 |
+
public function checkout_type_onepage_save_order_after(Varien_Event_Observer $observer) {
|
104 |
+
$order = $observer->getData('order');
|
105 |
+
$order->setEwayTransactionId($order->getPayment()->getTransactionId());
|
106 |
+
$order->save();
|
107 |
+
|
108 |
+
}
|
109 |
+
/*
|
110 |
+
* create order of recurring profile
|
111 |
+
*
|
112 |
+
* @param Varien_Event_Observer $observer
|
113 |
+
*/
|
114 |
+
public function createRecurringOrder(Varien_Event_Observer $observer)
|
115 |
+
{
|
116 |
+
$profiles = $observer->getEvent()->getRecurringProfiles();
|
117 |
+
|
118 |
+
if (isset($profiles[0])) {
|
119 |
+
/** @var Mage_Sales_Model_Recurring_Profile $profile */
|
120 |
+
$profile = $profiles[0];
|
121 |
+
} else {
|
122 |
+
return;
|
123 |
+
}
|
124 |
+
|
125 |
+
//if Billing Frequency <= 0 or isn't numeric, Status of recurring profile changed to canceled
|
126 |
+
if (!$profile->getPeriodFrequency()
|
127 |
+
|| (string)(int) $profile->getPeriodFrequency() !== ltrim($profile->getPeriodFrequency(), '0')
|
128 |
+
|| (int) $profile->getPeriodFrequency() <= 0
|
129 |
+
) {
|
130 |
+
$profile->cancel();
|
131 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('Billing Frequency is wrong. It must be numeric and greater than 0. Status of recurring profile is changed to canceled'));
|
132 |
+
$session = Mage::getSingleton('checkout/type_onepage')->getCheckout();
|
133 |
+
$session->setLastRecurringProfileIds(null);
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
+
$quote = $observer->getEvent()->getQuote();
|
138 |
+
|
139 |
+
/** @var Eway_Rapid31_Model_RecurringProfile $recurringProfile */
|
140 |
+
$recurringProfile = Mage::getModel('ewayrapid/recurringProfile');
|
141 |
+
$orderItemInfo = $profile->getOrderItemInfo();
|
142 |
+
$buyRequest = unserialize($orderItemInfo['info_buyRequest']);
|
143 |
+
|
144 |
+
// timezone used as store's timezone
|
145 |
+
$startDate = isset($buyRequest['recurring_profile_start_datetime']) && $buyRequest['recurring_profile_start_datetime'] ? $buyRequest['recurring_profile_start_datetime'] : null;
|
146 |
+
|
147 |
+
$additional = $profile->getAdditionalInfo();
|
148 |
+
$token = $recurringProfile->processToken($quote);
|
149 |
+
$token = json_decode($token, true);
|
150 |
+
$additional['token'] = $token;
|
151 |
+
$additional['startDate'] = $startDate;
|
152 |
+
$additional['initialFee'] = true;
|
153 |
+
$profile->setAdditionalInfo($additional);
|
154 |
+
$profile->save();
|
155 |
+
|
156 |
+
// charge Initial Fee if It is greater than 0 and is numeric
|
157 |
+
if ($profile->getInitAmount()
|
158 |
+
&& (float) $profile->getInitAmount() > 0
|
159 |
+
//&& (string)(int) $profile->getInitAmount() === ltrim($profile->getInitAmount(), '0')
|
160 |
+
) {
|
161 |
+
try {
|
162 |
+
$recurringProfile->processInitialFee($profile);
|
163 |
+
} catch (Exception $e) {
|
164 |
+
$additional = $profile->getAdditionalInfo();
|
165 |
+
$additional['initialFee'] = false;
|
166 |
+
if ($profile->getInitMayFail() == '1') {
|
167 |
+
// Allow Initial Fee Failure = yes
|
168 |
+
// change status recurring profile = suspended
|
169 |
+
$profile->suspend();
|
170 |
+
$errorMessage = Mage::getSingleton('core/session')->getData('errorMessage');
|
171 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('An error occurred while making the transaction by Initial Fee (Error message: %s). Status of recurring profile is changed to suspended.', $errorMessage));
|
172 |
+
return;
|
173 |
+
|
174 |
+
} else {
|
175 |
+
// Allow Initial Fee Failure = no
|
176 |
+
// Auto Bill on Next Cycle = no
|
177 |
+
// set additionalInfo['outstanding'] = Initial Fee
|
178 |
+
if (!$profile->getBillFailedLater()) {
|
179 |
+
$additional['outstanding'] = $profile->getInitAmount();
|
180 |
+
}
|
181 |
+
}
|
182 |
+
$profile->setAdditionalInfo($additional);
|
183 |
+
$profile->save();
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
// check current time >= started time
|
188 |
+
if (!$startDate || $recurringProfile->checkRecurringTimeStart($startDate)) {
|
189 |
+
try {
|
190 |
+
// create order
|
191 |
+
// before day = current date // check if frequency >1day
|
192 |
+
// next day with current date
|
193 |
+
$recurringProfile->processRequest($profile);
|
194 |
+
} catch (Exception $e) {
|
195 |
+
$errorMessage = Mage::getSingleton('core/session')->getData('errorMessage');
|
196 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. (Error message: %s)', $errorMessage));
|
197 |
+
// suspend recurring profile when response data contains error and/or TransactionID is null
|
198 |
+
$checkPaymentFailures = $recurringProfile->checkMaxPaymentFailures($profile);
|
199 |
+
if (!$checkPaymentFailures) {
|
200 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('Out of Payment failures. Status of recurring profile is changed to suspended.'));
|
201 |
+
}
|
202 |
+
return;
|
203 |
+
}
|
204 |
+
} else {
|
205 |
+
// not created order
|
206 |
+
// before day = null
|
207 |
+
// next day = date of started time
|
208 |
+
$additionalInfo = $profile->getAdditionalInfo();
|
209 |
+
$additionalInfo['nextDate'] = $startDate;
|
210 |
+
$profile->setAdditionalInfo($additionalInfo);
|
211 |
+
$profile->save();
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* load recurring profiles if methodcode = ewayrapid_saved or ewayrapid_ewayone
|
217 |
+
*
|
218 |
+
* @param array $methodCode
|
219 |
+
* @return array
|
220 |
+
*/
|
221 |
+
protected function _loadProfileByMethod($methodCode = ['ewayrapid_saved', 'ewayrapid_ewayone'])
|
222 |
+
{
|
223 |
+
$modelRecurringProfile = Mage::getModel('sales/recurring_profile')->getCollection()
|
224 |
+
->addFieldToFilter('method_code', array('in' => $methodCode))
|
225 |
+
->addFieldToFilter('state', 'active')
|
226 |
+
->addFieldToFilter('additional_info', array('notnull' => true))
|
227 |
+
->addFieldToFilter('period_max_cycles', array(
|
228 |
+
array('null' => true),
|
229 |
+
array('gt' => 0)
|
230 |
+
)
|
231 |
+
);
|
232 |
+
$profiles = array();
|
233 |
+
|
234 |
+
foreach ($modelRecurringProfile as $item) {
|
235 |
+
/** @var Mage_Sales_Model_Recurring_Profile $item */
|
236 |
+
$additionalInfo = unserialize($item->getAdditionalInfo());
|
237 |
+
$billingInfo = unserialize($item->getBillingAddressInfo());
|
238 |
+
$addressInfo = unserialize($item->getShippingAddressInfo());
|
239 |
+
$orderItemInfo = unserialize($item->getOrderItemInfo());
|
240 |
+
$orderInfo = unserialize($item->getOrderInfo());
|
241 |
+
$item->setBillingAddressInfo($billingInfo);
|
242 |
+
$item->setShippingAddressInfo($addressInfo);
|
243 |
+
$item->setOrderItemInfo($orderItemInfo);
|
244 |
+
$item->setAdditionalInfo($additionalInfo);
|
245 |
+
$item->setOrderInfo($orderInfo);
|
246 |
+
$profiles[] = $item;
|
247 |
+
}
|
248 |
+
return $profiles;
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* cron recurring profile to create order
|
253 |
+
*/
|
254 |
+
public function cronRecurringOrder()
|
255 |
+
{
|
256 |
+
$profiles = $this->_loadProfileByMethod();
|
257 |
+
foreach ($profiles as $profile) {
|
258 |
+
/** @var Mage_Sales_Model_Recurring_Profile $profile */
|
259 |
+
/** @var Eway_Rapid31_Model_RecurringProfile $recurringProfile */
|
260 |
+
$recurringProfile = Mage::getModel('ewayrapid/recurringProfile');
|
261 |
+
|
262 |
+
$recurringProfile->updateNextDate($profile);
|
263 |
+
|
264 |
+
// check run cron job conditions
|
265 |
+
if ($recurringProfile->checkRecurringProfileRunCronJob($profile)) {
|
266 |
+
// check charge money initial Fee
|
267 |
+
$additional = $profile->getAdditionalInfo();
|
268 |
+
if ($additional['initialFee'] == false) {
|
269 |
+
if (!$profile->getInitMayFail() && $profile->getBillFailedLater()) {
|
270 |
+
try {
|
271 |
+
$recurringProfile->processInitialFee($profile);
|
272 |
+
$additional['initialFee'] = true;
|
273 |
+
$profile->setAdditionalInfo($additional);
|
274 |
+
$profile->save();
|
275 |
+
} catch (Exception $e) {
|
276 |
+
Mage::logException($e);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
$profile->setIsCronJob(true);
|
282 |
+
|
283 |
+
try {
|
284 |
+
$recurringProfile->processRequest($profile);
|
285 |
+
} catch (Exception $e) {
|
286 |
+
$paymentFailures = $recurringProfile->checkMaxPaymentFailures($profile);
|
287 |
+
Mage::logException($e);
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
291 |
+
return;
|
292 |
+
}
|
293 |
}
|
@@ -65,7 +65,7 @@ class Eway_Rapid31_Model_RecurringProfile
|
|
65 |
protected function _checkRecurringProfile()
|
66 |
{
|
67 |
$methodCode = $this->_recurringProfile->getMethodCode();
|
68 |
-
if ($methodCode != 'ewayrapid_saved') {
|
69 |
throw new Exception(sprintf('Method "%s" is not eWAY Rapid (Saved).', $methodCode));
|
70 |
}
|
71 |
if (!Mage::helper('ewayrapid')->isSavedMethodEnabled()) {
|
@@ -459,6 +459,9 @@ class Eway_Rapid31_Model_RecurringProfile
|
|
459 |
}
|
460 |
|
461 |
/**
|
|
|
|
|
|
|
462 |
* @param Mage_Sales_Model_Recurring_Profile $profile
|
463 |
*/
|
464 |
public function updateNextDate(Mage_Sales_Model_Recurring_Profile $profile)
|
@@ -471,7 +474,7 @@ class Eway_Rapid31_Model_RecurringProfile
|
|
471 |
$currentDate = new DateTime(date("Y-m-d", Mage::getModel('core/date')->timestamp(time())), new DateTimeZone($timezone));
|
472 |
if ($nextDate < $currentDate) {
|
473 |
$this->_recurringProfile = $profile;
|
474 |
-
$startDate = $
|
475 |
$this->nextDate($startDate);
|
476 |
}
|
477 |
}
|
65 |
protected function _checkRecurringProfile()
|
66 |
{
|
67 |
$methodCode = $this->_recurringProfile->getMethodCode();
|
68 |
+
if ($methodCode != 'ewayrapid_saved' && $methodCode != 'ewayrapid_ewayone') {
|
69 |
throw new Exception(sprintf('Method "%s" is not eWAY Rapid (Saved).', $methodCode));
|
70 |
}
|
71 |
if (!Mage::helper('ewayrapid')->isSavedMethodEnabled()) {
|
459 |
}
|
460 |
|
461 |
/**
|
462 |
+
* If next date on profile is less than today, set next date to today
|
463 |
+
* (fixes missed days)
|
464 |
+
*
|
465 |
* @param Mage_Sales_Model_Recurring_Profile $profile
|
466 |
*/
|
467 |
public function updateNextDate(Mage_Sales_Model_Recurring_Profile $profile)
|
474 |
$currentDate = new DateTime(date("Y-m-d", Mage::getModel('core/date')->timestamp(time())), new DateTimeZone($timezone));
|
475 |
if ($nextDate < $currentDate) {
|
476 |
$this->_recurringProfile = $profile;
|
477 |
+
$startDate = $currentDate->format('Y-m-d');
|
478 |
$this->nextDate($startDate);
|
479 |
}
|
480 |
}
|
@@ -1,156 +1,180 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class Eway_Rapid31_Model_Request_Abstract
|
5 |
-
*
|
6 |
-
* @method Eway_Rapid31_Model_Field_Customer getCustomer()
|
7 |
-
* @method Eway_Rapid31_Model_Request_Abstract setCustomer(Eway_Rapid31_Model_Field_Customer $value)
|
8 |
-
* @method Eway_Rapid31_Model_Field_ShippingAddress getShippingAddress()
|
9 |
-
* @method Eway_Rapid31_Model_Request_Abstract setShippingAddress(Eway_Rapid31_Model_Field_ShippingAddress $value)
|
10 |
-
* @method string getShippingMethod()
|
11 |
-
* @method Eway_Rapid31_Model_Request_Abstract setShippingMethod(string $value)
|
12 |
-
* @method array getItems()
|
13 |
-
* @method Eway_Rapid31_Model_Request_Abstract setItems(array $value)
|
14 |
-
* @method Eway_Rapid31_Model_Field_Payment getPayment()
|
15 |
-
* @method Eway_Rapid31_Model_Request_Abstract setPayment(Eway_Rapid31_Model_Field_Payment $value)
|
16 |
-
* @method string getDeviceID()
|
17 |
-
* @method Eway_Rapid31_Model_Request_Abstract setDeviceID(string $value)
|
18 |
-
* @method string getCustomerIP()
|
19 |
-
* @method Eway_Rapid31_Model_Request_Abstract setCustomerIP(string $value)
|
20 |
-
* @method string getPartnerID()
|
21 |
-
* @method Eway_Rapid31_Model_Request_Abstract setPartnerID(string $value)
|
22 |
-
* @method string getTransactionType()
|
23 |
-
* @method Eway_Rapid31_Model_Request_Abstract setTransactionType(string $value)
|
24 |
-
* @method string getMethod()
|
25 |
-
* @method Eway_Rapid31_Model_Request_Abstract setMethod(string $value)
|
26 |
-
* @method int getTransactionId()
|
27 |
-
* @method Eway_Rapid31_Model_Request_Abstract setTransactionId(int $value)
|
28 |
-
* @method Eway_Rapid31_Model_Field_Payment getRefund()
|
29 |
-
* @method Eway_Rapid31_Model_Request_Abstract setRefund(Eway_Rapid31_Model_Field_Payment $value)
|
30 |
-
* @method string getRedirectUrl()
|
31 |
-
* @method Eway_Rapid31_Model_Request_Abstract setRedirectUrl(string $value)
|
32 |
-
* @method string getCheckoutPayment()
|
33 |
-
* @method Eway_Rapid31_Model_Request_Abstract setCheckoutPayment(bool $value)
|
34 |
-
* @method string getCheckoutURL()
|
35 |
-
* @method Eway_Rapid31_Model_Request_Abstract setCheckoutURL(string $value)
|
36 |
-
* @method string getCancelUrl()
|
37 |
-
* @method Eway_Rapid31_Model_Request_Abstract setCancelUrl(string $value)
|
38 |
-
* @method Eway_Rapid31_Model_Request_Abstract setCustomerReadOnly(bool $value)
|
39 |
-
*/
|
40 |
-
abstract class Eway_Rapid31_Model_Request_Abstract extends Eway_Rapid31_Model_JsonSerializableAbstract
|
41 |
-
{
|
42 |
-
const DEBUG_FILE = 'ewayrapid31_api_request.log';
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @var Eway_Rapid31_Model_Config
|
46 |
-
*/
|
47 |
-
protected $_config = null;
|
48 |
-
|
49 |
-
protected function _construct()
|
50 |
-
{
|
51 |
-
$this->_config = Mage::getSingleton('ewayrapid/config');
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Do the main API request.
|
56 |
-
* All API request to eWAY should call this function with appropriate parameters, after set all necessary data.
|
57 |
-
*
|
58 |
-
* @param string $action can be one of POST, GET, DELETE or PUT
|
59 |
-
* @param string $method
|
60 |
-
* @return Eway_Rapid31_Model_Response
|
61 |
-
*/
|
62 |
-
protected function _doRapidAPI($action, $method = 'POST') {
|
63 |
-
|
64 |
-
$url = $this->_config->getRapidAPIUrl($action);
|
65 |
-
$mode = $this->_config->isSandbox() ? '(Sandbox)' : '(Live)';
|
66 |
-
$this->_log('>>>>> START REQUEST ' . $mode . ' (' . $method . ') ' . ' : ' . $url);
|
67 |
-
|
68 |
-
$ch = curl_init($url);
|
69 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER,
|
70 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_config->getBasicAuthenticationHeader());
|
71 |
-
switch($method) {
|
72 |
-
case 'POST':
|
73 |
-
curl_setopt($ch, CURLOPT_POST, true);
|
74 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->jsonSerialize());
|
75 |
-
$this->_logPostJSON();
|
76 |
-
break;
|
77 |
-
case 'GET':
|
78 |
-
case 'DELETE':
|
79 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
80 |
-
break;
|
81 |
-
case 'PUT':
|
82 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
83 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->jsonSerialize());
|
84 |
-
$this->_logPostJSON();
|
85 |
-
break;
|
86 |
-
}
|
87 |
-
|
88 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
89 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
90 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->_config->isEnableSSLVerification());
|
91 |
-
|
92 |
-
$result = curl_exec($ch);
|
93 |
-
|
94 |
-
$this->_log('<<<<< RESPONSE:');
|
95 |
-
$response = Mage::getModel('ewayrapid/response');
|
96 |
-
if (curl_errno($ch) != CURLE_OK) {
|
97 |
-
$response->isSuccess(false);
|
98 |
-
$response->setMessage(Mage::helper('ewayrapid')->__("There is an error in making API request: %s", curl_error($ch)));
|
99 |
-
$this->_log("There is an error in making API request: " . curl_error($ch));
|
100 |
-
} else {
|
101 |
-
$info = curl_getinfo($ch);
|
102 |
-
$http_code = intval(trim($info['http_code']));
|
103 |
-
if ($http_code == 401 || $http_code == 404 || $http_code == 403) {
|
104 |
-
$response->isSuccess(false);
|
105 |
-
$response->setMessage(Mage::helper('ewayrapid')->__("Please check the API Key and Password %s", $mode));
|
106 |
-
$this->_log('Access denied. HTTP_CODE = ' . $info['http_code']);
|
107 |
-
} elseif ($http_code != 200) {
|
108 |
-
$response->isSuccess(false);
|
109 |
-
$response->setMessage(Mage::helper('ewayrapid')->__("Error connecting to payment gateway, please try again"));
|
110 |
-
$this->_log('Error connecting to payment gateway. HTTP_CODE = ' . $info['http_code']);
|
111 |
-
} else {
|
112 |
-
$response->isSuccess(true);
|
113 |
-
$response->decodeJSON($result);
|
114 |
-
if($this->_config->isDebug()) {
|
115 |
-
$this->_log('SUCCESS. Response body: ');
|
116 |
-
$this->_log(print_r(json_decode($result, true), true));
|
117 |
-
}
|
118 |
-
$this->_log('SUCCESS. HTTP_CODE = ' . $info['http_code']);
|
119 |
-
}
|
120 |
-
curl_close($ch);
|
121 |
-
}
|
122 |
-
|
123 |
-
$this->_log('===== END REQUEST.');
|
124 |
-
return $response;
|
125 |
-
}
|
126 |
-
|
127 |
-
protected function _logPostJSON()
|
128 |
-
{
|
129 |
-
if($this->_config->isDebug()) {
|
130 |
-
$cardDetails = null;
|
131 |
-
if($this->getCustomer() && $this->getCustomer()->getCardDetails()) {
|
132 |
-
$cardDetails = $this->getCustomer()->getCardDetails();
|
133 |
-
$cardDetails->shouldBeMasked();
|
134 |
-
}
|
135 |
-
$this->_log('Request body:');
|
136 |
-
$this->_log(print_r($this->getJsonData(), true));
|
137 |
-
if(!is_null($cardDetails)) {
|
138 |
-
$cardDetails->shouldBeMasked(false);
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
protected function _log($message, $file = self::DEBUG_FILE)
|
144 |
-
{
|
145 |
-
if($this->_config->isDebug()) {
|
146 |
-
Mage::log($message, Zend_Log::DEBUG, $file, true);
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
protected function _fixTitle($title) {
|
151 |
-
if ($title == 'n/a' || empty($title)) {
|
152 |
-
return 'Mr.';
|
153 |
-
}
|
154 |
-
return $title;
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Eway_Rapid31_Model_Request_Abstract
|
5 |
+
*
|
6 |
+
* @method Eway_Rapid31_Model_Field_Customer getCustomer()
|
7 |
+
* @method Eway_Rapid31_Model_Request_Abstract setCustomer(Eway_Rapid31_Model_Field_Customer $value)
|
8 |
+
* @method Eway_Rapid31_Model_Field_ShippingAddress getShippingAddress()
|
9 |
+
* @method Eway_Rapid31_Model_Request_Abstract setShippingAddress(Eway_Rapid31_Model_Field_ShippingAddress $value)
|
10 |
+
* @method string getShippingMethod()
|
11 |
+
* @method Eway_Rapid31_Model_Request_Abstract setShippingMethod(string $value)
|
12 |
+
* @method array getItems()
|
13 |
+
* @method Eway_Rapid31_Model_Request_Abstract setItems(array $value)
|
14 |
+
* @method Eway_Rapid31_Model_Field_Payment getPayment()
|
15 |
+
* @method Eway_Rapid31_Model_Request_Abstract setPayment(Eway_Rapid31_Model_Field_Payment $value)
|
16 |
+
* @method string getDeviceID()
|
17 |
+
* @method Eway_Rapid31_Model_Request_Abstract setDeviceID(string $value)
|
18 |
+
* @method string getCustomerIP()
|
19 |
+
* @method Eway_Rapid31_Model_Request_Abstract setCustomerIP(string $value)
|
20 |
+
* @method string getPartnerID()
|
21 |
+
* @method Eway_Rapid31_Model_Request_Abstract setPartnerID(string $value)
|
22 |
+
* @method string getTransactionType()
|
23 |
+
* @method Eway_Rapid31_Model_Request_Abstract setTransactionType(string $value)
|
24 |
+
* @method string getMethod()
|
25 |
+
* @method Eway_Rapid31_Model_Request_Abstract setMethod(string $value)
|
26 |
+
* @method int getTransactionId()
|
27 |
+
* @method Eway_Rapid31_Model_Request_Abstract setTransactionId(int $value)
|
28 |
+
* @method Eway_Rapid31_Model_Field_Payment getRefund()
|
29 |
+
* @method Eway_Rapid31_Model_Request_Abstract setRefund(Eway_Rapid31_Model_Field_Payment $value)
|
30 |
+
* @method string getRedirectUrl()
|
31 |
+
* @method Eway_Rapid31_Model_Request_Abstract setRedirectUrl(string $value)
|
32 |
+
* @method string getCheckoutPayment()
|
33 |
+
* @method Eway_Rapid31_Model_Request_Abstract setCheckoutPayment(bool $value)
|
34 |
+
* @method string getCheckoutURL()
|
35 |
+
* @method Eway_Rapid31_Model_Request_Abstract setCheckoutURL(string $value)
|
36 |
+
* @method string getCancelUrl()
|
37 |
+
* @method Eway_Rapid31_Model_Request_Abstract setCancelUrl(string $value)
|
38 |
+
* @method Eway_Rapid31_Model_Request_Abstract setCustomerReadOnly(bool $value)
|
39 |
+
*/
|
40 |
+
abstract class Eway_Rapid31_Model_Request_Abstract extends Eway_Rapid31_Model_JsonSerializableAbstract
|
41 |
+
{
|
42 |
+
const DEBUG_FILE = 'ewayrapid31_api_request.log';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @var Eway_Rapid31_Model_Config
|
46 |
+
*/
|
47 |
+
protected $_config = null;
|
48 |
+
|
49 |
+
protected function _construct()
|
50 |
+
{
|
51 |
+
$this->_config = Mage::getSingleton('ewayrapid/config');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Do the main API request.
|
56 |
+
* All API request to eWAY should call this function with appropriate parameters, after set all necessary data.
|
57 |
+
*
|
58 |
+
* @param string $action can be one of POST, GET, DELETE or PUT
|
59 |
+
* @param string $method
|
60 |
+
* @return Eway_Rapid31_Model_Response
|
61 |
+
*/
|
62 |
+
protected function _doRapidAPI($action, $method = 'POST') {
|
63 |
+
|
64 |
+
$url = $this->_config->getRapidAPIUrl($action);
|
65 |
+
$mode = $this->_config->isSandbox() ? '(Sandbox)' : '(Live)';
|
66 |
+
$this->_log('>>>>> START REQUEST ' . $mode . ' (' . $method . ') ' . ' : ' . $url);
|
67 |
+
|
68 |
+
$ch = curl_init($url);
|
69 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "X-EWAY-APIVERSION: 40"));
|
70 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_config->getBasicAuthenticationHeader());
|
71 |
+
switch($method) {
|
72 |
+
case 'POST':
|
73 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
74 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->jsonSerialize());
|
75 |
+
$this->_logPostJSON();
|
76 |
+
break;
|
77 |
+
case 'GET':
|
78 |
+
case 'DELETE':
|
79 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
80 |
+
break;
|
81 |
+
case 'PUT':
|
82 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
83 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->jsonSerialize());
|
84 |
+
$this->_logPostJSON();
|
85 |
+
break;
|
86 |
+
}
|
87 |
+
|
88 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
89 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
90 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->_config->isEnableSSLVerification());
|
91 |
+
|
92 |
+
$result = curl_exec($ch);
|
93 |
+
|
94 |
+
$this->_log('<<<<< RESPONSE:');
|
95 |
+
$response = Mage::getModel('ewayrapid/response');
|
96 |
+
if (curl_errno($ch) != CURLE_OK) {
|
97 |
+
$response->isSuccess(false);
|
98 |
+
$response->setMessage(Mage::helper('ewayrapid')->__("There is an error in making API request: %s", curl_error($ch)));
|
99 |
+
$this->_log("There is an error in making API request: " . curl_error($ch));
|
100 |
+
} else {
|
101 |
+
$info = curl_getinfo($ch);
|
102 |
+
$http_code = intval(trim($info['http_code']));
|
103 |
+
if ($http_code == 401 || $http_code == 404 || $http_code == 403) {
|
104 |
+
$response->isSuccess(false);
|
105 |
+
$response->setMessage(Mage::helper('ewayrapid')->__("Please check the API Key and Password %s", $mode));
|
106 |
+
$this->_log('Access denied. HTTP_CODE = ' . $info['http_code']);
|
107 |
+
} elseif ($http_code != 200) {
|
108 |
+
$response->isSuccess(false);
|
109 |
+
$response->setMessage(Mage::helper('ewayrapid')->__("Error connecting to payment gateway, please try again"));
|
110 |
+
$this->_log('Error connecting to payment gateway. HTTP_CODE = ' . $info['http_code']);
|
111 |
+
} else {
|
112 |
+
$response->isSuccess(true);
|
113 |
+
$response->decodeJSON($result);
|
114 |
+
if($this->_config->isDebug()) {
|
115 |
+
$this->_log('SUCCESS. Response body: ');
|
116 |
+
$this->_log(print_r(json_decode($result, true), true));
|
117 |
+
}
|
118 |
+
$this->_log('SUCCESS. HTTP_CODE = ' . $info['http_code']);
|
119 |
+
}
|
120 |
+
curl_close($ch);
|
121 |
+
}
|
122 |
+
|
123 |
+
$this->_log('===== END REQUEST.');
|
124 |
+
return $response;
|
125 |
+
}
|
126 |
+
|
127 |
+
protected function _logPostJSON()
|
128 |
+
{
|
129 |
+
if($this->_config->isDebug()) {
|
130 |
+
$cardDetails = null;
|
131 |
+
if($this->getCustomer() && $this->getCustomer()->getCardDetails()) {
|
132 |
+
$cardDetails = $this->getCustomer()->getCardDetails();
|
133 |
+
$cardDetails->shouldBeMasked();
|
134 |
+
}
|
135 |
+
$this->_log('Request body:');
|
136 |
+
$this->_log(print_r($this->getJsonData(), true));
|
137 |
+
if(!is_null($cardDetails)) {
|
138 |
+
$cardDetails->shouldBeMasked(false);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
protected function _log($message, $file = self::DEBUG_FILE)
|
144 |
+
{
|
145 |
+
if($this->_config->isDebug()) {
|
146 |
+
Mage::log($message, Zend_Log::DEBUG, $file, true);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
protected function _fixTitle($title) {
|
151 |
+
if ($title == 'n/a' || empty($title)) {
|
152 |
+
return 'Mr.';
|
153 |
+
}
|
154 |
+
return $title;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Get predicted increment order id
|
159 |
+
* @return string
|
160 |
+
*/
|
161 |
+
protected function _getIncrementOrderId($quote)
|
162 |
+
{
|
163 |
+
$orderConfig = Mage::getSingleton('eav/config')->getEntityType('order');
|
164 |
+
|
165 |
+
$entityStoreConfig = Mage::getModel('eav/entity_store')
|
166 |
+
->loadByEntityStore($orderConfig->getId(), $quote->getStoreId());
|
167 |
+
|
168 |
+
$incrementInstance = Mage::getModel($orderConfig->getIncrementModel())
|
169 |
+
->setPrefix($entityStoreConfig->getIncrementPrefix())
|
170 |
+
->setPadLength($orderConfig->getIncrementPadLength())
|
171 |
+
->setPadChar($orderConfig->getIncrementPadChar())
|
172 |
+
->setLastId($entityStoreConfig->getIncrementLastId())
|
173 |
+
->setEntityTypeId($entityStoreConfig->getEntityTypeId())
|
174 |
+
->setStoreId($entityStoreConfig->getStoreId());
|
175 |
+
|
176 |
+
$incrementId = $incrementInstance->getNextId();
|
177 |
+
|
178 |
+
return $incrementId;
|
179 |
+
}
|
180 |
}
|
@@ -1,271 +1,340 @@
|
|
1 |
-
<?php
|
2 |
-
class Eway_Rapid31_Model_Request_Direct extends Eway_Rapid31_Model_Request_Abstract
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Call Transaction API (Authorized & Capture at the same time)
|
6 |
-
*
|
7 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
8 |
-
* @param float $amount
|
9 |
-
* @return Eway_Rapid31_Model_Request_Direct $this
|
10 |
-
*/
|
11 |
-
public function doTransaction(Mage_Sales_Model_Order_Payment $payment, $amount)
|
12 |
-
{
|
13 |
-
$this->_buildRequest($payment, $amount);
|
14 |
-
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT);
|
15 |
-
$response = $this->_doRapidAPI('Transaction');
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
Mage::
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
->
|
73 |
-
|
74 |
-
$
|
75 |
-
|
76 |
-
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
$
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
$
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
$
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
if($
|
158 |
-
$
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
$
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
}
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
$
|
211 |
-
$
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
->
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$
|
236 |
-
$
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
$
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
$
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
}
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Model_Request_Direct extends Eway_Rapid31_Model_Request_Abstract
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Call Transaction API (Authorized & Capture at the same time)
|
6 |
+
*
|
7 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
8 |
+
* @param float $amount
|
9 |
+
* @return Eway_Rapid31_Model_Request_Direct $this
|
10 |
+
*/
|
11 |
+
public function doTransaction(Mage_Sales_Model_Order_Payment $payment, $amount)
|
12 |
+
{
|
13 |
+
$this->_buildRequest($payment, $amount);
|
14 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT);
|
15 |
+
$response = $this->_doRapidAPI('Transaction');
|
16 |
+
|
17 |
+
// Save fraud information
|
18 |
+
|
19 |
+
$transaction = $this->getTransaction($response['TransactionID']);
|
20 |
+
if($transaction) {
|
21 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
22 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
23 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
24 |
+
unset($transaction);
|
25 |
+
}
|
26 |
+
|
27 |
+
if($response->isSuccess()) {
|
28 |
+
$payment->setTransactionId($response->getTransactionID());
|
29 |
+
$payment->setCcLast4($response->getCcLast4());
|
30 |
+
$beagleScore = $response->getBeagleScore() && $response->getData('BeagleScore') > 0 ? $response->getBeagleScore() : '';
|
31 |
+
$payment->setBeagleScore($beagleScore);
|
32 |
+
$payment->setBeagleVerification(serialize($response->getBeagleVerification()));
|
33 |
+
$payment->setFraudAction($fraudAction);
|
34 |
+
$payment->setFraudCodes($fraudCodes);
|
35 |
+
$payment->setTransactionCaptured($captured);
|
36 |
+
return $this;
|
37 |
+
} else {
|
38 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. Please try again. (Error message: %s)',
|
39 |
+
$response->getMessage()));
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Call Authorisation API (Authorized only)
|
45 |
+
*
|
46 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
47 |
+
* @param $amount
|
48 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
49 |
+
*/
|
50 |
+
public function doAuthorisation(Mage_Sales_Model_Order_Payment $payment, $amount)
|
51 |
+
{
|
52 |
+
$this->_buildRequest($payment, $amount);
|
53 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_AUTHORISE);
|
54 |
+
$response = $this->_doRapidAPI('Authorisation');
|
55 |
+
|
56 |
+
// Save fraud information
|
57 |
+
|
58 |
+
$transaction = $this->getTransaction($response['TransactionID']);
|
59 |
+
if($transaction) {
|
60 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
61 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
62 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
63 |
+
unset($transaction);
|
64 |
+
}
|
65 |
+
|
66 |
+
if($response->isSuccess()) {
|
67 |
+
$payment->setTransactionId($response->getTransactionID());
|
68 |
+
$payment->setIsTransactionClosed(0);
|
69 |
+
$beagleScore = $response->getBeagleScore() && $response->getData('BeagleScore') > 0 ? $response->getBeagleScore() : '';
|
70 |
+
$payment->setBeagleScore($beagleScore);
|
71 |
+
$payment->setBeagleVerification(serialize($response->getBeagleVerification()));
|
72 |
+
$payment->setCcLast4($response->getCcLast4());
|
73 |
+
$payment->setFraudAction($fraudAction);
|
74 |
+
$payment->setFraudCodes($fraudCodes);
|
75 |
+
$payment->setTransactionCaptured($captured);
|
76 |
+
return $this;
|
77 |
+
} else {
|
78 |
+
if ($payment->getIsRecurring()) {
|
79 |
+
Mage::getSingleton('core/session')->setData('errorMessage', $response->getMessage());
|
80 |
+
}
|
81 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the authorisation. Please try again. (Error message: %s)',
|
82 |
+
$response->getMessage()));
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Call Capture API (do the Capture only, must Authorized previously)
|
88 |
+
*
|
89 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
90 |
+
* @param $amount
|
91 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
92 |
+
*/
|
93 |
+
public function doCapturePayment(Mage_Sales_Model_Order_Payment $payment, $amount)
|
94 |
+
{
|
95 |
+
// Empty Varien_Object's data
|
96 |
+
$this->unsetData();
|
97 |
+
|
98 |
+
/* @var Mage_Sales_Model_Order_Invoice $invoice */
|
99 |
+
$invoice = Mage::registry('current_invoice');
|
100 |
+
$order = $payment->getOrder();
|
101 |
+
|
102 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
103 |
+
$paymentParam->setTotalAmount($amount)
|
104 |
+
->setCurrencyCode($order->getBaseCurrencyCode());
|
105 |
+
if($invoice && $invoice->getIncrementId()) {
|
106 |
+
$paymentParam->setInvoiceNumber($invoice->getIncrementId())
|
107 |
+
->setInvoiceReference($invoice->getIncrementId())
|
108 |
+
->setInvoiceDescription(Mage::helper('ewayrapid')->__('Invoice created from Magento'));
|
109 |
+
}
|
110 |
+
$this->setPayment($paymentParam);
|
111 |
+
$this->setTransactionId($payment->getLastTransId());
|
112 |
+
|
113 |
+
$response = $this->_doRapidAPI('CapturePayment');
|
114 |
+
|
115 |
+
if($response->isSuccess()) {
|
116 |
+
$payment->setTransactionId($response->getTransactionID());
|
117 |
+
return $this;
|
118 |
+
} else {
|
119 |
+
if ($payment->getIsRecurring()) {
|
120 |
+
Mage::getSingleton('core/session')->setData('errorMessage', $response->getMessage());
|
121 |
+
}
|
122 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the capture. Please try again. (Error message: %s)',
|
123 |
+
$response->getMessage()));
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Call Refund API, must complete the transaction (Authorized & Capture) beforehand
|
129 |
+
*
|
130 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
131 |
+
* @param $amount
|
132 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
133 |
+
*/
|
134 |
+
public function doRefund(Mage_Sales_Model_Order_Payment $payment, $amount)
|
135 |
+
{
|
136 |
+
// Empty Varien_Object's data
|
137 |
+
$this->unsetData();
|
138 |
+
|
139 |
+
$order = $payment->getOrder();
|
140 |
+
/* @var Mage_Sales_Model_Order_Creditmemo $creditMemo */
|
141 |
+
$creditMemo = Mage::registry('current_creditmemo');
|
142 |
+
|
143 |
+
$invoice = ($creditMemo ? $creditMemo->getInvoice() : null);
|
144 |
+
/* @var Mage_Sales_Model_Order_Invoice $invoice */
|
145 |
+
if(!$invoice || !$invoice->getTransactionId()) {
|
146 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the online refund: Invoice or transaction does not exist.'));
|
147 |
+
}
|
148 |
+
|
149 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
150 |
+
$paymentParam->setTotalAmount($amount)
|
151 |
+
->setCurrencyCode($order->getBaseCurrencyCode())
|
152 |
+
->setTransactionID($invoice->getTransactionId());
|
153 |
+
if($creditMemo && $creditMemo->getIncrementId()) {
|
154 |
+
$paymentParam->setInvoiceDescription("Creditmemo ID " . $creditMemo->getIncrementId());
|
155 |
+
}
|
156 |
+
|
157 |
+
if($invoice && $invoice->getIncrementId()) {
|
158 |
+
$paymentParam->setInvoiceNumber($invoice->getIncrementId())
|
159 |
+
->setInvoiceReference($invoice->getIncrementId());
|
160 |
+
}
|
161 |
+
$this->setRefund($paymentParam);
|
162 |
+
|
163 |
+
$response = $this->_doRapidAPI('Transaction/' . $invoice->getTransactionId() . '/Refund');
|
164 |
+
|
165 |
+
if($response->isSuccess()) {
|
166 |
+
$payment->setTransactionId($response->getTransactionID());
|
167 |
+
return $this;
|
168 |
+
} else {
|
169 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the refund. Please try again. (Error message: %s)',
|
170 |
+
$response->getMessage()));
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Call Cancel API, the transaction must be Authorized beforehand
|
176 |
+
*
|
177 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
178 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
179 |
+
*/
|
180 |
+
public function doCancel(Mage_Sales_Model_Order_Payment $payment)
|
181 |
+
{
|
182 |
+
// Empty Varien_Object's data
|
183 |
+
$this->unsetData();
|
184 |
+
|
185 |
+
$transactionId = $payment->getLastTransId();
|
186 |
+
$this->setTransactionId($transactionId);
|
187 |
+
$response = $this->_doRapidAPI('CancelAuthorisation');
|
188 |
+
|
189 |
+
if($response->isSuccess()) {
|
190 |
+
$payment->setTransactionId($response->getTransactionID());
|
191 |
+
$payment->setIsTransactionClosed(1);
|
192 |
+
return $this;
|
193 |
+
} else {
|
194 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the cancel. Please try again. (Error message: %s)',
|
195 |
+
$response->getMessage()));
|
196 |
+
}
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Build the request with necessary parameters for doAuthorisation() and doTransaction()
|
202 |
+
*
|
203 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
204 |
+
* @param $amount
|
205 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
206 |
+
*/
|
207 |
+
protected function _buildRequest(Mage_Sales_Model_Order_Payment $payment, $amount)
|
208 |
+
{
|
209 |
+
// Empty Varien_Object's data
|
210 |
+
$this->unsetData();
|
211 |
+
$methodInstance = $payment->getMethodInstance();
|
212 |
+
$infoInstance = $methodInstance->getInfoInstance();
|
213 |
+
$order = $payment->getOrder();
|
214 |
+
$billing = $order->getBillingAddress();
|
215 |
+
$shipping = $order->getShippingAddress();
|
216 |
+
|
217 |
+
// if item is virtual product
|
218 |
+
if (!$shipping) {
|
219 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
220 |
+
if ($quote->isVirtual()) {
|
221 |
+
$shipping = $quote->getBillingAddress();
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
226 |
+
if(Mage::helper('ewayrapid')->isBackendOrder()) {
|
227 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_MOTO);
|
228 |
+
} else {
|
229 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE);
|
230 |
+
}
|
231 |
+
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
232 |
+
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
233 |
+
$this->setShippingMethod('Other');
|
234 |
+
|
235 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
236 |
+
$paymentParam->setTotalAmount($amount)
|
237 |
+
->setCurrencyCode($order->getBaseCurrencyCode());
|
238 |
+
|
239 |
+
// add InvoiceDescription and InvoiceReference
|
240 |
+
$config = Mage::getModel('ewayrapid/config');
|
241 |
+
|
242 |
+
if($config->shouldPassingInvoiceDescription()){
|
243 |
+
$invoiceDescription = '';
|
244 |
+
foreach($order->getAllVisibleItems() as $item){
|
245 |
+
// Check in case multi-shipping
|
246 |
+
if (!$item->getQuoteParentItemId()) {
|
247 |
+
$invoiceDescription .= (int) $item->getQtyOrdered() . ' x ' .$item->getName() . ', ';
|
248 |
+
}
|
249 |
+
}
|
250 |
+
$invoiceDescription = trim($invoiceDescription,', ');
|
251 |
+
$invoiceDescription = Mage::helper('ewayrapid')->limitInvoiceDescriptionLength($invoiceDescription);
|
252 |
+
|
253 |
+
$paymentParam->setInvoiceDescription($invoiceDescription);
|
254 |
+
}
|
255 |
+
|
256 |
+
if($config->shouldPassingGuessOrder()){
|
257 |
+
$paymentParam->setInvoiceReference($order->getIncrementId());
|
258 |
+
}
|
259 |
+
|
260 |
+
$this->setPayment($paymentParam);
|
261 |
+
|
262 |
+
$title = $this->_fixTitle($billing->getPrefix());
|
263 |
+
|
264 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
265 |
+
$customerParam->setTitle($title)
|
266 |
+
->setFirstName($billing->getFirstname())
|
267 |
+
->setLastName($billing->getLastname())
|
268 |
+
->setCompanyName($billing->getCompany())
|
269 |
+
->setJobDescription('')
|
270 |
+
->setStreet1($billing->getStreet1())
|
271 |
+
->setStreet2($billing->getStreet2())
|
272 |
+
->setCity($billing->getCity())
|
273 |
+
->setState($billing->getRegion())
|
274 |
+
->setPostalCode($billing->getPostcode())
|
275 |
+
->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))
|
276 |
+
->setEmail($billing->getEmail())
|
277 |
+
->setPhone($billing->getTelephone())
|
278 |
+
->setMobile('')
|
279 |
+
->setComments('')
|
280 |
+
->setFax($billing->getFax())
|
281 |
+
->setUrl('');
|
282 |
+
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
|
283 |
+
$cardDetails->setName($infoInstance->getCcOwner())
|
284 |
+
->setNumber($infoInstance->getCcNumber())
|
285 |
+
->setExpiryMonth($infoInstance->getCcExpMonth())
|
286 |
+
->setExpiryYear($infoInstance->getCcExpYear())
|
287 |
+
->setCVN($infoInstance->getCcCid());
|
288 |
+
|
289 |
+
$customerParam->setCardDetails($cardDetails);
|
290 |
+
$this->setCustomer($customerParam);
|
291 |
+
|
292 |
+
if (!empty($shipping)) {
|
293 |
+
$shippingParam = Mage::getModel('ewayrapid/field_shippingAddress');
|
294 |
+
$shippingParam->setFirstName($shipping->getFirstname())
|
295 |
+
->setLastName($shipping->getLastname())
|
296 |
+
->setStreet1($shipping->getStreet1())
|
297 |
+
->setStreet2($shipping->getStreet2())
|
298 |
+
->setCity($shipping->getCity())
|
299 |
+
->setState($shipping->getRegion())
|
300 |
+
->setPostalCode($shipping->getPostcode())
|
301 |
+
->setCountry(strtolower($shipping->getCountryModel()->getIso2Code()))
|
302 |
+
->setEmail($shipping->getEmail())
|
303 |
+
->setPhone($shipping->getTelephone())
|
304 |
+
->setFax($shipping->getFax());
|
305 |
+
$this->setShippingAddress($shippingParam);
|
306 |
+
}
|
307 |
+
|
308 |
+
if($methodInstance->getConfigData('transfer_cart_items')) {
|
309 |
+
$orderItems = $order->getAllVisibleItems();
|
310 |
+
$lineItems = array();
|
311 |
+
foreach($orderItems as $orderItem) {
|
312 |
+
/* @var Mage_Sales_Model_Order_Item $orderItem */
|
313 |
+
$lineItem = Mage::getModel('ewayrapid/field_lineItem');
|
314 |
+
$lineItem->setSKU($orderItem->getSku());
|
315 |
+
$lineItem->setDescription(substr($orderItem->getName(), 0, 26));
|
316 |
+
$lineItem->setQuantity($orderItem->getQtyOrdered());
|
317 |
+
$lineItem->setUnitCost(round($orderItem->getBasePrice() * 100));
|
318 |
+
$lineItem->setTax(round($orderItem->getBaseTaxAmount() * 100));
|
319 |
+
$lineItem->setTotal(round($orderItem->getBaseRowTotalInclTax() * 100));
|
320 |
+
$lineItems[] = $lineItem;
|
321 |
+
}
|
322 |
+
$this->setItems($lineItems);
|
323 |
+
}
|
324 |
+
|
325 |
+
return $this;
|
326 |
+
}
|
327 |
+
|
328 |
+
public function getTransaction($transaction_number) {
|
329 |
+
try {
|
330 |
+
$results = $this->_doRapidAPI("Transaction/$transaction_number", 'GET');
|
331 |
+
if ($results->isSuccess()) {
|
332 |
+
return $results->getTransactions();
|
333 |
+
}
|
334 |
+
} catch (Exception $e) {
|
335 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: %s)',
|
336 |
+
$results->getMessage()));
|
337 |
+
return false;
|
338 |
+
}
|
339 |
+
}
|
340 |
}
|
@@ -1,533 +1,639 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eway_Rapid31_Model_Request_Sharedpage extends Eway_Rapid31_Model_Request_Abstract
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* @var Mage_Sales_Model_Quote
|
7 |
-
*/
|
8 |
-
protected $_quote = null;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var Mage_Customer_Model_Session
|
12 |
-
*/
|
13 |
-
protected $_customerSession;
|
14 |
-
|
15 |
-
public function __construct($params = array())
|
16 |
-
{
|
17 |
-
if (isset($params['quote']) && $params['quote'] instanceof Mage_Sales_Model_Quote) {
|
18 |
-
$this->_quote = $params['quote'];
|
19 |
-
} else {
|
20 |
-
throw new Exception('Quote instance is required.');
|
21 |
-
}
|
22 |
-
|
23 |
-
$this->_config = Mage::getSingleton('ewayrapid/config');
|
24 |
-
$this->_customerSession = Mage::getSingleton('customer/session');
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* create AccessCode for process checkout
|
29 |
-
*
|
30 |
-
* @param null $returnUrl
|
31 |
-
* @param null $cancelUrl
|
32 |
-
* @return Eway_Rapid31_Model_Response
|
33 |
-
*/
|
34 |
-
public function createAccessCode($returnUrl = null, $cancelUrl = null)
|
35 |
-
{
|
36 |
-
// Empty Varien_Object's data
|
37 |
-
$this->unsetData();
|
38 |
-
$token = null;
|
39 |
-
$paypal = null;
|
40 |
-
$totalAmount = 0;
|
41 |
-
|
42 |
-
if ($this->getMethod() == Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD) {
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
}
|
51 |
-
}
|
52 |
-
if (
|
53 |
-
$
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
$
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$this->
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
$
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
$
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
$
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
$this->
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
$
|
177 |
-
$
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
$
|
217 |
-
|
218 |
-
$
|
219 |
-
}
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
$
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
$
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
$this->
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
$
|
304 |
-
Mage::
|
305 |
-
if (
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
$
|
352 |
-
$
|
353 |
-
|
354 |
-
|
355 |
-
$
|
356 |
-
$
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
$
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
$
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
}
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
}
|
527 |
-
return
|
528 |
-
}
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eway_Rapid31_Model_Request_Sharedpage extends Eway_Rapid31_Model_Request_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Mage_Sales_Model_Quote
|
7 |
+
*/
|
8 |
+
protected $_quote = null;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var Mage_Customer_Model_Session
|
12 |
+
*/
|
13 |
+
protected $_customerSession;
|
14 |
+
|
15 |
+
public function __construct($params = array())
|
16 |
+
{
|
17 |
+
if (isset($params['quote']) && $params['quote'] instanceof Mage_Sales_Model_Quote) {
|
18 |
+
$this->_quote = $params['quote'];
|
19 |
+
} else {
|
20 |
+
throw new Exception('Quote instance is required.');
|
21 |
+
}
|
22 |
+
|
23 |
+
$this->_config = Mage::getSingleton('ewayrapid/config');
|
24 |
+
$this->_customerSession = Mage::getSingleton('customer/session');
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* create AccessCode for process checkout
|
29 |
+
*
|
30 |
+
* @param null $returnUrl
|
31 |
+
* @param null $cancelUrl
|
32 |
+
* @return Eway_Rapid31_Model_Response
|
33 |
+
*/
|
34 |
+
public function createAccessCode($returnUrl = null, $cancelUrl = null)
|
35 |
+
{
|
36 |
+
// Empty Varien_Object's data
|
37 |
+
$this->unsetData();
|
38 |
+
$token = null;
|
39 |
+
$paypal = null;
|
40 |
+
$totalAmount = 0;
|
41 |
+
|
42 |
+
if ($this->getMethod() == Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD) {
|
43 |
+
if ($this->_isNewToken()) {
|
44 |
+
$returnUrl .= '?newToken=1';
|
45 |
+
$method = Eway_Rapid31_Model_Config::METHOD_CREATE_TOKEN;
|
46 |
+
} elseif ($token = $this->_editToken()) {
|
47 |
+
$returnUrl .= '?editToken=' . $token;
|
48 |
+
$token = Mage::helper('ewayrapid/customer')->getCustomerTokenId($token);
|
49 |
+
$method = Eway_Rapid31_Model_Config::METHOD_UPDATE_TOKEN;
|
50 |
+
}
|
51 |
+
} elseif ($this->getMethod() == Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD) {
|
52 |
+
if ($this->_isNewToken()) {
|
53 |
+
$returnUrl .= '?newToken=1';
|
54 |
+
if(Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE){
|
55 |
+
$method = Eway_Rapid31_Model_Config::METHOD_TOKEN_PAYMENT;
|
56 |
+
$totalAmount = round($this->_quote->getBaseGrandTotal() * 100);
|
57 |
+
}else{
|
58 |
+
$method = Eway_Rapid31_Model_Config::METHOD_CREATE_TOKEN ;
|
59 |
+
}
|
60 |
+
} elseif ($token = $this->_editToken()) {
|
61 |
+
$returnUrl .= '?editToken=' . $token;
|
62 |
+
$token = Mage::helper('ewayrapid/customer')->getCustomerTokenId($token);
|
63 |
+
if(Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE){
|
64 |
+
$method = Eway_Rapid31_Model_Config::METHOD_TOKEN_PAYMENT;
|
65 |
+
$totalAmount = round($this->_quote->getBaseGrandTotal() * 100);
|
66 |
+
}else{
|
67 |
+
$method = Eway_Rapid31_Model_Config::METHOD_UPDATE_TOKEN ;
|
68 |
+
}
|
69 |
+
}else{
|
70 |
+
if (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
|
71 |
+
$method = Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT;
|
72 |
+
} else {
|
73 |
+
$method = Eway_Rapid31_Model_Config::METHOD_AUTHORISE;
|
74 |
+
}
|
75 |
+
$totalAmount = round($this->_quote->getBaseGrandTotal() * 100);
|
76 |
+
$paypal = $this->_getPaypalCheckout();
|
77 |
+
if ($paypal === Eway_Rapid31_Model_Config::PAYPAL_EXPRESS_METHOD) {
|
78 |
+
$this->setCheckoutPayment(true);
|
79 |
+
$this->setCheckoutURL(Mage::getUrl('ewayrapid/sharedpage/review'));
|
80 |
+
}
|
81 |
+
}
|
82 |
+
} else {
|
83 |
+
if (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
|
84 |
+
$method = Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT;
|
85 |
+
} else {
|
86 |
+
$method = Eway_Rapid31_Model_Config::METHOD_AUTHORISE;
|
87 |
+
}
|
88 |
+
$totalAmount = round($this->_quote->getBaseGrandTotal() * 100);
|
89 |
+
$paypal = $this->_getPaypalCheckout();
|
90 |
+
if ($paypal === Eway_Rapid31_Model_Config::PAYPAL_EXPRESS_METHOD) {
|
91 |
+
$this->setCheckoutPayment(true);
|
92 |
+
$this->setCheckoutURL(Mage::getUrl('ewayrapid/sharedpage/review'));
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
$this->_buildRequest();
|
97 |
+
|
98 |
+
$customer = $this->getCustomer();
|
99 |
+
$customer->setTokenCustomerID($token ? $token : '');
|
100 |
+
$this->setCustomer($customer);
|
101 |
+
|
102 |
+
// prepare API
|
103 |
+
$this->setRedirectUrl($returnUrl);
|
104 |
+
$this->setCancelUrl($cancelUrl);
|
105 |
+
$this->setMethod($method);
|
106 |
+
|
107 |
+
if (Mage::helper('ewayrapid')->getTransferCartLineItems()) {
|
108 |
+
// add Shipping item and Line items
|
109 |
+
$lineItems = Mage::helper('ewayrapid')->getLineItems();
|
110 |
+
$this->setItems($lineItems);
|
111 |
+
}
|
112 |
+
|
113 |
+
// add Payment
|
114 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
115 |
+
$paymentParam->setTotalAmount($totalAmount);
|
116 |
+
$paymentParam->setCurrencyCode($this->_quote->getBaseCurrencyCode());
|
117 |
+
|
118 |
+
// add InvoiceDescription and InvoiceReference
|
119 |
+
$config = Mage::getModel('ewayrapid/config');
|
120 |
+
|
121 |
+
if($config->shouldPassingInvoiceDescription()){
|
122 |
+
$invoiceDescription = '';
|
123 |
+
foreach($this->_quote->getAllVisibleItems() as $item){
|
124 |
+
// Check in case multi-shipping
|
125 |
+
if (!$item->getQuoteParentItem()) {
|
126 |
+
$invoiceDescription .= (int) $item->getQty() . ' x ' .$item->getName() . ', ';
|
127 |
+
}
|
128 |
+
}
|
129 |
+
$invoiceDescription = trim($invoiceDescription,', ');
|
130 |
+
$invoiceDescription = Mage::helper('ewayrapid')->limitInvoiceDescriptionLength($invoiceDescription);
|
131 |
+
|
132 |
+
$paymentParam->setInvoiceDescription($invoiceDescription);
|
133 |
+
}
|
134 |
+
|
135 |
+
if($config->shouldPassingGuessOrder()){
|
136 |
+
$incrementId = $this->_getIncrementOrderId($this->_quote);
|
137 |
+
$paymentParam->setInvoiceReference($incrementId);
|
138 |
+
$paymentParam->setInvoiceNumber($incrementId);
|
139 |
+
}
|
140 |
+
|
141 |
+
$this->setPayment($paymentParam);
|
142 |
+
|
143 |
+
if($this->_config->isSharedPageConnection()){
|
144 |
+
// add Verify options
|
145 |
+
$this->setVerifyCustomerEmail($this->_config->getVerifyEmail());
|
146 |
+
$this->setVerifyCustomerPhone($this->_config->getVerifyPhone());
|
147 |
+
|
148 |
+
// add Custom View
|
149 |
+
$this->setCustomView($this->_config->getCustomView());
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
$response = $this->_doRapidAPI('AccessCodesShared');
|
154 |
+
return $response;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Call Authorisation API (Authorized only)
|
159 |
+
*
|
160 |
+
* @param Eway_Rapid31_Model_Response $response
|
161 |
+
* @return Eway_Rapid31_Model_Response
|
162 |
+
*/
|
163 |
+
public function doAuthorisation(Eway_Rapid31_Model_Response $response)
|
164 |
+
{
|
165 |
+
$this->unsetData();
|
166 |
+
|
167 |
+
$this->_buildRequest();
|
168 |
+
|
169 |
+
$cardData = $response->getCustomer();
|
170 |
+
if ($cardData['CardNumber'] && $cardData['CardName']) {
|
171 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_AUTHORISE);
|
172 |
+
} else {
|
173 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_TOKEN_PAYMENT);
|
174 |
+
}
|
175 |
+
|
176 |
+
$items = $this->_quote->getAllVisibleItems();
|
177 |
+
$lineItems = array();
|
178 |
+
foreach ($items as $item) {
|
179 |
+
/* @var Mage_Sales_Model_Order_Item $item */
|
180 |
+
$lineItem = Mage::getModel('ewayrapid/field_lineItem');
|
181 |
+
$lineItem->setSKU($item->getSku());
|
182 |
+
$lineItem->setDescription(substr($item->getName(), 0, 26));
|
183 |
+
$lineItem->setQuantity($item->getQty());
|
184 |
+
$lineItem->setUnitCost(round($item->getBasePrice() * 100));
|
185 |
+
$lineItem->setTax(round($item->getBaseTaxAmount() * 100));
|
186 |
+
$lineItem->setTotal(round($item->getBaseRowTotalInclTax() * 100));
|
187 |
+
$lineItems[] = $lineItem;
|
188 |
+
}
|
189 |
+
$this->setItems($lineItems);
|
190 |
+
|
191 |
+
$this->setItems(false);
|
192 |
+
|
193 |
+
// add Payment
|
194 |
+
$amount = round($this->_quote->getBaseGrandTotal() * 100);
|
195 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
196 |
+
$paymentParam->setTotalAmount($amount);
|
197 |
+
$paymentParam->setCurrencyCode($this->_quote->getBaseCurrencyCode());
|
198 |
+
|
199 |
+
// add InvoiceDescription and InvoiceReference
|
200 |
+
$config = Mage::getModel('ewayrapid/config');
|
201 |
+
|
202 |
+
if($config->shouldPassingInvoiceDescription()){
|
203 |
+
$invoiceDescription = '';
|
204 |
+
foreach($this->_quote->getAllVisibleItems() as $item){
|
205 |
+
// Check in case multi-shipping
|
206 |
+
if (!$item->getQuoteParentItemId()) {
|
207 |
+
$invoiceDescription .= (int) $item->getQty() . ' x ' .$item->getName() . ', ';
|
208 |
+
}
|
209 |
+
}
|
210 |
+
$invoiceDescription = trim($invoiceDescription,', ');
|
211 |
+
$invoiceDescription = Mage::helper('ewayrapid')->limitInvoiceDescriptionLength($invoiceDescription);
|
212 |
+
|
213 |
+
$paymentParam->setInvoiceDescription($invoiceDescription);
|
214 |
+
}
|
215 |
+
|
216 |
+
if($config->shouldPassingGuessOrder()){
|
217 |
+
$incrementId = $this->_getIncrementOrderId($this->_quote);
|
218 |
+
$paymentParam->setInvoiceReference($incrementId);
|
219 |
+
}
|
220 |
+
|
221 |
+
$this->setPayment($paymentParam);
|
222 |
+
|
223 |
+
$customerParam = $this->getCustomer();
|
224 |
+
$customerParam->setTokenCustomerID($response->getTokenCustomerID());
|
225 |
+
$this->setCustomer($customerParam);
|
226 |
+
|
227 |
+
$response = $this->_doRapidAPI('Authorisation');
|
228 |
+
return $response;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Call Transaction API (Authorized & Capture at the same time)
|
233 |
+
*
|
234 |
+
* @param Eway_Rapid31_Model_Response $response
|
235 |
+
* @return Eway_Rapid31_Model_Response
|
236 |
+
*/
|
237 |
+
public function doTransaction(Eway_Rapid31_Model_Response $response)
|
238 |
+
{
|
239 |
+
$this->unsetData();
|
240 |
+
|
241 |
+
$this->_buildRequest();
|
242 |
+
|
243 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_TOKEN_PAYMENT);
|
244 |
+
|
245 |
+
$items = $this->_quote->getAllVisibleItems();
|
246 |
+
$lineItems = array();
|
247 |
+
foreach ($items as $item) {
|
248 |
+
/* @var Mage_Sales_Model_Order_Item $item */
|
249 |
+
$lineItem = Mage::getModel('ewayrapid/field_lineItem');
|
250 |
+
$lineItem->setSKU($item->getSku());
|
251 |
+
$lineItem->setDescription(substr($item->getName(), 0, 26));
|
252 |
+
$lineItem->setQuantity($item->getQty());
|
253 |
+
$lineItem->setUnitCost(round($item->getBasePrice() * 100));
|
254 |
+
$lineItem->setTax(round($item->getBaseTaxAmount() * 100));
|
255 |
+
$lineItem->setTotal(round($item->getBaseRowTotalInclTax() * 100));
|
256 |
+
$lineItems[] = $lineItem;
|
257 |
+
}
|
258 |
+
$this->setItems($lineItems);
|
259 |
+
|
260 |
+
$this->setItems(false);
|
261 |
+
|
262 |
+
// add Payment
|
263 |
+
$amount = round($this->_quote->getBaseGrandTotal() * 100);
|
264 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
265 |
+
$paymentParam->setTotalAmount($amount);
|
266 |
+
$paymentParam->setCurrencyCode($this->_quote->getBaseCurrencyCode());
|
267 |
+
$this->setPayment($paymentParam);
|
268 |
+
|
269 |
+
$customerParam = $this->getCustomer();
|
270 |
+
$customerParam->setTokenCustomerID($response->getTokenCustomerID());
|
271 |
+
|
272 |
+
$this->setCustomer($customerParam);
|
273 |
+
|
274 |
+
$response = $this->_doRapidAPI('Transaction');
|
275 |
+
return $response;
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Call Capture API (do the Capture only, must Authorized previously)
|
280 |
+
*
|
281 |
+
* @param Eway_Rapid31_Model_Response $response
|
282 |
+
* @return Eway_Rapid31_Model_Response
|
283 |
+
*/
|
284 |
+
public function doCapturePayment(Eway_Rapid31_Model_Response $response)
|
285 |
+
{
|
286 |
+
$this->setTransactionId($response->getTransactionID());
|
287 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT);
|
288 |
+
|
289 |
+
$response = $this->_doRapidAPI('CapturePayment');
|
290 |
+
return $response;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Build the request with necessary parameters for doAuthorisation(), doTransaction() and CreateAccessCode()
|
295 |
+
*
|
296 |
+
* @return $this
|
297 |
+
*/
|
298 |
+
protected function _buildRequest()
|
299 |
+
{
|
300 |
+
// prepare API
|
301 |
+
$this->setShippingMethod('Other');
|
302 |
+
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
303 |
+
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
304 |
+
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
305 |
+
if (Mage::helper('ewayrapid')->isBackendOrder()) {
|
306 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_MOTO);
|
307 |
+
} else {
|
308 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE);
|
309 |
+
}
|
310 |
+
$this->setCustomerReadOnly(true);
|
311 |
+
|
312 |
+
// add Billing Address
|
313 |
+
$billingAddress = $this->_quote->getBillingAddress();
|
314 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
315 |
+
|
316 |
+
$title = $this->_fixTitle($billingAddress->getPrefix());
|
317 |
+
|
318 |
+
$customerParam->setTitle($title)
|
319 |
+
->setFirstName($billingAddress->getFirstname())
|
320 |
+
->setLastName($billingAddress->getLastname())
|
321 |
+
->setCompanyName($billingAddress->getCompany())
|
322 |
+
->setJobDescription($billingAddress->getJobDescription())
|
323 |
+
->setStreet1($billingAddress->getStreet1())
|
324 |
+
->setStreet2($billingAddress->getStreet2())
|
325 |
+
->setCity($billingAddress->getCity())
|
326 |
+
->setState($billingAddress->getRegion())
|
327 |
+
->setPostalCode($billingAddress->getPostcode())
|
328 |
+
->setCountry(strtolower($billingAddress->getCountryModel()->getIso2Code()))
|
329 |
+
->setEmail($billingAddress->getEmail())
|
330 |
+
->setPhone($billingAddress->getTelephone())
|
331 |
+
->setMobile($billingAddress->getMobile())
|
332 |
+
->setComments('')
|
333 |
+
->setFax($billingAddress->getFax())
|
334 |
+
->setUrl('');
|
335 |
+
$this->setCustomer($customerParam);
|
336 |
+
|
337 |
+
// add Shipping Address
|
338 |
+
$shippingAddress = $this->_quote->getShippingAddress();
|
339 |
+
|
340 |
+
// copy BillingAddress to ShippingAddress if checkout with guest or register
|
341 |
+
/**
|
342 |
+
$checkoutMethod = $this->_quote->getCheckoutMethod();
|
343 |
+
if ($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST
|
344 |
+
|| $checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER
|
345 |
+
) {
|
346 |
+
$shippingAddress = $billingAddress;
|
347 |
+
}
|
348 |
+
*/
|
349 |
+
|
350 |
+
if (!empty($shippingAddress)) {
|
351 |
+
$shippingParam = Mage::getModel('ewayrapid/field_shippingAddress');
|
352 |
+
$shippingParam->setFirstName($shippingAddress->getFirstname())
|
353 |
+
->setLastName($shippingAddress->getLastname())
|
354 |
+
->setStreet1($shippingAddress->getStreet1())
|
355 |
+
->setStreet2($shippingAddress->getStreet2())
|
356 |
+
->setCity($shippingAddress->getCity())
|
357 |
+
->setState($shippingAddress->getRegion())
|
358 |
+
->setPostalCode($shippingAddress->getPostcode())
|
359 |
+
->setCountry(strtolower($shippingAddress->getCountryModel()->getIso2Code()))
|
360 |
+
->setEmail($shippingAddress->getEmail())
|
361 |
+
->setPhone($shippingAddress->getTelephone())
|
362 |
+
->setFax($shippingAddress->getFax());
|
363 |
+
$this->setShippingAddress($shippingParam);
|
364 |
+
}
|
365 |
+
|
366 |
+
return $this;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Get customer information by access code
|
371 |
+
*/
|
372 |
+
public function getInfoByAccessCode($accessCode)
|
373 |
+
{
|
374 |
+
$response = $this->_doRapidAPI('AccessCode/' . $accessCode, false);
|
375 |
+
return $response;
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Get customer session object
|
380 |
+
*
|
381 |
+
* @return Mage_Customer_Model_Session
|
382 |
+
*/
|
383 |
+
public function getCustomerSession()
|
384 |
+
{
|
385 |
+
return $this->_customerSession;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* check is new token when checkout
|
390 |
+
*
|
391 |
+
* @return bool
|
392 |
+
*/
|
393 |
+
protected function _isNewToken()
|
394 |
+
{
|
395 |
+
$info = $this->_quote->getPayment();
|
396 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($info);
|
397 |
+
if ($token = Mage::getSingleton('core/session')->getData('newToken')) {
|
398 |
+
Mage::getSingleton('core/session')->unsetData('newToken');
|
399 |
+
return true;
|
400 |
+
}
|
401 |
+
return false;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* get TokenCustomerID is selected of customer
|
406 |
+
*
|
407 |
+
* @return mixed
|
408 |
+
*/
|
409 |
+
protected function _editToken()
|
410 |
+
{
|
411 |
+
if ($token = Mage::getSingleton('core/session')->getData('editToken')) {
|
412 |
+
Mage::getSingleton('core/session')->unsetData('editToken');
|
413 |
+
return $token;
|
414 |
+
}
|
415 |
+
return $token;
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* check paypal option in eway not saved
|
420 |
+
*
|
421 |
+
* @return mixed|null
|
422 |
+
*/
|
423 |
+
protected function _getPaypalCheckout()
|
424 |
+
{
|
425 |
+
if ($paypal = Mage::getSingleton('core/session')->getData('sharedpagePaypal')) {
|
426 |
+
Mage::getModel('core/session')->unsetData('sharedpagePaypal');
|
427 |
+
return $paypal;
|
428 |
+
}
|
429 |
+
return null;
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* update customer when edit shipping address to paypal
|
434 |
+
*
|
435 |
+
* @param $accessCode
|
436 |
+
*/
|
437 |
+
public function updateCustomer($accessCode)
|
438 |
+
{
|
439 |
+
$response = $this->_doRapidAPI('Transaction/' . $accessCode, 'GET');
|
440 |
+
if ($response->isSuccess()) {
|
441 |
+
$customer = $this->_quote->getCustomer();
|
442 |
+
$billingAddress = $this->_quote->getBillingAddress();
|
443 |
+
$shippingAddress = $this->_quote->getShippingAddress();
|
444 |
+
$trans = $response->getTransactions();
|
445 |
+
|
446 |
+
if (isset($trans[0]['Customer'])) {
|
447 |
+
$billing = $trans[0]['Customer'];
|
448 |
+
$billingAddress->setFirstname($billing['FirstName'])
|
449 |
+
->setLastName($billing['LastName'])
|
450 |
+
->setCompany($billing['CompanyName'])
|
451 |
+
->setJobDescription($billing['JobDescription'])
|
452 |
+
->setStreet($billing['Street1'])
|
453 |
+
->setStreet2($billing['Street2'])
|
454 |
+
->setCity($billing['City'])
|
455 |
+
->setState($billing['State'])
|
456 |
+
->setPostcode($billing['PostalCode'])
|
457 |
+
->setCountryId(strtoupper($billing['Country']))
|
458 |
+
->setEmail($billing['Email'])
|
459 |
+
->setTelephone($billing['Phone'])
|
460 |
+
->setMobile($billing['Mobile'])
|
461 |
+
->setComments($billing['Comments'])
|
462 |
+
->setFax($billing['Fax'])
|
463 |
+
->setUrl($billing['Url']);
|
464 |
+
}
|
465 |
+
if (isset($trans[0]['ShippingAddress'])) {
|
466 |
+
$shipping = $trans[0]['ShippingAddress'];
|
467 |
+
$shippingAddress->setFirstname($shipping['FirstName'])
|
468 |
+
->setLastname($shipping['LastName'])
|
469 |
+
->setStreet($shipping['Street1'])
|
470 |
+
->setStreet2($shipping['Street2'])
|
471 |
+
->setCity($shipping['City'])
|
472 |
+
->setPostcode($shipping['PostalCode'])
|
473 |
+
->setCountryId(strtoupper($shipping['Country']))
|
474 |
+
->setEmail($shipping['Email'])
|
475 |
+
->setFax($shipping['Fax']);
|
476 |
+
|
477 |
+
if ($shipping['State']
|
478 |
+
&& $shipping['Country']
|
479 |
+
&& $region = Mage::getModel('directory/region')->loadByCode($shipping['State'], $shipping['Country'])
|
480 |
+
) {
|
481 |
+
$shippingAddress->setRegion($region->getName())
|
482 |
+
->setRegionId($region->getId());
|
483 |
+
}
|
484 |
+
if ($shipping['Phone']) {
|
485 |
+
$shippingAddress->setTelephone($shipping['Phone']);
|
486 |
+
}
|
487 |
+
}
|
488 |
+
$this->_quote->assignCustomerWithAddressChange($customer, $billingAddress, $shippingAddress)->save();
|
489 |
+
}
|
490 |
+
}
|
491 |
+
|
492 |
+
/**
|
493 |
+
* save token when checkout with eway saved
|
494 |
+
*
|
495 |
+
* @param Eway_Rapid31_Model_Response $response
|
496 |
+
* @param null $ccNumber
|
497 |
+
*/
|
498 |
+
public function saveTokenById(Eway_Rapid31_Model_Response $response, $ccNumber = null)
|
499 |
+
{
|
500 |
+
$this->unsetData();
|
501 |
+
|
502 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
503 |
+
$customerParam->setTokenCustomerID($response->getTokenCustomerID());
|
504 |
+
$this->setCustomer($customerParam);
|
505 |
+
$payment = Mage::getModel('ewayrapid/field_payment');
|
506 |
+
$payment->setTotalAmount(1);
|
507 |
+
$this->setPayment($payment);
|
508 |
+
$this->setRedirectUrl(Mage::getBaseUrl() . '/ewayrapid/sharedpage/saveToken');
|
509 |
+
$this->setMethod('');
|
510 |
+
|
511 |
+
$response = $this->_doRapidAPI('AccessCodesShared');
|
512 |
+
$token = true;
|
513 |
+
if ($response->isSuccess()) {
|
514 |
+
if (!$ccNumber) {
|
515 |
+
$token = $this->_createNewToken($response);
|
516 |
+
} else {
|
517 |
+
$token = $this->_updateToken($response, $ccNumber);
|
518 |
+
}
|
519 |
+
|
520 |
+
} else {
|
521 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while creating new token. Please try again. (Error message: %s)',
|
522 |
+
$response->getMessage()));
|
523 |
+
}
|
524 |
+
if (!$token) {
|
525 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while process token. Please try again.'));
|
526 |
+
}
|
527 |
+
return $response;
|
528 |
+
}
|
529 |
+
|
530 |
+
/**
|
531 |
+
* Create new token when checkout
|
532 |
+
*
|
533 |
+
* @param Eway_Rapid31_Model_Response $response
|
534 |
+
* @return $this
|
535 |
+
*/
|
536 |
+
protected function _createNewToken(Eway_Rapid31_Model_Response $response)
|
537 |
+
{
|
538 |
+
try {
|
539 |
+
$customer = $response->getCustomer();
|
540 |
+
|
541 |
+
$tokenInfo = array(
|
542 |
+
'Token' => $response->getTokenCustomerID(),
|
543 |
+
'Card' => $customer['CardNumber'] ? substr_replace($customer['CardNumber'], '******', 6, 6) : 'Paypal',
|
544 |
+
'Owner' => $customer['CardName'],
|
545 |
+
'StartMonth' => $customer['CardStartMonth'],
|
546 |
+
'StartYear' => $customer['CardStartYear'],
|
547 |
+
'IssueNumber' => $customer['CardIssueNumber'],
|
548 |
+
'ExpMonth' => $customer['CardExpiryMonth'],
|
549 |
+
'ExpYear' => (strlen($customer['CardExpiryYear']) == 2 ? '20' . $customer['CardExpiryYear'] : $customer['CardExpiryYear']),
|
550 |
+
'Type' => $this->checkCardType($customer['CardNumber']),
|
551 |
+
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($customer),
|
552 |
+
);
|
553 |
+
|
554 |
+
Mage::helper('ewayrapid/customer')->addToken($tokenInfo);
|
555 |
+
return true;
|
556 |
+
} catch (Exception $e) {
|
557 |
+
return false;
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Update token when checkout with existing token
|
563 |
+
*
|
564 |
+
* @param Eway_Rapid31_Model_Response $response
|
565 |
+
* @param null $ccNumber
|
566 |
+
* @return $this
|
567 |
+
*/
|
568 |
+
protected function _updateToken(Eway_Rapid31_Model_Response $response, $ccNumber = null)
|
569 |
+
{
|
570 |
+
try {
|
571 |
+
$customer = $response->getCustomer();
|
572 |
+
|
573 |
+
$tokenInfo = array(
|
574 |
+
'Token' => $response->getTokenCustomerID(),
|
575 |
+
'Card' => $customer['CardNumber'] ? substr_replace($customer['CardNumber'], '******', 6, 6) : 'Paypal',
|
576 |
+
'Owner' => $customer['CardName'],
|
577 |
+
'StartMonth' => $customer['CardStartMonth'],
|
578 |
+
'StartYear' => $customer['CardStartYear'],
|
579 |
+
'IssueNumber' => $customer['CardIssueNumber'],
|
580 |
+
'ExpMonth' => $customer['CardExpiryMonth'],
|
581 |
+
'ExpYear' => (strlen($customer['CardExpiryYear']) == 2 ? '20' . $customer['CardExpiryYear'] : $customer['CardExpiryYear']),
|
582 |
+
'Type' => $this->checkCardType($customer['CardNumber']),
|
583 |
+
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($customer),
|
584 |
+
);
|
585 |
+
|
586 |
+
Mage::helper('ewayrapid/customer')->updateToken($ccNumber, $tokenInfo);
|
587 |
+
return true;
|
588 |
+
} catch (Exception $e) {
|
589 |
+
return false;
|
590 |
+
}
|
591 |
+
}
|
592 |
+
|
593 |
+
/**
|
594 |
+
* Get card type name by card number
|
595 |
+
* @param $num Card number
|
596 |
+
* @return string Card type name
|
597 |
+
*/
|
598 |
+
public function checkCardType($num)
|
599 |
+
{
|
600 |
+
if ($num == null) {
|
601 |
+
return Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD;
|
602 |
+
}
|
603 |
+
return Mage::getModel('ewayrapid/request_token')->checkCardType($num);
|
604 |
+
}
|
605 |
+
|
606 |
+
public function getShippingByCode($postalCode)
|
607 |
+
{
|
608 |
+
$groups = $this->_quote->getShippingAddress()
|
609 |
+
->collectShippingRates()
|
610 |
+
->getGroupedAllShippingRates();
|
611 |
+
// determine current selected code & name
|
612 |
+
foreach ($groups as $code => $rates) {
|
613 |
+
foreach ($rates as $rate) {
|
614 |
+
if (strtoupper($postalCode) == strtoupper($rate->getCode())) {
|
615 |
+
return $rate;
|
616 |
+
}
|
617 |
+
}
|
618 |
+
}
|
619 |
+
return false;
|
620 |
+
}
|
621 |
+
|
622 |
+
public function getMethod()
|
623 |
+
{
|
624 |
+
return Mage::getSingleton('core/session')->getData('ewayMethod');
|
625 |
+
}
|
626 |
+
|
627 |
+
public function getTransaction($transaction_number) {
|
628 |
+
try {
|
629 |
+
$results = $this->_doRapidAPI("Transaction/$transaction_number", 'GET');
|
630 |
+
if ($results->isSuccess()) {
|
631 |
+
return $results->getTransactions();
|
632 |
+
}
|
633 |
+
} catch (Exception $e) {
|
634 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: %s)',
|
635 |
+
$results->getMessage()));
|
636 |
+
return false;
|
637 |
+
}
|
638 |
+
}
|
639 |
}
|
@@ -1,525 +1,544 @@
|
|
1 |
-
<?php
|
2 |
-
class Eway_Rapid31_Model_Request_Token extends Eway_Rapid31_Model_Request_Direct
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Call create new customer token API
|
6 |
-
*
|
7 |
-
* @param Varien_Object $billing
|
8 |
-
* @param Varien_Object $infoInstance
|
9 |
-
* @return Eway_Rapid31_Model_Request_Token
|
10 |
-
*/
|
11 |
-
public function createNewToken(Varien_Object $billing, Varien_Object $infoInstance)
|
12 |
-
{
|
13 |
-
// Empty Varien_Object's data
|
14 |
-
$this->unsetData();
|
15 |
-
|
16 |
-
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
17 |
-
|
18 |
-
$title = $this->_fixTitle($billing->getPrefix());
|
19 |
-
|
20 |
-
$customerParam->setTitle($title)
|
21 |
-
->setFirstName($billing->getFirstname())
|
22 |
-
->setLastName($billing->getLastname())
|
23 |
-
->setCompanyName($billing->getCompany())
|
24 |
-
->setJobDescription($billing->getJobDescription())
|
25 |
-
->setStreet1($billing->getStreet1())
|
26 |
-
->setStreet2($billing->getStreet2())
|
27 |
-
->setCity($billing->getCity())
|
28 |
-
->setState($billing->getRegion())
|
29 |
-
->setPostalCode($billing->getPostcode())
|
30 |
-
->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))
|
31 |
-
->setEmail($billing->getEmail())
|
32 |
-
->setPhone($billing->getTelephone())
|
33 |
-
->setMobile($billing->getMobile())
|
34 |
-
->setComments('')
|
35 |
-
->setFax($billing->getFax())
|
36 |
-
->setUrl('');
|
37 |
-
|
38 |
-
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
|
39 |
-
$cardDetails->setName($infoInstance->getCcOwner())
|
40 |
-
->setNumber($infoInstance->getCcNumber())
|
41 |
-
->setExpiryMonth($infoInstance->getCcExpMonth())
|
42 |
-
->setExpiryYear($infoInstance->getCcExpYear())
|
43 |
-
->setCVN($infoInstance->getCcCid())
|
44 |
-
->setStartMonth($infoInstance->getStartMonth())
|
45 |
-
->setStartYear($infoInstance->getStartYear())
|
46 |
-
->setIssueNumber($infoInstance->getIssueNumber());
|
47 |
-
$customerParam->setCardDetails($cardDetails);
|
48 |
-
$this->setCustomer($customerParam);
|
49 |
-
|
50 |
-
$response = $this->_doRapidAPI('Customer');
|
51 |
-
if ($response->isSuccess()) {
|
52 |
-
$customerReturn = $response->getCustomer();
|
53 |
-
$cardDetails = $customerReturn['CardDetails'];
|
54 |
-
unset($customerReturn['CardDetails']);
|
55 |
-
$customerReturn['RegionId'] = ((!$billing->getRegion() && $billing->getRegionId()) ? $billing->getRegionId() : '');
|
56 |
-
$tokenInfo = array(
|
57 |
-
'Token' => $response->getTokenCustomerID(),
|
58 |
-
'Card' => substr_replace($cardDetails['Number'], '******', 6, 6),
|
59 |
-
'Owner' => $infoInstance->getCcOwner(),
|
60 |
-
'ExpMonth' => $infoInstance->getCcExpMonth(),
|
61 |
-
'ExpYear' => $infoInstance->getCcExpYear(),
|
62 |
-
'Type' => $infoInstance->getCcType(),
|
63 |
-
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($customerReturn),
|
64 |
-
);
|
65 |
-
Mage::helper('ewayrapid/customer')->addToken($tokenInfo);
|
66 |
-
return $this;
|
67 |
-
} else {
|
68 |
-
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while creating new token. Please try again. (Error message: %s)',
|
69 |
-
$response->getMessage()));
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Update current token
|
75 |
-
*
|
76 |
-
* @param Varien_Object $billing
|
77 |
-
* @param Varien_Object $infoInstance
|
78 |
-
* @return Eway_Rapid31_Model_Request_Token
|
79 |
-
*/
|
80 |
-
public function updateToken(Varien_Object $billing, Varien_Object $infoInstance)
|
81 |
-
{
|
82 |
-
if (!Mage::helper('ewayrapid')->isBackendOrder() && !Mage::getSingleton('ewayrapid/config')->canEditToken()) {
|
83 |
-
Mage::throwException(Mage::helper('ewayrapid')->__('Customers are not allowed to edit token.'));
|
84 |
-
}
|
85 |
-
|
86 |
-
// Empty Varien_Object's data
|
87 |
-
$this->unsetData();
|
88 |
-
|
89 |
-
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
90 |
-
|
91 |
-
$title = $this->_fixTitle($billing->getPrefix());
|
92 |
-
|
93 |
-
$customerParam->setTitle($title)
|
94 |
-
->setFirstName($billing->getFirstname())
|
95 |
-
->setLastName($billing->getLastname())
|
96 |
-
->setCompanyName($billing->getCompany())
|
97 |
-
->setJobDescription($billing->getJobDescription())
|
98 |
-
->setStreet1($billing->getStreet1())
|
99 |
-
->setStreet2($billing->getStreet2())
|
100 |
-
->setCity($billing->getCity())
|
101 |
-
->setState($billing->getRegion())
|
102 |
-
->setPostalCode($billing->getPostcode())
|
103 |
-
->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))
|
104 |
-
->setEmail($billing->getEmail())
|
105 |
-
->setPhone($billing->getTelephone())
|
106 |
-
->setMobile($billing->getMobile())
|
107 |
-
->setFax($billing->getFax());
|
108 |
-
|
109 |
-
$customerHelper = Mage::helper('ewayrapid/customer');
|
110 |
-
$customerTokenId = $customerHelper->getCustomerTokenId($infoInstance->getSavedToken());
|
111 |
-
if ($customerTokenId) {
|
112 |
-
$customerParam->setTokenCustomerID($customerTokenId);
|
113 |
-
} else {
|
114 |
-
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token: Token info does not exist.'));
|
115 |
-
}
|
116 |
-
|
117 |
-
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
|
118 |
-
$cardDetails->setName($infoInstance->getCcOwner())
|
119 |
-
->setExpiryMonth($infoInstance->getCcExpMonth())
|
120 |
-
->setNumber('444433XXXXXX1111') // Required dummy card number for update to work
|
121 |
-
->setExpiryYear($infoInstance->getCcExpYear())
|
122 |
-
->setCVN($infoInstance->getCcCid());
|
123 |
-
$customerParam->setCardDetails($cardDetails);
|
124 |
-
|
125 |
-
$this->setCustomer($customerParam);
|
126 |
-
|
127 |
-
$response = $this->_doRapidAPI('Customer', 'PUT');
|
128 |
-
if ($response->isSuccess()) {
|
129 |
-
$customerReturn = $response->getCustomer();
|
130 |
-
$customerReturn['RegionId'] = ((!$billing->getRegion() && $billing->getRegionId()) ? $billing->getRegionId() : '');
|
131 |
-
unset($customerReturn['CardDetails']);
|
132 |
-
$tokenInfo = array(
|
133 |
-
'Token' => $response->getTokenCustomerID(),
|
134 |
-
'Owner' => $infoInstance->getCcOwner(),
|
135 |
-
'ExpMonth' => $infoInstance->getCcExpMonth(),
|
136 |
-
'ExpYear' => $infoInstance->getCcExpYear(),
|
137 |
-
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($customerReturn),
|
138 |
-
);
|
139 |
-
Mage::helper('ewayrapid/customer')->updateToken($infoInstance->getSavedToken(), $tokenInfo);
|
140 |
-
return $this;
|
141 |
-
} else {
|
142 |
-
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token. Please try again. (Error message: %s)',
|
143 |
-
$response->getMessage()));
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
protected function _buildRequest(Mage_Sales_Model_Order_Payment $payment, $amount)
|
148 |
-
{
|
149 |
-
// Empty Varien_Object's data
|
150 |
-
$this->unsetData();
|
151 |
-
// in case recurring profile, $methodInstance is not exist, and $payment->getIsRecurring() is used
|
152 |
-
if (!$payment->getIsRecurring()) {
|
153 |
-
$methodInstance = $payment->getMethodInstance();
|
154 |
-
$infoInstance = $methodInstance->getInfoInstance();
|
155 |
-
Mage::helper('ewayrapid')->unserializeInfoInstace($infoInstance);
|
156 |
-
}
|
157 |
-
$order = $payment->getOrder();
|
158 |
-
$shipping = $order->getShippingAddress();
|
159 |
-
|
160 |
-
// if item is virtual product
|
161 |
-
if (!$shipping) {
|
162 |
-
$quote = Mage::getModel('checkout/cart')->getQuote();
|
163 |
-
if ($quote->isVirtual()) {
|
164 |
-
$shipping = $quote->getBillingAddress();
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
if (!$payment->getIsRecurring()) {
|
169 |
-
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
170 |
-
}
|
171 |
-
if (Mage::helper('ewayrapid')->isBackendOrder()) {
|
172 |
-
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_MOTO);
|
173 |
-
} elseif ($payment->getIsRecurring()) {
|
174 |
-
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_RECURRING);
|
175 |
-
} else {
|
176 |
-
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE);
|
177 |
-
}
|
178 |
-
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
179 |
-
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
180 |
-
$this->setShippingMethod('Other');
|
181 |
-
|
182 |
-
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
183 |
-
$paymentParam->setTotalAmount($amount)
|
184 |
-
->setCurrencyCode($order->getBaseCurrencyCode());
|
185 |
-
|
186 |
-
|
187 |
-
$
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
$
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
->
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
$
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
$
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
$
|
298 |
-
|
299 |
-
|
300 |
-
$
|
301 |
-
|
302 |
-
|
303 |
-
$
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
$
|
315 |
-
|
316 |
-
$
|
317 |
-
|
318 |
-
|
319 |
-
$
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
$
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
$
|
342 |
-
|
343 |
-
$
|
344 |
-
$
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
$
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
$response
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
$
|
397 |
-
|
398 |
-
|
399 |
-
'
|
400 |
-
'
|
401 |
-
'
|
402 |
-
'
|
403 |
-
'
|
404 |
-
'
|
405 |
-
|
406 |
-
'
|
407 |
-
'
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
$
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
'
|
426 |
-
'
|
427 |
-
'
|
428 |
-
|
429 |
-
'
|
430 |
-
'
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
$
|
446 |
-
|
447 |
-
'
|
448 |
-
'
|
449 |
-
'
|
450 |
-
'
|
451 |
-
'
|
452 |
-
'
|
453 |
-
|
454 |
-
'
|
455 |
-
'
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
}
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Model_Request_Token extends Eway_Rapid31_Model_Request_Direct
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Call create new customer token API
|
6 |
+
*
|
7 |
+
* @param Varien_Object $billing
|
8 |
+
* @param Varien_Object $infoInstance
|
9 |
+
* @return Eway_Rapid31_Model_Request_Token
|
10 |
+
*/
|
11 |
+
public function createNewToken(Varien_Object $billing, Varien_Object $infoInstance)
|
12 |
+
{
|
13 |
+
// Empty Varien_Object's data
|
14 |
+
$this->unsetData();
|
15 |
+
|
16 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
17 |
+
|
18 |
+
$title = $this->_fixTitle($billing->getPrefix());
|
19 |
+
|
20 |
+
$customerParam->setTitle($title)
|
21 |
+
->setFirstName($billing->getFirstname())
|
22 |
+
->setLastName($billing->getLastname())
|
23 |
+
->setCompanyName($billing->getCompany())
|
24 |
+
->setJobDescription($billing->getJobDescription())
|
25 |
+
->setStreet1($billing->getStreet1())
|
26 |
+
->setStreet2($billing->getStreet2())
|
27 |
+
->setCity($billing->getCity())
|
28 |
+
->setState($billing->getRegion())
|
29 |
+
->setPostalCode($billing->getPostcode())
|
30 |
+
->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))
|
31 |
+
->setEmail($billing->getEmail())
|
32 |
+
->setPhone($billing->getTelephone())
|
33 |
+
->setMobile($billing->getMobile())
|
34 |
+
->setComments('')
|
35 |
+
->setFax($billing->getFax())
|
36 |
+
->setUrl('');
|
37 |
+
|
38 |
+
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
|
39 |
+
$cardDetails->setName($infoInstance->getCcOwner())
|
40 |
+
->setNumber($infoInstance->getCcNumber())
|
41 |
+
->setExpiryMonth($infoInstance->getCcExpMonth())
|
42 |
+
->setExpiryYear($infoInstance->getCcExpYear())
|
43 |
+
->setCVN($infoInstance->getCcCid())
|
44 |
+
->setStartMonth($infoInstance->getStartMonth())
|
45 |
+
->setStartYear($infoInstance->getStartYear())
|
46 |
+
->setIssueNumber($infoInstance->getIssueNumber());
|
47 |
+
$customerParam->setCardDetails($cardDetails);
|
48 |
+
$this->setCustomer($customerParam);
|
49 |
+
|
50 |
+
$response = $this->_doRapidAPI('Customer');
|
51 |
+
if ($response->isSuccess()) {
|
52 |
+
$customerReturn = $response->getCustomer();
|
53 |
+
$cardDetails = $customerReturn['CardDetails'];
|
54 |
+
unset($customerReturn['CardDetails']);
|
55 |
+
$customerReturn['RegionId'] = ((!$billing->getRegion() && $billing->getRegionId()) ? $billing->getRegionId() : '');
|
56 |
+
$tokenInfo = array(
|
57 |
+
'Token' => $response->getTokenCustomerID(),
|
58 |
+
'Card' => substr_replace($cardDetails['Number'], '******', 6, 6),
|
59 |
+
'Owner' => $infoInstance->getCcOwner(),
|
60 |
+
'ExpMonth' => $infoInstance->getCcExpMonth(),
|
61 |
+
'ExpYear' => $infoInstance->getCcExpYear(),
|
62 |
+
'Type' => $infoInstance->getCcType(),
|
63 |
+
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($customerReturn),
|
64 |
+
);
|
65 |
+
Mage::helper('ewayrapid/customer')->addToken($tokenInfo);
|
66 |
+
return $this;
|
67 |
+
} else {
|
68 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while creating new token. Please try again. (Error message: %s)',
|
69 |
+
$response->getMessage()));
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Update current token
|
75 |
+
*
|
76 |
+
* @param Varien_Object $billing
|
77 |
+
* @param Varien_Object $infoInstance
|
78 |
+
* @return Eway_Rapid31_Model_Request_Token
|
79 |
+
*/
|
80 |
+
public function updateToken(Varien_Object $billing, Varien_Object $infoInstance)
|
81 |
+
{
|
82 |
+
if (!Mage::helper('ewayrapid')->isBackendOrder() && !Mage::getSingleton('ewayrapid/config')->canEditToken()) {
|
83 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('Customers are not allowed to edit token.'));
|
84 |
+
}
|
85 |
+
|
86 |
+
// Empty Varien_Object's data
|
87 |
+
$this->unsetData();
|
88 |
+
|
89 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
90 |
+
|
91 |
+
$title = $this->_fixTitle($billing->getPrefix());
|
92 |
+
|
93 |
+
$customerParam->setTitle($title)
|
94 |
+
->setFirstName($billing->getFirstname())
|
95 |
+
->setLastName($billing->getLastname())
|
96 |
+
->setCompanyName($billing->getCompany())
|
97 |
+
->setJobDescription($billing->getJobDescription())
|
98 |
+
->setStreet1($billing->getStreet1())
|
99 |
+
->setStreet2($billing->getStreet2())
|
100 |
+
->setCity($billing->getCity())
|
101 |
+
->setState($billing->getRegion())
|
102 |
+
->setPostalCode($billing->getPostcode())
|
103 |
+
->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))
|
104 |
+
->setEmail($billing->getEmail())
|
105 |
+
->setPhone($billing->getTelephone())
|
106 |
+
->setMobile($billing->getMobile())
|
107 |
+
->setFax($billing->getFax());
|
108 |
+
|
109 |
+
$customerHelper = Mage::helper('ewayrapid/customer');
|
110 |
+
$customerTokenId = $customerHelper->getCustomerTokenId($infoInstance->getSavedToken());
|
111 |
+
if ($customerTokenId) {
|
112 |
+
$customerParam->setTokenCustomerID($customerTokenId);
|
113 |
+
} else {
|
114 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token: Token info does not exist.'));
|
115 |
+
}
|
116 |
+
|
117 |
+
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
|
118 |
+
$cardDetails->setName($infoInstance->getCcOwner())
|
119 |
+
->setExpiryMonth($infoInstance->getCcExpMonth())
|
120 |
+
->setNumber('444433XXXXXX1111') // Required dummy card number for update to work
|
121 |
+
->setExpiryYear($infoInstance->getCcExpYear())
|
122 |
+
->setCVN($infoInstance->getCcCid());
|
123 |
+
$customerParam->setCardDetails($cardDetails);
|
124 |
+
|
125 |
+
$this->setCustomer($customerParam);
|
126 |
+
|
127 |
+
$response = $this->_doRapidAPI('Customer', 'PUT');
|
128 |
+
if ($response->isSuccess()) {
|
129 |
+
$customerReturn = $response->getCustomer();
|
130 |
+
$customerReturn['RegionId'] = ((!$billing->getRegion() && $billing->getRegionId()) ? $billing->getRegionId() : '');
|
131 |
+
unset($customerReturn['CardDetails']);
|
132 |
+
$tokenInfo = array(
|
133 |
+
'Token' => $response->getTokenCustomerID(),
|
134 |
+
'Owner' => $infoInstance->getCcOwner(),
|
135 |
+
'ExpMonth' => $infoInstance->getCcExpMonth(),
|
136 |
+
'ExpYear' => $infoInstance->getCcExpYear(),
|
137 |
+
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($customerReturn),
|
138 |
+
);
|
139 |
+
Mage::helper('ewayrapid/customer')->updateToken($infoInstance->getSavedToken(), $tokenInfo);
|
140 |
+
return $this;
|
141 |
+
} else {
|
142 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token. Please try again. (Error message: %s)',
|
143 |
+
$response->getMessage()));
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
protected function _buildRequest(Mage_Sales_Model_Order_Payment $payment, $amount)
|
148 |
+
{
|
149 |
+
// Empty Varien_Object's data
|
150 |
+
$this->unsetData();
|
151 |
+
// in case recurring profile, $methodInstance is not exist, and $payment->getIsRecurring() is used
|
152 |
+
if (!$payment->getIsRecurring()) {
|
153 |
+
$methodInstance = $payment->getMethodInstance();
|
154 |
+
$infoInstance = $methodInstance->getInfoInstance();
|
155 |
+
Mage::helper('ewayrapid')->unserializeInfoInstace($infoInstance);
|
156 |
+
}
|
157 |
+
$order = $payment->getOrder();
|
158 |
+
$shipping = $order->getShippingAddress();
|
159 |
+
|
160 |
+
// if item is virtual product
|
161 |
+
if (!$shipping) {
|
162 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
163 |
+
if ($quote->isVirtual()) {
|
164 |
+
$shipping = $quote->getBillingAddress();
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
if (!$payment->getIsRecurring()) {
|
169 |
+
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
170 |
+
}
|
171 |
+
if (Mage::helper('ewayrapid')->isBackendOrder()) {
|
172 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_MOTO);
|
173 |
+
} elseif ($payment->getIsRecurring()) {
|
174 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_RECURRING);
|
175 |
+
} else {
|
176 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE);
|
177 |
+
}
|
178 |
+
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
179 |
+
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
180 |
+
$this->setShippingMethod('Other');
|
181 |
+
|
182 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
183 |
+
$paymentParam->setTotalAmount($amount)
|
184 |
+
->setCurrencyCode($order->getBaseCurrencyCode());
|
185 |
+
|
186 |
+
// add InvoiceDescription and InvoiceReference
|
187 |
+
$config = Mage::getModel('ewayrapid/config');
|
188 |
+
|
189 |
+
if($config->shouldPassingInvoiceDescription()){
|
190 |
+
$invoiceDescription = '';
|
191 |
+
foreach($order->getAllVisibleItems() as $item){
|
192 |
+
// Check in case multi-shipping
|
193 |
+
if (!$item->getQuoteParentItemId()) {
|
194 |
+
$invoiceDescription .= (int) $item->getQtyOrdered() . ' x ' .$item->getName() . ', ';
|
195 |
+
}
|
196 |
+
}
|
197 |
+
$invoiceDescription = trim($invoiceDescription,', ');
|
198 |
+
$invoiceDescription = Mage::helper('ewayrapid')->limitInvoiceDescriptionLength($invoiceDescription);
|
199 |
+
|
200 |
+
$paymentParam->setInvoiceDescription($invoiceDescription);
|
201 |
+
}
|
202 |
+
|
203 |
+
if($config->shouldPassingGuessOrder()){
|
204 |
+
$paymentParam->setInvoiceReference($order->getIncrementId());
|
205 |
+
}
|
206 |
+
|
207 |
+
$this->setPayment($paymentParam);
|
208 |
+
|
209 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
210 |
+
$customerTokenId = null;
|
211 |
+
|
212 |
+
/** get $customerTokenId if product is recurring profile */
|
213 |
+
if ($payment->getIsRecurring()) {
|
214 |
+
$customer = Mage::getModel('customer/customer')->load($payment->getCustomerId());
|
215 |
+
$customerHelper = Mage::helper('ewayrapid/customer');
|
216 |
+
$customerHelper->setCurrentCustomer($customer);
|
217 |
+
$customerTokenId = $customerHelper->getCustomerTokenId($payment->getTokenId());
|
218 |
+
} else {
|
219 |
+
/** get $customerTokenId if product is normal item */
|
220 |
+
if ($infoInstance->getSavedToken()) {
|
221 |
+
$customerHelper = Mage::helper('ewayrapid/customer');
|
222 |
+
$customerTokenId = $customerHelper->getCustomerTokenId($infoInstance->getSavedToken());
|
223 |
+
}
|
224 |
+
else {
|
225 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction: Token info does not exist.'));
|
226 |
+
}
|
227 |
+
}
|
228 |
+
if ($customerTokenId) {
|
229 |
+
$customerParam->setTokenCustomerID($customerTokenId);
|
230 |
+
if ($this->getTransactionType() == Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE) {
|
231 |
+
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
|
232 |
+
$cardDetails->setCVN($infoInstance->getCcCid());
|
233 |
+
$customerParam->setCardDetails($cardDetails);
|
234 |
+
}
|
235 |
+
$this->setCustomer($customerParam);
|
236 |
+
} else {
|
237 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction: Token info does not exist.'));
|
238 |
+
}
|
239 |
+
|
240 |
+
if (!empty($shipping)) {
|
241 |
+
$shippingParam = Mage::getModel('ewayrapid/field_shippingAddress');
|
242 |
+
$shippingParam->setFirstName($shipping->getFirstname())
|
243 |
+
->setLastName($shipping->getLastname())
|
244 |
+
->setStreet1($shipping->getStreet1())
|
245 |
+
->setStreet2($shipping->getStreet2())
|
246 |
+
->setCity($shipping->getCity())
|
247 |
+
->setState($shipping->getRegion())
|
248 |
+
->setPostalCode($shipping->getPostcode())
|
249 |
+
->setCountry(strtolower($shipping->getCountryModel()->getIso2Code()))
|
250 |
+
->setEmail($shipping->getEmail())
|
251 |
+
->setPhone($shipping->getTelephone())
|
252 |
+
->setFax($shipping->getFax());
|
253 |
+
$this->setShippingAddress($shippingParam);
|
254 |
+
}
|
255 |
+
|
256 |
+
if ((isset($methodInstance) && $methodInstance->getConfigData('transfer_cart_items')) || $payment->getIsRecurring() || !$payment->getIsInitialFee()) {
|
257 |
+
$orderItems = $order->getAllVisibleItems();
|
258 |
+
$lineItems = array();
|
259 |
+
foreach ($orderItems as $orderItem) {
|
260 |
+
/* @var Mage_Sales_Model_Order_Item $orderItem */
|
261 |
+
$lineItem = Mage::getModel('ewayrapid/field_lineItem');
|
262 |
+
$lineItem->setSKU($orderItem->getSku());
|
263 |
+
$lineItem->setDescription(substr($orderItem->getName(), 0, 26));
|
264 |
+
$lineItem->setQuantity($orderItem->getQtyOrdered());
|
265 |
+
$lineItem->setUnitCost(round($orderItem->getBasePrice() * 100));
|
266 |
+
$lineItem->setTax(round($orderItem->getBaseTaxAmount() * 100));
|
267 |
+
$lineItem->setTotal(round($orderItem->getBaseRowTotalInclTax() * 100));
|
268 |
+
$lineItems[] = $lineItem;
|
269 |
+
}
|
270 |
+
$this->setItems($lineItems);
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
return $this;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Create new AccessCode
|
279 |
+
* @param Varien_Object $billing
|
280 |
+
* @param Varien_Object $infoInstance
|
281 |
+
* @param string $method
|
282 |
+
* @param null $request
|
283 |
+
* @return Eway_Rapid31_Model_Response
|
284 |
+
*/
|
285 |
+
public function createAccessCode(Varien_Object $billing, Varien_Object $infoInstance,
|
286 |
+
$method = 'AccessCodes', $request = null)
|
287 |
+
{
|
288 |
+
// Empty Varien_Object's data
|
289 |
+
$tokenCustomerID = $request->get('TokenCustomerID');
|
290 |
+
$this->unsetData();
|
291 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
292 |
+
|
293 |
+
$title = $this->_fixTitle($billing->getPrefix());
|
294 |
+
|
295 |
+
$customerParam->setTokenCustomerID($tokenCustomerID)
|
296 |
+
->setTitle($title)
|
297 |
+
->setFirstName($billing->getFirstname())
|
298 |
+
->setLastName($billing->getLastname())
|
299 |
+
->setCompanyName($billing->getCompany())
|
300 |
+
->setJobDescription($billing->getJobDescription())
|
301 |
+
->setStreet1($billing->getStreet1())
|
302 |
+
->setStreet2($billing->getStreet2())
|
303 |
+
->setCity($billing->getCity())
|
304 |
+
->setState($billing->getRegion())
|
305 |
+
->setPostalCode($billing->getPostcode())
|
306 |
+
->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))
|
307 |
+
->setEmail($billing->getEmail())
|
308 |
+
->setPhone($billing->getTelephone())
|
309 |
+
->setMobile($billing->getMobile())
|
310 |
+
->setComments('')
|
311 |
+
->setFax($billing->getFax())
|
312 |
+
->setUrl('');
|
313 |
+
|
314 |
+
$returnUrl = Mage::getBaseUrl() . '/ewayrapid/mycards/saveToken?ccType='
|
315 |
+
. $infoInstance->getCcType() . '&expYear=' . $infoInstance->getCcExpYear();
|
316 |
+
if ($request->get('is_default') == 'on') {
|
317 |
+
$returnUrl .= '&is_default=on';
|
318 |
+
}
|
319 |
+
if($infoInstance->getCcStartMonth()) {
|
320 |
+
$returnUrl .= '&startMonth=' . $infoInstance->getCcStartMonth();
|
321 |
+
}
|
322 |
+
if($infoInstance->getCcStartYear()) {
|
323 |
+
$returnUrl .= '&startYear=' . $infoInstance->getCcStartYear();
|
324 |
+
}
|
325 |
+
if($infoInstance->getCcIssueNumber()) {
|
326 |
+
$returnUrl .= '&issueNumber=' . $infoInstance->getCcIssueNumber();
|
327 |
+
}
|
328 |
+
// Binding address on url param
|
329 |
+
$returnUrl .= '&street1=' . base64_encode($billing->getStreet1())
|
330 |
+
. '&street2=' . base64_encode($billing->getStreet2());
|
331 |
+
$tokenId = $request->get('token_id');
|
332 |
+
if (!empty($tokenId)) { // ID token customer will be defined to update
|
333 |
+
$returnUrl = $returnUrl . '&token_id=' . $tokenId;
|
334 |
+
}
|
335 |
+
|
336 |
+
$this->setCustomer($customerParam);
|
337 |
+
$this->setRedirectUrl($returnUrl);
|
338 |
+
$this->setCancelUrl($returnUrl);
|
339 |
+
$this->setMethod(!empty($tokenCustomerID) ? 'UpdateTokenCustomer' : 'CreateTokenCustomer');
|
340 |
+
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
341 |
+
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
342 |
+
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
343 |
+
$this->setTransactionType("Purchase");
|
344 |
+
$this->setCustomerReadOnly(true);
|
345 |
+
|
346 |
+
// Create new access code
|
347 |
+
//$formMethod = !empty($tokenCustomerID) ? 'PUT' : 'POST';
|
348 |
+
$response = $this->_doRapidAPI($method);
|
349 |
+
return $response;
|
350 |
+
}
|
351 |
+
|
352 |
+
/*
|
353 |
+
* Get customer information by access code
|
354 |
+
*/
|
355 |
+
public function getInfoByAccessCode($accessCode)
|
356 |
+
{
|
357 |
+
$response = $this->_doRapidAPI('AccessCode/' . $accessCode, false);
|
358 |
+
return $response;
|
359 |
+
}
|
360 |
+
|
361 |
+
public function saveInfoByTokenId($cardData)
|
362 |
+
{
|
363 |
+
// Empty Varien_Object's data
|
364 |
+
$this->unsetData();
|
365 |
+
|
366 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
367 |
+
$customerParam->setTokenCustomerID($cardData['token']);
|
368 |
+
$payment = Mage::getModel('ewayrapid/field_payment');
|
369 |
+
$payment->setTotalAmount(1);
|
370 |
+
$returnUrl = Mage::getBaseUrl() . '/ewayrapid/mycards';
|
371 |
+
|
372 |
+
$this->setCustomer($customerParam);
|
373 |
+
$this->setPayment($payment);
|
374 |
+
$this->setRedirectUrl($returnUrl);
|
375 |
+
$this->setMethod('');
|
376 |
+
$this->setTransactionType('');
|
377 |
+
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
378 |
+
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
379 |
+
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
380 |
+
|
381 |
+
$response = $this->_doRapidAPI('AccessCodes');
|
382 |
+
|
383 |
+
if ($cardData['token_id']) {
|
384 |
+
// Update card
|
385 |
+
$this->__updateTokenTransparentOrSharedPage($response, $cardData);
|
386 |
+
} else
|
387 |
+
// Create new token
|
388 |
+
$this->__createNewTokenTransparentOrSharedPage($response, $cardData);
|
389 |
+
return $this;
|
390 |
+
|
391 |
+
}
|
392 |
+
|
393 |
+
private function __createNewTokenTransparentOrSharedPage($response, $cardData)
|
394 |
+
{
|
395 |
+
if ($response->isSuccess()) {
|
396 |
+
$data = $response->getData();
|
397 |
+
$customer = $data['Customer'];
|
398 |
+
$address = array(
|
399 |
+
//'TokenCustomerID' => $customer['TokenCustomerID'],
|
400 |
+
'Reference' => $customer['Reference'],
|
401 |
+
'Title' => $customer['Title'],
|
402 |
+
'FirstName' => $customer['FirstName'],
|
403 |
+
'LastName' => $customer['LastName'],
|
404 |
+
'CompanyName' => $customer['CompanyName'],
|
405 |
+
'JobDescription' => $customer['JobDescription'],
|
406 |
+
'Street1' => isset($cardData['street1'])? $cardData['street1'] : $customer['Street1'],
|
407 |
+
'Street2' => isset($cardData['street2']) ? $cardData['street2'] : $customer['Street2'],
|
408 |
+
'City' => $customer['City'],
|
409 |
+
'State' => $customer['State'],
|
410 |
+
'PostalCode' => $customer['PostalCode'],
|
411 |
+
'Country' => $customer['Country'],
|
412 |
+
'Email' => $customer['Email'],
|
413 |
+
'Phone' => $customer['Phone'],
|
414 |
+
'Mobile' => $customer['Mobile'],
|
415 |
+
'Comments' => $customer['Comments'],
|
416 |
+
'Fax' => $customer['Fax'],
|
417 |
+
'Url' => $customer['Url']
|
418 |
+
);
|
419 |
+
$tokenInfo = array(
|
420 |
+
'Token' => $response->getTokenCustomerID(),
|
421 |
+
'Card' => substr_replace($customer['CardNumber'], '******', 6, 6),
|
422 |
+
'Owner' => $customer['CardName'],
|
423 |
+
'StartMonth' => $cardData['startMonth'],
|
424 |
+
'StartYear' => $cardData['startYear'],
|
425 |
+
'IssueNumber' => $cardData['issueNumber'],
|
426 |
+
'ExpMonth' => $customer['CardExpiryMonth'],
|
427 |
+
'ExpYear' => (!empty($cardData['expYear']) ? $cardData['expYear'] :
|
428 |
+
(strlen($customer['CardExpiryYear']) == 2 ? '20' . $customer['CardExpiryYear'] : $customer['CardExpiryYear'])),
|
429 |
+
'Type' => $cardData['ccType'] ? $cardData['ccType'] : $this->checkCardType($customer['CardNumber']),
|
430 |
+
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($address),
|
431 |
+
);
|
432 |
+
|
433 |
+
Mage::helper('ewayrapid/customer')->addToken($tokenInfo);
|
434 |
+
return $this;
|
435 |
+
} else {
|
436 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while creating new token. Please try again. (Error message: %s)',
|
437 |
+
$response->getMessage()));
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
private function __updateTokenTransparentOrSharedPage($res, $cardData)
|
442 |
+
{
|
443 |
+
if ($res->isSuccess()) {
|
444 |
+
$data = $res->getData();
|
445 |
+
$customer = $data['Customer'];
|
446 |
+
$address = array(
|
447 |
+
//'TokenCustomerID' => $customer['TokenCustomerID'],
|
448 |
+
'Reference' => $customer['Reference'],
|
449 |
+
'Title' => $customer['Title'],
|
450 |
+
'FirstName' => $customer['FirstName'],
|
451 |
+
'LastName' => $customer['LastName'],
|
452 |
+
'CompanyName' => $customer['CompanyName'],
|
453 |
+
'JobDescription' => $customer['JobDescription'],
|
454 |
+
'Street1' => isset($cardData['street1'])? $cardData['street1'] : $customer['Street1'],
|
455 |
+
'Street2' => isset($cardData['street2']) ? $cardData['street2'] : $customer['Street2'],
|
456 |
+
'City' => $customer['City'],
|
457 |
+
'State' => $customer['State'],
|
458 |
+
'PostalCode' => $customer['PostalCode'],
|
459 |
+
'Country' => $customer['Country'],
|
460 |
+
'Email' => $customer['Email'],
|
461 |
+
'Phone' => $customer['Phone'],
|
462 |
+
'Mobile' => $customer['Mobile'],
|
463 |
+
'Comments' => $customer['Comments'],
|
464 |
+
'Fax' => $customer['Fax'],
|
465 |
+
'Url' => $customer['Url']
|
466 |
+
);
|
467 |
+
|
468 |
+
$tokenInfo = array(
|
469 |
+
'Token' => $res->getTokenCustomerID(),
|
470 |
+
'Owner' => $customer['CardName'],
|
471 |
+
'StartMonth' => $cardData['startMonth'],
|
472 |
+
'StartYear' => $cardData['startYear'],
|
473 |
+
'IssueNumber' => $cardData['issueNumber'],
|
474 |
+
'ExpMonth' => $customer['CardExpiryMonth'],
|
475 |
+
'ExpYear' => (!empty($cardData['expYear']) ? $cardData['expYear'] :
|
476 |
+
(strlen($customer['CardExpiryYear']) == 2 ? '20' . $customer['CardExpiryYear'] : $customer['CardExpiryYear'])),
|
477 |
+
'Type' => $cardData['ccType'] ? $cardData['ccType'] : $this->checkCardType($customer['CardNumber']),
|
478 |
+
'Address' => Mage::getModel('ewayrapid/field_customer')->addData($address),
|
479 |
+
);
|
480 |
+
//edit card number if connection type = shared page
|
481 |
+
if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type') === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
482 |
+
|| Mage::getStoreConfig('payment/ewayrapid_general/connection_type') === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
483 |
+
) {
|
484 |
+
$tokenInfo['Card'] = str_replace('X', '*', $customer['CardNumber']);
|
485 |
+
$tokenInfo['Card'] = str_replace('x', '*', $tokenInfo['Card']);
|
486 |
+
}
|
487 |
+
|
488 |
+
Mage::helper('ewayrapid/customer')->updateToken($cardData['token_id'], $tokenInfo);
|
489 |
+
return $this;
|
490 |
+
} else {
|
491 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while creating new token. Please try again. (Error message: %s)',
|
492 |
+
$res->getMessage()));
|
493 |
+
}
|
494 |
+
}
|
495 |
+
|
496 |
+
/**
|
497 |
+
* Get card type name by card number
|
498 |
+
* @param $num Card number
|
499 |
+
* @return string Card type name
|
500 |
+
*/
|
501 |
+
public function checkCardType($num)
|
502 |
+
{
|
503 |
+
if (preg_match('/^(4026|417500|4508|4844|4913|4917)/', $num)) {
|
504 |
+
return 'VE';
|
505 |
+
}
|
506 |
+
if (preg_match('/^4/', $num)) {
|
507 |
+
return 'VI';
|
508 |
+
}
|
509 |
+
if (preg_match('/^(34|37)/', $num)) {
|
510 |
+
return 'AE';
|
511 |
+
}
|
512 |
+
if (preg_match('/^(5[1-5])/', $num)) {
|
513 |
+
return 'MC';
|
514 |
+
}
|
515 |
+
if (preg_match('/^(2131|1800)/', $num)) {
|
516 |
+
return 'JCB';
|
517 |
+
}
|
518 |
+
if (preg_match('/^36/', $num)) {
|
519 |
+
return 'DC';
|
520 |
+
}
|
521 |
+
if (preg_match('/^(5018|5020|5038|5893|6304|6759|6761|6762|6763)/', $num)) {
|
522 |
+
return 'ME';
|
523 |
+
}
|
524 |
+
|
525 |
+
return 'Unknown';
|
526 |
+
}
|
527 |
+
/**
|
528 |
+
* Check Card Name
|
529 |
+
* @param $card Card Info
|
530 |
+
* @return string Card name: paypal | masterpass | mastercard
|
531 |
+
*/
|
532 |
+
public function checkCardName($card)
|
533 |
+
{
|
534 |
+
$cardType = strtolower($card->getType());
|
535 |
+
if (preg_match('/^paypal/', $cardType)) {
|
536 |
+
return Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD;
|
537 |
+
}
|
538 |
+
$ccTypes = Mage::getSingleton('ewayrapid/system_config_source_cctype')->getAllowedTypes();
|
539 |
+
if (in_array(strtoupper($cardType), $ccTypes)) {
|
540 |
+
return Eway_Rapid31_Model_Config::CREDITCARD_METHOD;
|
541 |
+
}
|
542 |
+
return Eway_Rapid31_Model_Config::MASTERPASS_METHOD;
|
543 |
+
}
|
544 |
}
|
@@ -1,694 +1,752 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eway_Rapid31_Model_Request_Transparent extends Eway_Rapid31_Model_Request_Abstract
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Get AccessCode
|
7 |
-
*
|
8 |
-
* @param Mage_Sales_Model_Quote $quote
|
9 |
-
* @return Eway_Rapid31_Model_Response
|
10 |
-
*/
|
11 |
-
public function createAccessCode(Mage_Sales_Model_Quote $quote, $method = 'ProcessPayment', $action = 'AccessCodes')
|
12 |
-
{
|
13 |
-
// Empty Varien_Object's data
|
14 |
-
$this->unsetData();
|
15 |
-
|
16 |
-
$billingAddress = $quote->getBillingAddress();
|
17 |
-
|
18 |
-
$title = $this->_fixTitle($billingAddress->getPrefix());
|
19 |
-
|
20 |
-
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
21 |
-
$customerParam->setTitle($title)
|
22 |
-
->setFirstName($billingAddress->getFirstname())
|
23 |
-
->setLastName($billingAddress->getLastname())
|
24 |
-
->setCompanyName($billingAddress->getCompany())
|
25 |
-
->setJobDescription($billingAddress->getJobDescription())
|
26 |
-
->setStreet1($billingAddress->getStreet1())
|
27 |
-
->setStreet2($billingAddress->getStreet2())
|
28 |
-
->setCity($billingAddress->getCity())
|
29 |
-
->setState($billingAddress->getRegion())
|
30 |
-
->setPostalCode($billingAddress->getPostcode())
|
31 |
-
->setCountry(strtolower($billingAddress->getCountryModel()->getIso2Code()))
|
32 |
-
->setEmail($billingAddress->getEmail())
|
33 |
-
->setPhone($billingAddress->getTelephone())
|
34 |
-
->setMobile($billingAddress->getMobile())
|
35 |
-
->setComments('')
|
36 |
-
->setFax($billingAddress->getFax())
|
37 |
-
->setUrl('');
|
38 |
-
|
39 |
-
if ($this->getMethod() == Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
->
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
$
|
89 |
-
$
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
//
|
94 |
-
$
|
95 |
-
|
96 |
-
if
|
97 |
-
|
98 |
-
$
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
$
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
$
|
116 |
-
$
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
if (
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
}
|
159 |
-
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: %s)',
|
160 |
-
$
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
*
|
167 |
-
* @
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
$
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
$
|
281 |
-
$
|
282 |
-
|
283 |
-
|
284 |
-
$
|
285 |
-
$
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
$
|
295 |
-
|
296 |
-
|
297 |
-
$
|
298 |
-
$
|
299 |
-
$
|
300 |
-
$
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
$
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
'
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
'
|
315 |
-
|
316 |
-
|
317 |
-
'
|
318 |
-
|
319 |
-
'
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
$
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
$
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
$this->
|
491 |
-
$this->
|
492 |
-
$
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
$
|
497 |
-
$quote->
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
*
|
509 |
-
*
|
510 |
-
* @
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
$
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
)
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
$
|
529 |
-
|
530 |
-
$
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
->
|
588 |
-
|
589 |
-
->
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
->
|
594 |
-
->
|
595 |
-
|
596 |
-
|
597 |
-
$
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
$
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
$
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
}
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
Mage::
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eway_Rapid31_Model_Request_Transparent extends Eway_Rapid31_Model_Request_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get AccessCode
|
7 |
+
*
|
8 |
+
* @param Mage_Sales_Model_Quote $quote
|
9 |
+
* @return Eway_Rapid31_Model_Response
|
10 |
+
*/
|
11 |
+
public function createAccessCode(Mage_Sales_Model_Quote $quote, $method = 'ProcessPayment', $action = 'AccessCodes')
|
12 |
+
{
|
13 |
+
// Empty Varien_Object's data
|
14 |
+
$this->unsetData();
|
15 |
+
|
16 |
+
$billingAddress = $quote->getBillingAddress();
|
17 |
+
|
18 |
+
$title = $this->_fixTitle($billingAddress->getPrefix());
|
19 |
+
|
20 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
21 |
+
$customerParam->setTitle($title)
|
22 |
+
->setFirstName($billingAddress->getFirstname())
|
23 |
+
->setLastName($billingAddress->getLastname())
|
24 |
+
->setCompanyName($billingAddress->getCompany())
|
25 |
+
->setJobDescription($billingAddress->getJobDescription())
|
26 |
+
->setStreet1($billingAddress->getStreet1())
|
27 |
+
->setStreet2($billingAddress->getStreet2())
|
28 |
+
->setCity($billingAddress->getCity())
|
29 |
+
->setState($billingAddress->getRegion())
|
30 |
+
->setPostalCode($billingAddress->getPostcode())
|
31 |
+
->setCountry(strtolower($billingAddress->getCountryModel()->getIso2Code()))
|
32 |
+
->setEmail($billingAddress->getEmail())
|
33 |
+
->setPhone($billingAddress->getTelephone())
|
34 |
+
->setMobile($billingAddress->getMobile())
|
35 |
+
->setComments('')
|
36 |
+
->setFax($billingAddress->getFax())
|
37 |
+
->setUrl('');
|
38 |
+
|
39 |
+
if ($this->getMethod() == Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
40 |
+
|| ($this->getMethod() == Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD
|
41 |
+
&& Mage::getSingleton('core/session')->getSavedToken())
|
42 |
+
) {
|
43 |
+
$customerTokenId = Mage::getSingleton('core/session')->getSavedToken();
|
44 |
+
if (!$customerTokenId) {
|
45 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token: Token info does not exist.'));
|
46 |
+
} elseif (is_numeric($customerTokenId)) {
|
47 |
+
$customerHelper = Mage::helper('ewayrapid/customer');
|
48 |
+
$customerTokenId = $customerHelper->getCustomerTokenId($customerTokenId);
|
49 |
+
if ($customerTokenId) {
|
50 |
+
$customerParam->setTokenCustomerID($customerTokenId);
|
51 |
+
} else {
|
52 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token: Token info does not exist.'));
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
$this->setCustomer($customerParam);
|
58 |
+
|
59 |
+
$shippingAddress = $quote->getShippingAddress();
|
60 |
+
|
61 |
+
// copy BillingAddress to ShippingAddress if checkout with guest or register
|
62 |
+
/**
|
63 |
+
$checkoutMethod = $quote->getCheckoutMethod();
|
64 |
+
if ($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST
|
65 |
+
|| $checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER
|
66 |
+
) {
|
67 |
+
$shippingAddress = $billingAddress;
|
68 |
+
}
|
69 |
+
*/
|
70 |
+
|
71 |
+
if (!empty($shippingAddress)) {
|
72 |
+
$shippingParam = Mage::getModel('ewayrapid/field_shippingAddress');
|
73 |
+
$shippingParam->setFirstName($shippingAddress->getFirstname())
|
74 |
+
->setLastName($shippingAddress->getLastname())
|
75 |
+
->setStreet1($shippingAddress->getStreet1())
|
76 |
+
->setStreet2($shippingAddress->getStreet2())
|
77 |
+
->setCity($shippingAddress->getCity())
|
78 |
+
->setState($shippingAddress->getRegion())
|
79 |
+
->setPostalCode($shippingAddress->getPostcode())
|
80 |
+
->setCountry(strtolower($shippingAddress->getCountryModel()->getIso2Code()))
|
81 |
+
->setEmail($shippingAddress->getEmail())
|
82 |
+
->setPhone($shippingAddress->getTelephone())
|
83 |
+
->setFax($shippingAddress->getFax());
|
84 |
+
$this->setShippingAddress($shippingParam);
|
85 |
+
}
|
86 |
+
|
87 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
88 |
+
$paymentParam->setTotalAmount(round($quote->getBaseGrandTotal() * 100));
|
89 |
+
if ($method == 'CreateTokenCustomer' || $method == 'UpdateTokenCustomer') {
|
90 |
+
$paymentParam->setTotalAmount(0);
|
91 |
+
}
|
92 |
+
|
93 |
+
// add InvoiceDescription and InvoiceReference
|
94 |
+
$config = Mage::getModel('ewayrapid/config');
|
95 |
+
|
96 |
+
if($config->shouldPassingInvoiceDescription()){
|
97 |
+
$invoiceDescription = '';
|
98 |
+
foreach($quote->getAllVisibleItems() as $item){
|
99 |
+
// Check in case multi-shipping
|
100 |
+
if (!$item->getQuoteParentItemId()) {
|
101 |
+
$invoiceDescription .= (int) $item->getQty() . ' x ' .$item->getName() . ', ';
|
102 |
+
}
|
103 |
+
}
|
104 |
+
$invoiceDescription = trim($invoiceDescription,', ');
|
105 |
+
$invoiceDescription = Mage::helper('ewayrapid')->limitInvoiceDescriptionLength($invoiceDescription);
|
106 |
+
|
107 |
+
$paymentParam->setInvoiceDescription($invoiceDescription);
|
108 |
+
}
|
109 |
+
|
110 |
+
if($config->shouldPassingGuessOrder()){
|
111 |
+
$incrementId = $this->_getIncrementOrderId($quote);
|
112 |
+
$paymentParam->setInvoiceReference($incrementId);
|
113 |
+
}
|
114 |
+
|
115 |
+
$paymentParam->setCurrencyCode($quote->getBaseCurrencyCode());
|
116 |
+
$this->setPayment($paymentParam);
|
117 |
+
|
118 |
+
$returnUrl = Mage::getBaseUrl() . '/ewayrapid/transparent/callBack';
|
119 |
+
$cancelUrl = Mage::getBaseUrl() . '/ewayrapid/transparent/cancel';
|
120 |
+
|
121 |
+
$this->setRedirectUrl($returnUrl);
|
122 |
+
|
123 |
+
//CheckOutUrl if using PayPal
|
124 |
+
$checkOutUrl = Mage::getBaseUrl() . '/ewayrapid/transparent/review';
|
125 |
+
|
126 |
+
if (Mage::helper('ewayrapid/data')->getTransferCartLineItems()) {
|
127 |
+
// add Shipping item and Line items
|
128 |
+
$lineItems = Mage::helper('ewayrapid')->getLineItems();
|
129 |
+
$this->setItems($lineItems);
|
130 |
+
}
|
131 |
+
|
132 |
+
/*if ($this->getTransMethod() == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
133 |
+
$this->setItems(false);
|
134 |
+
}*/
|
135 |
+
|
136 |
+
if ($this->getTransMethod() == Eway_Rapid31_Model_Config::PAYPAL_EXPRESS_METHOD) {
|
137 |
+
$this->setCheckoutPayment(true);
|
138 |
+
$this->setCheckoutURL($checkOutUrl);
|
139 |
+
$this->setItems(false);
|
140 |
+
}
|
141 |
+
|
142 |
+
$this->setCancelUrl($cancelUrl);
|
143 |
+
$this->setMethod($method);
|
144 |
+
$this->setShippingMethod('Other');
|
145 |
+
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
146 |
+
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
147 |
+
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
148 |
+
if (Mage::helper('ewayrapid')->isBackendOrder()) {
|
149 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_MOTO);
|
150 |
+
} else {
|
151 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE);
|
152 |
+
}
|
153 |
+
$this->setCustomerReadOnly(true);
|
154 |
+
|
155 |
+
$response = $this->_doRapidAPI($action);
|
156 |
+
if ($response->isSuccess()) {
|
157 |
+
return $response;
|
158 |
+
} else {
|
159 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: %s)',
|
160 |
+
$response->getMessage()));
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Get customer information by access code
|
166 |
+
* @param $accessCode
|
167 |
+
* @throws Mage_Core_Exception
|
168 |
+
*/
|
169 |
+
public function getInfoByAccessCode($accessCode)
|
170 |
+
{
|
171 |
+
$response = $this->_doRapidAPI('AccessCode/' . $accessCode, false);
|
172 |
+
if ($response->isSuccess()) {
|
173 |
+
return $response;
|
174 |
+
} else {
|
175 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. Please try again. (Error message: %s)',
|
176 |
+
$response->getMessage()));
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
public function getTransaction($accessCode)
|
182 |
+
{
|
183 |
+
try {
|
184 |
+
$results = $this->_doRapidAPI("Transaction/$accessCode", 'GET');
|
185 |
+
if ($results->isSuccess()) {
|
186 |
+
return $results->getTransactions();
|
187 |
+
}
|
188 |
+
} catch (Exception $e) {
|
189 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: %s)',
|
190 |
+
$results->getMessage()));
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Update customer info
|
197 |
+
* @param $transId
|
198 |
+
* @return mixed
|
199 |
+
*/
|
200 |
+
public function updateCustomer($accessCode, Mage_Sales_Model_Quote $quote)
|
201 |
+
{
|
202 |
+
try {
|
203 |
+
$results = $this->_doRapidAPI("Transaction/$accessCode", 'GET');
|
204 |
+
if (!$results->isSuccess()) {
|
205 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: %s)',
|
206 |
+
$results->getMessage()));
|
207 |
+
}
|
208 |
+
|
209 |
+
$customer = $quote->getCustomer();
|
210 |
+
$billingAddress = $quote->getBillingAddress();
|
211 |
+
$shippingAddress = $quote->getShippingAddress();
|
212 |
+
|
213 |
+
if ($results->isSuccess()) {
|
214 |
+
$trans = $results->getTransactions();
|
215 |
+
|
216 |
+
if (isset($trans[0]['Customer'])) {
|
217 |
+
$billing = $trans[0]['Customer'];
|
218 |
+
$billingAddress->setFirstname($billing['FirstName'])
|
219 |
+
->setLastName($billing['LastName'])
|
220 |
+
->setCompany($billing['CompanyName'])
|
221 |
+
->setJobDescription($billing['JobDescription'])
|
222 |
+
->setStreet($billing['Street1'])
|
223 |
+
->setStreet2($billing['Street2'])
|
224 |
+
->setCity($billing['City'])
|
225 |
+
->setState($billing['State'])
|
226 |
+
->setPostcode($billing['PostalCode'])
|
227 |
+
->setCountryId(strtoupper($billing['Country']))
|
228 |
+
->setEmail($billing['Email'])
|
229 |
+
->setTelephone($billing['Phone'])
|
230 |
+
->setMobile($billing['Mobile'])
|
231 |
+
->setComments($billing['Comments'])
|
232 |
+
->setFax($billing['Fax'])
|
233 |
+
->setUrl($billing['Url']);
|
234 |
+
}
|
235 |
+
if (isset($trans[0]['ShippingAddress'])) {
|
236 |
+
$shipping = $trans[0]['ShippingAddress'];
|
237 |
+
$shippingAddress->setFirstname($shipping['FirstName'])
|
238 |
+
->setLastname($shipping['LastName'])
|
239 |
+
->setStreet($shipping['Street1'])
|
240 |
+
->setStreet2($shipping['Street2'])
|
241 |
+
->setCity($shipping['City'])
|
242 |
+
->setPostcode($shipping['PostalCode'])
|
243 |
+
->setCountryId(strtoupper($shipping['Country']))
|
244 |
+
->setEmail($shipping['Email'])
|
245 |
+
->setFax($shipping['Fax']);
|
246 |
+
|
247 |
+
if ($shipping['State']
|
248 |
+
&& $shipping['Country']
|
249 |
+
&& $region = Mage::getModel('directory/region')->loadByCode($shipping['State'], $shipping['Country'])
|
250 |
+
) {
|
251 |
+
$shippingAddress->setRegion($region->getName())
|
252 |
+
->setRegionId($region->getId());
|
253 |
+
}
|
254 |
+
if ($shipping['Phone']) {
|
255 |
+
$shippingAddress->setTelephone($shipping['Phone']);
|
256 |
+
}
|
257 |
+
}
|
258 |
+
return $quote->assignCustomerWithAddressChange($customer, $billingAddress, $shippingAddress)->save();
|
259 |
+
}
|
260 |
+
return false;
|
261 |
+
} catch (Exception $e) {
|
262 |
+
Mage::throwException($e->getMessage());
|
263 |
+
return false;
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* @param Mage_Sales_Model_Quote $quote
|
269 |
+
* @param $tokenInfo
|
270 |
+
* @param $tokenCustomerID
|
271 |
+
* @return bool
|
272 |
+
*/
|
273 |
+
public function addToken(Mage_Sales_Model_Quote $quote, $tokenInfo, $tokenCustomerID = 0)
|
274 |
+
{
|
275 |
+
try {
|
276 |
+
if (!$tokenCustomerID)
|
277 |
+
return false;
|
278 |
+
|
279 |
+
//Get Customer Card Info
|
280 |
+
$customerCard = $this->getCustomerCard($tokenCustomerID);
|
281 |
+
$cardetail = null;
|
282 |
+
if ($customerCard) {
|
283 |
+
$customer = $customerCard->getCustomer();
|
284 |
+
$cardetail = $customer && isset($customer['CardDetails']) ? $customer['CardDetails'] : null;
|
285 |
+
unset($customer);
|
286 |
+
}
|
287 |
+
|
288 |
+
$billingAddress = $quote->getBillingAddress();
|
289 |
+
|
290 |
+
$title = $this->_fixTitle($billingAddress->getPrefix());
|
291 |
+
|
292 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
293 |
+
$customerParam->setTitle($title)
|
294 |
+
->setFirstName($billingAddress->getFirstname())
|
295 |
+
->setLastName($billingAddress->getLastname())
|
296 |
+
->setCompanyName($billingAddress->getCompany())
|
297 |
+
->setJobDescription($billingAddress->getJobDescription())
|
298 |
+
->setStreet1($billingAddress->getStreet1())
|
299 |
+
->setStreet2($billingAddress->getStreet2())
|
300 |
+
->setCity($billingAddress->getCity())
|
301 |
+
->setState($billingAddress->getRegion())
|
302 |
+
->setPostalCode($billingAddress->getPostcode())
|
303 |
+
->setCountry(strtolower($billingAddress->getCountryModel()->getIso2Code()))
|
304 |
+
->setEmail($billingAddress->getEmail())
|
305 |
+
->setPhone($billingAddress->getTelephone())
|
306 |
+
->setMobile($billingAddress->getMobile())
|
307 |
+
->setComments('')
|
308 |
+
->setFax($billingAddress->getFax())
|
309 |
+
->setUrl('');
|
310 |
+
$config = Mage::getSingleton('ewayrapid/config');
|
311 |
+
$cardNumber = null;
|
312 |
+
|
313 |
+
if ($tokenInfo['SavedType'] == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
314 |
+
$tokenInfo['ccType'] = "PayPal";
|
315 |
+
$cardNumber = "PayPal";
|
316 |
+
$tokenInfo['EWAY_CARDNAME'] = "PayPal";
|
317 |
+
$tokenInfo['EWAY_CARDEXPIRYMONTH'] = $tokenInfo['EWAY_CARDEXPIRYYEAR'] = '';
|
318 |
+
} elseif ($tokenInfo['SavedType'] == Eway_Rapid31_Model_Config::MASTERPASS_METHOD) {
|
319 |
+
//$tokenInfo['ccType'] = "MC";
|
320 |
+
$cardNumber = $cardetail && isset($cardetail['Number']) ? substr_replace($cardetail['Number'], '******', 6, 6) : "MasterPass";
|
321 |
+
$cardNumber = substr_replace($cardNumber, '******', 6, 6);
|
322 |
+
$tokenInfo['EWAY_CARDNAME'] = $cardetail && isset($cardetail['Name']) ? $cardetail['Name'] : "MasterPass";
|
323 |
+
$tokenInfo['EWAY_CARDEXPIRYMONTH'] = $cardetail && isset($cardetail['ExpiryMonth']) ? $cardetail['ExpiryMonth'] : "";
|
324 |
+
$tokenInfo['EWAY_CARDEXPIRYYEAR'] = $cardetail && isset($cardetail['ExpiryYear']) ? $cardetail['ExpiryYear'] : "";
|
325 |
+
} else {
|
326 |
+
$cardNumber = $cardetail && isset($cardetail['Number']) ? $cardetail['Number'] : @Mage::helper('ewayrapid/data')->decryptSha256($tokenInfo['EWAY_CARDNUMBER'], $config->getBasicAuthenticationHeader());
|
327 |
+
$cardNumber = substr_replace($cardNumber, '******', 6, 6);
|
328 |
+
$tokenInfo['EWAY_CARDNAME'] = $cardetail && isset($cardetail['Name']) ? $cardetail['Name'] : "creditcard";
|
329 |
+
$tokenInfo['EWAY_CARDEXPIRYMONTH'] = $cardetail && isset($cardetail['ExpiryMonth']) ? $cardetail['ExpiryMonth'] : "";
|
330 |
+
$tokenInfo['EWAY_CARDEXPIRYYEAR'] = $cardetail && isset($cardetail['ExpiryYear']) ? $cardetail['ExpiryYear'] : "";
|
331 |
+
}
|
332 |
+
$type = isset($tokenInfo['ccType']) ? $tokenInfo['ccType'] : $this->checkCardType($cardNumber);
|
333 |
+
if($type == 'Unknown') {
|
334 |
+
$type = $tokenInfo['SavedType'] == Eway_Rapid31_Model_Config::MASTERPASS_METHOD ? 'MasterPass' : 'CreditCard';
|
335 |
+
}
|
336 |
+
|
337 |
+
$tokenInfo['EWAY_CARDEXPIRYYEAR'] = $tokenInfo['EWAY_CARDEXPIRYYEAR'] && strlen($tokenInfo['EWAY_CARDEXPIRYYEAR']) == 2 ? '20' . $tokenInfo['EWAY_CARDEXPIRYYEAR'] : $cardetail['EWAY_CARDEXPIRYYEAR'];
|
338 |
+
$cardInfo = array(
|
339 |
+
'Token' => $tokenCustomerID,
|
340 |
+
'TokenCustomerID' => $tokenCustomerID,
|
341 |
+
'Card' => $cardNumber,
|
342 |
+
'Owner' => $tokenInfo['EWAY_CARDNAME'],
|
343 |
+
'StartMonth' => '',
|
344 |
+
'StartYear' => '',
|
345 |
+
'IssueNumber' => '',
|
346 |
+
'ExpMonth' => (int)$tokenInfo['EWAY_CARDEXPIRYMONTH'],
|
347 |
+
'ExpYear' => (int)$tokenInfo['EWAY_CARDEXPIRYYEAR'],
|
348 |
+
'Type' => $type,
|
349 |
+
'Address' => $customerParam,
|
350 |
+
);
|
351 |
+
|
352 |
+
Mage::helper('ewayrapid/customer')->addToken($cardInfo);
|
353 |
+
return true;
|
354 |
+
} catch (Exception $e) {
|
355 |
+
return false;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* @param $id
|
361 |
+
* @param $info
|
362 |
+
* @return bool
|
363 |
+
*/
|
364 |
+
public function updateToken($id, $info = null)
|
365 |
+
{
|
366 |
+
try {
|
367 |
+
//Get Customer Card Info
|
368 |
+
$customerCard = $this->getCustomerCard($id);
|
369 |
+
$cardetail = null;
|
370 |
+
if ($customerCard) {
|
371 |
+
$customer = $customerCard->getCustomer();
|
372 |
+
$cardetail = $customer && isset($customer['CardDetails']) ? $customer['CardDetails'] : null;
|
373 |
+
unset($customer);
|
374 |
+
}
|
375 |
+
$cardetail['ExpiryYear'] = $cardetail['ExpiryYear'] && strlen($cardetail['ExpiryYear']) == 2 ? '20' . $cardetail['ExpiryYear'] : $cardetail['ExpiryYear'];
|
376 |
+
|
377 |
+
if ($info['SavedType'] == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
378 |
+
$tokenInfo['EWAY_CARDNAME'] = "PayPal";
|
379 |
+
} elseif ($info['SavedType'] == Eway_Rapid31_Model_Config::MASTERPASS_METHOD) {
|
380 |
+
$info['ccType'] = "MC";
|
381 |
+
$info['EWAY_CARDNAME'] = $cardetail && isset($cardetail['Name']) ? $cardetail['Name'] : "MasterPass";
|
382 |
+
$info['EWAY_CARDEXPIRYMONTH'] = $cardetail && isset($cardetail['ExpiryMonth']) ? $cardetail['ExpiryMonth'] : "";
|
383 |
+
$info['EWAY_CARDEXPIRYYEAR'] = $cardetail && isset($cardetail['ExpiryYear']) ? $cardetail['ExpiryYear'] : "";
|
384 |
+
} else {
|
385 |
+
$info['EWAY_CARDNAME'] = $cardetail && isset($cardetail['Name']) ? $cardetail['Name'] : "PayPal";
|
386 |
+
$info['EWAY_CARDEXPIRYMONTH'] = $cardetail && isset($cardetail['ExpiryMonth']) ? $cardetail['ExpiryMonth'] : $info['EWAY_CARDEXPIRYMONTH'];
|
387 |
+
$info['EWAY_CARDEXPIRYYEAR'] = $cardetail && isset($cardetail['ExpiryYear']) ? $cardetail['ExpiryYear'] : $info['EWAY_CARDEXPIRYYEAR'];
|
388 |
+
}
|
389 |
+
|
390 |
+
$cardInfo = array(
|
391 |
+
'Owner' => $info['EWAY_CARDNAME'],
|
392 |
+
'StartMonth' => '',
|
393 |
+
'StartYear' => '',
|
394 |
+
'IssueNumber' => '',
|
395 |
+
'ExpMonth' => $info ? (int)$info['EWAY_CARDEXPIRYMONTH'] : '',
|
396 |
+
'ExpYear' => $info ? (int)$info['EWAY_CARDEXPIRYYEAR'] : '',
|
397 |
+
);
|
398 |
+
|
399 |
+
if ($this->getTransMethod() == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
400 |
+
$uid = Mage::getSingleton('core/session')->getPaypalSavedToken();
|
401 |
+
} elseif ($this->getTransMethod() == Eway_Rapid31_Model_Config::MASTERPASS_METHOD) {
|
402 |
+
$uid = Mage::getSingleton('core/session')->getMasterpassSavedToken();
|
403 |
+
} else {
|
404 |
+
$uid = Mage::getSingleton('core/session')->getSavedToken();
|
405 |
+
}
|
406 |
+
|
407 |
+
Mage::helper('ewayrapid/customer')->updateToken($uid, $cardInfo);
|
408 |
+
return true;
|
409 |
+
} catch (Exception $e) {
|
410 |
+
return false;
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Get card type name by card number
|
416 |
+
* @param $num Card number
|
417 |
+
* @return string Card type name
|
418 |
+
*/
|
419 |
+
public function checkCardType($num)
|
420 |
+
{
|
421 |
+
return Mage::getModel('ewayrapid/request_token')->checkCardType($num);
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
426 |
+
* @return bool
|
427 |
+
*/
|
428 |
+
public function setTransaction(Mage_Sales_Model_Order_Payment $payment)
|
429 |
+
{
|
430 |
+
$payment->setTransactionId(Mage::getSingleton('core/session')->getTransactionId());
|
431 |
+
$payment->setIsTransactionClosed(0);
|
432 |
+
return $payment;
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Get shipping by code
|
437 |
+
*
|
438 |
+
* @param Mage_Sales_Model_Quote $quote
|
439 |
+
* @param $postalCode
|
440 |
+
* @return bool
|
441 |
+
*/
|
442 |
+
public function getShippingByCode(Mage_Sales_Model_Quote $quote, $postalCode)
|
443 |
+
{
|
444 |
+
$groups = $quote->getShippingAddress()->collectShippingRates()->getGroupedAllShippingRates();
|
445 |
+
// determine current selected code & name
|
446 |
+
foreach ($groups as $code => $rates) {
|
447 |
+
foreach ($rates as $rate) {
|
448 |
+
if (strtoupper($postalCode) == strtoupper($rate->getCode())) {
|
449 |
+
return $rate;
|
450 |
+
}
|
451 |
+
}
|
452 |
+
}
|
453 |
+
return false;
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Call Transaction API (Authorized & Capture at the same time)
|
458 |
+
*
|
459 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
460 |
+
* @param float $amount
|
461 |
+
* @return Eway_Rapid31_Model_Request_Direct $this
|
462 |
+
*/
|
463 |
+
public function doTransaction(Mage_Sales_Model_Quote $quote, $amount)
|
464 |
+
{
|
465 |
+
$this->_buildRequest($quote, $amount);
|
466 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_TOKEN_PAYMENT);
|
467 |
+
$response = $this->_doRapidAPI('Transaction');
|
468 |
+
|
469 |
+
if ($response->isSuccess()) {
|
470 |
+
$quote->setTransactionId($response->getTransactionID());
|
471 |
+
$quote->setCcLast4($response->getCcLast4());
|
472 |
+
$quote->save();
|
473 |
+
return $quote;
|
474 |
+
} else {
|
475 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. Please try again. (Error message: %s)',
|
476 |
+
$response->getMessage()));
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Call Authorisation API (Authorized only)
|
482 |
+
*
|
483 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
484 |
+
* @param $amount
|
485 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
486 |
+
*/
|
487 |
+
public function doAuthorisation(Mage_Sales_Model_Quote $quote, $amount)
|
488 |
+
{
|
489 |
+
$this->_buildRequest($quote, $amount);
|
490 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_AUTHORISE);
|
491 |
+
$response = $this->_doRapidAPI('Authorisation');
|
492 |
+
if ($response->isSuccess()) {
|
493 |
+
$quote->setTransactionId($response->getTransactionID());
|
494 |
+
$quote->setIsTransactionClosed(0);
|
495 |
+
$quote->setCcLast4($response->getCcLast4());
|
496 |
+
$beagleScore = $response->getBeagleScore() ? $response->getBeagleScore() : '';
|
497 |
+
$quote->setBeagleScore($beagleScore);
|
498 |
+
$quote->setBeagleVerification($response->getBeagleVerification());
|
499 |
+
$quote->save();
|
500 |
+
return $quote;
|
501 |
+
} else {
|
502 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the authorisation. Please try again. (Error message: %s)',
|
503 |
+
$response->getMessage()));
|
504 |
+
}
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Call Capture API (do the Capture only, must Authorized previously)
|
509 |
+
*
|
510 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
511 |
+
* @param $amount
|
512 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
513 |
+
*/
|
514 |
+
public function doCapturePayment(Mage_Sales_Model_Quote $quote, $amount)
|
515 |
+
{
|
516 |
+
// Empty Varien_Object's data
|
517 |
+
$this->unsetData();
|
518 |
+
|
519 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
520 |
+
$paymentParam->setTotalAmount($amount)
|
521 |
+
->setCurrencyCode($quote->getBaseCurrencyCode());
|
522 |
+
|
523 |
+
$this->setPayment($paymentParam);
|
524 |
+
$this->setTransactionId($quote->getTransactionId());
|
525 |
+
$this->setMethod(Eway_Rapid31_Model_Config::METHOD_TOKEN_PAYMENT);
|
526 |
+
$response = $this->_doRapidAPI('CapturePayment');
|
527 |
+
|
528 |
+
if ($response->isSuccess()) {
|
529 |
+
$quote->setTransactionId($response->getTransactionID());
|
530 |
+
$quote->save();
|
531 |
+
return $quote;
|
532 |
+
} else {
|
533 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the capture. Please try again. (Error message: %s)',
|
534 |
+
$response->getMessage()));
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
/**
|
539 |
+
* Build the request with necessary parameters for doAuthorisation() and doTransaction()
|
540 |
+
*
|
541 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
542 |
+
* @param $amount
|
543 |
+
* @return Eway_Rapid31_Model_Request_Direct
|
544 |
+
*/
|
545 |
+
protected function _buildRequest(Mage_Sales_Model_Quote $quote, $amount)
|
546 |
+
{
|
547 |
+
// Empty Varien_Object's data
|
548 |
+
$this->unsetData();
|
549 |
+
|
550 |
+
$billing = $quote->getBillingAddress();
|
551 |
+
$shipping = $quote->getShippingAddress();
|
552 |
+
|
553 |
+
// copy BillingAddress to ShippingAddress if checkout with guest or register
|
554 |
+
$checkoutMethod = $quote->getCheckoutMethod();
|
555 |
+
if ($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST
|
556 |
+
|| $checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER
|
557 |
+
) {
|
558 |
+
$shipping = $billing;
|
559 |
+
}
|
560 |
+
|
561 |
+
$this->setCustomerIP(Mage::helper('core/http')->getRemoteAddr());
|
562 |
+
if (Mage::helper('ewayrapid')->isBackendOrder()) {
|
563 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_MOTO);
|
564 |
+
} else {
|
565 |
+
$this->setTransactionType(Eway_Rapid31_Model_Config::TRANSACTION_PURCHASE);
|
566 |
+
}
|
567 |
+
$version = Mage::helper('ewayrapid')->getExtensionVersion();
|
568 |
+
$this->setDeviceID('Magento ' . Mage::getEdition() . ' ' . Mage::getVersion().' - eWAY '.$version);
|
569 |
+
$this->setShippingMethod('Other');
|
570 |
+
|
571 |
+
$paymentParam = Mage::getModel('ewayrapid/field_payment');
|
572 |
+
$paymentParam->setTotalAmount($amount);
|
573 |
+
$paymentParam->setCurrencyCode($quote->getBaseCurrencyCode());
|
574 |
+
|
575 |
+
// add InvoiceDescription and InvoiceReference
|
576 |
+
$config = Mage::getModel('ewayrapid/config');
|
577 |
+
|
578 |
+
if($config->shouldPassingInvoiceDescription()){
|
579 |
+
$invoiceDescription = '';
|
580 |
+
foreach($quote->getAllVisibleItems() as $item){
|
581 |
+
// Check in case multi-shipping
|
582 |
+
if (!$item->getQuoteParentItemId()) {
|
583 |
+
$invoiceDescription .= (int) $item->getQty() . ' x ' .$item->getName() . ', ';
|
584 |
+
}
|
585 |
+
}
|
586 |
+
$invoiceDescription = trim($invoiceDescription,', ');
|
587 |
+
$invoiceDescription = Mage::helper('ewayrapid')->limitInvoiceDescriptionLength($invoiceDescription);
|
588 |
+
|
589 |
+
$paymentParam->setInvoiceDescription($invoiceDescription);
|
590 |
+
}
|
591 |
+
|
592 |
+
if($config->shouldPassingGuessOrder()){
|
593 |
+
$incrementId = $this->_getIncrementOrderId($quote);
|
594 |
+
$paymentParam->setInvoiceReference($incrementId);
|
595 |
+
}
|
596 |
+
|
597 |
+
$this->setPayment($paymentParam);
|
598 |
+
|
599 |
+
$title = $this->_fixTitle($billing->getPrefix());
|
600 |
+
|
601 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
602 |
+
$customerParam->setTitle($title)
|
603 |
+
->setFirstName($billing->getFirstname())
|
604 |
+
->setLastName($billing->getLastname())
|
605 |
+
->setCompanyName($billing->getCompany())
|
606 |
+
->setJobDescription('')
|
607 |
+
->setStreet1($billing->getStreet1())
|
608 |
+
->setStreet2($billing->getStreet2())
|
609 |
+
->setCity($billing->getCity())
|
610 |
+
->setState($billing->getRegion())
|
611 |
+
->setPostalCode($billing->getPostcode())
|
612 |
+
->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))
|
613 |
+
->setEmail($billing->getEmail())
|
614 |
+
->setPhone($billing->getTelephone())
|
615 |
+
->setMobile('')
|
616 |
+
->setComments('')
|
617 |
+
->setFax($billing->getFax())
|
618 |
+
->setUrl('');
|
619 |
+
|
620 |
+
$infoCard = Mage::getSingleton('core/session')->getInfoCard();
|
621 |
+
if ($infoCard && $infoCard->getCard() && $infoCard->getOwner() && !$this->getTokenInfo()) {
|
622 |
+
$cardDetails = Mage::getModel('ewayrapid/field_cardDetails');
|
623 |
+
$cardDetails->setName($infoCard->getOwner())
|
624 |
+
->setNumber($infoCard->getCard())
|
625 |
+
->setExpiryMonth($infoCard->getExpMonth())
|
626 |
+
->setExpiryYear($infoCard->getExpYear())
|
627 |
+
->setCVN($infoCard->getCid());
|
628 |
+
$customerParam->setCardDetails($cardDetails);
|
629 |
+
}
|
630 |
+
|
631 |
+
if ($quote->getTokenCustomerID()) {
|
632 |
+
$customerParam->setTokenCustomerID($quote->getTokenCustomerID());
|
633 |
+
} elseif ($token = $this->getTokenInfo()) {
|
634 |
+
$customerParam->setTokenCustomerID($token->getToken() ? $token->getToken() : $token->getTokenCustomerID());
|
635 |
+
}
|
636 |
+
|
637 |
+
$this->setCustomer($customerParam);
|
638 |
+
|
639 |
+
if (!empty($shipping)) {
|
640 |
+
$shippingParam = Mage::getModel('ewayrapid/field_shippingAddress');
|
641 |
+
$shippingParam->setFirstName($shipping->getFirstname())
|
642 |
+
->setLastName($shipping->getLastname())
|
643 |
+
->setStreet1($shipping->getStreet1())
|
644 |
+
->setStreet2($shipping->getStreet2())
|
645 |
+
->setCity($shipping->getCity())
|
646 |
+
->setState($shipping->getRegion())
|
647 |
+
->setPostalCode($shipping->getPostcode())
|
648 |
+
->setCountry(strtolower($shipping->getCountryModel()->getIso2Code()))
|
649 |
+
->setEmail($shipping->getEmail())
|
650 |
+
->setPhone($shipping->getTelephone())
|
651 |
+
->setFax($shipping->getFax());
|
652 |
+
$this->setShippingAddress($shippingParam);
|
653 |
+
}
|
654 |
+
|
655 |
+
$orderItems = $quote->getAllVisibleItems();
|
656 |
+
$lineItems = array();
|
657 |
+
foreach ($orderItems as $orderItem) {
|
658 |
+
/* @var Mage_Sales_Model_Order_Item $orderItem */
|
659 |
+
$lineItem = Mage::getModel('ewayrapid/field_lineItem');
|
660 |
+
$lineItem->setSKU($orderItem->getSku());
|
661 |
+
$lineItem->setDescription(substr($orderItem->getName(), 0, 26));
|
662 |
+
$lineItem->setQuantity($orderItem->getQtyOrdered());
|
663 |
+
$lineItem->setUnitCost(round($orderItem->getBasePrice() * 100));
|
664 |
+
$lineItem->setTax(round($orderItem->getBaseTaxAmount() * 100));
|
665 |
+
$lineItem->setTotal(round($orderItem->getBaseRowTotalInclTax() * 100));
|
666 |
+
$lineItems[] = $lineItem;
|
667 |
+
}
|
668 |
+
$this->setItems($lineItems);
|
669 |
+
if ($this->getTransMethod() == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
670 |
+
$this->setItems(false);
|
671 |
+
}
|
672 |
+
|
673 |
+
return $this;
|
674 |
+
}
|
675 |
+
|
676 |
+
/**
|
677 |
+
* @param $tokenCustomerID
|
678 |
+
* @throws Mage_Core_Exception
|
679 |
+
*/
|
680 |
+
public function getCustomerCard($tokenCustomerID)
|
681 |
+
{
|
682 |
+
// Empty Varien_Object's data
|
683 |
+
$this->unsetData();
|
684 |
+
|
685 |
+
$customerParam = Mage::getModel('ewayrapid/field_customer');
|
686 |
+
|
687 |
+
if ($tokenCustomerID) {
|
688 |
+
$customerParam->setTokenCustomerID($tokenCustomerID);
|
689 |
+
} else {
|
690 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while updating token: Token info does not exist.'));
|
691 |
+
}
|
692 |
+
$this->setCustomer($customerParam);
|
693 |
+
|
694 |
+
$response = $this->_doRapidAPI('Customer', 'PUT');
|
695 |
+
if ($response->isSuccess()) {
|
696 |
+
return $response;
|
697 |
+
} else {
|
698 |
+
return false;
|
699 |
+
}
|
700 |
+
}
|
701 |
+
|
702 |
+
public function getMethod()
|
703 |
+
{
|
704 |
+
return Mage::getSingleton('core/session')->getMethod();
|
705 |
+
}
|
706 |
+
|
707 |
+
/**
|
708 |
+
* @return mixed
|
709 |
+
*/
|
710 |
+
public function getTransMethod()
|
711 |
+
{
|
712 |
+
$transMethod = Mage::getSingleton('core/session')->getTransparentNotsaved();
|
713 |
+
if (!$transMethod) {
|
714 |
+
$transMethod = Mage::getSingleton('core/session')->getTransparentSaved();
|
715 |
+
}
|
716 |
+
return $transMethod;
|
717 |
+
}
|
718 |
+
|
719 |
+
/**
|
720 |
+
* @return mixed
|
721 |
+
*/
|
722 |
+
public function getTokenInfo()
|
723 |
+
{
|
724 |
+
if ($this->getTransMethod() == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD) {
|
725 |
+
$uid = Mage::getSingleton('core/session')->getPaypalSavedToken();
|
726 |
+
} elseif ($this->getTransMethod() == Eway_Rapid31_Model_Config::MASTERPASS_METHOD) {
|
727 |
+
$uid = Mage::getSingleton('core/session')->getMasterpassSavedToken();
|
728 |
+
} else {
|
729 |
+
$uid = Mage::getSingleton('core/session')->getSavedToken();
|
730 |
+
}
|
731 |
+
if ($uid && $uid != Eway_Rapid31_Model_Config::TOKEN_NEW)
|
732 |
+
return Mage::helper('ewayrapid/customer')->getTokenById($uid);
|
733 |
+
return false;
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
*
|
738 |
+
*/
|
739 |
+
public function unsetSessionData()
|
740 |
+
{
|
741 |
+
Mage::getSingleton('core/session')->unsTransparentNotsaved();
|
742 |
+
Mage::getSingleton('core/session')->unsTransparentSaved();
|
743 |
+
Mage::getSingleton('core/session')->unsSavedToken();
|
744 |
+
Mage::getSingleton('core/session')->unsTransactionId();
|
745 |
+
Mage::getSingleton('core/session')->unsFormActionUrl();
|
746 |
+
Mage::getSingleton('core/session')->unsPaypalSavedToken();
|
747 |
+
Mage::getSingleton('core/session')->unsMethod();
|
748 |
+
Mage::getSingleton('core/session')->unsCompleteCheckoutURL();
|
749 |
+
Mage::getSingleton('core/session')->unsMasterPassSavedToken();
|
750 |
+
Mage::getSingleton('core/session')->unsInfoCard();
|
751 |
+
}
|
752 |
}
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eway_Rapid31_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
|
4 |
+
}
|
@@ -249,7 +249,9 @@ class Eway_Rapid31_Model_Response extends Varien_Object
|
|
249 |
'F9033' => 'Invalid Billing Street',
|
250 |
'F9034' => 'Invalid Shipping Street',
|
251 |
'F9037' => 'Suspicious Customer Email Address',
|
|
|
252 |
'F9050' => 'High Risk Email Address and amount',
|
|
|
253 |
);
|
254 |
|
255 |
public function getMessage() {
|
@@ -328,11 +330,26 @@ class Eway_Rapid31_Model_Response extends Varien_Object
|
|
328 |
} else {
|
329 |
// Otherwise base on the Errors (Token transactions)
|
330 |
$this->isSuccess(!$this->getErrors());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
}
|
332 |
|
333 |
return $this;
|
334 |
}
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
private function _setIfNotEmpty($json, $key)
|
337 |
{
|
338 |
if(!empty($json[$key])) {
|
@@ -353,6 +370,7 @@ class Eway_Rapid31_Model_Response extends Varien_Object
|
|
353 |
|
354 |
/**
|
355 |
* replace error code to message
|
|
|
356 |
* @param $message
|
357 |
*/
|
358 |
public function replaceMessage($message)
|
@@ -373,4 +391,37 @@ class Eway_Rapid31_Model_Response extends Varien_Object
|
|
373 |
return Mage::helper('ewayrapid')->__('Transaction failed.');
|
374 |
}
|
375 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
}
|
249 |
'F9033' => 'Invalid Billing Street',
|
250 |
'F9034' => 'Invalid Shipping Street',
|
251 |
'F9037' => 'Suspicious Customer Email Address',
|
252 |
+
'F9049' => 'Genuine Customer',
|
253 |
'F9050' => 'High Risk Email Address and amount',
|
254 |
+
'F9113' => 'Card issuing country differs from IP address country'
|
255 |
);
|
256 |
|
257 |
public function getMessage() {
|
330 |
} else {
|
331 |
// Otherwise base on the Errors (Token transactions)
|
332 |
$this->isSuccess(!$this->getErrors());
|
333 |
+
|
334 |
+
// Catch empty response
|
335 |
+
if(!isset($json['TransactionStatus'])
|
336 |
+
&& !isset($json['TransactionID'])
|
337 |
+
&& !isset($json['Customer']['TokenCustomerID'])
|
338 |
+
&& !isset($json['AccessCode'])
|
339 |
+
&& !isset($json['Transactions'])) {
|
340 |
+
$this->isSuccess(false);
|
341 |
+
}
|
342 |
}
|
343 |
|
344 |
return $this;
|
345 |
}
|
346 |
|
347 |
+
/**
|
348 |
+
* Sets a value in the object if present
|
349 |
+
*
|
350 |
+
* @param array $json
|
351 |
+
* @param string $key
|
352 |
+
*/
|
353 |
private function _setIfNotEmpty($json, $key)
|
354 |
{
|
355 |
if(!empty($json[$key])) {
|
370 |
|
371 |
/**
|
372 |
* replace error code to message
|
373 |
+
*
|
374 |
* @param $message
|
375 |
*/
|
376 |
public function replaceMessage($message)
|
391 |
return Mage::helper('ewayrapid')->__('Transaction failed.');
|
392 |
}
|
393 |
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Checks if the transaction was marked as challenged by Beagle anti-fraud
|
397 |
+
*
|
398 |
+
* @param array $result transaction result from eWAY
|
399 |
+
*/
|
400 |
+
private function _checkfraud($result)
|
401 |
+
{
|
402 |
+
if (isset($result['FraudAction']) && !empty($result['FraudAction'])) {
|
403 |
+
|
404 |
+
// Challenged orders are Review or PreAuth/Allow that processed
|
405 |
+
if (($result['FraudAction'] == "Review") ||
|
406 |
+
($result['FraudAction'] == "PreAuth" && $this->isSuccess()) ||
|
407 |
+
($result['FraudAction'] == "Allow" && $this->isSuccess())) {
|
408 |
+
|
409 |
+
// Find fraud codes
|
410 |
+
$codeMessage = str_replace(' ', '', $result['ResponseMessage']);
|
411 |
+
$codeMessages = explode(',', $codeMessage);
|
412 |
+
$result = preg_grep("/^F.*/", $codeMessages);
|
413 |
+
$codes = array_flip($result);
|
414 |
+
|
415 |
+
// Convert to text and signal fraud
|
416 |
+
$resultMatched = array_intersect_key($this->_messageCode, $codes);
|
417 |
+
$resultDefault = array_fill_keys(array_keys($codes), "Unknown fraud rule");
|
418 |
+
$resultMessages = array_merge($resultDefault,$resultMatched);
|
419 |
+
Mage::getSingleton('core/session')->setData('fraud', 1);
|
420 |
+
$fraudMessage = implode(', ', $resultMessages);
|
421 |
+
Mage::getSingleton('core/session')->setData('fraudMessage', $fraudMessage);
|
422 |
+
|
423 |
+
}
|
424 |
+
|
425 |
+
}
|
426 |
+
}
|
427 |
}
|
@@ -18,6 +18,9 @@ class Eway_Rapid31_Model_System_Config_Source_ConnectionType
|
|
18 |
array(
|
19 |
'value' => Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE,
|
20 |
'label'=>Mage::helper('ewayrapid')->__('Responsive shared page')),
|
|
|
|
|
|
|
21 |
);
|
22 |
}
|
23 |
}
|
18 |
array(
|
19 |
'value' => Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE,
|
20 |
'label'=>Mage::helper('ewayrapid')->__('Responsive shared page')),
|
21 |
+
array(
|
22 |
+
'value' => Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME,
|
23 |
+
'label'=>Mage::helper('ewayrapid')->__('Rapid IFrame')),
|
24 |
);
|
25 |
}
|
26 |
}
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Model_System_Config_Source_CustomView extends Mage_Payment_Model_Source_Cctype
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Custom Views
|
6 |
+
*
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
return array(
|
12 |
+
array(
|
13 |
+
'value' => 'Default',
|
14 |
+
'label' => ('Default')
|
15 |
+
),
|
16 |
+
array(
|
17 |
+
'value' => 'Bootstrap',
|
18 |
+
'label' => ('Bootstrap')
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
'value' => 'BootstrapAmelia',
|
22 |
+
'label' => ('Bootstrap Amelia')
|
23 |
+
),
|
24 |
+
array(
|
25 |
+
'value' => 'BootstrapCerulean',
|
26 |
+
'label' => ('Bootstrap Cerulean')
|
27 |
+
),
|
28 |
+
array(
|
29 |
+
'value' => 'BootstrapCosmo',
|
30 |
+
'label' => ('Bootstrap Cosmo')
|
31 |
+
),
|
32 |
+
array(
|
33 |
+
'value' => 'BootstrapCyborg',
|
34 |
+
'label' => ('Bootstrap Cyborg')
|
35 |
+
),
|
36 |
+
array(
|
37 |
+
'value' => 'BootstrapFlatly',
|
38 |
+
'label' => ('Bootstrap Flatly')
|
39 |
+
),
|
40 |
+
array(
|
41 |
+
'value' => 'BootstrapJournal',
|
42 |
+
'label' => ('Bootstrap Journal')
|
43 |
+
),
|
44 |
+
array(
|
45 |
+
'value' => 'BootstrapReadable',
|
46 |
+
'label' => ('Bootstrap Readable')
|
47 |
+
),
|
48 |
+
array(
|
49 |
+
'value' => 'BootstrapSimplex',
|
50 |
+
'label' => ('Bootstrap Simplex')
|
51 |
+
),
|
52 |
+
array(
|
53 |
+
'value' => 'BootstrapSlate',
|
54 |
+
'label' => ('Bootstrap Slate')
|
55 |
+
),
|
56 |
+
array(
|
57 |
+
'value' => 'BootstrapSpacelab',
|
58 |
+
'label' => ('Bootstrap Spacelab')
|
59 |
+
),
|
60 |
+
array(
|
61 |
+
'value' => 'BootstrapUnited',
|
62 |
+
'label' => ('Bootstrap United')
|
63 |
+
)
|
64 |
+
);
|
65 |
+
}
|
66 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eway_Rapid31_Model_System_Config_Source_NoYes
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Options getter
|
6 |
+
*
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
return array(
|
12 |
+
array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('No')),
|
13 |
+
array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Yes')),
|
14 |
+
);
|
15 |
+
}
|
16 |
+
}
|
@@ -1,8 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
class Eway_Rapid31_Adminhtml_EwayadminController extends Mage_Adminhtml_Controller_Action {
|
|
|
|
|
|
|
|
|
|
|
6 |
public function indexAction() {
|
7 |
}
|
8 |
|
@@ -63,7 +68,7 @@ class Eway_Rapid31_Adminhtml_EwayadminController extends Mage_Adminhtml_Controll
|
|
63 |
// Check return data
|
64 |
$result_decode = json_decode($result);
|
65 |
|
66 |
-
$trans = $result_decode->Transactions;
|
67 |
if(!isset($trans[0])) {
|
68 |
continue; // go to next cycle when no element is exist
|
69 |
}
|
@@ -80,7 +85,7 @@ class Eway_Rapid31_Adminhtml_EwayadminController extends Mage_Adminhtml_Controll
|
|
80 |
}
|
81 |
}
|
82 |
// Redirect form
|
83 |
-
$this->
|
84 |
}
|
85 |
private function __getTransaction($transId) {
|
86 |
$ewayConfig = Mage::getSingleton('ewayrapid/config');
|
@@ -170,4 +175,16 @@ class Eway_Rapid31_Adminhtml_EwayadminController extends Mage_Adminhtml_Controll
|
|
170 |
}
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
*
|
4 |
*/
|
5 |
class Eway_Rapid31_Adminhtml_EwayadminController extends Mage_Adminhtml_Controller_Action {
|
6 |
+
|
7 |
+
protected function _isAllowed() {
|
8 |
+
return true;
|
9 |
+
}
|
10 |
+
|
11 |
public function indexAction() {
|
12 |
}
|
13 |
|
68 |
// Check return data
|
69 |
$result_decode = json_decode($result);
|
70 |
|
71 |
+
$trans = (isset($result_decode->Transactions) ? $result_decode->Transactions : array());
|
72 |
if(!isset($trans[0])) {
|
73 |
continue; // go to next cycle when no element is exist
|
74 |
}
|
85 |
}
|
86 |
}
|
87 |
// Redirect form
|
88 |
+
$this->_redirectReferer();
|
89 |
}
|
90 |
private function __getTransaction($transId) {
|
91 |
$ewayConfig = Mage::getSingleton('ewayrapid/config');
|
175 |
}
|
176 |
}
|
177 |
|
178 |
+
public function ewayordersAction()
|
179 |
+
{
|
180 |
+
$this->loadLayout();
|
181 |
+
$this->renderLayout();
|
182 |
+
}
|
183 |
+
|
184 |
+
public function gridAction()
|
185 |
+
{
|
186 |
+
$this->loadLayout(false);
|
187 |
+
$this->renderLayout();
|
188 |
+
}
|
189 |
+
|
190 |
}
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eway_Rapid31_Adminhtml_Ewayrapid_SavedcardController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
protected function _isAllowed() {
|
6 |
+
return true;
|
7 |
+
}
|
8 |
+
|
9 |
+
public function loadAction()
|
10 |
+
{
|
11 |
+
$request = $this->getRequest();
|
12 |
+
$tokenId = $request->getParam('token_id');
|
13 |
+
$message = array(
|
14 |
+
'message' => $this->__('Invalid request'),
|
15 |
+
'success' => false
|
16 |
+
);
|
17 |
+
|
18 |
+
if($tokenId && is_numeric($tokenId) && $tokenId > 0){
|
19 |
+
$customerId = $request->getParam('customer_id');
|
20 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
21 |
+
Mage::register('current_customer', $customer);
|
22 |
+
$this->loadLayout();
|
23 |
+
$this->getLayout()->getBlock('root')->setData('token_id', $tokenId);
|
24 |
+
$this->renderLayout();
|
25 |
+
}else{
|
26 |
+
$this->loadLayout();
|
27 |
+
$this->getLayout()->getBlock('root')->setData('token_id', 0);
|
28 |
+
$this->renderLayout();
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
public function newAction()
|
35 |
+
{
|
36 |
+
$this->_forward('edit');
|
37 |
+
}
|
38 |
+
|
39 |
+
public function saveAction(){
|
40 |
+
|
41 |
+
$request = $this->getRequest();
|
42 |
+
$params = $request->getParam('ewayrapid');
|
43 |
+
$customerId = $request->getParam('customer_id');
|
44 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
45 |
+
|
46 |
+
$message = array(
|
47 |
+
'success' => false,
|
48 |
+
'message' => Mage::helper('ewayrapid')->__('Invalid request')
|
49 |
+
);
|
50 |
+
|
51 |
+
Mage::register('current_customer', $customer);
|
52 |
+
if (!Mage::helper('ewayrapid')->isSavedMethodEnabled()) {
|
53 |
+
$this->getResponse()->setBody(json_encode($message));
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
$apiRequest = Mage::getModel('ewayrapid/request_token');
|
58 |
+
try {
|
59 |
+
if (!$request->isPost() || !$params['address'] || !$params['payment']) {
|
60 |
+
$this->getResponse()->setBody(json_encode($message));
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
|
64 |
+
$tokenId = $params['token_id'];
|
65 |
+
if (is_numeric($tokenId) && $tokenId > 0) {
|
66 |
+
list($billingAddress, $infoInstance) = $this->_generateApiParams($params);
|
67 |
+
|
68 |
+
$infoInstance->setSavedToken($tokenId);
|
69 |
+
$apiRequest->updateToken($billingAddress, $infoInstance);
|
70 |
+
|
71 |
+
} else if (!$tokenId) {
|
72 |
+
list($billingAddress, $infoInstance) = $this->_generateApiParams($params);
|
73 |
+
$apiRequest->createNewToken($billingAddress, $infoInstance);
|
74 |
+
|
75 |
+
$message['message'] = $this->__('Your Credit Card has been saved successfully.');
|
76 |
+
$message['success'] = true;
|
77 |
+
} else {
|
78 |
+
$message['message'] = $this->__('Invalid token id');
|
79 |
+
$message['success'] = false;
|
80 |
+
$this->getResponse()->setBody(json_encode($message));
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
} catch (Mage_Core_Exception $e) {
|
84 |
+
$message['message'] = $e->getMessage();
|
85 |
+
$this->getResponse()->setBody(json_encode($message));
|
86 |
+
return;
|
87 |
+
} catch (Exception $e){
|
88 |
+
$message['message'] = $e->getMessage();
|
89 |
+
$this->getResponse()->setBody(json_encode($message));
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
$this->loadLayout();
|
94 |
+
$this->renderLayout();
|
95 |
+
}
|
96 |
+
|
97 |
+
public function deleteAction(){
|
98 |
+
$request = $this->getRequest();
|
99 |
+
$tokenId = $request->getParam('token_id');
|
100 |
+
$message = array(
|
101 |
+
'message' => $this->__('Invalid request'),
|
102 |
+
'success' => false
|
103 |
+
);
|
104 |
+
|
105 |
+
if($tokenId && is_numeric($tokenId) && $tokenId > 0){
|
106 |
+
$customerId = $request->getParam('customer_id');
|
107 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
108 |
+
Mage::register('current_customer', $customer);
|
109 |
+
Mage::helper('ewayrapid/customer')->deleteToken($tokenId);
|
110 |
+
$message['success'] = true;
|
111 |
+
$message['message'] = $this->__('Card deleted');
|
112 |
+
$this->getResponse()->setBody(json_encode($message));
|
113 |
+
return;
|
114 |
+
}else{
|
115 |
+
$this->getResponse()->setBody(json_encode($message));
|
116 |
+
return;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
public function getAccessCodeAction(){
|
121 |
+
try{
|
122 |
+
$request = $this->getRequest();
|
123 |
+
$params = $request->getParam('ewayrapid');
|
124 |
+
$customerId = $request->getParam('customer_id');
|
125 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
126 |
+
|
127 |
+
$message = array(
|
128 |
+
'message' => $this->__('Invalid request'),
|
129 |
+
'success' => false
|
130 |
+
);
|
131 |
+
// Response data to client
|
132 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
133 |
+
|
134 |
+
// Enabled method save
|
135 |
+
if (!Mage::helper('ewayrapid')->isSavedMethodEnabled()) {
|
136 |
+
$this->getResponse()->setBody(json_encode($message));
|
137 |
+
return;
|
138 |
+
}
|
139 |
+
|
140 |
+
Mage::register('current_customer', $customer);
|
141 |
+
$method = 'AccessCodes';
|
142 |
+
if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
143 |
+
=== Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE ||
|
144 |
+
Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
145 |
+
=== Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
146 |
+
) {
|
147 |
+
$method = 'AccessCodesShared';
|
148 |
+
}
|
149 |
+
|
150 |
+
$request = $this->getRequest();
|
151 |
+
|
152 |
+
$apiRequest = Mage::getModel('ewayrapid/request_token');
|
153 |
+
list($billingAddress, $infoInstance) = $this->_generateApiParams($params);
|
154 |
+
$data = $apiRequest->createAccessCode($billingAddress, $infoInstance, $method, $request);
|
155 |
+
/*
|
156 |
+
* {"AccessCode":"C3AB9RIc_reC_FRm8nXsy36QddJm_-YlaZCc2ZHuhbOeR5RzX682kfgl_12-vipFpJiuPPcOyh-ToeWP--Px06J04mW1zhqKpyqRTsvz0ub9-URgih4V_rHDYoNxQHXq9Ho2l",
|
157 |
+
* "Customer":{
|
158 |
+
* "CardNumber":"",
|
159 |
+
* "CardStartMonth":"",
|
160 |
+
* "CardStartYear":"",
|
161 |
+
* "CardIssueNumber":"",
|
162 |
+
* "CardName":"",
|
163 |
+
* "CardExpiryMonth":"",
|
164 |
+
* "CardExpiryYear":"",
|
165 |
+
* "IsActive":false,
|
166 |
+
* "TokenCustomerID":null,
|
167 |
+
* "Reference":"",
|
168 |
+
* "Title":"Mr.",
|
169 |
+
* "FirstName":"binh",
|
170 |
+
* "LastName":"nguyen",
|
171 |
+
* "CompanyName":"aaaaaa",
|
172 |
+
* "JobDescription":"job",
|
173 |
+
* "Street1":"Product Attributes",
|
174 |
+
* "Street2":"def",
|
175 |
+
* "City":"city here",
|
176 |
+
* "State":"123",
|
177 |
+
* "PostalCode":"1234",
|
178 |
+
* "Country":"as",
|
179 |
+
* "Email":"4444ddd@gmail.com",
|
180 |
+
* "Phone":"0987654321",
|
181 |
+
* "Mobile":"4444444444",
|
182 |
+
* "Comments":"",
|
183 |
+
* "Fax":"4535343",
|
184 |
+
* "Url":""
|
185 |
+
* },
|
186 |
+
* "Payment":{"TotalAmount":0,"InvoiceNumber":null,"InvoiceDescription":null,"InvoiceReference":null,"CurrencyCode":"AUD"},
|
187 |
+
* "FormActionURL":"https:\/\/secure-au.sandbox.ewaypayments.com\/AccessCode\/C3AB9RIc_reC_FRm8nXsy36QddJm_-YlaZCc2ZHuhbOeR5RzX682kfgl_12-vipFpJiuPPcOyh-ToeWP--Px06J04mW1zhqKpyqRTsvz0ub9-URgih4V_rHDYoNxQHXq9Ho2l",
|
188 |
+
* "CompleteCheckoutURL":null,
|
189 |
+
* "Errors":null}
|
190 |
+
*/
|
191 |
+
// if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
192 |
+
// === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE||
|
193 |
+
// Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
194 |
+
// === Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
195 |
+
// ) {
|
196 |
+
// $data = $data->getData();
|
197 |
+
// }
|
198 |
+
$customerData = $data->getCustomer();
|
199 |
+
$data->setData('street1', $customerData['Street1']);
|
200 |
+
$data->setData('street2', $customerData['Street2']);
|
201 |
+
$data = json_encode($data->getData());
|
202 |
+
$this->getResponse()->setBody($data);
|
203 |
+
}catch (Mage_Core_Exception $e) {
|
204 |
+
$message['message'] = $e->getMessage();
|
205 |
+
$this->getResponse()->setBody(json_encode($message));
|
206 |
+
return;
|
207 |
+
} catch (Exception $e){
|
208 |
+
$message['message'] = $e->getMessage();
|
209 |
+
$this->getResponse()->setBody(json_encode($message));
|
210 |
+
return;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
public function savetokenAction(){
|
215 |
+
$req = $this->getRequest();
|
216 |
+
|
217 |
+
$customerId = $req->getParam('customer_id');
|
218 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
219 |
+
Mage::register('current_customer', $customer);
|
220 |
+
$message = array(
|
221 |
+
'message' => $this->__('Invalid request'),
|
222 |
+
'success' => false
|
223 |
+
);
|
224 |
+
// Check load access code
|
225 |
+
$accessCode = $req->getParam('AccessCode');
|
226 |
+
$ccType = $req->getParam('ccType');
|
227 |
+
$expYear = $req->getParam('expYear');
|
228 |
+
$token_id = $req->getParam('token_id');
|
229 |
+
|
230 |
+
if (isset($accessCode)) {
|
231 |
+
$apiRequest = Mage::getModel('ewayrapid/request_token');
|
232 |
+
// Retrieve data card by token key to save information
|
233 |
+
$result = $apiRequest->getInfoByAccessCode($accessCode);
|
234 |
+
$data = $result->getData();
|
235 |
+
|
236 |
+
$token_customer_id = $data['TokenCustomerID'];
|
237 |
+
|
238 |
+
/**
|
239 |
+
* TEST TOKEN ID NULL
|
240 |
+
*/
|
241 |
+
//$token_customer_id = null;
|
242 |
+
/**
|
243 |
+
* END TEST
|
244 |
+
*/
|
245 |
+
|
246 |
+
if (isset($token_customer_id) && !empty($token_customer_id)) {
|
247 |
+
$apiRequest = Mage::getModel('ewayrapid/request_token');
|
248 |
+
$street1 = $req->getParam('street1');
|
249 |
+
$street2 = $req->getParam('street2');
|
250 |
+
$cardData = array(
|
251 |
+
'token' => $token_customer_id,
|
252 |
+
'ccType' => $ccType,
|
253 |
+
'expYear' => $expYear,
|
254 |
+
'token_id' => $token_id,
|
255 |
+
'startMonth' => $req->getParam('startMonth'),
|
256 |
+
'startYear' => $req->getParam('startYear'),
|
257 |
+
'issueNumber' => $req->getParam('issueNumber'),
|
258 |
+
'street1' => $street1,
|
259 |
+
'street2' => $street2
|
260 |
+
);
|
261 |
+
// Retrieve data card by token key and save information
|
262 |
+
$apiRequest->saveInfoByTokenId($cardData);
|
263 |
+
if ($req->getParam('is_default')) {
|
264 |
+
Mage::helper('ewayrapid/customer')->setDefaultToken($token_id ? $token_id : Mage::helper('ewayrapid/customer')->getLastTokenId());
|
265 |
+
}
|
266 |
+
$this->loadLayout();
|
267 |
+
$this->renderLayout();
|
268 |
+
return;
|
269 |
+
|
270 |
+
} else {
|
271 |
+
// If error, it will be showed message ERR-002
|
272 |
+
$message['message'] = $this->__('Failed to update Credit Card. Please try again later.');
|
273 |
+
$this->getResponse()->setBody(json_encode($message));
|
274 |
+
}
|
275 |
+
}
|
276 |
+
$this->getResponse()->setBody(json_encode($message));
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
/**
|
280 |
+
* Generate params to post to eWAY gateway to create new token.
|
281 |
+
*
|
282 |
+
* @param Array $params
|
283 |
+
* @return array
|
284 |
+
*/
|
285 |
+
protected function _generateApiParams($params)
|
286 |
+
{
|
287 |
+
$billingAddress = Mage::getModel('customer/address');
|
288 |
+
$billingAddress->addData($params['address']);
|
289 |
+
$errors = $billingAddress->validate();
|
290 |
+
if ($errors !== true && is_array($errors)) {
|
291 |
+
Mage::throwException(implode("\n", $errors));
|
292 |
+
}
|
293 |
+
if($params && isset($params['payment'])){
|
294 |
+
$infoInstance = new Varien_Object($params['payment']);
|
295 |
+
}else{
|
296 |
+
$infoInstance = new Varien_Object();
|
297 |
+
}
|
298 |
+
|
299 |
+
return array($billingAddress, $infoInstance);
|
300 |
+
}
|
301 |
+
}
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*/
|
4 |
+
require_once 'Mage/Adminhtml/controllers/Sales/Order/CreateController.php';
|
5 |
+
|
6 |
+
|
7 |
+
class Eway_Rapid31_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* @var Eway_Rapid31_Model_Request_Sharedpage
|
11 |
+
*/
|
12 |
+
protected $_checkout = null;
|
13 |
+
|
14 |
+
protected $_checkoutType = 'ewayrapid/request_sharedpage';
|
15 |
+
|
16 |
+
protected function _isAllowed() {
|
17 |
+
return true;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function ewayIframeAction()
|
21 |
+
{
|
22 |
+
$this->_processActionData('save');
|
23 |
+
$postData = $this->getRequest()->getPost('order');
|
24 |
+
|
25 |
+
$this->_getSession()->unsetData('iframePostQuote');
|
26 |
+
$this->_getSession()->setData('iframePostQuote', $postData);
|
27 |
+
|
28 |
+
$paymentData = $this->getRequest()->getPost('payment');
|
29 |
+
if ($paymentData) {
|
30 |
+
$paymentData['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_INTERNAL
|
31 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
|
32 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
|
33 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
|
34 |
+
| Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
|
35 |
+
$this->_getOrderCreateModel()->setPaymentData($paymentData);
|
36 |
+
$this->_getOrderCreateModel()->getQuote()->getPayment()->addData($paymentData);
|
37 |
+
}
|
38 |
+
$quote = $this->_getOrderCreateModel()->getQuote();
|
39 |
+
|
40 |
+
try {
|
41 |
+
$checkout = Mage::getSingleton($this->_checkoutType, array(
|
42 |
+
'quote' => $quote
|
43 |
+
));
|
44 |
+
|
45 |
+
$redirectUrl = $this->getUrl('*/*/ewaysaveiframeorder');
|
46 |
+
//Init AccessCode
|
47 |
+
$data = $checkout->createAccessCode($redirectUrl, Mage::getUrl('*/*/cancel', array('_secure' => true)));
|
48 |
+
|
49 |
+
$redirectParams = array(
|
50 |
+
'AccessCode' => $data->getAccessCode()
|
51 |
+
);
|
52 |
+
|
53 |
+
//New/Edit or not saved token
|
54 |
+
$savedToken = $paymentData['saved_token'];
|
55 |
+
$saveCard = (isset($paymentData['save_card']) ? $paymentData['save_card'] : '');
|
56 |
+
|
57 |
+
if($savedToken && is_numeric($savedToken)) {
|
58 |
+
$redirectParams['saved_token'] = $savedToken;
|
59 |
+
} elseif($saveCard) {
|
60 |
+
$redirectParams['newToken'] = 1;
|
61 |
+
}
|
62 |
+
|
63 |
+
$redirectUrl = $this->getUrl('*/*/ewaysaveiframeorder', $redirectParams);
|
64 |
+
$result = array(
|
65 |
+
'success' => false,
|
66 |
+
'message' => '',
|
67 |
+
'url' => '',
|
68 |
+
'returnUrl' => $redirectUrl
|
69 |
+
);
|
70 |
+
|
71 |
+
if ($data->isSuccess()) {
|
72 |
+
//Mage::getSingleton('core/session')->setData('FormActionURL', $data->getFormActionURL());
|
73 |
+
if ($data->getSharedPaymentUrl()) {
|
74 |
+
$result['url'] = $data->getSharedPaymentUrl();
|
75 |
+
$result['success'] = true;
|
76 |
+
$this->getResponse()->setBody(json_encode($result));
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
} else {
|
80 |
+
$result['message'] = Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: ' . $data->getMessage() . ')');
|
81 |
+
$this->getResponse()->setBody(json_encode($result));
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
} catch (Exception $e) {
|
85 |
+
$result['message'] = Mage::helper('ewayrapid')->__($e->getMessage());
|
86 |
+
$this->getResponse()->setBody(json_encode($result));
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
public function ewaySaveIframeOrderAction()
|
93 |
+
{
|
94 |
+
try {
|
95 |
+
$newToken = $this->getRequest()->getParam('newToken');
|
96 |
+
$editToken = $this->getRequest()->getParam('saved_token');
|
97 |
+
$accessCode = $this->getRequest()->getParam('AccessCode');
|
98 |
+
|
99 |
+
$orderModel = $this->_getOrderCreateModel()
|
100 |
+
->setIsValidate(true)
|
101 |
+
->importPostData($this->_getSession()->getData('iframePostQuote'));
|
102 |
+
|
103 |
+
$beagleScore = 0;
|
104 |
+
$beagleVerification = array();
|
105 |
+
|
106 |
+
$quote = $orderModel->getQuote();
|
107 |
+
$this->_checkout = $this->_checkout = Mage::getSingleton($this->_checkoutType, array(
|
108 |
+
'quote' => $quote
|
109 |
+
));
|
110 |
+
|
111 |
+
$response = $this->_checkout->getInfoByAccessCode($accessCode);
|
112 |
+
// Get Fraud Information
|
113 |
+
if($response->isSuccess()){
|
114 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
115 |
+
if($transaction) {
|
116 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
117 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
118 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
119 |
+
unset($transaction);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
if($response->getData('BeagleVerification')){
|
124 |
+
$beagleVerification = $response->getData('BeagleVerification');
|
125 |
+
}
|
126 |
+
if($response->getData('BeagleScore') && $response->getData('BeagleScore') > 0){
|
127 |
+
$beagleScore = $response->getData('BeagleScore');
|
128 |
+
}
|
129 |
+
|
130 |
+
if ($newToken || $editToken) {
|
131 |
+
if ($response->getTokenCustomerID()) {
|
132 |
+
$response = $this->_checkout->saveTokenById($response, $editToken);
|
133 |
+
$response = $this->_processPayment($response);
|
134 |
+
if($response->getData('BeagleVerification')){
|
135 |
+
$beagleVerification = $response->getData('BeagleVerification');
|
136 |
+
}
|
137 |
+
if($response->getData('BeagleScore') && $response->getData('BeagleScore') > 0){
|
138 |
+
$beagleScore = $response->getData('BeagleScore');
|
139 |
+
}
|
140 |
+
} else {
|
141 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. Please try again. (Error message: %s)',
|
142 |
+
$response->getMessage()));
|
143 |
+
}
|
144 |
+
}
|
145 |
+
if ($response->isSuccess()) {
|
146 |
+
|
147 |
+
// Save fraud information
|
148 |
+
if(is_null($fraudAction)){
|
149 |
+
$fraudAction = $response->getFraudAction();
|
150 |
+
}
|
151 |
+
if(is_null($fraudCodes)){
|
152 |
+
$fraudCodes = $response->getFraudCodes();
|
153 |
+
}
|
154 |
+
if(is_null($captured)){
|
155 |
+
$captured = $response->getTransactionCaptured();
|
156 |
+
}
|
157 |
+
|
158 |
+
$beagleScore = $beagleScore ? $beagleScore : '';
|
159 |
+
$orderModel->getQuote()->getPayment()
|
160 |
+
->setAdditionalInformation('successType', 'success')
|
161 |
+
->setBeagleScore($beagleScore)
|
162 |
+
->setBeagleVerification(serialize($beagleVerification))
|
163 |
+
->setFraudAction($fraudAction)
|
164 |
+
->setFraudCodes($fraudCodes)
|
165 |
+
->setTransactionCaptured($captured);
|
166 |
+
|
167 |
+
Mage::getSingleton('core/session')->setData('ewayTransactionID', $response->getTransactionID());
|
168 |
+
} else {
|
169 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('Sorry, your payment could not be processed (Message: %s). Please check your details and try again, or try an alternative payment method.',
|
170 |
+
$response->getMessage()));
|
171 |
+
}
|
172 |
+
|
173 |
+
$order = $orderModel->createOrder();
|
174 |
+
$order->setEwayTransactionId($response->getTransactionID());
|
175 |
+
$order->save();
|
176 |
+
$this->_getSession()->clear();
|
177 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The order has been created.'));
|
178 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
179 |
+
$this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
|
180 |
+
} else {
|
181 |
+
$this->_redirect('*/sales_order/index');
|
182 |
+
}
|
183 |
+
} catch (Mage_Payment_Model_Info_Exception $e) {
|
184 |
+
$this->_getOrderCreateModel()->saveQuote();
|
185 |
+
$message = $e->getMessage();
|
186 |
+
if (!empty($message)) {
|
187 |
+
$this->_getSession()->addError($message);
|
188 |
+
}
|
189 |
+
$this->_redirect('*/*/');
|
190 |
+
} catch (Mage_Core_Exception $e) {
|
191 |
+
$message = $e->getMessage();
|
192 |
+
if (!empty($message)) {
|
193 |
+
$this->_getSession()->addError($message);
|
194 |
+
}
|
195 |
+
$this->_redirect('*/*/');
|
196 |
+
} catch (Exception $e) {
|
197 |
+
$this->_getSession()->addException($e, $this->__('Order saving error: %s', $e->getMessage()));
|
198 |
+
$this->_redirect('*/*/');
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* process Payment: authorize only or authorize & capture
|
204 |
+
*
|
205 |
+
* @param Eway_Rapid31_Model_Response $response
|
206 |
+
* @return Eway_Rapid31_Model_Response
|
207 |
+
* @throws Mage_Core_Exception
|
208 |
+
*/
|
209 |
+
protected function _processPayment(Eway_Rapid31_Model_Response $response)
|
210 |
+
{
|
211 |
+
$this->_initCheckout();
|
212 |
+
|
213 |
+
$cardData = $response->getCustomer();
|
214 |
+
|
215 |
+
if ($cardData['CardNumber'] && $cardData['CardName']) {
|
216 |
+
$response = $this->_checkout->doAuthorisation($response);
|
217 |
+
$beagleScore = $response->getBeagleScore();
|
218 |
+
|
219 |
+
// Get Fraud Information
|
220 |
+
if($response->isSuccess()){
|
221 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
222 |
+
if($transaction) {
|
223 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
224 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
225 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
226 |
+
unset($transaction);
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
if ($response->isSuccess()
|
231 |
+
&& Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE
|
232 |
+
) {
|
233 |
+
$response = $this->_checkout->doCapturePayment($response);
|
234 |
+
|
235 |
+
// Reload Fraud Information
|
236 |
+
if($response->isSuccess()){
|
237 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
238 |
+
if($transaction) {
|
239 |
+
if($transaction[0]['FraudAction']){
|
240 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
241 |
+
}
|
242 |
+
if(Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage'])){
|
243 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
244 |
+
}
|
245 |
+
if($transaction[0]['TransactionCaptured']){
|
246 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
247 |
+
}
|
248 |
+
unset($transaction);
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
}
|
253 |
+
} else {
|
254 |
+
if (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE) {
|
255 |
+
$response = $this->_checkout->doAuthorisation($response);
|
256 |
+
|
257 |
+
// Get Fraud Information
|
258 |
+
if($response->isSuccess()){
|
259 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
260 |
+
if($transaction) {
|
261 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
262 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
263 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
264 |
+
unset($transaction);
|
265 |
+
}
|
266 |
+
}
|
267 |
+
} elseif (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
|
268 |
+
$response = $this->_checkout->doTransaction($response);
|
269 |
+
|
270 |
+
// Get Fraud Information
|
271 |
+
if($response->isSuccess()){
|
272 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
273 |
+
if($transaction) {
|
274 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
275 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
276 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
277 |
+
unset($transaction);
|
278 |
+
}
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
if (!$response->isSuccess()) {
|
283 |
+
Mage::throwException(Mage::helper('ewayrapid')->__('Sorry, your payment could not be processed (Message: %s). Please check your details and try again, or try an alternative payment method.',
|
284 |
+
$response->getMessage()));
|
285 |
+
}
|
286 |
+
|
287 |
+
if($response->getBeagleScore() === null){
|
288 |
+
$response->setBeagleScore($beagleScore);
|
289 |
+
}
|
290 |
+
$response->setFraudAction($fraudAction);
|
291 |
+
$response->setFraudCodes($fraudCodes);
|
292 |
+
$response->setTransactionCaptured($captured);
|
293 |
+
return $response;
|
294 |
+
}
|
295 |
+
|
296 |
+
private function _initCheckout()
|
297 |
+
{
|
298 |
+
$quote = $this->_getOrderCreateModel()->getQuote();
|
299 |
+
$this->_checkout = Mage::getSingleton($this->_checkoutType, array(
|
300 |
+
'quote' => $quote
|
301 |
+
));
|
302 |
+
}
|
303 |
+
}
|
@@ -253,7 +253,9 @@ class Eway_Rapid31_MycardsController extends Mage_Core_Controller_Front_Action
|
|
253 |
|
254 |
$method = 'AccessCodes';
|
255 |
if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
256 |
-
=== Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE
|
|
|
|
|
257 |
) {
|
258 |
$method = 'AccessCodesShared';
|
259 |
}
|
@@ -307,6 +309,19 @@ class Eway_Rapid31_MycardsController extends Mage_Core_Controller_Front_Action
|
|
307 |
return $this->_redirectUrl($data['SharedPaymentUrl']);
|
308 |
}
|
309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
$data = json_encode($data->getData());
|
311 |
$this->getResponse()->setBody($data);
|
312 |
}
|
@@ -379,22 +394,7 @@ class Eway_Rapid31_MycardsController extends Mage_Core_Controller_Front_Action
|
|
379 |
|
380 |
}
|
381 |
|
382 |
-
/*
|
383 |
-
$url = 'https://api.sandbox.ewaypayments.com/Transaction/10889350';
|
384 |
-
//echo $url; die();
|
385 |
-
$ch = curl_init($url);
|
386 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/json"));
|
387 |
-
curl_setopt($ch, CURLOPT_USERPWD, 'A1001CO7f5Se/wnuCkN96LX02vLgZlLfDVdbxDZzFgm+YsxckCiIG8d5mZzHXCProMwr7C:abc12345');
|
388 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
389 |
-
|
390 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
391 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
392 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
393 |
-
|
394 |
-
$result = curl_exec($ch);
|
395 |
-
var_dump (json_decode($result)); die();
|
396 |
-
}
|
397 |
-
|
398 |
public function queryFraudAction() {
|
399 |
$cron = new Eway_Rapid31_Model_EwayCron();
|
400 |
$cron->querySuspectFraud();
|
253 |
|
254 |
$method = 'AccessCodes';
|
255 |
if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
256 |
+
=== Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE ||
|
257 |
+
Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
258 |
+
=== Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
259 |
) {
|
260 |
$method = 'AccessCodesShared';
|
261 |
}
|
309 |
return $this->_redirectUrl($data['SharedPaymentUrl']);
|
310 |
}
|
311 |
|
312 |
+
if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type')
|
313 |
+
=== Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME
|
314 |
+
) {
|
315 |
+
$redirectUrl = $apiRequest->getRedirectUrl();
|
316 |
+
|
317 |
+
$redirectUrl = Mage::getModel('core/url')->parseUrl($redirectUrl)
|
318 |
+
->setQueryParam('AccessCode',$data->getAccessCode());
|
319 |
+
|
320 |
+
$redirectUrl = Mage::getUrl('*/*/saveToken', $redirectUrl->getQueryParams());
|
321 |
+
|
322 |
+
$data->setReturnUrl($redirectUrl);
|
323 |
+
}
|
324 |
+
|
325 |
$data = json_encode($data->getData());
|
326 |
$this->getResponse()->setBody($data);
|
327 |
}
|
394 |
|
395 |
}
|
396 |
|
397 |
+
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
public function queryFraudAction() {
|
399 |
$cron = new Eway_Rapid31_Model_EwayCron();
|
400 |
$cron->querySuspectFraud();
|
@@ -25,12 +25,14 @@ class Eway_Rapid31_SharedpageController extends Mage_Checkout_OnepageController
|
|
25 |
$method = $this->_getQuote()->getPayment()->getMethod();
|
26 |
if ($method !== Eway_Rapid31_Model_Config::PAYMENT_NOT_SAVED_METHOD
|
27 |
&& $method !== Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
|
|
28 |
) {
|
29 |
Mage::getSingleton('core/session')->addError($this->__('Payment method ' . $method . ' not available'));
|
30 |
$this->_redirect('checkout/cart');
|
31 |
return;
|
32 |
}
|
33 |
-
if ($method === Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
|
|
34 |
&& !Mage::helper('ewayrapid')->isSavedMethodEnabled()
|
35 |
) {
|
36 |
Mage::getSingleton('core/session')->addError($this->__('This feature has been disabled. Please contact site owner.'));
|
@@ -59,6 +61,68 @@ class Eway_Rapid31_SharedpageController extends Mage_Checkout_OnepageController
|
|
59 |
}
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
public function cancelAction()
|
63 |
{
|
64 |
$this->_redirect('checkout/cart');
|
@@ -76,11 +140,45 @@ class Eway_Rapid31_SharedpageController extends Mage_Checkout_OnepageController
|
|
76 |
$editToken = $this->getRequest()->getParam('editToken');
|
77 |
$accessCode = $this->getRequest()->getParam('AccessCode');
|
78 |
|
|
|
|
|
|
|
79 |
$response = $this->_checkout->getInfoByAccessCode($accessCode);
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
if ($response->getTokenCustomerID()) {
|
82 |
-
$
|
83 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
} else {
|
85 |
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. Please try again. (Error message: %s)',
|
86 |
$response->getMessage()));
|
@@ -89,7 +187,19 @@ class Eway_Rapid31_SharedpageController extends Mage_Checkout_OnepageController
|
|
89 |
|
90 |
$orderId = null;
|
91 |
if ($response->isSuccess()) {
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
} else {
|
94 |
Mage::throwException(Mage::helper('ewayrapid')->__('Sorry, your payment could not be processed (Message: %s). Please check your details and try again, or try an alternative payment method.',
|
95 |
$response->getMessage()));
|
@@ -113,13 +223,19 @@ class Eway_Rapid31_SharedpageController extends Mage_Checkout_OnepageController
|
|
113 |
* @param string $successType
|
114 |
* @return string
|
115 |
*/
|
116 |
-
private function storeOrder($response, $successType = 'success')
|
117 |
{
|
118 |
try {
|
119 |
// Clear the basket and save the order (including some info about how the payment went)
|
120 |
$this->getOnepage()->getQuote()->collectTotals();
|
121 |
$payment = $this->getOnepage()->getQuote()->getPayment();
|
122 |
$payment->setAdditionalInformation('successType', $successType);
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
Mage::getSingleton('core/session')->setData('ewayTransactionID', $response->getTransactionID());
|
124 |
$orderId = $this->getOnepage()->saveOrder()->getLastOrderId();
|
125 |
$this->getOnepage()->getQuote()->setIsActive(1);
|
@@ -263,23 +379,82 @@ class Eway_Rapid31_SharedpageController extends Mage_Checkout_OnepageController
|
|
263 |
$cardData = $response->getCustomer();
|
264 |
|
265 |
if ($cardData['CardNumber'] && $cardData['CardName']) {
|
266 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
if ($response->isSuccess()
|
268 |
-
&& Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::
|
269 |
) {
|
270 |
-
$response = $this->_checkout->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
}
|
272 |
} else {
|
273 |
if (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE) {
|
274 |
$response = $this->_checkout->doAuthorisation($response);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
} elseif (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
|
276 |
$response = $this->_checkout->doTransaction($response);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
}
|
278 |
}
|
279 |
if (!$response->isSuccess()) {
|
280 |
Mage::throwException(Mage::helper('ewayrapid')->__('Sorry, your payment could not be processed (Message: %s). Please check your details and try again, or try an alternative payment method.',
|
281 |
$response->getMessage()));
|
282 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
return $response;
|
284 |
}
|
285 |
}
|
25 |
$method = $this->_getQuote()->getPayment()->getMethod();
|
26 |
if ($method !== Eway_Rapid31_Model_Config::PAYMENT_NOT_SAVED_METHOD
|
27 |
&& $method !== Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
28 |
+
&& $method !== Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD
|
29 |
) {
|
30 |
Mage::getSingleton('core/session')->addError($this->__('Payment method ' . $method . ' not available'));
|
31 |
$this->_redirect('checkout/cart');
|
32 |
return;
|
33 |
}
|
34 |
+
if (($method === Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
35 |
+
|| $method === Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD)
|
36 |
&& !Mage::helper('ewayrapid')->isSavedMethodEnabled()
|
37 |
) {
|
38 |
Mage::getSingleton('core/session')->addError($this->__('This feature has been disabled. Please contact site owner.'));
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
/**
|
65 |
+
* generate a Shared Payment URL for Rapid Iframe
|
66 |
+
*/
|
67 |
+
public function iframeAction()
|
68 |
+
{
|
69 |
+
// check method available
|
70 |
+
$method = $this->_getQuote()->getPayment()->getMethod();
|
71 |
+
if ($method !== Eway_Rapid31_Model_Config::PAYMENT_NOT_SAVED_METHOD
|
72 |
+
&& $method !== Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
73 |
+
&& $method !== Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD
|
74 |
+
) {
|
75 |
+
Mage::getSingleton('core/session')->addError($this->__('Payment method ' . $method . ' not available'));
|
76 |
+
$this->_redirect('checkout/cart');
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
if (($method === Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
80 |
+
|| $method === Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD)
|
81 |
+
&& !Mage::helper('ewayrapid')->isSavedMethodEnabled()
|
82 |
+
) {
|
83 |
+
Mage::getSingleton('core/session')->addError($this->__('This feature has been disabled. Please contact site owner.'));
|
84 |
+
$this->_redirect('checkout/cart');
|
85 |
+
return;
|
86 |
+
}
|
87 |
+
|
88 |
+
try {
|
89 |
+
$this->_initCheckout();
|
90 |
+
$data = $this->_checkout->createAccessCode(Mage::getUrl('*/*/return', array('_secure'=>true)), Mage::getUrl('*/*/cancel', array('_secure'=>true)));
|
91 |
+
|
92 |
+
// Save redirect url for iframe callback
|
93 |
+
$redirectUrl = Mage::getModel('core/url')->parseUrl($this->_checkout->getRedirectUrl())
|
94 |
+
->setQueryParam('AccessCode',$data['AccessCode']);
|
95 |
+
|
96 |
+
$redirectUrl = Mage::getUrl('*/*/return', $redirectUrl->getQueryParams());
|
97 |
+
|
98 |
+
$result = array(
|
99 |
+
'success' => false,
|
100 |
+
'message' => '',
|
101 |
+
'url' => '',
|
102 |
+
'returnUrl' => $redirectUrl
|
103 |
+
);
|
104 |
+
|
105 |
+
if ($data->isSuccess()) {
|
106 |
+
Mage::getSingleton('core/session')->setData('FormActionURL', $data->getFormActionURL());
|
107 |
+
if ($data->getSharedPaymentUrl()) {
|
108 |
+
$result['url'] = $data->getSharedPaymentUrl();
|
109 |
+
$result['success'] = true;
|
110 |
+
$this->getResponse()->setBody(json_encode($result));
|
111 |
+
return;
|
112 |
+
}
|
113 |
+
} else {
|
114 |
+
$result['message'] = Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later. (Error message: ' . $data->getMessage() . ')');
|
115 |
+
$this->getResponse()->setBody(json_encode($result));
|
116 |
+
return;
|
117 |
+
}
|
118 |
+
|
119 |
+
} catch (Exception $e) {
|
120 |
+
$result['message'] = Mage::helper('ewayrapid')->__($e->getMessage());
|
121 |
+
$this->getResponse()->setBody(json_encode($result));
|
122 |
+
return;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
public function cancelAction()
|
127 |
{
|
128 |
$this->_redirect('checkout/cart');
|
140 |
$editToken = $this->getRequest()->getParam('editToken');
|
141 |
$accessCode = $this->getRequest()->getParam('AccessCode');
|
142 |
|
143 |
+
$beagleScore = 0;
|
144 |
+
$beagleVerification = array();
|
145 |
+
|
146 |
$response = $this->_checkout->getInfoByAccessCode($accessCode);
|
147 |
+
// Get Fraud Information
|
148 |
+
if($response->isSuccess()){
|
149 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
150 |
+
if($transaction) {
|
151 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
152 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
153 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
154 |
+
unset($transaction);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
if($response->getData('BeagleVerification')){
|
159 |
+
$beagleVerification = $response->getData('BeagleVerification');
|
160 |
+
}
|
161 |
+
if($response->getData('BeagleScore') && $response->getData('BeagleScore') > 0){
|
162 |
+
$beagleScore = $response->getData('BeagleScore');
|
163 |
+
}
|
164 |
+
if ($editToken || $newToken) {
|
165 |
if ($response->getTokenCustomerID()) {
|
166 |
+
$method = $this->_getQuote()->getPayment()->getMethod();
|
167 |
+
if($method == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE){
|
168 |
+
// Authorize only require to call 2 requests, create token first, then use response to authorize payment
|
169 |
+
$response = $this->_checkout->saveTokenById($response, $editToken);
|
170 |
+
$response = $this->_processPayment($response);
|
171 |
+
}else{
|
172 |
+
// Authorize & Capture using TokenPayment will create request & charge payment in one call request.
|
173 |
+
// Don't need to call processPayment with token id
|
174 |
+
$this->_checkout->saveTokenById($response, $editToken);
|
175 |
+
}
|
176 |
+
if($response->getData('BeagleVerification')){
|
177 |
+
$beagleVerification = $response->getData('BeagleVerification');
|
178 |
+
}
|
179 |
+
if($response->getData('BeagleScore') && $response->getData('BeagleScore') > 0){
|
180 |
+
$beagleScore = $response->getData('BeagleScore');
|
181 |
+
}
|
182 |
} else {
|
183 |
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while making the transaction. Please try again. (Error message: %s)',
|
184 |
$response->getMessage()));
|
187 |
|
188 |
$orderId = null;
|
189 |
if ($response->isSuccess()) {
|
190 |
+
|
191 |
+
// Save fraud information
|
192 |
+
if(is_null($fraudAction)){
|
193 |
+
$fraudAction = $response->getFraudAction();
|
194 |
+
}
|
195 |
+
if(is_null($fraudCodes)){
|
196 |
+
$fraudCodes = $response->getFraudCodes();
|
197 |
+
}
|
198 |
+
if(is_null($captured)){
|
199 |
+
$captured = $response->getTransactionCaptured();
|
200 |
+
}
|
201 |
+
|
202 |
+
$orderId = $this->storeOrder($response, 'success', $beagleScore, $beagleVerification, $fraudAction, $fraudCodes, $captured);
|
203 |
} else {
|
204 |
Mage::throwException(Mage::helper('ewayrapid')->__('Sorry, your payment could not be processed (Message: %s). Please check your details and try again, or try an alternative payment method.',
|
205 |
$response->getMessage()));
|
223 |
* @param string $successType
|
224 |
* @return string
|
225 |
*/
|
226 |
+
private function storeOrder($response, $successType = 'success', $beagleScore, $beagleVerification, $fraudAction, $fraudCodes, $captured)
|
227 |
{
|
228 |
try {
|
229 |
// Clear the basket and save the order (including some info about how the payment went)
|
230 |
$this->getOnepage()->getQuote()->collectTotals();
|
231 |
$payment = $this->getOnepage()->getQuote()->getPayment();
|
232 |
$payment->setAdditionalInformation('successType', $successType);
|
233 |
+
$beagleScore = $beagleScore ? $beagleScore : '';
|
234 |
+
$payment->setBeagleScore($beagleScore);
|
235 |
+
$payment->setBeagleVerification(serialize($beagleVerification));
|
236 |
+
$payment->setFraudAction($fraudAction);
|
237 |
+
$payment->setFraudCodes($fraudCodes);
|
238 |
+
$payment->setTransactionCaptured($captured);
|
239 |
Mage::getSingleton('core/session')->setData('ewayTransactionID', $response->getTransactionID());
|
240 |
$orderId = $this->getOnepage()->saveOrder()->getLastOrderId();
|
241 |
$this->getOnepage()->getQuote()->setIsActive(1);
|
379 |
$cardData = $response->getCustomer();
|
380 |
|
381 |
if ($cardData['CardNumber'] && $cardData['CardName']) {
|
382 |
+
$beagleScore = $response->getBeagleScore();
|
383 |
+
|
384 |
+
// Get Fraud Information
|
385 |
+
if($response->isSuccess()){
|
386 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
387 |
+
if($transaction) {
|
388 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
389 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
390 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
391 |
+
unset($transaction);
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
if ($response->isSuccess()
|
396 |
+
&& Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE
|
397 |
) {
|
398 |
+
$response = $this->_checkout->doAuthorisation($response);
|
399 |
+
|
400 |
+
// Reload Fraud Information
|
401 |
+
if($response->isSuccess()){
|
402 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
403 |
+
if($transaction) {
|
404 |
+
if($transaction[0]['FraudAction']){
|
405 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
406 |
+
}
|
407 |
+
if(Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage'])){
|
408 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
409 |
+
}
|
410 |
+
if($transaction[0]['TransactionCaptured']){
|
411 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
412 |
+
}
|
413 |
+
unset($transaction);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
|
417 |
}
|
418 |
} else {
|
419 |
if (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE) {
|
420 |
$response = $this->_checkout->doAuthorisation($response);
|
421 |
+
|
422 |
+
// Get Fraud Information
|
423 |
+
if($response->isSuccess()){
|
424 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
425 |
+
if($transaction) {
|
426 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
427 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
428 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
429 |
+
unset($transaction);
|
430 |
+
}
|
431 |
+
}
|
432 |
} elseif (Mage::helper('ewayrapid')->getPaymentAction() === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
|
433 |
$response = $this->_checkout->doTransaction($response);
|
434 |
+
|
435 |
+
// Get Fraud Information
|
436 |
+
if($response->isSuccess()){
|
437 |
+
$transaction = $this->_checkout->getTransaction($response['TransactionID']);
|
438 |
+
if($transaction) {
|
439 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
440 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
441 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
442 |
+
unset($transaction);
|
443 |
+
}
|
444 |
+
}
|
445 |
}
|
446 |
}
|
447 |
if (!$response->isSuccess()) {
|
448 |
Mage::throwException(Mage::helper('ewayrapid')->__('Sorry, your payment could not be processed (Message: %s). Please check your details and try again, or try an alternative payment method.',
|
449 |
$response->getMessage()));
|
450 |
}
|
451 |
+
|
452 |
+
if($response->getBeagleScore() === null){
|
453 |
+
$response->setBeagleScore($beagleScore);
|
454 |
+
}
|
455 |
+
$response->setFraudAction($fraudAction);
|
456 |
+
$response->setFraudCodes($fraudCodes);
|
457 |
+
$response->setTransactionCaptured($captured);
|
458 |
return $response;
|
459 |
}
|
460 |
}
|
@@ -17,6 +17,7 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
17 |
protected $savedToken;
|
18 |
protected $cardInfo;
|
19 |
protected $masterPassSavedToken;
|
|
|
20 |
|
21 |
function _getSession()
|
22 |
{
|
@@ -26,7 +27,10 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
26 |
$this->transMethod = Mage::getSingleton('core/session')->getTransparentSaved();
|
27 |
}
|
28 |
|
29 |
-
|
|
|
|
|
|
|
30 |
$this->savedToken = Mage::getSingleton('core/session')->getSavedToken();
|
31 |
}
|
32 |
$this->cardInfo = Mage::getSingleton('core/session')->getCardInfo();
|
@@ -82,11 +86,42 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
82 |
else
|
83 |
$methodData = Eway_Rapid31_Model_Config::METHOD_UPDATE_TOKEN;
|
84 |
}
|
85 |
-
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
$methodData = Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT;
|
87 |
if ($this->helperData()->getPaymentAction() != Eway_Rapid31_Model_Method_Notsaved::ACTION_AUTHORIZE_CAPTURE
|
88 |
&& $this->transMethod != Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD
|
89 |
&& $this->transMethod != Eway_Rapid31_Model_Config::MASTERPASS_METHOD
|
|
|
90 |
)
|
91 |
{
|
92 |
$methodData = Eway_Rapid31_Model_Config::METHOD_AUTHORISE;
|
@@ -99,7 +134,10 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
99 |
Mage::getSingleton('core/session')->setFormActionUrl($data['FormActionURL']);
|
100 |
if (isset($data['CompleteCheckoutURL']))
|
101 |
Mage::getSingleton('core/session')->setCompleteCheckoutURL($data['CompleteCheckoutURL']);
|
102 |
-
if ($this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD
|
|
|
|
|
|
|
103 |
$urlRedirect = Mage::getUrl('ewayrapid/transparent/redirect', array('_secure'=>true)) . '?AccessCode=' . $data['AccessCode'];
|
104 |
} else {
|
105 |
$urlRedirect = Mage::getUrl('ewayrapid/transparent/paynow', array('_secure'=>true)) . '?AccessCode=' . $data['AccessCode'];
|
@@ -125,6 +163,7 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
125 |
echo Mage::getUrl('checkout/cart/');
|
126 |
return;
|
127 |
}
|
|
|
128 |
} catch (Exception $e) {
|
129 |
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later.'));
|
130 |
$this->transparentModel()->unsetSessionData();
|
@@ -186,13 +225,30 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
186 |
$accessCode = $this->getRequest()->getParam('AccessCode');
|
187 |
$order_id = $transactionID = $tokenCustomerID = 0;
|
188 |
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
$dataResult = $this->resultProcess($accessCode);
|
191 |
$transactionID = $dataResult['TransactionID'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
} else {
|
193 |
$transaction = $this->transparentModel()->getTransaction($accessCode);
|
194 |
if($transaction) {
|
195 |
$tokenCustomerID = $transaction && isset($transaction[0]['TokenCustomerID']) ? $transaction[0]['TokenCustomerID'] : null;
|
|
|
|
|
|
|
196 |
unset($transaction);
|
197 |
}
|
198 |
$quote->setTokenCustomerID($tokenCustomerID);
|
@@ -212,18 +268,40 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
212 |
$quote = $this->transparentModel()->doAuthorisation($quote, round($this->_getQuote()->getBaseGrandTotal() * 100));
|
213 |
$transactionID = $quote->getTransactionId();
|
214 |
//$quote = $this->transparentModel()->doCapturePayment($quote, round($this->_getQuote()->getBaseGrandTotal() * 100));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
216 |
}
|
217 |
$quote->setTransactionId($transactionID);
|
218 |
|
219 |
//Save Token
|
220 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
|
223 |
if ($transactionID) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
Mage::getSingleton('core/session')->setTransactionId($transactionID);
|
225 |
//Save order
|
226 |
-
$order_id = $this->storeOrder('success', $transactionID);
|
227 |
}
|
228 |
|
229 |
//unset all session's transaparent
|
@@ -280,6 +358,8 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
280 |
$this->cardInfo['SavedType'] = Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD;
|
281 |
} elseif ($this->transMethod == Eway_Rapid31_Model_Config::MASTERPASS_METHOD) {
|
282 |
$this->cardInfo['SavedType'] = Eway_Rapid31_Model_Config::MASTERPASS_METHOD;
|
|
|
|
|
283 |
}
|
284 |
$this->transparentModel()->addToken($quote, $this->cardInfo, $tokenCustomerID);
|
285 |
} else {
|
@@ -307,7 +387,7 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
307 |
* @param $transactionID
|
308 |
* @return string
|
309 |
*/
|
310 |
-
private function storeOrder($successType = 'success', $transactionID)
|
311 |
{
|
312 |
try {
|
313 |
//Clear the basket and save the order (including some info about how the payment went)
|
@@ -315,6 +395,12 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
315 |
$this->getOnepage()->getQuote()->getPayment()->setTransactionId($transactionID);
|
316 |
$this->getOnepage()->getQuote()->getPayment()->setAdditionalInformation('transactionId', $transactionID);
|
317 |
$this->getOnepage()->getQuote()->getPayment()->setAdditionalInformation('successType', $successType);
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
Mage::getSingleton('core/session')->setData('transparentCheckout', true);
|
319 |
$orderId = $this->getOnepage()->saveOrder()->getLastOrderId();
|
320 |
|
@@ -467,4 +553,5 @@ class Eway_Rapid31_TransparentController extends Mage_Checkout_OnepageController
|
|
467 |
{
|
468 |
return Mage::getSingleton('checkout/type_onepage');
|
469 |
}
|
|
|
470 |
}
|
17 |
protected $savedToken;
|
18 |
protected $cardInfo;
|
19 |
protected $masterPassSavedToken;
|
20 |
+
protected $saveCard;
|
21 |
|
22 |
function _getSession()
|
23 |
{
|
27 |
$this->transMethod = Mage::getSingleton('core/session')->getTransparentSaved();
|
28 |
}
|
29 |
|
30 |
+
$this->saveCard = Mage::getSingleton('core/session')->getSaveCard();
|
31 |
+
|
32 |
+
if ($this->methodPayment == Eway_Rapid31_Model_Config::PAYMENT_SAVED_METHOD
|
33 |
+
|| $this->methodPayment == Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD) {
|
34 |
$this->savedToken = Mage::getSingleton('core/session')->getSavedToken();
|
35 |
}
|
36 |
$this->cardInfo = Mage::getSingleton('core/session')->getCardInfo();
|
86 |
else
|
87 |
$methodData = Eway_Rapid31_Model_Config::METHOD_UPDATE_TOKEN;
|
88 |
}
|
89 |
+
} else if($this->methodPayment == Eway_Rapid31_Model_Config::PAYMENT_EWAYONE_METHOD) {
|
90 |
+
if($visaCheckout = $this->getRequest()->getParam('visa_checkout_call_id')){
|
91 |
+
if($visaCheckout && $visaCheckout != ""){
|
92 |
+
Mage::getSingleton('core/session')->setData('visa_checkout_call_id', $visaCheckout);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
$methodData = Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT;
|
96 |
+
|
97 |
+
if ($this->helperData()->getPaymentAction() != Eway_Rapid31_Model_Method_Notsaved::ACTION_AUTHORIZE_CAPTURE
|
98 |
+
// && $this->transMethod != Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD
|
99 |
+
// && $this->transMethod != Eway_Rapid31_Model_Config::MASTERPASS_METHOD
|
100 |
+
// && $this->transMethod != Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD
|
101 |
+
)
|
102 |
+
{
|
103 |
+
$methodData = Eway_Rapid31_Model_Config::METHOD_AUTHORISE;
|
104 |
+
}
|
105 |
+
|
106 |
+
if ($this->saveCard || ($this->savedToken && is_numeric($this->savedToken))) {
|
107 |
+
$methodData = Eway_Rapid31_Model_Config::METHOD_TOKEN_PAYMENT;
|
108 |
+
}
|
109 |
+
|
110 |
+
//Authorize Only
|
111 |
+
if ($this->helperData()->getPaymentAction() != Eway_Rapid31_Model_Method_Notsaved::ACTION_AUTHORIZE_CAPTURE
|
112 |
+
|| $this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD
|
113 |
+
) {
|
114 |
+
if ($this->savedToken && $this->savedToken == Eway_Rapid31_Model_Config::TOKEN_NEW && $this->saveCard)
|
115 |
+
$methodData = Eway_Rapid31_Model_Config::METHOD_CREATE_TOKEN;
|
116 |
+
else if ($this->savedToken && is_numeric($this->savedToken))
|
117 |
+
$methodData = Eway_Rapid31_Model_Config::METHOD_UPDATE_TOKEN;
|
118 |
+
}
|
119 |
+
} else{
|
120 |
$methodData = Eway_Rapid31_Model_Config::METHOD_PROCESS_PAYMENT;
|
121 |
if ($this->helperData()->getPaymentAction() != Eway_Rapid31_Model_Method_Notsaved::ACTION_AUTHORIZE_CAPTURE
|
122 |
&& $this->transMethod != Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD
|
123 |
&& $this->transMethod != Eway_Rapid31_Model_Config::MASTERPASS_METHOD
|
124 |
+
&& $this->transMethod != Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD
|
125 |
)
|
126 |
{
|
127 |
$methodData = Eway_Rapid31_Model_Config::METHOD_AUTHORISE;
|
134 |
Mage::getSingleton('core/session')->setFormActionUrl($data['FormActionURL']);
|
135 |
if (isset($data['CompleteCheckoutURL']))
|
136 |
Mage::getSingleton('core/session')->setCompleteCheckoutURL($data['CompleteCheckoutURL']);
|
137 |
+
if ($this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD
|
138 |
+
|| $this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_EXPRESS_METHOD
|
139 |
+
|| $this->transMethod == Eway_Rapid31_Model_Config::MASTERPASS_METHOD
|
140 |
+
|| $this->transMethod == Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD) {
|
141 |
$urlRedirect = Mage::getUrl('ewayrapid/transparent/redirect', array('_secure'=>true)) . '?AccessCode=' . $data['AccessCode'];
|
142 |
} else {
|
143 |
$urlRedirect = Mage::getUrl('ewayrapid/transparent/paynow', array('_secure'=>true)) . '?AccessCode=' . $data['AccessCode'];
|
163 |
echo Mage::getUrl('checkout/cart/');
|
164 |
return;
|
165 |
}
|
166 |
+
//
|
167 |
} catch (Exception $e) {
|
168 |
Mage::getSingleton('core/session')->addError(Mage::helper('ewayrapid')->__('An error occurred while connecting to payment gateway. Please try again later.'));
|
169 |
$this->transparentModel()->unsetSessionData();
|
225 |
$accessCode = $this->getRequest()->getParam('AccessCode');
|
226 |
$order_id = $transactionID = $tokenCustomerID = 0;
|
227 |
|
228 |
+
$fraudAction = '';
|
229 |
+
$fraudCodes = '';
|
230 |
+
|
231 |
+
if ($this->methodPayment == 'ewayrapid_notsaved'
|
232 |
+
|| ($this->methodPayment == 'ewayrapid_ewayone' && !$this->saveCard
|
233 |
+
&& (!$this->savedToken || !is_numeric($this->savedToken)))
|
234 |
+
) {
|
235 |
$dataResult = $this->resultProcess($accessCode);
|
236 |
$transactionID = $dataResult['TransactionID'];
|
237 |
+
|
238 |
+
$transaction = $this->transparentModel()->getTransaction($transactionID);
|
239 |
+
if($transaction) {
|
240 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
241 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
242 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
243 |
+
unset($transaction);
|
244 |
+
}
|
245 |
} else {
|
246 |
$transaction = $this->transparentModel()->getTransaction($accessCode);
|
247 |
if($transaction) {
|
248 |
$tokenCustomerID = $transaction && isset($transaction[0]['TokenCustomerID']) ? $transaction[0]['TokenCustomerID'] : null;
|
249 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
250 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
251 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
252 |
unset($transaction);
|
253 |
}
|
254 |
$quote->setTokenCustomerID($tokenCustomerID);
|
268 |
$quote = $this->transparentModel()->doAuthorisation($quote, round($this->_getQuote()->getBaseGrandTotal() * 100));
|
269 |
$transactionID = $quote->getTransactionId();
|
270 |
//$quote = $this->transparentModel()->doCapturePayment($quote, round($this->_getQuote()->getBaseGrandTotal() * 100));
|
271 |
+
|
272 |
+
// Reload fraud information after do authorisation
|
273 |
+
$transaction = $this->transparentModel()->getTransaction($transactionID);
|
274 |
+
if($transaction) {
|
275 |
+
$fraudAction = $transaction[0]['FraudAction'];
|
276 |
+
$fraudCodes = Mage::helper('ewayrapid')->getFraudCodes($transaction[0]['ResponseMessage']);
|
277 |
+
$captured = $transaction[0]['TransactionCaptured'];
|
278 |
+
unset($transaction);
|
279 |
+
}
|
280 |
}
|
281 |
}
|
282 |
$quote->setTransactionId($transactionID);
|
283 |
|
284 |
//Save Token
|
285 |
+
if($this->methodPayment == 'ewayrapid_saved'){
|
286 |
+
$this->saveToken($quote, $tokenCustomerID);
|
287 |
+
} elseif($this->methodPayment == 'ewayrapid_ewayone' && $this->saveCard) {
|
288 |
+
$this->saveToken($quote, $tokenCustomerID);
|
289 |
+
}
|
290 |
+
|
291 |
}
|
292 |
|
293 |
if ($transactionID) {
|
294 |
+
//Add Beagle Information
|
295 |
+
if (isset($dataResult)) {
|
296 |
+
$beagleScore = $dataResult->getBeagleScore();
|
297 |
+
$beagleVerification = $dataResult->getBeagleVerification();
|
298 |
+
}else{
|
299 |
+
$beagleScore = $quote->getBeagleScore();
|
300 |
+
$beagleVerification = $quote->getBeagleVerification();
|
301 |
+
}
|
302 |
Mage::getSingleton('core/session')->setTransactionId($transactionID);
|
303 |
//Save order
|
304 |
+
$order_id = $this->storeOrder('success', $transactionID, $beagleScore, $beagleVerification, $fraudAction, $fraudCodes, $captured);
|
305 |
}
|
306 |
|
307 |
//unset all session's transaparent
|
358 |
$this->cardInfo['SavedType'] = Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD;
|
359 |
} elseif ($this->transMethod == Eway_Rapid31_Model_Config::MASTERPASS_METHOD) {
|
360 |
$this->cardInfo['SavedType'] = Eway_Rapid31_Model_Config::MASTERPASS_METHOD;
|
361 |
+
} elseif ($this->transMethod == Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD) {
|
362 |
+
$this->cardInfo['SavedType'] = Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD;
|
363 |
}
|
364 |
$this->transparentModel()->addToken($quote, $this->cardInfo, $tokenCustomerID);
|
365 |
} else {
|
387 |
* @param $transactionID
|
388 |
* @return string
|
389 |
*/
|
390 |
+
private function storeOrder($successType = 'success', $transactionID, $beagleScore, $beagleVerification, $fraudAction, $fraudCodes, $captured)
|
391 |
{
|
392 |
try {
|
393 |
//Clear the basket and save the order (including some info about how the payment went)
|
395 |
$this->getOnepage()->getQuote()->getPayment()->setTransactionId($transactionID);
|
396 |
$this->getOnepage()->getQuote()->getPayment()->setAdditionalInformation('transactionId', $transactionID);
|
397 |
$this->getOnepage()->getQuote()->getPayment()->setAdditionalInformation('successType', $successType);
|
398 |
+
$beagleScore = $beagleScore && ($beagleScore > 0) ? $beagleScore : '';
|
399 |
+
$this->getOnepage()->getQuote()->getPayment()->setBeagleScore($beagleScore);
|
400 |
+
$this->getOnepage()->getQuote()->getPayment()->setBeagleVerification(serialize($beagleVerification));
|
401 |
+
$this->getOnepage()->getQuote()->getPayment()->setFraudAction($fraudAction);
|
402 |
+
$this->getOnepage()->getQuote()->getPayment()->setFraudCodes($fraudCodes);
|
403 |
+
$this->getOnepage()->getQuote()->getPayment()->setTransactionCaptured($captured);
|
404 |
Mage::getSingleton('core/session')->setData('transparentCheckout', true);
|
405 |
$orderId = $this->getOnepage()->saveOrder()->getLastOrderId();
|
406 |
|
553 |
{
|
554 |
return Mage::getSingleton('checkout/type_onepage');
|
555 |
}
|
556 |
+
|
557 |
}
|
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Eway_Rapid31>
|
5 |
-
<version>1.
|
6 |
</Eway_Rapid31>
|
7 |
</modules>
|
8 |
<global>
|
@@ -23,6 +23,7 @@
|
|
23 |
<adminhtml>
|
24 |
<rewrite>
|
25 |
<sales_order_grid>Eway_Rapid31_Block_Sales_Order_Grid</sales_order_grid>
|
|
|
26 |
</rewrite>
|
27 |
</adminhtml>
|
28 |
</blocks>
|
@@ -36,6 +37,7 @@
|
|
36 |
<ewayrapid_setup>
|
37 |
<setup>
|
38 |
<module>Eway_Rapid31</module>
|
|
|
39 |
</setup>
|
40 |
</ewayrapid_setup>
|
41 |
</resources>
|
@@ -60,6 +62,42 @@
|
|
60 |
</types>
|
61 |
</cc>
|
62 |
</payment>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
</global>
|
64 |
<frontend>
|
65 |
<translate>
|
@@ -220,6 +258,7 @@
|
|
220 |
<args>
|
221 |
<modules>
|
222 |
<eway_rapid31_adminhtml after="Mage_Adminhtml">Eway_Rapid31_Adminhtml</eway_rapid31_adminhtml>
|
|
|
223 |
</modules>
|
224 |
</args>
|
225 |
</adminhtml>
|
@@ -261,6 +300,17 @@
|
|
261 |
</children>
|
262 |
</system>
|
263 |
</menu>-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
</adminhtml>
|
265 |
<default>
|
266 |
<payment>
|
@@ -293,7 +343,13 @@
|
|
293 |
<active>0</active>
|
294 |
<title>Credit Card - eWAY (saved)</title>
|
295 |
</ewayrapid_saved>
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
</payment>
|
298 |
</default>
|
299 |
<phpunit>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Eway_Rapid31>
|
5 |
+
<version>1.4.0</version>
|
6 |
</Eway_Rapid31>
|
7 |
</modules>
|
8 |
<global>
|
23 |
<adminhtml>
|
24 |
<rewrite>
|
25 |
<sales_order_grid>Eway_Rapid31_Block_Sales_Order_Grid</sales_order_grid>
|
26 |
+
<page_head>Eway_Rapid31_Block_Html_Head</page_head>
|
27 |
</rewrite>
|
28 |
</adminhtml>
|
29 |
</blocks>
|
37 |
<ewayrapid_setup>
|
38 |
<setup>
|
39 |
<module>Eway_Rapid31</module>
|
40 |
+
<class>Eway_Rapid31_Model_Resource_Setup</class>
|
41 |
</setup>
|
42 |
</ewayrapid_setup>
|
43 |
</resources>
|
62 |
</types>
|
63 |
</cc>
|
64 |
</payment>
|
65 |
+
<fieldsets>
|
66 |
+
<sales_convert_quote_payment>
|
67 |
+
<fraud_action>
|
68 |
+
<to_order_payment>*</to_order_payment>
|
69 |
+
</fraud_action>
|
70 |
+
<fraud_codes>
|
71 |
+
<to_order_payment>*</to_order_payment>
|
72 |
+
</fraud_codes>
|
73 |
+
<transaction_captured>
|
74 |
+
<to_order_payment>*</to_order_payment>
|
75 |
+
</transaction_captured>
|
76 |
+
<beagle_score>
|
77 |
+
<to_order_payment>*</to_order_payment>
|
78 |
+
</beagle_score>
|
79 |
+
<beagle_verification>
|
80 |
+
<to_order_payment>*</to_order_payment>
|
81 |
+
</beagle_verification>
|
82 |
+
</sales_convert_quote_payment>
|
83 |
+
<sales_convert_order_payment>
|
84 |
+
<fraud_action>
|
85 |
+
<to_quote_payment>*</to_quote_payment>
|
86 |
+
</fraud_action>
|
87 |
+
<fraud_codes>
|
88 |
+
<to_order_payment>*</to_order_payment>
|
89 |
+
</fraud_codes>
|
90 |
+
<transaction_captured>
|
91 |
+
<to_order_payment>*</to_order_payment>
|
92 |
+
</transaction_captured>
|
93 |
+
<beagle_score>
|
94 |
+
<to_order_payment>*</to_order_payment>
|
95 |
+
</beagle_score>
|
96 |
+
<beagle_verification>
|
97 |
+
<to_order_payment>*</to_order_payment>
|
98 |
+
</beagle_verification>
|
99 |
+
</sales_convert_order_payment>
|
100 |
+
</fieldsets>
|
101 |
</global>
|
102 |
<frontend>
|
103 |
<translate>
|
258 |
<args>
|
259 |
<modules>
|
260 |
<eway_rapid31_adminhtml after="Mage_Adminhtml">Eway_Rapid31_Adminhtml</eway_rapid31_adminhtml>
|
261 |
+
<eway_rapid31 before="-">Eway_Rapid31_Adminhtml</eway_rapid31>
|
262 |
</modules>
|
263 |
</args>
|
264 |
</adminhtml>
|
300 |
</children>
|
301 |
</system>
|
302 |
</menu>-->
|
303 |
+
<menu>
|
304 |
+
<sales>
|
305 |
+
<children>
|
306 |
+
<eway_orders>
|
307 |
+
<title>eWAY</title>
|
308 |
+
<action>adminhtml/ewayadmin/ewayorders</action>
|
309 |
+
<sort_order>100</sort_order>
|
310 |
+
</eway_orders>
|
311 |
+
</children>
|
312 |
+
</sales>
|
313 |
+
</menu>
|
314 |
</adminhtml>
|
315 |
<default>
|
316 |
<payment>
|
343 |
<active>0</active>
|
344 |
<title>Credit Card - eWAY (saved)</title>
|
345 |
</ewayrapid_saved>
|
346 |
+
<ewayrapid_ewayone>
|
347 |
+
<model>ewayrapid/method_ewayone</model>
|
348 |
+
<active>0</active>
|
349 |
+
<title>Credit Card - eWAY</title>
|
350 |
+
<save_card>1</save_card>
|
351 |
+
<save_text>Save my details</save_text>
|
352 |
+
</ewayrapid_ewayone>
|
353 |
</payment>
|
354 |
</default>
|
355 |
<phpunit>
|
@@ -133,13 +133,49 @@
|
|
133 |
<sort_order>100</sort_order>
|
134 |
</connection_type>
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
<enable_masterpass translate="label">
|
137 |
<label>Enable MasterPass</label>
|
138 |
<frontend_type>select</frontend_type>
|
139 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
140 |
<show_in_default>1</show_in_default>
|
141 |
<show_in_website>1</show_in_website>
|
142 |
-
<sort_order>
|
143 |
<depends>
|
144 |
<connection_type>transparent</connection_type>
|
145 |
</depends>
|
@@ -150,11 +186,33 @@
|
|
150 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
151 |
<show_in_default>1</show_in_default>
|
152 |
<show_in_website>1</show_in_website>
|
153 |
-
<sort_order>
|
154 |
<depends>
|
155 |
<connection_type>transparent</connection_type>
|
156 |
</depends>
|
157 |
</enable_paypal_standard>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
<!--<enable_paypal_checkout translate="label">-->
|
159 |
<!--<label>Enable PayPal Express Checkout</label>-->
|
160 |
<!--<frontend_type>select</frontend_type>-->
|
@@ -177,7 +235,7 @@
|
|
177 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
178 |
<show_in_default>1</show_in_default>
|
179 |
<show_in_website>1</show_in_website>
|
180 |
-
<sort_order>
|
181 |
<depends>
|
182 |
<connection_type>transparent</connection_type>
|
183 |
</depends>
|
@@ -319,50 +377,70 @@
|
|
319 |
<show_in_website>1</show_in_website>
|
320 |
<sort_order>200</sort_order>
|
321 |
</transfer_cart_items>
|
322 |
-
|
323 |
-
|
|
|
324 |
<frontend_type>select</frontend_type>
|
325 |
-
<source_model>
|
326 |
<show_in_default>1</show_in_default>
|
327 |
<show_in_website>1</show_in_website>
|
328 |
-
<sort_order>
|
329 |
-
</
|
330 |
|
331 |
-
<
|
332 |
-
<label>
|
333 |
-
<
|
|
|
334 |
<show_in_default>1</show_in_default>
|
335 |
<show_in_website>1</show_in_website>
|
336 |
-
<
|
337 |
-
|
338 |
-
|
339 |
-
<
|
340 |
-
<label>
|
341 |
<frontend_type>select</frontend_type>
|
342 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
343 |
<show_in_default>1</show_in_default>
|
344 |
<show_in_website>1</show_in_website>
|
345 |
-
<sort_order>
|
346 |
-
</
|
347 |
-
<billing_agreement_title translate="label">
|
348 |
-
<label>Title</label>
|
349 |
-
<frontend_type>text</frontend_type>
|
350 |
-
<show_in_default>1</show_in_default>
|
351 |
-
<show_in_website>1</show_in_website>
|
352 |
-
<show_in_store>1</show_in_store>
|
353 |
-
<sort_order>260</sort_order>
|
354 |
-
</billing_agreement_title>
|
355 |
-
<billing_agreement_sort_order translate="label">
|
356 |
-
<label>Sort Order</label>
|
357 |
-
<frontend_type>text</frontend_type>
|
358 |
-
<show_in_default>1</show_in_default>
|
359 |
-
<show_in_website>1</show_in_website>
|
360 |
-
<sort_order>270</sort_order>
|
361 |
-
</billing_agreement_sort_order>
|
362 |
</fields>
|
363 |
</ewayrapid_general>
|
364 |
-
|
365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
<frontend_type>text</frontend_type>
|
367 |
<sort_order>201</sort_order>
|
368 |
<show_in_default>1</show_in_default>
|
@@ -385,44 +463,30 @@
|
|
385 |
<show_in_store>1</show_in_store>
|
386 |
<sort_order>20</sort_order>
|
387 |
</title>
|
388 |
-
<
|
389 |
-
<label>
|
390 |
-
<frontend_type>
|
|
|
391 |
<show_in_default>1</show_in_default>
|
392 |
<show_in_website>1</show_in_website>
|
393 |
<sort_order>30</sort_order>
|
394 |
-
</
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
<active>
|
406 |
-
<label>Enabled</label>
|
407 |
<frontend_type>select</frontend_type>
|
408 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
409 |
<show_in_default>1</show_in_default>
|
410 |
<show_in_website>1</show_in_website>
|
411 |
-
<sort_order>
|
412 |
-
|
413 |
-
<![CDATA[
|
414 |
-
eWAY Rapid 3.1 (Saved) will only display to logged in customers
|
415 |
-
]]>
|
416 |
-
</comment>
|
417 |
-
</active>
|
418 |
-
<title>
|
419 |
-
<label>Title</label>
|
420 |
-
<frontend_type>text</frontend_type>
|
421 |
-
<show_in_default>1</show_in_default>
|
422 |
-
<show_in_website>1</show_in_website>
|
423 |
-
<show_in_store>1</show_in_store>
|
424 |
-
<sort_order>20</sort_order>
|
425 |
-
</title>
|
426 |
<sort_order>
|
427 |
<label>Sort Order</label>
|
428 |
<frontend_type>text</frontend_type>
|
@@ -431,7 +495,46 @@
|
|
431 |
<sort_order>30</sort_order>
|
432 |
</sort_order>
|
433 |
</fields>
|
434 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
</groups>
|
436 |
</payment>
|
437 |
</sections>
|
133 |
<sort_order>100</sort_order>
|
134 |
</connection_type>
|
135 |
|
136 |
+
<custom_view translate="label">
|
137 |
+
<label>Shared Page Theme</label>
|
138 |
+
<frontend_type>select</frontend_type>
|
139 |
+
<source_model>ewayrapid/system_config_source_customView</source_model>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>1</show_in_website>
|
142 |
+
<sort_order>103</sort_order>
|
143 |
+
<depends>
|
144 |
+
<connection_type>sharedpage</connection_type>
|
145 |
+
</depends>
|
146 |
+
</custom_view>
|
147 |
+
|
148 |
+
<beagle_verify_email translate="label">
|
149 |
+
<label>Beagle Verify Email</label>
|
150 |
+
<frontend_type>select</frontend_type>
|
151 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
152 |
+
<show_in_default>1</show_in_default>
|
153 |
+
<show_in_website>1</show_in_website>
|
154 |
+
<sort_order>101</sort_order>
|
155 |
+
<depends>
|
156 |
+
<connection_type>sharedpage</connection_type>
|
157 |
+
</depends>
|
158 |
+
</beagle_verify_email>
|
159 |
+
|
160 |
+
<beagle_verify_phone translate="label">
|
161 |
+
<label>Beagle Verify Phone</label>
|
162 |
+
<frontend_type>select</frontend_type>
|
163 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
164 |
+
<show_in_default>1</show_in_default>
|
165 |
+
<show_in_website>1</show_in_website>
|
166 |
+
<sort_order>102</sort_order>
|
167 |
+
<depends>
|
168 |
+
<connection_type>sharedpage</connection_type>
|
169 |
+
</depends>
|
170 |
+
</beagle_verify_phone>
|
171 |
+
|
172 |
<enable_masterpass translate="label">
|
173 |
<label>Enable MasterPass</label>
|
174 |
<frontend_type>select</frontend_type>
|
175 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
176 |
<show_in_default>1</show_in_default>
|
177 |
<show_in_website>1</show_in_website>
|
178 |
+
<sort_order>104</sort_order>
|
179 |
<depends>
|
180 |
<connection_type>transparent</connection_type>
|
181 |
</depends>
|
186 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
187 |
<show_in_default>1</show_in_default>
|
188 |
<show_in_website>1</show_in_website>
|
189 |
+
<sort_order>105</sort_order>
|
190 |
<depends>
|
191 |
<connection_type>transparent</connection_type>
|
192 |
</depends>
|
193 |
</enable_paypal_standard>
|
194 |
+
<enable_visa_checkout translate="label">
|
195 |
+
<label>Enable Visa Checkout</label>
|
196 |
+
<frontend_type>select</frontend_type>
|
197 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
198 |
+
<show_in_default>1</show_in_default>
|
199 |
+
<show_in_website>1</show_in_website>
|
200 |
+
<sort_order>106</sort_order>
|
201 |
+
<depends>
|
202 |
+
<connection_type>transparent</connection_type>
|
203 |
+
</depends>
|
204 |
+
</enable_visa_checkout>
|
205 |
+
<visa_checkout_api_key translate="label">
|
206 |
+
<label>Visa Checkout Api Key</label>
|
207 |
+
<frontend_type>obscure</frontend_type>
|
208 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<sort_order>107</sort_order>
|
212 |
+
<depends>
|
213 |
+
<connection_type>transparent</connection_type>
|
214 |
+
</depends>
|
215 |
+
</visa_checkout_api_key>
|
216 |
<!--<enable_paypal_checkout translate="label">-->
|
217 |
<!--<label>Enable PayPal Express Checkout</label>-->
|
218 |
<!--<frontend_type>select</frontend_type>-->
|
235 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
236 |
<show_in_default>1</show_in_default>
|
237 |
<show_in_website>1</show_in_website>
|
238 |
+
<sort_order>106</sort_order>
|
239 |
<depends>
|
240 |
<connection_type>transparent</connection_type>
|
241 |
</depends>
|
377 |
<show_in_website>1</show_in_website>
|
378 |
<sort_order>200</sort_order>
|
379 |
</transfer_cart_items>
|
380 |
+
|
381 |
+
<invoice_description translate="label">
|
382 |
+
<label>Invoice Description</label>
|
383 |
<frontend_type>select</frontend_type>
|
384 |
+
<source_model>ewayrapid/system_config_source_noYes</source_model>
|
385 |
<show_in_default>1</show_in_default>
|
386 |
<show_in_website>1</show_in_website>
|
387 |
+
<sort_order>201</sort_order>
|
388 |
+
</invoice_description>
|
389 |
|
390 |
+
<guess_order translate="label">
|
391 |
+
<label>Guess next order #</label>
|
392 |
+
<frontend_type>select</frontend_type>
|
393 |
+
<source_model>ewayrapid/system_config_source_noYes</source_model>
|
394 |
<show_in_default>1</show_in_default>
|
395 |
<show_in_website>1</show_in_website>
|
396 |
+
<sort_order>202</sort_order>
|
397 |
+
</guess_order>
|
398 |
+
|
399 |
+
<debug translate="label">
|
400 |
+
<label>Debug</label>
|
401 |
<frontend_type>select</frontend_type>
|
402 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
403 |
<show_in_default>1</show_in_default>
|
404 |
<show_in_website>1</show_in_website>
|
405 |
+
<sort_order>230</sort_order>
|
406 |
+
</debug>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
</fields>
|
408 |
</ewayrapid_general>
|
409 |
+
<!--<ewayrapid_notsaved>-->
|
410 |
+
<!--<label>eWAY Rapid 3.1 (Not Saved)</label>-->
|
411 |
+
<!--<frontend_type>text</frontend_type>-->
|
412 |
+
<!--<sort_order>201</sort_order>-->
|
413 |
+
<!--<show_in_default>1</show_in_default>-->
|
414 |
+
<!--<show_in_website>1</show_in_website>-->
|
415 |
+
<!--<show_in_store>1</show_in_store>-->
|
416 |
+
<!--<fields>-->
|
417 |
+
<!--<active>-->
|
418 |
+
<!--<label>Enabled</label>-->
|
419 |
+
<!--<frontend_type>select</frontend_type>-->
|
420 |
+
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
421 |
+
<!--<show_in_default>1</show_in_default>-->
|
422 |
+
<!--<show_in_website>1</show_in_website>-->
|
423 |
+
<!--<sort_order>10</sort_order>-->
|
424 |
+
<!--</active>-->
|
425 |
+
<!--<title>-->
|
426 |
+
<!--<label>Title</label>-->
|
427 |
+
<!--<frontend_type>text</frontend_type>-->
|
428 |
+
<!--<show_in_default>1</show_in_default>-->
|
429 |
+
<!--<show_in_website>1</show_in_website>-->
|
430 |
+
<!--<show_in_store>1</show_in_store>-->
|
431 |
+
<!--<sort_order>20</sort_order>-->
|
432 |
+
<!--</title>-->
|
433 |
+
<!--<sort_order>-->
|
434 |
+
<!--<label>Sort Order</label>-->
|
435 |
+
<!--<frontend_type>text</frontend_type>-->
|
436 |
+
<!--<show_in_default>1</show_in_default>-->
|
437 |
+
<!--<show_in_website>1</show_in_website>-->
|
438 |
+
<!--<sort_order>30</sort_order>-->
|
439 |
+
<!--</sort_order>-->
|
440 |
+
<!--</fields>-->
|
441 |
+
<!--</ewayrapid_notsaved>-->
|
442 |
+
<ewayrapid_ewayone>
|
443 |
+
<label>eWAY Rapid 3.1</label>
|
444 |
<frontend_type>text</frontend_type>
|
445 |
<sort_order>201</sort_order>
|
446 |
<show_in_default>1</show_in_default>
|
463 |
<show_in_store>1</show_in_store>
|
464 |
<sort_order>20</sort_order>
|
465 |
</title>
|
466 |
+
<save_card>
|
467 |
+
<label>Save Card</label>
|
468 |
+
<frontend_type>select</frontend_type>
|
469 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
470 |
<show_in_default>1</show_in_default>
|
471 |
<show_in_website>1</show_in_website>
|
472 |
<sort_order>30</sort_order>
|
473 |
+
</save_card>
|
474 |
+
<save_text>
|
475 |
+
<label>Save Card Label</label>
|
476 |
+
<frontend_type>text</frontend_type>
|
477 |
+
<show_in_default>1</show_in_default>
|
478 |
+
<show_in_website>1</show_in_website>
|
479 |
+
<show_in_store>1</show_in_store>
|
480 |
+
<sort_order>40</sort_order>
|
481 |
+
</save_text>
|
482 |
+
<save_card_checked>
|
483 |
+
<label>Default check</label>
|
|
|
|
|
484 |
<frontend_type>select</frontend_type>
|
485 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
486 |
<show_in_default>1</show_in_default>
|
487 |
<show_in_website>1</show_in_website>
|
488 |
+
<sort_order>50</sort_order>
|
489 |
+
</save_card_checked>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
<sort_order>
|
491 |
<label>Sort Order</label>
|
492 |
<frontend_type>text</frontend_type>
|
495 |
<sort_order>30</sort_order>
|
496 |
</sort_order>
|
497 |
</fields>
|
498 |
+
|
499 |
+
</ewayrapid_ewayone>
|
500 |
+
<!--<ewayrapid_saved>-->
|
501 |
+
<!--<label>eWAY Rapid 3.1 (Saved)</label>-->
|
502 |
+
<!--<frontend_type>text</frontend_type>-->
|
503 |
+
<!--<sort_order>202</sort_order>-->
|
504 |
+
<!--<show_in_default>1</show_in_default>-->
|
505 |
+
<!--<show_in_website>1</show_in_website>-->
|
506 |
+
<!--<show_in_store>1</show_in_store>-->
|
507 |
+
<!--<fields>-->
|
508 |
+
<!--<active>-->
|
509 |
+
<!--<label>Enabled</label>-->
|
510 |
+
<!--<frontend_type>select</frontend_type>-->
|
511 |
+
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
512 |
+
<!--<show_in_default>1</show_in_default>-->
|
513 |
+
<!--<show_in_website>1</show_in_website>-->
|
514 |
+
<!--<sort_order>10</sort_order>-->
|
515 |
+
<!--<comment>-->
|
516 |
+
<!--<![CDATA[-->
|
517 |
+
<!--eWAY Rapid 3.1 (Saved) will only display to logged in customers-->
|
518 |
+
<!--]]>-->
|
519 |
+
<!--</comment>-->
|
520 |
+
<!--</active>-->
|
521 |
+
<!--<title>-->
|
522 |
+
<!--<label>Title</label>-->
|
523 |
+
<!--<frontend_type>text</frontend_type>-->
|
524 |
+
<!--<show_in_default>1</show_in_default>-->
|
525 |
+
<!--<show_in_website>1</show_in_website>-->
|
526 |
+
<!--<show_in_store>1</show_in_store>-->
|
527 |
+
<!--<sort_order>20</sort_order>-->
|
528 |
+
<!--</title>-->
|
529 |
+
<!--<sort_order>-->
|
530 |
+
<!--<label>Sort Order</label>-->
|
531 |
+
<!--<frontend_type>text</frontend_type>-->
|
532 |
+
<!--<show_in_default>1</show_in_default>-->
|
533 |
+
<!--<show_in_website>1</show_in_website>-->
|
534 |
+
<!--<sort_order>30</sort_order>-->
|
535 |
+
<!--</sort_order>-->
|
536 |
+
<!--</fields>-->
|
537 |
+
<!--</ewayrapid_saved>-->
|
538 |
</groups>
|
539 |
</payment>
|
540 |
</sections>
|
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$setup = Mage::getResourceModel('customer/setup', 'core_setup');
|
8 |
-
|
9 |
-
$setup->addAttribute('customer', 'saved_tokens_json', array(
|
10 |
-
'input' => '',
|
11 |
-
'type' => 'text',
|
12 |
-
'label' => '',
|
13 |
-
'visible' => '0',
|
14 |
-
'required' => '0',
|
15 |
-
'user_defined' => '0',
|
16 |
-
'backend' => 'ewayrapid/backend_savedtokens',
|
17 |
-
));
|
18 |
-
|
19 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$setup = Mage::getResourceModel('customer/setup', 'core_setup');
|
8 |
+
|
9 |
+
$setup->addAttribute('customer', 'saved_tokens_json', array(
|
10 |
+
'input' => '',
|
11 |
+
'type' => 'text',
|
12 |
+
'label' => '',
|
13 |
+
'visible' => '0',
|
14 |
+
'required' => '0',
|
15 |
+
'user_defined' => '0',
|
16 |
+
'backend' => 'ewayrapid/backend_savedtokens',
|
17 |
+
));
|
18 |
+
|
19 |
$installer->endSetup();
|
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
Mage::getModel('sales/order_status')
|
8 |
-
->setStatus(Eway_Rapid31_Model_Config::ORDER_STATUS_AUTHORISED)
|
9 |
-
->setLabel('eWAY Authorised')
|
10 |
-
->assignState('processing')
|
11 |
-
->save();
|
12 |
-
|
13 |
-
Mage::getModel('sales/order_status')
|
14 |
-
->setStatus(Eway_Rapid31_Model_Config::ORDER_STATUS_CAPTURED)
|
15 |
-
->setLabel('eWAY Captured')
|
16 |
-
->assignState('processing')
|
17 |
-
->save();
|
18 |
-
|
19 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
Mage::getModel('sales/order_status')
|
8 |
+
->setStatus(Eway_Rapid31_Model_Config::ORDER_STATUS_AUTHORISED)
|
9 |
+
->setLabel('eWAY Authorised')
|
10 |
+
->assignState('processing')
|
11 |
+
->save();
|
12 |
+
|
13 |
+
Mage::getModel('sales/order_status')
|
14 |
+
->setStatus(Eway_Rapid31_Model_Config::ORDER_STATUS_CAPTURED)
|
15 |
+
->setLabel('eWAY Captured')
|
16 |
+
->assignState('processing')
|
17 |
+
->save();
|
18 |
+
|
19 |
$installer->endSetup();
|
@@ -1,41 +1,41 @@
|
|
1 |
-
<?php
|
2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->getConnection()
|
8 |
-
->addColumn($installer->getTable('sales/order'),
|
9 |
-
'eway_transaction_id',
|
10 |
-
array(
|
11 |
-
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
12 |
-
'length' => 50,
|
13 |
-
'nullable' => true,
|
14 |
-
'comment' => 'eWAY Transaction ID'
|
15 |
-
)
|
16 |
-
);
|
17 |
-
|
18 |
-
$installer->getConnection()
|
19 |
-
->addColumn($installer->getTable('sales/quote'),
|
20 |
-
'transaction_id',
|
21 |
-
array(
|
22 |
-
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
23 |
-
'length' => 50,
|
24 |
-
'nullable' => true,
|
25 |
-
'comment' => 'eWAY Transaction ID'
|
26 |
-
)
|
27 |
-
);
|
28 |
-
|
29 |
-
$setup = Mage::getResourceModel('customer/setup', 'core_setup');
|
30 |
-
|
31 |
-
$setup->addAttribute('customer', 'mark_fraud', array(
|
32 |
-
'input' => '',
|
33 |
-
'type' => 'int',
|
34 |
-
'label' => '',
|
35 |
-
'visible' => '0',
|
36 |
-
'required' => '0',
|
37 |
-
'user_defined' => '0',
|
38 |
-
'backend' => '',
|
39 |
-
));
|
40 |
-
|
41 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->getConnection()
|
8 |
+
->addColumn($installer->getTable('sales/order'),
|
9 |
+
'eway_transaction_id',
|
10 |
+
array(
|
11 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
12 |
+
'length' => 50,
|
13 |
+
'nullable' => true,
|
14 |
+
'comment' => 'eWAY Transaction ID'
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
+
$installer->getConnection()
|
19 |
+
->addColumn($installer->getTable('sales/quote'),
|
20 |
+
'transaction_id',
|
21 |
+
array(
|
22 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
23 |
+
'length' => 50,
|
24 |
+
'nullable' => true,
|
25 |
+
'comment' => 'eWAY Transaction ID'
|
26 |
+
)
|
27 |
+
);
|
28 |
+
|
29 |
+
$setup = Mage::getResourceModel('customer/setup', 'core_setup');
|
30 |
+
|
31 |
+
$setup->addAttribute('customer', 'mark_fraud', array(
|
32 |
+
'input' => '',
|
33 |
+
'type' => 'int',
|
34 |
+
'label' => '',
|
35 |
+
'visible' => '0',
|
36 |
+
'required' => '0',
|
37 |
+
'user_defined' => '0',
|
38 |
+
'backend' => '',
|
39 |
+
));
|
40 |
+
|
41 |
$installer->endSetup();
|
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
4 |
-
$installer = $this;
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$setup = Mage::getResourceModel('customer/setup', 'core_setup');
|
8 |
-
|
9 |
-
$setup->addAttribute('customer', 'block_fraud_customer', array(
|
10 |
-
'input' => 'select',
|
11 |
-
'type' => 'int',
|
12 |
-
'label' => 'Unblock Fraud Customer',
|
13 |
-
'visible' => '0',
|
14 |
-
'required' => '0',
|
15 |
-
'user_defined' => '0',
|
16 |
-
'default' => '0',
|
17 |
-
'source' => 'eav/entity_attribute_source_boolean'
|
18 |
-
));
|
19 |
-
|
20 |
-
try {
|
21 |
-
$attributeId = $setup->getAttributeId('customer', 'block_fraud_customer');
|
22 |
-
Mage::getModel('customer/attribute')->load($attributeId)
|
23 |
-
->setSortOrder(999)
|
24 |
-
->save();
|
25 |
-
|
26 |
-
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'block_fraud_customer');
|
27 |
-
$oAttribute->setData('used_in_forms', array('adminhtml_customer'));
|
28 |
-
$oAttribute->save();
|
29 |
-
} catch (Exception $e) {
|
30 |
-
}
|
31 |
-
|
32 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
4 |
+
$installer = $this;
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$setup = Mage::getResourceModel('customer/setup', 'core_setup');
|
8 |
+
|
9 |
+
$setup->addAttribute('customer', 'block_fraud_customer', array(
|
10 |
+
'input' => 'select',
|
11 |
+
'type' => 'int',
|
12 |
+
'label' => 'Unblock Fraud Customer',
|
13 |
+
'visible' => '0',
|
14 |
+
'required' => '0',
|
15 |
+
'user_defined' => '0',
|
16 |
+
'default' => '0',
|
17 |
+
'source' => 'eav/entity_attribute_source_boolean'
|
18 |
+
));
|
19 |
+
|
20 |
+
try {
|
21 |
+
$attributeId = $setup->getAttributeId('customer', 'block_fraud_customer');
|
22 |
+
Mage::getModel('customer/attribute')->load($attributeId)
|
23 |
+
->setSortOrder(999)
|
24 |
+
->save();
|
25 |
+
|
26 |
+
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'block_fraud_customer');
|
27 |
+
$oAttribute->setData('used_in_forms', array('adminhtml_customer'));
|
28 |
+
$oAttribute->save();
|
29 |
+
} catch (Exception $e) {
|
30 |
+
}
|
31 |
+
|
32 |
$installer->endSetup();
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->getConnection()
|
8 |
+
->addColumn($installer->getTable('sales/order_payment'),
|
9 |
+
'fraud_action',
|
10 |
+
array(
|
11 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
12 |
+
'length' => 255,
|
13 |
+
'nullable' => true,
|
14 |
+
'comment' => 'eWAY Fraud Action'
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
+
$installer->getConnection()
|
19 |
+
->addColumn($installer->getTable('sales/quote_payment'),
|
20 |
+
'fraud_action',
|
21 |
+
array(
|
22 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
23 |
+
'length' => 255,
|
24 |
+
'nullable' => true,
|
25 |
+
'comment' => 'eWAY Fraud Action'
|
26 |
+
)
|
27 |
+
);
|
28 |
+
|
29 |
+
$installer->getConnection()
|
30 |
+
->addColumn($installer->getTable('sales/order_payment'),
|
31 |
+
'fraud_codes',
|
32 |
+
array(
|
33 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
34 |
+
'length' => 255,
|
35 |
+
'nullable' => true,
|
36 |
+
'comment' => 'eWAY Fraud Codes'
|
37 |
+
)
|
38 |
+
);
|
39 |
+
|
40 |
+
$installer->getConnection()
|
41 |
+
->addColumn($installer->getTable('sales/quote_payment'),
|
42 |
+
'fraud_codes',
|
43 |
+
array(
|
44 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
45 |
+
'length' => 255,
|
46 |
+
'nullable' => true,
|
47 |
+
'comment' => 'eWAY Fraud Codes'
|
48 |
+
)
|
49 |
+
);
|
50 |
+
|
51 |
+
$installer->getConnection()
|
52 |
+
->addColumn($installer->getTable('sales/order_payment'),
|
53 |
+
'transaction_captured',
|
54 |
+
array(
|
55 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
56 |
+
'length' => 50,
|
57 |
+
'nullable' => true,
|
58 |
+
'comment' => 'eWAY Transaction Captured'
|
59 |
+
)
|
60 |
+
);
|
61 |
+
|
62 |
+
$installer->getConnection()
|
63 |
+
->addColumn($installer->getTable('sales/quote_payment'),
|
64 |
+
'transaction_captured',
|
65 |
+
array(
|
66 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
67 |
+
'length' => 50,
|
68 |
+
'nullable' => true,
|
69 |
+
'comment' => 'eWAY Transaction Captured'
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
$installer->getConnection()
|
74 |
+
->addColumn($installer->getTable('sales/order_payment'),
|
75 |
+
'beagle_score',
|
76 |
+
array(
|
77 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
78 |
+
'length' => 255,
|
79 |
+
'nullable' => true,
|
80 |
+
'comment' => 'eWAY Beagle Score'
|
81 |
+
)
|
82 |
+
);
|
83 |
+
|
84 |
+
$installer->getConnection()
|
85 |
+
->addColumn($installer->getTable('sales/quote_payment'),
|
86 |
+
'beagle_score',
|
87 |
+
array(
|
88 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
89 |
+
'length' => 255,
|
90 |
+
'nullable' => true,
|
91 |
+
'comment' => 'eWAY Beagle Score'
|
92 |
+
)
|
93 |
+
);
|
94 |
+
|
95 |
+
$installer->getConnection()
|
96 |
+
->addColumn($installer->getTable('sales/order_payment'),
|
97 |
+
'beagle_verification',
|
98 |
+
array(
|
99 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
100 |
+
'length' => 255,
|
101 |
+
'nullable' => true,
|
102 |
+
'comment' => 'eWAY Beagle Verification'
|
103 |
+
)
|
104 |
+
);
|
105 |
+
|
106 |
+
$installer->getConnection()
|
107 |
+
->addColumn($installer->getTable('sales/quote_payment'),
|
108 |
+
'beagle_verification',
|
109 |
+
array(
|
110 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
111 |
+
'length' => 255,
|
112 |
+
'nullable' => true,
|
113 |
+
'comment' => 'eWAY Beagle Verification'
|
114 |
+
)
|
115 |
+
);
|
116 |
+
|
117 |
+
|
118 |
+
$installer->endSetup();
|
@@ -2,7 +2,7 @@
|
|
2 |
<layout version="0.1.0">
|
3 |
<adminhtml_sales_order_create_index>
|
4 |
<reference name="head">
|
5 |
-
<action
|
6 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
7 |
</reference>
|
8 |
<reference name="js">
|
@@ -14,4 +14,66 @@
|
|
14 |
</block>
|
15 |
</reference>
|
16 |
</adminhtml_sales_order_create_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
</layout>
|
2 |
<layout version="0.1.0">
|
3 |
<adminhtml_sales_order_create_index>
|
4 |
<reference name="head">
|
5 |
+
<action method="addExternalItem"><type>external_js</type><name>https://secure.ewaypayments.com/scripts/eCrypt.js</name><params/></action>
|
6 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
7 |
</reference>
|
8 |
<reference name="js">
|
14 |
</block>
|
15 |
</reference>
|
16 |
</adminhtml_sales_order_create_index>
|
17 |
+
<adminhtml_ewayadmin_ewayorders>
|
18 |
+
<reference name="menu">
|
19 |
+
<action method="setActive">
|
20 |
+
<menupath>sales/eway_orders</menupath>
|
21 |
+
</action>
|
22 |
+
</reference>
|
23 |
+
<reference name="content">
|
24 |
+
<block type="ewayrapid/adminhtml_sales_order" name="eway_orders" />
|
25 |
+
</reference>
|
26 |
+
</adminhtml_ewayadmin_ewayorders>
|
27 |
+
<adminhtml_ewayadmin_grid>
|
28 |
+
<update handle="formkey"/>
|
29 |
+
<block type="ewayrapid/adminhtml_sales_order_grid" name="eway_order.grid" output="toHtml"></block>
|
30 |
+
</adminhtml_ewayadmin_grid>
|
31 |
+
|
32 |
+
|
33 |
+
<adminhtml_customer_edit>
|
34 |
+
<reference name="head">
|
35 |
+
<action method="addExternalItem"><type>external_js</type><name>https://secure.ewaypayments.com/scripts/eCrypt.js</name><params/></action>
|
36 |
+
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
37 |
+
</reference>
|
38 |
+
<reference name="js">
|
39 |
+
<block type="core/template" name="ewayrapid.js" after="-">
|
40 |
+
<action method="setArea"><area>frontend</area></action>
|
41 |
+
<action ifconfig="payment/ewayrapid_general/active" method="setTemplate" >
|
42 |
+
<template>ewayrapid/js.phtml</template>
|
43 |
+
</action>
|
44 |
+
</block>
|
45 |
+
</reference>
|
46 |
+
<reference name="customer_edit_tabs">
|
47 |
+
<block type="ewayrapid/adminhtml_customer_savedcard" name="admin.customer.savedcard" template="ewayrapid/customer/cardcontainer.phtml">
|
48 |
+
<block type="ewayrapid/adminhtml_customer_method" name="admin.customer.ewayrapid.method" template="ewayrapid/customer/method.phtml" before="-">
|
49 |
+
<action method="setCode"><code>ewayrapid</code></action>
|
50 |
+
<block type="ewayrapid/adminhtml_customer_edit_tab_cards" name="admin.customer.ewayrapid.cards" template="ewayrapid/customer/edit/tab/cards.phtml">
|
51 |
+
<action method="setCode"><code>ewayrapid</code></action>
|
52 |
+
</block>
|
53 |
+
<block type="ewayrapid/adminhtml_customer_edit_tab_form" name="admin.customer.ewayrapid.form" template="ewayrapid/customer/edit/tab/form.phtml">
|
54 |
+
<action method="setCode"><code>ewayrapid</code></action>
|
55 |
+
</block>
|
56 |
+
</block>
|
57 |
+
</block>
|
58 |
+
<action method="addTab"><name>admin.customer.savedcard</name><block>admin.customer.savedcard</block></action>
|
59 |
+
</reference>
|
60 |
+
</adminhtml_customer_edit>
|
61 |
+
|
62 |
+
<adminhtml_ewayrapid_savedcard_load>
|
63 |
+
<block type="ewayrapid/adminhtml_customer_edit_tab_form" name="root" template="ewayrapid/customer/edit/tab/form.phtml">
|
64 |
+
<action method="setCode"><code>ewayrapid</code></action>
|
65 |
+
</block>
|
66 |
+
</adminhtml_ewayrapid_savedcard_load>
|
67 |
+
|
68 |
+
<adminhtml_ewayrapid_savedcard_save>
|
69 |
+
<block type="ewayrapid/adminhtml_customer_edit_tab_cards" name="root" template="ewayrapid/customer/edit/tab/cards.phtml">
|
70 |
+
<action method="setCode"><code>ewayrapid</code></action>
|
71 |
+
</block>
|
72 |
+
</adminhtml_ewayrapid_savedcard_save>
|
73 |
+
|
74 |
+
<adminhtml_ewayrapid_savedcard_savetoken>
|
75 |
+
<block type="ewayrapid/adminhtml_customer_edit_tab_cards" name="root" template="ewayrapid/customer/edit/tab/cards.phtml">
|
76 |
+
<action method="setCode"><code>ewayrapid</code></action>
|
77 |
+
</block>
|
78 |
+
</adminhtml_ewayrapid_savedcard_savetoken>
|
79 |
</layout>
|
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $this->getChildHtml(); ?>
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit-head">
|
2 |
+
<h4 class="icon-head head-customer-address-list"><?php echo $this->__('Saved Card') ?></h4>
|
3 |
+
</div>
|
4 |
+
<div class="fieldset" style="padding:0">
|
5 |
+
<ol>
|
6 |
+
<?php if ($this->checkCards()): ?>
|
7 |
+
<?php foreach ($this->getCards() as $id => $card): ?>
|
8 |
+
<?php if(!$card->getActive()) continue; ?>
|
9 |
+
<li class="item info-box" id="token-<?php echo $id ?>" style="cursor:default">
|
10 |
+
<h3 class="box-title">
|
11 |
+
<?php if ($card->getExpYear()): ?>
|
12 |
+
<small class="right"><?php echo $card->getExpMonth() . '/' . $card->getExpYear() ?></small>
|
13 |
+
<?php endif; ?>
|
14 |
+
<?php echo $this->__('Card: %s', $card->getCard()) ?>
|
15 |
+
</h3>
|
16 |
+
<address class="box-content" style="overflow:auto">
|
17 |
+
|
18 |
+
<?php echo $this->formatAddress($card->getAddress()) ?>
|
19 |
+
<div class="right">
|
20 |
+
<?php if(Mage::helper('ewayrapid')->checkCardName($card) != Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD): ?>
|
21 |
+
<button class="button" type="button" onclick="ewayrapid.editCard( <?php echo $id; ?> );">
|
22 |
+
<span><?php echo $this->__('Edit'); ?></span>
|
23 |
+
</button>
|
24 |
+
<?php endif; ?>
|
25 |
+
<button class="button" type="button" onclick="ewayrapid.deleteCard( <?php echo $id; ?> );">
|
26 |
+
<span><?php echo $this->__('Delete'); ?></span>
|
27 |
+
</button>
|
28 |
+
</div>
|
29 |
+
</address>
|
30 |
+
</li>
|
31 |
+
<?php endforeach; ?>
|
32 |
+
<?php else: ?>
|
33 |
+
<li class="item"><?php echo $this->__('No payment data saved yet.') ?></li>
|
34 |
+
<?php endif; ?>
|
35 |
+
</ol>
|
36 |
+
</div>
|
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit-head">
|
2 |
+
<h4 class="icon-head head-customer-address-list">
|
3 |
+
<?php if( $this->isEdit() ): ?>
|
4 |
+
<?php echo $this->__('Editing Card %s', $this->getCard()->getCard()); ?>
|
5 |
+
<?php else: ?>
|
6 |
+
<?php echo $this->__('Add A Credit Card') ?>
|
7 |
+
<?php endif; ?>
|
8 |
+
</h4>
|
9 |
+
</div>
|
10 |
+
<div class="fieldset">
|
11 |
+
<input type="hidden" id="token_id" name="<?php echo $this->getCode(); ?>[token_id]" value="<?php echo $this->getTokenId() ? $this->getTokenId() : 0; ?>" />
|
12 |
+
<input type="hidden" name="<?php echo $this->getCode(); ?>[TokenCustomerID]" value="<?php echo $this->getCard()->getToken() ? $this->getCard()->getToken() : ''; ?>" />
|
13 |
+
<h4><?php echo $this->__('Cardholder Information') ?></h4>
|
14 |
+
<table class="form-list" cellspacing="0">
|
15 |
+
<tr>
|
16 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_title"><?php echo $this->__('Title') ?></label></td>
|
17 |
+
<td class="value">
|
18 |
+
<select id="<?php echo $this->getCode(); ?>_title" name="<?php echo $this->getCode(); ?>[address][title]">
|
19 |
+
<?php foreach ($this->getPrefixOptions() as $_option): ?>
|
20 |
+
<option
|
21 |
+
value="<?php echo $_option ?>"<?php if ($this->getCard()->getAddress()->getTitle() == $_option): ?>
|
22 |
+
selected="selected"<?php endif; ?>><?php echo $this->__($_option) ?></option>
|
23 |
+
<?php endforeach; ?>
|
24 |
+
</select>
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
<tr>
|
28 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_fn"><?php echo $this->__('First Name') ?> <span class="required">*</span></label></td>
|
29 |
+
<td class="value">
|
30 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_fn" name="<?php echo $this->getCode(); ?>[address][firstname]"
|
31 |
+
class="input-text save-card-validate" data-validate="required-entry validate-length maximum-length-50" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getData('FirstName')); ?>" />
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<tr>
|
35 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_ln"><?php echo $this->__('Last Name') ?> <span class="required">*</span></label></td>
|
36 |
+
<td class="value">
|
37 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_ln" name="<?php echo $this->getCode(); ?>[address][lastname]"
|
38 |
+
class="input-text save-card-validate" data-validate="required-entry validate-length maximum-length-50" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getData('LastName')); ?>" />
|
39 |
+
</td>
|
40 |
+
</tr>
|
41 |
+
<tr>
|
42 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_company"><?php echo $this->__('Company') ?></label></td>
|
43 |
+
<td class="value">
|
44 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_company" name="<?php echo $this->getCode(); ?>[address][company]" class="input-text" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getCompanyName()); ?>" />
|
45 |
+
</td>
|
46 |
+
</tr>
|
47 |
+
<tr>
|
48 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_job_desc"><?php echo $this->__('Job Description') ?></label></td>
|
49 |
+
<td class="value">
|
50 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_job_desc" name="<?php echo $this->getCode(); ?>[address][job_description]" class="input-text" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getJobDescription()); ?>" />
|
51 |
+
</td>
|
52 |
+
</tr>
|
53 |
+
<tr>
|
54 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_street1"><?php echo $this->__('Street Address') ?> <span class="required">*</span></label></td>
|
55 |
+
<td class="value">
|
56 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_street1" name="<?php echo $this->getCode(); ?>[address][street][]"
|
57 |
+
class="input-text save-card-validate" data-validate="required-entry validate-length maximum-length-50" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getStreet1()); ?>" />
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<tr>
|
61 |
+
<td></td>
|
62 |
+
<td class="value">
|
63 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_street2" name="<?php echo $this->getCode(); ?>[address][street][]"
|
64 |
+
class="input-text save-card-validate" data-validate="validate-length maximum-length-50" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getStreet2()); ?>" />
|
65 |
+
</td>
|
66 |
+
</tr>
|
67 |
+
<tr>
|
68 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_city"><?php echo $this->__('City') ?> <span class="required">*</span></label></td>
|
69 |
+
<td class="value">
|
70 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_city" name="<?php echo $this->getCode(); ?>[address][city]"
|
71 |
+
class="input-text save-card-validate" data-validate="required-entry validate-length maximum-length-50" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getData('City')); ?>" />
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_region_id"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label></td>
|
76 |
+
<td class="value">
|
77 |
+
<select class="validate-select" title="State/Province" name="<?php echo $this->getCode(); ?>[address][region_id]" id="<?php echo $this->getCode(); ?>_region_id">
|
78 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
79 |
+
</select>
|
80 |
+
<script type="text/javascript">
|
81 |
+
$('<?php echo $this->getCode(); ?>_region_id').setAttribute('defaultValue', '<?php echo $this->getRegionId()?>');
|
82 |
+
</script>
|
83 |
+
<input type="text" class="input-text" title="State/Province" value="<?php echo $this->escapeHtml( $this->getCard()->getAddress()->getData('State') ); ?>" name="<?php echo $this->getCode(); ?>[address][region]" id="<?php echo $this->getCode(); ?>_region" />
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
<tr>
|
87 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_postcode"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label></td>
|
88 |
+
<td class="value">
|
89 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_postcode" name="<?php echo $this->getCode(); ?>[address][postcode]"
|
90 |
+
class="input-text save-card-validate" data-validate="required-entry validate-zip-international validate-length maximum-length-30" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getData('PostalCode')); ?>" />
|
91 |
+
</td>
|
92 |
+
</tr>
|
93 |
+
<tr>
|
94 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_country"><?php echo $this->__('Country') ?> <span class="required">*</span></label></td>
|
95 |
+
<td class="value">
|
96 |
+
<?php echo Mage::helper('ewayrapid')->getCountryHtmlSelect( $this->getCode() . '[address][country_id]',strtoupper($this->getCard()->getAddress()->getCountry()), $this->getCode().'_country' ); ?>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
+
<tr>
|
100 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_telephone"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label></td>
|
101 |
+
<td class="value">
|
102 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_telephone" name="<?php echo $this->getCode(); ?>[address][telephone]"
|
103 |
+
class="input-text save-card-validate" data-validate="required-entry eway-validate-phone validate-length maximum-length-32" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getData('Phone')); ?>" />
|
104 |
+
</td>
|
105 |
+
</tr>
|
106 |
+
<tr>
|
107 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_mobile"><?php echo $this->__('Mobile') ?></label></td>
|
108 |
+
<td class="value">
|
109 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_mobile" name="<?php echo $this->getCode(); ?>[address][mobile]"
|
110 |
+
class="input-text save-card-validate" data-validate="eway-validate-phone validate-length maximum-length-32" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getMobile()); ?>" />
|
111 |
+
</td>
|
112 |
+
</tr>
|
113 |
+
<tr>
|
114 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_email"><?php echo $this->__('Email') ?></label></td>
|
115 |
+
<td class="value">
|
116 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_email" name="<?php echo $this->getCode(); ?>[address][email]"
|
117 |
+
class="input-text save-card-validate" data-validate="validate-email validate-length maximum-length-50" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getEmail()); ?>" />
|
118 |
+
</td>
|
119 |
+
</tr>
|
120 |
+
<tr>
|
121 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_fax"><?php echo $this->__('Fax') ?></label></td>
|
122 |
+
<td class="value">
|
123 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_fax" name="<?php echo $this->getCode(); ?>[address][fax]"
|
124 |
+
class="input-text save-card-validate" data-validate="eway-validate-phone validate-length maximum-length-32" value="<?php echo $this->escapeHtml($this->getCard()->getAddress()->getData('Fax')); ?>" />
|
125 |
+
</td>
|
126 |
+
</tr>
|
127 |
+
</table>
|
128 |
+
|
129 |
+
<?php if(!Mage::helper('ewayrapid')->useIframeInBackend()): ?>
|
130 |
+
<h4><?php echo $this->__('Credit Card Information') ?></h4>
|
131 |
+
<table class="form-list" cellspacing="0" id="<?php echo $this->getCode(); ?>_ccInfo">
|
132 |
+
<tr>
|
133 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_cc_owner"><?php echo $this->__('Name on Card') ?> <span class="required">*</span></label></td>
|
134 |
+
<td class="value">
|
135 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_cc_owner" name="<?php echo $this->getCode(); ?>[payment][cc_owner]" title="<?php echo $this->__('Card Holder Name') ?>"
|
136 |
+
class="input-text save-card-validate" data-validate="required-entry validate-length maximum-length-50" value="<?php echo $this->escapeHtml($this->getCard()->getOwner()); ?>" autocomplete="off" />
|
137 |
+
</td>
|
138 |
+
</tr>
|
139 |
+
<tr>
|
140 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_cc_number"><?php echo $this->__('Credit Card Number') ?> <span class="required">*</span></label></td>
|
141 |
+
<td class="value">
|
142 |
+
<input type="text" id="<?php echo $this->getCode(); ?>_saved_cc_number" name="<?php echo $this->getCode(); ?>[payment][cc_number]"
|
143 |
+
title="<?php echo $this->__('Credit Card Number') ?>" class="input-text save-card-validate"
|
144 |
+
data-validate="validate-cc-number validate-cc-type-auto validate-cc-type"
|
145 |
+
<?php if($this->isEdit()): ?>value="<?php echo $this->escapeHtml($this->getCard()->getCard()); ?>" disabled="disabled" <?php endif;?> autocomplete="off" />
|
146 |
+
<input type="hidden" id="<?php echo $this->getCode(); ?>_saved_cc_type" name="<?php echo $this->getCode(); ?>[payment][cc_type]"
|
147 |
+
value="<?php echo $this->getCard()->getType() ?>"/>
|
148 |
+
</td>
|
149 |
+
</tr>
|
150 |
+
<tr>
|
151 |
+
<td class="label"><label for="<?php echo $this->getCode(); ?>_expiration"><?php echo $this->__('Expiration Date') ?> <span class="required">*</span></label></td>
|
152 |
+
<td class="value">
|
153 |
+
<select id="<?php echo $this->getCode(); ?>_expiration" name="<?php echo $this->getCode(); ?>[payment][cc_exp_month]" class="month save-card-validate"
|
154 |
+
data-validate="validate-cc-exp required-entry" style="width:150px">
|
155 |
+
<option value=""><?php echo $this->__('Month') ?></option>
|
156 |
+
<?php $_ccExpMonth = $this->getCard()->getExpMonth() ?>
|
157 |
+
<?php foreach(Mage::getSingleton('payment/config')->getMonths() as $k=>$v ): ?>
|
158 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
159 |
+
<?php endforeach ?>
|
160 |
+
</select>
|
161 |
+
|
162 |
+
<select id="<?php echo $this->getCode(); ?>_expiration_yr" name="<?php echo $this->getCode(); ?>[payment][cc_exp_year]" class="year" style="width:80px">
|
163 |
+
<option value=""><?php echo $this->__('Year') ?></option>
|
164 |
+
<?php $_ccExpYear = $this->getCard()->getExpYear() ?>
|
165 |
+
<?php foreach(Mage::getSingleton('payment/config')->getYears() as $k=>$v ): ?>
|
166 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
167 |
+
<?php endforeach ?>
|
168 |
+
</select>
|
169 |
+
</td>
|
170 |
+
</tr>
|
171 |
+
<!-- --><?php //if( Mage::helper('payment')->getMethodInstance( $this->getCode() )->getConfigData('useccv') ): ?>
|
172 |
+
<!-- <tr>-->
|
173 |
+
<!-- <td class="label"><label for="--><?php //echo $this->getCode(); ?><!--_cc_cid">--><?php //echo $this->__('Card Verification Number') ?><!-- <span class="required">*</span></label></td>-->
|
174 |
+
<!-- <td class="value">-->
|
175 |
+
<!-- <input type="text" title="--><?php //echo $this->__('Card Verification Number') ?><!--" class="input-text cvv" id="--><?php //echo $this->getCode(); ?><!--_cc_cid" name="--><?php //echo $this->getCode(); ?><!--[payment][cc_cid]" value="" style="width:50px" autocomplete="off" />-->
|
176 |
+
<!-- </td>-->
|
177 |
+
<!-- </tr>-->
|
178 |
+
<!-- --><?php //endif; ?>
|
179 |
+
</table>
|
180 |
+
<!-- --><?php //$requireCvv = Mage::helper('payment')->getMethodInstance( $this->getCode() )->getAdvancedConfigData('require_ccv'); ?>
|
181 |
+
<!-- --><?php //if( $this->isEdit() && Mage::helper('payment')->getMethodInstance( $this->getCode() )->getConfigData('useccv') && $requireCvv ): ?>
|
182 |
+
<!-- <table class="form-list" cellspacing="0" id="--><?php //echo $this->getCode(); ?><!--_ccInfoCcv">-->
|
183 |
+
<!-- <tr>-->
|
184 |
+
<!-- <td class="label"><label for="--><?php //echo $this->getCode(); ?><!--_saved_cc_cid">--><?php //echo $this->__('Card Verification Number') ?><!-- <span class="required">*</span></label></td>-->
|
185 |
+
<!-- <td class="value">-->
|
186 |
+
<!-- <input type="text" title="--><?php //echo $this->__('Card Verification Number') ?><!--" class="input-text cvv" id="--><?php //echo $this->getCode(); ?><!--_saved_cc_cid" name="--><?php //echo $this->getCode(); ?><!--[payment][saved_cc_cid]" value="" style="width:50px" autocomplete="off" />-->
|
187 |
+
<!-- </td>-->
|
188 |
+
<!-- </tr>-->
|
189 |
+
<!-- </table>-->
|
190 |
+
<!-- --><?php //endif; ?>
|
191 |
+
<?php endif; ?>
|
192 |
+
<table class="form-list" cellspacing="0">
|
193 |
+
<tr>
|
194 |
+
<td class="label"></td>
|
195 |
+
<td class="value">
|
196 |
+
<button class="button" type="button" onclick="<?php echo $this->getCode(); ?>.saveCard(<?php echo $this->getCard()->getToken() ? $this->getCard()->getToken() : ''?>);"><span><?php echo $this->__('Save') ?></span></button>
|
197 |
+
<a href="#" onclick="<?php echo $this->getCode(); ?>.editCard(0); return false;"><?php echo $this->__('Cancel'); ?></a>
|
198 |
+
</td>
|
199 |
+
</tr>
|
200 |
+
</table>
|
201 |
+
</div>
|
202 |
+
<script type="text/javascript">
|
203 |
+
//<![CDATA[
|
204 |
+
new RegionUpdater('<?php echo $this->getCode(); ?>_country', '<?php echo $this->getCode(); ?>_region', '<?php echo $this->getCode(); ?>_region_id', <?php echo Mage::helper('directory')->getRegionJson() ?>, undefined, '<?php echo $this->getCode(); ?>_postcode');
|
205 |
+
|
206 |
+
function <?php echo $this->getCode(); ?>_clearAddrValidation() {
|
207 |
+
$('<?php echo $this->getCode(); ?>_region_id').removeClassName('required-entry').removeClassName('validate-select');
|
208 |
+
$('<?php echo $this->getCode(); ?>_country').removeClassName('required-entry').removeClassName('validate-select');
|
209 |
+
$('<?php echo $this->getCode(); ?>_region').removeClassName('required-entry');
|
210 |
+
$('<?php echo $this->getCode(); ?>_postcode').removeClassName('required-entry');
|
211 |
+
}
|
212 |
+
|
213 |
+
/* Prevent the region from holding up submit... */
|
214 |
+
document.observe("dom:loaded", function() {
|
215 |
+
<?php echo $this->getCode(); ?>_clearAddrValidation();
|
216 |
+
});
|
217 |
+
//]]>
|
218 |
+
</script>
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !$this->isAjax() ): ?>
|
2 |
+
<table id="tokenbase-edit-<?php echo $this->getCode(); ?>" class="form-edit" cellspacing="0">
|
3 |
+
<?php endif; ?>
|
4 |
+
<tr>
|
5 |
+
<td id="<?php echo $this->getCode(); ?>-cards" class="address-list">
|
6 |
+
<?php echo $this->getChildHtml('admin.customer.ewayrapid.cards'); ?>
|
7 |
+
</td>
|
8 |
+
<td id="<?php echo $this->getCode(); ?>-form">
|
9 |
+
<?php echo $this->getChildHtml('admin.customer.ewayrapid.form'); ?>
|
10 |
+
</td>
|
11 |
+
</tr>
|
12 |
+
<?php if( !$this->isAjax() ): ?>
|
13 |
+
</table>
|
14 |
+
<?php endif; ?>
|
15 |
+
|
16 |
+
<?php if( !$this->isAjax() ): ?>
|
17 |
+
<script type="text/javascript">
|
18 |
+
var encryptKey = '<?php echo Mage::getSingleton('ewayrapid/config')->getEncryptionKey() ?>';
|
19 |
+
var accessCode = '';
|
20 |
+
var saveTokenResult = '';
|
21 |
+
//<![CDATA[
|
22 |
+
var <?php echo $this->getCode(); ?> = {
|
23 |
+
deleteCard: function( id ) {
|
24 |
+
if( confirm("<?php echo $this->__('Are you sure you want to delete this?'); ?>") ) {
|
25 |
+
Element.show('loading-mask');
|
26 |
+
new Ajax.Request("<?php echo $this->getUrl('*/ewayrapid_savedcard/delete', array('customer_id' => $this->getCustomer()->getId())); ?>", {
|
27 |
+
method: 'post',
|
28 |
+
parameters: "token_id="+id,
|
29 |
+
evalScripts: true,
|
30 |
+
onComplete: function(data) {
|
31 |
+
Element.hide('loading-mask');
|
32 |
+
|
33 |
+
try {
|
34 |
+
var json = data.responseText.evalJSON();
|
35 |
+
} catch(e) {}
|
36 |
+
|
37 |
+
if( typeof json != 'undefined' && json.success == false ) {
|
38 |
+
alert( json.message );
|
39 |
+
}
|
40 |
+
else {
|
41 |
+
$('token-'+id).hide();
|
42 |
+
<?php echo $this->getCode(); ?>.editCard(0);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
});
|
46 |
+
}
|
47 |
+
},
|
48 |
+
|
49 |
+
editCard: function( id ) {
|
50 |
+
Element.show('loading-mask');
|
51 |
+
new Ajax.Request("<?php echo $this->getUrl('*/ewayrapid_savedcard/load', array('customer_id' => $this->getCustomer()->getId())); ?>", {
|
52 |
+
method: 'post',
|
53 |
+
parameters: "token_id="+id,
|
54 |
+
evalScripts: true,
|
55 |
+
onComplete: function(data) {
|
56 |
+
Element.hide('loading-mask');
|
57 |
+
|
58 |
+
try {
|
59 |
+
var json = data.responseText.evalJSON();
|
60 |
+
} catch(e) {}
|
61 |
+
|
62 |
+
if( typeof json != 'undefined' && json.success == false ) {
|
63 |
+
alert( json.message );
|
64 |
+
}
|
65 |
+
else {
|
66 |
+
$('<?php echo $this->getCode(); ?>-form').update( data.responseText );
|
67 |
+
}
|
68 |
+
}
|
69 |
+
});
|
70 |
+
},
|
71 |
+
|
72 |
+
saveCard: function(customertokenid) {
|
73 |
+
var form = $('edit_form');
|
74 |
+
form.writeAttribute('data-eway-encrypt-key', encryptKey);
|
75 |
+
if(!validateForm()){
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
var ewayForm = new EwayForm();
|
79 |
+
var submitForm = ewayForm.encryptForm(form, true);
|
80 |
+
|
81 |
+
Element.show('loading-mask');
|
82 |
+
var url = '';
|
83 |
+
<?php if(Mage::helper('ewayrapid')->useIframeInBackend()): ?>
|
84 |
+
url = '<?php echo $this->getUrl('*/ewayrapid_savedcard/getAccessCode', array('customer_id' => $this->getCustomer()->getId())); ?>';
|
85 |
+
<?php else: ?>
|
86 |
+
url = '<?php echo $this->getUrl('*/ewayrapid_savedcard/save', array('customer_id' => $this->getCustomer()->getId())); ?>'
|
87 |
+
<?php endif; ?>
|
88 |
+
|
89 |
+
if(customertokenid){
|
90 |
+
url += 'TokenCustomerID/' + customertokenid;
|
91 |
+
}
|
92 |
+
new Ajax.Request(url, {
|
93 |
+
method: 'post',
|
94 |
+
parameters: Form.serialize(submitForm, true),
|
95 |
+
evalScripts: true,
|
96 |
+
onComplete: function(data) {
|
97 |
+
Element.hide('loading-mask');
|
98 |
+
try {
|
99 |
+
var json = data.responseText.evalJSON();
|
100 |
+
} catch(e) {}
|
101 |
+
|
102 |
+
if( typeof json != 'undefined' && json.success == false ) {
|
103 |
+
alert( json.message );
|
104 |
+
}
|
105 |
+
else {
|
106 |
+
<?php if(Mage::helper('ewayrapid')->useIframeInBackend()): ?>
|
107 |
+
var eWAYConfig = {
|
108 |
+
sharedPaymentUrl: json.SharedPaymentUrl
|
109 |
+
};
|
110 |
+
ewayReturnUrl = '<?php echo $this->getUrl('*/ewayrapid_savedcard/savetoken', array('customer_id' => $this->getCustomer()->getId())); ?>';
|
111 |
+
saveTokenResult = json;
|
112 |
+
Element.show('loading-mask');
|
113 |
+
eCrypt.showModalPayment(eWAYConfig, saveTokenCallBack);
|
114 |
+
<?php else: ?>
|
115 |
+
$('<?php echo $this->getCode(); ?>-cards').update(data.responseText);
|
116 |
+
<?php echo $this->getCode(); ?>.editCard(0);
|
117 |
+
<?php endif; ?>
|
118 |
+
}
|
119 |
+
}
|
120 |
+
});
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
function saveTokenCallBack (result, transactionID, errors) {
|
125 |
+
if (result == "Complete") {
|
126 |
+
var reqParams = {
|
127 |
+
// 'ccType': '',
|
128 |
+
// 'expYear': saveTokenResult.Customer.CardExpiryYear,
|
129 |
+
'token_id': $('token_id').value,
|
130 |
+
// 'startMonth': saveTokenResult.Customer.CardStartMonth,
|
131 |
+
// 'startYear': saveTokenResult.Customer.CardStartYear,
|
132 |
+
// 'issueNumber': saveTokenResult.Customer.CardIssueNumber,
|
133 |
+
'AccessCode': saveTokenResult.AccessCode,
|
134 |
+
'street1': saveTokenResult.street1,
|
135 |
+
'street2': saveTokenResult.street2
|
136 |
+
};
|
137 |
+
new Ajax.Request(ewayReturnUrl, {
|
138 |
+
method: 'post',
|
139 |
+
parameters: reqParams,
|
140 |
+
evalScripts: true,
|
141 |
+
onComplete: function(data) {
|
142 |
+
Element.hide('loading-mask');
|
143 |
+
try {
|
144 |
+
var json = data.responseText.evalJSON();
|
145 |
+
} catch(e) {}
|
146 |
+
|
147 |
+
if( typeof json != 'undefined' && json.success == false ) {
|
148 |
+
alert( json.message );
|
149 |
+
}
|
150 |
+
else {
|
151 |
+
$('<?php echo $this->getCode(); ?>-cards').update( data.responseText );
|
152 |
+
<?php echo $this->getCode(); ?>.editCard(0);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
});
|
156 |
+
} else if (result == "Error") {
|
157 |
+
alert("There was a problem completing the payment: " + errors);
|
158 |
+
Element.hide('loading-mask');
|
159 |
+
} else{
|
160 |
+
Element.hide('loading-mask');
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
function validateForm(){
|
165 |
+
$$('.save-card-validate').each(function(ele){
|
166 |
+
var eleValidate = ele.getAttribute('data-validate');
|
167 |
+
ele.addClassName(eleValidate);
|
168 |
+
});
|
169 |
+
$('ewayrapid_region_id') && $('ewayrapid_region_id').addClassName('required-entry').addClassName('validate-select');
|
170 |
+
var validator = new Validation('edit_form');
|
171 |
+
return validator.validate();
|
172 |
+
}
|
173 |
+
//]]!>
|
174 |
+
</script>
|
175 |
+
<?php endif; ?>
|
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_code = $this->getMethodCode();
|
28 |
+
?>
|
29 |
+
|
30 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display: none">
|
31 |
+
<?php if($this->checkSaveCardAvailable()): ?>
|
32 |
+
<?php
|
33 |
+
$_tokens = $this->getTokenList();
|
34 |
+
$_defaultToken = isset($_tokens['default_token']) ? $_tokens['default_token'] : false;
|
35 |
+
?>
|
36 |
+
<li <?php echo count($_tokens['tokens']) <= 1 ? 'style="display:none;"' : '' ?>>
|
37 |
+
<div class="input-box">
|
38 |
+
<div class="v-fix">
|
39 |
+
<select id="ewayrapid_ewayone_token" name="payment[saved_token]" class="ewayrapid_ewayone_token">
|
40 |
+
<?php foreach($_tokens['tokens'] as $_key => $_token):
|
41 |
+
if ($_key == Eway_Rapid31_Model_Config::TOKEN_NEW || $this->checkCardName($_token) == Eway_Rapid31_Model_Config::CREDITCARD_METHOD): ?>
|
42 |
+
<?php /* @var Eway_Rapid31_Model_Customer_Token $_token */ ?>
|
43 |
+
<option value="<?php echo $_key ?>" <?php if($_key == $_defaultToken): ?>selected="selected"<?php endif; ?>>
|
44 |
+
<?php echo $_token->getCard() ?>
|
45 |
+
</option>
|
46 |
+
<?php endif; ?>
|
47 |
+
<?php endforeach; ?>
|
48 |
+
</select>
|
49 |
+
</div>
|
50 |
+
<?php if(Mage::getSingleton('ewayrapid/config')->canEditToken() && count($_tokens['tokens']) > 1): ?>
|
51 |
+
<div class="v-fix">
|
52 |
+
<a id="ewayrapid_ewayone_edit" class="ewayrapid_ewayone_edit" href="javascript:void(0);"><?php echo $this->__('Edit') ?></a>
|
53 |
+
</div>
|
54 |
+
<?php endif; ?>
|
55 |
+
</div>
|
56 |
+
</li>
|
57 |
+
<?php endif; ?>
|
58 |
+
<li class="saved_token_fields">
|
59 |
+
<label for="<?php echo $_code ?>_cc_owner"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
60 |
+
<div class="input-box">
|
61 |
+
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<li class="saved_token_fields">
|
65 |
+
<label for="<?php echo $_code ?>_cc_number"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
66 |
+
<div class="input-box help-disabled-cc">
|
67 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" data-eway-encrypt-name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type-auto" value="" pattern="\d*"/>
|
68 |
+
<input type="hidden" id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" />
|
69 |
+
<a class="card-number-help" href="#"><?php echo $this->__('Help') ?></a>
|
70 |
+
<div class="tool-tip" id="cc-help-tool-tip" style="display:none;">
|
71 |
+
<div class="btn-close"><a href="#" id="cc-help-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
|
72 |
+
<div class="tool-tip-content">To use a new credit card number, please add another card</div>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
</li>
|
76 |
+
<li class="saved_token_fields">
|
77 |
+
<label for="<?php echo $_code ?>_expiration"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
|
78 |
+
<div class="input-box">
|
79 |
+
<div class="v-fix">
|
80 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
|
81 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
82 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
83 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
84 |
+
<?php endforeach ?>
|
85 |
+
</select>
|
86 |
+
</div>
|
87 |
+
<div class="v-fix">
|
88 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
89 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
|
90 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
91 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
92 |
+
<?php endforeach ?>
|
93 |
+
</select>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
</li>
|
97 |
+
<?php echo $this->getChildHtml() ?>
|
98 |
+
<?php if($this->hasVerification()): ?>
|
99 |
+
<li id="<?php echo $_code ?>_cc_type_cvv_div">
|
100 |
+
<label for="<?php echo $_code ?>_cc_cid"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
101 |
+
<div class="input-box">
|
102 |
+
<div class="v-fix">
|
103 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" data-eway-encrypt-name="payment[cc_cid]" value="" pattern="\d*"/>
|
104 |
+
</div>
|
105 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
106 |
+
</div>
|
107 |
+
</li>
|
108 |
+
<?php if ($this->getIsRecurring()) { ?>
|
109 |
+
<li>
|
110 |
+
<p>I authorize <?php echo Mage::app()->getStore()->getName(); ?> to charge the available balance
|
111 |
+
in my credit card for the future payments of this order. To make a change, I can go to
|
112 |
+
<a href="<?php echo Mage::getUrl('checkout/cart'); ?>">Cart</a>
|
113 |
+
</p>
|
114 |
+
<input type="checkbox" name="recurring-agree" class="recurring-agree required-entry"/><label class="lable-for-recurring" for="">Agree</label>
|
115 |
+
</li>
|
116 |
+
<?php } ?>
|
117 |
+
<?php endif; ?>
|
118 |
+
<?php if($this->checkSaveCardAvailable() && $this->getSaveCard()): ?>
|
119 |
+
<li id="eway_save_card" class="saved_token_fields">
|
120 |
+
<div class="v-fix">
|
121 |
+
<input type="checkbox" title="<?php echo $this->getSaveText() ?>" id="<?php echo $_code ?>_cc_save_card"
|
122 |
+
<?php echo $this->getSaveDefaultCheck() ? 'checked' : '' ?> name="payment[save_card]" value="1" pattern="\d*"/>
|
123 |
+
<label for="<?php echo $_code ?>_cc_save_card" ><?php echo $this->getSaveText() ?></label>
|
124 |
+
</div>
|
125 |
+
</li>
|
126 |
+
<?php endif; ?>
|
127 |
+
</ul>
|
128 |
+
<?php if(count($_tokens['tokens']) > 1): ?>
|
129 |
+
<script type="text/javascript">
|
130 |
+
var ewayPaymentToken = new EwayPaymentToken(
|
131 |
+
<?php echo $_tokens['tokens_json'] ?>,
|
132 |
+
<?php echo count($_tokens['tokens']) ?>,
|
133 |
+
false,
|
134 |
+
'<?php echo $this->__('Edit') ?>',
|
135 |
+
'<?php echo $this->__('Cancel edit') ?>'
|
136 |
+
);
|
137 |
+
|
138 |
+
$$('.help-disabled-cc a').each(function(element){
|
139 |
+
Event.observe(element, 'click', toggleToolTipCc);
|
140 |
+
});
|
141 |
+
|
142 |
+
function toggleToolTipCc(event){
|
143 |
+
if($('cc-help-tool-tip')){
|
144 |
+
$('cc-help-tool-tip').toggle();
|
145 |
+
}
|
146 |
+
Event.stop(event);
|
147 |
+
}
|
148 |
+
if($('cc-help-tool-tip-close')){
|
149 |
+
Event.observe($('cc-help-tool-tip-close'), 'click', toggleToolTipCc);
|
150 |
+
}
|
151 |
+
|
152 |
+
if(typeof AdminOrder.prototype.setPaymentMethodBackup == "undefined") {
|
153 |
+
AdminOrder.prototype.setPaymentMethodBackup = AdminOrder.prototype.setPaymentMethod;
|
154 |
+
AdminOrder.prototype.setPaymentMethod = function(method) {
|
155 |
+
AdminOrder.prototype.setPaymentMethodBackup(method);
|
156 |
+
if(EwayPayment.isEwayRapidMethod(method)) {
|
157 |
+
ewayPaymentToken.onSavedTokenChanged();
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
</script>
|
163 |
+
<?php endif; ?>
|
164 |
+
<script type="text/javascript">
|
165 |
+
$('p_method_ewayrapid_ewayone').observe('click', function () {
|
166 |
+
$('p_method_ewayrapid_ewayone').setAttribute('checked', 'true');
|
167 |
+
$('p_method_ewayrapid_notsaved') && $('p_method_ewayrapid_notsaved').removeAttribute('checked');
|
168 |
+
|
169 |
+
$$('#payment_form_ewayrapid_ewayone input[name*=payment]').each(function(inp) {
|
170 |
+
inp.removeAttribute('disabled');
|
171 |
+
});
|
172 |
+
|
173 |
+
$$('#payment_form_ewayrapid_ewayone select[name*=payment]').each(function(inp) {
|
174 |
+
inp.removeAttribute('disabled');
|
175 |
+
});
|
176 |
+
|
177 |
+
$$('#payment_form_ewayrapid_ewayone input[data-eway-encrypt-name*=payment]').each(function(inp) {
|
178 |
+
inp.removeAttribute('disabled');
|
179 |
+
});
|
180 |
+
});
|
181 |
+
</script>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
@@ -60,4 +59,15 @@
|
|
60 |
</div>
|
61 |
</li>
|
62 |
<?php echo $this->getChildHtml() ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
</ul>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
59 |
</div>
|
60 |
</li>
|
61 |
<?php echo $this->getChildHtml() ?>
|
62 |
+
<?php if($this->hasVerification()): ?>
|
63 |
+
<li id="<?php echo $_code ?>_cc_type_cvv_div">
|
64 |
+
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
65 |
+
<div class="input-box">
|
66 |
+
<div class="v-fix">
|
67 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" data-eway-encrypt-name="payment[cc_cid]" value="" pattern="\d*"/>
|
68 |
+
</div>
|
69 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
70 |
+
</div>
|
71 |
+
</li>
|
72 |
+
<?php endif; ?>
|
73 |
</ul>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_code = $this->getMethodCode()
|
28 |
+
?>
|
29 |
+
<?php if($this->checkSaveCardAvailable()): ?>
|
30 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display: none;width: 80%;padding-top: 8px;">
|
31 |
+
<li>
|
32 |
+
<div class="input-box">
|
33 |
+
<div class="v-fix">
|
34 |
+
<select id="ewayrapid_ewayone_token" name="payment[saved_token]" class="ewayrapid_ewayone_token">
|
35 |
+
<?php
|
36 |
+
$_tokens = $this->getTokenList();
|
37 |
+
$_defaultToken = isset($_tokens['default_token']) ? $_tokens['default_token'] : false;
|
38 |
+
?>
|
39 |
+
<?php foreach($_tokens['tokens'] as $_key => $_token): ?>
|
40 |
+
<?php /* @var Eway_Rapid31_Model_Customer_Token $_token */ ?>
|
41 |
+
<option value="<?php echo $_key ?>" <?php if($_key == $_defaultToken): ?>selected="selected"<?php endif; ?>>
|
42 |
+
<?php echo $_token->getCard() ?>
|
43 |
+
</option>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
</select>
|
46 |
+
</div>
|
47 |
+
<?php if(Mage::getSingleton('ewayrapid/config')->canEditToken() && count($_tokens['tokens']) > 1): ?>
|
48 |
+
<?php endif; ?>
|
49 |
+
</div>
|
50 |
+
</li>
|
51 |
+
|
52 |
+
<?php if($this->checkSaveCardAvailable() && $this->getSaveCard()): ?>
|
53 |
+
<li id="eway_save_card" class="saved_token_fields">
|
54 |
+
<div class="v-fix">
|
55 |
+
<input type="checkbox" title="<?php echo $this->getSaveText() ?>" id="<?php echo $_code ?>_cc_save_card"
|
56 |
+
<?php echo $this->getSaveDefaultCheck() ? 'checked' : '' ?> name="payment[save_card]" value="1" pattern="\d*"/>
|
57 |
+
<label for="<?php echo $_code ?>_cc_save_card" ><?php echo $this->getSaveText() ?></label>
|
58 |
+
</div>
|
59 |
+
</li>
|
60 |
+
<?php endif; ?>
|
61 |
+
</ul>
|
62 |
+
|
63 |
+
<script type="text/javascript">
|
64 |
+
var ewayPaymentToken = new EwayPaymentToken(
|
65 |
+
<?php echo $_tokens['tokens_json'] ?>,
|
66 |
+
<?php echo count($_tokens['tokens']) ?>,
|
67 |
+
false,
|
68 |
+
'<?php echo $this->__('Edit') ?>',
|
69 |
+
'<?php echo $this->__('Cancel edit') ?>'
|
70 |
+
)
|
71 |
+
|
72 |
+
$$('.help-disabled-cc a').each(function(element){
|
73 |
+
Event.observe(element, 'click', toggleToolTipCc);
|
74 |
+
});
|
75 |
+
|
76 |
+
function toggleToolTipCc(event){
|
77 |
+
if($('cc-help-tool-tip')){
|
78 |
+
$('cc-help-tool-tip').toggle();
|
79 |
+
}
|
80 |
+
Event.stop(event);
|
81 |
+
}
|
82 |
+
if($('cc-help-tool-tip-close')){
|
83 |
+
Event.observe($('cc-help-tool-tip-close'), 'click', toggleToolTipCc);
|
84 |
+
}
|
85 |
+
|
86 |
+
</script>
|
87 |
+
<?php endif; ?>
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_code = $this->getMethodCode();
|
28 |
+
?>
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_helper = Mage::helper('ewayrapid');
|
28 |
+
/* @var Eway_Rapid31_Block_Info_Direct_Notsaved $this */
|
29 |
+
$_info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $_info */
|
31 |
+
?>
|
32 |
+
<div class="cards-list">
|
33 |
+
|
34 |
+
<?php if (!$this->getHideTitle()): ?>
|
35 |
+
<div class="bold"><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></div>
|
36 |
+
<?php endif;?>
|
37 |
+
|
38 |
+
<table class="info-table">
|
39 |
+
<tbody>
|
40 |
+
<?php if($_info->getTokenId()): ?>
|
41 |
+
<tr>
|
42 |
+
<td><?php echo $_helper->__('Payer ID') ?>:</td>
|
43 |
+
<td><?php echo $this->getTokenId() ?></td>
|
44 |
+
</tr>
|
45 |
+
<?php endif; ?>
|
46 |
+
|
47 |
+
<?php if($_info->getCcLast4()): ?>
|
48 |
+
<tr>
|
49 |
+
<td><?php echo $_helper->__('Credit Card Number') ?>:</td>
|
50 |
+
<td><?php echo str_pad($_info->getCcLast4(), 16, '*', STR_PAD_LEFT); ?></td>
|
51 |
+
</tr>
|
52 |
+
<?php endif; ?>
|
53 |
+
|
54 |
+
<?php if($_info->getLastTransId()): ?>
|
55 |
+
<tr>
|
56 |
+
<td><?php echo $_helper->__('Last Transaction ID') ?>:</td>
|
57 |
+
<td><?php echo $_info->getLastTransId(); ?></td>
|
58 |
+
</tr>
|
59 |
+
<?php endif; ?>
|
60 |
+
|
61 |
+
<?php if($_info['beagle_score'] > 0): ?>
|
62 |
+
<tr>
|
63 |
+
<td><?php echo $_helper->__('Beagle Score') ?>:</td>
|
64 |
+
<td><?php echo $_info['beagle_score']; ?></td>
|
65 |
+
</tr>
|
66 |
+
<?php endif; ?>
|
67 |
+
|
68 |
+
<?php if(is_array($_info['beagle_verification'])): ?>
|
69 |
+
<?php $_verifications = array_filter(unserialize($_info['beagle_verification']) ) ?>
|
70 |
+
<?php endif; ?>
|
71 |
+
|
72 |
+
<?php if(!empty($_verifications)): ?>
|
73 |
+
<tr>
|
74 |
+
<td><?php echo $_helper->__('Beagle Verification') ?>:</td>
|
75 |
+
<td>
|
76 |
+
<?php $count = 0; ?>
|
77 |
+
<?php foreach($_verifications as $key => $_verificationCode): ?>
|
78 |
+
<?php
|
79 |
+
$_verificationTitle = Mage::helper('ewayrapid')->getBeagleVerificationTitle($_verificationCode);
|
80 |
+
?>
|
81 |
+
<span><?php echo $count ? ', ' : '' ?><?php echo $key . ': ' . $_verificationTitle ?></span>
|
82 |
+
<?php $count++ ?>
|
83 |
+
<?php endforeach; ?>
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
<?php endif; ?>
|
87 |
+
|
88 |
+
</tbody>
|
89 |
+
</table>
|
90 |
+
</div>
|
@@ -20,7 +20,7 @@
|
|
20 |
*
|
21 |
* @category design
|
22 |
* @package default_default
|
23 |
-
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
@@ -29,7 +29,7 @@ $_helper = Mage::helper('ewayrapid');
|
|
29 |
/* @var Eway_Rapid31_Block_Info_Direct_Notsaved $this */
|
30 |
$_info = $this->getInfo();
|
31 |
/* @var Mage_Sales_Model_Order_Payment $_info */
|
32 |
-
|
33 |
?>
|
34 |
<div class="cards-list">
|
35 |
|
@@ -73,6 +73,32 @@ $_info = $this->getInfo();
|
|
73 |
<td><?php echo $_info->getLastTransId(); ?></td>
|
74 |
</tr>
|
75 |
<?php endif;?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
</tbody>
|
77 |
</table>
|
78 |
</div>
|
20 |
*
|
21 |
* @category design
|
22 |
* @package default_default
|
23 |
+
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
29 |
/* @var Eway_Rapid31_Block_Info_Direct_Notsaved $this */
|
30 |
$_info = $this->getInfo();
|
31 |
/* @var Mage_Sales_Model_Order_Payment $_info */
|
32 |
+
$_additionalInfo = $_info->getAdditionalInformation();
|
33 |
?>
|
34 |
<div class="cards-list">
|
35 |
|
73 |
<td><?php echo $_info->getLastTransId(); ?></td>
|
74 |
</tr>
|
75 |
<?php endif;?>
|
76 |
+
|
77 |
+
<?php if($_info['beagle_score'] > 0): ?>
|
78 |
+
<tr>
|
79 |
+
<td><?php echo $_helper->__('Beagle Score') ?>:</td>
|
80 |
+
<td><?php echo $_info['beagle_score']; ?></td>
|
81 |
+
</tr>
|
82 |
+
<?php endif; ?>
|
83 |
+
|
84 |
+
<?php if (isset($_info['beagle_verification'])):
|
85 |
+
$_verifications = array_filter(unserialize($_info['beagle_verification']) );
|
86 |
+
endif; ?>
|
87 |
+
<?php if(isset($_verifications) && !empty($_verifications)): ?>
|
88 |
+
<tr>
|
89 |
+
<td><?php echo $_helper->__('Beagle Verification') ?>:</td>
|
90 |
+
<td>
|
91 |
+
<?php $count = 0; ?>
|
92 |
+
<?php foreach($_verifications as $key => $_verificationCode): ?>
|
93 |
+
<?php
|
94 |
+
$_verificationTitle = Mage::helper('ewayrapid')->getBeagleVerificationTitle($_verificationCode);
|
95 |
+
?>
|
96 |
+
<span><?php echo $count ? ',' : '' ?><?php echo $key . ' : ' . $_verificationTitle ?></span>
|
97 |
+
<?php $count++ ?>
|
98 |
+
<?php endforeach; ?>
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<?php endif; ?>
|
102 |
</tbody>
|
103 |
</table>
|
104 |
</div>
|
@@ -20,7 +20,6 @@
|
|
20 |
*
|
21 |
* @category design
|
22 |
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
@@ -29,7 +28,6 @@ $_helper = Mage::helper('ewayrapid');
|
|
29 |
/* @var Eway_Rapid31_Block_Info_Direct_Notsaved $this */
|
30 |
$_info = $this->getInfo();
|
31 |
/* @var Mage_Sales_Model_Order_Payment $_info */
|
32 |
-
|
33 |
?>
|
34 |
<div class="cards-list">
|
35 |
|
@@ -59,6 +57,33 @@ $_info = $this->getInfo();
|
|
59 |
<td><?php echo $_info->getLastTransId(); ?></td>
|
60 |
</tr>
|
61 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
</tbody>
|
63 |
</table>
|
64 |
</div>
|
20 |
*
|
21 |
* @category design
|
22 |
* @package default_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
28 |
/* @var Eway_Rapid31_Block_Info_Direct_Notsaved $this */
|
29 |
$_info = $this->getInfo();
|
30 |
/* @var Mage_Sales_Model_Order_Payment $_info */
|
|
|
31 |
?>
|
32 |
<div class="cards-list">
|
33 |
|
57 |
<td><?php echo $_info->getLastTransId(); ?></td>
|
58 |
</tr>
|
59 |
<?php endif; ?>
|
60 |
+
|
61 |
+
<?php if($_info['beagle_score'] > 0): ?>
|
62 |
+
<tr>
|
63 |
+
<td><?php echo $_helper->__('Beagle Score') ?>:</td>
|
64 |
+
<td><?php echo $_info['beagle_score']; ?></td>
|
65 |
+
</tr>
|
66 |
+
<?php endif; ?>
|
67 |
+
|
68 |
+
<?php if (isset($_info['beagle_verification'])):
|
69 |
+
$_verifications = array_filter(unserialize($_info['beagle_verification']) );
|
70 |
+
endif; ?>
|
71 |
+
<?php if(isset($_verifications) && !empty($_verifications)): ?>
|
72 |
+
<tr>
|
73 |
+
<td><?php echo $_helper->__('Beagle Verification') ?>:</td>
|
74 |
+
<td>
|
75 |
+
<?php $count = 0; ?>
|
76 |
+
<?php foreach($_verifications as $key => $_verificationCode): ?>
|
77 |
+
<?php
|
78 |
+
$_verificationTitle = Mage::helper('ewayrapid')->getBeagleVerificationTitle($_verificationCode);
|
79 |
+
?>
|
80 |
+
<span><?php echo $count ? ',' : '' ?><?php echo $key . ' : ' . $_verificationTitle ?></span>
|
81 |
+
<?php $count++ ?>
|
82 |
+
<?php endforeach; ?>
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
<?php endif; ?>
|
86 |
+
|
87 |
</tbody>
|
88 |
</table>
|
89 |
</div>
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_helper = Mage::helper('ewayrapid');
|
28 |
+
/* @var Eway_Rapid31_Block_Info_Direct_Notsaved $this */
|
29 |
+
$_info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $_info */
|
31 |
+
$_additionalInfo = $_info->getAdditionalInformation();
|
32 |
+
?>
|
33 |
+
<div class="cards-list">
|
34 |
+
|
35 |
+
<?php if (!$this->getHideTitle()): ?>
|
36 |
+
<div class="bold"><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></div>
|
37 |
+
<?php endif;?>
|
38 |
+
|
39 |
+
<table class="info-table">
|
40 |
+
<tbody>
|
41 |
+
<?php if($_info->getCcOwner()) : ?>
|
42 |
+
<tr>
|
43 |
+
<td><?php echo $_helper->__('Card Holder\'s Name') ?>:</td>
|
44 |
+
<td><?php echo $_info->getCcOwner(); ?></td>
|
45 |
+
</tr>
|
46 |
+
<?php endif;?>
|
47 |
+
|
48 |
+
<?php if($_info->getCcLast4()) : ?>
|
49 |
+
<tr>
|
50 |
+
<td><?php echo $_helper->__('Credit Card Number') ?>:</td>
|
51 |
+
<td><?php echo str_pad($_info->getCcLast4(), 16, '*', STR_PAD_LEFT); ?></td>
|
52 |
+
</tr>
|
53 |
+
<?php endif;?>
|
54 |
+
|
55 |
+
<?php if($_info->getCcExpMonth()) : ?>
|
56 |
+
<tr>
|
57 |
+
<td><?php echo $_helper->__('Credit Card Expiry') ?>:</td>
|
58 |
+
<td><?php echo str_pad($_info->getCcExpMonth(), 2, '0', STR_PAD_LEFT); ?> / <?php echo $_info->getCcExpYear() ?></td>
|
59 |
+
</tr>
|
60 |
+
<?php endif;?>
|
61 |
+
|
62 |
+
<?php if($_info->getCcType()) : ?>
|
63 |
+
<tr>
|
64 |
+
<td><?php echo $_helper->__('Credit Card Type') ?>:</td>
|
65 |
+
<td><?php echo $this->getCcTypeName($_info->getCcType()); ?></td>
|
66 |
+
</tr>
|
67 |
+
<?php endif;?>
|
68 |
+
|
69 |
+
<?php if($_info->getLastTransId()) : ?>
|
70 |
+
<tr>
|
71 |
+
<td><?php echo $_helper->__('Last Transaction ID') ?>:</td>
|
72 |
+
<td><?php echo $_info->getLastTransId(); ?></td>
|
73 |
+
</tr>
|
74 |
+
<?php endif;?>
|
75 |
+
|
76 |
+
<?php if($_info['beagle_score'] > 0): ?>
|
77 |
+
<tr>
|
78 |
+
<td><?php echo $_helper->__('Beagle Score') ?>:</td>
|
79 |
+
<td><?php echo $_info['beagle_score']; ?></td>
|
80 |
+
</tr>
|
81 |
+
<?php endif; ?>
|
82 |
+
|
83 |
+
<?php if (isset($_info['beagle_verification'])):
|
84 |
+
$_verifications = array_filter(unserialize($_info['beagle_verification']) );
|
85 |
+
endif; ?>
|
86 |
+
<?php if(isset($_verifications) && !empty($_verifications)): ?>
|
87 |
+
<tr>
|
88 |
+
<td><?php echo $_helper->__('Beagle Verification') ?>:</td>
|
89 |
+
<td>
|
90 |
+
<?php $count = 0; ?>
|
91 |
+
<?php foreach($_verifications as $key => $_verificationCode): ?>
|
92 |
+
<?php
|
93 |
+
$_verificationTitle = Mage::helper('ewayrapid')->getBeagleVerificationTitle($_verificationCode);
|
94 |
+
?>
|
95 |
+
<span><?php echo $count ? ',' : '' ?><?php echo $key . ' : ' . $_verificationTitle ?></span>
|
96 |
+
<?php $count++ ?>
|
97 |
+
<?php endforeach; ?>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
<?php endif; ?>
|
101 |
+
</tbody>
|
102 |
+
</table>
|
103 |
+
</div>
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_helper = Mage::helper('ewayrapid');
|
28 |
+
/* @var Eway_Rapid31_Block_Info_Direct_Notsaved $this */
|
29 |
+
$_info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $_info */
|
31 |
+
$_additionalInfo = $_info->getAdditionalInformation();
|
32 |
+
?>
|
33 |
+
<div class="cards-list">
|
34 |
+
|
35 |
+
<?php if (!$this->getHideTitle()): ?>
|
36 |
+
<div class="bold"><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></div>
|
37 |
+
<?php endif;?>
|
38 |
+
|
39 |
+
<table class="info-table">
|
40 |
+
<tbody>
|
41 |
+
<?php if($_info->getCcOwner()) : ?>
|
42 |
+
<tr>
|
43 |
+
<td><?php echo $_helper->__('Card Holder\'s Name') ?>:</td>
|
44 |
+
<td><?php echo $_info->getCcOwner(); ?></td>
|
45 |
+
</tr>
|
46 |
+
<?php endif;?>
|
47 |
+
|
48 |
+
<?php if($_info->getCcLast4()) : ?>
|
49 |
+
<tr>
|
50 |
+
<td><?php echo $_helper->__('Credit Card Number') ?>:</td>
|
51 |
+
<td><?php echo str_pad($_info->getCcLast4(), 16, '*', STR_PAD_LEFT); ?></td>
|
52 |
+
</tr>
|
53 |
+
<?php endif;?>
|
54 |
+
|
55 |
+
<?php if($_info->getCcExpMonth()) : ?>
|
56 |
+
<tr>
|
57 |
+
<td><?php echo $_helper->__('Credit Card Expiry') ?>:</td>
|
58 |
+
<td><?php echo str_pad($_info->getCcExpMonth(), 2, '0', STR_PAD_LEFT); ?> / <?php echo $_info->getCcExpYear() ?></td>
|
59 |
+
</tr>
|
60 |
+
<?php endif;?>
|
61 |
+
|
62 |
+
<?php if($_info->getCcType()) : ?>
|
63 |
+
<tr>
|
64 |
+
<td><?php echo $_helper->__('Credit Card Type') ?>:</td>
|
65 |
+
<td><?php echo $this->getCcTypeName($_info->getCcType()); ?></td>
|
66 |
+
</tr>
|
67 |
+
<?php endif;?>
|
68 |
+
|
69 |
+
<?php if($_info->getLastTransId()) : ?>
|
70 |
+
<tr>
|
71 |
+
<td><?php echo $_helper->__('Last Transaction ID') ?>:</td>
|
72 |
+
<td><?php echo $_info->getLastTransId(); ?></td>
|
73 |
+
</tr>
|
74 |
+
<?php endif;?>
|
75 |
+
|
76 |
+
<?php if($_info['beagle_score'] > 0): ?>
|
77 |
+
<tr>
|
78 |
+
<td><?php echo $_helper->__('Beagle Score') ?>:</td>
|
79 |
+
<td><?php echo $_info['beagle_score']; ?></td>
|
80 |
+
</tr>
|
81 |
+
<?php endif; ?>
|
82 |
+
|
83 |
+
<?php if (isset($_info['beagle_verification'])):
|
84 |
+
$_verifications = array_filter(unserialize($_info['beagle_verification']) );
|
85 |
+
endif; ?>
|
86 |
+
<?php if(isset($_verifications) && !empty($_verifications)): ?>
|
87 |
+
<tr>
|
88 |
+
<td><?php echo $_helper->__('Beagle Verification') ?>:</td>
|
89 |
+
<td>
|
90 |
+
<?php $count = 0; ?>
|
91 |
+
<?php foreach($_verifications as $key => $_verificationCode): ?>
|
92 |
+
<?php
|
93 |
+
$_verificationTitle = Mage::helper('ewayrapid')->getBeagleVerificationTitle($_verificationCode);
|
94 |
+
?>
|
95 |
+
<span><?php echo $count ? ',' : '' ?><?php echo $key . ' : ' . $_verificationTitle ?></span>
|
96 |
+
<?php $count++ ?>
|
97 |
+
<?php endforeach; ?>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
<?php endif; ?>
|
101 |
+
</tbody>
|
102 |
+
</table>
|
103 |
+
</div>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package default_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -2,7 +2,9 @@
|
|
2 |
<layout version="0.1.0">
|
3 |
<checkout_onepage_index>
|
4 |
<reference name="head">
|
5 |
-
<
|
|
|
|
|
6 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
7 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
8 |
</reference>
|
@@ -17,7 +19,9 @@
|
|
17 |
|
18 |
<checkout_multishipping_billing>
|
19 |
<reference name="head">
|
20 |
-
<
|
|
|
|
|
21 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
22 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
23 |
</reference>
|
@@ -35,7 +39,7 @@
|
|
35 |
|
36 |
<customer_account>
|
37 |
<reference name="customer_account_navigation">
|
38 |
-
<action ifconfig="payment/
|
39 |
<name>my-creditcards</name>
|
40 |
<path>ewayrapid/mycards/</path>
|
41 |
<label>My Credit Cards</label>
|
@@ -59,7 +63,9 @@
|
|
59 |
|
60 |
<ewayrapid_mycards_edit>
|
61 |
<reference name="head">
|
62 |
-
|
|
|
|
|
63 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
64 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
65 |
</reference>
|
@@ -71,7 +77,9 @@
|
|
71 |
|
72 |
<onestepcheckout_index_index>
|
73 |
<reference name="head">
|
74 |
-
<
|
|
|
|
|
75 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
76 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
77 |
</reference>
|
@@ -89,7 +97,9 @@
|
|
89 |
|
90 |
<firecheckout_index_index>
|
91 |
<reference name="head">
|
92 |
-
<
|
|
|
|
|
93 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
94 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
95 |
</reference>
|
@@ -107,7 +117,9 @@
|
|
107 |
|
108 |
<opc_index_index>
|
109 |
<reference name="head">
|
110 |
-
<
|
|
|
|
|
111 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
112 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
113 |
</reference>
|
@@ -125,7 +137,9 @@
|
|
125 |
|
126 |
<gomage_checkout_onepage_index>
|
127 |
<reference name="head">
|
128 |
-
<
|
|
|
|
|
129 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
130 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
131 |
</reference>
|
2 |
<layout version="0.1.0">
|
3 |
<checkout_onepage_index>
|
4 |
<reference name="head">
|
5 |
+
<block type="core/text" name="external_js">
|
6 |
+
<action method="setText"><text><![CDATA[<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>]]> </text> </action>
|
7 |
+
</block>
|
8 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
9 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
10 |
</reference>
|
19 |
|
20 |
<checkout_multishipping_billing>
|
21 |
<reference name="head">
|
22 |
+
<block type="core/text" name="external_js">
|
23 |
+
<action method="setText"><text><![CDATA[<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>]]> </text> </action>
|
24 |
+
</block>
|
25 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
26 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
27 |
</reference>
|
39 |
|
40 |
<customer_account>
|
41 |
<reference name="customer_account_navigation">
|
42 |
+
<action ifconfig="payment/ewayrapid_ewayone/active" method="addLink" translate="label" module="ewayrapid">
|
43 |
<name>my-creditcards</name>
|
44 |
<path>ewayrapid/mycards/</path>
|
45 |
<label>My Credit Cards</label>
|
63 |
|
64 |
<ewayrapid_mycards_edit>
|
65 |
<reference name="head">
|
66 |
+
<block type="core/text" name="external_js">
|
67 |
+
<action method="setText"><text><![CDATA[<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>]]> </text> </action>
|
68 |
+
</block>
|
69 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
70 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
71 |
</reference>
|
77 |
|
78 |
<onestepcheckout_index_index>
|
79 |
<reference name="head">
|
80 |
+
<block type="core/text" name="external_js">
|
81 |
+
<action method="setText"><text><![CDATA[<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>]]> </text> </action>
|
82 |
+
</block>
|
83 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
84 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
85 |
</reference>
|
97 |
|
98 |
<firecheckout_index_index>
|
99 |
<reference name="head">
|
100 |
+
<block type="core/text" name="external_js">
|
101 |
+
<action method="setText"><text><![CDATA[<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>]]> </text> </action>
|
102 |
+
</block>
|
103 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
104 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
105 |
</reference>
|
117 |
|
118 |
<opc_index_index>
|
119 |
<reference name="head">
|
120 |
+
<block type="core/text" name="external_js">
|
121 |
+
<action method="setText"><text><![CDATA[<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>]]> </text> </action>
|
122 |
+
</block>
|
123 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
124 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
125 |
</reference>
|
137 |
|
138 |
<gomage_checkout_onepage_index>
|
139 |
<reference name="head">
|
140 |
+
<block type="core/text" name="external_js">
|
141 |
+
<action method="setText"><text><![CDATA[<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>]]> </text> </action>
|
142 |
+
</block>
|
143 |
<action ifconfig="payment/ewayrapid_general/active" method="addJs"><script>ewayrapid/ewayrapid.js</script></action>
|
144 |
<action ifconfig="payment/ewayrapid_general/active" method="addCss"><script>css/ewayrapid.css</script></action>
|
145 |
</reference>
|
@@ -6,16 +6,24 @@ $_address = $this->getCustomerAddress();
|
|
6 |
$connectionType = Mage::getStoreConfig('payment/ewayrapid_general/connection_type');
|
7 |
$formUrl = $this->getSaveUrl();
|
8 |
$transparent = false;
|
|
|
|
|
9 |
switch ($connectionType) {
|
10 |
case Eway_Rapid31_Model_Config::CONNECTION_DIRECT:
|
11 |
-
echo '<script type="text/javascript" src="
|
12 |
break;
|
13 |
case Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT:
|
14 |
$transparent = true;
|
|
|
15 |
break;
|
16 |
case Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE:
|
17 |
$formUrl = Mage::getBaseUrl() . '/ewayrapid/mycards/getAccessCode';
|
18 |
break;
|
|
|
|
|
|
|
|
|
|
|
19 |
default:
|
20 |
break;
|
21 |
}
|
@@ -45,7 +53,7 @@ if ($_token->getTokenId()) {
|
|
45 |
|
46 |
<!-- Card info -->
|
47 |
<?php
|
48 |
-
if ($connectionType !== Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
|
49 |
?>
|
50 |
<div class="fieldset">
|
51 |
<?php echo $this->getBlockHtml('formkey') ?>
|
@@ -429,12 +437,12 @@ if ($connectionType !== Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
|
|
429 |
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>">
|
430 |
<small>« </small><?php echo $this->__('Back') ?></a></p>
|
431 |
<?php
|
432 |
-
echo $transparent ? '<button type="button" onclick="
|
433 |
. $this->__('Save Credit Card') . '" class="button"><span><span>'
|
434 |
. $this->__('Save Credit Card') . '</span></span></button>'
|
435 |
. '<span id="save-please-wait" class="please-wait" style="display:none;">
|
436 |
<img class="v-middle" title="Loading..." alt="Loading..." src="'
|
437 |
-
. Mage::getBaseUrl() . '/skin/frontend/
|
438 |
Please waiting ...
|
439 |
</span>'
|
440 |
: '<button type="submit" title="' . $this->__('Save Credit Card') . '" class="button"><span><span>' . $this->__('Save Credit Card') . '</span></span></button>';
|
@@ -611,5 +619,88 @@ if ($connectionType !== Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
|
|
611 |
return false;
|
612 |
}
|
613 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
614 |
//]]>
|
615 |
</script>
|
6 |
$connectionType = Mage::getStoreConfig('payment/ewayrapid_general/connection_type');
|
7 |
$formUrl = $this->getSaveUrl();
|
8 |
$transparent = false;
|
9 |
+
$iframe = false;
|
10 |
+
$submitFunction = '';
|
11 |
switch ($connectionType) {
|
12 |
case Eway_Rapid31_Model_Config::CONNECTION_DIRECT:
|
13 |
+
echo '<script type="text/javascript" src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>';
|
14 |
break;
|
15 |
case Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT:
|
16 |
$transparent = true;
|
17 |
+
$submitFunction = 'beforeSubmit';
|
18 |
break;
|
19 |
case Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE:
|
20 |
$formUrl = Mage::getBaseUrl() . '/ewayrapid/mycards/getAccessCode';
|
21 |
break;
|
22 |
+
case Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME:
|
23 |
+
$formUrl = Mage::getBaseUrl() . '/ewayrapid/mycards/getAccessCode';
|
24 |
+
$iframe = true;
|
25 |
+
$submitFunction = 'beforeSubmitIframe';
|
26 |
+
break;
|
27 |
default:
|
28 |
break;
|
29 |
}
|
53 |
|
54 |
<!-- Card info -->
|
55 |
<?php
|
56 |
+
if ($connectionType !== Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE && $connectionType !== Eway_Rapid31_Model_Config::CONNECTION_RAPID_IFRAME) {
|
57 |
?>
|
58 |
<div class="fieldset">
|
59 |
<?php echo $this->getBlockHtml('formkey') ?>
|
437 |
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>">
|
438 |
<small>« </small><?php echo $this->__('Back') ?></a></p>
|
439 |
<?php
|
440 |
+
echo $transparent || $iframe ? '<button type="button" onclick="'.$submitFunction.'(this)" title="'
|
441 |
. $this->__('Save Credit Card') . '" class="button"><span><span>'
|
442 |
. $this->__('Save Credit Card') . '</span></span></button>'
|
443 |
. '<span id="save-please-wait" class="please-wait" style="display:none;">
|
444 |
<img class="v-middle" title="Loading..." alt="Loading..." src="'
|
445 |
+
. Mage::getBaseUrl() . '/skin/frontend/rwd/default/images/opc-ajax-loader.gif">
|
446 |
Please waiting ...
|
447 |
</span>'
|
448 |
: '<button type="submit" title="' . $this->__('Save Credit Card') . '" class="button"><span><span>' . $this->__('Save Credit Card') . '</span></span></button>';
|
619 |
return false;
|
620 |
}
|
621 |
|
622 |
+
// Iframe
|
623 |
+
|
624 |
+
ewayReturnUrl = '';
|
625 |
+
|
626 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
627 |
+
if (result == "Complete") {
|
628 |
+
setLocation(ewayReturnUrl);
|
629 |
+
} else if (result == "Error") {
|
630 |
+
alert("There was a problem while connecting to payment gateway: " + errors);
|
631 |
+
dataForm.form.down('button').setStyle({'display': 'block'});
|
632 |
+
$('save-please-wait').setStyle({'display': 'none'});
|
633 |
+
} else{
|
634 |
+
dataForm.form.down('button').setStyle({'display': 'block'});
|
635 |
+
$('save-please-wait').setStyle({'display': 'none'});
|
636 |
+
}
|
637 |
+
}
|
638 |
+
|
639 |
+
function beforeSubmitIframe(obj) {
|
640 |
+
$('validate_from_date_message') != null ? $('validate_from_date_message').remove() : '';
|
641 |
+
|
642 |
+
if (typeof isTest !== 'undefined') {
|
643 |
+
// Alert error code ERR-012
|
644 |
+
alert('An error occurred while connecting to payment gateway. Please try again later.!');
|
645 |
+
return false;
|
646 |
+
}
|
647 |
+
|
648 |
+
var validate = dataForm.validator.validate();
|
649 |
+
if (!validate) {
|
650 |
+
return;
|
651 |
+
}
|
652 |
+
|
653 |
+
// Waiting
|
654 |
+
$(obj).setStyle({'display': 'none'});
|
655 |
+
$('save-please-wait').setStyle({'display': 'block'});
|
656 |
+
|
657 |
+
// Get access code
|
658 |
+
new Ajax.Request('<?php echo Mage::getBaseUrl() ?>/ewayrapid/mycards/getAccessCode',
|
659 |
+
{
|
660 |
+
method: 'post',
|
661 |
+
parameters: $('form-validate').serialize(true),
|
662 |
+
onSuccess: function (transport) {
|
663 |
+
if (transport.responseText) {
|
664 |
+
var data = JSON.parse(transport.responseText);
|
665 |
+
if (typeof data == 'object') {
|
666 |
+
|
667 |
+
// Check login require
|
668 |
+
if (data.login != undefined) {
|
669 |
+
alert('Session has expired');
|
670 |
+
window.location = window.location.href;
|
671 |
+
}
|
672 |
+
|
673 |
+
if (typeof data.SharedPaymentUrl != 'undefined' & data.SharedPaymentUrl != null) {
|
674 |
+
|
675 |
+
var eWAYConfig = {
|
676 |
+
sharedPaymentUrl: data.SharedPaymentUrl
|
677 |
+
};
|
678 |
+
|
679 |
+
ewayReturnUrl = data.ReturnUrl;
|
680 |
+
|
681 |
+
eCrypt.showModalPayment(eWAYConfig, eWayRapidCallback);
|
682 |
+
|
683 |
+
return;
|
684 |
+
}
|
685 |
+
else {
|
686 |
+
// Alert error code ERR-012
|
687 |
+
alert('An error occurred while connecting to payment gateway. Please try again later.!');
|
688 |
+
}
|
689 |
+
} else {
|
690 |
+
alert(transport.responseText)
|
691 |
+
}
|
692 |
+
|
693 |
+
// Remove style waiting
|
694 |
+
$(obj).setStyle({'display': 'block'});
|
695 |
+
$('save-please-wait').setStyle({'display': 'none'});
|
696 |
+
}
|
697 |
+
},
|
698 |
+
onFailure: function () {
|
699 |
+
alert('Something went wrong...')
|
700 |
+
}
|
701 |
+
});
|
702 |
+
return false;
|
703 |
+
}
|
704 |
+
|
705 |
//]]>
|
706 |
</script>
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_code = $this->getMethodCode();
|
28 |
+
$userLogger = Mage::getSingleton('customer/session')->isLoggedIn();
|
29 |
+
?>
|
30 |
+
|
31 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display: none">
|
32 |
+
<?php if($this->checkSaveCardAvailable()): ?>
|
33 |
+
<?php
|
34 |
+
$_tokens = $this->getTokenList();
|
35 |
+
$_defaultToken = isset($_tokens['default_token']) ? $_tokens['default_token'] : false;
|
36 |
+
?>
|
37 |
+
<li <?php echo count($_tokens['tokens']) <= 1 ? 'style="display:none;"' : '' ?>>
|
38 |
+
<div class="input-box">
|
39 |
+
<div class="v-fix">
|
40 |
+
<select id="ewayrapid_ewayone_token" name="payment[saved_token]" class="ewayrapid_ewayone_token">
|
41 |
+
<?php foreach($_tokens['tokens'] as $_key => $_token):
|
42 |
+
if ($_key == Eway_Rapid31_Model_Config::TOKEN_NEW || $this->checkCardName($_token) == Eway_Rapid31_Model_Config::CREDITCARD_METHOD): ?>
|
43 |
+
<?php /* @var Eway_Rapid31_Model_Customer_Token $_token */ ?>
|
44 |
+
<option value="<?php echo $_key ?>" <?php if($_key == $_defaultToken): ?>selected="selected"<?php endif; ?>>
|
45 |
+
<?php echo $_token->getCard() ?>
|
46 |
+
</option>
|
47 |
+
<?php endif; ?>
|
48 |
+
<?php endforeach; ?>
|
49 |
+
</select>
|
50 |
+
</div>
|
51 |
+
<?php if(Mage::getSingleton('ewayrapid/config')->canEditToken() && count($_tokens['tokens']) > 1): ?>
|
52 |
+
<div class="v-fix">
|
53 |
+
<a id="ewayrapid_ewayone_edit" class="ewayrapid_ewayone_edit" href="javascript:void(0);"><?php echo $this->__('Edit') ?></a>
|
54 |
+
</div>
|
55 |
+
<?php endif; ?>
|
56 |
+
</div>
|
57 |
+
</li>
|
58 |
+
<?php endif; ?>
|
59 |
+
<li <?php echo $userLogger ? 'class="saved_token_fields" style="display: none"' :'' ?>>
|
60 |
+
<label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
61 |
+
<div class="input-box">
|
62 |
+
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>" />
|
63 |
+
</div>
|
64 |
+
</li>
|
65 |
+
<li <?php echo $userLogger ? 'class="saved_token_fields" style="display: none"' :'' ?>>
|
66 |
+
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
67 |
+
<div class="input-box help-disabled-cc">
|
68 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" data-eway-encrypt-name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type-auto" value="" pattern="\d*"/>
|
69 |
+
<input type="hidden" id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" />
|
70 |
+
<a class="card-number-help" href="#"><?php echo $this->__('Help') ?></a>
|
71 |
+
<div class="tool-tip" id="cc-help-tool-tip" style="display:none;">
|
72 |
+
<div class="btn-close"><a href="#" id="cc-help-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
|
73 |
+
<div class="tool-tip-content">To use a new credit card number, please add another card</div>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
</li>
|
77 |
+
<li <?php echo $userLogger ? 'class="saved_token_fields" style="display: none"' :'' ?>>
|
78 |
+
<label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
|
79 |
+
<div class="input-box">
|
80 |
+
<div class="v-fix">
|
81 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
|
82 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
83 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
84 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
85 |
+
<?php endforeach ?>
|
86 |
+
</select>
|
87 |
+
</div>
|
88 |
+
<div class="v-fix">
|
89 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
90 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
|
91 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
92 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
93 |
+
<?php endforeach ?>
|
94 |
+
</select>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
</li>
|
98 |
+
<?php echo $this->getChildHtml() ?>
|
99 |
+
<?php if($this->hasVerification()): ?>
|
100 |
+
<li id="<?php echo $_code ?>_cc_type_cvv_div">
|
101 |
+
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
102 |
+
<div class="input-box">
|
103 |
+
<div class="v-fix">
|
104 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" data-eway-encrypt-name="payment[cc_cid]" value="" pattern="\d*"/>
|
105 |
+
</div>
|
106 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
107 |
+
</div>
|
108 |
+
</li>
|
109 |
+
<?php if ($this->getIsRecurring()) { ?>
|
110 |
+
<li>
|
111 |
+
<p>I authorize <?php echo Mage::app()->getStore()->getName(); ?> to charge the available balance
|
112 |
+
in my credit card for the future payments of this order. To make a change, I can go to
|
113 |
+
<a href="<?php echo Mage::getUrl('checkout/cart'); ?>">Cart</a>
|
114 |
+
</p>
|
115 |
+
<input type="checkbox" name="recurring-agree" class="recurring-agree required-entry"/><label class="lable-for-recurring" for="">Agree</label>
|
116 |
+
</li>
|
117 |
+
<?php } ?>
|
118 |
+
<?php endif; ?>
|
119 |
+
<?php if($this->checkSaveCardAvailable() && $this->getSaveCard()): ?>
|
120 |
+
<li id="eway_save_card" <?php echo $userLogger ? 'class="saved_token_fields" style="display: none"' :'' ?>>
|
121 |
+
<div class="v-fix">
|
122 |
+
<input type="checkbox" title="<?php echo $this->getSaveText() ?>" id="<?php echo $_code ?>_cc_save_card"
|
123 |
+
<?php echo $this->getSaveDefaultCheck() ? 'checked' : '' ?> name="payment[save_card]" value="1" pattern="\d*"/>
|
124 |
+
<label for="<?php echo $_code ?>_cc_save_card" ><?php echo $this->getSaveText() ?></label>
|
125 |
+
</div>
|
126 |
+
</li>
|
127 |
+
<?php endif; ?>
|
128 |
+
</ul>
|
129 |
+
<?php if($userLogger): ?>
|
130 |
+
<script type="text/javascript">
|
131 |
+
var ewayPaymentToken = new EwayPaymentToken(
|
132 |
+
<?php echo $_tokens['tokens_json'] ?>,
|
133 |
+
<?php echo count($_tokens['tokens']) ?>,
|
134 |
+
false,
|
135 |
+
'<?php echo $this->__('Edit') ?>',
|
136 |
+
'<?php echo $this->__('Cancel edit') ?>'
|
137 |
+
);
|
138 |
+
|
139 |
+
$$('.help-disabled-cc a').each(function(element){
|
140 |
+
Event.observe(element, 'click', toggleToolTipCc);
|
141 |
+
});
|
142 |
+
|
143 |
+
function toggleToolTipCc(event){
|
144 |
+
if($('cc-help-tool-tip')){
|
145 |
+
$('cc-help-tool-tip').toggle();
|
146 |
+
}
|
147 |
+
Event.stop(event);
|
148 |
+
}
|
149 |
+
if($('cc-help-tool-tip-close')){
|
150 |
+
Event.observe($('cc-help-tool-tip-close'), 'click', toggleToolTipCc);
|
151 |
+
}
|
152 |
+
|
153 |
+
</script>
|
154 |
+
<?php endif; ?>
|
155 |
+
<script type="text/javascript">
|
156 |
+
$('p_method_ewayrapid_ewayone').observe('click', function () {
|
157 |
+
$('p_method_ewayrapid_ewayone').setAttribute('checked', 'true');
|
158 |
+
$('p_method_ewayrapid_notsaved') && $('p_method_ewayrapid_notsaved').removeAttribute('checked');
|
159 |
+
|
160 |
+
$$('#payment_form_ewayrapid_ewayone input[name*=payment]').each(function(inp) {
|
161 |
+
inp.removeAttribute('disabled');
|
162 |
+
});
|
163 |
+
|
164 |
+
$$('#payment_form_ewayrapid_ewayone select[name*=payment]').each(function(inp) {
|
165 |
+
inp.removeAttribute('disabled');
|
166 |
+
});
|
167 |
+
|
168 |
+
$$('#payment_form_ewayrapid_ewayone input[data-eway-encrypt-name*=payment]').each(function(inp) {
|
169 |
+
inp.removeAttribute('disabled');
|
170 |
+
});
|
171 |
+
});
|
172 |
+
</script>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_code = $this->getMethodCode()
|
28 |
+
?>
|
29 |
+
<?php if($this->checkSaveCardAvailable()): ?>
|
30 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display: none;width: 80%;padding-top: 8px;">
|
31 |
+
<li>
|
32 |
+
<div class="input-box">
|
33 |
+
<div class="v-fix">
|
34 |
+
<select id="ewayrapid_ewayone_token" name="payment[saved_token]" class="ewayrapid_ewayone_token">
|
35 |
+
<?php
|
36 |
+
$_tokens = $this->getTokenList();
|
37 |
+
$_defaultToken = isset($_tokens['default_token']) ? $_tokens['default_token'] : false;
|
38 |
+
?>
|
39 |
+
<?php foreach($_tokens['tokens'] as $_key => $_token): ?>
|
40 |
+
<?php /* @var Eway_Rapid31_Model_Customer_Token $_token */ ?>
|
41 |
+
<option value="<?php echo $_key ?>" <?php if($_key == $_defaultToken): ?>selected="selected"<?php endif; ?>>
|
42 |
+
<?php echo $_token->getCard() ?>
|
43 |
+
</option>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
</select>
|
46 |
+
</div>
|
47 |
+
<?php if(Mage::getSingleton('ewayrapid/config')->canEditToken() && count($_tokens['tokens']) > 1): ?>
|
48 |
+
<?php endif; ?>
|
49 |
+
</div>
|
50 |
+
</li>
|
51 |
+
|
52 |
+
<?php if($this->checkSaveCardAvailable() && $this->getSaveCard()): ?>
|
53 |
+
<li id="eway_save_card" class="saved_token_fields">
|
54 |
+
<div class="v-fix">
|
55 |
+
<input type="checkbox" title="<?php echo $this->getSaveText() ?>" id="<?php echo $_code ?>_cc_save_card"
|
56 |
+
<?php echo $this->getSaveDefaultCheck() ? 'checked' : '' ?> name="payment[save_card]" value="1" pattern="\d*"/>
|
57 |
+
<label for="<?php echo $_code ?>_cc_save_card" ><?php echo $this->getSaveText() ?></label>
|
58 |
+
</div>
|
59 |
+
</li>
|
60 |
+
<?php endif; ?>
|
61 |
+
</ul>
|
62 |
+
|
63 |
+
<script type="text/javascript">
|
64 |
+
var ewayPaymentToken = new EwayPaymentToken(
|
65 |
+
<?php echo $_tokens['tokens_json'] ?>,
|
66 |
+
<?php echo count($_tokens['tokens']) ?>,
|
67 |
+
false,
|
68 |
+
'<?php echo $this->__('Edit') ?>',
|
69 |
+
'<?php echo $this->__('Cancel edit') ?>'
|
70 |
+
)
|
71 |
+
|
72 |
+
$$('.help-disabled-cc a').each(function(element){
|
73 |
+
Event.observe(element, 'click', toggleToolTipCc);
|
74 |
+
});
|
75 |
+
|
76 |
+
function toggleToolTipCc(event){
|
77 |
+
if($('cc-help-tool-tip')){
|
78 |
+
$('cc-help-tool-tip').toggle();
|
79 |
+
}
|
80 |
+
Event.stop(event);
|
81 |
+
}
|
82 |
+
if($('cc-help-tool-tip-close')){
|
83 |
+
Event.observe($('cc-help-tool-tip-close'), 'click', toggleToolTipCc);
|
84 |
+
}
|
85 |
+
|
86 |
+
</script>
|
87 |
+
<?php endif; ?>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -0,0 +1,374 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did 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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_code = $this->getMethodCode();
|
28 |
+
$_tokens = $this->getTokenList();
|
29 |
+
$userLogger = Mage::getSingleton('customer/session')->isLoggedIn();
|
30 |
+
$_defaultLabel = '';
|
31 |
+
?>
|
32 |
+
|
33 |
+
<ul class="sp-methods <?php echo !$userLogger ? 'not-login-methods' : '' ?>" id="payment_form_<?php echo $_code ?>"
|
34 |
+
style="display:none; padding-left: 16px; padding-bottom: 8px; border: 1px solid rgb(193, 193, 193);">
|
35 |
+
|
36 |
+
<li>
|
37 |
+
<ul class="form-list" id="ul-eway-saved-div-box" <?php echo count($_tokens['tokens']) <= 1 ? 'style="display:none;"' : '' ?>>
|
38 |
+
<?php if($this->checkSaveCardAvailable()): ?>
|
39 |
+
<?php
|
40 |
+
$_defaultToken = isset($_tokens['default_token']) ? $_tokens['default_token'] : false;
|
41 |
+
?>
|
42 |
+
<li <?php echo count($_tokens['tokens']) <= 1 ? 'style="display:none;"' : '' ?>>
|
43 |
+
<div class="eway-saved-div-box">
|
44 |
+
<label class="eway-saved-label-box"><?php echo $this->__('Saved Details') ?></label>
|
45 |
+
<select id="ewayrapid_ewayone_token" name="payment[saved_token]"
|
46 |
+
class="ewayrapid_ewayone_token eway-saved-select-box">
|
47 |
+
<?php
|
48 |
+
$_defaultLabel = $_firstLabel = '';
|
49 |
+
?>
|
50 |
+
<?php foreach ($_tokens['tokens'] as $_key => $_token):
|
51 |
+
if(!$_firstLabel) $_firstLabel = $_token->getCard();
|
52 |
+
if($_key == $_defaultToken) :
|
53 |
+
$_defaultLabel = $_token->getCard();
|
54 |
+
endif;
|
55 |
+
?>
|
56 |
+
<option value="<?php echo $_key ?>"
|
57 |
+
rel="<?php echo $this->checkCardName($_token); ?>"
|
58 |
+
<?php if ($_key == $_defaultToken): ?>selected="selected"<?php endif; ?>>
|
59 |
+
<?php echo $_token->getCard() ?>
|
60 |
+
</option>
|
61 |
+
<?php endforeach; ?>
|
62 |
+
</select>
|
63 |
+
|
64 |
+
<?php if(!$_defaultLabel) $_defaultLabel = strtolower($_firstLabel) == 'paypal' ? $_firstLabel : ''; ?>
|
65 |
+
|
66 |
+
<?php if (Mage::getSingleton('ewayrapid/config')->canEditToken() && count($_tokens['tokens']) > 1): ?>
|
67 |
+
<div class="v-fix eway-saved-edit-box">
|
68 |
+
<a style="<?php echo strtolower($_defaultLabel) === 'paypal' ? 'display:none;' : ''; ?>" id="ewayrapid_ewayone_edit" class="ewayrapid_ewayone_edit" href="javascript:void(0);"><?php echo $this->__('Edit') ?></a>
|
69 |
+
</div>
|
70 |
+
<?php endif; ?>
|
71 |
+
</div>
|
72 |
+
</li>
|
73 |
+
<?php endif; ?>
|
74 |
+
</ul>
|
75 |
+
</li>
|
76 |
+
|
77 |
+
<?php if ($this->getEnablePaypalStandard()) { ?>
|
78 |
+
<li id="eway_save_paypal" style="<?php echo $userLogger ? 'display:none;' : '' ?>">
|
79 |
+
<input id="p_method_ewayrapid_ewayone_transparent_paypal" rel="payment_form_paypal_saved"
|
80 |
+
value="<?php echo Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD ?>" type="radio"
|
81 |
+
name="payment[transparent_saved]" title="Paypal - eWAY" class="radio" autocomplete="off">
|
82 |
+
<label for="p_method_ewayrapid_ewayone_transparent_paypal"><img src="<?php echo $this->getSkinUrl('images/paypal_button.png') ?>" alt=""/> </label>
|
83 |
+
</li>
|
84 |
+
<?php } ?>
|
85 |
+
|
86 |
+
<?php if ($this->getEnableMasterPass() && Mage::helper('ewayrapid/data')->getPaymentAction() == Eway_Rapid31_Model_Method_Notsaved::ACTION_AUTHORIZE_CAPTURE) { ?>
|
87 |
+
<li id="eway_save_masterpass" style="<?php echo $userLogger ? 'display:none;' : '' ?>">
|
88 |
+
<input id="p_method_ewayrapid_transparent_masterpass" rel="payment_form_masterpass_saved"
|
89 |
+
value="<?php echo Eway_Rapid31_Model_Config::MASTERPASS_METHOD ?>" type="radio"
|
90 |
+
name="payment[transparent_saved]" title="MasterPass - eWAY" class="radio" autocomplete="off">
|
91 |
+
<label for="p_method_ewayrapid_transparent_masterpass"><img src="<?php echo $this->getSkinUrl('images/masterpass.png') ?>" alt=""/> </label>
|
92 |
+
</li>
|
93 |
+
<?php } ?>
|
94 |
+
<?php if ($this->getEnableVisaCheckout()){ ?>
|
95 |
+
<li id="eway_save_visa" style="<?php echo $userLogger ? 'display:none;' : '' ?>">
|
96 |
+
<input id="p_method_ewayrapid_transparent_visa" rel="payment_form_visa_saved"
|
97 |
+
value="<?php echo Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD ?>" type="radio"
|
98 |
+
name="payment[transparent_saved]" title="Visa Checkout - eWAY" class="radio" autocomplete="off">
|
99 |
+
<label for="p_method_ewayrapid_transparent_visa"><img src="<?php echo $this->getSkinUrl('images/visa_checkout.png') ?>" alt=""/> </label></label>
|
100 |
+
<input type="hidden" id="visa_checkout_call_id" name="payment[visa_checkout_call_id]">
|
101 |
+
<input type="hidden" id="visa_checkout_response" name="payment[visa_checkout_response]">
|
102 |
+
</li>
|
103 |
+
<?php } ?>
|
104 |
+
<li id="eway_save_creditcard">
|
105 |
+
<input id="p_method_ewayrapid_ewayone_mastercard" rel="ul_payment_form_<?php echo $_code ?>"
|
106 |
+
value="<?php echo Eway_Rapid31_Model_Config::CREDITCARD_METHOD ?>" type="radio"
|
107 |
+
name="payment[transparent_saved]" title="Check / Money order" class="radio element_save_creditcard" autocomplete="off"
|
108 |
+
checked="checked"
|
109 |
+
/>
|
110 |
+
<label for="p_method_ewayrapid_ewayone_mastercard" class="element_save_creditcard">Credit Card </label>
|
111 |
+
|
112 |
+
<ul class="form-list ul-form-list" id="ul_payment_form_<?php echo $_code ?>"
|
113 |
+
style="display: block;margin-left: 20px;">
|
114 |
+
<li class="element_save_creditcard">
|
115 |
+
<label for="<?php echo $_code ?>_cc_owner"
|
116 |
+
class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
117 |
+
<div class="input-box">
|
118 |
+
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry"
|
119 |
+
id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]"
|
120 |
+
value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
|
121 |
+
</div>
|
122 |
+
</li>
|
123 |
+
<li class="element_save_creditcard">
|
124 |
+
<label for="<?php echo $_code ?>_cc_number"
|
125 |
+
class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
126 |
+
|
127 |
+
<div class="input-box">
|
128 |
+
<input type="text" id="<?php echo $_code ?>_cc_number"
|
129 |
+
name="payment[cc_number]"
|
130 |
+
title="<?php echo $this->__('Credit Card Number') ?>"
|
131 |
+
data-eway-encrypt-name="payment[cc_number]"
|
132 |
+
class="input-text validate-cc-number validate-cc-type-auto" value="" pattern="\d*"/>
|
133 |
+
<input type="hidden" id="<?php echo $_code ?>_cc_type" name="payment[cc_type]"/>
|
134 |
+
</div>
|
135 |
+
</li>
|
136 |
+
<li id="<?php echo $_code ?>_cc_type_exp_div" class="element_save_creditcard">
|
137 |
+
<label for="<?php echo $_code ?>_expiration"
|
138 |
+
class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
|
139 |
+
|
140 |
+
<div class="input-box">
|
141 |
+
<div class="v-fix">
|
142 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]"
|
143 |
+
class="month validate-cc-exp required-entry">
|
144 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
145 |
+
<?php foreach ($this->getCcMonths() as $k => $v): ?>
|
146 |
+
<option
|
147 |
+
value="<?php echo $k ? $k : '' ?>"<?php if ($k == $_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
148 |
+
<?php endforeach ?>
|
149 |
+
</select>
|
150 |
+
</div>
|
151 |
+
<div class="v-fix">
|
152 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
153 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]"
|
154 |
+
class="year required-entry">
|
155 |
+
<?php foreach ($this->getCcYears() as $k => $v): ?>
|
156 |
+
<option
|
157 |
+
value="<?php echo $k ? $k : '' ?>"<?php if ($k == $_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
158 |
+
<?php endforeach ?>
|
159 |
+
</select>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
</li>
|
163 |
+
<?php echo $this->getChildHtml() ?>
|
164 |
+
<?php if ($this->hasVerification()): ?>
|
165 |
+
<li id="<?php echo $_code ?>_cc_type_cvv_div" style="<?php echo ($_defaultLabel) == 'paypal' ? 'display:none;' : '' ?>">
|
166 |
+
<label for="<?php echo $_code ?>_cc_cid"
|
167 |
+
class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
168 |
+
|
169 |
+
<div class="input-box">
|
170 |
+
<div class="v-fix" id="v-fix-change">
|
171 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>"
|
172 |
+
name="payment[cc_cid]"
|
173 |
+
disabled="disabled"
|
174 |
+
class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid"
|
175 |
+
data-eway-encrypt-name="payment[cc_cid]"
|
176 |
+
value="" pattern="\d*"/>
|
177 |
+
</div>
|
178 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
179 |
+
</div>
|
180 |
+
</li>
|
181 |
+
<?php if ($this->getIsRecurring()) { ?>
|
182 |
+
<li>
|
183 |
+
<p>I authorize <?php echo Mage::app()->getStore()->getName(); ?> to charge the available balance
|
184 |
+
in my credit card for the future payments of this order. To make a change, I can go to
|
185 |
+
<a href="<?php echo Mage::getUrl('checkout/cart'); ?>">Cart</a>
|
186 |
+
</p>
|
187 |
+
<input type="checkbox" name="recurring-agree" class="recurring-agree required-entry"/><label class="lable-for-recurring" for="">Agree</label>
|
188 |
+
</li>
|
189 |
+
<?php } ?>
|
190 |
+
<?php endif; ?>
|
191 |
+
</ul>
|
192 |
+
</li>
|
193 |
+
|
194 |
+
<?php if($this->checkSaveCardAvailable() && $this->getSaveCard()): ?>
|
195 |
+
<li id="eway_save_card" class="element_save_creditcard" <?php echo $userLogger ? 'style="display: none"' :'' ?>>
|
196 |
+
<div class="v-fix">
|
197 |
+
<input type="checkbox" title="<?php echo $this->getSaveText() ?>" id="<?php echo $_code ?>_cc_save_card"
|
198 |
+
<?php echo $this->getSaveDefaultCheck() ? 'checked' : '' ?> name="payment[save_card]" value="1" pattern="\d*"/>
|
199 |
+
<label for="<?php echo $_code ?>_cc_save_card" ><?php echo $this->getSaveText() ?></label>
|
200 |
+
</div>
|
201 |
+
</li>
|
202 |
+
<?php endif; ?>
|
203 |
+
</ul>
|
204 |
+
<?php //if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>
|
205 |
+
<script type="text/javascript">
|
206 |
+
var _saved = 0;
|
207 |
+
var ewayPaymentToken = new EwayPaymentToken(
|
208 |
+
<?php echo $_tokens['tokens_json'] ?>,
|
209 |
+
<?php echo count($_tokens['tokens']) ?>,
|
210 |
+
false,
|
211 |
+
'<?php echo $this->__('Edit') ?>',
|
212 |
+
'<?php echo $this->__('Cancel edit') ?>'
|
213 |
+
);
|
214 |
+
|
215 |
+
var _tokenCount = <?php echo count($_tokens['tokens']); ?>;
|
216 |
+
//console.log(_tokenCount);
|
217 |
+
var _defaultLabel = "<?php echo strtolower($_defaultLabel); ?>";
|
218 |
+
//console.log('default Label: ' + _defaultLabel);
|
219 |
+
if(_defaultLabel == 'paypal') {
|
220 |
+
$('ewayrapid_ewayone_cc_type_cvv_div') && $('ewayrapid_ewayone_cc_type_cvv_div').hide();
|
221 |
+
$('ewayrapid_ewayone_edit') && $('ewayrapid_ewayone_edit').hide();
|
222 |
+
$$('.element_save_creditcard').each(function(el) {
|
223 |
+
el.hide();
|
224 |
+
});
|
225 |
+
} else if((_defaultLabel == "" || _defaultLabel == null) && _tokenCount < 2) {
|
226 |
+
addNew();
|
227 |
+
} else {
|
228 |
+
$$('.element_save_creditcard').each(function(el) {
|
229 |
+
el.hide();
|
230 |
+
});
|
231 |
+
}
|
232 |
+
|
233 |
+
$$('#payment_form_<?php echo $_code ?> .radio').each(function (el) {
|
234 |
+
var _rel = $(el).readAttribute('rel');
|
235 |
+
//console.log(_rel);
|
236 |
+
if (_rel != '' && _rel != null) {
|
237 |
+
$(el).observe('click', function () {
|
238 |
+
$$('.ul-form-list').each(function (rd) {
|
239 |
+
rd.hide();
|
240 |
+
});
|
241 |
+
$(_rel) && $(_rel).show();
|
242 |
+
$(_rel) && $(_rel).firstElementChild.show();
|
243 |
+
});
|
244 |
+
}
|
245 |
+
});
|
246 |
+
|
247 |
+
$('ewayrapid_ewayone_edit') && $('ewayrapid_ewayone_edit').observe('click', function (elment) {
|
248 |
+
//console.log('Edit click: ' + this.innerHTML);
|
249 |
+
$('p_method_ewayrapid_ewayone_mastercard') && ($('p_method_ewayrapid_ewayone_mastercard').checked = true);
|
250 |
+
$('p_method_ewayrapid_ewayone_transparent_paypal') && ($('p_method_ewayrapid_ewayone_transparent_paypal').checked = false);
|
251 |
+
$('p_method_ewayrapid_transparent_masterpass') && ($('p_method_ewayrapid_transparent_masterpass').checked = false);
|
252 |
+
$('p_method_ewayrapid_transparent_visa') && ($('p_method_ewayrapid_transparent_visa').checked = false);
|
253 |
+
|
254 |
+
$('ul_payment_form_ewayrapid_ewayone') && $('ul_payment_form_ewayrapid_ewayone').show();
|
255 |
+
$('ewayrapid_ewayone_cc_type_cvv_div') && $('ewayrapid_ewayone_cc_type_cvv_div').show();
|
256 |
+
if (this.innerHTML == "Edit") {
|
257 |
+
$('eway_save_masterpass') && $('eway_save_masterpass').hide();
|
258 |
+
$('eway_save_paypal') && $('eway_save_paypal').hide();
|
259 |
+
$('eway_save_visa') && $('eway_save_visa').hide();
|
260 |
+
|
261 |
+
$$('.element_save_creditcard').each(function(el) {
|
262 |
+
el.hide();
|
263 |
+
});
|
264 |
+
} else {
|
265 |
+
$('eway_save_masterpass') && $('eway_save_masterpass').hide(150);
|
266 |
+
$('eway_save_paypal') && $('eway_save_paypal').hide(150);
|
267 |
+
$('eway_save_visa') && $('eway_save_visa').hide(150);
|
268 |
+
|
269 |
+
$('ul_payment_form_<?php echo $_code ?>') && $('ul_payment_form_<?php echo $_code ?>').show(150);
|
270 |
+
|
271 |
+
$$('.element_save_creditcard').each(function(el) {
|
272 |
+
el.show();
|
273 |
+
});
|
274 |
+
}
|
275 |
+
});
|
276 |
+
|
277 |
+
$('ewayrapid_ewayone_token') && $('ewayrapid_ewayone_token').observe('change', function () {
|
278 |
+
//console.log('Value: ' + this.getValue());
|
279 |
+
var _ctype = $('ewayrapid_ewayone_token')[this.selectedIndex].readAttribute('rel');
|
280 |
+
//console.log(_ctype);
|
281 |
+
if (this.getValue() == 'new') {
|
282 |
+
addNew();
|
283 |
+
} else {
|
284 |
+
edit(_ctype);
|
285 |
+
}
|
286 |
+
});
|
287 |
+
|
288 |
+
function addNew() {
|
289 |
+
$('<?php echo $_code ?>_cc_number') && $('<?php echo $_code ?>_cc_number').writeAttribute('disabled', false);
|
290 |
+
$('eway_save_masterpass') && $('eway_save_masterpass').show(150);
|
291 |
+
$('eway_save_paypal') && $('eway_save_paypal').show(150);
|
292 |
+
$('eway_save_visa') && $('eway_save_visa').show(150);
|
293 |
+
$('ul_payment_form_<?php echo $_code ?>') && $('ul_payment_form_<?php echo $_code ?>').show(150);
|
294 |
+
|
295 |
+
$('ewayrapid_ewayone_edit') && $('ewayrapid_ewayone_edit').hide();
|
296 |
+
|
297 |
+
$$('.element_save_creditcard').each(function(el) {
|
298 |
+
el.show();
|
299 |
+
});
|
300 |
+
$('ul_payment_form_ewayrapid_ewayone') && $('ul_payment_form_ewayrapid_ewayone').show();
|
301 |
+
$('ewayrapid_ewayone_cc_type_cvv_div') && $('ewayrapid_ewayone_cc_type_cvv_div').show();
|
302 |
+
}
|
303 |
+
|
304 |
+
function edit(_ctype) {
|
305 |
+
$$('.element_save_creditcard').each(function(el) {
|
306 |
+
el.hide();
|
307 |
+
});
|
308 |
+
|
309 |
+
$('eway_save_masterpass') && $('eway_save_masterpass').hide();
|
310 |
+
$('eway_save_paypal') && $('eway_save_paypal').hide();
|
311 |
+
$('eway_save_visa') && $('eway_save_visa').hide();
|
312 |
+
$('<?php echo $_code ?>_cc_number') && $('<?php echo $_code ?>_cc_number').writeAttribute('disabled', 'disabled');
|
313 |
+
|
314 |
+
|
315 |
+
if('<?php echo Eway_Rapid31_Model_Config::CREDITCARD_METHOD ?>' != _ctype) {
|
316 |
+
$('ewayrapid_ewayone_cc_type_cvv_div') && $('ewayrapid_ewayone_cc_type_cvv_div').hide();
|
317 |
+
$('ewayrapid_ewayone_edit') && $('ewayrapid_ewayone_edit').hide();
|
318 |
+
} else {
|
319 |
+
$('p_method_ewayrapid_ewayone_mastercard') && ($('p_method_ewayrapid_ewayone_mastercard').checked = true);
|
320 |
+
$('p_method_ewayrapid_ewayone_transparent_paypal') && ($('p_method_ewayrapid_ewayone_transparent_paypal').checked = false);
|
321 |
+
$('p_method_ewayrapid_transparent_masterpass') && ($('p_method_ewayrapid_transparent_masterpass').checked = false);
|
322 |
+
$('p_method_ewayrapid_transparent_visa') && ($('p_method_ewayrapid_transparent_visa').checked = false);
|
323 |
+
|
324 |
+
$('ul_payment_form_ewayrapid_ewayone') && $('ul_payment_form_ewayrapid_ewayone').show();
|
325 |
+
$('ewayrapid_ewayone_cc_type_cvv_div') && $('ewayrapid_ewayone_cc_type_cvv_div').show();
|
326 |
+
$('ewayrapid_ewayone_edit') && $('ewayrapid_ewayone_edit').show();
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
setInterval(function(){
|
331 |
+
if(_saved == 1) return false;
|
332 |
+
_saved = 1;
|
333 |
+
$$('#payment_form_ewayrapid_ewayone .radio:checked').each(function(rd) {
|
334 |
+
if(rd.getValue() == '<?php echo Eway_Rapid31_Model_Config::CREDITCARD_METHOD ?>') {
|
335 |
+
$('ul_payment_form_<?php echo $_code ?>').show();
|
336 |
+
} else if(rd.getValue() == '<?php echo Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD ?>'
|
337 |
+
|| rd.getValue() == '<?php echo Eway_Rapid31_Model_Config::MASTERPASS_METHOD ?>'
|
338 |
+
|| rd.getValue() == '<?php echo Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD ?>') {
|
339 |
+
$('ul_payment_form_<?php echo $_code ?>').hide();
|
340 |
+
} else {
|
341 |
+
$('ul_payment_form_<?php echo $_code ?>').show();
|
342 |
+
}
|
343 |
+
});
|
344 |
+
},300);
|
345 |
+
</script>
|
346 |
+
<?php //endif; ?>
|
347 |
+
|
348 |
+
<script type="text/javascript">
|
349 |
+
$$('.help-disabled-cc a').each(function (element) {
|
350 |
+
Event.observe(element, 'click', toggleToolTipCc);
|
351 |
+
});
|
352 |
+
|
353 |
+
function toggleToolTipCc(event) {
|
354 |
+
if ($('cc-help-tool-tip')) {
|
355 |
+
$('cc-help-tool-tip').toggle();
|
356 |
+
}
|
357 |
+
Event.stop(event);
|
358 |
+
}
|
359 |
+
if ($('cc-help-tool-tip-close')) {
|
360 |
+
Event.observe($('cc-help-tool-tip-close'), 'click', toggleToolTipCc);
|
361 |
+
}
|
362 |
+
|
363 |
+
$('p_method_ewayrapid_ewayone').observe('click', function () {
|
364 |
+
$('p_method_ewayrapid_ewayone').setAttribute('checked', 'true');
|
365 |
+
$('p_method_ewayrapid_notsaved') && $('p_method_ewayrapid_notsaved').removeAttribute('checked');
|
366 |
+
$('ul-eway-saved-div-box').show();
|
367 |
+
$$('#payment_form_ewayrapid_ewayone input[name*=payment]').each(function(inp) {
|
368 |
+
inp.removeAttribute('disabled');
|
369 |
+
});
|
370 |
+
$$('#payment_form_ewayrapid_ewayone select[name*=payment]').each(function(inp) {
|
371 |
+
inp.removeAttribute('disabled');
|
372 |
+
});
|
373 |
+
});
|
374 |
+
</script>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_helper = Mage::helper('ewayrapid');
|
28 |
+
/* @var Eway_Rapid31_Block_Info_Direct_Ewayone $this */
|
29 |
+
$_info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $_info */
|
31 |
+
|
32 |
+
?>
|
33 |
+
<div class="cards-list">
|
34 |
+
|
35 |
+
<?php if (!$this->getHideTitle()): ?>
|
36 |
+
<div class="bold"><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></div>
|
37 |
+
<?php endif;?>
|
38 |
+
</div>
|
@@ -20,7 +20,6 @@
|
|
20 |
*
|
21 |
* @category design
|
22 |
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
20 |
*
|
21 |
* @category design
|
22 |
* @package default_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package default_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_helper = Mage::helper('ewayrapid');
|
28 |
+
/* @var Eway_Rapid31_Block_Info_Direct_Ewayone $this */
|
29 |
+
$_info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $_info */
|
31 |
+
|
32 |
+
?>
|
33 |
+
<div class="cards-list">
|
34 |
+
|
35 |
+
<?php if (!$this->getHideTitle()): ?>
|
36 |
+
<div class="bold"><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></div>
|
37 |
+
<?php endif;?>
|
38 |
+
</div>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package default_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package default_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php
|
27 |
+
$_helper = Mage::helper('ewayrapid');
|
28 |
+
/* @var Eway_Rapid31_Block_Info_Direct_Ewayone $this */
|
29 |
+
$_info = $this->getInfo();
|
30 |
+
/* @var Mage_Sales_Model_Order_Payment $_info */
|
31 |
+
|
32 |
+
?>
|
33 |
+
<div class="cards-list">
|
34 |
+
|
35 |
+
<?php if (!$this->getHideTitle()): ?>
|
36 |
+
<div class="bold"><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></div>
|
37 |
+
<?php endif; ?>
|
38 |
+
</div>
|
@@ -19,8 +19,7 @@
|
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
*
|
21 |
* @category design
|
22 |
+
* @package default_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -1,307 +1,742 @@
|
|
1 |
-
<?php $_config = Mage::getSingleton('ewayrapid/config'); ?>
|
2 |
-
<?php $_backend = Mage::helper('ewayrapid')->isBackendOrder(); ?>
|
3 |
-
<?php $_checkoutExtension = $this->getCheckoutExtension(); ?>
|
4 |
-
<?php $_mageworld = Mage::helper('core')->isModuleEnabled('MW_Onestepcheckout'); ?>
|
5 |
-
<?php
|
6 |
-
|
7 |
-
|
8 |
-
<?php
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
<?php
|
32 |
-
|
33 |
-
if
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
checkout.
|
51 |
-
checkout.
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
FireCheckout.prototype.
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
<?php
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
IWD.OPC.
|
71 |
-
IWD.OPC.
|
72 |
-
IWD.OPC.
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
<?php
|
77 |
-
|
78 |
-
<?php
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
<?php
|
94 |
-
var notshipmethod
|
95 |
-
<?php
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
<?php endif; ?>
|
105 |
-
|
106 |
-
<?php
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
$('
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
$('
|
195 |
-
$('
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
<?php endif; ?>
|
1 |
+
<?php $_config = Mage::getSingleton('ewayrapid/config'); ?>
|
2 |
+
<?php $_backend = Mage::helper('ewayrapid')->isBackendOrder(); ?>
|
3 |
+
<?php $_checkoutExtension = $this->getCheckoutExtension(); ?>
|
4 |
+
<?php $_mageworld = Mage::helper('core')->isModuleEnabled('MW_Onestepcheckout'); ?>
|
5 |
+
<?php $_backendIFrame = $_config->isSharedPageConnection() || $_config->isRapidIframeConnection()?>
|
6 |
+
<?php if ($_config->isDirectConnection() || $_backend): ?>
|
7 |
+
<script type="text/javascript">
|
8 |
+
EwayPayment.supportCardTypes = <?php echo json_encode($_config->getSupportedCardTypes()) ?>;
|
9 |
+
<?php if(Mage::helper('ewayrapid')->isBackendOrder()): ?>
|
10 |
+
var ewayPayment = new EwayPayment($('edit_form'), '<?php echo $_config->getEncryptionKey() ?>');
|
11 |
+
if(typeof AdminOrder === 'function'){
|
12 |
+
AdminOrder.prototype.submit = ewayPayment.submitAdminOrder;
|
13 |
+
}
|
14 |
+
<?php else: ?>
|
15 |
+
<?php switch($_checkoutExtension):
|
16 |
+
case 'OneStepCheckout': // OneStepCheckout extension ?>
|
17 |
+
document.observe("dom:loaded", function () {
|
18 |
+
|
19 |
+
<?php if(Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')): ?>
|
20 |
+
var ewayPayment = new EwayPayment($('onestepcheckout-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
21 |
+
if (ewayPayment && $('onestepcheckout-form')) {
|
22 |
+
Payment.prototype.switchMethod = ewayPayment.OneStepCheckout.switchMethod;
|
23 |
+
if (payment.currentMethod) {
|
24 |
+
payment.switchMethod(payment.currentMethod);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
$('onestepcheckout-form') && ($('onestepcheckout-form').submit = function () {
|
29 |
+
eCrypt.submitForm();
|
30 |
+
});
|
31 |
+
<?php endif; ?>
|
32 |
+
|
33 |
+
<?php if(Mage::getStoreConfig('onestepcheckout/general/active')): ?>
|
34 |
+
var ewayPayment2 = new EwayPayment($('one-step-checkout-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
35 |
+
if (ewayPayment2 && $('one-step-checkout-form'))
|
36 |
+
Payment.prototype.switchMethod = ewayPayment2.OneStepCheckout.switchMethod;
|
37 |
+
|
38 |
+
$('one-step-checkout-form') && ($('one-step-checkout-form').submit = function () {
|
39 |
+
eCrypt.submitForm();
|
40 |
+
});
|
41 |
+
<?php endif; ?>
|
42 |
+
|
43 |
+
});
|
44 |
+
<?php break; ?>
|
45 |
+
|
46 |
+
<?php case 'LightCheckout': ?>
|
47 |
+
document.observe("dom:loaded", function () {
|
48 |
+
var ewayPayment = new EwayPayment($('gcheckout-onepage-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
49 |
+
if (typeof checkout.LightcheckoutSubmitOld == "undefined") {
|
50 |
+
checkout.LightcheckoutSubmitOld = checkout.LightcheckoutSubmit;
|
51 |
+
checkout.LightcheckoutSubmit = ewayPayment.Lightcheckout.LightcheckoutSubmit;
|
52 |
+
checkout.getFormData = ewayPayment.Lightcheckout.getFormData;
|
53 |
+
}
|
54 |
+
});
|
55 |
+
<?php break; ?>
|
56 |
+
|
57 |
+
<?php case 'FireCheckout': // FireCheckout extension ?>
|
58 |
+
document.observe("dom:loaded", function () {
|
59 |
+
var ewayPayment = new EwayPayment($('firecheckout-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
60 |
+
if (typeof FireCheckout.prototype.ewayOldSave == "undefined") {
|
61 |
+
FireCheckout.prototype.ewayOldSave = FireCheckout.prototype.save;
|
62 |
+
FireCheckout.prototype.save = ewayPayment.FireCheckout.save;
|
63 |
+
}
|
64 |
+
});
|
65 |
+
<?php break; ?>
|
66 |
+
<?php case 'IWDOnePageCheckout': // IWD OnePageCheckout extension ?>
|
67 |
+
document.observe("dom:loaded", function () {
|
68 |
+
var ewayPayment = new EwayPayment($('co-payment-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
69 |
+
if (typeof IWD.OPC.ewayOldSavePayment == "undefined") {
|
70 |
+
IWD.OPC.ewayOldSavePayment = IWD.OPC.savePayment;
|
71 |
+
IWD.OPC.ewayOldSaveOrder = IWD.OPC.saveOrder;
|
72 |
+
IWD.OPC.savePayment = ewayPayment.IWDOnePageCheckout.savePayment;
|
73 |
+
IWD.OPC.saveOrder = ewayPayment.IWDOnePageCheckout.saveOrder;
|
74 |
+
}
|
75 |
+
});
|
76 |
+
<?php break; ?>
|
77 |
+
<?php case 'MultiShippingAddress': // Magento default multi shipping address ?>
|
78 |
+
var ewayPayment = new EwayPayment($('multishipping-billing-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
79 |
+
$('multishipping-billing-form').onsubmit = ewayPayment.MultiShipping.submit;
|
80 |
+
<?php break; ?>
|
81 |
+
<?php default: // Magento default one page checkout ?>
|
82 |
+
var ewayPayment = new EwayPayment($('co-payment-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
83 |
+
Payment.prototype.save = ewayPayment.savePaymentWithEncryption;
|
84 |
+
Review.prototype.save = ewayPayment.saveReviewWithEncryption;
|
85 |
+
|
86 |
+
document.observe("dom:loaded", function () {
|
87 |
+
window.onload = function(){
|
88 |
+
// MageWorld One Step Checkout Pro
|
89 |
+
if(typeof $MW_Onestepcheckout != 'undefined') {
|
90 |
+
$MW_Onestepcheckout('.btn-checkout').die('click');
|
91 |
+
$MW_Onestepcheckout('.btn-checkout').live("click",function(e){
|
92 |
+
var ewayPayment = new EwayPayment($('onestep_form'), '<?php echo $_config->getEncryptionKey() ?>');
|
93 |
+
<?php if($_mageworld && Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
|
94 |
+
var notshipmethod=1;
|
95 |
+
<?php else:?>
|
96 |
+
var notshipmethod=$MW_Onestepcheckout("input[name=shipping_method]:checked").val();
|
97 |
+
<?php endif?>
|
98 |
+
ewayPayment.MageWorld.submit(e, notshipmethod, false);
|
99 |
+
});
|
100 |
+
}
|
101 |
+
}
|
102 |
+
});
|
103 |
+
<?php endswitch; ?>
|
104 |
+
<?php endif; ?>
|
105 |
+
</script>
|
106 |
+
<?php endif; ?>
|
107 |
+
|
108 |
+
<?php if ($_config->isTransparentConnection() && !$_backend): ?>
|
109 |
+
<?php if($_config->getVisaCheckoutEnable()): ?>
|
110 |
+
<img id="visa_checkout_button" class="v-button" role="button" tabindex="0" style="display: none"
|
111 |
+
src="https://<?php echo $_config->isSandbox() ? 'sandbox.' : '' ?>secure.checkout.visa.com/wallet-services-web/xo/button.png"/>
|
112 |
+
<script type="text/javascript"
|
113 |
+
src="<?php echo $_config->getVisaCheckoutSDK() ?>">
|
114 |
+
</script>
|
115 |
+
<script type="text/javascript">
|
116 |
+
function onVisaCheckoutReady(){
|
117 |
+
V.init({apikey: "<?php echo $_config->getVisaCheckoutApiKey() ?>"});
|
118 |
+
V.on("payment.success", function(payment){updateVisaCheckoutCallback(payment)});
|
119 |
+
V.on("payment.cancel", function(payment){updateVisaCheckoutCallback(payment)});
|
120 |
+
V.on("payment.error", function(payment, error){updateVisaCheckoutCallback(payment, error)});
|
121 |
+
}
|
122 |
+
|
123 |
+
function updateVisaCheckoutCallback(result, error){
|
124 |
+
if(error){
|
125 |
+
alert(error);
|
126 |
+
$('review-please-wait') && $('review-please-wait').show();
|
127 |
+
}
|
128 |
+
if(result && result.callid && result.encPaymentData){
|
129 |
+
$('visa_checkout_call_id').value = result.callid;
|
130 |
+
//payment.save();
|
131 |
+
ewayPayment.saveReviewWithEncryptionTrans();
|
132 |
+
}else{
|
133 |
+
$('review-please-wait') && $('review-please-wait').hide();
|
134 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').show();
|
135 |
+
}
|
136 |
+
}
|
137 |
+
</script>
|
138 |
+
<?php endif; ?>
|
139 |
+
<?php if($_checkoutExtension) {
|
140 |
+
Mage::getSingleton('core/session')->setCheckoutExtension($_checkoutExtension);
|
141 |
+
} else {
|
142 |
+
Mage::getSingleton('core/session')->unsCheckoutExtension();
|
143 |
+
}?>
|
144 |
+
<script type="text/javascript">
|
145 |
+
var creditcard = '<?php echo Eway_Rapid31_Model_Config::CREDITCARD_METHOD ?>';
|
146 |
+
|
147 |
+
<?php switch($_checkoutExtension):
|
148 |
+
case 'OneStepCheckout': // OneStepCheckout extension ?>
|
149 |
+
<?php if(Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')): ?>
|
150 |
+
|
151 |
+
function updateVisaCheckoutCallback(result, error){
|
152 |
+
if(error){
|
153 |
+
alert(error);
|
154 |
+
$('review-please-wait') && $('review-please-wait').show();
|
155 |
+
}
|
156 |
+
if(result && result.callid && result.encPaymentData){
|
157 |
+
$('visa_checkout_call_id').value = result.callid;
|
158 |
+
eCrypt.submitForm();
|
159 |
+
}else{
|
160 |
+
already_placing_order = false;
|
161 |
+
var submitelement = $('onestepcheckout-place-order');
|
162 |
+
|
163 |
+
$$('.onestepcheckout-place-order-loading').first() && $$('.onestepcheckout-place-order-loading').first().remove();
|
164 |
+
submitelement.addClassName('orange').removeClassName('grey');
|
165 |
+
submitelement.disabled = false;
|
166 |
+
}
|
167 |
+
};
|
168 |
+
|
169 |
+
document.observe("dom:loaded", function () {
|
170 |
+
var ewayPayment = new EwayPayment($('onestepcheckout-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
171 |
+
Payment.prototype.switchMethod = ewayPayment.OneStepCheckout.switchMethod;
|
172 |
+
if (payment.currentMethod) {
|
173 |
+
payment.switchMethod(payment.currentMethod);
|
174 |
+
}
|
175 |
+
|
176 |
+
$('onestepcheckout-form') && ($('onestepcheckout-form').submit = function () {
|
177 |
+
if($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked){
|
178 |
+
if(!$('visa_checkout_call_id').value){
|
179 |
+
document.getElementById('visa_checkout_button').click();
|
180 |
+
return;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
eCrypt.submitForm();
|
184 |
+
});
|
185 |
+
|
186 |
+
if ($('onestepcheckout-form')) {
|
187 |
+
$('ewayrapid_notsaved_expiration') && $('ewayrapid_notsaved_expiration').writeAttribute('style', 'width:103px !important;');
|
188 |
+
$('ewayrapid_ewayone_expiration') && $('ewayrapid_ewayone_expiration').writeAttribute('style', 'width:103px !important;');
|
189 |
+
//$('ewayrapid_ewayone_token') && $('ewayrapid_ewayone_token').writeAttribute('style', 'width:128px !important;');
|
190 |
+
$('v-fix-change') && $('v-fix-change').writeAttribute('style', 'width:60px !important;');
|
191 |
+
$('v-fix-cvn-id') && $('v-fix-cvn-id').writeAttribute('style', 'width:60px !important;');
|
192 |
+
|
193 |
+
$('ul_payment_form_ewayrapid_notsaved') && $('ul_payment_form_ewayrapid_notsaved').setStyle({'margin-left': '-2px'});
|
194 |
+
$('ul_payment_form_ewayrapid_ewayone') && $('ul_payment_form_ewayrapid_ewayone').setStyle({'margin-left': '-2px'});
|
195 |
+
$('ul-eway-saved-div-box') && $('ul-eway-saved-div-box').setStyle({'margin-left': '-2px'});
|
196 |
+
$$('#container_payment_method_ewayrapid_notsaved ul li').each(function (element) {
|
197 |
+
element.writeAttribute('style', 'float: left; width: 100%');
|
198 |
+
});
|
199 |
+
}
|
200 |
+
});
|
201 |
+
<?php endif; ?>
|
202 |
+
|
203 |
+
<?php if(Mage::getStoreConfig('onestepcheckout/general/active')): ?>
|
204 |
+
function updateVisaCheckoutCallback(result, error){
|
205 |
+
if(error){
|
206 |
+
alert(error);
|
207 |
+
$('review-please-wait') && $('review-please-wait').show();
|
208 |
+
}
|
209 |
+
if(result && result.callid && result.encPaymentData){
|
210 |
+
$('visa_checkout_call_id').value = result.callid;
|
211 |
+
$('one-step-checkout-form').submit();
|
212 |
+
}else{
|
213 |
+
$('onestepcheckout-place-order-loading').hide();
|
214 |
+
$('onestepcheckout-button-place-order').addClassName('onestepcheckout-btn-checkout');
|
215 |
+
$('onestepcheckout-button-place-order').removeClassName('place-order-loader');
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
document.observe("dom:loaded", function () {
|
220 |
+
var ewayPayment2 = new EwayPayment($('one-step-checkout-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
221 |
+
if (ewayPayment2 && $('one-step-checkout-form')){
|
222 |
+
Payment.prototype.switchMethod = ewayPayment2.OneStepCheckout.switchMethod;
|
223 |
+
}
|
224 |
+
function oscPlaceOrder(element) {
|
225 |
+
var validator = new Validation('one-step-checkout-form');
|
226 |
+
var form = $('one-step-checkout-form');
|
227 |
+
if (validator.validate()) {
|
228 |
+
if ($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked) {
|
229 |
+
if (!$('visa_checkout_call_id').value) {
|
230 |
+
document.getElementById('visa_checkout_button').click();
|
231 |
+
return;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
if (($('p_method_hosted_pro') && $('p_method_hosted_pro').checked) || ($('p_method_payflow_advanced') && $('p_method_payflow_advanced').checked)) {
|
235 |
+
$('onestepcheckout-place-order-loading').show();
|
236 |
+
$('onestepcheckout-button-place-order').removeClassName('onestepcheckout-btn-checkout');
|
237 |
+
$('onestepcheckout-button-place-order').addClassName('place-order-loader');
|
238 |
+
$('ajaxcart-load-ajax').show();
|
239 |
+
checkAjax('<?php echo $this->getUrl('onestepcheckout/index/saveOrderPro', array('_secure' => true)); ?>');
|
240 |
+
} else {
|
241 |
+
if (checkpayment()) {
|
242 |
+
element.disabled = true;
|
243 |
+
var already_placing_order = true;
|
244 |
+
disable_payment();
|
245 |
+
$('onestepcheckout-place-order-loading').show();
|
246 |
+
$('onestepcheckout-button-place-order').removeClassName('onestepcheckout-btn-checkout');
|
247 |
+
$('onestepcheckout-button-place-order').addClassName('place-order-loader');
|
248 |
+
//$('one-step-checkout-form').submit();
|
249 |
+
var options = document.getElementsByName('payment[method]');
|
250 |
+
for (var i = 0; i < options.length; i++) {
|
251 |
+
if ($(options[i].id).checked) {
|
252 |
+
if (options[i].id.indexOf("tco") != -1) {
|
253 |
+
var params = Form.serialize('one-step-checkout-form');
|
254 |
+
var request = new Ajax.Request(
|
255 |
+
'<?php echo $this->getCheckoutUrl() . 'isAjax/tco'; ?>',
|
256 |
+
{
|
257 |
+
method: 'post',
|
258 |
+
onComplete: this.onComplete,
|
259 |
+
onSuccess: function(transport) {
|
260 |
+
if (transport.status == 200) {
|
261 |
+
if (transport.responseText.isJSON) {
|
262 |
+
var response = JSON.parse(transport.responseText);
|
263 |
+
$('onestepcheckout-place-order-loading').style.display = 'none';
|
264 |
+
$('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
|
265 |
+
$('onestepcheckout-button-place-order').removeAttribute('onclick');
|
266 |
+
$('onestepcheckout-button-place-order').observe('click', formsubmit());
|
267 |
+
$('onestepcheckout-button-place-order').disabled = false;
|
268 |
+
}
|
269 |
+
}
|
270 |
+
},
|
271 |
+
onFailure: '', //checkout.ajaxFailure.bind(checkout),
|
272 |
+
parameters: params
|
273 |
+
});
|
274 |
+
} else if (options[i].id.indexOf("wirecard") != -1) {
|
275 |
+
var params = Form.serialize('one-step-checkout-form');
|
276 |
+
var request = new Ajax.Request(
|
277 |
+
'<?php echo $this->getCheckoutUrl() . 'isAjax/wirecard'; ?>',
|
278 |
+
{
|
279 |
+
method: 'post',
|
280 |
+
onComplete: this.onComplete,
|
281 |
+
onSuccess: function(transport) {
|
282 |
+
var response = JSON.parse(transport.responseText);
|
283 |
+
if (response.url) {
|
284 |
+
window.location.href = response.url;
|
285 |
+
} else {
|
286 |
+
var payment_method = $RF(form, 'payment[method]');
|
287 |
+
var wireparams = {'paymentMethod': payment_method};
|
288 |
+
url = '<?php echo Mage::getBaseUrl() . 'wirecard_checkout_page/processing/wirecard_checkout_pagecheckout/'; ?>';
|
289 |
+
var wirerequest = new Ajax.Request(
|
290 |
+
qmoreIsIframe,
|
291 |
+
{
|
292 |
+
method: 'get',
|
293 |
+
parameters: wireparams,
|
294 |
+
onSuccess: function(innerTransport) {
|
295 |
+
if (innerTransport && innerTransport.responseText) {
|
296 |
+
try {
|
297 |
+
var innerResponse = eval('(' + innerTransport.responseText + ')');
|
298 |
+
}
|
299 |
+
catch (e) {
|
300 |
+
innerResponse = {};
|
301 |
+
}
|
302 |
+
if (innerResponse.isIframe)
|
303 |
+
{
|
304 |
+
toggleQMoreIFrame();
|
305 |
+
$('qmore-iframe').src = url;
|
306 |
+
} else {
|
307 |
+
window.location.href = url;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
},
|
311 |
+
onFailure: ''
|
312 |
+
});
|
313 |
+
}
|
314 |
+
},
|
315 |
+
onFailure: '', //checkout.ajaxFailure.bind(checkout),
|
316 |
+
parameters: params
|
317 |
+
});
|
318 |
+
} else {
|
319 |
+
$('one-step-checkout-form').submit();
|
320 |
+
}
|
321 |
+
break;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
}
|
327 |
+
};
|
328 |
+
|
329 |
+
$('one-step-checkout-form') && ($('one-step-checkout-form').submit = function () {
|
330 |
+
if($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked){
|
331 |
+
if(!$('visa_checkout_call_id').value){
|
332 |
+
document.getElementById('visa_checkout_button').click();
|
333 |
+
return;
|
334 |
+
}
|
335 |
+
}
|
336 |
+
eCrypt.submitForm();
|
337 |
+
});
|
338 |
+
});
|
339 |
+
|
340 |
+
<?php endif; ?>
|
341 |
+
|
342 |
+
<?php break; ?>
|
343 |
+
|
344 |
+
<?php case 'LightCheckout': ?>
|
345 |
+
function updateVisaCheckoutCallback(result, error){
|
346 |
+
if(error){
|
347 |
+
alert(error);
|
348 |
+
$('review-please-wait') && $('review-please-wait').show();
|
349 |
+
}
|
350 |
+
if(result && result.callid && result.encPaymentData){
|
351 |
+
|
352 |
+
$('visa_checkout_call_id').value = result.callid;
|
353 |
+
checkout.showLoadinfo();
|
354 |
+
checkout.hideLoadinfo();
|
355 |
+
checkout.setLoadWaiting(false);
|
356 |
+
checkout.LightcheckoutSubmit();
|
357 |
+
}else{
|
358 |
+
checkout.setLoadWaiting(false);
|
359 |
+
checkout.showLoadinfo();
|
360 |
+
checkout.hideLoadinfo();
|
361 |
+
$('review-please-wait').hide();
|
362 |
+
}
|
363 |
+
}
|
364 |
+
document.observe("dom:loaded", function () {
|
365 |
+
var ewayPayment = new EwayPayment($('gcheckout-onepage-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
366 |
+
if (typeof checkout.LightcheckoutSubmitOld == "undefined") {
|
367 |
+
checkout.LightcheckoutSubmitOld = checkout.LightcheckoutSubmit;
|
368 |
+
checkout.LightcheckoutSubmit = ewayPayment.Lightcheckout.LightcheckoutSubmit;
|
369 |
+
checkout.getFormData = ewayPayment.Lightcheckout.getFormData;
|
370 |
+
}
|
371 |
+
});
|
372 |
+
<?php break; ?>
|
373 |
+
|
374 |
+
|
375 |
+
<?php case 'FireCheckout': // FireCheckout extension ?>
|
376 |
+
function updateVisaCheckoutCallback(result, error){
|
377 |
+
if(error){
|
378 |
+
alert(error);
|
379 |
+
$('review-please-wait') && $('review-please-wait').show();
|
380 |
+
}
|
381 |
+
if(result && result.callid && result.encPaymentData){
|
382 |
+
|
383 |
+
$('visa_checkout_call_id').value = result.callid;
|
384 |
+
checkout.setLoadWaiting(false);
|
385 |
+
checkout.save();
|
386 |
+
}else{
|
387 |
+
checkout.setLoadWaiting(false);
|
388 |
+
$('review-please-wait').hide();
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
document.observe("dom:loaded", function () {
|
393 |
+
var ewayPayment = new EwayPayment($('firecheckout-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
394 |
+
if (typeof FireCheckout.prototype.ewayOldSave == "undefined") {
|
395 |
+
FireCheckout.prototype.ewayOldSave = FireCheckout.prototype.save;
|
396 |
+
FireCheckout.prototype.save = ewayPayment.FireCheckout.savePayment;
|
397 |
+
}
|
398 |
+
});
|
399 |
+
<?php break; ?>
|
400 |
+
<?php case 'IWDOnePageCheckout': // IWDOnePageCheckout extension ?>
|
401 |
+
function updateVisaCheckoutCallback(result, error){
|
402 |
+
if(error){
|
403 |
+
alert(error);
|
404 |
+
$('review-please-wait') && $('review-please-wait').show();
|
405 |
+
}
|
406 |
+
if(result && result.callid && result.encPaymentData){
|
407 |
+
$('visa_checkout_call_id').value = result.callid;
|
408 |
+
IWD.OPC.savePayment();
|
409 |
+
}else{
|
410 |
+
IWD.OPC.Checkout.hideLoader();
|
411 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
412 |
+
}
|
413 |
+
}
|
414 |
+
|
415 |
+
document.observe("dom:loaded", function () {
|
416 |
+
var ewayPayment = new EwayPayment($('co-payment-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
417 |
+
if (typeof IWD.OPC.ewayOldSavePayment == "undefined") {
|
418 |
+
IWD.OPC.ewayOldSavePayment = IWD.OPC.savePayment;
|
419 |
+
IWD.OPC.savePayment = ewayPayment.IWDOnePageCheckout.savePaymentTrans;
|
420 |
+
}
|
421 |
+
});
|
422 |
+
<?php break; ?>
|
423 |
+
<?php case 'MultiShippingAddress': // Magento default multi shipping address ?>
|
424 |
+
var ewayPayment = new EwayPayment($('multishipping-billing-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
425 |
+
<?php break; ?>
|
426 |
+
|
427 |
+
<?php default: // Magento default one page checkout ?>
|
428 |
+
var ewayPayment = new EwayPayment($('co-payment-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
429 |
+
|
430 |
+
if (typeof (ewayPayment.ewaypaymentOldOrder) == "undefined") {
|
431 |
+
ewayPayment.ewaypaymentOldOrder = Payment.prototype.save;
|
432 |
+
}
|
433 |
+
Payment.prototype.save = ewayPayment.savePaymentWithTransEncryption;
|
434 |
+
|
435 |
+
if (typeof (ewayPayment.ewaysavedOldOrder) == "undefined") {
|
436 |
+
ewayPayment.ewaysavedOldOrder = Review.prototype.save;
|
437 |
+
}
|
438 |
+
ewayPayment.paymentUrl = "<?php echo Mage::getUrl('ewayrapid/transparent/build', array('_secure'=>true)); ?>";
|
439 |
+
Review.prototype.save = ewayPayment.saveReviewWithEncryptionTrans;
|
440 |
+
|
441 |
+
function updateVisaCheckoutCallback(result, error){
|
442 |
+
if(error){
|
443 |
+
alert(error);
|
444 |
+
$('review-please-wait') && $('review-please-wait').show();
|
445 |
+
}
|
446 |
+
if(result && result.callid && result.encPaymentData){
|
447 |
+
$('visa_checkout_call_id').value = result.callid;
|
448 |
+
if(typeof $MW_Onestepcheckout != 'undefined') {
|
449 |
+
//MageWord One Step Checkout
|
450 |
+
$MW_Onestepcheckout('.btn-checkout').click();
|
451 |
+
}else{
|
452 |
+
//Default Magento Onepage checkout
|
453 |
+
ewayPayment.saveReviewWithEncryptionTrans();
|
454 |
+
}
|
455 |
+
}else{
|
456 |
+
$('review-please-wait') && $('review-please-wait').hide();
|
457 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').show();
|
458 |
+
}
|
459 |
+
}
|
460 |
+
|
461 |
+
document.observe("dom:loaded", function () {
|
462 |
+
window.onload = function(){
|
463 |
+
// MageWorld One Step Checkout Pro
|
464 |
+
if(typeof $MW_Onestepcheckout != 'undefined') {
|
465 |
+
|
466 |
+
$('payment_form_ewayrapid_notsaved') && $('payment_form_ewayrapid_notsaved').setStyle({'width': '90%'});
|
467 |
+
$('payment_form_ewayrapid_ewayone') && $('payment_form_ewayrapid_ewayone').setStyle({'width': '90%'});
|
468 |
+
$('ul_payment_form_ewayrapid_notsaved') && $('ul_payment_form_ewayrapid_notsaved').setStyle({'margin-left': '-2px'});
|
469 |
+
$('ul_payment_form_ewayrapid_ewayone') && $('ul_payment_form_ewayrapid_ewayone').setStyle({'margin-left': '-2px'});
|
470 |
+
$('payment_form_ewayrapid_ewayone') && $('payment_form_ewayrapid_ewayone').setStyle({'margin-left': '-2px'});
|
471 |
+
$('ul-eway-saved-div-box') && $('ul-eway-saved-div-box').setStyle({'margin-left': '-2px'});
|
472 |
+
|
473 |
+
$('ewayrapid_notsaved_expiration') && $('ewayrapid_notsaved_expiration').writeAttribute('style', 'width:103px !important;');
|
474 |
+
$('ewayrapid_ewayone_expiration') && $('ewayrapid_ewayone_expiration').writeAttribute('style', 'width:103px !important;');
|
475 |
+
//$('ewayrapid_ewayone_token') && $('ewayrapid_ewayone_token').writeAttribute('style', 'width:128px !important;');
|
476 |
+
|
477 |
+
$('ewayrapid_notsaved_cc_type_cvv_div') && $$('#ewayrapid_notsaved_cc_type_cvv_div div.v-fix')[0].writeAttribute('style', 'width: 35% !important');
|
478 |
+
$('ewayrapid_ewayone_cc_type_cvv_div') && $$('#ewayrapid_ewayone_cc_type_cvv_div div.v-fix')[0].writeAttribute('style', 'width: 35% !important');
|
479 |
+
|
480 |
+
$$('#ul_payment_form_ewayrapid_notsaved input[type=text]').each(function (element) {
|
481 |
+
element.writeAttribute('style', 'width: 80% !important;');
|
482 |
+
});
|
483 |
+
|
484 |
+
$('ul_payment_form_ewayrapid_ewayone') && $$('#ul_payment_form_ewayrapid_ewayone input[type=text]').each(function (element) {
|
485 |
+
element.writeAttribute('style', 'width: 80% !important;');
|
486 |
+
});
|
487 |
+
|
488 |
+
$MW_Onestepcheckout('.btn-checkout').die('click');
|
489 |
+
$MW_Onestepcheckout('.btn-checkout').live("click",function(e){
|
490 |
+
alert('Transparent Redirect is not supported with MageWorld One Step Checkout Pro.');
|
491 |
+
return false;
|
492 |
+
var ewayPayment = new EwayPayment($('onestep_form'), '<?php echo $_config->getEncryptionKey() ?>');
|
493 |
+
ewayPayment.paymentUrl = "<?php echo Mage::getUrl('ewayrapid/transparent/build', array('_secure'=>true)); ?>";
|
494 |
+
<?php if($_mageworld && Mage::helper('onestepcheckout')->onlyProductDownloadable()):?>
|
495 |
+
var notshipmethod=1;
|
496 |
+
<?php else:?>
|
497 |
+
var notshipmethod=$MW_Onestepcheckout("input[name=shipping_method]:checked").val();
|
498 |
+
<?php endif?>
|
499 |
+
if ($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked) {
|
500 |
+
if (!$('visa_checkout_call_id').value) {
|
501 |
+
document.getElementById('visa_checkout_button').click();
|
502 |
+
return;
|
503 |
+
}
|
504 |
+
}
|
505 |
+
ewayPayment.MageWorld.submit(e, notshipmethod, true);
|
506 |
+
});
|
507 |
+
}
|
508 |
+
}
|
509 |
+
});
|
510 |
+
|
511 |
+
<?php endswitch; ?>
|
512 |
+
|
513 |
+
</script>
|
514 |
+
<?php endif; ?>
|
515 |
+
|
516 |
+
<?php if($_backend && $_backendIFrame): ?>
|
517 |
+
<script type="text/javascript">
|
518 |
+
if(typeof AdminOrder === 'function'){
|
519 |
+
AdminOrder.prototype.submit = ewayPayment.submitAdminOrderIFrame;
|
520 |
+
}
|
521 |
+
ewayPayment.paymentUrl = "<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/sales_order_create/ewayiframe', array('_secure'=>true)); ?>";
|
522 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
523 |
+
if (result == "Complete") {
|
524 |
+
setLocation(ewayReturnUrl);
|
525 |
+
} else if (result == "Error") {
|
526 |
+
alert("There was a problem completing the payment: " + errors);
|
527 |
+
$('loading-mask') && $('loading-mask').hide();
|
528 |
+
} else{
|
529 |
+
$('loading-mask') && $('loading-mask').hide();
|
530 |
+
}
|
531 |
+
}
|
532 |
+
</script>
|
533 |
+
<?php endif; ?>
|
534 |
+
|
535 |
+
<?php if ($_config->isRapidIframeConnection() && !$_backend): ?>
|
536 |
+
<?php if($_checkoutExtension) {
|
537 |
+
Mage::getSingleton('core/session')->setCheckoutExtension($_checkoutExtension);
|
538 |
+
} else {
|
539 |
+
Mage::getSingleton('core/session')->unsCheckoutExtension();
|
540 |
+
}?>
|
541 |
+
<script type="text/javascript">
|
542 |
+
var creditcard = '<?php echo Eway_Rapid31_Model_Config::CREDITCARD_METHOD ?>';
|
543 |
+
var ewayReturnUrl = '';
|
544 |
+
|
545 |
+
<?php switch($_checkoutExtension):
|
546 |
+
case 'OneStepCheckout': // OneStepCheckout extension ?>
|
547 |
+
|
548 |
+
// Idev OSC
|
549 |
+
<?php if(Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')): ?>
|
550 |
+
|
551 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
552 |
+
if (result == "Complete") {
|
553 |
+
setLocation(ewayReturnUrl);
|
554 |
+
} else if (result == "Error") {
|
555 |
+
alert("There was a problem completing the payment: " + errors);
|
556 |
+
|
557 |
+
already_placing_order = false;
|
558 |
+
var submitelement = $('onestepcheckout-place-order');
|
559 |
+
|
560 |
+
$$('.onestepcheckout-place-order-loading').first() && $$('.onestepcheckout-place-order-loading').first().remove();
|
561 |
+
submitelement.addClassName('orange').removeClassName('grey');
|
562 |
+
submitelement.disabled = false;
|
563 |
+
} else{
|
564 |
+
already_placing_order = false;
|
565 |
+
var submitelement = $('onestepcheckout-place-order');
|
566 |
+
|
567 |
+
$$('.onestepcheckout-place-order-loading').first() && $$('.onestepcheckout-place-order-loading').first().remove();
|
568 |
+
submitelement.addClassName('orange').removeClassName('grey');
|
569 |
+
submitelement.disabled = false;
|
570 |
+
}
|
571 |
+
}
|
572 |
+
|
573 |
+
document.observe("dom:loaded", function () {
|
574 |
+
|
575 |
+
ewayPayment = new EwayPayment(null, null);
|
576 |
+
|
577 |
+
if (typeof (ewayPayment.ewaysavedOldOrder) == "undefined") {
|
578 |
+
EwayPayment.prototype.ewaysavedOldOrder = $('onestepcheckout-form').submit;
|
579 |
+
}
|
580 |
+
|
581 |
+
ewayPayment.paymentUrl = "<?php echo Mage::getUrl('onestepcheckout/index/index', array('_secure'=>true)); ?>";
|
582 |
+
|
583 |
+
$('onestepcheckout-form') && ($('onestepcheckout-form').submit = function(){
|
584 |
+
if (EwayPayment.isEwayRapidMethod(payment.currentMethod) && ewayPayment.paymentUrl != null ) {
|
585 |
+
|
586 |
+
var formData = $('onestepcheckout-form').serialize(true);
|
587 |
+
|
588 |
+
ewayPayment.OneStepCheckout.saveOrderWithIframe(formData);
|
589 |
+
}else{
|
590 |
+
ewayPayment.ewaysavedOldOrder.apply($('onestepcheckout-form'));
|
591 |
+
}
|
592 |
+
});
|
593 |
+
});
|
594 |
+
<?php endif; ?>
|
595 |
+
|
596 |
+
// Magestore OSC
|
597 |
+
<?php if(Mage::getStoreConfig('onestepcheckout/general/active')): ?>
|
598 |
+
|
599 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
600 |
+
if (result == "Complete") {
|
601 |
+
setLocation(ewayReturnUrl);
|
602 |
+
} else if (result == "Error") {
|
603 |
+
alert("There was a problem completing the payment: " + errors);
|
604 |
+
$('onestepcheckout-place-order-loading').hide();
|
605 |
+
$('onestepcheckout-button-place-order').addClassName('onestepcheckout-btn-checkout');
|
606 |
+
$('onestepcheckout-button-place-order').removeClassName('place-order-loader');
|
607 |
+
} else{
|
608 |
+
$('onestepcheckout-place-order-loading').hide();
|
609 |
+
$('onestepcheckout-button-place-order').addClassName('onestepcheckout-btn-checkout');
|
610 |
+
$('onestepcheckout-button-place-order').removeClassName('place-order-loader');
|
611 |
+
}
|
612 |
+
}
|
613 |
+
|
614 |
+
document.observe("dom:loaded", function () {
|
615 |
+
ewayPayment = new EwayPayment(null, null);
|
616 |
+
|
617 |
+
if (ewayPayment && $('one-step-checkout-form'))
|
618 |
+
Payment.prototype.switchMethod = ewayPayment.OneStepCheckout.switchMethod;
|
619 |
+
|
620 |
+
if (typeof (ewayPayment.ewaysavedOldOrder) == "undefined") {
|
621 |
+
EwayPayment.prototype.ewaysavedOldOrder = $('one-step-checkout-form').submit;
|
622 |
+
}
|
623 |
+
|
624 |
+
ewayPayment.paymentUrl = "<?php echo Mage::getUrl('onestepcheckout/index/saveOrder', array('_secure'=>true)); ?>";
|
625 |
+
|
626 |
+
$('one-step-checkout-form') && ($('one-step-checkout-form').submit = function(){
|
627 |
+
|
628 |
+
var currentMethod = $RF($('one-step-checkout-form'), 'payment[method]');
|
629 |
+
|
630 |
+
if (EwayPayment.isEwayRapidMethod(currentMethod) && ewayPayment.paymentUrl != null ) {
|
631 |
+
|
632 |
+
var formData = $('one-step-checkout-form').serialize(true);
|
633 |
+
|
634 |
+
ewayPayment.OneStepCheckout.saveOrderWithIframe(formData);
|
635 |
+
}else{
|
636 |
+
ewayPayment.ewaysavedOldOrder.apply($('one-step-checkout-form'));
|
637 |
+
}
|
638 |
+
});
|
639 |
+
});
|
640 |
+
<?php endif; ?>
|
641 |
+
<?php break; ?>
|
642 |
+
|
643 |
+
<?php case 'LightCheckout': ?>
|
644 |
+
|
645 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
646 |
+
if (result == "Complete") {
|
647 |
+
setLocation(ewayReturnUrl);
|
648 |
+
} else if (result == "Error") {
|
649 |
+
alert("There was a problem completing the payment: " + errors);
|
650 |
+
checkout.hideLoadinfo()
|
651 |
+
} else{
|
652 |
+
checkout.hideLoadinfo()
|
653 |
+
}
|
654 |
+
}
|
655 |
+
|
656 |
+
document.observe("dom:loaded", function () {
|
657 |
+
var ewayPayment = new EwayPayment(null, null);
|
658 |
+
if (typeof checkout.LightcheckoutSubmitOld == "undefined") {
|
659 |
+
checkout.saveOrderOld = checkout.saveorder;
|
660 |
+
checkout.saveorder = ewayPayment.Lightcheckout.saveorder;
|
661 |
+
}
|
662 |
+
});
|
663 |
+
<?php break; ?>
|
664 |
+
|
665 |
+
|
666 |
+
<?php case 'FireCheckout': // FireCheckout extension ?>
|
667 |
+
|
668 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
669 |
+
if (result == "Complete") {
|
670 |
+
setLocation(ewayReturnUrl);
|
671 |
+
} else if (result == "Error") {
|
672 |
+
alert("There was a problem completing the payment: " + errors);
|
673 |
+
checkout.setLoadWaiting(false);
|
674 |
+
$('review-please-wait').hide();
|
675 |
+
} else{
|
676 |
+
checkout.setLoadWaiting(false);
|
677 |
+
$('review-please-wait').hide();
|
678 |
+
}
|
679 |
+
}
|
680 |
+
|
681 |
+
document.observe("dom:loaded", function () {
|
682 |
+
var ewayPayment = new EwayPayment(null, null);
|
683 |
+
if (typeof FireCheckout.prototype.ewaySetResponse == "undefined") {
|
684 |
+
FireCheckout.prototype.ewaySetResponse = FireCheckout.prototype.setResponse;
|
685 |
+
FireCheckout.prototype.setResponse = ewayPayment.FireCheckout.setResponse;
|
686 |
+
}
|
687 |
+
});
|
688 |
+
<?php break; ?>
|
689 |
+
<?php case 'IWDOnePageCheckout': // FireCheckout extension ?>
|
690 |
+
|
691 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
692 |
+
if (result == "Complete") {
|
693 |
+
setLocation(ewayReturnUrl);
|
694 |
+
} else if (result == "Error") {
|
695 |
+
alert("There was a problem completing the payment: " + errors);
|
696 |
+
IWD.OPC.Checkout.hideLoader();
|
697 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
698 |
+
} else{
|
699 |
+
IWD.OPC.Checkout.hideLoader();
|
700 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
701 |
+
}
|
702 |
+
}
|
703 |
+
|
704 |
+
document.observe("dom:loaded", function () {
|
705 |
+
var ewayPayment = new EwayPayment(null, null);
|
706 |
+
if (typeof IWD.OPC.ewayOldPreparePaymentResponse == "undefined") {
|
707 |
+
IWD.OPC.ewayOldPreparePaymentResponse = IWD.OPC.preparePaymentResponse;
|
708 |
+
IWD.OPC.preparePaymentResponse = ewayPayment.IWDOnePageCheckout.preparePaymentResponse;
|
709 |
+
}
|
710 |
+
});
|
711 |
+
<?php break; ?>
|
712 |
+
<?php case 'MultiShippingAddress': // Magento default multi shipping address ?>
|
713 |
+
var ewayPayment = new EwayPayment($('multishipping-billing-form'), '<?php echo $_config->getEncryptionKey() ?>');
|
714 |
+
<?php break; ?>
|
715 |
+
|
716 |
+
<?php default: // Magento default one page checkout ?>
|
717 |
+
|
718 |
+
function eWayRapidCallback (result, transactionID, errors) {
|
719 |
+
if (result == "Complete") {
|
720 |
+
setLocation(ewayReturnUrl);
|
721 |
+
} else if (result == "Error") {
|
722 |
+
alert("There was a problem completing the payment: " + errors);
|
723 |
+
$('review-please-wait') && $('review-please-wait').hide();
|
724 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').show();
|
725 |
+
} else{
|
726 |
+
$('review-please-wait') && $('review-please-wait').hide();
|
727 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').show();
|
728 |
+
}
|
729 |
+
}
|
730 |
+
|
731 |
+
var ewayPayment = new EwayPayment(null, null);
|
732 |
+
|
733 |
+
if (typeof (ewayPayment.ewaysavedOldOrder) == "undefined") {
|
734 |
+
ewayPayment.ewaysavedOldOrder = Review.prototype.save;
|
735 |
+
}
|
736 |
+
ewayPayment.paymentUrl = "<?php echo Mage::getUrl('ewayrapid/sharedpage/iframe', array('_secure'=>true)); ?>";
|
737 |
+
Review.prototype.save = ewayPayment.saveOrderWithIframe;
|
738 |
+
|
739 |
+
<?php endswitch; ?>
|
740 |
+
|
741 |
+
</script>
|
742 |
<?php endif; ?>
|
@@ -20,7 +20,6 @@
|
|
20 |
*
|
21 |
* @category design
|
22 |
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
*/
|
26 |
?>
|
20 |
*
|
21 |
* @category design
|
22 |
* @package base_default
|
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
?>
|
@@ -19,6 +19,11 @@ $accessCode = $this->getAccessCode();
|
|
19 |
class="" id="EWAY_CARDCVN" name="EWAY_CARDCVN" value="<?php echo Mage::getSingleton('core/session')->getInfoCard()->getCid(); ?>"
|
20 |
/>
|
21 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
22 |
<?php } ?>
|
23 |
|
24 |
<?php if ($this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_EXPRESS_METHOD) { ?>
|
19 |
class="" id="EWAY_CARDCVN" name="EWAY_CARDCVN" value="<?php echo Mage::getSingleton('core/session')->getInfoCard()->getCid(); ?>"
|
20 |
/>
|
21 |
<?php endif; ?>
|
22 |
+
<?php } elseif($this->transMethod == Eway_Rapid31_Model_Config::VISA_CHECKOUT_METHOD) {?>
|
23 |
+
<input type="hidden" name="EWAY_PAYMENTTYPE" value="visacheckout"/>
|
24 |
+
<input type="hidden" id="visa_checkout_callid" name="VISA_CHECKOUT_CALLID"
|
25 |
+
value="<?php echo Mage::getSingleton('core/session')->getVisaCheckoutCallId() ?>"/>
|
26 |
+
<input type="hidden" id="visa_checkout_response" name="VISA_CHECKOUT_RESPONSE" value=""/>
|
27 |
<?php } ?>
|
28 |
|
29 |
<?php if ($this->transMethod == Eway_Rapid31_Model_Config::PAYPAL_EXPRESS_METHOD) { ?>
|
@@ -1,1021 +0,0 @@
|
|
1 |
-
|
2 |
-
function eCrypt() {
|
3 |
-
this.init = null;
|
4 |
-
this.submitForm = null;
|
5 |
-
this.encryptValue = null;
|
6 |
-
this.doEncrypt = null;
|
7 |
-
}
|
8 |
-
|
9 |
-
(function (eCrypt) {
|
10 |
-
function eCryptInit() {
|
11 |
-
|
12 |
-
var ewayPublicKeyAttribute = "data-eway-encrypt-key";
|
13 |
-
var ewayEncryptAttribute = "data-eway-encrypt-name";
|
14 |
-
|
15 |
-
var PUBLIC_KEY_N = null;
|
16 |
-
var PUBLIC_KEY_E = b64tohex("AQAB");
|
17 |
-
|
18 |
-
var isAjaxCall = false;
|
19 |
-
|
20 |
-
var form = findFormToEncrypt();
|
21 |
-
if (form) {
|
22 |
-
extractPublicKey(form);
|
23 |
-
addSubmitEvent(form);
|
24 |
-
}
|
25 |
-
|
26 |
-
//API Entrypoint for JS to submit the form manually
|
27 |
-
function submitFormApi() {
|
28 |
-
var form = findFormToEncrypt();
|
29 |
-
if (form)
|
30 |
-
return submitForm(form);
|
31 |
-
else
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
function encryptValueApi(val, key) {
|
35 |
-
var keyToUse = null;
|
36 |
-
if (key) keyToUse = b64tohex(key);
|
37 |
-
if (!keyToUse) keyToUse = PUBLIC_KEY_N;
|
38 |
-
if (keyToUse) {
|
39 |
-
var rsa = new RSAKey();
|
40 |
-
rsa.setPublic(keyToUse, PUBLIC_KEY_E);
|
41 |
-
return "eCrypted:" + rsa.encrypt(val);
|
42 |
-
} else
|
43 |
-
return null;
|
44 |
-
}
|
45 |
-
function encryptForm(event) {
|
46 |
-
var target;
|
47 |
-
// the form is not the event target in ajax call, so we use form variable found before
|
48 |
-
if(form != null) {
|
49 |
-
target = form;
|
50 |
-
} else {
|
51 |
-
event = event || window.event; // event is undefined in IE
|
52 |
-
target = event.target || event.srcElement; // IE uses srcElement, everything else uses target
|
53 |
-
}
|
54 |
-
return submitForm(target);
|
55 |
-
}
|
56 |
-
// Clones and submuits the form, running it's original submit handler
|
57 |
-
function submitForm(target) {
|
58 |
-
try {
|
59 |
-
var rsa = new RSAKey();
|
60 |
-
rsa.setPublic(PUBLIC_KEY_N, PUBLIC_KEY_E);
|
61 |
-
var newForm = cloneForm(target);
|
62 |
-
if (newForm.id) {
|
63 |
-
newForm.id = "EWAY_CLONED_" + newForm.id;
|
64 |
-
}
|
65 |
-
|
66 |
-
for (formNode = 0, formLength = newForm.length; formNode < formLength; formNode++) {
|
67 |
-
var dataAttribute = newForm[formNode].getAttribute(ewayEncryptAttribute);
|
68 |
-
if (dataAttribute != null) {
|
69 |
-
encryptElement(newForm[formNode], rsa);
|
70 |
-
}
|
71 |
-
else if (newForm[formNode].id) {
|
72 |
-
newForm[formNode].id = "EWAY_ENCRYPTED_" + newForm[formNode].id;
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
newForm.style.display = "none";
|
77 |
-
form.parentNode.appendChild(newForm); //IE and FF will not submit form without it being inserted into the DOM
|
78 |
-
if(isAjaxCall) {
|
79 |
-
return newForm;
|
80 |
-
}
|
81 |
-
var formProxy = document.createElement('form');
|
82 |
-
formProxy.submit.apply(newForm); // To guard against a form with a button named 'submit'
|
83 |
-
|
84 |
-
}
|
85 |
-
catch (err) {
|
86 |
-
// Debugging - In case console not open in IE
|
87 |
-
if (!window.console) window.console = {};
|
88 |
-
if (!window.console.log) window.console.log = function () { };
|
89 |
-
console.log('Uh oh, something went wrong');
|
90 |
-
console.log(err);
|
91 |
-
console.log(err.message);
|
92 |
-
}
|
93 |
-
finally {
|
94 |
-
if(!isAjaxCall) {
|
95 |
-
return false;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
function findFormToEncrypt() {
|
101 |
-
var forms = document.getElementsByTagName('form');
|
102 |
-
for (var i = 0; i < forms.length; i++) {
|
103 |
-
var key = forms[i].getAttribute(ewayPublicKeyAttribute);
|
104 |
-
if (key) {
|
105 |
-
return forms[i];
|
106 |
-
}
|
107 |
-
}
|
108 |
-
return null;
|
109 |
-
}
|
110 |
-
|
111 |
-
function extractPublicKey(f) {
|
112 |
-
PUBLIC_KEY_N = b64tohex(f.getAttribute(ewayPublicKeyAttribute));
|
113 |
-
}
|
114 |
-
|
115 |
-
function cloneForm(oldForm) {
|
116 |
-
var newForm = oldForm.cloneNode(true);
|
117 |
-
copySelectLists(oldForm, newForm);
|
118 |
-
copyTextAreas(oldForm, newForm);
|
119 |
-
copyCheckboxAndRadioValues(oldForm, newForm);
|
120 |
-
return newForm;
|
121 |
-
}
|
122 |
-
|
123 |
-
function copySelectLists(oldForm, newForm) {
|
124 |
-
var selectElementsOld = oldForm.getElementsByTagName('Select');
|
125 |
-
var selectElementsNew = newForm.getElementsByTagName('Select');
|
126 |
-
|
127 |
-
for (var i = 0; i < selectElementsOld.length; i++) {
|
128 |
-
selectElementsNew[i].selectedIndex = selectElementsOld[i].selectedIndex;
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
function copyTextAreas(oldForm, newForm) {
|
133 |
-
var textElementsOld = oldForm.getElementsByTagName('TextArea');
|
134 |
-
var textElementsNew = newForm.getElementsByTagName('TextArea');
|
135 |
-
|
136 |
-
for (var i = 0; i < textElementsOld.length; i++) {
|
137 |
-
textElementsNew[i].value = textElementsOld[i].value;
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
function copyCheckboxAndRadioValues(oldForm, newForm) {
|
142 |
-
var inputsOld = oldForm.getElementsByTagName('input');
|
143 |
-
var inputsNew = newForm.getElementsByTagName('input');
|
144 |
-
|
145 |
-
for (var i = 0; i < inputsOld.length; i++) {
|
146 |
-
if (inputsOld[i].type === 'checkbox' || inputsOld[i].type === 'radio') {
|
147 |
-
inputsNew[i].checked = inputsOld[i].checked; // Need this for IE
|
148 |
-
inputsNew[i].value = inputsOld[i].value; // Need this for IE10
|
149 |
-
}
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
function encryptElement(element, rsa) {
|
154 |
-
if (element.id) {
|
155 |
-
element.id = "EWAY_ENCRYPTED_" + element.id;
|
156 |
-
}
|
157 |
-
element.name = element.getAttribute(ewayEncryptAttribute);
|
158 |
-
element.value = "eCrypted:" + rsa.encrypt(element.value);
|
159 |
-
}
|
160 |
-
|
161 |
-
function addSubmitEvent(frm) {
|
162 |
-
var oldonsubmit = frm.onsubmit;
|
163 |
-
if (typeof frm.onsubmit != 'function') {
|
164 |
-
frm.onsubmit = encryptForm;
|
165 |
-
} else {
|
166 |
-
frm.onsubmit = function (e) {
|
167 |
-
if (!oldonsubmit(e)) {
|
168 |
-
return false;
|
169 |
-
};
|
170 |
-
return encryptForm(e);
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
eCrypt.doEncrypt = function() {
|
175 |
-
isAjaxCall = true;
|
176 |
-
return encryptForm();
|
177 |
-
}
|
178 |
-
}
|
179 |
-
// Add Public API Entry Points into these functions
|
180 |
-
eCrypt.submitForm = submitFormApi;
|
181 |
-
eCrypt.encryptValue = encryptValueApi;
|
182 |
-
};
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
var dbits;
|
187 |
-
|
188 |
-
var canary = 0xdeadbeefcafe;
|
189 |
-
var j_lm = ((canary & 0xffffff) == 0xefcafe);
|
190 |
-
|
191 |
-
function BigInteger(a, b, c) {
|
192 |
-
if (a != null)
|
193 |
-
if ("number" == typeof a) this.fromNumber(a, b, c);
|
194 |
-
else if (b == null && "string" != typeof a) this.fromString(a, 256);
|
195 |
-
else this.fromString(a, b);
|
196 |
-
}
|
197 |
-
|
198 |
-
|
199 |
-
function nbi() { return new BigInteger(null); }
|
200 |
-
|
201 |
-
|
202 |
-
function am1(i, x, w, j, c, n) {
|
203 |
-
while (--n >= 0) {
|
204 |
-
var v = x * this[i++] + w[j] + c;
|
205 |
-
c = Math.floor(v / 0x4000000);
|
206 |
-
w[j++] = v & 0x3ffffff;
|
207 |
-
}
|
208 |
-
return c;
|
209 |
-
}
|
210 |
-
|
211 |
-
function am2(i, x, w, j, c, n) {
|
212 |
-
var xl = x & 0x7fff, xh = x >> 15;
|
213 |
-
while (--n >= 0) {
|
214 |
-
var l = this[i] & 0x7fff;
|
215 |
-
var h = this[i++] >> 15;
|
216 |
-
var m = xh * l + h * xl;
|
217 |
-
l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);
|
218 |
-
c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);
|
219 |
-
w[j++] = l & 0x3fffffff;
|
220 |
-
}
|
221 |
-
return c;
|
222 |
-
}
|
223 |
-
|
224 |
-
function am3(i, x, w, j, c, n) {
|
225 |
-
var xl = x & 0x3fff, xh = x >> 14;
|
226 |
-
while (--n >= 0) {
|
227 |
-
var l = this[i] & 0x3fff;
|
228 |
-
var h = this[i++] >> 14;
|
229 |
-
var m = xh * l + h * xl;
|
230 |
-
l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;
|
231 |
-
c = (l >> 28) + (m >> 14) + xh * h;
|
232 |
-
w[j++] = l & 0xfffffff;
|
233 |
-
}
|
234 |
-
return c;
|
235 |
-
}
|
236 |
-
if (j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
|
237 |
-
BigInteger.prototype.am = am2;
|
238 |
-
dbits = 30;
|
239 |
-
}
|
240 |
-
else if (j_lm && (navigator.appName != "Netscape")) {
|
241 |
-
BigInteger.prototype.am = am1;
|
242 |
-
dbits = 26;
|
243 |
-
}
|
244 |
-
else { // Mozilla/Netscape seems to prefer am3
|
245 |
-
BigInteger.prototype.am = am3;
|
246 |
-
dbits = 28;
|
247 |
-
}
|
248 |
-
|
249 |
-
BigInteger.prototype.DB = dbits;
|
250 |
-
BigInteger.prototype.DM = ((1 << dbits) - 1);
|
251 |
-
BigInteger.prototype.DV = (1 << dbits);
|
252 |
-
|
253 |
-
var BI_FP = 52;
|
254 |
-
BigInteger.prototype.FV = Math.pow(2, BI_FP);
|
255 |
-
BigInteger.prototype.F1 = BI_FP - dbits;
|
256 |
-
BigInteger.prototype.F2 = 2 * dbits - BI_FP;
|
257 |
-
|
258 |
-
// Digit conversions
|
259 |
-
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
|
260 |
-
var BI_RC = new Array();
|
261 |
-
var rr, vv;
|
262 |
-
rr = "0".charCodeAt(0);
|
263 |
-
for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
|
264 |
-
rr = "a".charCodeAt(0);
|
265 |
-
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
266 |
-
rr = "A".charCodeAt(0);
|
267 |
-
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
268 |
-
|
269 |
-
function int2char(n) { return BI_RM.charAt(n); }
|
270 |
-
function intAt(s, i) {
|
271 |
-
var c = BI_RC[s.charCodeAt(i)];
|
272 |
-
return (c == null) ? -1 : c;
|
273 |
-
}
|
274 |
-
|
275 |
-
|
276 |
-
function bnpCopyTo(r) {
|
277 |
-
for (var i = this.t - 1; i >= 0; --i) r[i] = this[i];
|
278 |
-
r.t = this.t;
|
279 |
-
r.s = this.s;
|
280 |
-
}
|
281 |
-
|
282 |
-
|
283 |
-
function bnpFromInt(x) {
|
284 |
-
this.t = 1;
|
285 |
-
this.s = (x < 0) ? -1 : 0;
|
286 |
-
if (x > 0) this[0] = x;
|
287 |
-
else if (x < -1) this[0] = x + this.DV;
|
288 |
-
else this.t = 0;
|
289 |
-
}
|
290 |
-
|
291 |
-
function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
|
292 |
-
|
293 |
-
// (protected) set from string and radix
|
294 |
-
function bnpFromString(s, b) {
|
295 |
-
var k;
|
296 |
-
if (b == 16) k = 4;
|
297 |
-
else if (b == 8) k = 3;
|
298 |
-
else if (b == 256) k = 8; // byte array
|
299 |
-
else if (b == 2) k = 1;
|
300 |
-
else if (b == 32) k = 5;
|
301 |
-
else if (b == 4) k = 2;
|
302 |
-
else { this.fromRadix(s, b); return; }
|
303 |
-
this.t = 0;
|
304 |
-
this.s = 0;
|
305 |
-
var i = s.length, mi = false, sh = 0;
|
306 |
-
while (--i >= 0) {
|
307 |
-
var x = (k == 8) ? s[i] & 0xff : intAt(s, i);
|
308 |
-
if (x < 0) {
|
309 |
-
if (s.charAt(i) == "-") mi = true;
|
310 |
-
continue;
|
311 |
-
}
|
312 |
-
mi = false;
|
313 |
-
if (sh == 0)
|
314 |
-
this[this.t++] = x;
|
315 |
-
else if (sh + k > this.DB) {
|
316 |
-
this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;
|
317 |
-
this[this.t++] = (x >> (this.DB - sh));
|
318 |
-
}
|
319 |
-
else
|
320 |
-
this[this.t - 1] |= x << sh;
|
321 |
-
sh += k;
|
322 |
-
if (sh >= this.DB) sh -= this.DB;
|
323 |
-
}
|
324 |
-
if (k == 8 && (s[0] & 0x80) != 0) {
|
325 |
-
this.s = -1;
|
326 |
-
if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;
|
327 |
-
}
|
328 |
-
this.clamp();
|
329 |
-
if (mi) BigInteger.ZERO.subTo(this, this);
|
330 |
-
}
|
331 |
-
|
332 |
-
// (protected) clamp off excess high words
|
333 |
-
function bnpClamp() {
|
334 |
-
var c = this.s & this.DM;
|
335 |
-
while (this.t > 0 && this[this.t - 1] == c)--this.t;
|
336 |
-
}
|
337 |
-
|
338 |
-
// (public) return string representation in given radix
|
339 |
-
function bnToString(b) {
|
340 |
-
if (this.s < 0) return "-" + this.negate().toString(b);
|
341 |
-
var k;
|
342 |
-
if (b == 16) k = 4;
|
343 |
-
else if (b == 8) k = 3;
|
344 |
-
else if (b == 2) k = 1;
|
345 |
-
else if (b == 32) k = 5;
|
346 |
-
else if (b == 4) k = 2;
|
347 |
-
else return this.toRadix(b);
|
348 |
-
var km = (1 << k) - 1, d, m = false, r = "", i = this.t;
|
349 |
-
var p = this.DB - (i * this.DB) % k;
|
350 |
-
if (i-- > 0) {
|
351 |
-
if (p < this.DB && (d = this[i] >> p) > 0) { m = true; r = int2char(d); }
|
352 |
-
while (i >= 0) {
|
353 |
-
if (p < k) {
|
354 |
-
d = (this[i] & ((1 << p) - 1)) << (k - p);
|
355 |
-
d |= this[--i] >> (p += this.DB - k);
|
356 |
-
}
|
357 |
-
else {
|
358 |
-
d = (this[i] >> (p -= k)) & km;
|
359 |
-
if (p <= 0) { p += this.DB; --i; }
|
360 |
-
}
|
361 |
-
if (d > 0) m = true;
|
362 |
-
if (m) r += int2char(d);
|
363 |
-
}
|
364 |
-
}
|
365 |
-
return m ? r : "0";
|
366 |
-
}
|
367 |
-
|
368 |
-
// (public) -this
|
369 |
-
function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this, r); return r; }
|
370 |
-
|
371 |
-
// (public) |this|
|
372 |
-
function bnAbs() { return (this.s < 0) ? this.negate() : this; }
|
373 |
-
|
374 |
-
// (public) return + if this > a, - if this < a, 0 if equal
|
375 |
-
function bnCompareTo(a) {
|
376 |
-
var r = this.s - a.s;
|
377 |
-
if (r != 0) return r;
|
378 |
-
var i = this.t;
|
379 |
-
r = i - a.t;
|
380 |
-
if (r != 0) return (this.s < 0) ? -r : r;
|
381 |
-
while (--i >= 0) if ((r = this[i] - a[i]) != 0) return r;
|
382 |
-
return 0;
|
383 |
-
}
|
384 |
-
|
385 |
-
// returns bit length of the integer x
|
386 |
-
function nbits(x) {
|
387 |
-
var r = 1, t;
|
388 |
-
if ((t = x >>> 16) != 0) { x = t; r += 16; }
|
389 |
-
if ((t = x >> 8) != 0) { x = t; r += 8; }
|
390 |
-
if ((t = x >> 4) != 0) { x = t; r += 4; }
|
391 |
-
if ((t = x >> 2) != 0) { x = t; r += 2; }
|
392 |
-
if ((t = x >> 1) != 0) { x = t; r += 1; }
|
393 |
-
return r;
|
394 |
-
}
|
395 |
-
|
396 |
-
// (public) return the number of bits in "this"
|
397 |
-
function bnBitLength() {
|
398 |
-
if (this.t <= 0) return 0;
|
399 |
-
return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));
|
400 |
-
}
|
401 |
-
|
402 |
-
// (protected) r = this << n*DB
|
403 |
-
function bnpDLShiftTo(n, r) {
|
404 |
-
var i;
|
405 |
-
for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];
|
406 |
-
for (i = n - 1; i >= 0; --i) r[i] = 0;
|
407 |
-
r.t = this.t + n;
|
408 |
-
r.s = this.s;
|
409 |
-
}
|
410 |
-
|
411 |
-
// (protected) r = this >> n*DB
|
412 |
-
function bnpDRShiftTo(n, r) {
|
413 |
-
for (var i = n; i < this.t; ++i) r[i - n] = this[i];
|
414 |
-
r.t = Math.max(this.t - n, 0);
|
415 |
-
r.s = this.s;
|
416 |
-
}
|
417 |
-
|
418 |
-
// (protected) r = this << n
|
419 |
-
function bnpLShiftTo(n, r) {
|
420 |
-
var bs = n % this.DB;
|
421 |
-
var cbs = this.DB - bs;
|
422 |
-
var bm = (1 << cbs) - 1;
|
423 |
-
var ds = Math.floor(n / this.DB), c = (this.s << bs) & this.DM, i;
|
424 |
-
for (i = this.t - 1; i >= 0; --i) {
|
425 |
-
r[i + ds + 1] = (this[i] >> cbs) | c;
|
426 |
-
c = (this[i] & bm) << bs;
|
427 |
-
}
|
428 |
-
for (i = ds - 1; i >= 0; --i) r[i] = 0;
|
429 |
-
r[ds] = c;
|
430 |
-
r.t = this.t + ds + 1;
|
431 |
-
r.s = this.s;
|
432 |
-
r.clamp();
|
433 |
-
}
|
434 |
-
|
435 |
-
// (protected) r = this >> n
|
436 |
-
function bnpRShiftTo(n, r) {
|
437 |
-
r.s = this.s;
|
438 |
-
var ds = Math.floor(n / this.DB);
|
439 |
-
if (ds >= this.t) { r.t = 0; return; }
|
440 |
-
var bs = n % this.DB;
|
441 |
-
var cbs = this.DB - bs;
|
442 |
-
var bm = (1 << bs) - 1;
|
443 |
-
r[0] = this[ds] >> bs;
|
444 |
-
for (var i = ds + 1; i < this.t; ++i) {
|
445 |
-
r[i - ds - 1] |= (this[i] & bm) << cbs;
|
446 |
-
r[i - ds] = this[i] >> bs;
|
447 |
-
}
|
448 |
-
if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;
|
449 |
-
r.t = this.t - ds;
|
450 |
-
r.clamp();
|
451 |
-
}
|
452 |
-
|
453 |
-
// (protected) r = this - a
|
454 |
-
function bnpSubTo(a, r) {
|
455 |
-
var i = 0, c = 0, m = Math.min(a.t, this.t);
|
456 |
-
while (i < m) {
|
457 |
-
c += this[i] - a[i];
|
458 |
-
r[i++] = c & this.DM;
|
459 |
-
c >>= this.DB;
|
460 |
-
}
|
461 |
-
if (a.t < this.t) {
|
462 |
-
c -= a.s;
|
463 |
-
while (i < this.t) {
|
464 |
-
c += this[i];
|
465 |
-
r[i++] = c & this.DM;
|
466 |
-
c >>= this.DB;
|
467 |
-
}
|
468 |
-
c += this.s;
|
469 |
-
}
|
470 |
-
else {
|
471 |
-
c += this.s;
|
472 |
-
while (i < a.t) {
|
473 |
-
c -= a[i];
|
474 |
-
r[i++] = c & this.DM;
|
475 |
-
c >>= this.DB;
|
476 |
-
}
|
477 |
-
c -= a.s;
|
478 |
-
}
|
479 |
-
r.s = (c < 0) ? -1 : 0;
|
480 |
-
if (c < -1) r[i++] = this.DV + c;
|
481 |
-
else if (c > 0) r[i++] = c;
|
482 |
-
r.t = i;
|
483 |
-
r.clamp();
|
484 |
-
}
|
485 |
-
|
486 |
-
// (protected) r = this * a, r != this,a (HAC 14.12)
|
487 |
-
// "this" should be the larger one if appropriate.
|
488 |
-
function bnpMultiplyTo(a, r) {
|
489 |
-
var x = this.abs(), y = a.abs();
|
490 |
-
var i = x.t;
|
491 |
-
r.t = i + y.t;
|
492 |
-
while (--i >= 0) r[i] = 0;
|
493 |
-
for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);
|
494 |
-
r.s = 0;
|
495 |
-
r.clamp();
|
496 |
-
if (this.s != a.s) BigInteger.ZERO.subTo(r, r);
|
497 |
-
}
|
498 |
-
|
499 |
-
// (protected) r = this^2, r != this (HAC 14.16)
|
500 |
-
function bnpSquareTo(r) {
|
501 |
-
var x = this.abs();
|
502 |
-
var i = r.t = 2 * x.t;
|
503 |
-
while (--i >= 0) r[i] = 0;
|
504 |
-
for (i = 0; i < x.t - 1; ++i) {
|
505 |
-
var c = x.am(i, x[i], r, 2 * i, 0, 1);
|
506 |
-
if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
|
507 |
-
r[i + x.t] -= x.DV;
|
508 |
-
r[i + x.t + 1] = 1;
|
509 |
-
}
|
510 |
-
}
|
511 |
-
if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);
|
512 |
-
r.s = 0;
|
513 |
-
r.clamp();
|
514 |
-
}
|
515 |
-
|
516 |
-
// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
|
517 |
-
// r != q, this != m. q or r may be null.
|
518 |
-
function bnpDivRemTo(m, q, r) {
|
519 |
-
var pm = m.abs();
|
520 |
-
if (pm.t <= 0) return;
|
521 |
-
var pt = this.abs();
|
522 |
-
if (pt.t < pm.t) {
|
523 |
-
if (q != null) q.fromInt(0);
|
524 |
-
if (r != null) this.copyTo(r);
|
525 |
-
return;
|
526 |
-
}
|
527 |
-
if (r == null) r = nbi();
|
528 |
-
var y = nbi(), ts = this.s, ms = m.s;
|
529 |
-
var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus
|
530 |
-
if (nsh > 0) { pm.lShiftTo(nsh, y); pt.lShiftTo(nsh, r); }
|
531 |
-
else { pm.copyTo(y); pt.copyTo(r); }
|
532 |
-
var ys = y.t;
|
533 |
-
var y0 = y[ys - 1];
|
534 |
-
if (y0 == 0) return;
|
535 |
-
var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);
|
536 |
-
var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2;
|
537 |
-
var i = r.t, j = i - ys, t = (q == null) ? nbi() : q;
|
538 |
-
y.dlShiftTo(j, t);
|
539 |
-
if (r.compareTo(t) >= 0) {
|
540 |
-
r[r.t++] = 1;
|
541 |
-
r.subTo(t, r);
|
542 |
-
}
|
543 |
-
BigInteger.ONE.dlShiftTo(ys, t);
|
544 |
-
t.subTo(y, y); // "negative" y so we can replace sub with am later
|
545 |
-
while (y.t < ys) y[y.t++] = 0;
|
546 |
-
while (--j >= 0) {
|
547 |
-
// Estimate quotient digit
|
548 |
-
var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);
|
549 |
-
if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out
|
550 |
-
y.dlShiftTo(j, t);
|
551 |
-
r.subTo(t, r);
|
552 |
-
while (r[i] < --qd) r.subTo(t, r);
|
553 |
-
}
|
554 |
-
}
|
555 |
-
if (q != null) {
|
556 |
-
r.drShiftTo(ys, q);
|
557 |
-
if (ts != ms) BigInteger.ZERO.subTo(q, q);
|
558 |
-
}
|
559 |
-
r.t = ys;
|
560 |
-
r.clamp();
|
561 |
-
if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder
|
562 |
-
if (ts < 0) BigInteger.ZERO.subTo(r, r);
|
563 |
-
}
|
564 |
-
|
565 |
-
// (public) this mod a
|
566 |
-
function bnMod(a) {
|
567 |
-
var r = nbi();
|
568 |
-
this.abs().divRemTo(a, null, r);
|
569 |
-
if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);
|
570 |
-
return r;
|
571 |
-
}
|
572 |
-
|
573 |
-
// Modular reduction using "classic" algorithm
|
574 |
-
function Classic(m) { this.m = m; }
|
575 |
-
function cConvert(x) {
|
576 |
-
if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
|
577 |
-
else return x;
|
578 |
-
}
|
579 |
-
function cRevert(x) { return x; }
|
580 |
-
function cReduce(x) { x.divRemTo(this.m, null, x); }
|
581 |
-
function cMulTo(x, y, r) { x.multiplyTo(y, r); this.reduce(r); }
|
582 |
-
function cSqrTo(x, r) { x.squareTo(r); this.reduce(r); }
|
583 |
-
|
584 |
-
Classic.prototype.convert = cConvert;
|
585 |
-
Classic.prototype.revert = cRevert;
|
586 |
-
Classic.prototype.reduce = cReduce;
|
587 |
-
Classic.prototype.mulTo = cMulTo;
|
588 |
-
Classic.prototype.sqrTo = cSqrTo;
|
589 |
-
|
590 |
-
// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
|
591 |
-
|
592 |
-
function bnpInvDigit() {
|
593 |
-
if (this.t < 1) return 0;
|
594 |
-
var x = this[0];
|
595 |
-
if ((x & 1) == 0) return 0;
|
596 |
-
var y = x & 3; // y == 1/x mod 2^2
|
597 |
-
y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4
|
598 |
-
y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8
|
599 |
-
y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16
|
600 |
-
// last step - calculate inverse mod DV directly;
|
601 |
-
// assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
|
602 |
-
y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits
|
603 |
-
// we really want the negative inverse, and -DV < y < DV
|
604 |
-
return (y > 0) ? this.DV - y : -y;
|
605 |
-
}
|
606 |
-
|
607 |
-
// Montgomery reduction
|
608 |
-
function Montgomery(m) {
|
609 |
-
this.m = m;
|
610 |
-
this.mp = m.invDigit();
|
611 |
-
this.mpl = this.mp & 0x7fff;
|
612 |
-
this.mph = this.mp >> 15;
|
613 |
-
this.um = (1 << (m.DB - 15)) - 1;
|
614 |
-
this.mt2 = 2 * m.t;
|
615 |
-
}
|
616 |
-
|
617 |
-
// xR mod m
|
618 |
-
function montConvert(x) {
|
619 |
-
var r = nbi();
|
620 |
-
x.abs().dlShiftTo(this.m.t, r);
|
621 |
-
r.divRemTo(this.m, null, r);
|
622 |
-
if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);
|
623 |
-
return r;
|
624 |
-
}
|
625 |
-
|
626 |
-
// x/R mod m
|
627 |
-
function montRevert(x) {
|
628 |
-
var r = nbi();
|
629 |
-
x.copyTo(r);
|
630 |
-
this.reduce(r);
|
631 |
-
return r;
|
632 |
-
}
|
633 |
-
|
634 |
-
// x = x/R mod m (HAC 14.32)
|
635 |
-
function montReduce(x) {
|
636 |
-
while (x.t <= this.mt2) // pad x so am has enough room later
|
637 |
-
x[x.t++] = 0;
|
638 |
-
for (var i = 0; i < this.m.t; ++i) {
|
639 |
-
// faster way of calculating u0 = x[i]*mp mod DV
|
640 |
-
var j = x[i] & 0x7fff;
|
641 |
-
var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;
|
642 |
-
// use am to combine the multiply-shift-add into one call
|
643 |
-
j = i + this.m.t;
|
644 |
-
x[j] += this.m.am(0, u0, x, i, 0, this.m.t);
|
645 |
-
// propagate carry
|
646 |
-
while (x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }
|
647 |
-
}
|
648 |
-
x.clamp();
|
649 |
-
x.drShiftTo(this.m.t, x);
|
650 |
-
if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);
|
651 |
-
}
|
652 |
-
|
653 |
-
// r = "x^2/R mod m"; x != r
|
654 |
-
function montSqrTo(x, r) { x.squareTo(r); this.reduce(r); }
|
655 |
-
|
656 |
-
// r = "xy/R mod m"; x,y != r
|
657 |
-
function montMulTo(x, y, r) { x.multiplyTo(y, r); this.reduce(r); }
|
658 |
-
|
659 |
-
Montgomery.prototype.convert = montConvert;
|
660 |
-
Montgomery.prototype.revert = montRevert;
|
661 |
-
Montgomery.prototype.reduce = montReduce;
|
662 |
-
Montgomery.prototype.mulTo = montMulTo;
|
663 |
-
Montgomery.prototype.sqrTo = montSqrTo;
|
664 |
-
|
665 |
-
// (protected) true iff this is even
|
666 |
-
function bnpIsEven() { return ((this.t > 0) ? (this[0] & 1) : this.s) == 0; }
|
667 |
-
|
668 |
-
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
|
669 |
-
function bnpExp(e, z) {
|
670 |
-
if (e > 0xffffffff || e < 1) return BigInteger.ONE;
|
671 |
-
var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e) - 1;
|
672 |
-
g.copyTo(r);
|
673 |
-
while (--i >= 0) {
|
674 |
-
z.sqrTo(r, r2);
|
675 |
-
if ((e & (1 << i)) > 0) z.mulTo(r2, g, r);
|
676 |
-
else { var t = r; r = r2; r2 = t; }
|
677 |
-
}
|
678 |
-
return z.revert(r);
|
679 |
-
}
|
680 |
-
|
681 |
-
// (public) this^e % m, 0 <= e < 2^32
|
682 |
-
function bnModPowInt(e, m) {
|
683 |
-
var z;
|
684 |
-
if (e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
|
685 |
-
return this.exp(e, z);
|
686 |
-
}
|
687 |
-
|
688 |
-
// protected
|
689 |
-
BigInteger.prototype.copyTo = bnpCopyTo;
|
690 |
-
BigInteger.prototype.fromInt = bnpFromInt;
|
691 |
-
BigInteger.prototype.fromString = bnpFromString;
|
692 |
-
BigInteger.prototype.clamp = bnpClamp;
|
693 |
-
BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
|
694 |
-
BigInteger.prototype.drShiftTo = bnpDRShiftTo;
|
695 |
-
BigInteger.prototype.lShiftTo = bnpLShiftTo;
|
696 |
-
BigInteger.prototype.rShiftTo = bnpRShiftTo;
|
697 |
-
BigInteger.prototype.subTo = bnpSubTo;
|
698 |
-
BigInteger.prototype.multiplyTo = bnpMultiplyTo;
|
699 |
-
BigInteger.prototype.squareTo = bnpSquareTo;
|
700 |
-
BigInteger.prototype.divRemTo = bnpDivRemTo;
|
701 |
-
BigInteger.prototype.invDigit = bnpInvDigit;
|
702 |
-
BigInteger.prototype.isEven = bnpIsEven;
|
703 |
-
BigInteger.prototype.exp = bnpExp;
|
704 |
-
|
705 |
-
// public
|
706 |
-
BigInteger.prototype.toString = bnToString;
|
707 |
-
BigInteger.prototype.negate = bnNegate;
|
708 |
-
BigInteger.prototype.abs = bnAbs;
|
709 |
-
BigInteger.prototype.compareTo = bnCompareTo;
|
710 |
-
BigInteger.prototype.bitLength = bnBitLength;
|
711 |
-
BigInteger.prototype.mod = bnMod;
|
712 |
-
BigInteger.prototype.modPowInt = bnModPowInt;
|
713 |
-
|
714 |
-
// "constants"
|
715 |
-
BigInteger.ZERO = nbv(0);
|
716 |
-
BigInteger.ONE = nbv(1);
|
717 |
-
|
718 |
-
|
719 |
-
// prng4.js - uses Arcfour as a PRNG
|
720 |
-
|
721 |
-
function Arcfour() {
|
722 |
-
this.i = 0;
|
723 |
-
this.j = 0;
|
724 |
-
this.S = new Array();
|
725 |
-
}
|
726 |
-
|
727 |
-
// Initialize arcfour context from key, an array of ints, each from [0..255]
|
728 |
-
function ARC4init(key) {
|
729 |
-
var i, j, t;
|
730 |
-
for (i = 0; i < 256; ++i)
|
731 |
-
this.S[i] = i;
|
732 |
-
j = 0;
|
733 |
-
for (i = 0; i < 256; ++i) {
|
734 |
-
j = (j + this.S[i] + key[i % key.length]) & 255;
|
735 |
-
t = this.S[i];
|
736 |
-
this.S[i] = this.S[j];
|
737 |
-
this.S[j] = t;
|
738 |
-
}
|
739 |
-
this.i = 0;
|
740 |
-
this.j = 0;
|
741 |
-
}
|
742 |
-
|
743 |
-
function ARC4next() {
|
744 |
-
var t;
|
745 |
-
this.i = (this.i + 1) & 255;
|
746 |
-
this.j = (this.j + this.S[this.i]) & 255;
|
747 |
-
t = this.S[this.i];
|
748 |
-
this.S[this.i] = this.S[this.j];
|
749 |
-
this.S[this.j] = t;
|
750 |
-
return this.S[(t + this.S[this.i]) & 255];
|
751 |
-
}
|
752 |
-
|
753 |
-
Arcfour.prototype.init = ARC4init;
|
754 |
-
Arcfour.prototype.next = ARC4next;
|
755 |
-
|
756 |
-
// Plug in your RNG constructor here
|
757 |
-
function prng_newstate() {
|
758 |
-
return new Arcfour();
|
759 |
-
}
|
760 |
-
|
761 |
-
|
762 |
-
var rng_psize = 256;
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
var rng_state;
|
767 |
-
var rng_pool;
|
768 |
-
var rng_pptr;
|
769 |
-
|
770 |
-
// Mix in a 32-bit integer into the pool
|
771 |
-
function rng_seed_int(x) {
|
772 |
-
rng_pool[rng_pptr++] ^= x & 255;
|
773 |
-
rng_pool[rng_pptr++] ^= (x >> 8) & 255;
|
774 |
-
rng_pool[rng_pptr++] ^= (x >> 16) & 255;
|
775 |
-
rng_pool[rng_pptr++] ^= (x >> 24) & 255;
|
776 |
-
if (rng_pptr >= rng_psize) rng_pptr -= rng_psize;
|
777 |
-
}
|
778 |
-
|
779 |
-
// Mix in the current time (w/milliseconds) into the pool
|
780 |
-
function rng_seed_time() {
|
781 |
-
rng_seed_int(new Date().getTime());
|
782 |
-
}
|
783 |
-
|
784 |
-
// Initialize the pool with junk if needed.
|
785 |
-
if (rng_pool == null) {
|
786 |
-
rng_pool = new Array();
|
787 |
-
rng_pptr = 0;
|
788 |
-
var t;
|
789 |
-
if (window.crypto && window.crypto.getRandomValues) {
|
790 |
-
// Use webcrypto if available
|
791 |
-
var ua = new Uint8Array(32);
|
792 |
-
window.crypto.getRandomValues(ua);
|
793 |
-
for (t = 0; t < 32; ++t)
|
794 |
-
rng_pool[rng_pptr++] = ua[t];
|
795 |
-
}
|
796 |
-
if (navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto) {
|
797 |
-
// Extract entropy (256 bits) from NS4 RNG if available
|
798 |
-
var z = window.crypto.random(32);
|
799 |
-
for (t = 0; t < z.length; ++t)
|
800 |
-
rng_pool[rng_pptr++] = z.charCodeAt(t) & 255;
|
801 |
-
}
|
802 |
-
while (rng_pptr < rng_psize) { // extract some randomness from Math.random()
|
803 |
-
t = Math.floor(65536 * Math.random());
|
804 |
-
rng_pool[rng_pptr++] = t >>> 8;
|
805 |
-
rng_pool[rng_pptr++] = t & 255;
|
806 |
-
}
|
807 |
-
rng_pptr = 0;
|
808 |
-
rng_seed_time();
|
809 |
-
//rng_seed_int(window.screenX);
|
810 |
-
//rng_seed_int(window.screenY);
|
811 |
-
}
|
812 |
-
|
813 |
-
function rng_get_byte() {
|
814 |
-
if (rng_state == null) {
|
815 |
-
rng_seed_time();
|
816 |
-
rng_state = prng_newstate();
|
817 |
-
rng_state.init(rng_pool);
|
818 |
-
for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
|
819 |
-
rng_pool[rng_pptr] = 0;
|
820 |
-
rng_pptr = 0;
|
821 |
-
//rng_pool = null;
|
822 |
-
}
|
823 |
-
|
824 |
-
return rng_state.next();
|
825 |
-
}
|
826 |
-
|
827 |
-
function rng_get_bytes(ba) {
|
828 |
-
var i;
|
829 |
-
for (i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
|
830 |
-
}
|
831 |
-
|
832 |
-
function SecureRandom() { }
|
833 |
-
|
834 |
-
SecureRandom.prototype.nextBytes = rng_get_bytes;
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
function parseBigInt(str, r) {
|
840 |
-
return new BigInteger(str, r);
|
841 |
-
}
|
842 |
-
|
843 |
-
function linebrk(s, n) {
|
844 |
-
var ret = "";
|
845 |
-
var i = 0;
|
846 |
-
while (i + n < s.length) {
|
847 |
-
ret += s.substring(i, i + n) + "\n";
|
848 |
-
i += n;
|
849 |
-
}
|
850 |
-
return ret + s.substring(i, s.length);
|
851 |
-
}
|
852 |
-
|
853 |
-
function byte2Hex(b) {
|
854 |
-
if (b < 0x10)
|
855 |
-
return "0" + b.toString(16);
|
856 |
-
else
|
857 |
-
return b.toString(16);
|
858 |
-
}
|
859 |
-
|
860 |
-
// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint
|
861 |
-
function pkcs1pad2(s, n) {
|
862 |
-
if (n < s.length + 11) { // TODO: fix for utf-8
|
863 |
-
alert("Message too long for RSA");
|
864 |
-
return null;
|
865 |
-
}
|
866 |
-
var ba = new Array();
|
867 |
-
var i = s.length - 1;
|
868 |
-
while (i >= 0 && n > 0) {
|
869 |
-
var c = s.charCodeAt(i--);
|
870 |
-
if (c < 128) { // encode using utf-8
|
871 |
-
ba[--n] = c;
|
872 |
-
}
|
873 |
-
else if ((c > 127) && (c < 2048)) {
|
874 |
-
ba[--n] = (c & 63) | 128;
|
875 |
-
ba[--n] = (c >> 6) | 192;
|
876 |
-
}
|
877 |
-
else {
|
878 |
-
ba[--n] = (c & 63) | 128;
|
879 |
-
ba[--n] = ((c >> 6) & 63) | 128;
|
880 |
-
ba[--n] = (c >> 12) | 224;
|
881 |
-
}
|
882 |
-
}
|
883 |
-
ba[--n] = 0;
|
884 |
-
var rng = new SecureRandom();
|
885 |
-
var x = new Array();
|
886 |
-
while (n > 2) { // random non-zero pad
|
887 |
-
x[0] = 0;
|
888 |
-
while (x[0] == 0) rng.nextBytes(x);
|
889 |
-
ba[--n] = x[0];
|
890 |
-
}
|
891 |
-
ba[--n] = 2;
|
892 |
-
ba[--n] = 0;
|
893 |
-
return new BigInteger(ba);
|
894 |
-
}
|
895 |
-
|
896 |
-
// "empty" RSA key constructor
|
897 |
-
function RSAKey() {
|
898 |
-
this.n = null;
|
899 |
-
this.e = 0;
|
900 |
-
this.d = null;
|
901 |
-
this.p = null;
|
902 |
-
this.q = null;
|
903 |
-
this.dmp1 = null;
|
904 |
-
this.dmq1 = null;
|
905 |
-
this.coeff = null;
|
906 |
-
}
|
907 |
-
|
908 |
-
// Set the public key fields N and e from hex strings
|
909 |
-
function RSASetPublic(N, E) {
|
910 |
-
if (N != null && E != null && N.length > 0 && E.length > 0) {
|
911 |
-
this.n = parseBigInt(N, 16);
|
912 |
-
this.e = parseInt(E, 16);
|
913 |
-
}
|
914 |
-
else
|
915 |
-
alert("Invalid RSA public key");
|
916 |
-
}
|
917 |
-
|
918 |
-
// Perform raw public operation on "x": return x^e (mod n)
|
919 |
-
function RSADoPublic(x) {
|
920 |
-
return x.modPowInt(this.e, this.n);
|
921 |
-
}
|
922 |
-
|
923 |
-
// Return the PKCS#1 RSA encryption of "text" as an even-length hex string
|
924 |
-
function RSAEncrypt(text) {
|
925 |
-
var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3);
|
926 |
-
if (m == null) return null;
|
927 |
-
var c = this.doPublic(m);
|
928 |
-
if (c == null) return null;
|
929 |
-
var h = c.toString(16);
|
930 |
-
if ((h.length & 1) == 0) return hex2b64(h); else return hex2b64("0" + h);
|
931 |
-
}
|
932 |
-
|
933 |
-
// Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string
|
934 |
-
//function RSAEncryptB64(text) {
|
935 |
-
// var h = this.encrypt(text);
|
936 |
-
// if (h) return hex2b64(h); else return null;
|
937 |
-
//}
|
938 |
-
|
939 |
-
// protected
|
940 |
-
RSAKey.prototype.doPublic = RSADoPublic;
|
941 |
-
|
942 |
-
// public
|
943 |
-
RSAKey.prototype.setPublic = RSASetPublic;
|
944 |
-
RSAKey.prototype.encrypt = RSAEncrypt;
|
945 |
-
|
946 |
-
// base64.js
|
947 |
-
|
948 |
-
var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
949 |
-
var b64padchar = "=";
|
950 |
-
|
951 |
-
function hex2b64(h) {
|
952 |
-
var i;
|
953 |
-
var c;
|
954 |
-
var ret = "";
|
955 |
-
for (i = 0; i + 3 <= h.length; i += 3) {
|
956 |
-
c = parseInt(h.substring(i, i + 3), 16);
|
957 |
-
ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);
|
958 |
-
}
|
959 |
-
if (i + 1 == h.length) {
|
960 |
-
c = parseInt(h.substring(i, i + 1), 16);
|
961 |
-
ret += b64map.charAt(c << 2);
|
962 |
-
}
|
963 |
-
else if (i + 2 == h.length) {
|
964 |
-
c = parseInt(h.substring(i, i + 2), 16);
|
965 |
-
ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);
|
966 |
-
}
|
967 |
-
while ((ret.length & 3) > 0) ret += b64padchar;
|
968 |
-
return ret;
|
969 |
-
}
|
970 |
-
|
971 |
-
// convert a base64 string to hex
|
972 |
-
function b64tohex(s) {
|
973 |
-
var ret = ""
|
974 |
-
var i;
|
975 |
-
var k = 0; // b64 state, 0-3
|
976 |
-
var slop;
|
977 |
-
for (i = 0; i < s.length; ++i) {
|
978 |
-
if (s.charAt(i) == b64padchar) break;
|
979 |
-
v = b64map.indexOf(s.charAt(i));
|
980 |
-
if (v < 0) continue;
|
981 |
-
if (k == 0) {
|
982 |
-
ret += int2char(v >> 2);
|
983 |
-
slop = v & 3;
|
984 |
-
k = 1;
|
985 |
-
}
|
986 |
-
else if (k == 1) {
|
987 |
-
ret += int2char((slop << 2) | (v >> 4));
|
988 |
-
slop = v & 0xf;
|
989 |
-
k = 2;
|
990 |
-
}
|
991 |
-
else if (k == 2) {
|
992 |
-
ret += int2char(slop);
|
993 |
-
ret += int2char(v >> 2);
|
994 |
-
slop = v & 3;
|
995 |
-
k = 3;
|
996 |
-
}
|
997 |
-
else {
|
998 |
-
ret += int2char((slop << 2) | (v >> 4));
|
999 |
-
ret += int2char(v & 0xf);
|
1000 |
-
k = 0;
|
1001 |
-
}
|
1002 |
-
}
|
1003 |
-
if (k == 1)
|
1004 |
-
ret += int2char(slop << 2);
|
1005 |
-
return ret;
|
1006 |
-
}
|
1007 |
-
|
1008 |
-
// convert a base64 string to a byte/number array
|
1009 |
-
function b64toBA(s) {
|
1010 |
-
//piggyback on b64tohex for now, optimize later
|
1011 |
-
var h = b64tohex(s);
|
1012 |
-
var i;
|
1013 |
-
var a = new Array();
|
1014 |
-
for (i = 0; 2 * i < h.length; ++i) {
|
1015 |
-
a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);
|
1016 |
-
}
|
1017 |
-
return a;
|
1018 |
-
}
|
1019 |
-
|
1020 |
-
eCrypt.init = eCryptInit;
|
1021 |
-
})(eCrypt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,145 +0,0 @@
|
|
1 |
-
<_>
|
2 |
-
<form_key>zlEmYI88Nf5v0PME</form_key>
|
3 |
-
<name>eWAY_Payment_Rapid31</name>
|
4 |
-
<channel>community</channel>
|
5 |
-
<version_ids>
|
6 |
-
<version_ids>2</version_ids>
|
7 |
-
</version_ids>
|
8 |
-
<summary>The eWAY payment module - accept credit card payments, save cards, process refunds with eWAY's Rapid 3.1 Payment Gateway.</summary>
|
9 |
-
<description>The eWAY Rapid 3.1 payments module - made by eWAY for eWAY merchants:
|
10 |
-
|
11 |
-
- It's free!
|
12 |
-
- Fast and easy to set up and integrate
|
13 |
-
- Smash chargebacks with global fraud protection
|
14 |
-
- More options for your customers - more payment methods
|
15 |
-
- Improve basket conversion with faster checkout features
|
16 |
-
- Full Magento back-office integration, including manual orders and refunds
|
17 |
-
- Supports eWAY's Sandbox for testing
|
18 |
-
- Your customers can save their card details using eWAY's secure servers for faster checkout
|
19 |
-
- Get help when and where you need it with 24/7 support
|
20 |
-
|
21 |
-
Discover more at http://www.eway.com.au - payments made smarter!</description>
|
22 |
-
<license>OSL v3.0</license>
|
23 |
-
<license_uri/>
|
24 |
-
<version>1.3.1</version>
|
25 |
-
<stability>stable</stability>
|
26 |
-
<notes>Minor fixes:
|
27 |
-
|
28 |
-
- Fix for stores with custom DB table prefixes
|
29 |
-
- Improved recurring initial fee handling
|
30 |
-
- Fix for manual payments not submitting for some stores
|
31 |
-
- Fix for update token with Direct sometimes failing</notes>
|
32 |
-
<authors>
|
33 |
-
<name>
|
34 |
-
<name>eWAY Payments</name>
|
35 |
-
</name>
|
36 |
-
<user>
|
37 |
-
<user>eWAYPayments</user>
|
38 |
-
</user>
|
39 |
-
<email>
|
40 |
-
<email>partner@eway.com.au</email>
|
41 |
-
</email>
|
42 |
-
</authors>
|
43 |
-
<depends_php_min>5.2.0</depends_php_min>
|
44 |
-
<depends_php_max>6.0.0</depends_php_max>
|
45 |
-
<depends>
|
46 |
-
<package>
|
47 |
-
<name>
|
48 |
-
<name/>
|
49 |
-
</name>
|
50 |
-
<channel>
|
51 |
-
<channel/>
|
52 |
-
</channel>
|
53 |
-
<min>
|
54 |
-
<min/>
|
55 |
-
</min>
|
56 |
-
<max>
|
57 |
-
<max/>
|
58 |
-
</max>
|
59 |
-
<files>
|
60 |
-
<files> </files>
|
61 |
-
</files>
|
62 |
-
</package>
|
63 |
-
<extension>
|
64 |
-
<name>
|
65 |
-
<name>Core</name>
|
66 |
-
<name>curl</name>
|
67 |
-
</name>
|
68 |
-
<min>
|
69 |
-
<min/>
|
70 |
-
<min/>
|
71 |
-
</min>
|
72 |
-
<max>
|
73 |
-
<max/>
|
74 |
-
<max/>
|
75 |
-
</max>
|
76 |
-
</extension>
|
77 |
-
</depends>
|
78 |
-
<contents>
|
79 |
-
<target>
|
80 |
-
<target>magelocal</target>
|
81 |
-
<target>magecommunity</target>
|
82 |
-
<target>magedesign</target>
|
83 |
-
<target>magedesign</target>
|
84 |
-
<target>mageetc</target>
|
85 |
-
<target>magelocale</target>
|
86 |
-
<target>mageskin</target>
|
87 |
-
<target>mageskin</target>
|
88 |
-
<target>mageweb</target>
|
89 |
-
<target>magedesign</target>
|
90 |
-
<target>magedesign</target>
|
91 |
-
</target>
|
92 |
-
<path>
|
93 |
-
<path/>
|
94 |
-
<path>Eway</path>
|
95 |
-
<path>adminhtml/default/default/layout/ewayrapid/</path>
|
96 |
-
<path>frontend/base/default/layout/ewayrapid</path>
|
97 |
-
<path>modules/Eway_Rapid31.xml</path>
|
98 |
-
<path>en_US/Eway_Rapid31.csv</path>
|
99 |
-
<path>adminhtml/default/default/ewayrapid.css</path>
|
100 |
-
<path>frontend/base/default/css/ewayrapid.css</path>
|
101 |
-
<path>js/ewayrapid</path>
|
102 |
-
<path>adminhtml/default/default/template/ewayrapid</path>
|
103 |
-
<path>frontend/base/default/template/ewayrapid</path>
|
104 |
-
</path>
|
105 |
-
<type>
|
106 |
-
<type>file</type>
|
107 |
-
<type>dir</type>
|
108 |
-
<type>dir</type>
|
109 |
-
<type>dir</type>
|
110 |
-
<type>file</type>
|
111 |
-
<type>file</type>
|
112 |
-
<type>file</type>
|
113 |
-
<type>file</type>
|
114 |
-
<type>dir</type>
|
115 |
-
<type>dir</type>
|
116 |
-
<type>dir</type>
|
117 |
-
</type>
|
118 |
-
<include>
|
119 |
-
<include/>
|
120 |
-
<include/>
|
121 |
-
<include/>
|
122 |
-
<include/>
|
123 |
-
<include/>
|
124 |
-
<include/>
|
125 |
-
<include/>
|
126 |
-
<include/>
|
127 |
-
<include/>
|
128 |
-
<include/>
|
129 |
-
<include/>
|
130 |
-
</include>
|
131 |
-
<ignore>
|
132 |
-
<ignore/>
|
133 |
-
<ignore/>
|
134 |
-
<ignore/>
|
135 |
-
<ignore/>
|
136 |
-
<ignore/>
|
137 |
-
<ignore/>
|
138 |
-
<ignore/>
|
139 |
-
<ignore/>
|
140 |
-
<ignore/>
|
141 |
-
<ignore/>
|
142 |
-
<ignore/>
|
143 |
-
</ignore>
|
144 |
-
</contents>
|
145 |
-
</_>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,764 +1,1327 @@
|
|
1 |
-
var EwayPayment = Class.create();
|
2 |
-
EwayPayment.isEwayRapidMethod = function(method) {
|
3 |
-
return ("ewayrapid_saved" === method || "ewayrapid_notsaved" === method);
|
4 |
-
};
|
5 |
-
EwayPayment.supportCardTypes = ['AE', 'VI', 'MC', 'JCB', 'DC', 'VE', 'ME'];
|
6 |
-
EwayPayment.prototype = {
|
7 |
-
paymentUrl : null,
|
8 |
-
ewayPayment: this,
|
9 |
-
initialize: function(form, encryptionKey) {
|
10 |
-
if (form) {
|
11 |
-
// Init client-side encryption
|
12 |
-
if (typeof eCrypt == 'function') {
|
13 |
-
form.writeAttribute('data-eway-encrypt-key', encryptionKey);
|
14 |
-
eCrypt && eCrypt.init();
|
15 |
-
}
|
16 |
-
}
|
17 |
-
},
|
18 |
-
|
19 |
-
savePaymentWithEncryption: function() {
|
20 |
-
if (checkout.loadWaiting!=false) return;
|
21 |
-
var validator = new Validation(this.form);
|
22 |
-
if (this.validate() && validator.validate()) {
|
23 |
-
checkout.setLoadWaiting('payment');
|
24 |
-
var form = $(this.form);
|
25 |
-
if($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
_transparent_method = $$("input[name='payment[
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
if (
|
85 |
-
|
86 |
-
|
87 |
-
params
|
88 |
-
|
89 |
-
this.
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
}
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
var
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
var
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
}
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
}
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
}
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
if(
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
}
|
555 |
-
}
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
}
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
}
|
598 |
-
|
599 |
-
if(
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
}
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
}
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
}
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var EwayPayment = Class.create();
|
2 |
+
EwayPayment.isEwayRapidMethod = function(method) {
|
3 |
+
return ("ewayrapid_saved" === method || "ewayrapid_notsaved" === method || "ewayrapid_ewayone" === method);
|
4 |
+
};
|
5 |
+
EwayPayment.supportCardTypes = ['AE', 'VI', 'MC', 'JCB', 'DC', 'VE', 'ME'];
|
6 |
+
EwayPayment.prototype = {
|
7 |
+
paymentUrl : null,
|
8 |
+
ewayPayment: this,
|
9 |
+
initialize: function(form, encryptionKey) {
|
10 |
+
if (form) {
|
11 |
+
// Init client-side encryption
|
12 |
+
if (typeof eCrypt == 'function') {
|
13 |
+
form.writeAttribute('data-eway-encrypt-key', encryptionKey);
|
14 |
+
eCrypt && eCrypt.init();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
},
|
18 |
+
|
19 |
+
savePaymentWithEncryption: function() {
|
20 |
+
if (checkout.loadWaiting!=false) return;
|
21 |
+
var validator = new Validation(this.form);
|
22 |
+
if (this.validate() && validator.validate()) {
|
23 |
+
checkout.setLoadWaiting('payment');
|
24 |
+
var form = $(this.form);
|
25 |
+
if($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
26 |
+
var ewayForm = new EwayForm();
|
27 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
28 |
+
var form = ewayForm.encryptForm(formToEncrypt, false);
|
29 |
+
}
|
30 |
+
this.ewayForm = form;
|
31 |
+
var request = new Ajax.Request(
|
32 |
+
this.saveUrl,
|
33 |
+
{
|
34 |
+
method:'post',
|
35 |
+
onComplete: this.onComplete,
|
36 |
+
onSuccess: this.onSave,
|
37 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
38 |
+
parameters: $(form).serialize()
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}
|
42 |
+
},
|
43 |
+
|
44 |
+
savePaymentWithTransEncryption: function() {
|
45 |
+
if (checkout.loadWaiting != false) return;
|
46 |
+
var validator = new Validation(this.form);
|
47 |
+
if (this.validate() && validator.validate()) {
|
48 |
+
checkout.setLoadWaiting('payment');
|
49 |
+
var form = $(this.form);
|
50 |
+
if(EwayPayment.isEwayRapidMethod(payment.currentMethod)) {
|
51 |
+
var _method = $$("input[name='payment[method]']:checked")[0].getValue();
|
52 |
+
var _transparent_method = '';
|
53 |
+
|
54 |
+
if (_method == 'ewayrapid_notsaved' && $$("input[name='payment[transparent_notsaved]']:checked").length > 0) {
|
55 |
+
_transparent_method = $$("input[name='payment[transparent_notsaved]']:checked")[0];
|
56 |
+
} else if (_method == 'ewayrapid_ewayone' && $$("input[name='payment[transparent_saved]']:checked").length > 0) {
|
57 |
+
_transparent_method = $$("input[name='payment[transparent_saved]']:checked")[0];
|
58 |
+
}
|
59 |
+
|
60 |
+
if (_transparent_method != '' && $(_transparent_method.id).getValue() == creditcard) {
|
61 |
+
if ($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
62 |
+
var ewayForm = new EwayForm();
|
63 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
64 |
+
var form = ewayForm.encryptForm(formToEncrypt, false);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
this.ewayForm = form;
|
69 |
+
}
|
70 |
+
var request = new Ajax.Request(
|
71 |
+
this.saveUrl,
|
72 |
+
{
|
73 |
+
method: 'post',
|
74 |
+
onComplete: this.onComplete,
|
75 |
+
onSuccess: this.onSave,
|
76 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
77 |
+
parameters: $(form).serialize()
|
78 |
+
}
|
79 |
+
);
|
80 |
+
}
|
81 |
+
},
|
82 |
+
|
83 |
+
saveReviewWithEncryption: function() {
|
84 |
+
if (checkout.loadWaiting!=false) return;
|
85 |
+
checkout.setLoadWaiting('review');
|
86 |
+
//var params = Form.serialize(payment.form);
|
87 |
+
var params = payment.ewayForm.serialize();
|
88 |
+
if (this.agreementsForm) {
|
89 |
+
params += '&'+Form.serialize(this.agreementsForm);
|
90 |
+
}
|
91 |
+
params.save = true;
|
92 |
+
var request = new Ajax.Request(
|
93 |
+
this.saveUrl,
|
94 |
+
{
|
95 |
+
method:'post',
|
96 |
+
parameters:params,
|
97 |
+
onComplete: this.onComplete,
|
98 |
+
onSuccess: this.onSave,
|
99 |
+
onFailure: checkout.ajaxFailure.bind(checkout)
|
100 |
+
}
|
101 |
+
);
|
102 |
+
},
|
103 |
+
|
104 |
+
saveReviewWithEncryptionTrans: function () {
|
105 |
+
if (EwayPayment.isEwayRapidMethod(payment.currentMethod) && ewayPayment.paymentUrl != null) {
|
106 |
+
$('review-please-wait') && $('review-please-wait').show();
|
107 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').hide();
|
108 |
+
|
109 |
+
var parameters = {};
|
110 |
+
if($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked){
|
111 |
+
if(!$('visa_checkout_call_id').value){
|
112 |
+
document.getElementById('visa_checkout_button').click();
|
113 |
+
return;
|
114 |
+
}else{
|
115 |
+
parameters.visa_checkout_call_id = $('visa_checkout_call_id').value;
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
var request = new Ajax.Request(
|
121 |
+
ewayPayment.paymentUrl,
|
122 |
+
{
|
123 |
+
method: 'post',
|
124 |
+
parameters: parameters,
|
125 |
+
onComplete: {},
|
126 |
+
onSuccess: function (response) {
|
127 |
+
if (response.responseText != '0') {
|
128 |
+
window.location = response.responseText;
|
129 |
+
}
|
130 |
+
return false;
|
131 |
+
},
|
132 |
+
onFailure: {}
|
133 |
+
}
|
134 |
+
);
|
135 |
+
} else {
|
136 |
+
ewayPayment.saveUrl = review.saveUrl;
|
137 |
+
ewayPayment.onComplete = review.onComplete;
|
138 |
+
ewayPayment.onSave = review.onSave;
|
139 |
+
ewayPayment.agreementsForm = review.agreementsForm;
|
140 |
+
ewayPayment.ewaysavedOldOrder();
|
141 |
+
}
|
142 |
+
},
|
143 |
+
|
144 |
+
saveOrderWithIframe: function () {
|
145 |
+
if (EwayPayment.isEwayRapidMethod(payment.currentMethod) && ewayPayment.paymentUrl != null) {
|
146 |
+
$('review-please-wait') && $('review-please-wait').show();
|
147 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').hide();
|
148 |
+
|
149 |
+
var request = new Ajax.Request(
|
150 |
+
ewayPayment.paymentUrl,
|
151 |
+
{
|
152 |
+
method: 'post',
|
153 |
+
onComplete: {},
|
154 |
+
onSuccess: function (trans) {
|
155 |
+
var res = trans.responseText.evalJSON();
|
156 |
+
if(res.success && res.url && res.returnUrl){
|
157 |
+
|
158 |
+
var eWAYConfig = {
|
159 |
+
sharedPaymentUrl: res.url
|
160 |
+
};
|
161 |
+
|
162 |
+
ewayReturnUrl = res.returnUrl;
|
163 |
+
|
164 |
+
eCrypt.showModalPayment(eWAYConfig, eWayRapidCallback);
|
165 |
+
|
166 |
+
}else if(res.message){
|
167 |
+
alert(res.message);
|
168 |
+
$('review-please-wait') && $('review-please-wait').hide();
|
169 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').show();
|
170 |
+
}
|
171 |
+
},
|
172 |
+
onFailure: {}
|
173 |
+
}
|
174 |
+
);
|
175 |
+
} else {
|
176 |
+
this.prototype.ewaysavedOldOrder();
|
177 |
+
}
|
178 |
+
},
|
179 |
+
|
180 |
+
subMitForm: function () {
|
181 |
+
eCrypt.submitForm();
|
182 |
+
},
|
183 |
+
|
184 |
+
submitAdminOrder: function() {
|
185 |
+
if(editForm.validator && editForm.validator.validate()) {
|
186 |
+
if($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
187 |
+
var ewayForm = new EwayForm();
|
188 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
189 |
+
var submitForm = ewayForm.encryptForm(formToEncrypt, true);
|
190 |
+
}
|
191 |
+
if (this.orderItemChanged) {
|
192 |
+
if (confirm('You have item changes')) {
|
193 |
+
if (submitForm.submit()) {
|
194 |
+
disableElements('save');
|
195 |
+
}
|
196 |
+
} else {
|
197 |
+
this.itemsUpdate();
|
198 |
+
}
|
199 |
+
} else {
|
200 |
+
if (submitForm.submit()) {
|
201 |
+
disableElements('save');
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
},
|
206 |
+
|
207 |
+
submitAdminOrderIFrame: function () {
|
208 |
+
if(editForm.validator && editForm.validator.validate()) {
|
209 |
+
if($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
210 |
+
var ewayForm = new EwayForm();
|
211 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
212 |
+
var submitForm = ewayForm.encryptForm(formToEncrypt, true);
|
213 |
+
}
|
214 |
+
var request = new Ajax.Request(
|
215 |
+
ewayPayment.paymentUrl,
|
216 |
+
{
|
217 |
+
method: 'post',
|
218 |
+
onComplete: {},
|
219 |
+
parameters: Form.serialize(submitForm, true),
|
220 |
+
onSuccess: function (trans) {
|
221 |
+
var res = trans.responseText.evalJSON();
|
222 |
+
if(res.success && res.url){
|
223 |
+
|
224 |
+
var eWAYConfig = {
|
225 |
+
sharedPaymentUrl: res.url
|
226 |
+
};
|
227 |
+
ewayReturnUrl = res.returnUrl;
|
228 |
+
|
229 |
+
eCrypt.showModalPayment(eWAYConfig, eWayRapidCallback);
|
230 |
+
|
231 |
+
}else if(res.message){
|
232 |
+
alert(res.message);
|
233 |
+
$('review-please-wait') && $('review-please-wait').hide();
|
234 |
+
$('review-buttons-container') && $('review-buttons-container').down('button').show();
|
235 |
+
}
|
236 |
+
},
|
237 |
+
onFailure: {}
|
238 |
+
}
|
239 |
+
);
|
240 |
+
}
|
241 |
+
},
|
242 |
+
|
243 |
+
MultiShipping: {
|
244 |
+
submit: function() {
|
245 |
+
var validator = new Validation('multishipping-billing-form');
|
246 |
+
if (validator.validate()) {
|
247 |
+
var form = $(this.form);
|
248 |
+
if($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
249 |
+
var ewayForm = new EwayForm();
|
250 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
251 |
+
var form = ewayForm.encryptForm(formToEncrypt, false);
|
252 |
+
}
|
253 |
+
form.submit();
|
254 |
+
}
|
255 |
+
return false;
|
256 |
+
}
|
257 |
+
},
|
258 |
+
|
259 |
+
OneStepCheckout: {
|
260 |
+
switchMethod: function(method) {
|
261 |
+
$$('.payment-method .form-list').each(function(form) {
|
262 |
+
//form.style.display = 'none';
|
263 |
+
var elements = form.select('input').concat(form.select('select')).concat(form.select('textarea'));
|
264 |
+
for (var i=0; i<elements.length; i++) elements[i].disabled = true;
|
265 |
+
});
|
266 |
+
|
267 |
+
if ($('payment_form_'+method)){
|
268 |
+
var form = $('payment_form_'+method);
|
269 |
+
form.style.display = '';
|
270 |
+
var elements = form.select('input').concat(form.select('select')).concat(form.select('textarea'));
|
271 |
+
for (var i=0; i<elements.length; i++) elements[i].disabled = false;
|
272 |
+
this.currentMethod = method;
|
273 |
+
if ($('ul_payment_form_'+method)) {
|
274 |
+
$('ul_payment_form_'+method).show();
|
275 |
+
}
|
276 |
+
}
|
277 |
+
},
|
278 |
+
|
279 |
+
saveOrderWithIframe: function (formData) {
|
280 |
+
var request = new Ajax.Request(
|
281 |
+
ewayPayment.paymentUrl,
|
282 |
+
{
|
283 |
+
method: 'post',
|
284 |
+
onComplete: {},
|
285 |
+
parameters: formData,
|
286 |
+
onSuccess: function (trans) {
|
287 |
+
var res = trans.responseText.evalJSON();
|
288 |
+
if(res.success && res.url && res.returnUrl){
|
289 |
+
|
290 |
+
var eWAYConfig = {
|
291 |
+
sharedPaymentUrl: res.url
|
292 |
+
};
|
293 |
+
|
294 |
+
ewayReturnUrl = res.returnUrl;
|
295 |
+
|
296 |
+
eCrypt.showModalPayment(eWAYConfig, eWayRapidCallback);
|
297 |
+
|
298 |
+
}else if(res.message){
|
299 |
+
alert(res.message);
|
300 |
+
}
|
301 |
+
},
|
302 |
+
onFailure: {}
|
303 |
+
}
|
304 |
+
);
|
305 |
+
}
|
306 |
+
},
|
307 |
+
|
308 |
+
FireCheckout: {
|
309 |
+
save: function(urlSuffix, forceSave) {
|
310 |
+
var currentMethod = payment.currentMethod ? payment.currentMethod : '';
|
311 |
+
if(EwayPayment.isEwayRapidMethod(currentMethod)) {
|
312 |
+
if (this.loadWaiting != false) {
|
313 |
+
return;
|
314 |
+
}
|
315 |
+
|
316 |
+
if (!this.validate()) {
|
317 |
+
return;
|
318 |
+
}
|
319 |
+
|
320 |
+
// infostrates tnt
|
321 |
+
if (!forceSave && (typeof shippingMethod === 'object')
|
322 |
+
&& shippingMethod.getCurrentMethod().indexOf("tnt_") === 0) {
|
323 |
+
|
324 |
+
shippingMethodTnt(shippingMethodTntUrl);
|
325 |
+
return;
|
326 |
+
}
|
327 |
+
// infostrates tnt
|
328 |
+
|
329 |
+
checkout.setLoadWaiting(true);
|
330 |
+
|
331 |
+
var params = Form.serialize(this.form, true);
|
332 |
+
$('review-please-wait').show();
|
333 |
+
|
334 |
+
var ewayForm = new EwayForm();
|
335 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
336 |
+
var encryptedForm = ewayForm.encryptForm(formToEncrypt, false);
|
337 |
+
|
338 |
+
params = Form.serialize(encryptedForm, true);
|
339 |
+
|
340 |
+
urlSuffix = urlSuffix || '';
|
341 |
+
var request = new Ajax.Request(this.urls.save + urlSuffix, {
|
342 |
+
method:'post',
|
343 |
+
parameters:params,
|
344 |
+
onSuccess: this.setResponse.bind(this),
|
345 |
+
onFailure: this.ajaxFailure.bind(this)
|
346 |
+
});
|
347 |
+
} else if(typeof this.ewayOldSave == 'function') {
|
348 |
+
this.ewayOldSave(urlSuffix, forceSave);
|
349 |
+
}
|
350 |
+
},
|
351 |
+
savePayment: function(urlSuffix, forceSave) {
|
352 |
+
var currentMethod = payment.currentMethod ? payment.currentMethod : '';
|
353 |
+
if(EwayPayment.isEwayRapidMethod(currentMethod)) {
|
354 |
+
if (this.loadWaiting != false) {
|
355 |
+
return;
|
356 |
+
}
|
357 |
+
|
358 |
+
if (!this.validate()) {
|
359 |
+
return;
|
360 |
+
}
|
361 |
+
|
362 |
+
// infostrates tnt
|
363 |
+
if (!forceSave && (typeof shippingMethod === 'object')
|
364 |
+
&& shippingMethod.getCurrentMethod().indexOf("tnt_") === 0) {
|
365 |
+
|
366 |
+
shippingMethodTnt(shippingMethodTntUrl);
|
367 |
+
return;
|
368 |
+
}
|
369 |
+
// infostrates tnt
|
370 |
+
|
371 |
+
checkout.setLoadWaiting(true);
|
372 |
+
|
373 |
+
var params = Form.serialize(this.form, true);
|
374 |
+
$('review-please-wait').show();
|
375 |
+
|
376 |
+
var _method = $$("input[name='payment[method]']:checked")[0].getValue();
|
377 |
+
var _transparent_method = '';
|
378 |
+
if (_method == 'ewayrapid_notsaved' && $$("input[name='payment[transparent_notsaved]']:checked").length > 0) {
|
379 |
+
_transparent_method = $$("input[name='payment[transparent_notsaved]']:checked")[0];
|
380 |
+
} else if (_method == 'ewayrapid_ewayone' && $$("input[name='payment[transparent_saved]']:checked").length > 0) {
|
381 |
+
_transparent_method = $$("input[name='payment[transparent_saved]']:checked")[0];
|
382 |
+
}
|
383 |
+
|
384 |
+
if($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked){
|
385 |
+
if(!$('visa_checkout_call_id').value){
|
386 |
+
document.getElementById('visa_checkout_button').click();
|
387 |
+
return;
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
//if (_transparent_method != '' && $(_transparent_method.id).getValue() == creditcard) {
|
392 |
+
if ($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
393 |
+
|
394 |
+
var ewayForm = new EwayForm();
|
395 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
396 |
+
var encryptedForm = ewayForm.encryptForm(formToEncrypt, false);
|
397 |
+
params = Form.serialize(encryptedForm, true);
|
398 |
+
}
|
399 |
+
//}
|
400 |
+
|
401 |
+
urlSuffix = urlSuffix || '';
|
402 |
+
var request = new Ajax.Request(this.urls.save + urlSuffix, {
|
403 |
+
method:'post',
|
404 |
+
parameters:params,
|
405 |
+
onSuccess: this.setResponse.bind(this),
|
406 |
+
onFailure: this.ajaxFailure.bind(this)
|
407 |
+
});
|
408 |
+
} else if(typeof this.ewayOldSave == 'function') {
|
409 |
+
this.ewayOldSave(urlSuffix, forceSave);
|
410 |
+
}
|
411 |
+
},
|
412 |
+
|
413 |
+
setResponse: function(response){
|
414 |
+
try {
|
415 |
+
response = response.responseText.evalJSON();
|
416 |
+
} catch (err) {
|
417 |
+
alert('An error has occured during request processing. Try again please');
|
418 |
+
checkout.setLoadWaiting(false);
|
419 |
+
$('review-please-wait').hide();
|
420 |
+
return false;
|
421 |
+
}
|
422 |
+
|
423 |
+
if (response.redirect) {
|
424 |
+
|
425 |
+
var request = new Ajax.Request(
|
426 |
+
response.redirect,
|
427 |
+
{
|
428 |
+
method: 'post',
|
429 |
+
onComplete: {},
|
430 |
+
onSuccess: function (trans) {
|
431 |
+
checkout.setLoadWaiting(false);
|
432 |
+
var res = trans.responseText.evalJSON();
|
433 |
+
if(res.success && res.url && res.returnUrl){
|
434 |
+
|
435 |
+
var eWAYConfig = {
|
436 |
+
sharedPaymentUrl: res.url
|
437 |
+
};
|
438 |
+
|
439 |
+
ewayReturnUrl = res.returnUrl;
|
440 |
+
|
441 |
+
eCrypt.showModalPayment(eWAYConfig, eWayRapidCallback);
|
442 |
+
|
443 |
+
}else if(res.message){
|
444 |
+
alert(res.message);
|
445 |
+
$('review-please-wait').hide();
|
446 |
+
}
|
447 |
+
},
|
448 |
+
onFailure: {}
|
449 |
+
}
|
450 |
+
);
|
451 |
+
|
452 |
+
return;
|
453 |
+
}
|
454 |
+
|
455 |
+
if (response.order_created) {
|
456 |
+
window.location = this.urls.success;
|
457 |
+
return;
|
458 |
+
} else {
|
459 |
+
if (response.captcha) {
|
460 |
+
this.updateCaptcha(response.captcha);
|
461 |
+
}
|
462 |
+
if (response.error_messages) {
|
463 |
+
var msg = response.error_messages;
|
464 |
+
if (typeof(msg) == 'object') {
|
465 |
+
msg = msg.join("\n");
|
466 |
+
}
|
467 |
+
alert(msg);
|
468 |
+
} else if (response.message) {
|
469 |
+
var msg = response.message;
|
470 |
+
if (typeof(msg) == 'object') {
|
471 |
+
msg = msg.join("\n");
|
472 |
+
}
|
473 |
+
alert(msg);
|
474 |
+
}
|
475 |
+
}
|
476 |
+
|
477 |
+
checkout.setLoadWaiting(false);
|
478 |
+
$('review-please-wait').hide();
|
479 |
+
|
480 |
+
if (response.update_section) {
|
481 |
+
for (var i in response.update_section) {
|
482 |
+
var el = $('checkout-' + i + '-load');
|
483 |
+
if (el) {
|
484 |
+
var data = {};
|
485 |
+
el.select('input, select').each(function(input) {
|
486 |
+
if ('radio' == input.type || 'checkbox' == input.type) {
|
487 |
+
data[input.id] = input.checked;
|
488 |
+
} else {
|
489 |
+
data[input.id] = input.getValue();
|
490 |
+
}
|
491 |
+
});
|
492 |
+
|
493 |
+
el.update(response.update_section[i])
|
494 |
+
.setOpacity(1)
|
495 |
+
.removeClassName('loading');
|
496 |
+
|
497 |
+
if (i == 'coupon-discount' || i == 'giftcard') {
|
498 |
+
continue;
|
499 |
+
}
|
500 |
+
|
501 |
+
for (var j in data) {
|
502 |
+
if (!j) {
|
503 |
+
continue;
|
504 |
+
}
|
505 |
+
var input = el.down('#' + j);
|
506 |
+
if (input) {
|
507 |
+
if ('radio' == input.type || 'checkbox' == input.type) {
|
508 |
+
input.checked = data[j];
|
509 |
+
} else {
|
510 |
+
input.setValue(data[j]);
|
511 |
+
}
|
512 |
+
}
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
if (i === 'shipping-method') {
|
517 |
+
shippingMethod.addObservers();
|
518 |
+
} else if (i === 'review') {
|
519 |
+
this.addCartObservers();
|
520 |
+
}
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
if (response.method) {
|
525 |
+
if ('centinel' == response.method) {
|
526 |
+
this.showCentinel();
|
527 |
+
} else if (0 === response.method.indexOf('billsafe')) {
|
528 |
+
lpg.open();
|
529 |
+
var form = $('firecheckout-form');
|
530 |
+
form.action = BILLSAFE_FORM_ACTION;
|
531 |
+
form.submit();
|
532 |
+
}
|
533 |
+
|
534 |
+
else if ('sagepayserver' === response.method
|
535 |
+
|| 'sagepayform' === response.method
|
536 |
+
|| 'sagepaydirectpro' === response.method
|
537 |
+
|| 'sagepaypaypal' === response.method) {
|
538 |
+
|
539 |
+
var SageServer = new EbizmartsSagePaySuite.Checkout({
|
540 |
+
//'checkout' : checkout
|
541 |
+
});
|
542 |
+
SageServer.code = response.method;
|
543 |
+
SageServer.reviewSave();
|
544 |
+
// SageServer.setPaymentMethod();
|
545 |
+
// SageServer.reviewSave({'tokenSuccess':true});
|
546 |
+
}
|
547 |
+
}
|
548 |
+
|
549 |
+
if (response.popup) {
|
550 |
+
this.showPopup(response.popup);
|
551 |
+
} else if (response.body) {
|
552 |
+
$(document.body).insert({
|
553 |
+
'bottom': response.body.content
|
554 |
+
});
|
555 |
+
}
|
556 |
+
|
557 |
+
// ogone fix
|
558 |
+
if (payment.toggleOpsCcInputs) {
|
559 |
+
payment.toggleOpsCcInputs();
|
560 |
+
}
|
561 |
+
// ogone fix
|
562 |
+
|
563 |
+
return false;
|
564 |
+
}
|
565 |
+
},
|
566 |
+
|
567 |
+
IWDOnePageCheckout: {
|
568 |
+
savePayment: function() {
|
569 |
+
if(EwayPayment.isEwayRapidMethod(payment.currentMethod)) {
|
570 |
+
if (IWD.OPC.Checkout.xhr!=null){
|
571 |
+
IWD.OPC.Checkout.xhr.abort();
|
572 |
+
}
|
573 |
+
IWD.OPC.Checkout.showLoader();
|
574 |
+
|
575 |
+
var ewayForm = new EwayForm();
|
576 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
577 |
+
var form = ewayForm.encryptForm(formToEncrypt, false);
|
578 |
+
form = $j(form).serializeArray();
|
579 |
+
IWD.OPC.Checkout.xhr = $j.post(IWD.OPC.Checkout.config.baseUrl + 'onepage/json/savePayment',form, IWD.OPC.preparePaymentResponse,'json');
|
580 |
+
} else if(typeof IWD.OPC.ewayOldSavePayment == 'function') {
|
581 |
+
IWD.OPC.ewayOldSavePayment();
|
582 |
+
}
|
583 |
+
},
|
584 |
+
savePaymentTrans: function() {
|
585 |
+
if(EwayPayment.isEwayRapidMethod(payment.currentMethod)) {
|
586 |
+
/*var ewayForm = $(this.form);
|
587 |
+
if (IWD.OPC.Checkout.xhr!=null){
|
588 |
+
IWD.OPC.Checkout.xhr.abort();
|
589 |
+
}
|
590 |
+
IWD.OPC.Checkout.showLoader();
|
591 |
+
var _method = $$("input[name='payment[method]']:checked")[0].getValue();
|
592 |
+
var _transparent_method = '';
|
593 |
+
if (_method == 'ewayrapid_notsaved' && $$("input[name='payment[transparent_notsaved]']:checked").length > 0) {
|
594 |
+
_transparent_method = $$("input[name='payment[transparent_notsaved]']:checked")[0];
|
595 |
+
} else if (_method == 'ewayrapid_saved' && $$("input[name='payment[transparent_saved]']:checked").length > 0) {
|
596 |
+
_transparent_method = $$("input[name='payment[transparent_saved]']:checked")[0];
|
597 |
+
}
|
598 |
+
|
599 |
+
if (_transparent_method != '' && $(_transparent_method.id).getValue() == creditcard) {
|
600 |
+
if ($$("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
601 |
+
ewayForm = eCrypt.doEncrypt();
|
602 |
+
}
|
603 |
+
}*/
|
604 |
+
|
605 |
+
if ($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked) {
|
606 |
+
if (!$('visa_checkout_call_id').value) {
|
607 |
+
document.getElementById('visa_checkout_button').click();
|
608 |
+
return;
|
609 |
+
}
|
610 |
+
}
|
611 |
+
|
612 |
+
var ewayForm = new EwayForm();
|
613 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
614 |
+
var form = ewayForm.encryptForm(formToEncrypt, false);
|
615 |
+
form = $j(form).serializeArray();
|
616 |
+
IWD.OPC.Checkout.xhr = $j.post(IWD.OPC.Checkout.config.baseUrl + 'onepage/json/savePayment',form, IWD.OPC.preparePaymentResponse,'json');
|
617 |
+
} else if(typeof IWD.OPC.ewayOldSavePayment == 'function') {
|
618 |
+
IWD.OPC.ewayOldSavePayment();
|
619 |
+
}
|
620 |
+
},
|
621 |
+
|
622 |
+
preparePaymentResponse: function(response){
|
623 |
+
if(EwayPayment.isEwayRapidMethod(payment.currentMethod)) {
|
624 |
+
IWD.OPC.Checkout.xhr = null;
|
625 |
+
|
626 |
+
IWD.OPC.agreements = $j('#checkout-agreements').serializeArray();
|
627 |
+
|
628 |
+
IWD.OPC.getSubscribe();
|
629 |
+
|
630 |
+
if (typeof(response.review)!= "undefined"){
|
631 |
+
IWD.OPC.Decorator.updateGrandTotal(response);
|
632 |
+
$j('#opc-review-block').html(response.review);
|
633 |
+
IWD.OPC.Checkout.removePrice();
|
634 |
+
|
635 |
+
// need to recheck subscribe and agreenet checkboxes
|
636 |
+
IWD.OPC.recheckItems();
|
637 |
+
}
|
638 |
+
|
639 |
+
if (typeof(response.error) != "undefined"){
|
640 |
+
|
641 |
+
IWD.OPC.Plugin.dispatch('error');
|
642 |
+
|
643 |
+
$j('.opc-message-container').html(response.error);
|
644 |
+
$j('.opc-message-wrapper').show();
|
645 |
+
IWD.OPC.Checkout.hideLoader();
|
646 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
647 |
+
IWD.OPC.saveOrderStatus = false;
|
648 |
+
|
649 |
+
return;
|
650 |
+
}
|
651 |
+
|
652 |
+
//SOME PAYMENT METHOD REDIRECT CUSTOMER TO PAYMENT GATEWAY
|
653 |
+
if (typeof(response.redirect) != "undefined" && IWD.OPC.saveOrderStatus===true){
|
654 |
+
IWD.OPC.Checkout.xhr = null;
|
655 |
+
IWD.OPC.Plugin.dispatch('redirectPayment', response.redirect);
|
656 |
+
if (IWD.OPC.Checkout.xhr==null){
|
657 |
+
var request = new Ajax.Request(
|
658 |
+
response.redirect,
|
659 |
+
{
|
660 |
+
method: 'post',
|
661 |
+
onComplete: {},
|
662 |
+
onSuccess: function (trans) {
|
663 |
+
var res = trans.responseText.evalJSON();
|
664 |
+
if(res.success && res.url && res.returnUrl){
|
665 |
+
|
666 |
+
var eWAYConfig = {
|
667 |
+
sharedPaymentUrl: res.url
|
668 |
+
};
|
669 |
+
|
670 |
+
ewayReturnUrl = res.returnUrl;
|
671 |
+
|
672 |
+
IWD.OPC.Checkout.hideLoader();
|
673 |
+
eCrypt.showModalPayment(eWAYConfig, eWayRapidCallback);
|
674 |
+
|
675 |
+
}else if(res.message){
|
676 |
+
alert(res.message);
|
677 |
+
IWD.OPC.Checkout.hideLoader();
|
678 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
679 |
+
}
|
680 |
+
},
|
681 |
+
onFailure: {}
|
682 |
+
}
|
683 |
+
);
|
684 |
+
}
|
685 |
+
else
|
686 |
+
{
|
687 |
+
IWD.OPC.Checkout.hideLoader();
|
688 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
689 |
+
}
|
690 |
+
|
691 |
+
return;
|
692 |
+
}
|
693 |
+
|
694 |
+
if (IWD.OPC.saveOrderStatus===true){
|
695 |
+
IWD.OPC.saveOrder();
|
696 |
+
}
|
697 |
+
else
|
698 |
+
{
|
699 |
+
IWD.OPC.Checkout.hideLoader();
|
700 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
701 |
+
}
|
702 |
+
|
703 |
+
IWD.OPC.Plugin.dispatch('savePaymentAfter');
|
704 |
+
}else if(typeof IWD.OPC.ewayOldPreparePaymentResponse == 'function') {
|
705 |
+
IWD.OPC.ewayOldPreparePaymentResponse();
|
706 |
+
}
|
707 |
+
|
708 |
+
},
|
709 |
+
|
710 |
+
saveOrder: function() {
|
711 |
+
if(EwayPayment.isEwayRapidMethod(payment.currentMethod)) {
|
712 |
+
|
713 |
+
var ewayForm = new EwayForm();
|
714 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
715 |
+
var form = ewayForm.encryptForm(formToEncrypt, false);
|
716 |
+
form = $j(form).serializeArray();
|
717 |
+
|
718 |
+
form = IWD.OPC.checkAgreement(form);
|
719 |
+
IWD.OPC.Checkout.showLoader();
|
720 |
+
if (IWD.OPC.Checkout.config.comment!=="0"){
|
721 |
+
IWD.OPC.saveCustomerComment();
|
722 |
+
}
|
723 |
+
|
724 |
+
IWD.OPC.Plugin.dispatch('saveOrder');
|
725 |
+
IWD.OPC.Checkout.xhr = $j.post(IWD.OPC.Checkout.saveOrderUrl ,form, IWD.OPC.prepareOrderResponse,'json');
|
726 |
+
} else if(typeof IWD.OPC.ewayOldSaveOrder == 'function') {
|
727 |
+
IWD.OPC.ewayOldSaveOrder();
|
728 |
+
}
|
729 |
+
}
|
730 |
+
},
|
731 |
+
Lightcheckout : {
|
732 |
+
LightcheckoutSubmit: function() {
|
733 |
+
if (payment.currentMethod && (payment.currentMethod.indexOf('sagepay') == 0) &&
|
734 |
+
(SageServer != undefined) && (review != undefined)) {
|
735 |
+
if (checkoutForm.validator.validate()) {
|
736 |
+
review.preparedata();
|
737 |
+
}
|
738 |
+
}
|
739 |
+
else {
|
740 |
+
if (checkoutForm.validator.validate()) {
|
741 |
+
if ($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked) {
|
742 |
+
if (!$('visa_checkout_call_id').value) {
|
743 |
+
document.getElementById('visa_checkout_button').click();
|
744 |
+
return;
|
745 |
+
}
|
746 |
+
}
|
747 |
+
this.submit(this.getFormData(), 'save_payment_methods');
|
748 |
+
}
|
749 |
+
}
|
750 |
+
},
|
751 |
+
submit: function (params, action) {
|
752 |
+
|
753 |
+
this.showLoadinfo();
|
754 |
+
|
755 |
+
params.action = action;
|
756 |
+
|
757 |
+
var request = new Ajax.Request(this.url,
|
758 |
+
{
|
759 |
+
method: 'post',
|
760 |
+
parameters: params,
|
761 |
+
onSuccess: function (transport) {
|
762 |
+
|
763 |
+
eval('var response = ' + transport.responseText);
|
764 |
+
|
765 |
+
if (response.messages_block) {
|
766 |
+
var gcheckout_onepage_wrap = $$('div.gcheckout-onepage-wrap')[0];
|
767 |
+
if (gcheckout_onepage_wrap) {
|
768 |
+
new Insertion.Before(gcheckout_onepage_wrap, response.messages_block);
|
769 |
+
}
|
770 |
+
this.disable_place_order = true;
|
771 |
+
} else {
|
772 |
+
this.disable_place_order = false;
|
773 |
+
}
|
774 |
+
|
775 |
+
if (response.url) {
|
776 |
+
|
777 |
+
this.existsreview = false;
|
778 |
+
setLocation(response.url);
|
779 |
+
|
780 |
+
} else {
|
781 |
+
|
782 |
+
if (response.error) {
|
783 |
+
if (response.message) {
|
784 |
+
alert(response.message);
|
785 |
+
}
|
786 |
+
this.existsreview = false;
|
787 |
+
this.hideLoadinfo();
|
788 |
+
} else {
|
789 |
+
|
790 |
+
var process_save_order = false;
|
791 |
+
|
792 |
+
if (response.methods) {
|
793 |
+
// Quote isVirtual
|
794 |
+
this.innerHTMLwithScripts($('gcheckout-onepage-methods'), response.methods);
|
795 |
+
var wrap = $$('div.gcheckout-onepage-wrap')[0];
|
796 |
+
if (wrap && !wrap.hasClassName('not_shipping_mode')) {
|
797 |
+
wrap.addClassName('not_shipping_mode');
|
798 |
+
}
|
799 |
+
if ($('billing_use_for_shipping_yes') && $('billing_use_for_shipping_yes').up('li.control')) {
|
800 |
+
$('billing_use_for_shipping_yes').up('li.control').remove();
|
801 |
+
}
|
802 |
+
if ($('gcheckout-shipping-address')) {
|
803 |
+
$('gcheckout-shipping-address').remove();
|
804 |
+
}
|
805 |
+
payment.init();
|
806 |
+
this.observeMethods();
|
807 |
+
}
|
808 |
+
|
809 |
+
if (response.shippings) {
|
810 |
+
if (shipping_rates_block = $('gcheckout-shipping-method-available')) {
|
811 |
+
this.innerHTMLwithScripts(shipping_rates_block, response.shippings);
|
812 |
+
this.observeShippingMethods();
|
813 |
+
}
|
814 |
+
}
|
815 |
+
|
816 |
+
if (response.payments) {
|
817 |
+
this.innerHTMLwithScripts($('gcheckout-payment-methods-available'), response.payments);
|
818 |
+
payment.init();
|
819 |
+
this.observePaymentMethods();
|
820 |
+
}
|
821 |
+
|
822 |
+
if (response.gift_message) {
|
823 |
+
if (giftmessage_block = $('gomage-lightcheckout-giftmessage')) {
|
824 |
+
this.innerHTMLwithScripts(giftmessage_block, response.gift_message);
|
825 |
+
}
|
826 |
+
}
|
827 |
+
|
828 |
+
if (response.toplinks) {
|
829 |
+
this.replaceTopLinks(response.toplinks);
|
830 |
+
}
|
831 |
+
|
832 |
+
if (response.minicart) {
|
833 |
+
this.replaceMiniCart(response);
|
834 |
+
}
|
835 |
+
|
836 |
+
if (response.cart_sidebar && typeof(GomageProcartConfig) != 'undefined') {
|
837 |
+
GomageProcartConfig._replaceEnterpriseTopCart(response.cart_sidebar, ($('topCartContent') && $('topCartContent').visible()));
|
838 |
+
}
|
839 |
+
|
840 |
+
if (response.review) {
|
841 |
+
this.innerHTMLwithScripts($$('#gcheckout-onepage-review div.totals')[0], response.review);
|
842 |
+
}
|
843 |
+
|
844 |
+
if (response.content_billing) {
|
845 |
+
var div_billing = document.createElement('div');
|
846 |
+
div_billing.innerHTML = response.content_billing;
|
847 |
+
$('gcheckout-onepage-address').replaceChild(div_billing.firstChild, $('gcheckout-billing-address'));
|
848 |
+
}
|
849 |
+
|
850 |
+
if (response.content_shipping && $('gcheckout-shipping-address')) {
|
851 |
+
var div_shipping = document.createElement('div');
|
852 |
+
div_shipping.innerHTML = response.content_shipping;
|
853 |
+
$('gcheckout-onepage-address').replaceChild(div_shipping.firstChild, $('gcheckout-shipping-address'));
|
854 |
+
}
|
855 |
+
|
856 |
+
if (response.content_billing || response.content_shipping) {
|
857 |
+
this.observeAddresses();
|
858 |
+
initAddresses();
|
859 |
+
}
|
860 |
+
|
861 |
+
if (response.section == 'varify_taxvat') {
|
862 |
+
|
863 |
+
if ($('billing_taxvat_verified')) {
|
864 |
+
$('billing_taxvat_verified').remove();
|
865 |
+
}
|
866 |
+
|
867 |
+
if ($('shipping_taxvat_verified')) {
|
868 |
+
$('shipping_taxvat_verified').remove();
|
869 |
+
}
|
870 |
+
|
871 |
+
this.taxvat_verify_result = response.verify_result;
|
872 |
+
|
873 |
+
if ($('billing_taxvat') && $('billing_taxvat').value) {
|
874 |
+
if (response.verify_result.billing) {
|
875 |
+
if (label = $('billing_taxvat').parentNode.parentNode.getElementsByTagName('label')[0]) {
|
876 |
+
label.innerHTML += '<strong id="billing_taxvat_verified" style="margin-left:5px;">(<span style="color:green;">Verified</span>)</strong>';
|
877 |
+
$('billing_taxvat').removeClassName('validation-failed');
|
878 |
+
}
|
879 |
+
} else if ($('billing_taxvat').value) {
|
880 |
+
if (label = $('billing_taxvat').parentNode.parentNode.getElementsByTagName('label')[0]) {
|
881 |
+
label.innerHTML += '<strong id="billing_taxvat_verified" style="margin-left:5px;">(<span style="color:red;">Not Verified</span>)</strong>';
|
882 |
+
}
|
883 |
+
}
|
884 |
+
}
|
885 |
+
|
886 |
+
if ($('shipping_taxvat') && $('shipping_taxvat').value) {
|
887 |
+
if (response.verify_result.shipping) {
|
888 |
+
if (label = $('shipping_taxvat').parentNode.parentNode.getElementsByTagName('label')[0]) {
|
889 |
+
label.innerHTML += '<strong id="shipping_taxvat_verified" style="margin-left:5px;">(<span style="color:green;">Verified</span>)</strong>';
|
890 |
+
$('shipping_taxvat').removeClassName('validation-failed');
|
891 |
+
}
|
892 |
+
} else if ($('shipping_taxvat').value) {
|
893 |
+
if (label = $('shipping_taxvat').parentNode.parentNode.getElementsByTagName('label')[0]) {
|
894 |
+
label.innerHTML += '<strong id="shipping_taxvat_verified" style="margin-left:5px;">(<span style="color:red;">Not Verified</span>)</strong>';
|
895 |
+
}
|
896 |
+
}
|
897 |
+
}
|
898 |
+
|
899 |
+
}
|
900 |
+
|
901 |
+
if (response.section == 'centinel') {
|
902 |
+
|
903 |
+
if (response.centinel) {
|
904 |
+
this.showCentinel(response.centinel);
|
905 |
+
} else {
|
906 |
+
process_save_order = true;
|
907 |
+
if ((payment.currentMethod == 'authorizenet_directpost') && ((typeof directPostModel != 'undefined'))) {
|
908 |
+
directPostModel.saveOnepageOrder();
|
909 |
+
} else {
|
910 |
+
this.saveorder();
|
911 |
+
}
|
912 |
+
}
|
913 |
+
}
|
914 |
+
|
915 |
+
this.setBlocksNumber();
|
916 |
+
|
917 |
+
if (this.existsreview) {
|
918 |
+
this.existsreview = false;
|
919 |
+
review.save();
|
920 |
+
}
|
921 |
+
else {
|
922 |
+
if (!process_save_order) {
|
923 |
+
this.hideLoadinfo();
|
924 |
+
}
|
925 |
+
}
|
926 |
+
|
927 |
+
}
|
928 |
+
|
929 |
+
}
|
930 |
+
|
931 |
+
}.bind(this),
|
932 |
+
onFailure: function () {
|
933 |
+
this.existsreview = false;
|
934 |
+
}
|
935 |
+
});
|
936 |
+
},
|
937 |
+
getFormData: function () {
|
938 |
+
//var form_data = $('gcheckout-onepage-form').serialize(true);
|
939 |
+
var ewayForm = new EwayForm();
|
940 |
+
var formToEncrypt = ewayForm.findFormToEncrypt();
|
941 |
+
var form = ewayForm.encryptForm(formToEncrypt, false);
|
942 |
+
|
943 |
+
var form_data = form.serialize(true);
|
944 |
+
for (var key in form_data) {
|
945 |
+
if ((key == 'billing[customer_password]') || (key == 'billing[confirm_password]')) {
|
946 |
+
form_data[key] = GlcUrl.encode(form_data[key]);
|
947 |
+
}
|
948 |
+
if (payment.currentMethod == 'authorizenet_directpost') {
|
949 |
+
if (key.indexOf('payment[') == 0 && key != 'payment[method]' && key != 'payment[use_customer_balance]') {
|
950 |
+
delete form_data[key];
|
951 |
+
}
|
952 |
+
}
|
953 |
+
}
|
954 |
+
|
955 |
+
return form_data;
|
956 |
+
},
|
957 |
+
saveorder: function () {
|
958 |
+
|
959 |
+
if(EwayPayment.isEwayRapidMethod(payment.currentMethod)){
|
960 |
+
this.showLoadinfo();
|
961 |
+
|
962 |
+
var params = this.getFormData();
|
963 |
+
|
964 |
+
var request = new Ajax.Request(this.save_order_url,
|
965 |
+
{
|
966 |
+
method: 'post',
|
967 |
+
parameters: params,
|
968 |
+
onSuccess: function (transport) {
|
969 |
+
eval('var response = ' + transport.responseText);
|
970 |
+
|
971 |
+
if (response.redirect) {
|
972 |
+
|
973 |
+
var request = new Ajax.Request(
|
974 |
+
response.redirect,
|
975 |
+
{
|
976 |
+
method: 'post',
|
977 |
+
onComplete: {},
|
978 |
+
onSuccess: function (trans) {
|
979 |
+
var res = trans.responseText.evalJSON();
|
980 |
+
if(res.success && res.url && res.returnUrl){
|
981 |
+
|
982 |
+
var eWAYConfig = {
|
983 |
+
sharedPaymentUrl: res.url
|
984 |
+
};
|
985 |
+
|
986 |
+
ewayReturnUrl = res.returnUrl;
|
987 |
+
|
988 |
+
eCrypt.showModalPayment(eWAYConfig, eWayRapidCallback);
|
989 |
+
|
990 |
+
}else if(res.message){
|
991 |
+
alert(res.message);
|
992 |
+
checkout.hideLoadinfo();
|
993 |
+
}
|
994 |
+
},
|
995 |
+
onFailure: {}
|
996 |
+
}
|
997 |
+
);
|
998 |
+
|
999 |
+
} else if (response.error) {
|
1000 |
+
if (response.message) {
|
1001 |
+
alert(response.message);
|
1002 |
+
}
|
1003 |
+
} else if (response.update_section) {
|
1004 |
+
this.accordion.currentSection = 'opc-review';
|
1005 |
+
this.innerHTMLwithScripts($('checkout-update-section'), response.update_section.html);
|
1006 |
+
|
1007 |
+
}
|
1008 |
+
this.hideLoadinfo();
|
1009 |
+
|
1010 |
+
}.bind(this),
|
1011 |
+
onFailure: function () {
|
1012 |
+
|
1013 |
+
}
|
1014 |
+
}
|
1015 |
+
);
|
1016 |
+
}else if(typeof checkout.saveOrderOld == 'function') {
|
1017 |
+
checkout.saveOrderOld();
|
1018 |
+
}
|
1019 |
+
}
|
1020 |
+
},
|
1021 |
+
MageWorld: {
|
1022 |
+
submit: function (e, notshipmethod, redirect) {
|
1023 |
+
$MW_Onestepcheckout('#co-payment-form').show();
|
1024 |
+
var form = new VarienForm('onestep_form');
|
1025 |
+
var logic=true;
|
1026 |
+
|
1027 |
+
// check for shipping type
|
1028 |
+
if(!$MW_Onestepcheckout('input[name=payment\\[method\\]]:checked').val() || !notshipmethod){
|
1029 |
+
logic=false;
|
1030 |
+
}
|
1031 |
+
if(!$MW_Onestepcheckout('input[name=payment\\[method\\]]:checked').val()){
|
1032 |
+
if(!$MW_Onestepcheckout('#advice-required-entry_payment').length) {
|
1033 |
+
$MW_Onestepcheckout('#checkout-payment-method-load').append('<dt><div class="validation-advice" id="advice-required-entry_payment" style="">'+message_payment+'</div></dt>');
|
1034 |
+
//if($MW_Onestepcheckout('#advice-required-entry_payment').attr('display')!="none"){
|
1035 |
+
//$MW_Onestepcheckout('#advice-required-entry_payment').css('display','block');
|
1036 |
+
}
|
1037 |
+
}
|
1038 |
+
else
|
1039 |
+
$MW_Onestepcheckout('#advice-required-entry_payment').remove();
|
1040 |
+
//$MW_Onestepcheckout('#advice-required-entry_payment').css('display','none');
|
1041 |
+
|
1042 |
+
if(!notshipmethod){
|
1043 |
+
if(!$MW_Onestepcheckout('#advice-required-entry_shipping').length){
|
1044 |
+
$MW_Onestepcheckout('#checkout-shipping-method-loadding').append('<dt><div class="validation-advice" id="advice-required-entry_shipping" style="">'+message_ship+'</div></dt>');
|
1045 |
+
//if($MW_Onestepcheckout('#advice-required-entry_shipping').attr('display')!="none"){
|
1046 |
+
//$MW_Onestepcheckout('#advice-required-entry_shipping').css('display','block');
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
}
|
1050 |
+
else
|
1051 |
+
$MW_Onestepcheckout('#advice-required-entry_shipping').remove();
|
1052 |
+
//$MW_Onestepcheckout('#advice-required-entry_shipping').css('display','none');
|
1053 |
+
|
1054 |
+
if(!form.validator.validate()) {
|
1055 |
+
if(logined()!=1){
|
1056 |
+
val=$MW_Onestepcheckout('#billing\\:email').val();
|
1057 |
+
emailvalidated=Validation.get('IsEmpty').test(val) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(val);
|
1058 |
+
if(val!="" && emailvalidated){
|
1059 |
+
updateEmailmsg(val);
|
1060 |
+
}
|
1061 |
+
}
|
1062 |
+
//val_emailbill_before=val;
|
1063 |
+
Event.stop(e);
|
1064 |
+
}
|
1065 |
+
else{
|
1066 |
+
if(logined()!=1){
|
1067 |
+
//$MW_Onestepcheckout('#billing\\:email').blur(function(event){
|
1068 |
+
//val=this.value;
|
1069 |
+
var msgerror=1;
|
1070 |
+
val=$MW_Onestepcheckout('#billing\\:email').val();
|
1071 |
+
emailvalidated=Validation.get('IsEmpty').test(val) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(val);
|
1072 |
+
if(val!="" && emailvalidated){
|
1073 |
+
msgerror=updateEmailmsg(val);
|
1074 |
+
}
|
1075 |
+
//val_emailbill_before=val;
|
1076 |
+
if(msgerror==0){
|
1077 |
+
return false;
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
if(logic){
|
1082 |
+
if($MW_Onestepcheckout("input[id*='ewayrapid_'][name='payment[method]']:checked").length > 0) {
|
1083 |
+
if ($('p_method_ewayrapid_transparent_visa') && $('p_method_ewayrapid_transparent_visa').checked) {
|
1084 |
+
if (!$('visa_checkout_call_id').value) {
|
1085 |
+
document.getElementById('visa_checkout_button').click();
|
1086 |
+
return;
|
1087 |
+
}
|
1088 |
+
}
|
1089 |
+
eCrypt.submitForm();
|
1090 |
+
} else {
|
1091 |
+
$MW_Onestepcheckout('#onestep_form').submit();
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
$MW_Onestepcheckout('#loading-mask').css('display','block');
|
1095 |
+
$MW_Onestepcheckout('.btn-checkout').attr("disabled","disabled");
|
1096 |
+
}
|
1097 |
+
else {
|
1098 |
+
return false;
|
1099 |
+
}
|
1100 |
+
}
|
1101 |
+
return false;
|
1102 |
+
}
|
1103 |
+
}
|
1104 |
+
};
|
1105 |
+
|
1106 |
+
var EwayPaymentToken = Class.create();
|
1107 |
+
EwayPaymentToken.prototype = {
|
1108 |
+
savedTokens: null,
|
1109 |
+
tokenCount: 0,
|
1110 |
+
isAdmin: false,
|
1111 |
+
labelEdit: 'Edit',
|
1112 |
+
labelCancel: 'Cancel edit',
|
1113 |
+
isEdit: true,
|
1114 |
+
initialize: function(savedTokens, tokenCount, isAdmin, labelEdit, labelCancel) {
|
1115 |
+
savedTokens['new']['Card'] = '';
|
1116 |
+
this.savedTokens = savedTokens;
|
1117 |
+
this.tokenCount = tokenCount;
|
1118 |
+
this.isAdmin = isAdmin;
|
1119 |
+
this.labelEdit = labelEdit;
|
1120 |
+
this.labelCancel = labelCancel;
|
1121 |
+
|
1122 |
+
$('ewayrapid_ewayone_token') && $('ewayrapid_ewayone_token').observe('change', this.onSavedTokenChanged.bind(this));
|
1123 |
+
|
1124 |
+
$('ewayrapid_ewayone_edit') && $('ewayrapid_ewayone_edit').observe('click', this.onEditClick.bind(this));
|
1125 |
+
|
1126 |
+
if(this.tokenCount == 1) {
|
1127 |
+
// Show credit card form in case customer does not have saved credit card (only 'Add new card' option)
|
1128 |
+
this.ewayrapidToggleCcForm(true);
|
1129 |
+
} else {
|
1130 |
+
this.onSavedTokenChanged();
|
1131 |
+
}
|
1132 |
+
},
|
1133 |
+
|
1134 |
+
onSavedTokenChanged: function() {
|
1135 |
+
if($('ewayrapid_ewayone_token') && !$('ewayrapid_ewayone_token').disabled && $('ewayrapid_ewayone_token').value == 'new') {
|
1136 |
+
this.ewayrapidToggleCcForm(true);
|
1137 |
+
this.ewayrapidSelectToken('new');
|
1138 |
+
$('ewayrapid_ewayone_cc_type') && $('ewayrapid_ewayone_cc_type').setValue('');
|
1139 |
+
$('ewayrapid_ewayone_edit') && $('ewayrapid_ewayone_edit').hide();
|
1140 |
+
$$('.help-disabled-cc a').each(function(element){
|
1141 |
+
element.hide();
|
1142 |
+
});
|
1143 |
+
} else {
|
1144 |
+
this.ewayrapidToggleCcForm(false);
|
1145 |
+
$('ewayrapid_ewayone_cc_type') && $('ewayrapid_ewayone_cc_type').setValue(this.savedTokens[$('ewayrapid_ewayone_token').getValue()]['Type']);
|
1146 |
+
if($('ewayrapid_ewayone_edit')) {
|
1147 |
+
this.isEdit = true;
|
1148 |
+
$('ewayrapid_ewayone_edit').update(this.labelEdit);
|
1149 |
+
$('ewayrapid_ewayone_edit').show();
|
1150 |
+
}
|
1151 |
+
}
|
1152 |
+
$('ewayrapid_ewayone_cc_cid') && $('ewayrapid_ewayone_cc_cid').setValue('');
|
1153 |
+
},
|
1154 |
+
|
1155 |
+
onEditClick: function() {
|
1156 |
+
if(this.isEdit) {
|
1157 |
+
this.ewayrapidToggleCcForm(true);
|
1158 |
+
this.ewayrapidSelectToken($('ewayrapid_ewayone_token').getValue());
|
1159 |
+
$('ewayrapid_ewayone_edit').update(this.labelCancel);
|
1160 |
+
$('ewayrapid_ewayone_cc_number').disable();
|
1161 |
+
$('ewayrapid_ewayone_cc_number').removeClassName('validate-cc-number').removeClassName('validate-cc-type-auto');
|
1162 |
+
$$('.help-disabled-cc a').each(function(element){
|
1163 |
+
element.show();
|
1164 |
+
});
|
1165 |
+
|
1166 |
+
this.isEdit = false;
|
1167 |
+
} else {
|
1168 |
+
this.ewayrapidToggleCcForm(false);
|
1169 |
+
$('ewayrapid_ewayone_edit').update(this.labelEdit);
|
1170 |
+
this.isEdit = true;
|
1171 |
+
}
|
1172 |
+
var validator = new Validation('co-payment-form');
|
1173 |
+
validator.validate();
|
1174 |
+
$('advice-validate-cc-type-auto-ewayrapid_ewayone_cc_number') && $('advice-validate-cc-type-auto-ewayrapid_ewayone_cc_number').hide();
|
1175 |
+
},
|
1176 |
+
|
1177 |
+
ewayrapidToggleCcForm: function(isShow) {
|
1178 |
+
$$('.saved_token_fields input,.saved_token_fields select').each(function(ele) {
|
1179 |
+
isShow ? ele.enable() : ele.disable();
|
1180 |
+
});
|
1181 |
+
$$('.saved_token_fields').each(function(ele) {
|
1182 |
+
isShow ? ele.show() : ele.hide();
|
1183 |
+
});
|
1184 |
+
|
1185 |
+
isShow && $('ewayrapid_ewayone_cc_number') ? $('ewayrapid_ewayone_cc_number').addClassName('validate-cc-number').addClassName('validate-cc-type-auto') : ($('ewayrapid_ewayone_cc_number') ? $('ewayrapid_ewayone_cc_number').removeClassName('validate-cc-number').removeClassName('validate-cc-type-auto') : '' );
|
1186 |
+
},
|
1187 |
+
|
1188 |
+
ewayrapidSelectToken: function(tokenId) {
|
1189 |
+
$('ewayrapid_ewayone_cc_owner') && $('ewayrapid_ewayone_cc_owner').setValue(this.savedTokens[tokenId]['Owner']);
|
1190 |
+
$('ewayrapid_ewayone_cc_number') && $('ewayrapid_ewayone_cc_number').setValue(this.savedTokens[tokenId]['Card']);
|
1191 |
+
$('ewayrapid_ewayone_expiration') && $('ewayrapid_ewayone_expiration').setValue(this.savedTokens[tokenId]['ExpMonth']);
|
1192 |
+
$('ewayrapid_ewayone_expiration_yr') && $('ewayrapid_ewayone_expiration_yr').setValue(this.savedTokens[tokenId]['ExpYear']);
|
1193 |
+
$('ewayrapid_ewayone_cc_owner') && $('ewayrapid_ewayone_cc_owner').focus();
|
1194 |
+
}
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
Validation.creditCartTypes = $H({
|
1198 |
+
'DC': [new RegExp('^3(?:0[0-5]|[68][0-9])[0-9]{11}$'), new RegExp('^[0-9]{3}$'), true],
|
1199 |
+
'VE': [new RegExp('^(4026|4405|4508|4844|4913|4917)[0-9]{12}|417500[0-9]{10}$'), new RegExp('^[0-9]{3}$'), true],
|
1200 |
+
'ME': [new RegExp('^(5018|5020|5038|5612|5893|6304|6759|6761|6762|6763|6390)[0-9]{8,15}$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
|
1201 |
+
|
1202 |
+
'SO': [new RegExp('^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
|
1203 |
+
'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true],
|
1204 |
+
'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true],
|
1205 |
+
// For 2017 - new MasterCard Range 2221-2720
|
1206 |
+
//'MC': [new RegExp('(^5[1-5][0-9]{14}$)|(^2221[0-9]{12}$)|(^222[2-9][0-9]{12}$)|(^22[3-9][0-9]{13}$)|(^2[3-6][0-9]{14}$)|(^2720[0-9]{12}$)|(^27[0-1][0-9]{13}$)'), new RegExp('^[0-9]{3}$'), true],
|
1207 |
+
'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true],
|
1208 |
+
'DI': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true],
|
1209 |
+
'JCB': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3,4}$'), true],
|
1210 |
+
// 'DICL': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true],
|
1211 |
+
'SM': [new RegExp('(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
|
1212 |
+
'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]
|
1213 |
+
});
|
1214 |
+
|
1215 |
+
Validation.add('validate-cc-type-auto', 'Invalid credit card number or credit card type is not supported.',
|
1216 |
+
function(v, elm) {
|
1217 |
+
// remove credit card number delimiters such as "-" and space
|
1218 |
+
elm.value = removeDelimiters(elm.value);
|
1219 |
+
v = removeDelimiters(v);
|
1220 |
+
var acceptedTypes = EwayPayment.supportCardTypes;
|
1221 |
+
|
1222 |
+
var ccType = '';
|
1223 |
+
Validation.creditCartTypes.each(function(cardType) {
|
1224 |
+
$cardNumberPattern = cardType.value[0];
|
1225 |
+
if($cardNumberPattern && v.match($cardNumberPattern)) {
|
1226 |
+
ccType = cardType.key;
|
1227 |
+
|
1228 |
+
// Correct JCB/DI type since they has identical pattern:
|
1229 |
+
if(ccType === 'DI' && v.indexOf('35') == 0) {
|
1230 |
+
ccType = 'JCB';
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
throw $break;
|
1234 |
+
}
|
1235 |
+
});
|
1236 |
+
|
1237 |
+
if(acceptedTypes.indexOf(ccType) == -1) {
|
1238 |
+
return false;
|
1239 |
+
}
|
1240 |
+
|
1241 |
+
var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
|
1242 |
+
if (ccTypeContainer) {
|
1243 |
+
ccTypeContainer.value = ccType;
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
return true;
|
1247 |
+
}
|
1248 |
+
);
|
1249 |
+
|
1250 |
+
Validation.add('eway-validate-phone', 'Please enter a valid phone number.', function(v, elm) {
|
1251 |
+
return Validation.get('IsEmpty').test(v) || /^[0-9\+\*\(\)]{1,32}$/.test(v);
|
1252 |
+
});
|
1253 |
+
|
1254 |
+
var EwayForm = Class.create({
|
1255 |
+
ewayPublicKeyAttribute : "data-eway-encrypt-key",
|
1256 |
+
ewayEncryptAttribute : "data-eway-encrypt-name",
|
1257 |
+
|
1258 |
+
findFormToEncrypt: function () {
|
1259 |
+
var forms = document.getElementsByTagName('form');
|
1260 |
+
for (var i = 0; i < forms.length; i++) {
|
1261 |
+
var key = forms[i].getAttribute(this.ewayPublicKeyAttribute);
|
1262 |
+
if (key) {
|
1263 |
+
return forms[i];
|
1264 |
+
}
|
1265 |
+
}
|
1266 |
+
return null;
|
1267 |
+
},
|
1268 |
+
|
1269 |
+
encryptForm: function(form, append) {
|
1270 |
+
var dataForm = this.cloneForm(form);
|
1271 |
+
dataForm.setAttribute('id', 'EWAY_FORM_' + form.getAttribute('id'));
|
1272 |
+
|
1273 |
+
for (formNode = 0, formLength = dataForm.length; formNode < formLength; formNode++) {
|
1274 |
+
var dataAttribute = dataForm[formNode].getAttribute(this.ewayEncryptAttribute);
|
1275 |
+
if (dataAttribute != null) {
|
1276 |
+
dataForm[formNode].name = dataForm[formNode].getAttribute(this.ewayEncryptAttribute);
|
1277 |
+
dataForm[formNode].value = eCrypt.encryptValue(dataForm[formNode].value);
|
1278 |
+
}
|
1279 |
+
}
|
1280 |
+
|
1281 |
+
// IE && FF will not submit clone form without insert to DOM
|
1282 |
+
if(append){
|
1283 |
+
dataForm.style.display = "none";
|
1284 |
+
form.parentNode.appendChild(dataForm);
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
return dataForm;
|
1288 |
+
},
|
1289 |
+
|
1290 |
+
cloneForm: function (oldForm) {
|
1291 |
+
var newForm = oldForm.cloneNode(true);
|
1292 |
+
this.copySelectLists(oldForm, newForm);
|
1293 |
+
this.copyTextAreas(oldForm, newForm);
|
1294 |
+
this.copyCheckboxAndRadioValues(oldForm, newForm);
|
1295 |
+
return newForm;
|
1296 |
+
},
|
1297 |
+
|
1298 |
+
copySelectLists: function (oldForm, newForm) {
|
1299 |
+
var selectElementsOld = oldForm.getElementsByTagName('Select');
|
1300 |
+
var selectElementsNew = newForm.getElementsByTagName('Select');
|
1301 |
+
|
1302 |
+
for (var i = 0; i < selectElementsOld.length; i++) {
|
1303 |
+
selectElementsNew[i].selectedIndex = selectElementsOld[i].selectedIndex;
|
1304 |
+
}
|
1305 |
+
},
|
1306 |
+
|
1307 |
+
copyTextAreas: function (oldForm, newForm) {
|
1308 |
+
var textElementsOld = oldForm.getElementsByTagName('TextArea');
|
1309 |
+
var textElementsNew = newForm.getElementsByTagName('TextArea');
|
1310 |
+
|
1311 |
+
for (var i = 0; i < textElementsOld.length; i++) {
|
1312 |
+
textElementsNew[i].value = textElementsOld[i].value;
|
1313 |
+
}
|
1314 |
+
},
|
1315 |
+
|
1316 |
+
copyCheckboxAndRadioValues: function (oldForm, newForm) {
|
1317 |
+
var inputsOld = oldForm.getElementsByTagName('input');
|
1318 |
+
var inputsNew = newForm.getElementsByTagName('input');
|
1319 |
+
|
1320 |
+
for (var i = 0; i < inputsOld.length; i++) {
|
1321 |
+
if (inputsOld[i].type === 'checkbox' || inputsOld[i].type === 'radio') {
|
1322 |
+
inputsNew[i].checked = inputsOld[i].checked; // Need this for IE
|
1323 |
+
inputsNew[i].value = inputsOld[i].value; // Need this for IE10
|
1324 |
+
}
|
1325 |
+
}
|
1326 |
+
}
|
1327 |
+
});
|
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>eWAY_Payment_Rapid31</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -20,11 +20,36 @@
|
|
20 |
- Get help when and where you need it with 24/7 support
|
21 |

|
22 |
Discover more at https://www.eway.com.au - payments made smarter!</description>
|
23 |
-
<notes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
<authors><author><name>eWAY Payments</name><user>eWAYPayments</user><email>partner@eway.com.au</email></author></authors>
|
25 |
-
<date>
|
26 |
-
<time>
|
27 |
-
<contents><target name="magecommunity"><dir name="Eway"><dir name="Rapid31"><dir name="Block"><dir name="Admin"><file name="Version.php" hash="7b5b41f31c14413c87e4e16cefab5748"/></dir><dir name="Customer"><file name="Edit.php" hash="d7b1373e21796578ff7b6be9d0bf051d"/><file name="Mycards.php" hash="34df399b9c3e8a2752cf2989b188ae80"/></dir><dir name="Form"><dir name="Direct"><file name="Notsaved.php" hash="82a649f61fb2c4cc1d02a492aed401a2"/><file name="Saved.php" hash="1ce47a1e6edb31dda3388a9d0966f80d"/></dir><dir name="Sharedpage"><file name="Notsaved.php" hash="8b8dc22e210f8d812c879cd0f0b85a03"/><file name="Saved.php" hash="af30582c5260c6edef41ac13daad6da0"/></dir><dir name="Transparent"><file name="Notsaved.php" hash="be64d2e56a205f2e2005770b92d294dd"/><file name="Saved.php" hash="4489ebedf0fd6a7c22311e6d01ca6a47"/></dir></dir><dir name="Info"><dir name="Direct"><file name="Notsaved.php" hash="76857a644cafc5b880a8a6930e9c8246"/><file name="Saved.php" hash="a9b1a08db461a9875cb67c24ec0d341d"/></dir><dir name="Sharedpage"><file name="Notsaved.php" hash="64fbfb7ad75b2eaec7cc55ca0189d4dc"/><file name="Saved.php" hash="6122e7f28b5086e5944e825dc50fd191"/></dir><dir name="Transparent"><file name="Notsaved.php" hash="743f4227532db7a4bcc706260b552e99"/><file name="Saved.php" hash="31de55ee9e7a015662b112d3c77bcd99"/></dir></dir><dir name="Redirect"><file name="PaypalReview.php" hash="bdfff05cf75ce9739a5022ce9fd553ed"/><file name="Transparent.php" hash="d0f589b3e1d19ec02fbea141ff0aaa2e"/><file name="TransparentCheckout.php" hash="458b1b10da66953fe38a82af8832f136"/></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="339b753bab57b2fefce2c770aca34920"/></dir></dir></dir><dir name="Helper"><file name="Customer.php" hash="c056f18f4dd474e94a10d066a56f6bf3"/><file name="Data.php" hash="2fdaf7c015a22caa53ee27cfd5becfc1"/></dir><dir name="Model"><dir name="Backend"><file name="Savedtokens.php" hash="55c209484a4ee56caadcde3633cb68dc"/></dir><file name="Config.php" hash="2d082fdbfa6ec184ea7b92686834726e"/><dir name="Customer"><file name="Savedtokens.php" hash="fec7133470f1c26cb284c12fd56e7991"/><file name="Token.php" hash="698166a7b2f9906a08842d15f01dc86c"/></dir><file name="EwayCron.php" hash="95b813adf22a0d1acf65a2677bcf1a59"/><dir name="Field"><file name="CardDetails.php" hash="15d10ff8dec0590335b5c576df00554b"/><file name="Customer.php" hash="a5c32b1f06070ec3fe419ff9bc1a298a"/><file name="LineItem.php" hash="0ba66e9b1ecd1acb95c91d6192f9a8df"/><file name="Payment.php" hash="5226334c0d5fe39f27466b6113e8c091"/><file name="ShippingAddress.php" hash="3e46233fa343875dd061a158b3363c32"/></dir><file name="JsonSerializable.php" hash="630af4fb2b90d9e7808615bcca2b968a"/><file name="JsonSerializableAbstract.php" hash="15f72821079c02efe2f31ce52be22193"/><dir name="Method"><file name="Notsaved.php" hash="f23183119533925cae5eb79e73a3fdfe"/><file name="Saved.php" hash="8b0772ea5731ec3c21b6e23968d59c85"/></dir><file name="Observer.php" hash="4ecba6f46d4ac2c129dce6fcf3a848e6"/><file name="RecurringProfile.php" hash="fc1f34e29edbca79ec8bab93887dbda7"/><dir name="Request"><file name="Abstract.php" hash="d0bdc1f5c76b974c44f116d9124b11b7"/><file name="Direct.php" hash="a1a5d56ddee61cf34f7ed0c3731df7ae"/><file name="Sharedpage.php" hash="d1b7bc02737862d203a8a40ce82e7971"/><file name="Token.php" hash="a73d105b824ea3c7783516fbc85a192a"/><file name="Transparent.php" hash="ee4b8062d0939aa69921043fe2a2aa2f"/></dir><file name="Response.php" hash="03977513b56c2698d44ac578756f9c8e"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Orderstatus.php" hash="26a90ac9556ba210a73685a2b6edc5cd"/><file name="Validation.php" hash="39a895e6083f47872425e1616e75bee5"/></dir><dir name="Source"><file name="Cctype.php" hash="1b31bfaae980669c5ac0ba7e644ea515"/><file name="ConnectionType.php" hash="9060bb5013246eaf08c8ebf215b70a7d"/><file name="Mode.php" hash="a3f1dffc58540b31c5ab43a32452cce5"/><file name="Orderstatus.php" hash="75524debbd930498e278abd74c635fb9"/><file name="PaymentAction.php" hash="eaca860975abf97aa3ca49ba5f57d21b"/><file name="VerifyStatus.php" hash="28ff5c7c66c6b70c3923379ce3b82671"/></dir></dir></dir></dir><dir name="Test"><dir name="Model"><file name="Abstract.php" hash="5683575f264336a8c5f4c71768883b73"/><file name="Config.php" hash="98cc66555893a2a29a2ac093795dde17"/><file name="CustomerToken.php" hash="ed2f390b4579a33da70835356a718a79"/><file name="JsonSerializable.php" hash="d0735fda26a7461885c3cf8a5afcca2a"/><dir name="Request"><dir name="fixtures"><file name="default.yaml" hash="51c7dc1c509fcd1e4cf8dc0c49c9126a"/></dir></dir><file name="Request.php" hash="e19218a48cfd0fe5c8abaa0a99d5da08"/><file name="Response.php" hash="fd7b02d0e0f7a4a50862b6649d9faf41"/><dir name="TokenRequest"><dir name="fixtures"><file name="default.yaml" hash="51c7dc1c509fcd1e4cf8dc0c49c9126a"/></dir></dir><file name="TokenRequest.php" hash="965cc4efc952fd9d612d0a6dc924e43e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="EwayadminController.php" hash="de5c4506f87ab13cb01780d1c79d4df7"/></dir><file name="MycardsController.php" hash="6f91776f56decab5beedda246c54437f"/><file name="SharedpageController.php" hash="69629e3f89512f2b8c70a5aa2dcfb04d"/><file name="TestController.php" hash="4d6bac6b37f8da9bf803ddf8cee7addb"/><file name="TransparentController.php" hash="38c5a81509ab91153784bde0be27dc22"/></dir><dir name="etc"><file name="config.xml" hash="0b93b5057ea2727f360d13369a9a5761"/><file name="system.xml" hash="02ed01ae6ea79dbcb899926b802dd6aa"/></dir><dir name="sql"><dir name="ewayrapid_setup"><file name="install-0.1.0.php" hash="25c8318a51545d2685388370b0bd87be"/><file name="upgrade-0.1.0-1.0.0.php" hash="9823e00ab55115dfa5da99d067ad1924"/><file name="upgrade-1.0.0-1.0.1.php" hash="7e68e66ec1273400fc35f796b1d3565e"/><file name="upgrade-1.0.1-1.0.3.php" hash="21fde70ea184fe2b0667f942d63e0280"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ewayrapid"><file name="layout.xml" hash="b5ce2f60041814eb192c75deec216647"/></dir></dir><dir name="template"><dir name="ewayrapid"><dir name="form"><file name="direct_notsaved.phtml" hash="5a3aac5acc635e03083773b706330b4f"/><file name="direct_saved.phtml" hash="8c7516529ace83e8d177a5fc9a8e9cd9"/></dir><dir name="info"><file name="direct_notsaved.phtml" hash="7378da27e6fc9432317686c5b05c52e3"/><file name="direct_saved.phtml" hash="fe943996b2eff65e72f594d34a2ddc89"/></dir><dir name="pdf"><file name="direct_notsaved.phtml" hash="bf22201062b76225e130323584646238"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ewayrapid"><file name="layout.xml" hash="b95b4baa764c5cb65c4c9ec91065ce17"/></dir></dir><dir name="template"><dir name="ewayrapid"><dir name="customer"><file name="edit.phtml" hash="b34376162df56abcdbbe81fdd78e75d7"/><file name="mycards.phtml" hash="edef4b70420c7225e9ee0e8098a686e0"/></dir><dir name="form"><file name="direct_notsaved.phtml" hash="c1bbc7f299e8ba2166256146f568320b"/><file name="direct_saved.phtml" hash="989b05758da7db9f51875e5e29145053"/><file name="sharedpage_notsaved.phtml" hash="84bcdff59da4888fde3d68b0e0044854"/><file name="sharedpage_saved.phtml" hash="08963dc603cef32fba9fb48d01536f5f"/><file name="transparent_notsaved.phtml" hash="8d5263c29c5d799f5f6aa10990a85fdc"/><file name="transparent_saved.phtml" hash="db8446efcca8fdef0fc65ecbaa1679e1"/></dir><dir name="info"><file name="direct_notsaved.phtml" hash="e3e6de0f60921687690a5c6225ddf8b6"/><file name="direct_saved.phtml" hash="e3e6de0f60921687690a5c6225ddf8b6"/><file name="sharedpage_notsaved.phtml" hash="e3e6de0f60921687690a5c6225ddf8b6"/><file name="sharedpage_saved.phtml" hash="b14f24a69d19129b34e5369dc075298d"/><file name="transparent_notsaved.phtml" hash="3b7c42bfbf960a89ebb5988c8c3f0e2d"/></dir><file name="js.phtml" hash="d3c363cf2c7ac0a6a822f1919fc9383a"/><dir name="redirect"><file name="review.phtml" hash="8f64dfebe347f45cc9cfa6be3554d7e7"/><file name="transparent.phtml" hash="23813476dc656d857efe6f2b50b5e710"/><file name="transparent_checkout.phtml" hash="20ae7dc582a9c430c84b381c9be8148d"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eway_Rapid31.xml" hash="2c1fefb7319ecbd86d3904afd35ac4c7"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Eway_Rapid31.csv" hash="4cecdb8c8152a113467fb2ca48b5062f"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="ewayrapid.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="ewayrapid.css" hash="b8dda3f195eb10b86f1ebd5d349ac0db"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="ewayrapid"><file name="eCrypt.js" hash="b79ff8bbb306e667872ae5862f82058c"/><file name="eWAY_Payment_Rapid31.xml" hash="03c6728b4c2b7dde8ab537a5b229f3aa"/><file name="ewayrapid.js" hash="563c82a82c017987ad282f04075ffcf3"/></dir></dir></target></contents>
|
28 |
<compatible/>
|
29 |
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
|
30 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>eWAY_Payment_Rapid31</name>
|
4 |
+
<version>1.4.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
20 |
- Get help when and where you need it with 24/7 support
|
21 |

|
22 |
Discover more at https://www.eway.com.au - payments made smarter!</description>
|
23 |
+
<notes>Please note: After upgrading, the eWAY Rapid payment option will need to be re-enabled.
|
24 |
+

|
25 |
+
New Features
|
26 |
+
- eWAY Rapid IFrame payment method
|
27 |
+
- Visa Checkout integration
|
28 |
+
- Saved cards can now be added and edited in the Magento back office
|
29 |
+
- eWAY Order View - a new report in the Magento back office with details eWAY order information such as Beagle Score and Fraud Actions
|
30 |
+
- New Responsive Shared Page options:
|
31 |
+
- Beagle Verify Phone & Email verification
|
32 |
+
- Choose from one of 13 themes
|
33 |
+
- Option to pass the Invoice Number & invoice description (an abbreviated list of items) to eWAY
|
34 |
+

|
35 |
+
Improvements
|
36 |
+
- Saved cards are now integrated into the credit card form instead of a separate payment option
|
37 |
+
- Beagle Score and Beagle Verify displayed in order information if enabled
|
38 |
+
- If a hosted form is selected as a payment method, the eWAY Rapid IFrame will also be used when placing orders in the back office for additional security
|
39 |
+
- PayPal & MasterPass now use their appropriate logos
|
40 |
+

|
41 |
+

|
42 |
+
Bug Fixes
|
43 |
+
- Fix for Transparent Redirect disabling other payment methods
|
44 |
+
- Fix for some multi-shipping checkout errors
|
45 |
+
- Fix for invalid responses creating orders (AMEX multi-currency error)
|
46 |
+
- Fix for some orders failing when no shipping address is present
|
47 |
+
- Fix for the initial fee sometimes not charging with Recurring Profiles
|
48 |
+
- Fix for billing address being used for shipping address for some guest checkouts</notes>
|
49 |
<authors><author><name>eWAY Payments</name><user>eWAYPayments</user><email>partner@eway.com.au</email></author></authors>
|
50 |
+
<date>2016-03-22</date>
|
51 |
+
<time>04:35:03</time>
|
52 |
+
<contents><target name="magecommunity"><dir name="Eway"><dir name="Rapid31"><dir name="Block"><dir name="Admin"><file name="Version.php" hash="4a8af7b6049ab60e273c8d8410e2988f"/></dir><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Cards.php" hash="436ea581d5a88f3bfedb4a8a47b40cbc"/><file name="Form.php" hash="7d76bcc9bc04e4289e99c6819b5c4f8a"/></dir></dir><file name="Method.php" hash="c44027b78478b53e0b21b326030121bc"/><file name="Savedcard.php" hash="39e94bf06a6e4504976c97a12a825802"/></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="980f5199b6092990a90a99377e7d8666"/><dir name="Renderer"><file name="Items.php" hash="aaef9d3494c44da3d03866d9cc788791"/></dir></dir><file name="Order.php" hash="e0b2321ade4e065794681985ccc937e9"/></dir></dir><dir name="Customer"><file name="Edit.php" hash="d7b1373e21796578ff7b6be9d0bf051d"/><file name="Mycards.php" hash="34df399b9c3e8a2752cf2989b188ae80"/></dir><dir name="Form"><dir name="Direct"><file name="Ewayone.php" hash="5b09b04f27207afa188214b19ed4b116"/><file name="Notsaved.php" hash="82a649f61fb2c4cc1d02a492aed401a2"/><file name="Saved.php" hash="1ce47a1e6edb31dda3388a9d0966f80d"/></dir><dir name="Sharedpage"><file name="Ewayone.php" hash="3c5e850a61f1a2de98cd639a9c49c3e8"/><file name="Notsaved.php" hash="f2f4d623b46775d2c09300394a3580cd"/><file name="Saved.php" hash="af30582c5260c6edef41ac13daad6da0"/></dir><dir name="Transparent"><file name="Ewayone.php" hash="4c4e051aff8bef4607877bd1edf77c52"/><file name="Notsaved.php" hash="be64d2e56a205f2e2005770b92d294dd"/><file name="Saved.php" hash="4489ebedf0fd6a7c22311e6d01ca6a47"/></dir></dir><dir name="Html"><file name="Head.php" hash="02248df4cbb51019c4597ee751ba906f"/></dir><dir name="Info"><dir name="Direct"><file name="Ewayone.php" hash="6959f5d07ddc906360b3321fedcfc76f"/><file name="Notsaved.php" hash="76857a644cafc5b880a8a6930e9c8246"/><file name="Saved.php" hash="a9b1a08db461a9875cb67c24ec0d341d"/></dir><dir name="Sharedpage"><file name="Ewayone.php" hash="b829072f627eb82c5728d5ce9fccacdf"/><file name="Notsaved.php" hash="64fbfb7ad75b2eaec7cc55ca0189d4dc"/><file name="Saved.php" hash="6122e7f28b5086e5944e825dc50fd191"/></dir><dir name="Transparent"><file name="Ewayone.php" hash="e1ae3b26d804324ab83553719d47e61a"/><file name="Notsaved.php" hash="743f4227532db7a4bcc706260b552e99"/><file name="Saved.php" hash="31de55ee9e7a015662b112d3c77bcd99"/></dir></dir><dir name="Redirect"><file name="PaypalReview.php" hash="bdfff05cf75ce9739a5022ce9fd553ed"/><file name="Transparent.php" hash="4b5fcc160079581b42c2be53a01ff379"/><file name="TransparentCheckout.php" hash="c28d82cc2207c42343fb31ca65afa2cd"/></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="339b753bab57b2fefce2c770aca34920"/></dir></dir></dir><dir name="Helper"><file name="Customer.php" hash="477559004a6200d7fe234902183ee600"/><file name="Data.php" hash="ed28b04dcc3f80d85aee4ea04752458b"/></dir><dir name="Model"><dir name="Backend"><file name="Savedtokens.php" hash="55c209484a4ee56caadcde3633cb68dc"/></dir><file name="Config.php" hash="e793793ea19334ec2a48a843e87fe3b1"/><dir name="Customer"><file name="Savedtokens.php" hash="fec7133470f1c26cb284c12fd56e7991"/><file name="Token.php" hash="698166a7b2f9906a08842d15f01dc86c"/></dir><file name="EwayCron.php" hash="802b0d1d02c8a4a3dcf5157e0bb9804d"/><dir name="Field"><file name="CardDetails.php" hash="15d10ff8dec0590335b5c576df00554b"/><file name="Customer.php" hash="a5c32b1f06070ec3fe419ff9bc1a298a"/><file name="LineItem.php" hash="0ba66e9b1ecd1acb95c91d6192f9a8df"/><file name="Payment.php" hash="5226334c0d5fe39f27466b6113e8c091"/><file name="ShippingAddress.php" hash="3e46233fa343875dd061a158b3363c32"/></dir><file name="JsonSerializable.php" hash="630af4fb2b90d9e7808615bcca2b968a"/><file name="JsonSerializableAbstract.php" hash="15f72821079c02efe2f31ce52be22193"/><dir name="Method"><file name="Ewayone.php" hash="da5f59ff25a3c44d3d2be7a3823ecc24"/><file name="Notsaved.php" hash="a38b6ab645d2fe73748840bef5fba217"/><file name="Saved.php" hash="14e995d75dbfe990b0eda2a75d23415d"/></dir><file name="Observer.php" hash="39b73aee99eb291c994f21411277740f"/><file name="RecurringProfile.php" hash="ae2591d25069f329e50994473bf556fe"/><dir name="Request"><file name="Abstract.php" hash="6e3c7940bcb9432ff4b5a7d9e6ecfdae"/><file name="Direct.php" hash="6e8cbf911eff2a681e75b7660dd52c81"/><file name="Sharedpage.php" hash="7b8cb69afa33f25f44a1b6de559d0b85"/><file name="Token.php" hash="d5c0cc4592774e72456bf199dfcfd0f4"/><file name="Transparent.php" hash="db82822daadda0a0a5b0d52b20d4dad9"/></dir><dir name="Resource"><file name="Setup.php" hash="701912d9d017e34bd6f8a3359da7f0d6"/></dir><file name="Response.php" hash="6dc8267a71e6fee0ca5dc6fd491c5015"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Orderstatus.php" hash="26a90ac9556ba210a73685a2b6edc5cd"/><file name="Validation.php" hash="39a895e6083f47872425e1616e75bee5"/></dir><dir name="Source"><file name="Cctype.php" hash="1b31bfaae980669c5ac0ba7e644ea515"/><file name="ConnectionType.php" hash="9f09773561540322c196359dff9f508f"/><file name="CustomView.php" hash="b4f2dcca59e97e38faa1b3b8e89d758c"/><file name="Mode.php" hash="a3f1dffc58540b31c5ab43a32452cce5"/><file name="NoYes.php" hash="05384b4295ee1dab2898051a085a1fa2"/><file name="Orderstatus.php" hash="75524debbd930498e278abd74c635fb9"/><file name="PaymentAction.php" hash="eaca860975abf97aa3ca49ba5f57d21b"/><file name="VerifyStatus.php" hash="28ff5c7c66c6b70c3923379ce3b82671"/></dir></dir></dir></dir><dir name="Test"><dir name="Model"><file name="Abstract.php" hash="5683575f264336a8c5f4c71768883b73"/><file name="Config.php" hash="98cc66555893a2a29a2ac093795dde17"/><file name="CustomerToken.php" hash="ed2f390b4579a33da70835356a718a79"/><file name="JsonSerializable.php" hash="d0735fda26a7461885c3cf8a5afcca2a"/><dir name="Request"><dir name="fixtures"><file name="default.yaml" hash="51c7dc1c509fcd1e4cf8dc0c49c9126a"/></dir></dir><file name="Request.php" hash="e19218a48cfd0fe5c8abaa0a99d5da08"/><file name="Response.php" hash="fd7b02d0e0f7a4a50862b6649d9faf41"/><dir name="TokenRequest"><dir name="fixtures"><file name="default.yaml" hash="51c7dc1c509fcd1e4cf8dc0c49c9126a"/></dir></dir><file name="TokenRequest.php" hash="965cc4efc952fd9d612d0a6dc924e43e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="EwayadminController.php" hash="4eb114484e845956d4018ad0a3aa9144"/><dir name="Ewayrapid"><file name="SavedcardController.php" hash="081a98dec58c91c9ff15921093b2a3c0"/></dir><dir name="Sales"><dir name="Order"><file name="CreateController.php" hash="701a4797e2a405bdf60e268bd32364a1"/></dir></dir></dir><file name="MycardsController.php" hash="f323ee3e8de3a2c705ed3e0862180b6d"/><file name="SharedpageController.php" hash="ca0edb347a6425c98e762d50070899aa"/><file name="TestController.php" hash="4d6bac6b37f8da9bf803ddf8cee7addb"/><file name="TransparentController.php" hash="87b2a77dda223cce52912acf8887246b"/></dir><dir name="etc"><file name="config.xml" hash="a0d4a40f0896a20478501acc024472a5"/><file name="system.xml" hash="bde3fb1ce869490de39eba3caa46991b"/></dir><dir name="sql"><dir name="ewayrapid_setup"><file name="install-0.1.0.php" hash="f1be76760820181d845c4c490db3868e"/><file name="upgrade-0.1.0-1.0.0.php" hash="5183123b924cd233ee739c710da05bc2"/><file name="upgrade-1.0.0-1.0.1.php" hash="ff9b1fbb2f170a38307aef5f629fb7f0"/><file name="upgrade-1.0.1-1.0.3.php" hash="1b2e710cc1b615ea1e3faa984e8f20a9"/><file name="upgrade-1.3.2-1.4.0.php" hash="51a24f529590ded3726670d5bbb02aec"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ewayrapid"><file name="layout.xml" hash="9746317b9ab21690e895eaf46837f610"/></dir></dir><dir name="template"><dir name="ewayrapid"><dir name="customer"><file name="cardcontainer.phtml" hash="fa7cb1468ffd91819d48e75b46c72b74"/><dir name="edit"><dir name="tab"><file name="cards.phtml" hash="0d5763a3e2b8d7c29a4e62461e5e45c8"/><file name="form.phtml" hash="0072d09df1b2586b47bf88511d8fb408"/></dir></dir><file name="method.phtml" hash="59db850e0f55e6f00f02861b336f9ae1"/></dir><dir name="form"><file name="direct_ewayone.phtml" hash="1959ec7cffe07bb93e3b4f86e8ecd692"/><file name="direct_notsaved.phtml" hash="e3b20e7723aebb3a63cb0b28bae9fae5"/><file name="direct_saved.phtml" hash="015e1c765cc4920430ccab2fa8991a16"/><file name="sharedpage_ewayone.phtml" hash="9b82900df8a7d1bb4360c47ed4474654"/><file name="sharedpage_notsaved.phtml" hash="84ed0449786feb73ccf9970232159934"/></dir><dir name="info"><file name="direct_ewayone.phtml" hash="3fee6dea19b69f94b48939b790fad262"/><file name="direct_notsaved.phtml" hash="b6a2c0d84032a8b1431ba547649237a6"/><file name="direct_saved.phtml" hash="ad1b4f6dab28ab65f291ab2547fe1d6f"/><file name="sharedpage_notsaved.phtml" hash="f22e1eb880eb5ad55a257d71a73f6605"/><file name="sharedpage_saved.phtml" hash="10d7f1e86cf3641aeea1f7a9a8ade77b"/></dir><dir name="pdf"><file name="direct_notsaved.phtml" hash="51d771c6839b6c83d2a84d55f193e9bb"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ewayrapid"><file name="layout.xml" hash="94b39bd9943690de324e2960ea13153f"/></dir></dir><dir name="template"><dir name="ewayrapid"><dir name="customer"><file name="edit.phtml" hash="159198404c7e758bbe5c81fdc966ec03"/><file name="mycards.phtml" hash="edef4b70420c7225e9ee0e8098a686e0"/></dir><dir name="form"><file name="direct_ewayone.phtml" hash="03e663c8820091d45e458278d83237b0"/><file name="direct_notsaved.phtml" hash="2b764060f69c8e08353245533ddd587b"/><file name="direct_saved.phtml" hash="90f8c0887d2293e4a0932a205a1f2872"/><file name="sharedpage_ewayone.phtml" hash="9b82900df8a7d1bb4360c47ed4474654"/><file name="sharedpage_notsaved.phtml" hash="84ed0449786feb73ccf9970232159934"/><file name="sharedpage_saved.phtml" hash="c59d256956f61102206bedcf71ea0b99"/><file name="transparent_ewayone.phtml" hash="1425e8f346760a5f4b4121bc3fafefa4"/><file name="transparent_notsaved.phtml" hash="8d5263c29c5d799f5f6aa10990a85fdc"/><file name="transparent_saved.phtml" hash="32e5d121c27c1bed0698649544f9d3a0"/></dir><dir name="info"><file name="direct_ewayone.phtml" hash="5ea103e188f064db7ff36e1a93bcd194"/><file name="direct_notsaved.phtml" hash="41e6d99d21813915db323983c6f1eafe"/><file name="direct_saved.phtml" hash="72ebf53b20b4d334a7e6b57cf9b6cbeb"/><file name="sharedpage_ewayone.phtml" hash="aff7b8fd31e90ce9f3c40eeb215d5b5a"/><file name="sharedpage_notsaved.phtml" hash="72ebf53b20b4d334a7e6b57cf9b6cbeb"/><file name="sharedpage_saved.phtml" hash="f25bfa4139ff137b9ef53646bf5d7b85"/><file name="transparent_ewayone.phtml" hash="f591cfd20097d8e91a107728fb0da76a"/><file name="transparent_notsaved.phtml" hash="8620ed78adf88e552f207756f89e6b0a"/></dir><file name="js.phtml" hash="00205e17cfdb8f31a8f023680fcd07cc"/><dir name="redirect"><file name="review.phtml" hash="8f64dfebe347f45cc9cfa6be3554d7e7"/><file name="transparent.phtml" hash="cc8722254f06bc7466565415c2e624cf"/><file name="transparent_checkout.phtml" hash="9273829f6b441b267a0182b8ff66071e"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eway_Rapid31.xml" hash="2c1fefb7319ecbd86d3904afd35ac4c7"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Eway_Rapid31.csv" hash="4cecdb8c8152a113467fb2ca48b5062f"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="ewayrapid.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="ewayrapid.css" hash="bed89bec2b0293136960d9daffab57cb"/></dir><dir name="images"><file name="masterpass.png" hash="3b46378f9f7e641896ed7fe5b470fb26"/><file name="paypal_button.png" hash="6ee06dfdba8376048c63a6865324179d"/><file name="visa_checkout.png" hash="94d6ab79beded06bc7263694ba03c91d"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="ewayrapid"><file name="ewayrapid.js" hash="855b9154d3e630f06ded7a97cb4fb171"/></dir></dir></target></contents>
|
53 |
<compatible/>
|
54 |
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
|
55 |
</package>
|
@@ -59,4 +59,76 @@
|
|
59 |
#container_payment_method_ewayrapid_saved label,
|
60 |
#container_payment_method_ewayrapid_notsaved label{ text-align: left; }
|
61 |
.eway-saved-label-box { width: auto !important; }
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
#container_payment_method_ewayrapid_saved label,
|
60 |
#container_payment_method_ewayrapid_notsaved label{ text-align: left; }
|
61 |
.eway-saved-label-box { width: auto !important; }
|
62 |
+
|
63 |
+
#payment_form_ewayrapid_ewayone li {
|
64 |
+
clear: both;
|
65 |
+
display: block;
|
66 |
+
}
|
67 |
+
|
68 |
+
.opc-col-right #eway_save_paypal{
|
69 |
+
padding-top: 12px;
|
70 |
+
}
|
71 |
+
|
72 |
+
#onestepcheckout-form #eway_save_paypal{
|
73 |
+
margin: 6px 0;
|
74 |
+
}
|
75 |
+
|
76 |
+
#onestepcheckout-form #eway_save_masterpass{
|
77 |
+
margin: 10px 0;
|
78 |
+
}
|
79 |
+
|
80 |
+
#payment_form_ewayrapid_ewayone li#eway_save_card input {
|
81 |
+
vertical-align: top;
|
82 |
+
margin-top: 6px;
|
83 |
+
}
|
84 |
+
#payment_form_ewayrapid_ewayone li#eway_save_card label {
|
85 |
+
float: none !important;
|
86 |
+
}
|
87 |
+
|
88 |
+
#onestepcheckout-payment-methods #ul_payment_form_ewayrapid_ewayone .input-box {
|
89 |
+
max-width: 90%;
|
90 |
+
}
|
91 |
+
|
92 |
+
#onestepcheckout-payment-methods #ewayrapid_ewayone_token {
|
93 |
+
max-width: 250px;
|
94 |
+
}
|
95 |
+
|
96 |
+
#ewayrapid_ewayone_edit {
|
97 |
+
margin: 4px 0 0 5px;
|
98 |
+
vertical-align: top;
|
99 |
+
display: inline-block;
|
100 |
+
}
|
101 |
+
#payment_form_ewayrapid_ewayone #eway_save_creditcard > ul {
|
102 |
+
margin-left: 0 !important;
|
103 |
+
}
|
104 |
+
|
105 |
+
#ewayrapid_ewayone_cc_cid {
|
106 |
+
width: 100px !important;
|
107 |
+
}
|
108 |
+
|
109 |
+
#ewayrapid_ewayone_token{
|
110 |
+
max-width: 200px;
|
111 |
+
width: 100%;
|
112 |
+
margin: 0 0 10px 10px;
|
113 |
+
}
|
114 |
+
|
115 |
+
#gcheckout-payment-methods dl dt{ float: none; width: 100%;}
|
116 |
+
#payment_form_ewayrapid_ewayone { margin-bottom: 10px;}
|
117 |
+
#gcheckout-payment-methods dl dt input[type="radio"] { float: none; padding: 0; margin: 0 5px 0 0 }
|
118 |
+
#gcheckout-payment-methods dl dt label { background: none; display: inline-block;}
|
119 |
+
#payment_form_ewayrapid_ewayone #eway_save_card .v-fix { float: none;}
|
120 |
+
#ul_payment_form_ewayrapid_ewayone { margin-left: 0 !important; text-align: left; width: 80%; background: none;}
|
121 |
+
#firecheckout-form .eway-saved-label-box {width: 100% !important;}
|
122 |
+
|
123 |
+
#ul-eway-saved-div-box .eway-saved-div-box {width: 100%;}
|
124 |
+
#ul-eway-saved-div-box .eway-saved-div-box > .eway-saved-label-box{
|
125 |
+
float: none; display: block; margin-bottom: 2px;
|
126 |
+
}
|
127 |
+
|
128 |
+
.sp-methods.not-login-methods > li > ul#ul-eway-saved-div-box {display: none;}
|
129 |
+
#payment_form_ewayrapid_ewayone > li > #ul-eway-saved-div-box { width: 95%;margin-top: 0px;border-top:none;}
|
130 |
+
#onestepcheckout-form #payment_form_ewayrapid_ewayone > li:first-child {margin: 0px}
|
131 |
+
#gcheckout-onepage-form #payment_form_ewayrapid_ewayone > li:first-child {margin: 0px}
|
132 |
+
#gcheckout-onepage-form #ul_payment_form_ewayrapid_ewayone {margin-top: 5px}
|
133 |
+
#gcheckout-onepage-form #ul_payment_form_ewayrapid_ewayone:before {display:none;}
|
134 |
+
#gcheckout-onepage-form #ul_payment_form_ewayrapid_ewayone:after {display:none;}
|
Binary file
|
Binary file
|
Binary file
|