Smart2Pay - Version 1.1.6

Version Notes

- Support to provide a surcharge fee per each payment method as a percent or a fixed amount
- Added Demo environment in order to help merchants to quickly have a working payment flow through our demo platform

Download this release

Release Info

Developer Stefan Iancu
Extension Smart2Pay
Version 1.1.6
Comparing to
See all releases


Code changes from version 1.1.5 to 1.1.6

Files changed (141) hide show
  1. app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php +76 -0
  2. app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/Sales/Order/Invoice/Total.php +80 -0
  3. app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/Sales/Order/Total.php +76 -0
  4. app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/System/Config/Configuredmethods.php +82 -0
  5. app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/System/Config/Fieldset/Simple.php +83 -0
  6. app/code/community/Smart2Pay/Globalpay/Block/Info.php +3 -3
  7. app/code/community/Smart2Pay/Globalpay/Block/Info/Globalpay.php +165 -38
  8. app/code/community/Smart2Pay/Globalpay/Block/Paymethod/Form.php +20 -5
  9. app/code/community/Smart2Pay/Globalpay/Block/Paymethod/Sendform.php +31 -14
  10. app/code/community/Smart2Pay/Globalpay/Block/Sales/Order/Creditmemo/Totals.php +76 -0
  11. app/code/community/Smart2Pay/Globalpay/Block/Sales/Order/Invoice/Total.php +80 -0
  12. app/code/community/Smart2Pay/Globalpay/Block/Sales/Order/Total.php +76 -0
  13. app/code/community/Smart2Pay/Globalpay/Block/Sales/Pdf/Surcharge.php +52 -0
  14. app/code/community/Smart2Pay/Globalpay/Helper/Data.php +9 -1
  15. app/code/community/Smart2Pay/Globalpay/Helper/Helper.php +189 -0
  16. app/code/community/Smart2Pay/Globalpay/Model/Adminhtml/System/Config/Backend/Configuredmethods.php +136 -0
  17. app/code/community/Smart2Pay/Globalpay/Model/Configuredmethods.php +324 -0
  18. app/code/community/Smart2Pay/Globalpay/Model/Country.php +1 -1
  19. app/code/community/Smart2Pay/Globalpay/Model/Countrymethod.php +2 -1
  20. app/code/community/Smart2Pay/Globalpay/Model/GlobalpayLog.php +2 -4
  21. app/code/community/Smart2Pay/Globalpay/Model/Pay.php +88 -6
  22. app/code/community/Smart2Pay/Globalpay/Model/Resource/Configuredmethods.php +88 -0
  23. app/code/community/Smart2Pay/Globalpay/Model/Resource/Configuredmethods/Collection.php +9 -0
  24. app/code/community/Smart2Pay/Globalpay/Model/Resource/Countrymethod/Collection.php +5 -4
  25. app/code/community/Smart2Pay/Globalpay/Model/Resource/Method/Collection.php +5 -3
  26. app/code/community/Smart2Pay/Globalpay/Model/Resource/Setup.php +2 -1
  27. app/code/community/Smart2Pay/Globalpay/Model/Sales/Observer.php +157 -0
  28. app/code/community/Smart2Pay/Globalpay/Model/Sales/Order/Invoice/Total/Surcharge.php +65 -0
  29. app/code/community/Smart2Pay/Globalpay/Model/Sales/Pdf/Surcharge.php +67 -0
  30. app/code/community/Smart2Pay/Globalpay/Model/Sales/Quote/Address/Total/Surcharge.php +110 -0
  31. app/code/community/Smart2Pay/Globalpay/Model/Source/Testlive.php +2 -0
  32. app/code/community/Smart2Pay/Globalpay/Model/Transactionlogger.php +27 -7
  33. app/code/community/Smart2Pay/Globalpay/controllers/IndexController.php +46 -25
  34. app/code/community/Smart2Pay/Globalpay/etc/config.xml +228 -1
  35. app/code/community/Smart2Pay/Globalpay/etc/system.xml +412 -233
  36. app/code/community/Smart2Pay/Globalpay/sql/globalpay_setup/mysql4-upgrade-1.1.5-1.1.6.php +65 -0
  37. app/design/adminhtml/default/default/layout/globalpay.xml +71 -0
  38. app/design/adminhtml/default/default/template/smart2pay/globalpay/info.phtml +0 -3
  39. app/design/adminhtml/default/default/template/smart2pay/globalpay/methodinfo.phtml +11 -2
  40. app/design/adminhtml/default/default/template/smart2pay/globalpay/methodinfopdf.phtml +14 -16
  41. app/design/adminhtml/default/default/template/smart2pay/globalpay/paymentinstructions.phtml +0 -115
  42. app/design/adminhtml/default/default/template/smart2pay/globalpay/paymethod/form.phtml +0 -212
  43. app/design/adminhtml/default/default/template/smart2pay/globalpay/paymethod/sendform.phtml +0 -230
  44. app/design/adminhtml/default/default/template/smart2pay/globalpay/system/config/methods.phtml +134 -0
  45. app/design/frontend/base/default/layout/globalpay.xml +52 -0
  46. app/design/frontend/base/default/template/smart2pay/globalpay/methodinfo.phtml +11 -2
  47. app/design/frontend/base/default/template/smart2pay/globalpay/methodinfopdf.phtml +0 -17
  48. app/design/frontend/base/default/template/smart2pay/globalpay/paymethod/form.phtml +49 -9
  49. app/design/frontend/base/default/template/smart2pay/globalpay/paymethod/sendform.phtml +4 -0
  50. app/locale/en_GB/Smart2Pay_Globalpay.csv +3 -2
  51. app/locale/en_US/Smart2Pay_Globalpay.csv +2 -1
  52. package.xml +6 -5
  53. skin/adminhtml/default/default/images/smart2pay/methods/7-Eleven.gif +0 -0
  54. skin/adminhtml/default/default/images/smart2pay/methods/IXe.gif +0 -0
  55. skin/adminhtml/default/default/images/smart2pay/methods/abaqoos.png +0 -0
  56. skin/adminhtml/default/default/images/smart2pay/methods/ach.png +0 -0
  57. skin/adminhtml/default/default/images/smart2pay/methods/alipay.png +0 -0
  58. skin/adminhtml/default/default/images/smart2pay/methods/alliance_online.gif +0 -0
  59. skin/adminhtml/default/default/images/smart2pay/methods/ambank_group.png +0 -0
  60. skin/adminhtml/default/default/images/smart2pay/methods/american_express.png +0 -0
  61. skin/adminhtml/default/default/images/smart2pay/methods/argentina_banks.png +0 -0
  62. skin/adminhtml/default/default/images/smart2pay/methods/banco_do_brasil.gif +0 -0
  63. skin/adminhtml/default/default/images/smart2pay/methods/bancomer.png +0 -0
  64. skin/adminhtml/default/default/images/smart2pay/methods/bank_transfer_logo_v6.png +0 -0
  65. skin/adminhtml/default/default/images/smart2pay/methods/beeline.png +0 -0
  66. skin/adminhtml/default/default/images/smart2pay/methods/bitcoin.png +0 -0
  67. skin/adminhtml/default/default/images/smart2pay/methods/boleto_bancario.png +0 -0
  68. skin/adminhtml/default/default/images/smart2pay/methods/bradesco_transferencia.png +0 -0
  69. skin/adminhtml/default/default/images/smart2pay/methods/cards_brl.gif +0 -0
  70. skin/adminhtml/default/default/images/smart2pay/methods/cards_colombia.gif +0 -0
  71. skin/adminhtml/default/default/images/smart2pay/methods/cashinyandex.gif +0 -0
  72. skin/adminhtml/default/default/images/smart2pay/methods/cashu.png +0 -0
  73. skin/adminhtml/default/default/images/smart2pay/methods/cimb_clicks.png +0 -0
  74. skin/adminhtml/default/default/images/smart2pay/methods/counter-service-thailand_paysbuy-cash.png +0 -0
  75. skin/adminhtml/default/default/images/smart2pay/methods/cuentadigital.png +0 -0
  76. skin/adminhtml/default/default/images/smart2pay/methods/danske_bank.png +0 -0
  77. skin/adminhtml/default/default/images/smart2pay/methods/debito_bradesco.png +0 -0
  78. skin/adminhtml/default/default/images/smart2pay/methods/dineromail.png +0 -0
  79. skin/adminhtml/default/default/images/smart2pay/methods/dp24_sofort.png +0 -0
  80. skin/adminhtml/default/default/images/smart2pay/methods/dragon_pay.png +0 -0
  81. skin/adminhtml/default/default/images/smart2pay/methods/eKonto.png +0 -0
  82. skin/adminhtml/default/default/images/smart2pay/methods/enets.png +0 -0
  83. skin/adminhtml/default/default/images/smart2pay/methods/eps-e-payment-standard.png +0 -0
  84. skin/adminhtml/default/default/images/smart2pay/methods/fpx.png +0 -0
  85. skin/adminhtml/default/default/images/smart2pay/methods/giropay.png +0 -0
  86. skin/adminhtml/default/default/images/smart2pay/methods/hong_leong.png +0 -0
  87. skin/adminhtml/default/default/images/smart2pay/methods/ideal.png +0 -0
  88. skin/adminhtml/default/default/images/smart2pay/methods/mandiri.png +0 -0
  89. skin/adminhtml/default/default/images/smart2pay/methods/mangir_cart.gif +0 -0
  90. skin/adminhtml/default/default/images/smart2pay/methods/maybank2u.png +0 -0
  91. skin/adminhtml/default/default/images/smart2pay/methods/mazooma.png +0 -0
  92. skin/adminhtml/default/default/images/smart2pay/methods/megafon.png +0 -0
  93. skin/adminhtml/default/default/images/smart2pay/methods/meps_cash.png +0 -0
  94. skin/adminhtml/default/default/images/smart2pay/methods/mercadopago.png +0 -0
  95. skin/adminhtml/default/default/images/smart2pay/methods/mobile_money.png +0 -0
  96. skin/adminhtml/default/default/images/smart2pay/methods/moneta.png +0 -0
  97. skin/adminhtml/default/default/images/smart2pay/methods/mozca.png +0 -0
  98. skin/adminhtml/default/default/images/smart2pay/methods/mrcash.png +0 -0
  99. skin/adminhtml/default/default/images/smart2pay/methods/mtcpay.png +0 -0
  100. skin/adminhtml/default/default/images/smart2pay/methods/mts.gif +0 -0
  101. skin/adminhtml/default/default/images/smart2pay/methods/mybank.png +0 -0
  102. skin/adminhtml/default/default/images/smart2pay/methods/nordea.png +0 -0
  103. skin/adminhtml/default/default/images/smart2pay/methods/onecard.png +0 -0
  104. skin/adminhtml/default/default/images/smart2pay/methods/online_banking_thailanda.png +0 -0
  105. skin/adminhtml/default/default/images/smart2pay/methods/op-pohjola.png +0 -0
  106. skin/adminhtml/default/default/images/smart2pay/methods/oxxo.gif +0 -0
  107. skin/adminhtml/default/default/images/smart2pay/methods/p24.png +0 -0
  108. skin/adminhtml/default/default/images/smart2pay/methods/pago_efectivo.gif +0 -0
  109. skin/adminhtml/default/default/images/smart2pay/methods/pagos_en_efectivo_servipag_bci_chile.png +0 -0
  110. skin/adminhtml/default/default/images/smart2pay/methods/pagtotal.png +0 -0
  111. skin/adminhtml/default/default/images/smart2pay/methods/payeasy.png +0 -0
  112. skin/adminhtml/default/default/images/smart2pay/methods/payment_references.png +0 -0
  113. skin/adminhtml/default/default/images/smart2pay/methods/payment_via_baloto.png +0 -0
  114. skin/adminhtml/default/default/images/smart2pay/methods/paypal.png +0 -0
  115. skin/adminhtml/default/default/images/smart2pay/methods/paysafecard.png +0 -0
  116. skin/adminhtml/default/default/images/smart2pay/methods/paysbuy.png +0 -0
  117. skin/adminhtml/default/default/images/smart2pay/methods/paysbuy_wallet.png +0 -0
  118. skin/adminhtml/default/default/images/smart2pay/methods/paysera.gif +0 -0
  119. skin/adminhtml/default/default/images/smart2pay/methods/paytrail.gif +0 -0
  120. skin/adminhtml/default/default/images/smart2pay/methods/poli.png +0 -0
  121. skin/adminhtml/default/default/images/smart2pay/methods/pse.png +0 -0
  122. skin/adminhtml/default/default/images/smart2pay/methods/pwmb.png +0 -0
  123. skin/adminhtml/default/default/images/smart2pay/methods/qiwi_wallet.png +0 -0
  124. skin/adminhtml/default/default/images/smart2pay/methods/rhb.png +0 -0
  125. skin/adminhtml/default/default/images/smart2pay/methods/s2p_cards.gif +0 -0
  126. skin/adminhtml/default/default/images/smart2pay/methods/santander.gif +0 -0
  127. skin/adminhtml/default/default/images/smart2pay/methods/scotiabank.gif +0 -0
  128. skin/adminhtml/default/default/images/smart2pay/methods/servipag.png +0 -0
  129. skin/adminhtml/default/default/images/smart2pay/methods/sibs_mb.png +0 -0
  130. skin/adminhtml/default/default/images/smart2pay/methods/tenpay.png +0 -0
  131. skin/adminhtml/default/default/images/smart2pay/methods/todito_cash.png +0 -0
  132. skin/adminhtml/default/default/images/smart2pay/methods/trustly.png +0 -0
  133. skin/adminhtml/default/default/images/smart2pay/methods/trustpay.png +0 -0
  134. skin/adminhtml/default/default/images/smart2pay/methods/ukash.png +0 -0
  135. skin/adminhtml/default/default/images/smart2pay/methods/umb.png +0 -0
  136. skin/adminhtml/default/default/images/smart2pay/methods/web_cash.gif +0 -0
  137. skin/adminhtml/default/default/images/smart2pay/methods/webmoney.png +0 -0
  138. skin/adminhtml/default/default/images/smart2pay/methods/xltunai.png +0 -0
  139. skin/adminhtml/default/default/images/smart2pay/methods/yandex.png +0 -0
  140. skin/adminhtml/default/default/images/smart2pay/methods/yandex_money.png +0 -0
  141. skin/frontend/base/default/images/smart2pay/methods/cashinyandex.gif +0 -0
