Version Notes
Add paypal API
Download this release
Release Info
Developer | Kassim_Profileo |
Extension | Allopass_Hipay |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.2.2
- app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit.php +59 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit/Form.php +95 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/Customer/Edit/Tab/Card.php +155 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile.php +14 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit.php +35 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit/Form.php +75 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Grid.php +83 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment.php +14 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit.php +55 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit/Form.php +96 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Grid.php +103 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/3dsRule.php +5 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/Allowsplitpayment.php +42 -0
- app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/MultiselectSortable.php +46 -0
- app/code/community/Allopass/Hipay/Block/Card.php +59 -0
- app/code/community/Allopass/Hipay/Block/Card/Edit.php +44 -0
- app/code/community/Allopass/Hipay/Block/Form/Abstract.php +94 -3
- app/code/community/Allopass/Hipay/Block/Form/Cc.php +14 -0
- app/code/community/Allopass/Hipay/Block/Info/Cc.php +14 -0
- app/code/community/Allopass/Hipay/Block/Info/Hosted.php +50 -1
- app/code/community/Allopass/Hipay/Controller/Payment.php +79 -49
- app/code/community/Allopass/Hipay/Helper/Data.php +368 -11
- app/code/community/Allopass/Hipay/Model/Api/Request.php +1 -0
- app/code/community/Allopass/Hipay/Model/Card.php +20 -0
- app/code/community/Allopass/Hipay/Model/Config.php +8 -1
- app/code/community/Allopass/Hipay/Model/Method/Abstract.php +409 -83
- app/code/community/Allopass/Hipay/Model/Method/Cc.php +22 -5
- app/code/community/Allopass/Hipay/Model/Method/Dexia.php +3 -0
- app/code/community/Allopass/Hipay/Model/Method/Giropay.php +4 -1
- app/code/community/Allopass/Hipay/Model/Method/Hosted.php +11 -4
- app/code/community/Allopass/Hipay/Model/Method/Ideal.php +2 -0
- app/code/community/Allopass/Hipay/Model/Method/Ing.php +4 -1
- app/code/community/Allopass/Hipay/Model/Method/Kbc.php +2 -0
- app/code/community/Allopass/Hipay/Model/Method/PaypalApi.php +87 -0
- app/code/community/Allopass/Hipay/Model/Method/Przelewy24Api.php +10 -5
- app/code/community/Allopass/Hipay/Model/Method/Qiwi.php +3 -0
- app/code/community/Allopass/Hipay/Model/Method/Sisal.php +3 -0
- app/code/community/Allopass/Hipay/Model/Method/SisalApi.php +12 -5
- app/code/community/Allopass/Hipay/Model/Method/SofortApi.php +9 -5
- app/code/community/Allopass/Hipay/Model/Method/Webmoney.php +3 -0
- app/code/community/Allopass/Hipay/Model/Method/WebmoneyApi.php +12 -5
- app/code/community/Allopass/Hipay/Model/Method/Yandex.php +3 -0
- app/code/community/Allopass/Hipay/Model/Method/YandexApi.php +12 -5
- app/code/community/Allopass/Hipay/Model/Observer.php +133 -0
- app/code/community/Allopass/Hipay/Model/PaymentProfile.php +155 -0
- app/code/community/Allopass/Hipay/Model/Resource/Card.php +12 -0
- app/code/community/Allopass/Hipay/Model/Resource/Card/Collection.php +19 -0
- app/code/community/Allopass/Hipay/Model/Resource/PaymentProfile.php +12 -0
- app/code/community/Allopass/Hipay/Model/Resource/PaymentProfile/Collection.php +37 -0
- app/code/community/Allopass/Hipay/Model/Resource/SplitPayment.php +12 -0
- app/code/community/Allopass/Hipay/Model/Resource/SplitPayment/Collection.php +19 -0
- app/code/community/Allopass/Hipay/Model/Rule.php +7 -2
- app/code/community/Allopass/Hipay/Model/Rule/Condition/Address.php +6 -2
- app/code/community/Allopass/Hipay/Model/Rule/Condition/Customer.php +25 -11
- app/code/community/Allopass/Hipay/Model/Rule/Config.php +22 -3
- app/code/community/Allopass/Hipay/Model/Source/3ds.php +6 -2
- app/code/community/Allopass/Hipay/Model/Source/CcType.php +23 -1
- app/code/community/Allopass/Hipay/Model/Source/CcTypeHosted.php +21 -1
- app/code/community/Allopass/Hipay/Model/Source/PaymentProfile.php +48 -0
- app/code/community/Allopass/Hipay/Model/Source/Template.php +1 -12
- app/code/community/Allopass/Hipay/Model/SplitPayment.php +91 -0
- app/code/community/Allopass/Hipay/Model/System/Config/Backend/CcTypes.php +12 -0
- app/code/community/Allopass/Hipay/controllers/Adminhtml/CardController.php +150 -0
- app/code/community/Allopass/Hipay/controllers/Adminhtml/PaymentController.php +297 -0
- app/code/community/Allopass/Hipay/controllers/Adminhtml/PaymentProfileController.php +153 -0
- app/code/community/Allopass/Hipay/controllers/Adminhtml/RuleController.php +1 -0
- app/code/community/Allopass/Hipay/controllers/Adminhtml/SplitPaymentController.php +163 -0
- app/code/community/Allopass/Hipay/controllers/CardController.php +175 -0
- app/code/community/Allopass/Hipay/controllers/NotifyController.php +15 -6
- app/code/community/Allopass/Hipay/controllers/PaypalapiController.php +8 -0
- app/code/community/Allopass/Hipay/controllers/Sales/Order/CreateController.php +79 -0
- app/code/community/Allopass/Hipay/etc/config.xml +222 -72
- app/code/community/Allopass/Hipay/etc/system.xml +778 -221
- app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-install-0.1.0.php +14 -14
- app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.6-1.0.7.php +43 -0
- app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.7-1.0.8.php +18 -0
- app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.8-1.0.9.php +32 -0
- app/code/community/Allopass/Hipay/sql/allopass_hipay_setup/mysql4-upgrade-1.0.9-1.1.0.php +69 -0
- app/design/adminhtml/default/default/layout/hipay.xml +38 -1
- app/design/{frontend → adminhtml}/default/default/template/hipay/form/cc.phtml +43 -19
- app/design/adminhtml/default/default/template/hipay/form/hosted.phtml +41 -0
- app/design/adminhtml/default/default/template/hipay/info/cc.phtml +19 -0
- app/design/adminhtml/default/default/template/hipay/info/hosted.phtml +19 -0
- app/design/frontend/base/default/layout/hipay.xml +41 -0
- app/design/frontend/base/default/template/hipay/card/account.phtml +56 -0
- app/design/frontend/base/default/template/hipay/card/form/edit.phtml +33 -0
- app/design/frontend/{default → base}/default/template/hipay/checkout/pending.phtml +0 -0
- app/design/frontend/base/default/template/hipay/form/cc.phtml +245 -0
- app/design/frontend/{default → base}/default/template/hipay/form/hosted.phtml +40 -12
- app/design/frontend/base/default/template/hipay/info/cc.phtml +19 -0
- app/design/frontend/base/default/template/hipay/info/hosted.phtml +19 -0
- app/design/frontend/default/default/layout/hipay.xml +0 -12
- app/locale/en_US/Allopass_Hipay.csv +35 -3
- app/locale/en_US/template/email/hipay_fraud_payment.html +64 -0
- app/locale/en_US/template/email/hipay_fraud_payment_accept.html +64 -0
- app/locale/en_US/template/email/hipay_fraud_payment_deny.html +64 -0
- app/locale/fr_FR/Allopass_Hipay.csv +38 -2
- app/locale/fr_FR/template/email/hipay_fraud_payment.html +66 -0
- app/locale/fr_FR/template/email/hipay_fraud_payment_accept.html +64 -0
- app/locale/fr_FR/template/email/hipay_fraud_payment_deny.html +64 -0
- app/locale/it_IT/Allopass_Hipay.csv +33 -0
- app/locale/it_IT/template/email/hipay_fraud_payment.html +64 -0
- app/locale/it_IT/template/email/hipay_fraud_payment_accept.html +64 -0
- app/locale/it_IT/template/email/hipay_fraud_payment_deny.html +64 -0
- package.xml +6 -6
app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_Card_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Initialize cms page edit block
|
6 |
+
*
|
7 |
+
* @return void
|
8 |
+
*/
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
|
12 |
+
$this->_objectId = 'card_id';
|
13 |
+
$this->_blockGroup = 'hipay';
|
14 |
+
$this->_controller = 'adminhtml_card';
|
15 |
+
$this->_headerText = $this->__('Card Hipay');
|
16 |
+
parent::__construct();
|
17 |
+
|
18 |
+
$this->removeButton('delete');
|
19 |
+
|
20 |
+
|
21 |
+
$this->_addButton('saveandcontinue', array(
|
22 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
23 |
+
'onclick' => 'saveAndContinueEdit(\''.$this->getUrl('*/*/save', array('_current'=>true,'back'=>'edit')).'\')',
|
24 |
+
'class' => 'save',
|
25 |
+
), -100);
|
26 |
+
|
27 |
+
|
28 |
+
$this->_formScripts[] = "
|
29 |
+
function saveAndContinueEdit(){
|
30 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
31 |
+
}
|
32 |
+
|
33 |
+
function run(url){
|
34 |
+
editForm.submit(url);
|
35 |
+
}
|
36 |
+
";
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get URL for back (reset) button
|
41 |
+
*
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function getBackUrl()
|
45 |
+
{
|
46 |
+
return $this->getUrl('adminhtml/customer/edit',array('id'=>$this->getCard()->getCustomerId()));
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Retrieve card model object
|
51 |
+
*
|
52 |
+
* @return Allopass_Hipay_Model_Card
|
53 |
+
*/
|
54 |
+
public function getCard()
|
55 |
+
{
|
56 |
+
return Mage::registry('current_card');
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/Card/Edit/Form.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Allopass_Hipay_Block_Adminhtml_Card_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _prepareForm()
|
7 |
+
{
|
8 |
+
|
9 |
+
/* @var $card Allopass_Hipay_Model_Card */
|
10 |
+
$card = Mage::registry('current_card');
|
11 |
+
|
12 |
+
|
13 |
+
$form = new Varien_Data_Form(array('id'=>'edit_form','action' => $this->getUrl('*/card/save'), 'method' => 'post'));
|
14 |
+
|
15 |
+
$fieldset = $form->addFieldset('card_form', array('legend'=>Mage::helper('hipay')->__('Card Hipay')));
|
16 |
+
|
17 |
+
if ($card->getCardId()) {
|
18 |
+
$fieldset->addField('card_id', 'hidden', array(
|
19 |
+
'name' => 'card_id',
|
20 |
+
));
|
21 |
+
$fieldset->addField('customer_id', 'hidden', array(
|
22 |
+
'name' => 'customer_id',
|
23 |
+
));
|
24 |
+
}
|
25 |
+
$fieldset->addField('name', 'text', array(
|
26 |
+
'label' => Mage::helper('hipay')->__('Card #'),
|
27 |
+
'title' => Mage::helper('hipay')->__('Card #'),
|
28 |
+
'class' => 'required-entry',
|
29 |
+
'required' => true,
|
30 |
+
'name' => 'name',
|
31 |
+
));
|
32 |
+
|
33 |
+
$fieldset->addField('is_default', 'select', array(
|
34 |
+
'label' => Mage::helper('hipay')->__('Is default'),
|
35 |
+
'title' => Mage::helper('hipay')->__('Is default'),
|
36 |
+
'name' => 'is_default',
|
37 |
+
'values' => array(Mage::helper('sales')->__('No'),Mage::helper('adminhtml')->__('Yes'))
|
38 |
+
));
|
39 |
+
|
40 |
+
$statues = array(Allopass_Hipay_Model_Card::STATUS_ENABLED =>$this->__('Enabled') ,Allopass_Hipay_Model_Card::STATUS_DISABLED=>$this->__('Disabled'));
|
41 |
+
$fieldset->addField('cc_status', 'select', array(
|
42 |
+
'label' => Mage::helper('hipay')->__('Status'),
|
43 |
+
'title' => Mage::helper('hipay')->__('Status'),
|
44 |
+
'name' => 'cc_status',
|
45 |
+
'values' => $statues
|
46 |
+
));
|
47 |
+
|
48 |
+
|
49 |
+
$fieldset_info = $form->addFieldset('card_info', array('legend'=>Mage::helper('hipay')->__('Informations'))) ;
|
50 |
+
|
51 |
+
$fieldset_info->addField('cc_type', 'text', array(
|
52 |
+
'label' => Mage::helper('payment')->__('Card type'),
|
53 |
+
'title' => Mage::helper('payment')->__('Card type'),
|
54 |
+
'name' => 'cc_type',
|
55 |
+
'readonly' => true,
|
56 |
+
));
|
57 |
+
|
58 |
+
$fieldset_info->addField('cc_number_enc', 'text', array(
|
59 |
+
'label' => Mage::helper('payment')->__('Card number'),
|
60 |
+
'title' => Mage::helper('payment')->__('Card number'),
|
61 |
+
'name' => 'cc_number_enc',
|
62 |
+
'readonly' => true,
|
63 |
+
));
|
64 |
+
|
65 |
+
$fieldset_info->addField('cc_exp_month', 'text', array(
|
66 |
+
'label' => Mage::helper('payment')->__('Card Exp. month'),
|
67 |
+
'title' => Mage::helper('payment')->__('Card Exp. month'),
|
68 |
+
'name' => 'cc_exp_month',
|
69 |
+
'readonly' => true,
|
70 |
+
));
|
71 |
+
|
72 |
+
$fieldset_info->addField('cc_exp_year', 'text', array(
|
73 |
+
'label' => Mage::helper('payment')->__('Card Exp. year'),
|
74 |
+
'title' => Mage::helper('payment')->__('Card Exp. year'),
|
75 |
+
'name' => 'cc_exp_year',
|
76 |
+
'readonly' => true,
|
77 |
+
));
|
78 |
+
|
79 |
+
|
80 |
+
$fieldset_info->addField('cc_token', 'text', array(
|
81 |
+
'label' => Mage::helper('hipay')->__('Card Token'),
|
82 |
+
'title' => Mage::helper('hipay')->__('Card Token'),
|
83 |
+
'readonly' => true,
|
84 |
+
'name' => 'cc_token',
|
85 |
+
));
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
$form->setUseContainer(true);
|
90 |
+
$form->setValues($card->getData());
|
91 |
+
$this->setForm($form);
|
92 |
+
return parent::_prepareForm();
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/Customer/Edit/Tab/Card.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Allopass_Hipay_Block_Adminhtml_Customer_Edit_Tab_Card extends
|
4 |
+
Mage_Adminhtml_Block_Widget_Grid implements
|
5 |
+
Mage_Adminhtml_Block_Widget_Tab_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Initialize Grid
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
public function __construct() {
|
12 |
+
parent::__construct();
|
13 |
+
$this->setId('hipay_card_grid');
|
14 |
+
$this->setDefaultSort('card_id', 'desc');
|
15 |
+
$this->setUseAjax(true);
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Retrieve current customer object
|
20 |
+
*
|
21 |
+
* @return Mage_Customer_Model_Customer
|
22 |
+
*/
|
23 |
+
protected function _getCustomer() {
|
24 |
+
return Mage::registry('current_customer');
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Create customer cards collection
|
29 |
+
*
|
30 |
+
* @return Allopass_Hipay_Model_Resource_Card_Collection
|
31 |
+
*/
|
32 |
+
protected function _createCollection() {
|
33 |
+
return Mage::getModel('hipay/card')->getCollection();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Prepare customer card collection
|
38 |
+
*
|
39 |
+
* @return Allopass_Hipay_Block_Adminhtml_Customer_Edit_Tab_Card
|
40 |
+
*/
|
41 |
+
protected function _prepareCollection() {
|
42 |
+
$collection = $this->_createCollection()
|
43 |
+
->addFieldToFilter('customer_id',
|
44 |
+
$this->_getCustomer()->getId());
|
45 |
+
$this->setCollection($collection);
|
46 |
+
|
47 |
+
return parent::_prepareCollection();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Prepare Grid columns
|
52 |
+
*
|
53 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Wishlist
|
54 |
+
*/
|
55 |
+
protected function _prepareColumns() {
|
56 |
+
$this
|
57 |
+
->addColumn('name',
|
58 |
+
array(
|
59 |
+
'header' => Mage::helper('hipay')
|
60 |
+
->__('Card Name'),
|
61 |
+
'index' => 'name',));
|
62 |
+
|
63 |
+
$this
|
64 |
+
->addColumn('cc_type',
|
65 |
+
array(
|
66 |
+
'header' => Mage::helper('hipay')->__('Type'),
|
67 |
+
'index' => 'cc_type',));
|
68 |
+
|
69 |
+
$this
|
70 |
+
->addColumn('cc_exp_month',
|
71 |
+
array(
|
72 |
+
'header' => Mage::helper('hipay')
|
73 |
+
->__('Exp. Month'),
|
74 |
+
'index' => 'cc_exp_month',
|
75 |
+
'type' => 'number', 'width' => '30px'));
|
76 |
+
|
77 |
+
$this
|
78 |
+
->addColumn('cc_exp_year',
|
79 |
+
array(
|
80 |
+
'header' => Mage::helper('hipay')
|
81 |
+
->__('Exp. Year'),
|
82 |
+
'index' => 'cc_exp_year',
|
83 |
+
'type' => 'number', 'width' => '30px'));
|
84 |
+
|
85 |
+
$this
|
86 |
+
->addColumn('cc_token',
|
87 |
+
array(
|
88 |
+
'header' => Mage::helper('hipay')
|
89 |
+
->__('Alias oneclick'),
|
90 |
+
'index' => 'cc_token',));
|
91 |
+
|
92 |
+
$this->addColumn('cc_status',
|
93 |
+
array(
|
94 |
+
'header'=> Mage::helper('hipay')->__('Status'),
|
95 |
+
'index' => 'cc_status',
|
96 |
+
'type' => 'options',
|
97 |
+
'options' => array(Allopass_Hipay_Model_Card::STATUS_ENABLED=>$this->__('Enabled'),Allopass_Hipay_Model_Card::STATUS_DISABLED=>$this->__('Disabled')),
|
98 |
+
));
|
99 |
+
|
100 |
+
$this->addColumn('is_default',
|
101 |
+
array(
|
102 |
+
'header'=> Mage::helper('hipay')->__('Is default'),
|
103 |
+
'index' => 'is_default',
|
104 |
+
'type' => 'options',
|
105 |
+
'options' => array($this->__('No'),$this->__('Yes')),
|
106 |
+
));
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
return parent::_prepareColumns();
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
public function getGridUrl() {
|
115 |
+
return $this
|
116 |
+
->getUrl('hipay/adminhtml_card/cards',
|
117 |
+
array('_current' => true));
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Row click url
|
122 |
+
*
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
+
public function getRowUrl($row)
|
126 |
+
{
|
127 |
+
return $this->getUrl('adminhtml/card/edit', array('card_id' => $row->getId()));
|
128 |
+
}
|
129 |
+
|
130 |
+
public function getTabLabel() {
|
131 |
+
return Mage::helper('hipay')->__("Hipay's Cards");
|
132 |
+
|
133 |
+
}
|
134 |
+
public function getTabTitle() {
|
135 |
+
return Mage::helper('hipay')->__("Hipay's Cards");
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
public function canShowTab()
|
140 |
+
{
|
141 |
+
if (Mage::registry('current_customer')->getId()) {
|
142 |
+
return true;
|
143 |
+
}
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
public function isHidden()
|
148 |
+
{
|
149 |
+
if (Mage::registry('current_customer')->getId()) {
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
return true;
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_PaymentProfile extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
|
7 |
+
$this->_controller = 'adminhtml_paymentProfile';
|
8 |
+
$this->_blockGroup = 'hipay';
|
9 |
+
$this->_headerText = $this->__('Hipay Payment Profiles');
|
10 |
+
$this->_addButtonLabel = $this->__('Add payment profile');
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_PaymentProfile_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Initialize cms page edit block
|
6 |
+
*
|
7 |
+
* @return void
|
8 |
+
*/
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
|
12 |
+
$this->_objectId = 'profile_id';
|
13 |
+
$this->_blockGroup = 'hipay';
|
14 |
+
$this->_controller = 'adminhtml_paymentProfile';
|
15 |
+
$this->_headerText = $this->__('Payment Profile');
|
16 |
+
parent::__construct();
|
17 |
+
|
18 |
+
$this->_addButton('saveandcontinue', array(
|
19 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
20 |
+
'onclick' => 'saveAndContinueEdit(\''.$this->getUrl('*/*/save', array('_current'=>true,'back'=>'edit')).'\')',
|
21 |
+
'class' => 'save',
|
22 |
+
), -100);
|
23 |
+
|
24 |
+
$this->_formScripts[] = "
|
25 |
+
function saveAndContinueEdit(){
|
26 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
27 |
+
}
|
28 |
+
";
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Edit/Form.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Allopass_Hipay_Block_Adminhtml_PaymentProfile_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _prepareForm()
|
7 |
+
{
|
8 |
+
/* @var $profile Allopass_Hipay_Model_PaymentProfile */
|
9 |
+
$profile = Mage::registry('payment_profile');
|
10 |
+
|
11 |
+
$form = new Varien_Data_Form(array('id'=>'edit_form','action' => $this->getUrl('*/paymentProfile/save'), 'method' => 'post'));
|
12 |
+
|
13 |
+
$fieldset = $form->addFieldset('paymentProfile_form', array('legend'=>Mage::helper('hipay')->__('Payment Profile')));
|
14 |
+
|
15 |
+
if ($profile->getProfileId()) {
|
16 |
+
$fieldset->addField('profile_id', 'hidden', array(
|
17 |
+
'name' => 'profile_id',
|
18 |
+
));
|
19 |
+
}
|
20 |
+
$fieldset->addField('name', 'text', array(
|
21 |
+
'label' => Mage::helper('hipay')->__('Name'),
|
22 |
+
'title' => Mage::helper('hipay')->__('Name'),
|
23 |
+
'class' => 'required-entry',
|
24 |
+
'required' => true,
|
25 |
+
'name' => 'name',
|
26 |
+
));
|
27 |
+
|
28 |
+
$fieldset->addField('period_unit', 'select', array(
|
29 |
+
'label' => $profile->getFieldLabel('period_unit'),
|
30 |
+
'title' => $profile->getFieldLabel('period_unit'),
|
31 |
+
'class' => 'required-entry',
|
32 |
+
'name' => 'period_unit',
|
33 |
+
'values' => Mage::getSingleton('hipay/paymentProfile')->getAllPeriodUnits(),
|
34 |
+
'note'=>$this->__('Unit for billing during the subscription period.')
|
35 |
+
)
|
36 |
+
);
|
37 |
+
|
38 |
+
$fieldset->addField('period_frequency', 'text', array(
|
39 |
+
'label' => $profile->getFieldLabel('period_frequency'),
|
40 |
+
'title' => $profile->getFieldLabel('period_frequency'),
|
41 |
+
'class' => 'required-entry validate-number',
|
42 |
+
'required' => true,
|
43 |
+
'name' => 'period_frequency',
|
44 |
+
'note'=>$this->__('Number of billing periods that make up one billing cycle.')
|
45 |
+
));
|
46 |
+
|
47 |
+
$fieldset->addField('period_max_cycles', 'text', array(
|
48 |
+
'label' => $profile->getFieldLabel('period_max_cycles'),
|
49 |
+
'title' => $profile->getFieldLabel('period_max_cycles'),
|
50 |
+
'class' => 'required-entry validate-number',
|
51 |
+
'required' => true,
|
52 |
+
'name' => 'period_max_cycles',
|
53 |
+
'note'=>$this->__('The number of billing cycles for payment period.')
|
54 |
+
));
|
55 |
+
|
56 |
+
/*$fieldset->addField('payment_type', 'select', array(
|
57 |
+
'label' => $profile->getPaymentTypeLabel('payment_type'),
|
58 |
+
'title' => $profile->getPaymentTypeLabel('payment_type'),
|
59 |
+
'name' => 'payment_type',
|
60 |
+
'values' => $profile->getAllPaymentTypes(),
|
61 |
+
)
|
62 |
+
);*/
|
63 |
+
|
64 |
+
$fieldset->addField('payment_type', "hidden", array(
|
65 |
+
'name' => 'payment_type'
|
66 |
+
));
|
67 |
+
$profile->setData('payment_type',"split_payment");
|
68 |
+
|
69 |
+
$form->setUseContainer(true);
|
70 |
+
$form->setValues($profile->getData());
|
71 |
+
$this->setForm($form);
|
72 |
+
return parent::_prepareForm();
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/PaymentProfile/Grid.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_PaymentProfile_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
|
5 |
+
protected function _prepareCollection()
|
6 |
+
{
|
7 |
+
|
8 |
+
$collection = Mage::getModel('hipay/paymentProfile')->getCollection();
|
9 |
+
$this->setCollection($collection);
|
10 |
+
parent::_prepareCollection();
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
protected function _prepareColumns()
|
16 |
+
{
|
17 |
+
/* @var $profile Allopass_Hipay_Model_PaymentProfile */
|
18 |
+
$profile = Mage::getModel('hipay/paymentProfile');
|
19 |
+
|
20 |
+
$this->addColumn('profile_id',
|
21 |
+
array(
|
22 |
+
'header'=> Mage::helper('hipay')->__('ID'),
|
23 |
+
'width' => '50px',
|
24 |
+
'type' => 'number',
|
25 |
+
'index' => 'profile_id',
|
26 |
+
));
|
27 |
+
$this->addColumn('name',
|
28 |
+
array(
|
29 |
+
'header'=> Mage::helper('hipay')->__('Name'),
|
30 |
+
'index' => 'name',
|
31 |
+
));
|
32 |
+
|
33 |
+
|
34 |
+
$this->addColumn('period_unit',
|
35 |
+
array(
|
36 |
+
'header'=> $profile->getFieldLabel('period_unit'),
|
37 |
+
'width' => '60px',
|
38 |
+
'index' => 'period_unit',
|
39 |
+
'type' => 'options',
|
40 |
+
'options' => Mage::getSingleton('hipay/paymentProfile')->getAllPeriodUnits(),
|
41 |
+
));
|
42 |
+
|
43 |
+
|
44 |
+
$this->addColumn('period_frequency',
|
45 |
+
array(
|
46 |
+
'header'=> $profile->getFieldLabel('period_frequency'),
|
47 |
+
'width' => '10px',
|
48 |
+
'type' => 'number',
|
49 |
+
'index' => 'period_frequency',
|
50 |
+
));
|
51 |
+
|
52 |
+
$this->addColumn('period_max_cycles',
|
53 |
+
array(
|
54 |
+
'header'=> $profile->getFieldLabel('period_max_cycles'),
|
55 |
+
'width' => '10px',
|
56 |
+
'type' => 'number',
|
57 |
+
'index' => 'period_max_cycles',
|
58 |
+
));
|
59 |
+
|
60 |
+
$this->addColumn('payment_type',
|
61 |
+
array(
|
62 |
+
'header'=> Mage::helper('hipay')->__('Payment type'),
|
63 |
+
'width' => '60px',
|
64 |
+
'index' => 'payment_type',
|
65 |
+
'type' => 'options',
|
66 |
+
'options' => Mage::getSingleton('hipay/paymentProfile')->getAllPaymentTypes(),
|
67 |
+
));
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
return parent::_prepareColumns();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Row click url
|
76 |
+
*
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function getRowUrl($row)
|
80 |
+
{
|
81 |
+
return $this->getUrl('*/*/edit', array('profile_id' => $row->getId()));
|
82 |
+
}
|
83 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_SplitPayment extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_splitPayment';
|
7 |
+
$this->_blockGroup = 'hipay';
|
8 |
+
$this->_headerText = $this->__('Hipay Split Payments');
|
9 |
+
|
10 |
+
parent::__construct();
|
11 |
+
|
12 |
+
$this->_removeButton('add');
|
13 |
+
}
|
14 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_SplitPayment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Initialize cms page edit block
|
6 |
+
*
|
7 |
+
* @return void
|
8 |
+
*/
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
|
12 |
+
$this->_objectId = 'split_payment_id';
|
13 |
+
$this->_blockGroup = 'hipay';
|
14 |
+
$this->_controller = 'adminhtml_splitPayment';
|
15 |
+
$this->_headerText = $this->__('Split Payment');
|
16 |
+
parent::__construct();
|
17 |
+
|
18 |
+
$this->removeButton('delete');
|
19 |
+
|
20 |
+
|
21 |
+
$this->_addButton('saveandcontinue', array(
|
22 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
23 |
+
'onclick' => 'saveAndContinueEdit(\''.$this->getUrl('*/*/save', array('_current'=>true,'back'=>'edit')).'\')',
|
24 |
+
'class' => 'save',
|
25 |
+
), -100);
|
26 |
+
|
27 |
+
if($this->getSplitPayment()->canPay())
|
28 |
+
$this->_addButton('payNow', array(
|
29 |
+
'label' => Mage::helper('adminhtml')->__('Pay now'),
|
30 |
+
'onclick' => 'run(\''.$this->getUrl('*/*/payNow', array('_current'=>true,'back'=>'edit')).'\')',
|
31 |
+
'class' => 'go',
|
32 |
+
), -120);
|
33 |
+
|
34 |
+
$this->_formScripts[] = "
|
35 |
+
function saveAndContinueEdit(){
|
36 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
37 |
+
}
|
38 |
+
|
39 |
+
function run(url){
|
40 |
+
editForm.submit(url);
|
41 |
+
}
|
42 |
+
";
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Retrieve SplitPayment model object
|
47 |
+
*
|
48 |
+
* @return Allopass_Hipay_Model_SplitPayment
|
49 |
+
*/
|
50 |
+
public function getSplitPayment()
|
51 |
+
{
|
52 |
+
return Mage::registry('split_payment');
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Edit/Form.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Allopass_Hipay_Block_Adminhtml_SplitPayment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _prepareForm()
|
7 |
+
{
|
8 |
+
/* @var $profile Allopass_Hipay_Model_SplitPayment */
|
9 |
+
$splitPayment = Mage::registry('split_payment');
|
10 |
+
|
11 |
+
$form = new Varien_Data_Form(array('id'=>'edit_form','action' =>$this->getUrl('*/splitPayment/save'), 'method' => 'post'));
|
12 |
+
|
13 |
+
$fieldset = $form->addFieldset('splitPayment_form', array('legend'=>Mage::helper('hipay')->__('Split Payment')));
|
14 |
+
|
15 |
+
if ($splitPayment->getSplitPaymentId()) {
|
16 |
+
$fieldset->addField('split_payment_id', 'hidden', array(
|
17 |
+
'name' => 'split_payment_id',
|
18 |
+
));
|
19 |
+
}
|
20 |
+
$fieldset->addField('real_order_id', 'text', array(
|
21 |
+
'label' => Mage::helper('sales')->__('Order #'),
|
22 |
+
'title' => Mage::helper('sales')->__('Order #'),
|
23 |
+
'class' => 'required-entry',
|
24 |
+
'required' => true,
|
25 |
+
'name' => 'real_order_id',
|
26 |
+
'readonly' => true,
|
27 |
+
));
|
28 |
+
|
29 |
+
$fieldset->addField('customer_id', 'text', array(
|
30 |
+
'label' => Mage::helper('customer')->__('Customer ID'),
|
31 |
+
'title' => Mage::helper('customer')->__('Customer ID'),
|
32 |
+
'class' => 'required-entry',
|
33 |
+
'required' => true,
|
34 |
+
'name' => 'customer_id',
|
35 |
+
'readonly' => true,
|
36 |
+
));
|
37 |
+
|
38 |
+
$fieldset->addField('card_token', 'text', array(
|
39 |
+
'label' => Mage::helper('hipay')->__('Card Token'),
|
40 |
+
'title' => Mage::helper('hipay')->__('Card Token'),
|
41 |
+
'class' => 'required-entry',
|
42 |
+
'required' => true,
|
43 |
+
'name' => 'card_token',
|
44 |
+
));
|
45 |
+
|
46 |
+
$fieldset->addField('total_amount', 'text', array(
|
47 |
+
'label' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
48 |
+
'title' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
49 |
+
'class' => 'required-entry validate-number',
|
50 |
+
'required' => true,
|
51 |
+
'name' => 'total_amount',
|
52 |
+
'readonly' => true,
|
53 |
+
));
|
54 |
+
|
55 |
+
$fieldset->addField('amount_to_pay', 'text', array(
|
56 |
+
'label' => Mage::helper('hipay')->__('Amount to pay'),
|
57 |
+
'title' => Mage::helper('hipay')->__('Amount to pay'),
|
58 |
+
'class' => 'required-entry validate-number',
|
59 |
+
'required' => true,
|
60 |
+
'name' => 'amount_to_pay',
|
61 |
+
));
|
62 |
+
|
63 |
+
$fieldset->addField('date_to_pay', 'date', array(
|
64 |
+
'label' => Mage::helper('hipay')->__('Date to pay'),
|
65 |
+
'title' => Mage::helper('hipay')->__('Date to pay'),
|
66 |
+
'class' => 'required-entry',
|
67 |
+
'required' => true,
|
68 |
+
'name' => 'date_to_pay',
|
69 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
70 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
71 |
+
));
|
72 |
+
|
73 |
+
$fieldset->addField('attempts', 'text', array(
|
74 |
+
'label' => Mage::helper('hipay')->__('Attempts'),
|
75 |
+
'title' => Mage::helper('hipay')->__('Attempts'),
|
76 |
+
'class' => 'required-entry validate-number',
|
77 |
+
'required' => true,
|
78 |
+
'name' => 'attempts',
|
79 |
+
'readonly' => true,
|
80 |
+
));
|
81 |
+
|
82 |
+
$fieldset->addField('status', 'select', array(
|
83 |
+
'label' => Mage::helper('hipay')->__('Status'),
|
84 |
+
'title' => Mage::helper('hipay')->__('Status'),
|
85 |
+
'name' => 'status',
|
86 |
+
'values' => Allopass_Hipay_Model_SplitPayment::getStatues(),
|
87 |
+
)
|
88 |
+
);
|
89 |
+
|
90 |
+
$form->setUseContainer(true);
|
91 |
+
$form->setValues($splitPayment->getData());
|
92 |
+
$this->setForm($form);
|
93 |
+
return parent::_prepareForm();
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/SplitPayment/Grid.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_SplitPayment_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
protected $_defaultSort = 'split_payment_id';
|
5 |
+
|
6 |
+
protected function _prepareCollection()
|
7 |
+
{
|
8 |
+
|
9 |
+
$collection = Mage::getModel('hipay/splitPayment')->getCollection();
|
10 |
+
$this->setCollection($collection);
|
11 |
+
parent::_prepareCollection();
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
|
16 |
+
protected function _prepareColumns()
|
17 |
+
{
|
18 |
+
|
19 |
+
|
20 |
+
$this->addColumn('split_payment_id',
|
21 |
+
array(
|
22 |
+
'header'=> Mage::helper('hipay')->__('ID'),
|
23 |
+
'width' => '50px',
|
24 |
+
'type' => 'number',
|
25 |
+
'index' => 'split_payment_id',
|
26 |
+
));
|
27 |
+
$this->addColumn('real_order_id',
|
28 |
+
array(
|
29 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
30 |
+
'type' => 'text',
|
31 |
+
'width'=>'20px',
|
32 |
+
'index' => 'real_order_id',
|
33 |
+
));
|
34 |
+
|
35 |
+
$this->addColumn('customer_id',
|
36 |
+
array(
|
37 |
+
'header'=> Mage::helper('customer')->__('Customer ID'),
|
38 |
+
'type' => 'text',
|
39 |
+
'width'=>'20px',
|
40 |
+
'index' => 'customer_id',
|
41 |
+
));
|
42 |
+
|
43 |
+
$this->addColumn('card_token',
|
44 |
+
array(
|
45 |
+
'header'=> Mage::helper('hipay')->__('Card Token'),
|
46 |
+
'type' => 'text',
|
47 |
+
'width'=>'60px',
|
48 |
+
'index' => 'card_token',
|
49 |
+
));
|
50 |
+
|
51 |
+
|
52 |
+
$this->addColumn('total_amount',
|
53 |
+
array(
|
54 |
+
'header'=> Mage::helper('sales')->__('G.T. (Purchased)'),
|
55 |
+
'index' => 'total_amount',
|
56 |
+
'type' => 'currency',
|
57 |
+
));
|
58 |
+
|
59 |
+
|
60 |
+
$this->addColumn('amount_to_pay',
|
61 |
+
array(
|
62 |
+
'header'=> Mage::helper('hipay')->__('Amount to pay'),
|
63 |
+
'type' => 'currency',
|
64 |
+
'index' => 'amount_to_pay',
|
65 |
+
));
|
66 |
+
|
67 |
+
$this->addColumn('date_to_pay',
|
68 |
+
array(
|
69 |
+
'header'=> Mage::helper('hipay')->__('Date to pay'),
|
70 |
+
'type' => 'date',
|
71 |
+
'index' => 'date_to_pay',
|
72 |
+
));
|
73 |
+
|
74 |
+
$this->addColumn('attempts',
|
75 |
+
array(
|
76 |
+
'header'=> Mage::helper('hipay')->__('Attempts'),
|
77 |
+
'index' => 'attempts',
|
78 |
+
'type' => 'number',
|
79 |
+
));
|
80 |
+
|
81 |
+
$this->addColumn('status',
|
82 |
+
array(
|
83 |
+
'header'=> Mage::helper('hipay')->__('Status'),
|
84 |
+
'index' => 'status',
|
85 |
+
'type' => 'options',
|
86 |
+
'options' => Allopass_Hipay_Model_SplitPayment::getStatues(),
|
87 |
+
));
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
return parent::_prepareColumns();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Row click url
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
*/
|
99 |
+
public function getRowUrl($row)
|
100 |
+
{
|
101 |
+
return $this->getUrl('*/*/edit', array('split_payment_id' => $row->getId()));
|
102 |
+
}
|
103 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/3dsRule.php
CHANGED
@@ -29,12 +29,17 @@ class Allopass_Hipay_Block_Adminhtml_System_Config_Form_Field_3dsRule extends M
|
|
29 |
*/
|
30 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
{
|
|
|
32 |
$partsId = explode("_", $element->getId());
|
33 |
$method_code = $partsId[1]. "_" . $partsId[2];
|
34 |
$rule = Mage::getModel('hipay/rule');
|
35 |
$rule->setMethodCode($method_code);
|
|
|
36 |
if($element->getValue())
|
37 |
$rule->load($element->getValue());
|
|
|
|
|
|
|
38 |
|
39 |
$element->setRule($rule);
|
40 |
|
29 |
*/
|
30 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
{
|
32 |
+
|
33 |
$partsId = explode("_", $element->getId());
|
34 |
$method_code = $partsId[1]. "_" . $partsId[2];
|
35 |
$rule = Mage::getModel('hipay/rule');
|
36 |
$rule->setMethodCode($method_code);
|
37 |
+
|
38 |
if($element->getValue())
|
39 |
$rule->load($element->getValue());
|
40 |
+
|
41 |
+
if($rule->getConfigPath() == "")
|
42 |
+
$rule->setConfigPath($element->getId());
|
43 |
|
44 |
$element->setRule($rule);
|
45 |
|
app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/Allowsplitpayment.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Allopass_Hipay_Block_Adminhtml_System_Config_Form_Field_Allowsplitpayment extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
12 |
+
{
|
13 |
+
$javaScript = "
|
14 |
+
<script type=\"text/javascript\">
|
15 |
+
Event.observe('{$element->getId()}', 'change', function(){
|
16 |
+
split_payment=$('{$element->getId()}').value;
|
17 |
+
$('{$this->_getSplitPaymentElementId($element)}').disabled = (!split_payment || split_payment!=1);
|
18 |
+
});
|
19 |
+
</script>";
|
20 |
+
|
21 |
+
$element->setData('after_element_html',$javaScript.$element->getAfterElementHtml());
|
22 |
+
|
23 |
+
$this->toggleDisabled($element);
|
24 |
+
|
25 |
+
return parent::_getElementHtml($element);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function toggleDisabled($element)
|
29 |
+
{
|
30 |
+
if(!$element->getValue() || $element->getValue()!=1) {
|
31 |
+
|
32 |
+
$element->getForm()->getElement($this->_getSplitPaymentElementId($element))->setDisabled('disabled');
|
33 |
+
}
|
34 |
+
return parent::getHtml();
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function _getSplitPaymentElementId($element)
|
38 |
+
{
|
39 |
+
return substr($element->getId(), 0, strrpos($element->getId(), 'allow_split_payment')) . 'split_payment_profile';
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
app/code/community/Allopass/Hipay/Block/Adminhtml/System/Config/Form/Field/MultiselectSortable.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Adminhtml_System_Config_Form_Field_MultiselectSortable extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$javaScript = "
|
13 |
+
<script type=\"text/javascript\">
|
14 |
+
var options = $$(\"#row_".$element->getHtmlId()." ul.checkboxes li\");
|
15 |
+
options.each(function(e){
|
16 |
+
var input = e.select('input').first();
|
17 |
+
input.name = input.name + '[]';
|
18 |
+
|
19 |
+
var label = e.select('label').first();
|
20 |
+
label.setStyle({cursor:'move'});
|
21 |
+
label.writeAttribute('for',false);
|
22 |
+
|
23 |
+
});
|
24 |
+
/*$$(\"#row_".$element->getHtmlId()." ul.checkboxes li input\").each(function(e,i)
|
25 |
+
{
|
26 |
+
e.name = e.name + '[]';
|
27 |
+
});
|
28 |
+
|
29 |
+
$$(\"#row_".$element->getHtmlId()." ul.checkboxes li label\").each(function(e,i)
|
30 |
+
{
|
31 |
+
e.setStyle({cursor:'move'});
|
32 |
+
e.writeAttribute({for}:'');
|
33 |
+
});*/
|
34 |
+
|
35 |
+
|
36 |
+
//Sortable.create('".$element->getHtmlId()."',{elements:$$('#".$element->getHtmlId()." option'),handles:$$('#".$element->getHtmlId()." option')});
|
37 |
+
var container = $$(\"#row_".$element->getHtmlId()." ul.checkboxes\").first();
|
38 |
+
Sortable.create(container);
|
39 |
+
</script>";
|
40 |
+
$element->setData('after_element_html',$javaScript.$element->getAfterElementHtml());
|
41 |
+
|
42 |
+
return parent::_getElementHtml($element);
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
}
|
app/code/community/Allopass/Hipay/Block/Card.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Allopass_Hipay_Block_Card extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setTemplate('hipay/card/account.phtml');
|
10 |
+
|
11 |
+
$cards = Mage::getResourceModel('hipay/card_collection')
|
12 |
+
->addFieldToSelect('*')
|
13 |
+
->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
|
14 |
+
->addFieldToFilter('cc_status', Allopass_Hipay_Model_Card::STATUS_ENABLED)
|
15 |
+
->setOrder('card_id', 'desc')
|
16 |
+
;
|
17 |
+
|
18 |
+
$this->setCards($cards);
|
19 |
+
|
20 |
+
Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('hipay')->__("Hipay's Cards"));
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _prepareLayout()
|
24 |
+
{
|
25 |
+
parent::_prepareLayout();
|
26 |
+
|
27 |
+
$pager = $this->getLayout()->createBlock('page/html_pager', 'hipay.card.account.pager')
|
28 |
+
->setCollection($this->getCards());
|
29 |
+
$this->setChild('pager', $pager);
|
30 |
+
$this->getCards()->load();
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getPagerHtml()
|
35 |
+
{
|
36 |
+
return $this->getChildHtml('pager');
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getEditUrl($card)
|
40 |
+
{
|
41 |
+
return $this->getUrl('*/*/edit', array('card_id' => $card->getId()));
|
42 |
+
}
|
43 |
+
|
44 |
+
public function canDelete()
|
45 |
+
{
|
46 |
+
return true;
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
public function getDeleteUrl($card)
|
51 |
+
{
|
52 |
+
return $this->getUrl('*/*/delete', array('card_id' => $card->getId()));
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getBackUrl()
|
56 |
+
{
|
57 |
+
return $this->getUrl('customer/account/');
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Allopass/Hipay/Block/Card/Edit.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Allopass_Hipay_Block_Card_Edit extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
protected $_card;
|
5 |
+
|
6 |
+
protected function _prepareLayout()
|
7 |
+
{
|
8 |
+
parent::_prepareLayout();
|
9 |
+
$this->_card = Mage::registry('current_card');
|
10 |
+
|
11 |
+
|
12 |
+
if ($headBlock = $this->getLayout()->getBlock('head')) {
|
13 |
+
$headBlock->setTitle($this->getTitle());
|
14 |
+
}
|
15 |
+
|
16 |
+
if ($postedData = Mage::getSingleton('customer/session')->getCardFormData(true)) {
|
17 |
+
$this->_card->addData($postedData);
|
18 |
+
}
|
19 |
+
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getCard()
|
24 |
+
{
|
25 |
+
return $this->_card;
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
public function getBackUrl()
|
30 |
+
{
|
31 |
+
if ($this->getData('back_url')) {
|
32 |
+
return $this->getData('back_url');
|
33 |
+
}
|
34 |
+
|
35 |
+
return $this->getUrl('hipay/card');
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getSaveUrl()
|
40 |
+
{
|
41 |
+
return Mage::getUrl('hipay/card/editPost', array('_secure'=>true, 'id'=>$this->getCard()->getId()));
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/Allopass/Hipay/Block/Form/Abstract.php
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
<?php
|
2 |
abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_Form
|
3 |
{
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
/**
|
6 |
* Retrieve payment configuration object
|
@@ -11,14 +16,50 @@ abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_For
|
|
11 |
{
|
12 |
return Mage::getSingleton('hipay/config');
|
13 |
}
|
14 |
-
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public function getCustomerHasAlias()
|
17 |
{
|
18 |
return $this->getCustomer()->getHipayAliasOneclick() != "";
|
19 |
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
public function getCustomer()
|
23 |
{
|
24 |
return Mage::getSingleton('customer/session')->getCustomer();
|
@@ -29,6 +70,11 @@ abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_For
|
|
29 |
return $this->helper('hipay')->checkIfCcExpDateIsValid((int)Mage::getSingleton('customer/session')->getCustomerId());
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
32 |
public function oneClickIsAllowed()
|
33 |
{
|
34 |
$checkoutMethod = Mage::getSingleton('checkout/session')->getQuote()->getCheckoutMethod();
|
@@ -40,15 +86,59 @@ abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_For
|
|
40 |
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
43 |
public function getQuote()
|
44 |
{
|
45 |
return Mage::getSingleton('checkout/session')->getQuote();
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
{
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
public function getIframeConfig()
|
@@ -56,6 +146,7 @@ abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_For
|
|
56 |
$iframe['iframe_width'] = $this->getMethod()->getConfigData('iframe_width');
|
57 |
$iframe['iframe_height'] = $this->getMethod()->getConfigData('iframe_height');
|
58 |
$iframe['iframe_style'] = $this->getMethod()->getConfigData('iframe_style');
|
|
|
59 |
return $iframe;
|
60 |
}
|
61 |
|
1 |
<?php
|
2 |
abstract class Allopass_Hipay_Block_Form_Abstract extends Mage_Payment_Block_Form
|
3 |
{
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @var Allopass_Hipay_Model_Resource_Card_Collection
|
7 |
+
*/
|
8 |
+
protected $_cards = null;
|
9 |
|
10 |
/**
|
11 |
* Retrieve payment configuration object
|
16 |
{
|
17 |
return Mage::getSingleton('hipay/config');
|
18 |
}
|
|
|
19 |
|
20 |
+
public function getCards()
|
21 |
+
{
|
22 |
+
if(is_null($this->_cards))
|
23 |
+
{
|
24 |
+
$today = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
|
25 |
+
|
26 |
+
$currentYear = (int)$today->getYear()->toString("YY");
|
27 |
+
$currentMonth = (int)$today->getMonth()->toString("MM");
|
28 |
+
|
29 |
+
$this->_cards = Mage::getResourceModel('hipay/card_collection')
|
30 |
+
->addFieldToSelect('*')
|
31 |
+
->addFieldToFilter('customer_id', $this->getCustomer()->getId())
|
32 |
+
->addFieldToFilter('cc_status', Allopass_Hipay_Model_Card::STATUS_ENABLED)
|
33 |
+
->addFieldToFilter('cc_exp_year', array("gteq"=>$currentYear))
|
34 |
+
->setOrder('card_id', 'desc')
|
35 |
+
->setOrder('is_default', 'desc');
|
36 |
+
|
37 |
+
foreach ($this->_cards as $card)
|
38 |
+
{
|
39 |
+
if($card->ccExpYear == $currentYear && $currentMonth < $card->ccExpMonth)
|
40 |
+
$this->_cards->removeItemByKey($card->getId());
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
return $this->_cards;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @deprecated since v1.0.9
|
49 |
+
* @return boolean
|
50 |
+
*/
|
51 |
public function getCustomerHasAlias()
|
52 |
{
|
53 |
return $this->getCustomer()->getHipayAliasOneclick() != "";
|
54 |
|
55 |
}
|
56 |
|
57 |
+
public function getCustomerHasCard()
|
58 |
+
{
|
59 |
+
return $this->getCards()->count() > 0;
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
public function getCustomer()
|
64 |
{
|
65 |
return Mage::getSingleton('customer/session')->getCustomer();
|
70 |
return $this->helper('hipay')->checkIfCcExpDateIsValid((int)Mage::getSingleton('customer/session')->getCustomerId());
|
71 |
}
|
72 |
|
73 |
+
/**
|
74 |
+
* If checkout method is GUEST oneclick is not allowed
|
75 |
+
* Or We check method configuration
|
76 |
+
* @return boolean
|
77 |
+
*/
|
78 |
public function oneClickIsAllowed()
|
79 |
{
|
80 |
$checkoutMethod = Mage::getSingleton('checkout/session')->getQuote()->getCheckoutMethod();
|
86 |
|
87 |
}
|
88 |
|
89 |
+
/**
|
90 |
+
* @return Mage_Sales_Model_Quote
|
91 |
+
*
|
92 |
+
* */
|
93 |
public function getQuote()
|
94 |
{
|
95 |
return Mage::getSingleton('checkout/session')->getQuote();
|
96 |
}
|
97 |
|
98 |
+
public function allowSplitPayment()
|
99 |
+
{
|
100 |
+
|
101 |
+
$checkoutMethod = $this->getQuote()->getCheckoutMethod();
|
102 |
+
$minAmount = $this->getMethod()->getConfigData('min_order_total_split_payment');
|
103 |
+
|
104 |
+
if($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST ||
|
105 |
+
!$this->getMethod()->getConfigData('allow_split_payment') ||
|
106 |
+
($this->getMethod()->getConfigData('allow_split_payment') && !empty($minAmount) && $minAmount >= $this->getQuote()->getBaseGrandTotal() ))
|
107 |
+
return false;
|
108 |
+
|
109 |
+
return true;
|
110 |
+
}
|
111 |
+
|
112 |
+
public function getSplitPaymentProfiles()
|
113 |
+
{
|
114 |
+
$profileIds = explode(",", $this->getMethod()->getConfigData('split_payment_profile'));
|
115 |
+
$profiles = Mage::getModel('hipay/paymentProfile')->getCollection()->addIdsToFilter($profileIds);
|
116 |
+
return $profiles;
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
|
121 |
+
protected function allowUseOneClick()
|
122 |
{
|
123 |
+
switch ((int)$this->getMethod()->getConfigData('allow_use_oneclick')) {
|
124 |
+
case 0:
|
125 |
+
return false;
|
126 |
+
|
127 |
+
case 1:
|
128 |
+
/* @var $rule Allopass_Hipay_Model_Rule */
|
129 |
+
|
130 |
+
$rule = Mage::getModel('hipay/rule')->load($this->getMethod()->getConfigData('filter_oneclick'));
|
131 |
+
if($rule->getId())
|
132 |
+
{
|
133 |
+
/*$objToValidate = new Varien_Object();
|
134 |
+
$objToValidate->setQuoteId($this->getQuote()->getId());
|
135 |
+
$objToValidate->setQuote($this->getQuote());
|
136 |
+
$objToValidate->setCreatedAt($this->getQuote()->getCreatedAt());*/
|
137 |
+
return (int)$rule->validate($this->getQuote());
|
138 |
+
}
|
139 |
+
return true;
|
140 |
+
|
141 |
+
}
|
142 |
}
|
143 |
|
144 |
public function getIframeConfig()
|
146 |
$iframe['iframe_width'] = $this->getMethod()->getConfigData('iframe_width');
|
147 |
$iframe['iframe_height'] = $this->getMethod()->getConfigData('iframe_height');
|
148 |
$iframe['iframe_style'] = $this->getMethod()->getConfigData('iframe_style');
|
149 |
+
$iframe['iframe_wrapper_style'] = $this->getMethod()->getConfigData('iframe_style');
|
150 |
return $iframe;
|
151 |
}
|
152 |
|
app/code/community/Allopass/Hipay/Block/Form/Cc.php
CHANGED
@@ -20,11 +20,25 @@ class Allopass_Hipay_Block_Form_Cc extends Allopass_Hipay_Block_Form_Abstract
|
|
20 |
$availableTypes = $method->getConfigData('cctypes');
|
21 |
if ($availableTypes) {
|
22 |
$availableTypes = explode(',', $availableTypes);
|
|
|
|
|
|
|
23 |
foreach ($types as $code=>$name) {
|
24 |
if (!in_array($code, $availableTypes)) {
|
25 |
unset($types[$code]);
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
|
|
|
|
|
|
28 |
}
|
29 |
}
|
30 |
return $types;
|
20 |
$availableTypes = $method->getConfigData('cctypes');
|
21 |
if ($availableTypes) {
|
22 |
$availableTypes = explode(',', $availableTypes);
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
foreach ($types as $code=>$name) {
|
27 |
if (!in_array($code, $availableTypes)) {
|
28 |
unset($types[$code]);
|
29 |
}
|
30 |
+
|
31 |
+
}
|
32 |
+
$ordered = array();
|
33 |
+
foreach($availableTypes as $key) {
|
34 |
+
if(array_key_exists($key,$types)) {
|
35 |
+
$ordered[$key] = $types[$key];
|
36 |
+
unset($types[$key]);
|
37 |
+
}
|
38 |
}
|
39 |
+
return $ordered;
|
40 |
+
|
41 |
+
//todo order $types
|
42 |
}
|
43 |
}
|
44 |
return $types;
|
app/code/community/Allopass/Hipay/Block/Info/Cc.php
CHANGED
@@ -5,6 +5,13 @@
|
|
5 |
*/
|
6 |
class Allopass_Hipay_Block_Info_Cc extends Mage_Payment_Block_Info
|
7 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
/**
|
9 |
* Retrieve credit card type name
|
10 |
*
|
@@ -76,6 +83,13 @@ class Allopass_Hipay_Block_Info_Cc extends Mage_Payment_Block_Info
|
|
76 |
if ($this->getInfo()->getCcLast4()) {
|
77 |
$data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
if (!$this->getIsSecureMode()) {
|
80 |
if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
|
81 |
$data[Mage::helper('payment')->__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
|
5 |
*/
|
6 |
class Allopass_Hipay_Block_Info_Cc extends Mage_Payment_Block_Info
|
7 |
{
|
8 |
+
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
parent::_construct();
|
12 |
+
$this->setTemplate('hipay/info/cc.phtml');
|
13 |
+
}
|
14 |
+
|
15 |
/**
|
16 |
* Retrieve credit card type name
|
17 |
*
|
83 |
if ($this->getInfo()->getCcLast4()) {
|
84 |
$data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
|
85 |
}
|
86 |
+
|
87 |
+
if($this->getInfo()->getAdditionalInformation('fraud_type') && $this->getInfo()->getAdditionalInformation('fraud_score'))
|
88 |
+
{
|
89 |
+
$data[Mage::helper('hipay')->__('Fraud result')] = ucfirst($this->getInfo()->getAdditionalInformation('fraud_type'));
|
90 |
+
$data[Mage::helper('hipay')->__('Fraud scoring')] = $this->getInfo()->getAdditionalInformation('fraud_score');
|
91 |
+
}
|
92 |
+
|
93 |
if (!$this->getIsSecureMode()) {
|
94 |
if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
|
95 |
$data[Mage::helper('payment')->__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
|
app/code/community/Allopass/Hipay/Block/Info/Hosted.php
CHANGED
@@ -5,5 +5,54 @@
|
|
5 |
*/
|
6 |
class Allopass_Hipay_Block_Info_Hosted extends Mage_Payment_Block_Info
|
7 |
{
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
}
|
5 |
*/
|
6 |
class Allopass_Hipay_Block_Info_Hosted extends Mage_Payment_Block_Info
|
7 |
{
|
8 |
+
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
parent::_construct();
|
12 |
+
$this->setTemplate('hipay/info/cc.phtml');
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Retrieve credit card type name
|
17 |
+
*
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
public function getCcTypeName()
|
21 |
+
{
|
22 |
+
$types = Mage::getSingleton('payment/config')->getCcTypes();
|
23 |
+
$ccType = $this->getInfo()->getCcType();
|
24 |
+
if (isset($types[$ccType])) {
|
25 |
+
return $types[$ccType];
|
26 |
+
}
|
27 |
+
return (empty($ccType)) ? Mage::helper('payment')->__('N/A') : $ccType;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Prepare credit card related payment info
|
32 |
+
*
|
33 |
+
* @param Varien_Object|array $transport
|
34 |
+
* @return Varien_Object
|
35 |
+
*/
|
36 |
+
protected function _prepareSpecificInformation($transport = null)
|
37 |
+
{
|
38 |
+
if (null !== $this->_paymentSpecificInformation) {
|
39 |
+
return $this->_paymentSpecificInformation;
|
40 |
+
}
|
41 |
+
$transport = parent::_prepareSpecificInformation($transport);
|
42 |
+
$data = array();
|
43 |
+
if ($ccType = $this->getCcTypeName()) {
|
44 |
+
$data[Mage::helper('payment')->__('Credit Card Type')] = $ccType;
|
45 |
+
}
|
46 |
+
if ($this->getInfo()->getCcLast4()) {
|
47 |
+
$data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
|
48 |
+
}
|
49 |
+
|
50 |
+
if($this->getInfo()->getAdditionalInformation('fraud_type') && $this->getInfo()->getAdditionalInformation('fraud_score'))
|
51 |
+
{
|
52 |
+
$data[Mage::helper('hipay')->__('Fraud result')] = ucfirst($this->getInfo()->getAdditionalInformation('fraud_type'));
|
53 |
+
$data[Mage::helper('hipay')->__('Fraud scoring')] = $this->getInfo()->getAdditionalInformation('fraud_score');
|
54 |
+
}
|
55 |
+
|
56 |
+
return $transport->setData(array_merge($data, $transport->getData()));
|
57 |
+
}
|
58 |
}
|
app/code/community/Allopass/Hipay/Controller/Payment.php
CHANGED
@@ -13,22 +13,9 @@ class Allopass_Hipay_Controller_Payment extends Mage_Core_Controller_Front_Actio
|
|
13 |
*/
|
14 |
public function preDispatch() {
|
15 |
parent::preDispatch();
|
16 |
-
|
17 |
-
if (!$this->_validateSignature()) {
|
18 |
-
$this->getResponse()->setBody("NOK. Wrong Signature!");
|
19 |
-
$this->setFlag('', 'no-dispatch', true);
|
20 |
-
}
|
21 |
-
}
|
22 |
-
|
23 |
-
|
24 |
-
protected function _validateSignature()
|
25 |
-
{
|
26 |
-
return true;
|
27 |
-
/* @var $_helper Allopass_Hipay_Helper_Data */
|
28 |
-
$_helper = Mage::helper('hipay');
|
29 |
-
$signature = $this->getRequest()->getParam('hash');
|
30 |
-
return $_helper->checkSignature($signature);
|
31 |
}
|
|
|
32 |
|
33 |
/**
|
34 |
*
|
@@ -43,6 +30,7 @@ class Allopass_Hipay_Controller_Payment extends Mage_Core_Controller_Front_Actio
|
|
43 |
{
|
44 |
$order = $this->getOrder();
|
45 |
$payment = $order->getPayment();
|
|
|
46 |
$methodInstance = $this->_getMethodInstance();
|
47 |
|
48 |
try
|
@@ -92,6 +80,15 @@ class Allopass_Hipay_Controller_Payment extends Mage_Core_Controller_Front_Actio
|
|
92 |
$profile->save();
|
93 |
}
|
94 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
/*else
|
97 |
{
|
@@ -113,6 +110,11 @@ class Allopass_Hipay_Controller_Payment extends Mage_Core_Controller_Front_Actio
|
|
113 |
|
114 |
public function declineAction()
|
115 |
{
|
|
|
|
|
|
|
|
|
|
|
116 |
$this->processResponse();
|
117 |
$this->_redirect('checkout/onepage/failure');
|
118 |
return $this;
|
@@ -121,6 +123,12 @@ class Allopass_Hipay_Controller_Payment extends Mage_Core_Controller_Front_Actio
|
|
121 |
|
122 |
public function exceptionAction()
|
123 |
{
|
|
|