app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Block_Adminhtml_Sales_Order_Creditmemo_Totals extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Add totals for surcharge
46
+ *
47
+ * @return Smart2Pay_Globalpay_Block_Sales_Order_Total
48
+ */
49
+ public function initTotals()
50
+ {
51
+ if( ($payment_obj = $this->getOrder()->getPayment())
52
+ and ((float)$payment_obj->getS2pSurchargeAmount() != 0 or (float)$payment_obj->getS2pSurchargeFixedAmount() != 0) )
53
+ {
54
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
55
+ $helper_obj = Mage::helper('globalpay/helper');
56
+
57
+ //$source = $this->getSource();
58
+ $amount = $payment_obj->getS2pSurchargeAmount();
59
+ $fixed_amount = $payment_obj->getS2pSurchargeFixedAmount();
60
+ $base_amount = $payment_obj->getS2pSurchargeBaseAmount();
61
+ $base_fixed_amount = $payment_obj->getS2pSurchargeFixedBaseAmount();
62
+ $percent = $payment_obj->getS2pSurchargePercent();
63
+
64
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
65
+ 'code' => 'globalpay',
66
+ 'strong' => false,
67
+ 'label' => $helper_obj->format_surcharge_label( $amount, $percent ),
68
+ 'value' => $helper_obj->format_surcharge_value( $amount + $fixed_amount, $percent ),
69
+ 'base_value' => $helper_obj->format_surcharge_value( $base_amount + $base_fixed_amount, $percent ),
70
+ 'area' => 'footer',
71
+ )), 'shipping');
72
+ }
73
+
74
+ return $this;
75
+ }
76
+ }
app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/Sales/Order/Invoice/Total.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Block_Adminhtml_Sales_Order_Invoice_Total extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Add totals for surcharge
46
+ *
47
+ * @return Smart2Pay_Globalpay_Block_Adminhtml_Sales_Order_Invoice_Total
48
+ */
49
+ public function initTotals()
50
+ {
51
+ /** @var Mage_Adminhtml_Block_Sales_Order_Invoice_View_Form $parent_block */
52
+ $parent_block = $this->getParentBlock();
53
+
54
+ if( ($invoice_obj = $parent_block->getInvoice())
55
+ and ($order_payment_obj = $parent_block->getOrder()->getPayment())
56
+ and ((float)$invoice_obj->getS2pSurchargeAmount() != 0 or (float)$invoice_obj->getS2pSurchargeFixedAmount() != 0) )
57
+ {
58
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
59
+ $helper_obj = Mage::helper('globalpay/helper');
60
+
61
+ //$source = $this->getSource();
62
+ $amount = $invoice_obj->getS2pSurchargeAmount();
63
+ $fixed_amount = $invoice_obj->getS2pSurchargeFixedAmount();
64
+ $base_amount = $invoice_obj->getS2pSurchargeBaseAmount();
65
+ $base_fixed_amount = $invoice_obj->getS2pSurchargeFixedBaseAmount();
66
+ $percent = $order_payment_obj->getS2pSurchargePercent();
67
+
68
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
69
+ 'code' => 'globalpay',
70
+ 'strong' => false,
71
+ 'label' => $helper_obj->format_surcharge_label( $amount, $percent ),
72
+ 'value' => $helper_obj->format_surcharge_value( $amount + $fixed_amount, $percent ),
73
+ 'base_value' => $helper_obj->format_surcharge_value( $base_amount + $base_fixed_amount, $percent ),
74
+ 'area' => 'footer',
75
+ )), 'shipping');
76
+ }
77
+
78
+ return $this;
79
+ }
80
+ }
app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/Sales/Order/Total.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Block_Adminhtml_Sales_Order_Total extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Add totals for surcharge
46
+ *
47
+ * @return Smart2Pay_Globalpay_Block_Sales_Order_Total
48
+ */
49
+ public function initTotals()
50
+ {
51
+ if( ($payment_obj = $this->getOrder()->getPayment())
52
+ and ((float)$payment_obj->getS2pSurchargeAmount() != 0 or (float)$payment_obj->getS2pSurchargeFixedAmount() != 0) )
53
+ {
54
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
55
+ $helper_obj = Mage::helper('globalpay/helper');
56
+
57
+ //$source = $this->getSource();
58
+ $amount = $payment_obj->getS2pSurchargeAmount();
59
+ $fixed_amount = $payment_obj->getS2pSurchargeFixedAmount();
60
+ $base_amount = $payment_obj->getS2pSurchargeBaseAmount();
61
+ $base_fixed_amount = $payment_obj->getS2pSurchargeFixedBaseAmount();
62
+ $percent = $payment_obj->getS2pSurchargePercent();
63
+
64
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
65
+ 'code' => 'globalpay',
66
+ 'strong' => false,
67
+ 'label' => $helper_obj->format_surcharge_label( $amount, $percent ),
68
+ 'value' => $helper_obj->format_surcharge_value( $amount + $fixed_amount, $percent ),
69
+ 'base_value' => $helper_obj->format_surcharge_value( $base_amount + $base_fixed_amount, $percent ),
70
+ 'area' => 'footer',
71
+ )), 'shipping');
72
+ }
73
+
74
+ return $this;
75
+ }
76
+ }
app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/System/Config/Configuredmethods.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Block_Adminhtml_System_Config_Configuredmethods extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
4
+ {
5
+ /**
6
+ * @var string
7
+ */
8
+ protected $_wizardTemplate = 'smart2pay/globalpay/system/config/methods.phtml';
9
+ protected $_code = 'globalpay';
10
+
11
+ public $base_currency;
12
+
13
+ function __construct( array $args = array() )
14
+ {
15
+ parent::__construct( $args );
16
+
17
+ $this->base_currency = Mage::app()->getBaseCurrencyCode();
18
+ }
19
+
20
+ /**
21
+ * Set template to itself
22
+ */
23
+ protected function _prepareLayout()
24
+ {
25
+ parent::_prepareLayout();
26
+
27
+ if (!$this->getTemplate()) {
28
+ $this->setTemplate($this->_wizardTemplate);
29
+ }
30
+
31
+ return $this;
32
+ }
33
+
34
+ /**
35
+ * Unset some non-related element parameters
36
+ *
37
+ * @param Varien_Data_Form_Element_Abstract $element
38
+ * @return string
39
+ */
40
+ public function render(Varien_Data_Form_Element_Abstract $element)
41
+ {
42
+ $this->setElement( $element );
43
+
44
+ return $this->_toHtml();
45
+ }
46
+
47
+ /**
48
+ * Get the button and scripts contents
49
+ *
50
+ * @param Varien_Data_Form_Element_Abstract $element
51
+ * @return string
52
+ */
53
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
54
+ {
55
+ $this->setElement( $element );
56
+ return $this->_toHtml();
57
+ }
58
+
59
+ public function get_all_methods()
60
+ {
61
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
62
+ $configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' );
63
+
64
+ return $configured_methods_obj->get_all_methods();
65
+ }
66
+
67
+ public function get_all_configured_methods()
68
+ {
69
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
70
+ $configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' );
71
+
72
+ return $configured_methods_obj->get_all_configured_methods();
73
+ }
74
+
75
+ public function get_countries_for_method( $method_id )
76
+ {
77
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
78
+ $configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' );
79
+
80
+ return $configured_methods_obj->get_countries_for_method( $method_id );
81
+ }
82
+ }
app/code/community/Smart2Pay/Globalpay/Block/Adminhtml/System/Config/Fieldset/Simple.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.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.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Paypal
23
+ * @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Fielset renderer which expanded by default
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Paypal
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Smart2Pay_Globalpay_Block_Adminhtml_System_Config_Fieldset_Simple
35
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
36
+ {
37
+
38
+ /**
39
+ * Return header html for fieldset
40
+ *
41
+ * @param Varien_Data_Form_Element_Abstract $element
42
+ * @return string
43
+ */
44
+ protected function _getHeaderHtml($element)
45
+ {
46
+ if ($element->getIsNested()) {
47
+ $html = '<tr class="nested"><td colspan="4"><div class="' . $this->_getFrontendClass($element) . '">';
48
+ } else {
49
+ $html = '<div class="' . $this->_getFrontendClass($element) . '">';
50
+ }
51
+
52
+ $html .= $this->_getHeaderTitleHtml($element);
53
+
54
+ $html .= '<input id="'.$element->getHtmlId() . '-state" name="config_state[' . $element->getId()
55
+ . ']" type="hidden" value="' . (int)$this->_getCollapseState($element) . '" />';
56
+ $html .= '<fieldset class="' . $this->_getFieldsetCss($element) . '" id="' . $element->getHtmlId() . '">';
57
+ $html .= '<legend>' . $element->getLegend() . '</legend>';
58
+
59
+ $html .= $this->_getHeaderCommentHtml($element);
60
+
61
+ return $html;
62
+ }
63
+
64
+ /**
65
+ * Return footer html for fieldset
66
+ * Add extra tooltip comments to elements
67
+ *
68
+ * @param Varien_Data_Form_Element_Abstract $element
69
+ * @return string
70
+ */
71
+ protected function _getFooterHtml($element)
72
+ {
73
+ $tooltipsExist = false;
74
+ $html = '</fieldset>' . $this->_getExtraJs($element, $tooltipsExist);
75
+
76
+ if ($element->getIsNested()) {
77
+ $html .= '</div></td></tr>';
78
+ } else {
79
+ $html .= '</div>';
80
+ }
81
+ return $html;
82
+ }
83
+ }
app/code/community/Smart2Pay/Globalpay/Block/Info.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class Smart2Pay_Globalpay_Block_Info extends Mage_Core_Block_Template
4
  {
5
- const S2P_STATUS_SUCCESS = 2, S2P_STATUS_CANCELLED = 3, S2P_STATUS_FAILED = 4, S2P_STATUS_EXPIRED = 5, S2P_STATUS_PROCESSING = 7;
6
 
7
  public $message;
8
 
@@ -14,7 +14,7 @@ class Smart2Pay_Globalpay_Block_Info extends Mage_Core_Block_Template
14
 
15
  private function getMessage()
16
  {
17
- /**@var $paymethod Smart2Pay_Globalpay_Model_Pay */
18
  $paymethod = Mage::getModel('globalpay/pay');
19
  $query = $this->getRequest()->getQuery();
20
 
@@ -24,7 +24,7 @@ class Smart2Pay_Globalpay_Block_Info extends Mage_Core_Block_Template
24
  if( empty( $query['data'] ) )
25
  $query['data'] = 0;
26
 
27
- if( in_array( $query['data'], array( self::S2P_STATUS_SUCCESS, self::S2P_STATUS_CANCELLED, self::S2P_STATUS_FAILED, self::S2P_STATUS_PROCESSING ) ) )
28
  return $paymethod->method_config['message_data_' . $query['data']];
29
 
30
  return $paymethod->method_config['message_data_7'];
2
 
3
  class Smart2Pay_Globalpay_Block_Info extends Mage_Core_Block_Template
4
  {
5
+ // const S2P_STATUS_SUCCESS = 2, S2P_STATUS_CANCELLED = 3, S2P_STATUS_FAILED = 4, S2P_STATUS_EXPIRED = 5, S2P_STATUS_PROCESSING = 7;
6
 
7
  public $message;
8
 
14
 
15
  private function getMessage()
16
  {
17
+ /** @var $paymethod Smart2Pay_Globalpay_Model_Pay */
18
  $paymethod = Mage::getModel('globalpay/pay');
19
  $query = $this->getRequest()->getQuery();
20
 
24
  if( empty( $query['data'] ) )
25
  $query['data'] = 0;
26
 
27
+ if( in_array( $query['data'], array( $paymethod::S2P_STATUS_SUCCESS, $paymethod::S2P_STATUS_CANCELLED, $paymethod::S2P_STATUS_FAILED, $paymethod::S2P_STATUS_PROCESSING ) ) )
28
  return $paymethod->method_config['message_data_' . $query['data']];
29
 
30
  return $paymethod->method_config['message_data_7'];
app/code/community/Smart2Pay/Globalpay/Block/Info/Globalpay.php CHANGED
@@ -2,9 +2,11 @@
2
 
3
  class Smart2Pay_Globalpay_Block_Info_Globalpay extends Mage_Payment_Block_Info
4
  {
5
- public function __construct()
 
 
6
  {
7
- parent::__construct();
8
 
9
  $this->setTemplate( 'smart2pay/globalpay/methodinfo.phtml' );
10
  }
@@ -37,32 +39,113 @@ class Smart2Pay_Globalpay_Block_Info_Globalpay extends Mage_Payment_Block_Info
37
 
38
  $transport = parent::_prepareSpecificInformation( $transport );
39
 
40
- /** @var Mage_Sales_Model_Order $order */
41
- $order = Mage::getModel( 'sales/order' );
42
  /** @var Smart2Pay_Globalpay_Helper_Helper $s2pHelper */
43
  $s2pHelper = Mage::helper( 'globalpay/helper' );
44
- /** @var Smart2Pay_Globalpay_Model_Resource_Method_Collection $s2pMethodCollection */
45
- $s2pMethodCollection = Mage::getModel( 'globalpay/method' )->getCollection();
46
  /** @var Smart2Pay_Globalpay_Model_Logger $s2pLogger */
47
  $s2pLogger = Mage::getModel( 'globalpay/logger' );
48
- /** @var Smart2Pay_Globalpay_Model_Transactionlogger $s2pTransactionLogger */
49
- $s2pTransactionLogger = Mage::getModel( 'globalpay/transactionlogger' );
50
 
51
- $no_information_available_arr = array( $this->__( 'No information available' ) => '' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- try
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  {
 
 
 
 
 
 
 
 
 
 
 
 
55
  if( !($info = $this->getInfo())
56
- or empty( $info['entity_id'] )
57
- or !$order->load( $info['entity_id'] )
58
  or !($merchant_transaction_id = $order->getIncrementId()) )
59
- return $this->_paymentSpecificInformation;
60
-
61
- if( !($s2p_transaction_arr = $s2pTransactionLogger->getTransactionDetailsAsArray( $merchant_transaction_id )) )
62
- return $transport->addData( $no_information_available_arr );
63
 
64
  $payment_info_arr = array();
65
 
 
 
 
66
  if( empty( $s2p_transaction_arr['method_id'] ) )
67
  $payment_info_arr['Payment Method'] = 'N/A';
68
 
@@ -81,35 +164,79 @@ class Smart2Pay_Globalpay_Block_Info_Globalpay extends Mage_Payment_Block_Info
81
  $payment_info_arr['Payment Method'] = $method_arr['display_name'];
82
  }
83
 
84
- if( $s2pHelper->isAdmin() )
 
85
  {
86
- $payment_info_arr['PaymentID'] = (!empty($s2p_transaction_arr['payment_id']) ? $s2p_transaction_arr['payment_id'] : 'N/A');
87
- $payment_info_arr['SiteID'] = (!empty($s2p_transaction_arr['site_id']) ? $s2p_transaction_arr['site_id'] : 'N/A');
88
-
89
- if( !empty( $s2p_transaction_arr['created'] ) )
90
- $payment_info_arr['Created'] = $this->formatDate( $s2p_transaction_arr['created'], 'medium', true);
91
- else
92
- $payment_info_arr['Created'] = 'N/A';
93
-
94
- if( !empty( $s2p_transaction_arr['updated'] ) )
95
- $payment_info_arr['Last Update'] = $this->formatDate( $s2p_transaction_arr['updated'], 'medium', true);
96
- else
97
- $payment_info_arr['Last Update'] = 'N/A';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
 
100
- if( !empty( $s2p_transaction_arr['extra_data'] )
101
- and ($extra_data_arr = $s2pHelper->parse_string( $s2p_transaction_arr['extra_data'] )) )
 
 
 
 
 
102
  {
103
- foreach( $extra_data_arr as $key => $val )
104
- $payment_info_arr[$this->__( $key )] = $val;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
 
106
 
 
107
  $transport->addData( $payment_info_arr );
108
- } catch( Exception $e )
109
- {
110
- $s2pLogger->write( 'Exception ('.$e->getMessage().')', 'trans_logger' );
111
- $transport->addData( $no_information_available_arr );
112
- }
113
 
114
  return $transport;
115
  }
2
 
3
  class Smart2Pay_Globalpay_Block_Info_Globalpay extends Mage_Payment_Block_Info
4
  {
5
+ protected $_display_lines = true;
6
+
7
+ public function _construct()
8
  {
9
+ parent::_construct();
10
 
11
  $this->setTemplate( 'smart2pay/globalpay/methodinfo.phtml' );
12
  }
39
 
40
  $transport = parent::_prepareSpecificInformation( $transport );
41
 
42
+ /** @var Smart2Pay_Globalpay_Model_Pay $s2pPayModel */
43
+ $s2pPayModel = Mage::getModel( 'globalpay/pay' );
44
  /** @var Smart2Pay_Globalpay_Helper_Helper $s2pHelper */
45
  $s2pHelper = Mage::helper( 'globalpay/helper' );
 
 
46
  /** @var Smart2Pay_Globalpay_Model_Logger $s2pLogger */
47
  $s2pLogger = Mage::getModel( 'globalpay/logger' );
 
 
48
 
49
+ $controller_module_name = $this->getRequest()->getControllerModule();
50
+ $controller_name = $this->getRequest()->getControllerName();
51
+ $action_name = $this->getRequest()->getActionName();
52
+ $route_name = $this->getRequest()->getRouteName();
53
+ $module_name = $this->getRequest()->getModuleName();
54
+
55
+ //$s2pLogger->write( 'Called from ['.$controller_module_name.']['.$controller_name.']'.
56
+ // '['.$action_name.']['.$route_name.']['.$module_name.']', 'payment_info' );
57
+
58
+ $payment_info_arr = array();
59
+ if( 'onepage' == $controller_name
60
+ and 'checkout' == $module_name )
61
+ {
62
+ // Display details in checkout...
63
+ $this->_display_lines = false;
64
+
65
+ /** @var Mage_Checkout_Model_Session $chkout */
66
+ if( empty( $_SESSION['globalpay_method'] )
67
+ or !($chkout = Mage::getSingleton('checkout/session'))
68
+ or !($quote = $chkout->getQuote())
69
+ or !($billingAddress = $quote->getBillingAddress())
70
+ or !($countryCode = $billingAddress->getCountryId())
71
+ or !($countryId = Mage::getModel('globalpay/country')->load($countryCode, 'code')->getId()) )
72
+ return $transport;
73
+
74
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
75
+ $configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' );
76
+
77
+ $method_arr = false;
78
+ if( ($methods_arr = $configured_methods_obj->get_configured_methods( $countryId, array( 'id_in_index' => true ) ))
79
+ and is_array( $methods_arr )
80
+ and !empty( $methods_arr[$_SESSION['globalpay_method']] ) )
81
+ $method_arr = $methods_arr[$_SESSION['globalpay_method']];
82
+
83
+ if( empty( $method_arr ) )
84
+ $payment_info_arr['Payment Method'] = 'N/A ['.$_SESSION['globalpay_method'].']';
85
+ else
86
+ $payment_info_arr['Payment Method'] = $method_arr['display_name'];
87
+
88
+ $info = $this->getInfo();
89
 
90
+ $surcharge_amount = $info->getS2pSurchargeAmount();
91
+ $surcharge_percent = $info->getS2pSurchargePercent();
92
+ $surcharge_fixed_amount = $info->getS2pSurchargeFixedAmount();
93
+
94
+ if( !empty( $method_arr['surcharge'] ) )
95
+ {
96
+ if( (int)$s2pPayModel->method_config['display_surcharge'] )
97
+ {
98
+ if( ($surcharge_percent_label = $s2pHelper->format_surcharge_percent_label( $surcharge_amount, $surcharge_percent, array( 'use_translate' => false ) )) )
99
+ $payment_info_arr[$surcharge_percent_label] = $s2pHelper->format_surcharge_percent_value( $surcharge_amount, $surcharge_percent );
100
+
101
+ $surcharge_fixed_amount_str = $quote->getStore()->getCurrentCurrency()->format( $surcharge_fixed_amount, array(), false );
102
+
103
+ if( ($surcharge_percent_label = $s2pHelper->format_surcharge_fixed_amount_label( $surcharge_fixed_amount, array( 'use_translate' => false ) )) )
104
+ $payment_info_arr[$surcharge_percent_label] = $s2pHelper->format_surcharge_fixed_amount_value( $surcharge_fixed_amount_str,
105
+ array(
106
+ 'format_price' => false,
107
+ //'include_container' => false,
108
+ //'format_currency' => $quote->getStore()->getCurrentCurrency(),
109
+ ) );
110
+ }
111
+
112
+ $surcharge_total_amount = $surcharge_amount + $surcharge_fixed_amount;
113
+ $surcharge_amount_str = $quote->getStore()->getCurrentCurrency()->format( $surcharge_total_amount, array(), false );
114
+
115
+ if( ($surcharge_amount_label = $s2pHelper->format_surcharge_label( $surcharge_total_amount, $surcharge_percent, array( 'include_percent' => false, 'use_translate' => false ) )) )
116
+ $payment_info_arr[$surcharge_amount_label] = $s2pHelper->format_surcharge_value( $surcharge_amount_str, $surcharge_percent,
117
+ array(
118
+ 'format_price' => false,
119
+ //'include_container' => false,
120
+ //'format_currency' => $quote->getStore()->getCurrentCurrency(),
121
+ ) );
122
+ }
123
+ } else /*if( in_array( $controller_name, array( 'sales_order', 'sales_order_invoice', 'sales_order_shipment', 'sales_order_creditmemo', 'order' ) )
124
+ or $controller_module_name == 'Smart2Pay_Globalpay' ) */
125
  {
126
+ if( $action_name == 'print' )
127
+ $this->_display_lines = false;
128
+
129
+ // display details when in view order...
130
+
131
+ /** @var Mage_Sales_Model_Order $order */
132
+ $order = Mage::getModel( 'sales/order' );
133
+ /** @var Smart2Pay_Globalpay_Model_Resource_Method_Collection $s2pMethodCollection */
134
+ $s2pMethodCollection = Mage::getModel( 'globalpay/method' )->getCollection();
135
+ /** @var Smart2Pay_Globalpay_Model_Transactionlogger $s2pTransactionLogger */
136
+ $s2pTransactionLogger = Mage::getModel( 'globalpay/transactionlogger' );
137
+
138
  if( !($info = $this->getInfo())
139
+ or empty( $info['parent_id'] )
140
+ or !$order->load( $info['parent_id'] )
141
  or !($merchant_transaction_id = $order->getIncrementId()) )
142
+ return $transport;
 
 
 
143
 
144
  $payment_info_arr = array();
145
 
146
+ if( !($s2p_transaction_arr = $s2pTransactionLogger->getTransactionDetailsAsArray( $merchant_transaction_id )) )
147
+ return $transport;
148
+
149
  if( empty( $s2p_transaction_arr['method_id'] ) )
150
  $payment_info_arr['Payment Method'] = 'N/A';
151
 
164
  $payment_info_arr['Payment Method'] = $method_arr['display_name'];
165
  }
166
 
167
+ if( ($payment = $order->getPayment())
168
+ and ($payment->getS2pSurchargeAmount() or $payment->getS2pSurchargeFixedAmount()) )
169
  {
170
+ $surcharge_amount = $payment->getS2pSurchargeAmount();
171
+ $surcharge_percent = $payment->getS2pSurchargePercent();
172
+ $surcharge_fixed_amount = $payment->getS2pSurchargeFixedAmount();
173
+
174
+ if( $s2pHelper->isAdmin()
175
+ or (int)$s2pPayModel->method_config['display_surcharge'] )
176
+ {
177
+ if( ($surcharge_percent_label = $s2pHelper->format_surcharge_percent_label( $surcharge_amount, $surcharge_percent, array( 'use_translate' => false ) )) )
178
+ $payment_info_arr[$surcharge_percent_label] = $s2pHelper->format_surcharge_percent_value( $surcharge_amount, $surcharge_percent );
179
+
180
+ $surcharge_fixed_amount_str = $order->getOrderCurrency()->format( $surcharge_fixed_amount, array(), false );
181
+
182
+ if( ($surcharge_percent_label = $s2pHelper->format_surcharge_fixed_amount_label( $surcharge_fixed_amount, array( 'use_translate' => false ) )) )
183
+ $payment_info_arr[$surcharge_percent_label] = $s2pHelper->format_surcharge_fixed_amount_value( $surcharge_fixed_amount_str,
184
+ array(
185
+ 'format_price' => false,
186
+ //'include_container' => false,
187
+ //'format_currency' => $quote->getStore()->getCurrentCurrency(),
188
+ ) );
189
+ }
190
+
191
+ $surcharge_total_amount = $surcharge_amount + $surcharge_fixed_amount;
192
+ $surcharge_amount_str = $order->getOrderCurrency()->format( $surcharge_total_amount, array(), false );
193
+
194
+ if( ($surcharge_amount_label = $s2pHelper->format_surcharge_label( $surcharge_total_amount, $surcharge_percent, array( 'include_percent' => false, 'use_translate' => false ) )) )
195
+ $payment_info_arr[$surcharge_amount_label] = $s2pHelper->format_surcharge_value( $surcharge_amount_str, $surcharge_percent,
196
+ array(
197
+ 'format_price' => false,
198
+ //'include_container' => false,
199
+ //'format_currency' => $quote->getStore()->getCurrentCurrency(),
200
+ ) );
201
  }
202
 
203
+ if( ($controller_name == 'order'
204
+ and in_array( $action_name, array( 'view' ) ))
205
+ or ($controller_name == 'sales_order'
206
+ and in_array( $action_name, array( 'view', 'email' ) ))
207
+ or ($controller_name == 'sales_order_creditmemo'
208
+ and in_array( $action_name, array( 'new', 'view', 'email' ) ))
209
+ )
210
  {
211
+ if( $s2pHelper->isAdmin() )
212
+ {
213
+ $payment_info_arr['Environment'] = ( ! empty( $s2p_transaction_arr['environment'] ) ? ucfirst( $s2p_transaction_arr['environment'] ): 'N/A' );
214
+ $payment_info_arr['PaymentID'] = ( ! empty( $s2p_transaction_arr['payment_id'] ) ? $s2p_transaction_arr['payment_id'] : 'N/A' );
215
+ $payment_info_arr['SiteID'] = ( ! empty( $s2p_transaction_arr['site_id'] ) ? $s2p_transaction_arr['site_id'] : 'N/A' );
216
+
217
+ if( ! empty( $s2p_transaction_arr['created'] ) )
218
+ $payment_info_arr['Created'] = $this->formatDate( $s2p_transaction_arr['created'], 'medium', true );
219
+ else
220
+ $payment_info_arr['Created'] = 'N/A';
221
+
222
+ if( ! empty( $s2p_transaction_arr['updated'] ) )
223
+ $payment_info_arr['Last Update'] = $this->formatDate( $s2p_transaction_arr['updated'], 'medium', true );
224
+ else
225
+ $payment_info_arr['Last Update'] = 'N/A';
226
+ }
227
+
228
+ if( ! empty( $s2p_transaction_arr['extra_data'] )
229
+ and ( $extra_data_arr = $s2pHelper->parse_string( $s2p_transaction_arr['extra_data'] ) )
230
+ )
231
+ {
232
+ foreach( $extra_data_arr as $key => $val )
233
+ $payment_info_arr[ $this->__( $key ) ] = $val;
234
+ }
235
  }
236
+ }
237
 
238
+ if( !empty( $payment_info_arr ) )
239
  $transport->addData( $payment_info_arr );
 
 
 
 
 
240
 
241
  return $transport;
242
  }
app/code/community/Smart2Pay/Globalpay/Block/Paymethod/Form.php CHANGED
@@ -17,12 +17,25 @@ class Smart2Pay_Globalpay_Block_Paymethod_Form extends Mage_Payment_Block_Form
17
 
18
  public function getPaymentMethods()
19
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  $pay_method = Mage::getModel('globalpay/pay');
21
- $chkout = Mage::getSingleton('checkout/session');
22
- $quote = $chkout->getQuote();
23
- $billingAddress = $quote->getBillingAddress();
24
- $countryCode = $billingAddress->getCountryId();
25
- $countryId = Mage::getModel('globalpay/country')->load($countryCode, 'code')->getId();
26
  $collection = Mage::getModel('globalpay/countrymethod')->getCollection();
27
  $collection->addFieldToSelect('*');
28
  $collection->addFieldToFilter('country_id', array(
@@ -40,5 +53,7 @@ class Smart2Pay_Globalpay_Block_Paymethod_Form extends Mage_Payment_Block_Form
40
  );
41
  $collection->setOrder('priority', 'ASC');
42
  return $collection->getData();
 
 
43
  }
44
  }
17
 
18
  public function getPaymentMethods()
19
  {
20
+ /** @var Mage_Checkout_Model_Session $chkout */
21
+ if( !($chkout = Mage::getSingleton('checkout/session'))
22
+ or !($quote = $chkout->getQuote())
23
+ or !($billingAddress = $quote->getBillingAddress())
24
+ or !($countryCode = $billingAddress->getCountryId())
25
+ or !($countryId = Mage::getModel('globalpay/country')->load($countryCode, 'code')->getId()) )
26
+ return array();
27
+
28
+
29
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
30
+ $configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' );
31
+
32
+ return $configured_methods_obj->get_configured_methods( $countryId );
33
+ /**
34
+ *
35
+ * OLD way...
36
+ *
37
  $pay_method = Mage::getModel('globalpay/pay');
38
+
 
 
 
 
39
  $collection = Mage::getModel('globalpay/countrymethod')->getCollection();
40
  $collection->addFieldToSelect('*');
41
  $collection->addFieldToFilter('country_id', array(
53
  );
54
  $collection->setOrder('priority', 'ASC');
55
  return $collection->getData();
56
+ *
57
+ **/
58
  }
59
  }
app/code/community/Smart2Pay/Globalpay/Block/Paymethod/Sendform.php CHANGED
@@ -14,41 +14,57 @@ class Smart2Pay_Globalpay_Block_Paymethod_Sendform extends Mage_Core_Block_Templ
14
  $s2pLogger = Mage::getModel( 'globalpay/logger' );
15
  /** @var Smart2Pay_Globalpay_Model_Transactionlogger $s2pTransactionLogger */
16
  $s2pTransactionLogger = Mage::getModel( 'globalpay/transactionlogger' );
17
-
18
  /** @var Smart2Pay_Globalpay_Model_Pay $paymentModel */
19
  $paymentModel = Mage::getModel('globalpay/pay');
 
 
 
20
  $order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
 
21
  /** @var Mage_Sales_Model_Order $order */
22
  $order = Mage::getModel('sales/order');
23
- $order->load($order_id);
24
- $order_id = $order->getRealOrderId();
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  // FORM DATA
27
  $this->form_data = $paymentModel->method_config;
28
 
 
 
29
  if( !empty( $_SESSION['globalpay_method'] ) )
30
  $this->form_data['method_id'] = $_SESSION['globalpay_method'];
31
  else
32
  $this->form_data['method_id'] = 0;
33
 
34
- $this->form_data['order_id'] = $order_id;
35
  $this->form_data['currency'] = $order->getOrderCurrency()->getCurrencyCode();
36
- $this->form_data['amount'] = number_format($order->getGrandTotal(), 2, '.', '') * 100;
37
 
38
  //anonymous user, get the info from billing details
39
  if( $order->getCustomerId() === NULL )
40
  {
41
- $this->form_data['customer_last_name'] = substr(trim($order->getBillingAddress()->getLastname()),0,30);
42
- $this->form_data['customer_first_name'] = substr(trim($order->getBillingAddress()->getFirstname()),0,30);
43
- $this->form_data['customer_name'] = substr(trim($this->form_data['customer_first_name'] . ' ' . $this->form_data['customer_last_name']),0,30);
44
  }
45
  //else, they're a normal registered user.
46
  else
47
  {
48
  $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
49
- $this->form_data['customer_name'] = substr(trim($order->getCustomerName()),0,30);
50
- $this->form_data['customer_last_name'] = substr(trim($customer->getDefaultBillingAddress()->getLastname()),0,30);
51
- $this->form_data['customer_first_name'] = substr(trim($customer->getDefaultBillingAddress()->getFirstname()),0,30);
52
  }
53
 
54
  $this->form_data['customer_email'] = trim($order->getCustomerEmail());
@@ -95,7 +111,7 @@ class Smart2Pay_Globalpay_Block_Paymethod_Sendform extends Mage_Core_Block_Templ
95
 
96
  $s2pLogger->write( 'Form hash: ['.$messageToHash.']', 'info' );
97
 
98
- $this->form_data['hash'] = Mage::helper( 'globalpay/helper' )->computeSHA256Hash( $messageToHash );
99
 
100
  $this->message_to_hash = $messageToHash;
101
  $this->hash = $this->form_data['hash'];
@@ -103,10 +119,11 @@ class Smart2Pay_Globalpay_Block_Paymethod_Sendform extends Mage_Core_Block_Templ
103
  $s2p_transaction_arr = array();
104
  if( !empty( $this->form_data['method_id'] ) )
105
  $s2p_transaction_arr['method_id'] = $this->form_data['method_id'];
106
- if( !empty( $order_id ) )
107
- $s2p_transaction_arr['merchant_transaction_id'] = $order_id;
108
  if( !empty( $this->form_data['site_id'] ) )
109
  $s2p_transaction_arr['site_id'] = $this->form_data['site_id'];
 
110
 
111
  $s2pTransactionLogger->write( $s2p_transaction_arr );
112
 
14
  $s2pLogger = Mage::getModel( 'globalpay/logger' );
15
  /** @var Smart2Pay_Globalpay_Model_Transactionlogger $s2pTransactionLogger */
16
  $s2pTransactionLogger = Mage::getModel( 'globalpay/transactionlogger' );
 
17
  /** @var Smart2Pay_Globalpay_Model_Pay $paymentModel */
18
  $paymentModel = Mage::getModel('globalpay/pay');
19
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
20
+ $helper_obj = Mage::helper( 'globalpay/helper' );
21
+
22
  $order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
23
+
24
  /** @var Mage_Sales_Model_Order $order */
25
  $order = Mage::getModel('sales/order');
26
+
27
+
28
+ $order->load( $order_id );
29
+
30
+ $merchant_transaction_id = $order->getRealOrderId();
31
+
32
+ // assume live environment if we don't get something valid from config
33
+ $environment = (!empty( $paymentModel->method_config['environment'] )?strtolower( trim( $paymentModel->method_config['environment'] ) ):'live');
34
+
35
+ if( $environment == 'demo' )
36
+ {
37
+ $merchant_transaction_id = base_convert( time(), 10, 36 ).'_'.$merchant_transaction_id;
38
+ }
39
 
40
  // FORM DATA
41
  $this->form_data = $paymentModel->method_config;
42
 
43
+ $this->form_data['environment'] = $environment;
44
+
45
  if( !empty( $_SESSION['globalpay_method'] ) )
46
  $this->form_data['method_id'] = $_SESSION['globalpay_method'];
47
  else
48
  $this->form_data['method_id'] = 0;
49
 
50
+ $this->form_data['order_id'] = $merchant_transaction_id;
51
  $this->form_data['currency'] = $order->getOrderCurrency()->getCurrencyCode();
52
+ $this->form_data['amount'] = number_format( $order->getGrandTotal(), 2, '.', '' ) * 100;
53
 
54
  //anonymous user, get the info from billing details
55
  if( $order->getCustomerId() === NULL )
56
  {
57
+ $this->form_data['customer_last_name'] = $helper_obj->s2p_mb_substr( $order->getBillingAddress()->getLastname(), 0, 30 );
58
+ $this->form_data['customer_first_name'] = $helper_obj->s2p_mb_substr( $order->getBillingAddress()->getFirstname(), 0, 30 );
59
+ $this->form_data['customer_name'] = $helper_obj->s2p_mb_substr( $this->form_data['customer_first_name'] . ' ' . $this->form_data['customer_last_name'], 0, 30 );
60
  }
61
  //else, they're a normal registered user.
62
  else
63
  {
64
  $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
65
+ $this->form_data['customer_name'] = $helper_obj->s2p_mb_substr( $order->getCustomerName(), 0, 30 );
66
+ $this->form_data['customer_last_name'] = $helper_obj->s2p_mb_substr( $customer->getDefaultBillingAddress()->getLastname(), 0, 30 );
67
+ $this->form_data['customer_first_name'] = $helper_obj->s2p_mb_substr( $customer->getDefaultBillingAddress()->getFirstname(), 0, 30 );
68
  }
69
 
70
  $this->form_data['customer_email'] = trim($order->getCustomerEmail());
111
 
112
  $s2pLogger->write( 'Form hash: ['.$messageToHash.']', 'info' );
113
 
114
+ $this->form_data['hash'] = $helper_obj->computeSHA256Hash( $messageToHash );
115
 
116
  $this->message_to_hash = $messageToHash;
117
  $this->hash = $this->form_data['hash'];
119
  $s2p_transaction_arr = array();
120
  if( !empty( $this->form_data['method_id'] ) )
121
  $s2p_transaction_arr['method_id'] = $this->form_data['method_id'];
122
+ if( !empty( $merchant_transaction_id ) )
123
+ $s2p_transaction_arr['merchant_transaction_id'] = $merchant_transaction_id;
124
  if( !empty( $this->form_data['site_id'] ) )
125
  $s2p_transaction_arr['site_id'] = $this->form_data['site_id'];
126
+ $s2p_transaction_arr['environment'] = $environment;
127
 
128
  $s2pTransactionLogger->write( $s2p_transaction_arr );
129
 
app/code/community/Smart2Pay/Globalpay/Block/Sales/Order/Creditmemo/Totals.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Block_Sales_Order_Creditmemo_Totals extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Add totals for surcharge
46
+ *
47
+ * @return Smart2Pay_Globalpay_Block_Sales_Order_Total
48
+ */
49
+ public function initTotals()
50
+ {
51
+ if( ($payment_obj = $this->getOrder()->getPayment())
52
+ and ((float)$payment_obj->getS2pSurchargeAmount() != 0 or (float)$payment_obj->getS2pSurchargeFixedAmount() != 0) )
53
+ {
54
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
55
+ $helper_obj = Mage::helper('globalpay/helper');
56
+
57
+ //$source = $this->getSource();
58
+ $amount = $payment_obj->getS2pSurchargeAmount();
59
+ $fixed_amount = $payment_obj->getS2pSurchargeFixedAmount();
60
+ $base_amount = $payment_obj->getS2pSurchargeBaseAmount();
61
+ $base_fixed_amount = $payment_obj->getS2pSurchargeFixedBaseAmount();
62
+ $percent = $payment_obj->getS2pSurchargePercent();
63
+
64
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
65
+ 'code' => 'globalpay',
66
+ 'strong' => false,
67
+ 'label' => $helper_obj->format_surcharge_label( $amount, $percent ),
68
+ 'value' => $helper_obj->format_surcharge_value( $amount + $fixed_amount, $percent ),
69
+ 'base_value' => $helper_obj->format_surcharge_value( $base_amount + $base_fixed_amount, $percent ),
70
+ 'area' => 'footer',
71
+ )), 'shipping');
72
+ }
73
+
74
+ return $this;
75
+ }
76
+ }
app/code/community/Smart2Pay/Globalpay/Block/Sales/Order/Invoice/Total.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Block_Sales_Order_Invoice_Total extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Add totals for surcharge
46
+ *
47
+ * @return Smart2Pay_Globalpay_Block_Adminhtml_Sales_Order_Invoice_Total
48
+ */
49
+ public function initTotals()
50
+ {
51
+ /** @var Mage_Adminhtml_Block_Sales_Order_Invoice_View_Form $parent_block */
52
+ $parent_block = $this->getParentBlock();
53
+
54
+ if( ($invoice_obj = $parent_block->getInvoice())
55
+ and ($order_payment_obj = $parent_block->getOrder()->getPayment())
56
+ and ((float)$invoice_obj->getS2pSurchargeAmount() != 0 or (float)$invoice_obj->getS2pSurchargeFixedAmount() != 0) )
57
+ {
58
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
59
+ $helper_obj = Mage::helper('globalpay/helper');
60
+
61
+ //$source = $this->getSource();
62
+ $amount = $invoice_obj->getS2pSurchargeAmount();
63
+ $fixed_amount = $invoice_obj->getS2pSurchargeFixedAmount();
64
+ $base_amount = $invoice_obj->getS2pSurchargeBaseAmount();
65
+ $base_fixed_amount = $invoice_obj->getS2pSurchargeFixedBaseAmount();
66
+ $percent = $order_payment_obj->getS2pSurchargePercent();
67
+
68
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
69
+ 'code' => 'globalpay',
70
+ 'strong' => false,
71
+ 'label' => $helper_obj->format_surcharge_label( $amount, $percent ),
72
+ 'value' => $helper_obj->format_surcharge_value( $amount + $fixed_amount, $percent ),
73
+ 'base_value' => $helper_obj->format_surcharge_value( $base_amount + $base_fixed_amount, $percent ),
74
+ 'area' => 'footer',
75
+ )), 'shipping');
76
+ }
77
+
78
+ return $this;
79
+ }
80
+ }
app/code/community/Smart2Pay/Globalpay/Block/Sales/Order/Total.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Block_Sales_Order_Total extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Initialize reward points totals
46
+ *
47
+ * @return Smart2Pay_Globalpay_Block_Sales_Order_Total
48
+ */
49
+ public function initTotals()
50
+ {
51
+ if( ($payment_obj = $this->getOrder()->getPayment())
52
+ and ((float)$payment_obj->getS2pSurchargeAmount() != 0 or (float)$payment_obj->getS2pSurchargeFixedAmount() != 0) )
53
+ {
54
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
55
+ $helper_obj = Mage::helper('globalpay/helper');
56
+
57
+ //$source = $this->getSource();
58
+ $amount = $payment_obj->getS2pSurchargeAmount();
59
+ $fixed_amount = $payment_obj->getS2pSurchargeFixedAmount();
60
+ $base_amount = $payment_obj->getS2pSurchargeBaseAmount();
61
+ $base_fixed_amount = $payment_obj->getS2pSurchargeFixedBaseAmount();
62
+ $percent = $payment_obj->getS2pSurchargePercent();
63
+
64
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
65
+ 'code' => 'globalpay',
66
+ 'strong' => false,
67
+ 'label' => $helper_obj->format_surcharge_label( $amount, $percent ),
68
+ 'value' => $helper_obj->format_surcharge_value( $amount + $fixed_amount, $percent ),
69
+ 'base_value' => $helper_obj->format_surcharge_value( $base_amount + $base_fixed_amount, $percent ),
70
+ 'area' => 'footer',
71
+ )), 'shipping' );
72
+ }
73
+
74
+ return $this;
75
+ }
76
+ }
app/code/community/Smart2Pay/Globalpay/Block/Sales/Pdf/Surcharge.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Model_Sales_Pdf_Surcharge extends Mage_Sales_Model_Order_Pdf_Total_Default
4
+ {
5
+
6
+ /**
7
+ * Check if we can display total information in PDF
8
+ *
9
+ * @return bool
10
+ */
11
+ public function canDisplay()
12
+ {
13
+ //$amount = $this->getAmount();
14
+ //return $this->getDisplayZero() || ($amount != 0);
15
+ return true;
16
+ }
17
+
18
+ /**
19
+ * Get Total amount from source
20
+ *
21
+ * @return float
22
+ */
23
+ public function getAmount()
24
+ {
25
+ return $this->getSource()->getDataUsingMethod($this->getSourceField());
26
+ }
27
+
28
+ /**
29
+ * Check if tax amount should be included to grandtotal block
30
+ * array(
31
+ * $index => array(
32
+ * 'amount' => $amount,
33
+ * 'label' => $label,
34
+ * 'font_size'=> $font_size
35
+ * )
36
+ * )
37
+ * @return array
38
+ */
39
+ public function getTotalsForDisplay()
40
+ {
41
+ $source = $this->getSource();
42
+
43
+ $totals = array();
44
+ $totals['label'] = '['.get_class( $source ).']';
45
+ $totals['amount'] = 0;
46
+ $totals['font_size'] = ($this->getFontSize() ? $this->getFontSize() : 7);
47
+
48
+ return $totals;
49
+ }
50
+
51
+
52
+ }
app/code/community/Smart2Pay/Globalpay/Helper/Data.php CHANGED
@@ -1,7 +1,15 @@
1
  <?php
2
 
3
- class Smart2Pay_Globalpay_Helper_Data extends Mage_Payment_Helper_Data
4
  {
 
 
 
 
 
 
 
 
5
  public function computeSHA256Hash( $message )
6
  {
7
  if( function_exists( 'mb_strtolower' ) )
1
  <?php
2
 
3
+ class Smart2Pay_Globalpay_Helper_Data extends Mage_Payment_Helper_Data
4
  {
5
+ public function s2p_mb_substr( $message, $start, $length )
6
+ {
7
+ if( function_exists( 'mb_substr' ) )
8
+ return mb_substr( $message, $start, $length, 'UTF-8' );
9
+ else
10
+ return substr( $message, $start, $length );
11
+ }
12
+
13
  public function computeSHA256Hash( $message )
14
  {
15
  if( function_exists( 'mb_strtolower' ) )
app/code/community/Smart2Pay/Globalpay/Helper/Helper.php CHANGED
@@ -2,6 +2,68 @@
2
 
3
  class Smart2Pay_Globalpay_Helper_Helper extends Mage_Core_Helper_Abstract
4
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  public function isAdmin()
6
  {
7
  if( Mage::app()->getStore()->isAdmin()
@@ -11,6 +73,133 @@ class Smart2Pay_Globalpay_Helper_Helper extends Mage_Core_Helper_Abstract
11
  return false;
12
  }
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  public function computeSHA256Hash( $message )
15
  {
16
  if( function_exists( 'mb_strtolower' ) )
2
 
3
  class Smart2Pay_Globalpay_Helper_Helper extends Mage_Core_Helper_Abstract
4
  {
5
+ public function mage_exception( $code, $messages_arr )
6
+ {
7
+ if( is_string( $messages_arr ) )
8
+ $messages_arr = array( Mage_Core_Model_Message::ERROR => $messages_arr );
9
+
10
+ if( empty( $code ) )
11
+ $code = -1;
12
+
13
+ if( empty( $messages_arr ) or !is_array( $messages_arr ) )
14
+ return Mage::exception( 'Mage_Core', $this->__( 'Unknown error' ), $code );
15
+
16
+ $exception_obj = new Mage_Core_Exception();
17
+
18
+ $error_types = array( Mage_Core_Model_Message::NOTICE, Mage_Core_Model_Message::WARNING, Mage_Core_Model_Message::ERROR, Mage_Core_Model_Message::SUCCESS );
19
+ $message_factory_obj = new Mage_Core_Model_Message();
20
+ foreach( $error_types as $type )
21
+ {
22
+ if( empty( $messages_arr[$type] ) or !is_array( $messages_arr[$type] ) )
23
+ continue;
24
+
25
+ foreach( $messages_arr[$type] as $message_arr )
26
+ {
27
+ if( is_string( $message_arr ) )
28
+ $message_arr = array( 'message' => $message_arr );
29
+
30
+ if( !is_array( $message_arr ) )
31
+ continue;
32
+
33
+ if( empty( $message_arr['class'] ) )
34
+ $message_arr['class'] = '';
35
+ if( empty( $message_arr['method'] ) )
36
+ $message_arr['method'] = '';
37
+
38
+ $message_obj = false;
39
+ switch( $type )
40
+ {
41
+ case Mage_Core_Model_Message::NOTICE:
42
+ $message_obj = $message_factory_obj->notice( $message_arr['message'], $message_arr['class'], $message_arr['method'] );
43
+ break;
44
+ case Mage_Core_Model_Message::WARNING:
45
+ $message_obj = $message_factory_obj->warning( $message_arr['message'], $message_arr['class'], $message_arr['method'] );
46
+ break;
47
+ case Mage_Core_Model_Message::ERROR:
48
+ $message_obj = $message_factory_obj->error( $message_arr['message'], $message_arr['class'], $message_arr['method'] );
49
+ $exception_obj->setMessage( $message_arr['message'].'<br/>', true );
50
+ break;
51
+ case Mage_Core_Model_Message::SUCCESS:
52
+ $message_obj = $message_factory_obj->success( $message_arr['message'], $message_arr['class'], $message_arr['method'] );
53
+ break;
54
+ }
55
+
56
+ if( empty( $message_obj ) )
57
+ continue;
58
+
59
+ $exception_obj->addMessage( $message_obj );
60
+ }
61
+ }
62
+
63
+
64
+ return $exception_obj;
65
+ }
66
+
67
  public function isAdmin()
68
  {
69
  if( Mage::app()->getStore()->isAdmin()
73
  return false;
74
  }
75
 
76
+ public function s2p_mb_substr( $message, $start, $length )
77
+ {
78
+ if( function_exists( 'mb_substr' ) )
79
+ return mb_substr( $message, $start, $length, 'UTF-8' );
80
+ else
81
+ return substr( $message, $start, $length );
82
+ }
83
+
84
+ public function format_surcharge_fixed_amount_label( $fixed_amount, $params = false )
85
+ {
86
+ if( empty( $params ) or !is_array( $params ) )
87
+ $params = array();
88
+
89
+ if( !isset( $params['use_translate'] ) )
90
+ $params['use_translate'] = true;
91
+
92
+ $label = 'Payment Method Fixed Fee';
93
+
94
+ return (!empty( $params['use_translate'] )?$this->__( $label ):$label);
95
+ }
96
+
97
+ public function format_surcharge_fixed_amount_value( $fixed_amount, $params = false )
98
+ {
99
+ if( empty( $params ) or !is_array( $params ) )
100
+ $params = array();
101
+
102
+ if( empty( $params['format_price'] ) )
103
+ $params['format_price'] = false;
104
+
105
+ if( !empty( $params['format_price'] )
106
+ and (!isset( $params['format_currency'] ) or !($params['format_currency'] instanceof Mage_Directory_Model_Currency)) )
107
+ $params['format_currency'] = Mage::app()->getStore()->getDefaultCurrency();
108
+ else
109
+ $params['format_currency'] = false;
110
+
111
+ if( !isset( $params['include_container'] ) )
112
+ $params['include_container'] = true;
113
+
114
+ if( empty( $params['format_options'] ) or !is_array( $params['format_options'] ) )
115
+ $params['format_options'] = array();
116
+ if( !isset( $params['format_options']['precision'] ) )
117
+ $params['format_options']['precision'] = 2;
118
+
119
+ if( empty( $params['format_price'] )
120
+ or empty( $params['format_currency'] ) )
121
+ $amount_str = $fixed_amount;
122
+
123
+ else
124
+ $amount_str = $params['format_currency']->format( $fixed_amount, $params['format_options'], $params['include_container'] );
125
+
126
+ return $amount_str;
127
+ }
128
+
129
+ public function format_surcharge_percent_label( $amount, $percent, $params = false )
130
+ {
131
+ if( empty( $params ) or !is_array( $params ) )
132
+ $params = array();
133
+
134
+ if( !isset( $params['use_translate'] ) )
135
+ $params['use_translate'] = true;
136
+
137
+ $label = 'Payment Method Percent';
138
+
139
+ return (!empty( $params['use_translate'] )?$this->__( $label ):$label);
140
+ }
141
+
142
+ public function format_surcharge_percent_value( $amount, $percent )
143
+ {
144
+ return $percent.'%';
145
+ }
146
+
147
+ public function format_surcharge_label( $amount, $percent, $params = false )
148
+ {
149
+ if( empty( $params ) or !is_array( $params ) )
150
+ $params = array();
151
+
152
+ if( !isset( $params['include_percent'] ) )
153
+ $params['include_percent'] = true;
154
+ if( !isset( $params['use_translate'] ) )
155
+ $params['use_translate'] = true;
156
+
157
+ if( !empty( $params['use_translate'] ) )
158
+ $label = $this->__( 'Payment Method Fee' );
159
+
160
+ else
161
+ {
162
+ $label = 'Payment Method Fee';
163
+
164
+ if( !empty( $params['include_percent'] ) )
165
+ $label .= ' (' . $percent . '%)';
166
+ }
167
+
168
+ return $label;
169
+ }
170
+
171
+ public function format_surcharge_value( $amount, $percent, $params = false )
172
+ {
173
+ if( empty( $params ) or !is_array( $params ) )
174
+ $params = array();
175
+
176
+ if( empty( $params['format_price'] ) )
177
+ $params['format_price'] = false;
178
+
179
+ if( !empty( $params['format_price'] )
180
+ and (!isset( $params['format_currency'] ) or !($params['format_currency'] instanceof Mage_Directory_Model_Currency)) )
181
+ $params['format_currency'] = Mage::app()->getStore()->getDefaultCurrency();
182
+ else
183
+ $params['format_currency'] = false;
184
+
185
+ if( !isset( $params['include_container'] ) )
186
+ $params['include_container'] = true;
187
+
188
+ if( empty( $params['format_options'] ) or !is_array( $params['format_options'] ) )
189
+ $params['format_options'] = array();
190
+ if( !isset( $params['format_options']['precision'] ) )
191
+ $params['format_options']['precision'] = 2;
192
+
193
+ if( empty( $params['format_price'] )
194
+ or empty( $params['format_currency'] ) )
195
+ $amount_str = $amount;
196
+
197
+ else
198
+ $amount_str = $params['format_currency']->format( $amount, $params['format_options'], $params['include_container'] );
199
+
200
+ return $amount_str;
201
+ }
202
+
203
  public function computeSHA256Hash( $message )
204
  {
205
  if( function_exists( 'mb_strtolower' ) )
app/code/community/Smart2Pay/Globalpay/Model/Adminhtml/System/Config/Backend/Configuredmethods.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Model_Adminhtml_System_Config_Backend_Configuredmethods extends Mage_Core_Model_Config_Data
4
+ {
5
+ const ERR_SURCHARGE_PERCENT = 1, ERR_SURCHARGE_SAVE = 2;
6
+
7
+ // Array created in _beforeSave() and commited to database in _afterSave()
8
+ // $_methods_to_save[{method_ids}][{country_ids}]['surcharge'], $_methods_to_save[{method_ids}][{country_ids}]['fixed_amount'], ...
9
+ protected $_methods_to_save = array();
10
+
11
+ /**
12
+ * Prefix of model events names
13
+ *
14
+ * @var string
15
+ */
16
+ protected $_eventPrefix = 'globalpay_configured_methods';
17
+
18
+ protected function _afterLoad()
19
+ {
20
+ return $this;
21
+ }
22
+
23
+ protected function _beforeSave()
24
+ {
25
+ /** @var Smart2Pay_Globalpay_Model_Logger $logger_obj */
26
+ $logger_obj = Mage::getModel( 'globalpay/logger' );
27
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
28
+ $configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' );
29
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
30
+ $helper_obj = Mage::helper( 'globalpay/helper' );
31
+
32
+ if( !($form_s2p_enabled_methods = Mage::app()->getRequest()->getParam( 's2p_enabled_methods', array() ))
33
+ or !is_array( $form_s2p_enabled_methods ) )
34
+ $form_s2p_enabled_methods = array();
35
+ if( !($form_s2p_surcharge = Mage::app()->getRequest()->getParam( 's2p_surcharge', array() ))
36
+ or !is_array( $form_s2p_surcharge ) )
37
+ $form_s2p_surcharge = array();
38
+ if( !($form_s2p_fixed_amount = Mage::app()->getRequest()->getParam( 's2p_fixed_amount', array() ))
39
+ or !is_array( $form_s2p_fixed_amount ) )
40
+ $form_s2p_fixed_amount = array();
41
+
42
+ $existing_methods_params_arr = array();
43
+ $existing_methods_params_arr['method_ids'] = $form_s2p_enabled_methods;
44
+ $existing_methods_params_arr['include_countries'] = false;
45
+
46
+ if( !($db_existing_methods = $configured_methods_obj->get_all_methods( $existing_methods_params_arr )) )
47
+ $db_existing_methods = array();
48
+
49
+ $messages_arr = array();
50
+ $last_code = 0;
51
+
52
+ $this->_methods_to_save = array();
53
+ foreach( $db_existing_methods as $method_id => $method_details )
54
+ {
55
+ if( empty( $form_s2p_surcharge[$method_id] ) )
56
+ $form_s2p_surcharge[$method_id] = 0;
57
+ if( empty( $form_s2p_fixed_amount[$method_id] ) )
58
+ $form_s2p_fixed_amount[$method_id] = 0;
59
+
60
+ if( !is_numeric( $form_s2p_surcharge[$method_id] ) )
61
+ {
62
+ $messages_arr[Mage_Core_Model_Message::ERROR][] = array(
63
+ 'message' => $helper_obj->__( 'Please provide a valid percent for method ' . $method_details['display_name'] . '.' ),
64
+ 'class' => __CLASS__,
65
+ 'method' => __METHOD__,
66
+ );
67
+ $last_code = self::ERR_SURCHARGE_PERCENT;
68
+ continue;
69
+ }
70
+
71
+ if( !is_numeric( $form_s2p_fixed_amount[$method_id] ) )
72
+ {
73
+ $messages_arr[Mage_Core_Model_Message::ERROR][] = array(
74
+ 'message' => $helper_obj->__( 'Please provide a valid fixed amount for method ' . $method_details['display_name'] . '.' ),
75
+ 'class' => __CLASS__,
76
+ 'method' => __METHOD__,
77
+ );
78
+ $last_code = self::ERR_SURCHARGE_PERCENT;
79
+ continue;
80
+ }
81
+
82
+ if( empty( $this->_methods_to_save[$method_id] ) )
83
+ $this->_methods_to_save[$method_id] = array();
84
+
85
+ // TODO: add country ids instead of only 0 (all countries)
86
+ $this->_methods_to_save[$method_id][0]['surcharge'] = $form_s2p_surcharge[$method_id];
87
+ $this->_methods_to_save[$method_id][0]['fixed_amount'] = $form_s2p_fixed_amount[$method_id];
88
+ }
89
+
90
+ if( !empty( $messages_arr ) )
91
+ {
92
+ // Don't let system write in db if we have an error
93
+ $this->_methods_to_save = array();
94
+ $this->_dataSaveAllowed = false;
95
+
96
+ throw $helper_obj->mage_exception( $last_code, $messages_arr );
97
+ }
98
+
99
+ // $logger_obj->write( 'Saving ['.print_r( $this->_methods_to_save, true ).']', 'config_save' );
100
+
101
+ return $this;
102
+ }
103
+
104
+ protected function _afterSave()
105
+ {
106
+ if( !is_array( $this->_methods_to_save ) )
107
+ return $this;
108
+
109
+ /** @var Smart2Pay_Globalpay_Model_Logger $logger_obj */
110
+ $logger_obj = Mage::getModel( 'globalpay/logger' );
111
+
112
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
113
+ $configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' );
114
+
115
+ if( ($save_result = $configured_methods_obj->save_configured_methods( $this->_methods_to_save )) !== true )
116
+ {
117
+ if( !is_array( $save_result ) )
118
+ {
119
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
120
+ $helper_obj = Mage::helper( 'globalpay/helper' );
121
+
122
+ $error_msg = $helper_obj->__( 'Error saving methods to database. Please try again.' );
123
+ } else
124
+ $error_msg = implode( '<br/>', $save_result );
125
+
126
+ throw Mage::exception( 'Mage_Core', $error_msg, self::ERR_SURCHARGE_SAVE );
127
+ }
128
+
129
+ return $this;
130
+ }
131
+
132
+ protected function _hasModelChanged()
133
+ {
134
+ return true;
135
+ }
136
+ }
app/code/community/Smart2Pay/Globalpay/Model/Configuredmethods.php ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Model_Configuredmethods extends Mage_Core_Model_Abstract
3
+ {
4
+ protected $_resourceCollectionName = 'globalpay/configuredmethods_collection';
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init('globalpay/configuredmethods');
9
+ }
10
+
11
+ public function get_all_methods( $params = false )
12
+ {
13
+ static $return_arr = false;
14
+
15
+ // Cache result for default parameters
16
+ if( empty( $params ) and !empty( $return_arr ) )
17
+ return $return_arr;
18
+
19
+ if( empty( $params ) or !is_array( $params ) )
20
+ $params = array();
21
+ if( !isset( $params['method_ids'] ) or !is_array( $params['method_ids'] ) )
22
+ $params['method_ids'] = false;
23
+ if( !isset( $params['include_countries'] ) )
24
+ $params['include_countries'] = true;
25
+ if( empty( $params['order_by'] ) or !in_array( $params['order_by'], array( 'display_name', 'method_id' ) ) )
26
+ $params['order_by'] = 'display_name';
27
+
28
+ // we received an empty array of ids, so we should return empty result...
29
+ if( is_array( $params['method_ids'] ) and empty( $params['method_ids'] ) )
30
+ return array();
31
+
32
+ $method_ids_arr = false;
33
+ if( !empty( $params['method_ids'] ) )
34
+ {
35
+ $method_ids_arr = array();
36
+ foreach( $params['method_ids'] as $method_id )
37
+ {
38
+ $method_id = intval( $method_id );
39
+ if( empty( $method_id ) )
40
+ continue;
41
+
42
+ $method_ids_arr[] = $method_id;
43
+ }
44
+ }
45
+
46
+ /** @var Smart2Pay_Globalpay_Model_Resource_Method_Collection $methods_collection */
47
+ $methods_collection = Mage::getModel( 'globalpay/method' )->getCollection();
48
+
49
+ $methods_collection->addFieldToSelect( array( 'method_id', 'display_name', 'description', 'logo_url' ) );
50
+
51
+ $methods_collection->addFieldToFilter( 'active', 1 );
52
+
53
+ if( !empty( $method_ids_arr ) )
54
+ $methods_collection->addFieldToFilter( 'method_id', array( 'in' => $method_ids_arr ) );
55
+
56
+ $methods_collection->setOrder( $params['order_by'], 'ASC' );
57
+
58
+ $return_arr = array();
59
+
60
+ while( ($method_obj = $methods_collection->fetchItem())
61
+ and ($method_arr = $method_obj->getData()) )
62
+ {
63
+ if( empty( $method_arr['method_id'] ) )
64
+ continue;
65
+
66
+ $return_arr[$method_arr['method_id']] = $method_arr;
67
+
68
+ if( !empty( $params['include_countries'] ) )
69
+ $return_arr[$method_arr['method_id']]['countries_list'] = $this->get_countries_for_method( $method_arr['method_id'] );
70
+ else
71
+ $return_arr[$method_arr['method_id']]['countries_list'] = array();
72
+ }
73
+
74
+ return $return_arr;
75
+ }
76
+
77
+ public function get_countries_for_method( $method_id )
78
+ {
79
+ $method_id = intval( $method_id );
80
+ if( empty( $method_id ) )
81
+ return array();
82
+
83
+ /** @var Smart2Pay_Globalpay_Model_Resource_Countrymethod_Collection $methodcountries_collection */
84
+ $methodcountries_collection = Mage::getModel( 'globalpay/countrymethod' )->getCollection();
85
+
86
+ $methodcountries_collection->addFieldToSelect( '*' );
87
+
88
+ $methodcountries_collection->addFieldToFilter( 'method_id', $method_id );
89
+
90
+ $methodcountries_collection->getSelect()->join(
91
+ 's2p_gp_countries',
92
+ 's2p_gp_countries.country_id = main_table.country_id' );
93
+
94
+ $methodcountries_collection->setOrder( 's2p_gp_countries_methods.priority', 'ASC' );
95
+
96
+ $return_arr = array();
97
+
98
+ while( ($country_obj = $methodcountries_collection->fetchItem())
99
+ and ($country_arr = $country_obj->getData()) )
100
+ {
101
+ if( empty( $country_arr['country_id'] ) )
102
+ continue;
103
+
104
+ $return_arr[$country_arr['country_id']] = $country_arr;
105
+ }
106
+
107
+ return $return_arr;
108
+
109
+ }
110
+
111
+ /**
112
+ * @param bool|array $params
113
+ *
114
+ * @return array
115
+ */
116
+ public function get_all_configured_methods( $params = false )
117
+ {
118
+ if( empty( $params ) or !is_array( $params ) )
119
+ $params = array();
120
+
121
+ // $return_arr[{method_ids}][{country_ids}]['surcharge'], $return_arr[{method_ids}][{country_ids}]['base_amount'], ...
122
+ $return_arr = array();
123
+
124
+ /** @var Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection $my_collection */
125
+ $my_collection = $this->getCollection();
126
+ $my_collection->addFieldToSelect( '*' );
127
+
128
+ while( ($configured_method_obj = $my_collection->fetchItem())
129
+ and ($configured_method_arr = $configured_method_obj->getData()) )
130
+ {
131
+ if( empty( $configured_method_arr['method_id'] ) )
132
+ continue;
133
+
134
+ $return_arr[$configured_method_arr['method_id']][$configured_method_arr['country_id']] = $configured_method_arr;
135
+ }
136
+
137
+ return $return_arr;
138
+ }
139
+
140
+ public function get_configured_methods( $country_id, $params = false )
141
+ {
142
+ $country_id = intval( $country_id );
143
+ if( empty( $country_id ) )
144
+ return array();
145
+
146
+ if( empty( $params ) or !is_array( $params ) )
147
+ $params = array();
148
+
149
+ if( empty( $params['id_in_index'] ) )
150
+ $params['id_in_index'] = false;
151
+
152
+ // 1. get a list of methods available for provided country
153
+ // 2. get default surcharge (s2p_gp_methods_configured.country_id = 0)
154
+ // 3. overwrite default surcharges for particular cases (if available) (s2p_gp_methods_configured.country_id = $country_id)
155
+
156
+ //
157
+ // START 1. get a list of methods available for provided country
158
+ //
159
+
160
+ /** @var Smart2Pay_Globalpay_Model_Resource_Countrymethod_Collection $cm_collection */
161
+ $cm_collection = Mage::getModel( 'globalpay/countrymethod' )->getCollection();
162
+ $cm_collection->addFieldToSelect( '*' );
163
+ $cm_collection->addFieldToFilter( 'country_id', $country_id );
164
+
165
+ $cm_collection->getSelect()->join(
166
+ 's2p_gp_methods',
167
+ 's2p_gp_methods.method_id = main_table.method_id'
168
+ );
169
+
170
+ $cm_collection->setOrder( 'priority', 'ASC' );
171
+
172
+ $methods_arr = array();
173
+ $method_ids_arr = array();
174
+ $enabled_method_ids_arr = array();
175
+
176
+
177
+ while( ($method_obj = $cm_collection->fetchItem())
178
+ and ($method_arr = $method_obj->getData()) )
179
+ {
180
+ if( empty( $method_arr['method_id'] ) )
181
+ continue;
182
+
183
+ $method_ids_arr[] = $method_arr['method_id'];
184
+ $methods_arr[$method_arr['method_id']] = $method_arr;
185
+ }
186
+
187
+ //
188
+ // END 1. get a list of methods available for provided country
189
+ //
190
+
191
+ //
192
+ // START 2. get default surcharge (s2p_gp_methods_configured.country_id = 0)
193
+ //
194
+ /** @var Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection $my_collection */
195
+ $my_collection = $this->getCollection();
196
+ $my_collection->addFieldToSelect( '*' );
197
+ $my_collection->addFieldToFilter( 'country_id', 0 );
198
+ $my_collection->addFieldToFilter( 'method_id', array( 'in' => $method_ids_arr ) );
199
+
200
+ while( ($configured_method_obj = $my_collection->fetchItem())
201
+ and ($configured_method_arr = $configured_method_obj->getData()) )
202
+ {
203
+ if( empty( $configured_method_arr['method_id'] ) )
204
+ continue;
205
+
206
+ $methods_arr[$configured_method_arr['method_id']]['surcharge'] = $configured_method_arr['surcharge'];
207
+ $methods_arr[$configured_method_arr['method_id']]['fixed_amount'] = $configured_method_arr['fixed_amount'];
208
+
209
+ $enabled_method_ids_arr[$configured_method_arr['method_id']] = 1;
210
+ }
211
+ //
212
+ // END 2. get default surcharge (s2p_gp_methods_configured.country_id = 0)
213
+ //
214
+
215
+ //
216
+ // START 3. overwrite default surcharges for particular cases (if available) (s2p_gp_methods_configured.country_id = $country_id)
217
+ //
218
+ /** @var Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection $my_collection */
219
+ $my_collection = $this->getCollection();
220
+ $my_collection->addFieldToSelect( '*' );
221
+ $my_collection->addFieldToFilter( 'country_id', $country_id );
222
+ $my_collection->addFieldToFilter( 'method_id', array( 'in' => $method_ids_arr ) );
223
+
224
+ while( ($configured_method_obj = $my_collection->fetchItem())
225
+ and ($configured_method_arr = $configured_method_obj->getData()) )
226
+ {
227
+ if( empty( $configured_method_arr['method_id'] ) )
228
+ continue;
229
+
230
+ $methods_arr[$configured_method_arr['method_id']]['surcharge'] = $configured_method_arr['surcharge'];
231
+ $methods_arr[$configured_method_arr['method_id']]['fixed_amount'] = $configured_method_arr['fixed_amount'];
232
+
233
+ $enabled_method_ids_arr[$configured_method_arr['method_id']] = 1;
234
+ }
235
+ //
236
+ // END 3. overwrite default surcharges for particular cases (if available) (s2p_gp_methods_configured.country_id = $country_id)
237
+ //
238
+
239
+ // clean methods array of methods that are not enabled
240
+ $methods_result = array();
241
+ foreach( $methods_arr as $method_id => $method_arr )
242
+ {
243
+ if( empty( $enabled_method_ids_arr[$method_id] ) )
244
+ continue;
245
+
246
+ if( empty( $params['id_in_index'] ) )
247
+ $methods_result[] = $method_arr;
248
+ else
249
+ $methods_result[$method_id] = $method_arr;
250
+ }
251
+
252
+ return $methods_result;
253
+ }
254
+
255
+ /**
256
+ * @param array $configured_methods_arr
257
+ *
258
+ * @return array|bool
259
+ */
260
+ function save_configured_methods( $configured_methods_arr )
261
+ {
262
+ if( !is_array( $configured_methods_arr ) )
263
+ return false;
264
+
265
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
266
+ $helper_obj = Mage::helper( 'globalpay/helper' );
267
+ /** @var Smart2Pay_Globalpay_Model_Resource_Configuredmethods $my_resource */
268
+ $my_resource = $this->getResource();
269
+
270
+ $saved_method_ids = array();
271
+ $errors_arr = array();
272
+ foreach( $configured_methods_arr as $method_id => $surcharge_per_countries )
273
+ {
274
+ $method_id = intval( $method_id );
275
+ if( empty( $method_id )
276
+ or empty( $surcharge_per_countries ) or !is_array( $surcharge_per_countries )
277
+ or !($countries_ids = array_keys( $surcharge_per_countries )) )
278
+ continue;
279
+
280
+ $provided_countries = array();
281
+ foreach( $surcharge_per_countries as $country_id => $country_surcharge )
282
+ {
283
+ $country_id = intval( $country_id );
284
+ if( !is_array( $country_surcharge ) )
285
+ continue;
286
+
287
+ if( empty( $country_surcharge['surcharge'] ) )
288
+ $country_surcharge['surcharge'] = 0;
289
+ if( empty( $country_surcharge['fixed_amount'] ) )
290
+ $country_surcharge['fixed_amount'] = 0;
291
+
292
+ if( !$my_resource->insert_or_update( $method_id, $country_id, $country_surcharge ) )
293
+ $errors_arr[] = $helper_obj->__( 'Error saving method ID '.$method_id.', for country '.$country_id.'.' );
294
+
295
+ $provided_countries[] = $country_id;
296
+ }
297
+
298
+ // Delete countries which are not provided for current method
299
+ /** @var Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection $my_collection */
300
+ $my_collection = $this->getCollection();
301
+ $my_collection->addFieldToFilter( 'method_id', $method_id );
302
+ if( !empty( $provided_countries ) )
303
+ $my_collection->addFieldToFilter( 'country_id', array( 'nin' => $provided_countries ) );
304
+
305
+ $my_resource->delete_from_collection( $my_collection );
306
+
307
+ $saved_method_ids[] = $method_id;
308
+ }
309
+
310
+ // delete rest of methods not in $saved_method_ids array...
311
+ /** @var Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection $my_collection */
312
+ $my_collection = $this->getCollection();
313
+ if( !empty( $saved_method_ids ) )
314
+ $my_collection->addFieldToFilter( 'method_id', array( 'nin' => $saved_method_ids ) );
315
+
316
+ $my_resource->delete_from_collection( $my_collection );
317
+
318
+ if( !empty( $errors_arr ) )
319
+ return $errors_arr;
320
+
321
+ return true;
322
+ }
323
+
324
+ }
app/code/community/Smart2Pay/Globalpay/Model/Country.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class Smart2Pay_Globalpay_Model_Country extends Mage_Core_Model_Abstract
3
  {
4
  protected $_resourceCollectionName = 'globalpay/country_collection';
@@ -8,4 +9,3 @@ class Smart2Pay_Globalpay_Model_Country extends Mage_Core_Model_Abstract
8
  $this->_init('globalpay/country');
9
  }
10
  }
11
- ?>
1
  <?php
2
+
3
  class Smart2Pay_Globalpay_Model_Country extends Mage_Core_Model_Abstract
4
  {
5
  protected $_resourceCollectionName = 'globalpay/country_collection';
9
  $this->_init('globalpay/country');
10
  }
11
  }
 
app/code/community/Smart2Pay/Globalpay/Model/Countrymethod.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class Smart2Pay_Globalpay_Model_Countrymethod extends Mage_Core_Model_Abstract
3
  {
4
  protected $_resourceCollectionName = 'globalpay/countrymethod_collection';
@@ -8,4 +9,4 @@ class Smart2Pay_Globalpay_Model_Countrymethod extends Mage_Core_Model_Abstract
8
  $this->_init('globalpay/countrymethod');
9
  }
10
  }
11
- ?>
1
  <?php
2
+
3
  class Smart2Pay_Globalpay_Model_Countrymethod extends Mage_Core_Model_Abstract
4
  {
5
  protected $_resourceCollectionName = 'globalpay/countrymethod_collection';
9
  $this->_init('globalpay/countrymethod');
10
  }
11
  }
12
+
app/code/community/Smart2Pay/Globalpay/Model/GlobalpayLog.php CHANGED
@@ -1,7 +1,5 @@
1
  <?php
2
 
3
- class Smart2Pay_GlobalPay_Model_GlobalpayLog extends Mage_Core_Model_Abstract {
4
-
5
  }
6
-
7
- ?>
1
  <?php
2
 
3
+ class Smart2Pay_GlobalPay_Model_GlobalpayLog extends Mage_Core_Model_Abstract
4
+ {
5
  }
 
 
app/code/community/Smart2Pay/Globalpay/Model/Pay.php CHANGED
@@ -7,7 +7,6 @@ class Smart2Pay_Globalpay_Model_Pay extends Mage_Payment_Model_Method_Abstract
7
  const PAYMENT_METHOD_BT = 1, PAYMENT_METHOD_SIBS = 20;
8
 
9
  protected $_code = 'globalpay';
10
-
11
  protected $_formBlockType = 'globalpay/paymethod_form';
12
  protected $_infoBlockType = 'globalpay/info_globalpay';
13
 
@@ -19,13 +18,11 @@ class Smart2Pay_Globalpay_Model_Pay extends Mage_Payment_Model_Method_Abstract
19
  parent::__construct();
20
 
21
  // get environment type
22
- $environment = $this->getConfigData('environment'); // [test | live]
23
 
24
  // get config
25
  $this->method_config = array(
26
- 'post_url' => $this->getConfigData('post_url_'.$environment),
27
- 'signature' => $this->getConfigData('signature_'.$environment),
28
- 'mid' => $this->getConfigData('mid_'.$environment),
29
  'return_url' => $this->getConfigData('return_url'),
30
  'methods' => $this->getConfigData('methods'),
31
  'methods_display_mode' => $this->getConfigData('methods_display_mode'),
@@ -33,6 +30,7 @@ class Smart2Pay_Globalpay_Model_Pay extends Mage_Payment_Model_Method_Abstract
33
  'show_methods_in_grid' => $this->getConfigData('show_methods_in_grid'),
34
  'grid_column_number' => $this->getConfigData('grid_column_number'),
35
  'adjust_for_one_page_checkout' => $this->getConfigData('adjust_for_one_page_checkout'),
 
36
  'autoselect_s2p' => $this->getConfigData('autoselect_s2p'),
37
  'send_customer_email' => $this->getConfigData('send_customer_email'),
38
  'send_customer_name' => $this->getConfigData('send_customer_name'),
@@ -60,6 +58,28 @@ class Smart2Pay_Globalpay_Model_Pay extends Mage_Payment_Model_Method_Abstract
60
  'auto_ship' => $this->getConfigData('auto_ship'),
61
  'notify_customer' => $this->getConfigData('notify_customer'),
62
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
 
65
  /**
@@ -73,7 +93,69 @@ class Smart2Pay_Globalpay_Model_Pay extends Mage_Payment_Model_Method_Abstract
73
  if( !($data instanceof Varien_Object) )
74
  $data = new Varien_Object($data);
75
 
76
- $_SESSION['globalpay_method'] = $data->getMethodId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  return $this;
79
  }
7
  const PAYMENT_METHOD_BT = 1, PAYMENT_METHOD_SIBS = 20;
8
 
9
  protected $_code = 'globalpay';
 
10
  protected $_formBlockType = 'globalpay/paymethod_form';
11
  protected $_infoBlockType = 'globalpay/info_globalpay';
12
 
18
  parent::__construct();
19
 
20
  // get environment type
21
+ $environment = $this->getConfigData('environment'); // [demo | test | live]
22
 
23
  // get config
24
  $this->method_config = array(
25
+ 'environment' => $environment,
 
 
26
  'return_url' => $this->getConfigData('return_url'),
27
  'methods' => $this->getConfigData('methods'),
28
  'methods_display_mode' => $this->getConfigData('methods_display_mode'),
30
  'show_methods_in_grid' => $this->getConfigData('show_methods_in_grid'),
31
  'grid_column_number' => $this->getConfigData('grid_column_number'),
32
  'adjust_for_one_page_checkout' => $this->getConfigData('adjust_for_one_page_checkout'),
33
+ 'display_surcharge' => $this->getConfigData('display_surcharge'),
34
  'autoselect_s2p' => $this->getConfigData('autoselect_s2p'),
35
  'send_customer_email' => $this->getConfigData('send_customer_email'),
36
  'send_customer_name' => $this->getConfigData('send_customer_name'),
58
  'auto_ship' => $this->getConfigData('auto_ship'),
59
  'notify_customer' => $this->getConfigData('notify_customer'),
60
  );
61
+
62
+ if( $environment == 'demo' )
63
+ {
64
+ // demo environment
65
+ $this->method_config['post_url'] = 'https://apitest.smart2pay.com';
66
+ $this->method_config['signature'] = '8bf71f75-68d9';
67
+ $this->method_config['mid'] = '1045';
68
+ $this->method_config['site_id'] = '30122';
69
+ } elseif( in_array( $environment, array( 'test', 'live' ) ) )
70
+ {
71
+ $this->method_config['post_url'] = $this->getConfigData( 'post_url_' . $environment );
72
+ $this->method_config['signature'] = $this->getConfigData( 'signature_' . $environment );
73
+ $this->method_config['mid'] = $this->getConfigData( 'mid_' . $environment );
74
+ } else
75
+ {
76
+ $this->method_config['post_url'] = 'https://apitest.smart2pay.com';
77
+ $this->method_config['signature'] = '';
78
+ $this->method_config['mid'] = 0;
79
+ }
80
+
81
+ // Not enabled yet
82
+ //$this->method_config['display_surcharge'] = 0;
83
  }
84
 
85
  /**
93
  if( !($data instanceof Varien_Object) )
94
  $data = new Varien_Object($data);
95
 
96
+ /** @var Mage_Checkout_Model_Session $chkout */
97
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $configured_methods_obj */
98
+ if( !($method_id = $data->getMethodId())
99
+ or !($chkout = Mage::getSingleton('checkout/session'))
100
+ or !($quote = $chkout->getQuote())
101
+ or !($billingAddress = $quote->getBillingAddress())
102
+ or !($countryCode = $billingAddress->getCountryId())
103
+ or !($countryId = Mage::getModel('globalpay/country')->load($countryCode, 'code')->getId())
104
+ or !($configured_methods_obj = Mage::getModel( 'globalpay/configuredmethods' ))
105
+ or !($enabled_methods = $configured_methods_obj->get_configured_methods( $countryId, array( 'id_in_index' => true ) ))
106
+ or empty( $enabled_methods[$method_id] ) )
107
+ {
108
+ Mage::throwException( Mage::helper('payment')->__( 'Couldn\'t get payment method details. Please try again.' ) );
109
+ return $this;
110
+ }
111
+
112
+ $info = $this->getInfoInstance();
113
+
114
+ $_SESSION['globalpay_method'] = $method_id;
115
+
116
+ /** @var Smart2Pay_Globalpay_Model_Logger $logger_obj */
117
+ $logger_obj = Mage::getModel( 'globalpay/logger' );
118
+
119
+ if( !empty( $enabled_methods[$method_id]['surcharge'] )
120
+ or !empty( $enabled_methods[$method_id]['fixed_amount'] ) )
121
+ {
122
+ $info->setS2pSurchargePercent( $enabled_methods[$method_id]['surcharge'] );
123
+
124
+ if( ($total_amount = $quote->getGrandTotal()) )
125
+ $total_amount -= ($info->getS2pSurchargeAmount() + $info->getS2pSurchargeFixedAmount());
126
+ if( ($total_base_amount = $quote->getBaseGrandTotal()) )
127
+ $total_base_amount -= ($info->getS2pSurchargeBaseAmount() + $info->getS2pSurchargeFixedBaseAmount());
128
+
129
+ $surcharge_amount = 0;
130
+ if( !empty( $total_amount )
131
+ and (float)$enabled_methods[ $method_id ]['surcharge'] != 0 )
132
+ $surcharge_amount = ( $total_amount * $enabled_methods[ $method_id ]['surcharge'] ) / 100;
133
+ $surcharge_base_amount = 0;
134
+ if( !empty( $total_base_amount )
135
+ and (float)$enabled_methods[ $method_id ]['surcharge'] != 0 )
136
+ $surcharge_base_amount = ($total_base_amount * $enabled_methods[$method_id]['surcharge']) / 100;
137
+
138
+ $surcharge_fixed_amount = 0;
139
+ $surcharge_fixed_base_amount = 0;
140
+ if( (float)$enabled_methods[$method_id]['fixed_amount'] != 0 )
141
+ $surcharge_fixed_base_amount = $enabled_methods[$method_id]['fixed_amount'];
142
+ if( $surcharge_fixed_base_amount != 0 )
143
+ $surcharge_fixed_amount = $quote->getStore()->getBaseCurrency()->convert( $surcharge_fixed_base_amount, $quote->getQuoteCurrencyCode() );
144
+
145
+ //$logger_obj->write( 'Total ['.$total_amount.'] Base ('.$total_base_amount.'), '.
146
+ // 'SurchargeFixed ['.$surcharge_fixed_amount.'] BaseFixed ('.$surcharge_fixed_base_amount.'), '.
147
+ // 'Surcharge ['.$surcharge_amount.'] Base ('.$surcharge_base_amount.') '.
148
+ // ' ['.$enabled_methods[$method_id]['surcharge'].'%]' );
149
+
150
+ $info->setS2pSurchargeAmount( $surcharge_amount );
151
+ $info->setS2pSurchargeBaseAmount( $surcharge_base_amount );
152
+ $info->setS2pSurchargeFixedAmount( $surcharge_fixed_amount );
153
+ $info->setS2pSurchargeFixedBaseAmount( $surcharge_fixed_base_amount );
154
+
155
+ // Recollect totals for surcharge amount
156
+ $quote->setTotalsCollectedFlag( false );
157
+ $quote->collectTotals();
158
+ }
159
 
160
  return $this;
161
  }
app/code/community/Smart2Pay/Globalpay/Model/Resource/Configuredmethods.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Model_Resource_Configuredmethods extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('globalpay/configuredmethods', 'id');
8
+ }
9
+
10
+ public function truncate_table()
11
+ {
12
+ $this->_getWriteAdapter()->truncateTable( $this->getMainTable() );
13
+ }
14
+
15
+ /**
16
+ * @param Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection $collection
17
+ *
18
+ * @return bool
19
+ */
20
+ public function delete_from_collection( Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection $collection )
21
+ {
22
+ if( !($collection instanceof Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection) )
23
+ return false;
24
+
25
+ if( !($it = $collection->getIterator()) )
26
+ return false;
27
+
28
+ /** @var Smart2Pay_Globalpay_Model_Configuredmethods $item */
29
+ foreach( $it as $item )
30
+ $item->delete();
31
+
32
+ return true;
33
+ }
34
+
35
+ /**
36
+ * @param int $method_id
37
+ * @param int $country_id
38
+ * @param array $params
39
+ *
40
+ * @return bool
41
+ */
42
+ public function insert_or_update( $method_id, $country_id, $params )
43
+ {
44
+ /** @var Magento_Db_Adapter_Pdo_Mysql $conn_write */
45
+ /** @var Magento_Db_Adapter_Pdo_Mysql $conn_read */
46
+ $method_id = intval( $method_id );
47
+ $country_id = intval( $country_id );
48
+ if( empty( $method_id )
49
+ or empty( $params ) or !is_array( $params )
50
+ or !($conn_read = $this->_getReadAdapter())
51
+ or !($conn_write = $this->_getWriteAdapter()) )
52
+ return false;
53
+
54
+ if( empty( $params['surcharge'] ) )
55
+ $params['surcharge'] = 0;
56
+ if( empty( $params['fixed_amount'] ) )
57
+ $params['fixed_amount'] = 0;
58
+
59
+ $insert_arr = array();
60
+ $insert_arr['surcharge'] = $params['surcharge'];
61
+ $insert_arr['fixed_amount'] = $params['fixed_amount'];
62
+
63
+ try
64
+ {
65
+ if( ( $existing_id = $conn_read->fetchOne( 'SELECT id FROM ' . $this->getMainTable() . ' WHERE method_id = \'' . $method_id . '\' AND country_id = \'' . $country_id . '\' LIMIT 0, 1' ) ) )
66
+ {
67
+ // we should update record
68
+ $conn_write->update( $this->getMainTable(), $insert_arr, 'id = \'' . $existing_id . '\'' );
69
+ } else
70
+ {
71
+ $insert_arr['method_id'] = $method_id;
72
+ $insert_arr['country_id'] = $country_id;
73
+
74
+ $conn_write->insert( $this->getMainTable(), $insert_arr );
75
+
76
+ }
77
+ } catch( Zend_Db_Adapter_Exception $e )
78
+ {
79
+ /** @var Smart2Pay_Globalpay_Model_Logger $s2pLogger */
80
+ $s2pLogger = Mage::getModel( 'globalpay/logger' );
81
+
82
+ $s2pLogger->write( 'DB Error ['.$e->getMessage().']', 'configured_method' );
83
+ return false;
84
+ }
85
+
86
+ return true;
87
+ }
88
+ }
app/code/community/Smart2Pay/Globalpay/Model/Resource/Configuredmethods/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Smart2Pay_Globalpay_Model_Resource_Configuredmethods_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init( 'globalpay/configuredmethods' );
7
+ }
8
+ }
9
+
app/code/community/Smart2Pay/Globalpay/Model/Resource/Countrymethod/Collection.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
- class Smart2Pay_Globalpay_Model_Resource_Countrymethod_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
3
 
4
- protected function _construct() {
 
 
 
5
  $this->_init('globalpay/countrymethod');
6
  }
7
-
8
  }
9
- ?>
1
  <?php
 
2
 
3
+ class Smart2Pay_Globalpay_Model_Resource_Countrymethod_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
  $this->_init('globalpay/countrymethod');
8
  }
 
9
  }
10
+
app/code/community/Smart2Pay/Globalpay/Model/Resource/Method/Collection.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
- class Smart2Pay_Globalpay_Model_Resource_Method_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
3
 
4
- protected function _construct() {
 
 
 
5
  $this->_init('globalpay/method');
6
  }
7
 
8
- }
1
  <?php
 
2
 
3
+ class Smart2Pay_Globalpay_Model_Resource_Method_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
  $this->_init('globalpay/method');
8
  }
9
 
10
+ }
app/code/community/Smart2Pay/Globalpay/Model/Resource/Setup.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
2
- class Smart2Pay_Globalpay_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
 
3
 
4
  }
1
  <?php
2
+ class Smart2Pay_Globalpay_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
3
+ {
4
 
5
  }
app/code/community/Smart2Pay/Globalpay/Model/Sales/Observer.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Model_Sales_Observer
4
+ {
5
+ public function __construct()
6
+ {
7
+ }
8
+
9
+ /**
10
+ * Removes applied surcharge from payment method when cart is changing
11
+ *
12
+ * @param Varien_Event_Observer $observer
13
+ * @return Smart2Pay_Globalpay_Model_Sales_Observer
14
+ */
15
+ public function remove_surcharge_from_cart( $observer )
16
+ {
17
+ $event = $observer->getEvent();
18
+
19
+ /** @var Mage_Checkout_Model_Cart $cart */
20
+ if( !($cart = $event->getCart())
21
+ or !($quote = $cart->getQuote())
22
+ or !($payment_obj = $quote->getPayment()) )
23
+ return $this;
24
+
25
+ $payment_obj->setS2pSurchargeAmount( 0 );
26
+ $payment_obj->setS2pSurchargeBaseAmount( 0 );
27
+ $payment_obj->setS2pSurchargePercent( 0 );
28
+ $payment_obj->setS2pSurchargeFixedAmount( 0 );
29
+ $payment_obj->setS2pSurchargeFixedBaseAmount( 0 );
30
+
31
+ if( ($address_obj = $quote->getBillingAddress()) )
32
+ {
33
+ $address_obj->setGrandTotal( $address_obj->getGrandTotal() - $address_obj->getS2pSurchargeAmount() - $address_obj->getS2pSurchargeFixedAmount() );
34
+ $address_obj->setBaseGrandTotal( $address_obj->getBaseGrandTotal() - $address_obj->getS2pSurchargeBaseAmount() - $address_obj->getS2pSurchargeFixedBaseAmount() );
35
+
36
+ $address_obj->setS2pSurchargeAmount( 0 );
37
+ $address_obj->setS2pSurchargeBaseAmount( 0 );
38
+ $address_obj->setS2pSurchargePercent( 0 );
39
+ $address_obj->setS2pSurchargeFixedAmount( 0 );
40
+ $address_obj->setS2pSurchargeFixedBaseAmount( 0 );
41
+ }
42
+
43
+ return $this;
44
+ }
45
+
46
+ /**
47
+ * Removes applied surcharge from payment method when cart is changing
48
+ *
49
+ * @param Varien_Event_Observer $observer
50
+ * @return Smart2Pay_Globalpay_Model_Sales_Observer
51
+ */
52
+ public function remove_surcharge_from_quote( $observer )
53
+ {
54
+ $event = $observer->getEvent();
55
+
56
+ /** @var Mage_Sales_Model_Quote $quote */
57
+ if( !($quote = $event->getQuote())
58
+ or !($payment_obj = $quote->getPayment()) )
59
+ return $this;
60
+
61
+ $payment_obj->setS2pSurchargeAmount( 0 );
62
+ $payment_obj->setS2pSurchargeBaseAmount( 0 );
63
+ $payment_obj->setS2pSurchargePercent( 0 );
64
+ $payment_obj->setS2pSurchargeFixedAmount( 0 );
65
+ $payment_obj->setS2pSurchargeFixedBaseAmount( 0 );
66
+
67
+ if( ($address_obj = $quote->getBillingAddress()) )
68
+ {
69
+ $address_obj->setGrandTotal( $address_obj->getGrandTotal() - $address_obj->getS2pSurchargeAmount() - $address_obj->getS2pSurchargeFixedAmount() );
70
+ $address_obj->setBaseGrandTotal( $address_obj->getBaseGrandTotal() - $address_obj->getS2pSurchargeBaseAmount() - $address_obj->getS2pSurchargeFixedBaseAmount() );
71
+
72
+ $address_obj->setS2pSurchargeAmount( 0 );
73
+ $address_obj->setS2pSurchargeBaseAmount( 0 );
74
+ $address_obj->setS2pSurchargePercent( 0 );
75
+ $address_obj->setS2pSurchargeFixedAmount( 0 );
76
+ $address_obj->setS2pSurchargeFixedBaseAmount( 0 );
77
+ }
78
+
79
+ return $this;
80
+ }
81
+
82
+ /**
83
+ * Removes applied surcharge from payment method when cart is changing
84
+ *
85
+ * @param Varien_Event_Observer $observer
86
+ * @return Smart2Pay_Globalpay_Model_Sales_Observer
87
+ */
88
+ public function remove_surcharge_from_quote_item( $observer )
89
+ {
90
+ $event = $observer->getEvent();
91
+
92
+ /** @var Mage_Sales_Model_Quote_Item $quote_item */
93
+ if( !($quote_item = $event->getQuoteItem())
94
+ or !($quote = $quote_item->getQuote())
95
+ or !($payment_obj = $quote->getPayment()) )
96
+ return $this;
97
+
98
+ $payment_obj->setS2pSurchargeAmount( 0 );
99
+ $payment_obj->setS2pSurchargeBaseAmount( 0 );
100
+ $payment_obj->setS2pSurchargePercent( 0 );
101
+ $payment_obj->setS2pSurchargeFixedAmount( 0 );
102
+ $payment_obj->setS2pSurchargeFixedBaseAmount( 0 );
103
+
104
+ if( ($address_obj = $quote->getBillingAddress()) )
105
+ {
106
+ $address_obj->setGrandTotal( $address_obj->getGrandTotal() - $address_obj->getS2pSurchargeAmount() - $address_obj->getS2pSurchargeFixedAmount() );
107
+ $address_obj->setBaseGrandTotal( $address_obj->getBaseGrandTotal() - $address_obj->getS2pSurchargeBaseAmount() - $address_obj->getS2pSurchargeFixedBaseAmount() );
108
+
109
+ $address_obj->setS2pSurchargeAmount( 0 );
110
+ $address_obj->setS2pSurchargeBaseAmount( 0 );
111
+ $address_obj->setS2pSurchargePercent( 0 );
112
+ $address_obj->setS2pSurchargeFixedAmount( 0 );
113
+ $address_obj->setS2pSurchargeFixedBaseAmount( 0 );
114
+ }
115
+
116
+ return $this;
117
+ }
118
+
119
+ public function invoice_save( Varien_Event_Observer $observer )
120
+ {
121
+ /** @var Mage_Sales_Model_Order_Invoice $invoice */
122
+ /** @var Mage_Sales_Model_Order $order */
123
+ if( !($event = $observer->getEvent())
124
+ or !($invoice = $event->getInvoice())
125
+ or (
126
+ !(float)$invoice->getS2pSurchargeAmount() and !(float)$invoice->getS2pSurchargeBaseAmount()
127
+ and !(float)$invoice->getS2pSurchargeFixedAmount() and !(float)$invoice->getS2pSurchargeFixedBaseAmount()
128
+ )
129
+ or !($order = $invoice->getOrder())
130
+ or !($order_payment = $order->getPayment()) )
131
+ return $this;
132
+
133
+ $order_payment->setS2pSurchargeAmountInvoiced( $order_payment->getS2pSurchargeAmountInvoiced() + $invoice->getS2pSurchargeAmount() + $invoice->getS2pSurchargeFixedAmount() );
134
+ $order_payment->setS2pSurchargeBaseAmountInvoiced( $order_payment->getS2pSurchargeBaseAmountInvoiced() + $invoice->getS2pSurchargeBaseAmount() + $invoice->getS2pSurchargeFixedBaseAmount() );
135
+
136
+ return $this;
137
+ }
138
+
139
+ public function order_payment_place( Varien_Event_Observer $observer )
140
+ {
141
+ /** @var Mage_Sales_Model_Order_Payment $payment */
142
+ /** @var Mage_Sales_Model_Order $order */
143
+ if( !($event = $observer->getEvent())
144
+ or !($payment = $event->getPayment())
145
+ or !($order = $payment->getOrder())
146
+ or (
147
+ !(float)$payment->getS2pSurchargeAmount() and !(float)$payment->getS2pSurchargeBaseAmount()
148
+ and !(float)$payment->getS2pSurchargeFixedAmount() and !(float)$payment->getS2pSurchargeFixedBaseAmount()
149
+ ) )
150
+ return $this;
151
+
152
+ $order->setGrandTotal( $order->getGrandTotal() + $payment->getS2pSurchargeAmount() + $payment->getS2pSurchargeFixedAmount() );
153
+ $order->setBaseGrandTotal( $order->getBaseGrandTotal() + $payment->getS2pSurchargeBaseAmount() + $payment->getS2pSurchargeFixedBaseAmount() );
154
+
155
+ return $this;
156
+ }
157
+ }
app/code/community/Smart2Pay/Globalpay/Model/Sales/Order/Invoice/Total/Surcharge.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Model_Sales_Order_Invoice_Total_Surcharge extends Mage_Sales_Model_Order_Invoice_Total_Abstract
4
+ {
5
+ public function collect( Mage_Sales_Model_Order_Invoice $invoice )
6
+ {
7
+ if( !($order = $invoice->getOrder())
8
+ or !($order_payment = $order->getPayment()) )
9
+ return $this;
10
+
11
+ $invoice_amount = $order_payment->getS2pSurchargeAmount() + $order_payment->getS2pSurchargeFixedAmount() - $order_payment->getS2pSurchargeAmountInvoiced();
12
+ $invoice_base_amount = $order_payment->getS2pSurchargeBaseAmount() + $order_payment->getS2pSurchargeFixedBaseAmount() - $order_payment->getS2pSurchargeBaseAmountInvoiced();
13
+
14
+ if( $invoice_amount <= 0 or $invoice_base_amount <= 0 )
15
+ return $this;
16
+
17
+ $invoice->setGrandTotal( $invoice->getGrandTotal() + $invoice_amount );
18
+ $invoice->setBaseGrandTotal( $invoice->getBaseGrandTotal() + $invoice_base_amount );
19
+
20
+ $invoice->setS2pSurchargeAmount( $invoice_amount );
21
+ $invoice->setS2pSurchargeBaseAmount( $invoice_base_amount );
22
+
23
+ if( ($surcharge_amount = $order_payment->getS2pSurchargeAmount() - $order_payment->getS2pSurchargeAmountInvoiced()) < 0 )
24
+ $surcharge_amount = 0;
25
+
26
+ if( ($surcharge_fixed_amount = $invoice_amount - $surcharge_amount) < 0 )
27
+ $surcharge_fixed_amount = 0;
28
+
29
+ if( ($surcharge_base_amount = $order_payment->getS2pSurchargeBaseAmount() - $order_payment->getS2pSurchargeBaseAmountInvoiced()) < 0 )
30
+ $surcharge_base_amount = 0;
31
+
32
+ if( ($surcharge_fixed_base_amount = $invoice_base_amount - $surcharge_base_amount) < 0 )
33
+ $surcharge_fixed_base_amount = 0;
34
+
35
+ $invoice->setS2pSurchargeAmount( $surcharge_amount );
36
+ $invoice->setS2pSurchargeBaseAmount( $surcharge_base_amount );
37
+ $invoice->setS2pSurchargeFixedAmount( $surcharge_fixed_amount );
38
+ $invoice->setS2pSurchargeFixedBaseAmount( $surcharge_fixed_base_amount );
39
+
40
+ /*
41
+ $feeAmountLeft = $order_payment->getS2pSurchargeAmount() + $order_payment->getS2pSurchargeFixedAmount() - $order_payment->getS2pSurchargeAmountInvoiced();
42
+ $baseFeeAmountLeft = $order_payment->getS2pSurchargeBaseAmount() + $order_payment->getS2pSurchargeFixedBaseAmount() - $order_payment->getS2pSurchargeBaseAmountInvoiced();
43
+
44
+ if( abs( $baseFeeAmountLeft ) < $invoice->getBaseGrandTotal() )
45
+ {
46
+ $invoice->setGrandTotal( $invoice->getGrandTotal() + $feeAmountLeft );
47
+ $invoice->setBaseGrandTotal( $invoice->getBaseGrandTotal() + $baseFeeAmountLeft );
48
+ } else
49
+ {
50
+ $feeAmountLeft = $invoice->getGrandTotal() * -1;
51
+ $baseFeeAmountLeft = $invoice->getBaseGrandTotal() * -1;
52
+
53
+ $invoice->setGrandTotal(0);
54
+ $invoice->setBaseGrandTotal(0);
55
+ }
56
+
57
+ //$amount_invoiced = $feeAmountLeft;
58
+ //if( $invoice->getS2pSurchargeAmount() < $amount_invoiced )
59
+ $invoice->setS2pSurchargeAmount( $feeAmountLeft );
60
+ $invoice->setS2pSurchargeBaseAmount( $baseFeeAmountLeft );
61
+ */
62
+
63
+ return $this;
64
+ }
65
+ }
app/code/community/Smart2Pay/Globalpay/Model/Sales/Pdf/Surcharge.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Model_Sales_Pdf_Surcharge extends Mage_Sales_Model_Order_Pdf_Total_Default
4
+ {
5
+
6
+ /**
7
+ * Check if we can display total information in PDF
8
+ *
9
+ * @return bool
10
+ */
11
+ public function canDisplay()
12
+ {
13
+ $amount = $this->getAmount();
14
+ $invoice_obj = $this->getSource();
15
+ if( !($invoice_obj instanceof Mage_Sales_Model_Order_Invoice) )
16
+ return false;
17
+
18
+ return $this->getDisplayZero() || ($amount != 0);
19
+ }
20
+
21
+ /**
22
+ * Get Total amount from source
23
+ *
24
+ * @return float
25
+ */
26
+ public function getAmount()
27
+ {
28
+ $invoice_obj = $this->getSource();
29
+ if( !($invoice_obj instanceof Mage_Sales_Model_Order_Invoice) )
30
+ return 0;
31
+
32
+ return $invoice_obj->getS2pSurchargeAmount() + $invoice_obj->getS2pSurchargeFixedAmount();
33
+ }
34
+
35
+ /**
36
+ * Check if tax amount should be included to grandtotal block
37
+ * array(
38
+ * $index => array(
39
+ * 'amount' => $amount,
40
+ * 'label' => $label,
41
+ * 'font_size'=> $font_size
42
+ * )
43
+ * )
44
+ * @return array
45
+ */
46
+ public function getTotalsForDisplay()
47
+ {
48
+ $source = $this->getSource();
49
+ if( !($source instanceof Mage_Sales_Model_Order_Invoice)
50
+ or !$this->getOrder() )
51
+ return array();
52
+
53
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
54
+ $helper_obj = Mage::helper('globalpay/helper');
55
+
56
+ $amount = $this->getAmount();
57
+
58
+ $totals = array();
59
+ $totals['label'] = $helper_obj->format_surcharge_label( $amount, 0 );
60
+ $totals['amount'] = $this->getAmountPrefix() . $this->getOrder()->formatPriceTxt( $amount );
61
+ $totals['font_size'] = ($this->getFontSize() ? $this->getFontSize() : 7);
62
+
63
+ return array( $totals );
64
+ }
65
+
66
+
67
+ }
app/code/community/Smart2Pay/Globalpay/Model/Sales/Quote/Address/Total/Surcharge.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smart2Pay_Globalpay_Model_Sales_Quote_Address_Total_Surcharge extends Mage_Sales_Model_Quote_Address_Total_Abstract
4
+ {
5
+ protected $_code = 'globalpay';
6
+
7
+ public function collect( Mage_Sales_Model_Quote_Address $address )
8
+ {
9
+ parent::collect( $address );
10
+
11
+ /** @var Smart2Pay_Globalpay_Model_Pay $pay_obj */
12
+ if( $address->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_BILLING
13
+ or !($quote = $address->getQuote())
14
+ or !($payment_obj = $quote->getPayment()) )
15
+ return $this;
16
+
17
+ /** @var Smart2Pay_Globalpay_Model_Logger $logger_obj */
18
+ $logger_obj = Mage::getModel( 'globalpay/logger' );
19
+
20
+ if( !($payment_amount = $payment_obj->getS2pSurchargeAmount()) )
21
+ $payment_amount = 0;
22
+ if( !($payment_fixed_amount = $payment_obj->getS2pSurchargeFixedAmount()) )
23
+ $payment_fixed_amount = 0;
24
+ if( !($payment_base_amount = $payment_obj->getS2pSurchargeBaseAmount()) )
25
+ $payment_base_amount = 0;
26
+ if( !($payment_fixed_base_amount = $payment_obj->getS2pSurchargeFixedBaseAmount()) )
27
+ $payment_fixed_base_amount = 0;
28
+ if( !($payment_percent = $payment_obj->getS2pSurchargePercent()) )
29
+ $payment_percent = 0;
30
+
31
+ if( $payment_obj->isDeleted() )
32
+ {
33
+ //$logger_obj->write( 'Deleted Payment ['.$payment_amount.'] Base ['.$payment_base_amount.'] Percent ['.$payment_percent.']' );
34
+
35
+ // clean surcharge as payment was deleted...
36
+ if( $payment_amount != 0 )
37
+ {
38
+ // we already have a surcharge... extract it from total
39
+ $address->setGrandTotal( $address->getGrandTotal() - ($payment_amount + $payment_fixed_amount) );
40
+ }
41
+
42
+ if( $payment_base_amount != 0 )
43
+ {
44
+ // we already have a surcharge... extract it from total
45
+ $address->setBaseGrandTotal( $address->getBaseGrandTotal() - ($payment_base_amount + $payment_fixed_base_amount) );
46
+ }
47
+
48
+ $payment_obj->setS2pSurchargeAmount( 0 );
49
+ $payment_obj->setS2pSurchargeFixedAmount( 0 );
50
+ $payment_obj->setS2pSurchargeBaseAmount( 0 );
51
+ $payment_obj->setS2pSurchargeFixedBaseAmount( 0 );
52
+ $payment_obj->setS2pSurchargePercent( 0 );
53
+
54
+ $address->setS2pSurchargeAmount( 0 );
55
+ $address->setS2pSurchargeFixedAmount( 0 );
56
+ $address->setS2pSurchargeBaseAmount( 0 );
57
+ $address->setS2pSurchargeFixedBaseAmount( 0 );
58
+ $address->setS2pSurchargePercent( 0 );
59
+
60
+ $this->_setAmount( 0 );
61
+ $this->_setBaseAmount( 0 );
62
+
63
+ return $this;
64
+ }
65
+
66
+ //$logger_obj->write( 'Surcharge ['.$payment_amount.'] Base ['.$payment_base_amount.'] Percent ['.$payment_percent.']' );
67
+
68
+ $address->setS2pSurchargeAmount( $payment_amount );
69
+ $address->setS2pSurchargeFixedAmount( $payment_fixed_amount );
70
+
71
+ $this->_addAmount( $address->getS2pSurchargeAmount() + $address->getS2pSurchargeFixedAmount() );
72
+
73
+ $address->setS2pSurchargeBaseAmount( $payment_base_amount );
74
+ $address->setS2pSurchargeFixedBaseAmount( $payment_fixed_base_amount );
75
+
76
+ $this->_addBaseAmount( $address->getS2pSurchargeBaseAmount() + $address->getS2pSurchargeFixedBaseAmount() );
77
+
78
+ //$logger_obj->write( 'Total ['.$address->getGrandTotal().'] Base ['.$address->getBaseGrandTotal().']' );
79
+
80
+ $address->setS2pSurchargePercent( $payment_percent );
81
+
82
+ return $this;
83
+ }
84
+
85
+ public function fetch( Mage_Sales_Model_Quote_Address $address )
86
+ {
87
+ /** @var Smart2Pay_Globalpay_Model_Pay $pay_obj */
88
+ if( $address->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_BILLING
89
+ or !($quote = $address->getQuote())
90
+ or !($payment_obj = $quote->getPayment())
91
+ or $payment_obj->isDeleted()
92
+ or (!$payment_obj->getS2pSurchargeAmount() and !$payment_obj->getS2pSurchargeFixedAmount()) )
93
+ return $this;
94
+
95
+ $payment_percent = $payment_obj->getS2pSurchargePercent();
96
+ $payment_fixed_amount = $payment_obj->getS2pSurchargeFixedAmount();
97
+ $payment_amount = $payment_obj->getS2pSurchargeAmount();
98
+
99
+ /** @var Smart2Pay_Globalpay_Helper_Helper $helper_obj */
100
+ $helper_obj = Mage::helper('globalpay/helper');
101
+
102
+ $address->addTotal( array(
103
+ 'code' => $this->getCode(),
104
+ 'title' => $helper_obj->format_surcharge_label( $payment_amount, $payment_percent, array( 'use_translate' => true ) ),
105
+ 'value' => $helper_obj->format_surcharge_value( $payment_amount + $payment_fixed_amount, $payment_percent ),
106
+ ) );
107
+
108
+ return $this;
109
+ }
110
+ }
app/code/community/Smart2Pay/Globalpay/Model/Source/Testlive.php CHANGED
@@ -10,6 +10,7 @@ class Smart2Pay_Globalpay_Model_Source_Testlive
10
  public function toOptionArray()
11
  {
12
  return array(
 
13
  array('value' => 'test', 'label' => 'Test'),
14
  array('value' => 'live', 'label' => 'Live'),
15
  );
@@ -23,6 +24,7 @@ class Smart2Pay_Globalpay_Model_Source_Testlive
23
  public function toArray()
24
  {
25
  return array(
 
26
  'test' => 'Test',
27
  'live' => 'Live',
28
  );
10
  public function toOptionArray()
11
  {
12
  return array(
13
+ array('value' => 'demo', 'label' => 'Demo'),
14
  array('value' => 'test', 'label' => 'Test'),
15
  array('value' => 'live', 'label' => 'Live'),
16
  );
24
  public function toArray()
25
  {
26
  return array(
27
+ 'demo' => 'Demo',
28
  'test' => 'Test',
29
  'live' => 'Live',
30
  );
app/code/community/Smart2Pay/Globalpay/Model/Transactionlogger.php CHANGED
@@ -63,23 +63,30 @@ class Smart2Pay_Globalpay_Model_Transactionlogger extends Mage_Core_Model_Abstra
63
  'method_id' => 0,
64
  'payment_id' => 0,
65
  'merchant_transaction_id' => '',
 
66
  'site_id' => 0,
67
  'extra_data' => '',
68
  );
69
  }
70
 
71
- static function validateTransactionLoggerParams( $params_arr )
72
  {
73
  if( empty( $params_arr ) or !is_array( $params_arr ) )
74
  $params_arr = array();
75
 
 
 
 
 
 
76
  $default_values = self::defaultTransactionLoggerParams();
77
  $new_params_arr = array();
78
  foreach( $default_values as $key => $val )
79
  {
80
  if( !array_key_exists( $key, $params_arr ) )
81
  {
82
- $new_params_arr[$key] = $val;
 
83
  continue;
84
  }
85
 
@@ -146,11 +153,6 @@ class Smart2Pay_Globalpay_Model_Transactionlogger extends Mage_Core_Model_Abstra
146
 
147
  $transaction_arr['extra_data'] = $transaction_extra_str;
148
 
149
- if( !($insert_arr = self::validateTransactionLoggerParams( $transaction_arr )) )
150
- return false;
151
-
152
- $insert_arr['updated'] = new Zend_Db_Expr('NOW()');
153
-
154
  try
155
  {
156
  /** @var Magento_Db_Adapter_Pdo_Mysql $conn_write */
@@ -162,12 +164,30 @@ class Smart2Pay_Globalpay_Model_Transactionlogger extends Mage_Core_Model_Abstra
162
  if( !empty( $transaction_arr['merchant_transaction_id'] )
163
  and ($existing_id = $conn_read->fetchOne( 'SELECT id FROM s2p_gp_transactions WHERE merchant_transaction_id = \''.$s2pHelper->prepare_data( $transaction_arr['merchant_transaction_id'] ).'\' LIMIT 0, 1' )) )
164
  {
 
 
 
 
 
165
  // we should update record
166
  $conn_write->update( 's2p_gp_transactions', $insert_arr, 'id = \''.$existing_id.'\'' );
167
 
168
  $s2pLogger->write( 'Update transaction ['.$existing_id.']', 'trans_logger' );
169
  } else
170
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  // we should insert record
172
  //$conn_write->query( $sql );
173
  $conn_write->insert( 's2p_gp_transactions', $insert_arr );
63
  'method_id' => 0,
64
  'payment_id' => 0,
65
  'merchant_transaction_id' => '',
66
+ 'environment' => '',
67
  'site_id' => 0,
68
  'extra_data' => '',
69
  );
70
  }
71
 
72
+ static function validateTransactionLoggerParams( $params_arr, $extra_arr = false )
73
  {
74
  if( empty( $params_arr ) or !is_array( $params_arr ) )
75
  $params_arr = array();
76
 
77
+ if( empty( $extra_arr ) or !is_array( $extra_arr ) )
78
+ $extra_arr = array();
79
+ if( !isset( $extra_arr['populate_missing_fields'] ) )
80
+ $extra_arr['populate_missing_fields'] = true;
81
+
82
  $default_values = self::defaultTransactionLoggerParams();
83
  $new_params_arr = array();
84
  foreach( $default_values as $key => $val )
85
  {
86
  if( !array_key_exists( $key, $params_arr ) )
87
  {
88
+ if( !empty( $extra_arr['populate_missing_fields'] ) )
89
+ $new_params_arr[$key] = $val;
90
  continue;
91
  }
92
 
153
 
154
  $transaction_arr['extra_data'] = $transaction_extra_str;
155
 
 
 
 
 
 
156
  try
157
  {
158
  /** @var Magento_Db_Adapter_Pdo_Mysql $conn_write */
164
  if( !empty( $transaction_arr['merchant_transaction_id'] )
165
  and ($existing_id = $conn_read->fetchOne( 'SELECT id FROM s2p_gp_transactions WHERE merchant_transaction_id = \''.$s2pHelper->prepare_data( $transaction_arr['merchant_transaction_id'] ).'\' LIMIT 0, 1' )) )
166
  {
167
+ if( !($insert_arr = self::validateTransactionLoggerParams( $transaction_arr, array( 'populate_missing_fields' => false ) )) )
168
+ return false;
169
+
170
+ $insert_arr['updated'] = new Zend_Db_Expr('NOW()');
171
+
172
  // we should update record
173
  $conn_write->update( 's2p_gp_transactions', $insert_arr, 'id = \''.$existing_id.'\'' );
174
 
175
  $s2pLogger->write( 'Update transaction ['.$existing_id.']', 'trans_logger' );
176
  } else
177
  {
178
+ if( !($insert_arr = self::validateTransactionLoggerParams( $transaction_arr, array( 'populate_missing_fields' => true ) )) )
179
+ return false;
180
+
181
+ $insert_arr['updated'] = new Zend_Db_Expr('NOW()');
182
+
183
+ if( empty( $insert_arr['environment'] ) )
184
+ {
185
+ /** @var Smart2Pay_Globalpay_Model_Pay $s2pPayModel */
186
+ $s2pPayModel = Mage::getModel( 'globalpay/pay' );
187
+
188
+ $insert_arr['environment'] = (!empty( $s2pPayModel->method_config['environment'] )?$s2pPayModel->method_config['environment']:'');
189
+ }
190
+
191
  // we should insert record
192
  //$conn_write->query( $sql );
193
  $conn_write->insert( 's2p_gp_transactions', $insert_arr );
app/code/community/Smart2Pay/Globalpay/controllers/IndexController.php CHANGED
@@ -173,7 +173,7 @@ class Smart2pay_Globalpay_IndexController extends Mage_Core_Controller_Front_Act
173
  $orderCurrency = $order->getOrderCurrency()->getCurrencyCode();
174
 
175
  if( strcmp( $orderAmount, $response['Amount'] ) != 0
176
- and $orderCurrency != $response['Currency'] )
177
  $order->addStatusHistoryComment( 'Smart2Pay :: notification has different amount ['.$orderAmount.'/'.$response['Amount'] . '] and/or currency ['.$orderCurrency.'/' . $response['Currency'] . ']!. Please contact support@smart2pay.com', $payMethod->method_config['order_status_on_4'] );
178
 
179
  else
@@ -301,23 +301,29 @@ class Smart2pay_Globalpay_IndexController extends Mage_Core_Controller_Front_Act
301
 
302
  public function informCustomer(Mage_Sales_Model_Order $order, $amount, $currency)
303
  {
 
 
 
304
  try
305
  {
306
  /** @var $order Mage_Sales_Model_Order */
 
307
  /**
308
  * get data for template
309
  */
310
- $siteUrl = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_LINK );
311
- $siteName = Mage::app()->getWebsite(1)->getName();
312
 
313
- $subject = $siteName.' - Payment confirmation';
 
314
 
315
- $supportEmail = Mage::getStoreConfig('trans_email/ident_support/email');
316
- $supportName = Mage::getStoreConfig('trans_email/ident_support/name');
 
 
317
 
318
- $localeCode = Mage::getStoreConfig('general/locale/code', $order->getStoreId());
319
 
320
- $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PAYMENT_CONFIRMATION);
321
 
322
 
323
  /** @var $mailTemplate Mage_Core_Model_Email_Template */
@@ -328,12 +334,17 @@ class Smart2pay_Globalpay_IndexController extends Mage_Core_Controller_Front_Act
328
  $mailTemplate->loadDefault($templateId, $localeCode);
329
  }
330
 
331
- $mailTemplate->setSenderName($supportName);
332
- $mailTemplate->setSenderEmail($supportEmail);
333
- $mailTemplate->setTemplateSubject('Payment Confirmation');
334
- $mailTemplate->setTemplateSubject($subject);
 
 
 
335
 
336
- $mailTemplate->send($order->getCustomerEmail(), $order->getCustomerName(), array(
 
 
337
  'site_url' => $siteUrl,
338
  'order_increment_id' => $order->getRealOrderId(),
339
  'site_name' => $siteName,
@@ -343,7 +354,9 @@ class Smart2pay_Globalpay_IndexController extends Mage_Core_Controller_Front_Act
343
  'currency' => $currency,
344
  'support_email' => $supportEmail
345
  )
346
- );
 
 
347
  } catch (Exception $e) {
348
  Mage::getModel('globalpay/logger')->write($e->getMessage(), 'exception');
349
  }
@@ -488,30 +501,33 @@ class Smart2pay_Globalpay_IndexController extends Mage_Core_Controller_Front_Act
488
  try
489
  {
490
  /** @var $order Mage_Sales_Model_Order */
 
491
  /**
492
  * get data for template
493
  */
494
- $siteUrl = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_LINK );
495
- $siteName = Mage::app()->getWebsite(1)->getName();
496
 
497
- $order_increment_id = $order->getRealOrderId();
 
 
498
 
499
- $subject = $siteName." - ".$this->__( 'PaymentInstructionsSubject', $order_increment_id );
 
500
 
501
- $supportEmail = Mage::getStoreConfig( 'trans_email/ident_support/email' );
502
- $supportName = Mage::getStoreConfig( 'trans_email/ident_support/name' );
 
 
503
 
504
  $localeCode = Mage::getStoreConfig( 'general/locale/code', $order->getStoreId() );
505
 
506
  if( ($s2p_transaction_arr = $s2pTransactionLogger->getTransactionDetailsAsArray( $order_increment_id ))
507
  and $s2p_transaction_arr['method_id'] == $payMethod::PAYMENT_METHOD_SIBS )
508
  {
509
- $s2pLogger->write( '['.self::XML_PATH_EMAIL_PAYMENT_INSTRUCTIONS_SIBS.']', 'email_template' );
510
- $templateId = Mage::getStoreConfig( self::XML_PATH_EMAIL_PAYMENT_INSTRUCTIONS_SIBS );
511
  } else
512
  {
513
- $s2pLogger->write( '['.self::XML_PATH_EMAIL_PAYMENT_INSTRUCTIONS.']', 'email_template' );
514
- $templateId = Mage::getStoreConfig( self::XML_PATH_EMAIL_PAYMENT_INSTRUCTIONS );
515
  }
516
 
517
  /** @var $mailTemplate Mage_Core_Model_Email_Template */
@@ -522,9 +538,14 @@ class Smart2pay_Globalpay_IndexController extends Mage_Core_Controller_Front_Act
522
  else
523
  $mailTemplate->loadDefault( $templateId, $localeCode );
524
 
 
 
 
 
 
525
  $mailTemplate->setSenderName( $supportName );
526
  $mailTemplate->setSenderEmail( $supportEmail );
527
- $mailTemplate->setTemplateSubject( $this->__('PaymentInstructions') );
528
  $mailTemplate->setTemplateSubject( $subject );
529
 
530
  // Extra details
173
  $orderCurrency = $order->getOrderCurrency()->getCurrencyCode();
174
 
175
  if( strcmp( $orderAmount, $response['Amount'] ) != 0
176
+ or $orderCurrency != $response['Currency'] )
177
  $order->addStatusHistoryComment( 'Smart2Pay :: notification has different amount ['.$orderAmount.'/'.$response['Amount'] . '] and/or currency ['.$orderCurrency.'/' . $response['Currency'] . ']!. Please contact support@smart2pay.com', $payMethod->method_config['order_status_on_4'] );
178
 
179
  else
301
 
302
  public function informCustomer(Mage_Sales_Model_Order $order, $amount, $currency)
303
  {
304
+ /** @var Smart2Pay_Globalpay_Model_Logger $s2pLogger */
305
+ $s2pLogger = Mage::getModel( 'globalpay/logger' );
306
+
307
  try
308
  {
309
  /** @var $order Mage_Sales_Model_Order */
310
+ /** @var $store_obj Mage_Core_Model_Store */
311
  /**
312
  * get data for template
313
  */
314
+ $store_obj = $order->getStore();
 
315
 
316
+ $siteUrl = $store_obj->getBaseUrl( Mage_Core_Model_Store::URL_TYPE_LINK ); // Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_LINK );
317
+ $siteName = Mage::app()->getWebsite( $store_obj->getWebsiteId() )->getName();
318
 
319
+ $supportEmail = Mage::getStoreConfig( 'trans_email/ident_support/email', $order->getStoreId() );
320
+ $supportName = Mage::getStoreConfig( 'trans_email/ident_support/name', $order->getStoreId() );
321
+
322
+ $localeCode = Mage::getStoreConfig( 'general/locale/code', $order->getStoreId() );
323
 
324
+ $templateId = Mage::getStoreConfig( self::XML_PATH_EMAIL_PAYMENT_CONFIRMATION, $order->getStoreId() );
325
 
326
+ $order_increment_id = $order->getRealOrderId();
327
 
328
 
329
  /** @var $mailTemplate Mage_Core_Model_Email_Template */
334
  $mailTemplate->loadDefault($templateId, $localeCode);
335
  }
336
 
337
+ if( !($subject = $mailTemplate->getTemplateSubject()) )
338
+ $subject = $this->__( 'Payment confirmation', $order_increment_id );
339
+
340
+ $subject = $siteName.' - '.$subject;
341
+
342
+ $mailTemplate->setSenderName( $supportName );
343
+ $mailTemplate->setSenderEmail( $supportEmail );
344
 
345
+ $mailTemplate->setTemplateSubject( $subject );
346
+
347
+ if( !$mailTemplate->send( $order->getCustomerEmail(), $order->getCustomerName(), array(
348
  'site_url' => $siteUrl,
349
  'order_increment_id' => $order->getRealOrderId(),
350
  'site_name' => $siteName,
354
  'currency' => $currency,
355
  'support_email' => $supportEmail
356
  )
357
+ ) )
358
+ $s2pLogger->write( 'Error sending customer informational email to ['.$order->getCustomerEmail().']', 'email_template' );
359
+
360
  } catch (Exception $e) {
361
  Mage::getModel('globalpay/logger')->write($e->getMessage(), 'exception');
362
  }
501
  try
502
  {
503
  /** @var $order Mage_Sales_Model_Order */
504
+ /** @var $store_obj Mage_Core_Model_Store */
505
  /**
506
  * get data for template
507
  */
508
+ $store_obj = $order->getStore();
 
509
 
510
+ //$siteUrl = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_LINK );
511
+ // $siteName = Mage::app()->getWebsite(1)->getName();
512
+ //$siteName = Mage::app()->getWebsite()->getName();
513
 
514
+ $siteUrl = $store_obj->getBaseUrl( Mage_Core_Model_Store::URL_TYPE_LINK );
515
+ $siteName = Mage::app()->getWebsite( $store_obj->getWebsiteId() )->getName();
516
 
517
+ $order_increment_id = $order->getRealOrderId();
518
+
519
+ $supportEmail = Mage::getStoreConfig( 'trans_email/ident_support/email', $order->getStoreId() );
520
+ $supportName = Mage::getStoreConfig( 'trans_email/ident_support/name', $order->getStoreId() );
521
 
522
  $localeCode = Mage::getStoreConfig( 'general/locale/code', $order->getStoreId() );
523
 
524
  if( ($s2p_transaction_arr = $s2pTransactionLogger->getTransactionDetailsAsArray( $order_increment_id ))
525
  and $s2p_transaction_arr['method_id'] == $payMethod::PAYMENT_METHOD_SIBS )
526
  {
527
+ $templateId = Mage::getStoreConfig( self::XML_PATH_EMAIL_PAYMENT_INSTRUCTIONS_SIBS, $order->getStoreId() );
 
528
  } else
529
  {
530
+ $templateId = Mage::getStoreConfig( self::XML_PATH_EMAIL_PAYMENT_INSTRUCTIONS, $order->getStoreId() );
 
531
  }
532
 
533
  /** @var $mailTemplate Mage_Core_Model_Email_Template */
538
  else
539
  $mailTemplate->loadDefault( $templateId, $localeCode );
540
 
541
+ if( !($subject = $mailTemplate->getTemplateSubject()) )
542
+ $subject = $this->__( 'PaymentInstructionsSubject', $order_increment_id );
543
+
544
+ $subject = $siteName.' - '.$subject;
545
+
546
  $mailTemplate->setSenderName( $supportName );
547
  $mailTemplate->setSenderEmail( $supportEmail );
548
+
549
  $mailTemplate->setTemplateSubject( $subject );
550
 
551
  // Extra details
app/code/community/Smart2Pay/Globalpay/etc/config.xml CHANGED
@@ -1,10 +1,12 @@
1
  <?xml version="1.0"?>
2
  <config>
 
3
  <modules>
4
  <Smart2Pay_Globalpay>
5
- <version>1.1.5</version>
6
  </Smart2Pay_Globalpay>
7
  </modules>
 
8
  <frontend>
9
  <routers>
10
  <globalpay>
@@ -33,7 +35,216 @@
33
  </translate>
34
  </frontend>
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  <global>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  <template>
38
  <email>
39
  <payment_globalpay_payment_confirmation_template translate="label" module="globalpay">
@@ -87,28 +298,42 @@
87
  <transactionlogger>
88
  <table>s2p_gp_transactions</table>
89
  </transactionlogger>
 
 
 
90
  <logger>
91
  <table>s2p_gp_logs</table>
92
  </logger>
93
  </entities>
94
  </globalpay_resource>
95
  </models>
 
96
  <blocks>
97
  <globalpay>
98
  <class>Smart2Pay_Globalpay_Block</class>
99
  </globalpay>
100
  </blocks>
 
101
  <helpers>
102
  <globalpay>
103
  <class>Smart2Pay_Globalpay_Helper</class>
104
  </globalpay>
105
  </helpers>
106
  </global>
 
107
  <default>
 
 
 
 
 
 
 
108
  <payment>
109
  <globalpay>
110
  <active>1</active>
111
  <model>globalpay/pay</model>
 
112
  <order_status>holded</order_status>
113
  <order_status_on_2>processing</order_status_on_2>
114
  <order_status_on_3>canceled</order_status_on_3>
@@ -118,6 +343,7 @@
118
  <post_url_live>https://api.smart2pay.com</post_url_live>
119
  <post_url_test>https://apitest.smart2pay.com</post_url_test>
120
  <methods>1,2,3,4,5,8,9,12,13,14,18,19,20,22,23,24,25,27,28,29,32,33,34,35,36,37,40,42,43,44,46,47,48,49,62,63,64,65,66,67,72,73,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043</methods>
 
121
  <product_description_ref>1</product_description_ref>
122
  <autoselect_s2p>1</autoselect_s2p>
123
  <skip_payment_page>1</skip_payment_page>
@@ -128,6 +354,7 @@
128
  <message_data_4><![CDATA[There was a problem processing your payment. Please try again.]]></message_data_4>
129
  <message_data_3><![CDATA[You have canceled the payment.]]></message_data_3>
130
  <message_data_7><![CDATA[Thank you, the transaction is pending. After we receive the final confirmation, we will release the goods.]]></message_data_7>
 
131
  </globalpay>
132
  </payment>
133
  </default>
1
  <?xml version="1.0"?>
2
  <config>
3
+
4
  <modules>
5
  <Smart2Pay_Globalpay>
6
+ <version>1.1.6</version>
7
  </Smart2Pay_Globalpay>
8
  </modules>
9
+
10
  <frontend>
11
  <routers>
12
  <globalpay>
35
  </translate>
36
  </frontend>
37
 
38
+ <!--
39
+ <admin>
40
+ <routers>
41
+ <globalpay>
42
+ <use>admin</use>
43
+ <args>
44
+ <module>
45
+ <Smart2pay_Globalpay after="Mage_Adminhtml">Smart2pay_Globalpay</Smart2pay_Globalpay>
46
+ </module>
47
+ </args>
48
+ </globalpay>
49
+ </routers>
50
+ </admin>
51
+ -->
52
+ <adminhtml>
53
+
54
+ <layout>
55
+ <updates>
56
+ <globalpay>
57
+ <file>globalpay.xml</file>
58
+ </globalpay>
59
+ </updates>
60
+ </layout>
61
+
62
+ <!--
63
+ <routers>
64
+ <globalpay>
65
+ <use>admin</use>
66
+ <args>
67
+ <module>Smart2Pay_Globalpay</module>
68
+ <frontName>globalpay_admin</frontName>
69
+ </args>
70
+ </globalpay>
71
+ </routers>
72
+ -->
73
+
74
+ <translate>
75
+ <modules>
76
+ <Smart2Pay_Globalpay>
77
+ <files>
78
+ <default>Smart2Pay_Globalpay.csv</default>
79
+ </files>
80
+ </Smart2Pay_Globalpay>
81
+ </modules>
82
+ </translate>
83
+
84
+ </adminhtml>
85
+
86
  <global>
87
+
88
+ <events>
89
+
90
+ <!-- Cart related -->
91
+ <checkout_cart_save_after>
92
+ <observers>
93
+ <Smart2Pay_Globalpay_cart_observer>
94
+ <type>singleton</type>
95
+ <class>globalpay/sales_observer</class>
96
+ <method>remove_surcharge_from_cart</method>
97
+ </Smart2Pay_Globalpay_cart_observer>
98
+ </observers>
99
+ </checkout_cart_save_after>
100
+
101
+ <checkout_quote_init>
102
+ <observers>
103
+ <Smart2Pay_Globalpay_quote_observer>
104
+ <type>singleton</type>
105
+ <class>globalpay/sales_observer</class>
106
+ <method>remove_surcharge_from_quote</method>
107
+ </Smart2Pay_Globalpay_quote_observer>
108
+ </observers>
109
+ </checkout_quote_init>
110
+ <checkout_quote_destroy>
111
+ <observers>
112
+ <Smart2Pay_Globalpay_quote_observer>
113
+ <type>singleton</type>
114
+ <class>globalpay/sales_observer</class>
115
+ <method>remove_surcharge_from_quote</method>
116
+ </Smart2Pay_Globalpay_quote_observer>
117
+ </observers>
118
+ </checkout_quote_destroy>
119
+
120
+ <sales_quote_add_item>
121
+ <observers>
122
+ <Smart2Pay_Globalpay_quote_observer>
123
+ <type>singleton</type>
124
+ <class>globalpay/sales_observer</class>
125
+ <method>remove_surcharge_from_quote_item</method>
126
+ </Smart2Pay_Globalpay_quote_observer>
127
+ </observers>
128
+ </sales_quote_add_item>
129
+ <sales_quote_remove_item>
130
+ <observers>
131
+ <Smart2Pay_Globalpay_quote_observer>
132
+ <type>singleton</type>
133
+ <class>globalpay/sales_observer</class>
134
+ <method>remove_surcharge_from_quote_item</method>
135
+ </Smart2Pay_Globalpay_quote_observer>
136
+ </observers>
137
+ </sales_quote_remove_item>
138
+
139
+ <!-- Order related -->
140
+ <sales_order_payment_place_start>
141
+ <observers>
142
+ <Smart2Pay_Globalpay_order_observer>
143
+ <class>globalpay/sales_observer</class>
144
+ <method>order_payment_place</method>
145
+ </Smart2Pay_Globalpay_order_observer>
146
+ </observers>
147
+ </sales_order_payment_place_start>
148
+
149
+ <!-- Invoice related -->
150
+ <sales_order_invoice_save_after>
151
+ <observers>
152
+ <Smart2Pay_Globalpay_invoice_observer>
153
+ <class>globalpay/sales_observer</class>
154
+ <method>invoice_save</method>
155
+ </Smart2Pay_Globalpay_invoice_observer>
156
+ </observers>
157
+ </sales_order_invoice_save_after>
158
+
159
+ <!-- Admin configuration related -->
160
+ <!--
161
+ <model_config_data_save_before>
162
+ <observers>
163
+ <Smart2Pay_Globalpay_admin_observer>
164
+ <class>globalpay/sales_observer</class>
165
+ <method>configuration_save</method>
166
+ </Smart2Pay_Globalpay_admin_observer>
167
+ </observers>
168
+ </model_config_data_save_before>
169
+ -->
170
+ </events>
171
+
172
+ <sales>
173
+ <quote>
174
+ <totals>
175
+ <Smart2Pay_Globalpay>
176
+ <class>globalpay/sales_quote_address_total_surcharge</class>
177
+ <after>shipping,tax</after>
178
+ <before>grand_total</before>
179
+ </Smart2Pay_Globalpay>
180
+ </totals>
181
+ </quote>
182
+ <order_invoice>
183
+ <totals>
184
+ <Smart2Pay_Globalpay>
185
+ <class>globalpay/sales_order_invoice_total_surcharge</class>
186
+ <after>shipping,tax</after>
187
+ <before>grand_total</before>
188
+ </Smart2Pay_Globalpay>
189
+ </totals>
190
+ </order_invoice>
191
+ </sales>
192
+
193
+ <pdf>
194
+ <totals>
195
+ <Smart2Pay_Globalpay translate="title">
196
+ <title>Payment Method Fee</title>
197
+ <source_field>s2p_surcharge_amount</source_field>
198
+ <model>globalpay/sales_pdf_surcharge</model>
199
+ <font_size>7</font_size>
200
+ <display_zero>0</display_zero>
201
+ <sort_order>699</sort_order>
202
+ </Smart2Pay_Globalpay>
203
+ </totals>
204
+ </pdf>
205
+
206
+ <fieldsets>
207
+ <sales_convert_quote_payment>
208
+ <s2p_surcharge_amount>
209
+ <to_order_payment>*</to_order_payment>
210
+ </s2p_surcharge_amount>
211
+ <s2p_surcharge_base_amount>
212
+ <to_order_payment>*</to_order_payment>
213
+ </s2p_surcharge_base_amount>
214
+ <s2p_surcharge_percent>
215
+ <to_order_payment>*</to_order_payment>
216
+ </s2p_surcharge_percent>
217
+ <s2p_surcharge_fixed_amount>
218
+ <to_order_payment>*</to_order_payment>
219
+ </s2p_surcharge_fixed_amount>
220
+ <s2p_surcharge_fixed_base_amount>
221
+ <to_order_payment>*</to_order_payment>
222
+ </s2p_surcharge_fixed_base_amount>
223
+ </sales_convert_quote_payment>
224
+
225
+ <sales_convert_order_payment>
226
+ <s2p_surcharge_amount>
227
+ <to_quote_payment>*</to_quote_payment>
228
+ <to_invoice>*</to_invoice>
229
+ </s2p_surcharge_amount>
230
+ <s2p_surcharge_base_amount>
231
+ <to_quote_payment>*</to_quote_payment>
232
+ <to_invoice>*</to_invoice>
233
+ </s2p_surcharge_base_amount>
234
+ <s2p_surcharge_fixed_amount>
235
+ <to_quote_payment>*</to_quote_payment>
236
+ <to_invoice>*</to_invoice>
237
+ </s2p_surcharge_fixed_amount>
238
+ <s2p_surcharge_fixed_base_amount>
239
+ <to_quote_payment>*</to_quote_payment>
240
+ <to_invoice>*</to_invoice>
241
+ </s2p_surcharge_fixed_base_amount>
242
+ <s2p_surcharge_percent>
243
+ <to_quote_payment>*</to_quote_payment>
244
+ </s2p_surcharge_percent>
245
+ </sales_convert_order_payment>
246
+ </fieldsets>
247
+
248
  <template>
249
  <email>
250
  <payment_globalpay_payment_confirmation_template translate="label" module="globalpay">
298
  <transactionlogger>
299
  <table>s2p_gp_transactions</table>
300
  </transactionlogger>
301
+ <configuredmethods>
302
+ <table>s2p_gp_methods_configured</table>
303
+ </configuredmethods>
304
  <logger>
305
  <table>s2p_gp_logs</table>
306
  </logger>
307
  </entities>
308
  </globalpay_resource>
309
  </models>
310
+
311
  <blocks>
312
  <globalpay>
313
  <class>Smart2Pay_Globalpay_Block</class>
314
  </globalpay>
315
  </blocks>
316
+
317
  <helpers>
318
  <globalpay>
319
  <class>Smart2Pay_Globalpay_Helper</class>
320
  </globalpay>
321
  </helpers>
322
  </global>
323
+
324
  <default>
325
+
326
+ <sales>
327
+ <totals_sort>
328
+ <Smart2Pay_Globalpay>99</Smart2Pay_Globalpay>
329
+ </totals_sort>
330
+ </sales>
331
+
332
  <payment>
333
  <globalpay>
334
  <active>1</active>
335
  <model>globalpay/pay</model>
336
+ <environment>demo</environment>
337
  <order_status>holded</order_status>
338
  <order_status_on_2>processing</order_status_on_2>
339
  <order_status_on_3>canceled</order_status_on_3>
343
  <post_url_live>https://api.smart2pay.com</post_url_live>
344
  <post_url_test>https://apitest.smart2pay.com</post_url_test>
345
  <methods>1,2,3,4,5,8,9,12,13,14,18,19,20,22,23,24,25,27,28,29,32,33,34,35,36,37,40,42,43,44,46,47,48,49,62,63,64,65,66,67,72,73,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043</methods>
346
+ <display_surcharge>0</display_surcharge>
347
  <product_description_ref>1</product_description_ref>
348
  <autoselect_s2p>1</autoselect_s2p>
349
  <skip_payment_page>1</skip_payment_page>
354
  <message_data_4><![CDATA[There was a problem processing your payment. Please try again.]]></message_data_4>
355
  <message_data_3><![CDATA[You have canceled the payment.]]></message_data_3>
356
  <message_data_7><![CDATA[Thank you, the transaction is pending. After we receive the final confirmation, we will release the goods.]]></message_data_7>
357
+ <selected_methods>0</selected_methods>
358
  </globalpay>
359
  </payment>
360
  </default>
app/code/community/Smart2Pay/Globalpay/etc/system.xml CHANGED
@@ -1,15 +1,34 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <sections>
4
- <payment>
 
5
  <groups>
6
- <globalpay translate="label" module="paygate">
 
 
7
  <label>Smart2Pay Payment Module</label>
8
  <sort_order>670</sort_order>
9
  <show_in_default>1</show_in_default>
10
  <show_in_website>1</show_in_website>
11
  <show_in_store>1</show_in_store>
 
 
12
  <fields>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  <active translate="label">
14
  <label>Enabled</label>
15
  <frontend_type>select</frontend_type>
@@ -18,15 +37,18 @@
18
  <show_in_default>1</show_in_default>
19
  <show_in_website>1</show_in_website>
20
  <show_in_store>1</show_in_store>
 
21
  </active>
22
  <environment translate="label">
23
- <label><![CDATA[<b>&raquo; Environment</b>]]> </label>
 
24
  <frontend_type>select</frontend_type>
25
  <source_model>globalpay/source_testlive</source_model>
26
  <sort_order>1</sort_order>
27
  <show_in_default>1</show_in_default>
28
  <show_in_website>1</show_in_website>
29
  <show_in_store>1</show_in_store>
 
30
  </environment>
31
  <post_url_live translate="label">
32
  <label><![CDATA[<b>&raquo; Post URL Live</b>]]></label>
@@ -36,6 +58,7 @@
36
  <show_in_default>1</show_in_default>
37
  <show_in_website>1</show_in_website>
38
  <show_in_store>0</show_in_store>
 
39
  </post_url_live>
40
  <post_url_test translate="label">
41
  <label><![CDATA[<b>&raquo; Post URL Test</b>]]></label>
@@ -45,6 +68,7 @@
45
  <show_in_default>1</show_in_default>
46
  <show_in_website>1</show_in_website>
47
  <show_in_store>0</show_in_store>
 
48
  </post_url_test>
49
  <mid_live translate="label">
50
  <label><![CDATA[<b>&raquo; MID Live</b>]]></label>
@@ -54,6 +78,7 @@
54
  <show_in_default>1</show_in_default>
55
  <show_in_website>1</show_in_website>
56
  <show_in_store>0</show_in_store>
 
57
  </mid_live>
58
  <mid_test translate="label">
59
  <label><![CDATA[<b>&raquo; MID Test</b>]]></label>
@@ -63,6 +88,7 @@
63
  <show_in_default>1</show_in_default>
64
  <show_in_website>1</show_in_website>
65
  <show_in_store>0</show_in_store>
 
66
  </mid_test>
67
  <site_id translate="label">
68
  <label><![CDATA[Site ID]]></label>
@@ -71,6 +97,7 @@
71
  <show_in_default>1</show_in_default>
72
  <show_in_website>1</show_in_website>
73
  <show_in_store>1</show_in_store>
 
74
  </site_id>
75
  <signature_live translate="label">
76
  <label><![CDATA[<b>&raquo; Signature Live</b>]]></label>
@@ -80,6 +107,7 @@
80
  <show_in_default>1</show_in_default>
81
  <show_in_website>1</show_in_website>
82
  <show_in_store>1</show_in_store>
 
83
  </signature_live>
84
  <signature_test translate="label">
85
  <label><![CDATA[<b>&raquo; Signature Test</b>]]></label>
@@ -89,6 +117,7 @@
89
  <show_in_default>1</show_in_default>
90
  <show_in_website>1</show_in_website>
91
  <show_in_store>1</show_in_store>
 
92
  </signature_test>
93
  <return_url translate="label">
94
  <label><![CDATA[<b>&raquo; Return URL</b>]]></label>
@@ -98,6 +127,7 @@
98
  <show_in_default>1</show_in_default>
99
  <show_in_website>1</show_in_website>
100
  <show_in_store>1</show_in_store>
 
101
  </return_url>
102
  <title translate="label">
103
  <label><![CDATA[Title]]></label>
@@ -107,204 +137,8 @@
107
  <show_in_default>1</show_in_default>
108
  <show_in_website>1</show_in_website>
109
  <show_in_store>1</show_in_store>
 
110
  </title>
111
- <methods translate="label">
112
- <label><![CDATA[Active methods]]></label>
113
- <frontend_type>multiselect</frontend_type>
114
- <sort_order>13</sort_order>
115
- <source_model>globalpay/source_methods</source_model>
116
- <show_in_default>1</show_in_default>
117
- <show_in_website>1</show_in_website>
118
- <show_in_store>1</show_in_store>
119
- </methods>
120
- <methods_display_mode translate="label">
121
- <label><![CDATA[Methods display mode]]></label>
122
- <frontend_type>select</frontend_type>
123
- <source_model>globalpay/source_displaymodes</source_model>
124
- <sort_order>14</sort_order>
125
- <show_in_default>1</show_in_default>
126
- <show_in_website>1</show_in_website>
127
- <show_in_store>1</show_in_store>
128
- </methods_display_mode>
129
- <show_methods_in_grid translate="label">
130
- <label><![CDATA[Show methods in grid]]></label>
131
- <comment>By default, methods will be displayed as a two columns table, having paymentm method's logo or name and description. When set to yes, description is omitted, and columns number can be specified bellow.</comment>
132
- <frontend_type>select</frontend_type>
133
- <source_model>adminhtml/system_config_source_yesno</source_model>
134
- <sort_order>15</sort_order>
135
- <show_in_default>1</show_in_default>
136
- <show_in_website>1</show_in_website>
137
- <show_in_store>1</show_in_store>
138
- </show_methods_in_grid>
139
- <grid_column_number translate="label">
140
- <label>Grid column number</label>
141
- <comment>Please provide a number, if left blank, the default value is 3 (This value is used only if above option is set to yes)</comment>
142
- <frontend_type>text</frontend_type>
143
- <sort_order>16</sort_order>
144
- <show_in_default>1</show_in_default>
145
- <show_in_website>1</show_in_website>
146
- <show_in_store>1</show_in_store>
147
- </grid_column_number>
148
- <product_description_ref translate="label">
149
- <label>Send order number as product description</label>
150
- <comment>If "No" is selected, the below custom description will be send</comment>
151
- <frontend_type>select</frontend_type>
152
- <source_model>adminhtml/system_config_source_yesno</source_model>
153
- <sort_order>20</sort_order>
154
- <show_in_default>1</show_in_default>
155
- <show_in_website>1</show_in_website>
156
- <show_in_store>1</show_in_store>
157
- </product_description_ref>
158
- <product_description_custom translate="label">
159
- <label>Custom product description</label>
160
- <frontend_type>textarea</frontend_type>
161
- <source_model>adminhtml/system_config_source_yesno</source_model>
162
- <sort_order>21</sort_order>
163
- <show_in_default>1</show_in_default>
164
- <show_in_website>1</show_in_website>
165
- <show_in_store>1</show_in_store>
166
- </product_description_custom>
167
- <notify_customer translate="label">
168
- <label>Notify customer by email</label>
169
- <comment>Send a confirmation email to the customer on success payment notification</comment>
170
- <frontend_type>select</frontend_type>
171
- <source_model>adminhtml/system_config_source_yesno</source_model>
172
- <sort_order>22</sort_order>
173
- <show_in_default>1</show_in_default>
174
- <show_in_website>1</show_in_website>
175
- <show_in_store>1</show_in_store>
176
- </notify_customer>
177
- <payment_confirmation_template translate="label">
178
- <label>Payment Confirmation Template</label>
179
- <frontend_type>select</frontend_type>
180
- <source_model>adminhtml/system_config_source_email_template</source_model>
181
- <sort_order>23</sort_order>
182
- <show_in_default>1</show_in_default>
183
- <show_in_website>1</show_in_website>
184
- <show_in_store>1</show_in_store>
185
- </payment_confirmation_template>
186
- <notify_payment_instructions translate="label">
187
- <label>Send payment instructions on order creation</label>
188
- <comment>Send a confirmation email to the customer on order creation with payment details</comment>
189
- <frontend_type>select</frontend_type>
190
- <source_model>adminhtml/system_config_source_yesno</source_model>
191
- <sort_order>24</sort_order>
192
- <show_in_default>1</show_in_default>
193
- <show_in_website>1</show_in_website>
194
- <show_in_store>1</show_in_store>
195
- </notify_payment_instructions>
196
- <payment_instructions_template translate="label">
197
- <label><![CDATA[Payment Instructions Template (for Bank Transafer)]]></label>
198
- <frontend_type>select</frontend_type>
199
- <source_model>adminhtml/system_config_source_email_template</source_model>
200
- <sort_order>25</sort_order>
201
- <show_in_default>1</show_in_default>
202
- <show_in_website>1</show_in_website>
203
- <show_in_store>1</show_in_store>
204
- </payment_instructions_template>
205
- <payment_instructions_template_sibs translate="label">
206
- <label><![CDATA[Payment Instructions Template (for Multibanco SIBS)]]></label>
207
- <frontend_type>select</frontend_type>
208
- <source_model>adminhtml/system_config_source_email_template</source_model>
209
- <sort_order>25</sort_order>
210
- <show_in_default>1</show_in_default>
211
- <show_in_website>1</show_in_website>
212
- <show_in_store>1</show_in_store>
213
- </payment_instructions_template_sibs>
214
-
215
- <auto_invoice translate="label">
216
- <label>Create invoice on success</label>
217
- <comment>Create an invoice if payment is successfully done. Invoice is automatically set to paid</comment>
218
- <frontend_type>select</frontend_type>
219
- <source_model>adminhtml/system_config_source_yesno</source_model>
220
- <sort_order>26</sort_order>
221
- <show_in_default>1</show_in_default>
222
- <show_in_website>1</show_in_website>
223
- <show_in_store>1</show_in_store>
224
- </auto_invoice>
225
-
226
- <auto_ship translate="label">
227
- <label>Automate shipping</label>
228
- <frontend_type>select</frontend_type>
229
- <source_model>adminhtml/system_config_source_yesno</source_model>
230
- <sort_order>27</sort_order>
231
- <show_in_default>1</show_in_default>
232
- <show_in_website>1</show_in_website>
233
- <show_in_store>1</show_in_store>
234
- </auto_ship>
235
-
236
- <order_status translate="label">
237
- <label>New Order status</label>
238
- <frontend_type>select</frontend_type>
239
- <source_model>adminhtml/system_config_source_order_status</source_model>
240
- <sort_order>28</sort_order>
241
- <show_in_default>1</show_in_default>
242
- <show_in_website>1</show_in_website>
243
- <show_in_store>0</show_in_store>
244
- </order_status>
245
- <order_status_on_2 translate="label">
246
- <label>Order status on SUCCESS</label>
247
- <frontend_type>select</frontend_type>
248
- <source_model>adminhtml/system_config_source_order_status</source_model>
249
- <sort_order>29</sort_order>
250
- <show_in_default>1</show_in_default>
251
- <show_in_website>1</show_in_website>
252
- <show_in_store>0</show_in_store>
253
- </order_status_on_2>
254
- <order_status_on_3 translate="label">
255
- <label>Order status on CANCEL</label>
256
- <frontend_type>select</frontend_type>
257
- <source_model>adminhtml/system_config_source_order_status</source_model>
258
- <sort_order>30</sort_order>
259
- <show_in_default>1</show_in_default>
260
- <show_in_website>1</show_in_website>
261
- <show_in_store>0</show_in_store>
262
- </order_status_on_3>
263
- <order_status_on_4 translate="label">
264
- <label>Order status on FAIL</label>
265
- <frontend_type>select</frontend_type>
266
- <source_model>adminhtml/system_config_source_order_status</source_model>
267
- <sort_order>31</sort_order>
268
- <show_in_default>1</show_in_default>
269
- <show_in_website>1</show_in_website>
270
- <show_in_store>0</show_in_store>
271
- </order_status_on_4>
272
- <order_status_on_5 translate="label">
273
- <label>Order status on EXPIRED</label>
274
- <frontend_type>select</frontend_type>
275
- <source_model>adminhtml/system_config_source_order_status</source_model>
276
- <sort_order>32</sort_order>
277
- <show_in_default>1</show_in_default>
278
- <show_in_website>1</show_in_website>
279
- <show_in_store>0</show_in_store>
280
- </order_status_on_5>
281
- <autoselect_s2p translate="label">
282
- <label>Auto-select GlobalPay payment methods</label>
283
- <frontend_type>select</frontend_type>
284
- <source_model>adminhtml/system_config_source_yesno</source_model>
285
- <sort_order>33</sort_order>
286
- <show_in_default>1</show_in_default>
287
- <show_in_website>1</show_in_website>
288
- <show_in_store>1</show_in_store>
289
- </autoselect_s2p>
290
- <skip_payment_page translate="label">
291
- <label>Skip payment page</label>
292
- <frontend_type>select</frontend_type>
293
- <source_model>adminhtml/system_config_source_yesno</source_model>
294
- <sort_order>34</sort_order>
295
- <show_in_default>1</show_in_default>
296
- <show_in_website>1</show_in_website>
297
- <show_in_store>1</show_in_store>
298
- </skip_payment_page>
299
- <redirect_in_iframe translate="label">
300
- <label>Redirect in iframe</label>
301
- <frontend_type>select</frontend_type>
302
- <source_model>adminhtml/system_config_source_yesno</source_model>
303
- <sort_order>35</sort_order>
304
- <show_in_default>1</show_in_default>
305
- <show_in_website>1</show_in_website>
306
- <show_in_store>1</show_in_store>
307
- </redirect_in_iframe>
308
  <skin_id translate="label">
309
  <label>Skin ID</label>
310
  <frontend_type>text</frontend_type>
@@ -312,39 +146,8 @@
312
  <show_in_default>1</show_in_default>
313
  <show_in_website>1</show_in_website>
314
  <show_in_store>1</show_in_store>
 
315
  </skin_id>
316
- <message_data_2 translate="label">
317
- <label>Message Success</label>
318
- <frontend_type>textarea</frontend_type>
319
- <sort_order>37</sort_order>
320
- <show_in_default>1</show_in_default>
321
- <show_in_website>1</show_in_website>
322
- <show_in_store>1</show_in_store>
323
- </message_data_2>
324
- <message_data_4 translate="label">
325
- <label>Message Failed</label>
326
- <frontend_type>textarea</frontend_type>
327
- <sort_order>38</sort_order>
328
- <show_in_default>1</show_in_default>
329
- <show_in_website>1</show_in_website>
330
- <show_in_store>1</show_in_store>
331
- </message_data_4>
332
- <message_data_3 translate="label">
333
- <label>Message Canceled</label>
334
- <frontend_type>textarea</frontend_type>
335
- <sort_order>39</sort_order>
336
- <show_in_default>1</show_in_default>
337
- <show_in_website>1</show_in_website>
338
- <show_in_store>1</show_in_store>
339
- </message_data_3>
340
- <message_data_7 translate="label">
341
- <label>Message Pending</label>
342
- <frontend_type>textarea</frontend_type>
343
- <sort_order>40</sort_order>
344
- <show_in_default>1</show_in_default>
345
- <show_in_website>1</show_in_website>
346
- <show_in_store>1</show_in_store>
347
- </message_data_7>
348
  <debug_form translate="label">
349
  <label>[ Debug Form ]</label>
350
  <comment>Show form data before submiting it to Smart2Pay</comment>
@@ -354,10 +157,386 @@
354
  <show_in_default>1</show_in_default>
355
  <show_in_website>1</show_in_website>
356
  <show_in_store>1</show_in_store>
 
357
  </debug_form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  </fields>
 
359
  </globalpay>
 
360
  </groups>
361
- </payment>
362
  </sections>
363
  </config>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <sections>
4
+
5
+ <payment>
6
  <groups>
7
+
8
+ <globalpay translate="label" module="globalpay">
9
+
10
  <label>Smart2Pay Payment Module</label>
11
  <sort_order>670</sort_order>
12
  <show_in_default>1</show_in_default>
13
  <show_in_website>1</show_in_website>
14
  <show_in_store>1</show_in_store>
15
+ <frontend_class>complex</frontend_class>
16
+
17
  <fields>
18
+
19
+ <general_settings type="group" translate="label">
20
+
21
+ <label>General Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <frontend_model>adminhtml/system_config_form_fieldset</frontend_model>
27
+ <sort_order>10</sort_order>
28
+ <expanded>1</expanded>
29
+
30
+ <fields>
31
+
32
  <active translate="label">
33
  <label>Enabled</label>
34
  <frontend_type>select</frontend_type>
37
  <show_in_default>1</show_in_default>
38
  <show_in_website>1</show_in_website>
39
  <show_in_store>1</show_in_store>
40
+ <config_path>payment/globalpay/active</config_path>
41
  </active>
42
  <environment translate="label">
43
+ <label><![CDATA[<b>&raquo; Environment</b>]]></label>
44
+ <comment><![CDATA[To obtain your credentials for live and test environments, please contact us at <a href="mailto:support@smart2pay.com">support@smart2pay.com</a>.]]></comment>
45
  <frontend_type>select</frontend_type>
46
  <source_model>globalpay/source_testlive</source_model>
47
  <sort_order>1</sort_order>
48
  <show_in_default>1</show_in_default>
49
  <show_in_website>1</show_in_website>
50
  <show_in_store>1</show_in_store>
51
+ <config_path>payment/globalpay/environment</config_path>
52
  </environment>
53
  <post_url_live translate="label">
54
  <label><![CDATA[<b>&raquo; Post URL Live</b>]]></label>
58
  <show_in_default>1</show_in_default>
59
  <show_in_website>1</show_in_website>
60
  <show_in_store>0</show_in_store>
61
+ <config_path>payment/globalpay/post_url_live</config_path>
62
  </post_url_live>
63
  <post_url_test translate="label">
64
  <label><![CDATA[<b>&raquo; Post URL Test</b>]]></label>
68
  <show_in_default>1</show_in_default>
69
  <show_in_website>1</show_in_website>
70
  <show_in_store>0</show_in_store>
71
+ <config_path>payment/globalpay/post_url_test</config_path>
72
  </post_url_test>
73
  <mid_live translate="label">
74
  <label><![CDATA[<b>&raquo; MID Live</b>]]></label>
78
  <show_in_default>1</show_in_default>
79
  <show_in_website>1</show_in_website>
80
  <show_in_store>0</show_in_store>
81
+ <config_path>payment/globalpay/mid_live</config_path>
82
  </mid_live>
83
  <mid_test translate="label">
84
  <label><![CDATA[<b>&raquo; MID Test</b>]]></label>
88
  <show_in_default>1</show_in_default>
89
  <show_in_website>1</show_in_website>
90
  <show_in_store>0</show_in_store>
91
+ <config_path>payment/globalpay/mid_test</config_path>
92
  </mid_test>
93
  <site_id translate="label">
94
  <label><![CDATA[Site ID]]></label>
97
  <show_in_default>1</show_in_default>
98
  <show_in_website>1</show_in_website>
99
  <show_in_store>1</show_in_store>
100
+ <config_path>payment/globalpay/site_id</config_path>
101
  </site_id>
102
  <signature_live translate="label">
103
  <label><![CDATA[<b>&raquo; Signature Live</b>]]></label>
107
  <show_in_default>1</show_in_default>
108
  <show_in_website>1</show_in_website>
109
  <show_in_store>1</show_in_store>
110
+ <config_path>payment/globalpay/signature_live</config_path>
111
  </signature_live>
112
  <signature_test translate="label">
113
  <label><![CDATA[<b>&raquo; Signature Test</b>]]></label>
117
  <show_in_default>1</show_in_default>
118
  <show_in_website>1</show_in_website>
119
  <show_in_store>1</show_in_store>
120
+ <config_path>payment/globalpay/signature_test</config_path>
121
  </signature_test>
122
  <return_url translate="label">
123
  <label><![CDATA[<b>&raquo; Return URL</b>]]></label>
127
  <show_in_default>1</show_in_default>
128
  <show_in_website>1</show_in_website>
129
  <show_in_store>1</show_in_store>
130
+ <config_path>payment/globalpay/return_url</config_path>
131
  </return_url>
132
  <title translate="label">
133
  <label><![CDATA[Title]]></label>
137
  <show_in_default>1</show_in_default>
138
  <show_in_website>1</show_in_website>
139
  <show_in_store>1</show_in_store>
140
+ <config_path>payment/globalpay/title</config_path>
141
  </title>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  <skin_id translate="label">
143
  <label>Skin ID</label>
144
  <frontend_type>text</frontend_type>
146
  <show_in_default>1</show_in_default>
147
  <show_in_website>1</show_in_website>
148
  <show_in_store>1</show_in_store>
149
+ <config_path>payment/globalpay/skin_id</config_path>
150
  </skin_id>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  <debug_form translate="label">
152
  <label>[ Debug Form ]</label>
153
  <comment>Show form data before submiting it to Smart2Pay</comment>
157
  <show_in_default>1</show_in_default>
158
  <show_in_website>1</show_in_website>
159
  <show_in_store>1</show_in_store>
160
+ <config_path>payment/globalpay/debug_form</config_path>
161
  </debug_form>
162
+
163
+ </fields>
164
+
165
+ </general_settings>
166
+
167
+ <methods_settings type="group" translate="label">
168
+ <label><![CDATA[Methods Display Settings <small><em>Click for details</em></small>]]></label>
169
+ <frontend_type>text</frontend_type>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>1</show_in_website>
172
+ <show_in_store>1</show_in_store>
173
+ <frontend_model>adminhtml/system_config_form_fieldset</frontend_model>
174
+ <sort_order>20</sort_order>
175
+ <expanded>0</expanded>
176
+
177
+ <fields>
178
+
179
+ <display_surcharge translate="label">
180
+ <label><![CDATA[Display surcharge fee to client]]></label>
181
+ <frontend_type>select</frontend_type>
182
+ <source_model>adminhtml/system_config_source_yesno</source_model>
183
+ <sort_order>10</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ <config_path>payment/globalpay/display_surcharge</config_path>
188
+ </display_surcharge>
189
+
190
+ <!--
191
+ <methods translate="label">
192
+ <label><![CDATA[Active methods]]></label>
193
+ <frontend_type>multiselect</frontend_type>
194
+ <sort_order>13</sort_order>
195
+ <source_model>globalpay/source_methods</source_model>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ <config_path>payment/globalpay/methods</config_path>
200
+ </methods>
201
+ -->
202
+
203
+ <methods_display_mode translate="label">
204
+ <label><![CDATA[Methods display mode]]></label>
205
+ <frontend_type>select</frontend_type>
206
+ <source_model>globalpay/source_displaymodes</source_model>
207
+ <sort_order>14</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>1</show_in_store>
211
+ <config_path>payment/globalpay/methods_display_mode</config_path>
212
+ </methods_display_mode>
213
+ <show_methods_in_grid translate="label">
214
+ <label><![CDATA[Show methods in grid]]></label>
215
+ <comment>By default, methods will be displayed as a two columns table, having paymentm method's logo or name and description. When set to yes, description is omitted, and columns number can be specified bellow.</comment>
216
+ <frontend_type>select</frontend_type>
217
+ <source_model>adminhtml/system_config_source_yesno</source_model>
218
+ <sort_order>15</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+ <config_path>payment/globalpay/show_methods_in_grid</config_path>
223
+ </show_methods_in_grid>
224
+ <grid_column_number translate="label">
225
+ <label>Grid column number</label>
226
+ <comment>Please provide a number, if left blank, the default value is 3 (This value is used only if above option is set to yes)</comment>
227
+ <frontend_type>text</frontend_type>
228
+ <sort_order>16</sort_order>
229
+ <show_in_default>1</show_in_default>
230
+ <show_in_website>1</show_in_website>
231
+ <show_in_store>1</show_in_store>
232
+ <config_path>payment/globalpay/grid_column_number</config_path>
233
+ </grid_column_number>
234
+
235
+ <product_description_ref translate="label">
236
+ <label>Send order number as product description</label>
237
+ <comment>If "No" is selected, the below custom description will be send</comment>
238
+ <frontend_type>select</frontend_type>
239
+ <source_model>adminhtml/system_config_source_yesno</source_model>
240
+ <sort_order>20</sort_order>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>1</show_in_store>
244
+ <config_path>payment/globalpay/product_description_ref</config_path>
245
+ </product_description_ref>
246
+
247
+ <product_description_custom translate="label">
248
+ <label>Custom product description</label>
249
+ <frontend_type>textarea</frontend_type>
250
+ <source_model>adminhtml/system_config_source_yesno</source_model>
251
+ <sort_order>21</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ <config_path>payment/globalpay/product_description_custom</config_path>
256
+ </product_description_custom>
257
+
258
+ </fields>
259
+
260
+ </methods_settings>
261
+
262
+ <email_settings type="group" translate="label">
263
+ <label><![CDATA[Email Settings <small><em>Click for details</em></small>]]></label>
264
+ <frontend_type>text</frontend_type>
265
+ <show_in_default>1</show_in_default>
266
+ <show_in_website>1</show_in_website>
267
+ <show_in_store>1</show_in_store>
268
+ <frontend_model>adminhtml/system_config_form_fieldset</frontend_model>
269
+ <sort_order>30</sort_order>
270
+ <expanded>0</expanded>
271
+
272
+ <fields>
273
+
274
+ <notify_customer translate="label">
275
+ <label>Notify customer by email</label>
276
+ <comment>Send a confirmation email to the customer on success payment notification</comment>
277
+ <frontend_type>select</frontend_type>
278
+ <source_model>adminhtml/system_config_source_yesno</source_model>
279
+ <sort_order>22</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <show_in_store>1</show_in_store>
283
+ <config_path>payment/globalpay/notify_customer</config_path>
284
+ </notify_customer>
285
+ <payment_confirmation_template translate="label">
286
+ <label>Payment Confirmation Template</label>
287
+ <frontend_type>select</frontend_type>
288
+ <source_model>adminhtml/system_config_source_email_template</source_model>
289
+ <sort_order>23</sort_order>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ <show_in_store>1</show_in_store>
293
+ <config_path>payment/globalpay/payment_confirmation_template</config_path>
294
+ </payment_confirmation_template>
295
+ <notify_payment_instructions translate="label">
296
+ <label>Send payment instructions on order creation</label>
297
+ <comment>Send a confirmation email to the customer on order creation with payment details</comment>
298
+ <frontend_type>select</frontend_type>
299
+ <source_model>adminhtml/system_config_source_yesno</source_model>
300
+ <sort_order>24</sort_order>
301
+ <show_in_default>1</show_in_default>
302
+ <show_in_website>1</show_in_website>
303
+ <show_in_store>1</show_in_store>
304
+ <config_path>payment/globalpay/notify_payment_instructions</config_path>
305
+ </notify_payment_instructions>
306
+ <payment_instructions_template translate="label">
307
+ <label><![CDATA[Payment Instructions Template (for Bank Transfer)]]></label>
308
+ <frontend_type>select</frontend_type>
309
+ <source_model>adminhtml/system_config_source_email_template</source_model>
310
+ <sort_order>25</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <show_in_store>1</show_in_store>
314
+ <config_path>payment/globalpay/payment_instructions_template</config_path>
315
+ </payment_instructions_template>
316
+ <payment_instructions_template_sibs translate="label">
317
+ <label><![CDATA[Payment Instructions Template (for Multibanco SIBS)]]></label>
318
+ <frontend_type>select</frontend_type>
319
+ <source_model>adminhtml/system_config_source_email_template</source_model>
320
+ <sort_order>25</sort_order>
321
+ <show_in_default>1</show_in_default>
322
+ <show_in_website>1</show_in_website>
323
+ <show_in_store>1</show_in_store>
324
+ <config_path>payment/globalpay/payment_instructions_template_sibs</config_path>
325
+ </payment_instructions_template_sibs>
326
+
327
+ </fields>
328
+
329
+ </email_settings>
330
+
331
+ <order_settings type="group" translate="label">
332
+ <label><![CDATA[Order Related Settings <small><em>Click for details</em></small>]]></label>
333
+ <frontend_type>text</frontend_type>
334
+ <show_in_default>1</show_in_default>
335
+ <show_in_website>1</show_in_website>
336
+ <show_in_store>1</show_in_store>
337
+ <frontend_model>adminhtml/system_config_form_fieldset</frontend_model>
338
+ <sort_order>40</sort_order>
339
+ <expanded>0</expanded>
340
+
341
+
342
+ <fields>
343
+
344
+ <auto_invoice translate="label">
345
+ <label>Create invoice on success</label>
346
+ <comment>Create an invoice if payment is successfully done. Invoice is automatically set to paid</comment>
347
+ <frontend_type>select</frontend_type>
348
+ <source_model>adminhtml/system_config_source_yesno</source_model>
349
+ <sort_order>26</sort_order>
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
+ <config_path>payment/globalpay/auto_invoice</config_path>
354
+ </auto_invoice>
355
+
356
+ <auto_ship translate="label">
357
+ <label>Automate shipping</label>
358
+ <frontend_type>select</frontend_type>
359
+ <source_model>adminhtml/system_config_source_yesno</source_model>
360
+ <sort_order>27</sort_order>
361
+ <show_in_default>1</show_in_default>
362
+ <show_in_website>1</show_in_website>
363
+ <show_in_store>1</show_in_store>
364
+ <config_path>payment/globalpay/auto_ship</config_path>
365
+ </auto_ship>
366
+
367
+ <order_status translate="label">
368
+ <label>New Order status</label>
369
+ <frontend_type>select</frontend_type>
370
+ <source_model>adminhtml/system_config_source_order_status</source_model>
371
+ <sort_order>28</sort_order>
372
+ <show_in_default>1</show_in_default>
373
+ <show_in_website>1</show_in_website>
374
+ <show_in_store>0</show_in_store>
375
+ <config_path>payment/globalpay/order_status</config_path>
376
+ </order_status>
377
+ <order_status_on_2 translate="label">
378
+ <label>Order status on SUCCESS</label>
379
+ <frontend_type>select</frontend_type>
380
+ <source_model>adminhtml/system_config_source_order_status</source_model>
381
+ <sort_order>29</sort_order>
382
+ <show_in_default>1</show_in_default>
383
+ <show_in_website>1</show_in_website>
384
+ <show_in_store>0</show_in_store>
385
+ <config_path>payment/globalpay/order_status_on_2</config_path>
386
+ </order_status_on_2>
387
+ <order_status_on_3 translate="label">
388
+ <label>Order status on CANCEL</label>
389
+ <frontend_type>select</frontend_type>
390
+ <source_model>adminhtml/system_config_source_order_status</source_model>
391
+ <sort_order>30</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>0</show_in_store>
395
+ <config_path>payment/globalpay/order_status_on_3</config_path>
396
+ </order_status_on_3>
397
+ <order_status_on_4 translate="label">
398
+ <label>Order status on FAIL</label>
399
+ <frontend_type>select</frontend_type>
400
+ <source_model>adminhtml/system_config_source_order_status</source_model>
401
+ <sort_order>31</sort_order>
402
+ <show_in_default>1</show_in_default>
403
+ <show_in_website>1</show_in_website>
404
+ <show_in_store>0</show_in_store>
405
+ <config_path>payment/globalpay/order_status_on_4</config_path>
406
+ </order_status_on_4>
407
+ <order_status_on_5 translate="label">
408
+ <label>Order status on EXPIRED</label>
409
+ <frontend_type>select</frontend_type>
410
+ <source_model>adminhtml/system_config_source_order_status</source_model>
411
+ <sort_order>32</sort_order>
412
+ <show_in_default>1</show_in_default>
413
+ <show_in_website>1</show_in_website>
414
+ <show_in_store>0</show_in_store>
415
+ <config_path>payment/globalpay/order_status_on_5</config_path>
416
+ </order_status_on_5>
417
+
418
+ </fields>
419
+
420
+ </order_settings>
421
+
422
+ <payment_flow_settings type="group" translate="label">
423
+ <label><![CDATA[Payment Flow Settings <small><em>Click for details</em></small>]]></label>
424
+ <frontend_type>text</frontend_type>
425
+ <show_in_default>1</show_in_default>
426
+ <show_in_website>1</show_in_website>
427
+ <show_in_store>1</show_in_store>
428
+ <frontend_model>adminhtml/system_config_form_fieldset</frontend_model>
429
+ <sort_order>50</sort_order>
430
+ <expanded>0</expanded>
431
+
432
+ <fields>
433
+
434
+ <autoselect_s2p translate="label">
435
+ <label>Auto-select GlobalPay payment methods</label>
436
+ <frontend_type>select</frontend_type>
437
+ <source_model>adminhtml/system_config_source_yesno</source_model>
438
+ <sort_order>33</sort_order>
439
+ <show_in_default>1</show_in_default>
440
+ <show_in_website>1</show_in_website>
441
+ <show_in_store>1</show_in_store>
442
+ <config_path>payment/globalpay/autoselect_s2p</config_path>
443
+ </autoselect_s2p>
444
+ <skip_payment_page translate="label">
445
+ <label>Skip payment page</label>
446
+ <frontend_type>select</frontend_type>
447
+ <source_model>adminhtml/system_config_source_yesno</source_model>
448
+ <sort_order>34</sort_order>
449
+ <show_in_default>1</show_in_default>
450
+ <show_in_website>1</show_in_website>
451
+ <show_in_store>1</show_in_store>
452
+ <config_path>payment/globalpay/skip_payment_page</config_path>
453
+ </skip_payment_page>
454
+ <redirect_in_iframe translate="label">
455
+ <label>Redirect in iframe</label>
456
+ <frontend_type>select</frontend_type>
457
+ <source_model>adminhtml/system_config_source_yesno</source_model>
458
+ <sort_order>35</sort_order>
459
+ <show_in_default>1</show_in_default>
460
+ <show_in_website>1</show_in_website>
461
+ <show_in_store>1</show_in_store>
462
+ <config_path>payment/globalpay/redirect_in_iframe</config_path>
463
+ </redirect_in_iframe>
464
+ <message_data_2 translate="label">
465
+ <label>Message Success</label>
466
+ <frontend_type>textarea</frontend_type>
467
+ <sort_order>37</sort_order>
468
+ <show_in_default>1</show_in_default>
469
+ <show_in_website>1</show_in_website>
470
+ <show_in_store>1</show_in_store>
471
+ <config_path>payment/globalpay/message_data_2</config_path>
472
+ </message_data_2>
473
+ <message_data_4 translate="label">
474
+ <label>Message Failed</label>
475
+ <frontend_type>textarea</frontend_type>
476
+ <sort_order>38</sort_order>
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
+ <config_path>payment/globalpay/message_data_4</config_path>
481
+ </message_data_4>
482
+ <message_data_3 translate="label">
483
+ <label>Message Canceled</label>
484
+ <frontend_type>textarea</frontend_type>
485
+ <sort_order>39</sort_order>
486
+ <show_in_default>1</show_in_default>
487
+ <show_in_website>1</show_in_website>
488
+ <show_in_store>1</show_in_store>
489
+ <config_path>payment/globalpay/message_data_3</config_path>
490
+ </message_data_3>
491
+ <message_data_7 translate="label">
492
+ <label>Message Pending</label>
493
+ <frontend_type>textarea</frontend_type>
494
+ <sort_order>40</sort_order>
495
+ <show_in_default>1</show_in_default>
496
+ <show_in_website>1</show_in_website>
497
+ <show_in_store>1</show_in_store>
498
+ <config_path>payment/globalpay/message_data_7</config_path>
499
+ </message_data_7>
500
+
501
+ </fields>
502
+ </payment_flow_settings>
503
+
504
+ <selected_methods type="group" translate="label">
505
+ <label>Select Methods</label>
506
+ <frontend_type>text</frontend_type>
507
+ <show_in_default>1</show_in_default>
508
+ <show_in_website>1</show_in_website>
509
+ <show_in_store>1</show_in_store>
510
+ <frontend_model>globalpay/adminhtml_system_config_fieldset_simple</frontend_model>
511
+ <sort_order>60</sort_order>
512
+ <expanded>1</expanded>
513
+ <comment><![CDATA[Please tick checkboxes for payment methods which you want to activate.<br/>
514
+ You can setup surcharges for each payment method by providing a percent, a fixed or a combination of percent and fixed price.<br/>
515
+ Fixed price is provided in base currency setup on <em>Currency Setup</em> page.]]></comment>
516
+
517
+ <fields>
518
+
519
+ <using_methods translate="label">
520
+ <label>Methods</label>
521
+ <frontend_type>text</frontend_type>
522
+ <frontend_model>globalpay/adminhtml_system_config_configuredmethods</frontend_model>
523
+ <backend_model>globalpay/adminhtml_system_config_backend_configuredmethods</backend_model>
524
+ <sort_order>1</sort_order>
525
+ <show_in_default>1</show_in_default>
526
+ <show_in_website>1</show_in_website>
527
+ <show_in_store>1</show_in_store>
528
+ <config_path>payment/globalpay/selected_methods</config_path>
529
+ </using_methods>
530
+
531
+ </fields>
532
+
533
+ </selected_methods>
534
+
535
  </fields>
536
+
537
  </globalpay>
538
+
539
  </groups>
540
+ </payment>
541
  </sections>
542
  </config>
app/code/community/Smart2Pay/Globalpay/sql/globalpay_setup/mysql4-upgrade-1.1.5-1.1.6.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //die('Trying to setup Smart2Pay_Globalpay database');
3
+
4
+ /* @var $installer Mage_Paypal_Model_Resource_Setup */
5
+ /* @var $this Mage_Paypal_Model_Resource_Setup */
6
+ $installer = $this;
7
+ $installer->startSetup();
8
+
9
+ //$this->getConnection()->addColumn( $this->getTable('sales/quote_address'), 's2p_surcharge_amount', array(
10
+ // 'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
11
+ // 'length' => '10,2',
12
+ // 'nullable' => false,
13
+ // 'default' => 0,
14
+ // 'comment' => 'Surcharge percent amount',
15
+ // ) );
16
+
17
+ // Adding fields in quote address for our surcharge fee
18
+ $installer->run( "ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `s2p_surcharge_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
19
+ "ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `s2p_surcharge_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
20
+ "ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `s2p_surcharge_percent` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
21
+ "ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `s2p_surcharge_fixed_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
22
+ "ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `s2p_surcharge_fixed_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';"
23
+ );
24
+
25
+ // Adding fields in quote payment for our surcharge fee
26
+ $installer->run( "ALTER TABLE `".$this->getTable('sales/quote_payment')."` ADD `s2p_surcharge_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
27
+ "ALTER TABLE `".$this->getTable('sales/quote_payment')."` ADD `s2p_surcharge_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
28
+ "ALTER TABLE `".$this->getTable('sales/quote_payment')."` ADD `s2p_surcharge_percent` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
29
+ "ALTER TABLE `".$this->getTable('sales/quote_payment')."` ADD `s2p_surcharge_fixed_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
30
+ "ALTER TABLE `".$this->getTable('sales/quote_payment')."` ADD `s2p_surcharge_fixed_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';"
31
+ );
32
+
33
+ // Adding fields in order for our surcharge fee
34
+ $installer->run( "ALTER TABLE `".$this->getTable('sales/order_payment')."` ADD `s2p_surcharge_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
35
+ "ALTER TABLE `".$this->getTable('sales/order_payment')."` ADD `s2p_surcharge_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
36
+ "ALTER TABLE `".$this->getTable('sales/order_payment')."` ADD `s2p_surcharge_percent` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
37
+ "ALTER TABLE `".$this->getTable('sales/order_payment')."` ADD `s2p_surcharge_fixed_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
38
+ "ALTER TABLE `".$this->getTable('sales/order_payment')."` ADD `s2p_surcharge_fixed_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
39
+ "ALTER TABLE `".$this->getTable('sales/order_payment')."` ADD `s2p_surcharge_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
40
+ "ALTER TABLE `".$this->getTable('sales/order_payment')."` ADD `s2p_surcharge_base_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';"
41
+ );
42
+
43
+ // Adding fields in invoice for our surcharge fee
44
+ $installer->run( "ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `s2p_surcharge_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
45
+ "ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `s2p_surcharge_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
46
+ "ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `s2p_surcharge_fixed_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';".
47
+ "ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `s2p_surcharge_fixed_base_amount` DECIMAL( 10, 2 ) NOT NULL DEFAULT '0';"
48
+ );
49
+
50
+ // Adding field that tells transaction environment
51
+ $installer->run( "ALTER TABLE `".$this->getTable('globalpay/transactionlogger')."` ADD `environment` VARCHAR(20) NULL DEFAULT 'live' COMMENT 'Environment of transaction' AFTER `site_id`;" );
52
+
53
+ $installer->run( "DROP TABLE IF EXISTS `{$installer->getTable('globalpay/configuredmethods')}`;".
54
+ " CREATE TABLE IF NOT EXISTS `{$installer->getTable('globalpay/configuredmethods')}` (
55
+ `id` int(11) NOT NULL auto_increment,
56
+ `method_id` int(11) NOT NULL DEFAULT '0',
57
+ `country_id` int(11) NOT NULL DEFAULT '0' COMMENT '0 for all countries',
58
+ `surcharge` DECIMAL(6, 2) NOT NULL DEFAULT '0' COMMENT 'Surcharge percent from total order amount to be used as payment fee',
59
+ `fixed_amount` DECIMAL(6, 2) NOT NULL DEFAULT '0' COMMENT 'Surcharge fixed amount to be used as payment fee',
60
+ PRIMARY KEY (`id`),
61
+ KEY `method_id` (`method_id`),
62
+ KEY `country_id` (`country_id`)
63
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Payment methods to be used and their surcharge (if applicable)';" );
64
+
65
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/globalpay.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+
4
+ <adminhtml_system_config_edit_section_payment>
5
+ <reference name="head">
6
+ <block type="core/text" name="jquery.js"><action method="setText"><text><![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script>jQuery.noConflict();</script>]]></text></action></block>
7
+ </reference>
8
+ </adminhtml_system_config_edit_section_payment>
9
+
10
+ <adminhtml_sales_order_invoice_print>
11
+ <reference name="invoice_totals">
12
+ <block type="globalpay/adminhtml_sales_order_invoice_total" name="globalpay.sales.order.invoice.total" />
13
+ </reference>
14
+ </adminhtml_sales_order_invoice_print>
15
+
16
+ <adminhtml_sales_order_invoice_view>
17
+ <reference name="invoice_totals">
18
+ <block type="globalpay/adminhtml_sales_order_invoice_total" name="globalpay.sales.order.invoice.total" />
19
+ </reference>
20
+ </adminhtml_sales_order_invoice_view>
21
+
22
+ <adminhtml_sales_order_invoice_new>
23
+ <reference name="invoice_totals">
24
+ <block type="globalpay/adminhtml_sales_order_invoice_total" name="globalpay.sales.order.invoice.total" />
25
+ </reference>
26
+ </adminhtml_sales_order_invoice_new>
27
+
28
+ <adminhtml_sales_order_invoice_updateqty>
29
+ <reference name="invoice_totals">
30
+ <block type="globalpay/adminhtml_sales_order_invoice_total" name="globalpay.sales.order.invoice.total" />
31
+ </reference>
32
+ </adminhtml_sales_order_invoice_updateqty>
33
+
34
+ <adminhtml_sales_order_view>
35
+ <reference name="order_totals">
36
+ <block type="globalpay/adminhtml_sales_order_total" name="globalpay.sales.order.total" />
37
+ </reference>
38
+ </adminhtml_sales_order_view>
39
+
40
+ <!--
41
+ <adminhtml_sales_order_creditmemo_new>
42
+ <reference name="creditmemo_totals">
43
+ <block type="globalpay/adminhtml_sales_order_creditmemo_totals" name="globalpay.sales.order.creditmemo.total" />
44
+ </reference>
45
+ </adminhtml_sales_order_creditmemo_new>
46
+
47
+ <adminhtml_sales_order_creditmemo_view>
48
+ <reference name="creditmemo_totals">
49
+ <block type="globalpay/adminhtml_sales_order_creditmemo_totals" name="globalpay.sales.order.creditmemo.total" />
50
+ </reference>
51
+ </adminhtml_sales_order_creditmemo_view>
52
+
53
+ <adminhtml_sales_order_creditmemo_updateqty>
54
+ <reference name="creditmemo_totals">
55
+ <block type="globalpay/adminhtml_sales_order_creditmemo_totals" name="globalpay.sales.order.creditmemo.total" />
56
+ </reference>
57
+ </adminhtml_sales_order_creditmemo_updateqty>
58
+ -->
59
+
60
+ <default>
61
+ <reference name="head">
62
+ <!--
63
+ <block type="core/text" name="jquery.js"><action method="setText"><text><![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script>jQuery.noConflict();</script>]]></text></action></block>
64
+ <action method="addJs">
65
+ <script>vendor/qtip/jquery.qtip.min.js</script>
66
+ </action>
67
+ -->
68
+ </reference>
69
+ </default>
70
+
71
+ </layout>
app/design/adminhtml/default/default/template/smart2pay/globalpay/info.phtml DELETED
@@ -1,3 +0,0 @@
1
- <?php /**@var $this Smart2Pay_Globalpay_Block_Info */ ?>
2
-
3
- <p><?php echo $this->__($this->message) ?></p>
 
 
 
app/design/adminhtml/default/default/template/smart2pay/globalpay/methodinfo.phtml CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  <p><?php echo $this->escapeHtml( $this->getMethod()->getTitle() ) ?></p>
2
 
3
  <?php if ($_specificInfo = $this->getSpecificInformation()):?>
@@ -5,8 +8,14 @@
5
  <tbody>
6
  <?php foreach ($_specificInfo as $_label => $_value):?>
7
  <tr>
8
- <td><em><?php echo $this->__( $_label )?></em></td>
9
- <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
 
 
 
 
 
 
10
  </tr>
11
  <?php endforeach; ?>
12
  </tbody>
1
+ <?php
2
+ /** @var Smart2Pay_Globalpay_Block_Info_Globalpay $this */
3
+ ?>
4
  <p><?php echo $this->escapeHtml( $this->getMethod()->getTitle() ) ?></p>
5
 
6
  <?php if ($_specificInfo = $this->getSpecificInformation()):?>
8
  <tbody>
9
  <?php foreach ($_specificInfo as $_label => $_value):?>
10
  <tr>
11
+ <td class="label"><label><em><?php echo $this->__( $_label )?></em></label></td>
12
+ <?php
13
+ if( empty( $this->_display_lines ) )
14
+ {
15
+ ?></tr><tr><?php
16
+ }
17
+ ?>
18
+ <td class="value"><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
19
  </tr>
20
  <?php endforeach; ?>
21
  </tbody>
app/design/adminhtml/default/default/template/smart2pay/globalpay/methodinfopdf.phtml CHANGED
@@ -1,17 +1,15 @@
1
- <p>!!!Smart2Pay: <?php echo $this->escapeHtml( $this->getMethod()->getTitle() ) ?></p>
2
- <?php if ($_specificInfo = $this->getSpecificInformation()):?>
3
- <table style="width:100%;">
4
- <tbody>
5
- <?php foreach ($_specificInfo as $_label => $_value):?>
6
- <tr>
7
- <td><?php echo $this->__( $_label )?></td>
8
- </tr>
9
- <tr>
10
- <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
11
- </tr>
12
- <?php endforeach; ?>
13
- </tbody>
14
- </table>
15
- <?php endif;?>
16
 
17
- <?php echo $this->getChildHtml()?>
1
+ <?php
2
+
3
+ echo $this->escapeHtml( $this->getMethod()->getTitle() ).'{{pdf_row_separator}}';
4
+
5
+ if( ($_specificInfo = $this->getSpecificInformation()) )
6
+ {
7
+ foreach ($_specificInfo as $_label => $_value)
8
+ {
9
+ echo $this->__( $_label ).'{{pdf_row_separator}}';
10
+ echo nl2br( implode( $this->getValueAsArray( $_value, true ), "{{pdf_row_separator}}\n" ) ).'{{pdf_row_separator}}';
11
+ }
12
+ }
13
+
14
+ echo $this->getChildHtml();
 
15
 
 
app/design/adminhtml/default/default/template/smart2pay/globalpay/paymentinstructions.phtml DELETED
@@ -1,115 +0,0 @@
1
- <?php
2
- if( !empty( $this->displayPaymentInstructions ) )
3
- {
4
- ?>
5
- <style type="text/css">
6
- #BankTransferInfo { margin: 0 auto; }
7
- #BankTransferInfo tr { text-align: left; }
8
- #BankTransferInfo td { width: 250px; text-align: left; }
9
- #BankTransferMessage { text-align: left; }
10
- #BankTransferTerms { text-align: left; font-weight: bold; }
11
- #PaymentDetails { background-color: #eeeeee; padding: 5px; }
12
- </style>
13
-
14
- <div id="PaymentDetails">
15
- <p id="BankTransferMessage"><?php echo $this->__('BankTransferMessage');?></p>
16
- <br/>
17
- <p id="BankTransferTerms"><?php echo $this->__('BankTransferTerms');?></p>
18
- <br/><br/>
19
- <table id="BankTransferInfo">
20
- <?php
21
- if( isset( $this->referenceNumber ) )
22
- {
23
- ?>
24
- <tr>
25
- <td><?php echo $this->__('ReferenceNumber');?></td>
26
- <td><?php echo $this->referenceNumber;?></td>
27
- </tr>
28
- <?php
29
- }
30
-
31
- if( isset( $this->entityNumber ) )
32
- {
33
- ?>
34
- <tr>
35
- <td><?php echo $this->__('EntityNumber');?></td>
36
- <td><?php echo $this->entityNumber;?></td>
37
- </tr>
38
- <?php
39
- }
40
-
41
- if( isset( $this->bankName ) )
42
- {
43
- ?>
44
- <tr>
45
- <td><?php echo $this->__('BankName');?></td>
46
- <td><?php echo $this->bankName;?></td>
47
- </tr>
48
- <?php
49
- }
50
-
51
- if( isset( $this->accountHolder ) )
52
- {
53
- ?>
54
- <tr>
55
- <td><?php echo $this->__('AccountHolder');?></td>
56
- <td><?php echo $this->accountHolder;?></td>
57
- </tr>
58
- <?php
59
- }
60
-
61
- if( isset( $this->accountNumber ) )
62
- {
63
- ?>
64
- <tr>
65
- <td><?php echo $this->__( 'AccountNumber' );?></td>
66
- <td><?php echo $this->accountNumber;?></td>
67
- </tr>
68
- <?php
69
- }
70
-
71
- if( isset( $this->SWIFT_BIC ) )
72
- {
73
- ?>
74
- <tr>
75
- <td><?php echo $this->__('SWIFT_BIC');?></td>
76
- <td><?php echo $this->SWIFT_BIC;?></td>
77
- </tr>
78
- <?php
79
- }
80
-
81
- if( isset( $this->IBAN ) )
82
- {
83
- ?>
84
- <tr>
85
- <td><?php echo $this->__('IBAN');?></td>
86
- <td><?php echo $this->IBAN;?></td>
87
- </tr>
88
- <?php
89
- }
90
-
91
- if( isset( $this->amountToPay ) )
92
- {
93
- ?>
94
- <tr>
95
- <td><?php echo $this->__('AmountToPay');?></td>
96
- <td><?php echo $this->amountToPay;?></td>
97
- </tr>
98
- <?php
99
- }
100
-
101
- if( isset( $this->accountCurrency ) )
102
- {
103
- ?>
104
- <tr>
105
- <td><?php echo $this->__( 'AccountCurrency' );?></td>
106
- <td><?php echo $this->accountCurrency;?></td>
107
- </tr>
108
- <?php
109
- }
110
- ?>
111
- </table>
112
- </div>
113
- <?php
114
- }
115
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/smart2pay/globalpay/paymethod/form.phtml DELETED
@@ -1,212 +0,0 @@
1
- <?php
2
- $_code = $this->getMethodCode();
3
- $s2pMethods = $this->getPaymentMethods();
4
- ?>
5
-
6
- <style type="text/css">
7
- .s2p-method-wrapper { display: block; white-space: nowrap; float: left; }
8
- .s2p-method-name { display: block; float: left; }
9
- .s2p-method-img { float: left; vertical-align: middle; max-height:40px; max-width:130px; }
10
- a .s2p-method-img, a .s2p-method-name, a .s2p-method-img-name, .s2p-method-ck { cursor: pointer; float: left; }
11
- .s2p-method-ck { margin-top: 10px; max-width: 30px; }
12
- .s2p-method-img-wrapper { min-height: 40px; vertical-align: middle; padding-left: 30px; }
13
-
14
- #payment_form_globalpay { background-color: #F3F3F3; border: 1px solid #CCC; border-left: 2px solid #CCC; }
15
-
16
- <?php
17
- if( !$this->method_config['show_methods_in_grid'] )
18
- {
19
- ?>
20
- #payment_form_globalpay td { padding: 10px; }
21
- .s2p-method-img-name.no-grid-w-description-title {
22
- border-bottom: 1px solid #CCCCCC;
23
- font-size: 100%;
24
- font-weight: bold;
25
- margin-bottom: 2px;
26
- padding-bottom: 2px;
27
- }
28
- .s2p-method-img-name.no-grid-w-description-content { font-size: 80%; }
29
- <?php
30
- } elseif( $this->method_config['grid_column_number'] == 1 )
31
- {
32
- ?>
33
- .grid.one-column { text-align: left; padding: 15px; }
34
- .s2p-method-img-name { padding: 5px 0px 0px 26px; }
35
- <?php
36
- } else
37
- {
38
- ?>
39
- .grid.one-column { padding: 15px; }
40
- .s2p-method-img-name { padding: 5px 0px 0px 26px; }
41
- <?php
42
- }
43
- ?>
44
-
45
- .s2p-method-img-name { display: block; /*float: right;*/ }
46
- .s2p-method-img { padding-left: 15px; }
47
- </style>
48
-
49
- <input type="hidden" id="s2p-payment-method" name="payment[method_id]" value="0" />
50
- <div id="payment_form_globalpay" style="display: none;">
51
- <?php
52
- /*
53
- * Send payment method
54
- */
55
- if( !empty( $s2pMethods ) and is_array( $s2pMethods ) )
56
- {
57
- $s2pMethods_count = count( $s2pMethods );
58
- ?>
59
- <table style="width: 100%;">
60
- <?php
61
- /*
62
- * Show methods in grid
63
- */
64
- if( $this->method_config['show_methods_in_grid'] )
65
- {
66
- //show methods in grid
67
- $grid_col_number = ((int)$this->method_config['grid_column_number'] > 0) ? (int)$this->method_config['grid_column_number'] : 3;
68
- $printed_grid_cols = 0;
69
- while( $printed_grid_cols < $s2pMethods_count )
70
- {
71
- ?><tr><?php
72
-
73
- for( $c = 0; $c < $grid_col_number; $c++ )
74
- {
75
- if( isset( $s2pMethods[$printed_grid_cols] ) )
76
- {
77
- $method = $s2pMethods[$printed_grid_cols];
78
-
79
- ?>
80
- <td class="grid one-column"><label class="s2p-method-wrapper" style="width: 100%;">
81
- <input type="radio" class="s2p-method-ck" data-method-id="<?php echo $method['method_id'] ?>" <?php echo (($printed_grid_cols == 0)?'id="s2p-first-method-ck"':'')?> />
82
- <div class="s2p-method-img-wrapper">
83
- <?php
84
-
85
- if( $this->method_config['methods_display_mode'] == 'text' )
86
- {
87
- ?><span class="s2p-method-img-name"><?php echo $this->__( $method['display_name'] )?></span><?php
88
- } elseif( $this->method_config['methods_display_mode'] == 'logo' )
89
- {
90
- ?>
91
- <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ); ?>' />
92
- <?php
93
- } else
94
- {
95
- ?>
96
- <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ); ?>' />
97
- <div style="clear: both;"></div>
98
- <span class="s2p-method-img-name"><?php echo $this->__( $method['display_name'] ); ?></span>
99
- <?php
100
- }
101
-
102
- ?></div></label></td><?php
103
- } else
104
- {
105
- ?><td></td><?php
106
- }
107
-
108
- $printed_grid_cols++;
109
- }
110
-
111
- ?></tr><?php
112
- }
113
- /*
114
- * Show methods in 2 column table
115
- */
116
- } else
117
- {
118
- $k = 0;
119
- foreach( $s2pMethods as $key => $method )
120
- {
121
- ?>
122
- <tr>
123
- <td style='vertical-align: middle;'><label class="s2p-method-wrapper" style="width: 100%;">
124
- <input type="radio" class="s2p-method-ck" data-method-id="<?php echo $method['method_id'] ?>" <?php echo (($k == 0)?'id="s2p-first-method-ck"':'')?> /> &nbsp;&nbsp;
125
- <div class="s2p-method-img-wrapper">
126
- <?php
127
- if( $this->method_config['methods_display_mode'] == 'text' )
128
- {
129
- ?><span class="s2p-method-name">&raquo <?php echo $this->__( $method['display_name'] ); ?></span><?php
130
- } elseif( $this->method_config['methods_display_mode'] == 'logo' )
131
- {
132
- ?><img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ) ?>' /><?php
133
- } else
134
- {
135
- ?><img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ) ?>' /><?php
136
- }
137
- ?>
138
- </label></td>
139
- <td style='padding-bottom: 10px; padding-left: 10px;'>
140
- <div class="s2p-method-img-name no-grid-w-description-title"><?php echo $this->__( $method['display_name'] ); ?></div>
141
- <div class="s2p-method-img-name no-grid-w-description-content"><?php echo $this->__( $method['description'] ); ?></div>
142
- </td>
143
- </tr>
144
- <?php
145
-
146
- $k++;
147
- }
148
- }
149
- }
150
- ?>
151
- </table>
152
- </div>
153
-
154
- <script type="text/javascript">
155
- jQuery.noConflict();
156
-
157
- function s2pChooseMethod( methodId )
158
- {
159
- jQuery('#s2p-payment-method').removeAttr('disabled');
160
- jQuery('#s2p-payment-method').val( methodId );
161
-
162
- checkS2PMethod( methodId );
163
-
164
- if( typeof payment.save == "function" )
165
- {
166
- // uncomment if you want to submit payment choice on radiobox checking event
167
- //payment.save();
168
- }
169
- }
170
-
171
- function checkS2PMethod( methodId )
172
- {
173
- jQuery('.s2p-method-ck').prop('checked', false);
174
- jQuery('.s2p-method-ck[data-method-id=' + methodId + ']').prop('checked', true );
175
- }
176
-
177
- function enableHiddenS2PField()
178
- {
179
- jQuery('#s2p-payment-method').removeAttr('disabled');
180
- }
181
-
182
- jQuery(document).ready(function()
183
- {
184
- jQuery('.s2p-method-ck').on('click', function(e) {
185
- s2pChooseMethod( jQuery(this).data('methodId') );
186
- });
187
-
188
- <?php
189
- if( empty( $s2pMethods ) )
190
- {
191
- ?>
192
- jQuery('#p_method_globalpay').parent().hide();
193
- jQuery('#s2p-payment-method').parent().hide();
194
- <?php
195
- } else
196
- {
197
- if( $this->method_config['autoselect_s2p']
198
- and !empty( $s2pMethods ) )
199
- {
200
- ?>
201
- jQuery('#p_method_globalpay').click();
202
- <?php
203
- }
204
- ?>
205
- jQuery('#s2p-first-method-ck').click();
206
- <?php
207
- }
208
- ?>
209
- })
210
-
211
- setTimeout( enableHiddenS2PField, 100 );
212
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/smart2pay/globalpay/paymethod/sendform.phtml DELETED
@@ -1,230 +0,0 @@
1
- <div style="<?php echo ($this->form_data['debug_form']) ? "display: table;" : "display: none;" ?>">
2
-
3
- <?php
4
- if( $this->form_data['debug_form'] )
5
- {
6
- ?>
7
- <p><b>Message to hash</b>: <?php echo strtolower($this->message_to_hash);?></p>
8
- <p><b>Hash</b>: <?php echo $this->hash?></p>
9
- <?php
10
- }
11
- ?>
12
-
13
- <form action="<?php echo $this->form_data['post_url'] ?>" id="s2pform" method="post" <?php if($this->form_data['redirect_in_iframe']) echo 'target="merchantIframe"'; ?>>
14
- <table>
15
- <tr>
16
- <td>MerchantID</td>
17
- <td><input type="text" name="MerchantID" value="<?php echo $this->form_data['mid'] ?>" /></td>
18
- </tr>
19
- <tr>
20
- <td>MerchantTransactionID</td>
21
- <td><input type="text" name="MerchantTransactionID" value="<?php echo $this->form_data['order_id'] ?>"/></td>
22
- </tr>
23
- <tr>
24
- <td>Amount</td>
25
- <td><input type="text" name="Amount" value="<?php echo $this->form_data['amount'] ?>"/></td>
26
- </tr>
27
- <tr>
28
- <td>Currency</td>
29
- <td><input type="text" name="Currency" value="<?php echo $this->form_data['currency'] ?>"/></td>
30
- </tr>
31
- <tr>
32
- <td>ReturnURL</td>
33
- <td><input type="text" name="ReturnURL" value="<?php echo $this->form_data['return_url'] ?>"/></td>
34
- </tr>
35
- <?php
36
- if( !$this->form_data['method_id'] )
37
- {
38
- ?>
39
- <tr>
40
- <td>
41
- IncludeMethodIDs
42
- </td>
43
- <td>
44
- <input type="text" name="IncludeMethodIDs" value="<?php echo $this->form_data['methods'] ?>"/>
45
- </td>
46
- </tr>
47
- <?php
48
- }
49
-
50
- if( $this->form_data['site_id'] )
51
- {
52
- ?>
53
- <tr>
54
- <td>
55
- SiteID
56
- </td>
57
- <td>
58
- <input type="text" name="SiteID" value="<?php echo $this->form_data['site_id'] ?>"/>
59
- </td>
60
- </tr>
61
- <?php
62
- }
63
- ?>
64
- <tr>
65
- <td colspan="2">Optional:</td>
66
- </tr>
67
- <tr>
68
- <td>CustomerName</td>
69
- <td><input type="text" name="CustomerName" value="<?php echo $this->form_data['customer_name'] ?>" /></td>
70
- </tr>
71
-
72
- <tr>
73
- <td>CustomerLastName</td>
74
- <td><input type="text" name="CustomerLastName" value="<?php echo $this->form_data['customer_last_name'] ?>"/></td>
75
- </tr>
76
-
77
- <tr>
78
- <td>CustomerFirstName</td>
79
- <td><input type="text" name="CustomerFirstName" value="<?php echo $this->form_data['customer_first_name'] ?>"/></td>
80
- </tr>
81
-
82
- <tr>
83
- <td>CustomerEmail</td>
84
- <td><input type="text" name="CustomerEmail" value="<?php echo $this->form_data['customer_email'] ?>"/></td>
85
- </tr>
86
- <tr>
87
- <td>Country</td>
88
- <td><input type="text" name="Country" value="<?php echo $this->form_data['country'] ?>"/></td>
89
- </tr>
90
- <tr>
91
- <td>MethodID</td>
92
- <td><input type="text" name="MethodID" value="<?php echo $this->form_data['method_id'] ?>"/></td>
93
- </tr>
94
-
95
-
96
- <?php
97
- if( $this->form_data['product_description_ref'] )
98
- {
99
- ?>
100
- <tr>
101
- <td>Description</td>
102
- <td><input type="text" name="Description" value="<?php echo "Ref. no.: ".$this->form_data['order_id'] ?>"/></td>
103
- </tr>
104
- <?php
105
- } else
106
- {
107
- ?>
108
- <tr>
109
- <td>Description</td>
110
- <td>
111
- <input type="text" name="Description" value="<?php echo $this->form_data['product_description_custom'] ?>"/>
112
- </td>
113
- </tr>
114
- <?php
115
- }
116
-
117
- if( $this->form_data['skip_payment_page']
118
- and (!in_array( $this->form_data['method_id'], array( 1, 20 ) )
119
- or $this->form_data['notify_payment_instructions']
120
- ) )
121
- {
122
- ?>
123
- <tr>
124
- <td>SkipHPP</td>
125
- <td><input type="text" name="SkipHPP" value="1" /></td>
126
- </tr>
127
- <?php
128
- }
129
-
130
- if( $this->form_data['redirect_in_iframe'] )
131
- {
132
- ?>
133
- <tr>
134
- <td>RedirectInIframe</td>
135
- <td><input type="text" name="RedirectInIframe" value="1"/></td>
136
- </tr>
137
- <?php
138
- }
139
-
140
- if( $this->form_data['skin_id'] )
141
- {
142
- ?>
143
- <tr>
144
- <td>SkinID</td>
145
- <td><input type="text" name="SkinID" value="<?php echo $this->form_data['skin_id']?>" /></td>
146
- </tr>
147
- <?php
148
- }
149
- ?>
150
-
151
- <tr>
152
- <td>Hash</td>
153
- <td><input type="text" name="Hash" value="<?php echo $this->form_data['hash'] ?>" /></td>
154
- </tr>
155
- <tr>
156
- <td colspan='2'><input type="submit" value="Submit"/></td>
157
- </tr>
158
- </table>
159
- </form>
160
- </div>
161
-
162
- <div id="iframe-container" style="display: none; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 1000">
163
- <div style="position: relative; width: 100%; height: 100%;">
164
- <div style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: #333; opacity: 0.5; filter:alpha(opacity=50)"></div>
165
- <div style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;">
166
- <div style="display: table; margin: 0px auto; margin-top: 50px;">
167
- <?php
168
- if( $this->form_data['redirect_in_iframe']
169
- && $this->form_data['skip_payment_page']
170
- && ($this->form_data['method_id'] == 1001 || $this->form_data['method_id'] == 1002 || $this->form_data['method_id'] == 76)):?>
171
- <iframe style='border: none; margin: 0px auto; background-color: #ffffff;' id="merchantIframe" name="merchantIframe" src="" width="780" height="500">
172
- <?php else:?>
173
- <iframe style='border: none; margin: 0px auto; background-color: transparent;' id="merchantIframe" name="merchantIframe" src="" width="900" height="800">
174
- <?php endif;?>
175
- </iframe>
176
- </div>
177
- </div>
178
- </div>
179
- </div>
180
-
181
- <script>
182
-
183
- jQuery.noConflict();
184
-
185
- function modalIframe(){
186
- jQuery("#iframe-container").css({height: jQuery('body').height()});
187
- jQuery("#iframe-container").appendTo('body');
188
- jQuery("#iframe-container").show();
189
- }
190
-
191
- jQuery(document).ready(function() {
192
-
193
- jQuery('#s2pform').submit(function(){
194
- modalIframe();
195
- });
196
- // autosend form if needed
197
- <?php if(!$this->form_data['debug_form']):?>
198
- jQuery("#s2pform").submit();
199
- <?php endif; ?>
200
- // get/parse smart2pay message
201
- var onmessage = function(e) {
202
- console.log(e);
203
- if(e.data == 'close_HPP') {
204
- setTimeout(function() {jQuery('iframe#merchantIframe').remove()}, 300);
205
- }
206
- else if (e.data.substring(0, 7) == "height=") {
207
- var iframe_height = e.data.substring(7);
208
- jQuery('iframe#merchantIframe').attr('height', parseInt(iframe_height)+300);
209
- console.log("jQuery('iframe#merchantIframe').attr('height'," + (parseInt(iframe_height)+300) + ");");
210
- }
211
- else if (e.data.substring(0, 6) == "width=") {
212
- var iframe_width = e.data.substring(6);
213
- jQuery('iframe#merchantIframe').attr('width', parseInt(iframe_width)+100);
214
- console.log("jQuery('iframe#merchantIframe').attr('width'," + (parseInt(iframe_width)+100) + ");");
215
- }
216
-
217
- else if (e.data.substring(0, 12) == "redirectURL="){
218
- window.location = e.data.substring(12);
219
- }
220
- };
221
-
222
- // set event listener for smart2pay
223
- if(typeof window.addEventListener != 'undefined') {
224
- window.addEventListener('message', onmessage, false);
225
- }
226
- else if(typeof window.attachEvent != 'undefined') {
227
- window.attachEvent('onmessage', onmessage);
228
- }
229
- });
230
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/smart2pay/globalpay/system/config/methods.phtml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @var Smart2Pay_Globalpay_Block_Adminhtml_System_Config_Configuredmethods $this */
3
+ ?>
4
+ <input type="hidden" value="1" name="groups[selected_methods][fields][using_methods][value]" id="payment_selected_methods_using_methods" />
5
+ <style type="text/css">
6
+ .s2p-method-img-td { height:50px; width: 134px; text-align: center; }
7
+ .s2p-method-img { vertical-align: middle; max-height:40px; max-width:130px; }
8
+ .sp2-middle-all { text-align: center; vertical-align: middle; }
9
+ #s2p_methods_table { min-width: 450px; width: 100%; margin: 0; padding: 0; }
10
+ #s2p_methods_table th { padding: 2px; text-align: center; font-weight: bold; background-color: #b6b6b6; color: black; }
11
+ #s2p_methods_table td { padding: 2px; border-bottom: 1px solid black !important; }
12
+ </style>
13
+ <script type="text/javascript">
14
+ function s2p_config_js_select_all()
15
+ {
16
+ form_obj = document.getElementById( 'config_edit_form' );
17
+ if( form_obj && form_obj.elements && form_obj.elements.length )
18
+ {
19
+ for( i = 0; i < form_obj.elements.length; i++ )
20
+ {
21
+ if( form_obj.elements[i].type == 'checkbox' && form_obj.elements[i].name == 's2p_enabled_methods[]' )
22
+ {
23
+ if( !form_obj.elements[i].checked )
24
+ form_obj.elements[i].click();
25
+ }
26
+ }
27
+ }
28
+ }
29
+ function s2p_config_js_deselect_all()
30
+ {
31
+ form_obj = document.getElementById( 'config_edit_form' );
32
+ if( form_obj && form_obj.elements && form_obj.elements.length )
33
+ {
34
+ for( i = 0; i < form_obj.elements.length; i++ )
35
+ {
36
+ if( form_obj.elements[i].type == 'checkbox' && form_obj.elements[i].name == 's2p_enabled_methods[]' )
37
+ {
38
+ if( form_obj.elements[i].checked )
39
+ form_obj.elements[i].click();
40
+ }
41
+ }
42
+ }
43
+ }
44
+ function s2p_config_js_invert()
45
+ {
46
+ form_obj = document.getElementById( 'config_edit_form' );
47
+ if( form_obj && form_obj.elements && form_obj.elements.length )
48
+ {
49
+ for( i = 0; i < form_obj.elements.length; i++ )
50
+ {
51
+ if( form_obj.elements[i].type == 'checkbox' && form_obj.elements[i].name == 's2p_enabled_methods[]' )
52
+ {
53
+ form_obj.elements[i].click();
54
+ }
55
+ }
56
+ }
57
+ }
58
+ </script>
59
+ <?php
60
+ if( !($all_methods = $this->get_all_methods()) )
61
+ $all_methods = array();
62
+ if( !($all_configured_methods = $this->get_all_configured_methods()) )
63
+ $all_configured_methods = array();
64
+ ?>
65
+ <table id="s2p_methods_table">
66
+ <thead>
67
+ <tr>
68
+ <th style="width: 30px;">#</th>
69
+ <th style="width: 60px;">Enabled?</th>
70
+ <th style="width: 90px;">Surcharge</th>
71
+ <th colspan="2">Method</th>
72
+ </tr>
73
+ </thead>
74
+ <tbody>
75
+ <tr>
76
+ <td colspan="5">
77
+ <p>
78
+ <a href="javascript:void(0);" onclick="s2p_config_js_select_all()">Select all</a>
79
+ |
80
+ <a href="javascript:void(0);" onclick="s2p_config_js_invert()">Invert</a>
81
+ |
82
+ <a href="javascript:void(0);" onclick="s2p_config_js_deselect_all()">Select none</a>
83
+ </p>
84
+
85
+ </td>
86
+ </tr>
87
+ <?php
88
+ $knti = 1;
89
+ foreach( $all_methods as $method_arr )
90
+ {
91
+ ?>
92
+ <tr class="s2p-method-tr">
93
+ <td class="sp2-middle-all"><?php echo $knti?></td>
94
+ <td class="sp2-middle-all"><input type="checkbox" id="s2p_enabled_method_<?php echo $method_arr['method_id']?>" name="s2p_enabled_methods[]" value="<?php echo $method_arr['method_id']?>" <?php echo (!empty( $all_configured_methods[$method_arr['method_id']][0] )?'checked="checked"':'')?> /></td>
95
+ <td class="sp2-middle-all" style="text-align: left;">
96
+ <div style="padding:2px; clear:both;"><input type="text" class="input-text" style="width: 50px !important; text-align: right;" name="s2p_surcharge[<?php echo $method_arr['method_id']?>]" id="s2p_surcharge_<?php echo $method_arr['method_id']?>" value="<?php echo ((!empty( $all_configured_methods[$method_arr['method_id']][0] ) and !empty( $all_configured_methods[$method_arr['method_id']][0]['surcharge'] ))?$all_configured_methods[$method_arr['method_id']][0]['surcharge']:0)?>"/>%</div>
97
+ <div style="padding:2px; clear:both;"><input type="text" class="input-text" style="width: 50px !important; text-align: right;" name="s2p_fixed_amount[<?php echo $method_arr['method_id']?>]" id="s2p_fixed_amount<?php echo $method_arr['method_id']?>" value="<?php echo ((!empty( $all_configured_methods[$method_arr['method_id']][0] ) and !empty( $all_configured_methods[$method_arr['method_id']][0]['fixed_amount'] ))?$all_configured_methods[$method_arr['method_id']][0]['fixed_amount']:0)?>"/> <?php echo $this->base_currency?></div>
98
+ </td>
99
+ <td class="sp2-middle-all s2p-method-img-td"><img class="s2p-method-img" alt="<?php echo $this->__( $method_arr['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method_arr['logo_url'] ); ?>' /></td>
100
+ <td>
101
+ <label for="s2p_enabled_method<?php echo $method_arr['method_id']?>"><strong><?php echo $this->__( $method_arr['display_name'] ); ?></strong></label>
102
+ <br/>
103
+ <?php echo $this->__( $method_arr['description'] ); ?>
104
+ <br/>
105
+ <strong>Available in following countries</strong>:
106
+ <?php
107
+ if( empty( $method_arr['countries_list'] )
108
+ or !is_array( $method_arr['countries_list'] ) )
109
+ echo 'N/A';
110
+
111
+ else
112
+ {
113
+ $first = true;
114
+ foreach( $method_arr['countries_list'] as $country_id => $country_arr )
115
+ {
116
+ if( !$first )
117
+ echo ', ';
118
+
119
+ echo $country_arr['name'];
120
+ $first = false;
121
+
122
+ }
123
+ echo '.';
124
+ }
125
+ ?>
126
+
127
+ </td>
128
+ </tr>
129
+ <?php
130
+ $knti++;
131
+ }
132
+ ?>
133
+ </tbody>
134
+ </table>
app/design/frontend/base/default/layout/globalpay.xml CHANGED
@@ -26,6 +26,58 @@
26
  <block type="globalpay/info" name="globalpay_info" template="smart2pay/globalpay/info.phtml"/>
27
  </reference>
28
  </globalpay_index_info>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  <default>
30
  <reference name="head">
31
  <block type="core/text" name="jquery.js"><action method="setText"><text><![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script>jQuery.noConflict();</script>]]></text></action></block>
26
  <block type="globalpay/info" name="globalpay_info" template="smart2pay/globalpay/info.phtml"/>
27
  </reference>
28
  </globalpay_index_info>
29
+
30
+
31
+ <sales_order_view>
32
+ <reference name="order_totals">
33
+ <block type="globalpay/sales_order_total" name="globalpay.sales.order.total" />
34
+ </reference>
35
+ </sales_order_view>
36
+ <sales_order_print>
37
+ <reference name="order_totals">
38
+ <block type="globalpay/sales_order_total" name="globalpay.sales.order.total" />
39
+ </reference>
40
+ </sales_order_print>
41
+ <sales_guest_print>
42
+ <reference name="order_totals">
43
+ <block type="globalpay/sales_order_total" name="globalpay.sales.order.total" />
44
+ </reference>
45
+ </sales_guest_print>
46
+ <sales_email_order_items>
47
+ <reference name="order_totals">
48
+ <block type="globalpay/sales_order_total" name="globalpay.sales.order.total" />
49
+ </reference>
50
+ </sales_email_order_items>
51
+
52
+ <sales_order_invoice>
53
+ <reference name="invoice_totals">
54
+ <block type="globalpay/sales_order_invoice_total" name="globalpay.sales.order.total" />
55
+ </reference>
56
+ </sales_order_invoice>
57
+ <sales_order_printinvoice>
58
+ <reference name="invoice_totals">
59
+ <block type="globalpay/sales_order_invoice_total" name="globalpay.sales.order.total" />
60
+ </reference>
61
+ </sales_order_printinvoice>
62
+ <sales_guest_printinvoice>
63
+ <reference name="invoice_totals">
64
+ <block type="globalpay/sales_order_invoice_total" name="globalpay.sales.order.total" />
65
+ </reference>
66
+ </sales_guest_printinvoice>
67
+ <sales_email_order_invoice_items>
68
+ <reference name="invoice_totals">
69
+ <block type="globalpay/sales_order_invoice_total" name="globalpay.sales.order.total" />
70
+ </reference>
71
+ </sales_email_order_invoice_items>
72
+
73
+ <!--
74
+ <sales_order_creditmemo>
75
+ <reference name="creditmemo_totals">
76
+ <block type="globalpay/sales_order_creditmemo_totals" name="globalpay.sales.order.creditmemo.total" />
77
+ </reference>
78
+ </sales_order_creditmemo>
79
+ -->
80
+
81
  <default>
82
  <reference name="head">
83
  <block type="core/text" name="jquery.js"><action method="setText"><text><![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script>jQuery.noConflict();</script>]]></text></action></block>
app/design/frontend/base/default/template/smart2pay/globalpay/methodinfo.phtml CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  <p><?php echo $this->escapeHtml( $this->getMethod()->getTitle() ) ?></p>
2
 
3
  <?php if ($_specificInfo = $this->getSpecificInformation()):?>
@@ -5,8 +8,14 @@
5
  <tbody>
6
  <?php foreach ($_specificInfo as $_label => $_value):?>
7
  <tr>
8
- <td><em><?php echo $this->__( $_label )?></em></td>
9
- <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
 
 
 
 
 
 
10
  </tr>
11
  <?php endforeach; ?>
12
  </tbody>
1
+ <?php
2
+ /** @var Smart2Pay_Globalpay_Block_Info_Globalpay $this */
3
+ ?>
4
  <p><?php echo $this->escapeHtml( $this->getMethod()->getTitle() ) ?></p>
5
 
6
  <?php if ($_specificInfo = $this->getSpecificInformation()):?>
8
  <tbody>
9
  <?php foreach ($_specificInfo as $_label => $_value):?>
10
  <tr>
11
+ <td class="label"><label><em><?php echo $this->__( $_label )?></em></label></td>
12
+ <?php
13
+ if( empty( $this->_display_lines ) )
14
+ {
15
+ ?></tr><tr><?php
16
+ }
17
+ ?>
18
+ <td class="value"><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
19
  </tr>
20
  <?php endforeach; ?>
21
  </tbody>
app/design/frontend/base/default/template/smart2pay/globalpay/methodinfopdf.phtml DELETED
@@ -1,17 +0,0 @@
1
- <p>!!!Smart2Pay: <?php echo $this->escapeHtml( $this->getMethod()->getTitle() ) ?></p>
2
- <?php if ($_specificInfo = $this->getSpecificInformation()):?>
3
- <table style="width:100%;">
4
- <tbody>
5
- <?php foreach ($_specificInfo as $_label => $_value):?>
6
- <tr>
7
- <td><?php echo $this->__( $_label )?></td>
8
- </tr>
9
- <tr>
10
- <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
11
- </tr>
12
- <?php endforeach; ?>
13
- </tbody>
14
- </table>
15
- <?php endif;?>
16
-
17
- <?php echo $this->getChildHtml()?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/smart2pay/globalpay/paymethod/form.phtml CHANGED
@@ -1,4 +1,6 @@
 
1
  <?php
 
2
  $_code = $this->getMethodCode();
3
  $s2pMethods = $this->getPaymentMethods();
4
  ?>
@@ -82,23 +84,37 @@ if( !$this->method_config['show_methods_in_grid'] )
82
  <div class="s2p-method-img-wrapper">
83
  <?php
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  if( $this->method_config['methods_display_mode'] == 'text' )
86
  {
87
- ?><span class="s2p-method-img-name"><?php echo $this->__( $method['display_name'] )?></span><?php
88
  } elseif( $this->method_config['methods_display_mode'] == 'logo' )
89
  {
90
  ?>
91
  <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ); ?>' />
92
  <?php
 
93
  } else
94
  {
95
  ?>
96
  <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ); ?>' />
97
  <div style="clear: both;"></div>
98
- <span class="s2p-method-img-name"><?php echo $this->__( $method['display_name'] ); ?></span>
99
- <?php
100
  }
101
-
102
  ?></div></label></td><?php
103
  } else
104
  {
@@ -121,23 +137,47 @@ if( !$this->method_config['show_methods_in_grid'] )
121
  ?>
122
  <tr>
123
  <td style='vertical-align: middle;'><label class="s2p-method-wrapper" style="width: 100%;">
124
- <input type="radio" class="s2p-method-ck" data-method-id="<?php echo $method['method_id'] ?>" <?php echo (($k == 0)?'id="s2p-first-method-ck"':'')?> /> &nbsp;&nbsp;
125
  <div class="s2p-method-img-wrapper">
126
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  if( $this->method_config['methods_display_mode'] == 'text' )
128
  {
129
  ?><span class="s2p-method-name">&raquo <?php echo $this->__( $method['display_name'] ); ?></span><?php
130
  } elseif( $this->method_config['methods_display_mode'] == 'logo' )
131
  {
132
- ?><img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ) ?>' /><?php
 
 
133
  } else
134
  {
135
- ?><img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ) ?>' /><?php
 
 
136
  }
137
  ?>
138
- </label></td>
139
  <td style='padding-bottom: 10px; padding-left: 10px;'>
140
- <div class="s2p-method-img-name no-grid-w-description-title"><?php echo $this->__( $method['display_name'] ); ?></div>
 
 
 
 
141
  <div class="s2p-method-img-name no-grid-w-description-content"><?php echo $this->__( $method['description'] ); ?></div>
142
  </td>
143
  </tr>
1
+ <div style="clear:both;"></div>
2
  <?php
3
+ /** @var Smart2Pay_Globalpay_Block_Paymethod_Form $this */
4
  $_code = $this->getMethodCode();
5
  $s2pMethods = $this->getPaymentMethods();
6
  ?>
84
  <div class="s2p-method-img-wrapper">
85
  <?php
86
 
87
+ $surcharge_explained_str = '';
88
+ if( (int)$this->method_config['display_surcharge']
89
+ and ((float)$method['surcharge'] != 0 or (float)$method['fixed_amount'] != 0) )
90
+ {
91
+ $surcharge_explained_str = '<div style="clear: both;"></div>(';
92
+
93
+ if( (float)$method['surcharge'] != 0 )
94
+ $surcharge_explained_str .= ( $method['surcharge'] > 0 ? '+' : '' ) . $method['surcharge'] . '%';
95
+ if( (float)$method['fixed_amount'] != 0 )
96
+ $surcharge_explained_str .= ((float)$method['surcharge'] != 0?' + ':'').
97
+ Mage::getSingleton('checkout/session')->getQuote()->getStore()->getBaseCurrency()->format( $method['fixed_amount'], array(), false );
98
+
99
+ $surcharge_explained_str .= ')';
100
+ }
101
+
102
  if( $this->method_config['methods_display_mode'] == 'text' )
103
  {
104
+ ?><span class="s2p-method-img-name"><?php echo $this->__( $method['display_name'] ).$surcharge_explained_str?></span><?php
105
  } elseif( $this->method_config['methods_display_mode'] == 'logo' )
106
  {
107
  ?>
108
  <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ); ?>' />
109
  <?php
110
+ echo $surcharge_explained_str;
111
  } else
112
  {
113
  ?>
114
  <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ); ?>' />
115
  <div style="clear: both;"></div>
116
+ <span class="s2p-method-img-name"><?php echo $this->__( $method['display_name'] ).$surcharge_explained_str; ?></span><?php
 
117
  }
 
118
  ?></div></label></td><?php
119
  } else
120
  {
137
  ?>
138
  <tr>
139
  <td style='vertical-align: middle;'><label class="s2p-method-wrapper" style="width: 100%;">
140
+ <input type="radio" class="s2p-method-ck" data-method-id="<?php echo $method['method_id'] ?>" <?php echo (($k == 0)?'id="s2p-first-method-ck"':'')?> />
141
  <div class="s2p-method-img-wrapper">
142
  <?php
143
+
144
+ $surcharge_explained_str = '';
145
+ if( (int)$this->method_config['display_surcharge']
146
+ and ((float)$method['surcharge'] != 0 or (float)$method['fixed_amount'] != 0) )
147
+ {
148
+ $surcharge_explained_str = ' (';
149
+
150
+ if( (float)$method['surcharge'] != 0 )
151
+ $surcharge_explained_str .= ( $method['surcharge'] > 0 ? '+' : '' ) . $method['surcharge'] . '%';
152
+ if( (float)$method['fixed_amount'] != 0 )
153
+ $surcharge_explained_str .= ((float)$method['surcharge'] != 0?' + ':'').
154
+ Mage::getSingleton('checkout/session')->getQuote()->getStore()->getBaseCurrency()->format( $method['fixed_amount'], array(), false );
155
+
156
+ $surcharge_explained_str .= ')';
157
+ }
158
+
159
  if( $this->method_config['methods_display_mode'] == 'text' )
160
  {
161
  ?><span class="s2p-method-name">&raquo <?php echo $this->__( $method['display_name'] ); ?></span><?php
162
  } elseif( $this->method_config['methods_display_mode'] == 'logo' )
163
  {
164
+ ?>
165
+ <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ) ?>' />
166
+ <?php
167
  } else
168
  {
169
+ ?>
170
+ <img class="s2p-method-img" alt="<?php echo $this->__( $method['display_name'] ); ?>" src='<?php echo $this->getSkinUrl( 'images/smart2pay/methods/'.$method['logo_url'] ) ?>' />
171
+ <?php
172
  }
173
  ?>
174
+ </div></label></td>
175
  <td style='padding-bottom: 10px; padding-left: 10px;'>
176
+ <div class="s2p-method-img-name no-grid-w-description-title">
177
+ <?php
178
+ echo $this->__( $method['display_name'] ) . $surcharge_explained_str;
179
+ ?>
180
+ </div>
181
  <div class="s2p-method-img-name no-grid-w-description-content"><?php echo $this->__( $method['description'] ); ?></div>
182
  </td>
183
  </tr>
app/design/frontend/base/default/template/smart2pay/globalpay/paymethod/sendform.phtml CHANGED
@@ -12,6 +12,10 @@
12
 
13
  <form action="<?php echo $this->form_data['post_url'] ?>" id="s2pform" method="post" <?php if($this->form_data['redirect_in_iframe']) echo 'target="merchantIframe"'; ?>>
14
  <table>
 
 
 
 
15
  <tr>
16
  <td>MerchantID</td>
17
  <td><input type="text" name="MerchantID" value="<?php echo $this->form_data['mid'] ?>" /></td>
12
 
13
  <form action="<?php echo $this->form_data['post_url'] ?>" id="s2pform" method="post" <?php if($this->form_data['redirect_in_iframe']) echo 'target="merchantIframe"'; ?>>
14
  <table>
15
+ <tr>
16
+ <td>Environment</td>
17
+ <td><strong><?php echo $this->form_data['environment'] ?></strong></td>
18
+ </tr>
19
  <tr>
20
  <td>MerchantID</td>
21
  <td><input type="text" name="MerchantID" value="<?php echo $this->form_data['mid'] ?>" /></td>
app/locale/en_GB/Smart2Pay_Globalpay.csv CHANGED
@@ -176,7 +176,7 @@
176
  "Cash-in description","Cash Options Russia allows you to pay at Euroset and Svyaznoy communication stores and Sberbank ATMs."
177
  "Cards Russia description","Credit and debit cards are still one the most used online payment methods in Russia."
178
  "PaymentInstructions","Payment Instructions"
179
- "PaymentInstructionsSubject","Payment Instructions for order #%s"
180
  "BankTransferMessage","You have chosen to pay using bank transfer. Please find below your personal reference number and our bank details. Always enter the reference number under ""Purpose of payment"" when making a bank transfer."
181
  "BankTransferTerms","A bank transfer payment is reported by the bank in 1-3 bank days (Saturday, Sunday and national holidays not included)!"
182
  "ReferenceNumber","Reference Number"
@@ -190,4 +190,5 @@
190
  "EntityNumber","Entity Number"
191
  "Payment Method","Payment Method"
192
  "Last Update","Last Update"
193
- "No information available","No information available"
 
176
  "Cash-in description","Cash Options Russia allows you to pay at Euroset and Svyaznoy communication stores and Sberbank ATMs."
177
  "Cards Russia description","Credit and debit cards are still one the most used online payment methods in Russia."
178
  "PaymentInstructions","Payment Instructions"
179
+ "PaymentInstructionsSubject","Payment instructions for order #%s"
180
  "BankTransferMessage","You have chosen to pay using bank transfer. Please find below your personal reference number and our bank details. Always enter the reference number under ""Purpose of payment"" when making a bank transfer."
181
  "BankTransferTerms","A bank transfer payment is reported by the bank in 1-3 bank days (Saturday, Sunday and national holidays not included)!"
182
  "ReferenceNumber","Reference Number"
190
  "EntityNumber","Entity Number"
191
  "Payment Method","Payment Method"
192
  "Last Update","Last Update"
193
+ "Payment Method Fee","Payment Method Fee"
194
+ "Payment Confirmation","Payment confirmation for order #%s"
app/locale/en_US/Smart2Pay_Globalpay.csv CHANGED
@@ -190,4 +190,5 @@
190
  "EntityNumber","Entity Number"
191
  "Payment Method","Payment Method"
192
  "Last Update","Last Update"
193
- "No information available","No information available"
 
190
  "EntityNumber","Entity Number"
191
  "Payment Method","Payment Method"
192
  "Last Update","Last Update"
193
+ "Payment Method Fee","Payment Method Fee"
194
+ "Payment Confirmation","Payment confirmation for order #%s"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Smart2Pay</name>
4
- <version>1.1.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">The Open Software License 3.0 (OSL-3.0)</license>
7
  <channel>community</channel>
@@ -105,11 +105,12 @@ https://dashboardtest.smart2pay.com/Account/Register or e-mail &#xD;
105
  support@smart2pay.com for instructions on account activation and detailed &#xD;
106
  documentation.&lt;/p&gt;&#xD;
107
  </description>
108
- <notes>- Payment details are saved in database and displayed in order details for both front-end and back-end</notes>
 
109
  <authors><author><name>Stefan Iancu</name><user>stefani</user><email>support@smart2pay.com</email></author></authors>
110
- <date>2015-03-09</date>
111
- <time>16:34:27</time>
112
- <contents><target name="magecommunity"><dir name="Smart2Pay"><dir name="Globalpay"><dir name="Block"><dir name="Info"><file name="Globalpay.php" hash="f08e2c1ca3722bf9c99607453e29c707"/></dir><file name="Info.php" hash="0ce44c8234fc66bae84ce49120d2866c"/><file name="Paymentinstructions.php" hash="1490c20b3f13cb8d9a80616b66904cf2"/><dir name="Paymethod"><file name="Form.php" hash="50acaca159e47f8060c63f4f827c1205"/><file name="Sendform.php" hash="16240037321927965ad4c3447b8f05ff"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e8c8a8825234e044140c868403d457f5"/><file name="Helper.php" hash="cad1ee4a2d90d656061079d351ea5feb"/></dir><dir name="Model"><file name="Country.php" hash="936012cbfa55c64ed7fb76886c551f7e"/><file name="Countrymethod.php" hash="fdca03bc90ee641aeabbfe8b7452f8db"/><file name="GlobalpayLog.php" hash="70e0c38c6234d75239136a3621f7ac8c"/><file name="Logger.php" hash="534118191b5b14d223544d765a54f672"/><file name="Method.php" hash="ef927f2723349a25a154cf00cea105e0"/><file name="Pay.php" hash="131fd1d854fc059744e958db17ebec59"/><dir name="Resource"><dir name="Country"><file name="Collection.php" hash="4ded83c204c83add05e9676a94638ce0"/></dir><file name="Country.php" hash="fcb4dcc631b086eaa715f5e7a96e7386"/><dir name="Countrymethod"><file name="Collection.php" hash="492742783f370d1b22d43a9ce6a38bf7"/></dir><file name="Countrymethod.php" hash="48074ce7a859de057445c7c27d9ae87b"/><dir name="Logger"><file name="Collection.php" hash="64dd8f9119679ff3e8c4d6b968201671"/></dir><file name="Logger.php" hash="98847ce83ed78a424c781885e4cee6b6"/><dir name="Method"><file name="Collection.php" hash="2ee2315d1ced6a17df20dcd0091cf9ce"/></dir><file name="Method.php" hash="ce00096559b5ac1142c7f40a4f0505fd"/><file name="Setup.php" hash="93047b7581bfdedaa813e9787d5843fb"/><dir name="Transactionlogger"><file name="Collection.php" hash="e24c39b140ef198a0e154d0dd9104667"/></dir><file name="Transactionlogger.php" hash="36c4eed50271c5d0044446d7e743bd7b"/></dir><dir name="Source"><file name="Displaymodes.php" hash="e7c7f0e2117d1c0b31f8b492f6cfdf56"/><file name="Methods.php" hash="33e7a754d22c0c87deb58b5e3852466b"/><file name="Testlive.php" hash="c7fb03a04efd342833dbe0130f1670a8"/></dir><file name="Transactionlogger.php" hash="d47dc1e0fef760f02118a11e5c8e90c3"/></dir><dir name="controllers"><file name="IndexController.php" hash="383728a5edc4853c52fef86b469b9608"/><file name="TestsController.php" hash="fef4a90341d6fbc3442ae2ed3aa776af"/></dir><dir name="etc"><file name="config.xml" hash="5b7b1f1eb71eb3c378657dd20ca90502"/><file name="system.xml" hash="4d7ff989bfb489c6d04f787a6333a327"/></dir><dir name="sql"><dir name="globalpay_setup"><file name="mysql4-install-0.1.0.php" hash="b20f861bb89ecc6e75ca45ef4ae9a571"/><file name="mysql4-upgrade-1.0.3-1.1.1.php" hash="0cc5a5e482c69833594c8e9c3fd43027"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="3c74ed2415bf2e8575bff1898961805a"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="8112e779e009a9626a1c51408a7208f3"/><file name="mysql4-upgrade-1.1.3-1.1.4.php" hash="538609da33ce07f1d94ae548bf83a4c4"/><file name="mysql4-upgrade-1.1.4-1.1.5.php" hash="d79a11406afdd436159d736f975abbb1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="globalpay.xml" hash="fbd01b6088819973e24baa50b4bac262"/></dir><dir name="template"><dir name="smart2pay"><dir name="globalpay"><file name="info.phtml" hash="f558fd34e676eee618deadc5d72bd8c7"/><file name="methodinfo.phtml" hash="18d3047e38b0b3b706c9d59a6f559492"/><file name="methodinfopdf.phtml" hash="3e56d8bf7207eb0d7f465df6a1a6397f"/><file name="paymentinstructions.phtml" hash="4da294678e43c633631fcb1f69238a64"/><dir name="paymethod"><file name="form.phtml" hash="cdc0940426e8bb5c815410b0d58e0bda"/><file name="sendform.phtml" hash="c682571a8237cec400f9fc0e26edd053"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="smart2pay"><dir name="globalpay"><file name="info.phtml" hash="f558fd34e676eee618deadc5d72bd8c7"/><file name="methodinfo.phtml" hash="18d3047e38b0b3b706c9d59a6f559492"/><file name="methodinfopdf.phtml" hash="3e56d8bf7207eb0d7f465df6a1a6397f"/><file name="paymentinstructions.phtml" hash="4da294678e43c633631fcb1f69238a64"/><dir name="paymethod"><file name="form.phtml" hash="cdc0940426e8bb5c815410b0d58e0bda"/><file name="sendform.phtml" hash="c682571a8237cec400f9fc0e26edd053"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="smart2pay"><dir name="methods"><file name="7-Eleven.gif" hash="6a6a250a4a7d1b423e2df0de29ca58a7"/><file name="IXe.gif" hash="2794745e00826bc6c623548926a2a188"/><file name="abaqoos.png" hash="ad0ee5b7a034c174ba07e936a5cdf823"/><file name="ach.png" hash="2c12370813d356b2b2f3c9494aad02bf"/><file name="alipay.png" hash="c63c14def69ae33db0614104bf3c3558"/><file name="alliance_online.gif" hash="89b8abd6f8a0134fd3eecfd2d80bc987"/><file name="ambank_group.png" hash="099bfae5ded5d8e31fdcc628dc3de7e2"/><file name="american_express.png" hash="e4a577dd5039a2bab65b7de027e4be13"/><file name="argentina_banks.png" hash="97e6e32919e31ebe789472f37a476f8b"/><file name="banco_do_brasil.gif" hash="667bb89f35534f0b7b6d8a438508a88b"/><file name="bancomer.png" hash="17ffe51209f4b95ff80427362f657a79"/><file name="bank_transfer_logo_v6.png" hash="2f9ef6aa8ff3bd9cbd5044e09090e4b1"/><file name="beeline.png" hash="3a28a1eb11ef72646bcaa9cc83336b08"/><file name="bitcoin.png" hash="39d4bafa85173fab9990d3abe54496f3"/><file name="boleto_bancario.png" hash="f6e86cc5081f11b275b79d8af0520ba9"/><file name="bradesco_transferencia.png" hash="bc4c6760620a34fd00b2f5ed69576e21"/><file name="cards_brl.gif" hash="22d0fec42d931fac48087f6532a7cca8"/><file name="cards_colombia.gif" hash="e522dd8482bb5ea21605052bcc50c19d"/><file name="cashu.png" hash="df0f9530dcb9a8c4f0dc5ba252605123"/><file name="cimb_clicks.png" hash="5c6b4a18eb831c56eb9b128cf58b19ea"/><file name="counter-service-thailand_paysbuy-cash.png" hash="c84ca401b5e43d43d716464e9f3fda39"/><file name="cuentadigital.png" hash="036e2d620e385f1cff0f70c8f14868db"/><file name="danske_bank.png" hash="f99f90f528f0c4b92f00ef613bb9a7de"/><file name="debito_bradesco.png" hash="bf76c75a4a85b41c4b76bac23e1ae855"/><file name="dineromail.png" hash="33f5af837277e28e281946ec79f22194"/><file name="dp24_sofort.png" hash="368b4bf4d9e07e0b322b432faa7ff618"/><file name="dragon_pay.png" hash="17ec7a3afb163119bf1a55fd95aa2ec0"/><file name="eKonto.png" hash="392287f752646c1389433a326d2b3cab"/><file name="enets.png" hash="7c137cae5578577836c66dcd18f0f021"/><file name="eps-e-payment-standard.png" hash="e8882e834ffc5b77dd50109705f5fcba"/><file name="fpx.png" hash="7f4c6a9f924cdc1f45480ed397a4b80f"/><file name="giropay.png" hash="7d9d02897f63f201cb18a9e44c4386d9"/><file name="hong_leong.png" hash="762d2bdf0d93372a2cf2576c3b4ba5bd"/><file name="ideal.png" hash="cd3833c3b0879fde5b68402febb97589"/><file name="mandiri.png" hash="48ee8ddd905341cf9a7256bf0fd9a9a8"/><file name="mangir_cart.gif" hash="56a84b3a860ccf8d0db1ee1082702f46"/><file name="maybank2u.png" hash="d647549d861c892d2850a6616f6461c3"/><file name="mazooma.png" hash="27a9d98c97f1de58050f64d2b3e1d23d"/><file name="megafon.png" hash="ecf26d2f85ce9eab7755948d3d434dcd"/><file name="meps_cash.png" hash="34ae83d23977406b236e0c5f9bc65b44"/><file name="mercadopago.png" hash="892c519217c400e27220ed5ab4de261e"/><file name="mobile_money.png" hash="7f75e90891bb9b356da7a0ec4bedb207"/><file name="moneta.png" hash="338a82756875c3c494b35b68d73eb773"/><file name="mozca.png" hash="54a945ee2690300adcaf90c52b561765"/><file name="mrcash.png" hash="369c1ca9bb031828807f44669692a3ba"/><file name="mtcpay.png" hash="f8e593750cf9aa449255243aee1e72e6"/><file name="mts.gif" hash="b4bc8d834bb8536c820b9e3ef57b42db"/><file name="mybank.png" hash="9f8bf3009fd204c36d02df2f5b75e6b9"/><file name="nordea.png" hash="c8a16da380770db3d05918cf6147e83e"/><file name="onecard.png" hash="d14d53461b1b8a4dc8d89d4a9a0ba4e1"/><file name="online_banking_thailanda.png" hash="e8815328708416e5d6a50508e564acbe"/><file name="op-pohjola.png" hash="fd94de57ae60e3afd985a639c420d514"/><file name="oxxo.gif" hash="ac05a1abe4dd00824eb9311f0607dc4d"/><file name="p24.png" hash="8494b7b58ba7a5dd2521ca1be53ce37a"/><file name="pago_efectivo.gif" hash="738ef8043dd02266a78d7d4b6c5d239b"/><file name="pagos_en_efectivo_servipag_bci_chile.png" hash="acadda22c64dd353dcac8117bfd1fc07"/><file name="pagtotal.png" hash="ae37109cebe6b6b22c817bd58b2f74ba"/><file name="payeasy.png" hash="2b02d482197af0c100cc9708f6c330e3"/><file name="payment_references.png" hash="e61a499a96560d3c6964ac3d6b1fce8f"/><file name="payment_via_baloto.png" hash="8681510117d6aee52dd8045b160af6f0"/><file name="paypal.png" hash="cba61f30ae9ab1ec8ea87dfedb22408b"/><file name="paysafecard.png" hash="40671b01d31fc7298825ff6574952d2e"/><file name="paysbuy.png" hash="897d2ab55b7ca42058a1dd0b4e6a6728"/><file name="paysbuy_wallet.png" hash="0acb4707dfeb41af3d074d614a7c3485"/><file name="paysera.gif" hash="a243e136a0bd62c9b8178d23faca785a"/><file name="paytrail.gif" hash="0aa6e2eef9e9cee062effe1ed361b1c7"/><file name="poli.png" hash="f03d1e87d9b48576c3f366b98ecbe71a"/><file name="pse.png" hash="d66ef5333f270c672c77616af9b5aa20"/><file name="pwmb.png" hash="c43963ecf263c8bf83d9dd74e011c9df"/><file name="qiwi_wallet.png" hash="715beab1c80c2d02d561fc264f716c3e"/><file name="rhb.png" hash="e6c6b64c27c489e7e658e4b781cf747a"/><file name="s2p_cards.gif" hash="22d0fec42d931fac48087f6532a7cca8"/><file name="santander.gif" hash="d30180163ec24e2cf56d683d1e84d4fe"/><file name="scotiabank.gif" hash="17d5e63219623276924f6720053f0b83"/><file name="servipag.png" hash="9e4c12273f937e42149f2df3584fb4a7"/><file name="sibs_mb.png" hash="28352acf0ce61c5e326a93a30e0a6d25"/><file name="tenpay.png" hash="a65b0cb373c32ee9fddb98a26a85ce66"/><file name="todito_cash.png" hash="d4f9c6fab19081a69f94afbfb03f2f66"/><file name="trustly.png" hash="e64e5a9730ea7d45f2c41755fb5b2837"/><file name="trustpay.png" hash="4856854403455474c241afbcaf5172a9"/><file name="ukash.png" hash="a4e549ee30f82e15a9b438a9e30e7614"/><file name="umb.png" hash="93a2747b83d8d48c52adea8e9b374551"/><file name="web_cash.gif" hash="e49caf4308322dbe22282e0e156de83d"/><file name="webmoney.png" hash="5600e6676866d18304ec9bedfa204fca"/><file name="xltunai.png" hash="1fec1c07050a160e7c19f33e63202d87"/><file name="yandex.png" hash="c7f21e223572aa57669bd7d5c543ba9e"/><file name="yandex_money.png" hash="94489649adac0824a6dad19605ab0442"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Smart2Pay_Globalpay.xml" hash="1f3951214d78df89b34a781bd683699c"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="smart2pay"><dir name="globalpay"><file name="payment_confirmation.html" hash="20b2112815ea8437929d45e324beed19"/><file name="payment_instructions.html" hash="8451e3fadbdad49d1844bd60f5f1c21b"/><file name="payment_instructions_sibs.html" hash="1d76a24096133de9837859caff8a82a2"/></dir></dir></dir></dir><file name="Smart2Pay_Globalpay.csv" hash="1289fcf5de25c292a7e45638e3de14bf"/></dir><dir name="en_GB"><dir name="template"><dir name="email"><dir name="smart2pay"><dir name="globalpay"><file name="payment_confirmation.html" hash="20b2112815ea8437929d45e324beed19"/><file name="payment_instructions.html" hash="21797b7891cc5d162412ba112b2f8696"/><file name="payment_instructions_sibs.html" hash="1d76a24096133de9837859caff8a82a2"/></dir></dir></dir></dir><file name="Smart2Pay_Globalpay.csv" hash="1289fcf5de25c292a7e45638e3de14bf"/></dir><dir name="da_DK"><file name="Smart2Pay_Globalpay.csv" hash="e573ba63de5d0883d33c8aba799914d7"/></dir><dir name="de_AT"><file name="Smart2Pay_Globalpay.csv" hash="513e5f5c23f1b05b9e740243e5524eec"/></dir><dir name="de_DE"><file name="Smart2Pay_Globalpay.csv" hash="513e5f5c23f1b05b9e740243e5524eec"/></dir><dir name="es_AR"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_CL"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_CO"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_ES"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_MX"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="fi_FI"><file name="Smart2Pay_Globalpay.csv" hash="99292d7660a52809c80c1a77553b7928"/></dir><dir name="fr_FR"><file name="Smart2Pay_Globalpay.csv" hash="2fe4d15b14b0642b700adfc9c59093f6"/></dir><dir name="it_IT"><file name="Smart2Pay_Globalpay.csv" hash="8fc8a53f82b0b9c3565aabb0f1ebf168"/></dir><dir name="pt_BR"><file name="Smart2Pay_Globalpay.csv" hash="dd51daad3cad2a1f831fd40384895757"/></dir><dir name="pt_PT"><file name="Smart2Pay_Globalpay.csv" hash="dd51daad3cad2a1f831fd40384895757"/></dir></target></contents>
113
  <compatible/>
114
  <dependencies><required><php><min>5.2.6</min><max>5.6.0</max></php></required></dependencies>
115
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Smart2Pay</name>
4
+ <version>1.1.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">The Open Software License 3.0 (OSL-3.0)</license>
7
  <channel>community</channel>
105
  support@smart2pay.com for instructions on account activation and detailed &#xD;
106
  documentation.&lt;/p&gt;&#xD;
107
  </description>
108
+ <notes>- Support to provide a surcharge fee per each payment method as a percent or a fixed amount&#xD;
109
+ - Added Demo environment in order to help merchants to quickly have a working payment flow through our demo platform</notes>
110
  <authors><author><name>Stefan Iancu</name><user>stefani</user><email>support@smart2pay.com</email></author></authors>
111
+ <date>2015-05-20</date>
112
+ <time>07:30:41</time>
113
+ <contents><target name="magecommunity"><dir name="Smart2Pay"><dir name="Globalpay"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="1468910cfcb7b684c2f4b5288611f669"/></dir><dir name="Invoice"><file name="Total.php" hash="b2b61720ffdd569e4a3a107ad2b319cd"/></dir><file name="Total.php" hash="f1ec6e5840597c0f05ae7c983cedb40b"/></dir></dir><dir name="System"><dir name="Config"><file name="Configuredmethods.php" hash="c7aeffa8f0a8834b2666ce6f02d2c9e9"/><dir name="Fieldset"><file name="Simple.php" hash="7f386c137f7107bd71d639d7090860ab"/></dir></dir></dir></dir><dir name="Info"><file name="Globalpay.php" hash="de61f8c85e4d92d67f426b5e829a2131"/></dir><file name="Info.php" hash="fa2ae3f42cd02fdfada4fa2de496e3a9"/><file name="Paymentinstructions.php" hash="1490c20b3f13cb8d9a80616b66904cf2"/><dir name="Paymethod"><file name="Form.php" hash="c3a848735e625b8758524fc8d87144e1"/><file name="Sendform.php" hash="14fff0535bd4c5b8e63340ce5dbb7dcc"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="28c50120eb1cf3c260addb4aa168cccc"/></dir><dir name="Invoice"><file name="Total.php" hash="126906c054a0c3d11b73e3481c746ec0"/></dir><file name="Total.php" hash="90039e8aad1f7561020338bd2619e58d"/></dir><dir name="Pdf"><file name="Surcharge.php" hash="2fd8c7f87cc2c607312b459d8f19966d"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="b1fb3427b49d7472321eb8bd7a4d72a0"/><file name="Helper.php" hash="21facc364df33f89375b24cf0807bab4"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Configuredmethods.php" hash="34acdbfced9161e74ef32e7bfa1ec060"/></dir></dir></dir></dir><file name="Configuredmethods.php" hash="d2d79d61fc3134b26b6fbdf46fde743f"/><file name="Country.php" hash="d2f00e4b8119477d991d4b0eb1a49560"/><file name="Countrymethod.php" hash="f3166e1f8e5639a9f3e98e85da2aabbe"/><file name="GlobalpayLog.php" hash="545a439b0db6d525c8894c4af5933f7d"/><file name="Logger.php" hash="534118191b5b14d223544d765a54f672"/><file name="Method.php" hash="ef927f2723349a25a154cf00cea105e0"/><file name="Pay.php" hash="af4a11de937031088fe9a8a3c60fb843"/><dir name="Resource"><dir name="Configuredmethods"><file name="Collection.php" hash="5eda593d9324c1b08da9032410ac338d"/></dir><file name="Configuredmethods.php" hash="a900b1b081b72ea6f01a9cd053c5ace6"/><dir name="Country"><file name="Collection.php" hash="4ded83c204c83add05e9676a94638ce0"/></dir><file name="Country.php" hash="fcb4dcc631b086eaa715f5e7a96e7386"/><dir name="Countrymethod"><file name="Collection.php" hash="07bbc2a0ff65142e685b550468a35718"/></dir><file name="Countrymethod.php" hash="48074ce7a859de057445c7c27d9ae87b"/><dir name="Logger"><file name="Collection.php" hash="64dd8f9119679ff3e8c4d6b968201671"/></dir><file name="Logger.php" hash="98847ce83ed78a424c781885e4cee6b6"/><dir name="Method"><file name="Collection.php" hash="0219108ff85ea504a79296765c18b6d1"/></dir><file name="Method.php" hash="ce00096559b5ac1142c7f40a4f0505fd"/><file name="Setup.php" hash="2c839caa8a13287266f50dc27fd3a6a4"/><dir name="Transactionlogger"><file name="Collection.php" hash="e24c39b140ef198a0e154d0dd9104667"/></dir><file name="Transactionlogger.php" hash="36c4eed50271c5d0044446d7e743bd7b"/></dir><dir name="Sales"><file name="Observer.php" hash="e07110d2b5e0665c218b044dc50ba805"/><dir name="Order"><dir name="Invoice"><dir name="Total"><file name="Surcharge.php" hash="f72dc34c7481406bb4192b2595728182"/></dir></dir></dir><dir name="Pdf"><file name="Surcharge.php" hash="3aebc14631310c8df7170be7f02e0104"/></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Surcharge.php" hash="e76a8176c6a4d88b53f0c4b9433659a1"/></dir></dir></dir></dir><dir name="Source"><file name="Displaymodes.php" hash="e7c7f0e2117d1c0b31f8b492f6cfdf56"/><file name="Methods.php" hash="33e7a754d22c0c87deb58b5e3852466b"/><file name="Testlive.php" hash="f1e23cbdcdb5ffd56414cfdc83297831"/></dir><file name="Transactionlogger.php" hash="13fed5f7b9df700b9d60e63cd27df2e6"/></dir><dir name="controllers"><file name="IndexController.php" hash="2bbf52033529ba6cd493d385cdd8ebc6"/><file name="TestsController.php" hash="fef4a90341d6fbc3442ae2ed3aa776af"/></dir><dir name="etc"><file name="config.xml" hash="f63614731cf1a678c762398acd8b1224"/><file name="system.xml" hash="7a76e680c6d90435b5e5b9ad04b35e80"/></dir><dir name="sql"><dir name="globalpay_setup"><file name="mysql4-install-0.1.0.php" hash="b20f861bb89ecc6e75ca45ef4ae9a571"/><file name="mysql4-upgrade-1.0.3-1.1.1.php" hash="0cc5a5e482c69833594c8e9c3fd43027"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="3c74ed2415bf2e8575bff1898961805a"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="8112e779e009a9626a1c51408a7208f3"/><file name="mysql4-upgrade-1.1.3-1.1.4.php" hash="538609da33ce07f1d94ae548bf83a4c4"/><file name="mysql4-upgrade-1.1.4-1.1.5.php" hash="d79a11406afdd436159d736f975abbb1"/><file name="mysql4-upgrade-1.1.5-1.1.6.php" hash="51a02ab2316729ee2d5d7914c293a75b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="globalpay.xml" hash="225bb75aa16653078b3d85c74bfba38c"/></dir><dir name="template"><dir name="smart2pay"><dir name="globalpay"><file name="info.phtml" hash="f558fd34e676eee618deadc5d72bd8c7"/><file name="methodinfo.phtml" hash="261ec60d966c6b407bd0200956bc95e2"/><file name="paymentinstructions.phtml" hash="4da294678e43c633631fcb1f69238a64"/><dir name="paymethod"><file name="form.phtml" hash="93973a8e38e18944b52ddab5aaea040a"/><file name="sendform.phtml" hash="0b56c4764724202592ba9ecfc4d8cb0d"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="globalpay.xml" hash="430bd373c06d9c7a946bc76529aa8da6"/></dir><dir name="template"><dir name="smart2pay"><dir name="globalpay"><file name="methodinfo.phtml" hash="261ec60d966c6b407bd0200956bc95e2"/><file name="methodinfopdf.phtml" hash="00d63a97dd6d7ce37e964397226e426e"/><dir name="system"><dir name="config"><file name="methods.phtml" hash="a341648f5a92f9533858715dbf520f75"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="smart2pay"><dir name="methods"><file name="7-Eleven.gif" hash="6a6a250a4a7d1b423e2df0de29ca58a7"/><file name="IXe.gif" hash="2794745e00826bc6c623548926a2a188"/><file name="abaqoos.png" hash="ad0ee5b7a034c174ba07e936a5cdf823"/><file name="ach.png" hash="2c12370813d356b2b2f3c9494aad02bf"/><file name="alipay.png" hash="c63c14def69ae33db0614104bf3c3558"/><file name="alliance_online.gif" hash="89b8abd6f8a0134fd3eecfd2d80bc987"/><file name="ambank_group.png" hash="099bfae5ded5d8e31fdcc628dc3de7e2"/><file name="american_express.png" hash="e4a577dd5039a2bab65b7de027e4be13"/><file name="argentina_banks.png" hash="97e6e32919e31ebe789472f37a476f8b"/><file name="banco_do_brasil.gif" hash="667bb89f35534f0b7b6d8a438508a88b"/><file name="bancomer.png" hash="17ffe51209f4b95ff80427362f657a79"/><file name="bank_transfer_logo_v6.png" hash="2f9ef6aa8ff3bd9cbd5044e09090e4b1"/><file name="beeline.png" hash="3a28a1eb11ef72646bcaa9cc83336b08"/><file name="bitcoin.png" hash="39d4bafa85173fab9990d3abe54496f3"/><file name="boleto_bancario.png" hash="f6e86cc5081f11b275b79d8af0520ba9"/><file name="bradesco_transferencia.png" hash="bc4c6760620a34fd00b2f5ed69576e21"/><file name="cards_brl.gif" hash="22d0fec42d931fac48087f6532a7cca8"/><file name="cards_colombia.gif" hash="e522dd8482bb5ea21605052bcc50c19d"/><file name="cashinyandex.gif" hash="8fdccf95d10df08f9f4658fe96574f34"/><file name="cashu.png" hash="df0f9530dcb9a8c4f0dc5ba252605123"/><file name="cimb_clicks.png" hash="5c6b4a18eb831c56eb9b128cf58b19ea"/><file name="counter-service-thailand_paysbuy-cash.png" hash="c84ca401b5e43d43d716464e9f3fda39"/><file name="cuentadigital.png" hash="036e2d620e385f1cff0f70c8f14868db"/><file name="danske_bank.png" hash="f99f90f528f0c4b92f00ef613bb9a7de"/><file name="debito_bradesco.png" hash="bf76c75a4a85b41c4b76bac23e1ae855"/><file name="dineromail.png" hash="33f5af837277e28e281946ec79f22194"/><file name="dp24_sofort.png" hash="368b4bf4d9e07e0b322b432faa7ff618"/><file name="dragon_pay.png" hash="17ec7a3afb163119bf1a55fd95aa2ec0"/><file name="eKonto.png" hash="392287f752646c1389433a326d2b3cab"/><file name="enets.png" hash="7c137cae5578577836c66dcd18f0f021"/><file name="eps-e-payment-standard.png" hash="e8882e834ffc5b77dd50109705f5fcba"/><file name="fpx.png" hash="7f4c6a9f924cdc1f45480ed397a4b80f"/><file name="giropay.png" hash="7d9d02897f63f201cb18a9e44c4386d9"/><file name="hong_leong.png" hash="762d2bdf0d93372a2cf2576c3b4ba5bd"/><file name="ideal.png" hash="cd3833c3b0879fde5b68402febb97589"/><file name="mandiri.png" hash="48ee8ddd905341cf9a7256bf0fd9a9a8"/><file name="mangir_cart.gif" hash="56a84b3a860ccf8d0db1ee1082702f46"/><file name="maybank2u.png" hash="d647549d861c892d2850a6616f6461c3"/><file name="mazooma.png" hash="27a9d98c97f1de58050f64d2b3e1d23d"/><file name="megafon.png" hash="ecf26d2f85ce9eab7755948d3d434dcd"/><file name="meps_cash.png" hash="34ae83d23977406b236e0c5f9bc65b44"/><file name="mercadopago.png" hash="892c519217c400e27220ed5ab4de261e"/><file name="mobile_money.png" hash="7f75e90891bb9b356da7a0ec4bedb207"/><file name="moneta.png" hash="338a82756875c3c494b35b68d73eb773"/><file name="mozca.png" hash="54a945ee2690300adcaf90c52b561765"/><file name="mrcash.png" hash="369c1ca9bb031828807f44669692a3ba"/><file name="mtcpay.png" hash="f8e593750cf9aa449255243aee1e72e6"/><file name="mts.gif" hash="b4bc8d834bb8536c820b9e3ef57b42db"/><file name="mybank.png" hash="9f8bf3009fd204c36d02df2f5b75e6b9"/><file name="nordea.png" hash="c8a16da380770db3d05918cf6147e83e"/><file name="onecard.png" hash="d14d53461b1b8a4dc8d89d4a9a0ba4e1"/><file name="online_banking_thailanda.png" hash="e8815328708416e5d6a50508e564acbe"/><file name="op-pohjola.png" hash="fd94de57ae60e3afd985a639c420d514"/><file name="oxxo.gif" hash="ac05a1abe4dd00824eb9311f0607dc4d"/><file name="p24.png" hash="8494b7b58ba7a5dd2521ca1be53ce37a"/><file name="pago_efectivo.gif" hash="738ef8043dd02266a78d7d4b6c5d239b"/><file name="pagos_en_efectivo_servipag_bci_chile.png" hash="acadda22c64dd353dcac8117bfd1fc07"/><file name="pagtotal.png" hash="ae37109cebe6b6b22c817bd58b2f74ba"/><file name="payeasy.png" hash="2b02d482197af0c100cc9708f6c330e3"/><file name="payment_references.png" hash="e61a499a96560d3c6964ac3d6b1fce8f"/><file name="payment_via_baloto.png" hash="8681510117d6aee52dd8045b160af6f0"/><file name="paypal.png" hash="cba61f30ae9ab1ec8ea87dfedb22408b"/><file name="paysafecard.png" hash="40671b01d31fc7298825ff6574952d2e"/><file name="paysbuy.png" hash="897d2ab55b7ca42058a1dd0b4e6a6728"/><file name="paysbuy_wallet.png" hash="0acb4707dfeb41af3d074d614a7c3485"/><file name="paysera.gif" hash="a243e136a0bd62c9b8178d23faca785a"/><file name="paytrail.gif" hash="0aa6e2eef9e9cee062effe1ed361b1c7"/><file name="poli.png" hash="f03d1e87d9b48576c3f366b98ecbe71a"/><file name="pse.png" hash="d66ef5333f270c672c77616af9b5aa20"/><file name="pwmb.png" hash="c43963ecf263c8bf83d9dd74e011c9df"/><file name="qiwi_wallet.png" hash="715beab1c80c2d02d561fc264f716c3e"/><file name="rhb.png" hash="e6c6b64c27c489e7e658e4b781cf747a"/><file name="s2p_cards.gif" hash="22d0fec42d931fac48087f6532a7cca8"/><file name="santander.gif" hash="d30180163ec24e2cf56d683d1e84d4fe"/><file name="scotiabank.gif" hash="17d5e63219623276924f6720053f0b83"/><file name="servipag.png" hash="9e4c12273f937e42149f2df3584fb4a7"/><file name="sibs_mb.png" hash="28352acf0ce61c5e326a93a30e0a6d25"/><file name="tenpay.png" hash="a65b0cb373c32ee9fddb98a26a85ce66"/><file name="todito_cash.png" hash="d4f9c6fab19081a69f94afbfb03f2f66"/><file name="trustly.png" hash="e64e5a9730ea7d45f2c41755fb5b2837"/><file name="trustpay.png" hash="4856854403455474c241afbcaf5172a9"/><file name="ukash.png" hash="a4e549ee30f82e15a9b438a9e30e7614"/><file name="umb.png" hash="93a2747b83d8d48c52adea8e9b374551"/><file name="web_cash.gif" hash="e49caf4308322dbe22282e0e156de83d"/><file name="webmoney.png" hash="5600e6676866d18304ec9bedfa204fca"/><file name="xltunai.png" hash="1fec1c07050a160e7c19f33e63202d87"/><file name="yandex.png" hash="c7f21e223572aa57669bd7d5c543ba9e"/><file name="yandex_money.png" hash="94489649adac0824a6dad19605ab0442"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="smart2pay"><dir name="methods"><file name="7-Eleven.gif" hash="6a6a250a4a7d1b423e2df0de29ca58a7"/><file name="IXe.gif" hash="2794745e00826bc6c623548926a2a188"/><file name="abaqoos.png" hash="ad0ee5b7a034c174ba07e936a5cdf823"/><file name="ach.png" hash="2c12370813d356b2b2f3c9494aad02bf"/><file name="alipay.png" hash="c63c14def69ae33db0614104bf3c3558"/><file name="alliance_online.gif" hash="89b8abd6f8a0134fd3eecfd2d80bc987"/><file name="ambank_group.png" hash="099bfae5ded5d8e31fdcc628dc3de7e2"/><file name="american_express.png" hash="e4a577dd5039a2bab65b7de027e4be13"/><file name="argentina_banks.png" hash="97e6e32919e31ebe789472f37a476f8b"/><file name="banco_do_brasil.gif" hash="667bb89f35534f0b7b6d8a438508a88b"/><file name="bancomer.png" hash="17ffe51209f4b95ff80427362f657a79"/><file name="bank_transfer_logo_v6.png" hash="2f9ef6aa8ff3bd9cbd5044e09090e4b1"/><file name="beeline.png" hash="3a28a1eb11ef72646bcaa9cc83336b08"/><file name="bitcoin.png" hash="39d4bafa85173fab9990d3abe54496f3"/><file name="boleto_bancario.png" hash="f6e86cc5081f11b275b79d8af0520ba9"/><file name="bradesco_transferencia.png" hash="bc4c6760620a34fd00b2f5ed69576e21"/><file name="cards_brl.gif" hash="22d0fec42d931fac48087f6532a7cca8"/><file name="cards_colombia.gif" hash="e522dd8482bb5ea21605052bcc50c19d"/><file name="cashinyandex.gif" hash="8fdccf95d10df08f9f4658fe96574f34"/><file name="cashu.png" hash="df0f9530dcb9a8c4f0dc5ba252605123"/><file name="cimb_clicks.png" hash="5c6b4a18eb831c56eb9b128cf58b19ea"/><file name="counter-service-thailand_paysbuy-cash.png" hash="c84ca401b5e43d43d716464e9f3fda39"/><file name="cuentadigital.png" hash="036e2d620e385f1cff0f70c8f14868db"/><file name="danske_bank.png" hash="f99f90f528f0c4b92f00ef613bb9a7de"/><file name="debito_bradesco.png" hash="bf76c75a4a85b41c4b76bac23e1ae855"/><file name="dineromail.png" hash="33f5af837277e28e281946ec79f22194"/><file name="dp24_sofort.png" hash="368b4bf4d9e07e0b322b432faa7ff618"/><file name="dragon_pay.png" hash="17ec7a3afb163119bf1a55fd95aa2ec0"/><file name="eKonto.png" hash="392287f752646c1389433a326d2b3cab"/><file name="enets.png" hash="7c137cae5578577836c66dcd18f0f021"/><file name="eps-e-payment-standard.png" hash="e8882e834ffc5b77dd50109705f5fcba"/><file name="fpx.png" hash="7f4c6a9f924cdc1f45480ed397a4b80f"/><file name="giropay.png" hash="7d9d02897f63f201cb18a9e44c4386d9"/><file name="hong_leong.png" hash="762d2bdf0d93372a2cf2576c3b4ba5bd"/><file name="ideal.png" hash="cd3833c3b0879fde5b68402febb97589"/><file name="mandiri.png" hash="48ee8ddd905341cf9a7256bf0fd9a9a8"/><file name="mangir_cart.gif" hash="56a84b3a860ccf8d0db1ee1082702f46"/><file name="maybank2u.png" hash="d647549d861c892d2850a6616f6461c3"/><file name="mazooma.png" hash="27a9d98c97f1de58050f64d2b3e1d23d"/><file name="megafon.png" hash="ecf26d2f85ce9eab7755948d3d434dcd"/><file name="meps_cash.png" hash="34ae83d23977406b236e0c5f9bc65b44"/><file name="mercadopago.png" hash="892c519217c400e27220ed5ab4de261e"/><file name="mobile_money.png" hash="7f75e90891bb9b356da7a0ec4bedb207"/><file name="moneta.png" hash="338a82756875c3c494b35b68d73eb773"/><file name="mozca.png" hash="54a945ee2690300adcaf90c52b561765"/><file name="mrcash.png" hash="369c1ca9bb031828807f44669692a3ba"/><file name="mtcpay.png" hash="f8e593750cf9aa449255243aee1e72e6"/><file name="mts.gif" hash="b4bc8d834bb8536c820b9e3ef57b42db"/><file name="mybank.png" hash="9f8bf3009fd204c36d02df2f5b75e6b9"/><file name="nordea.png" hash="c8a16da380770db3d05918cf6147e83e"/><file name="onecard.png" hash="d14d53461b1b8a4dc8d89d4a9a0ba4e1"/><file name="online_banking_thailanda.png" hash="e8815328708416e5d6a50508e564acbe"/><file name="op-pohjola.png" hash="fd94de57ae60e3afd985a639c420d514"/><file name="oxxo.gif" hash="ac05a1abe4dd00824eb9311f0607dc4d"/><file name="p24.png" hash="8494b7b58ba7a5dd2521ca1be53ce37a"/><file name="pago_efectivo.gif" hash="738ef8043dd02266a78d7d4b6c5d239b"/><file name="pagos_en_efectivo_servipag_bci_chile.png" hash="acadda22c64dd353dcac8117bfd1fc07"/><file name="pagtotal.png" hash="ae37109cebe6b6b22c817bd58b2f74ba"/><file name="payeasy.png" hash="2b02d482197af0c100cc9708f6c330e3"/><file name="payment_references.png" hash="e61a499a96560d3c6964ac3d6b1fce8f"/><file name="payment_via_baloto.png" hash="8681510117d6aee52dd8045b160af6f0"/><file name="paypal.png" hash="cba61f30ae9ab1ec8ea87dfedb22408b"/><file name="paysafecard.png" hash="40671b01d31fc7298825ff6574952d2e"/><file name="paysbuy.png" hash="897d2ab55b7ca42058a1dd0b4e6a6728"/><file name="paysbuy_wallet.png" hash="0acb4707dfeb41af3d074d614a7c3485"/><file name="paysera.gif" hash="a243e136a0bd62c9b8178d23faca785a"/><file name="paytrail.gif" hash="0aa6e2eef9e9cee062effe1ed361b1c7"/><file name="poli.png" hash="f03d1e87d9b48576c3f366b98ecbe71a"/><file name="pse.png" hash="d66ef5333f270c672c77616af9b5aa20"/><file name="pwmb.png" hash="c43963ecf263c8bf83d9dd74e011c9df"/><file name="qiwi_wallet.png" hash="715beab1c80c2d02d561fc264f716c3e"/><file name="rhb.png" hash="e6c6b64c27c489e7e658e4b781cf747a"/><file name="s2p_cards.gif" hash="22d0fec42d931fac48087f6532a7cca8"/><file name="santander.gif" hash="d30180163ec24e2cf56d683d1e84d4fe"/><file name="scotiabank.gif" hash="17d5e63219623276924f6720053f0b83"/><file name="servipag.png" hash="9e4c12273f937e42149f2df3584fb4a7"/><file name="sibs_mb.png" hash="28352acf0ce61c5e326a93a30e0a6d25"/><file name="tenpay.png" hash="a65b0cb373c32ee9fddb98a26a85ce66"/><file name="todito_cash.png" hash="d4f9c6fab19081a69f94afbfb03f2f66"/><file name="trustly.png" hash="e64e5a9730ea7d45f2c41755fb5b2837"/><file name="trustpay.png" hash="4856854403455474c241afbcaf5172a9"/><file name="ukash.png" hash="a4e549ee30f82e15a9b438a9e30e7614"/><file name="umb.png" hash="93a2747b83d8d48c52adea8e9b374551"/><file name="web_cash.gif" hash="e49caf4308322dbe22282e0e156de83d"/><file name="webmoney.png" hash="5600e6676866d18304ec9bedfa204fca"/><file name="xltunai.png" hash="1fec1c07050a160e7c19f33e63202d87"/><file name="yandex.png" hash="c7f21e223572aa57669bd7d5c543ba9e"/><file name="yandex_money.png" hash="94489649adac0824a6dad19605ab0442"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Smart2Pay_Globalpay.xml" hash="1f3951214d78df89b34a781bd683699c"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="smart2pay"><dir name="globalpay"><file name="payment_confirmation.html" hash="20b2112815ea8437929d45e324beed19"/><file name="payment_instructions.html" hash="8451e3fadbdad49d1844bd60f5f1c21b"/><file name="payment_instructions_sibs.html" hash="1d76a24096133de9837859caff8a82a2"/></dir></dir></dir></dir><file name="Smart2Pay_Globalpay.csv" hash="095891b67ae1a66dd914c1ee897ef314"/></dir><dir name="en_GB"><dir name="template"><dir name="email"><dir name="smart2pay"><dir name="globalpay"><file name="payment_confirmation.html" hash="20b2112815ea8437929d45e324beed19"/><file name="payment_instructions.html" hash="21797b7891cc5d162412ba112b2f8696"/><file name="payment_instructions_sibs.html" hash="1d76a24096133de9837859caff8a82a2"/></dir></dir></dir></dir><file name="Smart2Pay_Globalpay.csv" hash="7c52a940b4cd689642cfc41e77e6c6d7"/></dir><dir name="da_DK"><file name="Smart2Pay_Globalpay.csv" hash="e573ba63de5d0883d33c8aba799914d7"/></dir><dir name="de_AT"><file name="Smart2Pay_Globalpay.csv" hash="513e5f5c23f1b05b9e740243e5524eec"/></dir><dir name="de_DE"><file name="Smart2Pay_Globalpay.csv" hash="513e5f5c23f1b05b9e740243e5524eec"/></dir><dir name="es_AR"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_CL"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_CO"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_ES"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="es_MX"><file name="Smart2Pay_Globalpay.csv" hash="a504653b67cb41dd4684c067303adc10"/></dir><dir name="fi_FI"><file name="Smart2Pay_Globalpay.csv" hash="99292d7660a52809c80c1a77553b7928"/></dir><dir name="fr_FR"><file name="Smart2Pay_Globalpay.csv" hash="2fe4d15b14b0642b700adfc9c59093f6"/></dir><dir name="it_IT"><file name="Smart2Pay_Globalpay.csv" hash="8fc8a53f82b0b9c3565aabb0f1ebf168"/></dir><dir name="pt_BR"><file name="Smart2Pay_Globalpay.csv" hash="dd51daad3cad2a1f831fd40384895757"/></dir><dir name="pt_PT"><file name="Smart2Pay_Globalpay.csv" hash="dd51daad3cad2a1f831fd40384895757"/></dir></target></contents>
114
  <compatible/>
115
  <dependencies><required><php><min>5.2.6</min><max>5.6.0</max></php></required></dependencies>
116
  </package>
skin/adminhtml/default/default/images/smart2pay/methods/7-Eleven.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/IXe.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/abaqoos.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/ach.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/alipay.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/alliance_online.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/ambank_group.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/american_express.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/argentina_banks.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/banco_do_brasil.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/bancomer.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/bank_transfer_logo_v6.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/beeline.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/bitcoin.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/boleto_bancario.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/bradesco_transferencia.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/cards_brl.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/cards_colombia.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/cashinyandex.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/cashu.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/cimb_clicks.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/counter-service-thailand_paysbuy-cash.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/cuentadigital.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/danske_bank.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/debito_bradesco.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/dineromail.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/dp24_sofort.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/dragon_pay.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/eKonto.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/enets.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/eps-e-payment-standard.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/fpx.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/giropay.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/hong_leong.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/ideal.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mandiri.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mangir_cart.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/maybank2u.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mazooma.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/megafon.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/meps_cash.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mercadopago.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mobile_money.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/moneta.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mozca.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mrcash.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mtcpay.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mts.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/mybank.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/nordea.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/onecard.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/online_banking_thailanda.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/op-pohjola.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/oxxo.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/p24.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/pago_efectivo.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/pagos_en_efectivo_servipag_bci_chile.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/pagtotal.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/payeasy.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/payment_references.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/payment_via_baloto.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/paypal.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/paysafecard.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/paysbuy.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/paysbuy_wallet.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/paysera.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/paytrail.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/poli.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/pse.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/pwmb.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/qiwi_wallet.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/rhb.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/s2p_cards.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/santander.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/scotiabank.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/servipag.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/sibs_mb.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/tenpay.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/todito_cash.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/trustly.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/trustpay.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/ukash.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/umb.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/web_cash.gif ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/webmoney.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/xltunai.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/yandex.png ADDED
Binary file
skin/adminhtml/default/default/images/smart2pay/methods/yandex_money.png ADDED
Binary file
skin/frontend/base/default/images/smart2pay/methods/cashinyandex.gif ADDED
Binary file