ConCardis_PayEngine_ePayments - Version 16.12.14

Version Notes

Download this release

Release Info

Developer Sebastian Ertner
Extension ConCardis_PayEngine_ePayments
Version 16.12.14
Comparing to
See all releases


Code changes from version 16.05.26 to 16.12.14

Files changed (259) hide show
  1. app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Edit/Tab/Alias.php +32 -29
  2. app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Renderer/PaymentMethod.php +8 -1
  3. app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixo/Shipping/Edit.php +7 -4
  4. app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/CategoryTree.php +11 -4
  5. app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/Edit/Form.php +47 -30
  6. app/code/community/Netresearch/OPS/Block/Alias/List.php +4 -1
  7. app/code/community/Netresearch/OPS/Block/Checkout/SubscriptionNotice.php +19 -10
  8. app/code/community/Netresearch/OPS/Block/Form.php +170 -23
  9. app/code/community/Netresearch/OPS/Block/Form/Alias.php +3 -3
  10. app/code/community/Netresearch/OPS/Block/Form/BankTransfer.php +42 -0
  11. app/code/community/Netresearch/OPS/Block/Form/Cc.php +17 -107
  12. app/code/community/Netresearch/OPS/Block/Form/DirectDebit.php +7 -193
  13. app/code/community/Netresearch/OPS/Block/Form/DirectEbanking.php +42 -0
  14. app/code/community/Netresearch/OPS/Block/Form/Flex.php +1 -2
  15. app/code/community/Netresearch/OPS/Block/Form/Ideal.php +2 -2
  16. app/code/community/Netresearch/OPS/Block/Form/Kwixo/ApresReception.php +1 -0
  17. app/code/community/Netresearch/OPS/Block/Form/Kwixo/Comptant.php +1 -0
  18. app/code/community/Netresearch/OPS/Block/Form/Kwixo/Credit.php +1 -0
  19. app/code/community/Netresearch/OPS/Block/Form/OpenInvoice.php +63 -0
  20. app/code/community/Netresearch/OPS/Block/Form/PayPerMail.php +43 -0
  21. app/code/community/Netresearch/OPS/Block/Form/RecurringCc.php +2 -1
  22. app/code/community/Netresearch/OPS/Block/Info/Alias.php +1 -0
  23. app/code/community/Netresearch/OPS/Block/Info/Bancontact.php +54 -0
  24. app/code/community/Netresearch/OPS/Block/Info/Cc.php +1 -0
  25. app/code/community/Netresearch/OPS/Block/Info/Flex.php +2 -0
  26. app/code/community/Netresearch/OPS/Block/Info/OpsId.php +1 -0
  27. app/code/community/Netresearch/OPS/Block/Info/PayPerMail.php +44 -0
  28. app/code/community/Netresearch/OPS/Block/Info/RecurringCc.php +4 -1
  29. app/code/community/Netresearch/OPS/Block/Info/Redirect.php +1 -0
  30. app/code/community/Netresearch/OPS/Block/Placeform.php +38 -14
  31. app/code/community/Netresearch/OPS/Block/Placeform3dsecure.php +1 -1
  32. app/code/community/Netresearch/OPS/Block/RetryPayment.php +64 -10
  33. app/code/community/Netresearch/OPS/Block/RetryPayment/Methods.php +80 -0
  34. app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Brand.php +8 -4
  35. app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Image.php +87 -0
  36. app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Method.php +12 -6
  37. app/code/community/Netresearch/OPS/Block/System/Config/Mode.php +32 -31
  38. app/code/community/Netresearch/OPS/Block/System/Config/PaymentForm.php +47 -0
  39. app/code/community/Netresearch/OPS/Block/System/Config/Support.php +9 -7
  40. app/code/community/Netresearch/OPS/Controller/Abstract.php +17 -8
  41. app/code/community/Netresearch/OPS/Helper/Address.php +181 -0
  42. app/code/community/Netresearch/OPS/Helper/Alias.php +103 -80
  43. app/code/community/Netresearch/OPS/Helper/Api.php +16 -12
  44. app/code/community/Netresearch/OPS/Helper/Creditcard.php +8 -6
  45. app/code/community/Netresearch/OPS/Helper/Data.php +5 -6
  46. app/code/community/Netresearch/OPS/Helper/Debitcard.php +1 -1
  47. app/code/community/Netresearch/OPS/Helper/DirectDebit.php +16 -183
  48. app/code/community/Netresearch/OPS/Helper/Directlink.php +21 -27
  49. app/code/community/Netresearch/OPS/Helper/Kwixo.php +7 -15
  50. app/code/community/Netresearch/OPS/Helper/MobileDetect.php +68 -0
  51. app/code/community/Netresearch/OPS/Helper/Order.php +2 -3
  52. app/code/community/Netresearch/OPS/Helper/Order/Refund.php +8 -4
  53. app/code/community/Netresearch/OPS/Helper/Payment.php +73 -278
  54. app/code/community/Netresearch/OPS/Helper/Payment/DirectLink/Request.php +6 -3
  55. app/code/community/Netresearch/OPS/Helper/Payment/Request.php +170 -91
  56. app/code/community/Netresearch/OPS/Helper/Quote.php +6 -4
  57. app/code/community/Netresearch/OPS/Helper/Subscription.php +1 -1
  58. app/code/community/Netresearch/OPS/Helper/Validation/Checkout/Step.php +51 -30
  59. app/code/community/Netresearch/OPS/Helper/Validation/Result.php +7 -7
  60. app/code/community/Netresearch/OPS/Model/Alias.php +11 -5
  61. app/code/community/Netresearch/OPS/Model/Api/Directlink.php +43 -23
  62. app/code/community/Netresearch/OPS/Model/Backend/Operation/Capture/Parameter.php +3 -2
  63. app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter.php +3 -3
  64. app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Abstract.php +11 -9
  65. app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/Interface.php +1 -1
  66. app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/OpenInvoiceNlAbstract.php +52 -45
  67. app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Additional/OpenInvoiceNl.php +59 -62
  68. app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Parameter.php +6 -4
  69. app/code/community/Netresearch/OPS/Model/Config.php +151 -16
  70. app/code/community/Netresearch/OPS/Model/File/Download.php +3 -3
  71. app/code/community/Netresearch/OPS/Model/Kwixo/Category/Mapping.php +4 -3
  72. app/code/community/Netresearch/OPS/Model/Kwixo/Shipping/Setting.php +0 -1
  73. app/code/community/Netresearch/OPS/Model/Mysql4/Alias.php +6 -6
  74. app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Category/Mapping.php +1 -1
  75. app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Shipping/Setting.php +0 -1
  76. app/code/community/Netresearch/OPS/Model/Observer.php +43 -17
  77. app/code/community/Netresearch/OPS/Model/Payment/Abstract.php +142 -120
  78. app/code/community/Netresearch/OPS/Model/Payment/Bancontact.php +55 -1
  79. app/code/community/Netresearch/OPS/Model/Payment/BankTransfer.php +4 -1
  80. app/code/community/Netresearch/OPS/Model/Payment/Cc.php +31 -6
  81. app/code/community/Netresearch/OPS/Model/Payment/Debitcard.php +4 -1
  82. app/code/community/Netresearch/OPS/Model/Payment/DirectDebit.php +6 -5
  83. app/code/community/Netresearch/OPS/Model/Payment/DirectEbanking.php +7 -14
  84. app/code/community/Netresearch/OPS/Model/Payment/DirectLink.php +4 -2
  85. app/code/community/Netresearch/OPS/Model/Payment/Features/PaymentEmail.php +198 -197
  86. app/code/community/Netresearch/OPS/Model/Payment/Features/ZeroAmountAuth.php +2 -1
  87. app/code/community/Netresearch/OPS/Model/Payment/IDeal.php +1 -5
  88. app/code/community/Netresearch/OPS/Model/Payment/InterSolve.php +1 -1
  89. app/code/community/Netresearch/OPS/Model/Payment/Kwixo/Abstract.php +53 -115
  90. app/code/community/Netresearch/OPS/Model/Payment/Masterpass.php +9 -9
  91. app/code/community/Netresearch/OPS/Model/Payment/Mpass.php +0 -25
  92. app/code/community/Netresearch/OPS/Model/Payment/OpenInvoice/Abstract.php +55 -17
  93. app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceAt.php +93 -84
  94. app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceDe.php +3 -3
  95. app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceNl.php +16 -22
  96. app/code/community/Netresearch/OPS/Model/Payment/PayPerMail.php +41 -0
  97. app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc.php +21 -12
  98. app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc/ParameterBag.php +22 -15
  99. app/code/community/Netresearch/OPS/Model/Response/Handler.php +2 -1
  100. app/code/community/Netresearch/OPS/Model/Response/Type/Abstract.php +41 -9
  101. app/code/community/Netresearch/OPS/Model/Response/Type/Authorize.php +179 -115
  102. app/code/community/Netresearch/OPS/Model/Response/Type/Capture.php +79 -45
  103. app/code/community/Netresearch/OPS/Model/Response/Type/Refund.php +66 -42
  104. app/code/community/Netresearch/OPS/Model/Response/Type/Special.php +6 -8
  105. app/code/community/Netresearch/OPS/Model/Response/Type/Void.php +3 -4
  106. app/code/community/Netresearch/OPS/Model/Source/BankTransfer/Countries.php +11 -2
  107. app/code/community/Netresearch/OPS/Model/Source/DirectDebit/Countries.php +7 -1
  108. app/code/community/Netresearch/OPS/Model/Source/DirectEbanking/Brands.php +1 -1
  109. app/code/community/Netresearch/OPS/Model/Source/Kwixo/ShipMethodType.php +6 -6
  110. app/code/community/Netresearch/OPS/Model/Source/Mode.php +31 -29
  111. app/code/community/Netresearch/OPS/Model/Source/OrderReference.php +8 -2
  112. app/code/community/Netresearch/OPS/Model/Source/PaymentAction.php +8 -2
  113. app/code/community/Netresearch/OPS/Model/Source/Pmlist.php +12 -3
  114. app/code/community/Netresearch/OPS/Model/Source/Template.php +16 -4
  115. app/code/community/Netresearch/OPS/Model/Source/TemplateType.php +23 -21
  116. app/code/community/Netresearch/OPS/Model/Status.php +4 -3
  117. app/code/community/Netresearch/OPS/Model/Status/Update.php +4 -2
  118. app/code/community/Netresearch/OPS/Model/Subscription/Manager.php +10 -8
  119. app/code/community/Netresearch/OPS/Model/System/Config/Backend/Encoding.php +46 -0
  120. app/code/community/Netresearch/OPS/Model/System/Config/Backend/Flex/Methods.php +2 -2
  121. app/code/community/Netresearch/OPS/Model/System/Config/Backend/Intersolve/Brands.php +1 -1
  122. app/code/community/Netresearch/OPS/Model/System/Config/Backend/PaymentLogo.php +47 -0
  123. app/code/community/Netresearch/OPS/Model/System/Config/Mode.php +40 -39
  124. app/code/community/Netresearch/OPS/Model/System/Config/Template.php +63 -63
  125. app/code/community/Netresearch/OPS/Model/Validator/CompositeInterface.php +1 -1
  126. app/code/community/Netresearch/OPS/Model/Validator/Kwixo/Shipping/Setting.php +4 -4
  127. app/code/community/Netresearch/OPS/Model/Validator/Parameter/Factory.php +8 -3
  128. app/code/community/Netresearch/OPS/Model/Validator/Parameter/Length.php +9 -3
  129. app/code/community/Netresearch/OPS/Model/Validator/Payment/DirectDebit.php +0 -250
  130. app/code/community/Netresearch/OPS/Test/Block/Adminhtml/Customer/Renderer/StateTest.php +1 -1
  131. app/code/community/Netresearch/OPS/Test/Block/Alias/ListTest.php +1 -1
  132. app/code/community/Netresearch/OPS/Test/Block/Checkout/DeviceFingerprintingTest.php +2 -2
  133. app/code/community/Netresearch/OPS/Test/Block/Form/CcTest.php +4 -4
  134. app/code/community/Netresearch/OPS/Test/Block/Form/DirectDebitTest.php +0 -281
  135. app/code/community/Netresearch/OPS/Test/Block/Form/Ideal.php +1 -1
  136. app/code/community/Netresearch/OPS/Test/Block/FormTest.php +50 -77
  137. app/code/community/Netresearch/OPS/Test/Block/FormTest/fixtures/FormTest.yaml +22 -0
  138. app/code/community/Netresearch/OPS/Test/Block/FrauddetectionTest.php +16 -3
  139. app/code/community/Netresearch/OPS/Test/Block/PlaceformTest.php +20 -2
  140. app/code/community/Netresearch/OPS/Test/Block/RetryPayment/MethodsTest.php +86 -0
  141. app/code/community/Netresearch/OPS/Test/Block/RetryPaymentTest.php +94 -0
  142. app/code/community/Netresearch/OPS/Test/Block/System/Config/Form/Field/ImageTest.php +73 -0
  143. app/code/community/Netresearch/OPS/Test/Block/System/Config/ModeTest.php +21 -20
  144. app/code/community/Netresearch/OPS/Test/Controller/Adminhtml/AdminControllerTest.php +82 -80
  145. app/code/community/Netresearch/OPS/Test/Controller/Adminhtml/KwixoshippingControllerTest.php +8 -23
  146. app/code/community/Netresearch/OPS/Test/Controller/AliasControllerTest.php +125 -106
  147. app/code/community/Netresearch/OPS/Test/Controller/PaymentControllerTest.php +223 -56
  148. app/code/community/Netresearch/OPS/Test/Controller/PaymentControllerTest/fixtures/orders.yaml +26 -0
  149. app/code/community/Netresearch/OPS/Test/Helper/AddressTest.php +22 -0
  150. app/code/community/Netresearch/OPS/Test/Helper/AddressTest/expectations/splitStreet.yaml +209 -0
  151. app/code/community/Netresearch/OPS/Test/Helper/AddressTest/providers/splitStreet.yaml +105 -0
  152. app/code/community/Netresearch/OPS/Test/Helper/AliasTest.php +88 -58
  153. app/code/community/Netresearch/OPS/Test/Helper/DataTest.php +18 -22
  154. app/code/community/Netresearch/OPS/Test/Helper/DirectDebitTest.php +67 -424
  155. app/code/community/Netresearch/OPS/Test/Helper/DirectDebitTest/fixtures/orders.yaml +79 -0
  156. app/code/community/Netresearch/OPS/Test/Helper/DirectLinkTest.php +26 -8
  157. app/code/community/Netresearch/OPS/Test/Helper/MobileDetectTest.php +77 -0
  158. app/code/community/Netresearch/OPS/Test/Helper/Payment/RequestTest.php +5 -2
  159. app/code/community/Netresearch/OPS/Test/Helper/PaymentTest.php +101 -170
  160. app/code/community/Netresearch/OPS/Test/Helper/SubscriptionTest.php +2 -1
  161. app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Capture/Additional/OpenInvoiceNlTest.php +23 -37
  162. app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Capture/ParameterTest.php +17 -3
  163. app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/ParameterTest.php +2 -1
  164. app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Refund/Additional/OpenInvoiceNlTest.php +68 -52
  165. app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Refund/ParameterTest.php +9 -3
  166. app/code/community/Netresearch/OPS/Test/Model/ConfigTest.php +40 -0
  167. app/code/community/Netresearch/OPS/Test/Model/File/Download.php +4 -3
  168. app/code/community/Netresearch/OPS/Test/Model/Mysql4/Alias/AliasTest.php +2 -1
  169. app/code/community/Netresearch/OPS/Test/Model/ObserverTest.php +122 -71
  170. app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractRefundTest.php +7 -7
  171. app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest.php +69 -30
  172. app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest/expectations/paymentMethods.yaml +0 -3
  173. app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest/fixtures/.gitkeep +0 -0
  174. app/code/community/Netresearch/OPS/Test/Model/Payment/BancontactTest.php +50 -0
  175. app/code/community/Netresearch/OPS/Test/Model/Payment/BancontactTest/fixtures/.gitkeep +0 -0
  176. app/code/community/Netresearch/OPS/Test/Model/Payment/CcTest.php +3 -3
  177. app/code/community/Netresearch/OPS/Test/Model/Payment/DirectLinkTest.php +4 -7
  178. app/code/community/Netresearch/OPS/Test/Model/Payment/Features/PaymentEmailTest.php +12 -16
  179. app/code/community/Netresearch/OPS/Test/Model/Payment/IDealTest.php +21 -44
  180. app/code/community/Netresearch/OPS/Test/Model/Payment/InterSolveTest.php +4 -29
  181. app/code/community/Netresearch/OPS/Test/Model/Payment/Kwixo/AbstractTest.php +2 -40
  182. app/code/community/Netresearch/OPS/Test/Model/Payment/Kwixo/AbstractTest/expectations/paymentMethods.yaml +0 -3
  183. app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoApresReceptionTest.php +4 -4
  184. app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoComptantTest.php +4 -4
  185. app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoCreditTest.php +2 -1
  186. app/code/community/Netresearch/OPS/Test/Model/Payment/OpenInvoiceAtTest.php +27 -0
  187. app/code/community/Netresearch/OPS/Test/Model/Payment/OpenInvoiceNlTest.php +10 -6
  188. app/code/community/Netresearch/OPS/Test/Model/Payment/PayPerMailTest.php +77 -0
  189. app/code/community/Netresearch/OPS/Test/Model/Payment/Recurring/Cc/ParameterBagTest.php +2 -1
  190. app/code/community/Netresearch/OPS/Test/Model/Payment/Recurring/CcTest.php +6 -3
  191. app/code/community/Netresearch/OPS/Test/Model/Response/TestCase.php +4 -6
  192. app/code/community/Netresearch/OPS/Test/Model/Response/Type/AuthorizeTest.php +5 -5
  193. app/code/community/Netresearch/OPS/Test/Model/Response/Type/CaptureTest.php +2 -2
  194. app/code/community/Netresearch/OPS/Test/Model/Source/ModeTest.php +21 -21
  195. app/code/community/Netresearch/OPS/Test/Model/Status/UpdateTest.php +27 -31
  196. app/code/community/Netresearch/OPS/Test/Model/StatusTest.php +1 -1
  197. app/code/community/Netresearch/OPS/Test/Model/Subscription/ManagerTest.php +2 -1
  198. app/code/community/Netresearch/OPS/Test/Model/System/Config/Backend/EncodingTest.php +60 -0
  199. app/code/community/Netresearch/OPS/Test/Model/System/Config/Backend/PaymentLogoTest.php +53 -0
  200. app/code/community/Netresearch/OPS/Test/Model/Validator/Payment/DirectDebitTest.php +0 -166
  201. app/code/community/Netresearch/OPS/Test/var/fixtures/orders.yaml +65 -1
  202. app/code/community/Netresearch/OPS/Trait/AliasController.php +87 -61
  203. app/code/community/Netresearch/OPS/Trait/PaymentHelper.php +1 -1
  204. app/code/community/Netresearch/OPS/controllers/Adminhtml/AdminController.php +4 -2
  205. app/code/community/Netresearch/OPS/controllers/Adminhtml/KwixocategoryController.php +7 -2
  206. app/code/community/Netresearch/OPS/controllers/Adminhtml/KwixoshippingController.php +37 -31
  207. app/code/community/Netresearch/OPS/controllers/AliasController.php +13 -13
  208. app/code/community/Netresearch/OPS/controllers/ApiController.php +1 -6
  209. app/code/community/Netresearch/OPS/controllers/CustomerController.php +3 -1
  210. app/code/community/Netresearch/OPS/controllers/DeviceController.php +4 -3
  211. app/code/community/Netresearch/OPS/controllers/PaymentController.php +142 -30
  212. app/code/community/Netresearch/OPS/data/ops_setup/data-install-14.02.05.php +12 -12
  213. app/code/community/Netresearch/OPS/etc/config.xml +32 -10
  214. app/code/community/Netresearch/OPS/etc/jstranslator.xml +27 -0
  215. app/code/community/Netresearch/OPS/etc/system.xml +1673 -380
  216. app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-1.0.1-12.12.03.php +4 -2
  217. app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.04.10-13.04.16.php +16 -8
  218. app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.05.30-13.06.07.php +16 -8
  219. app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.06.07-13.07.04.php +4 -2
  220. app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.11.04-13.11.05.php +4 -2
  221. app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-14.01.27-14.02.05.php +1 -2
  222. app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-16.05.26-27.06.16.php +8 -0
  223. app/design/adminhtml/default/default/layout/ops.xml +10 -15
  224. app/design/adminhtml/default/default/template/ops/categoriestree.phtml +19 -0
  225. app/design/adminhtml/default/default/template/ops/form/cc.phtml +6 -58
  226. app/design/adminhtml/default/default/template/ops/form/directDebit.phtml +177 -49
  227. app/design/adminhtml/default/default/template/ops/form/opsId.phtml +20 -3
  228. app/design/adminhtml/default/default/template/ops/form/payPerMail.phtml +31 -0
  229. app/design/adminhtml/default/default/template/ops/info.phtml +9 -14
  230. app/design/adminhtml/default/default/template/ops/info/bancontact.phtml +81 -0
  231. app/design/adminhtml/default/default/template/ops/info/cc.phtml +9 -14
  232. app/design/adminhtml/default/default/template/ops/info/opsId.phtml +9 -14
  233. app/design/adminhtml/default/default/template/ops/info/payPerMail.phtml +23 -0
  234. app/design/adminhtml/default/default/template/ops/info/redirect.phtml +9 -14
  235. app/design/adminhtml/default/default/template/ops/sales/order/creditmemo/closed-transaction/warning.phtml +21 -0
  236. app/design/adminhtml/default/default/template/ops/sales/order/creditmemo/totals/checkbox.phtml +9 -14
  237. app/design/adminhtml/default/default/template/ops/system/config/kwixoconfiglinks.phtml +21 -0
  238. app/design/adminhtml/default/default/template/ops/system/config/support.phtml +21 -0
  239. app/design/frontend/base/default/layout/ops.xml +38 -15
  240. app/design/frontend/base/default/template/ops/customer/alias/list.phtml +17 -19
  241. app/design/frontend/base/default/template/ops/form.phtml +1 -65
  242. app/design/frontend/base/default/template/ops/form/alias.phtml +2 -2
  243. app/design/frontend/base/default/template/ops/form/bankTransfer.phtml +51 -0
  244. app/design/frontend/base/default/template/ops/form/cc.phtml +85 -96
  245. app/design/frontend/base/default/template/ops/form/directDebit.phtml +125 -57
  246. app/design/frontend/base/default/template/ops/form/directEbanking.phtml +51 -0
  247. app/design/frontend/base/default/template/ops/form/flex.phtml +5 -4
  248. app/design/frontend/base/default/template/ops/form/ideal.phtml +22 -1
  249. app/design/frontend/base/default/template/ops/form/intersolve.phtml +1 -0
  250. app/design/frontend/base/default/template/ops/form/openInvoice.phtml +42 -0
  251. app/design/frontend/base/default/template/ops/form/other.phtml +24 -1
  252. app/design/frontend/base/default/template/ops/frauddetection.phtml +20 -0
  253. app/design/frontend/base/default/template/ops/info/bancontact.phtml +23 -0
  254. app/design/frontend/base/default/template/ops/info/cc.phtml +9 -14
  255. app/design/frontend/base/default/template/ops/info/opsId.phtml +21 -0
  256. app/design/frontend/base/default/template/ops/info/payPerMail.phtml +23 -0
  257. app/design/frontend/base/default/template/ops/info/redirect.phtml +9 -14
  258. app/design/frontend/base/default/template/ops/paypage.phtml +9 -14
  259. app/design/frontend/base/default/template/ops/placeform.phtml +18 -18
app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Edit/Tab/Alias.php CHANGED
@@ -78,15 +78,6 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Edit_Tab_Alias
78
  return 'orders';
79
  }
80
 
81
- /*
82
- * Retrieves Grid Url
83
- *
84
- * @return string
85
- */
86
- public function getGridUrl()
87
- {
88
- //return $this->getUrl('*/ops/customer', array('_current'=>true));
89
- }
90
 
91
  protected function _prepareCollection()
92
  {
@@ -102,45 +93,60 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Edit_Tab_Alias
102
 
103
  protected function _prepareColumns()
104
  {
105
- $this->addColumn('alias', array(
 
106
  'header' => Mage::helper('ops')->__('Alias'),
107
  'align' => 'right',
108
  'index' => 'alias',
109
- ));
 
110
 
111
- $this->addColumn('payment_method', array(
 
112
  'header' => Mage::helper('ops')->__('Payment method'),
113
  'index' => 'payment_method',
114
  'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_PaymentMethod'
115
- ));
 
116
 
117
- $this->addColumn('brand', array(
 
118
  'header' => Mage::helper('ops')->__('Credit Card Type'),
119
  'index' => 'brand',
120
- ));
 
121
 
122
- $this->addColumn('pseudo_account_or_cc_no', array(
 
123
  'header' => Mage::helper('ops')->__('Card Number/Account Number'),
124
  'index' => 'pseudo_account_or_cc_no',
125
- ));
 
126
 
127
- $this->addColumn('expiration_date', array(
 
128
  'header' => Mage::helper('ops')->__('Expiration Date'),
129
  'index' => 'expiration_date',
130
- ));
 
131
 
132
- $this->addColumn('card_holder', array(
 
133
  'header' => Mage::helper('ops')->__('Card Holder'),
134
  'index' => 'card_holder',
135
- ));
 
136
 
137
- $this->addColumn('state', array(
 
138
  'header' => Mage::helper('ops')->__('State'),
139
  'index' => 'state',
140
  'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_State',
141
- ));
 
142
 
143
- $this->addColumn('action',
 
144
  array(
145
  'header' => Mage::helper('ops')->__('Action'),
146
  'width' => '100',
@@ -157,13 +163,10 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Edit_Tab_Alias
157
  'sortable' => false,
158
  'index' => 'stores',
159
  'is_system' => true,
160
- ));
 
161
 
162
  return parent::_prepareColumns();
163
  }
164
 
165
- public function getRowUrl($row)
166
- {
167
- //return $this->getUrl('*/customer/edit', array('id' => $row->getId()));
168
- }
169
  }
78
  return 'orders';
79
  }
80
 
 
 
 
 
 
 
 
 
 
81
 
82
  protected function _prepareCollection()
83
  {
93
 
94
  protected function _prepareColumns()
95
  {
96
+ $this->addColumn(
97
+ 'alias', array(
98
  'header' => Mage::helper('ops')->__('Alias'),
99
  'align' => 'right',
100
  'index' => 'alias',
101
+ )
102
+ );
103
 
104
+ $this->addColumn(
105
+ 'payment_method', array(
106
  'header' => Mage::helper('ops')->__('Payment method'),
107
  'index' => 'payment_method',
108
  'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_PaymentMethod'
109
+ )
110
+ );
111
 
112
+ $this->addColumn(
113
+ 'brand', array(
114
  'header' => Mage::helper('ops')->__('Credit Card Type'),
115
  'index' => 'brand',
116
+ )
117
+ );
118
 
119
+ $this->addColumn(
120
+ 'pseudo_account_or_cc_no', array(
121
  'header' => Mage::helper('ops')->__('Card Number/Account Number'),
122
  'index' => 'pseudo_account_or_cc_no',
123
+ )
124
+ );
125
 
126
+ $this->addColumn(
127
+ 'expiration_date', array(
128
  'header' => Mage::helper('ops')->__('Expiration Date'),
129
  'index' => 'expiration_date',
130
+ )
131
+ );
132
 
133
+ $this->addColumn(
134
+ 'card_holder', array(
135
  'header' => Mage::helper('ops')->__('Card Holder'),
136
  'index' => 'card_holder',
137
+ )
138
+ );
139
 
140
+ $this->addColumn(
141
+ 'state', array(
142
  'header' => Mage::helper('ops')->__('State'),
143
  'index' => 'state',
144
  'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_State',
145
+ )
146
+ );
147
 
148
+ $this->addColumn(
149
+ 'action',
150
  array(
151
  'header' => Mage::helper('ops')->__('Action'),
152
  'width' => '100',
163
  'sortable' => false,
164
  'index' => 'stores',
165
  'is_system' => true,
166
+ )
167
+ );
168
 
169
  return parent::_prepareColumns();
170
  }
171
 
 
 
 
 
172
  }
app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Renderer/PaymentMethod.php CHANGED
@@ -9,12 +9,19 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Renderer_PaymentMethod
9
  extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
10
  {
11
 
 
 
 
 
12
  public function render(Varien_Object $row)
13
  {
 
14
  $methodCode = $row->getData($this->getColumn()->getIndex());
15
  $instance = Mage::helper('payment')->getMethodInstance($methodCode);
16
  if ($instance) {
17
- return $instance->getTitle();
18
  }
 
 
19
  }
20
  }
9
  extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
10
  {
11
 
12
+ /**
13
+ * @param Varien_Object $row
14
+ * @return string
15
+ */
16
  public function render(Varien_Object $row)
17
  {
18
+ $title = '';
19
  $methodCode = $row->getData($this->getColumn()->getIndex());
20
  $instance = Mage::helper('payment')->getMethodInstance($methodCode);
21
  if ($instance) {
22
+ $title = $instance->getTitle();
23
  }
24
+
25
+ return $title;
26
  }
27
  }
app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixo/Shipping/Edit.php CHANGED
@@ -13,7 +13,7 @@ class Netresearch_OPS_Block_Adminhtml_Kwixo_Shipping_Edit
13
  {
14
 
15
 
16
- private $kwixoShippingModel = null;
17
 
18
  /**
19
  * gets the form action url
@@ -64,15 +64,18 @@ class Netresearch_OPS_Block_Adminhtml_Kwixo_Shipping_Edit
64
  return $this->kwixoShippingModel;
65
  }
66
 
67
-
68
- private function getValues($carrierCode)
 
 
 
69
  {
70
  $values = array(
71
  'kwixo_shipping_type' => '',
72
  'kwixo_shipping_speed' => '',
73
  'kwixo_shipping_details' => ''
74
  );
75
- if (!is_null($this->getData('postData')) && array_key_exists($carrierCode, $this->getData('postData'))) {
76
  $errorData = $this->getData('postData');
77
  $values = $errorData[$carrierCode];
78
  } else {
13
  {
14
 
15
 
16
+ protected $kwixoShippingModel = null;
17
 
18
  /**
19
  * gets the form action url
64
  return $this->kwixoShippingModel;
65
  }
66
 
67
+ /**
68
+ * @param $carrierCode
69
+ * @return array
70
+ */
71
+ protected function getValues($carrierCode)
72
  {
73
  $values = array(
74
  'kwixo_shipping_type' => '',
75
  'kwixo_shipping_speed' => '',
76
  'kwixo_shipping_details' => ''
77
  );
78
+ if (null != ($this->getData('postData')) && array_key_exists($carrierCode, $this->getData('postData'))) {
79
  $errorData = $this->getData('postData');
80
  $values = $errorData[$carrierCode];
81
  } else {
app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/CategoryTree.php CHANGED
@@ -33,7 +33,16 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_CategoryTree
33
 
34
  public function getSwitchTreeUrl()
35
  {
36
- return $this->getUrl("*/*/tree", array('_current' => true, 'store' => null, '_query' => false, 'id' => null, 'parent' => null));
 
 
 
 
 
 
 
 
 
37
  }
38
 
39
  public function getNodesUrl()
@@ -50,8 +59,6 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_CategoryTree
50
  {
51
  $item = array();
52
  $item['text'] = $this->buildNodeName($node);
53
- //$rootForStores = in_array($node->getEntityId(), $this->getRootIds());
54
-
55
  $item['id'] = $node->getId();
56
  $item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
57
  $item['store'] = (int) $this->getStore()->getId();
@@ -92,7 +99,7 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_CategoryTree
92
 
93
  public function buildNodeName($node)
94
  {
95
- $result = $this->htmlEscape($node->getName());
96
  return $result;
97
  }
98
 
33
 
34
  public function getSwitchTreeUrl()
35
  {
36
+ return $this->getUrl(
37
+ "*/*/tree",
38
+ array(
39
+ '_current' => true,
40
+ 'store' => null,
41
+ '_query' => false,
42
+ 'id' => null,
43
+ 'parent' => null
44
+ )
45
+ );
46
  }
47
 
48
  public function getNodesUrl()
59
  {
60
  $item = array();
61
  $item['text'] = $this->buildNodeName($node);
 
 
62
  $item['id'] = $node->getId();
63
  $item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
64
  $item['store'] = (int) $this->getStore()->getId();
99
 
100
  public function buildNodeName($node)
101
  {
102
+ $result = $this->escapeHtml($node->getName());
103
  return $result;
104
  }
105
 
app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/Edit/Form.php CHANGED
@@ -4,12 +4,14 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_Edit_Form
4
  {
5
  protected function _prepareForm()
6
  {
7
- $form = new Varien_Data_Form(array(
 
8
  'id' => 'edit_form',
9
  'action' => $this->getUrl('*/*/save'),
10
  'method' => 'post',
11
  'enctype' => 'multipart/form-data'
12
- ));
 
13
 
14
  $categoryId = (int) $this->getRequest()->getParam('id');
15
  if ($categoryId <= 0) {
@@ -18,38 +20,53 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_Edit_Form
18
  $kwixoCategoryMapping = Mage::getModel('ops/kwixo_category_mapping')->loadByCategoryId($categoryId);
19
  $storeId = (int) $this->getRequest()->getParam('store');
20
 
21
- $fieldset = $form->addFieldset('ops_form', array('legend' => Mage::helper('ops/data')->__('Categories configuration')));
 
 
 
 
 
22
 
23
- $fieldset->addField('storeId', 'hidden', array(
24
- 'required' => true,
25
- 'name' => 'storeId',
26
- 'value' => $storeId,
27
- ));
 
 
28
 
29
- $fieldset->addField('id', 'hidden', array(
30
- 'required' => false,
31
- 'name' => 'id',
32
- 'value' => $kwixoCategoryMapping->getId(),
33
- ));
34
- $fieldset->addField('category_id', 'hidden', array(
35
- 'required' => true,
36
- 'name' => 'category_id',
37
- 'value' => $categoryId,
38
- ));
 
 
 
 
39
 
40
- $fieldset->addField('kwixoCategory_id', 'select', array(
41
- 'label' => Mage::Helper('ops/data')->__('Kwixo category'),
42
- 'class' => 'required-entry',
43
- 'required' => true,
44
- 'name' => 'kwixoCategory_id',
45
- 'value' => $kwixoCategoryMapping->getKwixoCategoryId(),
46
- 'values' => Mage::getModel('ops/source_kwixo_productCategories')->toOptionArray()
47
- ));
 
 
48
 
49
- $fieldset->addField('applysubcat', 'checkbox', array(
50
- 'label' => Mage::Helper('ops/data')->__('Apply to sub-categories'),
51
- 'name' => 'applysubcat'
52
- ));
 
 
53
 
54
  $form->setUseContainer(true);
55
  $this->setForm($form);
4
  {
5
  protected function _prepareForm()
6
  {
7
+ $form = new Varien_Data_Form(
8
+ array(
9
  'id' => 'edit_form',
10
  'action' => $this->getUrl('*/*/save'),
11
  'method' => 'post',
12
  'enctype' => 'multipart/form-data'
13
+ )
14
+ );
15
 
16
  $categoryId = (int) $this->getRequest()->getParam('id');
17
  if ($categoryId <= 0) {
20
  $kwixoCategoryMapping = Mage::getModel('ops/kwixo_category_mapping')->loadByCategoryId($categoryId);
21
  $storeId = (int) $this->getRequest()->getParam('store');
22
 
23
+ $fieldset = $form->addFieldset(
24
+ 'ops_form',
25
+ array(
26
+ 'legend' => Mage::helper('ops/data')->__('Categories configuration')
27
+ )
28
+ );
29
 
30
+ $fieldset->addField(
31
+ 'storeId', 'hidden', array(
32
+ 'required' => true,
33
+ 'name' => 'storeId',
34
+ 'value' => $storeId,
35
+ )
36
+ );
37
 
38
+ $fieldset->addField(
39
+ 'id', 'hidden', array(
40
+ 'required' => false,
41
+ 'name' => 'id',
42
+ 'value' => $kwixoCategoryMapping->getId(),
43
+ )
44
+ );
45
+ $fieldset->addField(
46
+ 'category_id', 'hidden', array(
47
+ 'required' => true,
48
+ 'name' => 'category_id',
49
+ 'value' => $categoryId,
50
+ )
51
+ );
52
 
53
+ $fieldset->addField(
54
+ 'kwixoCategory_id', 'select', array(
55
+ 'label' => Mage::Helper('ops/data')->__('Kwixo category'),
56
+ 'class' => 'required-entry',
57
+ 'required' => true,
58
+ 'name' => 'kwixoCategory_id',
59
+ 'value' => $kwixoCategoryMapping->getKwixoCategoryId(),
60
+ 'values' => Mage::getModel('ops/source_kwixo_productCategories')->toOptionArray()
61
+ )
62
+ );
63
 
64
+ $fieldset->addField(
65
+ 'applysubcat', 'checkbox', array(
66
+ 'label' => Mage::Helper('ops/data')->__('Apply to sub-categories'),
67
+ 'name' => 'applysubcat'
68
+ )
69
+ );
70
 
71
  $form->setUseContainer(true);
72
  $this->setForm($form);
app/code/community/Netresearch/OPS/Block/Alias/List.php CHANGED
@@ -40,10 +40,13 @@ class Netresearch_OPS_Block_Alias_List
40
  */
41
  public function getMethodName($methodCode)
42
  {
 
43
  $instance = Mage::helper('payment')->getMethodInstance($methodCode);
44
  if ($instance) {
45
- return $instance->getTitle();
46
  }
 
 
47
  }
48
 
49
  /**
40
  */
41
  public function getMethodName($methodCode)
42
  {
43
+ $title = '';
44
  $instance = Mage::helper('payment')->getMethodInstance($methodCode);
45
  if ($instance) {
46
+ $title = $instance->getTitle();
47
  }
48
+
49
+ return $title;
50
  }
51
 
52
  /**
app/code/community/Netresearch/OPS/Block/Checkout/SubscriptionNotice.php CHANGED
@@ -93,7 +93,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
93
  */
94
  public function getInitialFeeText()
95
  {
96
- return $this->__('You will be charged an initial amount of %s.',
 
97
  $this->helper('checkout')->formatPrice($this->getProfile()->getInitAmount())
98
  );
99
  }
@@ -105,7 +106,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
105
  {
106
  $profile = $this->getProfile();
107
 
108
- return $this->__('A trial subscription will be created. This will charge you %s every %s %s until %s.',
 
109
  $this->helper('checkout')->formatPrice(
110
  $profile->getTrialBillingAmount() + $profile->getShippingAmount()
111
  ),
@@ -122,7 +124,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
122
  {
123
  $profile = $this->getProfile();
124
 
125
- $message = $this->__('A subscription will be created. This will charge you %s every %s %s.',
 
126
  $this->helper('checkout')->formatPrice(
127
  $profile->getBillingAmount() + $profile->getTaxAmount() + $profile->getShippingAmount()
128
  ),
@@ -130,16 +133,19 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
130
  $profile->getPeriodUnitLabel($profile->getPeriodUnit())
131
  );
132
 
133
- if($this->getRegularSubscriptionEndDate()){
134
- $message .= $this->__(' The subscription will end on %s.',
135
- $this->localizeDate($this->getRegularSubscriptionEndDate()));
 
 
136
  }
137
  return $message;
138
  }
139
 
140
  public function getCancelInformationText()
141
  {
142
- return $this->__('To cancel the subscription, please send an email to the shop owner' .
 
143
  ' or request this by clicking the suspend button on the subscriptions detail view in your customer account.'
144
  . ' A link to that page will be displayed on the checkout success page.'
145
  );
@@ -163,7 +169,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
163
  $parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
164
  $enddate = null;
165
  $startDate = new DateTime($this->getProfile()->getStartDatetime());
166
- $enddate = $parameterModel->calculateEndDate($startDate, $this->getProfile()->getTrialPeriodUnit(),
 
167
  $this->getProfile()->getTrialPeriodFrequency(), $this->getProfile()->getTrialPeriodMaxCycles()
168
  );
169
 
@@ -179,14 +186,16 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
179
  } else {
180
  $startDate = new DateTime($this->getProfile()->getStartDatetime());
181
  }
182
- $enddate = $parameterModel->calculateEndDate($startDate, $this->getProfile()->getPeriodUnit(),
 
183
  $this->getProfile()->getPeriodFrequency(), $this->getProfile()->getPeriodMaxCycles()
184
  );
185
 
186
  return $enddate;
187
  }
188
 
189
- protected function localizeDate(DateTime $date){
 
190
  $date = new Zend_Date($date->getTimestamp());
191
  return Mage::helper('core')->formatDate($date);
192
  }
93
  */
94
  public function getInitialFeeText()
95
  {
96
+ return $this->__(
97
+ 'You will be charged an initial amount of %s.',
98
  $this->helper('checkout')->formatPrice($this->getProfile()->getInitAmount())
99
  );
100
  }
106
  {
107
  $profile = $this->getProfile();
108
 
109
+ return $this->__(
110
+ 'A trial subscription will be created. This will charge you %s every %s %s until %s.',
111
  $this->helper('checkout')->formatPrice(
112
  $profile->getTrialBillingAmount() + $profile->getShippingAmount()
113
  ),
124
  {
125
  $profile = $this->getProfile();
126
 
127
+ $message = $this->__(
128
+ 'A subscription will be created. This will charge you %s every %s %s.',
129
  $this->helper('checkout')->formatPrice(
130
  $profile->getBillingAmount() + $profile->getTaxAmount() + $profile->getShippingAmount()
131
  ),
133
  $profile->getPeriodUnitLabel($profile->getPeriodUnit())
134
  );
135
 
136
+ if ($this->getRegularSubscriptionEndDate()) {
137
+ $message .= $this->__(
138
+ ' The subscription will end on %s.',
139
+ $this->localizeDate($this->getRegularSubscriptionEndDate())
140
+ );
141
  }
142
  return $message;
143
  }
144
 
145
  public function getCancelInformationText()
146
  {
147
+ return $this->__(
148
+ 'To cancel the subscription, please send an email to the shop owner' .
149
  ' or request this by clicking the suspend button on the subscriptions detail view in your customer account.'
150
  . ' A link to that page will be displayed on the checkout success page.'
151
  );
169
  $parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
170
  $enddate = null;
171
  $startDate = new DateTime($this->getProfile()->getStartDatetime());
172
+ $enddate = $parameterModel->calculateEndDate(
173
+ $startDate, $this->getProfile()->getTrialPeriodUnit(),
174
  $this->getProfile()->getTrialPeriodFrequency(), $this->getProfile()->getTrialPeriodMaxCycles()
175
  );
176
 
186
  } else {
187
  $startDate = new DateTime($this->getProfile()->getStartDatetime());
188
  }
189
+ $enddate = $parameterModel->calculateEndDate(
190
+ $startDate, $this->getProfile()->getPeriodUnit(),
191
  $this->getProfile()->getPeriodFrequency(), $this->getProfile()->getPeriodMaxCycles()
192
  );
193
 
194
  return $enddate;
195
  }
196
 
197
+ protected function localizeDate(DateTime $date)
198
+ {
199
  $date = new Zend_Date($date->getTimestamp());
200
  return Mage::helper('core')->formatDate($date);
201
  }
app/code/community/Netresearch/OPS/Block/Form.php CHANGED
@@ -33,6 +33,8 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
33
 
34
  protected $config = null;
35
 
 
 
36
  /**
37
  * Frontend Payment Template
38
  */
@@ -78,7 +80,12 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
78
  */
79
  public function getQuote()
80
  {
81
- return Mage::getSingleton('checkout/session')->getQuote();
 
 
 
 
 
82
  }
83
 
84
  /**
@@ -159,34 +166,13 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
159
  }
160
 
161
  /**
162
- * @return Simple_Xml
163
  */
164
  protected function getFieldMapping()
165
  {
166
  return $this->getConfig()->getFrontendFieldMapping();
167
  }
168
 
169
- /**
170
- * returns the corresponding fields for frontend validation if needed
171
- *
172
- * @return string - the json encoded fields
173
- */
174
- public function getFrontendValidators()
175
- {
176
- $frontendFields = array();
177
- if ($this->getConfig()->canSubmitExtraParameter($this->getQuote()->getStoreId())) {
178
- $fieldsToValidate = $this->getConfig()->getParameterLengths();
179
- $mappedFields = $this->getFieldMapping();
180
- foreach ($fieldsToValidate as $key => $value) {
181
- if (array_key_exists($key, $mappedFields)) {
182
- $frontendFields = $this->getFrontendValidationFields($mappedFields, $key, $value, $frontendFields);
183
- }
184
- }
185
- }
186
-
187
- return Mage::helper('core/data')->jsonEncode($frontendFields);
188
- }
189
-
190
  /**
191
  * @param $mappedFields
192
  * @param $key
@@ -213,4 +199,165 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
213
  $brandName = str_replace(' ', '', $brand);
214
  return $this->getSkinUrl('images/ops/alias/brands/'. $brandName .'.png');
215
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  }
33
 
34
  protected $config = null;
35
 
36
+ protected $_aliasDataForCustomer = array();
37
+
38
  /**
39
  * Frontend Payment Template
40
  */
80
  */
81
  public function getQuote()
82
  {
83
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
84
+ if (Mage::app()->getStore()->isAdmin()) {
85
+ $quote = Mage::getSingleton('adminhtml/sales_order_create')->getQuote();
86
+ }
87
+
88
+ return $quote;
89
  }
90
 
91
  /**
166
  }
167
 
168
  /**
169
+ * @return array
170
  */
171
  protected function getFieldMapping()
172
  {
173
  return $this->getConfig()->getFrontendFieldMapping();
174
  }
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  /**
177
  * @param $mappedFields
178
  * @param $key
199
  $brandName = str_replace(' ', '', $brand);
200
  return $this->getSkinUrl('images/ops/alias/brands/'. $brandName .'.png');
201
  }
202
+
203
+ /**
204
+ * Function to add the Payment Logo to the according title
205
+ *
206
+ * @return string
207
+ */
208
+ public function getMethodLabelAfterHtml()
209
+ {
210
+ $paymentCode = $this->getMethod()->getCode();
211
+ $logoValue = Mage::getStoreConfig('payment/' . $paymentCode . '/image');
212
+ $logoPosition = Mage::getStoreConfig('payment/' . $paymentCode . '/position');
213
+
214
+ if ($logoPosition != 'hidden') {
215
+ if (!empty($logoValue)) {
216
+ $url = Mage::getBaseUrl('media') . 'ops/paymentLogo/' . $logoValue;
217
+ } else {
218
+ $url = Mage::helper('ops/payment')->getPaymentDefaultLogo($paymentCode);
219
+ }
220
+
221
+ return "<span class='payment-logo $logoPosition'><img src='$url' alt='$paymentCode' title='$paymentCode'/></span>";
222
+ }
223
+
224
+ return '';
225
+ }
226
+
227
+ /**
228
+ * Obtain redirect message.
229
+ *
230
+ * @return string
231
+ */
232
+ public function getRedirectMessage()
233
+ {
234
+ return $this->__('You will be redirected to finalize your payment.');
235
+ }
236
+
237
+ /**
238
+ * retrieves the alias data for the logged in customer
239
+ *
240
+ * @return array | null - array the alias data or null if the customer
241
+ * is not logged in
242
+ */
243
+ protected function getStoredAliasForCustomer()
244
+ {
245
+ if (Mage::helper('customer/data')->isLoggedIn()
246
+ && Mage::getModel('ops/config')->isAliasManagerEnabled($this->getMethodCode())
247
+ ) {
248
+ $quote = $this->getQuote();
249
+ $aliases = Mage::helper('ops/alias')->getAliasesForAddresses(
250
+ $quote->getCustomer()->getId(), $quote->getBillingAddress(),
251
+ $quote->getShippingAddress(), $quote->getStoreId()
252
+ )
253
+ ->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE)
254
+ ->addFieldToFilter('payment_method', $this->getMethodCode())
255
+ ->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC);
256
+
257
+
258
+ foreach ($aliases as $key => $alias) {
259
+ $this->_aliasDataForCustomer[$key] = $alias;
260
+ }
261
+ }
262
+
263
+ return $this->_aliasDataForCustomer;
264
+ }
265
+
266
+ /**
267
+ * @param null $storeId
268
+ * @param bool $admin
269
+ *
270
+ * @return string
271
+ */
272
+ public function getAliasAcceptUrl($storeId = null, $admin = false)
273
+ {
274
+ return Mage::getModel('ops/config')->getAliasAcceptUrl($storeId, $admin);
275
+ }
276
+
277
+ /**
278
+ * @param null $storeId
279
+ * @param bool $admin
280
+ *
281
+ * @return string
282
+ */
283
+ public function getAliasExceptionUrl($storeId = null, $admin = false)
284
+ {
285
+ return Mage::getModel('ops/config')->getAliasExceptionUrl($storeId, $admin);
286
+ }
287
+
288
+
289
+ /**
290
+ * @param null $storeId
291
+ *
292
+ * @return string
293
+ */
294
+ public function getAliasGatewayUrl($storeId = null)
295
+ {
296
+ return Mage::getModel('ops/config')->getAliasGatewayUrl($storeId);
297
+ }
298
+
299
+ /**
300
+ *
301
+ * @param $aliasId
302
+ *
303
+ * @return null|string - the card holder either from alias data or
304
+ * the name from the the user who is logged in, null otherwise
305
+ */
306
+ public function getCardHolderName($aliasId)
307
+ {
308
+ $cardHolderName = $this->getStoredAliasDataForCustomer($aliasId, 'card_holder');
309
+ $customerHelper = Mage::helper('customer/data');
310
+ if ((null === $cardHolderName || 0 === strlen(trim($cardHolderName)))
311
+ && $customerHelper->isLoggedIn()
312
+ && Mage::getModel('ops/config')->isAliasManagerEnabled($this->getMethodCode())
313
+ ) {
314
+ $cardHolderName = $customerHelper->getCustomerName();
315
+ }
316
+
317
+ return $cardHolderName;
318
+ }
319
+
320
+ /**
321
+ * @param $aliasId
322
+ * @return null|string
323
+ */
324
+ public function getAliasCardNumber($aliasId)
325
+ {
326
+ $aliasCardNumber = $this->getStoredAliasDataForCustomer($aliasId, 'pseudo_account_or_cc_no');
327
+ if (0 < strlen(trim($aliasCardNumber))) {
328
+ $aliasCardNumber = Mage::helper('ops/alias')->formatAliasCardNo(
329
+ $this->getStoredAliasDataForCustomer($aliasId, 'brand'), $aliasCardNumber
330
+ );
331
+ }
332
+
333
+ return $aliasCardNumber;
334
+ }
335
+
336
+ /**
337
+ * retrieves single values to given keys from the alias data
338
+ *
339
+ * @param $aliasId
340
+ * @param $key - string the key for the alias data
341
+ *
342
+ * @return null|string - null if key is not set in the alias data, otherwise
343
+ * the value for the given key from the alias data
344
+ */
345
+ protected function getStoredAliasDataForCustomer($aliasId, $key)
346
+ {
347
+ $returnValue = null;
348
+ $aliasData = array();
349
+
350
+ if (empty($this->_aliasDataForCustomer)) {
351
+ $aliasData = $this->getStoredAliasForCustomer();
352
+ } else {
353
+ $aliasData = $this->_aliasDataForCustomer;
354
+ }
355
+
356
+ if (array_key_exists($aliasId, $aliasData) && $aliasData[$aliasId]->hasData($key)) {
357
+ $returnValue = $aliasData[$aliasId]->getData($key);
358
+ }
359
+
360
+ return $returnValue;
361
+ }
362
+
363
  }
app/code/community/Netresearch/OPS/Block/Form/Alias.php CHANGED
@@ -39,10 +39,10 @@ class Netresearch_OPS_Block_Form_Alias extends Netresearch_OPS_Block_Form
39
  }
40
  return array();
41
  }
42
-
43
  /**
44
- *
45
- * @param String $alias- the human readable alias
46
  */
47
  protected function getHumanReadableAlias($alias)
48
  {
39
  }
40
  return array();
41
  }
42
+
43
  /**
44
+ * @param $alias
45
+ * @return string
46
  */
47
  protected function getHumanReadableAlias($alias)
48
  {
app/code/community/Netresearch/OPS/Block/Form/BankTransfer.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * BankTransfer.php
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
28
+ */
29
+ ?>
30
+ <?php
31
+
32
+ class Netresearch_OPS_Block_Form_BankTransfer extends Netresearch_OPS_Block_Form
33
+ {
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ protected function _construct()
38
+ {
39
+ parent::_construct();
40
+ $this->setTemplate('ops/form/bankTransfer.phtml');
41
+ }
42
+ }
app/code/community/Netresearch/OPS/Block/Form/Cc.php CHANGED
@@ -11,7 +11,7 @@
11
  class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
12
  {
13
 
14
- private $aliasDataForCustomer = array();
15
 
16
  /**
17
  * CC Payment Template
@@ -36,38 +36,6 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
36
  ->getAliasInterfaceCompatibleTypes();
37
  }
38
 
39
- /**
40
- * @param null $storeId
41
- * @param bool $admin
42
- *
43
- * @return string
44
- */
45
- public function getAliasAcceptUrl($storeId = null, $admin = false)
46
- {
47
- return Mage::getModel('ops/config')->getAliasAcceptUrl($storeId, $admin);
48
- }
49
-
50
- /**
51
- * @param null $storeId
52
- * @param bool $admin
53
- *
54
- * @return string
55
- */
56
- public function getAliasExceptionUrl($storeId = null, $admin = false)
57
- {
58
- return Mage::getModel('ops/config')->getAliasExceptionUrl($storeId, $admin);
59
- }
60
-
61
- /**
62
- * @param null $storeId
63
- *
64
- * @return string
65
- */
66
- public function getAliasGatewayUrl($storeId = null)
67
- {
68
- return Mage::getModel('ops/config')->getAliasGatewayUrl($storeId);
69
- }
70
-
71
  /**
72
  * @return string
73
  */
@@ -122,47 +90,20 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
122
 
123
 
124
  foreach ($aliases as $key => $alias) {
125
- $this->aliasDataForCustomer[$key] = $alias;
126
  }
127
  }
128
 
129
- return $this->aliasDataForCustomer;
130
  }
131
 
132
 
133
- /**
134
- * retrieves single values to given keys from the alias data
135
- *
136
- * @param $aliasId
137
- * @param $key - string the key for the alias data
138
- *
139
- * @return null|string - null if key is not set in the alias data, otherwise
140
- * the value for the given key from the alias data
141
- */
142
- protected function getStoredAliasDataForCustomer($aliasId, $key)
143
- {
144
- $returnValue = null;
145
- $aliasData = array();
146
-
147
- if (empty($this->aliasDataForCustomer)) {
148
- $aliasData = $this->getStoredAliasForCustomer();
149
- } else {
150
- $aliasData = $this->aliasDataForCustomer;
151
- }
152
-
153
- if (array_key_exists($aliasId, $aliasData) && $aliasData[$aliasId]->hasData($key)) {
154
- $returnValue = $aliasData[$aliasId]->getData($key);
155
- }
156
 
157
- return $returnValue;
158
- }
159
 
160
  /**
161
- * retrieves the given path (month or year) from stored expiration date
162
- *
163
- * @param $key - the requested path
164
- *
165
- * @return null | string the extracted part of the date
166
  */
167
  public function getExpirationDatePart($aliasId, $key)
168
  {
@@ -193,56 +134,17 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
193
 
194
  }
195
 
196
- /**
197
- * retrieves the masked alias card number and formats it in a card specific format
198
- *
199
- * @return null|string - null if no alias data were found,
200
- * otherwise the formatted card number
201
- */
202
- public function getAliasCardNumber($aliasId)
203
- {
204
- $aliasCardNumber = $this->getStoredAliasDataForCustomer($aliasId, 'pseudo_account_or_cc_no');
205
- if (0 < strlen(trim($aliasCardNumber))) {
206
- $aliasCardNumber = Mage::helper('ops/alias')->formatAliasCardNo(
207
- $this->getStoredAliasDataForCustomer($aliasId, 'brand'), $aliasCardNumber
208
- );
209
- }
210
-
211
- return $aliasCardNumber;
212
- }
213
-
214
- /**
215
- * @return null|string - the card holder either from alias data or
216
- * the name from the the user who is logged in, null otherwise
217
- */
218
- public function getCardHolderName($aliasId)
219
- {
220
- $cardHolderName = $this->getStoredAliasDataForCustomer($aliasId, 'card_holder');
221
- $customerHelper = Mage::helper('customer/data');
222
- if ((is_null($cardHolderName) || 0 === strlen(trim($cardHolderName)))
223
- && $customerHelper->isLoggedIn()
224
- && Mage::getModel('ops/config')->isAliasManagerEnabled($this->getMethodCode())
225
- ) {
226
- $cardHolderName = $customerHelper->getCustomerName();
227
- }
228
-
229
- return $cardHolderName;
230
- }
231
 
232
  /**
233
  * the brand of the stored card data
234
  *
 
 
235
  * @return null|string - string if stored card data were found, null otherwise
236
  */
237
  public function getStoredAliasBrand($aliasId)
238
  {
239
- $storedBrand = $this->getStoredAliasDataForCustomer($aliasId, 'brand');
240
- $methodCode = $this->getMethodCode();
241
- if (in_array($storedBrand, Mage::getModel('ops/config')->getInlinePaymentCcTypes($methodCode))) {
242
- return $storedBrand;
243
- }
244
-
245
- return '';
246
  }
247
 
248
  /**
@@ -265,4 +167,12 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
265
  return explode(',', $this->getConfig()->getAcceptedCcTypes($this->getMethodCode()));
266
  }
267
 
 
 
 
 
 
 
 
 
268
  }
11
  class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
12
  {
13
 
14
+ protected $_aliasDataForCustomer = array();
15
 
16
  /**
17
  * CC Payment Template
36
  ->getAliasInterfaceCompatibleTypes();
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * @return string
41
  */
90
 
91
 
92
  foreach ($aliases as $key => $alias) {
93
+ $this->_aliasDataForCustomer[$key] = $alias;
94
  }
95
  }
96
 
97
+ return $this->_aliasDataForCustomer;
98
  }
99
 
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
 
 
102
 
103
  /**
104
+ * @param $aliasId
105
+ * @param $key
106
+ * @return null|string
 
 
107
  */
108
  public function getExpirationDatePart($aliasId, $key)
109
  {
134
 
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
  /**
139
  * the brand of the stored card data
140
  *
141
+ * @param $aliasId
142
+ *
143
  * @return null|string - string if stored card data were found, null otherwise
144
  */
145
  public function getStoredAliasBrand($aliasId)
146
  {
147
+ return $this->getStoredAliasDataForCustomer($aliasId, 'brand');
 
 
 
 
 
 
148
  }
149
 
150
  /**
167
  return explode(',', $this->getConfig()->getAcceptedCcTypes($this->getMethodCode()));
168
  }
169
 
170
+ public function checkIfBrandHasAliasInterfaceSupport($alias)
171
+ {
172
+ $brand = $this->getStoredAliasBrand($alias);
173
+ $allowedBrands = $this->getMethod()->getBrandsForAliasInterface();
174
+
175
+ return in_array($brand, $allowedBrands);
176
+ }
177
+
178
  }
app/code/community/Netresearch/OPS/Block/Form/DirectDebit.php CHANGED
@@ -10,8 +10,6 @@
10
  class Netresearch_OPS_Block_Form_DirectDebit extends Netresearch_OPS_Block_Form
11
  {
12
 
13
- protected $previousParams = array();
14
-
15
  /**
16
  * Backend Payment Template
17
  */
@@ -34,200 +32,16 @@ class Netresearch_OPS_Block_Form_DirectDebit extends Netresearch_OPS_Block_Form
34
  }
35
 
36
  /**
37
- * get previously entred params for displaying them again in the backend
38
- *
39
- * @return array - the previously entred params
40
- */
41
- public function getParams()
42
- {
43
- $params = Mage::getModel('adminhtml/session')->getData(
44
- 'ops_direct_debit_params'
45
- );
46
-
47
- Mage::getModel('adminhtml/session')->unsetData(
48
- 'ops_direct_debit_params'
49
- );
50
- if (!is_array($params)) {
51
- $params = array(
52
- 'country' => '',
53
- 'CN' => '',
54
- 'iban' => '',
55
- 'bic' => '',
56
- 'account' => '',
57
- 'bankcode' => ''
58
- );
59
- }
60
- $this->previousParams = $params;
61
-
62
- return $this->previousParams;
63
- }
64
-
65
- /**
66
- * checks if the iban field is required
67
- *
68
- * @return bool - true if so, false otherwise
69
- */
70
- public function isIbanFieldRequired()
71
- {
72
- return (count($this->previousParams) == 0
73
- || (array_key_exists(
74
- 'iban', $this->previousParams
75
- )
76
- && 0 < strlen('iban')
77
- || array_key_exists('account', $this->previousParams)
78
- && 0 == strlen($this->previousParams['account'])));
79
- }
80
-
81
- /**
82
- * checks if the account field is required
83
- *
84
- * @return bool - true if so, false otherwise
85
- */
86
- public function isAccountFieldRequired()
87
- {
88
- return (count($this->previousParams) == 0
89
- || (array_key_exists(
90
- 'account', $this->previousParams
91
- )
92
- && (!array_key_exists('iban', $this->previousParams)
93
- || 0 == strlen($this->previousParams['iban']))));
94
- }
95
-
96
-
97
-
98
- /**
99
- * checks if the bankcode field is required
100
- *
101
- * @return bool - true if so, false otherwise
102
- */
103
- public function isBankCodeFieldRequired()
104
- {
105
- return $this->isAccountFieldRequired()
106
- && array_key_exists(
107
- 'country', $this->previousParams
108
- )
109
- && ('DE' == strtoupper(
110
- $this->getCountry())
111
- || 'AT' == strtoupper($this->getCountry())
112
-
113
- );
114
- }
115
-
116
- /**
117
- * checks if the bankcode field is visible
118
- *
119
- * @return bool - true if so, false otherwise
120
- */
121
- public function isBankCodeFieldVisible()
122
- {
123
- return array_key_exists('country', $this->previousParams)
124
- && ('DE' == strtoupper($this->getCountry())
125
- || 'AT' == strtoupper($this->getCountry()));
126
- }
127
-
128
- /**
129
- * checks if the bic field is visible
130
- *
131
- * @return bool - true if so, false otherwise
132
- */
133
- public function isBicFieldVisible()
134
- {
135
- return ('NL' == strtoupper($this->getCountry()));
136
- }
137
-
138
- /**
139
- * gets the previously entered country (if any)
140
- *
141
- * @return string - empty string if no country is given, otherwise the country
142
  */
143
- public function getCountry()
144
  {
145
- $country = '';
146
- if (array_key_exists('country', $this->previousParams)) {
147
- $country = $this->previousParams['country'];
 
148
  }
 
149
 
150
- return $country;
151
- }
152
-
153
- /**
154
- * gets the previously entered iban (if any)
155
- *
156
- * @return string - empty string if no iban is given, otherwise the iban
157
- */
158
- public function getIban()
159
- {
160
- $iban = '';
161
- if (array_key_exists('iban', $this->previousParams)) {
162
- $iban = $this->previousParams['iban'];
163
- }
164
-
165
- return $iban;
166
- }
167
-
168
- /**
169
- * gets the previously entered bic (if any)
170
- *
171
- * @return string - empty string if no bic is given, otherwise the bic
172
- */
173
- public function getBic()
174
- {
175
- $bic = '';
176
- if (array_key_exists('bic', $this->previousParams)) {
177
- $bic = $this->previousParams['bic'];
178
- }
179
-
180
- return $bic;
181
- }
182
-
183
- /**
184
- * gets the previously entered account (if any)
185
- *
186
- * @return string - empty string if no account is given, otherwise the account
187
- */
188
- public function getAccount()
189
- {
190
- $account = '';
191
- if (array_key_exists('account', $this->previousParams)) {
192
- $account = $this->previousParams['account'];
193
- }
194
-
195
- return $account;
196
- }
197
-
198
- /**
199
- * gets the previously entered bankcode (if any)
200
- *
201
- * @return string - empty string if no bankcode is given, otherwise the bankcode
202
- */
203
- public function getBankcode()
204
- {
205
- $bankcode = '';
206
- if (array_key_exists('bankcode', $this->previousParams)) {
207
- $bankcode = $this->previousParams['bankcode'];
208
- }
209
-
210
- return $bankcode;
211
- }
212
-
213
- /**
214
- * gets the previously entered card holder (if any)
215
- * @param $aliasId - not used, but required by parent methods
216
- *
217
- * @return string - empty string if no card holder is given, otherwise the card holder
218
- */
219
- public function getCardholderName($aliasId = null)
220
- {
221
- $cardholder = '';
222
- if (array_key_exists('CN', $this->previousParams)) {
223
- $cardholder = $this->previousParams['CN'];
224
- }
225
-
226
- return $cardholder;
227
- }
228
-
229
- public function getRegisterDirectDebitPaymentUrl()
230
- {
231
- return Mage::getModel('ops/config')->getRegisterDirectDebitPaymentUrl();
232
  }
233
  }
10
  class Netresearch_OPS_Block_Form_DirectDebit extends Netresearch_OPS_Block_Form
11
  {
12
 
 
 
13
  /**
14
  * Backend Payment Template
15
  */
32
  }
33
 
34
  /**
35
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  */
37
+ public function getSelectedCountryId()
38
  {
39
+ $countryId = $this->getQuote()->getPayment()->getAdditionalInformation('country_id');
40
+ if (Mage::app()->getStore()->isAdmin()) {
41
+ $data = $this->getQuote()->getPayment()->getData('ops_directDebit_data');
42
+ $countryId = $data && array_key_exists('country_id', $data) ? $data['country_id'] : '';
43
  }
44
+ return $countryId;
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
  }
app/code/community/Netresearch/OPS/Block/Form/DirectEbanking.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * DirectEbanking.php
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
28
+ */
29
+ ?>
30
+ <?php
31
+
32
+ class Netresearch_OPS_Block_Form_DirectEbanking extends Netresearch_OPS_Block_Form
33
+ {
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ protected function _construct()
38
+ {
39
+ parent::_construct();
40
+ $this->setTemplate('ops/form/directEbanking.phtml');
41
+ }
42
+ }
app/code/community/Netresearch/OPS/Block/Form/Flex.php CHANGED
@@ -47,9 +47,8 @@ class Netresearch_OPS_Block_Form_Flex extends Netresearch_OPS_Block_Form
47
  */
48
  public function getFlexMethods()
49
  {
50
-
51
  $methods = $this->getMethod()->getConfigData('methods');
52
- if(!is_array($methods)){
53
  $methods = unserialize($methods);
54
  }
55
 
47
  */
48
  public function getFlexMethods()
49
  {
 
50
  $methods = $this->getMethod()->getConfigData('methods');
51
+ if (!is_array($methods)) {
52
  $methods = unserialize($methods);
53
  }
54
 
app/code/community/Netresearch/OPS/Block/Form/Ideal.php CHANGED
@@ -8,7 +8,7 @@
8
 
9
 
10
  class Netresearch_OPS_Block_Form_Ideal
11
- extends Mage_Payment_Block_Form
12
  {
13
 
14
  /**
@@ -30,4 +30,4 @@ class Netresearch_OPS_Block_Form_Ideal
30
  {
31
  return Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
32
  }
33
- }
8
 
9
 
10
  class Netresearch_OPS_Block_Form_Ideal
11
+ extends Netresearch_OPS_Block_Form
12
  {
13
 
14
  /**
30
  {
31
  return Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
32
  }
33
+ }
app/code/community/Netresearch/OPS/Block/Form/Kwixo/ApresReception.php CHANGED
@@ -21,6 +21,7 @@ class Netresearch_OPS_Block_Form_Kwixo_ApresReception extends Netresearch_OPS_Bl
21
  protected function _construct()
22
  {
23
  parent::_construct();
 
24
  $this->setTemplate(self::FRONTEND_TEMPLATE);
25
  }
26
  }
21
  protected function _construct()
22
  {
23
  parent::_construct();
24
+ /** @noinspection PhpUndefinedMethodInspection */
25
  $this->setTemplate(self::FRONTEND_TEMPLATE);
26
  }
27
  }
app/code/community/Netresearch/OPS/Block/Form/Kwixo/Comptant.php CHANGED
@@ -22,6 +22,7 @@ class Netresearch_OPS_Block_Form_Kwixo_Comptant extends Netresearch_OPS_Block_Fo
22
  protected function _construct()
23
  {
24
  parent::_construct();
 
25
  $this->setTemplate(self::FRONTEND_TEMPLATE);
26
  }
27
 
22
  protected function _construct()
23
  {
24
  parent::_construct();
25
+ /** @noinspection PhpUndefinedMethodInspection */
26
  $this->setTemplate(self::FRONTEND_TEMPLATE);
27
  }
28
 
app/code/community/Netresearch/OPS/Block/Form/Kwixo/Credit.php CHANGED
@@ -22,6 +22,7 @@ class Netresearch_OPS_Block_Form_Kwixo_Credit extends Netresearch_OPS_Block_Form
22
  protected function _construct()
23
  {
24
  parent::_construct();
 
25
  $this->setTemplate(self::FRONTEND_TEMPLATE);
26
  }
27
  }
22
  protected function _construct()
23
  {
24
  parent::_construct();
25
+ /** @noinspection PhpUndefinedMethodInspection */
26
  $this->setTemplate(self::FRONTEND_TEMPLATE);
27
  }
28
  }
app/code/community/Netresearch/OPS/Block/Form/OpenInvoice.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * Netresearch_OPS_Block_Form_OpenInvoice
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Paul Siedler <paul.siedler@netresearch.de>
28
+ */
29
+ class Netresearch_OPS_Block_Form_OpenInvoice extends Netresearch_OPS_Block_Form
30
+ {
31
+ protected function _construct()
32
+ {
33
+ parent::_construct();
34
+ $this->setTemplate('ops/form/openInvoice.phtml');
35
+ }
36
+
37
+ /**
38
+ * @return string
39
+ * @see Netresearch_OPS_Model_Payment_OpenInvoice_Abstract::getInvoiceTermsTitle
40
+ */
41
+ public function getInvoiceTermsTitle()
42
+ {
43
+ return $this->getMethod()->getInvoiceTermsTitle();
44
+ }
45
+
46
+ /**
47
+ * @return string
48
+ * @see Netresearch_OPS_Model_Payment_OpenInvoice_Abstract::getInvoiceTermsUrl
49
+ */
50
+ public function getInvoiceTermsUrl()
51
+ {
52
+ return $this->getMethod()->getInvoiceTermsUrl();
53
+ }
54
+
55
+ /**
56
+ * @return bool
57
+ * @see Netresearch_OPS_Model_Payment_OpenInvoice_Abstract::showInvoiceTermsLink
58
+ */
59
+ public function showInvoiceTermsLink()
60
+ {
61
+ return $this->getMethod()->showInvoiceTermsLink();
62
+ }
63
+ }
app/code/community/Netresearch/OPS/Block/Form/PayPerMail.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * PayPerMail.php
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Paul Siedler <paul.siedler@netresearch.de>
28
+ */
29
+ ?>
30
+ <?php
31
+
32
+ class Netresearch_OPS_Block_Form_PayPerMail extends Netresearch_OPS_Block_Form
33
+ {
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ protected function _construct()
38
+ {
39
+ parent::_construct();
40
+ $this->setTemplate('ops/form/payPerMail.phtml');
41
+ }
42
+
43
+ }
app/code/community/Netresearch/OPS/Block/Form/RecurringCc.php CHANGED
@@ -27,7 +27,8 @@
27
  * @author Paul Siedler <paul.siedler@netresearch.de>
28
  */
29
 
30
- class Netresearch_OPS_Block_Form_RecurringCc extends Netresearch_OPS_Block_Form_Cc {
 
31
 
32
  public function getCcBrands()
33
  {
27
  * @author Paul Siedler <paul.siedler@netresearch.de>
28
  */
29
 
30
+ class Netresearch_OPS_Block_Form_RecurringCc extends Netresearch_OPS_Block_Form_Cc
31
+ {
32
 
33
  public function getCcBrands()
34
  {
app/code/community/Netresearch/OPS/Block/Info/Alias.php CHANGED
@@ -25,6 +25,7 @@ class Netresearch_OPS_Block_Info_Alias extends Netresearch_OPS_Block_Info_Redire
25
  protected function _construct()
26
  {
27
  parent::_construct();
 
28
  $this->setTemplate('ops/info/cc.phtml');
29
  }
30
  }
25
  protected function _construct()
26
  {
27
  parent::_construct();
28
+ /** @noinspection PhpUndefinedMethodInspection */
29
  $this->setTemplate('ops/info/cc.phtml');
30
  }
31
  }
app/code/community/Netresearch/OPS/Block/Info/Bancontact.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Netresearch_OPS
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * OPS payment information block
29
+ */
30
+ class Netresearch_OPS_Block_Info_Bancontact extends Mage_Payment_Block_Info
31
+ {
32
+ /**
33
+ * Init ops payment information block
34
+ *
35
+ */
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('ops/info/bancontact.phtml');
40
+ }
41
+
42
+
43
+ public function getDeviceParameter()
44
+ {
45
+ return $this->getInfo()->getAdditionalInformation('DEVICE');
46
+ }
47
+
48
+
49
+ public function getMobileModeParameter()
50
+ {
51
+ return $this->getInfo()->getAdditionalInformation('MOBILEMODE');
52
+ }
53
+
54
+ }
app/code/community/Netresearch/OPS/Block/Info/Cc.php CHANGED
@@ -36,6 +36,7 @@ class Netresearch_OPS_Block_Info_Cc extends Netresearch_OPS_Block_Info_Redirect
36
  protected function _construct()
37
  {
38
  parent::_construct();
 
39
  $this->setTemplate('ops/info/cc.phtml');
40
  }
41
  }
36
  protected function _construct()
37
  {
38
  parent::_construct();
39
+ /** @noinspection PhpUndefinedMethodInspection */
40
  $this->setTemplate('ops/info/cc.phtml');
41
  }
42
  }
app/code/community/Netresearch/OPS/Block/Info/Flex.php CHANGED
@@ -37,6 +37,7 @@ class Netresearch_OPS_Block_Info_Flex extends Mage_Payment_Block_Info
37
  protected function _construct()
38
  {
39
  parent::_construct();
 
40
  $this->setTemplate('ops/info/flex.phtml');
41
  }
42
 
@@ -46,6 +47,7 @@ class Netresearch_OPS_Block_Info_Flex extends Mage_Payment_Block_Info
46
  */
47
  public function getFlexTitle()
48
  {
 
49
  return $this->getMethod()->getInfoInstance()->getAdditionalInformation(
50
  Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE
51
  );
37
  protected function _construct()
38
  {
39
  parent::_construct();
40
+ /** @noinspection PhpUndefinedMethodInspection */
41
  $this->setTemplate('ops/info/flex.phtml');
42
  }
43
 
47
  */
48
  public function getFlexTitle()
49
  {
50
+ /** @noinspection PhpUndefinedMethodInspection */
51
  return $this->getMethod()->getInfoInstance()->getAdditionalInformation(
52
  Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE
53
  );
app/code/community/Netresearch/OPS/Block/Info/OpsId.php CHANGED
@@ -36,6 +36,7 @@ class Netresearch_OPS_Block_Info_OpsId extends Mage_Payment_Block_Info
36
  protected function _construct()
37
  {
38
  parent::_construct();
 
39
  $this->setTemplate('ops/info/opsId.phtml');
40
  }
41
  }
36
  protected function _construct()
37
  {
38
  parent::_construct();
39
+ /** @noinspection PhpUndefinedMethodInspection */
40
  $this->setTemplate('ops/info/opsId.phtml');
41
  }
42
  }
app/code/community/Netresearch/OPS/Block/Info/PayPerMail.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * PayPerMail.php
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
28
+ */
29
+ ?>
30
+ <?php
31
+
32
+ class Netresearch_OPS_Block_Info_PayPerMail extends Mage_Payment_Block_Info
33
+ {
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ protected function _construct()
38
+ {
39
+ parent::_construct();
40
+ /** @noinspection PhpUndefinedMethodInspection */
41
+ $this->setTemplate('ops/info/payPerMail.phtml');
42
+ }
43
+
44
+ }
app/code/community/Netresearch/OPS/Block/Info/RecurringCc.php CHANGED
@@ -27,6 +27,9 @@
27
  * @author Paul Siedler <paul.siedler@netresearch.de>
28
  */
29
 
30
- class Netresearch_OPS_Block_Info_RecurringCc extends Netresearch_OPS_Block_Info_Cc {
 
 
 
31
 
32
  }
27
  * @author Paul Siedler <paul.siedler@netresearch.de>
28
  */
29
 
30
+ class Netresearch_OPS_Block_Info_RecurringCc extends Netresearch_OPS_Block_Info_Cc
31
+ {
32
+
33
+
34
 
35
  }
app/code/community/Netresearch/OPS/Block/Info/Redirect.php CHANGED
@@ -36,6 +36,7 @@ class Netresearch_OPS_Block_Info_Redirect extends Mage_Payment_Block_Info
36
  protected function _construct()
37
  {
38
  parent::_construct();
 
39
  $this->setTemplate('ops/info/redirect.phtml');
40
  }
41
  }
36
  protected function _construct()
37
  {
38
  parent::_construct();
39
+ /** @noinspection PhpUndefinedMethodInspection */
40
  $this->setTemplate('ops/info/redirect.phtml');
41
  }
42
  }
app/code/community/Netresearch/OPS/Block/Placeform.php CHANGED
@@ -31,11 +31,10 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
31
  protected $formFields;
32
  protected $question;
33
 
34
- public function __construct()
35
- {
36
-
37
- }
38
 
 
 
 
39
  public function getConfig()
40
  {
41
  return Mage::getModel('ops/config');
@@ -58,10 +57,13 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
58
  */
59
  protected function _getApi()
60
  {
 
61
  $order = Mage::getModel('sales/order')->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
62
- if ($order && !is_null($order->getId())) {
63
- return $order->getPayment()->getMethodInstance();
64
  }
 
 
65
  }
66
 
67
  /**
@@ -102,7 +104,8 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
102
  */
103
  public function getFormData()
104
  {
105
- if (is_null($this->formFields) && $this->_getOrder() && !is_null($this->_getOrder()->getId())) {
 
106
  $this->formFields = $this->_getApi()->getFormFields($this->_getOrder(), $this->getRequest()->getParams());
107
  }
108
  return $this->formFields;
@@ -121,7 +124,9 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
121
  $question = $this->getQuestion();
122
 
123
  if ($this->getRequest()->isPost() || empty($question)) {
124
- $formAction = $this->getConfig()->getFrontendGatewayPath();
 
 
125
  } else {
126
  $formAction = Mage::getUrl(
127
  '*/*/*', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
@@ -131,33 +136,52 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
131
  return $formAction;
132
  }
133
 
 
 
 
134
  public function hasMissingParams()
135
  {
136
- if (is_null($this->_getOrder())) {
137
  return null;
138
  }
139
- if (is_null($this->hasMissingParams)) {
140
- $this->hasMissingParams = $this->_getApi()->hasFormMissingParams($this->_getOrder(), $this->getRequest()->getParams(), $this->getFormData());
 
 
 
 
 
141
  }
142
  return $this->hasMissingParams;
143
  }
144
 
 
 
 
145
  public function getQuestion()
146
  {
147
- if (is_null($this->question) && $this->_getOrder() && !is_null($this->_getOrder()->getId())) {
148
- $this->question = $this->_getApi()->getQuestion($this->_getOrder(), $this->getRequest()->getParams());
149
  }
150
  return $this->question;
151
  }
152
 
 
 
 
153
  public function getQuestionedFormFields()
154
  {
155
  if (is_null($this->missingFormFields) && $this->_getOrder() && !is_null($this->_getOrder()->getId())) {
156
- $this->missingFormFields = $this->_getApi()->getQuestionedFormFields($this->_getOrder(), $this->getRequest()->getParams());
 
157
  }
 
158
  return $this->missingFormFields;
159
  }
160
 
 
 
 
161
  public function isIframeTarget()
162
  {
163
  return $this->getConfig()->getConfigData('template') === Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME;
31
  protected $formFields;
32
  protected $question;
33
 
 
 
 
 
34
 
35
+ /**
36
+ * @return Netresearch_OPS_Model_Config
37
+ */
38
  public function getConfig()
39
  {
40
  return Mage::getModel('ops/config');
57
  */
58
  protected function _getApi()
59
  {
60
+ $methodInstance = null;
61
  $order = Mage::getModel('sales/order')->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
62
+ if ($order && null != $order->getId()) {
63
+ $methodInstance = $order->getPayment()->getMethodInstance();
64
  }
65
+
66
+ return $methodInstance;
67
  }
68
 
69
  /**
104
  */
105
  public function getFormData()
106
  {
107
+ if (null == $this->formFields && $this->_getOrder()
108
+ && null != $this->_getOrder()->getId()) {
109
  $this->formFields = $this->_getApi()->getFormFields($this->_getOrder(), $this->getRequest()->getParams());
110
  }
111
  return $this->formFields;
124
  $question = $this->getQuestion();
125
 
126
  if ($this->getRequest()->isPost() || empty($question)) {
127
+ /** @var Netresearch_OPS_Model_Payment_Abstract $method */
128
+ $method = $this->_getOrder()->getPayment()->getMethodInstance();
129
+ $formAction = $method->getFrontendGateWay();
130
  } else {
131
  $formAction = Mage::getUrl(
132
  '*/*/*', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
136
  return $formAction;
137
  }
138
 
139
+ /**
140
+ * @return bool|null
141
+ */
142
  public function hasMissingParams()
143
  {
144
+ if (null === $this->_getOrder()) {
145
  return null;
146
  }
147
+ if (null === $this->hasMissingParams) {
148
+ $this->hasMissingParams = $this->_getApi()
149
+ ->hasFormMissingParams(
150
+ $this->_getOrder(),
151
+ $this->getRequest()->getParams(),
152
+ $this->getFormData()
153
+ );
154
  }
155
  return $this->hasMissingParams;
156
  }
157
 
158
+ /**
159
+ * @return string
160
+ */
161
  public function getQuestion()
162
  {
163
+ if (null === $this->question && $this->_getOrder() && null != $this->_getOrder()->getId()) {
164
+ $this->question = $this->_getApi()->getQuestion();
165
  }
166
  return $this->question;
167
  }
168
 
169
+ /**
170
+ * @return array
171
+ */
172
  public function getQuestionedFormFields()
173
  {
174
  if (is_null($this->missingFormFields) && $this->_getOrder() && !is_null($this->_getOrder()->getId())) {
175
+ $this->missingFormFields = $this->_getApi()
176
+ ->getQuestionedFormFields($this->_getOrder());
177
  }
178
+
179
  return $this->missingFormFields;
180
  }
181
 
182
+ /**
183
+ * @return bool
184
+ */
185
  public function isIframeTarget()
186
  {
187
  return $this->getConfig()->getConfigData('template') === Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME;
app/code/community/Netresearch/OPS/Block/Placeform3dsecure.php CHANGED
@@ -34,7 +34,7 @@ class Netresearch_OPS_Block_Placeform3dsecure extends Netresearch_OPS_Block_Plac
34
  */
35
  public function getFormData()
36
  {
37
- if (!is_null($this->_getOrder())) {
38
  return base64_decode($this->_getOrder()->getPayment()->getAdditionalInformation('HTML_ANSWER'));
39
  }
40
  return null;
34
  */
35
  public function getFormData()
36
  {
37
+ if (null != $this->_getOrder()) {
38
  return base64_decode($this->_getOrder()->getPayment()->getAdditionalInformation('HTML_ANSWER'));
39
  }
40
  return null;
app/code/community/Netresearch/OPS/Block/RetryPayment.php CHANGED
@@ -20,16 +20,16 @@
20
  */
21
 
22
  /**
23
- * RetryPayment.php
24
  *
25
  * @category payment
26
  * @package Netresearch_OPS
27
  * @author Paul Siedler <paul.siedler@netresearch.de>
28
- */
29
-
30
- class Netresearch_OPS_Block_RetryPayment extends Netresearch_OPS_Block_Placeform {
31
 
32
- protected $order = null;
33
 
34
  protected function _getApi()
35
  {
@@ -38,12 +38,66 @@ class Netresearch_OPS_Block_RetryPayment extends Netresearch_OPS_Block_Placeform
38
 
39
  protected function _getOrder()
40
  {
41
- if(is_null($this->order)){
42
- $opsOrderId = $this->getRequest()->getParam('orderID');
43
- $this->order = Mage::helper('ops/order')->getOrder($opsOrderId);
44
  }
45
- return $this->order;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
 
 
 
 
48
 
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  */
21
 
22
  /**
23
+ * Netresearch_OPS_Block_RetryPayment
24
  *
25
  * @category payment
26
  * @package Netresearch_OPS
27
  * @author Paul Siedler <paul.siedler@netresearch.de>
28
+ */
29
+ class Netresearch_OPS_Block_RetryPayment extends Netresearch_OPS_Block_Placeform
30
+ {
31
 
32
+ protected $_order = null;
33
 
34
  protected function _getApi()
35
  {
38
 
39
  protected function _getOrder()
40
  {
41
+ if (null === $this->_order) {
42
+ $opsOrderId = $this->getOrderId();
43
+ $this->_order = Mage::helper('ops/order')->getOrder($opsOrderId);
44
  }
45
+
46
+ return $this->_order;
47
+ }
48
+
49
+ /**
50
+ * Getting placeform url
51
+ *
52
+ * @return string
53
+ */
54
+ public function getFormAction()
55
+ {
56
+ $formAction = Mage::getUrl(
57
+ '*/*/updatePaymentAndPlaceForm',
58
+ array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
59
+ );
60
+
61
+ return $formAction;
62
+ }
63
+
64
+ /**
65
+ * Getting cancel url
66
+ *
67
+ * @return string
68
+ */
69
+ public function getCancelUrl()
70
+ {
71
+ $formAction = Mage::getUrl(
72
+ '*/*/cancel',
73
+ array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
74
+ );
75
+
76
+ return $formAction;
77
  }
78
 
79
+ public function getOrderId()
80
+ {
81
+ return $this->getRequest()->getParam('orderID');
82
+ }
83
 
84
+ /**
85
+ * Returns the orders billing address
86
+ *
87
+ * @return Mage_Sales_Model_Order_Address
88
+ */
89
+ public function getBillingAddress()
90
+ {
91
+ return $this->_getOrder()->getBillingAddress();
92
+ }
93
+
94
+ /**
95
+ * Returns the orders shipping address or false in case of a virtual order
96
+ *
97
+ * @return Mage_Sales_Model_Order_Address|false
98
+ */
99
+ public function getShippingAddress()
100
+ {
101
+ return $this->_getOrder()->getShippingAddress();
102
+ }
103
+ }
app/code/community/Netresearch/OPS/Block/RetryPayment/Methods.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * Netresearch_OPS_Block_RetryPayment_Methods
24
+ *
25
+ * @category OPS
26
+ * @package Netresearch_OPS
27
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
28
+ */
29
+ class Netresearch_OPS_Block_RetryPayment_Methods extends Mage_Checkout_Block_Onepage_Payment_Methods
30
+ {
31
+ protected $quote = null;
32
+
33
+ /**
34
+ * Get Order ID from Url
35
+ *
36
+ * @return null
37
+ * @throws Exception
38
+ */
39
+ public function getQuote()
40
+ {
41
+ if (null === $this->quote) {
42
+ $opsOrderId = $this->getRequest()->getParam('orderID');
43
+ $order = Mage::helper('ops/order')-> getOrder($opsOrderId);
44
+ $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
45
+
46
+ if ($quote->getId()) {
47
+ $quote->setIsActive(1)
48
+ ->save();
49
+ Mage::getSingleton('checkout/session')
50
+ ->replaceQuote($quote);
51
+ }
52
+
53
+ $this->quote = $quote;
54
+ }
55
+
56
+ return $this->quote;
57
+ }
58
+
59
+ /**
60
+ * Retrieve available payment methods - filtered by OPS methods
61
+ *
62
+ * @return array
63
+ */
64
+ public function getMethods()
65
+ {
66
+ $methods = $this->getData('methods');
67
+ if ($methods === null) {
68
+ $methods = parent::getMethods();
69
+ foreach ($methods as $key => $method) {
70
+ if (!$method instanceof Netresearch_OPS_Model_Payment_Abstract) {
71
+ $this->_assignMethod($method);
72
+ unset($methods[$key]);
73
+ }
74
+ }
75
+ $this->setData('methods', $methods);
76
+ }
77
+
78
+ return $methods;
79
+ }
80
+ }
app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Brand.php CHANGED
@@ -34,14 +34,18 @@ class Netresearch_OPS_Block_System_Config_Form_Field_Brand
34
  {
35
  public function __construct()
36
  {
37
- $this->addColumn('brand', array(
 
38
  'label' => Mage::helper('ops')->__('Brand'),
39
  'style' => 'width:120px',
40
- ));
41
- $this->addColumn('value', array(
 
 
42
  'label' => Mage::helper('ops')->__('Title'),
43
  'style' => 'width:120px',
44
- ));
 
45
  $this->_addAfter = false;
46
  $this->_addButtonLabel = Mage::helper('ops')->__('Add Brand');
47
  parent::__construct();
34
  {
35
  public function __construct()
36
  {
37
+ $this->addColumn(
38
+ 'brand', array(
39
  'label' => Mage::helper('ops')->__('Brand'),
40
  'style' => 'width:120px',
41
+ )
42
+ );
43
+ $this->addColumn(
44
+ 'value', array(
45
  'label' => Mage::helper('ops')->__('Title'),
46
  'style' => 'width:120px',
47
+ )
48
+ );
49
  $this->_addAfter = false;
50
  $this->_addButtonLabel = Mage::helper('ops')->__('Add Brand');
51
  parent::__construct();
app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Image.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Netresearch OPS
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade this extension to
16
+ * newer versions in the future.
17
+ *
18
+ * @category Netresearch
19
+ * @package Netresearch_OPS
20
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ /**
25
+ * Netresearch
26
+ *
27
+ * @category Netresearch
28
+ * @package Netresearch_OPS
29
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
30
+ */
31
+ class Netresearch_OPS_Block_System_Config_Form_Field_Image
32
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Image
33
+ {
34
+
35
+ /**
36
+ * Return element html code
37
+ *
38
+ * @return string
39
+ */
40
+ public function getElementHtml()
41
+ {
42
+ $html = '';
43
+ $url = $this->_getUrl();
44
+
45
+ if (!empty($url)) {
46
+ $value = $this->getData('value');
47
+ $html = '<a href="' . $url . '"'
48
+ . ' onclick="imagePreview(\'' . $this->getHtmlId() . '_image\'); return false;">'
49
+ . '<img src="' . $url . '" id="' . $this->getHtmlId() . '_image" title="' . $value . '"'
50
+ . ' alt="' . $value . '" height="22" width="22" class="small-image-preview v-middle" />'
51
+ . '</a> ';
52
+ }
53
+ $this->setData('class', 'input-file');
54
+ $html .= Varien_Data_Form_Element_Abstract::getElementHtml();
55
+ $html .= $this->_getDeleteCheckbox();
56
+
57
+ return $html;
58
+ }
59
+
60
+ /**
61
+ * Get image preview url
62
+ *
63
+ * @return string
64
+ */
65
+ protected function _getUrl()
66
+ {
67
+ $url = $this->getData('value');
68
+ $config = $this->getData('field_config');
69
+
70
+ if (!empty($url)) {
71
+ /* @var $config Varien_Simplexml_Element */
72
+ if (!empty($config->base_url)) {
73
+ $el = $config->descend('base_url');
74
+ $urlType = empty($el['type']) ? 'link' : (string)$el['type'];
75
+ $url = Mage::getBaseUrl($urlType) . (string)$config->base_url . '/' . $url;
76
+ }
77
+ } else {
78
+ preg_match("/groups\[([a-zA-Z_]*)/", $this->getData('name'), $imageName);
79
+
80
+ if (isset($imageName[1])) {
81
+ $url = Mage::helper('ops/payment')->getPaymentDefaultLogo($imageName[1]);
82
+ }
83
+ }
84
+
85
+ return $url;
86
+ }
87
+ }
app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Method.php CHANGED
@@ -31,20 +31,26 @@ class Netresearch_OPS_Block_System_Config_Form_Field_Method extends Mage_Adminht
31
  {
32
  public function __construct()
33
  {
34
- $this->addColumn('title', array(
 
35
  'label' => Mage::helper('ops')->__('Title'),
36
  'style' => 'width:80px',
37
  'class' => 'required-entry'
38
- ));
39
- $this->addColumn('pm', array(
 
 
40
  'label' => 'PM',
41
  'style' => 'width:80px',
42
  'class' => 'required-entry'
43
- ));
44
- $this->addColumn('brand', array(
 
 
45
  'label' => 'BRAND',
46
  'style' => 'width:80px',
47
- ));
 
48
 
49
  $this->_addAfter = false;
50
  $this->_addButtonLabel = Mage::helper('ops')->__('Add Method');
31
  {
32
  public function __construct()
33
  {
34
+ $this->addColumn(
35
+ 'title', array(
36
  'label' => Mage::helper('ops')->__('Title'),
37
  'style' => 'width:80px',
38
  'class' => 'required-entry'
39
+ )
40
+ );
41
+ $this->addColumn(
42
+ 'pm', array(
43
  'label' => 'PM',
44
  'style' => 'width:80px',
45
  'class' => 'required-entry'
46
+ )
47
+ );
48
+ $this->addColumn(
49
+ 'brand', array(
50
  'label' => 'BRAND',
51
  'style' => 'width:80px',
52
+ )
53
+ );
54
 
55
  $this->_addAfter = false;
56
  $this->_addButtonLabel = Mage::helper('ops')->__('Add Method');
app/code/community/Netresearch/OPS/Block/System/Config/Mode.php CHANGED
@@ -1,31 +1,32 @@
1
- <?php
2
- /**
3
- * Mode.php
4
- * @author paul.siedler@netresearch.de
5
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
- */
8
-
9
- class Netresearch_OPS_Block_System_Config_Mode extends Mage_Adminhtml_Block_System_Config_Form_Field {
10
-
11
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
12
- {
13
- $html = parent::_getElementHtml($element);
14
-
15
- $javascript = "
16
- <script type=\"text/javascript\">
17
- element = $('".$element->getHtmlId()."');
18
- Event.observe(element, 'change', function(){
19
- if(element.selectedOptions[0].value != '".$element->getValue()."'){
20
- $('ops_mode_comment').style.display = 'block';
21
- } else {
22
- $('ops_mode_comment').style.display = 'none';
23
- }
24
- });
25
- </script>";
26
-
27
- return $html.$javascript;
28
- }
29
-
30
-
31
- }
 
1
+ <?php
2
+ /**
3
+ * Mode.php
4
+ * @author paul.siedler@netresearch.de
5
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
+ */
8
+
9
+ class Netresearch_OPS_Block_System_Config_Mode extends Mage_Adminhtml_Block_System_Config_Form_Field
10
+ {
11
+
12
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
13
+ {
14
+ $html = parent::_getElementHtml($element);
15
+
16
+ $javascript = "
17
+ <script type=\"text/javascript\">
18
+ element = $('".$element->getHtmlId()."');
19
+ Event.observe(element, 'change', function(){
20
+ if(element.selectedOptions[0].value != '".$element->getValue()."'){
21
+ $('ops_mode_comment').style.display = 'block';
22
+ } else {
23
+ $('ops_mode_comment').style.display = 'none';
24
+ }
25
+ });
26
+ </script>";
27
+
28
+ return $html.$javascript;
29
+ }
30
+
31
+
32
+ }
app/code/community/Netresearch/OPS/Block/System/Config/PaymentForm.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Netresearch OPS
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade this extension to
16
+ * newer versions in the future.
17
+ *
18
+ * @category Netresearch
19
+ * @package Netresearch_OPS
20
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ /**
25
+ * Netresearch
26
+ *
27
+ * @category Netresearch
28
+ * @package Netresearch_OPS
29
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
30
+ */
31
+ class Netresearch_Ops_Block_System_Config_PaymentForm
32
+ extends Mage_Adminhtml_Block_System_Config_Form
33
+ {
34
+
35
+ /**
36
+ * Add Payment Logo Image Renderer to renderer types
37
+ *
38
+ * @return array
39
+ */
40
+ protected function _getAdditionalElementTypes()
41
+ {
42
+ $elementTypes = parent::_getAdditionalElementTypes();
43
+ $elementTypes['paymentLogo'] = Mage::getConfig()->getBlockClassName('ops/system_config_form_field_image');
44
+
45
+ return $elementTypes;
46
+ }
47
+ }
app/code/community/Netresearch/OPS/Block/System/Config/Support.php CHANGED
@@ -20,9 +20,11 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
20
  public function render(Varien_Data_Form_Element_Abstract $fieldset)
21
  {
22
  $originalData = $fieldset->getOriginalData();
23
- $this->addData(array(
 
24
  'fieldset_label' => $fieldset->getLegend(),
25
- ));
 
26
  return $this->toHtml();
27
  }
28
 
@@ -58,7 +60,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
58
  public function getSupportMail()
59
  {
60
  $mail = $this->getConfig()->getConfigData('support_mail');
61
- if (0 < strpos($mail, '@')) {
62
  return $mail;
63
  }
64
  }
@@ -81,7 +83,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
81
  public function getDocLinkDe()
82
  {
83
  $link = $this->getConfig()->getConfigData('doc_link_de');
84
- if (0 < strpos($link, '://')) {
85
  return $link;
86
  }
87
  }
@@ -94,7 +96,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
94
  public function getDocLinkEn()
95
  {
96
  $link = $this->getConfig()->getConfigData('doc_link_en');
97
- if (0 < strpos($link, '://')) {
98
  return $link;
99
  }
100
  }
@@ -116,7 +118,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
116
  public function getFaqLinkDe()
117
  {
118
  $link = $this->getConfig()->getConfigData('faq_link_de');
119
- if (0 < strpos($link, '://')) {
120
  return $link;
121
  }
122
 
@@ -130,7 +132,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
130
  public function getFaqLinkEn()
131
  {
132
  $link = $this->getConfig()->getConfigData('faq_link_en');
133
- if (0 < strpos($link, '://')) {
134
  return $link;
135
  }
136
  }
20
  public function render(Varien_Data_Form_Element_Abstract $fieldset)
21
  {
22
  $originalData = $fieldset->getOriginalData();
23
+ $this->addData(
24
+ array(
25
  'fieldset_label' => $fieldset->getLegend(),
26
+ )
27
+ );
28
  return $this->toHtml();
29
  }
30
 
60
  public function getSupportMail()
61
  {
62
  $mail = $this->getConfig()->getConfigData('support_mail');
63
+ if (false !== strpos($mail, '@')) {
64
  return $mail;
65
  }
66
  }
83
  public function getDocLinkDe()
84
  {
85
  $link = $this->getConfig()->getConfigData('doc_link_de');
86
+ if (false !== strpos($link, '://')) {
87
  return $link;
88
  }
89
  }
96
  public function getDocLinkEn()
97
  {
98
  $link = $this->getConfig()->getConfigData('doc_link_en');
99
+ if (false !== strpos($link, '://')) {
100
  return $link;
101
  }
102
  }
118
  public function getFaqLinkDe()
119
  {
120
  $link = $this->getConfig()->getConfigData('faq_link_de');
121
+ if (false !== strpos($link, '://')) {
122
  return $link;
123
  }
124
 
132
  public function getFaqLinkEn()
133
  {
134
  $link = $this->getConfig()->getConfigData('faq_link_en');
135
+ if (false !== strpos($link, '://')) {
136
  return $link;
137
  }
138
  }
app/code/community/Netresearch/OPS/Controller/Abstract.php CHANGED
@@ -39,17 +39,20 @@ class Netresearch_OPS_Controller_Abstract extends Mage_Core_Controller_Front_Act
39
  /**
40
  * Return order instance loaded by increment id'
41
  *
 
 
42
  * @return Mage_Sales_Model_Order
43
  */
44
 
45
  protected function _getOrder($opsOrderId = null)
46
  {
47
  if (empty($this->_order)) {
48
- if (is_null($opsOrderId)) {
49
  $opsOrderId = $this->getRequest()->getParam('orderID');
50
  }
51
  $this->_order = Mage::helper('ops/order')->getOrder($opsOrderId);
52
  }
 
53
  return $this->_order;
54
  }
55
 
@@ -60,11 +63,12 @@ class Netresearch_OPS_Controller_Abstract extends Mage_Core_Controller_Front_Act
60
  */
61
  protected function _getApi()
62
  {
63
- if (!is_null($this->getRequest()->getParam('orderID'))):
64
- return $this->_getOrder()->getPayment()->getMethodInstance();
65
- else:
66
- return Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance();
67
- endif;
 
68
  }
69
 
70
  /**
@@ -95,12 +99,17 @@ class Netresearch_OPS_Controller_Abstract extends Mage_Core_Controller_Front_Act
95
  /**
96
  * Validation of incoming OPS data
97
  *
 
 
 
98
  * @return bool
99
  */
100
- protected function _validateOPSData()
101
  {
102
  $helper = Mage::helper('ops');
103
- $params = $this->getRequest()->getParams();
 
 
104
  if ($this->getSubscriptionHelper()->isSubscriptionFeedback($params)) {
105
  $profile = $this->getSubscriptionHelper()->getProfileForSubscription($params['orderID']);
106
  if (!$profile->getId()) {
39
  /**
40
  * Return order instance loaded by increment id'
41
  *
42
+ * @param $opsOrderId
43
+ *
44
  * @return Mage_Sales_Model_Order
45
  */
46
 
47
  protected function _getOrder($opsOrderId = null)
48
  {
49
  if (empty($this->_order)) {
50
+ if (null === $opsOrderId) {
51
  $opsOrderId = $this->getRequest()->getParam('orderID');
52
  }
53
  $this->_order = Mage::helper('ops/order')->getOrder($opsOrderId);
54
  }
55
+
56
  return $this->_order;
57
  }
58
 
63
  */
64
  protected function _getApi()
65
  {
66
+ $api = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance();
67
+ if (null != $this->getRequest()->getParam('orderID')) {
68
+ $api = $this->_getOrder()->getPayment()->getMethodInstance();
69
+ }
70
+
71
+ return $api;
72
  }
73
 
74
  /**
99
  /**
100
  * Validation of incoming OPS data
101
  *
102
+ * @param mixed[]|bool $paramOverwrite array of parameters with SHASIGN to validate instead of standard request
103
+ * parameters
104
+ *
105
  * @return bool
106
  */
107
+ protected function _validateOPSData($paramOverwrite = false)
108
  {
109
  $helper = Mage::helper('ops');
110
+
111
+ $params = $paramOverwrite ? : $this->getRequest()->getParams();
112
+
113
  if ($this->getSubscriptionHelper()->isSubscriptionFeedback($params)) {
114
  $profile = $this->getSubscriptionHelper()->getProfileForSubscription($params['orderID']);
115
  if (!$profile->getId()) {
app/code/community/Netresearch/OPS/Helper/Address.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS_Helper_Address
4
+ *
5
+ * @package
6
+ * @copyright 2016 Netresearch
7
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
8
+ * @license OSL 3.0
9
+ */
10
+ class Netresearch_OPS_Helper_Address extends Mage_Core_Helper_Abstract
11
+ {
12
+
13
+ const OPTION_A_ADDITION_1 = 'A_Addition_to_address_1';
14
+ const OPTION_A_STREET_NAME = 'A_Street_name_1';
15
+ const OPTION_A_HOUSE_NUMBER = 'A_House_number_1';
16
+ const OPTION_A_ADDITION_2 = 'A_Addition_to_address_2';
17
+ const OPTION_B_ADDITION_1 = 'B_Addition_to_address_1';
18
+ const OPTION_B_STREET_NAME = 'B_Street_name';
19
+ const OPTION_B_HOUSE_NUMBER = 'B_House_number';
20
+ const OPTION_B_ADDITION_2 = 'B_Addition_to_address_2';
21
+
22
+
23
+ /**
24
+ * split street into street name, number and additional street information
25
+ *
26
+ * @param string $street
27
+ *
28
+ * @return array
29
+ */
30
+ public function splitStreet($street)
31
+ {
32
+ $result = array(
33
+ 'street_name' => $street,
34
+ 'street_number' => '',
35
+ 'supplement' => ''
36
+ );
37
+
38
+ if (preg_match($this->getStreetSplitter(), $street, $matches)) {
39
+
40
+ // Pattern A
41
+ if (isset($matches[self::OPTION_A_STREET_NAME]) && !empty($matches[self::OPTION_A_STREET_NAME])) {
42
+
43
+ $result['street_name'] = trim($matches[self::OPTION_A_STREET_NAME]);
44
+
45
+ if (isset($matches[self::OPTION_A_HOUSE_NUMBER]) && !empty($matches[self::OPTION_A_HOUSE_NUMBER])) {
46
+ $result['street_number'] = trim($matches[self::OPTION_A_HOUSE_NUMBER]);
47
+ }
48
+
49
+ if (isset($matches[self::OPTION_A_ADDITION_1]) && isset($matches[self::OPTION_A_ADDITION_2])) {
50
+ $result['supplement'] = trim($matches[self::OPTION_A_ADDITION_1] . ' '
51
+ . $matches[self::OPTION_A_ADDITION_2]
52
+ );
53
+ }
54
+
55
+ return $result ;
56
+
57
+ // Pattern B
58
+ } elseif (isset($matches[self::OPTION_B_STREET_NAME]) && !empty($matches[self::OPTION_B_STREET_NAME])) {
59
+
60
+ $result['street_name'] = trim($matches[self::OPTION_B_STREET_NAME]);
61
+
62
+ if (isset($matches[self::OPTION_B_HOUSE_NUMBER]) && !empty($matches[self::OPTION_B_HOUSE_NUMBER])) {
63
+ $result['street_number'] = trim($matches[self::OPTION_B_HOUSE_NUMBER]);
64
+ }
65
+
66
+ if (isset($matches[self::OPTION_B_ADDITION_1]) && isset($matches[self::OPTION_B_ADDITION_2])) {
67
+ $result['supplement'] = trim($matches[self::OPTION_B_ADDITION_1] . ' '
68
+ . $matches[self::OPTION_B_ADDITION_2]
69
+ );
70
+ }
71
+
72
+
73
+ return $result;
74
+ }
75
+ }
76
+
77
+ return $result;
78
+ }
79
+
80
+ /**
81
+ * Regex to analyze addresses and split them into the groups Street Name, House Number and Additional Information
82
+ * Pattern A is addition number street addition
83
+ * Pattern B is addition street number addition
84
+ *
85
+ * @return string
86
+ */
87
+ protected function getStreetSplitter()
88
+ {
89
+ return "/\\A\\s*
90
+ (?:
91
+ #########################################################################
92
+ # Option A: [<Addition to address 1>] <House number> <Street name> #
93
+ # [<Addition to address 2>] #
94
+ #########################################################################
95
+ (?:
96
+ (?P<A_Addition_to_address_1>.*?)
97
+ ,\\s*
98
+ )?
99
+ # Addition to address 1
100
+ (?:No\\.\\s*)?
101
+ (?P<A_House_number_1>
102
+ \\pN+[a-zA-Z]?
103
+ (?:\\s*[-\\/\\pP]\\s*\\pN+[a-zA-Z]?)*
104
+ )
105
+ # House number
106
+ \\s*,?\\s*
107
+ (?P<A_Street_name_1>
108
+ (?:[a-zA-Z]\\s*|\\pN\\pL{2,}\\s\\pL)
109
+ \\S[^,#]*?
110
+ (?<!\\s)
111
+ )
112
+ # Street name
113
+ \\s*
114
+ (?:
115
+ (?:
116
+ [,\\/]|
117
+ (?=\\#)
118
+ )
119
+ \\s*
120
+ (?!\\s*No\\.)
121
+ (?P<A_Addition_to_address_2>
122
+ (?!\\s)
123
+ .*?
124
+ )
125
+ )?
126
+ # Addition to address 2
127
+ |
128
+ #########################################################################
129
+ # Option B: [<Addition to address 1>] <Street name> <House number> #
130
+ # [<Addition to address 2>] #
131
+ #########################################################################
132
+ (?:
133
+ (?P<B_Addition_to_address_1>.*?)
134
+ ,\\s*
135
+ (?=.*[,\\/])
136
+ )?
137
+ # Addition to address 1
138
+ (?!\\s*No\\.)
139
+ (?P<B_Street_name>
140
+ \\S\\s*\\S
141
+ (?:
142
+ [^,#]
143
+ (?!\\b\\pN+\\s)
144
+ )*?
145
+ (?<!\\s)
146
+ )
147
+ # Street name
148
+ \\s*[\\/,]?\\s*
149
+ (?:\\sNo\\.)?
150
+ \\s+
151
+ (?P<B_House_number>
152
+ \\pN+\\s*-?[a-zA-Z]?
153
+ (?:
154
+ \\s*[-\\/\\pP]?\\s*\\pN+
155
+ (?:\\s*[\\-a-zA-Z])?
156
+ )*|
157
+ [IVXLCDM]+
158
+ (?!.*\\b\\pN+\\b)
159
+ )
160
+ (?<!\\s)
161
+ # House number
162
+ \\s*
163
+ (?:
164
+ (?:
165
+ [,\\/]|
166
+ (?=\\#)|
167
+ \\s
168
+ )
169
+ \\s*
170
+ (?!\\s*No\\.)
171
+ \\s*
172
+ (?P<B_Addition_to_address_2>
173
+ (?!\\s)
174
+ .*?
175
+ )
176
+ )?
177
+ # Addition to address 2
178
+ )
179
+ \\s*\\Z/x";
180
+ }
181
+ }
app/code/community/Netresearch/OPS/Helper/Alias.php CHANGED
@@ -64,73 +64,43 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
64
  return $payment;
65
  }
66
 
67
- /**
68
- * get alias or generate a new one
69
- *
70
- * alias has length 16 and consists of quote creation date, a separator,
71
- * and the quote id to make sure we have the full quote id we shorten
72
- * the creation date accordingly
73
- *
74
- * @param Mage_Sales_Model_Quote $quote
75
- *
76
- * @return string
77
- */
78
- public function getAlias($quote, $forceNew = false)
79
- {
80
-
81
- $alias = $quote->getPayment()->getAdditionalInformation('alias');
82
- if (0 == strlen($alias) || $forceNew) {
83
- /* turn createdAt into format MMDDHHii */
84
- $createdAt = time();
85
- $quoteId = $quote->getId();
86
- /* shorten createdAt, if we would exceed maximum length */
87
- $maxAliasLength = 16;
88
- $separator = '99';
89
- $maxCreatedAtLength
90
- = $maxAliasLength - strlen($quoteId) - strlen($separator);
91
- $alias = substr($createdAt, 0, $maxCreatedAtLength) . $separator
92
- . $quoteId;
93
- }
94
-
95
- if ($this->isAdminSession() && !strpos($alias,'BE')) {
96
- $alias = $alias.'BE';
97
- }
98
- return $alias;
99
- }
100
-
101
  /**
102
  * saves the alias if customer is logged in (and want to create an alias)
103
  *
104
- * @param $aliasData
105
- * @param Mage_Sales_Model_Quote $quote
106
  *
107
  * @return Netresearch_OPS_Model_Alias | null
108
  */
109
- public function saveAlias($aliasData)
110
  {
111
  $quote = null;
112
  $aliasModel = null;
113
- Mage::helper('ops')->log('aliasData ' . Zend_Json::encode(Mage::helper('ops/data')->clearMsg($aliasData)));
114
- if (array_key_exists('Alias_OrderId', $aliasData) && is_numeric($aliasData['Alias_OrderId'])) {
115
- $quote = Mage::getModel('sales/quote')->load($aliasData['Alias_OrderId']);
116
  }
117
 
118
  if ($quote instanceof Mage_Sales_Model_Quote
119
  && $quote->getPayment()
120
  && Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()
121
  != Mage_Checkout_Model_Type_Onepage::METHOD_GUEST
122
- && (array_key_exists('Alias_StorePermanently',$aliasData) && 'Y' == $aliasData['Alias_StorePermanently'])
123
  ) {
124
 
125
  // alias does not exist -> create a new one if requested
126
- if (!is_null($quote) && $quote->getPayment()) {
127
  // create new alias
128
- $aliasModel = $this->saveNewAlias($quote, $aliasData);
129
  $quote->getPayment()->setAdditionalInformation(
130
  'opsAliasId', $aliasModel->getId()
131
  );
132
  $quote->getPayment()->save();
133
  }
 
 
 
 
 
134
  }
135
 
136
  return $aliasModel;
@@ -164,7 +134,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
164
  }
165
  }
166
 
167
- protected function saveNewAlias(Mage_Sales_Model_Quote $quote, $aliasData)
168
  {
169
  $customerId = $quote->getCustomer()->getId();
170
  $billingAddressHash = $this->generateAddressHash(
@@ -174,23 +144,67 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
174
  $quote->getShippingAddress()
175
  );
176
 
177
- $aliasModel = Mage::getModel('ops/alias');
178
- $aliasModel->setCustomerId($customerId);
179
- $aliasModel->setAlias($aliasData['Alias_AliasId']);
180
- $aliasModel->setExpirationDate($aliasData['Card_ExpiryDate']);
181
- $aliasModel->setBillingAddressHash($billingAddressHash);
182
- $aliasModel->setShippingAddressHash($shippingAddressHash);
183
- $aliasModel->setBrand($aliasData['Card_Brand']);
184
- $aliasModel->setPaymentMethod($quote->getPayment()->getMethod());
185
- $aliasModel->setPseudoAccountOrCCNo($aliasData['Card_CardNumber']);
186
- $aliasModel->setState(Netresearch_OPS_Model_Alias_State::PENDING);
187
- $aliasModel->setStoreId($quote->getStoreId());
188
- if (array_key_exists('Card_CardHolderName', $aliasData)) {
189
- $aliasModel->setCardHolder($aliasData['Card_CardHolderName']);
 
 
190
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  Mage::helper('ops')->log(
192
  'saving alias' . Zend_Json::encode($aliasModel->getData())
193
  );
 
 
194
  $aliasModel->save();
195
 
196
  return $aliasModel;
@@ -199,14 +213,11 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
199
  /**
200
  * generates hash from address data
201
  *
202
- * @param Mage_Sales_Model_Quote_Address $address the address data to hash
203
  *
204
  * @returns string hash of address
205
  */
206
- public function generateAddressHash(
207
- Mage_Customer_Model_Address_Abstract $address
208
- )
209
- {
210
  /** @var Netresearch_OPS_Helper_Payment $opsHelper */
211
  $opsHelper = Mage::helper('ops/payment');
212
  $addressString = $address->getFirstname();
@@ -241,7 +252,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
241
  $billingAddressHash = null;
242
  $shippingAddressHash = null;
243
  $storeId = null;
244
- if (!is_null($quote)) {
245
  $billingAddressHash = $this->generateAddressHash(
246
  $quote->getBillingAddress()
247
  );
@@ -253,7 +264,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
253
  return Mage::getModel('ops/alias')
254
  ->getAliasesForCustomer(
255
  $customerId, $billingAddressHash, $shippingAddressHash, $storeId
256
- );
257
  }
258
 
259
  /**
@@ -263,6 +274,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
263
  * @param string $alias
264
  * @param Mage_Sales_Model_Quote_Address $billingAddress
265
  * @param Mage_Sales_Model_Quote_Address $shippingAddress
 
266
  *
267
  * @return boolean
268
  */
@@ -271,11 +283,11 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
271
  )
272
  {
273
  $aliasCollection = $this->getAliasesForAddresses(
274
- $customerId, $billingAddress, $shippingAddress, $storeId
275
- )
276
  ->addFieldToFilter('alias', $alias)
277
  ->setPageSize(1);
278
- return (1 == $aliasCollection->count());
279
  }
280
 
281
  /**
@@ -284,6 +296,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
284
  * @param int $customerId Id of customer
285
  * @param Mage_Sales_Model_Quote_Address $billingAddress billing address
286
  * @param Mage_Sales_Model_Quote_Address $shippingAddress shipping address
 
287
  *
288
  * @return Netresearch_OPS_Model_Mysql4_Alias_Collection
289
  */
@@ -334,7 +347,12 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
334
  * @param boolean $userIsRegistering - is registering method in checkout
335
  * @param boolean $paymentSave - is it necessary to save the payment afterwards
336
  */
337
- public function setAliasToPayment(Mage_Payment_Model_Info $payment, array $aliasData, $userIsRegistering = false, $paymentSave = false)
 
 
 
 
 
338
  {
339
  if (array_key_exists('alias_aliasid', $aliasData) && 0 < strlen(trim($aliasData['alias_aliasid']))) {
340
  $payment->setAdditionalInformation('alias', trim($aliasData['alias_aliasid']));
@@ -351,7 +369,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
351
  }
352
 
353
  $payment->setDataChanges(true);
354
- if($paymentSave === true){
355
  $payment->save();
356
  }
357
  } else {
@@ -373,7 +391,8 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
373
  ->addFieldToFilter('store_id', array(array('eq' => $quote->getStoreId()), array('null' => true)))
374
  ->getFirstItem();
375
  // and if so update this alias with alias data from alias gateway
376
- if (is_numeric($oldAlias->getId()) && is_null($oldAlias->getCardHolder()) && array_key_exists('Card_CardHolderName', $aliasData)
 
377
  ) {
378
  $oldAlias->setCardHolder($aliasData['Card_CardHolderName']);
379
  $oldAlias->save();
@@ -382,27 +401,31 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
382
 
383
  /**
384
  * set the last pending alias to active and remove other aliases for customer based on address
385
- *
 
386
  * @param Mage_Sales_Model_Quote $quote
 
 
387
  */
388
  public function setAliasActive(
389
  Mage_Sales_Model_Quote $quote,
390
  Mage_Sales_Model_Order $order = null,
391
  $saveSalesObjects = false
392
- ) {
393
- if (is_null($quote->getPayment()->getAdditionalInformation('userIsRegistering'))
 
394
  || false == $quote->getPayment()->getAdditionalInformation('userIsRegistering')
395
  ) {
396
  $aliasesToDelete = Mage::helper('ops/alias')->getAliasesForAddresses(
397
- $quote->getCustomer()->getId(), $quote->getBillingAddress(), $quote->getShippingAddress()
398
- )
399
  ->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE);
400
  $lastPendingAlias = Mage::helper('ops/alias')->getAliasesForAddresses(
401
- $quote->getCustomer()->getId(),
402
- $quote->getBillingAddress(),
403
- $quote->getShippingAddress(),
404
- $quote->getStoreId()
405
- )
406
  ->addFieldToFilter('alias', $quote->getPayment()->getAdditionalInformation('alias'))
407
  ->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::PENDING)
408
  ->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC)
64
  return $payment;
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * saves the alias if customer is logged in (and want to create an alias)
69
  *
70
+ * @param $params
 
71
  *
72
  * @return Netresearch_OPS_Model_Alias | null
73
  */
74
+ public function saveAlias($params)
75
  {
76
  $quote = null;
77
  $aliasModel = null;
78
+ Mage::helper('ops')->log('aliasData ' . Zend_Json::encode(Mage::helper('ops/data')->clearMsg($params)));
79
+ if (array_key_exists('Alias_OrderId', $params) && is_numeric($params['Alias_OrderId'])) {
80
+ $quote = Mage::getModel('sales/quote')->load($params['Alias_OrderId']);
81
  }
82
 
83
  if ($quote instanceof Mage_Sales_Model_Quote
84
  && $quote->getPayment()
85
  && Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()
86
  != Mage_Checkout_Model_Type_Onepage::METHOD_GUEST
87
+ && (array_key_exists('Alias_StorePermanently', $params) && 'Y' == $params['Alias_StorePermanently'])
88
  ) {
89
 
90
  // alias does not exist -> create a new one if requested
91
+ if (null != $quote && $quote->getPayment()) {
92
  // create new alias
93
+ $aliasModel = $this->saveNewAliasFromQuote($quote, $params);
94
  $quote->getPayment()->setAdditionalInformation(
95
  'opsAliasId', $aliasModel->getId()
96
  );
97
  $quote->getPayment()->save();
98
  }
99
+ } elseif (array_key_exists('orderid', $params)) {
100
+ /** @var Mage_Sales_Model_Order $order */
101
+ $order = Mage::helper('ops/order')->getOrder($params['orderid']);
102
+ $aliasModel = $this->saveNewAliasFromOrder($order, $params);
103
+ $order->getPayment()->setAdditionalInformation('opsAliasId', $aliasModel->getId());
104
  }
105
 
106
  return $aliasModel;
134
  }
135
  }
136
 
137
+ protected function saveNewAliasFromQuote(Mage_Sales_Model_Quote $quote, $params)
138
  {
139
  $customerId = $quote->getCustomer()->getId();
140
  $billingAddressHash = $this->generateAddressHash(
144
  $quote->getShippingAddress()
145
  );
146
 
147
+
148
+ $aliasData = array();
149
+ $aliasData['customer_id'] = $customerId;
150
+ $aliasData['alias'] = $params['Alias_AliasId'];
151
+ $aliasData['expiration_date'] = $params['Card_ExpiryDate'];
152
+ $aliasData['billing_address_hash'] = $billingAddressHash;
153
+ $aliasData['shipping_address_hash'] = $shippingAddressHash;
154
+ $aliasData['brand'] = $params['Card_Brand'];
155
+ $aliasData['payment_method'] = $quote->getPayment()->getMethod();
156
+ $aliasData['pseudo_account_or_cc_no'] = $params['Card_CardNumber'];
157
+ $aliasData['state'] = Netresearch_OPS_Model_Alias_State::PENDING;
158
+ $aliasData['store_id'] = $quote->getStoreId();
159
+
160
+ if (array_key_exists('Card_CardHolderName', $params)) {
161
+ $aliasData['card_holder'] = $params['Card_CardHolderName'];
162
  }
163
+
164
+ $aliasModel = $this->persistAlias($aliasData);
165
+
166
+ return $aliasModel;
167
+ }
168
+
169
+ public function saveNewAliasFromOrder(Mage_Sales_Model_Order $order, $params)
170
+ {
171
+ $customerId = $order->getCustomerId();
172
+ $billingAddressHash = $this->generateAddressHash(
173
+ $order->getBillingAddress()
174
+ );
175
+ $shippingAddressHash = $this->generateAddressHash(
176
+ $order->getShippingAddress()
177
+ );
178
+
179
+ $aliasData = array();
180
+ $aliasData['customer_id'] = $customerId;
181
+ $aliasData['alias'] = $params['alias'];
182
+ $aliasData['expiration_date'] = $params['ed'];
183
+ $aliasData['billing_address_hash'] = $billingAddressHash;
184
+ $aliasData['shipping_address_hash'] = $shippingAddressHash;
185
+ $aliasData['brand'] = $params['brand'];
186
+ $aliasData['payment_method'] = $order->getPayment()->getMethod();
187
+ $aliasData['pseudo_account_or_cc_no'] = $params['cardno'];
188
+ $aliasData['state'] = Netresearch_OPS_Model_Alias_State::ACTIVE;
189
+ $aliasData['store_id'] = $order->getStoreId();
190
+ $aliasData['card_holder'] = $params['cn'];
191
+
192
+ $aliasModel = $this->persistAlias($aliasData);
193
+
194
+ return $aliasModel;
195
+ }
196
+
197
+
198
+ public function persistAlias(array $aliasParams)
199
+ {
200
+ /** @var Netresearch_OPS_Model_Alias $aliasModel */
201
+ $aliasModel = Mage::getModel('ops/alias')->load($aliasParams['alias'], 'alias');
202
+
203
  Mage::helper('ops')->log(
204
  'saving alias' . Zend_Json::encode($aliasModel->getData())
205
  );
206
+
207
+ $aliasModel->addData($aliasParams);
208
  $aliasModel->save();
209
 
210
  return $aliasModel;
213
  /**
214
  * generates hash from address data
215
  *
216
+ * @param Mage_Customer_Model_Address_Abstract $address the address data to hash
217
  *
218
  * @returns string hash of address
219
  */
220
+ public function generateAddressHash(Mage_Customer_Model_Address_Abstract $address) {
 
 
 
221
  /** @var Netresearch_OPS_Helper_Payment $opsHelper */
222
  $opsHelper = Mage::helper('ops/payment');
223
  $addressString = $address->getFirstname();
252
  $billingAddressHash = null;
253
  $shippingAddressHash = null;
254
  $storeId = null;
255
+ if (null !=($quote)) {
256
  $billingAddressHash = $this->generateAddressHash(
257
  $quote->getBillingAddress()
258
  );
264
  return Mage::getModel('ops/alias')
265
  ->getAliasesForCustomer(
266
  $customerId, $billingAddressHash, $shippingAddressHash, $storeId
267
+ );
268
  }
269
 
270
  /**
274
  * @param string $alias
275
  * @param Mage_Sales_Model_Quote_Address $billingAddress
276
  * @param Mage_Sales_Model_Quote_Address $shippingAddress
277
+ * @param int $storeId
278
  *
279
  * @return boolean
280
  */
283
  )
284
  {
285
  $aliasCollection = $this->getAliasesForAddresses(
286
+ $customerId, $billingAddress, $shippingAddress, $storeId
287
+ )
288
  ->addFieldToFilter('alias', $alias)
289
  ->setPageSize(1);
290
+ return (1 == $aliasCollection->getSize());
291
  }
292
 
293
  /**
296
  * @param int $customerId Id of customer
297
  * @param Mage_Sales_Model_Quote_Address $billingAddress billing address
298
  * @param Mage_Sales_Model_Quote_Address $shippingAddress shipping address
299
+ * @param int $storeId
300
  *
301
  * @return Netresearch_OPS_Model_Mysql4_Alias_Collection
302
  */
347
  * @param boolean $userIsRegistering - is registering method in checkout
348
  * @param boolean $paymentSave - is it necessary to save the payment afterwards
349
  */
350
+ public function setAliasToPayment(
351
+ Mage_Payment_Model_Info $payment,
352
+ array $aliasData,
353
+ $userIsRegistering = false,
354
+ $paymentSave = false
355
+ )
356
  {
357
  if (array_key_exists('alias_aliasid', $aliasData) && 0 < strlen(trim($aliasData['alias_aliasid']))) {
358
  $payment->setAdditionalInformation('alias', trim($aliasData['alias_aliasid']));
369
  }
370
 
371
  $payment->setDataChanges(true);
372
+ if ($paymentSave === true) {
373
  $payment->save();
374
  }
375
  } else {
391
  ->addFieldToFilter('store_id', array(array('eq' => $quote->getStoreId()), array('null' => true)))
392
  ->getFirstItem();
393
  // and if so update this alias with alias data from alias gateway
394
+ if (is_numeric($oldAlias->getId()) && null === $oldAlias->getCardHolder()
395
+ && array_key_exists('Card_CardHolderName', $aliasData)
396
  ) {
397
  $oldAlias->setCardHolder($aliasData['Card_CardHolderName']);
398
  $oldAlias->save();
401
 
402
  /**
403
  * set the last pending alias to active and remove other aliases for customer based on address
404
+ *
405
+ *
406
  * @param Mage_Sales_Model_Quote $quote
407
+ * @param Mage_Sales_Model_Order|null $order
408
+ * @param bool $saveSalesObjects
409
  */
410
  public function setAliasActive(
411
  Mage_Sales_Model_Quote $quote,
412
  Mage_Sales_Model_Order $order = null,
413
  $saveSalesObjects = false
414
+ )
415
+ {
416
+ if (null === $quote->getPayment()->getAdditionalInformation('userIsRegistering')
417
  || false == $quote->getPayment()->getAdditionalInformation('userIsRegistering')
418
  ) {
419
  $aliasesToDelete = Mage::helper('ops/alias')->getAliasesForAddresses(
420
+ $quote->getCustomer()->getId(), $quote->getBillingAddress(), $quote->getShippingAddress()
421
+ )
422
  ->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE);
423
  $lastPendingAlias = Mage::helper('ops/alias')->getAliasesForAddresses(
424
+ $quote->getCustomer()->getId(),
425
+ $quote->getBillingAddress(),
426
+ $quote->getShippingAddress(),
427
+ $quote->getStoreId()
428
+ )
429
  ->addFieldToFilter('alias', $quote->getPayment()->getAdditionalInformation('alias'))
430
  ->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::PENDING)
431
  ->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC)
app/code/community/Netresearch/OPS/Helper/Api.php CHANGED
@@ -11,7 +11,7 @@
11
  class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
12
  {
13
 
14
- private $configModel = null;
15
 
16
 
17
  /**
@@ -38,7 +38,7 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
38
  }
39
 
40
  // in case none of the cases above match then the status is not known
41
- if (is_null($route)) {
42
  Mage::throwException('invalid status provided');
43
  }
44
 
@@ -51,9 +51,9 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
51
  *
52
  * @return Netresearch_OPS_Model_Config
53
  */
54
- private function getConfigModel()
55
  {
56
- if (is_null($this->configModel)) {
57
  $this->configModel = Mage::getModel('ops/config');
58
  }
59
  return $this->configModel;
@@ -66,9 +66,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
66
  *
67
  * @return bool - true if the status is known as accept status, false otherwise
68
  */
69
- private function isAcceptStatus($status)
70
  {
71
- return in_array($status, array(
 
72
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT
73
  )
74
  );
@@ -81,9 +82,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
81
  *
82
  * @return bool - true if the status is known as canceled status, false otherwise
83
  */
84
- private function isCancelStatus($status)
85
  {
86
- return in_array($status, array(
 
87
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_CANCEL
88
  )
89
  );
@@ -96,9 +98,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
96
  *
97
  * @return bool - true if the status is known as declined status, false otherwise
98
  */
99
- private function isDeclineStatus($status)
100
  {
101
- return in_array($status, array(
 
102
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE
103
  )
104
  );
@@ -111,9 +114,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
111
  *
112
  * @return bool - true if the status is known as exception status, false otherwise
113
  */
114
- private function isExceptionStatus($status)
115
  {
116
- return in_array($status, array(
 
117
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION
118
  )
119
  );
11
  class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
12
  {
13
 
14
+ protected $configModel = null;
15
 
16
 
17
  /**
38
  }
39
 
40
  // in case none of the cases above match then the status is not known
41
+ if (null === $route) {
42
  Mage::throwException('invalid status provided');
43
  }
44
 
51
  *
52
  * @return Netresearch_OPS_Model_Config
53
  */
54
+ protected function getConfigModel()
55
  {
56
+ if (null === $this->configModel) {
57
  $this->configModel = Mage::getModel('ops/config');
58
  }
59
  return $this->configModel;
66
  *
67
  * @return bool - true if the status is known as accept status, false otherwise
68
  */
69
+ protected function isAcceptStatus($status)
70
  {
71
+ return in_array(
72
+ $status, array(
73
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT
74
  )
75
  );
82
  *
83
  * @return bool - true if the status is known as canceled status, false otherwise
84
  */
85
+ protected function isCancelStatus($status)
86
  {
87
+ return in_array(
88
+ $status, array(
89
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_CANCEL
90
  )
91
  );
98
  *
99
  * @return bool - true if the status is known as declined status, false otherwise
100
  */
101
+ protected function isDeclineStatus($status)
102
  {
103
+ return in_array(
104
+ $status, array(
105
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE
106
  )
107
  );
114
  *
115
  * @return bool - true if the status is known as exception status, false otherwise
116
  */
117
+ protected function isExceptionStatus($status)
118
  {
119
+ return in_array(
120
+ $status, array(
121
  Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION
122
  )
123
  );
app/code/community/Netresearch/OPS/Helper/Creditcard.php CHANGED
@@ -33,10 +33,10 @@ class Netresearch_OPS_Helper_Creditcard extends Netresearch_OPS_Helper_Payment_D
33
  }
34
 
35
 
36
-
37
  /**
38
- * @param $quote
39
- * @param $requestParams
 
40
  */
41
  public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
42
  {
@@ -46,13 +46,15 @@ class Netresearch_OPS_Helper_Creditcard extends Netresearch_OPS_Helper_Payment_D
46
  protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
47
  {
48
  $alias = $quote->getPayment()->getAdditionalInformation('alias');
49
- if (is_null($alias) && $this->getDataHelper()->isAdminSession()) {
50
  $alias = $this->getAliasHelper()->getAlias($quote);
51
  }
 
52
  $params = array (
53
- 'ALIAS' => $alias
 
54
  );
55
- if($this->getConfig()->getCreditDebitSplit($quote->getStoreId())){
56
  $params['CREDITDEBIT'] = 'C';
57
  }
58
  if (is_numeric($quote->getPayment()->getAdditionalInformation('cvc'))) {
33
  }
34
 
35
 
 
36
  /**
37
+ * @param Mage_Sales_Model_Quote $quote
38
+ * @param array $requestParams
39
+ * @return $this
40
  */
41
  public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
42
  {
46
  protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
47
  {
48
  $alias = $quote->getPayment()->getAdditionalInformation('alias');
49
+ if (null === $alias && $this->getDataHelper()->isAdminSession()) {
50
  $alias = $this->getAliasHelper()->getAlias($quote);
51
  }
52
+ $saveAlias = Mage::getModel('ops/alias')->load($alias, 'alias')->getId();
53
  $params = array (
54
+ 'ALIAS' => $alias,
55
+ 'ALIASPERSISTEDAFTERUSE' => $saveAlias ? 'Y' : 'N',
56
  );
57
+ if ($this->getConfig()->getCreditDebitSplit($quote->getStoreId())) {
58
  $params['CREDITDEBIT'] = 'C';
59
  }
60
  if (is_numeric($quote->getPayment()->getAdditionalInformation('cvc'))) {
app/code/community/Netresearch/OPS/Helper/Data.php CHANGED
@@ -29,7 +29,7 @@ class Netresearch_OPS_Helper_Data extends Mage_Core_Helper_Abstract
29
  public function getModuleVersionString()
30
  {
31
  $version = Mage::getConfig()->getNode('modules/Netresearch_OPS/version');
32
- $plainversion = preg_replace('/\.|[+-].+$/','', $version);
33
  return 'CC1X' . $plainversion;
34
  }
35
 
@@ -75,10 +75,10 @@ class Netresearch_OPS_Helper_Data extends Mage_Core_Helper_Abstract
75
  }
76
  }
77
  if (is_string($message)) {
78
- $message = preg_replace('/"CVC":".*"(,)/i','',$message);
79
- $message = preg_replace('/"CVC":".*"/i','',$message);
80
- $message = preg_replace('/"CVC".*"[A-Z]*";/','',$message);
81
- $message = preg_replace('/"CVC":".*"(})/i','}',$message);
82
  }
83
  return $message;
84
  }
@@ -87,7 +87,6 @@ class Netresearch_OPS_Helper_Data extends Mage_Core_Helper_Abstract
87
  {
88
  Mage::app()->getResponse()->setRedirect($url);
89
  Mage::app()->getResponse()->sendResponse();
90
- exit();
91
  }
92
 
93
  /**
29
  public function getModuleVersionString()
30
  {
31
  $version = Mage::getConfig()->getNode('modules/Netresearch_OPS/version');
32
+ $plainversion = preg_replace('/\.|[+-].+$/', '', $version);
33
  return 'CC1X' . $plainversion;
34
  }
35
 
75
  }
76
  }
77
  if (is_string($message)) {
78
+ $message = preg_replace('/"CVC":".*"(,)/i', '', $message);
79
+ $message = preg_replace('/"CVC":".*"/i', '', $message);
80
+ $message = preg_replace('/"CVC".*"[A-Z]*";/', '', $message);
81
+ $message = preg_replace('/"CVC":".*"(})/i', '}', $message);
82
  }
83
  return $message;
84
  }
87
  {
88
  Mage::app()->getResponse()->setRedirect($url);
89
  Mage::app()->getResponse()->sendResponse();
 
90
  }
91
 
92
  /**
app/code/community/Netresearch/OPS/Helper/Debitcard.php CHANGED
@@ -13,7 +13,7 @@ class Netresearch_OPS_Helper_Debitcard extends Netresearch_OPS_Helper_Creditcard
13
  protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
14
  {
15
  $params = parent::getPaymentSpecificParams($quote);
16
- if($this->getConfig()->getCreditDebitSplit($quote->getStoreId())){
17
  $params['CREDITDEBIT'] = 'D';
18
  }
19
  return $params;
13
  protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
14
  {
15
  $params = parent::getPaymentSpecificParams($quote);
16
+ if ($this->getConfig()->getCreditDebitSplit($quote->getStoreId())) {
17
  $params['CREDITDEBIT'] = 'D';
18
  }
19
  return $params;
app/code/community/Netresearch/OPS/Helper/DirectDebit.php CHANGED
@@ -19,10 +19,6 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
19
 
20
  protected $customerHelper = null;
21
 
22
- protected $validator = null;
23
-
24
-
25
-
26
 
27
  /**
28
  * sets the data helper
@@ -31,13 +27,13 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
31
  */
32
  public function setDataHelper(Netresearch_OPS_Helper_Data $dataHelper)
33
  {
34
- $this->dataHelper = $dataHelper;
35
  }
36
 
37
  /**
38
  * gets the data helper
39
  *
40
- * @return Mage_Core_Helper_Abstract
41
  */
42
  public function getDataHelper()
43
  {
@@ -120,165 +116,6 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
120
  return $this->customerHelper;
121
  }
122
 
123
-
124
- /**
125
- * sets the validator
126
- *
127
- * @param Netresearch_OPS_Model_Validator_Payment_DirectDebit $validator
128
- */
129
- public function setValidator(
130
- Netresearch_OPS_Model_Validator_Payment_DirectDebit $validator
131
- )
132
- {
133
- $this->validator = $validator;
134
- }
135
-
136
- /**
137
- * gets the validator
138
- *
139
- * @return Netresearch_OPS_Model_Validator_Payment_DirectDebit
140
- */
141
- public function getValidator()
142
- {
143
- if (null === $this->validator) {
144
- $this->validator = Mage::getModel(
145
- 'ops/validator_payment_directDebit'
146
- );
147
- }
148
-
149
- return $this->validator;
150
- }
151
-
152
- /**
153
- * gets the country from a given array
154
- *
155
- * @param array $params
156
- *
157
- * @return string - the country in uppercase, empty string if no country
158
- * was provided
159
- */
160
- public function getCountry(array $params)
161
- {
162
- $country = '';
163
- if (array_key_exists('country', $params)) {
164
- $country = strtoupper($params['country']);
165
- }
166
-
167
- return $country;
168
- }
169
-
170
- /**
171
- * checks whether the given data has an iban field or not
172
- *
173
- * @param array $accountData
174
- *
175
- * @return bool - true if iban field is present and filled, false otherwise
176
- */
177
- public function hasIban(array $accountData)
178
- {
179
- return array_key_exists('iban', $accountData)
180
- && 0 < strlen(trim($accountData['iban']));
181
- }
182
-
183
- /**
184
- * sets the direct debit data to given payment
185
- *
186
- * @param Mage_Sales_Model_Quote_Payment $payment - the payment which
187
- * should contain the
188
- * additional data
189
- * @param array $params -
190
- *
191
- * @return Mage_Sales_Model_Quote_Payment
192
- */
193
- public function setDirectDebitDataToPayment(
194
- Mage_Sales_Model_Quote_Payment $payment, array $params
195
- )
196
- {
197
- $payment->setAdditionalInformation(
198
- 'PM', 'Direct Debits ' . $this->getCountry($params)
199
- );
200
- $this->setAccountHolder($payment, $params);
201
- $this->setAccountData($payment, $params);
202
-
203
- return $payment;
204
- }
205
-
206
- /**
207
- * sets the account holder to given payment
208
- *
209
- * @param Mage_Sales_Model_Quote_Payment $payment
210
- * @param array $params
211
- */
212
- protected function setAccountHolder(
213
- Mage_Sales_Model_Quote_Payment $payment, array $params
214
- )
215
- {
216
- if (array_key_exists('CN', $params)
217
- && 0 < strlen(trim($params['CN']))
218
- ) {
219
- $payment->setAdditionalInformation('CN', trim($params['CN']));
220
- }
221
- }
222
-
223
- /**
224
- * set the account data to given payment
225
- *
226
- * @param Mage_Sales_Model_Quote_Payment $payment
227
- * @param array $params
228
- */
229
- protected function setAccountData(
230
- Mage_Sales_Model_Quote_Payment $payment, array $params
231
- )
232
- {
233
- $country = $this->getCountry($params);
234
-
235
- if ('DE' == $country || 'AT' == $country) {
236
- if ($this->hasIban($params) && 'DE' == $country) {
237
- $payment->setAdditionalInformation(
238
- 'CARDNO', trim($params['iban'])
239
- );
240
- } else {
241
- $payment->setAdditionalInformation(
242
- 'CARDNO',
243
- trim($params['account']) . 'BLZ' . trim($params['bankcode'])
244
- );
245
- }
246
-
247
-
248
- }
249
- if ('NL' == $country) {
250
- if ($this->hasIban($params)) {
251
- $payment->setAdditionalInformation(
252
- 'CARDNO', trim($params['iban'])
253
- );
254
- $payment->setAdditionalInformation('BIC', trim($params['bic']));
255
- } else {
256
- $payment->setAdditionalInformation(
257
- 'CARDNO', str_pad($params['account'], '0', STR_PAD_LEFT)
258
- );
259
- }
260
- }
261
- }
262
-
263
- /**
264
- * validates direct debit payment from the backend
265
- *
266
- * @param $requestParams - the params passed on order submission
267
- * @throws Mage_Core_Exception - if the data is not valid
268
- * @return boolean - true if data were valid
269
- */
270
- protected function validateAdminDirectDebit($requestParams)
271
- {
272
- $validator = $this->getValidator();
273
- if (false === $validator->isValid($requestParams)) {
274
- Mage::getModel('adminhtml/session')->setData('ops_direct_debit_params', $requestParams);
275
- Mage::throwException(
276
- implode('<br />', $validator->getMessages())
277
- );
278
- }
279
- return true;
280
- }
281
-
282
  /**
283
  * @param Mage_Sales_Model_Quote $quote
284
  * @param array $requestParams
@@ -286,30 +123,26 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
286
  */
287
  public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
288
  {
289
- if ($this->getDataHelper()->isAdminSession() && is_array($requestParams)) {
290
- $this->validateAdminDirectDebit($requestParams);
291
- $this->setDirectDebitDataToPayment($quote->getPayment(), $requestParams);
292
- $quote->getPayment()->save();
293
- }
294
-
295
  return $this;
296
  }
297
 
 
 
 
 
 
298
  protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
299
  {
300
- $cardHolderName = $quote->getPayment()->getAdditionalInformation('CN');
301
- $params = array(
302
- 'CARDNO' => $quote->getPayment()->getAdditionalInformation('CARDNO'),
303
- 'CN' => utf8_decode($cardHolderName),
304
- // Always the same on direct debit
305
- 'ED' => '9999',
306
- 'PM' => $quote->getPayment()->getAdditionalInformation('PM'),
 
 
307
  );
308
- if (0 < strlen(trim($quote->getPayment()->getAdditionalInformation('BIC')))) {
309
- $bic = $quote->getPayment()->getAdditionalInformation('BIC');
310
- $params['BIC'] = $bic;
311
- }
312
- $params['BRAND'] = $params['PM'];
313
 
314
  return $params;
315
  }
19
 
20
  protected $customerHelper = null;
21
 
 
 
 
 
22
 
23
  /**
24
  * sets the data helper
27
  */
28
  public function setDataHelper(Netresearch_OPS_Helper_Data $dataHelper)
29
  {
30
+ $this->dataHelper = Mage::helper('ops/data');
31
  }
32
 
33
  /**
34
  * gets the data helper
35
  *
36
+ * @return Netresearch_OPS_Helper_Data
37
  */
38
  public function getDataHelper()
39
  {
116
  return $this->customerHelper;
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  /**
120
  * @param Mage_Sales_Model_Quote $quote
121
  * @param array $requestParams
123
  */
124
  public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
125
  {
 
 
 
 
 
 
126
  return $this;
127
  }
128
 
129
+
130
+ /**
131
+ * @param Mage_Sales_Model_Quote $quote
132
+ * @return array
133
+ */
134
  protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
135
  {
136
+ $alias = $quote->getPayment()->getAdditionalInformation('alias');
137
+ $saveAlias = Mage::getModel('ops/alias')->load($alias, 'alias')->getId();
138
+
139
+ $paymentMethod = 'Direct Debits ' . $quote->getPayment()->getAdditionalInformation('country_id');
140
+ $params = array (
141
+ 'ALIAS' => $alias,
142
+ 'ALIASPERSISTEDAFTERUSE' => $saveAlias ? 'Y' : 'N',
143
+ 'PM' => $paymentMethod,
144
+ 'BRAND' => $paymentMethod
145
  );
 
 
 
 
 
146
 
147
  return $params;
148
  }
app/code/community/Netresearch/OPS/Helper/Directlink.php CHANGED
@@ -26,7 +26,6 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
26
  {
27
  $payment = $order->getPayment();
28
  $payment->setTransactionId($transactionID."/".$subPayID);
29
- // $transaction = $payment->addTransaction($typename, null, false, $comment);
30
  $payment->setParentTransactionId($transactionID);
31
  $payment->setIsTransactionClosed($closed);
32
  $payment->setTransactionAdditionalInfo($arrInformation, null);
@@ -105,8 +104,6 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
105
  {
106
  Mage::getModel('ops/response_handler')->processResponse($params, $order->getPayment()->getMethodInstance());
107
  $order->getPayment()->save();
108
-
109
- return;
110
  }
111
 
112
  /**
@@ -132,19 +129,19 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
132
  $transactionCollection->addAttributeToFilter('parent_txn_id', $payId);
133
  }
134
 
135
- if ($transactionCollection->count()>1 || $transactionCollection->count() == 0) {
136
  $errorMsq = $helper->__(
137
  "Warning, transaction count is %s instead of 1 for the Payid '%s', order '%s' and Operation '%s'.",
138
- $transactionCollection->count(),
139
  $payId,
140
  $order->getId(),
141
  $operation
142
  );
143
  $helper->log($errorMsq);
144
- throw new Mage_Core_Exception($errorMsq);
145
  }
146
 
147
- if ($transactionCollection->count() == 1) {
148
  $transaction = $transactionCollection->getLastItem();
149
  $transaction->setOrderPaymentObject($order->getPayment());
150
  return $transaction;
@@ -168,7 +165,7 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
168
  ->addAttributeToFilter('is_closed', 0)
169
  ->addAttributeToFilter('order_id', $order->getId());
170
 
171
- return (0 < $transactionCollection->count());
172
  }
173
 
174
  /**
@@ -181,7 +178,9 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
181
  {
182
  // Avoid quotes added somewhere unknown
183
  if (preg_match("/^[\"']([0-9-\..,-]+)[\"']$/i", $amount, $matches)) {
184
- Mage::helper('ops')->log("Warning in formatAmount: Found quotes around amount in '" . var_export($amount, true) . "'");
 
 
185
  $amount = $matches[1];
186
  }
187
 
@@ -197,7 +196,11 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
197
  *
198
  * @return boolean
199
  */
200
- public function isValidOpsRequest($openTransaction, Mage_Sales_Model_Order $order, $opsRequestParams)
 
 
 
 
201
  {
202
  if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_DELETE_TRANSACTION_TYPE) {
203
  return false;
@@ -210,13 +213,10 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
210
 
211
  /* find expected amount */
212
  $expectedAmount = null;
213
- if (false === is_null($openTransaction)) {
214
  $transactionInfo = unserialize($openTransaction->getAdditionalInformation('arrInfo'));
215
  if (array_key_exists('amount', $transactionInfo)) {
216
- if (
217
- is_null($expectedAmount)
218
- || $transactionInfo['amount'] == $requestedAmount
219
- ) {
220
  $expectedAmount = $this->formatAmount($transactionInfo['amount']);
221
  }
222
  }
@@ -225,24 +225,19 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
225
  if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE
226
  || $this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_VOID_TRANSACTION_TYPE
227
  ) {
228
- if (is_null($requestedAmount)
229
- || 0 == count($openTransaction)
230
- || $requestedAmount != $expectedAmount
231
- ) {
232
  return false;
233
  }
234
  }
235
 
236
  if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
237
- if (is_null($requestedAmount)) {
238
  Mage::helper('ops')->log('Please configure PayEngine to submit amount');
239
  return false;
240
  }
241
  $grandTotal = $this->formatAmount(Mage::helper('ops/payment')->getBaseGrandTotalFromSalesObject($order));
242
  if ($grandTotal != $requestedAmount) {
243
- if (is_null($openTransaction)
244
- || $expectedAmount != $requestedAmount
245
- ) {
246
  return false;
247
  }
248
  }
@@ -257,12 +252,11 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
257
  /**
258
  * allow null as valid state for creating the order with status 'pending'
259
  */
260
- if (!is_null($response['STATUS'])
261
- && Mage::helper('ops/payment')->isPaymentFailed($response['STATUS'])
262
- ) {
263
  Mage::getSingleton('checkout/type_onepage')->getCheckout()->setGotoSection('payment');
264
- throw new Mage_Core_Exception(Mage::helper('ops/data')->__('PayEngine Payment failed'));
265
  }
 
266
  return $response;
267
  }
268
  }
26
  {
27
  $payment = $order->getPayment();
28
  $payment->setTransactionId($transactionID."/".$subPayID);
 
29
  $payment->setParentTransactionId($transactionID);
30
  $payment->setIsTransactionClosed($closed);
31
  $payment->setTransactionAdditionalInfo($arrInformation, null);
104
  {
105
  Mage::getModel('ops/response_handler')->processResponse($params, $order->getPayment()->getMethodInstance());
106
  $order->getPayment()->save();
 
 
107
  }
108
 
109
  /**
129
  $transactionCollection->addAttributeToFilter('parent_txn_id', $payId);
130
  }
131
 
132
+ if ($transactionCollection->getSize()>1 || $transactionCollection->getSize() == 0) {
133
  $errorMsq = $helper->__(
134
  "Warning, transaction count is %s instead of 1 for the Payid '%s', order '%s' and Operation '%s'.",
135
+ $transactionCollection->getSize(),
136
  $payId,
137
  $order->getId(),
138
  $operation
139
  );
140
  $helper->log($errorMsq);
141
+ Mage::throwException($errorMsq);
142
  }
143
 
144
+ if ($transactionCollection->getSize() == 1) {
145
  $transaction = $transactionCollection->getLastItem();
146
  $transaction->setOrderPaymentObject($order->getPayment());
147
  return $transaction;
165
  ->addAttributeToFilter('is_closed', 0)
166
  ->addAttributeToFilter('order_id', $order->getId());
167
 
168
+ return (0 < $transactionCollection->getSize());
169
  }
170
 
171
  /**
178
  {
179
  // Avoid quotes added somewhere unknown
180
  if (preg_match("/^[\"']([0-9-\..,-]+)[\"']$/i", $amount, $matches)) {
181
+ Mage::helper('ops')->log(
182
+ "Warning in formatAmount: Found quotes around amount in '" . var_export($amount, true) . "'"
183
+ );
184
  $amount = $matches[1];
185
  }
186
 
196
  *
197
  * @return boolean
198
  */
199
+ public function isValidOpsRequest(
200
+ $openTransaction,
201
+ Mage_Sales_Model_Order $order,
202
+ $opsRequestParams
203
+ )
204
  {
205
  if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_DELETE_TRANSACTION_TYPE) {
206
  return false;
213
 
214
  /* find expected amount */
215
  $expectedAmount = null;
216
+ if (null !== $openTransaction) {
217
  $transactionInfo = unserialize($openTransaction->getAdditionalInformation('arrInfo'));
218
  if (array_key_exists('amount', $transactionInfo)) {
219
+ if (null === $expectedAmount || $transactionInfo['amount'] == $requestedAmount) {
 
 
 
220
  $expectedAmount = $this->formatAmount($transactionInfo['amount']);
221
  }
222
  }
225
  if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE
226
  || $this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_VOID_TRANSACTION_TYPE
227
  ) {
228
+ if (null === $requestedAmount || 0 == count($openTransaction) || $requestedAmount != $expectedAmount) {
 
 
 
229
  return false;
230
  }
231
  }
232
 
233
  if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
234
+ if (null === $requestedAmount) {
235
  Mage::helper('ops')->log('Please configure PayEngine to submit amount');
236
  return false;
237
  }
238
  $grandTotal = $this->formatAmount(Mage::helper('ops/payment')->getBaseGrandTotalFromSalesObject($order));
239
  if ($grandTotal != $requestedAmount) {
240
+ if (null === $openTransaction || $expectedAmount != $requestedAmount) {
 
 
241
  return false;
242
  }
243
  }
252
  /**
253
  * allow null as valid state for creating the order with status 'pending'
254
  */
255
+ if (null != $response['STATUS'] && Mage::helper('ops/payment')->isPaymentFailed($response['STATUS'])) {
 
 
256
  Mage::getSingleton('checkout/type_onepage')->getCheckout()->setGotoSection('payment');
257
+ Mage::throwException(Mage::helper('ops/data')->__('PayEngine Payment failed'));
258
  }
259
+
260
  return $response;
261
  }
262
  }
app/code/community/Netresearch/OPS/Helper/Kwixo.php CHANGED
@@ -11,7 +11,7 @@
11
  class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
12
  {
13
 
14
- private $helper = null;
15
 
16
  protected function getHelper()
17
  {
@@ -59,13 +59,9 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
59
  );
60
  $subcategories = $category->getAllChildren(true);
61
  foreach ($subcategories as $subcategory) {
62
- $kwixoCatMapModel = Mage::getModel(
63
- 'ops/kwixo_category_mapping'
64
- )->loadByCategoryId($subcategory);
65
  $kwixoCatMapModel->setCategoryId($subcategory);
66
- $kwixoCatMapModel->setKwixoCategoryId(
67
- $postData['kwixoCategory_id']
68
- );
69
  $kwixoCatMapModel->save();
70
  }
71
  }
@@ -85,7 +81,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
85
  *
86
  * @throws Mage_Core_Exception - if the structure does not match
87
  */
88
- private function validateKwixoConfigurationData(array $postData)
89
  {
90
  $helper = $this->getHelper();
91
  $isValid = true;
@@ -122,7 +118,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
122
  * information
123
  *
124
  */
125
- private function validateKwixoMappingExist(array $postData)
126
  {
127
  $helper = $this->getHelper();
128
  $kwixoCategories = Mage::getModel('ops/source_kwixo_productCategories')
@@ -145,7 +141,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
145
  *
146
  * @throws Mage_Core_Exception - if an invalid setting is given
147
  */
148
- private function validateCategoryExist(array $postData)
149
  {
150
  $helper = $this->getHelper();
151
  $isValid = true;
@@ -157,11 +153,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
157
  }
158
  if ($isValid
159
  && (!is_numeric($postData['category_id'])
160
- || is_null(
161
- Mage::getModel('catalog/category')->load(
162
- $postData['category_id']
163
- )->getId()
164
- ))
165
  ) {
166
  $isValid = false;
167
  $message = $helper->__('Invalid category provided');
11
  class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
12
  {
13
 
14
+ protected $helper = null;
15
 
16
  protected function getHelper()
17
  {
59
  );
60
  $subcategories = $category->getAllChildren(true);
61
  foreach ($subcategories as $subcategory) {
62
+ $kwixoCatMapModel = Mage::getModel('ops/kwixo_category_mapping')->loadByCategoryId($subcategory);
 
 
63
  $kwixoCatMapModel->setCategoryId($subcategory);
64
+ $kwixoCatMapModel->setKwixoCategoryId($postData['kwixoCategory_id']);
 
 
65
  $kwixoCatMapModel->save();
66
  }
67
  }
81
  *
82
  * @throws Mage_Core_Exception - if the structure does not match
83
  */
84
+ protected function validateKwixoConfigurationData(array $postData)
85
  {
86
  $helper = $this->getHelper();
87
  $isValid = true;
118
  * information
119
  *
120
  */
121
+ protected function validateKwixoMappingExist(array $postData)
122
  {
123
  $helper = $this->getHelper();
124
  $kwixoCategories = Mage::getModel('ops/source_kwixo_productCategories')
141
  *
142
  * @throws Mage_Core_Exception - if an invalid setting is given
143
  */
144
+ protected function validateCategoryExist(array $postData)
145
  {
146
  $helper = $this->getHelper();
147
  $isValid = true;
153
  }
154
  if ($isValid
155
  && (!is_numeric($postData['category_id'])
156
+ || null === Mage::getModel('catalog/category')->load($postData['category_id'])->getId())
 
 
 
 
157
  ) {
158
  $isValid = false;
159
  $message = $helper->__('Invalid category provided');
app/code/community/Netresearch/OPS/Helper/MobileDetect.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS_Helper_MobileDetect
4
+ *
5
+ * @package
6
+ * @copyright 2016 Netresearch
7
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
8
+ * @license OSL 3.0
9
+ */
10
+ require_once Mage::getBaseDir('lib') . DS . 'MobileDetect' .DS. 'Mobile_Detect.php';
11
+
12
+ class Netresearch_OPS_Helper_MobileDetect extends Mage_Core_Helper_Abstract
13
+ {
14
+ /**
15
+ * Computer device type string
16
+ */
17
+ const DEVICE_TYPE_COMPUTER = 'Computer';
18
+ /**
19
+ * mobile device type string
20
+ */
21
+ const DEVICE_TYPE_MOBILE = 'Mobile';
22
+ /**
23
+ * tablet device type string
24
+ */
25
+ const DEVICE_TYPE_TABLET = 'Tablet';
26
+
27
+ /**
28
+ * @var Mobile_Detect
29
+ */
30
+ private $_detector = null;
31
+
32
+ /**
33
+ * create class instance
34
+ *
35
+ * Netresearch_OPS_Helper_MobileDetect constructor.
36
+ * @param null $headers
37
+ * @param null $userAgent
38
+ * @param null $detector
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_detector = new Mobile_Detect();
43
+ }
44
+
45
+ public function setDetector($detector)
46
+ {
47
+ $this->_detector = $detector;
48
+ }
49
+
50
+ /**
51
+ * determine device type with help of mobile_detect lib and return it
52
+ *
53
+ * @return string
54
+ */
55
+ public function getDeviceType()
56
+ {
57
+ $deviceType = self::DEVICE_TYPE_COMPUTER;
58
+ if ($this->_detector->isMobile()) {
59
+ $deviceType = self::DEVICE_TYPE_MOBILE;
60
+ }
61
+
62
+ if ($this->_detector->isTablet()) {
63
+ $deviceType = self::DEVICE_TYPE_TABLET;
64
+ }
65
+
66
+ return $deviceType;
67
+ }
68
+ }
app/code/community/Netresearch/OPS/Helper/Order.php CHANGED
@@ -14,7 +14,7 @@ class Netresearch_OPS_Helper_Order extends Mage_Core_Helper_Abstract
14
  const DELIMITER = '#';
15
 
16
  /** @var $config Netresearch_OPS_Model_Config */
17
- private $config = null;
18
 
19
  protected $statusMappingModel = null;
20
 
@@ -48,7 +48,7 @@ class Netresearch_OPS_Helper_Order extends Mage_Core_Helper_Abstract
48
  */
49
  protected function getConfig()
50
  {
51
- if (is_null($this->config)) {
52
  $this->config = Mage::getModel('ops/config');
53
  }
54
 
@@ -113,7 +113,6 @@ class Netresearch_OPS_Helper_Order extends Mage_Core_Helper_Abstract
113
  $fieldToFilter = 'increment_id';
114
  }
115
 
116
-
117
  /* @var $order Mage_Sales_Model_Resource_Order_Collection */
118
  $order = Mage::getModel('sales/order')->getCollection()
119
  ->addFieldToFilter($fieldToFilter, $opsOrderId)
14
  const DELIMITER = '#';
15
 
16
  /** @var $config Netresearch_OPS_Model_Config */
17
+ protected $config = null;
18
 
19
  protected $statusMappingModel = null;
20
 
48
  */
49
  protected function getConfig()
50
  {
51
+ if (null === $this->config) {
52
  $this->config = Mage::getModel('ops/config');
53
  }
54
 
113
  $fieldToFilter = 'increment_id';
114
  }
115
 
 
116
  /* @var $order Mage_Sales_Model_Resource_Order_Collection */
117
  $order = Mage::getModel('sales/order')->getCollection()
118
  ->addFieldToFilter($fieldToFilter, $opsOrderId)
app/code/community/Netresearch/OPS/Helper/Order/Refund.php CHANGED
@@ -32,6 +32,7 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
32
 
33
  /**
34
  * @param Varien_Object $payment
 
35
  */
36
  public function setPayment(Varien_Object $payment)
37
  {
@@ -41,7 +42,8 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
41
  }
42
 
43
  /**
44
- * @param float $amount
 
45
  */
46
  public function setAmount($amount)
47
  {
@@ -94,8 +96,9 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
94
  }
95
 
96
  /**
97
- * @param Mage_Sales_Model_Order_Payment $payment
98
- * @param float $amount
 
99
  */
100
  public function prepareOperation($payment, $amount)
101
  {
@@ -124,7 +127,8 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
124
  *
125
  * @return Mage_Sales_Model_Order_Payment_Transaction|null
126
  */
127
- public function getOpenRefundTransaction($payment){
 
128
  /** @var Mage_Sales_Model_Resource_Order_Payment_Transaction_Collection $refundTransactions */
129
  $refundTransactions = Mage::getModel('sales/order_payment_transaction')->getCollection();
130
  $transaction = $refundTransactions->addPaymentIdFilter($payment->getId())
32
 
33
  /**
34
  * @param Varien_Object $payment
35
+ * @return $this
36
  */
37
  public function setPayment(Varien_Object $payment)
38
  {
42
  }
43
 
44
  /**
45
+ * @param $amount
46
+ * @return $this
47
  */
48
  public function setAmount($amount)
49
  {
96
  }
97
 
98
  /**
99
+ * @param $payment
100
+ * @param $amount
101
+ * @return mixed
102
  */
103
  public function prepareOperation($payment, $amount)
104
  {
127
  *
128
  * @return Mage_Sales_Model_Order_Payment_Transaction|null
129
  */
130
+ public function getOpenRefundTransaction($payment)
131
+ {
132
  /** @var Mage_Sales_Model_Resource_Order_Payment_Transaction_Collection $refundTransactions */
133
  $refundTransactions = Mage::getModel('sales/order_payment_transaction')->getCollection();
134
  $transaction = $refundTransactions->addPaymentIdFilter($payment->getId())
app/code/community/Netresearch/OPS/Helper/Payment.php CHANGED
@@ -71,7 +71,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
71
  * Check hash crypted by SHA1 with existing data
72
  *
73
  * @param array $data
74
- * @param string $hash
75
  * @param string $key
76
  *
77
  * @return bool
@@ -97,7 +97,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
97
  }
98
  }
99
 
100
- private function compareHashes($hashFromOPS, $actual)
101
  {
102
  $helper = Mage::helper('ops');
103
  $helper->log(
@@ -120,8 +120,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
120
  /**
121
  * Return set of data which is ready for SHA crypt
122
  *
123
- * @param array $data
124
- * @param string $key
125
  *
126
  * @return string
127
  */
@@ -130,7 +130,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
130
  $params = $this->prepareParamsAndSort($params);
131
  $plainHashString = "";
132
  foreach ($params as $paramSet):
133
- if ($paramSet['value'] == '' || $paramSet['key'] == 'SHASIGN') {
134
  continue;
135
  }
136
  $plainHashString .= strtoupper($paramSet['key']) . "=" . $paramSet['value'] . $SHAkey;
@@ -177,14 +177,14 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
177
  */
178
  public function getSHASign($formFields, $shaCode = null, $storeId = null)
179
  {
180
- if (is_null($shaCode)) {
181
  $shaCode = Mage::getModel('ops/config')->getShaOutCode($storeId);
182
  }
183
  $formFields = array_change_key_case($formFields, CASE_UPPER);
184
  uksort($formFields, 'strnatcasecmp');
185
  $plainHashString = '';
186
  foreach ($formFields as $formKey => $formVal) {
187
- if (is_null($formVal) || '' === $formVal || $formKey == 'SHASIGN') {
188
  continue;
189
  }
190
  $plainHashString .= strtoupper($formKey) . '=' . $formVal . $shaCode;
@@ -193,13 +193,35 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
193
  return $plainHashString;
194
  }
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  /**
197
  * We get some CC info from ops, so we must save it
198
  *
199
  * @param Mage_Sales_Model_Order $order
200
  * @param array $ccInfo
201
  *
202
- * @return Netresearch_OPS_ApiController
203
  */
204
  public function _prepareCCInfo($order, $ccInfo)
205
  {
@@ -287,7 +309,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
287
  case Netresearch_OPS_Model_Status::AUTHORIZED:
288
  case Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT:
289
  case Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING:
290
- case Netresearch_OPS_Model_Status::AUTHORIZED_UNKNOWN:
291
  case Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT:
292
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT;
293
  break;
@@ -298,7 +319,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
298
  break;
299
  case Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED:
300
  case Netresearch_OPS_Model_Status::PAYMENT_REFUSED:
301
- // $this->declineOrder($order, $params);
302
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE;
303
  break;
304
  case Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER:
@@ -306,7 +326,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
306
  break;
307
  default:
308
  //all unknown transaction will accept as exceptional
309
- // $this->handleException($order, $params);
310
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION;
311
  }
312
 
@@ -316,8 +335,11 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
316
  /**
317
  * Process success action by accept url
318
  *
319
- * @param Mage_Sales_Model_Order $order Order
320
- * @param array $params Request params
 
 
 
321
  */
322
  public function acceptOrder($order, $params, $instantCapture = 0)
323
  {
@@ -365,7 +387,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
365
  * so capture or cancel won't work. So we need to create a new authorization transaction for them
366
  * when a payment was accepted by PayEngine
367
  *
368
- * In exception-case we create the authorization-transaction too because some exception-cases can turn into accepted
 
369
  */
370
  if (('accept' === $action || 'exception' === $action)
371
  && in_array($code, array('ops_cc', 'ops_directDebit'))
@@ -433,142 +456,15 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
433
  $payment->setAdditionalInformation('additionalScoringData', $additionalScoringData);
434
  }
435
 
436
- /**
437
- * Process cancel action by cancel url
438
- *
439
- * @param Mage_Sales_Model_Order $order Order
440
- * @param string[] $params Request params
441
- * @param string $status Order status
442
- * @param string $comment Order comment
443
- * @throws Exception
444
- * @deprecated
445
- */
446
- public function cancelOrder($order, $params, $status, $comment)
447
- {
448
- //@TODO: remove obsolete function
449
-
450
- try {
451
- Mage::register('ops_auto_void', true); //Set this session value to true to allow cancel
452
- $this->cancelInvoices($order);
453
- $order->cancel();
454
- $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, $status, $comment);
455
- $order->save();
456
-
457
- try {
458
- $this->setPaymentTransactionInformation($order->getPayment(), $params, 'cancel');
459
- } catch (Exception $e) {
460
- // just ignore that
461
- Mage::helper('ops')->log(
462
- 'Catched exception while saving payment transaction information of a canceled order: '
463
- . $e->getMessage()
464
- );
465
- }
466
- } catch (Exception $e) {
467
- $this->_getCheckout()->addError(Mage::helper('ops')->__('Order can not be canceled for system reason.'));
468
- throw $e;
469
- }
470
- }
471
-
472
- /**
473
- * Process decline action by ops decline url
474
- *
475
- * @param Mage_Sales_Model_Order $order Order
476
- * @param array $params Request params
477
- */
478
- public function declineOrder($order, $params)
479
- {
480
- //@TODO: remove obsolete function
481
-
482
- try {
483
- Mage::register('ops_auto_void', true); //Set this session value to true to allow cancel
484
- $this->cancelInvoices($order);
485
- $order->cancel();
486
- $order->setState(
487
- Mage_Sales_Model_Order::STATE_CANCELED,
488
- Mage_Sales_Model_Order::STATE_CANCELED,
489
- Mage::helper('ops')->__(
490
- 'Order declined on ops side. PayEngine status: %s, Payment ID: %s.',
491
- Mage::helper('ops')->getStatusText($params['STATUS']),
492
- $params['PAYID']
493
- )
494
- );
495
- $order->save();
496
-
497
- $this->setPaymentTransactionInformation($order->getPayment(), $params, 'decline');
498
- } catch (Exception $e) {
499
- $this->_getCheckout()->addError(Mage::helper('ops')->__('Order can not be canceled for system reason.'));
500
- throw $e;
501
- }
502
- }
503
-
504
- /**
505
- * Wait for 3D secure confirmation
506
- *
507
- * @param Mage_Sales_Model_Order $order Order
508
- * @param array $params Request params
509
- */
510
- public function waitOrder($order, $params)
511
- {
512
-
513
- //@TODO: remove obsolete function
514
- try {
515
- $order->setState(
516
- Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW,
517
- Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW,
518
- Mage::helper('ops')->__(
519
- 'Order is waiting for PayEngine confirmation of 3D-Secure. PayEngine status: %s, Payment ID: %s.',
520
- Mage::helper('ops')->getStatusText($params['STATUS']),
521
- $params['PAYID']
522
- )
523
- );
524
- $order->save();
525
- $this->setPaymentTransactionInformation($order->getPayment(), $params, 'wait');
526
- } catch (Exception $e) {
527
- $this->_getCheckout()->addError(
528
- Mage::helper('ops')->__('Error during 3D-Secure processing of PayEngine. Error: %s', $e->getMessage())
529
- );
530
- throw $e;
531
- }
532
- }
533
 
534
- /**
535
- * Process exception action by ops exception url
536
- *
537
- * @param Mage_Sales_Model_Order $order Order
538
- * @param array $params Request params
539
- */
540
- public function handleException($order, $params)
541
- {
542
- //@TODO: remove obsolete function
543
- $exceptionMessage = $this->getPaymentExceptionMessage($params['STATUS']);
544
 
545
- if (!empty($exceptionMessage)) {
546
- try {
547
- $this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());
548
- $this->_prepareCCInfo($order, $params);
549
- $order->getPayment()->setLastTransId($params['PAYID']);
550
- //to send new order email only when state is pending payment
551
- if (!$order->getEmailSent() != 1
552
- && $order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
553
- ) {
554
- $order->sendNewOrderEmail();
555
 
556
- }
557
- $order->addStatusHistoryComment($exceptionMessage);
558
- $order->save();
559
- $this->setPaymentTransactionInformation($order->getPayment(), $params, 'exception');
560
- } catch (Exception $e) {
561
- $this->_getCheckout()->addError(Mage::helper('ops')->__('Order can not be saved for system reason.'));
562
- }
563
- } else {
564
- $this->_getCheckout()->addError(Mage::helper('ops')->__('An unknown exception occured.'));
565
- }
566
- }
567
 
568
  /**
569
  * Get Payment Exception Message
570
  *
571
- * @param int $ops_status Request OPS Status
 
572
  */
573
  protected function getPaymentExceptionMessage($ops_status)
574
  {
@@ -590,122 +486,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
590
  return $exceptionMessage;
591
  }
592
 
593
- /**
594
- * Process Configured Payment Action: Direct Sale, create invoice if state is Pending
595
- *
596
- * @param Mage_Sales_Model_Order $order Order
597
- * @param array $params Request params
598
- */
599
- protected function _processDirectSale($order, $params, $instantCapture = 0)
600
- {
601
- //@TODO: remove obsolete function
602
-
603
- Mage::register('ops_auto_capture', true);
604
- $status = $params['STATUS'];
605
- if ($status == Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT) {
606
- $order->setState(
607
- Mage_Sales_Model_Order::STATE_PROCESSING,
608
- Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
609
- Mage::helper('ops')->__('Waiting for the payment of the customer')
610
- );
611
-
612
- // send new order mail for bank transfer, since it is 'successfully' authorized at this point
613
- if ($order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_BankTransfer
614
- && $order->getEmailSent() != 1
615
- ) {
616
- $order->sendNewOrderEmail();
617
- }
618
-
619
- $order->save();
620
- } elseif ($status == Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING) {
621
- $order->setState(
622
- Mage_Sales_Model_Order::STATE_PROCESSING,
623
- Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
624
- Mage::helper('ops')->__('Authorization waiting from PayEngine')
625
- );
626
- $order->save();
627
- } elseif (($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
628
- || $instantCapture)
629
- && !$this->isPaypalSpecialStatus($order->getPayment()->getMethodInstance(), $status)
630
- ) {
631
- if ($status == Netresearch_OPS_Model_Status::AUTHORIZED) {
632
- if ($order->getStatus() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
633
- $order->setState(
634
- Mage_Sales_Model_Order::STATE_PROCESSING,
635
- Mage_Sales_Model_Order::STATE_PROCESSING,
636
- Mage::helper('ops')->__('Processed by PayEngine')
637
- );
638
-
639
- }
640
- } else {
641
- $order->setState(
642
- Mage_Sales_Model_Order::STATE_PROCESSING,
643
- true,
644
- Mage::helper('ops')->__('Processed by PayEngine')
645
- );
646
- $order->save();
647
- }
648
- if (!$order->getInvoiceCollection()->getSize()
649
- && $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
650
- && $order->canInvoice()
651
- ) {
652
- $invoice = $order->prepareInvoice();
653
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
654
- $invoice->register();
655
- $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID);
656
- $invoice->getOrder()->setIsInProcess(true);
657
- $invoice->save();
658
- $this->sendInvoiceToCustomer($invoice);
659
-
660
- $transactionSave = Mage::getModel('core/resource_transaction')
661
- ->addObject($invoice)
662
- ->addObject($invoice->getOrder())
663
- ->save();
664
-
665
- /*
666
- * If the payment method is a redirect-payment-method send the email
667
- * In any other case Magento sends an email automatically in Mage_Checkout_Model_Type_Onepage::saveOrder
668
- */
669
- if ($this->isRedirectPaymentMethod($order) === true
670
- && $order->getEmailSent() != 1
671
- ) {
672
- $order->sendNewOrderEmail();
673
- }
674
- $eventData = array('data_object' => $order, 'order' => $order);
675
- Mage::dispatchEvent('ops_sales_order_save_commit_after', $eventData);
676
- }
677
-
678
- if ($this->isInlinePayment($order->getPayment())
679
- && 0 < strlen(trim($order->getPayment()->getAdditionalInformation('HTML_ANSWER')))
680
- && $order->getPayment()->getAdditionalInformation('status') == Netresearch_OPS_Model_Status::PAYMENT_REQUESTED
681
- ) {
682
- $order->getPayment()->setIsTransactionApproved(true)->registerPaymentReviewAction(
683
- Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, true
684
- )->save();
685
- $this->setInvoicesToPaid($order);
686
- $order->getPayment()->getAuthorizationTransaction()->setIsClosed(true)->save();
687
- $order->getPayment()->addTransaction(
688
- Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $order->getPayment()
689
- )->setIsClosed(true)->save();
690
-
691
- if ($order->getEmailSent() != 1) {
692
- $order->sendNewOrderEmail();
693
- }
694
-
695
- $order->save();
696
- }
697
- if ($this->isInlinePayment($order->getPayment()) && Mage::getModel('ops/config')->getSendInvoice()
698
- && Mage::getModel('ops/config')->getPaymentAction($order->getStoreId())
699
- === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE
700
- ) {
701
- foreach ($order->getInvoiceCollection() as $invoice) {
702
- $this->sendInvoiceToCustomer($invoice);
703
- }
704
- }
705
- } else {
706
- $order->save();
707
- }
708
- }
709
 
710
  /**
711
  * send invoice to customer if that was configured by the merchant
@@ -719,7 +499,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
719
  if (false == $invoice->getEmailSent()
720
  && $this->getConfig()->getSendInvoice()
721
  ) {
722
- $invoice->sendEmail($notifyCustomer = true);
723
  }
724
  }
725
 
@@ -806,20 +586,20 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
806
  /**
807
  * Fetches transaction with given transaction id
808
  *
809
- * @param string $txnId
810
  *
811
  * @return mixed Mage_Sales_Model_Order_Payment_Transaction | boolean
812
  */
813
  public function getTransactionByTransactionId($transactionId)
814
  {
815
  if (!$transactionId) {
816
- return;
817
  }
818
  $transaction = Mage::getModel('sales/order_payment_transaction')
819
  ->getCollection()
820
  ->addAttributeToFilter('txn_id', $transactionId)
821
  ->getLastItem();
822
- if (is_null($transaction->getId())) {
823
  return false;
824
  }
825
  $transaction->getOrderPaymentObject();
@@ -839,7 +619,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
839
  // add items
840
  $cart = Mage::getSingleton('checkout/cart');
841
 
842
- if (0 < $cart->getQuote()->getItemsCollection()->count()) {
843
  //cart is not empty, so refilling it is not required
844
  return;
845
  }
@@ -855,7 +635,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
855
  // add coupon code
856
  $coupon = $order->getCouponCode();
857
  $session = Mage::getSingleton('checkout/session');
858
- if (false == is_null($coupon)) {
859
  $session->getQuote()->setCouponCode($coupon)->save();
860
  }
861
  }
@@ -878,19 +658,21 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
878
  /**
879
  * Check is payment method is a redirect method
880
  *
881
- * @param Mage_Sales_Model_Order $order
 
882
  */
883
  protected function isRedirectPaymentMethod($order)
884
  {
 
885
  $method = $order->getPayment()->getMethodInstance();
886
  if ($method
887
- && $method->getOrderPlaceRedirectUrl() != '' //Magento returns ''
888
- && $method->getOrderPlaceRedirectUrl() !== false
889
- ) { //Ops return false
890
- return true;
891
- } else {
892
- return false;
893
  }
 
 
894
  }
895
 
896
  public function getQuote()
@@ -933,11 +715,11 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
933
  */
934
  public function getBaseGrandTotalFromSalesObject($salesObject)
935
  {
936
- if ($salesObject instanceof Mage_Sales_Model_Order or $salesObject instanceof Mage_Sales_Model_Quote) {
937
- return $salesObject->getBaseGrandTotal();
938
- } else {
939
  Mage::throwException('$salesObject is not a quote or an order instance');
940
  }
 
 
941
  }
942
 
943
 
@@ -1107,8 +889,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
1107
  {
1108
  return $this->isInlinePayment($payment)
1109
  && (0 === strlen(
1110
- trim($payment->getMethodInstance()->getConfigPaymentAction())
1111
- ));
1112
  }
1113
 
1114
  /**
@@ -1124,8 +906,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
1124
  foreach ($order->getInvoiceCollection() as $invoice) {
1125
  $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
1126
  $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID);
1127
- $invoice->save();
1128
  }
 
1129
 
1130
  return $this;
1131
  }
@@ -1171,4 +953,17 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
1171
  );
1172
  }
1173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1174
  }
71
  * Check hash crypted by SHA1 with existing data
72
  *
73
  * @param array $data
74
+ * @param string $hashFromOPS
75
  * @param string $key
76
  *
77
  * @return bool
97
  }
98
  }
99
 
100
+ protected function compareHashes($hashFromOPS, $actual)
101
  {
102
  $helper = Mage::helper('ops');
103
  $helper->log(
120
  /**
121
  * Return set of data which is ready for SHA crypt
122
  *
123
+ * @param array $params
124
+ * @param string $SHAkey
125
  *
126
  * @return string
127
  */
130
  $params = $this->prepareParamsAndSort($params);
131
  $plainHashString = "";
132
  foreach ($params as $paramSet):
133
+ if ($paramSet['value'] == '' || $paramSet['key'] == 'SHASIGN' || is_array($paramSet['value'])) {
134
  continue;
135
  }
136
  $plainHashString .= strtoupper($paramSet['key']) . "=" . $paramSet['value'] . $SHAkey;
177
  */
178
  public function getSHASign($formFields, $shaCode = null, $storeId = null)
179
  {
180
+ if (null === $shaCode) {
181
  $shaCode = Mage::getModel('ops/config')->getShaOutCode($storeId);
182
  }
183
  $formFields = array_change_key_case($formFields, CASE_UPPER);
184
  uksort($formFields, 'strnatcasecmp');
185
  $plainHashString = '';
186
  foreach ($formFields as $formKey => $formVal) {
187
+ if (null === $formVal || '' === $formVal || $formKey == 'SHASIGN') {
188
  continue;
189
  }
190
  $plainHashString .= strtoupper($formKey) . '=' . $formVal . $shaCode;
193
  return $plainHashString;
194
  }
195
 
196
+ /**
197
+ * @param int $opsOrderId
198
+ * @param int $storeId
199
+ *
200
+ * @return array
201
+ */
202
+ public function validateOrderForReuse($opsOrderId, $storeId)
203
+ {
204
+
205
+ return array(
206
+ 'orderID' => $opsOrderId,
207
+ 'SHASIGN' => strtoupper(
208
+ $this->shaCrypt(
209
+ $this->getSHAInSet(
210
+ array('orderId' => $opsOrderId),
211
+ $this->getConfig()->getShaOutCode($storeId)
212
+ )
213
+ )
214
+ ),
215
+ );
216
+ }
217
+
218
  /**
219
  * We get some CC info from ops, so we must save it
220
  *
221
  * @param Mage_Sales_Model_Order $order
222
  * @param array $ccInfo
223
  *
224
+ * @return $this
225
  */
226
  public function _prepareCCInfo($order, $ccInfo)
227
  {
309
  case Netresearch_OPS_Model_Status::AUTHORIZED:
310
  case Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT:
311
  case Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING:
 
312
  case Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT:
313
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT;
314
  break;
319
  break;
320
  case Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED:
321
  case Netresearch_OPS_Model_Status::PAYMENT_REFUSED:
 
322
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE;
323
  break;
324
  case Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER:
326
  break;
327
  default:
328
  //all unknown transaction will accept as exceptional
 
329
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION;
330
  }
331
 
335
  /**
336
  * Process success action by accept url
337
  *
338
+ *
339
+ * @param $order
340
+ * @param $params
341
+ * @param int $instantCapture
342
+ * @throws Exception
343
  */
344
  public function acceptOrder($order, $params, $instantCapture = 0)
345
  {
387
  * so capture or cancel won't work. So we need to create a new authorization transaction for them
388
  * when a payment was accepted by PayEngine
389
  *
390
+ * In exception-case we create the authorization-transaction too
391
+ * because some exception-cases can turn into accepted
392
  */
393
  if (('accept' === $action || 'exception' === $action)
394
  && in_array($code, array('ops_cc', 'ops_directDebit'))
456
  $payment->setAdditionalInformation('additionalScoringData', $additionalScoringData);
457
  }
458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
 
 
 
 
 
 
 
 
 
 
 
460
 
 
 
 
 
 
 
 
 
 
 
461
 
 
 
 
 
 
 
 
 
 
 
 
462
 
463
  /**
464
  * Get Payment Exception Message
465
  *
466
+ * @param $ops_status
467
+ * @return string
468
  */
469
  protected function getPaymentExceptionMessage($ops_status)
470
  {
486
  return $exceptionMessage;
487
  }
488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
 
490
  /**
491
  * send invoice to customer if that was configured by the merchant
499
  if (false == $invoice->getEmailSent()
500
  && $this->getConfig()->getSendInvoice()
501
  ) {
502
+ $invoice->sendEmail(true);
503
  }
504
  }
505
 
586
  /**
587
  * Fetches transaction with given transaction id
588
  *
589
+ * @param string $transactionId
590
  *
591
  * @return mixed Mage_Sales_Model_Order_Payment_Transaction | boolean
592
  */
593
  public function getTransactionByTransactionId($transactionId)
594
  {
595
  if (!$transactionId) {
596
+ return false;
597
  }
598
  $transaction = Mage::getModel('sales/order_payment_transaction')
599
  ->getCollection()
600
  ->addAttributeToFilter('txn_id', $transactionId)
601
  ->getLastItem();
602
+ if (null === $transaction->getId()) {
603
  return false;
604
  }
605
  $transaction->getOrderPaymentObject();
619
  // add items
620
  $cart = Mage::getSingleton('checkout/cart');
621
 
622
+ if (0 < $cart->getQuote()->getItemsCollection()->getSize()) {
623
  //cart is not empty, so refilling it is not required
624
  return;
625
  }
635
  // add coupon code
636
  $coupon = $order->getCouponCode();
637
  $session = Mage::getSingleton('checkout/session');
638
+ if (null != $coupon) {
639
  $session->getQuote()->setCouponCode($coupon)->save();
640
  }
641
  }
658
  /**
659
  * Check is payment method is a redirect method
660
  *
661
+ * @param $order
662
+ * @return bool
663
  */
664
  protected function isRedirectPaymentMethod($order)
665
  {
666
+ $result = false;
667
  $method = $order->getPayment()->getMethodInstance();
668
  if ($method
669
+ && $method->getOrderPlaceRedirectUrl() != '' // Magento returns ''
670
+ && $method->getOrderPlaceRedirectUrl() !== false // Ops returns false
671
+ ) {
672
+ $result = true;
 
 
673
  }
674
+
675
+ return $result;
676
  }
677
 
678
  public function getQuote()
715
  */
716
  public function getBaseGrandTotalFromSalesObject($salesObject)
717
  {
718
+ if (!($salesObject instanceof Mage_Sales_Model_Order || $salesObject instanceof Mage_Sales_Model_Quote)) {
 
 
719
  Mage::throwException('$salesObject is not a quote or an order instance');
720
  }
721
+
722
+ return $salesObject->getBaseGrandTotal();
723
  }
724
 
725
 
889
  {
890
  return $this->isInlinePayment($payment)
891
  && (0 === strlen(
892
+ trim($payment->getMethodInstance()->getConfigPaymentAction())
893
+ ));
894
  }
895
 
896
  /**
906
  foreach ($order->getInvoiceCollection() as $invoice) {
907
  $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
908
  $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID);
 
909
  }
910
+ $order->getInvoiceCollection()->save();
911
 
912
  return $this;
913
  }
953
  );
954
  }
955
 
956
+ /**
957
+ * @param $paymentCode
958
+ *
959
+ * @return string
960
+ */
961
+ public function getPaymentDefaultLogo($paymentCode)
962
+ {
963
+ return Mage::getSingleton('core/design_package')->getSkinUrl(
964
+ 'images/ops/logos/' . $paymentCode . '.png',
965
+ array('_area' => 'frontend')
966
+ );
967
+ }
968
+
969
  }
app/code/community/Netresearch/OPS/Helper/Payment/DirectLink/Request.php CHANGED
@@ -162,7 +162,8 @@ abstract class Netresearch_OPS_Helper_Payment_DirectLink_Request
162
 
163
 
164
  /**
165
- * extracts the parameter for the direct link request from the quote, order and, optionally from existing request params
 
166
  *
167
  * @param Mage_Sales_Model_Quote $quote
168
  * @param Mage_Sales_Model_Order $order
@@ -170,7 +171,8 @@ abstract class Netresearch_OPS_Helper_Payment_DirectLink_Request
170
  *
171
  * @return array - the parameters for the direct link request
172
  */
173
- public function getDirectLinkRequestParams(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order, $requestParams = array())
 
174
  {
175
  $billingAddress = $order->getBillingAddress();
176
  $shippingAddress = $this->getShippingAddress($order, $billingAddress);
@@ -262,8 +264,9 @@ abstract class Netresearch_OPS_Helper_Payment_DirectLink_Request
262
  {
263
  if ($this->getDataHelper()->isAdminSession()) {
264
  $requestParams['ECI'] = Netresearch_OPS_Model_Eci_Values::MANUALLY_KEYED_FROM_MOTO;
265
- $requestParams['REMOTE_ADDR'] = 'NONE';//$order->getRemoteIp();
266
  }
 
267
  return $requestParams;
268
  }
269
 
162
 
163
 
164
  /**
165
+ * extracts the parameter for the direct link request from the quote,
166
+ * order and, optionally from existing request params
167
  *
168
  * @param Mage_Sales_Model_Quote $quote
169
  * @param Mage_Sales_Model_Order $order
171
  *
172
  * @return array - the parameters for the direct link request
173
  */
174
+ public function getDirectLinkRequestParams(
175
+ Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order, $requestParams = array())
176
  {
177
  $billingAddress = $order->getBillingAddress();
178
  $shippingAddress = $this->getShippingAddress($order, $billingAddress);
264
  {
265
  if ($this->getDataHelper()->isAdminSession()) {
266
  $requestParams['ECI'] = Netresearch_OPS_Model_Eci_Values::MANUALLY_KEYED_FROM_MOTO;
267
+ $requestParams['REMOTE_ADDR'] = 'NONE';
268
  }
269
+
270
  return $requestParams;
271
  }
272
 
app/code/community/Netresearch/OPS/Helper/Payment/Request.php CHANGED
@@ -51,19 +51,23 @@ class Netresearch_OPS_Helper_Payment_Request
51
  $address = $salesObject->getBillingAddress();
52
  }
53
 
54
- if(!$address){
55
  return $paramValues;
56
  }
57
  }
58
 
59
- $paramValues['ECOM_SHIPTO_POSTAL_CITY'] = $address->getCity();
60
- $paramValues['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $address->getPostcode();
61
- $paramValues['ECOM_SHIPTO_POSTAL_STATE'] = $this->getIsoRegionCode($address);
62
- $paramValues['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $address->getCountry();
63
- $paramValues['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $address->getFirstname();
64
- $paramValues['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $address->getLastname();
65
- $paramValues['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $address->getStreet(1);
66
- $paramValues['ECOM_SHIPTO_POSTAL_STREET_LINE2'] = $address->getStreet(2);
 
 
 
 
67
 
68
  return $paramValues;
69
  }
@@ -81,24 +85,28 @@ class Netresearch_OPS_Helper_Payment_Request
81
  $paramValues = array();
82
 
83
  if (!$address instanceof Mage_Customer_Model_Address_Abstract) {
84
- if(!is_null($salesObject)) {
85
  $address = $salesObject->getBillingAddress();
86
  }
87
- if(!$address){
88
  return $paramValues;
89
  }
90
  }
91
 
92
- $paramValues['ECOM_BILLTO_POSTAL_CITY'] = $address->getCity();
93
- $paramValues['ECOM_BILLTO_POSTAL_POSTALCODE'] = $address->getPostcode();
94
- $paramValues['ECOM_BILLTO_POSTAL_COUNTY'] = $this->getIsoRegionCode($address);
95
- $paramValues['ECOM_BILLTO_POSTAL_COUNTRYCODE'] = $address->getCountry();
96
- $paramValues['ECOM_BILLTO_POSTAL_NAME_FIRST'] = $address->getFirstname();
97
- $paramValues['ECOM_BILLTO_POSTAL_NAME_LAST'] = $address->getLastname();
98
- $paramValues['ECOM_BILLTO_POSTAL_POSTALCODE'] = $address->getPostcode();
99
- $paramValues['ECOM_BILLTO_POSTAL_STREET_LINE1'] = $address->getStreet(1);
100
- $paramValues['ECOM_BILLTO_POSTAL_STREET_LINE2'] = $address->getStreet(2);
101
- $paramValues['ECOM_BILLTO_POSTAL_STREET_LINE3'] = $address->getStreet(3);
 
 
 
 
102
 
103
  return $paramValues;
104
  }
@@ -106,9 +114,9 @@ class Netresearch_OPS_Helper_Payment_Request
106
  /**
107
  * extraxcts the according PayEngine owner* parameter
108
  *
109
- * @param Mage_Customer_Model_Address_Abstract $billingAddress
110
  *
111
- * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $salesObject
112
  *
113
  * @return string[]
114
  */
@@ -117,11 +125,11 @@ class Netresearch_OPS_Helper_Payment_Request
117
  $ownerParams = array();
118
  if ($this->getConfig()->canSubmitExtraParameter($salesObject->getStoreId())) {
119
  $ownerParams = array(
120
- 'OWNERADDRESS' => str_replace("\n", ' ', $billingAddress->getStreet(1)),
121
- 'OWNERTOWN' => $billingAddress->getCity(),
122
- 'OWNERZIP' => $billingAddress->getPostcode(),
123
- 'OWNERTELNO' => $billingAddress->getTelephone(),
124
- 'OWNERCTY' => $billingAddress->getCountry(),
125
 
126
  'ECOM_BILLTO_POSTAL_POSTALCODE' => $billingAddress->getPostcode(),
127
  );
@@ -141,7 +149,7 @@ class Netresearch_OPS_Helper_Payment_Request
141
  $formFields = array();
142
  switch ($this->getConfig()->getConfigData('template')) {
143
  case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL:
144
- $formFields['TP'] = $this->getConfig()->getPayPageTemplate($storeId);
145
  break;
146
  case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE:
147
  $formFields['TP'] = $this->getConfig()->getTemplateIdentifier($storeId);
@@ -159,8 +167,12 @@ class Netresearch_OPS_Helper_Payment_Request
159
  $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor', $storeId);
160
  $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype', $storeId);
161
  $formFields['LOGO'] = $this->getConfig()->getConfigData('logo', $storeId);
162
- $formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'home')) : 'NONE';
163
- $formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'catalog')) : '';
 
 
 
 
164
  break;
165
  default:
166
  break;
@@ -240,7 +252,7 @@ class Netresearch_OPS_Helper_Payment_Request
240
  return $this->getRegionsMappingForLatvia();
241
  }
242
 
243
- return array();;
244
  }
245
 
246
  /**
@@ -491,21 +503,25 @@ class Netresearch_OPS_Helper_Payment_Request
491
 
492
  public function getMandatoryRequestFields(Mage_Sales_Model_Order $order)
493
  {
494
- $payment = $order->getPayment()->getMethodInstance();
495
- $formFields = array();
496
- $formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());
497
- $formFields['AMOUNT'] = Mage::helper('ops')->getAmount($order->getBaseGrandTotal());
 
498
  $formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();
499
- $formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order);
500
  $formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();
501
- $formFields['PM'] = $payment->getOpsCode($order->getPayment());
502
- $formFields['EMAIL'] = $order->getCustomerEmail();
503
 
504
- $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();
505
- $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();
506
  $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
507
- $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();
508
- $formFields['BACKURL'] = $this->getConfig()->getCancelUrl();
 
 
 
509
 
510
  $formFields['FP_ACTIV'] = $this->isFingerPrintingActive($order) ? '1' : '0';
511
 
@@ -522,49 +538,71 @@ class Netresearch_OPS_Helper_Payment_Request
522
  protected function isFingerPrintingActive($order)
523
  {
524
  return $this->getConfig()->getDeviceFingerPrinting($order->getStoreId())
525
- && Mage::getSingleton('customer/session')->getData(Netresearch_OPS_Model_Payment_Abstract::FINGERPRINT_CONSENT_SESSION_KEY);
 
 
526
  }
527
 
528
  /**
529
  * Extracts the order item parameters and puts them in a array like
530
  *
531
- * @param Mage_Sales_Model_Order $order
532
  *
533
- * @return array
534
  */
535
- public function extractOrderItemParameters(Mage_Sales_Model_Order $order)
536
  {
537
  $formFields = array();
538
-
539
  // add order items
540
  $count = 1;
541
- foreach ($order->getAllItems() as $item) {
542
- if ($item->getParentItemId()
543
- && $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
544
- || $item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE
545
- ) {
546
  continue;
547
  }
548
- $formFields = array_merge($formFields, $this->getItemFormFields($count, $item));
 
 
549
  $count++;
550
  }
551
 
552
  // add discount item
553
- $discountItemFormFields = $this->getDiscountItemFormFields($order, $count);
554
- if (is_array($discountItemFormFields)) {
555
- $formFields = array_merge($formFields, $discountItemFormFields);
 
556
  $count++;
557
  }
558
 
559
  // add shipping item
560
- $shippingItemFields = $this->getShippingItemFormFields($order);
561
- if (is_array($shippingItemFields)) {
562
- $formFields = array_merge($formFields, $shippingItemFields);
 
563
  }
564
 
565
  return $formFields;
566
  }
567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  /**
569
  * @param Mage_Sales_Model_Order $order
570
  *
@@ -586,19 +624,41 @@ class Netresearch_OPS_Helper_Payment_Request
586
  /**
587
  * Genereates item array for shipping, returns false if order is virtual
588
  *
589
- * @param Mage_Sales_Model_Order $order
 
590
  *
591
- * @return array | false
592
  */
593
- protected function getShippingItemFormFields($order)
594
  {
595
- if ($order->getIsNotVirtual()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  /* add shipping item */
597
- $formFields['ORDERSHIPMETH'] = substr($order->getShippingDescription(), 0, 25);
598
- $formFields['ORDERSHIPCOST'] = Mage::helper('ops')->getAmount($order->getBaseShippingAmount());
599
- $formFields['ORDERSHIPTAXCODE']
600
- = str_replace(',', '.', (string)(float)$this->getShippingTaxRate($order)) . '%';
601
- $formFields['ORDERSHIPTAX'] = Mage::helper('ops')->getAmount($order->getBaseShippingTaxAmount());
 
 
602
  return $formFields;
603
  }
604
 
@@ -608,20 +668,25 @@ class Netresearch_OPS_Helper_Payment_Request
608
  /**
609
  * Returns item array for PayEngine request for the specified item
610
  *
611
- * @param $count
612
- * @param $item
613
  *
614
  * @return array
615
  */
616
- protected function getItemFormFields($count, $item)
617
  {
618
  $formFields = array();
619
- $formFields['ITEMID' . $count] = $item->getItemId();
620
- $formFields['ITEMNAME' . $count] = substr($item->getName(), 0, 40);
621
- $formFields['ITEMPRICE' . $count] = number_format($item->getBasePriceInclTax(), 2, '.', '');
622
- $formFields['ITEMQUANT' . $count] = (int)$item->getQtyOrdered();
623
- $formFields['ITEMVATCODE' . $count] = str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
624
- $formFields['TAXINCLUDED' . $count] = 1;
 
 
 
 
 
625
 
626
  return $formFields;
627
  }
@@ -629,31 +694,45 @@ class Netresearch_OPS_Helper_Payment_Request
629
  /**
630
  * Creates array
631
  *
632
- * @param Mage_Sales_Model_Order $order
633
- * @param $count
634
  *
635
- * @return mixed
636
  */
637
- protected function getDiscountItemFormFields(Mage_Sales_Model_Order $order, $count)
638
  {
639
  $formFields = array();
 
 
 
 
 
 
640
  /* add coupon item */
641
- if ($order->getBaseDiscountAmount()) {
642
- $couponAmount = $order->getBaseDiscountAmount();
643
- $formFields['ITEMID' . $count] = 'DISCOUNT';
644
  $couponRuleName = 'DISCOUNT';
645
  if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
646
  $couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
647
  }
648
- $formFields['ITEMNAME' . $count] = $couponRuleName;
649
- $formFields['ITEMPRICE' . $count] = number_format($couponAmount, 2, '.', '');
650
- $formFields['ITEMQUANT' . $count] = 1;
651
- $formFields['ITEMVATCODE' . $count]
 
 
 
 
 
 
 
 
652
  = str_replace(',', '.', (string)(float)$this->getShippingTaxRate($order)) . '%';
653
- $formFields['TAXINCLUDED' . $count] = 1;
 
654
  return $formFields;
655
 
656
  }
 
657
  return false;
658
  }
659
- }
51
  $address = $salesObject->getBillingAddress();
52
  }
53
 
54
+ if (!$address) {
55
  return $paramValues;
56
  }
57
  }
58
 
59
+ $shippingStreet = str_replace("\n", ' ', $address->getStreet(-1));
60
+ $splittedShippingStreet = Mage::Helper('ops/address')->splitStreet($shippingStreet);
61
+
62
+ $paramValues['ECOM_SHIPTO_POSTAL_CITY'] = $address->getCity();
63
+ $paramValues['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $address->getPostcode();
64
+ $paramValues['ECOM_SHIPTO_POSTAL_STATE'] = $this->getIsoRegionCode($address);
65
+ $paramValues['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $address->getCountry();
66
+ $paramValues['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $address->getFirstname();
67
+ $paramValues['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $address->getLastname();
68
+ $paramValues['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $splittedShippingStreet['street_name'];
69
+ $paramValues['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = $splittedShippingStreet['street_number'];
70
+ $paramValues['ECOM_SHIPTO_POSTAL_STREET_LINE2'] = $splittedShippingStreet['supplement'];
71
 
72
  return $paramValues;
73
  }
85
  $paramValues = array();
86
 
87
  if (!$address instanceof Mage_Customer_Model_Address_Abstract) {
88
+ if (!is_null($salesObject)) {
89
  $address = $salesObject->getBillingAddress();
90
  }
91
+ if (!$address) {
92
  return $paramValues;
93
  }
94
  }
95
 
96
+ $billingStreet = str_replace("\n", ' ', $address->getStreet(-1));
97
+ $splittedBillingStreet = Mage::Helper('ops/address')->splitStreet($billingStreet);
98
+
99
+ $paramValues['ECOM_BILLTO_POSTAL_CITY'] = $address->getCity();
100
+ $paramValues['ECOM_BILLTO_POSTAL_POSTALCODE'] = $address->getPostcode();
101
+ $paramValues['ECOM_BILLTO_POSTAL_COUNTY'] = $this->getIsoRegionCode($address);
102
+ $paramValues['ECOM_BILLTO_POSTAL_COUNTRYCODE'] = $address->getCountry();
103
+ $paramValues['ECOM_BILLTO_POSTAL_NAME_FIRST'] = $address->getFirstname();
104
+ $paramValues['ECOM_BILLTO_POSTAL_NAME_LAST'] = $address->getLastname();
105
+ $paramValues['ECOM_BILLTO_POSTAL_POSTALCODE'] = $address->getPostcode();
106
+ $paramValues['ECOM_BILLTO_POSTAL_STREET_LINE1'] = $splittedBillingStreet['street_name'];
107
+ $paramValues['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = $splittedBillingStreet['street_number'];
108
+ $paramValues['ECOM_BILLTO_POSTAL_STREET_LINE2'] = $splittedBillingStreet['supplement'];
109
+ $paramValues['ECOM_BILLTO_POSTAL_STREET_LINE3'] = $address->getStreet(3);
110
 
111
  return $paramValues;
112
  }
114
  /**
115
  * extraxcts the according PayEngine owner* parameter
116
  *
117
+ * @param Mage_Customer_Model_Address_Abstract $billingAddress
118
  *
119
+ * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $salesObject
120
  *
121
  * @return string[]
122
  */
125
  $ownerParams = array();
126
  if ($this->getConfig()->canSubmitExtraParameter($salesObject->getStoreId())) {
127
  $ownerParams = array(
128
+ 'OWNERADDRESS' => str_replace("\n", ' ', $billingAddress->getStreet(1)),
129
+ 'OWNERTOWN' => $billingAddress->getCity(),
130
+ 'OWNERZIP' => $billingAddress->getPostcode(),
131
+ 'OWNERTELNO' => $billingAddress->getTelephone(),
132
+ 'OWNERCTY' => $billingAddress->getCountry(),
133
 
134
  'ECOM_BILLTO_POSTAL_POSTALCODE' => $billingAddress->getPostcode(),
135
  );
149
  $formFields = array();
150
  switch ($this->getConfig()->getConfigData('template')) {
151
  case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL:
152
+ $formFields['TP'] = $this->getConfig()->getPayPageTemplate();
153
  break;
154
  case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE:
155
  $formFields['TP'] = $this->getConfig()->getTemplateIdentifier($storeId);
167
  $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor', $storeId);
168
  $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype', $storeId);
169
  $formFields['LOGO'] = $this->getConfig()->getConfigData('logo', $storeId);
170
+ $formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(
171
+ array('redirect' => 'home')
172
+ ) : 'NONE';
173
+ $formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(
174
+ array('redirect' => 'catalog')
175
+ ) : '';
176
  break;
177
  default:
178
  break;
252
  return $this->getRegionsMappingForLatvia();
253
  }
254
 
255
+ return array();
256
  }
257
 
258
  /**
503
 
504
  public function getMandatoryRequestFields(Mage_Sales_Model_Order $order)
505
  {
506
+ $payment = $order->getPayment()->getMethodInstance();
507
+ $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
508
+ $formFields = array();
509
+ $formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());
510
+ $formFields['AMOUNT'] = Mage::helper('ops')->getAmount($order->getBaseGrandTotal());
511
  $formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();
512
+ $formFields['ORDERID'] = $opsOrderId;
513
  $formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();
514
+ $formFields['PM'] = $payment->getOpsCode($order->getPayment());
515
+ $formFields['EMAIL'] = $order->getCustomerEmail();
516
 
517
+ $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();
518
+ $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();
519
  $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
520
+ $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();
521
+
522
+ $formFields['BACKURL'] = $this->getConfig()->getPaymentRetryUrl(
523
+ Mage::helper('ops/payment')->validateOrderForReuse($opsOrderId, $order->getStoreId())
524
+ );
525
 
526
  $formFields['FP_ACTIV'] = $this->isFingerPrintingActive($order) ? '1' : '0';
527
 
538
  protected function isFingerPrintingActive($order)
539
  {
540
  return $this->getConfig()->getDeviceFingerPrinting($order->getStoreId())
541
+ && Mage::getSingleton('customer/session')->getData(
542
+ Netresearch_OPS_Model_Payment_Abstract::FINGERPRINT_CONSENT_SESSION_KEY
543
+ );
544
  }
545
 
546
  /**
547
  * Extracts the order item parameters and puts them in a array like
548
  *
549
+ * @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice $salesObject
550
  *
551
+ * @return mixed[]
552
  */
553
+ public function extractOrderItemParameters($salesObject)
554
  {
555
  $formFields = array();
556
+ $formatAmounts = $salesObject instanceof Mage_Sales_Model_Order_Invoice;
557
  // add order items
558
  $count = 1;
559
+ $addItemCount = function (&$value, $key, $count) use (&$formFields) {
560
+ $formFields[$key . $count] = $value;
561
+ };
562
+ foreach ($salesObject->getAllItems() as $item) {
563
+ if ($this->isNonDataItem($item)) {
564
  continue;
565
  }
566
+
567
+ $itemFields = $this->getItemFormFields($item, $formatAmounts);
568
+ array_walk($itemFields, $addItemCount, $count);
569
  $count++;
570
  }
571
 
572
  // add discount item
573
+ /** @var mixed|false $discountItemFormFields */
574
+ $discountItemFormFields = $this->getDiscountItemFormFields($salesObject, $formatAmounts);
575
+ if ($discountItemFormFields) {
576
+ array_walk($discountItemFormFields, $addItemCount, $count);
577
  $count++;
578
  }
579
 
580
  // add shipping item
581
+ /** @var mixed|false $shippingItemFields */
582
+ $shippingItemFields = $this->getShippingItemFormFields($salesObject, $formatAmounts);
583
+ if ($shippingItemFields) {
584
+ array_walk($shippingItemFields, $addItemCount, $count);
585
  }
586
 
587
  return $formFields;
588
  }
589
 
590
+ /**
591
+ * @param Mage_Sales_Model_Order_Item|Mage_Sales_Model_Order_Invoice_Item $item
592
+ *
593
+ * @return bool
594
+ */
595
+ protected function isNonDataItem($item)
596
+ {
597
+ if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
598
+ $item = $item->getOrderItem();
599
+ }
600
+
601
+ return $item->getParentItemId()
602
+ && $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
603
+ || $item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE;
604
+ }
605
+
606
  /**
607
  * @param Mage_Sales_Model_Order $order
608
  *
624
  /**
625
  * Genereates item array for shipping, returns false if order is virtual
626
  *
627
+ * @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice $salesObject
628
+ * @param bool $formatAmount
629
  *
630
+ * @return mixed[] | false
631
  */
632
+ protected function getShippingItemFormFields($salesObject, $formatAmount = false)
633
  {
634
+
635
+ if ($salesObject instanceof Mage_Sales_Model_Order_Invoice) {
636
+ /** @var Mage_Sales_Model_Order_Invoice $salesObject */
637
+ $order = $salesObject->getOrder();
638
+ } else {
639
+ /** @var Mage_Sales_Model_Order $salesObject */
640
+ $order = $salesObject;
641
+ }
642
+ /** @var string $taxRate */
643
+ $taxRate = str_replace(',', '.', (string)(float)$this->getShippingTaxRate($order)) . '%';
644
+
645
+ if ($order->getIsNotVirtual() && 0 < $salesObject->getBaseShippingInclTax()) {
646
+ $formFields = array();
647
+
648
+ if ($formatAmount) {
649
+ $amount = Mage::helper('ops')->getAmount($salesObject->getBaseShippingInclTax());
650
+ } else {
651
+ $amount = number_format($salesObject->getBaseShippingInclTax(), 2, '.', '');
652
+ }
653
+
654
  /* add shipping item */
655
+ $formFields['ITEMID'] = 'SHIPPING';
656
+ $formFields['ITEMNAME'] = substr($order->getShippingDescription(), 0, 25);
657
+ $formFields['ITEMPRICE'] = $amount;
658
+ $formFields['TAXINCLUDED'] = 1;
659
+ $formFields['ITEMQUANT'] = 1;
660
+ $formFields['ITEMVATCODE'] = $taxRate;
661
+
662
  return $formFields;
663
  }
664
 
668
  /**
669
  * Returns item array for PayEngine request for the specified item
670
  *
671
+ * @param Mage_Sales_Model_Order_Invoice_Item|Mage_Sales_Model_Order_Item $item
672
+ * @param bool $formatAmount
673
  *
674
  * @return array
675
  */
676
+ protected function getItemFormFields($item, $formatAmount = false)
677
  {
678
  $formFields = array();
679
+ $formFields['ITEMID'] = $item->getItemId() ?: $item->getOrderItemId();
680
+ $formFields['ITEMNAME'] = substr($item->getName(), 0, 40);
681
+ if ($formatAmount) {
682
+ $amount = Mage::helper('ops')->getAmount($item->getBasePriceInclTax());
683
+ } else {
684
+ $amount = number_format($item->getBasePriceInclTax(), 2, '.', '');
685
+ }
686
+ $formFields['ITEMPRICE'] = $amount;
687
+ $formFields['ITEMQUANT'] = (int)$item->getQtyOrdered() ?: $item->getQty();
688
+ $formFields['ITEMVATCODE'] = str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
689
+ $formFields['TAXINCLUDED'] = 1;
690
 
691
  return $formFields;
692
  }
694
  /**
695
  * Creates array
696
  *
697
+ * @param Mage_Sales_Model_Abstract $salesObject
698
+ * @param bool $formatAmount
699
  *
700
+ * @return bool|mixed[]
701
  */
702
+ protected function getDiscountItemFormFields(Mage_Sales_Model_Abstract $salesObject, $formatAmount = false)
703
  {
704
  $formFields = array();
705
+ if ($salesObject instanceof Mage_Sales_Model_Order_Invoice) {
706
+ $order = $salesObject->getOrder();
707
+ } else {
708
+ $order = $salesObject;
709
+ }
710
+ /** @var Mage_Sales_Model_Order $order */
711
  /* add coupon item */
712
+ if ($salesObject->getBaseDiscountAmount() != 0.00) {
 
 
713
  $couponRuleName = 'DISCOUNT';
714
  if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
715
  $couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
716
  }
717
+
718
+ if ($formatAmount) {
719
+ $couponAmount = Mage::helper('ops')->getAmount($salesObject->getBaseDiscountAmount());
720
+ } else {
721
+ $couponAmount = number_format($salesObject->getBaseDiscountAmount(), 2, '.', '');
722
+ }
723
+
724
+ $formFields['ITEMID'] = 'DISCOUNT';
725
+ $formFields['ITEMNAME'] = $couponRuleName;
726
+ $formFields['ITEMPRICE'] = $couponAmount;
727
+ $formFields['ITEMQUANT'] = 1;
728
+ $formFields['ITEMVATCODE']
729
  = str_replace(',', '.', (string)(float)$this->getShippingTaxRate($order)) . '%';
730
+ $formFields['TAXINCLUDED'] = 1;
731
+
732
  return $formFields;
733
 
734
  }
735
+
736
  return false;
737
  }
738
+ }
app/code/community/Netresearch/OPS/Helper/Quote.php CHANGED
@@ -22,9 +22,11 @@ class Netresearch_OPS_Helper_Quote extends Mage_Core_Helper_Abstract
22
  */
23
  public function cleanUpOldPaymentInformation()
24
  {
25
- $allowedTimestamp = new Zend_Db_Expr(sprintf(
26
- 'NOW() - INTERVAL %d MINUTE', self::MINUTES_IN_PAST
27
- ));
 
 
28
  /*
29
  * fetching possible affected information from the sales_quote_payment table
30
  * criteria are:
@@ -42,7 +44,7 @@ class Netresearch_OPS_Helper_Quote extends Mage_Core_Helper_Abstract
42
  ->setOrder('created_at', 'DESC')
43
  ->setPageSize(self::PAGE_SIZE);
44
  foreach ($paymentInformation as $payment) {
45
- if (!is_null($payment->getAdditionalInformation('cvc'))) {
46
  // quote needs to be loaded, because saving the payment information would fail otherwise
47
  $payment->setQuote(
48
  Mage::getModel('sales/quote')->load($payment->getQuoteId())
22
  */
23
  public function cleanUpOldPaymentInformation()
24
  {
25
+ $allowedTimestamp = new Zend_Db_Expr(
26
+ sprintf(
27
+ 'NOW() - INTERVAL %d MINUTE', self::MINUTES_IN_PAST
28
+ )
29
+ );
30
  /*
31
  * fetching possible affected information from the sales_quote_payment table
32
  * criteria are:
44
  ->setOrder('created_at', 'DESC')
45
  ->setPageSize(self::PAGE_SIZE);
46
  foreach ($paymentInformation as $payment) {
47
+ if (null != $payment->getAdditionalInformation('cvc')) {
48
  // quote needs to be loaded, because saving the payment information would fail otherwise
49
  $payment->setQuote(
50
  Mage::getModel('sales/quote')->load($payment->getQuoteId())
app/code/community/Netresearch/OPS/Helper/Subscription.php CHANGED
@@ -37,7 +37,7 @@ class Netresearch_OPS_Helper_Subscription extends Mage_Core_Helper_Abstract
37
  * SUB-subscriptionId-TRIAL
38
  *
39
  * @param Mage_Payment_Model_Recurring_Profile $profile - the profile itself
40
- * @param bool $withTrial - if you wish the trial suffix appended in case the profile has a trial subscription
41
  *
42
  * @return string
43
  */
37
  * SUB-subscriptionId-TRIAL
38
  *
39
  * @param Mage_Payment_Model_Recurring_Profile $profile - the profile itself
40
+ * @param bool $withTrial - if you wish the trial suffix appended in case the profile has a trial subscription
41
  *
42
  * @return string
43
  */
app/code/community/Netresearch/OPS/Helper/Validation/Checkout/Step.php CHANGED
@@ -13,43 +13,51 @@ class Netresearch_OPS_Helper_Validation_Checkout_Step
13
 
14
  const SHIPPING_STEP = 'shipping';
15
 
 
 
 
 
16
  /**
17
  * retrieves the params for pushing back to the billing step
18
  *
19
  * @return array
20
  */
21
- protected function getBillingParams()
22
  {
23
- return array(
24
- 'CN',
25
- 'OWNERZIP',
26
- 'OWNERTOWN',
27
- 'OWNERTELNO',
28
- 'OWNERADDRESS',
29
- 'ECOM_BILLTO_POSTAL_POSTALCODE'
30
- );
 
 
 
 
 
31
  }
32
 
33
- /**
34
- * retrieves the params for pushing back to the billing step
35
- *
36
- * @return array
37
- */
38
- protected function getShippingParams()
39
  {
40
- return array(
41
- 'ECOM_SHIPTO_POSTAL_NAME_FIRST',
42
- 'ECOM_SHIPTO_POSTAL_NAME_LAST',
43
- 'ECOM_SHIPTO_POSTAL_STREET1',
44
- 'ECOM_SHIPTO_POSTAL_STREET2',
45
- 'ECOM_SHIPTO_POSTAL_STREET3',
46
- 'ECOM_SHIPTO_POSTAL_COUNTRYCODE',
47
- 'ECOM_SHIPTO_POSTAL_COUNTY',
48
- 'ECOM_SHIPTO_POSTAL_POSTALCODE',
49
- 'ECOM_SHIPTO_POSTAL_CITY',
50
- 'ECOM_SHIPTO_POSTAL_STREET_NUMBER',
51
- 'ECOM_SHIPTO_POSTAL_STATE'
52
- );
 
 
 
53
  }
54
 
55
  /**
@@ -62,16 +70,29 @@ class Netresearch_OPS_Helper_Validation_Checkout_Step
62
  public function getStep(array $erroneousFields)
63
  {
64
  $checkoutStep = '';
 
65
  foreach ($erroneousFields as $erroneousField) {
66
- if (in_array($erroneousField, $this->getBillingParams())) {
 
 
67
  $checkoutStep = self::BILLING_STEP;
68
  break;
69
  }
70
- if (in_array($erroneousField, $this->getShippingParams())) {
 
 
71
  $checkoutStep = self::SHIPPING_STEP;
72
  }
73
  }
74
 
75
  return $checkoutStep;
76
  }
 
 
 
 
 
 
 
 
77
  }
13
 
14
  const SHIPPING_STEP = 'shipping';
15
 
16
+ const BILLING_PARAMETER_STRING_VALUE = 'billing';
17
+
18
+ const SHIPPING_PARAMETER_STRING_VALUE = 'shipping';
19
+
20
  /**
21
  * retrieves the params for pushing back to the billing step
22
  *
23
  * @return array
24
  */
25
+ protected function determineStep()
26
  {
27
+ $result = array();
28
+ $mappedParams = $this->getMappedParams();
29
+
30
+ foreach ($mappedParams as $paramName => $value) {
31
+ if (strpos($value, self::BILLING_PARAMETER_STRING_VALUE) === 0) {
32
+ $result[self::BILLING_PARAMETER_STRING_VALUE][] = $paramName;
33
+ }
34
+ if (strpos($value, self::SHIPPING_PARAMETER_STRING_VALUE) === 0) {
35
+ $result[self::SHIPPING_STEP][] = $paramName;
36
+ }
37
+ }
38
+
39
+ return $result;
40
  }
41
 
42
+
43
+ protected function getMappedParams()
 
 
 
 
44
  {
45
+ $result = array();
46
+ $paramLengthFields = $this->getConfig()->getParameterLengths();
47
+ $frontendFieldMapping = $this->getConfig()->getFrontendFieldMapping();
48
+
49
+ foreach (array_keys($paramLengthFields) as $key) {
50
+ if (isset($frontendFieldMapping[$key])) {
51
+ $frontendField = !is_array($frontendFieldMapping[$key])
52
+ ? $frontendFieldMapping[$key]
53
+ : implode(
54
+ ',', $frontendFieldMapping[$key]
55
+ );
56
+ $result[$key] = $frontendField;
57
+ }
58
+ }
59
+
60
+ return $result;
61
  }
62
 
63
  /**
70
  public function getStep(array $erroneousFields)
71
  {
72
  $checkoutStep = '';
73
+ $stepParams = $this->determineStep();
74
  foreach ($erroneousFields as $erroneousField) {
75
+ if (isset($stepParams[self::BILLING_STEP])
76
+ && in_array($erroneousField, $stepParams[self::BILLING_STEP])
77
+ ) {
78
  $checkoutStep = self::BILLING_STEP;
79
  break;
80
  }
81
+ if (isset($stepParams[self::SHIPPING_STEP])
82
+ && in_array($erroneousField, $stepParams[self::SHIPPING_STEP])
83
+ ) {
84
  $checkoutStep = self::SHIPPING_STEP;
85
  }
86
  }
87
 
88
  return $checkoutStep;
89
  }
90
+
91
+ /**
92
+ * @return Netresearch_OPS_Model_Config
93
+ */
94
+ protected function getConfig()
95
+ {
96
+ return Mage::getModel('ops/config');
97
+ }
98
  }
app/code/community/Netresearch/OPS/Helper/Validation/Result.php CHANGED
@@ -107,7 +107,7 @@ class Netresearch_OPS_Helper_Validation_Result
107
  }
108
 
109
  /**
110
- * @return null
111
  */
112
  public function getFormBlock()
113
  {
@@ -139,7 +139,6 @@ class Netresearch_OPS_Helper_Validation_Result
139
 
140
  /**
141
  * @param $messages
142
- * @param $result
143
  *
144
  * @return mixed
145
  */
@@ -163,8 +162,10 @@ class Netresearch_OPS_Helper_Validation_Result
163
  }
164
 
165
  /**
166
- * @param $quote
167
- * @param $gotoSection
 
 
168
  */
169
  protected function addErrorToExistingAddress($quote, $gotoSection)
170
  {
@@ -183,9 +184,8 @@ class Netresearch_OPS_Helper_Validation_Result
183
  }
184
 
185
  /**
186
- * @param $messages
187
- * @param $result
188
- * @param $gotoSection
189
  *
190
  * @return mixed
191
  */
107
  }
108
 
109
  /**
110
+ * @return Netresearch_OPS_Block_Form
111
  */
112
  public function getFormBlock()
113
  {
139
 
140
  /**
141
  * @param $messages
 
142
  *
143
  * @return mixed
144
  */
162
  }
163
 
164
  /**
165
+ * @param Mage_Sales_Model_Quote $quote
166
+ * @param string $gotoSection
167
+ *
168
+ * @return $this
169
  */
170
  protected function addErrorToExistingAddress($quote, $gotoSection)
171
  {
184
  }
185
 
186
  /**
187
+ * @param string[] $messages
188
+ * @param string $gotoSection
 
189
  *
190
  * @return mixed
191
  */
app/code/community/Netresearch/OPS/Model/Alias.php CHANGED
@@ -44,19 +44,25 @@ class Netresearch_OPS_Model_Alias extends Mage_Core_Model_Abstract
44
  /**
45
  * @param $customerId - the id of the customer
46
  * @param $billingAddressHash - optional billing address hash
47
- * @param $shippingAdressHash - optional shipping address hash
 
 
48
  * @return Netresearch_OPS_Model_Mysql4_Alias_Collection - collection of aliases for given customer
49
  */
50
- public function getAliasesForCustomer($customerId, $billingAddressHash = null, $shippingAddressHash = null, $storeId = null)
 
 
 
 
 
51
  {
52
  $collection = $this->getCollection()
53
  ->addFieldToFilter('customer_id', $customerId);
54
- if (!is_null($billingAddressHash) && !is_null($shippingAddressHash)) {
55
  $collection
56
  ->addFieldToFilter('billing_address_hash', $billingAddressHash)
57
  ->addFieldToFilter('shipping_address_hash', $shippingAddressHash)
58
- ->addFieldToFilter('store_id', array('eq' => $storeId, 'null' => 'null'))
59
- ;
60
  }
61
  return $collection->load();
62
  }
44
  /**
45
  * @param $customerId - the id of the customer
46
  * @param $billingAddressHash - optional billing address hash
47
+ * @param $shippingAddressHash - optional shipping address hash
48
+ * @param $storeId
49
+ *
50
  * @return Netresearch_OPS_Model_Mysql4_Alias_Collection - collection of aliases for given customer
51
  */
52
+ public function getAliasesForCustomer(
53
+ $customerId,
54
+ $billingAddressHash = null,
55
+ $shippingAddressHash = null,
56
+ $storeId = null
57
+ )
58
  {
59
  $collection = $this->getCollection()
60
  ->addFieldToFilter('customer_id', $customerId);
61
+ if (null != $billingAddressHash && null != $shippingAddressHash) {
62
  $collection
63
  ->addFieldToFilter('billing_address_hash', $billingAddressHash)
64
  ->addFieldToFilter('shipping_address_hash', $shippingAddressHash)
65
+ ->addFieldToFilter('store_id', array('eq' => $storeId, 'null' => 'null'));
 
66
  }
67
  return $collection->load();
68
  }
app/code/community/Netresearch/OPS/Model/Api/Directlink.php CHANGED
@@ -36,6 +36,8 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
36
  * Perform a CURL call and log request end response to logfile
37
  *
38
  * @param array $params
 
 
39
  * @return mixed
40
  */
41
  public function call($params, $url)
@@ -47,36 +49,47 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
47
  $http->write(Zend_Http_Client::POST, $url, '1.1', array(), http_build_query($params));
48
  $response = $http->read();
49
  $response = substr($response, strpos($response, "<?xml"), strlen($response));
50
-
51
- return $response;
52
- } catch (Exception $e) {
53
  Mage::logException($e);
54
  Mage::throwException(
55
  Mage::helper('ops')->__('PayEngine server is temporarily not available, please try again later.')
56
  );
57
- }
 
 
58
  }
59
 
60
  /**
61
  * Performs a POST request to the Direct Link Gateway with the given
62
  * parameters and returns the result parameters as array
63
  *
64
- * @param array $params
 
 
 
65
  * @return array
66
  */
67
  public function performRequest($requestParams, $url, $storeId = 0)
68
  {
69
  $helper = Mage::helper('ops');
70
  $params = $this->getEncodedParametersWithHash(
71
- array_merge($requestParams,$this->buildAuthenticationParams($storeId)) //Merge Logic Operation Data with Authentication Data
72
- , null, $storeId);
 
 
 
 
 
73
  $responseParams = $this->getResponseParams($params, $url);
74
- $helper->log($helper->__("Direct Link Request/Response in PayEngine \n\nRequest: %s\nResponse: %s\nMagento-URL: %s\nAPI-URL: %s",
75
- serialize($params),
76
- serialize($responseParams),
77
- Mage::helper('core/url')->getCurrentUrl(),
78
- $url
79
- ));
 
 
 
80
 
81
  $this->checkResponse($responseParams);
82
 
@@ -122,7 +135,8 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
122
  } elseif (array_key_exists('PAYID', $params)) {
123
  $ref = $params['PAYID'];
124
  }
125
- Mage::helper('ops')->log('DirectLink::getResponseParams failed: ' .
 
126
  $e->getMessage() . ' current retry count: ' . $retryCount . ' for quote ' . $ref
127
  );
128
  $responseParams = $this->getResponseParams($params, $url, ++$retryCount);
@@ -137,6 +151,8 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
137
  /**
138
  * Return Authentication Params for OPS Call
139
  *
 
 
140
  * @return array
141
  */
142
  protected function buildAuthenticationParams($storeId = 0)
@@ -148,11 +164,12 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
148
  );
149
  }
150
 
151
- /**
152
  * Parses the XML-String to an array with the result data
153
  *
154
- * @param string xmlString
155
- * @return array
 
156
  */
157
  public function getParamArrFromXmlString($xmlString)
158
  {
@@ -171,16 +188,19 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
171
  throw $e;
172
  }
173
  }
174
-
175
- /**
176
  * Check if the Response from OPS reports Errors
177
  *
178
- * @param array $responseParams
179
- * @return mixed
180
  */
181
  public function checkResponse($responseParams)
182
  {
183
- if (false === is_array($responseParams) || false === array_key_exists('NCERROR', $responseParams) || $responseParams['NCERROR'] > 0) {
 
 
 
 
184
  if (empty($responseParams['NCERRORPLUS'])) {
185
  $responseParams['NCERRORPLUS'] = Mage::helper('ops')->__('Invalid payment information')." Errorcode:".$responseParams['NCERROR'];
186
  }
@@ -191,7 +211,7 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
191
  }
192
 
193
  Mage::throwException(
194
- Mage::helper('ops')->__("An error occured during the PayEngine request. Your action could not be executed. Message: '%s.'",$responseParams['NCERRORPLUS'])
195
  );
196
  }
197
  }
36
  * Perform a CURL call and log request end response to logfile
37
  *
38
  * @param array $params
39
+ * @param string $url
40
+ *
41
  * @return mixed
42
  */
43
  public function call($params, $url)
49
  $http->write(Zend_Http_Client::POST, $url, '1.1', array(), http_build_query($params));
50
  $response = $http->read();
51
  $response = substr($response, strpos($response, "<?xml"), strlen($response));
52
+ } catch (Exception $e) {
 
 
53
  Mage::logException($e);
54
  Mage::throwException(
55
  Mage::helper('ops')->__('PayEngine server is temporarily not available, please try again later.')
56
  );
57
+ }
58
+
59
+ return $response;
60
  }
61
 
62
  /**
63
  * Performs a POST request to the Direct Link Gateway with the given
64
  * parameters and returns the result parameters as array
65
  *
66
+ * @param array $requestParams
67
+ * @param string $url
68
+ * @param int $storeId
69
+ *
70
  * @return array
71
  */
72
  public function performRequest($requestParams, $url, $storeId = 0)
73
  {
74
  $helper = Mage::helper('ops');
75
  $params = $this->getEncodedParametersWithHash(
76
+ array_merge(
77
+ $requestParams,
78
+ $this->buildAuthenticationParams($storeId)
79
+ ),//Merge Logic Operation Data with Authentication Data
80
+ null,
81
+ $storeId
82
+ );
83
  $responseParams = $this->getResponseParams($params, $url);
84
+ $helper->log(
85
+ $helper->__(
86
+ "Direct Link Request/Response in PayEngine \n\nRequest: %s\nResponse: %s\nMagento-URL: %s\nAPI-URL: %s",
87
+ serialize($params),
88
+ serialize($responseParams),
89
+ Mage::helper('core/url')->getCurrentUrl(),
90
+ $url
91
+ )
92
+ );
93
 
94
  $this->checkResponse($responseParams);
95
 
135
  } elseif (array_key_exists('PAYID', $params)) {
136
  $ref = $params['PAYID'];
137
  }
138
+ Mage::helper('ops')->log(
139
+ 'DirectLink::getResponseParams failed: ' .
140
  $e->getMessage() . ' current retry count: ' . $retryCount . ' for quote ' . $ref
141
  );
142
  $responseParams = $this->getResponseParams($params, $url, ++$retryCount);
151
  /**
152
  * Return Authentication Params for OPS Call
153
  *
154
+ * @param int $storeId
155
+ *
156
  * @return array
157
  */
158
  protected function buildAuthenticationParams($storeId = 0)
164
  );
165
  }
166
 
167
+ /**
168
  * Parses the XML-String to an array with the result data
169
  *
170
+ * @param $xmlString
171
+ * @return mixed
172
+ * @throws Exception
173
  */
174
  public function getParamArrFromXmlString($xmlString)
175
  {
188
  throw $e;
189
  }
190
  }
191
+
192
+ /**
193
  * Check if the Response from OPS reports Errors
194
  *
195
+ * @param $responseParams
 
196
  */
197
  public function checkResponse($responseParams)
198
  {
199
+ if (false === is_array($responseParams)
200
+ || false === array_key_exists('NCERROR', $responseParams)
201
+ || $responseParams['NCERROR'] > 0
202
+ )
203
+ {
204
  if (empty($responseParams['NCERRORPLUS'])) {
205
  $responseParams['NCERRORPLUS'] = Mage::helper('ops')->__('Invalid payment information')." Errorcode:".$responseParams['NCERROR'];
206
  }
211
  }
212
 
213
  Mage::throwException(
214
+ Mage::helper('ops')->__("An error occured during the PayEngine request. Your action could not be executed. Message: '%s.'", $responseParams['NCERRORPLUS'])
215
  );
216
  }
217
  }
app/code/community/Netresearch/OPS/Model/Backend/Operation/Capture/Parameter.php CHANGED
@@ -20,7 +20,8 @@ class Netresearch_OPS_Model_Backend_Operation_Capture_Parameter
20
  {
21
  $opsPaymentMethodClass = get_class($opsPaymentMethod);
22
  $opsPmsRequiringSpecialParams = $this->getOpsConfig()
23
- ->getMethodsRequiringAdditionalParametersFor(Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE
 
24
  );
25
 
26
  return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
@@ -33,7 +34,7 @@ class Netresearch_OPS_Model_Backend_Operation_Capture_Parameter
33
  */
34
  protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
35
  {
36
- if ($opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_OpenInvoiceNl) {
37
  $this->additionalParamsModel = Mage::getModel('ops/backend_operation_capture_additional_openInvoiceNl');
38
  }
39
  }
20
  {
21
  $opsPaymentMethodClass = get_class($opsPaymentMethod);
22
  $opsPmsRequiringSpecialParams = $this->getOpsConfig()
23
+ ->getMethodsRequiringAdditionalParametersFor(
24
+ Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE
25
  );
26
 
27
  return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
34
  */
35
  protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
36
  {
37
+ if ($opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_OpenInvoice_Abstract) {
38
  $this->additionalParamsModel = Mage::getModel('ops/backend_operation_capture_additional_openInvoiceNl');
39
  }
40
  }
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter.php CHANGED
@@ -19,7 +19,6 @@ class Netresearch_OPS_Model_Backend_Operation_Parameter
19
  * @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
20
  * @param Varien_Object $payment
21
  * @param $amount
22
- * @param $arrInfo
23
  *
24
  * @return array
25
  */
@@ -28,7 +27,8 @@ class Netresearch_OPS_Model_Backend_Operation_Parameter
28
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
29
  Varien_Object $payment,
30
  $amount
31
- ) {
 
32
  return $this->getParameterModel($operation)->getRequestParams($opsPaymentMethod, $payment, $amount);
33
  }
34
 
@@ -46,7 +46,7 @@ class Netresearch_OPS_Model_Backend_Operation_Parameter
46
  if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
47
  return Mage::getModel('ops/backend_operation_capture_parameter');
48
  }
49
- if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE){
50
  return Mage::getModel('ops/backend_operation_refund_parameter');
51
  }
52
 
19
  * @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
20
  * @param Varien_Object $payment
21
  * @param $amount
 
22
  *
23
  * @return array
24
  */
27
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
28
  Varien_Object $payment,
29
  $amount
30
+ )
31
+ {
32
  return $this->getParameterModel($operation)->getRequestParams($opsPaymentMethod, $payment, $amount);
33
  }
34
 
46
  if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
47
  return Mage::getModel('ops/backend_operation_capture_parameter');
48
  }
49
+ if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE) {
50
  return Mage::getModel('ops/backend_operation_refund_parameter');
51
  }
52
 
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Abstract.php CHANGED
@@ -27,8 +27,9 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
27
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
28
  Varien_Object $payment,
29
  $amount
30
- ) {
31
- $this->getBaseParams($opsPaymentMethod, $payment, $amount );
 
32
  $this->addPmSpecificParams($opsPaymentMethod, $payment, $amount);
33
 
34
  return $this->requestParams;
@@ -40,7 +41,6 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
40
  * @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
41
  * @param Varien_Object $payment
42
  * @param $amount
43
- * @param $arrInfo
44
  *
45
  * @return $this
46
  */
@@ -48,11 +48,12 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
48
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
49
  Varien_Object $payment,
50
  $amount
51
- ) {
52
- $this->requestParams['AMOUNT'] = $this->getDataHelper()->getAmount($amount);
53
- $this->requestParams['PAYID'] = $payment->getAdditionalInformation('paymentId');
 
54
  $this->requestParams['OPERATION'] = $this->getOrderHelper()->determineOperationCode($payment, $amount);
55
- $this->requestParams['CURRENCY'] = Mage::app()->getStore($payment->getOrder()->getStoreId())
56
  ->getBaseCurrencyCode();
57
 
58
  return $this;
@@ -83,13 +84,14 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
83
  */
84
  protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
85
  Varien_Object $payment, $amount
86
- ) {
 
87
  if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
88
  $this->setAdditionalParamsModelFor($opsPaymentMethod);
89
  if ($this->additionalParamsModel instanceof
90
  Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
91
  ) {
92
- $params = $this->additionalParamsModel->extractAdditionalParams($payment->getInvoice());
93
  $this->requestParams = array_merge($this->requestParams, $params);
94
  }
95
  }
27
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
28
  Varien_Object $payment,
29
  $amount
30
+ )
31
+ {
32
+ $this->getBaseParams($opsPaymentMethod, $payment, $amount);
33
  $this->addPmSpecificParams($opsPaymentMethod, $payment, $amount);
34
 
35
  return $this->requestParams;
41
  * @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
42
  * @param Varien_Object $payment
43
  * @param $amount
 
44
  *
45
  * @return $this
46
  */
48
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
49
  Varien_Object $payment,
50
  $amount
51
+ )
52
+ {
53
+ $this->requestParams['AMOUNT'] = $this->getDataHelper()->getAmount($amount);
54
+ $this->requestParams['PAYID'] = $payment->getAdditionalInformation('paymentId');
55
  $this->requestParams['OPERATION'] = $this->getOrderHelper()->determineOperationCode($payment, $amount);
56
+ $this->requestParams['CURRENCY'] = Mage::app()->getStore($payment->getOrder()->getStoreId())
57
  ->getBaseCurrencyCode();
58
 
59
  return $this;
84
  */
85
  protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
86
  Varien_Object $payment, $amount
87
+ )
88
+ {
89
  if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
90
  $this->setAdditionalParamsModelFor($opsPaymentMethod);
91
  if ($this->additionalParamsModel instanceof
92
  Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
93
  ) {
94
+ $params = $this->additionalParamsModel->extractAdditionalParams($payment);
95
  $this->requestParams = array_merge($this->requestParams, $params);
96
  }
97
  }
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/Interface.php CHANGED
@@ -7,5 +7,5 @@
7
  */
8
  interface Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
9
  {
10
- public function extractAdditionalParams(Mage_Sales_Model_Abstract $itemContainer);
11
  }
7
  */
8
  interface Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
9
  {
10
+ public function extractAdditionalParams(Mage_Sales_Model_Order_Payment $payment);
11
  }
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/OpenInvoiceNlAbstract.php CHANGED
@@ -6,65 +6,68 @@
6
  * @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
  */
9
-
10
  abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
11
  implements Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
12
  {
13
- protected $additionalParams = array();
14
- protected $opsDataHelper = null;
15
- protected $itemIdx = 1;
16
 
17
 
18
  /**
19
- * @param Mage_Sales_Model_Abstract $itemContainer
20
  *
21
  * @return array
22
  */
23
- public function extractAdditionalParams(Mage_Sales_Model_Abstract $itemContainer)
24
  {
 
25
  if ($itemContainer instanceof Mage_Sales_Model_Order_Invoice) {
26
- $this->extractFromInvoiceItems($itemContainer);
27
- $this->extractFromDiscountData($itemContainer);
28
- $this->extractFromInvoicedShippingMethod($itemContainer);
29
  }
30
 
31
- return $this->additionalParams;
32
  }
33
 
34
  /**
 
 
35
  * extracts all necessary data from the invoice items
36
  *
37
  * @param Mage_Sales_Model_Order_Invoice $invoice
 
 
38
  */
39
  protected function extractFromInvoiceItems(Mage_Sales_Model_Order_Invoice $invoice)
40
  {
41
  foreach ($invoice->getItemsCollection() as $item) {
42
  /** @var $item Mage_Sales_Model_Order_Invoice_Item */
43
  // filter out configurable products
44
- if ($item->getParentItemId()
45
- && $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
46
- || $item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
47
  continue;
48
  }
49
- $this->additionalParams['ITEMID' . $this->itemIdx] = substr($item->getOrderItemId(), 0, 15);
50
- $this->additionalParams['ITEMNAME' . $this->itemIdx] = substr($item->getName(), 0, 30);
51
- $this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount(
52
- $item->getBasePriceInclTax()
53
  );
54
- $this->additionalParams['ITEMQUANT' . $this->itemIdx] = $item->getQty();
55
- $this->additionalParams['ITEMVATCODE' . $this->itemIdx]
56
- =
57
- str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
58
- $this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
59
- ++$this->itemIdx;
60
  }
61
 
62
  return $this;
63
  }
64
 
 
65
  /**
66
  * extract the necessary data from the shipping data of the invoice
67
  *
 
 
68
  * @param Mage_Sales_Model_Order_Invoice $invoice
69
  *
70
  * @return $this
@@ -73,14 +76,14 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
73
  {
74
  $amount = $invoice->getBaseShippingInclTax();
75
  if (0 < $amount) {
76
- $this->additionalParams['ITEMID' . $this->itemIdx] = 'SHIPPING';
77
- $this->additionalParams['ITEMNAME' . $this->itemIdx] =
78
- substr($invoice->getOrder()->getShippingDescription(), 0, 30);
79
- $this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount($amount);
80
- $this->additionalParams['ITEMQUANT' . $this->itemIdx] = 1;
81
- $this->additionalParams['ITEMVATCODE' . $this->itemIdx] = $this->getShippingTaxRate($invoice) . '%';
82
- $this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
83
- ++$this->itemIdx;
84
  }
85
 
86
 
@@ -88,6 +91,8 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
88
  }
89
 
90
  /**
 
 
91
  * retrieves used shipping tax rate
92
  *
93
  * @param Mage_Sales_Model_Order_Invoice $invoice
@@ -96,8 +101,8 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
96
  */
97
  protected function getShippingTaxRate(Mage_Sales_Model_Order_Invoice $invoice)
98
  {
99
- $taxRate = 0.0;
100
- $order = $invoice->getOrder();
101
 
102
  $taxRate = (floatval(Mage::helper('ops/payment_request')->getShippingTaxRate($order)));
103
 
@@ -112,33 +117,35 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
112
  */
113
  protected function getOpsDataHelper()
114
  {
115
- if (null === $this->opsDataHelper) {
116
- $this->opsDataHelper = Mage::helper('ops/data');
117
  }
118
 
119
- return $this->opsDataHelper;
120
  }
121
 
122
 
123
  /**
124
- * @param $itemContainer
 
 
125
  */
126
  protected function extractFromDiscountData($invoice)
127
  {
128
  $amount = $invoice->getBaseDiscountAmount();
129
  if (0 > $amount) {
130
  $couponRuleName = 'DISCOUNT';
131
- $order = $invoice->getOrder();
132
  if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
133
  $couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
134
  }
135
- $this->additionalParams['ITEMID' . $this->itemIdx] = 'DISCOUNT';
136
- $this->additionalParams['ITEMNAME' . $this->itemIdx] = $couponRuleName;
137
- $this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount($amount);
138
- $this->additionalParams['ITEMQUANT' . $this->itemIdx] = 1;
139
- $this->additionalParams['ITEMVATCODE' . $this->itemIdx] = $this->getShippingTaxRate($invoice) . '%';
140
- $this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
141
- ++$this->itemIdx;
142
  }
143
  }
144
  }
6
  * @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
  */
 
9
  abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
10
  implements Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
11
  {
12
+ protected $_additionalParams = array();
13
+ protected $_opsDataHelper = null;
14
+ protected $_itemIdx = 1;
15
 
16
 
17
  /**
18
+ * @param Mage_Sales_Model_Order_Payment $payment
19
  *
20
  * @return array
21
  */
22
+ public function extractAdditionalParams(Mage_Sales_Model_Order_Payment $payment)
23
  {
24
+ $itemContainer = $payment->getInvoice();
25
  if ($itemContainer instanceof Mage_Sales_Model_Order_Invoice) {
26
+ $requestHelper = Mage::helper('ops/payment_request');
27
+ $this->_additionalParams = $requestHelper->extractOrderItemParameters($itemContainer);
 
28
  }
29
 
30
+ return $this->_additionalParams;
31
  }
32
 
33
  /**
34
+ * @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
35
+ *
36
  * extracts all necessary data from the invoice items
37
  *
38
  * @param Mage_Sales_Model_Order_Invoice $invoice
39
+ *
40
+ * @return Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
41
  */
42
  protected function extractFromInvoiceItems(Mage_Sales_Model_Order_Invoice $invoice)
43
  {
44
  foreach ($invoice->getItemsCollection() as $item) {
45
  /** @var $item Mage_Sales_Model_Order_Invoice_Item */
46
  // filter out configurable products
47
+ if (!$this->isDataItem($item)) {
 
 
48
  continue;
49
  }
50
+ $this->_additionalParams['ITEMID' . $this->_itemIdx] = substr($item->getOrderItemId(), 0, 15);
51
+ $this->_additionalParams['ITEMNAME' . $this->_itemIdx] = substr($item->getName(), 0, 30);
52
+ $this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount(
53
+ $item->getBasePriceInclTax()
54
  );
55
+ $this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = $item->getQty();
56
+ $this->_additionalParams['ITEMVATCODE' . $this->_itemIdx]
57
+ = str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
58
+ $this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
59
+ ++$this->_itemIdx;
 
60
  }
61
 
62
  return $this;
63
  }
64
 
65
+
66
  /**
67
  * extract the necessary data from the shipping data of the invoice
68
  *
69
+ * @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
70
+ *
71
  * @param Mage_Sales_Model_Order_Invoice $invoice
72
  *
73
  * @return $this
76
  {
77
  $amount = $invoice->getBaseShippingInclTax();
78
  if (0 < $amount) {
79
+ $this->_additionalParams['ITEMID' . $this->_itemIdx] = 'SHIPPING';
80
+ $this->_additionalParams['ITEMNAME' . $this->_itemIdx]
81
+ = substr($invoice->getOrder()->getShippingDescription(), 0, 30);
82
+ $this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount($amount);
83
+ $this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
84
+ $this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
85
+ $this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
86
+ ++$this->_itemIdx;
87
  }
88
 
89
 
91
  }
92
 
93
  /**
94
+ * @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
95
+ *
96
  * retrieves used shipping tax rate
97
  *
98
  * @param Mage_Sales_Model_Order_Invoice $invoice
101
  */
102
  protected function getShippingTaxRate(Mage_Sales_Model_Order_Invoice $invoice)
103
  {
104
+ $taxRate = 0.0;
105
+ $order = $invoice->getOrder();
106
 
107
  $taxRate = (floatval(Mage::helper('ops/payment_request')->getShippingTaxRate($order)));
108
 
117
  */
118
  protected function getOpsDataHelper()
119
  {
120
+ if (null === $this->_opsDataHelper) {
121
+ $this->_opsDataHelper = Mage::helper('ops/data');
122
  }
123
 
124
+ return $this->_opsDataHelper;
125
  }
126
 
127
 
128
  /**
129
+ * @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
130
+ *
131
+ * @param $invoice
132
  */
133
  protected function extractFromDiscountData($invoice)
134
  {
135
  $amount = $invoice->getBaseDiscountAmount();
136
  if (0 > $amount) {
137
  $couponRuleName = 'DISCOUNT';
138
+ $order = $invoice->getOrder();
139
  if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
140
  $couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
141
  }
142
+ $this->_additionalParams['ITEMID' . $this->_itemIdx] = 'DISCOUNT';
143
+ $this->_additionalParams['ITEMNAME' . $this->_itemIdx] = $couponRuleName;
144
+ $this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount($amount);
145
+ $this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
146
+ $this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
147
+ $this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
148
+ ++$this->_itemIdx;
149
  }
150
  }
151
  }
app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Additional/OpenInvoiceNl.php CHANGED
@@ -10,69 +10,63 @@
10
  class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
11
  extends Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
12
  {
13
- protected $creditmemo = array();
 
14
  protected $amount = 0;
15
  protected $refundHelper = null;
16
 
17
  /**
18
- * @param Mage_Sales_Model_Abstract $itemContainer
19
  * @return array
20
  */
21
- public function extractAdditionalParams(Mage_Sales_Model_Abstract $itemContainer = null)
22
  {
23
- $invoice = null;
24
- if ($itemContainer instanceof Mage_Sales_Model_Order_Invoice && $itemContainer) {
25
- $invoice = $itemContainer;
26
- } else if ($itemContainer instanceof Mage_Sales_Block_Order_Creditmemo && $itemContainer){
27
- $invoice = Mage::getModel('sales/order_invoice')->load($itemContainer->getInvoiceId());
28
- }
29
 
30
- if($invoice == null){
31
  // if invoice is not set we load id hard from the request params
32
  $invoice = $this->getRefundHelper()->getInvoiceFromCreditMemoRequest();
33
  }
34
- $this->creditmemo = $this->getRefundHelper()->getCreditMemoFromRequest();
35
 
36
  if ($invoice instanceof Mage_Sales_Model_Order_Invoice) {
37
  $this->extractFromCreditMemoItems($invoice);
38
  // We dont extract from discount data for the moment, because partial refunds are a problem
39
- // $this->extractFromDiscountData($invoice);
40
  $this->extractFromInvoicedShippingMethod($invoice);
41
  $this->extractFromAdjustments($invoice);
42
  // Overwrite amount to fix Magentos rounding problems (eg +1ct)
43
- $this->additionalParams['AMOUNT'] = $this->amount;
44
  }
45
 
46
- return $this->additionalParams;
47
  }
48
 
49
  /**
50
  * extracts all data from the invoice according to the credit memo items
51
  *
52
- * @param $itemContainer
53
  */
54
- protected function extractFromCreditMemoItems(Mage_Sales_Model_Order_Invoice $invoice)
55
  {
56
- foreach ($invoice->getItemsCollection() as $item) {
57
- if (array_key_exists($item->getOrderItemId(), $this->creditmemo['items'])) {
58
- if ($item->getParentItemId()
59
- && $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
60
- || $item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
61
- continue;
62
- }
63
- $this->additionalParams['ITEMID' . $this->itemIdx] = substr($item->getOrderItemId(), 0, 15);
64
- $this->additionalParams['ITEMNAME' . $this->itemIdx] = substr($item->getName(), 0, 30);
65
- $this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount(
66
- $item->getBasePriceInclTax()
67
- );
68
- $this->amount += $this->getOpsDataHelper()->getAmount($item->getBasePriceInclTax()) * $this->creditmemo['items'][$item->getOrderItemId()]['qty'];
69
- $this->additionalParams['ITEMQUANT' . $this->itemIdx] = $this->creditmemo['items'][$item->getOrderItemId()]['qty'];
70
- $this->additionalParams['ITEMVATCODE' . $this->itemIdx]
71
- =
72
- str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
73
- $this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
74
- ++$this->itemIdx;
75
  }
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
  }
@@ -80,16 +74,17 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
80
 
81
  protected function extractFromInvoicedShippingMethod(Mage_Sales_Model_Order_Invoice $invoice)
82
  {
83
- if ($this->creditmemo['shipping_amount'] > 0) {
84
- $this->additionalParams['ITEMID' . $this->itemIdx] = 'SHIPPING';
85
- $this->additionalParams['ITEMNAME' . $this->itemIdx] =
86
  substr($invoice->getOrder()->getShippingDescription(), 0, 30);
87
- $this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount($this->creditmemo['shipping_amount']);
88
- $this->amount += $this->getOpsDataHelper()->getAmount($this->creditmemo['shipping_amount']);
89
- $this->additionalParams['ITEMQUANT' . $this->itemIdx] = 1;
90
- $this->additionalParams['ITEMVATCODE' . $this->itemIdx] = $this->getShippingTaxRate($invoice) . '%';
91
- $this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
92
- ++$this->itemIdx;
 
93
  }
94
 
95
  }
@@ -102,26 +97,28 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
102
  protected function extractFromAdjustments(Mage_Sales_Model_Order_Invoice $invoice)
103
  {
104
 
105
- if ($this->creditmemo['adjustment_positive'] > 0) {
106
- $this->additionalParams['ITEMID' . $this->itemIdx] = 'ADJUSTREFUND';
107
- $this->additionalParams['ITEMNAME' . $this->itemIdx] = 'Adjustment Refund';
108
- $this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount($this->creditmemo['adjustment_positive']);
109
- $this->amount += $this->getOpsDataHelper()->getAmount($this->creditmemo['adjustment_positive']);
110
- $this->additionalParams['ITEMQUANT' . $this->itemIdx] = 1;
111
- $this->additionalParams['ITEMVATCODE' . $this->itemIdx] = $this->getShippingTaxRate($invoice) . '%';
112
- $this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
113
- ++$this->itemIdx;
 
114
 
115
  }
116
- if ($this->creditmemo['adjustment_negative'] > 0) {
117
- $this->additionalParams['ITEMID' . $this->itemIdx] = 'ADJUSTFEE';
118
- $this->additionalParams['ITEMNAME' . $this->itemIdx] = 'Adjustment Fee';
119
- $this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount(-$this->creditmemo['adjustment_negative']);
120
- $this->amount += $this->getOpsDataHelper()->getAmount(-$this->creditmemo['adjustment_negative']);
121
- $this->additionalParams['ITEMQUANT' . $this->itemIdx] = 1;
122
- $this->additionalParams['ITEMVATCODE' . $this->itemIdx] = $this->getShippingTaxRate($invoice) . '%';
123
- $this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
124
- ++$this->itemIdx;
 
125
  }
126
  }
127
 
10
  class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
11
  extends Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
12
  {
13
+ /** @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
14
+ protected $creditmemo = null;
15
  protected $amount = 0;
16
  protected $refundHelper = null;
17
 
18
  /**
19
+ * @param Mage_Sales_Model_Order_Payment $itemContainer
20
  * @return array
21
  */
22
+ public function extractAdditionalParams(Mage_Sales_Model_Order_Payment $payment = null)
23
  {
24
+ $invoice = $payment->getInvoice();
 
 
 
 
 
25
 
26
+ if ($invoice == null) {
27
  // if invoice is not set we load id hard from the request params
28
  $invoice = $this->getRefundHelper()->getInvoiceFromCreditMemoRequest();
29
  }
30
+ $this->creditmemo = $payment->getCreditmemo();
31
 
32
  if ($invoice instanceof Mage_Sales_Model_Order_Invoice) {
33
  $this->extractFromCreditMemoItems($invoice);
34
  // We dont extract from discount data for the moment, because partial refunds are a problem
 
35
  $this->extractFromInvoicedShippingMethod($invoice);
36
  $this->extractFromAdjustments($invoice);
37
  // Overwrite amount to fix Magentos rounding problems (eg +1ct)
38
+ $this->_additionalParams['AMOUNT'] = $this->amount;
39
  }
40
 
41
+ return $this->_additionalParams;
42
  }
43
 
44
  /**
45
  * extracts all data from the invoice according to the credit memo items
46
  *
 
47
  */
48
+ protected function extractFromCreditMemoItems()
49
  {
50
+ /** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
51
+ foreach ($this->creditmemo->getAllItems() as $item) {
52
+ if ($item->getOrderItem()->getParentItemId()
53
+ && $item->getOrderItem()->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
54
+ || $item->getOrderItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE
55
+ ) {
56
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
+ $this->_additionalParams['ITEMID' . $this->_itemIdx] = substr($item->getOrderItemId(), 0, 15);
59
+ $this->_additionalParams['ITEMNAME' . $this->_itemIdx] = substr($item->getName(), 0, 30);
60
+ $this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount(
61
+ $item->getBasePriceInclTax()
62
+ );
63
+ $this->amount += $this->getOpsDataHelper()
64
+ ->getAmount($item->getBasePriceInclTax()) * $item->getQty();
65
+ $this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = $item->getQty();
66
+ $this->_additionalParams['ITEMVATCODE' . $this->_itemIdx]
67
+ = str_replace(',', '.', (string)(float)$item->getOrderItem()->getTaxPercent()) . '%';
68
+ $this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
69
+ ++$this->_itemIdx;
70
  }
71
 
72
  }
74
 
75
  protected function extractFromInvoicedShippingMethod(Mage_Sales_Model_Order_Invoice $invoice)
76
  {
77
+ if ($this->creditmemo->getBaseShippingInclTax() > 0) {
78
+ $this->_additionalParams['ITEMID' . $this->_itemIdx] = 'SHIPPING';
79
+ $this->_additionalParams['ITEMNAME' . $this->_itemIdx] =
80
  substr($invoice->getOrder()->getShippingDescription(), 0, 30);
81
+ $this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()
82
+ ->getAmount($this->creditmemo->getBaseShippingInclTax());
83
+ $this->amount += $this->getOpsDataHelper()->getAmount($this->creditmemo->getBaseShippingInclTax());
84
+ $this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
85
+ $this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
86
+ $this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
87
+ ++$this->_itemIdx;
88
  }
89
 
90
  }
97
  protected function extractFromAdjustments(Mage_Sales_Model_Order_Invoice $invoice)
98
  {
99
 
100
+ if ($this->creditmemo->getBaseAdjustmentPositive() > 0) {
101
+ $this->_additionalParams['ITEMID' . $this->_itemIdx] = 'ADJUSTREFUND';
102
+ $this->_additionalParams['ITEMNAME' . $this->_itemIdx] = 'Adjustment Refund';
103
+ $this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()
104
+ ->getAmount($this->creditmemo->getBaseAdjustmentPositive());
105
+ $this->amount += $this->getOpsDataHelper()->getAmount($this->creditmemo->getBaseAdjustmentPositive());
106
+ $this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
107
+ $this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
108
+ $this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
109
+ ++$this->_itemIdx;
110
 
111
  }
112
+ if ($this->creditmemo->getBaseAdjustmentNegative() > 0) {
113
+ $this->_additionalParams['ITEMID' . $this->_itemIdx] = 'ADJUSTFEE';
114
+ $this->_additionalParams['ITEMNAME' . $this->_itemIdx] = 'Adjustment Fee';
115
+ $this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()
116
+ ->getAmount(-$this->creditmemo->getBaseAdjustmentNegative());
117
+ $this->amount += $this->getOpsDataHelper()->getAmount(-$this->creditmemo->getBaseAdjustmentNegative());
118
+ $this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
119
+ $this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
120
+ $this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
121
+ ++$this->_itemIdx;
122
  }
123
  }
124
 
app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Parameter.php CHANGED
@@ -20,7 +20,8 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Parameter
20
  {
21
  $opsPaymentMethodClass = get_class($opsPaymentMethod);
22
  $opsPmsRequiringSpecialParams = $this->getOpsConfig()
23
- ->getMethodsRequiringAdditionalParametersFor(Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE
 
24
  );
25
 
26
  return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
@@ -33,20 +34,21 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Parameter
33
  */
34
  protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
35
  {
36
- if ($opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_OpenInvoiceNl) {
37
  $this->additionalParamsModel = Mage::getModel('ops/backend_operation_refund_additional_openInvoiceNl');
38
  }
39
  }
40
 
41
  protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
42
  Varien_Object $payment, $amount
43
- ) {
 
44
  if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
45
  $this->setAdditionalParamsModelFor($opsPaymentMethod);
46
  if ($this->additionalParamsModel instanceof
47
  Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
48
  ) {
49
- $params = $this->additionalParamsModel->extractAdditionalParams(Mage::registry('current_creditmemo'));
50
  $this->requestParams = array_merge($this->requestParams, $params);
51
  }
52
  }
20
  {
21
  $opsPaymentMethodClass = get_class($opsPaymentMethod);
22
  $opsPmsRequiringSpecialParams = $this->getOpsConfig()
23
+ ->getMethodsRequiringAdditionalParametersFor(
24
+ Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE
25
  );
26
 
27
  return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
34
  */
35
  protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
36
  {
37
+ if ($opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_OpenInvoice_Abstract) {
38
  $this->additionalParamsModel = Mage::getModel('ops/backend_operation_refund_additional_openInvoiceNl');
39
  }
40
  }
41
 
42
  protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
43
  Varien_Object $payment, $amount
44
+ )
45
+ {
46
  if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
47
  $this->setAdditionalParamsModelFor($opsPaymentMethod);
48
  if ($this->additionalParamsModel instanceof
49
  Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
50
  ) {
51
+ $params = $this->additionalParamsModel->extractAdditionalParams($payment);
52
  $this->requestParams = array_merge($this->requestParams, $params);
53
  }
54
  }
app/code/community/Netresearch/OPS/Model/Config.php CHANGED
@@ -44,11 +44,12 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
44
  */
45
  public function getConfigData($path, $storeId = null)
46
  {
 
47
  if (!empty($path)) {
48
- return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . $path, $storeId);
49
  }
50
 
51
- return false;
52
  }
53
 
54
  /**
@@ -78,6 +79,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
78
  /**
79
  * Return frontend gateway path, get from config. Setup on admin place.
80
  *
 
81
  * @param int $storeId
82
  *
83
  * @return string
@@ -185,7 +187,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
185
  '_secure' => $this->isCurrentlySecure(),
186
  '_nosid' => true
187
  );
188
- if (false === is_null($storeId)) {
189
  $params['_store'] = $storeId;
190
  }
191
 
@@ -238,7 +240,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
238
  '_secure' => $this->isCurrentlySecure(),
239
  '_nosid' => true
240
  );
241
- if (false === is_null($storeId)) {
242
  $params['_store'] = $storeId;
243
  }
244
  if ($admin) {
@@ -320,7 +322,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
320
  '_secure' => $this->isCurrentlySecure(),
321
  '_nosid' => true,
322
  );
323
- if (false === is_null($storeId)) {
324
  $params['_store'] = $storeId;
325
  }
326
  if ($admin) {
@@ -333,34 +335,37 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
333
 
334
  }
335
 
336
- public function getRegisterDirectDebitPaymentUrl()
337
- {
338
- return Mage::getUrl(
339
- self::OPS_CONTROLLER_ROUTE_PAYMENT . 'registerDirectDebitPayment',
340
- array('_secure' => $this->isCurrentlySecure(), '_nosid' => true)
341
- );
342
- }
343
-
344
  /**
345
  * Checks if requests should be logged or not regarding configuration
346
  *
347
- * @return boolean
 
348
  */
349
  public function shouldLogRequests($storeId = null)
350
  {
351
  return $this->getConfigData('debug_flag', $storeId);
352
  }
353
 
 
 
 
354
  public function hasCatalogUrl()
355
  {
356
  return Mage::getStoreConfig('payment_services/ops/showcatalogbutton');
357
  }
358
 
 
 
 
359
  public function hasHomeUrl()
360
  {
361
  return Mage::getStoreConfig('payment_services/ops/showhomebutton');
362
  }
363
 
 
 
 
 
364
  public function getAcceptedCcTypes($code)
365
  {
366
  return Mage::getStoreConfig('payment/' . $code . '/types');
@@ -388,21 +393,33 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
388
  return $inlineTypes;
389
  }
390
 
 
 
 
391
  public function get3dSecureIsActive()
392
  {
393
  return Mage::getStoreConfig('payment/ops_cc/enabled_3dsecure');
394
  }
395
 
 
 
 
396
  public function getDirectDebitCountryIds()
397
  {
398
  return Mage::getStoreConfig('payment/ops_directDebit/countryIds');
399
  }
400
 
 
 
 
401
  public function getBankTransferCountryIds()
402
  {
403
  return Mage::getStoreConfig('payment/ops_bankTransfer/countryIds');
404
  }
405
 
 
 
 
406
  public function getDirectEbankingBrands()
407
  {
408
  return Mage::getStoreConfig('payment/ops_directEbanking/brands');
@@ -430,6 +447,11 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
430
  return $url;
431
  }
432
 
 
 
 
 
 
433
  public function getCcSaveAliasUrl($storeId = null, $admin = false)
434
  {
435
  $params = array(
@@ -466,7 +488,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
466
  {
467
  $result = array();
468
  $brands = Mage::getStoreConfig('payment/ops_interSolve/brands', $storeId);
469
- if (!is_null($brands)) {
470
  $result = unserialize($brands);
471
  }
472
 
@@ -482,19 +504,25 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
482
  {
483
  $result = array();
484
  $methods = Mage::getStoreConfig('payment/ops_flex/methods', $storeId);
485
- if (!is_null($methods)) {
486
  $result = unserialize($methods);
487
  }
488
 
489
  return $result;
490
  }
491
 
 
 
 
492
  public function getAllCcTypes()
493
  {
494
  return explode(',', Mage::getStoreConfig('payment/ops_cc/availableTypes'));
495
  }
496
 
497
 
 
 
 
498
  public function getAllDcTypes()
499
  {
500
  return explode(',', Mage::getStoreConfig('payment/ops_dc/availableTypes'));
@@ -509,6 +537,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
509
  {
510
  return array(
511
  'AAVCHECK',
 
512
  'CVCCHECK',
513
  'CCCTY',
514
  'IPCTY',
@@ -523,6 +552,9 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
523
  );
524
  }
525
 
 
 
 
526
  public function getSendInvoice()
527
  {
528
  return (bool)(int)Mage::getStoreConfig('payment_services/ops/send_invoice');
@@ -540,6 +572,9 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
540
  return (bool)(int)Mage::getStoreConfig('payment/' . $code . '/backend_enabled', $storeId);
541
  }
542
 
 
 
 
543
  public function isAliasInfoBlockEnabled()
544
  {
545
  return (bool)(int)Mage::getStoreConfig('payment/ops_cc/show_alias_manager_info_for_guests');
@@ -558,6 +593,33 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
558
  return (bool)Mage::getStoreConfig('payment/' . $code . '/active_alias', $storeId);
559
  }
560
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
561
  /**
562
  * getter for usage of order reference
563
  */
@@ -628,6 +690,10 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
628
  }
629
 
630
 
 
 
 
 
631
  public function getMethodsRequiringAdditionalParametersFor($operation)
632
  {
633
  return Mage::getStoreConfig('payment/additional_params_required/' . $operation);
@@ -673,12 +739,18 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
673
  return $this->getConfigData('paramLength');
674
  }
675
 
 
 
 
676
  public function getFrontendFieldMapping()
677
  {
678
  return $this->getConfigData('frontendFieldMapping');
679
 
680
  }
681
 
 
 
 
682
  public function getValidationUrl()
683
  {
684
  return Mage::getUrl(
@@ -687,6 +759,10 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
687
  );
688
  }
689
 
 
 
 
 
690
  public function getInlineOrderReference($storeId = null)
691
  {
692
  return $this->getConfigData('inlineOrderReference', $storeId);
@@ -750,26 +826,56 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
750
  }
751
  }
752
 
 
 
 
 
753
  public function getTemplateIdentifier($storeId = null)
754
  {
755
  return $this->getConfigData('template_identifier', $storeId);
756
  }
757
 
 
 
 
 
758
  public function getResendPaymentInfoIdentity($storeId = null)
759
  {
760
  return $this->getConfigData('resendPaymentInfo_identity', $storeId);
761
  }
762
 
 
 
 
 
763
  public function getResendPaymentInfoTemplate($storeId = null)
764
  {
765
  return $this->getConfigData('resendPaymentInfo_template', $storeId);
766
  }
767
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768
  public function getStateRestriction()
769
  {
770
  return $this->getConfigData('ops_state_restriction');
771
  }
772
 
 
 
 
 
 
773
  public function getPaymentRetryUrl($params, $storeId = null)
774
  {
775
  return Mage::getUrl(
@@ -792,6 +898,10 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
792
  return (bool)$this->getConfigData('device_fingerprinting', $storeId);
793
  }
794
 
 
 
 
 
795
  public function getTransActionTimeout($storeId = null)
796
  {
797
  return (int)$this->getConfigData('ops_rtimeout', $storeId);
@@ -808,34 +918,59 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
808
  return (bool)$this->getConfigData('creditdebit_split', $storeId);
809
  }
810
 
 
 
 
811
  public function getAllRecurringCcTypes()
812
  {
813
  return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/availableTypes'));
814
  }
815
 
 
 
 
816
  public function getAcceptedRecurringCcTypes()
817
  {
818
  return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/acceptedTypes'));
819
  }
820
 
 
 
 
 
821
  public function getMonthlyBillingDay($storeId = null)
822
  {
823
  return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_month', $storeId);
824
  }
825
 
 
 
 
 
826
  public function getWeeklyBillingDay($storeId = null)
827
  {
828
  return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_week', $storeId);
829
  }
830
 
 
 
 
 
831
  public function getSuspendSubscriptionTemplate($storeId = null)
832
  {
833
  return $this->getConfigData('suspendSubscription_template', $storeId);
834
  }
835
 
 
 
 
 
836
  public function getSuspendSubscriptionIdentity($storeId = null)
837
  {
838
  return $this->getConfigData('suspendSubscription_identity', $storeId);
839
  }
 
 
 
840
  }
841
 
44
  */
45
  public function getConfigData($path, $storeId = null)
46
  {
47
+ $result = false;
48
  if (!empty($path)) {
49
+ $result = Mage::getStoreConfig(self::OPS_PAYMENT_PATH . $path, $storeId);
50
  }
51
 
52
+ return $result;
53
  }
54
 
55
  /**
79
  /**
80
  * Return frontend gateway path, get from config. Setup on admin place.
81
  *
82
+ * @param string $path
83
  * @param int $storeId
84
  *
85
  * @return string
187
  '_secure' => $this->isCurrentlySecure(),
188
  '_nosid' => true
189
  );
190
+ if (null != $storeId) {
191
  $params['_store'] = $storeId;
192
  }
193
 
240
  '_secure' => $this->isCurrentlySecure(),
241
  '_nosid' => true
242
  );
243
+ if (null !=$storeId) {
244
  $params['_store'] = $storeId;
245
  }
246
  if ($admin) {
322
  '_secure' => $this->isCurrentlySecure(),
323
  '_nosid' => true,
324
  );
325
+ if (null != $storeId) {
326
  $params['_store'] = $storeId;
327
  }
328
  if ($admin) {
335
 
336
  }
337
 
 
 
 
 
 
 
 
 
338
  /**
339
  * Checks if requests should be logged or not regarding configuration
340
  *
341
+ * @param null $storeId
342
+ * @return Simple_Xml
343
  */
344
  public function shouldLogRequests($storeId = null)
345
  {
346
  return $this->getConfigData('debug_flag', $storeId);
347
  }
348
 
349
+ /**
350
+ * @return mixed
351
+ */
352
  public function hasCatalogUrl()
353
  {
354
  return Mage::getStoreConfig('payment_services/ops/showcatalogbutton');
355
  }
356
 
357
+ /**
358
+ * @return mixed
359
+ */
360
  public function hasHomeUrl()
361
  {
362
  return Mage::getStoreConfig('payment_services/ops/showhomebutton');
363
  }
364
 
365
+ /**
366
+ * @param $code
367
+ * @return mixed
368
+ */
369
  public function getAcceptedCcTypes($code)
370
  {
371
  return Mage::getStoreConfig('payment/' . $code . '/types');
393
  return $inlineTypes;
394
  }
395
 
396
+ /**
397
+ * @return mixed
398
+ */
399
  public function get3dSecureIsActive()
400
  {
401
  return Mage::getStoreConfig('payment/ops_cc/enabled_3dsecure');
402
  }
403
 
404
+ /**
405
+ * @return mixed
406
+ */
407
  public function getDirectDebitCountryIds()
408
  {
409
  return Mage::getStoreConfig('payment/ops_directDebit/countryIds');
410
  }
411
 
412
+ /**
413
+ * @return mixed
414
+ */
415
  public function getBankTransferCountryIds()
416
  {
417
  return Mage::getStoreConfig('payment/ops_bankTransfer/countryIds');
418
  }
419
 
420
+ /**
421
+ * @return mixed
422
+ */
423
  public function getDirectEbankingBrands()
424
  {
425
  return Mage::getStoreConfig('payment/ops_directEbanking/brands');
447
  return $url;
448
  }
449
 
450
+ /**
451
+ * @param null $storeId
452
+ * @param bool $admin
453
+ * @return mixed
454
+ */
455
  public function getCcSaveAliasUrl($storeId = null, $admin = false)
456
  {
457
  $params = array(
488
  {
489
  $result = array();
490
  $brands = Mage::getStoreConfig('payment/ops_interSolve/brands', $storeId);
491
+ if (null !=$brands) {
492
  $result = unserialize($brands);
493
  }
494
 
504
  {
505
  $result = array();
506
  $methods = Mage::getStoreConfig('payment/ops_flex/methods', $storeId);
507
+ if (null !=$methods) {
508
  $result = unserialize($methods);
509
  }
510
 
511
  return $result;
512
  }
513
 
514
+ /**
515
+ * @return array
516
+ */
517
  public function getAllCcTypes()
518
  {
519
  return explode(',', Mage::getStoreConfig('payment/ops_cc/availableTypes'));
520
  }
521
 
522
 
523
+ /**
524
+ * @return array
525
+ */
526
  public function getAllDcTypes()
527
  {
528
  return explode(',', Mage::getStoreConfig('payment/ops_dc/availableTypes'));
537
  {
538
  return array(
539
  'AAVCHECK',
540
+ 'ACCEPTANCE',
541
  'CVCCHECK',
542
  'CCCTY',
543
  'IPCTY',
552
  );
553
  }
554
 
555
+ /**
556
+ * @return bool
557
+ */
558
  public function getSendInvoice()
559
  {
560
  return (bool)(int)Mage::getStoreConfig('payment_services/ops/send_invoice');
572
  return (bool)(int)Mage::getStoreConfig('payment/' . $code . '/backend_enabled', $storeId);
573
  }
574
 
575
+ /**
576
+ * @return bool
577
+ */
578
  public function isAliasInfoBlockEnabled()
579
  {
580
  return (bool)(int)Mage::getStoreConfig('payment/ops_cc/show_alias_manager_info_for_guests');
593
  return (bool)Mage::getStoreConfig('payment/' . $code . '/active_alias', $storeId);
594
  }
595
 
596
+ /**
597
+ * return configured text for alias usage parameter for new alias creation
598
+ *
599
+ * @param $code
600
+ * @param null $storeId
601
+ *
602
+ * @return string
603
+ */
604
+ public function getAliasUsageForNewAlias($code, $storeId = null)
605
+ {
606
+ return Mage::getStoreConfig('payment/' . $code . '/alias_usage_for_new_alias', $storeId);
607
+ }
608
+
609
+ /**
610
+ * return configured text for alias usage parameter when using a existing alias
611
+ *
612
+ * @param $code
613
+ * @param null $storeId
614
+ *
615
+ * @return string
616
+ */
617
+ public function getAliasUsageForExistingAlias($code, $storeId = null)
618
+ {
619
+ return Mage::getStoreConfig('payment/' . $code . '/alias_usage_for_existing_alias', $storeId);
620
+ }
621
+
622
+
623
  /**
624
  * getter for usage of order reference
625
  */
690
  }
691
 
692
 
693
+ /**
694
+ * @param $operation
695
+ * @return mixed
696
+ */
697
  public function getMethodsRequiringAdditionalParametersFor($operation)
698
  {
699
  return Mage::getStoreConfig('payment/additional_params_required/' . $operation);
739
  return $this->getConfigData('paramLength');
740
  }
741
 
742
+ /**
743
+ * @return Simple_Xml
744
+ */
745
  public function getFrontendFieldMapping()
746
  {
747
  return $this->getConfigData('frontendFieldMapping');
748
 
749
  }
750
 
751
+ /**
752
+ * @return mixed
753
+ */
754
  public function getValidationUrl()
755
  {
756
  return Mage::getUrl(
759
  );
760
  }
761
 
762
+ /**
763
+ * @param null $storeId
764
+ * @return Simple_Xml
765
+ */
766
  public function getInlineOrderReference($storeId = null)
767
  {
768
  return $this->getConfigData('inlineOrderReference', $storeId);
826
  }
827
  }
828
 
829
+ /**
830
+ * @param null $storeId
831
+ * @return Simple_Xml
832
+ */
833
  public function getTemplateIdentifier($storeId = null)
834
  {
835
  return $this->getConfigData('template_identifier', $storeId);
836
  }
837
 
838
+ /**
839
+ * @param null $storeId
840
+ * @return Simple_Xml
841
+ */
842
  public function getResendPaymentInfoIdentity($storeId = null)
843
  {
844
  return $this->getConfigData('resendPaymentInfo_identity', $storeId);
845
  }
846
 
847
+ /**
848
+ * @param null $storeId
849
+ * @return Simple_Xml
850
+ */
851
  public function getResendPaymentInfoTemplate($storeId = null)
852
  {
853
  return $this->getConfigData('resendPaymentInfo_template', $storeId);
854
  }
855
 
856
+
857
+ /**
858
+ * @param null $storeId
859
+ * @return Simple_Xml
860
+ */
861
+ public function getPayPerMailTemplate($storeId = null)
862
+ {
863
+ return $this->getConfigData('payPerMail_template', $storeId);
864
+ }
865
+
866
+ /**
867
+ * @return Simple_Xml
868
+ */
869
  public function getStateRestriction()
870
  {
871
  return $this->getConfigData('ops_state_restriction');
872
  }
873
 
874
+ /**
875
+ * @param $params
876
+ * @param null $storeId
877
+ * @return mixed
878
+ */
879
  public function getPaymentRetryUrl($params, $storeId = null)
880
  {
881
  return Mage::getUrl(
898
  return (bool)$this->getConfigData('device_fingerprinting', $storeId);
899
  }
900
 
901
+ /**
902
+ * @param null $storeId
903
+ * @return int
904
+ */
905
  public function getTransActionTimeout($storeId = null)
906
  {
907
  return (int)$this->getConfigData('ops_rtimeout', $storeId);
918
  return (bool)$this->getConfigData('creditdebit_split', $storeId);
919
  }
920
 
921
+ /**
922
+ * @return array
923
+ */
924
  public function getAllRecurringCcTypes()
925
  {
926
  return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/availableTypes'));
927
  }
928
 
929
+ /**
930
+ * @return array
931
+ */
932
  public function getAcceptedRecurringCcTypes()
933
  {
934
  return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/acceptedTypes'));
935
  }
936
 
937
+ /**
938
+ * @param null $storeId
939
+ * @return mixed
940
+ */
941
  public function getMonthlyBillingDay($storeId = null)
942
  {
943
  return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_month', $storeId);
944
  }
945
 
946
+ /**
947
+ * @param null $storeId
948
+ * @return mixed
949
+ */
950
  public function getWeeklyBillingDay($storeId = null)
951
  {
952
  return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_week', $storeId);
953
  }
954
 
955
+ /**
956
+ * @param null $storeId
957
+ * @return Simple_Xml
958
+ */
959
  public function getSuspendSubscriptionTemplate($storeId = null)
960
  {
961
  return $this->getConfigData('suspendSubscription_template', $storeId);
962
  }
963
 
964
+ /**
965
+ * @param null $storeId
966
+ * @return Simple_Xml
967
+ */
968
  public function getSuspendSubscriptionIdentity($storeId = null)
969
  {
970
  return $this->getConfigData('suspendSubscription_identity', $storeId);
971
  }
972
+
973
+
974
+
975
  }
976
 
app/code/community/Netresearch/OPS/Model/File/Download.php CHANGED
@@ -25,11 +25,11 @@ class Netresearch_OPS_Model_File_Download
25
  public function getFile($path, $threshold = self::ONE_MEGABYTE)
26
  {
27
  $this->_filePath = $path;
28
- if(!file_exists($this->_filePath) || !is_readable($this->_filePath)){
29
  Mage::throwException('File '.$this->_filePath.' does not exist or is not readable.');
30
  return '';
31
  }
32
- if(filesize($path) > $threshold){
33
  return $this->_trimFileToThreshold($threshold);
34
  } else {
35
  return $this->_filePath;
@@ -46,7 +46,7 @@ class Netresearch_OPS_Model_File_Download
46
  protected function _trimFileToThreshold($threshold)
47
  {
48
  $this->_fileHandler = fopen($this->_filePath, 'r');
49
- if(0 > fseek($this->_fileHandler, filesize($this->_filePath)-$threshold, SEEK_SET)){
50
  Mage::throwException('Function fseek on file '. $this->_filePath.' failed.');
51
  }
52
  $content = fread($this->_fileHandler, $threshold);
25
  public function getFile($path, $threshold = self::ONE_MEGABYTE)
26
  {
27
  $this->_filePath = $path;
28
+ if (!file_exists($this->_filePath) || !is_readable($this->_filePath)) {
29
  Mage::throwException('File '.$this->_filePath.' does not exist or is not readable.');
30
  return '';
31
  }
32
+ if (filesize($path) > $threshold) {
33
  return $this->_trimFileToThreshold($threshold);
34
  } else {
35
  return $this->_filePath;
46
  protected function _trimFileToThreshold($threshold)
47
  {
48
  $this->_fileHandler = fopen($this->_filePath, 'r');
49
+ if (0 > fseek($this->_fileHandler, filesize($this->_filePath)-$threshold, SEEK_SET)) {
50
  Mage::throwException('Function fseek on file '. $this->_filePath.' failed.');
51
  }
52
  $content = fread($this->_fileHandler, $threshold);
app/code/community/Netresearch/OPS/Model/Kwixo/Category/Mapping.php CHANGED
@@ -36,7 +36,6 @@ class Netresearch_OPS_Model_Kwixo_Category_Mapping
36
  * Constructor
37
  *
38
  * @see lib/Varien/Varien_Object#_construct()
39
- * @return Netresearch_OPS_Model_Kwixo_Category_Mapping
40
  */
41
  public function _construct()
42
  {
@@ -49,8 +48,10 @@ class Netresearch_OPS_Model_Kwixo_Category_Mapping
49
  {
50
  $collection = $this->getCollection()
51
  ->addFieldToFilter('category_id', $categoryId)
52
- ->load();
53
- return $collection->getFirstItem();
 
 
54
  }
55
 
56
  }
36
  * Constructor
37
  *
38
  * @see lib/Varien/Varien_Object#_construct()
 
39
  */
40
  public function _construct()
41
  {
48
  {
49
  $collection = $this->getCollection()
50
  ->addFieldToFilter('category_id', $categoryId)
51
+ ->load()
52
+ ->getFirstItem();
53
+
54
+ return $collection;
55
  }
56
 
57
  }
app/code/community/Netresearch/OPS/Model/Kwixo/Shipping/Setting.php CHANGED
@@ -15,7 +15,6 @@ class Netresearch_OPS_Model_Kwixo_Shipping_Setting
15
  * Constructor
16
  *
17
  * @see lib/Varien/Varien_Object#_construct()
18
- * @return Netresearch_OPS_Model_Kwixo_Shipping_Setting
19
  */
20
  public function _construct()
21
  {
15
  * Constructor
16
  *
17
  * @see lib/Varien/Varien_Object#_construct()
 
18
  */
19
  public function _construct()
20
  {
app/code/community/Netresearch/OPS/Model/Mysql4/Alias.php CHANGED
@@ -21,13 +21,13 @@ class Netresearch_OPS_Model_Mysql4_Alias
21
  extends Mage_Core_Model_Mysql4_Abstract
22
  {
23
  /**
24
- * Constructor
25
- *
26
- * @see lib/Varien/Varien_Object#_construct()
27
- * @return Netresearch_OPS_Model_Mysql4_Alias
28
- */
29
  public function _construct()
30
  {
31
- $this->_init('ops/alias','id');
32
  }
33
  }
21
  extends Mage_Core_Model_Mysql4_Abstract
22
  {
23
  /**
24
+ * Constructor
25
+ *
26
+ * @see lib/Varien/Varien_Object#_construct()
27
+ * @return Netresearch_OPS_Model_Mysql4_Alias
28
+ */
29
  public function _construct()
30
  {
31
+ $this->_init('ops/alias', 'id');
32
  }
33
  }
app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Category/Mapping.php CHANGED
@@ -26,7 +26,7 @@ class Netresearch_OPS_Model_Mysql4_Kwixo_Category_Mapping
26
  */
27
  public function _construct()
28
  {
29
- $this->_init('ops/kwixo_category_mapping','id');
30
  }
31
 
32
  }
26
  */
27
  public function _construct()
28
  {
29
+ $this->_init('ops/kwixo_category_mapping', 'id');
30
  }
31
 
32
  }
app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Shipping/Setting.php CHANGED
@@ -10,7 +10,6 @@
10
 
11
  class Netresearch_OPS_Model_Mysql4_Kwixo_Shipping_Setting
12
  extends Mage_Core_Model_Mysql4_Abstract
13
-
14
  {
15
 
16
  public function _construct()
10
 
11
  class Netresearch_OPS_Model_Mysql4_Kwixo_Shipping_Setting
12
  extends Mage_Core_Model_Mysql4_Abstract
 
13
  {
14
 
15
  public function _construct()
app/code/community/Netresearch/OPS/Model/Observer.php CHANGED
@@ -44,7 +44,7 @@ class Netresearch_OPS_Model_Observer
44
 
45
  public function getHelper($name = null)
46
  {
47
- if (is_null($name)) {
48
  return Mage::helper('ops');
49
  }
50
 
@@ -74,7 +74,7 @@ class Netresearch_OPS_Model_Observer
74
  $quote->getPayment()
75
  )
76
  ) {
77
- $this->confirmDdPayment($order, $quote, $observer);
78
  } elseif ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
79
  $requestParams = $quote->getPayment()->getMethodInstance()->getFormFields($order, array(), false);
80
  $this->invokeRequestParamValidation($requestParams);
@@ -82,7 +82,7 @@ class Netresearch_OPS_Model_Observer
82
  } catch (Exception $e) {
83
  $quote->setIsActive(true);
84
  $this->getOnepage()->getCheckout()->setGotoSection('payment');
85
- throw new Mage_Core_Exception($e->getMessage());
86
  }
87
  }
88
 
@@ -135,10 +135,8 @@ class Netresearch_OPS_Model_Observer
135
  /**
136
  * allow null as valid state for creating the order with status 'pending'
137
  */
138
- if (!is_null($response['STATUS'])
139
- && Mage::helper('ops/payment')->isPaymentFailed($response['STATUS'])
140
- ) {
141
- throw new Mage_Core_Exception($this->getHelper()->__('PayEngine Payment failed'));
142
  }
143
  $quote->getPayment()->setAdditionalInformation('ops_response', $response)->save();
144
 
@@ -184,7 +182,9 @@ class Netresearch_OPS_Model_Observer
184
  ) {
185
  //Build message and update cancel button
186
  $message = Mage::helper('ops')->__(
187
- "Are you sure you want to cancel this order? Warning: Please check the payment status in the back-office of PayEngine before. By cancelling this order you won\\'t be able to update the status in Magento anymore."
 
 
188
  );
189
  $block->updateButton(
190
  'order_cancel',
@@ -204,7 +204,7 @@ class Netresearch_OPS_Model_Observer
204
  *
205
  * @param Varien_Event_Observer $observer
206
  *
207
- * @return void
208
  */
209
  public function appendCheckBoxToRefundForm($observer)
210
  {
@@ -251,7 +251,7 @@ class Netresearch_OPS_Model_Observer
251
  *
252
  * @param Varien_Event_Observer $observer
253
  *
254
- * @return void
255
  */
256
  public function showWarningForClosedTransactions($observer)
257
  {
@@ -290,7 +290,7 @@ class Netresearch_OPS_Model_Observer
290
  *
291
  * @param $observer
292
  */
293
- public function cleanUpOldPaymentData($observer)
294
  {
295
  Mage::helper('ops/quote')->cleanUpOldPaymentInformation();
296
  }
@@ -425,13 +425,15 @@ class Netresearch_OPS_Model_Observer
425
  $controller = $event->getControllerAction();
426
  $quote = $this->getOnepage()->getQuote();
427
  if ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
 
428
  $paramHelper = Mage::helper('ops/payment_request');
429
  $shippingParams = array();
430
- $billingParams = $paramHelper->getOwnerParams($quote->getBillingAddress(), $quote);
 
431
  if ($quote->getShippingAddress()) {
432
  $shippingParams = $paramHelper->extractShipToParameters($quote->getShippingAddress(), $quote);
433
  }
434
- $params = array_merge($billingParams, $shippingParams);
435
  $validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
436
  Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
437
  );
@@ -541,7 +543,9 @@ class Netresearch_OPS_Model_Observer
541
  if ($profile->getMethodCode() == Netresearch_OPS_Model_Payment_Recurring_Cc::CODE) {
542
  $cancelMessage = Mage::helper('ops')
543
  ->__(
544
- 'Are you sure you want to perform this action? Canceling the subscription here will not actually cancel the subscription on PayEngine side. To stop charging the customer you will have to deactivate the subscription there.'
 
 
545
  );
546
  $cancelUrl = $block->getUrl(
547
  '*/*/updateState',
@@ -556,7 +560,9 @@ class Netresearch_OPS_Model_Observer
556
 
557
  $suspendMessage = Mage::helper('ops')
558
  ->__(
559
- 'Are you sure you want to perform this action? Suspending the subscription here will not actually cancel the subscription on PayEngine side. To stop charging the customer you will have to deactivate the subscription there.'
 
 
560
  );
561
  $suspendUrl = $block->getUrl(
562
  '*/*/updateState',
@@ -677,14 +683,14 @@ class Netresearch_OPS_Model_Observer
677
  {
678
  /** @var Mage_Sales_Model_Order $order */
679
  $order = $observer->getOrder();
680
- if (!$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
681
  // ignore third-party payment methods
682
  return;
683
  }
684
 
685
  /** @var Mage_Sales_Model_Quote $quote */
686
  $quote = $observer->getQuote();
687
- if ($quote->getPayment()->getOrderPlaceRedirectUrl()) {
688
  // redirect payments require special treatment, may still get cancelled or declined
689
  return;
690
  }
@@ -696,4 +702,24 @@ class Netresearch_OPS_Model_Observer
696
  Mage::logException($e);
697
  }
698
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
699
  }
44
 
45
  public function getHelper($name = null)
46
  {
47
+ if (null === $name) {
48
  return Mage::helper('ops');
49
  }
50
 
74
  $quote->getPayment()
75
  )
76
  ) {
77
+ $this->confirmDdPayment($order, $quote );
78
  } elseif ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
79
  $requestParams = $quote->getPayment()->getMethodInstance()->getFormFields($order, array(), false);
80
  $this->invokeRequestParamValidation($requestParams);
82
  } catch (Exception $e) {
83
  $quote->setIsActive(true);
84
  $this->getOnepage()->getCheckout()->setGotoSection('payment');
85
+ Mage::throwException($e->getMessage());
86
  }
87
  }
88
 
135
  /**
136
  * allow null as valid state for creating the order with status 'pending'
137
  */
138
+ if (null != $response['STATUS'] && Mage::helper('ops/payment')->isPaymentFailed($response['STATUS'])) {
139
+ Mage::throwException($this->getHelper()->__('PayEngine Payment failed'));
 
 
140
  }
141
  $quote->getPayment()->setAdditionalInformation('ops_response', $response)->save();
142
 
182
  ) {
183
  //Build message and update cancel button
184
  $message = Mage::helper('ops')->__(
185
+ "Are you sure you want to cancel this order? Warning:" .
186
+ " Please check the payment status in the back-office of PayEngine before." .
187
+ " By cancelling this order you won\\'t be able to update the status in Magento anymore."
188
  );
189
  $block->updateButton(
190
  'order_cancel',
204
  *
205
  * @param Varien_Event_Observer $observer
206
  *
207
+ * @return string
208
  */
209
  public function appendCheckBoxToRefundForm($observer)
210
  {
251
  *
252
  * @param Varien_Event_Observer $observer
253
  *
254
+ * @return string
255
  */
256
  public function showWarningForClosedTransactions($observer)
257
  {
290
  *
291
  * @param $observer
292
  */
293
+ public function cleanUpOldPaymentData()
294
  {
295
  Mage::helper('ops/quote')->cleanUpOldPaymentInformation();
296
  }
425
  $controller = $event->getControllerAction();
426
  $quote = $this->getOnepage()->getQuote();
427
  if ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
428
+ /** @var Netresearch_OPS_Helper_Payment_Request $paramHelper */
429
  $paramHelper = Mage::helper('ops/payment_request');
430
  $shippingParams = array();
431
+ $ownerParams = $paramHelper->getOwnerParams($quote->getBillingAddress(), $quote);
432
+ $billingParams = $paramHelper->extractBillToParameters($quote->getBillingAddress(), $quote);
433
  if ($quote->getShippingAddress()) {
434
  $shippingParams = $paramHelper->extractShipToParameters($quote->getShippingAddress(), $quote);
435
  }
436
+ $params = array_merge($ownerParams, $shippingParams, $billingParams);
437
  $validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
438
  Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
439
  );
543
  if ($profile->getMethodCode() == Netresearch_OPS_Model_Payment_Recurring_Cc::CODE) {
544
  $cancelMessage = Mage::helper('ops')
545
  ->__(
546
+ 'Are you sure you want to perform this action?' .
547
+ ' Canceling the subscription here will not actually cancel the subscription on PayEngine side.' .
548
+ ' To stop charging the customer you will have to deactivate the subscription there.'
549
  );
550
  $cancelUrl = $block->getUrl(
551
  '*/*/updateState',
560
 
561
  $suspendMessage = Mage::helper('ops')
562
  ->__(
563
+ 'Are you sure you want to perform this action?' .
564
+ 'Suspending the subscription here will not actually cancel the subscription on PayEngine side.' .
565
+ 'To stop charging the customer you will have to deactivate the subscription there.'
566
  );
567
  $suspendUrl = $block->getUrl(
568
  '*/*/updateState',
683
  {
684
  /** @var Mage_Sales_Model_Order $order */
685
  $order = $observer->getOrder();
686
+ if ($order == null || !$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
687
  // ignore third-party payment methods
688
  return;
689
  }
690
 
691
  /** @var Mage_Sales_Model_Quote $quote */
692
  $quote = $observer->getQuote();
693
+ if ($quote && $quote->getPayment()->getOrderPlaceRedirectUrl()) {
694
  // redirect payments require special treatment, may still get cancelled or declined
695
  return;
696
  }
702
  Mage::logException($e);
703
  }
704
  }
705
+
706
+ /**
707
+ * triggers the email sending for payment method payPerMail
708
+ *
709
+ * event: sales_order_place_after
710
+ *
711
+ * @param Varien_Event_Observer $observer
712
+ */
713
+ public function sendPayPerMailInfo(Varien_Event_Observer $observer)
714
+ {
715
+ /** @var Mage_Sales_Model_Order $order */
716
+ $order = $observer->getOrder();
717
+ if (!$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_PayPerMail) {
718
+ return;
719
+ }
720
+
721
+ /** @var Netresearch_OPS_Model_Payment_Features_PaymentEmail $sendEmailModel */
722
+ $sendEmailModel = Mage::getModel('ops/payment_features_paymentEmail');
723
+ $sendEmailModel->resendPaymentInfo($order);
724
+ }
725
  }
app/code/community/Netresearch/OPS/Model/Payment/Abstract.php CHANGED
@@ -39,26 +39,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
39
  protected $_config = null;
40
  protected $requestHelper = null;
41
  protected $backendOperationParameterModel = null;
42
-
43
- /**
44
- * @param null $backendOperationParameterModel
45
- */
46
- public function setBackendOperationParameterModel($backendOperationParameterModel)
47
- {
48
- $this->backendOperationParameterModel = $backendOperationParameterModel;
49
- }
50
-
51
- /**
52
- * @return Netresearch_OPS_Model_Backend_Operation_Parameter
53
- */
54
- public function getBackendOperationParameterModel()
55
- {
56
- if (null === $this->backendOperationParameterModel) {
57
- $this->backendOperationParameterModel = Mage::getModel('ops/backend_operation_parameter');
58
- }
59
-
60
- return $this->backendOperationParameterModel;
61
- }
62
 
63
  /**
64
  * Magento Payment Behaviour Settings
@@ -81,10 +62,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
81
  */
82
 
83
  protected $_needsCartDataForRequest = false;
84
-
85
  protected $_needsShipToParams = true;
86
-
87
- protected $_needsBillToParams = false;
88
 
89
  /**
90
  * OPS template modes
@@ -94,11 +73,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
94
  const TEMPLATE_OPS_TEMPLATE = 'ops_template';
95
  const TEMPLATE_MAGENTO_INTERNAL = 'magento';
96
 
97
-
98
  /**
99
  * redirect references
100
  */
101
-
102
  const REFERENCE_QUOTE_ID = 'quoteId';
103
  const REFERENCE_ORDER_ID = 'orderId';
104
 
@@ -141,6 +118,42 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
141
  */
142
  const FINGERPRINT_CONSENT_SESSION_KEY = 'device_fingerprinting_consent';
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  /**
145
  * Return OPS Config
146
  *
@@ -148,7 +161,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
148
  */
149
  public function getConfig()
150
  {
151
- if (is_null($this->_config)) {
152
  $this->_config = Mage::getSingleton('ops/config');
153
  }
154
 
@@ -160,6 +173,16 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
160
  return $this->getPaymentAction();
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
163
  /**
164
  * return if shipment params are needed for request
165
  *
@@ -206,7 +229,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
206
 
207
  $storeId = 0;
208
  // allow multi store/site for backend orders with disabled backend payment methods in default store
209
- if (!is_null($quote) && !is_null($quote->getId())) {
210
  $storeId = $quote->getStoreId();
211
  }
212
  if (Mage_Core_Model_App::ADMIN_STORE_ID == Mage::app()->getStore()->getId()
@@ -221,6 +244,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
221
  /**
222
  * if method is enabled for backend payments
223
  *
 
224
  * @return bool
225
  */
226
  public function isEnabledForBackend($storeId = 0)
@@ -238,18 +262,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
238
  return $this->getConfig()->getPaymentRedirectUrl();
239
  }
240
 
241
- protected function getPayment()
242
- {
243
- $checkout = Mage::getSingleton('checkout/session');
244
- $payment = $checkout->getQuote()->getPayment();
245
- if (!$payment->getId()) {
246
- $payment = Mage::getModel('sales/order')->loadByIncrementId($checkout->getLastRealOrderId())->getPayment();
247
- }
248
- }
249
-
250
  public function getOpsBrand($payment = null)
251
  {
252
- if (is_null($payment)) {
253
  $payment = $this->getInfoInstance();
254
  }
255
  $brand = trim($payment->getAdditionalInformation('BRAND'));
@@ -262,7 +277,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
262
 
263
  public function getOpsCode($payment = null)
264
  {
265
- if (is_null($payment)) {
266
  $payment = $this->getInfoInstance();
267
  }
268
  $pm = trim($payment->getAdditionalInformation('PM'));
@@ -361,9 +376,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
361
  /**
362
  * Prepare params array to send it to gateway page via POST
363
  *
364
- * @param Mage_Sales_Model_Order
365
- * @param array
366
- *
367
  * @return array
368
  */
369
  public function getFormFields($order, $requestParams, $isRequest = true)
@@ -379,13 +394,6 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
379
  // get mandatory parameters
380
  $formFields = $this->getMandatoryFormFields($order);
381
 
382
- // get method specific parameters
383
- $methodDependendFields = $this->getMethodDependendFormFields($order, $requestParams);
384
- if (is_array($methodDependendFields)) {
385
- $formFields = array_merge($formFields, $methodDependendFields);
386
- }
387
-
388
-
389
  $paymentAction = $this->_getOPSPaymentOperation();
390
  if ($paymentAction ) {
391
  $formFields['OPERATION'] = $paymentAction;
@@ -393,11 +401,14 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
393
 
394
  $formFields = array_merge($formFields, $requestHelper->getTemplateParams($order->getStoreId()));
395
 
396
- $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();
397
- $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();
398
- $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
399
- $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();
400
- $formFields['BACKURL'] = $this->getConfig()->getCancelUrl();
 
 
 
401
 
402
 
403
  /** @var $order Mage_Sales_Model_Order */
@@ -423,6 +434,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
423
  $formFields = array_merge($formFields, $methodDependendFields);
424
  }
425
 
 
 
426
  $shaSign = Mage::helper('ops/payment')->shaCrypt(
427
  Mage::helper('ops/payment')
428
  ->getSHASign($formFields, null, $order->getStoreId())
@@ -465,19 +478,6 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
465
  return $value;
466
  }
467
 
468
- protected function convertToLatin1($StringToConvert)
469
- {
470
- $returnString = '';
471
- $chars = str_split($StringToConvert);
472
- foreach ($chars as $char) {
473
- if (31 < ord($char) && ord($char) < 127) {
474
- $returnString .= $char;
475
- }
476
- }
477
-
478
- return $returnString;
479
- }
480
-
481
  /**
482
  * get formated order description
483
  *
@@ -487,22 +487,18 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
487
  */
488
  public function _getOrderDescription($order)
489
  {
490
- $descriptionItems = array();
491
- $description = '';
492
- $lengs = 0;
493
- foreach ($order->getAllItems() as $item) {
494
- if ($item->getParentItem()) {
495
- continue;
496
- }
497
- // we know that PayEngine is not able to handle characters that are not available in iso-8859-1
498
- // $descriptionItems[] = mb_ereg_replace("[^a-zA-Z0-9äáàéèíóöõúüûÄÁÀÉÍÓÖÕÚÜÛ_ ]" , "" , $item->getName());
499
- $descriptionItems[] = $this->convertToLatin1($item->getName());
500
- $description = Mage::helper('core/string')->substr(implode(', ', $descriptionItems), 0, 100);
501
- //COM field is limited to 100 chars max
502
- if (100 <= Mage::helper('core/string')->strlen($description)) {
503
- break;
504
- }
505
- }
506
 
507
  return $description;
508
  }
@@ -561,7 +557,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
561
  parent::acceptPayment($payment);
562
  $status = $payment->getAdditionalInformation('status');
563
 
564
- if ($status == Netresearch_OPS_Model_Status::AUTHORIZED || $status == Netresearch_OPS_Model_Status::PAYMENT_REQUESTED) {
 
 
565
  return true;
566
  }
567
 
@@ -587,7 +585,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
587
  parent::denyPayment($payment);
588
 
589
  Mage::getSingleton('admin/session')->addNotice(
590
- $this->getHelper()->__('Order has been canceled permanently in Magento. Changes in PayEngine platform will no longer be considered.')
 
591
  );
592
 
593
  return true;
@@ -640,9 +639,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
640
  self::OPS_CAPTURE_TRANSACTION_TYPE,
641
  $this,
642
  $payment,
643
- $amount,
644
- $arrInfo
645
  );
 
646
  $response = Mage::getSingleton('ops/api_directlink')->performRequest(
647
  $requestParams,
648
  Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
@@ -651,13 +650,13 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
651
 
652
  Mage::getModel('ops/response_handler')->processResponse($response, $this, false);
653
 
654
- return $this;
655
-
656
  } catch (Exception $e) {
657
  Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
658
  Mage::helper('ops')->log("Exception in capture request:" . $e->getMessage());
659
  Mage::throwException($e->getMessage());
660
  }
 
 
661
  }
662
 
663
  /**
@@ -670,14 +669,19 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
670
  */
671
  public function refund(Varien_Object $payment, $amount)
672
  {
 
673
  $refundHelper = Mage::helper('ops/order_refund');
674
 
675
  if ($refundHelper->getOpenRefundTransaction($payment)->getId()) {
676
- Mage::throwException($this->getHelper()->__("There is already one creditmemo in the queue. The Creditmemo will be created automatically as soon as PayEngine sends an acknowledgement."));
 
 
 
 
 
677
  }
678
 
679
  $refundHelper->setAmount($amount)->setPayment($payment);
680
- $arrInfo = $refundHelper->prepareOperation($payment, $amount);
681
  $storeId = $payment->getOrder()->getStoreId();
682
 
683
  try {
@@ -685,9 +689,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
685
  self::OPS_REFUND_TRANSACTION_TYPE,
686
  $this,
687
  $payment,
688
- $amount,
689
- $arrInfo
690
  );
 
691
  $response = Mage::getSingleton('ops/api_directlink')->performRequest(
692
  $requestParams,
693
  Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
@@ -756,11 +760,10 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
756
  */
757
 
758
  //Proceed parent cancel method in case that regirstry value ops_auto_void is set
759
- if (true === Mage::registry('ops_auto_void')):
760
  Mage::unregister('ops_auto_void');
761
-
762
  return parent::cancel($payment);
763
- endif;
764
 
765
  //If order has state 'pending_payment' and the payment has PayEngine-status 0 or null (unknown) then cancel the order
766
  if (true === $this->canCancelManually($payment->getOrder())) {
@@ -772,23 +775,21 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
772
  }
773
 
774
  //Abort cancel method by throwing a Mage_Core_Exception
775
- throw new Mage_Core_Exception($this->getHelper()->__('Please use void to cancel the operation.'));
776
  }
777
 
778
  /**
779
  * Custom void behavior, trigger PayEngine cancel request
780
  *
781
- * @param Mage_Sales_Model_Order_Payment $payment
782
- *
783
- * @return void
784
- * @throws Mage_Core_Exception
785
  */
786
  public function void(Varien_Object $payment)
787
  {
788
 
789
  $status = $payment->getAdditionalInformation('status');
790
 
791
- if(!Netresearch_OPS_Model_Status::canVoidTransaction($status)){
792
  Mage::throwException($this->getHelper()->__('Status %s can not be voided.', $status));
793
  }
794
 
@@ -854,7 +855,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
854
  Mage::helper('ops')->log(
855
  "Exception in void request:" . $e->getMessage()
856
  );
857
- throw new Mage_Core_Exception($e->getMessage());
858
  }
859
  }
860
 
@@ -862,12 +863,10 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
862
  * get question for fields with disputable value
863
  * users are asked to correct the values before redirect to PayEngine
864
  *
865
- * @param Mage_Sales_Model_Order $order Current order
866
- * @param array $requestParams Request parameters
867
  *
868
  * @return string
869
  */
870
- public function getQuestion($order, $requestParams)
871
  {
872
  return '';
873
  }
@@ -877,11 +876,10 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
877
  * users are asked to correct the values before redirect to PayEngine
878
  *
879
  * @param Mage_Sales_Model_Order $order Current order
880
- * @param array $requestParams Request parameters
881
  *
882
  * @return array
883
  */
884
- public function getQuestionedFormFields($quote, $requestParams)
885
  {
886
  return array();
887
  }
@@ -901,11 +899,11 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
901
  if (false == is_array($requestParams)) {
902
  $requestParams = array();
903
  }
904
- if (is_null($formFields)) {
905
  $formFields = $this->getFormFields($order, $requestParams, false);
906
  }
907
  $availableParams = array_merge($requestParams, $formFields);
908
- $requiredParams = $this->getQuestionedFormFields($order, $requestParams);
909
  foreach ($requiredParams as $requiredParam) {
910
  if (false == array_key_exists($requiredParam, $availableParams)
911
  || 0 == strlen($availableParams[$requiredParam])
@@ -931,7 +929,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
931
  //If payment has PayEngine-status 0 or null (unknown) or another offline cancelable status
932
  $status = $payment->getAdditionalInformation('status');
933
 
934
- return is_null($status)
935
  || in_array(
936
  $status, array(
937
  Netresearch_OPS_Model_Status::INVALID_INCOMPLETE,
@@ -945,9 +943,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
945
  public function getOpsHtmlAnswer($payment = null)
946
  {
947
  $returnValue = '';
948
- if (is_null($payment)) {
949
  $quoteId = Mage::getSingleton('checkout/session')->getQuote()->getId();
950
- if (is_null($quoteId)) {
951
  $orderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
952
  $order = Mage::getModel('sales/order')->loadByAttribute('increment_id', $orderIncrementId);
953
  } else {
@@ -1033,8 +1031,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
1033
  */
1034
  public function canVoid(Varien_Object $payment)
1035
  {
1036
-
1037
- if(Netresearch_OPS_Model_Status::canVoidTransaction($payment->getAdditionalInformation('status'))){
1038
  return parent::canVoid($payment);
1039
  } else {
1040
  return false;
@@ -1050,8 +1047,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
1050
  parent::assignData($data);
1051
 
1052
  $paymentInfo = $this->getInfoInstance();
1053
- if ($paymentInfo->getData($this->getCode())) {
1054
- foreach ($paymentInfo->getData($this->getCode()) as $key => $value) {
1055
  $paymentInfo->setAdditionalInformation($key, $value);
1056
  }
1057
  }
@@ -1072,11 +1069,13 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
1072
  $shippingAddress = $paymentInfo->getOrder()->getShippingAddress();
1073
  $salesObject = $paymentInfo->getOrder();
1074
  } else {
 
1075
  $salesObject = $paymentInfo->getQuote();
1076
  $billingAddress = $salesObject->getBillingAddress();
1077
  $shippingAddress = $salesObject->getShippingAddress();
1078
  }
1079
 
 
1080
  $validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
1081
  Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
1082
  );
@@ -1084,22 +1083,45 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
1084
  $params = $this->getRequestHelper()->getOwnerParams($billingAddress, $salesObject);
1085
  $billingParams = $this->getBillToParams($billingAddress);
1086
  $shippingParams = $this->getShipToParams($shippingAddress);
1087
- if($shippingParams) {
1088
  $params = array_merge($params, $shippingParams);
1089
  }
1090
- if($billingParams){
1091
  $params = array_merge($params, $billingParams);
1092
  }
 
1093
 
1094
- if(false === $validator->isValid($params)){
1095
  $result = Mage::helper('ops/validation_result')->getValidationFailedResult(
1096
  $validator->getMessages(), $salesObject
1097
  );
1098
- throw new Mage_Payment_Exception('Validation failed', $result['fields']);
1099
  }
1100
 
1101
  return parent::validate();
1102
  }
1103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1104
 
1105
  }
39
  protected $_config = null;
40
  protected $requestHelper = null;
41
  protected $backendOperationParameterModel = null;
42
+ protected $encoding = 'utf-8';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  /**
45
  * Magento Payment Behaviour Settings
62
  */
63
 
64
  protected $_needsCartDataForRequest = false;
 
65
  protected $_needsShipToParams = true;
66
+ protected $_needsBillToParams = true;
 
67
 
68
  /**
69
  * OPS template modes
73
  const TEMPLATE_OPS_TEMPLATE = 'ops_template';
74
  const TEMPLATE_MAGENTO_INTERNAL = 'magento';
75
 
 
76
  /**
77
  * redirect references
78
  */
 
79
  const REFERENCE_QUOTE_ID = 'quoteId';
80
  const REFERENCE_ORDER_ID = 'orderId';
81
 
118
  */
119
  const FINGERPRINT_CONSENT_SESSION_KEY = 'device_fingerprinting_consent';
120
 
121
+ /**
122
+ * @return string
123
+ */
124
+ public function getEncoding()
125
+ {
126
+ return $this->encoding;
127
+ }
128
+
129
+ /**
130
+ * @param string $encoding
131
+ */
132
+ public function setEncoding($encoding)
133
+ {
134
+ $this->encoding = $encoding;
135
+ }
136
+
137
+ /**
138
+ * @param null $backendOperationParameterModel
139
+ */
140
+ public function setBackendOperationParameterModel($backendOperationParameterModel)
141
+ {
142
+ $this->backendOperationParameterModel = $backendOperationParameterModel;
143
+ }
144
+
145
+ /**
146
+ * @return Netresearch_OPS_Model_Backend_Operation_Parameter
147
+ */
148
+ public function getBackendOperationParameterModel()
149
+ {
150
+ if (null === $this->backendOperationParameterModel) {
151
+ $this->backendOperationParameterModel = Mage::getModel('ops/backend_operation_parameter');
152
+ }
153
+
154
+ return $this->backendOperationParameterModel;
155
+ }
156
+
157
  /**
158
  * Return OPS Config
159
  *
161
  */
162
  public function getConfig()
163
  {
164
+ if (null === $this->_config) {
165
  $this->_config = Mage::getSingleton('ops/config');
166
  }
167
 
173
  return $this->getPaymentAction();
174
  }
175
 
176
+ /**
177
+ * get the frontend gateway path based on encoding property
178
+ */
179
+ public function getFrontendGateWay()
180
+ {
181
+ $gateway = $this->getConfig()->getFrontendGatewayPath();
182
+
183
+ return $gateway;
184
+ }
185
+
186
  /**
187
  * return if shipment params are needed for request
188
  *
229
 
230
  $storeId = 0;
231
  // allow multi store/site for backend orders with disabled backend payment methods in default store
232
+ if (null != $quote && null != $quote->getId()) {
233
  $storeId = $quote->getStoreId();
234
  }
235
  if (Mage_Core_Model_App::ADMIN_STORE_ID == Mage::app()->getStore()->getId()
244
  /**
245
  * if method is enabled for backend payments
246
  *
247
+ * @param int $storeId
248
  * @return bool
249
  */
250
  public function isEnabledForBackend($storeId = 0)
262
  return $this->getConfig()->getPaymentRedirectUrl();
263
  }
264
 
 
 
 
 
 
 
 
 
 
265
  public function getOpsBrand($payment = null)
266
  {
267
+ if (null === $payment) {
268
  $payment = $this->getInfoInstance();
269
  }
270
  $brand = trim($payment->getAdditionalInformation('BRAND'));
277
 
278
  public function getOpsCode($payment = null)
279
  {
280
+ if (null === $payment) {
281
  $payment = $this->getInfoInstance();
282
  }
283
  $pm = trim($payment->getAdditionalInformation('PM'));
376
  /**
377
  * Prepare params array to send it to gateway page via POST
378
  *
379
+ * @param $order
380
+ * @param $requestParams
381
+ * @param bool $isRequest
382
  * @return array
383
  */
384
  public function getFormFields($order, $requestParams, $isRequest = true)
394
  // get mandatory parameters
395
  $formFields = $this->getMandatoryFormFields($order);
396
 
 
 
 
 
 
 
 
397
  $paymentAction = $this->_getOPSPaymentOperation();
398
  if ($paymentAction ) {
399
  $formFields['OPERATION'] = $paymentAction;
401
 
402
  $formFields = array_merge($formFields, $requestHelper->getTemplateParams($order->getStoreId()));
403
 
404
+ $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
405
+ $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();
406
+ $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();
407
+ $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
408
+ $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();
409
+ $formFields['BACKURL'] = $this->getConfig()->getPaymentRetryUrl(
410
+ Mage::helper('ops/payment')->validateOrderForReuse($opsOrderId, $order->getStoreId())
411
+ );
412
 
413
 
414
  /** @var $order Mage_Sales_Model_Order */
434
  $formFields = array_merge($formFields, $methodDependendFields);
435
  }
436
 
437
+ $formFields = $this->transliterateParams($formFields);
438
+
439
  $shaSign = Mage::helper('ops/payment')->shaCrypt(
440
  Mage::helper('ops/payment')
441
  ->getSHASign($formFields, null, $order->getStoreId())
478
  return $value;
479
  }
480
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  /**
482
  * get formated order description
483
  *
487
  */
488
  public function _getOrderDescription($order)
489
  {
490
+ /** @var Mage_Sales_Model_Order_Item[] $items */
491
+ $items = $order->getAllItems();
492
+ $description = array_reduce(
493
+ $items,
494
+ function ($acc, $item) {
495
+ /** @var Mage_Sales_Model_Order_Item $item */
496
+ if (!$item->getParentItem()) {
497
+ $acc .= ($acc != '' ? ', ' : '') . $item->getName();
498
+ }
499
+ return $acc;
500
+ }, ''
501
+ );
 
 
 
 
502
 
503
  return $description;
504
  }
557
  parent::acceptPayment($payment);
558
  $status = $payment->getAdditionalInformation('status');
559
 
560
+ if ($status == Netresearch_OPS_Model_Status::AUTHORIZED
561
+ || $status == Netresearch_OPS_Model_Status::PAYMENT_REQUESTED)
562
+ {
563
  return true;
564
  }
565
 
585
  parent::denyPayment($payment);
586
 
587
  Mage::getSingleton('admin/session')->addNotice(
588
+ $this->getHelper()->__(
589
+ 'Order has been canceled permanently in Magento. Changes in PayEngine platform will no longer be considered.')
590
  );
591
 
592
  return true;
639
  self::OPS_CAPTURE_TRANSACTION_TYPE,
640
  $this,
641
  $payment,
642
+ $amount
 
643
  );
644
+ $requestParams = $this->transliterateParams($requestParams);
645
  $response = Mage::getSingleton('ops/api_directlink')->performRequest(
646
  $requestParams,
647
  Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
650
 
651
  Mage::getModel('ops/response_handler')->processResponse($response, $this, false);
652
 
 
 
653
  } catch (Exception $e) {
654
  Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
655
  Mage::helper('ops')->log("Exception in capture request:" . $e->getMessage());
656
  Mage::throwException($e->getMessage());
657
  }
658
+
659
+ return $this;
660
  }
661
 
662
  /**
669
  */
670
  public function refund(Varien_Object $payment, $amount)
671
  {
672
+ /** @var Netresearch_OPS_Helper_Order_Refund $refundHelper */
673
  $refundHelper = Mage::helper('ops/order_refund');
674
 
675
  if ($refundHelper->getOpenRefundTransaction($payment)->getId()) {
676
+ Mage::throwException(
677
+ $this->getHelper()->__(
678
+ "There is already one creditmemo in the queue." .
679
+ "The Creditmemo will be created automatically as soon as PayEngine sends an acknowledgement."
680
+ )
681
+ );
682
  }
683
 
684
  $refundHelper->setAmount($amount)->setPayment($payment);
 
685
  $storeId = $payment->getOrder()->getStoreId();
686
 
687
  try {
689
  self::OPS_REFUND_TRANSACTION_TYPE,
690
  $this,
691
  $payment,
692
+ $amount
 
693
  );
694
+ $requestParams = $this->transliterateParams($requestParams);
695
  $response = Mage::getSingleton('ops/api_directlink')->performRequest(
696
  $requestParams,
697
  Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
760
  */
761
 
762
  //Proceed parent cancel method in case that regirstry value ops_auto_void is set
763
+ if (true === Mage::registry('ops_auto_void')) {
764
  Mage::unregister('ops_auto_void');
 
765
  return parent::cancel($payment);
766
+ }
767
 
768
  //If order has state 'pending_payment' and the payment has PayEngine-status 0 or null (unknown) then cancel the order
769
  if (true === $this->canCancelManually($payment->getOrder())) {
775
  }
776
 
777
  //Abort cancel method by throwing a Mage_Core_Exception
778
+ Mage::throwException($this->getHelper()->__('Please use void to cancel the operation.'));
779
  }
780
 
781
  /**
782
  * Custom void behavior, trigger PayEngine cancel request
783
  *
784
+ * @param Varien_Object $payment
785
+ * @return $this|void
 
 
786
  */
787
  public function void(Varien_Object $payment)
788
  {
789
 
790
  $status = $payment->getAdditionalInformation('status');
791
 
792
+ if (!Netresearch_OPS_Model_Status::canVoidTransaction($status)) {
793
  Mage::throwException($this->getHelper()->__('Status %s can not be voided.', $status));
794
  }
795
 
855
  Mage::helper('ops')->log(
856
  "Exception in void request:" . $e->getMessage()
857
  );
858
+ Mage::throwException($e->getMessage());
859
  }
860
  }
861
 
863
  * get question for fields with disputable value
864
  * users are asked to correct the values before redirect to PayEngine
865
  *
 
 
866
  *
867
  * @return string
868
  */
869
+ public function getQuestion()
870
  {
871
  return '';
872
  }
876
  * users are asked to correct the values before redirect to PayEngine
877
  *
878
  * @param Mage_Sales_Model_Order $order Current order
 
879
  *
880
  * @return array
881
  */
882
+ public function getQuestionedFormFields($order)
883
  {
884
  return array();
885
  }
899
  if (false == is_array($requestParams)) {
900
  $requestParams = array();
901
  }
902
+ if (null === $formFields) {
903
  $formFields = $this->getFormFields($order, $requestParams, false);
904
  }
905
  $availableParams = array_merge($requestParams, $formFields);
906
+ $requiredParams = $this->getQuestionedFormFields($order);
907
  foreach ($requiredParams as $requiredParam) {
908
  if (false == array_key_exists($requiredParam, $availableParams)
909
  || 0 == strlen($availableParams[$requiredParam])
929
  //If payment has PayEngine-status 0 or null (unknown) or another offline cancelable status
930
  $status = $payment->getAdditionalInformation('status');
931
 
932
+ return (null === $status)
933
  || in_array(
934
  $status, array(
935
  Netresearch_OPS_Model_Status::INVALID_INCOMPLETE,
943
  public function getOpsHtmlAnswer($payment = null)
944
  {
945
  $returnValue = '';
946
+ if (null === $payment) {
947
  $quoteId = Mage::getSingleton('checkout/session')->getQuote()->getId();
948
+ if (null === $quoteId) {
949
  $orderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
950
  $order = Mage::getModel('sales/order')->loadByAttribute('increment_id', $orderIncrementId);
951
  } else {
1031
  */
1032
  public function canVoid(Varien_Object $payment)
1033
  {
1034
+ if (Netresearch_OPS_Model_Status::canVoidTransaction($payment->getAdditionalInformation('status'))) {
 
1035
  return parent::canVoid($payment);
1036
  } else {
1037
  return false;
1047
  parent::assignData($data);
1048
 
1049
  $paymentInfo = $this->getInfoInstance();
1050
+ if ($data instanceof Varien_Object && $data->getData($this->getCode().'_data')) {
1051
+ foreach ($data->getData($this->getCode().'_data') as $key => $value) {
1052
  $paymentInfo->setAdditionalInformation($key, $value);
1053
  }
1054
  }
1069
  $shippingAddress = $paymentInfo->getOrder()->getShippingAddress();
1070
  $salesObject = $paymentInfo->getOrder();
1071
  } else {
1072
+ /** @var Mage_Sales_Model_Quote $salesObject */
1073
  $salesObject = $paymentInfo->getQuote();
1074
  $billingAddress = $salesObject->getBillingAddress();
1075
  $shippingAddress = $salesObject->getShippingAddress();
1076
  }
1077
 
1078
+ /** @var Netresearch_OPS_Model_Validator_Parameter_Length $validator */
1079
  $validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
1080
  Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
1081
  );
1083
  $params = $this->getRequestHelper()->getOwnerParams($billingAddress, $salesObject);
1084
  $billingParams = $this->getBillToParams($billingAddress);
1085
  $shippingParams = $this->getShipToParams($shippingAddress);
1086
+ if ($shippingParams) {
1087
  $params = array_merge($params, $shippingParams);
1088
  }
1089
+ if ($billingParams) {
1090
  $params = array_merge($params, $billingParams);
1091
  }
1092
+ $params['CN'] = $billingAddress->getFirstname() . ' ' . $billingAddress->getLastname();
1093
 
1094
+ if (false === $validator->isValid($params)) {
1095
  $result = Mage::helper('ops/validation_result')->getValidationFailedResult(
1096
  $validator->getMessages(), $salesObject
1097
  );
1098
+ throw Mage::exception('Mage_Payment', implode(', ', $result['fields']));
1099
  }
1100
 
1101
  return parent::validate();
1102
  }
1103
 
1104
+ /**
1105
+ * Transliterates params if necessary by configuration
1106
+ *
1107
+ * @param string[] $formFields formfields to transliterate
1108
+ *
1109
+ * @return string[]
1110
+ */
1111
+ protected function transliterateParams($formFields)
1112
+ {
1113
+ if (strtoupper($this->getEncoding()) != 'UTF-8') {
1114
+ setlocale(LC_CTYPE, Mage::app()->getLocale()->getLocaleCode());
1115
+ array_walk(
1116
+ $formFields,
1117
+ function (&$value) {
1118
+ $value = iconv('UTF-8', 'ASCII//TRANSLIT', $value);
1119
+ }
1120
+ );
1121
+ }
1122
+
1123
+ return $formFields;
1124
+ }
1125
+
1126
 
1127
  }
app/code/community/Netresearch/OPS/Model/Payment/Bancontact.php CHANGED
@@ -38,11 +38,65 @@ class Netresearch_OPS_Model_Payment_Bancontact
38
  protected $_canBackendDirectCapture = true;
39
 
40
  /** info source path */
41
- protected $_infoBlockType = 'ops/info_redirect';
42
 
43
  /** payment code */
44
  protected $_code = self::CODE;
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  }
48
 
38
  protected $_canBackendDirectCapture = true;
39
 
40
  /** info source path */
41
+ protected $_infoBlockType = 'ops/info_bancontact';
42
 
43
  /** payment code */
44
  protected $_code = self::CODE;
45
 
46
+ protected $_mobileDetectHelper = null;
47
+
48
+ /**
49
+ * add needed params to dependend formfields
50
+ *
51
+ * @param Mage_Sales_Model_Order $order
52
+ * @param null $requestParams
53
+ * @return string[]
54
+ */
55
+ public function getMethodDependendFormFields($order, $requestParams = null)
56
+ {
57
+ $formFields = parent::getMethodDependendFormFields($order, $requestParams);
58
+ $formFields['DEVICE'] = $this->getInfoInstance()->getAdditionalInformation('DEVICE');
59
+
60
+ return $formFields;
61
+ }
62
+
63
+ /**
64
+ * @param mixed $data
65
+ * @return $this
66
+ */
67
+ public function assignData($data)
68
+ {
69
+ parent::assignData($data);
70
+ $payment = $this->getInfoInstance();
71
+ $payment->setAdditionalInformation('DEVICE', $this->getMobileDetectHelper()->getDeviceType());
72
+
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Get Mobile Detect Helper
78
+ *
79
+ * @return Netresearch_OPS_Helper_MobileDetect
80
+ */
81
+ public function getMobileDetectHelper()
82
+ {
83
+ if ($this->_mobileDetectHelper === null) {
84
+ $this->_mobileDetectHelper = Mage::helper('ops/mobileDetect');
85
+ }
86
+ return $this->_mobileDetectHelper;
87
+ }
88
+
89
+ /**
90
+ * @param Netresearch_OPS_Helper_MobileDetect $mobileHelper
91
+ *
92
+ * @returns $this
93
+ */
94
+ public function setMobileDetectHelper($mobileHelper)
95
+ {
96
+ $this->_mobileDetectHelper = $mobileHelper;
97
+
98
+ return $this;
99
+ }
100
 
101
  }
102
 
app/code/community/Netresearch/OPS/Model/Payment/BankTransfer.php CHANGED
@@ -16,6 +16,9 @@ class Netresearch_OPS_Model_Payment_BankTransfer
16
  /** info source path */
17
  protected $_infoBlockType = 'ops/info_redirect';
18
 
 
 
 
19
  /** payment code */
20
  protected $_code = 'ops_bankTransfer';
21
 
@@ -37,7 +40,7 @@ class Netresearch_OPS_Model_Payment_BankTransfer
37
  $pm = $brand = trim('Bank transfer' . (('*' == $countryId) ? '' : ' ' . $countryId));
38
 
39
  $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
40
- $payment->setAdditionalInformation('PM', $pm);
41
  $payment->setAdditionalInformation('BRAND', $brand);
42
 
43
  parent::assignData($data);
16
  /** info source path */
17
  protected $_infoBlockType = 'ops/info_redirect';
18
 
19
+ /** form block type */
20
+ protected $_formBlockType = 'ops/form_bankTransfer';
21
+
22
  /** payment code */
23
  protected $_code = 'ops_bankTransfer';
24
 
40
  $pm = $brand = trim('Bank transfer' . (('*' == $countryId) ? '' : ' ' . $countryId));
41
 
42
  $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
43
+ $payment->setAdditionalInformation('PM', $pm);
44
  $payment->setAdditionalInformation('BRAND', $brand);
45
 
46
  parent::assignData($data);
app/code/community/Netresearch/OPS/Model/Payment/Cc.php CHANGED
@@ -24,7 +24,10 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
24
  protected $featureModel = null;
25
 
26
 
27
- /** ops payment code */
 
 
 
28
  public function getOpsCode($payment = null)
29
  {
30
  $opsBrand = $this->getOpsBrand($payment);
@@ -45,7 +48,7 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
45
  */
46
  public function getOpsBrand($payment = null)
47
  {
48
- if (is_null($payment)) {
49
  $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
50
  }
51
 
@@ -63,7 +66,7 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
63
  public function getOrderPlaceRedirectUrl($payment = null)
64
  {
65
  $salesObject = $this->getInfoInstance()->getOrder() ? : $this->getInfoInstance()->getQuote();
66
- if ($this->hasBrandAliasInterfaceSupport($payment) || is_null($salesObject->getRemoteIp())) {
67
  if ('' == $this->getOpsHtmlAnswer($payment)) {
68
  return false;
69
  } // Prevent redirect on cc payment
@@ -143,9 +146,11 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
143
  }
144
 
145
 
146
- protected function performPreDirectLinkCallActions(Mage_Sales_Model_Quote $quote, Varien_Object $payment,
 
147
  $requestParams = array()
148
- ) {
 
149
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true);
150
  if (true === Mage::getModel('ops/config')->isAliasManagerEnabled($this->getCode())) {
151
  $this->validateAlias($quote, $payment);
@@ -246,7 +251,7 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
246
  */
247
  public function isAvailable($quote = null)
248
  {
249
- if (!is_null($quote) && !$quote->getItemsCount() > 0 && $this->getDataHelper()->isAdminSession()) {
250
  /* Disable payment method in backend as long as there are no items in quote to
251
  * avoid problems with alias creation in EE1.12 & EE1.13
252
  */
@@ -271,6 +276,26 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
271
  $formFields['CREDITDEBIT'] = "C";
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  return $formFields;
275
  }
276
  }
24
  protected $featureModel = null;
25
 
26
 
27
+ /**
28
+ * @param null $payment
29
+ * @return string
30
+ */
31
  public function getOpsCode($payment = null)
32
  {
33
  $opsBrand = $this->getOpsBrand($payment);
48
  */
49
  public function getOpsBrand($payment = null)
50
  {
51
+ if (null === $payment) {
52
  $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
53
  }
54
 
66
  public function getOrderPlaceRedirectUrl($payment = null)
67
  {
68
  $salesObject = $this->getInfoInstance()->getOrder() ? : $this->getInfoInstance()->getQuote();
69
+ if ($this->hasBrandAliasInterfaceSupport($payment) || null === $salesObject->getRemoteIp()) {
70
  if ('' == $this->getOpsHtmlAnswer($payment)) {
71
  return false;
72
  } // Prevent redirect on cc payment
146
  }
147
 
148
 
149
+ protected function performPreDirectLinkCallActions(
150
+ Mage_Sales_Model_Quote $quote, Varien_Object $payment,
151
  $requestParams = array()
152
+ )
153
+ {
154
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true);
155
  if (true === Mage::getModel('ops/config')->isAliasManagerEnabled($this->getCode())) {
156
  $this->validateAlias($quote, $payment);
251
  */
252
  public function isAvailable($quote = null)
253
  {
254
+ if (null != $quote && !$quote->getItemsCount() > 0 && $this->getDataHelper()->isAdminSession()) {
255
  /* Disable payment method in backend as long as there are no items in quote to
256
  * avoid problems with alias creation in EE1.12 & EE1.13
257
  */
276
  $formFields['CREDITDEBIT'] = "C";
277
  }
278
 
279
+ $alias = $order->getPayment()->getAdditionalInformation('alias');
280
+
281
+ if ($alias) {
282
+ $formFields['ALIAS'] = $alias;
283
+ $formFields['ALIASOPERATION'] = "BYPSP";
284
+ $formFields['ECI'] = 9;
285
+ $formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForExistingAlias(
286
+ $order->getPayment()->getMethodInstance()->getCode(),
287
+ $order->getStoreId()
288
+ );
289
+ } else {
290
+ $formFields['ALIAS'] = "";
291
+ $formFields['ALIASOPERATION'] = "BYPSP";
292
+ $formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForNewAlias(
293
+ $order->getPayment()->getMethodInstance()->getCode(),
294
+ $order->getStoreId()
295
+ );
296
+
297
+ }
298
+
299
  return $formFields;
300
  }
301
  }
app/code/community/Netresearch/OPS/Model/Payment/Debitcard.php CHANGED
@@ -15,7 +15,10 @@ class Netresearch_OPS_Model_Payment_Debitcard extends Netresearch_OPS_Model_Paym
15
  protected $_code = 'ops_dc';
16
 
17
 
18
- /** ops payment code */
 
 
 
19
  public function getOpsCode($payment = null)
20
  {
21
  return 'CreditCard';
15
  protected $_code = 'ops_dc';
16
 
17
 
18
+ /**
19
+ * @param null $payment
20
+ * @return string
21
+ */
22
  public function getOpsCode($payment = null)
23
  {
24
  return 'CreditCard';
app/code/community/Netresearch/OPS/Model/Payment/DirectDebit.php CHANGED
@@ -38,22 +38,23 @@ class Netresearch_OPS_Model_Payment_DirectDebit
38
  return $this->requestParamsHelper;
39
  }
40
 
41
- protected function performPreDirectLinkCallActions(Mage_Sales_Model_Quote $quote, Varien_Object $payment, $requestParams = array())
 
 
 
42
  {
43
  return $this;
44
  }
45
 
46
  protected function performPostDirectLinkCallAction(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order)
47
  {
 
 
48
  return $this;
49
  }
50
 
51
  protected function handleAdminPayment(Mage_Sales_Model_Quote $quote)
52
  {
53
- $directDebitHelper = Mage::helper('ops/directDebit');
54
- $requestParams = Mage::app()->getRequest()->getParam('ops_directDebit');
55
- $directDebitHelper->handleAdminPayment($quote, $requestParams);
56
-
57
  return $this;
58
  }
59
  }
38
  return $this->requestParamsHelper;
39
  }
40
 
41
+ protected function performPreDirectLinkCallActions(
42
+ Mage_Sales_Model_Quote $quote,
43
+ Varien_Object $payment, $requestParams = array()
44
+ )
45
  {
46
  return $this;
47
  }
48
 
49
  protected function performPostDirectLinkCallAction(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order)
50
  {
51
+ Mage::helper('ops/alias')->setAliasActive($quote, $order);
52
+
53
  return $this;
54
  }
55
 
56
  protected function handleAdminPayment(Mage_Sales_Model_Quote $quote)
57
  {
 
 
 
 
58
  return $this;
59
  }
60
  }
app/code/community/Netresearch/OPS/Model/Payment/DirectEbanking.php CHANGED
@@ -16,20 +16,12 @@ class Netresearch_OPS_Model_Payment_DirectEbanking
16
  /** info source path */
17
  protected $_infoBlockType = 'ops/info_redirect';
18
 
 
 
 
19
  /** payment code */
20
  protected $_code = 'ops_directEbanking';
21
 
22
-
23
- protected function getPayment()
24
- {
25
- $checkout = Mage::getSingleton('checkout/session');
26
- $payment = $checkout->getQuote()->getPayment();
27
- if (!$payment->getId()) {
28
- $payment = Mage::getModel('sales/order')->loadByIncrementId($checkout->getLastRealOrderId())->getPayment();
29
- }
30
- return $payment;
31
- }
32
-
33
  /**
34
  * Assign data to info model instance
35
  *
@@ -51,7 +43,7 @@ class Netresearch_OPS_Model_Payment_DirectEbanking
51
 
52
  $payment = $this->getInfoInstance();
53
  // brand == pm for all DirectEbanking methods
54
- $payment->setAdditionalInformation('PM', $brand);
55
  $payment->setAdditionalInformation('BRAND', $brand);
56
  parent::assignData($data);
57
  return $this;
@@ -64,8 +56,9 @@ class Netresearch_OPS_Model_Payment_DirectEbanking
64
  * @param string $value
65
  * @return string
66
  */
67
- protected function fixSofortUberweisungBrand($value){
68
- if($value === 'Sofort Uberweisung'){
 
69
  return 'DirectEbanking';
70
  }
71
  return $value;
16
  /** info source path */
17
  protected $_infoBlockType = 'ops/info_redirect';
18
 
19
+ /** form block type */
20
+ protected $_formBlockType = 'ops/form_directEbanking';
21
+
22
  /** payment code */
23
  protected $_code = 'ops_directEbanking';
24
 
 
 
 
 
 
 
 
 
 
 
 
25
  /**
26
  * Assign data to info model instance
27
  *
43
 
44
  $payment = $this->getInfoInstance();
45
  // brand == pm for all DirectEbanking methods
46
+ $payment->setAdditionalInformation('PM', $brand);
47
  $payment->setAdditionalInformation('BRAND', $brand);
48
  parent::assignData($data);
49
  return $this;
56
  * @param string $value
57
  * @return string
58
  */
59
+ protected function fixSofortUberweisungBrand($value)
60
+ {
61
+ if ($value === 'Sofort Uberweisung') {
62
  return 'DirectEbanking';
63
  }
64
  return $value;
app/code/community/Netresearch/OPS/Model/Payment/DirectLink.php CHANGED
@@ -155,7 +155,8 @@ abstract class Netresearch_OPS_Model_Payment_DirectLink extends Netresearch_OPS_
155
 
156
  protected function confirmPayment(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote $quote,
157
  Varien_Object $payment
158
- ) {
 
159
  $this->handleAdminPayment($quote);
160
  $requestParams = $this->getRequestParamsHelper()->getDirectLinkRequestParams($quote, $order, $payment);
161
  $this->invokeRequestParamValidation($requestParams);
@@ -215,7 +216,8 @@ abstract class Netresearch_OPS_Model_Payment_DirectLink extends Netresearch_OPS_
215
 
216
 
217
  /**
218
- * performs direct link request either for inline payments and direct sale mode or the normal maintenance call (invoice)
 
219
  *
220
  * @override
221
  *
155
 
156
  protected function confirmPayment(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote $quote,
157
  Varien_Object $payment
158
+ )
159
+ {
160
  $this->handleAdminPayment($quote);
161
  $requestParams = $this->getRequestParamsHelper()->getDirectLinkRequestParams($quote, $order, $payment);
162
  $this->invokeRequestParamValidation($requestParams);
216
 
217
 
218
  /**
219
+ * performs direct link request either for inline payments and
220
+ * direct sale mode or the normal maintenance call (invoice)
221
  *
222
  * @override
223
  *
app/code/community/Netresearch/OPS/Model/Payment/Features/PaymentEmail.php CHANGED
@@ -1,197 +1,198 @@
1
- <?php
2
- /**
3
- * Netresearch OPS
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
- *
12
- * DISCLAIMER
13
- *
14
- * Do not edit or add to this file if you wish to upgrade this extension to
15
- * newer versions in the future.
16
- *
17
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
- * @license Open Software License (OSL 3.0)
19
- * @link http://opensource.org/licenses/osl-3.0.php
20
- */
21
-
22
- /**
23
- * Implements functionality to send PayEngine specific mails
24
- *
25
- * @category Payment method
26
- * @package Netresearch OPS
27
- * @author Paul Siedler <paul.siedler@netresearch.de>
28
- */
29
- class Netresearch_OPS_Model_Payment_Features_PaymentEmail
30
- {
31
-
32
- protected function getConfig()
33
- {
34
- return Mage::getModel('ops/config');
35
- }
36
-
37
- /**
38
- * Check if payment email is available for order
39
- *
40
- * @param $order
41
- *
42
- * @return bool
43
- */
44
- public function isAvailableForOrder($order)
45
- {
46
- if ($order instanceof Mage_Sales_Model_Order) {
47
- $status = $order->getPayment()->getAdditionalInformation('status');
48
-
49
- return Netresearch_OPS_Model_Status::canResendPaymentInfo($status);
50
- }
51
-
52
- return false;
53
- }
54
-
55
-
56
- /**
57
- * Resends the payment information and returns true/false, depending if succeeded or not
58
- *
59
- * @param Mage_Sales_Model_Order $order
60
- *
61
- * @return boolean success state
62
- */
63
- public function resendPaymentInfo(Mage_Sales_Model_Order $order)
64
- {
65
-
66
- // reset payment method so the customer can choose freely from all available methods
67
- $this->setPaymentMethodToGeneric($order);
68
-
69
-
70
- $identity = $this->getIdentity($this->getConfig()->getResendPaymentInfoIdentity($order->getStoreId()));
71
-
72
- $emailTemplate = $this->prepareTemplate(
73
- $this->getConfig()->getResendPaymentInfoTemplate($order->getStoreId()),
74
- $identity->getEmail(),
75
- $identity->getName()
76
- );
77
-
78
- $parameters = array(
79
- "order" => $order,
80
- "paymentLink" => $this->generatePaymentLink($order),
81
- "store" => Mage::app()->getStore($order->getStoreId())
82
- );
83
-
84
- return $emailTemplate->send($order->getCustomerEmail(), $order->getCustomerName(), $parameters);
85
-
86
- }
87
-
88
- /**
89
- * Generates the payment url
90
- *
91
- * @param Mage_Sales_Model_Order $order
92
- *
93
- * @return string
94
- */
95
- protected function generatePaymentLink(Mage_Sales_Model_Order $order)
96
- {
97
- $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
98
-
99
- $params = array(
100
- 'orderID' => $opsOrderId
101
- );
102
-
103
- $secret = $this->getConfig()->getShaInCode($order->getStoreId());
104
- $raw = Mage::helper('ops/payment')->getSHAInSet($params, $secret);
105
-
106
- $params['SHASIGN'] = strtoupper(Mage::helper('ops/payment')->shaCrypt($raw));
107
-
108
- $url = Mage::getModel('ops/config')->getPaymentRetryUrl($params, $order->getStoreId());
109
-
110
- return $url;
111
- }
112
-
113
- /**
114
- * Set payment method to Netresearch_OPS_Model_Payment_Flex
115
- *
116
- * @param Mage_Sales_Model_Order $order
117
- *
118
- * @throws Exception
119
- */
120
- protected function setPaymentMethodToGeneric(Mage_Sales_Model_Order $order)
121
- {
122
- $order->getPayment()->setMethod(Netresearch_OPS_Model_Payment_Flex::CODE)->save();
123
- }
124
-
125
- /**
126
- * Sends suspend subscription mail to configured store contact via configured mail template
127
- *
128
- * @param Mage_Sales_Model_Recurring_Profile $profile
129
- * @param Mage_Customer_Model_Customer $customer
130
- *
131
- * @return bool
132
- */
133
- public function sendSuspendSubscriptionMail($profile, $customer)
134
- {
135
- if (is_null($profile) || is_null($customer)) {
136
- Mage::throwException('Could not send mail due to internal error!');
137
- }
138
-
139
- $emailTemplate = $this->prepareTemplate(
140
- $this->getConfig()->getSuspendSubscriptionTemplate($profile->getStoreId()),
141
- $customer->getEmail(),
142
- $customer->getName()
143
- );
144
-
145
- $emailTemplate->addBcc($customer->getEmail());
146
-
147
- $parameters = array(
148
- "profile" => $profile,
149
- "customer" => $customer,
150
- "store" => Mage::app()->getStore($profile->getStoreId())
151
- );
152
-
153
- $identity = $this->getIdentity($this->getConfig()->getSuspendSubscriptionIdentity($profile->getStoreId()));
154
-
155
- return $emailTemplate->send($identity->getEmail(), $identity->getName(), $parameters);
156
-
157
- }
158
-
159
-
160
- /**
161
- * Loads email and name of the given store identity
162
- *
163
- * @param string $key - identity to load, defaults to sales
164
- *
165
- * @return Varien_Object with data name and email
166
- */
167
- protected function getIdentity($key = 'sales')
168
- {
169
- $identity = new Varien_Object();
170
- $identity->setName(Mage::getStoreConfig('trans_email/ident_' . $key . '/name'))
171
- ->setEmail(Mage::getStoreConfig('trans_email/ident_' . $key . '/email'));
172
-
173
- return $identity;
174
- }
175
-
176
- /**
177
- * Loads the given template by identifier, sets sender mail and name
178
- *
179
- * @param string $template
180
- * @param string $senderMail
181
- * @param string $senderName
182
- *
183
- * @return Mage_Core_Model_Email_Template
184
- */
185
- protected function prepareTemplate($template, $senderMail, $senderName)
186
- {
187
- $emailTemplate = Mage::getModel('core/email_template')->load($template);
188
- if (is_null($emailTemplate->getTemplateSubject())) {
189
- $emailTemplate = $emailTemplate->loadDefault($template);
190
- }
191
- $emailTemplate->setSenderName($senderName)
192
- ->setSenderEmail($senderMail);
193
-
194
- return $emailTemplate;
195
- }
196
-
197
- }
 
1
+ <?php
2
+ /**
3
+ * Netresearch OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * Implements functionality to send PayEngine specific mails
24
+ *
25
+ * @category Payment method
26
+ * @package Netresearch OPS
27
+ * @author Paul Siedler <paul.siedler@netresearch.de>
28
+ */
29
+ class Netresearch_OPS_Model_Payment_Features_PaymentEmail
30
+ {
31
+
32
+ protected function getConfig()
33
+ {
34
+ return Mage::getModel('ops/config');
35
+ }
36
+
37
+ /**
38
+ * Check if payment email is available for order
39
+ *
40
+ * @param $order
41
+ *
42
+ * @return bool
43
+ */
44
+ public function isAvailableForOrder($order)
45
+ {
46
+ if ($order instanceof Mage_Sales_Model_Order) {
47
+ $status = $order->getPayment()->getAdditionalInformation('status');
48
+
49
+ return Netresearch_OPS_Model_Status::canResendPaymentInfo($status);
50
+ }
51
+
52
+ return false;
53
+ }
54
+
55
+
56
+ /**
57
+ * Resends the payment information and returns true/false, depending if succeeded or not
58
+ *
59
+ * @param Mage_Sales_Model_Order $order
60
+ *
61
+ * @return boolean success state
62
+ */
63
+ public function resendPaymentInfo(Mage_Sales_Model_Order $order)
64
+ {
65
+
66
+ // reset payment method so the customer can choose freely from all available methods
67
+ $this->setPaymentMethodToGeneric($order);
68
+
69
+ $identity = $this->getIdentity($this->getConfig()->getResendPaymentInfoIdentity($order->getStoreId()));
70
+
71
+ if ($order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_PayPerMail) {
72
+ $template = $this->getConfig()->getPayPerMailTemplate($order->getStoreId());
73
+ } else {
74
+ $template = $this->getConfig()->getResendPaymentInfoTemplate($order->getStoreId());
75
+ }
76
+
77
+ $emailTemplate = $this->prepareTemplate(
78
+ $template,
79
+ $identity->getEmail(),
80
+ $identity->getName()
81
+ );
82
+
83
+ $parameters = array(
84
+ "order" => $order,
85
+ "paymentLink" => $this->generatePaymentLink($order),
86
+ "store" => Mage::app()->getStore($order->getStoreId())
87
+ );
88
+
89
+ return $emailTemplate->send($order->getCustomerEmail(), $order->getCustomerName(), $parameters);
90
+
91
+ }
92
+
93
+ /**
94
+ * Generates the payment url
95
+ *
96
+ * @param Mage_Sales_Model_Order $order
97
+ *
98
+ * @return string
99
+ */
100
+ protected function generatePaymentLink(Mage_Sales_Model_Order $order)
101
+ {
102
+ $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
103
+
104
+ $url = Mage::getModel('ops/config')->getPaymentRetryUrl(
105
+ Mage::helper('ops/payment')->validateOrderForReuse($opsOrderId, $order->getStoreId()),
106
+ $order->getStoreId()
107
+ );
108
+
109
+ return $url;
110
+ }
111
+
112
+ /**
113
+ * Set payment method to Netresearch_OPS_Model_Payment_Flex
114
+ *
115
+ * @param Mage_Sales_Model_Order $order
116
+ *
117
+ * @throws Exception
118
+ */
119
+ protected function setPaymentMethodToGeneric(Mage_Sales_Model_Order $order)
120
+ {
121
+ if (!$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_PayPerMail) {
122
+ $order->getPayment()->setMethod(Netresearch_OPS_Model_Payment_Flex::CODE)->save();
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Sends suspend subscription mail to configured store contact via configured mail template
128
+ *
129
+ * @param Mage_Sales_Model_Recurring_Profile $profile
130
+ * @param Mage_Customer_Model_Customer $customer
131
+ *
132
+ * @return bool
133
+ */
134
+ public function sendSuspendSubscriptionMail($profile, $customer)
135
+ {
136
+ if (null === $profile || null === $customer) {
137
+ Mage::throwException('Could not send mail due to internal error!');
138
+ }
139
+
140
+ $emailTemplate = $this->prepareTemplate(
141
+ $this->getConfig()->getSuspendSubscriptionTemplate($profile->getStoreId()),
142
+ $customer->getEmail(),
143
+ $customer->getName()
144
+ );
145
+
146
+ $emailTemplate->addBcc($customer->getEmail());
147
+
148
+ $parameters = array(
149
+ "profile" => $profile,
150
+ "customer" => $customer,
151
+ "store" => Mage::app()->getStore($profile->getStoreId())
152
+ );
153
+
154
+ $identity = $this->getIdentity($this->getConfig()->getSuspendSubscriptionIdentity($profile->getStoreId()));
155
+
156
+ return $emailTemplate->send($identity->getEmail(), $identity->getName(), $parameters);
157
+
158
+ }
159
+
160
+
161
+ /**
162
+ * Loads email and name of the given store identity
163
+ *
164
+ * @param string $key - identity to load, defaults to sales
165
+ *
166
+ * @return Varien_Object with data name and email
167
+ */
168
+ protected function getIdentity($key = 'sales')
169
+ {
170
+ $identity = new Varien_Object();
171
+ $identity->setName(Mage::getStoreConfig('trans_email/ident_' . $key . '/name'))
172
+ ->setEmail(Mage::getStoreConfig('trans_email/ident_' . $key . '/email'));
173
+
174
+ return $identity;
175
+ }
176
+
177
+ /**
178
+ * Loads the given template by identifier, sets sender mail and name
179
+ *
180
+ * @param string $template
181
+ * @param string $senderMail
182
+ * @param string $senderName
183
+ *
184
+ * @return Mage_Core_Model_Email_Template
185
+ */
186
+ protected function prepareTemplate($template, $senderMail, $senderName)
187
+ {
188
+ $emailTemplate = Mage::getModel('core/email_template')->load($template);
189
+ if (null === $emailTemplate->getTemplateSubject()) {
190
+ $emailTemplate = $emailTemplate->loadDefault($template);
191
+ }
192
+ $emailTemplate->setSenderName($senderName)
193
+ ->setSenderEmail($senderMail);
194
+
195
+ return $emailTemplate;
196
+ }
197
+
198
+ }
app/code/community/Netresearch/OPS/Model/Payment/Features/ZeroAmountAuth.php CHANGED
@@ -21,7 +21,8 @@ class Netresearch_OPS_Model_Payment_Features_ZeroAmountAuth
21
  public function isCCAndZeroAmountAuthAllowed(
22
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
23
  Mage_Sales_Model_Quote $quote
24
- ) {
 
25
  $result = false;
26
  $storeId = $quote->getStoreId();
27
  if ($quote->getBaseGrandTotal() < 0.01
21
  public function isCCAndZeroAmountAuthAllowed(
22
  Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
23
  Mage_Sales_Model_Quote $quote
24
+ )
25
+ {
26
  $result = false;
27
  $storeId = $quote->getStoreId();
28
  if ($quote->getBaseGrandTotal() < 0.01
app/code/community/Netresearch/OPS/Model/Payment/IDeal.php CHANGED
@@ -38,11 +38,7 @@ class Netresearch_OPS_Model_Payment_IDeal
38
  $data = $data->getData();
39
  }
40
  if (array_key_exists('iDeal_issuer_id', $data)) {
41
- $payment = Mage::getSingleton('checkout/session')
42
- ->getQuote()
43
- ->getPayment();
44
- $payment
45
- ->setAdditionalInformation('iDeal_issuer_id', $data['iDeal_issuer_id']);
46
  }
47
  parent::assignData($data);
48
 
38
  $data = $data->getData();
39
  }
40
  if (array_key_exists('iDeal_issuer_id', $data)) {
41
+ $this->getInfoInstance()->setAdditionalInformation('iDeal_issuer_id', $data['iDeal_issuer_id']);
 
 
 
 
42
  }
43
  parent::assignData($data);
44
 
app/code/community/Netresearch/OPS/Model/Payment/InterSolve.php CHANGED
@@ -41,7 +41,7 @@ class Netresearch_OPS_Model_Payment_InterSolve
41
  if (strlen(trim($brand)) === 0) {
42
  $brand = 'InterSolve';
43
  }
44
- $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
45
  $payment->setAdditionalInformation('BRAND', $brand);
46
 
47
  parent::assignData($data);
41
  if (strlen(trim($brand)) === 0) {
42
  $brand = 'InterSolve';
43
  }
44
+ $payment = $this->getInfoInstance();
45
  $payment->setAdditionalInformation('BRAND', $brand);
46
 
47
  parent::assignData($data);
app/code/community/Netresearch/OPS/Model/Payment/Kwixo/Abstract.php CHANGED
@@ -30,14 +30,14 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
30
  extends Netresearch_OPS_Model_Payment_Abstract
31
  {
32
 
33
- private $kwixoShippingModel = null;
34
 
35
- private $shippingSettings = null;
36
 
37
  /**
38
- *
39
  * @param Mage_Sales_Model_Order $order
40
- * @param array $requestParams
 
41
  */
42
  public function getMethodDependendFormFields($order, $requestParams = null)
43
  {
@@ -58,8 +58,8 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
58
 
59
  $formFields['ECOM_ESTIMATEDELIVERYDATE']
60
  = $this->getEstimatedDeliveryDate(
61
- $this->getCode(), $order->getStoreId()
62
- );
63
  $formFields['RNPOFFERT'] = $this->getRnpFee(
64
  $this->getCode(), $order->getStoreId()
65
  );
@@ -122,7 +122,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
122
  foreach ($product->getCategoryIds() as $categoryId) {
123
  $kwixoCategory = Mage::getModel('ops/kwixo_category_mapping')
124
  ->loadByCategoryId($categoryId);
125
- if (!is_null($kwixoCategory->getId())) {
126
  $kwixoCategoryId = $kwixoCategory->getKwixoCategoryId();
127
  break;
128
  }
@@ -135,38 +135,23 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
135
  *
136
  *
137
  * @param Mage_Sales_Model_Order $order
138
- * @param array $requestParams
139
  *
140
  * @return array
141
  */
142
  public function getKwixoBillToParams(Mage_Sales_Model_Order $order)
143
  {
144
- $formFields = array();
145
- $billingAddress
146
- = $order->getBillingAddress();
147
- $splittedStreet = $this->splitHouseNumber(
148
- $billingAddress->getStreet1()
149
- );
150
- $formFields['ECOM_BILLTO_POSTAL_NAME_FIRST']
151
- = $billingAddress->getFirstname();
152
- $formFields['ECOM_BILLTO_POSTAL_NAME_LAST']
153
- = $billingAddress->getLastname();
154
- $formFields['OWNERADDRESS'] = str_replace(
155
- "\n", ' ', $billingAddress->getStreet1()
156
- );
157
- if (array_key_exists('street', $splittedStreet)) {
158
- $formFields['OWNERADDRESS'] = trim($splittedStreet['street']);
159
- }
160
- $streetAppendix = trim($billingAddress->getStreet2());
161
- if (0 < strlen($streetAppendix)) {
162
- $formFields['OWNERADDRESS2'] = $streetAppendix;
163
- }
164
- $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = '';
165
- if (array_key_exists('housenumber', $splittedStreet)) {
166
- $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER']
167
- = $splittedStreet['housenumber'];
168
- }
169
- $formFields['OWNERTELNO'] = $billingAddress->getTelephone();
170
 
171
  return $formFields;
172
  }
@@ -175,7 +160,6 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
175
  * return the shipping parameters as array based on shipping method type
176
  *
177
  * @param Mage_Sales_Model_Order $order
178
- * @param array $requestParams
179
  *
180
  * @return array
181
  */
@@ -183,66 +167,42 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
183
  {
184
  $formFields = array();
185
  $shippingAddress = $order->getShippingAddress();
 
186
  if ($shippingAddress === false) {
187
  $shippingAddress = $order->getBillingAddress();
188
  }
189
- $splittedStreet = $this->splitHouseNumber(
190
- $shippingAddress->getStreet1()
191
- );
192
 
193
- $shippingMethodType = (int)$this->getShippingMethodType(
194
- $this->getCode(), $order->getStoreId()
195
- );
196
 
197
- if (in_array(
198
- $shippingMethodType, $this->getShippingMethodTypeValues()
199
- )
200
- ) {
201
  if (4 === $shippingMethodType) {
202
- $formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX']
203
- = $shippingAddress->getPrefix();
204
  }
205
 
206
-
207
  $company = trim($shippingAddress->getCompany());
208
  if (0 < strlen($company)) {
209
  $formFields['ECOM_SHIPTO_COMPANY'] = $company;
210
  }
 
211
  $fax = trim($shippingAddress->getFax());
212
  if (0 < strlen($fax)) {
213
  $formFields['ECOM_SHIPTO_TELECOM_FAX_NUMBER'] = $fax;
214
  }
215
 
216
-
217
- $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1']
218
- = $shippingAddress->getStreet1();
219
- if (array_key_exists('street', $splittedStreet)) {
220
- $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1']
221
- = $splittedStreet['street'];
222
- }
223
- $streetAppendix = trim($shippingAddress->getStreet2());
224
- if (0 < strlen($streetAppendix)) {
225
- $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE2']
226
- = $streetAppendix;
227
- }
228
- $formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = '';
229
- if (array_key_exists('housenumber', $splittedStreet)) {
230
- $formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER']
231
- = $splittedStreet['housenumber'];
232
- }
233
- $formFields['ECOM_SHIPTO_POSTAL_POSTALCODE']
234
- = $shippingAddress->getPostcode();
235
- $formFields['ECOM_SHIPTO_POSTAL_CITY']
236
- = $shippingAddress->getCity();
237
- $formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE']
238
- = $shippingAddress->getCountryId();
239
  }
240
- $formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST']
241
- = $shippingAddress->getFirstname();
242
- $formFields['ECOM_SHIPTO_POSTAL_NAME_LAST']
243
- = $shippingAddress->getLastname();
244
- $formFields['ECOM_SHIPTO_TELECOM_PHONE_NUMBER']
245
- = $shippingAddress->getTelephone();
246
 
247
  return $formFields;
248
  }
@@ -268,11 +228,11 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
268
  }
269
 
270
  $subtotal += $item->getBasePriceInclTax(
271
- ) * $item->getQtyOrdered();
272
  $formFields['ITEMFDMPRODUCTCATEG' . $itemCounter]
273
  = $this->getKwixoCategoryFromOrderItem(
274
- $item
275
- );
276
  $formFields['ITEMID' . $itemCounter] = $item->getItemId();
277
  $formFields['ITEMNAME' . $itemCounter] = substr(
278
  $item->getName(), 0, 40
@@ -282,7 +242,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
282
  );
283
  $formFields['ITEMQUANT' . $itemCounter]
284
  = (int)$item->getQtyOrdered(
285
- );
286
  $formFields['ITEMVAT' . $itemCounter] = str_replace(
287
  ',', '.', (string)(float)$item->getBaseTaxAmount()
288
  );
@@ -318,25 +278,6 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
318
  return $formFields;
319
  }
320
 
321
- /**
322
- * splits house number and street for france addresses
323
- *
324
- * @param string $address
325
- *
326
- * @return array
327
- */
328
- public function splitHouseNumber($address)
329
- {
330
- $splittedStreet = array();
331
- $street = str_replace("\n", ' ', $address);
332
- $regexp = '/(?P<housenumber>[0-9]+)([,:\s])(?P<street>.+)/';
333
- if (!preg_match($regexp, $street, $splittedStreet)) {
334
- $splittedStreet[1] = $street;
335
- $splittedStreet[2] = '';
336
- }
337
-
338
- return $splittedStreet;
339
- }
340
 
341
  /**
342
  * returns the delivery date as date based on actual date and adding
@@ -376,10 +317,10 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
376
  /**
377
  * returns the Shipping Method Type configured in backend
378
  *
379
- * @param string $code
380
- * @param int $storeId
381
- *
382
- * @return string
383
  */
384
  public function getShippingMethodType(
385
  $code, $storeId = null, $isVirtual = false
@@ -463,12 +404,10 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
463
  * get question for fields with disputable value
464
  * users are asked to correct the values before redirect to PayEngine
465
  *
466
- * @param Mage_Sales_Model_Order $order Current order
467
- * @param array $requestParams Request parameters
468
  *
469
  * @return string
470
  */
471
- public function getQuestion($order, $requestParams)
472
  {
473
  return Mage::helper('ops/data')->__(
474
  'Please make sure that the displayed data is correct.'
@@ -480,12 +419,12 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
480
  * users are asked to correct the values before redirect to PayEngine
481
  *
482
  * @param Mage_Sales_Model_Order $order Current order
483
- * @param array $requestParams Request parameters
484
  *
485
  * @return array
486
  */
487
- public function getQuestionedFormFields($order, $requestParams)
488
  {
 
489
  $questionedFormFields = array(
490
  'CIVILITY',
491
  'OWNERADDRESS',
@@ -499,10 +438,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
499
  $shippingMethodType = (int)$this->getShippingMethodType(
500
  $this->getCode(), $storeId
501
  );
502
- if (in_array(
503
- $shippingMethodType, $this->getShippingMethodTypeValues()
504
- )
505
- ) {
506
  $questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_NUMBER';
507
  $questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_LINE1';
508
  }
@@ -530,6 +466,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
530
  *
531
  * @param array $formFields - the array to populate
532
  * @param null $dataArray - the array containing the data
 
533
  *
534
  * @return array - the populated array
535
  */
@@ -544,7 +481,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
544
  if (array_key_exists($key, $formFields)
545
  && in_array(
546
  $key,
547
- $this->getQuestionedFormFields($order, $dataArray), true
548
  )
549
  || $key == 'CIVILITY'
550
  ) {
@@ -601,8 +538,9 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
601
 
602
  /**
603
  * @param $carrierCode
 
604
  */
605
- private function loadShippingSettingForCarrierCode($carrierCode)
606
  {
607
  $this->shippingSettings = $this->getKwixoShippingModel()->load(
608
  $carrierCode, 'shipping_code'
30
  extends Netresearch_OPS_Model_Payment_Abstract
31
  {
32
 
33
+ protected $kwixoShippingModel = null;
34
 
35
+ protected $shippingSettings = null;
36
 
37
  /**
 
38
  * @param Mage_Sales_Model_Order $order
39
+ * @param null $requestParams
40
+ * @return string[]
41
  */
42
  public function getMethodDependendFormFields($order, $requestParams = null)
43
  {
58
 
59
  $formFields['ECOM_ESTIMATEDELIVERYDATE']
60
  = $this->getEstimatedDeliveryDate(
61
+ $this->getCode(), $order->getStoreId()
62
+ );
63
  $formFields['RNPOFFERT'] = $this->getRnpFee(
64
  $this->getCode(), $order->getStoreId()
65
  );
122
  foreach ($product->getCategoryIds() as $categoryId) {
123
  $kwixoCategory = Mage::getModel('ops/kwixo_category_mapping')
124
  ->loadByCategoryId($categoryId);
125
+ if (null != $kwixoCategory->getId()) {
126
  $kwixoCategoryId = $kwixoCategory->getKwixoCategoryId();
127
  break;
128
  }
135
  *
136
  *
137
  * @param Mage_Sales_Model_Order $order
 
138
  *
139
  * @return array
140
  */
141
  public function getKwixoBillToParams(Mage_Sales_Model_Order $order)
142
  {
143
+ $formFields = array();
144
+ $billingAddress = $order->getBillingAddress();
145
+
146
+ $billingStreet = str_replace("\n", ' ', $billingAddress->getStreet(-1));
147
+ $splittedBillingStreet = Mage::Helper('ops/address')->splitStreet($billingStreet);
148
+
149
+ $formFields['ECOM_BILLTO_POSTAL_NAME_FIRST'] = $billingAddress->getFirstname();
150
+ $formFields['ECOM_BILLTO_POSTAL_NAME_LAST'] = $billingAddress->getLastname();
151
+ $formFields['OWNERADDRESS'] = $splittedBillingStreet['street_name'];
152
+ $formFields['OWNERADDRESS2'] = $splittedBillingStreet['supplement'];
153
+ $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = $splittedBillingStreet['street_number'];
154
+ $formFields['OWNERTELNO'] = $billingAddress->getTelephone();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  return $formFields;
157
  }
160
  * return the shipping parameters as array based on shipping method type
161
  *
162
  * @param Mage_Sales_Model_Order $order
 
163
  *
164
  * @return array
165
  */
167
  {
168
  $formFields = array();
169
  $shippingAddress = $order->getShippingAddress();
170
+
171
  if ($shippingAddress === false) {
172
  $shippingAddress = $order->getBillingAddress();
173
  }
 
 
 
174
 
175
+ $shippingStreet = str_replace("\n", ' ', $shippingAddress->getStreet(-1));
176
+ $splittedShippingStreet = Mage::Helper('ops/address')->splitStreet($shippingStreet);
177
+ $shippingMethodType = (int)$this->getShippingMethodType($this->getCode(), $order->getStoreId());
178
 
179
+ if (in_array($shippingMethodType, $this->getShippingMethodTypeValues())) {
 
 
 
180
  if (4 === $shippingMethodType) {
181
+ $formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix();
 
182
  }
183
 
 
184
  $company = trim($shippingAddress->getCompany());
185
  if (0 < strlen($company)) {
186
  $formFields['ECOM_SHIPTO_COMPANY'] = $company;
187
  }
188
+
189
  $fax = trim($shippingAddress->getFax());
190
  if (0 < strlen($fax)) {
191
  $formFields['ECOM_SHIPTO_TELECOM_FAX_NUMBER'] = $fax;
192
  }
193
 
194
+ $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $shippingAddress->getStreet1();
195
+ $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $splittedShippingStreet['street_name'];
196
+ $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE2'] = $splittedShippingStreet['supplement'];
197
+ $formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = $splittedShippingStreet['street_number'];
198
+ $formFields['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippingAddress->getPostcode();
199
+ $formFields['ECOM_SHIPTO_POSTAL_CITY'] = $shippingAddress->getCity();
200
+ $formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shippingAddress->getCountryId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  }
202
+
203
+ $formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shippingAddress->getFirstname();
204
+ $formFields['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shippingAddress->getLastname();
205
+ $formFields['ECOM_SHIPTO_TELECOM_PHONE_NUMBER'] = $shippingAddress->getTelephone();
 
 
206
 
207
  return $formFields;
208
  }
228
  }
229
 
230
  $subtotal += $item->getBasePriceInclTax(
231
+ ) * $item->getQtyOrdered();
232
  $formFields['ITEMFDMPRODUCTCATEG' . $itemCounter]
233
  = $this->getKwixoCategoryFromOrderItem(
234
+ $item
235
+ );
236
  $formFields['ITEMID' . $itemCounter] = $item->getItemId();
237
  $formFields['ITEMNAME' . $itemCounter] = substr(
238
  $item->getName(), 0, 40
242
  );
243
  $formFields['ITEMQUANT' . $itemCounter]
244
  = (int)$item->getQtyOrdered(
245
+ );
246
  $formFields['ITEMVAT' . $itemCounter] = str_replace(
247
  ',', '.', (string)(float)$item->getBaseTaxAmount()
248
  );
278
  return $formFields;
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  /**
283
  * returns the delivery date as date based on actual date and adding
317
  /**
318
  * returns the Shipping Method Type configured in backend
319
  *
320
+ * @param $code
321
+ * @param null $storeId
322
+ * @param bool $isVirtual
323
+ * @return int
324
  */
325
  public function getShippingMethodType(
326
  $code, $storeId = null, $isVirtual = false
404
  * get question for fields with disputable value
405
  * users are asked to correct the values before redirect to PayEngine
406
  *
 
 
407
  *
408
  * @return string
409
  */
410
+ public function getQuestion()
411
  {
412
  return Mage::helper('ops/data')->__(
413
  'Please make sure that the displayed data is correct.'
419
  * users are asked to correct the values before redirect to PayEngine
420
  *
421
  * @param Mage_Sales_Model_Order $order Current order
 
422
  *
423
  * @return array
424
  */
425
+ public function getQuestionedFormFields($order)
426
  {
427
+
428
  $questionedFormFields = array(
429
  'CIVILITY',
430
  'OWNERADDRESS',
438
  $shippingMethodType = (int)$this->getShippingMethodType(
439
  $this->getCode(), $storeId
440
  );
441
+ if (in_array($shippingMethodType, $this->getShippingMethodTypeValues())) {
 
 
 
442
  $questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_NUMBER';
443
  $questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_LINE1';
444
  }
466
  *
467
  * @param array $formFields - the array to populate
468
  * @param null $dataArray - the array containing the data
469
+ * @param Mage_Sales_Model_Order $order
470
  *
471
  * @return array - the populated array
472
  */
481
  if (array_key_exists($key, $formFields)
482
  && in_array(
483
  $key,
484
+ $this->getQuestionedFormFields($order), true
485
  )
486
  || $key == 'CIVILITY'
487
  ) {
538
 
539
  /**
540
  * @param $carrierCode
541
+ * @return null
542
  */
543
+ protected function loadShippingSettingForCarrierCode($carrierCode)
544
  {
545
  $this->shippingSettings = $this->getKwixoShippingModel()->load(
546
  $carrierCode, 'shipping_code'
app/code/community/Netresearch/OPS/Model/Payment/Masterpass.php CHANGED
@@ -9,19 +9,19 @@
9
  * @license OSL 3.0
10
  */
11
  class Netresearch_OPS_Model_Payment_Masterpass
12
- extends Netresearch_OPS_Model_Payment_Abstract
13
  {
14
- protected $pm = 'MasterPass';
15
- protected $brand = 'MasterPass';
16
 
17
- /** Check if we can capture directly from the backend */
18
- protected $_canBackendDirectCapture = true;
19
 
20
- /** info source path */
21
- protected $_infoBlockType = 'ops/info_redirect';
22
 
23
- /** payment code */
24
- protected $_code = 'ops_Masterpass';
25
 
26
  }
27
 
9
  * @license OSL 3.0
10
  */
11
  class Netresearch_OPS_Model_Payment_Masterpass
12
+ extends Netresearch_OPS_Model_Payment_Abstract
13
  {
14
+ protected $pm = 'MasterPass';
15
+ protected $brand = 'MasterPass';
16
 
17
+ /** Check if we can capture directly from the backend */
18
+ protected $_canBackendDirectCapture = true;
19
 
20
+ /** info source path */
21
+ protected $_infoBlockType = 'ops/info_redirect';
22
 
23
+ /** payment code */
24
+ protected $_code = 'ops_Masterpass';
25
 
26
  }
27
 
app/code/community/Netresearch/OPS/Model/Payment/Mpass.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- /**
3
- * Netresearch_OPS_Model_Payment_Mpass
4
- *
5
- * @package
6
- * @copyright 2011 Netresearch
7
- * @author Thomas Kappel <thomas.kappel@netresearch.de>
8
- * @license OSL 3.0
9
- */
10
- class Netresearch_OPS_Model_Payment_Mpass
11
- extends Netresearch_OPS_Model_Payment_Abstract
12
- {
13
- protected $pm = 'MPASS';
14
- protected $brand = 'MPASS';
15
-
16
- /** Check if we can capture directly from the backend */
17
- protected $_canBackendDirectCapture = true;
18
-
19
- /** info source path */
20
- protected $_infoBlockType = 'ops/info_redirect';
21
-
22
- /** payment code */
23
- protected $_code = 'ops_mpass';
24
- }
25
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoice/Abstract.php CHANGED
@@ -32,35 +32,73 @@ class Netresearch_OPS_Model_Payment_OpenInvoice_Abstract extends Netresearch_OPS
32
  protected $_needsCartDataForRequest = true;
33
  protected $_needsShipToParams = false;
34
 
35
- public function getMethodDependendFormFields($order, $requestParams = null)
36
- {
37
- $formFields = parent::getMethodDependendFormFields($order, $requestParams);
38
-
39
- $billingAddress = $order->getBillingAddress();
40
- $birthday = new DateTime($order->getCustomerDob());
41
-
42
 
43
- $gender = $order->getCustomerGender() == 1 ? 'M' : 'F';
 
 
44
 
 
45
 
 
 
 
46
  $billingAddress = $order->getBillingAddress();
47
- $street = str_replace("\n", ' ', $billingAddress->getStreet(-1));
48
- $regexp = '/^([^0-9]*)([0-9].*)$/';
 
 
 
49
  if (!preg_match($regexp, $street, $splittedStreet)) {
50
  $splittedStreet[1] = $street;
51
  $splittedStreet[2] = '';
52
  }
53
 
54
- $formFields['OWNERADDRESS'] = trim($splittedStreet[1]);
55
  $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]);
56
-
57
- //$formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix();
58
- $formFields['ECOM_BILLTO_POSTAL_NAME_FIRST'] = substr($billingAddress->getFirstname(), 0, 50);
59
- $formFields['ECOM_BILLTO_POSTAL_NAME_LAST'] = substr($billingAddress->getLastname(), 0, 50);
60
- $formFields['ECOM_SHIPTO_DOB'] = $birthday->format('d/m/Y');
61
- $formFields['ECOM_CONSUMER_GENDER'] = $gender;
62
 
63
  return $formFields;
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
32
  protected $_needsCartDataForRequest = true;
33
  protected $_needsShipToParams = false;
34
 
35
+ protected $_formBlockType = 'ops/form_openInvoice';
 
 
 
 
 
 
36
 
37
+ public function __construct()
38
+ {
39
+ $this->setEncoding($this->getConfigData('encoding'));
40
 
41
+ }
42
 
43
+ public function getMethodDependendFormFields($order, $requestParams = null)
44
+ {
45
+ $formFields = parent::getMethodDependendFormFields($order, $requestParams);
46
  $billingAddress = $order->getBillingAddress();
47
+ $birthday = new DateTime($order->getCustomerDob());
48
+ $gender = $order->getCustomerGender() == 1 ? 'M' : 'F';
49
+ $street = str_replace("\n", ' ', $billingAddress->getStreet(-1));
50
+ $regexp = '/^([^0-9]*)([0-9].*)$/';
51
+
52
  if (!preg_match($regexp, $street, $splittedStreet)) {
53
  $splittedStreet[1] = $street;
54
  $splittedStreet[2] = '';
55
  }
56
 
57
+ $formFields['OWNERADDRESS'] = trim($splittedStreet[1]);
58
  $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]);
59
+ $formFields['ECOM_BILLTO_POSTAL_NAME_FIRST'] = substr($billingAddress->getFirstname(), 0, 50);
60
+ $formFields['ECOM_BILLTO_POSTAL_NAME_LAST'] = substr($billingAddress->getLastname(), 0, 50);
61
+ $formFields['ECOM_SHIPTO_DOB'] = $birthday->format('d/m/Y');
62
+ $formFields['ECOM_CONSUMER_GENDER'] = $gender;
 
 
63
 
64
  return $formFields;
65
  }
66
 
67
+ /**
68
+ * @return string title for invoice termes configured in backend
69
+ */
70
+ public function getInvoiceTermsTitle()
71
+ {
72
+ return $this->getConfigData('invoice_terms_title');
73
+ }
74
+
75
+ /**
76
+ * @return string url to the invoice terms configured in backend
77
+ */
78
+ public function getInvoiceTermsUrl()
79
+ {
80
+ return $this->getConfigData('invoice_terms_url');
81
+ }
82
+
83
+ /**
84
+ * @return bool if invoice terms should be displayed in checkout
85
+ */
86
+ public function showInvoiceTermsLink()
87
+ {
88
+ return (bool) $this->getConfigData('show_invoice_terms');
89
+ }
90
+
91
+ /**
92
+ * @param Mage_Sales_Model_Quote $quote
93
+ *
94
+ * @return bool
95
+ */
96
+ public function isAvailable($quote = null)
97
+ {
98
+ if ($quote && !$quote->isVirtual() && !$quote->getShippingAddress()->getSameAsBilling()) {
99
+ return false;
100
+ }
101
+
102
+ return parent::isAvailable($quote);
103
+ }
104
  }
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceAt.php CHANGED
@@ -9,90 +9,99 @@
9
  * @license OSL 3.0
10
  */
11
  class Netresearch_OPS_Model_Payment_OpenInvoiceAt
12
- extends Netresearch_OPS_Model_Payment_OpenInvoice_Abstract
13
  {
14
- protected $pm = 'Open Invoice AT';
15
- protected $brand = 'Open Invoice AT';
16
-
17
- /** if we can capture directly from the backend */
18
- protected $_canBackendDirectCapture = false;
19
-
20
- protected $_canCapturePartial = false;
21
- protected $_canRefundInvoicePartial = false;
22
-
23
- /** info source path */
24
- protected $_infoBlockType = 'ops/info_redirect';
25
-
26
- /** payment code */
27
- protected $_code = 'ops_openInvoiceAt';
28
-
29
- /**
30
- * Open Invoice AT is not available if quote has a coupon
31
- *
32
- * @param Mage_Sales_Model_Quote $quote
33
- *
34
- * @return boolean
35
- */
36
- public function isAvailable( $quote = null ) {
37
- /* availability depends on quote */
38
- if( false == $quote instanceof Mage_Sales_Model_Quote ) {
39
- return false;
40
- }
41
-
42
- /* not available if quote contains a coupon and allow_discounted_carts is disabled */
43
- if( !$this->isAvailableForDiscountedCarts()
44
- && $quote->getSubtotal() != $quote->getSubtotalWithDiscount()
45
- ) {
46
- return false;
47
- }
48
-
49
- /* not available if there is no gender or no birthday */
50
- if( is_null( $quote->getCustomerGender() ) || is_null( $quote->getCustomerDob() ) ) {
51
- return false;
52
- }
53
-
54
- return parent::isAvailable( $quote );
55
- }
56
-
57
- public function getPaymentAction() {
58
- return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
59
- }
60
-
61
- /*
62
- * @param Mage_Sales_Model_Order $order
63
- * @param array|null $requestParams
64
- *
65
- * @return array
66
- */
67
- public function getMethodDependendFormFields( $order, $requestParams = null ) {
68
- $formFields = parent::getMethodDependendFormFields( $order, $requestParams );
69
-
70
- $shippingAddress = $order->getShippingAddress();
71
-
72
- $gender = Mage::getSingleton( 'eav/config' )
73
- ->getAttribute( 'customer', 'gender' )
74
- ->getSource()
75
- ->getOptionText( $order->getCustomerGender() );
76
-
77
- $formFields[ 'CIVILITY' ] = $gender == 'Male' ? 'Herr' : 'Frau';
78
- $formFields[ 'ECOM_CONSUMER_GENDER' ] = $gender == 'Male' ? 'M' : 'F';
79
-
80
- if( !$this->getConfig()->canSubmitExtraParameter( $order->getStoreId() ) ) {
81
- // add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice
82
- $shipToParams = $this->getRequestHelper()->extractShipToParameters( $shippingAddress, $order );
83
- $formFields = array_merge( $formFields, $shipToParams );
84
- }
85
-
86
- return $formFields;
87
- }
88
-
89
- /**
90
- * getter for the allow_discounted_carts
91
- *
92
- * @return array
93
- */
94
- protected function isAvailableForDiscountedCarts() {
95
- return (bool) $this->getConfigData( 'allow_discounted_carts' );
96
- }
 
 
 
 
 
 
 
 
 
97
 
98
  }
9
  * @license OSL 3.0
10
  */
11
  class Netresearch_OPS_Model_Payment_OpenInvoiceAt
12
+ extends Netresearch_OPS_Model_Payment_OpenInvoice_Abstract
13
  {
14
+ protected $pm = 'Open Invoice AT';
15
+ protected $brand = 'Open Invoice AT';
16
+
17
+ /** if we can capture directly from the backend */
18
+ protected $_canBackendDirectCapture = false;
19
+ protected $_canCapturePartial = false;
20
+ protected $_canRefundInvoicePartial = false;
21
+
22
+ /** info source path */
23
+ protected $_infoBlockType = 'ops/info_redirect';
24
+
25
+ /** payment code */
26
+ protected $_code = 'ops_openInvoiceAt';
27
+
28
+ /**
29
+ * Open Invoice AT is not available if quote has a coupon
30
+ *
31
+ * @param Mage_Sales_Model_Quote $quote
32
+ *
33
+ * @return boolean
34
+ */
35
+ public function isAvailable( $quote = null )
36
+ {
37
+ /* availability depends on quote */
38
+ if ( false == $quote instanceof Mage_Sales_Model_Quote ) {
39
+ return false;
40
+ }
41
+
42
+ /* not available if quote contains a coupon and allow_discounted_carts is disabled */
43
+ if ( !$this->isAvailableForDiscountedCarts()
44
+ && $quote->getSubtotal() != $quote->getSubtotalWithDiscount()
45
+ ) {
46
+ return false;
47
+ }
48
+
49
+ /* not available if there is no gender or no birthday */
50
+ if ($quote->getCustomerGender() == null || $quote->getCustomerDob() == null) {
51
+ return false;
52
+ }
53
+
54
+ return parent::isAvailable($quote);
55
+ }
56
+
57
+ public function getPaymentAction()
58
+ {
59
+ return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
60
+ }
61
+
62
+ /**
63
+ * @param Mage_Sales_Model_Order $order
64
+ * @param array|null $requestParams
65
+ *
66
+ * @return array
67
+ */
68
+ public function getMethodDependendFormFields( $order, $requestParams = null )
69
+ {
70
+ $formFields = parent::getMethodDependendFormFields($order, $requestParams);
71
+
72
+ $shippingAddress = $order->getShippingAddress();
73
+
74
+ $gender = Mage::getSingleton('eav/config')
75
+ ->getAttribute('customer', 'gender')
76
+ ->getSource()
77
+ ->getOptionText($order->getCustomerGender());
78
+
79
+ $formFields[ 'CIVILITY' ] = $gender == 'Male' ? 'Herr' : 'Frau';
80
+ $formFields[ 'ECOM_CONSUMER_GENDER' ] = $gender == 'Male' ? 'M' : 'F';
81
+
82
+ // Change address format to make austrian addresses compatible with platform data transfer to Klarna
83
+ $billToParams = $this->getRequestHelper()->extractBillToParameters($order->getBillingAddress(), $order);
84
+ $formFields['OWNERADDRESS'] = $billToParams['ECOM_BILLTO_POSTAL_STREET_LINE1'] . ' '
85
+ . $billToParams['ECOM_BILLTO_POSTAL_STREET_NUMBER'];
86
+ $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = ' ';
87
+
88
+ if (!$this->getConfig()->canSubmitExtraParameter($order->getStoreId()) ) {
89
+ // add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice
90
+ $shipToParams = $this->getRequestHelper()->extractShipToParameters($shippingAddress, $order);
91
+ $formFields = array_merge($formFields, $shipToParams);
92
+ }
93
+
94
+ return $formFields;
95
+ }
96
+
97
+ /**
98
+ * getter for the allow_discounted_carts
99
+ *
100
+ * @return bool
101
+ */
102
+ protected function isAvailableForDiscountedCarts()
103
+ {
104
+ return (bool) $this->getConfigData('allow_discounted_carts');
105
+ }
106
 
107
  }
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceDe.php CHANGED
@@ -46,7 +46,7 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceDe
46
  }
47
 
48
  /* not available if there is no gender or no birthday */
49
- if (is_null($quote->getCustomerGender()) || is_null($quote->getCustomerDob())) {
50
  return false;
51
  }
52
 
@@ -69,8 +69,8 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceDe
69
  ->getSource()
70
  ->getOptionText($order->getCustomerGender());
71
 
72
- $formFields[ 'CIVILITY' ] = $gender == 'Male' ? 'Herr' : 'Frau';
73
- $formFields[ 'ECOM_CONSUMER_GENDER' ] = $gender == 'Male' ? 'M' : 'F';
74
 
75
  if (!$this->getConfig()->canSubmitExtraParameter($order->getStoreId())) {
76
  // add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice
46
  }
47
 
48
  /* not available if there is no gender or no birthday */
49
+ if (null === $quote->getCustomerGender() || is_null($quote->getCustomerDob())) {
50
  return false;
51
  }
52
 
69
  ->getSource()
70
  ->getOptionText($order->getCustomerGender());
71
 
72
+ $formFields[ 'CIVILITY' ] = $gender == 'Male' ? 'Herr' : 'Frau';
73
+ $formFields[ 'ECOM_CONSUMER_GENDER' ] = $gender == 'Male' ? 'M' : 'F';
74
 
75
  if (!$this->getConfig()->canSubmitExtraParameter($order->getStoreId())) {
76
  // add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceNl.php CHANGED
@@ -38,7 +38,7 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
38
  }
39
 
40
  /* not available if there is no gender or no birthday */
41
- if (is_null($quote->getCustomerGender()) || is_null($quote->getCustomerDob())) {
42
  return false;
43
  }
44
 
@@ -49,18 +49,16 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
49
  * get some method dependend form fields
50
  *
51
  * @param Mage_Sales_Model_Quote $order
 
52
  * @return array
53
  */
54
  public function getMethodDependendFormFields($order, $requestParams=null)
55
  {
56
  $billingAddress = $order->getBillingAddress();
57
  $shippingAddress = $order->getShippingAddress();
58
- $street = str_replace("\n", ' ',$billingAddress->getStreet(-1));
59
- $regexp = '/^([^0-9]*)([0-9].*)$/';
60
- if (!preg_match($regexp, $street, $splittedStreet)) {
61
- $splittedStreet[1] = $street;
62
- $splittedStreet[2] = '';
63
- }
64
  $formFields = parent::getMethodDependendFormFields($order, $requestParams);
65
 
66
  $gender = Mage::getSingleton('eav/config')
@@ -70,23 +68,22 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
70
 
71
  $formFields['CIVILITY'] = $gender == 'Male' ? 'M' : 'V';
72
  $formFields['ECOM_CONSUMER_GENDER'] = $gender == 'Male' ? 'M' : 'V';
73
- $formFields['OWNERADDRESS'] = trim($splittedStreet[1]);
74
- $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]);
75
  $formFields['OWNERZIP'] = $billingAddress->getPostcode();
76
  $formFields['OWNERTOWN'] = $billingAddress->getCity();
77
  $formFields['OWNERCTY'] = $billingAddress->getCountry();
78
  $formFields['OWNERTELNO'] = $billingAddress->getTelephone();
79
 
80
- $street = str_replace("\n", ' ',$shippingAddress->getStreet(-1));
81
- if (!preg_match($regexp, $street, $splittedStreet)) {
82
- $splittedStreet[1] = $street;
83
- $splittedStreet[2] = '';
84
- }
85
  $formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix();
86
  $formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shippingAddress->getFirstname();
87
  $formFields['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shippingAddress->getLastname();
88
- $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = trim($splittedStreet[1]);
89
- $formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]);
90
  $formFields['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippingAddress->getPostcode();
91
  $formFields['ECOM_SHIPTO_POSTAL_CITY'] = $shippingAddress->getCity();
92
  $formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shippingAddress->getCountry();
@@ -116,11 +113,9 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
116
  * get question for fields with disputable value
117
  * users are asked to correct the values before redirect to PayEngine
118
  *
119
- * @param Mage_Sales_Model_Order $order Current order
120
- * @param array $requestParams Request parameters
121
  * @return string
122
  */
123
- public function getQuestion($order, $requestParams)
124
  {
125
  return Mage::helper('ops')->__('Please make sure that your street and house number are correct.');
126
  }
@@ -129,11 +124,10 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
129
  * get an array of fields with disputable value
130
  * users are asked to correct the values before redirect to PayEngine
131
  *
132
- * @param Mage_Sales_Model_Order $order Current order
133
- * @param array $requestParams Request parameters
134
  * @return array
135
  */
136
- public function getQuestionedFormFields($order, $requestParams)
137
  {
138
  return array(
139
  'OWNERADDRESS',
38
  }
39
 
40
  /* not available if there is no gender or no birthday */
41
+ if (null === $quote->getCustomerGender() || is_null($quote->getCustomerDob())) {
42
  return false;
43
  }
44
 
49
  * get some method dependend form fields
50
  *
51
  * @param Mage_Sales_Model_Quote $order
52
+ * @param array $requestParams
53
  * @return array
54
  */
55
  public function getMethodDependendFormFields($order, $requestParams=null)
56
  {
57
  $billingAddress = $order->getBillingAddress();
58
  $shippingAddress = $order->getShippingAddress();
59
+ $billingStreet = str_replace("\n", ' ', $billingAddress->getStreet(-1));
60
+
61
+ $splittedBillingStreet = Mage::helper('ops/address')->splitStreet($billingStreet);
 
 
 
62
  $formFields = parent::getMethodDependendFormFields($order, $requestParams);
63
 
64
  $gender = Mage::getSingleton('eav/config')
68
 
69
  $formFields['CIVILITY'] = $gender == 'Male' ? 'M' : 'V';
70
  $formFields['ECOM_CONSUMER_GENDER'] = $gender == 'Male' ? 'M' : 'V';
71
+ $formFields['OWNERADDRESS'] = $splittedBillingStreet['street_name'];
72
+ $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = $splittedBillingStreet['street_number'];
73
  $formFields['OWNERZIP'] = $billingAddress->getPostcode();
74
  $formFields['OWNERTOWN'] = $billingAddress->getCity();
75
  $formFields['OWNERCTY'] = $billingAddress->getCountry();
76
  $formFields['OWNERTELNO'] = $billingAddress->getTelephone();
77
 
78
+ $shippingStreet = str_replace("\n", ' ', $shippingAddress->getStreet(-1));
79
+
80
+ $splittedShippingStreet = Mage::Helper('ops/address')->splitStreet($shippingStreet);
81
+
 
82
  $formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix();
83
  $formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shippingAddress->getFirstname();
84
  $formFields['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shippingAddress->getLastname();
85
+ $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $splittedShippingStreet['street_name'];
86
+ $formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = $splittedShippingStreet['street_number'];
87
  $formFields['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippingAddress->getPostcode();
88
  $formFields['ECOM_SHIPTO_POSTAL_CITY'] = $shippingAddress->getCity();
89
  $formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shippingAddress->getCountry();
113
  * get question for fields with disputable value
114
  * users are asked to correct the values before redirect to PayEngine
115
  *
 
 
116
  * @return string
117
  */
118
+ public function getQuestion()
119
  {
120
  return Mage::helper('ops')->__('Please make sure that your street and house number are correct.');
121
  }
124
  * get an array of fields with disputable value
125
  * users are asked to correct the values before redirect to PayEngine
126
  *
127
+ *
 
128
  * @return array
129
  */
130
+ public function getQuestionedFormFields($order)
131
  {
132
  return array(
133
  'OWNERADDRESS',
app/code/community/Netresearch/OPS/Model/Payment/PayPerMail.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * PayPerMail.php
5
+ *
6
+ * @author Sebastian Ertner sebastian.ertner@netresearch.de
7
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
9
+ */
10
+ class Netresearch_OPS_Model_Payment_PayPerMail extends Netresearch_OPS_Model_Payment_Abstract
11
+ {
12
+
13
+ const CODE = 'ops_payPerMail';
14
+ const INFO_KEY_TITLE = 'paypermail_title';
15
+ const INFO_KEY_PM = 'paypermail_pm';
16
+ const INFO_KEY_BRAND = 'paypermail_brand';
17
+
18
+ protected $_canUseCheckout = false;
19
+ protected $_canUseInternal = true;
20
+
21
+
22
+ /** info source path */
23
+ protected $_infoBlockType = 'ops/info_payPerMail';
24
+
25
+ protected $_formBlockType = 'ops/form_payPerMail';
26
+
27
+ /** payment code */
28
+ protected $_code = self::CODE;
29
+
30
+
31
+ public function getOpsCode($payment = null)
32
+ {
33
+ return $this->getInfoInstance()->getAdditionalInformation(self::INFO_KEY_PM);
34
+ }
35
+
36
+ public function getOpsBrand($payment = null)
37
+ {
38
+ return $this->getInfoInstance()->getAdditionalInformation(self::INFO_KEY_BRAND);
39
+ }
40
+
41
+ }
app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc.php CHANGED
@@ -52,7 +52,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
52
  */
53
  public function getSubscriptionManager()
54
  {
55
- if (is_null($this->subscriptionManager)) {
56
  $this->subscriptionManager = Mage::getModel('ops/subscription_manager');
57
  }
58
 
@@ -77,7 +77,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
77
  */
78
  public function getParameterModel()
79
  {
80
- if (is_null($this->parameterModel)) {
81
  $this->parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
82
  }
83
 
@@ -119,12 +119,12 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
119
  * @param Mage_Payment_Model_Recurring_Profile $profile
120
  * @param Mage_Payment_Model_Info $paymentInfo
121
  *
122
- * @return string[]
123
  */
124
  protected function submitTrialSubscription(
125
  Mage_Payment_Model_Recurring_Profile $profile,
126
  Mage_Payment_Model_Info $paymentInfo
127
- ) {
 
128
  if ($profile->getTrialPeriodUnit()) {
129
  $requestParams = $this->getParameterModel()->collectAllParametersForTrial($paymentInfo, $profile);
130
  $this->getParameterModel()->unsetData();
@@ -149,7 +149,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
149
  public function submitRecurringProfile(
150
  Mage_Payment_Model_Recurring_Profile $profile,
151
  Mage_Payment_Model_Info $paymentInfo
152
- ) {
 
153
  $this->performPreDirectLinkCallActions($profile->getQuote(), $paymentInfo);
154
 
155
  $this->submitTrialSubscription($profile, $paymentInfo);
@@ -202,17 +203,21 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
202
  switch ($profile->getNewState()) {
203
  case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE:
204
  if (Mage::getSingleton('admin/session')->isLoggedIn()) {
205
- $this->addAdminNotice('To actually activate the subscription an update in the PayEngine backend is needed.'
 
206
  );
207
  } else {
208
  Mage::throwException(
209
- $this->getDataHelper()->__('Automatic activation not possible. Please contact our support team.')
 
 
210
  );
211
  }
212
  break;
213
  case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED:
214
  if (Mage::getSingleton('admin/session')->isLoggedIn()) {
215
- $this->addAdminNotice('To actually cancel the subscription an update in the PayEngine backend is needed.'
 
216
  );
217
  } else {
218
  $this->sendSuspendMail($profile);
@@ -220,7 +225,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
220
  break;
221
  case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED:
222
  if (Mage::getSingleton('admin/session')->isLoggedIn()) {
223
- $this->addAdminNotice('To actually suspend the subscription an update in the PayEngine backend is needed.'
 
224
  );
225
  } else {
226
  $this->sendSuspendMail($profile);
@@ -270,7 +276,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
270
  $profile->setOverrideState(true);
271
  $session->addSuccess(
272
  $this->getDataHelper()
273
- ->__('Your suspend request was successfully sent. A copy of the email will be sent to your address.'
 
274
  )
275
  );
276
  } else {
@@ -336,7 +343,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
336
  */
337
  protected function submitRegularSubscription(Mage_Payment_Model_Recurring_Profile $profile,
338
  Mage_Payment_Model_Info $paymentInfo
339
- ) {
 
340
  $requestParams = $this->getParameterModel()->collectAllParameters($paymentInfo, $profile);
341
  $this->getParameterModel()->unsetData();
342
  $response = $this->getDirectLinkHelper()->performDirectLinkRequest(
@@ -355,7 +363,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
355
  protected function submitInitialFee(
356
  Mage_Payment_Model_Recurring_Profile $profile,
357
  Mage_Payment_Model_Info $paymentInfo
358
- ) {
 
359
  /** @var $profile Mage_Sales_Model_Recurring_Profile */
360
  if ($profile->getInitAmount() > 0) {
361
  $order = $this->getSubscriptionManager()->createInitialOrder($profile);
52
  */
53
  public function getSubscriptionManager()
54
  {
55
+ if (null === $this->subscriptionManager) {
56
  $this->subscriptionManager = Mage::getModel('ops/subscription_manager');
57
  }
58
 
77
  */
78
  public function getParameterModel()
79
  {
80
+ if (null === $this->parameterModel) {
81
  $this->parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
82
  }
83
 
119
  * @param Mage_Payment_Model_Recurring_Profile $profile
120
  * @param Mage_Payment_Model_Info $paymentInfo
121
  *
 
122
  */
123
  protected function submitTrialSubscription(
124
  Mage_Payment_Model_Recurring_Profile $profile,
125
  Mage_Payment_Model_Info $paymentInfo
126
+ )
127
+ {
128
  if ($profile->getTrialPeriodUnit()) {
129
  $requestParams = $this->getParameterModel()->collectAllParametersForTrial($paymentInfo, $profile);
130
  $this->getParameterModel()->unsetData();
149
  public function submitRecurringProfile(
150
  Mage_Payment_Model_Recurring_Profile $profile,
151
  Mage_Payment_Model_Info $paymentInfo
152
+ )
153
+ {
154
  $this->performPreDirectLinkCallActions($profile->getQuote(), $paymentInfo);
155
 
156
  $this->submitTrialSubscription($profile, $paymentInfo);
203
  switch ($profile->getNewState()) {
204
  case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE:
205
  if (Mage::getSingleton('admin/session')->isLoggedIn()) {
206
+ $this->addAdminNotice(
207
+ 'To actually activate the subscription an update in the PayEngine backend is needed.'
208
  );
209
  } else {
210
  Mage::throwException(
211
+ $this->getDataHelper()->__(
212
+ 'Automatic activation not possible. Please contact our support team.'
213
+ )
214
  );
215
  }
216
  break;
217
  case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED:
218
  if (Mage::getSingleton('admin/session')->isLoggedIn()) {
219
+ $this->addAdminNotice(
220
+ 'To actually cancel the subscription an update in the PayEngine backend is needed.'
221
  );
222
  } else {
223
  $this->sendSuspendMail($profile);
225
  break;
226
  case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED:
227
  if (Mage::getSingleton('admin/session')->isLoggedIn()) {
228
+ $this->addAdminNotice(
229
+ 'To actually suspend the subscription an update in the PayEngine backend is needed.'
230
  );
231
  } else {
232
  $this->sendSuspendMail($profile);
276
  $profile->setOverrideState(true);
277
  $session->addSuccess(
278
  $this->getDataHelper()
279
+ ->__(
280
+ 'Your suspend request was successfully sent. A copy of the email will be sent to your address.'
281
  )
282
  );
283
  } else {
343
  */
344
  protected function submitRegularSubscription(Mage_Payment_Model_Recurring_Profile $profile,
345
  Mage_Payment_Model_Info $paymentInfo
346
+ )
347
+ {
348
  $requestParams = $this->getParameterModel()->collectAllParameters($paymentInfo, $profile);
349
  $this->getParameterModel()->unsetData();
350
  $response = $this->getDirectLinkHelper()->performDirectLinkRequest(
363
  protected function submitInitialFee(
364
  Mage_Payment_Model_Recurring_Profile $profile,
365
  Mage_Payment_Model_Info $paymentInfo
366
+ )
367
+ {
368
  /** @var $profile Mage_Sales_Model_Recurring_Profile */
369
  if ($profile->getInitAmount() > 0) {
370
  $order = $this->getSubscriptionManager()->createInitialOrder($profile);
app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc/ParameterBag.php CHANGED
@@ -49,7 +49,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
49
  */
50
  public function getSubscriptionHelper()
51
  {
52
- if (is_null($this->subscriptionHelper)) {
53
  $this->subscriptionHelper = Mage::helper('ops/subscription');
54
  }
55
 
@@ -73,7 +73,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
73
  */
74
  public function getDataHelper()
75
  {
76
- if (is_null($this->dataHelper)) {
77
  $this->dataHelper = Mage::helper('ops');
78
  }
79
 
@@ -97,7 +97,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
97
  */
98
  public function getQuoteHelper()
99
  {
100
- if (is_null($this->quoteHelper)) {
101
  $this->quoteHelper = Mage::helper('ops/quote');
102
  }
103
 
@@ -121,7 +121,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
121
  */
122
  public function getConfig()
123
  {
124
- if (is_null($this->config)) {
125
  $this->config = Mage::getModel('ops/config');
126
  }
127
 
@@ -145,7 +145,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
145
  */
146
  public function getRequestHelper()
147
  {
148
- if (is_null($this->requestHelper)) {
149
  $this->requestHelper = Mage::helper('ops/payment_request');
150
  }
151
 
@@ -223,7 +223,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
223
  *
224
  * @return Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag
225
  */
226
- public function collectPaymentParameters(Mage_Payment_Model_Info $paymentInfo, $trial = false)
227
  {
228
  $this->setData('CN', $paymentInfo->getAdditionalInformation('CC_CN'))
229
  ->setData('ALIAS', $paymentInfo->getAdditionalInformation('alias'))
@@ -286,7 +286,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
286
  ->setData('SUB_AMOUNT', $this->getDataHelper()->getAmount($subscriptionAmount))
287
  // amount is always 0 for subscription transactions
288
  ->setData('AMOUNT', 0)
289
- ->setData('SUB_PERIOD_MOMENT',
 
290
  $this->getSubscriptionHelper()->getBillingDayForPeriodUnit($periodUnit, $profile->getStoreId())
291
  );
292
 
@@ -309,7 +310,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
309
  */
310
  public function calculateEndDate(DateTime $startDate, $periodUnit, $frequency, $maxCycles)
311
  {
312
- if(!$this->isMappedUnit($periodUnit)){
313
  $frequency = $this->adjustFrequencyToUnitSpecialCases($periodUnit, $frequency);
314
  $periodUnit = $this->mapUnit($periodUnit);
315
  }
@@ -337,12 +338,15 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
337
  *
338
  * @return bool
339
  */
340
- protected function isMappedUnit($unit){
341
- return in_array($unit, array(
 
 
342
  self::PERIOD_UNIT_DAY,
343
  self::PERIOD_UNIT_WEEK,
344
  self::PERIOD_UNIT_MONTH
345
- ));
 
346
  }
347
 
348
  /**
@@ -355,7 +359,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
355
  */
356
  public function collectAllParameters(Mage_Payment_Model_Info $paymentInfo,
357
  Mage_Payment_Model_Recurring_Profile $profile
358
- ) {
 
359
  $this->collectProfileParameters($profile)
360
  ->collectPaymentParameters($paymentInfo);
361
 
@@ -372,7 +377,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
372
  */
373
  public function collectAllParametersForTrial(Mage_Payment_Model_Info $paymentInfo,
374
  Mage_Payment_Model_Recurring_Profile $profile
375
- ) {
 
376
  $this->collectProfileParameters($profile, true)
377
  ->collectPaymentParameters($paymentInfo, true);
378
 
@@ -391,7 +397,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
391
  public function collectAllParametersForInitialFee(Mage_Payment_Model_Info $paymentInfo,
392
  Mage_Payment_Model_Recurring_Profile $profile,
393
  Mage_Sales_Model_Order $order
394
- ) {
 
395
  /** @var $profile Mage_Sales_Model_Recurring_Profile */
396
  $this->collectPaymentParameters($paymentInfo)->collectAddressParameters($profile);
397
 
@@ -419,7 +426,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
419
  * Determines base values for the subscription depending on the trial parameter
420
  *
421
  * @param Mage_Sales_Model_Recurring_Profile $profile
422
- * @param $trial - if the values for the trial subscription should be used or not
423
  *
424
  * @return string[] - containing the following:
425
  * [0] => amount for the subscription,
49
  */
50
  public function getSubscriptionHelper()
51
  {
52
+ if (null === $this->subscriptionHelper) {
53
  $this->subscriptionHelper = Mage::helper('ops/subscription');
54
  }
55
 
73
  */
74
  public function getDataHelper()
75
  {
76
+ if (null === $this->dataHelper) {
77
  $this->dataHelper = Mage::helper('ops');
78
  }
79
 
97
  */
98
  public function getQuoteHelper()
99
  {
100
+ if (null === $this->quoteHelper) {
101
  $this->quoteHelper = Mage::helper('ops/quote');
102
  }
103
 
121
  */
122
  public function getConfig()
123
  {
124
+ if (null === $this->config) {
125
  $this->config = Mage::getModel('ops/config');
126
  }
127
 
145
  */
146
  public function getRequestHelper()
147
  {
148
+ if (null === $this->requestHelper) {
149
  $this->requestHelper = Mage::helper('ops/payment_request');
150
  }
151
 
223
  *
224
  * @return Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag
225
  */
226
+ public function collectPaymentParameters(Mage_Payment_Model_Info $paymentInfo)
227
  {
228
  $this->setData('CN', $paymentInfo->getAdditionalInformation('CC_CN'))
229
  ->setData('ALIAS', $paymentInfo->getAdditionalInformation('alias'))
286
  ->setData('SUB_AMOUNT', $this->getDataHelper()->getAmount($subscriptionAmount))
287
  // amount is always 0 for subscription transactions
288
  ->setData('AMOUNT', 0)
289
+ ->setData(
290
+ 'SUB_PERIOD_MOMENT',
291
  $this->getSubscriptionHelper()->getBillingDayForPeriodUnit($periodUnit, $profile->getStoreId())
292
  );
293
 
310
  */
311
  public function calculateEndDate(DateTime $startDate, $periodUnit, $frequency, $maxCycles)
312
  {
313
+ if (!$this->isMappedUnit($periodUnit)) {
314
  $frequency = $this->adjustFrequencyToUnitSpecialCases($periodUnit, $frequency);
315
  $periodUnit = $this->mapUnit($periodUnit);
316
  }
338
  *
339
  * @return bool
340
  */
341
+ protected function isMappedUnit($unit)
342
+ {
343
+ return in_array(
344
+ $unit, array(
345
  self::PERIOD_UNIT_DAY,
346
  self::PERIOD_UNIT_WEEK,
347
  self::PERIOD_UNIT_MONTH
348
+ )
349
+ );
350
  }
351
 
352
  /**
359
  */
360
  public function collectAllParameters(Mage_Payment_Model_Info $paymentInfo,
361
  Mage_Payment_Model_Recurring_Profile $profile
362
+ )
363
+ {
364
  $this->collectProfileParameters($profile)
365
  ->collectPaymentParameters($paymentInfo);
366
 
377
  */
378
  public function collectAllParametersForTrial(Mage_Payment_Model_Info $paymentInfo,
379
  Mage_Payment_Model_Recurring_Profile $profile
380
+ )
381
+ {
382
  $this->collectProfileParameters($profile, true)
383
  ->collectPaymentParameters($paymentInfo, true);
384
 
397
  public function collectAllParametersForInitialFee(Mage_Payment_Model_Info $paymentInfo,
398
  Mage_Payment_Model_Recurring_Profile $profile,
399
  Mage_Sales_Model_Order $order
400
+ )
401
+ {
402
  /** @var $profile Mage_Sales_Model_Recurring_Profile */
403
  $this->collectPaymentParameters($paymentInfo)->collectAddressParameters($profile);
404
 
426
  * Determines base values for the subscription depending on the trial parameter
427
  *
428
  * @param Mage_Sales_Model_Recurring_Profile $profile
429
+ * @param $trial - if the values for the trial subscription should be used or not
430
  *
431
  * @return string[] - containing the following:
432
  * [0] => amount for the subscription,
app/code/community/Netresearch/OPS/Model/Response/Handler.php CHANGED
@@ -42,7 +42,8 @@ class Netresearch_OPS_Model_Response_Handler
42
  */
43
  public function processResponse(
44
  $responseArray, Netresearch_OPS_Model_Payment_Abstract $paymentMethod, $shouldRegisterFeedback = true
45
- ){
 
46
  $responseArray = array_change_key_case($responseArray, CASE_LOWER);
47
  $this->getTypeHandler($responseArray['status'])
48
  ->handleResponse($responseArray, $paymentMethod, $shouldRegisterFeedback);
42
  */
43
  public function processResponse(
44
  $responseArray, Netresearch_OPS_Model_Payment_Abstract $paymentMethod, $shouldRegisterFeedback = true
45
+ )
46
+ {
47
  $responseArray = array_change_key_case($responseArray, CASE_LOWER);
48
  $this->getTypeHandler($responseArray['status'])
49
  ->handleResponse($responseArray, $paymentMethod, $shouldRegisterFeedback);
app/code/community/Netresearch/OPS/Model/Response/Type/Abstract.php CHANGED
@@ -66,6 +66,9 @@
66
  * @method string getIpcty()
67
  * @method bool hasAcceptance()
68
  * @method bool hasBrand()
 
 
 
69
  * @method bool getShouldRegisterFeedback() if feedback should get registered on payment object
70
  * @method Netresearch_OPS_Model_Response_Type_Abstract setShouldRegisterFeedback($shouldRegisterFeedback)
71
  *
@@ -79,7 +82,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
79
  */
80
  public function getConfig()
81
  {
82
- if (is_null($this->getData('config'))) {
83
  $this->setData('config', Mage::getModel('ops/config'));
84
  }
85
 
@@ -92,8 +95,9 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
92
  *
93
  * @param array $responseArray
94
  * @param Netresearch_OPS_Model_Payment_Abstract $paymentMethod
95
- * @param bool $shouldRegisterFeedback determines if the Mage_Sales_Model_Order_Payments register*Feedback
96
- * functions get called, defaults to true
 
97
  *
98
  * @return Netresearch_OPS_Model_Response_TypeInterface
99
  */
@@ -105,7 +109,8 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
105
  $this->setShouldRegisterFeedback($shouldRegisterFeedback);
106
 
107
  if ($this->getStatus() == $this->getMethodInstance()->getInfoInstance()->getAdditionalInformation('status')
108
- && $this->getTransactionId() == $paymentMethod->getInfoInstance()->getLastTransId()) {
 
109
  return $this;
110
  }
111
 
@@ -113,6 +118,10 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
113
  $this->_handleResponse();
114
  $this->updateAdditionalInformation();
115
 
 
 
 
 
116
  return $this;
117
  }
118
 
@@ -130,8 +139,10 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
130
  */
131
  protected function updateAdditionalInformation()
132
  {
 
133
  $this->updateDefaultInformation();
134
  $this->setFraudDetectionParameters();
 
135
  }
136
 
137
  /**
@@ -144,6 +155,10 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
144
  $payment->setAdditionalInformation('paymentId', $this->getPayid())
145
  ->setAdditionalInformation('status', $this->getStatus());
146
 
 
 
 
 
147
  if ($this->hasAcceptance()) {
148
  $payment->setAdditionalInformation('acceptence', $this->getAcceptance());
149
  }
@@ -153,6 +168,18 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
153
  }
154
  }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  /**
157
  * Sets Transaction details (TransactionId etc.)
158
  */
@@ -161,9 +188,13 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
161
  $payment = $this->getMethodInstance()->getInfoInstance();
162
 
163
  $payment->setTransactionParentId($this->getPayid());
164
- $transId = $this->getTransactionId();
165
 
166
- $payment->setLastTransId($transId);
 
 
 
 
 
167
  $payment->setTransactionId($transId);
168
  $payment->setIsTransactionClosed(false);
169
  }
@@ -201,11 +232,9 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
201
  * @param string $orderComment
202
  * @param string $additionalInfo
203
  *
204
- * @return string
205
  */
206
  protected function addOrderComment($orderComment, $additionalInfo = '')
207
  {
208
-
209
  $orderComment = $this->getOrderComment($orderComment, $additionalInfo);
210
  $this->getMethodInstance()->getInfoInstance()->getOrder()->addStatusHistoryComment($orderComment);
211
  }
@@ -261,8 +290,8 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
261
  $orderComment = Mage::helper('ops')->__(
262
  'Received PayEngine feedback status update with final status %s.',
263
  $this->getStatus()
264
-
265
  );
 
266
  return $this->getOrderComment($orderComment, $additionalInfo);
267
 
268
  }
@@ -278,6 +307,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
278
  'Received PayEngine feedback status update with intermediate status %s.',
279
  $this->getStatus()
280
  );
 
281
  return $this->getOrderComment($orderComment, $additionalInfo);
282
  }
283
 
@@ -292,6 +322,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
292
  'Received PayEngine feedback status update with refused status %s.',
293
  $this->getStatus()
294
  );
 
295
  return $this->getOrderComment($orderComment, $additionalInfo);
296
  }
297
 
@@ -306,6 +337,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
306
  'Received PayEngine feedback status update with suspected fraud status %s.',
307
  $this->getStatus()
308
  );
 
309
  return $this->getOrderComment($orderComment, $additionalInfo);
310
  }
311
 
66
  * @method string getIpcty()
67
  * @method bool hasAcceptance()
68
  * @method bool hasBrand()
69
+ * @method bool hasAlias()
70
+ * @method bool hasMobilemode()
71
+ * @method string getAlias()
72
  * @method bool getShouldRegisterFeedback() if feedback should get registered on payment object
73
  * @method Netresearch_OPS_Model_Response_Type_Abstract setShouldRegisterFeedback($shouldRegisterFeedback)
74
  *
82
  */
83
  public function getConfig()
84
  {
85
+ if ($this->getData('config') === null) {
86
  $this->setData('config', Mage::getModel('ops/config'));
87
  }
88
 
95
  *
96
  * @param array $responseArray
97
  * @param Netresearch_OPS_Model_Payment_Abstract $paymentMethod
98
+ * @param bool $shouldRegisterFeedback
99
+ * determines if the Mage_Sales_Model_Order_Payments register*Feedback
100
+ * functions get called, defaults to true
101
  *
102
  * @return Netresearch_OPS_Model_Response_TypeInterface
103
  */
109
  $this->setShouldRegisterFeedback($shouldRegisterFeedback);
110
 
111
  if ($this->getStatus() == $this->getMethodInstance()->getInfoInstance()->getAdditionalInformation('status')
112
+ && $this->getTransactionId() == $paymentMethod->getInfoInstance()->getLastTransId()
113
+ ) {
114
  return $this;
115
  }
116
 
118
  $this->_handleResponse();
119
  $this->updateAdditionalInformation();
120
 
121
+ if ($this->getShouldRegisterFeedback() && $this->hasAlias()) {
122
+ Mage::helper('ops/alias')->saveAlias($responseArray);
123
+ }
124
+
125
  return $this;
126
  }
127
 
139
  */
140
  protected function updateAdditionalInformation()
141
  {
142
+ $this->getMethodInstance()->getInfoInstance()->setLastTransId($this->getTransactionId());
143
  $this->updateDefaultInformation();
144
  $this->setFraudDetectionParameters();
145
+ $this->setDeviceInformationParameters();
146
  }
147
 
148
  /**
155
  $payment->setAdditionalInformation('paymentId', $this->getPayid())
156
  ->setAdditionalInformation('status', $this->getStatus());
157
 
158
+ if ($this->hasAlias()) {
159
+ $payment->setAdditionalInformation('alias', $this->getAlias());
160
+ }
161
+
162
  if ($this->hasAcceptance()) {
163
  $payment->setAdditionalInformation('acceptence', $this->getAcceptance());
164
  }
168
  }
169
  }
170
 
171
+ protected function setDeviceInformationParameters()
172
+ {
173
+ if (!$this->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Bancontact) {
174
+ return;
175
+ }
176
+
177
+ $payment = $this->getMethodInstance()->getInfoInstance();
178
+ if ($this->hasMobilemode()) {
179
+ $payment->setAdditionalInformation('MOBILEMODE', $this->getMobilemode());
180
+ }
181
+ }
182
+
183
  /**
184
  * Sets Transaction details (TransactionId etc.)
185
  */
188
  $payment = $this->getMethodInstance()->getInfoInstance();
189
 
190
  $payment->setTransactionParentId($this->getPayid());
 
191
 
192
+ if (!$this->hasPayidsub()) {
193
+ $transId = $payment->getLastTransId();
194
+ } else {
195
+ $transId = $this->getTransactionId();
196
+ }
197
+
198
  $payment->setTransactionId($transId);
199
  $payment->setIsTransactionClosed(false);
200
  }
232
  * @param string $orderComment
233
  * @param string $additionalInfo
234
  *
 
235
  */
236
  protected function addOrderComment($orderComment, $additionalInfo = '')
237
  {
 
238
  $orderComment = $this->getOrderComment($orderComment, $additionalInfo);
239
  $this->getMethodInstance()->getInfoInstance()->getOrder()->addStatusHistoryComment($orderComment);
240
  }
290
  $orderComment = Mage::helper('ops')->__(
291
  'Received PayEngine feedback status update with final status %s.',
292
  $this->getStatus()
 
293
  );
294
+
295
  return $this->getOrderComment($orderComment, $additionalInfo);
296
 
297
  }
307
  'Received PayEngine feedback status update with intermediate status %s.',
308
  $this->getStatus()
309
  );
310
+
311
  return $this->getOrderComment($orderComment, $additionalInfo);
312
  }
313
 
322
  'Received PayEngine feedback status update with refused status %s.',
323
  $this->getStatus()
324
  );
325
+
326
  return $this->getOrderComment($orderComment, $additionalInfo);
327
  }
328
 
337
  'Received PayEngine feedback status update with suspected fraud status %s.',
338
  $this->getStatus()
339
  );
340
+
341
  return $this->getOrderComment($orderComment, $additionalInfo);
342
  }
343
 
app/code/community/Netresearch/OPS/Model/Response/Type/Authorize.php CHANGED
@@ -37,10 +37,9 @@ class Netresearch_OPS_Model_Response_Type_Authorize extends Netresearch_OPS_Mode
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isAuthorize($this->getStatus())) {
40
- throw new Mage_Core_Exception(Mage::helper('ops')->__('%s is not a authorize status!', $this->getStatus()));
41
  }
42
 
43
-
44
  /** @var Mage_Sales_Model_Order $order */
45
  $order = $this->getMethodInstance()->getInfoInstance()->getOrder();
46
  /** @var Mage_Sales_Model_Order_Payment $payment */
@@ -52,136 +51,201 @@ class Netresearch_OPS_Model_Response_Type_Authorize extends Netresearch_OPS_Mode
52
  }
53
 
54
  if (Netresearch_OPS_Model_Status::isFinal($this->getStatus())) {
55
- // handle authorization declined
56
- // thrown exception gets catched by core and order will not been created
57
- if ($this->getStatus() == Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  ) {
59
- if (!$this->getShouldRegisterFeedback()) {
60
- Mage::throwException(
61
- Mage::helper('ops')->__(
62
- 'Payment failed because the authorization was declined! Please choose another payment method.'
63
- )
64
- );
65
- } elseif ($payment->getAdditionalInformation('status')
66
- == Netresearch_OPS_Model_Status::WAITING_FOR_IDENTIFICATION
67
- && $order->getState() === Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW
68
- ) {
69
- try {
70
- // if the payment was previously in payment review/has status 46 the identification obviously failed and the order gets canceled
71
- $payment->setNotificationResult(true);
72
- $payment->registerPaymentReviewAction(
73
- Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, false
74
- );
75
- } catch (Mage_Core_Exception $e) {
76
- /**
77
- * in CE 1.7 Mage_Sales_Model_Order::registerCancellation will always fail with exception if the
78
- * order is in payment_review state. we therefore cancel the order 'manually'.
79
- *
80
- * below code is c&p from Mage_Sales_Model_Order::registerCancellation:
81
- *
82
- * @see Mage_Sales_Model_Order::registerCancellation
83
- */
84
- if ($e->getMessage() === Mage::helper('sales')->__('Order does not allow to be canceled.')) {
85
- $cancelState = Mage_Sales_Model_Order::STATE_CANCELED;
86
- foreach ($order->getAllItems() as $item) {
87
- if ($cancelState != Mage_Sales_Model_Order::STATE_PROCESSING
88
- && $item->getQtyToRefund()
89
- ) {
90
- if ($item->getQtyToShip() > $item->getQtyToCancel()) {
91
- $cancelState = Mage_Sales_Model_Order::STATE_PROCESSING;
92
- } else {
93
- $cancelState = Mage_Sales_Model_Order::STATE_COMPLETE;
94
- }
95
- }
96
- $item->cancel();
97
- }
98
-
99
- $order->setSubtotalCanceled($order->getSubtotal() - $order->getSubtotalInvoiced());
100
- $order->setBaseSubtotalCanceled(
101
- $order->getBaseSubtotal() - $order->getBaseSubtotalInvoiced()
102
- );
103
-
104
- $order->setTaxCanceled($order->getTaxAmount() - $order->getTaxInvoiced());
105
- $order->setBaseTaxCanceled($order->getBaseTaxAmount() - $order->getBaseTaxInvoiced());
106
-
107
- $order->setShippingCanceled($order->getShippingAmount() - $order->getShippingInvoiced());
108
- $order->setBaseShippingCanceled(
109
- $order->getBaseShippingAmount() - $order->getBaseShippingInvoiced()
110
- );
111
-
112
- $order->setDiscountCanceled(
113
- abs($order->getDiscountAmount()) - $order->getDiscountInvoiced()
114
- );
115
- $order->setBaseDiscountCanceled(
116
- abs($order->getBaseDiscountAmount()) - $order->getBaseDiscountInvoiced()
117
- );
118
-
119
- $order->setTotalCanceled($order->getGrandTotal() - $order->getTotalPaid());
120
- $order->setBaseTotalCanceled($order->getBaseGrandTotal() - $order->getBaseTotalPaid());
121
-
122
- $order->setState($cancelState, true, $this->getFinalStatusComment());
123
- }
124
- }
125
  }
126
- } elseif ($this->getStatus() == Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER) {
127
- $order->registerCancellation($this->getFinalStatusComment());
128
  }
 
 
129
 
130
- if ($this->getShouldRegisterFeedback()) {
131
- if ($order->getState() === Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
132
-
133
- $action = Mage_Sales_Model_Order_Payment::REVIEW_ACTION_ACCEPT;
134
- $targetState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
135
- if (Netresearch_OPS_Model_Status::canResendPaymentInfo($this->getStatus())
136
- && Mage::helper('ops/payment')->isInlinePayment($payment)
137
- ) {
138
- $targetState = Mage_Sales_Model_Order::STATE_CANCELED;
139
- $action = Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY;
140
- }
141
- $payment->setNotificationResult(true);
142
- $payment->registerPaymentReviewAction($action, false);
143
- if ($order->getState() != $targetState) {
144
- $order->setState($targetState, true, $this->getFinalStatusComment());
145
- }
146
- } elseif ($order->getState() === Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
147
- || $order->getState() === Mage_Sales_Model_Order::STATE_NEW
148
- ) {
149
- $payment->registerAuthorizationNotification($this->getAmount());
150
- $order->setState(
151
- Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, $this->getFinalStatusComment()
152
- );
153
 
154
- }
155
- } else {
156
- $this->addFinalStatusComment();
157
- }
158
- } else {
159
- $payment->setIsTransactionPending(true);
160
- if ($this->getStatus() == Netresearch_OPS_Model_Status::STAND_BY_SUSPECTED_FRAUD) {
161
- $payment->setIsFraudDetected(true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  $order->setState(
163
- Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW,
164
- Mage_Sales_Model_Order::STATUS_FRAUD,
165
- $this->getFraudStatusComment(
166
- Mage::helper('ops')->__('Please have a look in PayEngine backend for more information.')
167
- )
168
  );
169
- } else {
170
- $order->addStatusHistoryComment($this->getIntermediateStatusComment());
171
- }
172
- if ($this->getShouldRegisterFeedback()) {
173
- $payment->registerAuthorizationNotification($this->getAmount());
174
  }
 
 
175
  }
 
176
 
 
 
 
 
 
 
 
 
 
177
  if ($this->getShouldRegisterFeedback()) {
178
  $payment->save();
179
  $order->save();
180
 
181
  // gateway payments do not send confirmation emails by default
182
- if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED){
183
  Mage::helper('ops/data')->sendTransactionalEmail($order);
184
  }
185
  }
186
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  }
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isAuthorize($this->getStatus())) {
40
+ Mage::throwException(Mage::helper('ops')->__('%s is not a authorize status!', $this->getStatus()));
41
  }
42
 
 
43
  /** @var Mage_Sales_Model_Order $order */
44
  $order = $this->getMethodInstance()->getInfoInstance()->getOrder();
45
  /** @var Mage_Sales_Model_Order_Payment $payment */
51
  }
52
 
53
  if (Netresearch_OPS_Model_Status::isFinal($this->getStatus())) {
54
+ $this->processFinalStatus($order, $payment);
55
+ } else {
56
+ $this->processIntermediateState($payment, $order);
57
+ }
58
+
59
+ $this->persistSalesObject($payment, $order);
60
+ }
61
+
62
+ /**
63
+ * in CE 1.7 Mage_Sales_Model_Order::registerCancellation will always fail with exception if the
64
+ * order is in payment_review state. we therefore cancel the order 'manually'.
65
+ *
66
+ * below code is c&p from Mage_Sales_Model_Order::registerCancellation:
67
+ *
68
+ * @see Mage_Sales_Model_Order::registerCancellation
69
+ *
70
+ * @param Mage_Sales_Model_Order $order
71
+ */
72
+ protected function registerCancellation($order)
73
+ {
74
+ $cancelState = Mage_Sales_Model_Order::STATE_CANCELED;
75
+ /** @var Mage_Sales_Model_Order_Item $item */
76
+ foreach ($order->getAllItems() as $item) {
77
+ if ($cancelState != Mage_Sales_Model_Order::STATE_PROCESSING
78
+ && $item->getQtyToRefund()
79
  ) {
80
+ if ($item->getQtyToShip() > $item->getQtyToCancel()) {
81
+ $cancelState = Mage_Sales_Model_Order::STATE_PROCESSING;
82
+ } else {
83
+ $cancelState = Mage_Sales_Model_Order::STATE_COMPLETE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
 
 
85
  }
86
+ $item->cancel();
87
+ }
88
 
89
+ $order->setSubtotalCanceled($order->getSubtotal() - $order->getSubtotalInvoiced());
90
+ $order->setBaseSubtotalCanceled(
91
+ $order->getBaseSubtotal() - $order->getBaseSubtotalInvoiced()
92
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
+ $order->setTaxCanceled($order->getTaxAmount() - $order->getTaxInvoiced());
95
+ $order->setBaseTaxCanceled($order->getBaseTaxAmount() - $order->getBaseTaxInvoiced());
96
+
97
+ $order->setShippingCanceled($order->getShippingAmount() - $order->getShippingInvoiced());
98
+ $order->setBaseShippingCanceled(
99
+ $order->getBaseShippingAmount() - $order->getBaseShippingInvoiced()
100
+ );
101
+
102
+ $order->setDiscountCanceled(
103
+ abs($order->getDiscountAmount()) - $order->getDiscountInvoiced()
104
+ );
105
+ $order->setBaseDiscountCanceled(
106
+ abs($order->getBaseDiscountAmount()) - $order->getBaseDiscountInvoiced()
107
+ );
108
+
109
+ $order->setTotalCanceled($order->getGrandTotal() - $order->getTotalPaid());
110
+ $order->setBaseTotalCanceled($order->getBaseGrandTotal() - $order->getBaseTotalPaid());
111
+
112
+ $order->setState($cancelState, true, $this->getFinalStatusComment());
113
+ }
114
+
115
+ /**
116
+ * process final state
117
+ *
118
+ * @param Mage_Sales_Model_Order $order
119
+ * @param Mage_Sales_Model_Order_Payment $payment
120
+ */
121
+ protected function processFinalStatus($order, $payment)
122
+ {
123
+ // handle authorization declined
124
+ // thrown exception gets catched by core and order will not been created
125
+ if ($this->getStatus() == Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED
126
+ ) {
127
+ $this->processAuthorizationDeclined($order, $payment);
128
+
129
+ } elseif ($this->getStatus() == Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER) {
130
+ $order->registerCancellation($this->getFinalStatusComment());
131
+ }
132
+
133
+ if ($this->getShouldRegisterFeedback()) {
134
+ if ($order->getState() === Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
135
+ $this->processFinalStatusInPaymentReview($order, $payment);
136
+ } elseif ($order->getState() === Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
137
+ || $order->getState() === Mage_Sales_Model_Order::STATE_NEW
138
+ ) {
139
+ $payment->registerAuthorizationNotification($this->getAmount());
140
  $order->setState(
141
+ Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, $this->getFinalStatusComment()
 
 
 
 
142
  );
143
+
 
 
 
 
144
  }
145
+ } else {
146
+ $this->addFinalStatusComment();
147
  }
148
+ }
149
 
150
+ /**
151
+ * save payment and order object and send transaction email if order state is not canceled
152
+ *
153
+ *
154
+ * @param Mage_Sales_Model_Order_Payment $payment
155
+ * @param Mage_Sales_Model_Order $order
156
+ */
157
+ protected function persistSalesObject($payment, $order)
158
+ {
159
  if ($this->getShouldRegisterFeedback()) {
160
  $payment->save();
161
  $order->save();
162
 
163
  // gateway payments do not send confirmation emails by default
164
+ if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
165
  Mage::helper('ops/data')->sendTransactionalEmail($order);
166
  }
167
  }
168
  }
169
+
170
+ /**
171
+ * process non final state
172
+ *
173
+ * @param Mage_Sales_Model_Order_Payment $payment
174
+ * @param Mage_Sales_Model_Order $order
175
+ */
176
+ protected function processIntermediateState($payment, $order)
177
+ {
178
+ $payment->setIsTransactionPending(true);
179
+ if ($this->getStatus() == Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT) {
180
+ $payment->setIsFraudDetected(true);
181
+ $order->setState(
182
+ Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW,
183
+ Mage_Sales_Model_Order::STATUS_FRAUD,
184
+ $this->getFraudStatusComment(
185
+ Mage::helper('ops')->__('Please have a look in PayEngine backend for more information.')
186
+ )
187
+ );
188
+ } else {
189
+ $order->addStatusHistoryComment($this->getIntermediateStatusComment());
190
+ }
191
+ if ($this->getShouldRegisterFeedback()) {
192
+ $payment->registerAuthorizationNotification($this->getAmount());
193
+ }
194
+ }
195
+
196
+ /**
197
+ * process authorization declined feedback
198
+ *
199
+ * @param Mage_Sales_Model_Order $order
200
+ * @param Mage_Sales_Model_Order_Payment $payment
201
+ */
202
+ protected function processAuthorizationDeclined($order, $payment)
203
+ {
204
+ if (!$this->getShouldRegisterFeedback()) {
205
+ Mage::throwException(
206
+ Mage::helper('ops')->__(
207
+ 'Payment failed because the authorization was declined! Please choose another payment method.'
208
+ )
209
+ );
210
+ } elseif ($order->getState() === Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
211
+
212
+ try {
213
+ // if the payment was previously in payment review/has status 46
214
+ // the identification obviously failed and the order gets canceled
215
+ $payment->setNotificationResult(true);
216
+ $payment->registerPaymentReviewAction(
217
+ Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, false
218
+ );
219
+ } catch (Mage_Core_Exception $e) {
220
+ // perform manual cancellation if we are on CE1.7 and receive the error message
221
+ if ($e->getMessage() === Mage::helper('sales')->__('Order does not allow to be canceled.')) {
222
+ $this->registerCancellation($order);
223
+ }
224
+ }
225
+ }
226
+ }
227
+
228
+ /**
229
+ * If order is in payment_review and we receive a final status, the order needs to be moved to
230
+ * new the proper order state, e.g. canceled for failed payments or processing for successful ones
231
+ *
232
+ * @param Mage_Sales_Model_Order $order
233
+ * @param Mage_Sales_Model_Order_Payment $payment
234
+ */
235
+ protected function processFinalStatusInPaymentReview($order, $payment)
236
+ {
237
+ $action = Mage_Sales_Model_Order_Payment::REVIEW_ACTION_ACCEPT;
238
+ $targetState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
239
+ if (Netresearch_OPS_Model_Status::canResendPaymentInfo($this->getStatus())
240
+ && Mage::helper('ops/payment')->isInlinePayment($payment)
241
+ ) {
242
+ $targetState = Mage_Sales_Model_Order::STATE_CANCELED;
243
+ $action = Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY;
244
+ }
245
+ $payment->setNotificationResult(true);
246
+ $payment->registerPaymentReviewAction($action, false);
247
+ if ($order->getState() != $targetState) {
248
+ $order->setState($targetState, true, $this->getFinalStatusComment());
249
+ }
250
+ }
251
  }
app/code/community/Netresearch/OPS/Model/Response/Type/Capture.php CHANGED
@@ -37,7 +37,7 @@ class Netresearch_OPS_Model_Response_Type_Capture extends Netresearch_OPS_Model_
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isCapture($this->getStatus())) {
40
- throw new Mage_Core_Exception(Mage::helper('ops')->__('%s is not a capture status!', $this->getStatus()));
41
  }
42
 
43
  /** @var Mage_Sales_Model_Order_Payment $payment */
@@ -58,60 +58,94 @@ class Netresearch_OPS_Model_Response_Type_Capture extends Netresearch_OPS_Model_
58
  */
59
 
60
  if (Netresearch_OPS_Model_Status::isIntermediate($this->getStatus())) {
 
 
 
 
 
61
 
62
- $message = $this->getIntermediateStatusComment();
63
- $payment->setIsTransactionPending(true);
64
- if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
65
- || $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
66
- ) {
67
- // transaction was placed on PSP, initial feedback to shop or partial capture case
68
 
69
- $payment->setPreparedMessage($message);
70
- if ($this->getShouldRegisterFeedback()) {
71
- $payment->registerCaptureNotification($this->getAmount());
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
75
- // payment was pending and is still pending
76
- $payment->setIsTransactionApproved(false);
77
- $payment->setIsTransactionDenied(false);
78
- $payment->setPreparedMessage($message);
79
 
80
- if ($this->getShouldRegisterFeedback()) {
81
- $payment->setNotificationResult(true);
82
- $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, false);
83
- }
 
 
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
  } else {
87
- // final status, means 9 or 95
88
- $message = $this->getFinalStatusComment();
89
- if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
90
- $payment->setNotificationResult(true);
91
- $payment->setPreparedMessage($message);
92
- if ($this->getShouldRegisterFeedback()) {
93
- $payment->setNotificationResult(true);
94
- $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_ACCEPT, false);
95
- }
96
- } else {
97
- $payment->setPreparedMessage($message);
98
- if ($this->getShouldRegisterFeedback()) {
99
- $payment->registerCaptureNotification($this->getAmount());
100
- }
101
  }
102
  }
 
103
 
104
- if ($this->getShouldRegisterFeedback()) {
105
- $payment->save();
106
- $order->save();
 
 
 
 
 
 
 
107
 
108
- // gateway payments do not send confirmation emails by default
109
- Mage::helper('ops/data')->sendTransactionalEmail($order);
110
-
111
- $invoice = Mage::getModel('sales/order_invoice')->load($this->getTransactionId(), 'transaction_id');
112
- if($invoice->getId()){
113
- Mage::helper('ops')->sendTransactionalEmail($invoice);
114
- }
115
  }
116
  }
117
- }
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isCapture($this->getStatus())) {
40
+ Mage::throwException(Mage::helper('ops')->__('%s is not a capture status!', $this->getStatus()));
41
  }
42
 
43
  /** @var Mage_Sales_Model_Order_Payment $payment */
58
  */
59
 
60
  if (Netresearch_OPS_Model_Status::isIntermediate($this->getStatus())) {
61
+ $this->processIntermediateState($payment, $order);
62
+ } else {
63
+ // final means state 9 or 95
64
+ $this->processFinalState($order, $payment);
65
+ }
66
 
67
+ if ($this->getShouldRegisterFeedback()) {
68
+ $this->registerFeedBack($payment, $order);
69
+ }
70
+ }
 
 
71
 
72
+ /**
73
+ * process intermediate state
74
+ *
75
+ * @param Mage_Sales_Model_Order_Payment $payment
76
+ * @param Mage_Sales_Model_Order $order
77
+ */
78
+ protected function processIntermediateState($payment, $order)
79
+ {
80
+ $message = $this->getIntermediateStatusComment();
81
+ $payment->setIsTransactionPending(true);
82
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
83
+ || $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
84
+ ) {
85
+ // transaction was placed on PSP, initial feedback to shop or partial capture case
86
+ $payment->setPreparedMessage($message);
87
+ if ($this->getShouldRegisterFeedback()) {
88
+ $payment->registerCaptureNotification($this->getAmount());
89
+ }
90
 
91
+ } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
92
+ // payment was pending and is still pending
93
+ $payment->setIsTransactionApproved(false);
94
+ $payment->setIsTransactionDenied(false);
95
+ $payment->setPreparedMessage($message);
96
 
97
+ if ($this->getShouldRegisterFeedback()) {
98
+ $payment->setNotificationResult(true);
99
+ $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, false);
100
+ }
101
+ }
102
+ }
103
 
104
+ /**
105
+ * process final state
106
+ *
107
+ * @param Mage_Sales_Model_Order_Payment $payment
108
+ * @param Mage_Sales_Model_Order $order
109
+ */
110
+ protected function processFinalState($order, $payment)
111
+ {
112
+ $message = $this->getFinalStatusComment();
113
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
114
+ $payment->setNotificationResult(true);
115
+ $payment->setPreparedMessage($message);
116
+ if ($this->getShouldRegisterFeedback()) {
117
+ $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_ACCEPT, false);
118
+ $transaction = $payment->getTransaction($payment->getLastTransId());
119
+ if ($transaction) {
120
+ $transaction->close(true);
121
+ }
122
  }
123
  } else {
124
+ $payment->setPreparedMessage($message);
125
+ if ($this->getShouldRegisterFeedback()) {
126
+ $payment->registerCaptureNotification($this->getAmount());
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
  }
129
+ }
130
 
131
+ /**
132
+ * save payment and order object and send transaction email
133
+ *
134
+ * @param Mage_Sales_Model_Order_Payment $payment
135
+ * @param Mage_Sales_Model_Order $order
136
+ */
137
+ protected function registerFeedBack($payment, $order)
138
+ {
139
+ $payment->save();
140
+ $order->save();
141
 
142
+ // gateway payments do not send confirmation emails by default
143
+ Mage::helper('ops/data')->sendTransactionalEmail($order);
144
+
145
+ /** @var Mage_Sales_Model_Order_Invoice $invoice */
146
+ $invoice = Mage::getModel('sales/order_invoice')->load($this->getTransactionId(), 'transaction_id');
147
+ if ($invoice->getId()) {
148
+ Mage::helper('ops')->sendTransactionalEmail($invoice);
149
  }
150
  }
151
+ }
app/code/community/Netresearch/OPS/Model/Response/Type/Refund.php CHANGED
@@ -40,7 +40,6 @@ class Netresearch_OPS_Model_Response_Type_Refund extends Netresearch_OPS_Model_R
40
  Mage::throwException(Mage::helper('ops')->__('%s is not a refund status!', $this->getStatus()));
41
  }
42
 
43
-
44
  /** @var Mage_Sales_Model_Order_Payment $payment */
45
  $payment = $this->getMethodInstance()->getInfoInstance();
46
 
@@ -65,37 +64,7 @@ class Netresearch_OPS_Model_Response_Type_Refund extends Netresearch_OPS_Model_R
65
  $this->closeRefundTransaction($creditMemo);
66
  $this->addFinalStatusComment();
67
  } elseif ($this->getStatus() == Netresearch_OPS_Model_Status::REFUND_REFUSED) {
68
- $order = $creditMemo->getOrder();
69
- $creditMemo->cancel()->save();
70
- $this->closeRefundTransaction($creditMemo);
71
- $invoice = Mage::getModel('sales/order_invoice')->load($creditMemo->getInvoiceId());
72
- $invoice->setIsUsedForRefund(0)
73
- ->setBaseTotalRefunded(
74
- $invoice->getBaseTotalRefunded() - $creditMemo->getBaseGrandTotal()
75
- );
76
- $creditMemo->setInvoice($invoice);
77
- /** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
78
- foreach ($creditMemo->getAllItems() as $item) {
79
- $item->getOrderItem()->setAmountRefunded(
80
- $item->getOrderItem()->getAmountRefunded() - $item->getRowTotal()
81
- );
82
- $item->getOrderItem()->setBaseAmountRefunded(
83
- $item->getOrderItem()->getBaseAmountRefunded() - $item->getBaseRowTotal()
84
- );
85
- }
86
- $order->setTotalRefunded($order->getTotalRefunded() - $creditMemo->getBaseGrandTotal());
87
- $order->setBaseTotalRefunded($order->getBaseTotalRefunded() - $creditMemo->getBaseGrandTotal());
88
-
89
- $this->addRefusedStatusComment();
90
- $state = Mage_Sales_Model_Order::STATE_COMPLETE;
91
- if ($order->canShip() || $order->canInvoice()) {
92
- $state = Mage_Sales_Model_Order::STATE_PROCESSING;
93
- }
94
- $order->setState(
95
- $state,
96
- true,
97
- $this->getRefusedStatusComment(Mage::helper('ops')->__('Refund refused by PayEngine.'))
98
- );
99
  } else {
100
  $this->addIntermediateStatusComment();
101
  }
@@ -117,19 +86,11 @@ class Netresearch_OPS_Model_Response_Type_Refund extends Netresearch_OPS_Model_R
117
  }
118
  }
119
  }
120
- if ($this->getShouldRegisterFeedback()) {
121
- $transactionSave = Mage::getModel('core/resource_transaction')
122
- ->addObject($order)
123
- ->addObject($payment)
124
- ->addObject($creditMemo);
125
 
126
- if ($creditMemo->getInvoice()) {
127
- $transactionSave->addObject($creditMemo->getInvoice());
128
- }
129
- $transactionSave->save();
130
  }
131
 
132
- return;
133
  }
134
 
135
  /**
@@ -166,4 +127,67 @@ class Netresearch_OPS_Model_Response_Type_Refund extends Netresearch_OPS_Model_R
166
  }
167
  }
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  }
40
  Mage::throwException(Mage::helper('ops')->__('%s is not a refund status!', $this->getStatus()));
41
  }
42
 
 
43
  /** @var Mage_Sales_Model_Order_Payment $payment */
44
  $payment = $this->getMethodInstance()->getInfoInstance();
45
 
64
  $this->closeRefundTransaction($creditMemo);
65
  $this->addFinalStatusComment();
66
  } elseif ($this->getStatus() == Netresearch_OPS_Model_Status::REFUND_REFUSED) {
67
+ $order = $this->processRefundRefused($creditMemo);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  } else {
69
  $this->addIntermediateStatusComment();
70
  }
86
  }
87
  }
88
  }
 
 
 
 
 
89
 
90
+ if ($this->getShouldRegisterFeedback()) {
91
+ $this->registerFeedBack($order, $payment, $creditMemo);
 
 
92
  }
93
 
 
94
  }
95
 
96
  /**
127
  }
128
  }
129
 
130
+ /**
131
+ * process refund refused response
132
+ *
133
+ * @param $creditMemo
134
+ * @return mixed
135
+ */
136
+ protected function processRefundRefused($creditMemo)
137
+ {
138
+ $order = $creditMemo->getOrder();
139
+ $creditMemo->cancel()->save();
140
+ $this->closeRefundTransaction($creditMemo);
141
+ $invoice = Mage::getModel('sales/order_invoice')->load($creditMemo->getInvoiceId());
142
+ $invoice->setIsUsedForRefund(0)
143
+ ->setBaseTotalRefunded(
144
+ $invoice->getBaseTotalRefunded() - $creditMemo->getBaseGrandTotal()
145
+ );
146
+ $creditMemo->setInvoice($invoice);
147
+ /** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
148
+ foreach ($creditMemo->getAllItems() as $item) {
149
+ $item->getOrderItem()->setAmountRefunded(
150
+ $item->getOrderItem()->getAmountRefunded() - $item->getRowTotal()
151
+ );
152
+ $item->getOrderItem()->setBaseAmountRefunded(
153
+ $item->getOrderItem()->getBaseAmountRefunded() - $item->getBaseRowTotal()
154
+ );
155
+ }
156
+ $order->setTotalRefunded($order->getTotalRefunded() - $creditMemo->getBaseGrandTotal());
157
+ $order->setBaseTotalRefunded($order->getBaseTotalRefunded() - $creditMemo->getBaseGrandTotal());
158
+
159
+ $this->addRefusedStatusComment();
160
+ $state = Mage_Sales_Model_Order::STATE_COMPLETE;
161
+ if ($order->canShip() || $order->canInvoice()) {
162
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
163
+ }
164
+ $order->setState(
165
+ $state,
166
+ true,
167
+ $this->getRefusedStatusComment(Mage::helper('ops')->__('Refund refused by PayEngine.'))
168
+ );
169
+
170
+ return $order;
171
+ }
172
+
173
+ /**
174
+ * register feedback
175
+ *
176
+ * @param $order
177
+ * @param $payment
178
+ * @param $creditMemo
179
+ */
180
+ protected function registerFeedBack($order, $payment, $creditMemo)
181
+ {
182
+ $transactionSave = Mage::getModel('core/resource_transaction')
183
+ ->addObject($order)
184
+ ->addObject($payment)
185
+ ->addObject($creditMemo);
186
+
187
+ if ($creditMemo->getInvoice()) {
188
+ $transactionSave->addObject($creditMemo->getInvoice());
189
+ }
190
+ $transactionSave->save();
191
+ }
192
+
193
  }
app/code/community/Netresearch/OPS/Model/Response/Type/Special.php CHANGED
@@ -37,7 +37,7 @@ class Netresearch_OPS_Model_Response_Type_Special extends Netresearch_OPS_Model_
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isSpecialStatus($this->getStatus())) {
40
- throw new Mage_Core_Exception(Mage::helper('ops')->__('%s is not a special status!', $this->getStatus()));
41
  }
42
 
43
  /** @var Mage_Sales_Model_Order_Payment $payment */
@@ -60,21 +60,19 @@ class Netresearch_OPS_Model_Response_Type_Special extends Netresearch_OPS_Model_
60
  'Customer received your payment instructions, waiting for actual payment.'
61
  )
62
  )
63
-
64
  );
65
 
66
  // gateway payments do not send confirmation emails by default
67
  Mage::helper('ops/data')->sendTransactionalEmail($order);
68
  }
69
 
70
- if ($this->getStatus() == Netresearch_OPS_Model_Status::STORED_WAITING_EXTERNAL_RESULT) {
71
- //TODO handle status 40
72
- }
73
-
74
  if ($this->getStatus() == Netresearch_OPS_Model_Status::INVALID_INCOMPLETE) {
75
  //save status information to order before exception
76
- $this->updateAdditionalInformation();
77
- $payment->save();
 
 
 
78
 
79
  $message = Mage::helper('ops')->__('PayEngine status 0, the action failed.');
80
  if ($helper->isAdminSession()) {
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isSpecialStatus($this->getStatus())) {
40
+ Mage::throwException(Mage::helper('ops')->__('%s is not a special status!', $this->getStatus()));
41
  }
42
 
43
  /** @var Mage_Sales_Model_Order_Payment $payment */
60
  'Customer received your payment instructions, waiting for actual payment.'
61
  )
62
  )
 
63
  );
64
 
65
  // gateway payments do not send confirmation emails by default
66
  Mage::helper('ops/data')->sendTransactionalEmail($order);
67
  }
68
 
 
 
 
 
69
  if ($this->getStatus() == Netresearch_OPS_Model_Status::INVALID_INCOMPLETE) {
70
  //save status information to order before exception
71
+ if($this->getShouldRegisterFeedback()){
72
+ $this->updateAdditionalInformation();
73
+ $payment->save();
74
+ }
75
+
76
 
77
  $message = Mage::helper('ops')->__('PayEngine status 0, the action failed.');
78
  if ($helper->isAdminSession()) {
app/code/community/Netresearch/OPS/Model/Response/Type/Void.php CHANGED
@@ -37,7 +37,7 @@ class Netresearch_OPS_Model_Response_Type_Void extends Netresearch_OPS_Model_Res
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isVoid($this->getStatus())) {
40
- throw new Mage_Core_Exception(Mage::helper('ops')->__('%s is not a void status!', $this->getStatus()));
41
  }
42
 
43
  /** @var Mage_Sales_Model_Order_Payment $payment */
@@ -52,7 +52,8 @@ class Netresearch_OPS_Model_Response_Type_Void extends Netresearch_OPS_Model_Res
52
  );
53
  $payment->registerVoidNotification($this->getAmount());
54
 
55
- // payment void does not cancel the order, but sets it to processing. we therefore need to cancel the order ourselves
 
56
  $order->registerCancellation($this->getFinalStatusComment(), true);
57
  } else {
58
  $this->addFinalStatusComment();
@@ -63,6 +64,4 @@ class Netresearch_OPS_Model_Response_Type_Void extends Netresearch_OPS_Model_Res
63
 
64
  $order->save();
65
  }
66
-
67
-
68
  }
37
  protected function _handleResponse()
38
  {
39
  if (!Netresearch_OPS_Model_Status::isVoid($this->getStatus())) {
40
+ Mage::throwException(Mage::helper('ops')->__('%s is not a void status!', $this->getStatus()));
41
  }
42
 
43
  /** @var Mage_Sales_Model_Order_Payment $payment */
52
  );
53
  $payment->registerVoidNotification($this->getAmount());
54
 
55
+ // payment void does not cancel the order, but sets it to processing.
56
+ // We therefore need to cancel the order ourselves.
57
  $order->registerCancellation($this->getFinalStatusComment(), true);
58
  } else {
59
  $this->addFinalStatusComment();
64
 
65
  $order->save();
66
  }
 
 
67
  }
app/code/community/Netresearch/OPS/Model/Source/BankTransfer/Countries.php CHANGED
@@ -46,14 +46,23 @@ class Netresearch_OPS_Model_Source_BankTransfer_Countries
46
  if (!$this->options) {
47
  $this->options = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
48
  if (!$isMultiselect) {
49
- array_unshift($this->options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
 
 
 
 
 
 
50
  }
51
  foreach ($this->options as $offset=>$option) {
52
  if (!in_array($option['value'], $this->countries)) {
53
  unset($this->options[$offset]);
54
  }
55
  }
56
- $this->options['*'] = array('value'=>'*', 'label'=> Mage::helper('adminhtml')->__(Mage::helper('ops')->__('Miscellaneous Countries')));
 
 
 
57
  }
58
 
59
  return $this->options;
46
  if (!$this->options) {
47
  $this->options = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
48
  if (!$isMultiselect) {
49
+ array_unshift(
50
+ $this->options,
51
+ array(
52
+ 'value'=>'',
53
+ 'label'=> Mage::helper('adminhtml')->__('--Please Select--')
54
+ )
55
+ );
56
  }
57
  foreach ($this->options as $offset=>$option) {
58
  if (!in_array($option['value'], $this->countries)) {
59
  unset($this->options[$offset]);
60
  }
61
  }
62
+ $this->options['*'] = array(
63
+ 'value'=>'*',
64
+ 'label'=> Mage::helper('adminhtml')->__(Mage::helper('ops')->__('Miscellaneous Countries'))
65
+ );
66
  }
67
 
68
  return $this->options;
app/code/community/Netresearch/OPS/Model/Source/DirectDebit/Countries.php CHANGED
@@ -45,7 +45,13 @@ class Netresearch_OPS_Model_Source_DirectDebit_Countries
45
  if (!$this->options) {
46
  $this->options = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
47
  if (!$isMultiselect) {
48
- array_unshift($this->options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
 
 
 
 
 
 
49
  }
50
  foreach ($this->options as $offset=>$option) {
51
  if (!in_array($option['value'], $this->countries)) {
45
  if (!$this->options) {
46
  $this->options = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
47
  if (!$isMultiselect) {
48
+ array_unshift(
49
+ $this->options,
50
+ array(
51
+ 'value'=>'',
52
+ 'label'=> Mage::helper('adminhtml')->__('--Please Select--')
53
+ )
54
+ );
55
  }
56
  foreach ($this->options as $offset=>$option) {
57
  if (!in_array($option['value'], $this->countries)) {
app/code/community/Netresearch/OPS/Model/Source/DirectEbanking/Brands.php CHANGED
@@ -56,7 +56,7 @@ protected $options = array(
56
  /**
57
  * @return array
58
  */
59
- public function toOptionArray($isMultiselect = false)
60
  {
61
  foreach ($this->options as $key => $value) {
62
  $this->options[$key]['label'] = Mage::helper('ops')->__($value['value']);
56
  /**
57
  * @return array
58
  */
59
+ public function toOptionArray()
60
  {
61
  foreach ($this->options as $key => $value) {
62
  $this->options[$key]['label'] = Mage::helper('ops')->__($value['value']);
app/code/community/Netresearch/OPS/Model/Source/Kwixo/ShipMethodType.php CHANGED
@@ -59,20 +59,20 @@ class Netresearch_OPS_Model_Source_Kwixo_ShipMethodType
59
  array(
60
  'value' => self::COLLECTION_POINT,
61
  'label' => Mage::helper('ops/data')->__(
62
- 'Collection point (Kiala...)'
63
- )
64
  ),
65
  array(
66
  'value' => self::COLLECT_AT_AIRPORT,
67
  'label' => Mage::helper('ops/data')->__(
68
- 'Collect at airport, train station or travel agency'
69
- )
70
  ),
71
  array(
72
  'value' => self::TRANSPORTER,
73
  'label' => Mage::helper('ops/data')->__(
74
- 'Transporter (La Poste, UPS...)'
75
- )
76
  ),
77
  array(
78
  'value' => self::DOWNLOAD,
59
  array(
60
  'value' => self::COLLECTION_POINT,
61
  'label' => Mage::helper('ops/data')->__(
62
+ 'Collection point (Kiala...)'
63
+ )
64
  ),
65
  array(
66
  'value' => self::COLLECT_AT_AIRPORT,
67
  'label' => Mage::helper('ops/data')->__(
68
+ 'Collect at airport, train station or travel agency'
69
+ )
70
  ),
71
  array(
72
  'value' => self::TRANSPORTER,
73
  'label' => Mage::helper('ops/data')->__(
74
+ 'Transporter (La Poste, UPS...)'
75
+ )
76
  ),
77
  array(
78
  'value' => self::DOWNLOAD,
app/code/community/Netresearch/OPS/Model/Source/Mode.php CHANGED
@@ -1,29 +1,31 @@
1
- <?php
2
- /**
3
- * Mode.php
4
- * @author paul.siedler@netresearch.de
5
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
- */
8
-
9
-
10
- class Netresearch_OPS_Model_Source_Mode {
11
-
12
- const PROD = 'prod';
13
- const TEST = 'test';
14
- const CUSTOM = 'custom';
15
-
16
- /**
17
- *
18
- *
19
- * @return array
20
- */
21
- public function toOptionArray(){
22
- return array(
23
- array('value' => self::TEST, 'label' => Mage::helper('ops')->__(self::TEST)),
24
- array('value' => self::PROD, 'label' => Mage::helper('ops')->__(self::PROD)),
25
- array('value' => self::CUSTOM, 'label' => Mage::helper('ops')->__(self::CUSTOM)),
26
- );
27
- }
28
-
29
- }
 
 
1
+ <?php
2
+ /**
3
+ * Mode.php
4
+ * @author paul.siedler@netresearch.de
5
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
+ */
8
+
9
+
10
+ class Netresearch_OPS_Model_Source_Mode
11
+ {
12
+
13
+ const PROD = 'prod';
14
+ const TEST = 'test';
15
+ const CUSTOM = 'custom';
16
+
17
+ /**
18
+ *
19
+ *
20
+ * @return array
21
+ */
22
+ public function toOptionArray()
23
+ {
24
+ return array(
25
+ array('value' => self::TEST, 'label' => Mage::helper('ops')->__(self::TEST)),
26
+ array('value' => self::PROD, 'label' => Mage::helper('ops')->__(self::PROD)),
27
+ array('value' => self::CUSTOM, 'label' => Mage::helper('ops')->__(self::CUSTOM)),
28
+ );
29
+ }
30
+
31
+ }
app/code/community/Netresearch/OPS/Model/Source/OrderReference.php CHANGED
@@ -37,8 +37,14 @@ class Netresearch_OPS_Model_Source_OrderReference
37
  public function toOptionArray()
38
  {
39
  return array(
40
- array('value' => Netresearch_OPS_Model_Payment_Abstract::REFERENCE_QUOTE_ID, 'label' => Mage::helper('ops')->__('quote id')),
41
- array('value' => Netresearch_OPS_Model_Payment_Abstract::REFERENCE_ORDER_ID, 'label' => Mage::helper('ops')->__('order id')),
 
 
 
 
 
 
42
  );
43
  }
44
  }
37
  public function toOptionArray()
38
  {
39
  return array(
40
+ array(
41
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::REFERENCE_QUOTE_ID,
42
+ 'label' => Mage::helper('ops')->__('quote id')
43
+ ),
44
+ array(
45
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::REFERENCE_ORDER_ID,
46
+ 'label' => Mage::helper('ops')->__('order id')
47
+ ),
48
  );
49
  }
50
  }
app/code/community/Netresearch/OPS/Model/Source/PaymentAction.php CHANGED
@@ -37,8 +37,14 @@ class Netresearch_OPS_Model_Source_PaymentAction
37
  public function toOptionArray()
38
  {
39
  return array(
40
- array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, 'label' => Mage::helper('ops')->__('Authorization')),
41
- array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, 'label' => Mage::helper('ops')->__('Direct Sale')),
 
 
 
 
 
 
42
  );
43
  }
44
  }
37
  public function toOptionArray()
38
  {
39
  return array(
40
+ array(
41
+ 'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE,
42
+ 'label' => Mage::helper('ops')->__('Authorization')
43
+ ),
44
+ array(
45
+ 'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE,
46
+ 'label' => Mage::helper('ops')->__('Direct Sale')
47
+ ),
48
  );
49
  }
50
  }
app/code/community/Netresearch/OPS/Model/Source/Pmlist.php CHANGED
@@ -37,9 +37,18 @@ class Netresearch_OPS_Model_Source_Pmlist
37
  public function toOptionArray()
38
  {
39
  return array(
40
- array('value' => Netresearch_OPS_Model_Payment_Abstract::PMLIST_HORIZONTAL_LEFT, 'label' => Mage::helper('ops')->__('Horizontally grouped logo with group name on left')),
41
- array('value' => Netresearch_OPS_Model_Payment_Abstract::PMLIST_HORIZONTAL, 'label' => Mage::helper('ops')->__('Horizontally grouped logo with no group name')),
42
- array('value' => Netresearch_OPS_Model_Payment_Abstract::PMLIST_VERTICAL, 'label' => Mage::helper('ops')->__('Verical list')),
 
 
 
 
 
 
 
 
 
43
  );
44
  }
45
  }
37
  public function toOptionArray()
38
  {
39
  return array(
40
+ array(
41
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::PMLIST_HORIZONTAL_LEFT,
42
+ 'label' => Mage::helper('ops')->__('Horizontally grouped logo with group name on left')
43
+ ),
44
+ array(
45
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::PMLIST_HORIZONTAL,
46
+ 'label' => Mage::helper('ops')->__('Horizontally grouped logo with no group name')
47
+ ),
48
+ array(
49
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::PMLIST_VERTICAL,
50
+ 'label' => Mage::helper('ops')->__('Verical list')
51
+ ),
52
  );
53
  }
54
  }
app/code/community/Netresearch/OPS/Model/Source/Template.php CHANGED
@@ -37,10 +37,22 @@ class Netresearch_OPS_Model_Source_Template
37
  public function toOptionArray()
38
  {
39
  return array(
40
- array('value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_REDIRECT, 'label' => Mage::helper('ops')->__('PayEngine - Redirect mode')),
41
- array('value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL, 'label' => Mage::helper('ops')->__('Magento - internal shop template')),
42
- array('value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME, 'label' => Mage::helper('ops')->__('PayEngine - iFrame mode')),
43
- array('value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE, 'label' => Mage::helper('ops')->__('PayEngine - Dynamic template'))
 
 
 
 
 
 
 
 
 
 
 
 
44
  );
45
  }
46
  }
37
  public function toOptionArray()
38
  {
39
  return array(
40
+ array(
41
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_REDIRECT,
42
+ 'label' => Mage::helper('ops')->__('PayEngine - Redirect mode')
43
+ ),
44
+ array(
45
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL,
46
+ 'label' => Mage::helper('ops')->__('Magento - internal shop template')
47
+ ),
48
+ array(
49
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME,
50
+ 'label' => Mage::helper('ops')->__('PayEngine - iFrame mode')
51
+ ),
52
+ array(
53
+ 'value' => Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE,
54
+ 'label' => Mage::helper('ops')->__('PayEngine - Dynamic template')
55
+ )
56
  );
57
  }
58
  }
app/code/community/Netresearch/OPS/Model/Source/TemplateType.php CHANGED
@@ -1,21 +1,23 @@
1
- <?php
2
- /**
3
- * TemplateType.php
4
- * @author paul.siedler@netresearch.de
5
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
- */
8
-
9
- class Netresearch_OPS_Model_Source_TemplateType {
10
-
11
- const URL = 'url';
12
- const ID = 'id';
13
-
14
- public function toOptionArray(){
15
- return array(
16
- array('value' => self::URL, 'label' => Mage::helper('ops')->__(self::URL)),
17
- array('value' => self::ID, 'label' => Mage::helper('ops')->__(self::ID))
18
- );
19
- }
20
-
21
- }
 
 
1
+ <?php
2
+ /**
3
+ * TemplateType.php
4
+ * @author paul.siedler@netresearch.de
5
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
+ */
8
+
9
+ class Netresearch_OPS_Model_Source_TemplateType
10
+ {
11
+
12
+ const URL = 'url';
13
+ const ID = 'id';
14
+
15
+ public function toOptionArray()
16
+ {
17
+ return array(
18
+ array('value' => self::URL, 'label' => Mage::helper('ops')->__(self::URL)),
19
+ array('value' => self::ID, 'label' => Mage::helper('ops')->__(self::ID))
20
+ );
21
+ }
22
+
23
+ }
app/code/community/Netresearch/OPS/Model/Status.php CHANGED
@@ -35,7 +35,8 @@
35
  * Statuses in 1 digit are 'normal' statuses:
36
  *
37
  * 0 or 1 means the payment entry was not completed either because it is still underway or because interrupted or because
38
- * a validation error prevented from confirming. If the cause is a validation error, an additional error code (*) (NCERROR) identifies the error.
 
39
  *
40
  * 2 means the acquirer did not authorise the payment.
41
  *
@@ -70,7 +71,7 @@ class Netresearch_OPS_Model_Status
70
  const AUTHORIZED_WAITING_EXTERNAL_RESULT = 50;
71
  const AUTHORIZATION_WAITING = 51;
72
  const AUTHORIZED_UNKNOWN = 52;
73
- const STAND_BY_SUSPECTED_FRAUD = 55;
74
  const OK_WITH_SHEDULED_PAYMENTS = 56;
75
  const NOT_OK_WITH_SHEDULED_PAYMENTS = 57;
76
  const AUTHORISATION_TO_BE_REQUESTED_MANUALLY = 59;
@@ -228,7 +229,7 @@ class Netresearch_OPS_Model_Status
228
  self::AUTHORIZED_WAITING_EXTERNAL_RESULT,
229
  self::AUTHORIZATION_WAITING,
230
  self::AUTHORIZED_UNKNOWN,
231
- self::STAND_BY_SUSPECTED_FRAUD,
232
  self::OK_WITH_SHEDULED_PAYMENTS,
233
  self::NOT_OK_WITH_SHEDULED_PAYMENTS,
234
  self::AUTHORISATION_TO_BE_REQUESTED_MANUALLY,
35
  * Statuses in 1 digit are 'normal' statuses:
36
  *
37
  * 0 or 1 means the payment entry was not completed either because it is still underway or because interrupted or because
38
+ * a validation error prevented from confirming. If the cause is a validation error,
39
+ * an additional error code (*) (NCERROR) identifies the error.
40
  *
41
  * 2 means the acquirer did not authorise the payment.
42
  *
71
  const AUTHORIZED_WAITING_EXTERNAL_RESULT = 50;
72
  const AUTHORIZATION_WAITING = 51;
73
  const AUTHORIZED_UNKNOWN = 52;
74
+ const STAND_BY = 55;
75
  const OK_WITH_SHEDULED_PAYMENTS = 56;
76
  const NOT_OK_WITH_SHEDULED_PAYMENTS = 57;
77
  const AUTHORISATION_TO_BE_REQUESTED_MANUALLY = 59;
229
  self::AUTHORIZED_WAITING_EXTERNAL_RESULT,
230
  self::AUTHORIZATION_WAITING,
231
  self::AUTHORIZED_UNKNOWN,
232
+ self::STAND_BY,
233
  self::OK_WITH_SHEDULED_PAYMENTS,
234
  self::NOT_OK_WITH_SHEDULED_PAYMENTS,
235
  self::AUTHORISATION_TO_BE_REQUESTED_MANUALLY,
app/code/community/Netresearch/OPS/Model/Status/Update.php CHANGED
@@ -244,7 +244,8 @@ class Netresearch_OPS_Model_Status_Update
244
  }
245
 
246
  if (false != strlen(trim($this->getOrder()->getPayment()->getAdditionalInformation('paymentId')))) {
247
- Mage::getModel('ops/response_handler')->processResponse($this->getOpsResponse(),
 
248
  $this->getOrder()->getPayment()->getMethodInstance()
249
  );
250
  } else {
@@ -288,12 +289,13 @@ class Netresearch_OPS_Model_Status_Update
288
 
289
  /**
290
  * @param Mage_Sales_Model_Order_Payment $payment
 
291
  */
292
  protected function addPayIdSub(Mage_Sales_Model_Order_Payment $payment)
293
  {
294
  $lastTransaction = $payment->getLastTransId();
295
  $lastTransactionParts = explode('/', $lastTransaction);
296
- if($lastTransaction && count($lastTransactionParts)>1){
297
  $this->requestParams['PAYIDSUB'] = $lastTransactionParts[1];
298
  }
299
  return $this;
244
  }
245
 
246
  if (false != strlen(trim($this->getOrder()->getPayment()->getAdditionalInformation('paymentId')))) {
247
+ Mage::getModel('ops/response_handler')->processResponse(
248
+ $this->getOpsResponse(),
249
  $this->getOrder()->getPayment()->getMethodInstance()
250
  );
251
  } else {
289
 
290
  /**
291
  * @param Mage_Sales_Model_Order_Payment $payment
292
+ * @return $this
293
  */
294
  protected function addPayIdSub(Mage_Sales_Model_Order_Payment $payment)
295
  {
296
  $lastTransaction = $payment->getLastTransId();
297
  $lastTransactionParts = explode('/', $lastTransaction);
298
+ if ($lastTransaction && count($lastTransactionParts)>1) {
299
  $this->requestParams['PAYIDSUB'] = $lastTransactionParts[1];
300
  }
301
  return $this;
app/code/community/Netresearch/OPS/Model/Subscription/Manager.php CHANGED
@@ -44,7 +44,7 @@ class Netresearch_OPS_Model_Subscription_Manager
44
  */
45
  public function getDataHelper()
46
  {
47
- if (is_null($this->dataHelper)) {
48
  $this->dataHelper = Mage::helper('ops');
49
  }
50
 
@@ -68,7 +68,7 @@ class Netresearch_OPS_Model_Subscription_Manager
68
  */
69
  public function getPaymentHelper()
70
  {
71
- if (is_null($this->paymentHelper)) {
72
  $this->paymentHelper = Mage::helper('ops/payment');
73
  }
74
 
@@ -93,7 +93,7 @@ class Netresearch_OPS_Model_Subscription_Manager
93
  */
94
  public function getSubscriptionHelper()
95
  {
96
- if (is_null($this->subscriptionHelper)) {
97
  $this->subscriptionHelper = Mage::helper('ops/subscription');
98
  }
99
 
@@ -134,7 +134,7 @@ class Netresearch_OPS_Model_Subscription_Manager
134
  Mage::throwException($this->getDataHelper()->__('No response array provided'));
135
  }
136
 
137
- if (is_null($profile)) {
138
  $profile = $this->getSubscriptionHelper()->getProfileForSubscription($orderId);
139
  }
140
 
@@ -163,9 +163,9 @@ class Netresearch_OPS_Model_Subscription_Manager
163
  }
164
  }
165
 
166
- if ($createOrder && is_null($order)) {
167
  return $this->createOrderFromFeedback($profile, $feedbackType, $responseParams);
168
- } elseif (!is_null($order)) {
169
  return $this->processPaymentFeedback($responseParams, $profile, $order);
170
  }
171
 
@@ -191,7 +191,8 @@ class Netresearch_OPS_Model_Subscription_Manager
191
  if ($feedbackType == Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL) {
192
  $orderItemInfo = new Varien_Object($profile->getOrderItemInfo());
193
  $calculator = Mage::getModel('tax/calculation');
194
- $tax = $calculator->calcTaxAmount($profile->getTrialBillingAmount(),
 
195
  $orderItemInfo->getTaxPercent(), true, true
196
  );
197
  $price = $profile->getTrialBillingAmount() - $tax;
@@ -222,7 +223,8 @@ class Netresearch_OPS_Model_Subscription_Manager
222
  $item = new Varien_Object();
223
  $orderItemInfo = new Varien_Object($profile->getOrderItemInfo());
224
  $calculator = Mage::getModel('tax/calculation');
225
- $taxAmount = $calculator->calcTaxAmount($profile->getInitAmount(), $orderItemInfo->getTaxPercent(), true,
 
226
  true
227
  );
228
  $amountWithoutTax = $profile->getInitAmount() - $taxAmount;
44
  */
45
  public function getDataHelper()
46
  {
47
+ if (null === $this->dataHelper) {
48
  $this->dataHelper = Mage::helper('ops');
49
  }
50
 
68
  */
69
  public function getPaymentHelper()
70
  {
71
+ if (null === $this->paymentHelper) {
72
  $this->paymentHelper = Mage::helper('ops/payment');
73
  }
74
 
93
  */
94
  public function getSubscriptionHelper()
95
  {
96
+ if (null === $this->subscriptionHelper) {
97
  $this->subscriptionHelper = Mage::helper('ops/subscription');
98
  }
99
 
134
  Mage::throwException($this->getDataHelper()->__('No response array provided'));
135
  }
136
 
137
+ if (null === $profile) {
138
  $profile = $this->getSubscriptionHelper()->getProfileForSubscription($orderId);
139
  }
140
 
163
  }
164
  }
165
 
166
+ if ($createOrder && null === $order) {
167
  return $this->createOrderFromFeedback($profile, $feedbackType, $responseParams);
168
+ } elseif (null != $order) {
169
  return $this->processPaymentFeedback($responseParams, $profile, $order);
170
  }
171
 
191
  if ($feedbackType == Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL) {
192
  $orderItemInfo = new Varien_Object($profile->getOrderItemInfo());
193
  $calculator = Mage::getModel('tax/calculation');
194
+ $tax = $calculator->calcTaxAmount(
195
+ $profile->getTrialBillingAmount(),
196
  $orderItemInfo->getTaxPercent(), true, true
197
  );
198
  $price = $profile->getTrialBillingAmount() - $tax;
223
  $item = new Varien_Object();
224
  $orderItemInfo = new Varien_Object($profile->getOrderItemInfo());
225
  $calculator = Mage::getModel('tax/calculation');
226
+ $taxAmount = $calculator->calcTaxAmount(
227
+ $profile->getInitAmount(), $orderItemInfo->getTaxPercent(), true,
228
  true
229
  );
230
  $amountWithoutTax = $profile->getInitAmount() - $taxAmount;
app/code/community/Netresearch/OPS/Model/System/Config/Backend/Encoding.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Netresearch OPS
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade this extension to
16
+ * newer versions in the future.
17
+ *
18
+ * @category Netresearch
19
+ * @package Netresearch_OPS
20
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ /**
25
+ * Netresearch
26
+ *
27
+ * @category Netresearch
28
+ * @package Netresearch_OPS
29
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
30
+ */
31
+ class Netresearch_OPS_Model_System_Config_Backend_Encoding
32
+ {
33
+
34
+ /**
35
+ * Options getter
36
+ *
37
+ * @return array
38
+ */
39
+ public function toOptionArray()
40
+ {
41
+ return array(
42
+ array('value' => 'utf-8', 'label' => Mage::helper('ops')->__('UTF-8')),
43
+ array('value' => 'other', 'label' => Mage::helper('ops')->__('Other')),
44
+ );
45
+ }
46
+ }
app/code/community/Netresearch/OPS/Model/System/Config/Backend/Flex/Methods.php CHANGED
@@ -42,7 +42,7 @@ class Netresearch_OPS_Model_System_Config_Backend_Flex_Methods
42
  public function save()
43
  {
44
  $methods = $this->getValue();
45
- if (is_array($methods) && sizeof($methods) > 1) {
46
  $alreadyProcessedMethods = array();
47
  foreach ($methods as $method) {
48
 
@@ -50,7 +50,7 @@ class Netresearch_OPS_Model_System_Config_Backend_Flex_Methods
50
  && array_key_exists('pm', $method)
51
  && array_key_exists('brand', $method)
52
  ) {
53
- if(empty($method['title'])||empty($method['pm'])){
54
  Mage::throwException("Can not save empty title or PM fields");
55
  }
56
 
42
  public function save()
43
  {
44
  $methods = $this->getValue();
45
+ if (is_array($methods) && count($methods) > 1) {
46
  $alreadyProcessedMethods = array();
47
  foreach ($methods as $method) {
48
 
50
  && array_key_exists('pm', $method)
51
  && array_key_exists('brand', $method)
52
  ) {
53
+ if (empty($method['title'])||empty($method['pm'])) {
54
  Mage::throwException("Can not save empty title or PM fields");
55
  }
56
 
app/code/community/Netresearch/OPS/Model/System/Config/Backend/Intersolve/Brands.php CHANGED
@@ -44,7 +44,7 @@ class Netresearch_Ops_Model_System_Config_Backend_Intersolve_Brands
44
  public function save()
45
  {
46
  $brands = $this->getValue();
47
- if (is_array($brands) && sizeof($brands) > 1) {
48
  $alreadyProcessedBrands = array();
49
  foreach ($brands as $brand) {
50
  if (is_array($brand) && array_key_exists('brand', $brand)) {
44
  public function save()
45
  {
46
  $brands = $this->getValue();
47
+ if (is_array($brands) && count($brands) > 1) {
48
  $alreadyProcessedBrands = array();
49
  foreach ($brands as $brand) {
50
  if (is_array($brand) && array_key_exists('brand', $brand)) {
app/code/community/Netresearch/OPS/Model/System/Config/Backend/PaymentLogo.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Netresearch OPS
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade this extension to
16
+ * newer versions in the future.
17
+ *
18
+ * @category Netresearch
19
+ * @package Netresearch_OPS
20
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ /**
25
+ * Netresearch
26
+ *
27
+ * @category Netresearch
28
+ * @package Netresearch_OPS
29
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
30
+ */
31
+ class Netresearch_Ops_Model_System_Config_Backend_PaymentLogo
32
+ {
33
+
34
+ /**
35
+ * Options getter
36
+ *
37
+ * @return array
38
+ */
39
+ public function toOptionArray()
40
+ {
41
+ return array(
42
+ array('value' => 'left', 'label' => Mage::helper('ops')->__('Left')),
43
+ array('value' => 'right', 'label' => Mage::helper('ops')->__('Right')),
44
+ array('value' => 'hidden', 'label' => Mage::helper('ops')->__('Non Visible')),
45
+ );
46
+ }
47
+ }
app/code/community/Netresearch/OPS/Model/System/Config/Mode.php CHANGED
@@ -1,39 +1,40 @@
1
- <?php
2
- /**
3
- * Mode.php
4
- * @author paul.siedler@netresearch.de
5
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
- */
8
-
9
- class Netresearch_OPS_Model_System_Config_Mode extends Mage_Core_Model_Config_Data
10
- {
11
-
12
- public function _afterSave()
13
- {
14
-
15
- if($this->getValue() != Netresearch_OPS_Model_Source_Mode::CUSTOM && $this->isValueChanged()){
16
- $xmlConfig = Mage::getConfig()->loadModulesConfiguration('config.xml');
17
- foreach($this->getUrlPaths() as $path){
18
- $default = $xmlConfig->getNode('default/'.$path);
19
- $newValue = preg_replace('/\/ncol\/\w+/', '/ncol/'.$this->getValue(), $default);
20
- Mage::getConfig()->saveConfig($path, $newValue, $this->getScope(), $this->getScopeId());
21
-
22
- }
23
- }
24
-
25
- return parent::_afterSave();
26
- }
27
-
28
- protected function getUrlPaths(){
29
- return array(
30
- Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'ops_gateway',
31
- Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'ops_alias_gateway',
32
- Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'frontend_gateway',
33
- Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'directlink_gateway',
34
- Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'directlink_gateway_order',
35
- Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'directlink_maintenance_api'
36
- );
37
- }
38
-
39
- }
 
1
+ <?php
2
+ /**
3
+ * Mode.php
4
+ * @author paul.siedler@netresearch.de
5
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
+ */
8
+
9
+ class Netresearch_OPS_Model_System_Config_Mode extends Mage_Core_Model_Config_Data
10
+ {
11
+
12
+ public function _afterSave()
13
+ {
14
+
15
+ if ($this->getValue() != Netresearch_OPS_Model_Source_Mode::CUSTOM && $this->isValueChanged()) {
16
+ $xmlConfig = Mage::getConfig()->loadModulesConfiguration('config.xml');
17
+ foreach ($this->getUrlPaths() as $path) {
18
+ $default = $xmlConfig->getNode('default/'.$path);
19
+ $newValue = preg_replace('/\/ncol\/\w+/', '/ncol/'.$this->getValue(), $default);
20
+ Mage::getConfig()->saveConfig($path, $newValue, $this->getScope(), $this->getScopeId());
21
+
22
+ }
23
+ }
24
+
25
+ return parent::_afterSave();
26
+ }
27
+
28
+ protected function getUrlPaths()
29
+ {
30
+ return array(
31
+ Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'ops_gateway',
32
+ Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'ops_alias_gateway',
33
+ Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'frontend_gateway',
34
+ Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'directlink_gateway',
35
+ Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'directlink_gateway_order',
36
+ Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH.'directlink_maintenance_api'
37
+ );
38
+ }
39
+
40
+ }
app/code/community/Netresearch/OPS/Model/System/Config/Template.php CHANGED
@@ -1,63 +1,63 @@
1
- <?php
2
-
3
- /**
4
- * Template.php
5
- * @author paul.siedler@netresearch.de
6
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
8
- */
9
- class Netresearch_OPS_Model_System_Config_Template extends Mage_Core_Model_Config_Data
10
- {
11
- protected function getConfig()
12
- {
13
- return Mage::getModel('ops/config');
14
-
15
- }
16
-
17
- public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
18
- {
19
- $paypageUrl = $this->getConfig()->getPayPageTemplate();
20
- $paypageInfo = Mage::helper('ops')->__(
21
- 'With this setting the customer will be redirected to the PayEngine paypage with the look and feel of your shop. ' .
22
- '</br> The template used can be seen here: </br>'
23
- );
24
- $paypageInfo .= "<a href=\"" . $paypageUrl . "\">" . $paypageUrl . "</a>";
25
-
26
- $result = "<p class=\"note\"><span id=\"ops_template_comment\"></span></p>";
27
- $result .= "
28
- <script type=\"text/javascript\">
29
- Translator.add(
30
- '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL . "',
31
- '" . $paypageInfo . "'
32
- );
33
- Translator.add(
34
- '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE . "',
35
- '" . Mage::helper('ops')->__('With this setting the customer will be redirected to the PayEngine paypage. The look and feel of that page will be defined by a dynamically loaded template file whose origin you can define below.') . "'
36
- );
37
- Translator.add(
38
- '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME . "',
39
- '" . Mage::helper('ops')->__('With this setting the customer will enter the payment details on a page in your shop that hosts the PayEngine paypage in an iFrame. You can style the paypage through the parameters below.') . "'
40
- );
41
- Translator.add(
42
- '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_REDIRECT . "',
43
- '" . Mage::helper('ops')->__('With this setting the customer will get redirected to PayEngine to enter his payment details. You can style the page through the parameters below.') . "'
44
- );
45
- selectElement = $('payment_services_ops_template');
46
-
47
- function updateComment(value){
48
- var comment = $('ops_template_comment');
49
- comment.innerHTML = Translator.translate(value);
50
- }
51
-
52
- Event.observe(window, 'load', function(){
53
- updateComment('" . $currentValue . "');
54
- Event.observe(selectElement, 'change', function(){
55
- updateComment(selectElement.value);
56
- });
57
- });
58
- </script>";
59
-
60
- return $result;
61
- }
62
-
63
- }
1
+ <?php
2
+
3
+ /**
4
+ * Template.php
5
+ * @author paul.siedler@netresearch.de
6
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
8
+ */
9
+ class Netresearch_OPS_Model_System_Config_Template extends Mage_Core_Model_Config_Data
10
+ {
11
+ protected function getConfig()
12
+ {
13
+ return Mage::getModel('ops/config');
14
+
15
+ }
16
+
17
+ public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
18
+ {
19
+ $paypageUrl = $this->getConfig()->getPayPageTemplate();
20
+ $paypageInfo = Mage::helper('ops')->__(
21
+ 'With this setting the customer will be redirected to the PayEngine paypage with the look and feel of your shop. ' .
22
+ '</br> The template used can be seen here: </br>'
23
+ );
24
+ $paypageInfo .= "<a href=\"" . $paypageUrl . "\">" . $paypageUrl . "</a>";
25
+
26
+ $result = "<p class=\"note\"><span id=\"ops_template_comment\"></span></p>";
27
+ $result .= "
28
+ <script type=\"text/javascript\">
29
+ Translator.add(
30
+ '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL . "',
31
+ '" . $paypageInfo . "'
32
+ );
33
+ Translator.add(
34
+ '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE . "',
35
+ '" . Mage::helper('ops')->__('With this setting the customer will be redirected to the PayEngine paypage. The look and feel of that page will be defined by a dynamically loaded template file whose origin you can define below.') . "'
36
+ );
37
+ Translator.add(
38
+ '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME . "',
39
+ '" . Mage::helper('ops')->__('With this setting the customer will enter the payment details on a page in your shop that hosts the PayEngine paypage in an iFrame. You can style the paypage through the parameters below.') . "'
40
+ );
41
+ Translator.add(
42
+ '" . Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_REDIRECT . "',
43
+ '" . Mage::helper('ops')->__('With this setting the customer will get redirected to PayEngine to enter his payment details. You can style the page through the parameters below.') . "'
44
+ );
45
+ selectElement = $('payment_services_ops_template');
46
+
47
+ function updateComment(value){
48
+ var comment = $('ops_template_comment');
49
+ comment.innerHTML = Translator.translate(value);
50
+ }
51
+
52
+ Event.observe(window, 'load', function(){
53
+ updateComment('" . $currentValue . "');
54
+ Event.observe(selectElement, 'change', function(){
55
+ updateComment(selectElement.value);
56
+ });
57
+ });
58
+ </script>";
59
+
60
+ return $result;
61
+ }
62
+
63
+ }
app/code/community/Netresearch/OPS/Model/Validator/CompositeInterface.php CHANGED
@@ -6,7 +6,7 @@
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  interface Netresearch_OPS_Model_Validator_CompositeInterface
9
- {
10
  public function addValidator(Zend_Validate_Interface $validator);
11
 
12
  }
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  interface Netresearch_OPS_Model_Validator_CompositeInterface
9
+ {
10
  public function addValidator(Zend_Validate_Interface $validator);
11
 
12
  }
app/code/community/Netresearch/OPS/Model/Validator/Kwixo/Shipping/Setting.php CHANGED
@@ -11,7 +11,7 @@
11
  class Netresearch_OPS_Model_Validator_Kwixo_Shipping_Setting
12
  {
13
 
14
- private $messages = array();
15
 
16
  public function isValid(array $data)
17
  {
@@ -32,7 +32,7 @@ class Netresearch_OPS_Model_Validator_Kwixo_Shipping_Setting
32
  return $this->messages;
33
  }
34
 
35
- private function validateRow($code, $row)
36
  {
37
  $shippingTypeResult = $this->validateShippingType($code, $row);
38
  $shippingSpeedResult = $this->validateShippingSpeed($code, $row);
@@ -61,7 +61,7 @@ class Netresearch_OPS_Model_Validator_Kwixo_Shipping_Setting
61
  return false;
62
  }
63
 
64
- private function validateShippingSpeed($code, $row)
65
  {
66
  if (array_key_exists('kwixo_shipping_speed', $row)
67
  && Zend_Validate::is(
@@ -77,7 +77,7 @@ class Netresearch_OPS_Model_Validator_Kwixo_Shipping_Setting
77
  return false;
78
  }
79
 
80
- private function validateShippingDetails($code, $row)
81
  {
82
  if (array_key_exists('kwixo_shipping_details', $row)
83
  && Zend_Validate::is(
11
  class Netresearch_OPS_Model_Validator_Kwixo_Shipping_Setting
12
  {
13
 
14
+ protected $messages = array();
15
 
16
  public function isValid(array $data)
17
  {
32
  return $this->messages;
33
  }
34
 
35
+ protected function validateRow($code, $row)
36
  {
37
  $shippingTypeResult = $this->validateShippingType($code, $row);
38
  $shippingSpeedResult = $this->validateShippingSpeed($code, $row);
61
  return false;
62
  }
63
 
64
+ protected function validateShippingSpeed($code, $row)
65
  {
66
  if (array_key_exists('kwixo_shipping_speed', $row)
67
  && Zend_Validate::is(
77
  return false;
78
  }
79
 
80
+ protected function validateShippingDetails($code, $row)
81
  {
82
  if (array_key_exists('kwixo_shipping_details', $row)
83
  && Zend_Validate::is(
app/code/community/Netresearch/OPS/Model/Validator/Parameter/Factory.php CHANGED
@@ -1,19 +1,24 @@
1
  <?php
 
2
  /**
3
- * @author Michael Lühr <michael.luehr@netresearch.de>
4
  * @category Netresearch
5
  * @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
-
9
-
10
  class Netresearch_OPS_Model_Validator_Parameter_Factory extends Mage_Core_Model_Abstract
11
  {
12
 
13
  const TYPE_REQUEST_PARAMS_VALIDATION = 'request_validation';
14
 
 
 
 
15
  protected $validator = null;
16
 
 
 
 
17
  protected $config = null;
18
 
19
  /**
1
  <?php
2
+
3
  /**
4
+ * @author Michael Lühr <michael.luehr@netresearch.de>
5
  * @category Netresearch
6
  * @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
  */
 
 
9
  class Netresearch_OPS_Model_Validator_Parameter_Factory extends Mage_Core_Model_Abstract
10
  {
11
 
12
  const TYPE_REQUEST_PARAMS_VALIDATION = 'request_validation';
13
 
14
+ /**
15
+ * @var Netresearch_OPS_Model_Validator_Parameter_Validator
16
+ */
17
  protected $validator = null;
18
 
19
+ /**
20
+ * @var Netresearch_OPS_Model_Config
21
+ */
22
  protected $config = null;
23
 
24
  /**
app/code/community/Netresearch/OPS/Model/Validator/Parameter/Length.php CHANGED
@@ -45,12 +45,18 @@ class Netresearch_OPS_Model_Validator_Parameter_Length implements Zend_Validate_
45
  if (is_array($dataToValidate) && 0 < count($dataToValidate)) {
46
  foreach ($dataToValidate as $key => $value) {
47
  $maxLength = $this->getFieldLengthFor($key);
48
- if(is_null($value)){
49
  $value = '';
50
  }
51
  if (0 < $maxLength) {
52
- if (false == Zend_Validate::is(utf8_encode($value), 'StringLength', array('max' => $maxLength, 'encoding' => 'utf-8'))) {
53
- $this->messages[$key] = Mage::helper('ops/data')->__('value exceeds %d characters', $maxLength);
 
 
 
 
 
 
54
  $validationResult = false;
55
  }
56
  }
45
  if (is_array($dataToValidate) && 0 < count($dataToValidate)) {
46
  foreach ($dataToValidate as $key => $value) {
47
  $maxLength = $this->getFieldLengthFor($key);
48
+ if ($value === null) {
49
  $value = '';
50
  }
51
  if (0 < $maxLength) {
52
+ if (
53
+ false == Zend_Validate::is(
54
+ utf8_encode($value),
55
+ 'StringLength',
56
+ array('max' => $maxLength, 'encoding' => 'utf-8')
57
+ )
58
+ ) {
59
+ $this->messages[$key] = Mage::helper('ops/data')->__('Value exceeds %d characters', $maxLength);
60
  $validationResult = false;
61
  }
62
  }
app/code/community/Netresearch/OPS/Model/Validator/Payment/DirectDebit.php DELETED
@@ -1,250 +0,0 @@
1
- <?php
2
- /**
3
- * @author Michael Lühr <michael.luehr@netresearch.de>
4
- * @category Netresearch
5
- * @package Netresearch_OPS
6
- * @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
-
11
- class Netresearch_OPS_Model_Validator_Payment_DirectDebit
12
- {
13
-
14
- protected $messages = array();
15
-
16
- protected $dataHelper = null;
17
-
18
- protected $directDebitHelper = null;
19
-
20
- /**
21
- * sets the data helper
22
- *
23
- * @param Mage_Core_Helper_Abstract $dataHelper
24
- */
25
- public function setDataHelper(Mage_Core_Helper_Abstract $dataHelper)
26
- {
27
- $this->dataHelper = $dataHelper;
28
- }
29
-
30
- /**
31
- * gwets the data helper
32
- *
33
- * @return Mage_Core_Helper_Abstract|null
34
- */
35
- public function getDataHelper()
36
- {
37
- if (null == $this->dataHelper) {
38
- $this->dataHelper = Mage::helper('ops/data');
39
- }
40
-
41
- return $this->dataHelper;
42
- }
43
-
44
- /**
45
- * sets the direct debit helper
46
- *
47
- * @param Netresearch_OPS_Helper_DirectDebit $directDebitHelper
48
- */
49
- public function setDirectDebitHelper(Netresearch_OPS_Helper_DirectDebit $directDebitHelper)
50
- {
51
- $this->directDebitHelper = $directDebitHelper;
52
- }
53
-
54
- /**
55
- * gets the direct debit helper
56
- *
57
- * @return Netresearch_OPS_Helper_DirectDebit
58
- */
59
- public function getDirectDebitHelper()
60
- {
61
- if (null === $this->directDebitHelper) {
62
- $this->directDebitHelper = Mage::helper('ops/directDebit');
63
- }
64
- return $this->directDebitHelper;
65
- }
66
-
67
- /**
68
- * validates the direct debit payment data
69
- *
70
- * @param array $directDebitData
71
- *
72
- * @return bool - true if the direct data are valid, false otherwise
73
- */
74
- public function isValid(array $directDebitData)
75
- {
76
- if (false === $this->checkPreconditions($directDebitData)) {
77
- return false;
78
- }
79
-
80
- return $this->validateAccountData($directDebitData);
81
- }
82
-
83
- /**
84
- * gets the validation messages
85
- *
86
- * @return array
87
- */
88
- public function getMessages()
89
- {
90
- return $this->messages;
91
- }
92
-
93
- /**
94
- * checks if the neccesaary data are present
95
- *
96
- * @param array $accountData
97
- *
98
- * @return bool - true if the neccessary data are present, false otherwise
99
- */
100
- protected function checkPreconditions(array $accountData)
101
- {
102
- if (0 == count($accountData)
103
- || !array_key_exists(
104
- 'CN', $accountData
105
- )
106
- || !array_key_exists('country', $accountData)
107
- || !array_key_exists('account', $accountData)
108
- || !array_key_exists('iban', $accountData)
109
- ) {
110
- $this->messages[] = $this->getDataHelper()->__(
111
- 'invalid data provided'
112
- );
113
-
114
- return false;
115
- }
116
-
117
- return true;
118
- }
119
-
120
- /**
121
- * checks if the account data are valid
122
- *
123
- * @param array $accountData
124
- *
125
- * @return bool - true if the data are valid, false otherise
126
- */
127
- protected function validateAccountData(array $accountData)
128
- {
129
- $result = true;
130
- if ($this->hasAccountHolder($accountData)) {
131
- $this->messages[] = $this->getDataHelper()->__(
132
- 'Account holder must be provided'
133
- );
134
- $result = false;
135
- }
136
-
137
- // check iban data
138
- if ($this->hasIban($accountData)) {
139
- $result = $this->validateIban(
140
- $accountData['country'], $accountData['iban'],
141
- (array_key_exists('bic', $accountData))? $accountData['bic'] : ''
142
- );
143
- }
144
- // check bank account data
145
- else {
146
- $result = $this->validateBankAccount(
147
- $accountData['country'], $accountData['account'],
148
- (array_key_exists('bankcode', $accountData))
149
- ? $accountData['bankcode'] : ''
150
- );
151
- }
152
-
153
- return $result;
154
- }
155
-
156
-
157
- /**
158
- * validates iban and (optional) bic data
159
- *
160
- * @param $country - the country for the iban
161
- * @param $iban - the iban to validate
162
- * @param $bic - the bic if given
163
- *
164
- * @return bool - true if the iban data are valid, false otherwise
165
- */
166
- protected function validateIban($country, $iban, $bic)
167
- {
168
- $country = strtoupper(trim($country));
169
- $result = true;
170
- if ('DE' != $country && 'NL' != $country) {
171
- $result = false;
172
- $this->messages[] = $this->getDataHelper()->__(
173
- 'Country not supported for IBAN'
174
- );
175
- }
176
- $validator = new Zend_Validate_Iban();
177
-
178
- if (!$validator->isValid($iban)) {
179
- $result = false;
180
-
181
- $this->messages[] = $this->getDataHelper()->__('Invalid IBAN provided');
182
- }
183
- if ('NL' == $country
184
- && (11 < strlen(trim($bic)))
185
- ) {
186
- $result = false;
187
- $this->messages[] = $this->getDataHelper()->__(
188
- 'invalid BIC provided'
189
- );
190
-
191
- }
192
-
193
- return $result;
194
- }
195
-
196
- /**
197
- * validates bank account data
198
- *
199
- * @param $country - the country for the bank account data
200
- * @param $accountNo - the account number
201
- * @param $bankCode - the bank code
202
- *
203
- * @return bool - true if the data are valid, false otherwise
204
- */
205
- protected function validateBankAccount($country, $accountNo, $bankCode)
206
- {
207
- $result = true;
208
- if (!is_numeric($accountNo)) {
209
- $this->messages[] = $this->getDataHelper()->__(
210
- 'Account number must contain numbers only.'
211
- );
212
- $result = false;
213
- }
214
- $country = strtolower($country);
215
- if (('de' == $country || 'at' == $country) && !is_numeric($bankCode)) {
216
- $this->messages[] = $this->getDataHelper()->__(
217
- 'Bank code must contain numbers only.'
218
- );
219
- $result = false;
220
- }
221
-
222
- return $result;
223
- }
224
-
225
- /**
226
- * checks if account holder is provided in the given account data
227
- *
228
- * @param array $accountData
229
- *
230
- * @return bool - true if account holder is present, false otherwise
231
- */
232
- protected function hasAccountHolder(array $accountData)
233
- {
234
- return array_key_exists('CN', $accountData)
235
- && 0 === strlen(trim($accountData['CN']));
236
- }
237
-
238
- /**
239
- * checks if the account data has the ibna field
240
- *
241
- * @param array $accountData
242
- *
243
- * @return bool - true if the account data contain the iban
244
- */
245
- protected function hasIban(array $accountData)
246
- {
247
- return $this->getDirectDebitHelper()->hasIban($accountData);
248
- }
249
-
250
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Netresearch/OPS/Test/Block/Adminhtml/Customer/Renderer/StateTest.php CHANGED
@@ -17,7 +17,7 @@ class Netresearch_OPS_Test_Block_Adminhtml_Customer_Renderer_StateTest
17
  $this->assertEquals(
18
  Mage::helper('ops/data')->__(
19
  Netresearch_OPS_Model_Alias_State::ACTIVE
20
- ) , $block->render($row)
21
  );
22
  }
23
  }
17
  $this->assertEquals(
18
  Mage::helper('ops/data')->__(
19
  Netresearch_OPS_Model_Alias_State::ACTIVE
20
+ ), $block->render($row)
21
  );
22
  }
23
  }
app/code/community/Netresearch/OPS/Test/Block/Alias/ListTest.php CHANGED
@@ -29,7 +29,7 @@ class Netresearch_OPS_Test_Block_Alias_ListTest
29
 
30
  public function testGetMethodName()
31
  {
32
- $this->assertNull($this->block->getMethodName('something_stupid'));
33
 
34
  Mage::app()->getStore()->setConfig('payment/ops_cc/title', 'OPS Credit Card');
35
  $this->assertEquals(
29
 
30
  public function testGetMethodName()
31
  {
32
+ $this->assertEquals('', $this->block->getMethodName('something_stupid'));
33
 
34
  Mage::app()->getStore()->setConfig('payment/ops_cc/title', 'OPS Credit Card');
35
  $this->assertEquals(
app/code/community/Netresearch/OPS/Test/Block/Checkout/DeviceFingerprintingTest.php CHANGED
@@ -55,7 +55,7 @@ class Netresearch_OPS_Test_Block_Checkout_DeviceFingerprintingTest
55
  $this->assertNotEmpty($html);
56
 
57
  $url = $block->getConsentUrl();
58
- $this->assertStringEndsWith('ops/device/', $url);
59
  }
60
 
61
  /**
@@ -70,6 +70,6 @@ class Netresearch_OPS_Test_Block_Checkout_DeviceFingerprintingTest
70
  $this->assertEmpty($html);
71
 
72
  $url = $block->getConsentUrl();
73
- $this->assertStringEndsWith('ops/device/', $url);
74
  }
75
  }
55
  $this->assertNotEmpty($html);
56
 
57
  $url = $block->getConsentUrl();
58
+ $this->assertContains('ops/device/', $url);
59
  }
60
 
61
  /**
70
  $this->assertEmpty($html);
71
 
72
  $url = $block->getConsentUrl();
73
+ $this->assertContains('ops/device/', $url);
74
  }
75
  }
app/code/community/Netresearch/OPS/Test/Block/Form/CcTest.php CHANGED
@@ -356,7 +356,7 @@ class Netresearch_OPS_Test_Block_Form_CcTest extends EcomDev_PHPUnit_Test_Case
356
  }
357
 
358
 
359
- public function testGetStoredAliasBrandWithNonInlineBrand()
360
  {
361
  /** @var Netresearch_OPS_Block_Form_Cc $blockMock */
362
 
@@ -368,11 +368,11 @@ class Netresearch_OPS_Test_Block_Form_CcTest extends EcomDev_PHPUnit_Test_Case
368
  ->will(
369
  $this->returnValue(
370
  array(new Varien_Object(
371
- array(
372
  'pseudo_account_or_cc_no' => 'xxxxxxxxxxxx1111',
373
  'brand' => 'VISA'
374
  )
375
- ))
376
  )
377
  );
378
  $blockMock->expects($this->any())
@@ -394,7 +394,7 @@ class Netresearch_OPS_Test_Block_Form_CcTest extends EcomDev_PHPUnit_Test_Case
394
 
395
  $this->replaceByMock('model', 'ops/config', $modelMock);
396
 
397
- $this->assertEquals('', $blockMock->getStoredAliasBrand(0));
398
  }
399
 
400
  public function testIsAliasInfoBlockEnabled()
356
  }
357
 
358
 
359
+ public function testGetStoredAliasBrand()
360
  {
361
  /** @var Netresearch_OPS_Block_Form_Cc $blockMock */
362
 
368
  ->will(
369
  $this->returnValue(
370
  array(new Varien_Object(
371
+ array(
372
  'pseudo_account_or_cc_no' => 'xxxxxxxxxxxx1111',
373
  'brand' => 'VISA'
374
  )
375
+ ))
376
  )
377
  );
378
  $blockMock->expects($this->any())
394
 
395
  $this->replaceByMock('model', 'ops/config', $modelMock);
396
 
397
+ $this->assertEquals('VISA', $blockMock->getStoredAliasBrand(0));
398
  }
399
 
400
  public function testIsAliasInfoBlockEnabled()
app/code/community/Netresearch/OPS/Test/Block/Form/DirectDebitTest.php CHANGED
@@ -48,285 +48,4 @@ class Netresearch_OPS_Test_Block_Form_DirectDebitTest
48
  explode(',', 'AT, DE, NL'), $blockMock->getDirectDebitCountryIds()
49
  );
50
  }
51
-
52
- public function testGetParams()
53
- {
54
- $sessionMock = $this->getModelMock(
55
- 'adminhtml/session', array('init', 'save')
56
- );
57
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
58
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
59
- $expectedResult = array(
60
- 'country' => '',
61
- 'CN' => '',
62
- 'iban' => '',
63
- 'bic' => '',
64
- 'account' => '',
65
- 'bankcode' => ''
66
- );
67
- $this->assertEquals($expectedResult, $block->getParams());
68
- $newParams = array('bla' => 'foo');
69
- $sessionMock->setData(
70
- 'ops_direct_debit_params', $newParams
71
- );
72
- $result = $block->getParams();
73
- $this->assertFalse($sessionMock->hasData('ops_direct_debit_params'));
74
- $this->assertEquals($newParams, $result);
75
-
76
- }
77
-
78
- public function testIsIbanFieldRequired()
79
- {
80
- $sessionMock = $this->getModelMock(
81
- 'adminhtml/session', array('init', 'save')
82
- );
83
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
84
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
85
- $this->assertTrue($block->isIbanFieldRequired());
86
- $newParams = array('iban' => 'foo');
87
- $sessionMock->setData(
88
- 'ops_direct_debit_params', $newParams
89
- );
90
- $block->getParams();
91
- $this->assertTrue($block->isIbanFieldRequired());
92
- $newParams = array('account' => '');
93
- $sessionMock->setData(
94
- 'ops_direct_debit_params', $newParams
95
- );
96
- $block->getParams();
97
- $this->assertTrue($block->isIbanFieldRequired());
98
-
99
- $newParams = array('account' => '123456');
100
- $sessionMock->setData(
101
- 'ops_direct_debit_params', $newParams
102
- );
103
- $block->getParams();
104
- $this->assertFalse($block->isIbanFieldRequired());
105
- }
106
-
107
- public function testIsAccountFieldRequired()
108
- {
109
- $sessionMock = $this->getModelMock(
110
- 'adminhtml/session', array('init', 'save')
111
- );
112
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
113
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
114
- $this->assertTrue($block->isAccountFieldRequired());
115
- $newParams = array('account' => 'foo');
116
- $sessionMock->setData(
117
- 'ops_direct_debit_params', $newParams
118
- );
119
- $block->getParams();
120
- $this->assertTrue($block->isAccountFieldRequired());
121
- $newParams = array('account' => '');
122
- $sessionMock->setData(
123
- 'ops_direct_debit_params', $newParams
124
- );
125
- $block->getParams();
126
- $this->assertTrue($block->isAccountFieldRequired());
127
-
128
- $newParams = array('account' => '123456', 'iban' => '');
129
- $sessionMock->setData(
130
- 'ops_direct_debit_params', $newParams
131
- );
132
- $block->getParams();
133
- $this->assertTrue($block->isAccountFieldRequired());
134
-
135
- $newParams = array('account' => '123456', 'iban' => '123456');
136
- $sessionMock->setData(
137
- 'ops_direct_debit_params', $newParams
138
- );
139
- $block->getParams();
140
- $this->assertFalse($block->isAccountFieldRequired());
141
- }
142
-
143
-
144
- public function testIsBankCodeFieldRequired()
145
- {
146
- $sessionMock = $this->getModelMock(
147
- 'adminhtml/session', array('init', 'save')
148
- );
149
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
150
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
151
- $this->assertFalse($block->isBankCodeFieldRequired());
152
-
153
- $newParams = array('account' => '12345');
154
- $sessionMock->setData(
155
- 'ops_direct_debit_params', $newParams
156
- );
157
- $block->getParams();
158
- $this->assertFalse($block->isBankCodeFieldRequired());
159
-
160
- $newParams = array('account' => '123456', 'country' => 'de');
161
- $sessionMock->setData(
162
- 'ops_direct_debit_params', $newParams
163
- );
164
- $block->getParams();
165
- $this->assertTrue($block->isBankCodeFieldRequired());
166
- }
167
-
168
- public function testIsBankCodeFieldVisible()
169
- {
170
- $sessionMock = $this->getModelMock(
171
- 'adminhtml/session', array('init', 'save')
172
- );
173
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
174
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
175
- $this->assertFalse($block->isBankCodeFieldVisible());
176
- $newParams = array('country' => 'at');
177
- $sessionMock->setData(
178
- 'ops_direct_debit_params', $newParams
179
- );
180
- $block->getParams();
181
- $this->assertTrue($block->isBankCodeFieldVisible());
182
-
183
- $newParams = array('country' => 'de');
184
- $sessionMock->setData(
185
- 'ops_direct_debit_params', $newParams
186
- );
187
- $block->getParams();
188
- $this->assertTrue($block->isBankCodeFieldVisible());
189
-
190
- $newParams = array('country' => 'nl');
191
- $sessionMock->setData(
192
- 'ops_direct_debit_params', $newParams
193
- );
194
- $block->getParams();
195
- $this->assertFalse($block->isBankCodeFieldVisible());
196
- }
197
-
198
- public function testIsBicFieldVisible()
199
- {
200
- $sessionMock = $this->getModelMock(
201
- 'adminhtml/session', array('init', 'save')
202
- );
203
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
204
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
205
- $this->assertFalse($block->isBicFieldVisible());
206
-
207
- $newParams = array('country' => 'de');
208
- $sessionMock->setData(
209
- 'ops_direct_debit_params', $newParams
210
- );
211
- $block->getParams();
212
- $this->assertFalse($block->isBicFieldVisible());
213
-
214
- $newParams = array('country' => 'at');
215
- $sessionMock->setData(
216
- 'ops_direct_debit_params', $newParams
217
- );
218
- $block->getParams();
219
- $this->assertFalse($block->isBicFieldVisible());
220
-
221
- $newParams = array('country' => 'nl');
222
- $sessionMock->setData(
223
- 'ops_direct_debit_params', $newParams
224
- );
225
- $block->getParams();
226
- $this->assertTrue($block->isBicFieldVisible());
227
- }
228
-
229
- public function testGetCountry()
230
- {
231
- $sessionMock = $this->getModelMock(
232
- 'adminhtml/session', array('init', 'save')
233
- );
234
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
235
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
236
- $this->assertEquals('', $block->getCountry());
237
- $newParams = array('country' => 'de');
238
- $sessionMock->setData(
239
- 'ops_direct_debit_params', $newParams
240
- );
241
- $block->getParams();
242
- $this->assertEquals('de', $block->getCountry());
243
-
244
- }
245
-
246
- public function testGetIban()
247
- {
248
- $sessionMock = $this->getModelMock(
249
- 'adminhtml/session', array('init', 'save')
250
- );
251
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
252
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
253
- $this->assertEquals('', $block->getIban());
254
- $newParams = array('iban' => '1234567');
255
- $sessionMock->setData(
256
- 'ops_direct_debit_params', $newParams
257
- );
258
- $block->getParams();
259
- $this->assertEquals('1234567', $block->getIban());
260
-
261
- }
262
-
263
- public function testGetBic()
264
- {
265
- $sessionMock = $this->getModelMock(
266
- 'adminhtml/session', array('init', 'save')
267
- );
268
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
269
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
270
- $this->assertEquals('', $block->getBic());
271
- $newParams = array('bic' => '1234567');
272
- $sessionMock->setData(
273
- 'ops_direct_debit_params', $newParams
274
- );
275
- $block->getParams();
276
- $this->assertEquals('1234567', $block->getBic());
277
-
278
- }
279
-
280
- public function testGetAccount()
281
- {
282
- $sessionMock = $this->getModelMock(
283
- 'adminhtml/session', array('init', 'save')
284
- );
285
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
286
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
287
- $this->assertEquals('', $block->getAccount());
288
- $newParams = array('account' => '1234567');
289
- $sessionMock->setData(
290
- 'ops_direct_debit_params', $newParams
291
- );
292
- $block->getParams();
293
- $this->assertEquals('1234567', $block->getAccount());
294
-
295
- }
296
-
297
- public function testGetBankcode()
298
- {
299
- $sessionMock = $this->getModelMock(
300
- 'adminhtml/session', array('init', 'save')
301
- );
302
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
303
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
304
- $this->assertEquals('', $block->getBankcode());
305
- $newParams = array('bankcode' => '1234567');
306
- $sessionMock->setData(
307
- 'ops_direct_debit_params', $newParams
308
- );
309
- $block->getParams();
310
- $this->assertEquals('1234567', $block->getBankcode());
311
-
312
- }
313
-
314
- public function testGetCardholderName()
315
- {
316
- $sessionMock = $this->getModelMock(
317
- 'adminhtml/session', array('init', 'save')
318
- );
319
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
320
- $block = new Netresearch_OPS_Block_Form_DirectDebit();
321
- $this->assertEquals('', $block->getCardholderName());
322
- $newParams = array('CN' => 'Hans wurst');
323
- $sessionMock->setData(
324
- 'ops_direct_debit_params', $newParams
325
- );
326
- $block->getParams();
327
- $this->assertEquals('Hans wurst', $block->getCardholderName());
328
-
329
- }
330
-
331
-
332
  }
48
  explode(',', 'AT, DE, NL'), $blockMock->getDirectDebitCountryIds()
49
  );
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
app/code/community/Netresearch/OPS/Test/Block/Form/Ideal.php CHANGED
@@ -6,7 +6,7 @@ class Netresearch_OPS_Test_Block_Form_Ideal extends EcomDev_PHPUnit_Test_Case
6
  {
7
  $issuers = Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
8
  $block = Mage::app()->getLayout()->createBlock('ops/form_Ideal');
9
- $this->assertEquals($issuers,$block->getIssuers());
10
 
11
  }
12
  }
6
  {
7
  $issuers = Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
8
  $block = Mage::app()->getLayout()->createBlock('ops/form_Ideal');
9
+ $this->assertEquals($issuers, $block->getIssuers());
10
 
11
  }
12
  }
app/code/community/Netresearch/OPS/Test/Block/FormTest.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  class Netresearch_OPS_Test_Block_FormTest
4
- extends EcomDev_PHPUnit_Test_Case_Controller
5
  {
6
  private $_block;
7
 
@@ -35,99 +35,72 @@ class Netresearch_OPS_Test_Block_FormTest
35
  $this->assertFalse($block->isUserNotRegistering());
36
  }
37
 
38
-
39
  public function testGetPmLogo()
40
  {
41
  $this->assertEquals(null, $this->_block->getPmLogo());
42
  }
43
 
44
- public function testGetFrontendValidatorsAreEmtpyWhenNoExtraParamtersAreSubmitted()
45
  {
46
- $quoteMock = Mage::getModel('sales/quote');
47
- $quoteMock->setStoreId(0);
48
- $sessionMock = $this->getModelMockBuilder('checkout/session')
49
- ->disableOriginalConstructor()// This one removes session_start and other methods usage
50
- ->setMethods(array('getQuote'))
51
- ->getMock();
52
- $sessionMock->expects($this->any())
53
- ->method('getQuote')
54
- ->will($this->returnValue($quoteMock));
55
- $this->replaceByMock('singleton', 'checkout/session', $sessionMock);
56
-
57
- $configMock = $this->getModelMock('ops/config', array('canSubmitExtraParameter'));
58
- $configMock->expects($this->once())
59
- ->method('canSubmitExtraParameter')
60
- ->will($this->returnValue(false));
61
- $this->_block->setConfig($configMock);
62
- $this->_block->setQuote($quoteMock);
63
- $this->assertEquals(Mage::helper('core/data')->jsonEncode(array()), $this->_block->getFrontendValidators());
64
- }
65
 
66
- public function testGetFrontendValidatorsAreEmptyDueToEmptyValidators()
67
- {
68
- $configMock = $this->getModelMock('ops/config', array('canSubmitExtraParameter', 'getParameterLengths'));
69
- $configMock->expects($this->once())
70
- ->method('canSubmitExtraParameter')
71
- ->will($this->returnValue(true));
72
- $configMock->expects($this->once())
73
- ->method('getParameterLengths')
74
- ->will($this->returnValue(array()));
75
-
76
- $quote = Mage::getModel('sales/quote');
77
- $blockMock = $this->getBlockMock('ops/form', array('getQuote'));
78
  $blockMock->expects($this->any())
79
- ->method('getQuote')
80
- ->will($this->returnValue($quote));
81
- $blockMock->setConfig($configMock);
82
- $this->assertEquals(Mage::helper('core/data')->jsonEncode(array()), $blockMock->getFrontendValidators());
 
 
 
 
 
 
 
 
 
 
83
  }
84
 
85
- public function testGetFrontendValidatorsAreEmptyDueToUnmappedValidators()
86
  {
87
- $configMock = $this->getModelMock('ops/config', array('canSubmitExtraParameter', 'getParameterLengths'));
88
- $configMock->expects($this->once())
89
- ->method('canSubmitExtraParameter')
90
- ->will($this->returnValue(true));
91
- $configMock->expects($this->once())
92
- ->method('getParameterLengths')
93
- ->will($this->returnValue(array('Foo' => 50)));
94
-
95
- $quote = Mage::getModel('sales/quote');
96
- $blockMock = $this->getBlockMock('ops/form', array('getQuote'));
97
  $blockMock->expects($this->any())
98
- ->method('getQuote')
99
- ->will($this->returnValue($quote));
100
- $blockMock->setConfig($configMock);
101
- $this->assertEquals(Mage::helper('core/data')->jsonEncode(array()), $blockMock->getFrontendValidators());
102
- }
103
 
 
104
 
105
- public function testGetFrontendValidatorsAreNotEmpty()
106
- {
 
 
107
 
108
- $configValues = array('CN' => 50, 'ECOM_BILLTO_POSTAL_POSTALCODE' => 10, 'ECOM_SHIPTO_POSTAL_POSTALCODE' => 10);
 
 
 
109
 
110
- $configMock = $this->getModelMock('ops/config', array('canSubmitExtraParameter', 'getParameterLengths'));
111
- $configMock->expects($this->once())
112
- ->method('canSubmitExtraParameter')
113
- ->will($this->returnValue(true));
114
- $configMock->expects($this->once())
115
- ->method('getParameterLengths')
116
- ->will($this->returnValue($configValues));
117
 
118
- $quote = Mage::getModel('sales/quote');
119
- $blockMock = $this->getBlockMock('ops/form', array('getQuote'));
120
  $blockMock->expects($this->any())
121
- ->method('getQuote')
122
- ->will($this->returnValue($quote));
123
- $blockMock->setConfig($configMock);
124
- $this->assertEquals(
125
- Mage::helper('core/data')->jsonEncode(
126
- array(
127
- 'billing:firstname' => 50, 'billing:lastname' => 50, 'billing:postcode' => 10,
128
- 'shipping:postcode' => 10
129
- )
130
- ), $blockMock->getFrontendValidators()
131
- );
132
  }
 
133
  }
1
  <?php
2
 
3
  class Netresearch_OPS_Test_Block_FormTest
4
+ extends EcomDev_PHPUnit_Test_Case
5
  {
6
  private $_block;
7
 
35
  $this->assertFalse($block->isUserNotRegistering());
36
  }
37
 
 
38
  public function testGetPmLogo()
39
  {
40
  $this->assertEquals(null, $this->_block->getPmLogo());
41
  }
42
 
43
+ public function getMethodLabelAfterHtmlSuccess()
44
  {
45
+ $method = new Varien_Object();
46
+ $method->setData('code', 'ops_cc');
47
+
48
+ $blockMock = $this->getBlockMock('ops/form', array('getMethod'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  $blockMock->expects($this->any())
51
+ ->method('getMethod')
52
+ ->will($this->returnValue($method));
53
+ $this->replaceByMock('block', 'ops/form', $blockMock);
54
+
55
+ $formBlock = Mage::app()->getLayout()->createBlock('ops/form');
56
+
57
+ $result = $formBlock->getMethodLabelAfterHtml();
58
+
59
+ $this->assertContains('cc.jpg', $result);
60
+ $this->assertContains(' left', $result);
61
+
62
+ $result = $formBlock->getMethodLabelAfterHtml();
63
+
64
+ $this->assertContains('store_one', $result);
65
  }
66
 
67
+ public function getMethodLabelAfterHtmlHidden()
68
  {
69
+ $method = new Varien_Object();
70
+ $method->setData('code', 'ops_dc');
71
+
72
+ $blockMock = $this->getBlockMock('ops/form', array('getMethod'));
73
+
 
 
 
 
 
74
  $blockMock->expects($this->any())
75
+ ->method('getMethod')
76
+ ->will($this->returnValue($method));
77
+ $this->replaceByMock('block', 'ops/form', $blockMock);
 
 
78
 
79
+ $formBlock = Mage::app()->getLayout()->createBlock('ops/form');
80
 
81
+ $result = $formBlock->getMethodLabelAfterHtml();
82
+
83
+ $this->assertEmpty($result);
84
+ }
85
 
86
+ public function getMethodLabelAfterHtmlFail()
87
+ {
88
+ $method = new Varien_Object();
89
+ $method->setData('code', 'ops_iDEAL');
90
 
91
+ $blockMock = $this->getBlockMock('ops/form', array('getMethod'));
 
 
 
 
 
 
92
 
 
 
93
  $blockMock->expects($this->any())
94
+ ->method('getMethod')
95
+ ->will($this->returnValue($method));
96
+ $this->replaceByMock('block', 'ops/form', $blockMock);
97
+
98
+ $formBlock = Mage::app()->getLayout()->createBlock('ops/form');
99
+
100
+ $result = $formBlock->getMethodLabelAfterHtml();
101
+
102
+ $this->assertContains('ops_iDEAL.jpg', $result);
103
+ $this->assertContains('skin/frontend', $result);
 
104
  }
105
+
106
  }
app/code/community/Netresearch/OPS/Test/Block/FormTest/fixtures/FormTest.yaml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ scope:
2
+ store: # Initializes store views
3
+ # Store 1
4
+ - store_id: 1
5
+ website_id: 1
6
+ group_id: 1
7
+ code: store_one
8
+ name: Store One
9
+ is_active: 1
10
+ # Store 2
11
+ - store_id: 2
12
+ website_id: 1
13
+ group_id: 1
14
+ code: store_two
15
+ name: Store Two
16
+ is_active: 1
17
+
18
+ config:
19
+ default/payment/ops_dc/position: hidden
20
+ default/payment/ops_cc/position: left
21
+ default/payment/ops_cc/image: default/cc.jpg
22
+ stores/store_one/payment/ops_cc/image: store_one/cc.jpg
app/code/community/Netresearch/OPS/Test/Block/FrauddetectionTest.php CHANGED
@@ -1,9 +1,19 @@
1
  <?php
2
 
3
  class Netresearch_OPS_Test_Block_FrauddetectionTest
4
- extends EcomDev_PHPUnit_Test_Case_Controller
5
  {
6
 
 
 
 
 
 
 
 
 
 
 
7
  public function testToHtml()
8
  {
9
  $block = Mage::app()->getLayout()->getBlockSingleton('ops/frauddetection');
@@ -15,7 +25,10 @@ class Netresearch_OPS_Test_Block_FrauddetectionTest
15
  ->will($this->returnValue(true));
16
  $this->replaceByMock('model', 'ops/config', $configMock);
17
 
18
- $sessionMock = $this->getModelMock('customer/session', array('getData'));
 
 
 
19
  $sessionMock->expects($this->once())
20
  ->method('getData')
21
  ->with(Netresearch_OPS_Model_Payment_Abstract::FINGERPRINT_CONSENT_SESSION_KEY)
@@ -49,4 +62,4 @@ class Netresearch_OPS_Test_Block_FrauddetectionTest
49
  $this->assertEquals(md5(Mage::getModel('ops/config')->getPSPID() . '#123456'), $block->getTrackingSid());
50
  }
51
 
52
- }
1
  <?php
2
 
3
  class Netresearch_OPS_Test_Block_FrauddetectionTest
4
+ extends EcomDev_PHPUnit_Test_Case
5
  {
6
 
7
+ private $store;
8
+
9
+ public function setUp()
10
+ {
11
+ @session_start();
12
+ parent::setUp();
13
+ $this->store = Mage::app()->getStore(0)->load(0);
14
+ $this->store->resetConfig();
15
+ }
16
+
17
  public function testToHtml()
18
  {
19
  $block = Mage::app()->getLayout()->getBlockSingleton('ops/frauddetection');
25
  ->will($this->returnValue(true));
26
  $this->replaceByMock('model', 'ops/config', $configMock);
27
 
28
+ $sessionMock = $this->getModelMockBuilder('customer/session')
29
+ ->disableOriginalConstructor()
30
+ ->setMethods(array('getData'))
31
+ ->getMock();
32
  $sessionMock->expects($this->once())
33
  ->method('getData')
34
  ->with(Netresearch_OPS_Model_Payment_Abstract::FINGERPRINT_CONSENT_SESSION_KEY)
62
  $this->assertEquals(md5(Mage::getModel('ops/config')->getPSPID() . '#123456'), $block->getTrackingSid());
63
  }
64
 
65
+ }
app/code/community/Netresearch/OPS/Test/Block/PlaceformTest.php CHANGED
@@ -4,12 +4,24 @@ class Netresearch_OPS_Test_Block_PlaceformTest extends EcomDev_PHPUnit_Test_Case
4
  public function testGetFormAction()
5
  {
6
  $this->mockSessions();
 
 
 
 
 
 
7
  //$block = Mage::app()->getLayout()->getBlockSingleton('ops/placeform');
8
- $blockMock = $this->getBlockMock('ops/placeform', array('getQuestion'));
9
  $blockMock->expects($this->any())
10
  ->method('getQuestion')
11
  ->will($this->returnValue('How much is the fish?'));
12
 
 
 
 
 
 
 
13
  $action = $blockMock->getFormAction();
14
  $this->assertEquals(Mage::getUrl('*/*/*', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())), $action);
15
 
@@ -18,11 +30,17 @@ class Netresearch_OPS_Test_Block_PlaceformTest extends EcomDev_PHPUnit_Test_Case
18
  $action = $blockMock->getFormAction();
19
  $this->assertEquals(Mage::getUrl('*/*/*', array('_secure' =>true)), $action);
20
 
21
- $blockMock = $this->getBlockMock('ops/placeform', array('getQuestion'));
22
  $blockMock->expects($this->any())
23
  ->method('getQuestion')
24
  ->will($this->returnValue(null));
25
 
 
 
 
 
 
 
26
  $action = $blockMock->getFormAction();
27
  $this->assertEquals($blockMock->getConfig()->getFrontendGatewayPath(), $action);
28
  }
4
  public function testGetFormAction()
5
  {
6
  $this->mockSessions();
7
+
8
+ $order = Mage::getModel('sales/order');
9
+ $payment = Mage::getModel('sales/order_payment');
10
+ $payment->setMethod('ops_openInvoiceDe');
11
+ $order->setPayment($payment);
12
+
13
  //$block = Mage::app()->getLayout()->getBlockSingleton('ops/placeform');
14
+ $blockMock = $this->getBlockMock('ops/placeform', array('getQuestion', '_getOrder'));
15
  $blockMock->expects($this->any())
16
  ->method('getQuestion')
17
  ->will($this->returnValue('How much is the fish?'));
18
 
19
+
20
+ $blockMock->expects($this->any())
21
+ ->method('_getOrder')
22
+ ->will($this->returnValue($order));
23
+
24
+
25
  $action = $blockMock->getFormAction();
26
  $this->assertEquals(Mage::getUrl('*/*/*', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())), $action);
27
 
30
  $action = $blockMock->getFormAction();
31
  $this->assertEquals(Mage::getUrl('*/*/*', array('_secure' =>true)), $action);
32
 
33
+ $blockMock = $this->getBlockMock('ops/placeform', array('getQuestion', '_getOrder'));
34
  $blockMock->expects($this->any())
35
  ->method('getQuestion')
36
  ->will($this->returnValue(null));
37
 
38
+ $blockMock->expects($this->any())
39
+ ->method('_getOrder')
40
+ ->will($this->returnValue($order));
41
+
42
+
43
+
44
  $action = $blockMock->getFormAction();
45
  $this->assertEquals($blockMock->getConfig()->getFrontendGatewayPath(), $action);
46
  }
app/code/community/Netresearch/OPS/Test/Block/RetryPayment/MethodsTest.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * Methods.php
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
28
+ */
29
+ class Netresearch_OPS_Test_Block_RetryPayment_MethodsTest extends EcomDev_PHPUnit_Test_Case
30
+ {
31
+ /**
32
+ * @test
33
+ */
34
+ public function getMethods()
35
+ {
36
+ $this->mockSessions();
37
+
38
+ /** @var Netresearch_OPS_Block_RetryPayment_Methods $retryBlockMock */
39
+ $retryBlockMock = $this->getBlockMock('ops/retryPayment_methods', array('_canUseMethod'));
40
+ $retryBlockMock->expects($this->any())
41
+ ->method('_canUseMethod')
42
+ ->will($this->returnValue(true));
43
+
44
+ $method = Mage::getModel('ops/payment_ops_cc');
45
+ $retryBlockMock->setMethods(array($method));
46
+
47
+ $paymentMethodMock = $this->getModelMock('ops/payment_abstract', array('isApplicableToQuote'));
48
+ $paymentMethodMock->expects($this->any())
49
+ ->method('isApplicableToQuote')
50
+ ->will($this->returnValue(true));
51
+
52
+ $paymentHelperMock = $this->getHelperMock('payment', array('getStoreMethods'));
53
+ $paymentHelperMock->expects($this->any())
54
+ ->method('getStoreMethods')
55
+ ->will($this->returnValue(array($paymentMethodMock)));
56
+ $this->replaceByMock('helper', 'payment', $paymentHelperMock);
57
+
58
+ $result = $retryBlockMock->getMethods();
59
+
60
+ $this->assertInternalType('array', $result);
61
+ $this->assertEquals(1, count($result));
62
+
63
+ }
64
+
65
+ /**
66
+ * Helper Function to remove Session Errors
67
+ */
68
+ protected function mockSessions()
69
+ {
70
+ $sessionMock = $this->getModelMockBuilder('admin/session')
71
+ ->disableOriginalConstructor()// This one removes session_start and other methods usage
72
+ ->getMock();
73
+ $this->replaceByMock('singleton', 'admin/session', $sessionMock);
74
+
75
+ $sessionMock = $this->getModelMockBuilder('checkout/session')
76
+ ->disableOriginalConstructor()// This one removes session_start and other methods usage
77
+ ->getMock();
78
+ $this->replaceByMock('singleton', 'core/session', $sessionMock);
79
+
80
+ $sessionMock = $this->getModelMockBuilder('customer/session')
81
+ ->disableOriginalConstructor()// This one removes session_start and other methods usage
82
+ ->getMock();
83
+ $this->replaceByMock('singleton', 'customer/session', $sessionMock);
84
+ }
85
+
86
+ }
app/code/community/Netresearch/OPS/Test/Block/RetryPaymentTest.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * RetryPaymentTest.php
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
28
+ */
29
+ class Netresearch_OPS_Test_Block_RetryPaymentTest extends EcomDev_PHPUnit_Test_Case
30
+ {
31
+ /**
32
+ * @test
33
+ */
34
+ public function getFormAction()
35
+ {
36
+ $this->mockSessions();
37
+ $retryBlock = new Netresearch_OPS_Block_RetryPayment();
38
+
39
+ $result = $retryBlock->getFormAction();
40
+
41
+ $this->assertInternalType('string', $result);
42
+ $this->assertContains('http', $result);
43
+
44
+ }
45
+
46
+ /**
47
+ * @test
48
+ */
49
+ public function getCancelUrl()
50
+ {
51
+ $this->mockSessions();
52
+ $retryBlock = new Netresearch_OPS_Block_RetryPayment();
53
+
54
+ $result = $retryBlock->getCancelUrl();
55
+
56
+ $this->assertInternalType('string', $result);
57
+ $this->assertContains('http', $result);
58
+
59
+ }
60
+
61
+ /**
62
+ * @test
63
+ */
64
+ public function getOrderId()
65
+ {
66
+ $this->mockSessions();
67
+ $retryBlock = new Netresearch_OPS_Block_RetryPayment();
68
+ $orderId = '100000023';
69
+
70
+ Mage::app()->getRequest()->setParam('orderID', $orderId);
71
+
72
+ $result = $retryBlock->getOrderId();
73
+
74
+ $this->assertContains($orderId, $result);
75
+
76
+ }
77
+
78
+ /**
79
+ * Helper Function to remove Session Errors
80
+ */
81
+ protected function mockSessions()
82
+ {
83
+ $sessionMock = $this->getModelMockBuilder('checkout/session')
84
+ ->disableOriginalConstructor()// This one removes session_start and other methods usage
85
+ ->getMock();
86
+ $this->replaceByMock('singleton', 'core/session', $sessionMock);
87
+
88
+ $sessionMock = $this->getModelMockBuilder('customer/session')
89
+ ->disableOriginalConstructor()// This one removes session_start and other methods usage
90
+ ->getMock();
91
+ $this->replaceByMock('singleton', 'customer/session', $sessionMock);
92
+ }
93
+
94
+ }
app/code/community/Netresearch/OPS/Test/Block/System/Config/Form/Field/ImageTest.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * PHP version 5
18
+ *
19
+ * @category OPS
20
+ * @package Netresearch_OPS
21
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
22
+ * @copyright 2016 Netresearch GmbH & Co. KG
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @link http://www.netresearch.de/
25
+ */
26
+
27
+ /**
28
+ * Netresearch_OPS_Test_Block_System_Config_ImageTest
29
+ *
30
+ * @category OPS
31
+ * @package Netresearch_OPS
32
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
33
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
+ * @link http://www.netresearch.de/
35
+ */
36
+ class Netresearch_OPS_Test_Block_System_Config_Form_Field_ImageTest
37
+ extends EcomDev_PHPUnit_Test_Case
38
+ {
39
+ /**
40
+ * @test
41
+ */
42
+ public function getElementHtml()
43
+ {
44
+ $blockMock =
45
+ $this->getBlockMock('ops/system_config_form_field_image', array('getHtmlId', '_getDeleteCheckbox'), false,
46
+ array(), '', false
47
+ );
48
+
49
+ $blockMock->expects($this->any())
50
+ ->method('getHtmlId')
51
+ ->will($this->returnValue('112'));
52
+ $blockMock->expects($this->any())
53
+ ->method('_getDeleteCheckbox')
54
+ ->will($this->returnValue(''));
55
+
56
+ /** @var Netresearch_OPS_Block_System_Config_Form_Field_Image $imageBlock */
57
+ $blockMock->setData('name', 'groups[ops_cc][fields][image][value]');
58
+
59
+ $result = $blockMock->getElementHtml();
60
+
61
+ $this->assertInternalType('string', $result);
62
+ $this->assertContains('ops/logos/ops_cc.png', $result);
63
+
64
+ /* Fill the Block with an Url */
65
+ $simpleXmlElement = new Varien_Simplexml_Element('<xml><base_url>ingenico/test</base_url></xml>');
66
+ $blockMock->setData('value', 'default/img.png');
67
+ $blockMock->setData('field_config', $simpleXmlElement);
68
+ $result = $blockMock->getElementHtml();
69
+ $this->assertInternalType('string', $result);
70
+ $this->assertContains('ingenico/test', $result);
71
+ }
72
+
73
+ }
app/code/community/Netresearch/OPS/Test/Block/System/Config/ModeTest.php CHANGED
@@ -1,20 +1,21 @@
1
- <?php
2
- /**
3
- * ModeTest.php
4
- * @author paul.siedler@netresearch.de
5
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
- */
8
-
9
- class Netresearch_OPS_Test_Block_System_Config_ModeTest extends EcomDev_PHPUnit_Test_Case {
10
-
11
- public function testGetElementHtmlContainsScriptTag()
12
- {
13
- $element = new Varien_Data_Form_Element_Select();
14
- $element->setForm(new Varien_Object());
15
- $block = new Netresearch_OPS_Block_System_Config_Mode();
16
- $html = $block->render($element);
17
- $this->assertTrue(preg_match('/<script/', $html) > 0);
18
- }
19
-
20
- }
 
1
+ <?php
2
+ /**
3
+ * ModeTest.php
4
+ * @author paul.siedler@netresearch.de
5
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
+ */
8
+
9
+ class Netresearch_OPS_Test_Block_System_Config_ModeTest extends EcomDev_PHPUnit_Test_Case
10
+ {
11
+
12
+ public function testGetElementHtmlContainsScriptTag()
13
+ {
14
+ $element = new Varien_Data_Form_Element_Select();
15
+ $element->setForm(new Varien_Object());
16
+ $block = new Netresearch_OPS_Block_System_Config_Mode();
17
+ $html = $block->render($element);
18
+ $this->assertTrue(preg_match('/<script/', $html) > 0);
19
+ }
20
+
21
+ }
app/code/community/Netresearch/OPS/Test/Controller/Adminhtml/AdminControllerTest.php CHANGED
@@ -1,80 +1,82 @@
1
- <?php
2
-
3
- /**
4
- * AdminControllerTest.php
5
- * @author paul.siedler@netresearch.de
6
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
8
- */
9
-
10
- class Netresearch_OPS_Test_Controller_Adminhtml_AdminControllerTest extends EcomDev_PHPUnit_Test_Case_Controller
11
- {
12
-
13
- public function setUp(){
14
- parent::setUp();
15
-
16
- $nodePath = "modules/Enterprise_AdminGws/active";
17
- if (Mage::helper('core/data')->isModuleEnabled('Enterprise_AdminGws')) {
18
- Mage::getConfig()->setNode($nodePath, 'false', true);
19
- }
20
-
21
- $this->fakeAdminUser();
22
- }
23
-
24
- public function testResendInfoActionWillSucceed()
25
- {
26
- $mailFeatureMock = $this->getModelMock('ops/payment_features_paymentEmail', array('resendPaymentInfo', 'isAvailableForOrder'));
27
- $mailFeatureMock->expects($this->any())
28
- ->method('isAvailableForOrder')
29
- ->will($this->returnValue(true));
30
- $mailFeatureMock->expects($this->once())
31
- ->method('resendPaymentInfo')
32
- ->will($this->returnValue(true));
33
- $this->replaceByMock('model', 'ops/payment_features_paymentEmail', $mailFeatureMock);
34
-
35
- $orderMock = $this->getModelMock('sales/order', array('load'));
36
- $orderMock->expects($this->once())
37
- ->method('load')
38
- ->will($this->returnValue($orderMock));
39
- $this->replaceByMock('model', 'sales/order', $orderMock);
40
-
41
- $this->dispatch('adminhtml/admin/resendInfo', array('order_id' => 1));
42
- }
43
-
44
- public function testResendInfoActionWillFail()
45
- {
46
- $mailFeatureMock = $this->getModelMock('ops/payment_features_paymentEmail', array('resendPaymentInfo', 'isAvailableForOrder'));
47
- $mailFeatureMock->expects($this->any())
48
- ->method('isAvailableForOrder')
49
- ->will($this->returnValue(true));
50
- $mailFeatureMock->expects($this->once())
51
- ->method('resendPaymentInfo')
52
- ->will($this->returnValue(false));
53
- $this->replaceByMock('model', 'ops/payment_features_paymentEmail', $mailFeatureMock);
54
-
55
- $orderMock = $this->getModelMock('sales/order', array('load'));
56
- $orderMock->expects($this->once())
57
- ->method('load')
58
- ->will($this->returnValue($orderMock));
59
- $this->replaceByMock('model', 'sales/order', $orderMock);
60
-
61
- $this->dispatch('adminhtml/admin/resendInfo', array('order_id' => 1));
62
- }
63
-
64
- protected function fakeAdminUser(){
65
- $fakeUser = $this->getModelMock('admin/user', array('getId', 'getRole'));
66
- $fakeUser->expects($this->any())
67
- ->method('getId')
68
- ->will($this->returnValue(1));
69
-
70
- $adminSessionMock = $this->getModelMock('admin/session', array('isAllowed', 'init', 'save', 'getUser'));
71
- $adminSessionMock->expects($this->any())
72
- ->method('isAllowed')
73
- ->will($this->returnValue(true));
74
- $adminSessionMock->expects($this->any())
75
- ->method('getUser')
76
- ->will($this->returnValue($fakeUser));
77
- $this->replaceByMock('model', 'admin/session', $adminSessionMock);
78
- }
79
-
80
- }
 
 
1
+ <?php
2
+
3
+ /**
4
+ * AdminControllerTest.php
5
+ * @author paul.siedler@netresearch.de
6
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
8
+ */
9
+
10
+ class Netresearch_OPS_Test_Controller_Adminhtml_AdminControllerTest extends EcomDev_PHPUnit_Test_Case_Controller
11
+ {
12
+
13
+ public function setUp()
14
+ {
15
+ parent::setUp();
16
+
17
+ $nodePath = "modules/Enterprise_AdminGws/active";
18
+ if (Mage::helper('core/data')->isModuleEnabled('Enterprise_AdminGws')) {
19
+ Mage::getConfig()->setNode($nodePath, 'false', true);
20
+ }
21
+
22
+ $this->fakeAdminUser();
23
+ }
24
+
25
+ public function testResendInfoActionWillSucceed()
26
+ {
27
+ $mailFeatureMock = $this->getModelMock('ops/payment_features_paymentEmail', array('resendPaymentInfo', 'isAvailableForOrder'));
28
+ $mailFeatureMock->expects($this->any())
29
+ ->method('isAvailableForOrder')
30
+ ->will($this->returnValue(true));
31
+ $mailFeatureMock->expects($this->once())
32
+ ->method('resendPaymentInfo')
33
+ ->will($this->returnValue(true));
34
+ $this->replaceByMock('model', 'ops/payment_features_paymentEmail', $mailFeatureMock);
35
+
36
+ $orderMock = $this->getModelMock('sales/order', array('load'));
37
+ $orderMock->expects($this->once())
38
+ ->method('load')
39
+ ->will($this->returnValue($orderMock));
40
+ $this->replaceByMock('model', 'sales/order', $orderMock);
41
+
42
+ $this->dispatch('adminhtml/admin/resendInfo', array('order_id' => 1));
43
+ }
44
+
45
+ public function testResendInfoActionWillFail()
46
+ {
47
+ $mailFeatureMock = $this->getModelMock('ops/payment_features_paymentEmail', array('resendPaymentInfo', 'isAvailableForOrder'));
48
+ $mailFeatureMock->expects($this->any())
49
+ ->method('isAvailableForOrder')
50
+ ->will($this->returnValue(true));
51
+ $mailFeatureMock->expects($this->once())
52
+ ->method('resendPaymentInfo')
53
+ ->will($this->returnValue(false));
54
+ $this->replaceByMock('model', 'ops/payment_features_paymentEmail', $mailFeatureMock);
55
+
56
+ $orderMock = $this->getModelMock('sales/order', array('load'));
57
+ $orderMock->expects($this->once())
58
+ ->method('load')
59
+ ->will($this->returnValue($orderMock));
60
+ $this->replaceByMock('model', 'sales/order', $orderMock);
61
+
62
+ $this->dispatch('adminhtml/admin/resendInfo', array('order_id' => 1));
63
+ }
64
+
65
+ protected function fakeAdminUser()
66
+ {
67
+ $fakeUser = $this->getModelMock('admin/user', array('getId', 'getRole'));
68
+ $fakeUser->expects($this->any())
69
+ ->method('getId')
70
+ ->will($this->returnValue(1));
71
+
72
+ $adminSessionMock = $this->getModelMock('admin/session', array('isAllowed', 'init', 'save', 'getUser'));
73
+ $adminSessionMock->expects($this->any())
74
+ ->method('isAllowed')
75
+ ->will($this->returnValue(true));
76
+ $adminSessionMock->expects($this->any())
77
+ ->method('getUser')
78
+ ->will($this->returnValue($fakeUser));
79
+ $this->replaceByMock('model', 'admin/session', $adminSessionMock);
80
+ }
81
+
82
+ }
app/code/community/Netresearch/OPS/Test/Controller/Adminhtml/KwixoshippingControllerTest.php CHANGED
@@ -79,10 +79,11 @@ class Netresearch_OPS_Test_Controller_Adminhtml_KwixoshippingControllerTest
79
  $postData = array(
80
  'form_key' => '1234',
81
  'flatrate' => array(
82
- 'kwixo_shipping_type' => 1,
83
- 'kwixo_shipping_speed' => 1,
84
  'kwixo_shipping_details' => 'foo'
85
- )
 
86
  );
87
  $this->getRequest()->setPost($postData);
88
  $this->getRequest()->setMethod('POST');
@@ -94,8 +95,8 @@ class Netresearch_OPS_Test_Controller_Adminhtml_KwixoshippingControllerTest
94
  // assure that saving the data worked properly
95
 
96
  $this->assertEquals('flatrate', $kwixoModel->getShippingCode());
97
- $this->assertEquals(1, $kwixoModel->getKwixoShippingType());
98
- $this->assertEquals(1, $kwixoModel->getKwixoShippingSpeed());
99
  $this->assertEquals('foo', $kwixoModel->getKwixoShippingDetails());
100
  }
101
 
@@ -111,7 +112,8 @@ class Netresearch_OPS_Test_Controller_Adminhtml_KwixoshippingControllerTest
111
  'kwixo_shipping_type' => -1,
112
  'kwixo_shipping_speed' => 'abc',
113
  'kwixo_shipping_details' => 'foo'
114
- )
 
115
  );
116
  $this->getRequest()->setPost($postData);
117
  $this->getRequest()->setMethod('POST');
@@ -128,21 +130,4 @@ class Netresearch_OPS_Test_Controller_Adminhtml_KwixoshippingControllerTest
128
  $this->assertNotEquals('foo', $kwixoModel->getKwixoShippingDetails());
129
  }
130
 
131
- public function testDeleteNotFoundAction()
132
- {
133
- $this->dispatch('adminhtml/kwixoshipping/delete', array());
134
- $headers = $this->getResponse()->getHeaders();
135
- $notFound = false;
136
- foreach ($headers as $header) {
137
- if ($header['name'] == 'Status'
138
- && $header['value'] == '404 File not found'
139
- ) {
140
- $notFound = true;
141
- break;
142
- }
143
- }
144
- $this->assertTrue($notFound);
145
-
146
- }
147
-
148
  }
79
  $postData = array(
80
  'form_key' => '1234',
81
  'flatrate' => array(
82
+ 'kwixo_shipping_type' => 2,
83
+ 'kwixo_shipping_speed' => 2,
84
  'kwixo_shipping_details' => 'foo'
85
+ ),
86
+ 'foobar' => 'barfoo'
87
  );
88
  $this->getRequest()->setPost($postData);
89
  $this->getRequest()->setMethod('POST');
95
  // assure that saving the data worked properly
96
 
97
  $this->assertEquals('flatrate', $kwixoModel->getShippingCode());
98
+ $this->assertEquals(2, $kwixoModel->getKwixoShippingType());
99
+ $this->assertEquals(2, $kwixoModel->getKwixoShippingSpeed());
100
  $this->assertEquals('foo', $kwixoModel->getKwixoShippingDetails());
101
  }
102
 
112
  'kwixo_shipping_type' => -1,
113
  'kwixo_shipping_speed' => 'abc',
114
  'kwixo_shipping_details' => 'foo'
115
+ ),
116
+ 'foobar' => 'barfoo'
117
  );
118
  $this->getRequest()->setPost($postData);
119
  $this->getRequest()->setMethod('POST');
130
  $this->assertNotEquals('foo', $kwixoModel->getKwixoShippingDetails());
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
app/code/community/Netresearch/OPS/Test/Controller/AliasControllerTest.php CHANGED
@@ -1,106 +1,125 @@
1
- <?php
2
- class Netresearch_OPS_Test_Controller_AliasControllerTest
3
- extends EcomDev_PHPUnit_Test_Case_Controller
4
- {
5
-
6
- public function testAcceptAliasAction()
7
- {
8
- $quote = Mage::getModel('sales/quote');
9
- $payment = Mage::getModel('sales/quote_payment');
10
- $quote->setPayment($payment);
11
- $sessionMock = $this->getModelMock('checkout/session', array('getQuote'));
12
- $sessionMock->expects($this->any())
13
- ->method('getQuote')
14
- ->will($this->returnValue($quote));
15
- $this->replaceByMock('singleton', 'checkout/session', $sessionMock);
16
- $aliasHelperMock = $this->getHelperMock('ops/alias', array('saveAlias', 'setAliasToPayment'));
17
- $this->replaceByMock('helper', 'ops/alias', $aliasHelperMock);
18
- $routeToDispatch = 'ops/alias/accept';
19
- $params = array('Alias_AliasId' => '4711');
20
- $this->dispatch($routeToDispatch, $params);
21
- $result = $this->getResponse()->getOutputBody();
22
- $this->assertEquals($result, "<script type='application/javascript'>window.onload = function() { top.document.fire('alias:success', '4711'); };</script>");
23
-
24
- $params = array('Alias_AliasId' => '4711', 'Card_CVC' => '123');
25
- $this->dispatch($routeToDispatch, $params);
26
- $result = $this->getResponse()->getOutputBody();
27
- $this->assertEquals($result, "<script type='application/javascript'>window.onload = function() { top.document.fire('alias:success', '4711'); };</script>");
28
-
29
- }
30
-
31
- /**
32
- * @loadFixture orders.yaml
33
- */
34
- public function testGenerateHashAction()
35
- {
36
-
37
- $fakeQuote = Mage::getModel('sales/order')->load(11);
38
- $quoteMock = $this->getModelMock('sales/quote', array('load', 'save'));
39
- $quoteMock->expects($this->any())
40
- ->method('load')
41
- ->will($this->returnValue($fakeQuote));
42
- $this->replaceByMock('model', 'sales/quote', $quoteMock);
43
- $params = array(
44
- 'alias' => 4711,
45
- 'storeId' => 1
46
- );
47
-
48
- $configHelperMock = $this->getModelMock('ops/config', array('getAliasAcceptUrl', 'getAliasExceptionUrl'));
49
- $configHelperMock->expects($this->any())
50
- ->method('getAliasAcceptUrl')
51
- ->with(1)
52
- ->will($this->returnValue(1));
53
- $configHelperMock->expects($this->any())
54
- ->method('getAliasExceptionUrl')
55
- ->with(1)
56
- ->will($this->returnValue(1));
57
- $this->replaceByMock('model', 'ops/config', $configHelperMock);
58
-
59
- $this->dispatch('ops/alias/generateHash', $params);
60
- $result = Mage::helper('core')->jsonDecode($this->getResponse()->getOutputBody());
61
- $this->assertArrayHasKey('hash', $result);
62
-
63
- $params = array(
64
- 'alias' => 4712,
65
- 'storeId' => 0
66
- );
67
-
68
- $configHelperMock = $this->getModelMock('ops/config', array('getAliasAcceptUrl', 'getAliasExceptionUrl'));
69
- $configHelperMock->expects($this->any())
70
- ->method('getAliasAcceptUrl')
71
- ->with(0)
72
- ->will($this->returnValue(1));
73
- $configHelperMock->expects($this->any())
74
- ->method('getAliasExceptionUrl')
75
- ->with(0)
76
- ->will($this->returnValue(1));
77
- $this->replaceByMock('model', 'ops/config', $configHelperMock);
78
-
79
- $this->dispatch('ops/alias/generateHash', $params);
80
- $result = Mage::helper('core')->jsonDecode($this->getResponse()->getOutputBody());
81
- $this->assertArrayHasKey('hash', $result);
82
-
83
- $params = array(
84
- 'alias' => 4713,
85
- 'storeId' => 1,
86
- 'isAdmin' => 1,
87
- 'brand' => 'visa'
88
- );
89
-
90
- $configHelperMock = $this->getModelMock('ops/config', array('getAliasAcceptUrl', 'getAliasExecptionUrl'));
91
- $configHelperMock->expects($this->any())
92
- ->method('getAliasAcceptUrl')
93
- ->with(0)
94
- ->will($this->returnValue(1));
95
- $configHelperMock->expects($this->any())
96
- ->method('getAliasExceptionUrl')
97
- ->with(0)
98
- ->will($this->returnValue(1));
99
- $this->replaceByMock('model', 'ops/config', $configHelperMock);
100
-
101
- $this->dispatch('ops/alias/generateHash', $params);
102
- $result = Mage::helper('core')->jsonDecode($this->getResponse()->getOutputBody());
103
- $this->assertArrayHasKey('hash', $result);
104
-
105
- }
106
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Netresearch_OPS_Test_Controller_AliasControllerTest
3
+ extends EcomDev_PHPUnit_Test_Case_Controller
4
+ {
5
+
6
+ protected function prepareAliasControllerTest()
7
+ {
8
+ $quote = Mage::getModel('sales/quote');
9
+ $payment = Mage::getModel('sales/quote_payment');
10
+ $quote->setPayment($payment);
11
+ $sessionMock = $this->getModelMock('checkout/session', array('getQuote'));
12
+ $sessionMock->expects($this->any())
13
+ ->method('getQuote')
14
+ ->will($this->returnValue($quote));
15
+ $this->replaceByMock('singleton', 'checkout/session', $sessionMock);
16
+ $aliasHelperMock = $this->getHelperMock('ops/alias', array('saveAlias', 'setAliasToPayment'));
17
+ $this->replaceByMock('helper', 'ops/alias', $aliasHelperMock);
18
+ return 'ops/alias/accept';
19
+ }
20
+
21
+
22
+ public function testAcceptAliasActionSuccess()
23
+ {
24
+
25
+ $routeToDispatch = $this->prepareAliasControllerTest();
26
+ $params = array('Alias_AliasId' => '4711', 'Alias_OrderId' => '0');
27
+ $this->dispatch($routeToDispatch, $params);
28
+ $result = $this->getResponse()->getOutputBody();
29
+ $this->assertEquals($result, "<script type='application/javascript'>window.onload = function() { top.document.fire('alias:success', '4711'); };</script>");
30
+
31
+ $params = array('Alias_AliasId' => '4711', 'Card_CVC' => '123', 'Alias_OrderId' => '0');
32
+ $this->dispatch($routeToDispatch, $params);
33
+ $result = $this->getResponse()->getOutputBody();
34
+ $this->assertEquals($result, "<script type='application/javascript'>window.onload = function() { top.document.fire('alias:success', '4711'); };</script>");
35
+
36
+
37
+
38
+ }
39
+
40
+ public function testAcceptAliasActionException()
41
+ {
42
+ $routeToDispatch = $this->prepareAliasControllerTest();
43
+
44
+ $this->dispatch($routeToDispatch, array('Alias_OrderId' => '0'));
45
+ $result = $this->getResponse()->getOutputBody();
46
+ $this->assertEquals($result, "<script type='application/javascript'>window.onload = function() { top.document.fire('alias:failure'); };</script>");
47
+ }
48
+
49
+
50
+ /**
51
+ * @loadFixture orders.yaml
52
+ */
53
+ public function testGenerateHashAction()
54
+ {
55
+
56
+ $fakeQuote = Mage::getModel('sales/order')->load(11);
57
+ $quoteMock = $this->getModelMock('sales/quote', array('load', 'save'));
58
+ $quoteMock->expects($this->any())
59
+ ->method('load')
60
+ ->will($this->returnValue($fakeQuote));
61
+ $this->replaceByMock('model', 'sales/quote', $quoteMock);
62
+ $params = array(
63
+ 'alias' => 4711,
64
+ 'storeId' => 1
65
+ );
66
+
67
+ $configHelperMock = $this->getModelMock('ops/config', array('getAliasAcceptUrl', 'getAliasExceptionUrl'));
68
+ $configHelperMock->expects($this->any())
69
+ ->method('getAliasAcceptUrl')
70
+ ->with(1)
71
+ ->will($this->returnValue(1));
72
+ $configHelperMock->expects($this->any())
73
+ ->method('getAliasExceptionUrl')
74
+ ->with(1)
75
+ ->will($this->returnValue(1));
76
+ $this->replaceByMock('model', 'ops/config', $configHelperMock);
77
+
78
+ $this->dispatch('ops/alias/generateHash', $params);
79
+ $result = Mage::helper('core')->jsonDecode($this->getResponse()->getOutputBody());
80
+ $this->assertArrayHasKey('hash', $result);
81
+
82
+ $params = array(
83
+ 'alias' => 4712,
84
+ 'storeId' => 0
85
+ );
86
+
87
+ $configHelperMock = $this->getModelMock('ops/config', array('getAliasAcceptUrl', 'getAliasExceptionUrl'));
88
+ $configHelperMock->expects($this->any())
89
+ ->method('getAliasAcceptUrl')
90
+ ->with(0)
91
+ ->will($this->returnValue(1));
92
+ $configHelperMock->expects($this->any())
93
+ ->method('getAliasExceptionUrl')
94
+ ->with(0)
95
+ ->will($this->returnValue(1));
96
+ $this->replaceByMock('model', 'ops/config', $configHelperMock);
97
+
98
+ $this->dispatch('ops/alias/generateHash', $params);
99
+ $result = Mage::helper('core')->jsonDecode($this->getResponse()->getOutputBody());
100
+ $this->assertArrayHasKey('hash', $result);
101
+
102
+ $params = array(
103
+ 'alias' => 4713,
104
+ 'storeId' => 1,
105
+ 'isAdmin' => 1,
106
+ 'brand' => 'visa'
107
+ );
108
+
109
+ $configHelperMock = $this->getModelMock('ops/config', array('getAliasAcceptUrl', 'getAliasExecptionUrl'));
110
+ $configHelperMock->expects($this->any())
111
+ ->method('getAliasAcceptUrl')
112
+ ->with(0)
113
+ ->will($this->returnValue(1));
114
+ $configHelperMock->expects($this->any())
115
+ ->method('getAliasExceptionUrl')
116
+ ->with(0)
117
+ ->will($this->returnValue(1));
118
+ $this->replaceByMock('model', 'ops/config', $configHelperMock);
119
+
120
+ $this->dispatch('ops/alias/generateHash', $params);
121
+ $result = Mage::helper('core')->jsonDecode($this->getResponse()->getOutputBody());
122
+ $this->assertArrayHasKey('hash', $result);
123
+
124
+ }
125
+ }
app/code/community/Netresearch/OPS/Test/Controller/PaymentControllerTest.php CHANGED
@@ -1,9 +1,36 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  class Netresearch_OPS_Test_Controller_PaymentControllerTest
4
  extends EcomDev_PHPUnit_Test_Case_Controller
5
  {
6
-
7
  public function setUp()
8
  {
9
  parent::setUp();
@@ -15,7 +42,7 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
15
  'handleException',
16
  'getSHAInSet',
17
  'refillCart'
18
- )
19
  );
20
  $helperMock->expects($this->any())
21
  ->method('shaCryptValidation')
@@ -29,23 +56,17 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
29
  */
30
  public function testAcceptAction()
31
  {
32
- $params = array();
33
- $this->dispatch('ops/payment/accept', $params);
34
- $this->assertRedirect('checkout/cart');
35
-
36
-
37
  $params = array(
38
  'orderID' => '#100000011'
39
  );
40
  $this->dispatch('ops/payment/accept', $params);
41
- $this->assertRedirect('checkout/onepage/success');
42
 
43
  $params = array(
44
  'orderID' => '23'
45
  );
46
  $this->dispatch('ops/payment/accept', $params);
47
- $this->assertRedirect('checkout/onepage/success');
48
-
49
  }
50
 
51
  /**
@@ -53,22 +74,36 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
53
  */
54
  public function testExceptionAction()
55
  {
56
- $params = array();
57
- $this->dispatch('ops/payment/exception', $params);
58
- $this->assertRedirect('checkout/cart');
 
 
 
 
 
 
 
59
 
60
- $params = array(
61
- 'orderID' => '#100000011'
62
- );
63
  $this->dispatch('ops/payment/exception', $params);
64
- $this->assertRedirect('checkout/onepage/success');
 
 
 
 
 
 
 
 
 
65
 
66
- $params = array(
67
- 'orderID' => '23'
68
- );
69
  $this->dispatch('ops/payment/exception', $params);
70
- $this->assertRedirect('checkout/onepage/success');
 
71
 
 
 
 
72
  }
73
 
74
  /**
@@ -79,21 +114,20 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
79
  $routeToDispatch = 'ops/payment/decline';
80
  $params = array();
81
  $this->dispatch($routeToDispatch, $params);
82
- $this->assertRedirect('checkout/onepage');
83
 
84
 
85
  $params = array(
86
  'orderID' => '#100000011'
87
  );
88
  $this->dispatch($routeToDispatch, $params);
89
- $this->assertRedirect('checkout/onepage');
90
 
91
  $params = array(
92
  'orderID' => '23'
93
  );
94
  $this->dispatch($routeToDispatch, $params);
95
- $this->assertRedirect('checkout/onepage');
96
-
97
  }
98
 
99
  /**
@@ -102,22 +136,18 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
102
  public function testCancelAction()
103
  {
104
  $routeToDispatch = 'ops/payment/cancel';
105
- $params = array();
106
- $this->dispatch($routeToDispatch, $params);
107
- $this->assertRedirect('checkout/onepage');
108
 
109
  $params = array(
110
  'orderID' => '#100000011'
111
  );
112
  $this->dispatch($routeToDispatch, $params);
113
- $this->assertRedirect('checkout/onepage');
114
 
115
  $params = array(
116
  'orderID' => '23'
117
  );
118
  $this->dispatch($routeToDispatch, $params);
119
- $this->assertRedirect('checkout/onepage');
120
-
121
  }
122
 
123
  /**
@@ -128,36 +158,34 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
128
  $routeToDispatch = 'ops/payment/continue';
129
  $params = array();
130
  $this->dispatch($routeToDispatch, $params);
131
- $this->assertRedirect('checkout/cart');
132
 
133
 
134
  $params = array(
135
  'orderID' => '#100000011'
136
  );
137
  $this->dispatch($routeToDispatch, $params);
138
- $this->assertRedirect('checkout/cart');
139
 
140
  $params = array(
141
  'orderID' => '23'
142
  );
143
  $this->dispatch($routeToDispatch, $params);
144
- $this->assertRedirect('checkout/cart');
145
 
146
  $params = array(
147
  'orderID' => '#100000011',
148
  'redirect' => 'catalog'
149
  );
150
  $this->dispatch($routeToDispatch, $params);
151
- $this->assertRedirect('/');
152
 
153
  $params = array(
154
  'orderID' => '23',
155
  'redirect' => 'catalog'
156
  );
157
  $this->dispatch($routeToDispatch, $params);
158
- $this->assertRedirect('/');
159
-
160
-
161
  }
162
 
163
  /**
@@ -182,7 +210,6 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
182
  $message = Mage::getSingleton('core/session')->getMessages()->getLastAddedMessage();
183
  $this->assertNotNull($message);
184
  $this->assertEquals($message->getText(), 'Hash not valid');
185
-
186
  }
187
 
188
  /**
@@ -192,8 +219,8 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
192
  {
193
 
194
  // test 1: hash valid, order can not be retried
195
- // orderID 100000011
196
- $order = Mage::getModel('sales/order')->load(11);
197
  $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
198
 
199
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('shaCryptValidation'));
@@ -202,18 +229,22 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
202
  ->will($this->returnValue(true));
203
  $this->replaceByMock('helper', 'ops/payment', $paymentHelperMock);
204
 
205
- $params = array(
206
- 'orderID' => $opsOrderId,
207
- 'SHASIGN' => 'foo'
208
- );
 
 
 
209
  $this->dispatch('ops/payment/retry', $params);
 
210
  $this->assertRedirectTo('/');
 
211
  $message = Mage::getSingleton('core/session')->getMessages()->getLastAddedMessage();
212
  $this->assertNotNull($message);
213
  $this->assertEquals(
214
  $message->getText(), 'Not possible to reenter the payment details for order ' . $order->getIncrementId()
215
  );
216
-
217
  }
218
 
219
  /**
@@ -221,10 +252,10 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
221
  */
222
  public function testRepayActionWithSuccess()
223
  {
224
- // test 3: order is fine
225
- // orderID 100000013
226
 
227
- $order = Mage::getModel('sales/order')->load(13);
228
  $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
229
 
230
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('shaCryptValidation'));
@@ -233,14 +264,150 @@ class Netresearch_OPS_Test_Controller_PaymentControllerTest
233
  ->will($this->returnValue(true));
234
  $this->replaceByMock('helper', 'ops/payment', $paymentHelperMock);
235
 
236
- $params = array(
237
- 'orderID' => $opsOrderId,
238
- 'SHASIGN' => 'foo'
239
- );
240
 
241
- $this->dispatch('ops/payment/retry', $params);
242
  $this->assertLayoutLoaded();
243
  $this->assertLayoutHandleLoaded('ops_payment_retry');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  }
246
- }
1
  <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * Netresearch_OPS_Test_Controller_PaymentControllerTest
24
+ *
25
+ * @category controller
26
+ * @package Netresearch_OPS
27
+ * @author Thomas Kappel <thomas.kappel@netresearch.de>
28
+ * @author André Herrn <andre.herrn@netresearch.de>
29
+ * @author Paul Siedler <paul.siedler@netresearch.de>
30
+ */
31
  class Netresearch_OPS_Test_Controller_PaymentControllerTest
32
  extends EcomDev_PHPUnit_Test_Case_Controller
33
  {
 
34
  public function setUp()
35
  {
36
  parent::setUp();
42
  'handleException',
43
  'getSHAInSet',
44
  'refillCart'
45
+ )
46
  );
47
  $helperMock->expects($this->any())
48
  ->method('shaCryptValidation')
56
  */
57
  public function testAcceptAction()
58
  {
 
 
 
 
 
59
  $params = array(
60
  'orderID' => '#100000011'
61
  );
62
  $this->dispatch('ops/payment/accept', $params);
63
+ $this->assertRedirectTo('checkout/onepage/success');
64
 
65
  $params = array(
66
  'orderID' => '23'
67
  );
68
  $this->dispatch('ops/payment/accept', $params);
69
+ $this->assertRedirectTo('checkout/onepage/success');
 
70
  }
71
 
72
  /**
74
  */
75
  public function testExceptionAction()
76
  {
77
+ $msg = 'Your order has been registered, but your payment is still marked as pending.';
78
+ $msg.= ' Please have patience until the final status is known.';
79
+
80
+ $orderId = '11';
81
+ $quoteId = '23';
82
+ $incrementId = '#100000011';
83
+
84
+
85
+ // assert order increment id parameter handling
86
+ $params = array('orderID' => $incrementId);
87
 
 
 
 
88
  $this->dispatch('ops/payment/exception', $params);
89
+ $this->assertRedirectTo('checkout/onepage/success');
90
+ $this->assertEquals($orderId, Mage::getSingleton('checkout/session')->getLastOrderId());
91
+
92
+ $message = Mage::getSingleton('checkout/session')->getMessages()->getLastAddedMessage();
93
+ $this->assertEquals('error', $message->getType());
94
+ $this->assertEquals($msg, $message->getText());
95
+
96
+
97
+ // assert entity id parameter handling
98
+ $params = array('orderID' => $quoteId);
99
 
 
 
 
100
  $this->dispatch('ops/payment/exception', $params);
101
+ $this->assertRedirectTo('checkout/onepage/success');
102
+ $this->assertEquals($orderId, Mage::getSingleton('checkout/session')->getLastOrderId());
103
 
104
+ $message = Mage::getSingleton('checkout/session')->getMessages()->getLastAddedMessage();
105
+ $this->assertEquals('error', $message->getType());
106
+ $this->assertEquals($msg, $message->getText());
107
  }
108
 
109
  /**
114
  $routeToDispatch = 'ops/payment/decline';
115
  $params = array();
116
  $this->dispatch($routeToDispatch, $params);
117
+ $this->assertRedirectTo('checkout/onepage');
118
 
119
 
120
  $params = array(
121
  'orderID' => '#100000011'
122
  );
123
  $this->dispatch($routeToDispatch, $params);
124
+ $this->assertRedirectTo('checkout/onepage');
125
 
126
  $params = array(
127
  'orderID' => '23'
128
  );
129
  $this->dispatch($routeToDispatch, $params);
130
+ $this->assertRedirectTo('checkout/onepage');
 
131
  }
132
 
133
  /**
136
  public function testCancelAction()
137
  {
138
  $routeToDispatch = 'ops/payment/cancel';
 
 
 
139
 
140
  $params = array(
141
  'orderID' => '#100000011'
142
  );
143
  $this->dispatch($routeToDispatch, $params);
144
+ $this->assertRedirectTo('checkout/cart');
145
 
146
  $params = array(
147
  'orderID' => '23'
148
  );
149
  $this->dispatch($routeToDispatch, $params);
150
+ $this->assertRedirectTo('checkout/cart');
 
151
  }
152
 
153
  /**
158
  $routeToDispatch = 'ops/payment/continue';
159
  $params = array();
160
  $this->dispatch($routeToDispatch, $params);
161
+ $this->assertRedirectTo('checkout/cart');
162
 
163
 
164
  $params = array(
165
  'orderID' => '#100000011'
166
  );
167
  $this->dispatch($routeToDispatch, $params);
168
+ $this->assertRedirectTo('checkout/cart');
169
 
170
  $params = array(
171
  'orderID' => '23'
172
  );
173
  $this->dispatch($routeToDispatch, $params);
174
+ $this->assertRedirectTo('checkout/cart');
175
 
176
  $params = array(
177
  'orderID' => '#100000011',
178
  'redirect' => 'catalog'
179
  );
180
  $this->dispatch($routeToDispatch, $params);
181
+ $this->assertRedirectTo('/');
182
 
183
  $params = array(
184
  'orderID' => '23',
185
  'redirect' => 'catalog'
186
  );
187
  $this->dispatch($routeToDispatch, $params);
188
+ $this->assertRedirectTo('/');
 
 
189
  }
190
 
191
  /**
210
  $message = Mage::getSingleton('core/session')->getMessages()->getLastAddedMessage();
211
  $this->assertNotNull($message);
212
  $this->assertEquals($message->getText(), 'Hash not valid');
 
213
  }
214
 
215
  /**
219
  {
220
 
221
  // test 1: hash valid, order can not be retried
222
+ // orderID 100000012 - status 5
223
+ $order = Mage::getModel('sales/order')->load(12);
224
  $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
225
 
226
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('shaCryptValidation'));
229
  ->will($this->returnValue(true));
230
  $this->replaceByMock('helper', 'ops/payment', $paymentHelperMock);
231
 
232
+ $orderHelperMock = $this->getHelperMock('ops/order', array('getOrder'));
233
+ $orderHelperMock->expects($this->any())
234
+ ->method('getOrder')
235
+ ->will($this->returnValue($order));
236
+ $this->replaceByMock('helper', 'ops/order', $orderHelperMock);
237
+
238
+ $params = array('orderID' => $opsOrderId, 'SHASIGN' => 'foo');
239
  $this->dispatch('ops/payment/retry', $params);
240
+
241
  $this->assertRedirectTo('/');
242
+
243
  $message = Mage::getSingleton('core/session')->getMessages()->getLastAddedMessage();
244
  $this->assertNotNull($message);
245
  $this->assertEquals(
246
  $message->getText(), 'Not possible to reenter the payment details for order ' . $order->getIncrementId()
247
  );
 
248
  }
249
 
250
  /**
252
  */
253
  public function testRepayActionWithSuccess()
254
  {
255
+ // test 31: order is fine
256
+ // orderID 100000011
257
 
258
+ $order = Mage::getModel('sales/order')->load(11);
259
  $opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
260
 
261
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('shaCryptValidation'));
264
  ->will($this->returnValue(true));
265
  $this->replaceByMock('helper', 'ops/payment', $paymentHelperMock);
266
 
267
+ $this->dispatch('ops/payment/retry', $paymentHelperMock->validateOrderForReuse($opsOrderId,1));
 
 
 
268
 
 
269
  $this->assertLayoutLoaded();
270
  $this->assertLayoutHandleLoaded('ops_payment_retry');
271
+ }
272
+
273
+ /**
274
+ * @test
275
+ */
276
+ public function placeformActionWithoutSuccess()
277
+ {
278
+ $this->dispatch('ops/payment/placeForm');
279
+ $this->assertRedirectTo('checkout/cart');
280
+ }
281
+
282
+ /**
283
+ * @loadFixture ../../../var/fixtures/orders.yaml
284
+ * @test
285
+ */
286
+ public function placeformActionWithSuccess()
287
+ {
288
+ $quoteModelMock = $this->getModelMock('sales/quote', array('save'));
289
+ $quoteModelMock->expects($this->any())
290
+ ->method('save')
291
+ ->will($this->returnSelf());
292
+
293
+ $checkoutSessionMock = $this->getModelMock('checkout/session', array('getLastRealOrderId', 'getQuote'));
294
+ $checkoutSessionMock->expects($this->any())
295
+ ->method('getLastRealOrderId')
296
+ ->will($this->returnValue(100000013));
297
+ $checkoutSessionMock->expects($this->any())
298
+ ->method('getQuote')
299
+ ->will($this->returnValue($quoteModelMock));
300
+ $this->replaceByMock('singleton', 'checkout/session', $checkoutSessionMock);
301
+
302
+ $this->dispatch('ops/payment/placeForm');
303
+
304
+ $this->assertLayoutLoaded();
305
+ $this->assertLayoutHandleLoaded('ops_payment_placeform');
306
+ }
307
+
308
+ /**
309
+ * @loadFixture ../../../var/fixtures/orders.yaml
310
+ * @test
311
+ */
312
+ public function updatePaymentAndPlaceFormActionWithException()
313
+ {
314
+ $orderId = 100000013;
315
 
316
+ /** @var Mage_Sales_Model_Order $order */
317
+ $order = Mage::getModel('sales/order');
318
+ $order->loadByIncrementId($orderId);
319
+
320
+ $orderHelperMock = $this->getHelperMock('ops/order', array('getOrder'));
321
+ $orderHelperMock->expects($this->any())
322
+ ->method('getOrder')
323
+ ->will($this->returnValue($order));
324
+ $this->replaceByMock('helper', 'ops/order', $orderHelperMock);
325
+
326
+
327
+ $this->dispatch('ops/payment/updatePaymentAndPlaceForm', array('orderID' => $orderId));
328
+ $this->assertRedirectTo('checkout/cart');
329
+
330
+ /** @var Mage_Core_Model_Session $test */
331
+ $test = Mage::getSingleton('core/session');
332
+ $messages = $test->getMessages()->count();
333
+ $this->assertEquals(1, $messages);
334
+ $test->getMessages()->clear();
335
+ }
336
+
337
+ /**
338
+ * @loadFixture orders.yaml
339
+ * @test
340
+ */
341
+ public function updatePaymentAndPlaceFormActionWithSuccess()
342
+ {
343
+ $orderId = '#100000013';
344
+ $params = array(
345
+ 'orderID' => $orderId,
346
+ 'payment' => array(
347
+ 'method' => 'ops_iDeal',
348
+ 'ops_iDeal' => array('info' => 'foo', 'info2' => 'bar')
349
+ )
350
+ );
351
+
352
+ Mage::app()->getRequest()->setParams($params);
353
+ Mage::getConfig()->setNode('stores/default/payment/ops_iDeal/active', 1);
354
+ $this->mockSession('checkout/session', array());
355
+
356
+ $this->dispatch('ops/payment/updatePaymentAndPlaceForm');
357
+
358
+ $this->assertRedirectToUrlContains('placeForm');
359
+
360
+ /** @var Mage_Core_Model_Session $test */
361
+ $test = Mage::getSingleton('core/session');
362
+ $messages = $test->getMessages()->count();
363
+ $this->assertEquals(0, $messages);
364
+ }
365
+
366
+ /**
367
+ * @loadFixture ../../../var/fixtures/orders.yaml
368
+ * @test
369
+ */
370
+ public function updatePaymentAndPlaceFormActionWithSuccessForDirectDebit()
371
+ {
372
+ $this->markTestIncomplete("DirectDebit needs a general rework - INGRC-34");
373
+
374
+ $orderId = 100000014;
375
+ Mage::app()->getRequest()->setParam('orderID', $orderId);
376
+ Mage::app()->getRequest()->setParam('payment', array('method' => 'ops_directDebit'));
377
+
378
+ /** @var Mage_Sales_Model_Order $orderModelMock */
379
+ $orderModelMock = $this->getModelMock('sales/order', array('save', 'place'));
380
+ $orderModelMock->expects($this->any())
381
+ ->method('save')
382
+ ->will($this->returnSelf());
383
+ $orderModelMock->expects($this->any())
384
+ ->method('place')
385
+ ->will($this->returnSelf());
386
+
387
+ $orderHelperMock = $this->getHelperMock('ops/order', array('getOrder'));
388
+ $orderHelperMock->expects($this->any())
389
+ ->method('getOrder')
390
+ ->will($this->returnValue($orderModelMock->loadByIncrementId($orderId)));
391
+ $this->replaceByMock('helper', 'ops/order', $orderHelperMock);
392
+
393
+ $quoteModelMock = $this->getModelMock('sales/quote', array('save'));
394
+ $quoteModelMock->expects($this->any())
395
+ ->method('save')
396
+ ->will($this->returnSelf());
397
+ $this->replaceByMock('model', 'sales/quote', $quoteModelMock);
398
+
399
+ $quotePaymentModelMock = $this->getModelMock('sales/quote_payment', array('save'));
400
+ $quotePaymentModelMock->expects($this->any())
401
+ ->method('save')
402
+ ->will($this->returnSelf());
403
+ $this->replaceByMock('model', 'sales/quote_payment', $quotePaymentModelMock);
404
+
405
+ $this->dispatch('ops/payment/updatePaymentAndPlaceForm');
406
+ $this->assertRedirectToUrlContains('onepage/success');
407
+
408
+ /** @var Mage_Core_Model_Session $test */
409
+ $test = Mage::getSingleton('core/session');
410
+ $messages = $test->getMessages()->count();
411
+ $this->assertEquals(0, $messages);
412
  }
413
+ }
app/code/community/Netresearch/OPS/Test/Controller/PaymentControllerTest/fixtures/orders.yaml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tables:
2
+ core/config_data:
3
+ - config_id: 500
4
+ path: 'payment/ops_iDeal/active'
5
+ value: 1
6
+
7
+ sales/order:
8
+ - entity_id: 13
9
+ increment_id: 100000013
10
+ shipping_address_id: 43
11
+ base_grand_total: 177.55
12
+ grand_total: 177.55
13
+ currency: 'EUR'
14
+ customer_gender: 1
15
+ shipping_method: 'flatrate_flatrate'
16
+ customer_email: 'willi.usa.customer@trash-mail.com'
17
+ state: 'processing'
18
+ status: 'processing'
19
+ quote_id: 25
20
+ store_id: 0
21
+
22
+ sales/order_payment:
23
+ - entity_id: 3
24
+ parent_id: 13
25
+ additional_information: a:3:{s:2:"PM";s:16:"Bank transfer DE";s:5:"BRAND";s:16:"Bank transfer DE";s:6:"status";s:1:"0";}
26
+ method: 'ops_bankTransfer'
app/code/community/Netresearch/OPS/Test/Helper/AddressTest.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Netresearch_OPS_Test_Helper_AddressTest extends EcomDev_PHPUnit_Test_Case
3
+ {
4
+
5
+ /**
6
+ * @param string $street
7
+ *
8
+ * @test
9
+ * @loadExpectation
10
+ * @dataProvider dataProvider
11
+ */
12
+ public function splitStreet($street)
13
+ {
14
+ /** @var Netresearch_OPS_Helper_Address $helper */
15
+ $helper = Mage::helper('ops/address');
16
+ $split = $helper->splitStreet($street);
17
+ $expected = $this->expected('auto')->getData();
18
+
19
+ $this->assertEquals($expected, $split);
20
+ }
21
+ }
22
+
app/code/community/Netresearch/OPS/Test/Helper/AddressTest/expectations/splitStreet.yaml ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ thunstrasse_39:
2
+ street_name: "Thunstraße"
3
+ street_number: "39"
4
+ supplement: ""
5
+ nonnenstrasse:
6
+ street_name: "Nonnenstraße"
7
+ street_number: ""
8
+ supplement: ""
9
+ tulpenweg:
10
+ street_name: "Tulpenweg"
11
+ street_number: ""
12
+ supplement: ""
13
+ tulpenweg_:
14
+ street_name: "Tulpenweg"
15
+ street_number: ""
16
+ supplement: ""
17
+ nonnenstrasse_11c:
18
+ street_name: "Nonnenstraße"
19
+ street_number: "11c"
20
+ supplement: ""
21
+ nonnenstrasse11c:
22
+ street_name: "Nonnenstraße11c"
23
+ street_number: ""
24
+ supplement: ""
25
+ nonnenstrasse_44_46:
26
+ street_name: "Nonnenstraße"
27
+ street_number: "44-46"
28
+ supplement: ""
29
+ nonnenstrasse_44_46_haus_c:
30
+ street_name: "Nonnenstraße"
31
+ street_number: "44-46"
32
+ supplement: "Haus C"
33
+ leipziger_strasse_117_zimmer_321:
34
+ street_name: "Leipziger Straße"
35
+ street_number: "117"
36
+ supplement: "Zimmer 321"
37
+ lilienweg_14:
38
+ street_name: "Lilienweg"
39
+ street_number: "14"
40
+ supplement: ""
41
+ lilienweg_4:
42
+ street_name: "Lilienweg"
43
+ street_number: "4"
44
+ supplement: ""
45
+ richard_strauss_strasse_4:
46
+ street_name: "Richard Strauß Straße"
47
+ street_number: "4"
48
+ supplement: ""
49
+ mittelstrasse_6:
50
+ street_name: "Mittelstrasse"
51
+ street_number: "6"
52
+ supplement: ""
53
+ hauptstr_6:
54
+ street_name: "Hauptstr."
55
+ street_number: "6"
56
+ supplement: ""
57
+ alte_dorfstraße_4:
58
+ street_name: "Alte Dorfstraße"
59
+ street_number: "4"
60
+ supplement: ""
61
+ alfons_mitnacht_str_5:
62
+ street_name: "Alfons-Mitnacht Str."
63
+ street_number: "5"
64
+ supplement: ""
65
+ seilerweg_5:
66
+ street_name: "Seilerweg"
67
+ street_number: "5"
68
+ supplement: ""
69
+ aegirsvej_4:
70
+ street_name: "Ægirsvej"
71
+ street_number: "4"
72
+ supplement: ""
73
+ hilgartshausener_hauptstrasse_49:
74
+ street_name: "Hilgartshausener Hauptstraße"
75
+ street_number: "49"
76
+ supplement: ""
77
+ erich_weinert_strasse_87:
78
+ street_name: "erich-weinert-strasse"
79
+ street_number: "87"
80
+ supplement: ""
81
+ m4_8:
82
+ street_name: "M4"
83
+ street_number: "8"
84
+ supplement: ""
85
+ strasse_1:
86
+ street_name: "1.Straße"
87
+ street_number: ""
88
+ supplement: ""
89
+ wiesencenter_bayreuther_strasse_108_2_stock:
90
+ street_name: "Bayreuther Str."
91
+ street_number: "108"
92
+ supplement: "Wiesentcenter 2. Stock"
93
+ neue_strasse_28_1_stock:
94
+ street_name: "Neue Straße"
95
+ street_number: "28"
96
+ supplement: "1.Stock"
97
+ kirchengasse_7_1_stock_zi_4:
98
+ street_name: "Kirchengasse"
99
+ street_number: "7"
100
+ supplement: "1. Stock Zi.Nr. 4"
101
+ pallaswiesenstr_57_App_235:
102
+ street_name: "Pallaswiesenstr."
103
+ street_number: "57"
104
+ supplement: "App. 235"
105
+ neue_str_55_whg_3:
106
+ street_name: "Neue Str."
107
+ street_number: "55"
108
+ supplement: "Whg. 3"
109
+ apenrader_str_16_whg_3:
110
+ street_name: "Apenrader Str."
111
+ street_number: "16"
112
+ supplement: "Whg. 3"
113
+ d_6_2:
114
+ street_name: "D 6"
115
+ street_number: "2"
116
+ supplement: ""
117
+ r4_7:
118
+ street_name: "R4"
119
+ street_number: "7"
120
+ supplement: ""
121
+ lieblgasse_2_41_7_21:
122
+ street_name: "Lieblgasse"
123
+ street_number: "2/41/7/21"
124
+ supplement: ""
125
+ 1752_oto_iwatsukiku:
126
+ street_name: "Oto"
127
+ street_number: "1752"
128
+ supplement: "Iwatsukiku"
129
+ 3940_radio_road_unit_110:
130
+ street_name: "Radio Road"
131
+ street_number: "3940"
132
+ supplement: "Unit 110"
133
+ 1101_madison_st_600:
134
+ street_name: "Madison St"
135
+ street_number: "1101"
136
+ supplement: "# 600"
137
+ 1523_6th_ave:
138
+ street_name: "6th Ave"
139
+ street_number: "1523"
140
+ supplement: ""
141
+ 81_quai_charles_de_gaulle:
142
+ street_name: "quai Charles de Gaulle"
143
+ street_number: "81"
144
+ supplement: ""
145
+ nafarroa_kalea_9:
146
+ street_name: "Nafarroa Kalea"
147
+ street_number: "9"
148
+ supplement: ""
149
+ av_libertad_53:
150
+ street_name: "Av. Libertad"
151
+ street_number: "53"
152
+ supplement: ""
153
+ vanzada_errepidea_1:
154
+ street_name: "vanzada Errepidea"
155
+ street_number: "1"
156
+ supplement: ""
157
+ 88_century_blvd_pudong:
158
+ street_name: "Century Blvd"
159
+ street_number: "88"
160
+ supplement: "Pudong"
161
+ mannerheimintie_13A2:
162
+ street_name: "Mannerheimintie"
163
+ street_number: "13A2"
164
+ supplement: ""
165
+ mannerheimintie_13_A2:
166
+ street_name: "Mannerheimintie"
167
+ street_number: "13 A2"
168
+ supplement: ""
169
+ mannerheimintie_13_A_2:
170
+ street_name: "Mannerheimintie"
171
+ street_number: "13 A 2"
172
+ supplement: ""
173
+ 7_place_de_l_hotel_de_ville:
174
+ street_name: "place de l'Hôtel de Ville"
175
+ street_number: "7"
176
+ supplement: ""
177
+ 488_west_57_street:
178
+ street_name: "West 57 Street"
179
+ street_number: "488"
180
+ supplement: ""
181
+ 574_e_10th_street:
182
+ street_name: "E 10th Street"
183
+ street_number: "574"
184
+ supplement: ""
185
+ neuhof_13_15:
186
+ street_name: "Neuhof"
187
+ street_number: "13 / 15"
188
+ supplement: ""
189
+ no_133_shangdong_st:
190
+ street_name: "Shangdong St."
191
+ street_number: "133"
192
+ supplement: ""
193
+ 56_route_de_geneve:
194
+ street_name: "route de Genève"
195
+ street_number: "56"
196
+ supplement: ""
197
+ no_59_yangfangdian_xi:
198
+ street_name: "Yangfangdian Xi"
199
+ street_number: "59"
200
+ supplement: ""
201
+ 514_3_daechi_dong:
202
+ street_name: "Daechi-Dong"
203
+ street_number: "514-3"
204
+ supplement: ""
205
+ san_millan_3_10:
206
+ street_name: "San Millán"
207
+ street_number: "3-10"
208
+ supplement: ""
209
+
app/code/community/Netresearch/OPS/Test/Helper/AddressTest/providers/splitStreet.yaml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ thunstrasse_39:
2
+ - "Thunstraße 39"
3
+ nonnenstrasse:
4
+ - "Nonnenstraße"
5
+ tulpenweg:
6
+ - "Tulpenweg"
7
+ tulpenweg_:
8
+ - "Tulpenweg"
9
+ nonnenstrasse_11c:
10
+ - "Nonnenstraße 11c"
11
+ nonnenstrasse11c:
12
+ - "Nonnenstraße11c"
13
+ nonnenstrasse_44_46:
14
+ - "Nonnenstraße 44-46"
15
+ nonnenstrasse_44_46_haus_c:
16
+ - "Nonnenstraße 44-46 Haus C"
17
+ leipziger_strasse_117_zimmer_321:
18
+ - "Leipziger Straße 117, Zimmer 321"
19
+ lilienweg_14:
20
+ - "Lilienweg 14"
21
+ lilienweg_4:
22
+ - "Lilienweg 4"
23
+ richard_strauss_strasse_4:
24
+ - "Richard Strauß Straße 4"
25
+ mittelstrasse_6:
26
+ - "Mittelstrasse 6"
27
+ hauptstr_6:
28
+ - "Hauptstr. 6"
29
+ alte_dorfstraße_4:
30
+ - "Alte Dorfstraße 4"
31
+ alfons_mitnacht_str_5:
32
+ - "Alfons-Mitnacht Str. 5"
33
+ seilerweg_5:
34
+ - "Seilerweg 5"
35
+ aegirsvej_4:
36
+ - "Ægirsvej 4"
37
+ hilgartshausener_hauptstrasse_49:
38
+ - "Hilgartshausener Hauptstraße 49"
39
+ erich_weinert_strasse_87:
40
+ - "erich-weinert-strasse 87"
41
+ m4_8:
42
+ - "M4 8"
43
+ strasse_1:
44
+ - "1.Straße"
45
+ wiesencenter_bayreuther_strasse_108_2_stock:
46
+ - "Wiesentcenter, Bayreuther Str. 108, 2. Stock"
47
+ neue_strasse_28_1_stock:
48
+ - "Neue Straße 28 / 1.Stock"
49
+ kirchengasse_7_1_stock_zi_4:
50
+ - "Kirchengasse 7, 1. Stock Zi.Nr. 4"
51
+ pallaswiesenstr_57_App_235:
52
+ - "Pallaswiesenstr. 57 App. 235"
53
+ neue_str_55_whg_3:
54
+ - "Neue Str. 55, Whg. 3"
55
+ apenrader_str_16_whg_3:
56
+ - "Apenrader Str. 16 / Whg. 3"
57
+ d_6_2:
58
+ - "D 6, 2"
59
+ r4_7:
60
+ - "R4, 7"
61
+ lieblgasse_2_41_7_21:
62
+ - "Lieblgasse 2/41/7/21"
63
+ 1752_oto_iwatsukiku:
64
+ - "1752 Oto, Iwatsukiku"
65
+ 3940_radio_road_unit_110:
66
+ - "3940 Radio Road, Unit 110"
67
+ 1101_madison_st_600:
68
+ - "1101 Madison St # 600"
69
+ 1523_6th_ave:
70
+ - "1523 6th Ave"
71
+ 81_quai_charles_de_gaulle:
72
+ - "81, quai Charles de Gaulle"
73
+ nafarroa_kalea_9:
74
+ - "Nafarroa Kalea 9"
75
+ av_libertad_53:
76
+ - "Av. Libertad 53"
77
+ vanzada_errepidea_1:
78
+ - "vanzada Errepidea 1"
79
+ 88_century_blvd_pudong:
80
+ - "88 Century Blvd, Pudong"
81
+ mannerheimintie_13A2:
82
+ - "Mannerheimintie 13A2"
83
+ mannerheimintie_13_A2:
84
+ - "Mannerheimintie 13 A2"
85
+ mannerheimintie_13_A_2:
86
+ - "Mannerheimintie 13 A 2"
87
+ 7_place_de_l_hotel_de_ville:
88
+ - "7, place de l'Hôtel de Ville"
89
+ 488_west_57_street:
90
+ - "488 West 57 Street"
91
+ 574_e_10th_street:
92
+ - "574 E 10th Street"
93
+ neuhof_13_15:
94
+ - "Neuhof 13 / 15"
95
+ no_133_shangdong_st:
96
+ - "No. 133 Shangdong St."
97
+ 56_route_de_geneve:
98
+ - "56, route de Genève"
99
+ no_59_yangfangdian_xi:
100
+ - "No. 59 Yangfangdian Xi"
101
+ 514_3_daechi_dong:
102
+ - "514-3, Daechi-Dong"
103
+ san_millan_3_10:
104
+ - "San Millán, 3-10"
105
+
app/code/community/Netresearch/OPS/Test/Helper/AliasTest.php CHANGED
@@ -45,44 +45,6 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
45
  $this->replaceByMock('singleton', 'checkout/type_onepage', $onepage);
46
  }
47
 
48
- /**
49
- * @loadFixture ../../../var/fixtures/orders.yaml
50
- */
51
- public function testGetAliasWithoutAdditionalInformation()
52
- {
53
- $aliasHelperMock = $this->getHelperMock('ops/alias', array('isAdminSession'));
54
- $aliasHelperMock->expects($this->any())
55
- ->method('isAdminSession')
56
- ->will($this->returnValue(false));
57
- $quote = Mage::getModel('sales/quote')->load(11);
58
-
59
- $alias = $aliasHelperMock->getAlias($quote);
60
-
61
- $this->assertTrue(
62
- strlen($aliasHelperMock->getAlias($quote)) <= 16
63
- );
64
- $this->assertTrue(
65
- strpos($aliasHelperMock->getAlias($quote), "99") != false
66
- );
67
- }
68
-
69
- public function testGetAliasWithAdditionalInformation()
70
- {
71
- $quote = new Varien_Object();
72
- $payment = new Varien_Object();
73
- $payment->setAdditionalInformation(array('alias' => 'testAlias'));
74
- $quote->setPayment($payment);
75
-
76
- $aliasHelperMock = $this->getHelperMock('ops/alias', array('isAdminSession'));
77
- $aliasHelperMock->expects($this->any())
78
- ->method('isAdminSession')
79
- ->will($this->returnValue(false));
80
-
81
- $this->assertEquals(
82
- 'testAlias', $aliasHelperMock->getAlias($quote)
83
- );
84
-
85
- }
86
 
87
 
88
  public function testGetOpsCode()
@@ -101,10 +63,12 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
101
  $quote = Mage::getModel('sales/quote');
102
  $this->assertEquals(
103
  null,
104
- $this->_helper->saveAlias(array(
 
105
  'OrderID' => 4711,
106
  'StorePermanently' => 'N'
107
- ))
 
108
  );
109
  }
110
 
@@ -163,7 +127,7 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
163
 
164
  $oldAliasId = $alias->getId();
165
  $alias = $this->_helper->saveAlias($aliasData, $quote);
166
- $this->assertNotEquals($oldAliasId, $alias->getId());
167
  }
168
 
169
  /**
@@ -218,11 +182,14 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
218
  $aliasData['Alias_StorePermanently'] = 'Y';
219
 
220
  $updatedAlias = $this->_helper->saveAlias($aliasData);
221
- $this->assertEquals(4711,$updatedAlias->getAlias());
222
- $this->assertEquals('Mastercard',$updatedAlias->getBrand());
223
- $this->assertEquals('xxxx01111',$updatedAlias->getPseudoAccountOrCcNo());
224
- $this->assertEquals('1213',$updatedAlias->getExpirationDate());
225
- $this->assertEquals('Max Power',$updatedAlias->getCardHolder());
 
 
 
226
 
227
  }
228
 
@@ -230,10 +197,10 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
230
  * @loadFixture ../../../var/fixtures/aliases.yaml
231
  * @loadFixture ../../../var/fixtures/orders.yaml
232
  */
233
- public function testSaveNewAlias()
234
  {
235
  $reflection_class = new ReflectionClass("Netresearch_OPS_Helper_Alias");
236
- $method = $reflection_class->getMethod("saveNewAlias");
237
  $method->setAccessible(true);
238
 
239
  $quote = Mage::getModel('sales/quote')->load(10);
@@ -263,7 +230,7 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
263
  $alias = $method->invoke($aliasHelper, $quote, $aliasData);
264
  $this->assertEquals('TestAlias', $alias->getAlias());
265
  $this->assertEquals('12.12.0012', $alias->getExpirationDate());
266
- $this->assertNull($alias->getCardHolder());
267
  $this->assertEquals(Netresearch_OPS_Model_Alias_State::PENDING, $alias->getState());
268
 
269
  $aliasData = array(
@@ -282,6 +249,70 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
282
  $this->assertEquals(Netresearch_OPS_Model_Alias_State::PENDING, $alias->getState());
283
  }
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  /**
286
  * @loadFixture ../../../var/fixtures/aliases.yaml
287
  * @loadFixture ../../../var/fixtures/orders.yaml
@@ -560,7 +591,7 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
560
  'Card_CardHolderName' => 'Max Muster'
561
  );
562
 
563
- $method->invoke($helperObject, $quote,$aliasData);
564
  $updatedAlias = Mage::getModel('ops/alias')->load(7);
565
  $this->assertEquals($aliasData['Card_CardHolderName'], $updatedAlias->getCardHolder());
566
 
@@ -660,8 +691,8 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
660
  $quote->setBillingAddress($this->getAddressData());
661
  $quote->setShippingAddress($this->getAddressData());
662
  $quote->getPayment()->setAdditionalInformation('alias', '4714');
663
- $quote->getPayment()->setAdditionalInformation('opsAliasId','11111');
664
- $quote->getPayment()->setAdditionalInformation('userIsRegistering',true);
665
  $quote->setCheckoutMethod(Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER);
666
  $quote->setStoreId(null);
667
  $billingAddressHash = Mage::helper('ops/alias')->generateAddressHash($quote->getBillingAddress());
@@ -673,10 +704,10 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
673
  ->addFieldToFilter('shipping_address_hash', $shippingAddressHash)
674
  ->getFirstItem();
675
 
676
- Mage::helper('ops/alias')->setAliasToActiveAfterUserRegisters($order,$quote);
677
  $testAlias = Mage::getModel('ops/alias')->load($oldAlias->getId());
678
  $this->assertEquals(Netresearch_OPS_Model_Alias_State::ACTIVE, $testAlias->getState());
679
- $this->assertEquals(123,$testAlias->getCustomerId());
680
  }
681
 
682
  /**
@@ -698,7 +729,7 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
698
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment);
699
 
700
  $this->assertTrue(is_array($payment->getAdditionalInformation()));
701
- $this->assertFalse(array_key_exists('cvc' ,$payment->getAdditionalInformation()));
702
  $this->assertFalse(array_key_exists('storedOPSId', $payment->getAdditionalInformation()));
703
 
704
  $quote = Mage::getModel('sales/quote')->load(11);
@@ -714,7 +745,7 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
714
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true);
715
 
716
  $this->assertTrue(is_array($payment->getAdditionalInformation()));
717
- $this->assertFalse(array_key_exists('cvc' ,$payment->getAdditionalInformation()));
718
  $this->assertTrue(array_key_exists('storedOPSId', $payment->getAdditionalInformation()));
719
  }
720
 
@@ -724,8 +755,7 @@ class Netresearch_OPS_Test_Helper_AliasTest extends EcomDev_PHPUnit_Test_Case
724
  {
725
  $payment = $this->getModelMock('sales/quote_payment', array('save'));
726
  $payment->expects($this->once())
727
- ->method('save')
728
- ;
729
 
730
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true, true);
731
 
45
  $this->replaceByMock('singleton', 'checkout/type_onepage', $onepage);
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
 
50
  public function testGetOpsCode()
63
  $quote = Mage::getModel('sales/quote');
64
  $this->assertEquals(
65
  null,
66
+ $this->_helper->saveAlias(
67
+ array(
68
  'OrderID' => 4711,
69
  'StorePermanently' => 'N'
70
+ )
71
+ )
72
  );
73
  }
74
 
127
 
128
  $oldAliasId = $alias->getId();
129
  $alias = $this->_helper->saveAlias($aliasData, $quote);
130
+ $this->assertEquals($oldAliasId, $alias->getId());
131
  }
132
 
133
  /**
182
  $aliasData['Alias_StorePermanently'] = 'Y';
183
 
184
  $updatedAlias = $this->_helper->saveAlias($aliasData);
185
+
186
+
187
+
188
+ $this->assertEquals(4711, $updatedAlias->getAlias());
189
+ $this->assertEquals('Mastercard', $updatedAlias->getBrand());
190
+ $this->assertEquals('xxxx01111', $updatedAlias->getPseudoAccountOrCcNo());
191
+ $this->assertEquals('1213', $updatedAlias->getExpirationDate());
192
+ $this->assertEquals('Max Power', $updatedAlias->getCardHolder());
193
 
194
  }
195
 
197
  * @loadFixture ../../../var/fixtures/aliases.yaml
198
  * @loadFixture ../../../var/fixtures/orders.yaml
199
  */
200
+ public function testSaveNewAliasFromQuote()
201
  {
202
  $reflection_class = new ReflectionClass("Netresearch_OPS_Helper_Alias");
203
+ $method = $reflection_class->getMethod("saveNewAliasFromQuote");
204
  $method->setAccessible(true);
205
 
206
  $quote = Mage::getModel('sales/quote')->load(10);
230
  $alias = $method->invoke($aliasHelper, $quote, $aliasData);
231
  $this->assertEquals('TestAlias', $alias->getAlias());
232
  $this->assertEquals('12.12.0012', $alias->getExpirationDate());
233
+ $this->assertEquals('Foo', $alias->getCardHolder());
234
  $this->assertEquals(Netresearch_OPS_Model_Alias_State::PENDING, $alias->getState());
235
 
236
  $aliasData = array(
249
  $this->assertEquals(Netresearch_OPS_Model_Alias_State::PENDING, $alias->getState());
250
  }
251
 
252
+
253
+
254
+ /**
255
+ * @loadFixture ../../../var/fixtures/aliases.yaml
256
+ * @loadFixture ../../../var/fixtures/orders.yaml
257
+ */
258
+ public function testSaveNewAliasFromOrder()
259
+ {
260
+ $reflection_class = new ReflectionClass("Netresearch_OPS_Helper_Alias");
261
+ $method = $reflection_class->getMethod("saveNewAliasFromOrder");
262
+ $method->setAccessible(true);
263
+
264
+ $order = Mage::getModel('sales/order')->load(11);
265
+
266
+
267
+
268
+ $aliasData = array(
269
+ 'alias' => 'TestAlias',
270
+ 'brand' => 'Visa',
271
+ 'cardno' => '12345678',
272
+ 'cn' => 'Foo',
273
+ 'Alias_StorePermanently' => 'Y',
274
+ 'ed' => '12.12.0012'
275
+ );
276
+
277
+
278
+ $aliasHelper = Mage::helper('ops/alias');
279
+ $alias = $method->invoke($aliasHelper, $order, $aliasData);
280
+ $this->assertEquals('TestAlias', $alias->getAlias());
281
+ $this->assertEquals('12.12.0012', $alias->getExpirationDate());
282
+ $this->assertEquals('Foo', $alias->getCardHolder());
283
+ $this->assertEquals(Netresearch_OPS_Model_Alias_State::ACTIVE, $alias->getState());
284
+
285
+ $aliasData = array(
286
+ 'alias' => 'TestAlias',
287
+ 'brand' => 'Visa',
288
+ 'cardno' => '12345678',
289
+ 'Alias_StorePermanently' => 'Y',
290
+ 'ed' => '12.12.0012',
291
+ 'cn' => null
292
+ );
293
+ $aliasHelper = Mage::helper('ops/alias');
294
+ $alias = $method->invoke($aliasHelper, $order, $aliasData);
295
+ $this->assertEquals('TestAlias', $alias->getAlias());
296
+ $this->assertEquals('12.12.0012', $alias->getExpirationDate());
297
+ $this->assertNull($alias->getCardHolder());
298
+ $this->assertEquals(Netresearch_OPS_Model_Alias_State::ACTIVE, $alias->getState());
299
+
300
+ $aliasData = array(
301
+ 'alias' => 'TestAlias',
302
+ 'brand' => 'Visa',
303
+ 'cardno' => '12345678',
304
+ 'Alias_StorePermanently' => 'Y',
305
+ 'ed' => '12.12.0012',
306
+ 'cn' => ''
307
+ );
308
+ $aliasHelper = Mage::helper('ops/alias');
309
+ $alias = $method->invoke($aliasHelper, $order, $aliasData);
310
+ $this->assertEquals('TestAlias', $alias->getAlias());
311
+ $this->assertEquals('12.12.0012', $alias->getExpirationDate());
312
+ $this->assertEquals('', $alias->getCardHolder());
313
+ $this->assertEquals(Netresearch_OPS_Model_Alias_State::ACTIVE, $alias->getState());
314
+ }
315
+
316
  /**
317
  * @loadFixture ../../../var/fixtures/aliases.yaml
318
  * @loadFixture ../../../var/fixtures/orders.yaml
591
  'Card_CardHolderName' => 'Max Muster'
592
  );
593
 
594
+ $method->invoke($helperObject, $quote, $aliasData);
595
  $updatedAlias = Mage::getModel('ops/alias')->load(7);
596
  $this->assertEquals($aliasData['Card_CardHolderName'], $updatedAlias->getCardHolder());
597
 
691
  $quote->setBillingAddress($this->getAddressData());
692
  $quote->setShippingAddress($this->getAddressData());
693
  $quote->getPayment()->setAdditionalInformation('alias', '4714');
694
+ $quote->getPayment()->setAdditionalInformation('opsAliasId', '11111');
695
+ $quote->getPayment()->setAdditionalInformation('userIsRegistering', true);
696
  $quote->setCheckoutMethod(Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER);
697
  $quote->setStoreId(null);
698
  $billingAddressHash = Mage::helper('ops/alias')->generateAddressHash($quote->getBillingAddress());
704
  ->addFieldToFilter('shipping_address_hash', $shippingAddressHash)
705
  ->getFirstItem();
706
 
707
+ Mage::helper('ops/alias')->setAliasToActiveAfterUserRegisters($order, $quote);
708
  $testAlias = Mage::getModel('ops/alias')->load($oldAlias->getId());
709
  $this->assertEquals(Netresearch_OPS_Model_Alias_State::ACTIVE, $testAlias->getState());
710
+ $this->assertEquals(123, $testAlias->getCustomerId());
711
  }
712
 
713
  /**
729
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment);
730
 
731
  $this->assertTrue(is_array($payment->getAdditionalInformation()));
732
+ $this->assertFalse(array_key_exists('cvc', $payment->getAdditionalInformation()));
733
  $this->assertFalse(array_key_exists('storedOPSId', $payment->getAdditionalInformation()));
734
 
735
  $quote = Mage::getModel('sales/quote')->load(11);
745
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true);
746
 
747
  $this->assertTrue(is_array($payment->getAdditionalInformation()));
748
+ $this->assertFalse(array_key_exists('cvc', $payment->getAdditionalInformation()));
749
  $this->assertTrue(array_key_exists('storedOPSId', $payment->getAdditionalInformation()));
750
  }
751
 
755
  {
756
  $payment = $this->getModelMock('sales/quote_payment', array('save'));
757
  $payment->expects($this->once())
758
+ ->method('save');
 
759
 
760
  Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true, true);
761
 
app/code/community/Netresearch/OPS/Test/Helper/DataTest.php CHANGED
@@ -97,13 +97,11 @@ class Netresearch_OPS_Test_Helper_DataTest extends EcomDev_PHPUnit_Test_Case
97
  public function sendNoMail()
98
  {
99
  $documentMock = $this->getMockBuilder('Mage_Sales_Model_Order_Shipment')
100
- ->setMethods(['getEmailSent'])
101
- ->getMock()
102
- ;
103
  $documentMock
104
  ->expects($this->never())
105
- ->method('getEmailSent')
106
- ;
107
 
108
  Mage::helper('ops/data')->sendTransactionalEmail($documentMock);
109
  }
@@ -113,23 +111,22 @@ class Netresearch_OPS_Test_Helper_DataTest extends EcomDev_PHPUnit_Test_Case
113
  */
114
  public function sendOrderEmail()
115
  {
116
- $orderMock = $this->getModelMock('sales/order', [
 
117
  'getEmailSent', 'getCanSendNewEmailFlag', 'sendNewOrderEmail'
118
- ]);
 
119
  $orderMock
120
  ->expects($this->exactly(3))
121
  ->method('getEmailSent')
122
- ->willReturnOnConsecutiveCalls(true, false, false)
123
- ;
124
  $orderMock
125
  ->expects($this->exactly(2))
126
  ->method('getCanSendNewEmailFlag')
127
- ->willReturnOnConsecutiveCalls(false, true)
128
- ;
129
  $orderMock
130
  ->expects($this->once())
131
- ->method('sendNewOrderEmail')
132
- ;
133
  $this->replaceByMock('model', 'sales/order', $orderMock);
134
 
135
  $order = Mage::getModel('sales/order');
@@ -143,26 +140,25 @@ class Netresearch_OPS_Test_Helper_DataTest extends EcomDev_PHPUnit_Test_Case
143
  */
144
  public function sendInvoiceEmail()
145
  {
146
- $configMock = $this->getModelMock('ops/config', ['getSendInvoice']);
147
  $configMock
148
  ->expects($this->exactly(2))
149
  ->method('getSendInvoice')
150
- ->willReturnOnConsecutiveCalls(false, true)
151
- ;
152
  $this->replaceByMock('model', 'ops/config', $configMock);
153
 
154
- $invoiceMock = $this->getModelMock('sales/order_invoice', [
 
155
  'getEmailSent', 'sendEmail'
156
- ]);
 
157
  $invoiceMock
158
  ->expects($this->exactly(3))
159
  ->method('getEmailSent')
160
- ->willReturnOnConsecutiveCalls(true, false, false)
161
- ;
162
  $invoiceMock
163
  ->expects($this->once())
164
- ->method('sendEmail')
165
- ;
166
  $this->replaceByMock('model', 'sales/order', $invoiceMock);
167
 
168
  $order = Mage::getModel('sales/order');
97
  public function sendNoMail()
98
  {
99
  $documentMock = $this->getMockBuilder('Mage_Sales_Model_Order_Shipment')
100
+ ->setMethods(array('getEmailSent'))
101
+ ->getMock();
 
102
  $documentMock
103
  ->expects($this->never())
104
+ ->method('getEmailSent');
 
105
 
106
  Mage::helper('ops/data')->sendTransactionalEmail($documentMock);
107
  }
111
  */
112
  public function sendOrderEmail()
113
  {
114
+ $orderMock = $this->getModelMock(
115
+ 'sales/order', array(
116
  'getEmailSent', 'getCanSendNewEmailFlag', 'sendNewOrderEmail'
117
+ )
118
+ );
119
  $orderMock
120
  ->expects($this->exactly(3))
121
  ->method('getEmailSent')
122
+ ->willReturnOnConsecutiveCalls(true, false, false);
 
123
  $orderMock
124
  ->expects($this->exactly(2))
125
  ->method('getCanSendNewEmailFlag')
126
+ ->willReturnOnConsecutiveCalls(false, true);
 
127
  $orderMock
128
  ->expects($this->once())
129
+ ->method('sendNewOrderEmail');
 
130
  $this->replaceByMock('model', 'sales/order', $orderMock);
131
 
132
  $order = Mage::getModel('sales/order');
140
  */
141
  public function sendInvoiceEmail()
142
  {
143
+ $configMock = $this->getModelMock('ops/config', array('getSendInvoice'));
144
  $configMock
145
  ->expects($this->exactly(2))
146
  ->method('getSendInvoice')
147
+ ->willReturnOnConsecutiveCalls(false, true);
 
148
  $this->replaceByMock('model', 'ops/config', $configMock);
149
 
150
+ $invoiceMock = $this->getModelMock(
151
+ 'sales/order_invoice', array(
152
  'getEmailSent', 'sendEmail'
153
+ )
154
+ );
155
  $invoiceMock
156
  ->expects($this->exactly(3))
157
  ->method('getEmailSent')
158
+ ->willReturnOnConsecutiveCalls(true, false, false);
 
159
  $invoiceMock
160
  ->expects($this->once())
161
+ ->method('sendEmail');
 
162
  $this->replaceByMock('model', 'sales/order', $invoiceMock);
163
 
164
  $order = Mage::getModel('sales/order');
app/code/community/Netresearch/OPS/Test/Helper/DirectDebitTest.php CHANGED
@@ -12,11 +12,15 @@ class Netresearch_OPS_Test_Helper_DirectDebitTest
12
  extends EcomDev_PHPUnit_Test_Case
13
  {
14
 
 
 
 
15
  protected function getDirectDebitHelper()
16
  {
17
  return Mage::helper('ops/directDebit');
18
  }
19
 
 
20
  public function testGetDataHelper()
21
  {
22
  $this->assertTrue(
@@ -25,477 +29,116 @@ class Netresearch_OPS_Test_Helper_DirectDebitTest
25
  );
26
  }
27
 
28
- public function testGetQuoteHelper()
29
  {
 
 
30
  $this->assertTrue(
31
- $this->getDirectDebitHelper()->getQuoteHelper() instanceof
32
- Netresearch_OPS_Helper_Quote
33
  );
34
  }
35
 
36
- public function testGetOrderHelper()
37
  {
38
  $this->assertTrue(
39
- $this->getDirectDebitHelper()->getOrderHelper() instanceof
40
- Netresearch_OPS_Helper_Order
41
  );
42
  }
43
 
44
- public function testGetCustomerHelper()
45
  {
 
 
46
  $this->assertTrue(
47
- $this->getDirectDebitHelper()->getCustomerHelper() instanceof
48
- Mage_Customer_Helper_Data
49
  );
50
  }
51
 
52
- public function testGetValidator()
53
  {
54
  $this->assertTrue(
55
- $this->getDirectDebitHelper()->getValidator() instanceof
56
- Netresearch_OPS_Model_Validator_Payment_DirectDebit
57
  );
58
  }
59
 
60
- public function testGetCountry()
61
  {
62
- $helper = $this->getDirectDebitHelper();
63
- $params = array();
64
- $this->assertEquals('', $helper->getCountry($params));
65
- $params['country'] = 'de';
66
- $this->assertEquals('DE', $helper->getCountry($params));
67
- }
68
-
69
- public function testHasIban()
70
- {
71
- $helper = $this->getDirectDebitHelper();
72
- $params = array();
73
- $this->assertFalse($helper->hasIban($params));
74
- $params['iban'] = '';
75
- $this->assertFalse($helper->hasIban($params));
76
- $params['iban'] = ' ';
77
- $this->assertFalse($helper->hasIban($params));
78
- $params['iban'] = '123456789';
79
- $this->assertTrue($helper->hasIban($params));
80
- }
81
-
82
- public function testSetDirectDebitDataToPayment()
83
- {
84
- $payment = Mage::getModel('sales/quote_payment');
85
- $helper = $this->getDirectDebitHelper();
86
- $params = array('country' => 'de', 'account' => '', 'bankcode' => '');
87
- $helper->setDirectDebitDataToPayment($payment, $params);
88
- $this->assertEquals(
89
- 'Direct Debits DE', $payment->getAdditionalInformation('PM')
90
- );
91
-
92
- $params = array(
93
- 'country' => 'de', 'CN' => 'Account Holder', 'account' => '',
94
- 'bankcode' => ''
95
- );
96
- $helper->setDirectDebitDataToPayment($payment, $params);
97
- $this->assertEquals(
98
- 'Account Holder', $payment->getAdditionalInformation('CN')
99
- );
100
-
101
- $params = array(
102
- 'country' => 'nl', 'CN' => 'Account Holder',
103
- 'account' => '1234567', 'bankcode' => ''
104
- );
105
- $helper->setDirectDebitDataToPayment($payment, $params);
106
- $this->assertEquals(
107
- '1234567', $payment->getAdditionalInformation('CARDNO')
108
- );
109
-
110
- $params = array(
111
- 'country' => 'at', 'CN' => 'Account Holder',
112
- 'account' => '1234567', 'bankcode' => '1234567'
113
- );
114
- $helper->setDirectDebitDataToPayment($payment, $params);
115
- $this->assertEquals(
116
- '1234567BLZ1234567', $payment->getAdditionalInformation('CARDNO')
117
- );
118
-
119
- $params = array(
120
- 'country' => 'de', 'CN' => 'Account Holder',
121
- 'account' => '1234567', 'bankcode' => '1234567'
122
- );
123
- $helper->setDirectDebitDataToPayment($payment, $params);
124
- $this->assertEquals(
125
- '1234567BLZ1234567', $payment->getAdditionalInformation('CARDNO')
126
- );
127
-
128
- $params = array(
129
- 'country' => 'de', 'CN' => 'Account Holder',
130
- 'iban' => 'DE1234567890', 'account' => '1234567',
131
- 'bankcode' => '1234567'
132
- );
133
- $helper->setDirectDebitDataToPayment($payment, $params);
134
- $this->assertEquals(
135
- 'DE1234567890', $payment->getAdditionalInformation('CARDNO')
136
- );
137
-
138
- $params = array(
139
- 'country' => 'at', 'CN' => 'Account Holder',
140
- 'iban' => 'DE1234567890', 'account' => '1234567',
141
- 'bankcode' => '1234567'
142
- );
143
- $helper->setDirectDebitDataToPayment($payment, $params);
144
- $this->assertEquals(
145
- '1234567BLZ1234567', $payment->getAdditionalInformation('CARDNO')
146
- );
147
 
148
- $params = array(
149
- 'country' => 'nl', 'CN' => 'Account Holder',
150
- 'iban' => 'NL1234567890', 'bic' => '12345678',
151
- 'account' => '1234567', 'bankcode' => '1234567'
152
- );
153
- $helper->setDirectDebitDataToPayment($payment, $params);
154
- $this->assertEquals(
155
- 'NL1234567890', $payment->getAdditionalInformation('CARDNO')
156
- );
157
- $this->assertEquals(
158
- '12345678', $payment->getAdditionalInformation('BIC')
159
  );
160
  }
161
 
162
- /**
163
- * @loadFixture ../../../var/fixtures/orders.yaml
164
- */
165
- public function testGetDirectLinkRequestParams()
166
  {
167
-
168
- $store = Mage::app()->getStore(0)->load(0);
169
- $store->resetConfig();
170
-
171
- $store->setConfig(
172
- 'payment_services/ops/inlineOrderReference',
173
- Netresearch_OPS_Model_Payment_Abstract::REFERENCE_QUOTE_ID
174
- );
175
-
176
- $quote = Mage::getModel('sales/quote')->load(10);
177
- $order = Mage::getModel('sales/order')->load(11);
178
- $dataHelper = $this->getHelperMock('ops/data', array('isAdminSession'));
179
- $dataHelper->expects($this->any())
180
- ->method('isAdminSession')
181
- ->will($this->returnValue(false));
182
-
183
- $customerHelper = $this->getHelperMock(
184
- 'customer/data', array('isLoggedIn')
185
- );
186
- $customerHelper->expects($this->any())
187
- ->method('isLoggedIn')
188
- ->will($this->returnValue(false));
189
-
190
- $quoteHelper = $this->getHelperMock(
191
- 'ops/quote', array('getPaymentAction', 'getQuoteCurrency')
192
- );
193
- $quoteHelper->expects($this->any())
194
- ->method('getPaymentAction')
195
- ->will($this->returnValue('RES'));
196
- $quoteHelper->expects($this->any())
197
- ->method('getQuoteCurrency')
198
- ->will($this->returnValue('EUR'));
199
-
200
- $orderHelper = $this->getHelperMock(
201
- 'ops/order', array('checkIfAddressesAreSame')
202
- );
203
- $orderHelper->expects($this->any())
204
- ->method('checkIfAddressesAreSame')
205
- ->will($this->returnValue(1));
206
-
207
- $helper = $this->getDirectDebitHelper();
208
- $helper->setDataHelper($dataHelper);
209
- $helper->setCustomerHelper($customerHelper);
210
- $helper->setQuoteHelper($quoteHelper);
211
- $helper->setOrderHelper($orderHelper);
212
- $this->assertEquals(
213
- $this->getExpectedResultOnFrontendRequest($order),
214
- $helper->getDirectLinkRequestParams($quote, $order)
215
  );
216
  }
217
 
218
- /**
219
- * @loadFixture ../../../var/fixtures/orders.yaml
220
- */
221
- public function testGetDirectLinkRequestParamsWithNoShippingAddress()
222
  {
223
- $quote = Mage::getModel('sales/quote')->load(10);
224
- $order = Mage::getModel('sales/order')->load(28);
225
- $dataHelper = $this->getHelperMock('ops/data', array('isAdminSession'));
226
- $dataHelper->expects($this->any())
227
- ->method('isAdminSession')
228
- ->will($this->returnValue(false));
229
 
230
- $customerHelper = $this->getHelperMock(
231
- 'customer/data', array('isLoggedIn')
232
- );
233
- $customerHelper->expects($this->any())
234
- ->method('isLoggedIn')
235
- ->will($this->returnValue(false));
236
-
237
- $quoteHelper = $this->getHelperMock(
238
- 'ops/quote', array('getPaymentAction', 'getQuoteCurrency')
239
- );
240
- $quoteHelper->expects($this->any())
241
- ->method('getPaymentAction')
242
- ->will($this->returnValue('RES'));
243
- $quoteHelper->expects($this->any())
244
- ->method('getQuoteCurrency')
245
- ->will($this->returnValue('EUR'));
246
-
247
- $configMock = $this->getModelMock('ops/config', array('canSubmitExtraParameter'));
248
- $configMock->expects($this->any())
249
- ->method('canSubmitExtraParameter')
250
- ->will($this->returnValue(true));
251
-
252
- $helper = $this->getDirectDebitHelper();
253
- $helper->setConfig($configMock);
254
- $helper->getRequestHelper()->setConfig($configMock);
255
- $helper->setDataHelper($dataHelper);
256
- $helper->setCustomerHelper($customerHelper);
257
- $helper->setQuoteHelper($quoteHelper);
258
-
259
- $result = $helper->getDirectLinkRequestParams($quote, $order);
260
- $this->assertEquals(
261
- '04227',
262
- $result['ECOM_SHIPTO_POSTAL_POSTALCODE']
263
  );
264
  }
265
 
266
- /**
267
- * @loadFixture ../../../var/fixtures/orders.yaml
268
- */
269
- public function testGetDirectLinkRequestParamsWithLoggedInCustomer()
270
  {
271
- $quote = Mage::getModel('sales/quote')->load(10);
272
- $order = Mage::getModel('sales/order')->load(28);
273
- $dataHelper = $this->getHelperMock('ops/data', array('isAdminSession'));
274
- $dataHelper->expects($this->any())
275
- ->method('isAdminSession')
276
- ->will($this->returnValue(false));
277
-
278
- $fakeCustomer = new Varien_Object();
279
- $fakeCustomer->setId(666);
280
- $customerHelper = $this->getHelperMock(
281
- 'customer/data', array('isLoggedIn', 'getCustomer')
282
- );
283
- $customerHelper->expects($this->any())
284
- ->method('isLoggedIn')
285
- ->will($this->returnValue(true));
286
- $customerHelper->expects($this->any())
287
- ->method('getCustomer')
288
- ->will($this->returnValue($fakeCustomer));
289
-
290
- $quoteHelper = $this->getHelperMock(
291
- 'ops/quote', array('getPaymentAction', 'getQuoteCurrency')
292
  );
293
- $quoteHelper->expects($this->any())
294
- ->method('getPaymentAction')
295
- ->will($this->returnValue('RES'));
296
- $quoteHelper->expects($this->any())
297
- ->method('getQuoteCurrency')
298
- ->will($this->returnValue('EUR'));
299
- $configMock = $this->getModelMock('ops/config', array('canSubmitExtraParameter'));
300
- $configMock->expects($this->any())
301
- ->method('canSubmitExtraParameter')
302
- ->will($this->returnValue(true));
303
- $helper = $this->getDirectDebitHelper();
304
- $helper->setConfig($configMock);
305
- $helper->getRequestHelper()->setConfig($configMock);
306
- $helper->setDataHelper($dataHelper);
307
- $helper->setCustomerHelper($customerHelper);
308
- $helper->setQuoteHelper($quoteHelper);
309
-
310
- $result = $helper->getDirectLinkRequestParams($quote, $order);
311
- $this->assertEquals(666, $result['CUID']);
312
  }
313
 
314
-
315
  /**
316
- * @loadFixture ../../../var/fixtures/orders.yaml
317
  */
318
- public function testGetDirectLinkRequestParamsForBackendOrder()
319
  {
320
- $quote = Mage::getModel('sales/quote')->load(10);
321
- $order = Mage::getModel('sales/order')->load(11);
322
-
323
- $validator = $this->getModelMock(
324
- 'ops/validator_payment_directDebit', array('isValid')
325
- );
326
- $validator->expects($this->any())
327
- ->method('isValid')
328
- ->will($this->returnValue(true));
329
-
330
- $dataHelper = $this->getHelperMock('ops/data', array('isAdminSession'));
331
- $dataHelper->expects($this->any())
332
- ->method('isAdminSession')
333
- ->will($this->returnValue(true));
334
-
335
- $customerHelper = $this->getHelperMock(
336
- 'customer/data', array('isLoggedIn')
337
- );
338
- $customerHelper->expects($this->any())
339
- ->method('isLoggedIn')
340
- ->will($this->returnValue(false));
341
-
342
- $quoteHelper = $this->getHelperMock(
343
- 'ops/quote', array('getPaymentAction', 'getQuoteCurrency')
344
- );
345
- $quoteHelper->expects($this->any())
346
- ->method('getPaymentAction')
347
- ->will($this->returnValue('RES'));
348
- $quoteHelper->expects($this->any())
349
- ->method('getQuoteCurrency')
350
- ->will($this->returnValue('EUR'));
351
-
352
- $orderHelper = $this->getHelperMock(
353
- 'ops/order', array('checkIfAddressesAreSame')
354
- );
355
- $orderHelper->expects($this->any())
356
- ->method('checkIfAddressesAreSame')
357
- ->will($this->returnValue(1));
358
-
359
  $helper = $this->getDirectDebitHelper();
360
- $helper->setDataHelper($dataHelper);
361
- $helper->setCustomerHelper($customerHelper);
362
- $helper->setQuoteHelper($quoteHelper);
363
- $helper->setOrderHelper($orderHelper);
364
- $helper->setValidator($validator);
365
-
366
- $params = array(
367
- 'country' => 'DE', 'CN' => 'Hans Wurst', 'account' => '4711',
368
- 'bankcode' => '0815'
369
- );
370
- $helper->handleAdminPayment($quote, $params);
371
- $result = $helper->getDirectLinkRequestParams($quote, $order, $params);
372
- $this->assertEquals('Direct Debits DE', $result['PM']);
373
- $this->assertEquals('Hans Wurst', $result['CN']);
374
- $this->assertEquals($result['PM'], $result['BRAND']);
375
- $this->assertEquals('4711BLZ0815', $result['CARDNO']);
376
- $this->assertEquals(1, $result['ECI']);
377
-
378
  $params = array(
379
- 'country' => 'DE', 'CN' => 'Hans Wurst', 'account' => '4711',
380
- 'bankcode' => '0815', 'bic' => '4712', 'iban' => '0816'
381
- );
382
- $helper->handleAdminPayment($quote, $params);
383
- $result = $helper->getDirectLinkRequestParams($quote, $order, $params);
384
- $this->assertEquals('0816', $result['CARDNO']);
385
- $this->assertArrayNotHasKey('BIC', $result);
386
-
387
- $params = array(
388
- 'country' => 'NL', 'CN' => 'Hans Wurst', 'account' => '4711',
389
- 'bankcode' => '0815', 'bic' => '4712', 'iban' => '0816'
390
- );
391
- $helper->handleAdminPayment($quote, $params);
392
- $result = $helper->getDirectLinkRequestParams($quote, $order, $params);
393
- $this->assertEquals('0816', $result['CARDNO']);
394
- $this->assertArrayHasKey('BIC', $result);
395
- $this->assertEquals('4712', $result['BIC']);
396
-
397
- $params = array(
398
- 'country' => 'NL', 'CN' => 'Hans Wurst', 'account' => '4711',
399
- 'bankcode' => '0815', 'bic' => '', 'iban' => '0816'
400
- );
401
- $quote->getPayment()->setAdditionalInformation('PM', 'Direct Debits NL');
402
- $helper->handleAdminPayment($quote, $params);
403
- $result = $helper->getDirectLinkRequestParams($quote, $order, $params);
404
- $this->assertArrayNotHasKey('BIC', $result);
405
-
406
- $params = array(
407
- 'country' => 'DE', 'CN' => 'Hans Wurst', 'account' => '4711',
408
- 'bankcode' => '0815', 'bic' => '', 'iban' => '0816'
409
  );
410
- $quote->getPayment()->setAdditionalInformation('PM', 'Direct Debits DE');
411
- $helper->handleAdminPayment($quote, $params);
412
  $result = $helper->getDirectLinkRequestParams($quote, $order, $params);
413
- $this->assertArrayNotHasKey('BIC', $result);
414
- }
415
 
416
-
417
- /**
418
- * @loadFixture ../../../var/fixtures/orders.yaml
419
- */
420
- public function testGetDirectLinkRequestParamsForBackendOrderThrowsException(
421
- )
422
- {
423
- $sessionMock = $this->getModelMock(
424
- 'adminhtml/session', array('init', 'save')
425
- );
426
- $this->replaceByMock('model', 'adminhtml/session', $sessionMock);
427
-
428
- $quote = Mage::getModel('sales/quote')->load(10);
429
- $order = Mage::getModel('sales/order')->load(11);
430
-
431
- $validator = $this->getModelMock(
432
- 'ops/validator_payment_directDebit', array('isValid', 'getMessages')
433
- );
434
- $validator->expects($this->any())
435
- ->method('isValid')
436
- ->will($this->returnValue(false));
437
- $validator->expects($this->any())
438
- ->method('getMessages')
439
- ->will($this->returnValue(array('foo', 'bar')));
440
-
441
- $dataHelper = $this->getHelperMock('ops/data', array('isAdminSession'));
442
- $dataHelper->expects($this->any())
443
- ->method('isAdminSession')
444
- ->will($this->returnValue(true));
445
-
446
- $helper = $this->getDirectDebitHelper();
447
- $helper->setDataHelper($dataHelper);
448
- $helper->setValidator($validator);
449
-
450
- $params = array(
451
- 'country' => 'DE', 'CN' => 'Hans Wurst', 'account' => '4711',
452
- 'bankcode' => '0815'
453
- );
454
- try {
455
- $helper->getDirectLinkRequestParams(
456
- $quote, $order, $params
457
- );
458
- } catch (Exception $e) {
459
-
460
- }
461
  }
462
 
463
- protected function getExpectedResultOnFrontendRequest($order)
464
  {
465
- return array(
466
- 'AMOUNT' => 0.0,
467
- 'CARDNO' => NULL,
468
- 'CN' => utf8_decode(""),
469
- 'CURRENCY' => "EUR",
470
- 'ED' => "9999",
471
- 'OPERATION' => "RES",
472
- 'ORDERID' => Mage::getModel('ops/config')->getConfigData('devprefix') . $order->getQuoteId(),
473
- 'PM' => NULL,
474
- 'OWNERADDRESS' => utf8_decode(
475
- "An der Tabaksmühle 3a"
476
- ),
477
- 'OWNERTOWN' => utf8_decode("Leipzig"),
478
- 'OWNERZIP' => "04229",
479
- 'OWNERTELNO' => NULL,
480
- 'OWNERCTY' => "DE",
481
- 'ADDMATCH' => 1,
482
- 'RTIMEOUT' => 45,
483
- 'ECOM_SHIPTO_POSTAL_POSTALCODE' => "04229",
484
- 'ECOM_BILLTO_POSTAL_POSTALCODE' => "04229",
485
- 'ORIG' => Mage::helper("ops")->getModuleVersionString(),
486
- 'BRAND' => NULL,
487
- 'ECOM_SHIPTO_POSTAL_NAME_FIRST' => 'Hubertus',
488
- 'ECOM_SHIPTO_POSTAL_NAME_LAST' => utf8_decode('Fürstenberg'),
489
- 'ECOM_SHIPTO_POSTAL_STREET_LINE1' => utf8_decode('An der Tabaksmühle 3a'),
490
- 'ECOM_SHIPTO_POSTAL_STREET_LINE2' => '',
491
- 'ECOM_SHIPTO_POSTAL_COUNTRYCODE' => 'DE',
492
- 'ECOM_SHIPTO_POSTAL_CITY' => 'Leipzig',
493
- 'EMAIL' => 'hubertus.von.fuerstenberg@trash-mail.com',
494
- 'REMOTE_ADDR' => null,
495
- 'ECOM_SHIPTO_POSTAL_STATE' => ''
496
- );
497
-
498
  }
499
-
500
-
501
- }
12
  extends EcomDev_PHPUnit_Test_Case
13
  {
14
 
15
+ /**
16
+ * @return Netresearch_OPS_Helper_DirectDebit
17
+ */
18
  protected function getDirectDebitHelper()
19
  {
20
  return Mage::helper('ops/directDebit');
21
  }
22
 
23
+
24
  public function testGetDataHelper()
25
  {
26
  $this->assertTrue(
29
  );
30
  }
31
 
32
+ public function testSetDataHelper()
33
  {
34
+ $this->getDirectDebitHelper()->setDataHelper(Mage::helper('ops/data'));
35
+
36
  $this->assertTrue(
37
+ $this->getDirectDebitHelper()->getDataHelper() instanceof
38
+ Netresearch_OPS_Helper_Data
39
  );
40
  }
41
 
42
+ public function testGetQuoteHelper()
43
  {
44
  $this->assertTrue(
45
+ $this->getDirectDebitHelper()->getQuoteHelper() instanceof
46
+ Netresearch_OPS_Helper_Quote
47
  );
48
  }
49
 
50
+ public function testSetQuoteHelper()
51
  {
52
+ $this->getDirectDebitHelper()->setQuoteHelper(Mage::helper('ops/quote'));
53
+
54
  $this->assertTrue(
55
+ $this->getDirectDebitHelper()->getQuoteHelper() instanceof
56
+ Netresearch_OPS_Helper_Quote
57
  );
58
  }
59
 
60
+ public function testGetOrderHelper()
61
  {
62
  $this->assertTrue(
63
+ $this->getDirectDebitHelper()->getOrderHelper() instanceof
64
+ Netresearch_OPS_Helper_Order
65
  );
66
  }
67
 
68
+ public function testSetOrderHelper()
69
  {
70
+ $this->getDirectDebitHelper()->setOrderHelper(Mage::helper('ops/order'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
+ $this->assertTrue(
73
+ $this->getDirectDebitHelper()->getOrderHelper() instanceof
74
+ Netresearch_OPS_Helper_Order
 
 
 
 
 
 
 
 
75
  );
76
  }
77
 
78
+ public function testGetCustomerHelper()
 
 
 
79
  {
80
+ $this->assertTrue(
81
+ $this->getDirectDebitHelper()->getCustomerHelper() instanceof
82
+ Mage_Customer_Helper_Data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  );
84
  }
85
 
86
+ public function testSetCustomerHelper()
 
 
 
87
  {
88
+ $this->getDirectDebitHelper()->setCustomerHelper(Mage::helper('customer/data'));
 
 
 
 
 
89
 
90
+ $this->assertTrue(
91
+ $this->getDirectDebitHelper()->getCustomerHelper() instanceof
92
+ Mage_Customer_Helper_Data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  );
94
  }
95
 
96
+ public function testHandleAdminPayment()
 
 
 
97
  {
98
+ $quote = Mage::getModel('sales/quote');
99
+ $this->assertTrue(
100
+ $this->getDirectDebitHelper()->handleAdminPayment($quote, array())
101
+ instanceof Netresearch_OPS_Helper_DirectDebit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
 
105
  /**
106
+ * @loadFixture orders.yaml
107
  */
108
+ public function testGetPaymentSpecificParamsForFrontend()
109
  {
110
+ $this->mockSessions();
111
+ $order = Mage::getModel('sales/order')->load(1);
112
+ $quote = Mage::getModel('sales/quote')->load(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  $helper = $this->getDirectDebitHelper();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  $params = array(
115
+ 'country_id' => 'de',
116
+ 'CN' => 'Account Holder',
117
+ 'account' => '1234567',
118
+ 'bankcode' => '1234567'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  );
 
 
120
  $result = $helper->getDirectLinkRequestParams($quote, $order, $params);
 
 
121
 
122
+ $this->assertTrue((isset($result['BRAND'])) && $result['BRAND'] = "Direct Debits DE");
123
+ $this->assertTrue((isset($result['PM'])) && $result['PM'] = "Direct Debits DE");
124
+ $this->assertTrue((isset($result['ALIAS'])) && $result['ALIAS'] = "0000000012385139");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
126
 
127
+ protected function mockSessions()
128
  {
129
+ $sessionMock = $this->getModelMockBuilder('admin/session')
130
+ ->disableOriginalConstructor()
131
+ ->getMock();
132
+ $this->replaceByMock('singleton', 'admin/session', $sessionMock);
133
+
134
+ $sessionMock = $this->getModelMockBuilder('core/session')
135
+ ->disableOriginalConstructor()
136
+ ->getMock();
137
+ $this->replaceByMock('singleton', 'core/session', $sessionMock);
138
+
139
+ $sessionMock = $this->getModelMockBuilder('customer/session')
140
+ ->disableOriginalConstructor()
141
+ ->getMock();
142
+ $this->replaceByMock('singleton', 'customer/session', $sessionMock);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  }
144
+ }
 
 
app/code/community/Netresearch/OPS/Test/Helper/DirectDebitTest/fixtures/orders.yaml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tables:
2
+ sales/order:
3
+ - entity_id: 1
4
+ increment_id: 100000001
5
+ shipping_address_id: 1
6
+ base_grand_total: 119.00
7
+ grand_total: 119.00
8
+ currency: 'EUR'
9
+ customer_gender: 1
10
+ shipping_method: 'flatrate_flatrate'
11
+ customer_email: 'hubertus.von.fuerstenberg@trash-mail.com'
12
+ state: 'pending_payment'
13
+ status: 'pending_payment'
14
+ quote_id: 1
15
+ store_id: 0
16
+
17
+ sales/quote:
18
+ - entity_id: 1
19
+ orig_order_id: 1
20
+ base_grand_total: 119.00
21
+ grand_total: 119.00
22
+ currency: 'EUR'
23
+ customer_gender: 1
24
+ shipping_method: 'flatrate_flatrate'
25
+
26
+
27
+ sales/quote_payment:
28
+ - payment_id: 1
29
+ quote_id: 1
30
+ updated_at: '1970-01-01'
31
+ method: 'ops_directDebit'
32
+ additional_information: a:5:{s:5:"alias";s:16:"0000000012385139";s:10:"country_id";s:2:"DE";s:10:"opsAliasId";s:2:"21";s:8:"CC_BRAND";s:16:"Direct Debits DE";s:5:"CC_CN";s:4:"asda";}
33
+
34
+
35
+ sales/order_payment:
36
+ - entity_id: 1
37
+ parent_id: 1
38
+ method: 'ops_directDebit'
39
+
40
+
41
+ sales/shipment:
42
+ - entity_id: 1
43
+ increment_id: 100000001
44
+ order_id: 1
45
+ shipping_address_id: 42
46
+
47
+ sales/order_address:
48
+ - entity_id: 1
49
+ parent_id: 1
50
+ address_type: 'billing'
51
+ firstname: 'Hubertus'
52
+ postcode: '04229'
53
+ lastname: 'Fürstenberg'
54
+ street: 'An der Tabaksmühle 3a'
55
+ city: 'Leipzig'
56
+ email: 'hubertus.von.fuerstenberg@trash-mail.com'
57
+ country_id: 'DE'
58
+ prefix: 'Prof. Dr.'
59
+ middlename: 'von'
60
+ suffix: 'MdL'
61
+ company: ''
62
+ fax: 12345678
63
+
64
+ - entity_id: 2
65
+ parent_id: 1
66
+ address_type: 'shipping'
67
+ firstname: 'Hubertus'
68
+ postcode: '04229'
69
+ lastname: 'Fürstenberg'
70
+ street: 'An der Tabaksmühle 3a'
71
+ city: 'Leipzig'
72
+ email: 'hubertus.von.fuerstenberg@trash-mail.com'
73
+ country_id: 'DE'
74
+ prefix: 'Prof. Dr.'
75
+ middlename: 'von'
76
+ suffix: 'MdL'
77
+ company: ''
78
+ same_as_billing: 1
79
+
app/code/community/Netresearch/OPS/Test/Helper/DirectLinkTest.php CHANGED
@@ -7,9 +7,13 @@ class Netresearch_OPS_Test_Helper_DirectLinkTest
7
  parent::setup();
8
  $this->_helper = Mage::helper('ops/directlink');
9
  $transaction = Mage::getModel('sales/order_payment_transaction');
10
- $transaction->setAdditionalInformation('arrInfo', serialize(array(
11
- 'amount' => '184.90'
12
- )));
 
 
 
 
13
  $transaction->setIsClosed(0);
14
  $this->_transaction = $transaction;
15
  $this->_order = Mage::getModel('sales/order');
@@ -19,7 +23,13 @@ class Netresearch_OPS_Test_Helper_DirectLinkTest
19
 
20
  public function testDeleteActions()
21
  {
22
- $this->assertFalse($this->_helper->isValidOpsRequest($this->_transaction, $this->_order, array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETED)));
 
 
 
 
 
 
23
  $this->assertFalse($this->_helper->isValidOpsRequest($this->_transaction, $this->_order, array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETION_PENDING)));
24
  $this->assertFalse($this->_helper->isValidOpsRequest($this->_transaction, $this->_order, array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETION_UNCERTAIN)));
25
  $this->assertFalse($this->_helper->isValidOpsRequest($this->_transaction, $this->_order, array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETION_REFUSED)));
@@ -86,6 +96,10 @@ class Netresearch_OPS_Test_Helper_DirectLinkTest
86
  */
87
  public function testProcessFeedbackCaptureSuccess()
88
  {
 
 
 
 
89
  $this->mockEmailHelper($this->once());
90
 
91
  $order = Mage::getModel('sales/order')->load(11);
@@ -150,7 +164,8 @@ class Netresearch_OPS_Test_Helper_DirectLinkTest
150
 
151
 
152
  $closure = function ($order, $params = array()) {
153
- $order->getPayment()->setAdditionalInformation('status',
 
154
  Netresearch_OPS_Model_Status::REFUND_PROCESSED_BY_MERCHANT
155
  );
156
  return $order->getPayment();
@@ -184,7 +199,8 @@ class Netresearch_OPS_Test_Helper_DirectLinkTest
184
 
185
 
186
  $closure = function ($order, $params = array()) {
187
- $order->getPayment()->setAdditionalInformation('status',
 
188
  Netresearch_OPS_Model_Status::PAYMENT_PROCESSING
189
  );
190
  return $order->getPayment();
@@ -252,7 +268,8 @@ class Netresearch_OPS_Test_Helper_DirectLinkTest
252
 
253
 
254
  $closure = function ($order, $params = array()) {
255
- $order->getPayment()->setAdditionalInformation('status',
 
256
  Netresearch_OPS_Model_Status::REFUND_PENDING
257
  );
258
  return $order->getPayment();
@@ -447,7 +464,8 @@ class Netresearch_OPS_Test_Helper_DirectLinkTest
447
 
448
 
449
  $closure = function ($order, $params = array()) {
450
- $order->getPayment()->setAdditionalInformation('status', Netresearch_OPS_Model_Status::AUTHORIZED
 
451
  );
452
  return $order->getPayment();
453
  };
7
  parent::setup();
8
  $this->_helper = Mage::helper('ops/directlink');
9
  $transaction = Mage::getModel('sales/order_payment_transaction');
10
+ $transaction->setAdditionalInformation(
11
+ 'arrInfo', serialize(
12
+ array(
13
+ 'amount' => '184.90'
14
+ )
15
+ )
16
+ );
17
  $transaction->setIsClosed(0);
18
  $this->_transaction = $transaction;
19
  $this->_order = Mage::getModel('sales/order');
23
 
24
  public function testDeleteActions()
25
  {
26
+ $this->assertFalse(
27
+ $this->_helper->isValidOpsRequest(
28
+ $this->_transaction,
29
+ $this->_order,
30
+ array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETED)
31
+ )
32
+ );
33
  $this->assertFalse($this->_helper->isValidOpsRequest($this->_transaction, $this->_order, array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETION_PENDING)));
34
  $this->assertFalse($this->_helper->isValidOpsRequest($this->_transaction, $this->_order, array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETION_UNCERTAIN)));
35
  $this->assertFalse($this->_helper->isValidOpsRequest($this->_transaction, $this->_order, array('STATUS'=> Netresearch_OPS_Model_Status::PAYMENT_DELETION_REFUSED)));
96
  */
97
  public function testProcessFeedbackCaptureSuccess()
98
  {
99
+ $rssSession = $this->mockSession('rss/session')->disableOriginalConstructor();
100
+ $this->replaceByMock('model', 'rss/session', $rssSession);
101
+ $adminSession = $this->mockSession('admin/session')->disableOriginalConstructor();
102
+ $this->replaceByMock('model', 'admin/session', $adminSession);
103
  $this->mockEmailHelper($this->once());
104
 
105
  $order = Mage::getModel('sales/order')->load(11);
164
 
165
 
166
  $closure = function ($order, $params = array()) {
167
+ $order->getPayment()->setAdditionalInformation(
168
+ 'status',
169
  Netresearch_OPS_Model_Status::REFUND_PROCESSED_BY_MERCHANT
170
  );
171
  return $order->getPayment();
199
 
200
 
201
  $closure = function ($order, $params = array()) {
202
+ $order->getPayment()->setAdditionalInformation(
203
+ 'status',
204
  Netresearch_OPS_Model_Status::PAYMENT_PROCESSING
205
  );
206
  return $order->getPayment();
268
 
269
 
270
  $closure = function ($order, $params = array()) {
271
+ $order->getPayment()->setAdditionalInformation(
272
+ 'status',
273
  Netresearch_OPS_Model_Status::REFUND_PENDING
274
  );
275
  return $order->getPayment();
464
 
465
 
466
  $closure = function ($order, $params = array()) {
467
+ $order->getPayment()->setAdditionalInformation(
468
+ 'status', Netresearch_OPS_Model_Status::AUTHORIZED
469
  );
470
  return $order->getPayment();
471
  };
app/code/community/Netresearch/OPS/Test/Helper/MobileDetectTest.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once Mage::getBaseDir('lib') .DS. 'MobileDetect' .DS. 'Mobile_Detect.php';
4
+
5
+ class Netresearch_OPS_Test_Helper_MobileDetectTest extends EcomDev_PHPUnit_Test_Case
6
+ {
7
+ /** @var Netresearch_OPS_Helper_MobileDetect */
8
+ protected $helper;
9
+
10
+ protected $detectorMock;
11
+
12
+ public function setUp()
13
+ {
14
+ parent::setup();
15
+ $this->detectorMock = $this->getMockBuilder('Mobile_Detect')
16
+ ->setMethods(array('isMobile', 'isTablet'))
17
+ ->getMock();
18
+ $this->helper = Mage::helper('ops/mobileDetect');
19
+ $this->helper->setDetector($this->detectorMock);
20
+ }
21
+
22
+ /**
23
+ * @test
24
+ */
25
+ public function testGetDeviceTypeMobile()
26
+ {
27
+ $this->detectorMock
28
+ ->expects($this->once())
29
+ ->method('isMobile')
30
+ ->willReturn(true);
31
+
32
+ $this->detectorMock
33
+ ->expects($this->once())
34
+ ->method('isTablet')
35
+ ->willReturn(false);
36
+
37
+ $this->assertEquals(Netresearch_OPS_Helper_MobileDetect::DEVICE_TYPE_MOBILE, $this->helper->getDeviceType());
38
+ }
39
+
40
+ /**
41
+ * @test
42
+ */
43
+ public function testGetDeviceTypeTablet()
44
+ {
45
+ $this->detectorMock
46
+ ->expects($this->once())
47
+ ->method('isMobile')
48
+ ->willReturn(false);
49
+
50
+ $this->detectorMock
51
+ ->expects($this->once())
52
+ ->method('isTablet')
53
+ ->willReturn(true);
54
+
55
+ $this->assertEquals(Netresearch_OPS_Helper_MobileDetect::DEVICE_TYPE_TABLET, $this->helper->getDeviceType());
56
+ }
57
+
58
+ /**
59
+ * @test
60
+ */
61
+ public function testGetDeviceTypeComputer()
62
+ {
63
+ $this->detectorMock
64
+ ->expects($this->once())
65
+ ->method('isMobile')
66
+ ->willReturn(false);
67
+
68
+ $this->detectorMock
69
+ ->expects($this->once())
70
+ ->method('isTablet')
71
+ ->willReturn(false);
72
+
73
+ $this->assertEquals(Netresearch_OPS_Helper_MobileDetect::DEVICE_TYPE_COMPUTER, $this->helper->getDeviceType());
74
+ }
75
+ }
76
+
77
+
app/code/community/Netresearch/OPS/Test/Helper/Payment/RequestTest.php CHANGED
@@ -49,11 +49,14 @@ class Netresearch_OPS_Test_Helper_Payment_RequestTest extends EcomDev_PHPUnit_Te
49
  $params = $this->getRequestHelper()->extractShipToParameters($address, Mage::getModel('sales/quote'));
50
  $this->assertEquals('Hans', $params['ECOM_SHIPTO_POSTAL_NAME_FIRST']);
51
  $this->assertEquals('Wurst', $params['ECOM_SHIPTO_POSTAL_NAME_LAST']);
52
- $this->assertEquals('Nonnenstrasse 11d', $params['ECOM_SHIPTO_POSTAL_STREET_LINE1']);
 
53
  $this->assertEquals('', $params['ECOM_SHIPTO_POSTAL_STREET_LINE2']);
54
  $this->assertEquals('DE', $params['ECOM_SHIPTO_POSTAL_COUNTRYCODE']);
55
  $this->assertEquals('Leipzig', $params['ECOM_SHIPTO_POSTAL_CITY']);
56
  $this->assertEquals('04229', $params['ECOM_SHIPTO_POSTAL_POSTALCODE']);
 
 
57
  }
58
 
59
  public function testGetIsoRegionCodeWithIsoRegionCode()
@@ -231,7 +234,7 @@ class Netresearch_OPS_Test_Helper_Payment_RequestTest extends EcomDev_PHPUnit_Te
231
 
232
  $this->assertArrayHasKey('ITEMID1', $formFields);
233
  $this->assertArrayHasKey('ITEMID2', $formFields);
234
- $this->assertArrayHasKey('ORDERSHIPCOST', $formFields);
235
  }
236
 
237
  public function testExtractOrderItemParametersWithNoItems()
49
  $params = $this->getRequestHelper()->extractShipToParameters($address, Mage::getModel('sales/quote'));
50
  $this->assertEquals('Hans', $params['ECOM_SHIPTO_POSTAL_NAME_FIRST']);
51
  $this->assertEquals('Wurst', $params['ECOM_SHIPTO_POSTAL_NAME_LAST']);
52
+ $this->assertEquals('Nonnenstrasse' , $params['ECOM_SHIPTO_POSTAL_STREET_LINE1']);
53
+ $this->assertEquals('Nonnenstrasse' , $params['ECOM_SHIPTO_POSTAL_STREET_LINE1']);
54
  $this->assertEquals('', $params['ECOM_SHIPTO_POSTAL_STREET_LINE2']);
55
  $this->assertEquals('DE', $params['ECOM_SHIPTO_POSTAL_COUNTRYCODE']);
56
  $this->assertEquals('Leipzig', $params['ECOM_SHIPTO_POSTAL_CITY']);
57
  $this->assertEquals('04229', $params['ECOM_SHIPTO_POSTAL_POSTALCODE']);
58
+ $this->assertEquals('11d', $params['ECOM_SHIPTO_POSTAL_STREET_NUMBER']);
59
+
60
  }
61
 
62
  public function testGetIsoRegionCodeWithIsoRegionCode()
234
 
235
  $this->assertArrayHasKey('ITEMID1', $formFields);
236
  $this->assertArrayHasKey('ITEMID2', $formFields);
237
+ $this->assertArrayHasKey('ITEMID3', $formFields);
238
  }
239
 
240
  public function testExtractOrderItemParametersWithNoItems()
app/code/community/Netresearch/OPS/Test/Helper/PaymentTest.php CHANGED
@@ -1,13 +1,15 @@
1
  <?php
 
2
  class Netresearch_OPS_Test_Helper_PaymentTest
3
  extends Netresearch_OPS_Test_Model_Response_TestCase
4
  {
 
5
  private $_helper;
6
  private $store;
7
 
8
  public function setUp()
9
  {
10
- parent::setup();
11
  $this->_helper = Mage::helper('ops/payment');
12
  $this->store = Mage::app()->getStore(0)->load(0);
13
  $this->store->resetConfig();
@@ -140,11 +142,10 @@ class Netresearch_OPS_Test_Helper_PaymentTest
140
  );
141
  $secret = 'Mysecretsig1875!?';
142
  $shaInSet
143
- =
144
- 'ACCEPTURL=https=//www.myshop.com/ok.htmlMysecretsig1875!?BRAND=VISAMysecretsig1875!?'
145
- . 'CARDNO=4111111111111111Mysecretsig1875!?CN=JohnSmithMysecretsig1875!?CVC=123Mysecretsig1875!?'
146
- . 'ED=1212Mysecretsig1875!?EXCEPTIONURL=https=//www.myshop.com/nok.htmlMysecretsig1875!?'
147
- . 'PSPID=test1Mysecretsig1875!?';
148
  $key = 'a28dc9fe69b63fe81da92471fefa80aca3f4851a';
149
  $this->assertEquals(
150
  $sortedParams, $this->_helper->prepareParamsAndSort($params)
@@ -298,10 +299,18 @@ class Netresearch_OPS_Test_Helper_PaymentTest
298
  */
299
  public function testSetPaymentTransactionInformation()
300
  {
 
 
 
 
 
 
301
  $order = Mage::getModel('sales/order')->load(15);
302
- $reflectionClass = new ReflectionClass(get_class(
303
- Mage::helper('ops/payment')
304
- ));
 
 
305
  $method = $reflectionClass->getMethod(
306
  'setPaymentTransactionInformation'
307
  );
@@ -378,14 +387,13 @@ class Netresearch_OPS_Test_Helper_PaymentTest
378
  $order->getPayment()->getAdditionalInformation('CC_BRAND')
379
  );
380
  }
381
-
382
-
383
  /**
384
- * @param int $opsStatus Incoming postBack status
385
- * @param bool $sendMail Indicates whether opsStatus should trigger order confirmation mail
386
  * @param string $feedbackStatus Indicates the route that the customer should get redirected to
387
  *
388
- * @loadFixture ../../../var/fixtures/orders.yaml
389
  * @dataProvider applyStateForOrderProvider
390
  */
391
  public function testApplyStateForOrder($opsStatus, $sendMail, $feedbackStatus)
@@ -393,94 +401,99 @@ class Netresearch_OPS_Test_Helper_PaymentTest
393
  $this->mockEmailHelper($this->exactly(intval($sendMail)));
394
  $this->mockOrderConfig();
395
 
396
- $helperMock = $this->getHelperMock('ops', array('isAdminSession'));
397
  $helperMock->expects($this->any())
398
  ->method('isAdminSession')
399
  ->will($this->returnValue(false));
 
 
 
400
  $this->replaceByMock('helper', 'ops', $helperMock);
401
 
402
  /** @var Netresearch_OPS_Helper_Payment $paymenthelperMock */
403
- $paymenthelperMock = $this->getHelperMock('ops/payment', [
404
- 'acceptOrder', 'waitOrder', 'declineOrder', 'cancelOrder', 'handleException',
405
- ]);
 
 
406
 
407
  $order = Mage::getModel('sales/order')->load(19);
408
  $this->assertEquals(
409
  $feedbackStatus,
410
- $paymenthelperMock->applyStateForOrder($order, ['STATUS' => $opsStatus])
411
  );
412
  }
413
 
414
  public function applyStateForOrderProvider()
415
  {
416
- return [
417
  // assertion for WAITING_FOR_IDENTIFICATION = 46
418
- [
419
- $opsStatus = Netresearch_OPS_Model_Status::WAITING_FOR_IDENTIFICATION,
420
- $sendMail = false,
421
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
422
- ],
423
  // assertion for AUTHORIZED = 5
424
- [
425
- $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZED,
426
- $sendMail = true,
427
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
428
- ],
429
  // assertion for AUTHORIZED_WAITING_EXTERNAL_RESULT = 50
430
- [
431
- $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT,
432
- $sendMail = true,
433
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
434
- ],
435
  // assertion for AUTHORIZATION_WAITING = 51
436
- [
437
- $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING,
438
- $sendMail = true,
439
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
440
- ],
441
  // assertion for AUTHORIZED_UNKNOWN = 52
442
- [
443
- $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZED_UNKNOWN,
444
- $sendMail = true,
445
- $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
446
- ],
447
  // assertion for WAITING_CLIENT_PAYMENT = 41
448
- [
449
- $opsStatus = Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT,
450
- $sendMail = true,
451
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
452
- ],
453
  // assertion for PAYMENT_REQUESTED = 9
454
- [
455
- $opsStatus = Netresearch_OPS_Model_Status::PAYMENT_REQUESTED,
456
- $sendMail = true,
457
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
458
- ],
459
  // assertion for PAYMENT_PROCESSING = 91
460
- [
461
- $opsStatus = Netresearch_OPS_Model_Status::PAYMENT_PROCESSING,
462
- $sendMail = true,
463
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
464
- ],
465
  // assertion for AUTHORISATION_DECLINED = 2
466
- [
467
- $opsStatus = Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED,
468
- $sendMail = true,
469
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE,
470
- ],
471
  // assertion for PAYMENT_REFUSED = 93
472
- [
473
- $opsStatus = Netresearch_OPS_Model_Status::PAYMENT_REFUSED,
474
- $sendMail = true,
475
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE,
476
- ],
477
  // assertion for CANCELED_BY_CUSTOMER = 1
478
- [
479
- $opsStatus = Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER,
480
- $sendMail = false,
481
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_CANCEL,
482
- ],
483
- ];
484
  }
485
 
486
  /**
@@ -502,13 +515,13 @@ class Netresearch_OPS_Test_Helper_PaymentTest
502
  $order = Mage::getModel('sales/order')->load(28);
503
  $this->assertTrue($method->invoke($helper, $order));
504
 
505
- // $order = Mage::getModel('sales/order')->load(29);
506
- // $this->assertTrue($method->invoke($helper, $order));
507
  }
508
 
509
  public function testCheckIfCCisInCheckoutMethodsFalse()
510
  {
511
- $testMethod = $this->getProtectedMethod($this->_helper,'checkIfCCisInCheckoutMethods');
512
  $paymentMethods = new Varien_Object();
513
  $paymentMethods->setCode('ops_iDeal');
514
  $this->assertFalse($testMethod->invoke($this->_helper, array($paymentMethods)));
@@ -518,7 +531,7 @@ class Netresearch_OPS_Test_Helper_PaymentTest
518
 
519
  public function testCheckIfCCisInCheckoutMethodsTrue()
520
  {
521
- $testMethod = $this->getProtectedMethod($this->_helper,'checkIfCCisInCheckoutMethods');
522
  $paymentMethods = new Varien_Object();
523
  $paymentMethods->setCode('ops_cc');
524
  $this->assertTrue($testMethod->invoke($this->_helper, array($paymentMethods)));
@@ -529,13 +542,15 @@ class Netresearch_OPS_Test_Helper_PaymentTest
529
  public function testAddCCForZeroAmountCheckout()
530
  {
531
  $block = new Mage_Payment_Block_Form_Container();
532
- $method = new Varien_Object();
533
  $method->setCode('ops_ideal');
534
- $block->setData('methods',array($method));
535
  $quote = Mage::getModel('sales/quote');
536
  $block->setQuote($quote);
537
 
538
- $featureModelMock = $this->getModelMock('ops/payment_features_zeroAmountAuth', array('isCCAndZeroAmountAuthAllowed'));
 
 
539
  $featureModelMock->expects($this->any())
540
  ->method('isCCAndZeroAmountAuthAllowed')
541
  ->will($this->returnValue(true));
@@ -544,21 +559,20 @@ class Netresearch_OPS_Test_Helper_PaymentTest
544
  $this->_helper->addCCForZeroAmountCheckout($block);
545
 
546
  $methods = $block->getMethods();
547
- $this->assertTrue( $methods[1] instanceof Netresearch_OPS_Model_Payment_Cc);
548
- $this->assertFalse( $methods[0] instanceof Netresearch_OPS_Model_Payment_Cc);
549
 
550
  }
551
 
552
-
553
  protected function getProtectedMethod($class, $method)
554
  {
555
  $reflection_class = new ReflectionClass(get_class($class));
556
  $method = $reflection_class->getMethod($method);
557
  $method->setAccessible(true);
 
558
  return $method;
559
  }
560
-
561
-
562
  public function testIsInlinePaymentWithOrderIdIsTrueForInlineCcWithOrderId()
563
  {
564
  $configMock = $this->getModelMock('ops/config', array('getInlineOrderReference'));
@@ -584,7 +598,9 @@ class Netresearch_OPS_Test_Helper_PaymentTest
584
 
585
  public function testIsInlinePaymentWithOrderIdIsFalseForRedirectCcWithOrderId()
586
  {
587
- $ccMock = $this->getModelMock('ops/payment_cc', array('getConfigPaymentAction', 'hasBrandAliasInterfaceSupport'));
 
 
588
  $ccMock->expects($this->any())
589
  ->method('getConfigPaymentAction')
590
  ->will($this->returnValue('authorize'));
@@ -640,6 +656,7 @@ class Netresearch_OPS_Test_Helper_PaymentTest
640
 
641
  $this->assertFalse(Mage::helper('ops/payment')->isInlinePaymentWithOrderId($payment));
642
  }
 
643
  public function testIsInlinePaymentWithOrderIdIsTrueIfOrderIdIsConfiguredForDirectDebit()
644
  {
645
  $configMock = $this->getModelMock('ops/config', array('getInlineOrderReference'));
@@ -675,103 +692,17 @@ class Netresearch_OPS_Test_Helper_PaymentTest
675
 
676
  public function testSetInvoicesToPaid()
677
  {
 
 
 
678
  $order = $this->getModelMock('sales/order', array('save', 'getInvoiceCollection'));
679
  $order->expects($this->any())
680
  ->method('getInvoiceCollection')
681
- ->will($this->returnValue(array($this->getModelMock('sales/order_invoice', array('save')))));
682
  Mage::helper('ops/payment')->setInvoicesToPaid($order);
683
  foreach ($order->getInvoiceCollection() as $invoice) {
684
  $this->assertEquals(Mage_Sales_Model_Order_Invoice::STATE_PAID, $invoice->getState());
685
  }
686
  }
687
-
688
-
689
- /**
690
- * @expectedException Mage_Core_Exception
691
- */
692
- public function testCancelOrderWithException()
693
- {
694
- $params = array('status' => 2, 'payid' => 4711);
695
- $status = Mage_Sales_Model_Order::STATE_CANCELED;
696
- $comment = 'TestComment';
697
-
698
- $order = $this->getModelMock('sales/order', array('save', 'cancel', 'setState'));
699
- $order->expects($this->any())
700
- ->method('cancel')
701
- ->will($this->throwException(new Mage_Core_Exception('cancel failed')));
702
- ;
703
-
704
- $paymentHelperMock = $this->getHelperMock('ops/payment', array('_getCheckout'));
705
-
706
- $paymentHelperMock->expects($this->any())
707
- ->method('_getCheckout')
708
- ->will($this->returnValue($this->getModelMock('checkout/session', array('init', 'save'))))
709
- ;
710
-
711
- $paymentHelperMock->cancelOrder($order, $params, $status, $comment);
712
- Mage::unregister('ops_auto_void');
713
- }
714
-
715
- public function testDeclineOrder()
716
- {
717
- Mage::unregister('ops_auto_void');
718
- $params = array('STATUS' => 2, 'PAYID' => 4711);
719
- $status = Mage_Sales_Model_Order::STATE_CANCELED;
720
- $comment = 'TestComment';
721
-
722
- $order = $this->getModelMock('sales/order', array('save', 'cancel', 'setState', 'getPayment'));
723
- $order->expects($this->once())
724
- ->method('cancel')
725
- ;
726
- $order->expects($this->once())
727
- ->method('getPayment')
728
- ->will($this->returnValue($this->getModelMock('sales/order_payment', array('save'))));
729
- ;
730
-
731
- $paymentHelperMock = $this->getHelperMock('ops/payment', array('setPaymentTransactionInformation', '_getCheckout', 'cancelInvoices'));
732
- $paymentHelperMock->expects($this->once())
733
- ->method('setPaymentTransactionInformation');
734
- $paymentHelperMock->expects($this->once())
735
- ->method('cancelInvoices');
736
-
737
- $paymentHelperMock->expects($this->any())
738
- ->method('_getCheckout')
739
- ->will($this->returnValue($this->getModelMock('checkout/session', array('init', 'save'))))
740
- ;
741
-
742
- $paymentHelperMock->declineOrder($order, $params);
743
-
744
- }
745
-
746
- /**
747
- * @expectedException Mage_Core_Exception
748
- */
749
- public function testDeclineOrderWithException()
750
- {
751
- Mage::unregister('ops_auto_void');
752
- $params = array('STATUS' => 2, 'PAYID' => 4711);
753
- $status = Mage_Sales_Model_Order::STATE_CANCELED;
754
- $comment = 'TestComment';
755
-
756
- $order = $this->getModelMock('sales/order', array('save', 'cancel', 'setState'));
757
- $order->expects($this->once())
758
- ->method('cancel')
759
- ->will($this->throwException(new Mage_Core_Exception('exceptional case')));
760
-
761
-
762
- $paymentHelperMock = $this->getHelperMock('ops/payment', array('setPaymentTransactionInformation', '_getCheckout', 'cancelInvoices'));
763
- $paymentHelperMock->expects($this->never())
764
- ->method('setPaymentTransactionInformation');
765
- $paymentHelperMock->expects($this->once())
766
- ->method('cancelInvoices');
767
-
768
-
769
- $paymentHelperMock->expects($this->any())
770
- ->method('_getCheckout')
771
- ->will($this->returnValue($this->getModelMock('checkout/session', array('init', 'save'))))
772
- ;
773
-
774
- $paymentHelperMock->declineOrder($order, $params);
775
-
776
- }
777
  }
1
  <?php
2
+
3
  class Netresearch_OPS_Test_Helper_PaymentTest
4
  extends Netresearch_OPS_Test_Model_Response_TestCase
5
  {
6
+ /** @var Netresearch_OPS_Helper_Payment $_helper */
7
  private $_helper;
8
  private $store;
9
 
10
  public function setUp()
11
  {
12
+ parent::setUp();
13
  $this->_helper = Mage::helper('ops/payment');
14
  $this->store = Mage::app()->getStore(0)->load(0);
15
  $this->store->resetConfig();
142
  );
143
  $secret = 'Mysecretsig1875!?';
144
  $shaInSet
145
+ = 'ACCEPTURL=https=//www.myshop.com/ok.htmlMysecretsig1875!?BRAND=VISAMysecretsig1875!?'
146
+ . 'CARDNO=4111111111111111Mysecretsig1875!?CN=JohnSmithMysecretsig1875!?CVC=123Mysecretsig1875!?'
147
+ . 'ED=1212Mysecretsig1875!?EXCEPTIONURL=https=//www.myshop.com/nok.htmlMysecretsig1875!?'
148
+ . 'PSPID=test1Mysecretsig1875!?';
 
149
  $key = 'a28dc9fe69b63fe81da92471fefa80aca3f4851a';
150
  $this->assertEquals(
151
  $sortedParams, $this->_helper->prepareParamsAndSort($params)
299
  */
300
  public function testSetPaymentTransactionInformation()
301
  {
302
+ $dataMock = $this->getHelperMock('ops/data', array('isAdminSession'));
303
+ $dataMock->expects($this->any())
304
+ ->method('isAdminSession')
305
+ ->will($this->returnValue(false));
306
+ $this->replaceByMock('helper', 'ops/data', $dataMock);
307
+
308
  $order = Mage::getModel('sales/order')->load(15);
309
+ $reflectionClass = new ReflectionClass(
310
+ get_class(
311
+ Mage::helper('ops/payment')
312
+ )
313
+ );
314
  $method = $reflectionClass->getMethod(
315
  'setPaymentTransactionInformation'
316
  );
387
  $order->getPayment()->getAdditionalInformation('CC_BRAND')
388
  );
389
  }
390
+
 
391
  /**
392
+ * @param int $opsStatus Incoming postBack status
393
+ * @param bool $sendMail Indicates whether opsStatus should trigger order confirmation mail
394
  * @param string $feedbackStatus Indicates the route that the customer should get redirected to
395
  *
396
+ * @loadFixture ../../../var/fixtures/orders.yaml
397
  * @dataProvider applyStateForOrderProvider
398
  */
399
  public function testApplyStateForOrder($opsStatus, $sendMail, $feedbackStatus)
401
  $this->mockEmailHelper($this->exactly(intval($sendMail)));
402
  $this->mockOrderConfig();
403
 
404
+ $helperMock = $this->getHelperMock('ops', array('isAdminSession', 'sendTransactionalEmail'));
405
  $helperMock->expects($this->any())
406
  ->method('isAdminSession')
407
  ->will($this->returnValue(false));
408
+ $helperMock->expects($this->any())
409
+ ->method('sendTransactionalEmail')
410
+ ->will($this->returnArgument(0));
411
  $this->replaceByMock('helper', 'ops', $helperMock);
412
 
413
  /** @var Netresearch_OPS_Helper_Payment $paymenthelperMock */
414
+ $paymenthelperMock = $this->getHelperMock(
415
+ 'ops/payment', array(
416
+ 'acceptOrder', 'waitOrder', 'declineOrder', 'cancelOrder', 'handleException',
417
+ )
418
+ );
419
 
420
  $order = Mage::getModel('sales/order')->load(19);
421
  $this->assertEquals(
422
  $feedbackStatus,
423
+ $paymenthelperMock->applyStateForOrder($order, array('STATUS' => $opsStatus))
424
  );
425
  }
426
 
427
  public function applyStateForOrderProvider()
428
  {
429
+ return array(
430
  // assertion for WAITING_FOR_IDENTIFICATION = 46
431
+ array(
432
+ $opsStatus = Netresearch_OPS_Model_Status::WAITING_FOR_IDENTIFICATION,
433
+ $sendMail = false,
434
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
435
+ ),
436
  // assertion for AUTHORIZED = 5
437
+ array(
438
+ $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZED,
439
+ $sendMail = true,
440
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
441
+ ),
442
  // assertion for AUTHORIZED_WAITING_EXTERNAL_RESULT = 50
443
+ array(
444
+ $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT,
445
+ $sendMail = true,
446
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
447
+ ),
448
  // assertion for AUTHORIZATION_WAITING = 51
449
+ array(
450
+ $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING,
451
+ $sendMail = true,
452
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
453
+ ),
454
  // assertion for AUTHORIZED_UNKNOWN = 52
455
+ array(
456
+ $opsStatus = Netresearch_OPS_Model_Status::AUTHORIZED_UNKNOWN,
457
+ $sendMail = true,
458
+ $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION,
459
+ ),
460
  // assertion for WAITING_CLIENT_PAYMENT = 41
461
+ array(
462
+ $opsStatus = Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT,
463
+ $sendMail = true,
464
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
465
+ ),
466
  // assertion for PAYMENT_REQUESTED = 9
467
+ array(
468
+ $opsStatus = Netresearch_OPS_Model_Status::PAYMENT_REQUESTED,
469
+ $sendMail = true,
470
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
471
+ ),
472
  // assertion for PAYMENT_PROCESSING = 91
473
+ array(
474
+ $opsStatus = Netresearch_OPS_Model_Status::PAYMENT_PROCESSING,
475
+ $sendMail = true,
476
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT,
477
+ ),
478
  // assertion for AUTHORISATION_DECLINED = 2
479
+ array(
480
+ $opsStatus = Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED,
481
+ $sendMail = true,
482
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE,
483
+ ),
484
  // assertion for PAYMENT_REFUSED = 93
485
+ array(
486
+ $opsStatus = Netresearch_OPS_Model_Status::PAYMENT_REFUSED,
487
+ $sendMail = true,
488
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE,
489
+ ),
490
  // assertion for CANCELED_BY_CUSTOMER = 1
491
+ array(
492
+ $opsStatus = Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER,
493
+ $sendMail = false,
494
  $feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_CANCEL,
495
+ ),
496
+ );
497
  }
498
 
499
  /**
515
  $order = Mage::getModel('sales/order')->load(28);
516
  $this->assertTrue($method->invoke($helper, $order));
517
 
518
+ // $order = Mage::getModel('sales/order')->load(29);
519
+ // $this->assertTrue($method->invoke($helper, $order));
520
  }
521
 
522
  public function testCheckIfCCisInCheckoutMethodsFalse()
523
  {
524
+ $testMethod = $this->getProtectedMethod($this->_helper, 'checkIfCCisInCheckoutMethods');
525
  $paymentMethods = new Varien_Object();
526
  $paymentMethods->setCode('ops_iDeal');
527
  $this->assertFalse($testMethod->invoke($this->_helper, array($paymentMethods)));
531
 
532
  public function testCheckIfCCisInCheckoutMethodsTrue()
533
  {
534
+ $testMethod = $this->getProtectedMethod($this->_helper, 'checkIfCCisInCheckoutMethods');
535
  $paymentMethods = new Varien_Object();
536
  $paymentMethods->setCode('ops_cc');
537
  $this->assertTrue($testMethod->invoke($this->_helper, array($paymentMethods)));
542
  public function testAddCCForZeroAmountCheckout()
543
  {
544
  $block = new Mage_Payment_Block_Form_Container();
545
+ $method = new Varien_Object();
546
  $method->setCode('ops_ideal');
547
+ $block->setData('methods', array($method));
548
  $quote = Mage::getModel('sales/quote');
549
  $block->setQuote($quote);
550
 
551
+ $featureModelMock = $this->getModelMock(
552
+ 'ops/payment_features_zeroAmountAuth', array('isCCAndZeroAmountAuthAllowed')
553
+ );
554
  $featureModelMock->expects($this->any())
555
  ->method('isCCAndZeroAmountAuthAllowed')
556
  ->will($this->returnValue(true));
559
  $this->_helper->addCCForZeroAmountCheckout($block);
560
 
561
  $methods = $block->getMethods();
562
+ $this->assertTrue($methods[1] instanceof Netresearch_OPS_Model_Payment_Cc);
563
+ $this->assertFalse($methods[0] instanceof Netresearch_OPS_Model_Payment_Cc);
564
 
565
  }
566
 
 
567
  protected function getProtectedMethod($class, $method)
568
  {
569
  $reflection_class = new ReflectionClass(get_class($class));
570
  $method = $reflection_class->getMethod($method);
571
  $method->setAccessible(true);
572
+
573
  return $method;
574
  }
575
+
 
576
  public function testIsInlinePaymentWithOrderIdIsTrueForInlineCcWithOrderId()
577
  {
578
  $configMock = $this->getModelMock('ops/config', array('getInlineOrderReference'));
598
 
599
  public function testIsInlinePaymentWithOrderIdIsFalseForRedirectCcWithOrderId()
600
  {
601
+ $ccMock = $this->getModelMock(
602
+ 'ops/payment_cc', array('getConfigPaymentAction', 'hasBrandAliasInterfaceSupport')
603
+ );
604
  $ccMock->expects($this->any())
605
  ->method('getConfigPaymentAction')
606
  ->will($this->returnValue('authorize'));
656
 
657
  $this->assertFalse(Mage::helper('ops/payment')->isInlinePaymentWithOrderId($payment));
658
  }
659
+
660
  public function testIsInlinePaymentWithOrderIdIsTrueIfOrderIdIsConfiguredForDirectDebit()
661
  {
662
  $configMock = $this->getModelMock('ops/config', array('getInlineOrderReference'));
692
 
693
  public function testSetInvoicesToPaid()
694
  {
695
+ /** @var Mage_Sales_Model_Resource_Order_Invoice_Collection $invoiceCollection */
696
+ $invoiceCollection = $this->getResourceModelMock('sales/order_invoice_collection', array('save'));
697
+ $invoiceCollection->addItem(Mage::getModel('sales/order_invoice'));
698
  $order = $this->getModelMock('sales/order', array('save', 'getInvoiceCollection'));
699
  $order->expects($this->any())
700
  ->method('getInvoiceCollection')
701
+ ->will($this->returnValue($invoiceCollection));
702
  Mage::helper('ops/payment')->setInvoicesToPaid($order);
703
  foreach ($order->getInvoiceCollection() as $invoice) {
704
  $this->assertEquals(Mage_Sales_Model_Order_Invoice::STATE_PAID, $invoice->getState());
705
  }
706
  }
707
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  }
app/code/community/Netresearch/OPS/Test/Helper/SubscriptionTest.php CHANGED
@@ -102,7 +102,8 @@ class Netresearch_OPS_Test_Helper_SubscriptionTest extends EcomDev_PHPUnit_Test_
102
 
103
  }
104
 
105
- public function testGetBillingDayForPeriodUnit(){
 
106
  $subject = Mage::helper('ops/subscription');
107
 
108
  $this->assertEquals(1, $subject->getBillingDayForPeriodUnit('abc'));
102
 
103
  }
104
 
105
+ public function testGetBillingDayForPeriodUnit()
106
+ {
107
  $subject = Mage::helper('ops/subscription');
108
 
109
  $this->assertEquals(1, $subject->getBillingDayForPeriodUnit('abc'));
app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Capture/Additional/OpenInvoiceNlTest.php CHANGED
@@ -23,12 +23,7 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
23
 
24
  public function testExtractAdditionalParamsWithoutShipping1()
25
  {
26
- $itemsContainer = Mage::getModel('sales/order_shipment');
27
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
28
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
29
  $itemsContainer = Mage::getModel('sales/order_invoice');
30
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
31
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
32
  $orderItem = Mage::getModel('sales/order_item');
33
  $orderItem->setId(1);
34
  $orderItem->setQtyOrdered(2);
@@ -40,7 +35,9 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
40
  $item->setQty(2);
41
  $item->setTaxPercent(19);
42
  $itemsContainer->addItem($item);
43
- $result = $this->openInvoiceNlModel->extractAdditionalParams($itemsContainer);
 
 
44
  $this->assertTrue(is_array($result));
45
  $this->assertTrue(0 < count($result));
46
  $this->assertArrayHasKey('ITEMID1', $result);
@@ -57,15 +54,11 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
57
 
58
  public function testExtractAdditionalParamsWithoutShippingButWithConfigurable()
59
  {
60
- $itemsContainer = Mage::getModel('sales/order_shipment');
61
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
62
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
63
  $itemsContainer = Mage::getModel('sales/order_invoice');
64
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
65
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
66
  $orderItem = Mage::getModel('sales/order_item');
67
  $orderItem->setId(1);
68
  $orderItem->setQtyOrdered(2);
 
69
  $item = Mage::getModel('sales/order_invoice_item');
70
  $item->setOrderItemId(1);
71
  $item->setOrderItem($orderItem);
@@ -75,18 +68,21 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
75
  $item->setTaxPercent(19);
76
  $itemsContainer->addItem($item);
77
  $item = Mage::getModel('sales/order_invoice_item');
78
- $orderItem = Mage::getModel('sales/order_item');
79
- $orderItem->setId(1);
80
- $orderItem->setQtyOrdered(2);
81
- $orderItem->setParentItemId(1);
 
82
  $item->setOrderItemId(2);
83
- $item->setOrderItem($orderItem);
84
  $item->setName('Item');
85
  $item->setBasePriceInclTax(19.99);
86
  $item->setQty(2);
87
  $item->setTaxPercent(19);
88
  $itemsContainer->addItem($item);
89
- $result = $this->openInvoiceNlModel->extractAdditionalParams($itemsContainer);
 
 
90
  $this->assertTrue(is_array($result));
91
  $this->assertTrue(0 < count($result));
92
  $this->assertArrayHasKey('ITEMID1', $result);
@@ -103,12 +99,7 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
103
 
104
  public function testExtractAdditionalParamsWithoutShippingButWithTwoNormalInvoiceItems()
105
  {
106
- $itemsContainer = Mage::getModel('sales/order_shipment');
107
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
108
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
109
  $itemsContainer = Mage::getModel('sales/order_invoice');
110
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
111
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
112
  $orderItem = Mage::getModel('sales/order_item');
113
  $orderItem->setId(1);
114
  $orderItem->setQtyOrdered(2);
@@ -131,7 +122,9 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
131
  $item->setQty(2);
132
  $item->setTaxPercent(19);
133
  $itemsContainer->addItem($item);
134
- $result = $this->openInvoiceNlModel->extractAdditionalParams($itemsContainer);
 
 
135
  $this->assertTrue(is_array($result));
136
  $this->assertTrue(0 < count($result));
137
  $this->assertArrayHasKey('ITEMID1', $result);
@@ -159,12 +152,7 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
159
 
160
  public function testExtractAdditionalParamsWithShipping()
161
  {
162
- $itemsContainer = Mage::getModel('sales/order_shipment');
163
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
164
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
165
  $itemsContainer = Mage::getModel('sales/order_invoice');
166
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
167
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
168
  $orderItem = Mage::getModel('sales/order_item');
169
  $orderItem->setId(1);
170
  $orderItem->setQtyOrdered(2);
@@ -177,13 +165,14 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
177
  $item->setTaxPercent(19);
178
  $itemsContainer->addItem($item);
179
  $itemsContainer->setBaseShippingInclTax(10.00);
180
- $order = MAge::getModel('sales/order');
181
  $order->setShippingDescription('foo');
182
  $payment = Mage::getModel('sales/order_payment');
183
  $payment->setMethod('ops_openInvoiceNl');
184
  $order->setPayment($payment);
185
  $itemsContainer->setOrder($order);
186
- $result = $this->openInvoiceNlModel->extractAdditionalParams($itemsContainer);
 
187
  $this->assertTrue(is_array($result));
188
  $this->assertTrue(0 < count($result));
189
  $this->assertArrayHasKey('ITEMID1', $result);
@@ -212,12 +201,7 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
212
 
213
  public function testExtractAdditionalParamsWithShippingAndDiscount()
214
  {
215
- $itemsContainer = Mage::getModel('sales/order_shipment');
216
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
217
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
218
  $itemsContainer = Mage::getModel('sales/order_invoice');
219
- $this->assertTrue(is_array($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
220
- $this->assertEquals(0, count($this->openInvoiceNlModel->extractAdditionalParams($itemsContainer)));
221
  $orderItem = Mage::getModel('sales/order_item');
222
  $orderItem->setId(1);
223
  $orderItem->setQtyOrdered(2);
@@ -238,7 +222,8 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
238
  $payment->setMethod('ops_openInvoiceNl');
239
  $order->setPayment($payment);
240
  $itemsContainer->setOrder($order);
241
- $result = $this->openInvoiceNlModel->extractAdditionalParams($itemsContainer);
 
242
  $this->assertTrue(is_array($result));
243
  $this->assertTrue(0 < count($result));
244
  $this->assertArrayHasKey('ITEMID1', $result);
@@ -279,7 +264,8 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_Additional_OpenInvoic
279
  $this->assertEquals(1, $result['TAXINCLUDED3']);
280
  }
281
 
282
- protected function mockSessions(){
 
283
  $sessionMock = $this->getModelMockBuilder('checkout/session')
284
  ->disableOriginalConstructor()
285
  ->setMethods(null)
23
 
24
  public function testExtractAdditionalParamsWithoutShipping1()
25
  {
 
 
 
26
  $itemsContainer = Mage::getModel('sales/order_invoice');
 
 
27
  $orderItem = Mage::getModel('sales/order_item');
28
  $orderItem->setId(1);
29
  $orderItem->setQtyOrdered(2);
35
  $item->setQty(2);
36
  $item->setTaxPercent(19);
37
  $itemsContainer->addItem($item);
38
+ $payment = Mage::getModel('sales/order_payment')->setMethod('ops_openInvoiceNl');
39
+ $payment->setInvoice($itemsContainer);
40
+ $result = $this->openInvoiceNlModel->extractAdditionalParams($payment);
41
  $this->assertTrue(is_array($result));
42
  $this->assertTrue(0 < count($result));
43
  $this->assertArrayHasKey('ITEMID1', $result);
54
 
55
  public function testExtractAdditionalParamsWithoutShippingButWithConfigurable()
56
  {
 
 
 
57
  $itemsContainer = Mage::getModel('sales/order_invoice');
 
 
58
  $orderItem = Mage::getModel('sales/order_item');
59
  $orderItem->setId(1);
60
  $orderItem->setQtyOrdered(2);
61
+ $orderItem->setProductType(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE);
62
  $item = Mage::getModel('sales/order_invoice_item');
63
  $item->setOrderItemId(1);
64
  $item->setOrderItem($orderItem);
68
  $item->setTaxPercent(19);
69
  $itemsContainer->addItem($item);
70
  $item = Mage::getModel('sales/order_invoice_item');
71
+ $simpleOrderItem = Mage::getModel('sales/order_item');
72
+ $simpleOrderItem->setId(1);
73
+ $simpleOrderItem->setQtyOrdered(2);
74
+ $simpleOrderItem->setParentItemId(1);
75
+ $simpleOrderItem->setParentItem($orderItem);
76
  $item->setOrderItemId(2);
77
+ $item->setOrderItem($simpleOrderItem);
78
  $item->setName('Item');
79
  $item->setBasePriceInclTax(19.99);
80
  $item->setQty(2);
81
  $item->setTaxPercent(19);
82
  $itemsContainer->addItem($item);
83
+ $payment = Mage::getModel('sales/order_payment')->setMethod('ops_openInvoiceNl');
84
+ $payment->setInvoice($itemsContainer);
85
+ $result = $this->openInvoiceNlModel->extractAdditionalParams($payment);
86
  $this->assertTrue(is_array($result));
87
  $this->assertTrue(0 < count($result));
88
  $this->assertArrayHasKey('ITEMID1', $result);
99
 
100
  public function testExtractAdditionalParamsWithoutShippingButWithTwoNormalInvoiceItems()
101
  {
 
 
 
102
  $itemsContainer = Mage::getModel('sales/order_invoice');
 
 
103
  $orderItem = Mage::getModel('sales/order_item');
104
  $orderItem->setId(1);
105
  $orderItem->setQtyOrdered(2);
122
  $item->setQty(2);
123
  $item->setTaxPercent(19);
124
  $itemsContainer->addItem($item);
125
+ $payment = Mage::getModel('sales/order_payment')->setMethod('ops_openInvoiceNl');
126
+ $payment->setInvoice($itemsContainer);
127
+ $result = $this->openInvoiceNlModel->extractAdditionalParams($payment);
128
  $this->assertTrue(is_array($result));
129
  $this->assertTrue(0 < count($result));
130
  $this->assertArrayHasKey('ITEMID1', $result);
152
 
153
  public function testExtractAdditionalParamsWithShipping()
154
  {
 
 
 
155
  $itemsContainer = Mage::getModel('sales/order_invoice');
 
 
156
  $orderItem = Mage::getModel('sales/order_item');
157
  $orderItem->setId(1);
158
  $orderItem->setQtyOrdered(2);
165
  $item->setTaxPercent(19);
166
  $itemsContainer->addItem($item);
167
  $itemsContainer->setBaseShippingInclTax(10.00);
168
+ $order = Mage::getModel('sales/order');
169
  $order->setShippingDescription('foo');
170
  $payment = Mage::getModel('sales/order_payment');
171
  $payment->setMethod('ops_openInvoiceNl');
172
  $order->setPayment($payment);
173
  $itemsContainer->setOrder($order);
174
+ $payment->setInvoice($itemsContainer);
175
+ $result = $this->openInvoiceNlModel->extractAdditionalParams($payment);
176
  $this->assertTrue(is_array($result));
177
  $this->assertTrue(0 < count($result));
178
  $this->assertArrayHasKey('ITEMID1', $result);
201
 
202
  public function testExtractAdditionalParamsWithShippingAndDiscount()
203
  {
 
 
 
204
  $itemsContainer = Mage::getModel('sales/order_invoice');
 
 
205
  $orderItem = Mage::getModel('sales/order_item');
206
  $orderItem->setId(1);
207
  $orderItem->setQtyOrdered(2);
222
  $payment->setMethod('ops_openInvoiceNl');
223
  $order->setPayment($payment);
224
  $itemsContainer->setOrder($order);
225
+ $payment->setInvoice($itemsContainer);
226
+ $result = $this->openInvoiceNlModel->extractAdditionalParams($payment);
227
  $this->assertTrue(is_array($result));
228
  $this->assertTrue(0 < count($result));
229
  $this->assertArrayHasKey('ITEMID1', $result);
264
  $this->assertEquals(1, $result['TAXINCLUDED3']);
265
  }
266
 
267
+ protected function mockSessions()
268
+ {
269
  $sessionMock = $this->getModelMockBuilder('checkout/session')
270
  ->disableOriginalConstructor()
271
  ->setMethods(null)
app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Capture/ParameterTest.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
 
2
  /**
3
- * @author Michael Lühr <michael.luehr@netresearch.de>
4
  * @category Netresearch_OPS
5
  * @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
@@ -10,6 +11,10 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_ParameterTest extends
10
 
11
  public function testGetRequestParams()
12
  {
 
 
 
 
13
  $fakePayment = Mage::getModel('sales/order_payment');
14
  $fakePayment->setOrder(Mage::getModel('sales/order'));
15
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
@@ -27,11 +32,17 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_ParameterTest extends
27
  $this->assertEquals(1000, $requestParams['AMOUNT']);
28
  $this->assertEquals(4711, $requestParams['PAYID']);
29
  $this->assertEquals(Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_PARTIAL, $requestParams['OPERATION']);
30
- $this->assertEquals(Mage::app()->getStore($fakePayment->getOrder()->getStoreId())->getBaseCurrencyCode(), $requestParams['CURRENCY']);
 
 
 
31
  }
32
 
33
  public function testGetRequestParamsWithAdditionalParameters()
34
  {
 
 
 
35
  $fakePayment = Mage::getModel('sales/order_payment');
36
  $fakePayment->setOrder(Mage::getModel('sales/order'));
37
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
@@ -50,7 +61,10 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Capture_ParameterTest extends
50
  $this->assertEquals(1000, $requestParams['AMOUNT']);
51
  $this->assertEquals(4711, $requestParams['PAYID']);
52
  $this->assertEquals(Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_PARTIAL, $requestParams['OPERATION']);
53
- $this->assertEquals(Mage::app()->getStore($fakePayment->getOrder()->getStoreId())->getBaseCurrencyCode(), $requestParams['CURRENCY']);
 
 
 
54
  }
55
 
56
  }
1
  <?php
2
+
3
  /**
4
+ * @author Michael Lühr <michael.luehr@netresearch.de>
5
  * @category Netresearch_OPS
6
  * @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
 
12
  public function testGetRequestParams()
13
  {
14
+ $sessionMock = $this->mockSession('customer/session');
15
+ $sessionMock->disableOriginalConstructor();
16
+ $this->replaceByMock('singleton', 'customer/session', $sessionMock);
17
+
18
  $fakePayment = Mage::getModel('sales/order_payment');
19
  $fakePayment->setOrder(Mage::getModel('sales/order'));
20
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
32
  $this->assertEquals(1000, $requestParams['AMOUNT']);
33
  $this->assertEquals(4711, $requestParams['PAYID']);
34
  $this->assertEquals(Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_PARTIAL, $requestParams['OPERATION']);
35
+ $this->assertEquals(
36
+ Mage::app()->getStore($fakePayment->getOrder()->getStoreId())->getBaseCurrencyCode(),
37
+ $requestParams['CURRENCY']
38
+ );
39
  }
40
 
41
  public function testGetRequestParamsWithAdditionalParameters()
42
  {
43
+ $sessionMock = $this->mockSession('customer/session');
44
+ $sessionMock->disableOriginalConstructor();
45
+ $this->replaceByMock('singleton', 'customer/session', $sessionMock);
46
  $fakePayment = Mage::getModel('sales/order_payment');
47
  $fakePayment->setOrder(Mage::getModel('sales/order'));
48
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
61
  $this->assertEquals(1000, $requestParams['AMOUNT']);
62
  $this->assertEquals(4711, $requestParams['PAYID']);
63
  $this->assertEquals(Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_PARTIAL, $requestParams['OPERATION']);
64
+ $this->assertEquals(
65
+ Mage::app()->getStore($fakePayment->getOrder()->getStoreId())->getBaseCurrencyCode(),
66
+ $requestParams['CURRENCY']
67
+ );
68
  }
69
 
70
  }
app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/ParameterTest.php CHANGED
@@ -19,7 +19,8 @@ class Netresearch_OPS_Test_Model_Backend_Operation_ParameterTest extends EcomDev
19
  $amount = 0;
20
  $opsPaymentMethod = Mage::getModel('ops/payment_abstract');
21
  Mage::getModel('ops/backend_operation_parameter')->getParameterFor(
22
- 'NOT SUPPORTED OPERATION TYPE', $opsPaymentMethod, $fakePayment, $amount, $arrInfo);
 
23
  }
24
 
25
  public function testGetParameterForCaptureWillReturnArray()
19
  $amount = 0;
20
  $opsPaymentMethod = Mage::getModel('ops/payment_abstract');
21
  Mage::getModel('ops/backend_operation_parameter')->getParameterFor(
22
+ 'NOT SUPPORTED OPERATION TYPE', $opsPaymentMethod, $fakePayment, $amount, $arrInfo
23
+ );
24
  }
25
 
26
  public function testGetParameterForCaptureWillReturnArray()
app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Refund/Additional/OpenInvoiceNlTest.php CHANGED
@@ -3,30 +3,47 @@
3
  class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoiceNlTest extends EcomDev_PHPUnit_Test_Case
4
  {
5
  protected $openInvoiceNlModel = null;
6
- protected $testInvoice = null;
7
 
8
  public function setUp()
9
  {
10
  parent::setUp();
11
  $this->openInvoiceNlModel = Mage::getModel('ops/backend_operation_refund_additional_openInvoiceNl');
12
-
13
  $invoice = Mage::getModel('sales/order_invoice');
14
  // add first item to invoice
15
- $item = Mage::getModel('sales/order_invoice_item');
 
16
  $orderItem = Mage::getModel('sales/order_item');
17
  $orderItem->setId(1);
18
  $orderItem->setQtyOrdered(2);
 
 
 
19
  $item->setOrderItemId(1);
20
  $item->setOrderItem($orderItem);
21
  $item->setName('Item 1');
22
  $item->setBasePriceInclTax(42.99);
23
  $item->setQty(2);
24
  $item->setTaxPercent(19);
 
 
 
 
 
 
 
 
 
 
25
  $invoice->addItem($item);
 
26
  // add second item to invoice
27
  $orderItem = Mage::getModel('sales/order_item');
28
  $orderItem->setId(2);
29
  $orderItem->setQtyOrdered(2);
 
 
30
  $item = Mage::getModel('sales/order_invoice_item');
31
  $item->setOrderItemId(2);
32
  $item->setOrderItem($orderItem);
@@ -34,6 +51,16 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
34
  $item->setBasePriceInclTax(19.99);
35
  $item->setQty(2);
36
  $item->setTaxPercent(7);
 
 
 
 
 
 
 
 
 
 
37
  $invoice->addItem($item);
38
  // add shipping and discount
39
  $invoice->setBaseShippingInclTax(10.00);
@@ -43,17 +70,19 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
43
  $payment->setMethod('ops_openInvoiceNl');
44
  $order->setPayment($payment);
45
  $invoice->setOrder($order);
46
- $this->testInvoice = $invoice;
 
 
47
 
48
  $sessionMock = $this->getModelMockBuilder('adminhtml/session_quote')
49
- ->disableOriginalConstructor()
50
- ->setMethods(null)
51
- ->getMock();
52
  $this->replaceByMock('singleton', 'adminhtml/session_quote', $sessionMock);
53
  $sessionMock = $this->getModelMockBuilder('checkout/session')
54
- ->disableOriginalConstructor()
55
- ->setMethods(null)
56
- ->getMock();
57
  $this->replaceByMock('singleton', 'checkout/session', $sessionMock);
58
  $sessionMock = $this->getModelMockBuilder('customer/session')
59
  ->disableOriginalConstructor()
@@ -65,26 +94,17 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
65
 
66
  public function testExtractWithoutShippingAndAdjustments()
67
  {
68
- $params =
69
- array(
70
- 'creditmemo' => array(
71
- 'items' => array(
72
- 1 => array(
73
- 'qty' => 2
74
- ),
75
- 2 => array(
76
- 'qty' => 0
77
- )
78
- ),
79
- 'shipping_amount' => 0,
80
- 'adjustment_positive' => 0,
81
- 'adjustment_negative' => 0
82
-
83
- )
84
- );
85
 
 
 
 
 
 
 
 
86
  $this->mockRefundHelper($params);
87
- $result = $this->openInvoiceNlModel->extractAdditionalParams($this->testInvoice);
88
  // refunded item
89
  $this->assertTrue(is_array($result));
90
  $this->assertTrue(0 < count($result));
@@ -112,33 +132,27 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
112
  $this->assertArrayHasKey('TAXINCLUDED2', $result);
113
  $this->assertEquals(1, $result['TAXINCLUDED2']);
114
  $this->assertArrayHasKey('ITEMQUANT2', $result);
115
- $this->assertEquals(0, $result['ITEMQUANT2']);
116
  // amount
117
  $this->assertArrayHasKey('AMOUNT', $result);
118
- $this->assertEquals(8598, $result['AMOUNT']);
119
  }
120
 
121
 
122
  public function testWithShippingAndAllAdjustments()
123
  {
124
  $params = array(
125
- 'creditmemo' => array(
126
- 'items' => array(
127
- 1 => array(
128
- 'qty' => 0
129
- ),
130
- 2 => array(
131
- 'qty' => 0
132
- )
133
- ),
134
- 'shipping_amount' => 5,
135
- 'adjustment_positive' => 5,
136
- 'adjustment_negative' => 10
137
-
138
- )
139
  );
140
  $this->mockRefundHelper($params);
141
- $result = $this->openInvoiceNlModel->extractAdditionalParams($this->testInvoice);
 
 
142
  // Test our items
143
  $this->assertTrue(is_array($result));
144
  $this->assertTrue(0 < count($result));
@@ -153,7 +167,7 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
153
  $this->assertArrayHasKey('TAXINCLUDED1', $result);
154
  $this->assertEquals(1, $result['TAXINCLUDED1']);
155
  $this->assertArrayHasKey('ITEMQUANT1', $result);
156
- $this->assertEquals(0, $result['ITEMQUANT1']);
157
  $this->assertArrayHasKey('ITEMID2', $result);
158
  $this->assertEquals(2, $result['ITEMID2']);
159
  $this->assertArrayHasKey('ITEMNAME2', $result);
@@ -165,7 +179,7 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
165
  $this->assertArrayHasKey('TAXINCLUDED2', $result);
166
  $this->assertEquals(1, $result['TAXINCLUDED2']);
167
  $this->assertArrayHasKey('ITEMQUANT2', $result);
168
- $this->assertEquals(0, $result['ITEMQUANT2']);
169
 
170
  // shipping
171
  $this->assertArrayHasKey('ITEMID3', $result);
@@ -209,15 +223,17 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
209
  $this->assertEquals(1, $result['ITEMQUANT5']);
210
  // amount: 5+5+(-10)
211
  $this->assertArrayHasKey('AMOUNT', $result);
212
- $this->assertEquals(0, $result['AMOUNT']);
213
  }
214
 
215
  protected function mockRefundHelper($params)
216
  {
217
- $helperMock = $this->getHelperMock('ops/order_refund', array('getCreditMemoRequestParams', 'createRefundTransaction'));
 
 
218
  $helperMock->expects($this->any())
219
- ->method('getCreditMemoRequestParams')
220
- ->will($this->returnValue($params));
221
  $this->replaceByMock('helper', 'ops/order_refund', $helperMock);
222
  }
223
 
@@ -226,7 +242,7 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoice
226
  {
227
  parent::tearDown();
228
  $this->openInvoiceNlModel = null;
229
- $this->testInvoice = null;
230
  }
231
  }
232
 
3
  class Netresearch_OPS_Test_Model_Backend_Operation_Refund_Additional_OpenInvoiceNlTest extends EcomDev_PHPUnit_Test_Case
4
  {
5
  protected $openInvoiceNlModel = null;
6
+ protected $testPayment = null;
7
 
8
  public function setUp()
9
  {
10
  parent::setUp();
11
  $this->openInvoiceNlModel = Mage::getModel('ops/backend_operation_refund_additional_openInvoiceNl');
12
+ $creditMemo = Mage::getModel('sales/order_creditmemo');
13
  $invoice = Mage::getModel('sales/order_invoice');
14
  // add first item to invoice
15
+
16
+
17
  $orderItem = Mage::getModel('sales/order_item');
18
  $orderItem->setId(1);
19
  $orderItem->setQtyOrdered(2);
20
+ $orderItem->setTaxPercent(19);
21
+
22
+ $item = Mage::getModel('sales/order_invoice_item');
23
  $item->setOrderItemId(1);
24
  $item->setOrderItem($orderItem);
25
  $item->setName('Item 1');
26
  $item->setBasePriceInclTax(42.99);
27
  $item->setQty(2);
28
  $item->setTaxPercent(19);
29
+
30
+ $orderItem->setQtyInvoiced(2);
31
+ $creditMemoItem = Mage::getModel('sales/order_creditmemo_item');
32
+ $creditMemoItem->setOrderItemId(1);
33
+ $creditMemoItem->setOrderItem($orderItem);
34
+ $creditMemoItem->setName('Item 1');
35
+ $creditMemoItem->setBasePriceInclTax(42.99);
36
+ $creditMemoItem->setQty(2);
37
+
38
+ $creditMemo->addItem($creditMemoItem);
39
  $invoice->addItem($item);
40
+
41
  // add second item to invoice
42
  $orderItem = Mage::getModel('sales/order_item');
43
  $orderItem->setId(2);
44
  $orderItem->setQtyOrdered(2);
45
+ $orderItem->setTaxPercent(7);
46
+
47
  $item = Mage::getModel('sales/order_invoice_item');
48
  $item->setOrderItemId(2);
49
  $item->setOrderItem($orderItem);
51
  $item->setBasePriceInclTax(19.99);
52
  $item->setQty(2);
53
  $item->setTaxPercent(7);
54
+
55
+ $orderItem->setQtyInvoiced(2);
56
+ $creditMemoItem = Mage::getModel('sales/order_creditmemo_item');
57
+ $creditMemoItem->setOrderItemId(2);
58
+ $creditMemoItem->setOrderItem($orderItem);
59
+ $creditMemoItem->setName('Item 2');
60
+ $creditMemoItem->setBasePriceInclTax(19.99);
61
+ $creditMemoItem->setQty(2);
62
+
63
+ $creditMemo->addItem($creditMemoItem);
64
  $invoice->addItem($item);
65
  // add shipping and discount
66
  $invoice->setBaseShippingInclTax(10.00);
70
  $payment->setMethod('ops_openInvoiceNl');
71
  $order->setPayment($payment);
72
  $invoice->setOrder($order);
73
+ $payment->setInvoice($invoice);
74
+ $payment->setCreditmemo($creditMemo);
75
+ $this->testPayment = $payment;
76
 
77
  $sessionMock = $this->getModelMockBuilder('adminhtml/session_quote')
78
+ ->disableOriginalConstructor()
79
+ ->setMethods(null)
80
+ ->getMock();
81
  $this->replaceByMock('singleton', 'adminhtml/session_quote', $sessionMock);
82
  $sessionMock = $this->getModelMockBuilder('checkout/session')
83
+ ->disableOriginalConstructor()
84
+ ->setMethods(null)
85
+ ->getMock();
86
  $this->replaceByMock('singleton', 'checkout/session', $sessionMock);
87
  $sessionMock = $this->getModelMockBuilder('customer/session')
88
  ->disableOriginalConstructor()
94
 
95
  public function testExtractWithoutShippingAndAdjustments()
96
  {
97
+ $params = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
+ 'shipping_amount' => 0,
100
+ 'adjustment_positive' => 0,
101
+ 'adjustment_negative' => 0
102
+
103
+
104
+ );
105
+ $this->testPayment->getCreditmemo()->addData($params);
106
  $this->mockRefundHelper($params);
107
+ $result = $this->openInvoiceNlModel->extractAdditionalParams($this->testPayment);
108
  // refunded item
109
  $this->assertTrue(is_array($result));
110
  $this->assertTrue(0 < count($result));
132
  $this->assertArrayHasKey('TAXINCLUDED2', $result);
133
  $this->assertEquals(1, $result['TAXINCLUDED2']);
134
  $this->assertArrayHasKey('ITEMQUANT2', $result);
135
+ $this->assertEquals(2, $result['ITEMQUANT2']);
136
  // amount
137
  $this->assertArrayHasKey('AMOUNT', $result);
138
+ $this->assertEquals(12596, $result['AMOUNT']);
139
  }
140
 
141
 
142
  public function testWithShippingAndAllAdjustments()
143
  {
144
  $params = array(
145
+
146
+ 'base_shipping_incl_tax' => 5,
147
+ 'base_adjustment_positive' => 5,
148
+ 'base_adjustment_negative' => 10
149
+
150
+
 
 
 
 
 
 
 
 
151
  );
152
  $this->mockRefundHelper($params);
153
+ $this->testPayment->getCreditmemo()->addData($params);
154
+
155
+ $result = $this->openInvoiceNlModel->extractAdditionalParams($this->testPayment);
156
  // Test our items
157
  $this->assertTrue(is_array($result));
158
  $this->assertTrue(0 < count($result));
167
  $this->assertArrayHasKey('TAXINCLUDED1', $result);
168
  $this->assertEquals(1, $result['TAXINCLUDED1']);
169
  $this->assertArrayHasKey('ITEMQUANT1', $result);
170
+ $this->assertEquals(2, $result['ITEMQUANT1']);
171
  $this->assertArrayHasKey('ITEMID2', $result);
172
  $this->assertEquals(2, $result['ITEMID2']);
173
  $this->assertArrayHasKey('ITEMNAME2', $result);
179
  $this->assertArrayHasKey('TAXINCLUDED2', $result);
180
  $this->assertEquals(1, $result['TAXINCLUDED2']);
181
  $this->assertArrayHasKey('ITEMQUANT2', $result);
182
+ $this->assertEquals(2, $result['ITEMQUANT2']);
183
 
184
  // shipping
185
  $this->assertArrayHasKey('ITEMID3', $result);
223
  $this->assertEquals(1, $result['ITEMQUANT5']);
224
  // amount: 5+5+(-10)
225
  $this->assertArrayHasKey('AMOUNT', $result);
226
+ $this->assertEquals(12596, $result['AMOUNT']);
227
  }
228
 
229
  protected function mockRefundHelper($params)
230
  {
231
+ $helperMock = $this->getHelperMock(
232
+ 'ops/order_refund', array('getCreditMemoRequestParams', 'createRefundTransaction')
233
+ );
234
  $helperMock->expects($this->any())
235
+ ->method('getCreditMemoRequestParams')
236
+ ->will($this->returnValue($params));
237
  $this->replaceByMock('helper', 'ops/order_refund', $helperMock);
238
  }
239
 
242
  {
243
  parent::tearDown();
244
  $this->openInvoiceNlModel = null;
245
+ $this->testPayment = null;
246
  }
247
  }
248
 
app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Refund/ParameterTest.php CHANGED
@@ -6,6 +6,8 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_ParameterTest extends
6
  public function testGetRequestParams()
7
  {
8
  $fakePayment = Mage::getModel('sales/order_payment');
 
 
9
  $fakePayment->setOrder(Mage::getModel('sales/order'));
10
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
11
  $arrInfo = array(
@@ -30,9 +32,14 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_ParameterTest extends
30
 
31
  public function testGetRequestParamsWithAdditionalParameters()
32
  {
 
 
33
 
34
  $fakePayment = Mage::getModel('sales/order_payment');
35
- $fakePayment->setOrder(Mage::getModel('sales/order'));
 
 
 
36
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
37
  $fakeInvoice = Mage::getModel('sales/order_invoice');
38
  $fakePayment->setInvoice($fakeInvoice);
@@ -40,11 +47,10 @@ class Netresearch_OPS_Test_Model_Backend_Operation_Refund_ParameterTest extends
40
  'operation' => 'refund',
41
  'invoice_id' => 2
42
  );
43
- $amount = 10;
44
  $opsPaymentMethod = Mage::getModel('ops/payment_openInvoiceNl');
45
  $captureParameterModel = Mage::getModel('ops/backend_operation_refund_parameter');
46
  $this->mockRefundHelper();
47
- $requestParams = $captureParameterModel->getRequestParams($opsPaymentMethod, $fakePayment, $amount, $arrInfo);
48
  $this->assertArrayHasKey('AMOUNT', $requestParams);
49
  $this->assertArrayHasKey('PAYID', $requestParams);
50
  $this->assertArrayHasKey('OPERATION', $requestParams);
6
  public function testGetRequestParams()
7
  {
8
  $fakePayment = Mage::getModel('sales/order_payment');
9
+ $creditMemo = Mage::getModel('sales/order_creditmemo');
10
+ $fakePayment->setCreditmemo($creditMemo);
11
  $fakePayment->setOrder(Mage::getModel('sales/order'));
12
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
13
  $arrInfo = array(
32
 
33
  public function testGetRequestParamsWithAdditionalParameters()
34
  {
35
+ $customerSession = $this->getModelMockBuilder('customer/session')->disableOriginalConstructor()->getMock();
36
+ $this->replaceByMock('model', 'customer/session', $customerSession);
37
 
38
  $fakePayment = Mage::getModel('sales/order_payment');
39
+ $creditMemo = Mage::getModel('sales/order_creditmemo');
40
+ $creditMemo->setBaseShippingInclTax(10);
41
+ $fakePayment->setCreditmemo($creditMemo);
42
+ $fakePayment->setOrder(Mage::getModel('sales/order')->setBaseGrandTotal(100));
43
  $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
44
  $fakeInvoice = Mage::getModel('sales/order_invoice');
45
  $fakePayment->setInvoice($fakeInvoice);
47
  'operation' => 'refund',
48
  'invoice_id' => 2
49
  );
 
50
  $opsPaymentMethod = Mage::getModel('ops/payment_openInvoiceNl');
51
  $captureParameterModel = Mage::getModel('ops/backend_operation_refund_parameter');
52
  $this->mockRefundHelper();
53
+ $requestParams = $captureParameterModel->getRequestParams($opsPaymentMethod, $fakePayment, 0, $arrInfo);
54
  $this->assertArrayHasKey('AMOUNT', $requestParams);
55
  $this->assertArrayHasKey('PAYID', $requestParams);
56
  $this->assertArrayHasKey('OPERATION', $requestParams);
app/code/community/Netresearch/OPS/Test/Model/ConfigTest.php CHANGED
@@ -240,6 +240,35 @@ class Netresearch_OPS_Test_Model_ConfigTest
240
  }
241
 
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  public function testGetAcceptRedirectLocation()
244
  {
245
  $this->assertEquals(
@@ -404,6 +433,9 @@ class Netresearch_OPS_Test_Model_ConfigTest
404
  'OWNERTELNO' => 30,
405
  'OWNERADDRESS' => 35,
406
  'ECOM_BILLTO_POSTAL_POSTALCODE' => 10,
 
 
 
407
  );
408
 
409
  }
@@ -511,6 +543,14 @@ class Netresearch_OPS_Test_Model_ConfigTest
511
  $this->assertEquals($config->getResendPaymentInfoTemplate(), 'payment_services_ops_resendPaymentInfo_template');
512
  }
513
 
 
 
 
 
 
 
 
 
514
  public function testGetResendPaymentInfoIdentity()
515
  {
516
  $config = Mage::getModel('ops/config');
240
  }
241
 
242
 
243
+ public function getAliasUsageForNewAlias()
244
+ {
245
+ $path = 'payment/ops_cc/alias_usage_for_new_alias';
246
+ $store = Mage::app()->getStore(0)->load(0);
247
+ $store->resetConfig();
248
+ $store->setConfig($path, 'my text goes here');
249
+
250
+ $this->assertEquals('my text goes here', $this->_model->getAliasUsageForNewAlias('ops_cc', 0));
251
+
252
+ $store->resetConfig();
253
+ $store->setConfig($path, 'my text goes here two');
254
+ $this->assertNotEquals('my text goes here', $this->_model->getAliasUsageForNewAlias('ops_cc', 0));
255
+ }
256
+
257
+
258
+ public function getAliasUsageForExistingAlias()
259
+ {
260
+ $path = 'payment/ops_cc/alias_usage_for_existing_alias';
261
+ $store = Mage::app()->getStore(0)->load(0);
262
+ $store->resetConfig();
263
+ $store->setConfig($path, 'my text goes here');
264
+
265
+ $this->assertEquals('my text goes here', $this->_model->getAliasUsageForNewAlias('ops_cc', 0));
266
+
267
+ $store->resetConfig();
268
+ $store->setConfig($path, 'my text goes here two');
269
+ $this->assertNotEquals('my text goes here', $this->_model->getAliasUsageForNewAlias('ops_cc', 0));
270
+ }
271
+
272
  public function testGetAcceptRedirectLocation()
273
  {
274
  $this->assertEquals(
433
  'OWNERTELNO' => 30,
434
  'OWNERADDRESS' => 35,
435
  'ECOM_BILLTO_POSTAL_POSTALCODE' => 10,
436
+ 'ECOM_BILLTO_POSTAL_NAME_FIRST' => 50,
437
+ 'ECOM_BILLTO_POSTAL_NAME_LAST' => 50,
438
+ 'ECOM_SHIPTO_POSTAL_STATE' => 35
439
  );
440
 
441
  }
543
  $this->assertEquals($config->getResendPaymentInfoTemplate(), 'payment_services_ops_resendPaymentInfo_template');
544
  }
545
 
546
+
547
+ public function testGetPayPerMailTemplate()
548
+ {
549
+ $config = Mage::getModel('ops/config');
550
+ $this->assertEquals($config->getPayPerMailTemplate(), 'payment_services_ops_payPerMail_template');
551
+ }
552
+
553
+
554
  public function testGetResendPaymentInfoIdentity()
555
  {
556
  $config = Mage::getModel('ops/config');
app/code/community/Netresearch/OPS/Test/Model/File/Download.php CHANGED
@@ -7,7 +7,7 @@ class Netresearch_OPS_Test_Model_File_Download extends EcomDev_PHPUnit_Test_Case
7
  {
8
  $this->testFile = Mage::helper('ops/data')->getLogPath();
9
  if(!file_exists($this->testFile)){
10
- $file = fopen($this->testFile,'c');
11
  fclose($file);
12
  }
13
 
@@ -22,10 +22,11 @@ class Netresearch_OPS_Test_Model_File_Download extends EcomDev_PHPUnit_Test_Case
22
  $model->getFile($path);
23
  }
24
 
25
- public function testSuccessGetFile(){
 
26
  $model = Mage::getModel('ops/file_download');
27
  if(filesize($this->testFile) > $model::ONE_MEGABYTE){
28
- $this->assertEquals(0, strpos(basename($model->getFile($this->testFile)),'tempFile'));
29
  }else{
30
  $this->assertEquals($model->getFile($this->testFile), $this->testFile);
31
  }
7
  {
8
  $this->testFile = Mage::helper('ops/data')->getLogPath();
9
  if(!file_exists($this->testFile)){
10
+ $file = fopen($this->testFile, 'c');
11
  fclose($file);
12
  }
13
 
22
  $model->getFile($path);
23
  }
24
 
25
+ public function testSuccessGetFile()
26
+ {
27
  $model = Mage::getModel('ops/file_download');
28
  if(filesize($this->testFile) > $model::ONE_MEGABYTE){
29
+ $this->assertEquals(0, strpos(basename($model->getFile($this->testFile)), 'tempFile'));
30
  }else{
31
  $this->assertEquals($model->getFile($this->testFile), $this->testFile);
32
  }
app/code/community/Netresearch/OPS/Test/Model/Mysql4/Alias/AliasTest.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  class Netresearch_OPS_Test_Model_Mysql4_Alias_CollectionTest extends EcomDev_PHPUnit_Test_Case
3
- {
 
4
  public function testType()
5
  {
6
  $this->assertTypeOf('Netresearch_OPS_Model_Mysql4_Alias_Collection', Mage::getModel('ops/mysql4_alias')->getCollection());
1
  <?php
2
  class Netresearch_OPS_Test_Model_Mysql4_Alias_CollectionTest extends EcomDev_PHPUnit_Test_Case
3
+ {
4
+
5
  public function testType()
6
  {
7
  $this->assertTypeOf('Netresearch_OPS_Model_Mysql4_Alias_Collection', Mage::getModel('ops/mysql4_alias')->getCollection());
app/code/community/Netresearch/OPS/Test/Model/ObserverTest.php CHANGED
@@ -125,7 +125,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
125
  $order->setPayment($payment);
126
  $invoice = new Varien_Object();
127
  $invoice->setTransactionId(1);
128
- $creditMemo = $this->getModelMock('sales/order_creditmemo',
 
129
  array('getOrder', 'getInvoice', 'canRefund', 'getOrderId')
130
  );
131
  $creditMemo->expects($this->any())
@@ -143,7 +144,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
143
  Mage::register('current_creditmemo', $creditMemo);
144
  $block = Mage::app()->getLayout()->getBlockSingleton('adminhtml/sales_order_creditmemo_create');
145
 
146
- $blockMock = $this->getBlockMock('ops/adminhtml_sales_order_creditmemo_closedTransaction_warning',
 
147
  array('renderView')
148
  );
149
  $blockMock->expects($this->once())
@@ -187,7 +189,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
187
  ->will($this->returnValue('USD'));
188
  $this->replaceByMock('helper', 'ops/quote', $quoteHelperMock);
189
 
190
- $observerMock = $this->getModelMock('ops/observer',
 
191
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
192
  );
193
  $observerMock->expects($this->any())
@@ -206,7 +209,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
206
  ->will($this->returnValue(1));
207
  $this->replaceByMock('model', 'customer/session', $customerSessionMock);
208
 
209
- $configModelMock = $this->getModelMock('ops/config', array(
 
210
  'get3dSecureIsActive',
211
  'getAcceptUrl',
212
  'getDeclineUrl',
@@ -242,7 +246,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
242
  ->will($this->returnValue(true));
243
  $this->replaceByMock('helper', 'ops/data', $helperMock);
244
 
245
- $observerMock = $this->getModelMock('ops/observer',
 
246
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
247
  );
248
 
@@ -352,7 +357,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
352
  $quote = Mage::getModel('sales/quote')->load(10);
353
  $order = Mage::getModel('sales/order')->load(11);
354
 
355
- $observerMock = $this->getModelMock('ops/observer',
 
356
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
357
  );
358
 
@@ -401,7 +407,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
401
  $order = Mage::getModel('sales/order')->load(11);
402
 
403
 
404
- $observerMock = $this->getModelMock('ops/observer',
 
405
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
406
  );
407
 
@@ -665,7 +672,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
665
  ->method('getMessages')
666
  ->will($this->returnValue(array('Foo' => 'Not Valid')));
667
  $this->replaceByMock('model', 'ops/validator_parameter_validator', $validatorMock);
668
- $fakeResponse->setBody(Mage::helper('core/data')->jsonEncode(array('error' => false, 'update_section' => 'foo'))
 
669
  );
670
  $fakeController->setResponse($fakeResponse);
671
  $event = new Varien_Event_Observer();
@@ -746,7 +754,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
746
  public function testSetOrderStateForDirectLinkDoesNotChangeStateDueToMissingStatus()
747
  {
748
  $order = $this->getOrderForDirectDebitNlTest();
749
- $event = $this->getEventForDirectDebitNlTests($order, 'ops/payment_directDebit',
 
750
  array('PM' => 'Direct Debits NL')
751
  );
752
  $this->registerPaymentHelperMockForDirectDebitNlTests(true);
@@ -759,7 +768,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
759
  public function testSetOrderStateForDirectLinkDoesNotChangeStateDueToWrongPm()
760
  {
761
  $order = $this->getOrderForDirectDebitNlTest();
762
- $event = $this->getEventForDirectDebitNlTests($order, 'ops/payment_directDebit',
 
763
  array('PM' => 'Direct Debits DE', 'STATUS' => 51)
764
  );
765
  $this->registerPaymentHelperMockForDirectDebitNlTests(true);
@@ -772,7 +782,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
772
  public function testSetOrderStateForDirectLinkDoesNotChangeStateDueToWrongStatus()
773
  {
774
  $order = $this->getOrderForDirectDebitNlTest();
775
- $event = $this->getEventForDirectDebitNlTests($order, 'ops/payment_directDebit',
 
776
  array('PM' => 'Direct Debits NL', 'STATUS' => 5)
777
  );
778
  $this->registerPaymentHelperMockForDirectDebitNlTests(true);
@@ -785,7 +796,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
785
  public function testSetOrderStateForDirectLinkDoesChangeState()
786
  {
787
  $order = $this->getOrderForDirectDebitNlTest();
788
- $event = $this->getEventForDirectDebitNlTests($order, 'ops/payment_directDebit',
 
789
  array('PM' => 'Direct Debits NL',
790
  'status' => Netresearch_OPS_Model_Status::AUTHORIZED)
791
  );
@@ -857,7 +869,8 @@ class Netresearch_OPS_Test_Model_ObserverTest
857
  $subject->updateRecurringProfileButtons($observer);
858
  $html = $block->getButtonsHtml('header');
859
 
860
- $this->assertContains('Suspending the subscription here will not actually cancel the subscription on PayEngine side.',
 
861
  $html
862
  );
863
  }
@@ -886,30 +899,31 @@ class Netresearch_OPS_Test_Model_ObserverTest
886
  public function sendTransactionalEmailsNoOps()
887
  {
888
  // no emails on third party payments
889
- $helperMock = $this->getHelperMock('ops/data', ['sendTransactionalEmail']);
890
  $helperMock
891
  ->expects($this->never())
892
  ->method('sendTransactionalEmail')
893
- ->with($this->isInstanceOf('Mage_Sales_Model_Order'))
894
- ;
895
  $this->replaceByMock('helper', 'ops/data', $helperMock);
896
 
897
- $payment = new Varien_Object([
 
898
  'method' => Mage::getModel('payment/method_checkmo')->getCode(),
899
- ]);
900
- $order = new Varien_Object([
 
 
901
  'payment' => $payment,
902
- ]);
 
903
 
904
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
905
- ->setMethods(['getOrder'])
906
- ->getMock()
907
- ;
908
  $observerMock
909
  ->expects($this->once())
910
  ->method('getOrder')
911
- ->willReturn($order)
912
- ;
913
 
914
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
915
  }
@@ -920,39 +934,41 @@ class Netresearch_OPS_Test_Model_ObserverTest
920
  public function sendTransactionalEmailsGatewayPayment()
921
  {
922
  // no emails on ingenico redirect payments
923
- $helperMock = $this->getHelperMock('ops/data', ['sendTransactionalEmail']);
924
  $helperMock
925
  ->expects($this->never())
926
  ->method('sendTransactionalEmail')
927
- ->with($this->isInstanceOf('Mage_Sales_Model_Order'))
928
- ;
929
  $this->replaceByMock('helper', 'ops/data', $helperMock);
930
 
931
- $payment = new Varien_Object([
 
932
  'method_instance' => Mage::getModel('ops/payment_bankTransfer'),
933
  'order_place_redirect_url' => 'foo',
934
- ]);
935
- $order = new Varien_Object([
 
 
936
  'payment' => $payment,
937
- ]);
938
- $quote = new Varien_Object([
 
 
939
  'payment' => $payment,
940
- ]);
 
941
 
942
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
943
- ->setMethods(['getOrder', 'getQuote'])
944
- ->getMock()
945
- ;
946
  $observerMock
947
  ->expects($this->once())
948
  ->method('getOrder')
949
- ->willReturn($order)
950
- ;
951
  $observerMock
952
  ->expects($this->once())
953
  ->method('getQuote')
954
- ->willReturn($quote)
955
- ;
956
 
957
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
958
  }
@@ -964,7 +980,7 @@ class Netresearch_OPS_Test_Model_ObserverTest
964
  {
965
  // exception not really testable.
966
  // just assert that second call to sendTransactionalEmail is not invoked
967
- $helperMock = $this->getHelperMock('ops/data', ['sendTransactionalEmail']);
968
  $helperMock
969
  ->expects($this->exactly(1))
970
  ->method('sendTransactionalEmail')
@@ -972,38 +988,37 @@ class Netresearch_OPS_Test_Model_ObserverTest
972
  $this->isInstanceOf('Mage_Sales_Model_Order'),
973
  $this->isInstanceOf('Mage_Sales_Model_Order_Invoice')
974
  )
975
- ->willThrowException(new Exception('no mails foo'))
976
- ;
977
  $this->replaceByMock('helper', 'ops/data', $helperMock);
978
 
979
 
980
- $payment = new Varien_Object([
 
981
  'method_instance' => Mage::getModel('ops/payment_bankTransfer'),
982
- ]);
983
- $quote = new Varien_Object([
 
 
984
  'payment' => $payment,
985
- ]);
986
- $orderMock = $this->getModelMock('sales/order', ['getPayment']);
 
987
  $orderMock
988
  ->expects($this->once())
989
  ->method('getPayment')
990
- ->willReturn($payment)
991
- ;
992
 
993
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
994
- ->setMethods(['getOrder', 'getQuote'])
995
- ->getMock()
996
- ;
997
  $observerMock
998
  ->expects($this->once())
999
  ->method('getOrder')
1000
- ->willReturn($orderMock)
1001
- ;
1002
  $observerMock
1003
  ->expects($this->once())
1004
  ->method('getQuote')
1005
- ->willReturn($quote)
1006
- ;
1007
 
1008
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
1009
  }
@@ -1013,48 +1028,84 @@ class Netresearch_OPS_Test_Model_ObserverTest
1013
  */
1014
  public function sendTransactionalEmailsSuccess()
1015
  {
1016
- $helperMock = $this->getHelperMock('ops/data', ['sendTransactionalEmail']);
1017
  $helperMock
1018
  ->expects($this->exactly(2))
1019
  ->method('sendTransactionalEmail')
1020
  ->withConsecutive(
1021
  $this->isInstanceOf('Mage_Sales_Model_Order'),
1022
  $this->isInstanceOf('Mage_Sales_Model_Order_Invoice')
1023
- )
1024
- ;
1025
  $this->replaceByMock('helper', 'ops/data', $helperMock);
1026
 
1027
  // invoice
1028
  $invoice = Mage::getModel('sales/order_invoice');
1029
 
1030
  // order payment
1031
- $payment = new Varien_Object([
 
1032
  'method_instance' => Mage::getModel('ops/payment_cc'),
1033
  'created_invoice' => $invoice,
1034
- ]);
 
1035
 
1036
  // order
1037
- $orderMock = $this->getModelMock('sales/order', ['getPayment']);
1038
  $orderMock
1039
  ->expects($this->exactly(2))
1040
  ->method('getPayment')
1041
- ->willReturn($payment)
1042
- ;
1043
  $this->replaceByMock('model', 'sales/order', $orderMock);
1044
  $order = Mage::getModel('sales/order');
1045
 
1046
  // quote
1047
- $quote = new Varien_Object([
 
1048
  'payment' => $payment,
1049
- ]);
 
1050
 
1051
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
1052
- ->setMethods(['getOrder', 'getQuote'])
1053
- ->getMock()
1054
- ;
1055
  $observerMock->expects($this->once())->method('getOrder')->willReturn($order);
1056
  $observerMock->expects($this->once())->method('getQuote')->willReturn($quote);
1057
 
1058
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
1059
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1060
  }
125
  $order->setPayment($payment);
126
  $invoice = new Varien_Object();
127
  $invoice->setTransactionId(1);
128
+ $creditMemo = $this->getModelMock(
129
+ 'sales/order_creditmemo',
130
  array('getOrder', 'getInvoice', 'canRefund', 'getOrderId')
131
  );
132
  $creditMemo->expects($this->any())
144
  Mage::register('current_creditmemo', $creditMemo);
145
  $block = Mage::app()->getLayout()->getBlockSingleton('adminhtml/sales_order_creditmemo_create');
146
 
147
+ $blockMock = $this->getBlockMock(
148
+ 'ops/adminhtml_sales_order_creditmemo_closedTransaction_warning',
149
  array('renderView')
150
  );
151
  $blockMock->expects($this->once())
189
  ->will($this->returnValue('USD'));
190
  $this->replaceByMock('helper', 'ops/quote', $quoteHelperMock);
191
 
192
+ $observerMock = $this->getModelMock(
193
+ 'ops/observer',
194
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
195
  );
196
  $observerMock->expects($this->any())
209
  ->will($this->returnValue(1));
210
  $this->replaceByMock('model', 'customer/session', $customerSessionMock);
211
 
212
+ $configModelMock = $this->getModelMock(
213
+ 'ops/config', array(
214
  'get3dSecureIsActive',
215
  'getAcceptUrl',
216
  'getDeclineUrl',
246
  ->will($this->returnValue(true));
247
  $this->replaceByMock('helper', 'ops/data', $helperMock);
248
 
249
+ $observerMock = $this->getModelMock(
250
+ 'ops/observer',
251
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
252
  );
253
 
357
  $quote = Mage::getModel('sales/quote')->load(10);
358
  $order = Mage::getModel('sales/order')->load(11);
359
 
360
+ $observerMock = $this->getModelMock(
361
+ 'ops/observer',
362
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
363
  );
364
 
407
  $order = Mage::getModel('sales/order')->load(11);
408
 
409
 
410
+ $observerMock = $this->getModelMock(
411
+ 'ops/observer',
412
  array('performDirectLinkRequest', 'invokeRequestParamValidation')
413
  );
414
 
672
  ->method('getMessages')
673
  ->will($this->returnValue(array('Foo' => 'Not Valid')));
674
  $this->replaceByMock('model', 'ops/validator_parameter_validator', $validatorMock);
675
+ $fakeResponse->setBody(
676
+ Mage::helper('core/data')->jsonEncode(array('error' => false, 'update_section' => 'foo'))
677
  );
678
  $fakeController->setResponse($fakeResponse);
679
  $event = new Varien_Event_Observer();
754
  public function testSetOrderStateForDirectLinkDoesNotChangeStateDueToMissingStatus()
755
  {
756
  $order = $this->getOrderForDirectDebitNlTest();
757
+ $event = $this->getEventForDirectDebitNlTests(
758
+ $order, 'ops/payment_directDebit',
759
  array('PM' => 'Direct Debits NL')
760
  );
761
  $this->registerPaymentHelperMockForDirectDebitNlTests(true);
768
  public function testSetOrderStateForDirectLinkDoesNotChangeStateDueToWrongPm()
769
  {
770
  $order = $this->getOrderForDirectDebitNlTest();
771
+ $event = $this->getEventForDirectDebitNlTests(
772
+ $order, 'ops/payment_directDebit',
773
  array('PM' => 'Direct Debits DE', 'STATUS' => 51)
774
  );
775
  $this->registerPaymentHelperMockForDirectDebitNlTests(true);
782
  public function testSetOrderStateForDirectLinkDoesNotChangeStateDueToWrongStatus()
783
  {
784
  $order = $this->getOrderForDirectDebitNlTest();
785
+ $event = $this->getEventForDirectDebitNlTests(
786
+ $order, 'ops/payment_directDebit',
787
  array('PM' => 'Direct Debits NL', 'STATUS' => 5)
788
  );
789
  $this->registerPaymentHelperMockForDirectDebitNlTests(true);
796
  public function testSetOrderStateForDirectLinkDoesChangeState()
797
  {
798
  $order = $this->getOrderForDirectDebitNlTest();
799
+ $event = $this->getEventForDirectDebitNlTests(
800
+ $order, 'ops/payment_directDebit',
801
  array('PM' => 'Direct Debits NL',
802
  'status' => Netresearch_OPS_Model_Status::AUTHORIZED)
803
  );
869
  $subject->updateRecurringProfileButtons($observer);
870
  $html = $block->getButtonsHtml('header');
871
 
872
+ $this->assertContains(
873
+ 'Suspending the subscription here will not actually cancel the subscription on PayEngine side.',
874
  $html
875
  );
876
  }
899
  public function sendTransactionalEmailsNoOps()
900
  {
901
  // no emails on third party payments
902
+ $helperMock = $this->getHelperMock('ops/data', array('sendTransactionalEmail'));
903
  $helperMock
904
  ->expects($this->never())
905
  ->method('sendTransactionalEmail')
906
+ ->with($this->isInstanceOf('Mage_Sales_Model_Order'));
 
907
  $this->replaceByMock('helper', 'ops/data', $helperMock);
908
 
909
+ $payment = new Varien_Object(
910
+ array(
911
  'method' => Mage::getModel('payment/method_checkmo')->getCode(),
912
+ )
913
+ );
914
+ $order = new Varien_Object(
915
+ array(
916
  'payment' => $payment,
917
+ )
918
+ );
919
 
920
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
921
+ ->setMethods(array('getOrder'))
922
+ ->getMock();
 
923
  $observerMock
924
  ->expects($this->once())
925
  ->method('getOrder')
926
+ ->willReturn($order);
 
927
 
928
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
929
  }
934
  public function sendTransactionalEmailsGatewayPayment()
935
  {
936
  // no emails on ingenico redirect payments
937
+ $helperMock = $this->getHelperMock('ops/data', array('sendTransactionalEmail'));
938
  $helperMock
939
  ->expects($this->never())
940
  ->method('sendTransactionalEmail')
941
+ ->with($this->isInstanceOf('Mage_Sales_Model_Order'));
 
942
  $this->replaceByMock('helper', 'ops/data', $helperMock);
943
 
944
+ $payment = new Varien_Object(
945
+ array(
946
  'method_instance' => Mage::getModel('ops/payment_bankTransfer'),
947
  'order_place_redirect_url' => 'foo',
948
+ )
949
+ );
950
+ $order = new Varien_Object(
951
+ array(
952
  'payment' => $payment,
953
+ )
954
+ );
955
+ $quote = new Varien_Object(
956
+ array(
957
  'payment' => $payment,
958
+ )
959
+ );
960
 
961
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
962
+ ->setMethods(array('getOrder', 'getQuote'))
963
+ ->getMock();
 
964
  $observerMock
965
  ->expects($this->once())
966
  ->method('getOrder')
967
+ ->willReturn($order);
 
968
  $observerMock
969
  ->expects($this->once())
970
  ->method('getQuote')
971
+ ->willReturn($quote);
 
972
 
973
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
974
  }
980
  {
981
  // exception not really testable.
982
  // just assert that second call to sendTransactionalEmail is not invoked
983
+ $helperMock = $this->getHelperMock('ops/data', array('sendTransactionalEmail'));
984
  $helperMock
985
  ->expects($this->exactly(1))
986
  ->method('sendTransactionalEmail')
988
  $this->isInstanceOf('Mage_Sales_Model_Order'),
989
  $this->isInstanceOf('Mage_Sales_Model_Order_Invoice')
990
  )
991
+ ->willThrowException(new Exception('no mails foo'));
 
992
  $this->replaceByMock('helper', 'ops/data', $helperMock);
993
 
994
 
995
+ $payment = new Varien_Object(
996
+ array(
997
  'method_instance' => Mage::getModel('ops/payment_bankTransfer'),
998
+ )
999
+ );
1000
+ $quote = new Varien_Object(
1001
+ array(
1002
  'payment' => $payment,
1003
+ )
1004
+ );
1005
+ $orderMock = $this->getModelMock('sales/order', array('getPayment'));
1006
  $orderMock
1007
  ->expects($this->once())
1008
  ->method('getPayment')
1009
+ ->willReturn($payment);
 
1010
 
1011
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
1012
+ ->setMethods(array('getOrder', 'getQuote'))
1013
+ ->getMock();
 
1014
  $observerMock
1015
  ->expects($this->once())
1016
  ->method('getOrder')
1017
+ ->willReturn($orderMock);
 
1018
  $observerMock
1019
  ->expects($this->once())
1020
  ->method('getQuote')
1021
+ ->willReturn($quote);
 
1022
 
1023
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
1024
  }
1028
  */
1029
  public function sendTransactionalEmailsSuccess()
1030
  {
1031
+ $helperMock = $this->getHelperMock('ops/data', array('sendTransactionalEmail'));
1032
  $helperMock
1033
  ->expects($this->exactly(2))
1034
  ->method('sendTransactionalEmail')
1035
  ->withConsecutive(
1036
  $this->isInstanceOf('Mage_Sales_Model_Order'),
1037
  $this->isInstanceOf('Mage_Sales_Model_Order_Invoice')
1038
+ );
 
1039
  $this->replaceByMock('helper', 'ops/data', $helperMock);
1040
 
1041
  // invoice
1042
  $invoice = Mage::getModel('sales/order_invoice');
1043
 
1044
  // order payment
1045
+ $payment = new Varien_Object(
1046
+ array(
1047
  'method_instance' => Mage::getModel('ops/payment_cc'),
1048
  'created_invoice' => $invoice,
1049
+ )
1050
+ );
1051
 
1052
  // order
1053
+ $orderMock = $this->getModelMock('sales/order', array('getPayment'));
1054
  $orderMock
1055
  ->expects($this->exactly(2))
1056
  ->method('getPayment')
1057
+ ->willReturn($payment);
 
1058
  $this->replaceByMock('model', 'sales/order', $orderMock);
1059
  $order = Mage::getModel('sales/order');
1060
 
1061
  // quote
1062
+ $quote = new Varien_Object(
1063
+ array(
1064
  'payment' => $payment,
1065
+ )
1066
+ );
1067
 
1068
  $observerMock = $this->getMockBuilder('Varien_Event_Observer')
1069
+ ->setMethods(array('getOrder', 'getQuote'))
1070
+ ->getMock();
 
1071
  $observerMock->expects($this->once())->method('getOrder')->willReturn($order);
1072
  $observerMock->expects($this->once())->method('getQuote')->willReturn($quote);
1073
 
1074
  Mage::getModel('ops/observer')->sendTransactionalEmails($observerMock);
1075
  }
1076
+
1077
+ public function testSendPayPerMailInfoSuccess()
1078
+ {
1079
+ // order payment
1080
+ $payment = Mage::getModel('sales/order_payment');
1081
+ $payment->setMethodInstance(Mage::getModel('ops/payment_payPerMail'));
1082
+
1083
+ $order = Mage::getModel('sales/order');
1084
+ $order->setPayment($payment);
1085
+
1086
+ $observerMock = $this->getMockBuilder('Varien_Event_Observer')
1087
+ ->setMethods(['getOrder'])
1088
+ ->getMock()
1089
+ ;
1090
+ $observerMock->expects($this->once())->method('getOrder')->willReturn($order);
1091
+ Mage::getModel('ops/observer')->sendPayPerMailInfo($observerMock);
1092
+ }
1093
+
1094
+ public function testSendPayPerMailInfoFailure()
1095
+ {
1096
+ // order payment
1097
+ $payment = Mage::getModel('sales/order_payment');
1098
+ $payment->setMethodInstance(Mage::getModel('ops/payment_cc'));
1099
+
1100
+ $order = Mage::getModel('sales/order');
1101
+ $order->setPayment($payment);
1102
+
1103
+ $observerMock = $this->getMockBuilder('Varien_Event_Observer')
1104
+ ->setMethods(['getOrder'])
1105
+ ->getMock()
1106
+ ;
1107
+ $observerMock->expects($this->once())->method('getOrder')->willReturn($order);
1108
+ Mage::getModel('ops/observer')->sendPayPerMailInfo($observerMock);
1109
+ }
1110
+
1111
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractRefundTest.php CHANGED
@@ -43,7 +43,7 @@ class Netresearch_OPS_Test_Model_Payment_AbstractRefundTest extends EcomDev_PHPU
43
  $amount = 10;
44
  $requestParams = $this->getRequestParams($amount, $testPayment);
45
  $testOpsResponse = $this->returnValue(
46
- array('STATUS' => Netresearch_OPS_Model_Status::REFUND_UNCERTAIN)
47
  );
48
  $this->mockApiDirectLink($requestParams, $testOpsResponse);
49
  $this->testObject->setInfoInstance($testPayment);
@@ -61,7 +61,7 @@ class Netresearch_OPS_Test_Model_Payment_AbstractRefundTest extends EcomDev_PHPU
61
  $amount = 10;
62
  $requestParams = $this->getRequestParams($amount, $testPayment);
63
  $testOpsResponse = $this->returnValue(
64
- array('STATUS' => Netresearch_OPS_Model_Status::REFUND_PROCESSED_BY_MERCHANT)
65
  );
66
  $this->mockApiDirectLink($requestParams, $testOpsResponse);
67
  $this->testObject->setInfoInstance($testPayment);
@@ -80,7 +80,7 @@ class Netresearch_OPS_Test_Model_Payment_AbstractRefundTest extends EcomDev_PHPU
80
  $amount = 10;
81
  $requestParams = $this->getRequestParams($amount, $testPayment);
82
  $testOpsResponse = $this->returnValue(
83
- array('STATUS' => 500)
84
  );
85
  $this->mockApiDirectLink($requestParams, $testOpsResponse);
86
 
@@ -136,10 +136,10 @@ class Netresearch_OPS_Test_Model_Payment_AbstractRefundTest extends EcomDev_PHPU
136
  $apiDirectLinkMock->expects($this->once())
137
  ->method('performRequest')
138
  ->with(
139
- $this->equalTo($requestParams),
140
- $this->equalTo(Mage::getModel('ops/config')->getDirectLinkGatewayPath()),
141
- $this->equalTo(null)
142
- )
143
  ->will($testOpsResponse);
144
  $this->replaceByMock('model', 'ops/api_directlink', $apiDirectLinkMock);
145
  }
43
  $amount = 10;
44
  $requestParams = $this->getRequestParams($amount, $testPayment);
45
  $testOpsResponse = $this->returnValue(
46
+ array('STATUS' => Netresearch_OPS_Model_Status::REFUND_UNCERTAIN)
47
  );
48
  $this->mockApiDirectLink($requestParams, $testOpsResponse);
49
  $this->testObject->setInfoInstance($testPayment);
61
  $amount = 10;
62
  $requestParams = $this->getRequestParams($amount, $testPayment);
63
  $testOpsResponse = $this->returnValue(
64
+ array('STATUS' => Netresearch_OPS_Model_Status::REFUND_PROCESSED_BY_MERCHANT)
65
  );
66
  $this->mockApiDirectLink($requestParams, $testOpsResponse);
67
  $this->testObject->setInfoInstance($testPayment);
80
  $amount = 10;
81
  $requestParams = $this->getRequestParams($amount, $testPayment);
82
  $testOpsResponse = $this->returnValue(
83
+ array('STATUS' => 500)
84
  );
85
  $this->mockApiDirectLink($requestParams, $testOpsResponse);
86
 
136
  $apiDirectLinkMock->expects($this->once())
137
  ->method('performRequest')
138
  ->with(
139
+ $this->equalTo($requestParams),
140
+ $this->equalTo(Mage::getModel('ops/config')->getDirectLinkGatewayPath()),
141
+ $this->equalTo(null)
142
+ )
143
  ->will($testOpsResponse);
144
  $this->replaceByMock('model', 'ops/api_directlink', $apiDirectLinkMock);
145
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest.php CHANGED
@@ -25,26 +25,36 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
25
  public function _getOrderDescriptionShorterThen100Chars()
26
  {
27
  $items = array(
28
- new Varien_Object(array(
 
29
  'parent_item' => false,
30
  'name' => 'abc'
31
- )),
32
- new Varien_Object(array(
 
 
33
  'parent_item' => true,
34
  'name' => 'def'
35
- )),
36
- new Varien_Object(array(
 
 
37
  'parent_item' => false,
38
  'name' => 'ghi'
39
- )),
40
- new Varien_Object(array(
 
 
41
  'parent_item' => false,
42
  'name' => 'Dubbelwerkende cilinder Boring ø70 Stang ø40 3/8'
43
- )),
44
- new Varien_Object(array(
 
 
45
  'parent_item' => false,
46
- 'name' => '0123456789012345678901234567890123456789012xxxxxx'
47
- )),
 
48
  );
49
 
50
  $order = $this->getModelMock('sales/order', array('getAllItems'));
@@ -54,7 +64,7 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
54
 
55
  $result = Mage::getModel('ops/payment_abstract')->_getOrderDescription($order);
56
  $this->assertEquals(
57
- 'abc, ghi, Dubbelwerkende cilinder Boring 70 Stang 40 3/8, 012345678901234567890123456789012345678901',
58
  $result
59
  );
60
  }
@@ -65,14 +75,18 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
65
  public function _getOrderDescriptionLongerThen100Chars()
66
  {
67
  $items = array(
68
- new Varien_Object(array(
 
69
  'parent_item' => false,
70
  'name' => '1bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi1' //54 chars
71
- )),
72
- new Varien_Object(array(
 
 
73
  'parent_item' => false,
74
- 'name' => '2bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi2' //54 chars
75
- ))
 
76
  );
77
 
78
  $order = $this->getModelMock('sales/order', array('getAllItems'));
@@ -82,7 +96,7 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
82
 
83
  $result = Mage::getModel('ops/payment_abstract')->_getOrderDescription($order);
84
  $this->assertEquals(
85
- '1bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi1, 2bcdefghij abcdefghij abcdefghij abcdefghij ',
86
  $result
87
  );
88
  }
@@ -93,11 +107,13 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
93
  public function _getOrderDescriptionLongerThen100CharsOneItem()
94
  {
95
  $items = array(
96
- new Varien_Object(array(
 
97
  'parent_item' => false,
98
  'name' => '1bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi1 '.
99
- '2bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi2'
100
- ))
 
101
  );
102
 
103
  $order = $this->getModelMock('sales/order', array('getAllItems'));
@@ -592,9 +608,12 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
592
  $apiClientMock->expects($this->any())
593
  ->method('performRequest')
594
  ->will(
595
- $this->returnValue(array(
 
596
  'STATUS' => 666
597
- )));
 
 
598
  $this->replaceByMock('model', 'ops/api_directlink', $apiClientMock);
599
  $order = Mage::getModel('sales/order')->load(11);
600
  $order->getPayment()->setAdditionalInformation('status', 5);
@@ -640,11 +659,14 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
640
  $apiClientMock->expects($this->any())
641
  ->method('performRequest')
642
  ->will(
643
- $this->returnValue(array(
 
644
  'STATUS' => Netresearch_OPS_Model_Status::DELETION_WAITING,
645
  'PAYID' => '4711',
646
  'PAYIDSUB' => '0815'
647
- )));
 
 
648
  $this->replaceByMock('model', 'ops/api_directlink', $apiClientMock);
649
  $order = Mage::getModel('sales/order')->load(11);
650
  $order->getPayment()->setAdditionalInformation('status', 5);
@@ -688,11 +710,14 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
688
  $apiClientMock->expects($this->any())
689
  ->method('performRequest')
690
  ->will(
691
- $this->returnValue(array(
 
692
  'STATUS' => Netresearch_OPS_Model_Status::AUTHORIZED_AND_CANCELLED,
693
  'PAYID' => '4711',
694
  'PAYIDSUB' => '0815'
695
- )));
 
 
696
  $this->replaceByMock('model', 'ops/api_directlink', $apiClientMock);
697
  $order = Mage::getModel('sales/order')->load(11);
698
  $order->getPayment()->setAdditionalInformation('status', 5);
@@ -818,6 +843,23 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
818
  $this->assertTrue(Mage::getModel('ops/payment_abstract')->canReviewPayment($order->getPayment()));
819
  }
820
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  protected function getOwnerParams()
822
  {
823
  return $ownerParams = array(
@@ -845,7 +887,4 @@ class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Te
845
 
846
  return $paramValues;
847
  }
848
-
849
-
850
-
851
  }
25
  public function _getOrderDescriptionShorterThen100Chars()
26
  {
27
  $items = array(
28
+ new Varien_Object(
29
+ array(
30
  'parent_item' => false,
31
  'name' => 'abc'
32
+ )
33
+ ),
34
+ new Varien_Object(
35
+ array(
36
  'parent_item' => true,
37
  'name' => 'def'
38
+ )
39
+ ),
40
+ new Varien_Object(
41
+ array(
42
  'parent_item' => false,
43
  'name' => 'ghi'
44
+ )
45
+ ),
46
+ new Varien_Object(
47
+ array(
48
  'parent_item' => false,
49
  'name' => 'Dubbelwerkende cilinder Boring ø70 Stang ø40 3/8'
50
+ )
51
+ ),
52
+ new Varien_Object(
53
+ array(
54
  'parent_item' => false,
55
+ 'name' => '0123456789012345678901234567890123456789'
56
+ )
57
+ ),
58
  );
59
 
60
  $order = $this->getModelMock('sales/order', array('getAllItems'));
64
 
65
  $result = Mage::getModel('ops/payment_abstract')->_getOrderDescription($order);
66
  $this->assertEquals(
67
+ 'abc, ghi, Dubbelwerkende cilinder Boring ø70 Stang ø40 3/8, 0123456789012345678901234567890123456789',
68
  $result
69
  );
70
  }
75
  public function _getOrderDescriptionLongerThen100Chars()
76
  {
77
  $items = array(
78
+ new Varien_Object(
79
+ array(
80
  'parent_item' => false,
81
  'name' => '1bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi1' //54 chars
82
+ )
83
+ ),
84
+ new Varien_Object(
85
+ array(
86
  'parent_item' => false,
87
+ 'name' => '2bcdefghij abcdefghij abcdefghij abcdefghij' //54 chars
88
+ )
89
+ )
90
  );
91
 
92
  $order = $this->getModelMock('sales/order', array('getAllItems'));
96
 
97
  $result = Mage::getModel('ops/payment_abstract')->_getOrderDescription($order);
98
  $this->assertEquals(
99
+ '1bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi1, 2bcdefghij abcdefghij abcdefghij abcdefghij',
100
  $result
101
  );
102
  }
107
  public function _getOrderDescriptionLongerThen100CharsOneItem()
108
  {
109
  $items = array(
110
+ new Varien_Object(
111
+ array(
112
  'parent_item' => false,
113
  'name' => '1bcdefghij abcdefghij abcdefghij abcdefghij abcdefghi1 '.
114
+ '2bcdefghij abcdefghij abcdefghij abcdefghij a'
115
+ )
116
+ )
117
  );
118
 
119
  $order = $this->getModelMock('sales/order', array('getAllItems'));
608
  $apiClientMock->expects($this->any())
609
  ->method('performRequest')
610
  ->will(
611
+ $this->returnValue(
612
+ array(
613
  'STATUS' => 666
614
+ )
615
+ )
616
+ );
617
  $this->replaceByMock('model', 'ops/api_directlink', $apiClientMock);
618
  $order = Mage::getModel('sales/order')->load(11);
619
  $order->getPayment()->setAdditionalInformation('status', 5);
659
  $apiClientMock->expects($this->any())
660
  ->method('performRequest')
661
  ->will(
662
+ $this->returnValue(
663
+ array(
664
  'STATUS' => Netresearch_OPS_Model_Status::DELETION_WAITING,
665
  'PAYID' => '4711',
666
  'PAYIDSUB' => '0815'
667
+ )
668
+ )
669
+ );
670
  $this->replaceByMock('model', 'ops/api_directlink', $apiClientMock);
671
  $order = Mage::getModel('sales/order')->load(11);
672
  $order->getPayment()->setAdditionalInformation('status', 5);
710
  $apiClientMock->expects($this->any())
711
  ->method('performRequest')
712
  ->will(
713
+ $this->returnValue(
714
+ array(
715
  'STATUS' => Netresearch_OPS_Model_Status::AUTHORIZED_AND_CANCELLED,
716
  'PAYID' => '4711',
717
  'PAYIDSUB' => '0815'
718
+ )
719
+ )
720
+ );
721
  $this->replaceByMock('model', 'ops/api_directlink', $apiClientMock);
722
  $order = Mage::getModel('sales/order')->load(11);
723
  $order->getPayment()->setAdditionalInformation('status', 5);
843
  $this->assertTrue(Mage::getModel('ops/payment_abstract')->canReviewPayment($order->getPayment()));
844
  }
845
 
846
+ public function testGetFrontendGateWay()
847
+ {
848
+ $gateway = Mage::getModel('ops/config')->getFrontendGatewayPath();
849
+ $payment = Mage::getModel('ops/payment_cc');
850
+ $url = $payment->getFrontendGateWay();
851
+ $this->assertTrue(strpos($url, '_utf8') >= 0);
852
+ $this->assertEquals($gateway, $url);
853
+ }
854
+
855
+ public function testSetEncoding()
856
+ {
857
+ $payment = Mage::getModel('ops/payment_cc');
858
+ $payment->setEncoding('test_foo');
859
+
860
+ $this->assertEquals('test_foo', $payment->getEncoding());
861
+ }
862
+
863
  protected function getOwnerParams()
864
  {
865
  return $ownerParams = array(
887
 
888
  return $paramValues;
889
  }
 
 
 
890
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest/expectations/paymentMethods.yaml CHANGED
@@ -175,9 +175,6 @@ ops_ingHomePay:
175
  ops_kbcOnline:
176
  pm: KBC Online
177
  brand: KBC Online
178
- ops_mpass:
179
- pm: MPASS
180
- brand: MPASS
181
  ops_paysafecard:
182
  pm: paysafecard
183
  brand: paysafecard
175
  ops_kbcOnline:
176
  pm: KBC Online
177
  brand: KBC Online
 
 
 
178
  ops_paysafecard:
179
  pm: paysafecard
180
  brand: paysafecard
app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest/fixtures/.gitkeep ADDED
File without changes
app/code/community/Netresearch/OPS/Test/Model/Payment/BancontactTest.php CHANGED
@@ -28,4 +28,54 @@ class Netresearch_OPS_Test_Model_Payment_BancontactTest extends EcomDev_PHPUnit_
28
  $this->assertEquals('BCMC', $this->model->getOpsBrand());
29
  }
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
28
  $this->assertEquals('BCMC', $this->model->getOpsBrand());
29
  }
30
 
31
+ /**
32
+ * @loadFixture ../../../../var/fixtures/orders.yaml
33
+ */
34
+ public function testGetMethodDependendFormFields()
35
+ {
36
+ $order = Mage::getModel('sales/order')->load(32);
37
+
38
+ $sessionMock = $this->getModelMockBuilder('core/session')
39
+ ->disableOriginalConstructor()
40
+ ->setMethods(null)
41
+ ->getMock();
42
+ $this->replaceByMock('singleton', 'core/session', $sessionMock);
43
+
44
+ $sessionMock = $this->getModelMockBuilder('customer/session')
45
+ ->disableOriginalConstructor()
46
+ ->setMethods(null)
47
+ ->getMock();
48
+ $this->replaceByMock('singleton', 'customer/session', $sessionMock);
49
+
50
+ $this->model->getInfoInstance()->setAdditionalInformation('DEVICE', Netresearch_OPS_Helper_MobileDetect::DEVICE_TYPE_MOBILE);
51
+ $formFields = $this->model->getMethodDependendFormFields($order, null);
52
+ $this->assertEquals(Netresearch_OPS_Helper_MobileDetect::DEVICE_TYPE_MOBILE, $formFields['DEVICE']);
53
+ }
54
+
55
+
56
+ public function testAssignData()
57
+ {
58
+ $infoInstance = Mage::getModel('sales/quote_payment');
59
+
60
+ $helperMock = new Varien_Object(
61
+ array('device_type' => Netresearch_OPS_Helper_MobileDetect::DEVICE_TYPE_MOBILE)
62
+ );
63
+
64
+ $paymentInstance = Mage::getModel('ops/payment_bancontact');
65
+ $paymentInstance->setMobileDetectHelper($helperMock)
66
+ ->setInfoInstance($infoInstance);
67
+
68
+ $paymentInstance->assignData(array());
69
+ $additionalInformation = $infoInstance->getData('additional_information');
70
+
71
+ $this->assertEquals(Netresearch_OPS_Helper_MobileDetect::DEVICE_TYPE_MOBILE, $additionalInformation['DEVICE']);
72
+ }
73
+
74
+ /**
75
+ * @Test
76
+ */
77
+ public function testGetMobileDetectHelper()
78
+ {
79
+ $this->assertTrue($this->model->getMobileDetectHelper() instanceof Netresearch_OPS_Helper_MobileDetect);
80
+ }
81
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/BancontactTest/fixtures/.gitkeep ADDED
File without changes
app/code/community/Netresearch/OPS/Test/Model/Payment/CcTest.php CHANGED
@@ -103,7 +103,7 @@ class Netresearch_OPS_Test_Model_Payment_CcTest extends EcomDev_PHPUnit_Test_Cas
103
  public function testIsApplicableToQuoteTrueWithZeroAmount()
104
  {
105
  $versionInfo = Mage::getVersionInfo();
106
- if ((array_key_exists('minor',$versionInfo))
107
  && (Mage::getEdition() === Mage::EDITION_COMMUNITY && $versionInfo['minor'] > '7')
108
  || (Mage::getEdition() === Mage::EDITION_ENTERPRISE && $versionInfo['minor'] > '13')
109
  )
@@ -141,7 +141,7 @@ class Netresearch_OPS_Test_Model_Payment_CcTest extends EcomDev_PHPUnit_Test_Cas
141
  public function testIsApplicableToQuoteFeatureModelTrue()
142
  {
143
  $versionInfo = Mage::getVersionInfo();
144
- if ((array_key_exists('minor',$versionInfo))
145
  && (Mage::getEdition() === Mage::EDITION_COMMUNITY && $versionInfo['minor'] > '7')
146
  || (Mage::getEdition() === Mage::EDITION_ENTERPRISE && $versionInfo['minor'] > '13')
147
  )
@@ -160,7 +160,7 @@ class Netresearch_OPS_Test_Model_Payment_CcTest extends EcomDev_PHPUnit_Test_Cas
160
  $this->replaceByMock('helper', 'ops/version', $helperMock);
161
 
162
  $quote = Mage::getModel('sales/quote');
163
- $this->assertTrue($this->_model->isApplicableToQuote($quote,'1'));
164
  }
165
  }
166
 
103
  public function testIsApplicableToQuoteTrueWithZeroAmount()
104
  {
105
  $versionInfo = Mage::getVersionInfo();
106
+ if ((array_key_exists('minor', $versionInfo))
107
  && (Mage::getEdition() === Mage::EDITION_COMMUNITY && $versionInfo['minor'] > '7')
108
  || (Mage::getEdition() === Mage::EDITION_ENTERPRISE && $versionInfo['minor'] > '13')
109
  )
141
  public function testIsApplicableToQuoteFeatureModelTrue()
142
  {
143
  $versionInfo = Mage::getVersionInfo();
144
+ if ((array_key_exists('minor', $versionInfo))
145
  && (Mage::getEdition() === Mage::EDITION_COMMUNITY && $versionInfo['minor'] > '7')
146
  || (Mage::getEdition() === Mage::EDITION_ENTERPRISE && $versionInfo['minor'] > '13')
147
  )
160
  $this->replaceByMock('helper', 'ops/version', $helperMock);
161
 
162
  $quote = Mage::getModel('sales/quote');
163
+ $this->assertTrue($this->_model->isApplicableToQuote($quote, '1'));
164
  }
165
  }
166
 
app/code/community/Netresearch/OPS/Test/Model/Payment/DirectLinkTest.php CHANGED
@@ -135,8 +135,7 @@ class Netresearch_OPS_Test_Model_Payment_DirectLinkTest extends EcomDev_PHPUnit_
135
  $testMock->setQuoteHelper($quoteHelperMock);
136
  $testMock->expects($this->once())
137
  ->method('confirmPayment')
138
- ->with($fakeOrder, $fakeQuote, $payment)
139
- ;
140
  $testMock->setConfig($configMock);
141
  $testMock->authorize($payment, 100);
142
  }
@@ -162,8 +161,7 @@ class Netresearch_OPS_Test_Model_Payment_DirectLinkTest extends EcomDev_PHPUnit_
162
  $testMock->setQuoteHelper($quoteHelperMock);
163
  $testMock->expects($this->once())
164
  ->method('confirmPayment')
165
- ->with($fakeOrder, $fakeQuote, $payment)
166
- ;
167
  $testMock->expects($this->any())
168
  ->method('hasBrandAliasInterfaceSupport')
169
  ->will($this->returnValue(true));
@@ -214,7 +212,7 @@ class Netresearch_OPS_Test_Model_Payment_DirectLinkTest extends EcomDev_PHPUnit_
214
  $testMock->setConfig($configMock);
215
  $testMock->authorize($payment, 100);
216
 
217
- $this->assertEquals(5,$payment->getAdditionalInformation('status'));
218
  $this->assertNotEmpty($fakeOrder->getAllStatusHistory());
219
  }
220
 
@@ -470,8 +468,7 @@ class Netresearch_OPS_Test_Model_Payment_DirectLinkTest extends EcomDev_PHPUnit_
470
 
471
 
472
  $directDebitMock->expects($this->never())
473
- ->method('confirmPayment')
474
- ;
475
  $directDebitMock->setPaymentHelper($paymentHelperMock);
476
  $directDebitMock->capture($payment, 100);
477
  }
135
  $testMock->setQuoteHelper($quoteHelperMock);
136
  $testMock->expects($this->once())
137
  ->method('confirmPayment')
138
+ ->with($fakeOrder, $fakeQuote, $payment);
 
139
  $testMock->setConfig($configMock);
140
  $testMock->authorize($payment, 100);
141
  }
161
  $testMock->setQuoteHelper($quoteHelperMock);
162
  $testMock->expects($this->once())
163
  ->method('confirmPayment')
164
+ ->with($fakeOrder, $fakeQuote, $payment);
 
165
  $testMock->expects($this->any())
166
  ->method('hasBrandAliasInterfaceSupport')
167
  ->will($this->returnValue(true));
212
  $testMock->setConfig($configMock);
213
  $testMock->authorize($payment, 100);
214
 
215
+ $this->assertEquals(5, $payment->getAdditionalInformation('status'));
216
  $this->assertNotEmpty($fakeOrder->getAllStatusHistory());
217
  }
218
 
468
 
469
 
470
  $directDebitMock->expects($this->never())
471
+ ->method('confirmPayment');
 
472
  $directDebitMock->setPaymentHelper($paymentHelperMock);
473
  $directDebitMock->capture($payment, 100);
474
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/Features/PaymentEmailTest.php CHANGED
@@ -47,21 +47,18 @@ class Netresearch_OPS_Test_Model_Payment_Features_PaymentEmailTest extends EcomD
47
  public function testResendPaymentInfo()
48
  {
49
  $mailMock = $this->getMockBuilder('Zend_Mail')
50
- ->setMethods(['send'])
51
- ->getMock()
52
- ;
53
  $mailMock
54
  ->expects($this->once())
55
  ->method('send')
56
- ->willReturnSelf()
57
- ;
58
 
59
- $templateMock = $this->getModelMock('core/email_template', ['getMail']);
60
  $templateMock
61
  ->expects($this->any())
62
  ->method('getMail')
63
- ->willReturn($mailMock)
64
- ;
65
  $this->replaceByMock('model', 'core/email_template', $templateMock);
66
 
67
  $payment = $this->getModelMock('sales/order_payment', array('save'));
@@ -69,6 +66,8 @@ class Netresearch_OPS_Test_Model_Payment_Features_PaymentEmailTest extends EcomD
69
  ->method('save')
70
  ->will($this->returnValue(null));
71
 
 
 
72
  $order = Mage::getModel('sales/order');
73
  $order->setData('customer_email', 'a@bc.de')
74
  ->setData('customer_firstname', 'Hans')
@@ -93,21 +92,18 @@ class Netresearch_OPS_Test_Model_Payment_Features_PaymentEmailTest extends EcomD
93
  public function testSendSuspendSubscriptionMail()
94
  {
95
  $mailMock = $this->getMockBuilder('Zend_Mail')
96
- ->setMethods(['send'])
97
- ->getMock()
98
- ;
99
  $mailMock
100
  ->expects($this->once())
101
  ->method('send')
102
- ->willReturnSelf()
103
- ;
104
 
105
- $templateMock = $this->getModelMock('core/email_template', ['getMail']);
106
  $templateMock
107
  ->expects($this->any())
108
  ->method('getMail')
109
- ->willReturn($mailMock)
110
- ;
111
  $this->replaceByMock('model', 'core/email_template', $templateMock);
112
 
113
  $profile = Mage::getModel('sales/recurring_profile');
47
  public function testResendPaymentInfo()
48
  {
49
  $mailMock = $this->getMockBuilder('Zend_Mail')
50
+ ->setMethods(array('send'))
51
+ ->getMock();
 
52
  $mailMock
53
  ->expects($this->once())
54
  ->method('send')
55
+ ->willReturnSelf();
 
56
 
57
+ $templateMock = $this->getModelMock('core/email_template', array('getMail'));
58
  $templateMock
59
  ->expects($this->any())
60
  ->method('getMail')
61
+ ->willReturn($mailMock);
 
62
  $this->replaceByMock('model', 'core/email_template', $templateMock);
63
 
64
  $payment = $this->getModelMock('sales/order_payment', array('save'));
66
  ->method('save')
67
  ->will($this->returnValue(null));
68
 
69
+ $payment->setMethod(Netresearch_OPS_Model_Payment_Flex::CODE);
70
+
71
  $order = Mage::getModel('sales/order');
72
  $order->setData('customer_email', 'a@bc.de')
73
  ->setData('customer_firstname', 'Hans')
92
  public function testSendSuspendSubscriptionMail()
93
  {
94
  $mailMock = $this->getMockBuilder('Zend_Mail')
95
+ ->setMethods(array('send'))
96
+ ->getMock();
 
97
  $mailMock
98
  ->expects($this->once())
99
  ->method('send')
100
+ ->willReturnSelf();
 
101
 
102
+ $templateMock = $this->getModelMock('core/email_template', array('getMail'));
103
  $templateMock
104
  ->expects($this->any())
105
  ->method('getMail')
106
+ ->willReturn($mailMock);
 
107
  $this->replaceByMock('model', 'core/email_template', $templateMock);
108
 
109
  $profile = Mage::getModel('sales/recurring_profile');
app/code/community/Netresearch/OPS/Test/Model/Payment/IDealTest.php CHANGED
@@ -16,52 +16,40 @@ class Netresearch_OPS_Test_Model_Payment_IDealTest extends EcomDev_PHPUnit_Test_
16
  {
17
  $issuers = Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
18
  $this->assertTrue(is_array($issuers));
19
- $this->assertTrue(array_key_exists('ABNANL2A',$issuers));
20
- $this->assertEquals('ABN AMRO',$issuers['ABNANL2A']);
21
 
22
- $this->assertTrue(array_key_exists('RABONL2U',$issuers));
23
- $this->assertEquals('Rabobank',$issuers['RABONL2U']);
24
 
25
- $this->assertTrue(array_key_exists('INGBNL2A',$issuers));
26
- $this->assertEquals('ING',$issuers['INGBNL2A']);
27
 
28
- $this->assertTrue(array_key_exists('SNSBNL2A',$issuers));
29
- $this->assertEquals('SNS Bank',$issuers['SNSBNL2A']);
30
 
31
- $this->assertTrue(array_key_exists('RBRBNL21',$issuers));
32
- $this->assertEquals('Regio Bank',$issuers['RBRBNL21']);
33
 
34
- $this->assertTrue(array_key_exists('ASNBNL21',$issuers));
35
- $this->assertEquals('ASN Bank',$issuers['ASNBNL21']);
36
 
37
- $this->assertTrue(array_key_exists('TRIONL2U',$issuers));
38
- $this->assertEquals('Triodos Bank',$issuers['TRIONL2U']);
39
 
40
- $this->assertTrue(array_key_exists('FVLBNL22',$issuers));
41
- $this->assertEquals('Van Lanschot Bankiers',$issuers['FVLBNL22']);
42
 
43
- $this->assertTrue(array_key_exists('KNABNL2H',$issuers));
44
- $this->assertEquals('Knab Bank',$issuers['KNABNL2H']);
45
 
46
  }
47
 
48
 
49
  public function testAssignData()
50
  {
51
- $payment = $this->getModelMock('sales/quote_payment', array('setAdditionalInformation'));
52
- $payment->setMethod('ops_iDeal');
53
- $payment->expects($this->any())
54
- ->method('setAdditionalInformation')
55
- ->with($this->equalTo('iDeal_issuer_id'));
56
-
57
- $quote = Mage::getModel('sales/quote');
58
- $quote->setPayment($payment);
59
-
60
- $checkout = $this->getModelMock('checkout/session');
61
- $checkout->expects($this->any())
62
- ->method('getQuote')
63
- ->will($this->returnValue($quote));
64
- $this->replaceByMock('singleton', 'checkout/session', $checkout);
65
 
66
  $data = array('iDeal_issuer_id' => 'RBRBNL21');
67
  $this->assertEquals('iDEAL', $payment->getMethodInstance()->getOpsCode());
@@ -69,34 +57,23 @@ class Netresearch_OPS_Test_Model_Payment_IDealTest extends EcomDev_PHPUnit_Test_
69
  $method = $payment->getMethodInstance()->assignData($data);
70
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_IDeal', $method);
71
 
72
- $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
73
  $this->assertEquals('RBRBNL21', $payment->getAdditionalInformation('iDeal_issuer_id'));
74
  }
75
 
76
  public function testAssignDataWithVarienObject()
77
  {
78
- $payment = $this->getModelMock('sales/quote_payment', array('setAdditionalInformation'));
79
  $payment->setMethod('ops_iDeal');
80
- $payment->expects($this->any())
81
- ->method('setAdditionalInformation')
82
- ->with($this->equalTo('iDeal_issuer_id'));
83
 
84
  $quote = Mage::getModel('sales/quote');
85
  $quote->setPayment($payment);
86
 
87
- $checkout = $this->getModelMock('checkout/session');
88
- $checkout->expects($this->any())
89
- ->method('getQuote')
90
- ->will($this->returnValue($quote));
91
- $this->replaceByMock('singleton', 'checkout/session', $checkout);
92
-
93
  $data = new Varien_object(array('iDeal_issuer_id' => 'ABNAMRO'));
94
  $this->assertEquals('iDEAL', $payment->getMethodInstance()->getOpsCode());
95
 
96
  $method = $payment->getMethodInstance()->assignData($data);
97
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_IDeal', $method);
98
 
99
- $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
100
  $this->assertEquals('ABNAMRO', $payment->getAdditionalInformation('iDeal_issuer_id'));
101
  }
102
 
16
  {
17
  $issuers = Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
18
  $this->assertTrue(is_array($issuers));
19
+ $this->assertTrue(array_key_exists('ABNANL2A', $issuers));
20
+ $this->assertEquals('ABN AMRO', $issuers['ABNANL2A']);
21
 
22
+ $this->assertTrue(array_key_exists('RABONL2U', $issuers));
23
+ $this->assertEquals('Rabobank', $issuers['RABONL2U']);
24
 
25
+ $this->assertTrue(array_key_exists('INGBNL2A', $issuers));
26
+ $this->assertEquals('ING', $issuers['INGBNL2A']);
27
 
28
+ $this->assertTrue(array_key_exists('SNSBNL2A', $issuers));
29
+ $this->assertEquals('SNS Bank', $issuers['SNSBNL2A']);
30
 
31
+ $this->assertTrue(array_key_exists('RBRBNL21', $issuers));
32
+ $this->assertEquals('Regio Bank', $issuers['RBRBNL21']);
33
 
34
+ $this->assertTrue(array_key_exists('ASNBNL21', $issuers));
35
+ $this->assertEquals('ASN Bank', $issuers['ASNBNL21']);
36
 
37
+ $this->assertTrue(array_key_exists('TRIONL2U', $issuers));
38
+ $this->assertEquals('Triodos Bank', $issuers['TRIONL2U']);
39
 
40
+ $this->assertTrue(array_key_exists('FVLBNL22', $issuers));
41
+ $this->assertEquals('Van Lanschot Bankiers', $issuers['FVLBNL22']);
42
 
43
+ $this->assertTrue(array_key_exists('KNABNL2H', $issuers));
44
+ $this->assertEquals('Knab Bank', $issuers['KNABNL2H']);
45
 
46
  }
47
 
48
 
49
  public function testAssignData()
50
  {
51
+ $payment = Mage::getModel('sales/quote_payment')->setMethod('ops_iDeal');
52
+ $quote = Mage::getModel('sales/quote')->setPayment($payment);
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  $data = array('iDeal_issuer_id' => 'RBRBNL21');
55
  $this->assertEquals('iDEAL', $payment->getMethodInstance()->getOpsCode());
57
  $method = $payment->getMethodInstance()->assignData($data);
58
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_IDeal', $method);
59
 
 
60
  $this->assertEquals('RBRBNL21', $payment->getAdditionalInformation('iDeal_issuer_id'));
61
  }
62
 
63
  public function testAssignDataWithVarienObject()
64
  {
65
+ $payment = Mage::getModel('sales/quote_payment');
66
  $payment->setMethod('ops_iDeal');
 
 
 
67
 
68
  $quote = Mage::getModel('sales/quote');
69
  $quote->setPayment($payment);
70
 
 
 
 
 
 
 
71
  $data = new Varien_object(array('iDeal_issuer_id' => 'ABNAMRO'));
72
  $this->assertEquals('iDEAL', $payment->getMethodInstance()->getOpsCode());
73
 
74
  $method = $payment->getMethodInstance()->assignData($data);
75
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_IDeal', $method);
76
 
 
77
  $this->assertEquals('ABNAMRO', $payment->getAdditionalInformation('iDeal_issuer_id'));
78
  }
79
 
app/code/community/Netresearch/OPS/Test/Model/Payment/InterSolveTest.php CHANGED
@@ -42,61 +42,36 @@ class Netresearch_OPS_Test_Model_Payment_InterSolveTest extends EcomDev_PHPUnit_
42
 
43
  public function testAssignDataWithBrand()
44
  {
45
- $payment = $this->getModelMock('sales/quote_payment', array('setAdditionalInformation'));
46
  $payment->setMethod('ops_interSolve');
47
- $payment->expects($this->any())
48
- ->method('setAdditionalInformation')
49
- ->with(
50
- $this->equalTo('BRAND'),
51
- $this->equalTo('InterSolve')
52
- );
53
 
54
  $quote = Mage::getModel('sales/quote');
55
  $quote->setPayment($payment);
56
 
57
- $checkout = $this->getModelMock('checkout/session');
58
- $checkout->expects($this->any())
59
- ->method('getQuote')
60
- ->will($this->returnValue($quote));
61
- $this->replaceByMock('singleton', 'checkout/session', $checkout);
62
-
63
  $data = array('intersolve_brand' => 'FooBar');
64
  $this->assertEquals('InterSolve', $payment->getMethodInstance()->getOpsCode());
65
 
66
  $method = $payment->getMethodInstance()->assignData($data);
67
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_InterSolve', $method);
68
 
69
- $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
70
  $this->assertEquals('FooBar', $payment->getAdditionalInformation('BRAND'));
71
  }
72
 
73
  public function testAssignDataWithoutBrand()
74
  {
75
- $payment = $this->getModelMock('sales/quote_payment', array('setAdditionalInformation'));
76
  $payment->setMethod('ops_interSolve');
77
- $payment->expects($this->any())
78
- ->method('setAdditionalInformation')
79
- ->with(
80
- $this->equalTo('BRAND'),
81
- $this->equalTo('InterSolve')
82
- );
83
 
84
  $quote = Mage::getModel('sales/quote');
85
  $quote->setPayment($payment);
86
 
87
- $checkout = $this->getModelMock('checkout/session');
88
- $checkout->expects($this->any())
89
- ->method('getQuote')
90
- ->will($this->returnValue($quote));
91
- $this->replaceByMock('singleton', 'checkout/session', $checkout);
92
-
93
  $this->assertEquals('InterSolve', $payment->getMethodInstance()->getOpsCode());
94
 
 
95
  $method = $payment->getMethodInstance();
96
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_InterSolve', $method);
97
- $method->assignData(array());
98
 
99
- $payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
100
  $this->assertEquals('InterSolve', $payment->getAdditionalInformation('BRAND'));
101
  }
102
  }
42
 
43
  public function testAssignDataWithBrand()
44
  {
45
+ $payment = Mage::getModel('sales/quote_payment');
46
  $payment->setMethod('ops_interSolve');
 
 
 
 
 
 
47
 
48
  $quote = Mage::getModel('sales/quote');
49
  $quote->setPayment($payment);
50
 
 
 
 
 
 
 
51
  $data = array('intersolve_brand' => 'FooBar');
52
  $this->assertEquals('InterSolve', $payment->getMethodInstance()->getOpsCode());
53
 
54
  $method = $payment->getMethodInstance()->assignData($data);
55
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_InterSolve', $method);
56
 
 
57
  $this->assertEquals('FooBar', $payment->getAdditionalInformation('BRAND'));
58
  }
59
 
60
  public function testAssignDataWithoutBrand()
61
  {
62
+ $payment = Mage::getModel('sales/quote_payment');
63
  $payment->setMethod('ops_interSolve');
 
 
 
 
 
 
64
 
65
  $quote = Mage::getModel('sales/quote');
66
  $quote->setPayment($payment);
67
 
 
 
 
 
 
 
68
  $this->assertEquals('InterSolve', $payment->getMethodInstance()->getOpsCode());
69
 
70
+ /** @var Netresearch_OPS_Model_Payment_InterSolve $method */
71
  $method = $payment->getMethodInstance();
72
  $this->assertInstanceOf('Netresearch_OPS_Model_Payment_InterSolve', $method);
 
73
 
74
+ $method->assignData(array());
75
  $this->assertEquals('InterSolve', $payment->getAdditionalInformation('BRAND'));
76
  }
77
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/Kwixo/AbstractTest.php CHANGED
@@ -209,7 +209,6 @@ class Netresearch_OPS_Test_Model_Payment_Kwixo_AbstractTest
209
  'ops/payment_kwixo_abstract', array(
210
  'getShippingMethodTypeValues',
211
  'getShippingMethodType',
212
- 'splitHouseNumber'
213
  )
214
  );
215
  $kwixoAbstractModelMock->expects($this->any())
@@ -220,13 +219,6 @@ class Netresearch_OPS_Test_Model_Payment_Kwixo_AbstractTest
220
  ->method('getShippingMethodType')
221
  ->will($this->returnValue(4));
222
 
223
- $kwixoAbstractModelMock->expects($this->any())
224
- ->method('splitHouseNumber')
225
- ->will(
226
- $this->returnValue(
227
- array('housenumber' => 4, 'street' => 'testStreet')
228
- )
229
- );
230
 
231
  $this->replaceByMock(
232
  'model', 'ops/payment_kwixo_abstract', $kwixoAbstractModelMock
@@ -353,15 +345,6 @@ class Netresearch_OPS_Test_Model_Payment_Kwixo_AbstractTest
353
  'street' => 'teststreet'
354
  );
355
 
356
- $kwixoModelMock = $this->getModelMock(
357
- 'ops/payment_kwixo_abstract', array('splitHouseNumber')
358
- );
359
- $kwixoModelMock->expects($this->any())
360
- ->method('splitHouseNumber')
361
- ->will($this->returnValue($addressData));
362
- $this->replaceByMock(
363
- 'model', 'ops/payment_kwixo_abstract', $kwixoModelMock
364
- );
365
 
366
  $formFields = Mage::getModel('ops/payment_kwixo_abstract')
367
  ->getKwixoBillToParams($order);
@@ -624,10 +607,7 @@ class Netresearch_OPS_Test_Model_Payment_Kwixo_AbstractTest
624
  $params = array();
625
  $this->assertEquals(
626
  'Please make sure that the displayed data is correct.',
627
- Mage::getModel('ops/payment_kwixo_abstract')->getQuestion(
628
- $order, $params
629
- )
630
- );
631
  }
632
 
633
  public function testGetQuestionedFormFields()
@@ -635,7 +615,7 @@ class Netresearch_OPS_Test_Model_Payment_Kwixo_AbstractTest
635
  $order = new Varien_Object();
636
  $params = array();
637
  $fields = Mage::getModel('ops/payment_kwixo_abstract')
638
- ->getQuestionedFormFields($order, $params);
639
  $this->assertTrue(in_array('OWNERADDRESS', $fields));
640
  $this->assertTrue(
641
  in_array('ECOM_BILLTO_POSTAL_STREET_NUMBER', $fields)
@@ -670,24 +650,6 @@ class Netresearch_OPS_Test_Model_Payment_Kwixo_AbstractTest
670
  );
671
  }
672
 
673
- /**
674
- * @test
675
- * @loadFixture ../../../../../var/fixtures/orders.yaml
676
- */
677
- public function testSplitHouseNumber()
678
- {
679
- $order = Mage::getModel('sales/order')->load(24);
680
- $shippingAddress = $order->getShippingAddress();
681
- $addressData = Mage::getModel('ops/payment_kwixo_abstract')
682
- ->splitHouseNumber($shippingAddress->getStreet(-1));
683
- $this->assertEquals('44', $addressData['housenumber']);
684
- $this->assertEquals('rue Parmentier', $addressData['street']);
685
-
686
-
687
- $addressData = Mage::getModel('ops/payment_kwixo_abstract')
688
- ->splitHouseNumber('55, rue du Faubourg-Saint-Honoré');
689
- $this->assertEquals('55', $addressData['housenumber']);
690
- }
691
 
692
  public function testPopulateFromArray()
693
  {
209
  'ops/payment_kwixo_abstract', array(
210
  'getShippingMethodTypeValues',
211
  'getShippingMethodType',
 
212
  )
213
  );
214
  $kwixoAbstractModelMock->expects($this->any())
219
  ->method('getShippingMethodType')
220
  ->will($this->returnValue(4));
221
 
 
 
 
 
 
 
 
222
 
223
  $this->replaceByMock(
224
  'model', 'ops/payment_kwixo_abstract', $kwixoAbstractModelMock
345
  'street' => 'teststreet'
346
  );
347
 
 
 
 
 
 
 
 
 
 
348
 
349
  $formFields = Mage::getModel('ops/payment_kwixo_abstract')
350
  ->getKwixoBillToParams($order);
607
  $params = array();
608
  $this->assertEquals(
609
  'Please make sure that the displayed data is correct.',
610
+ Mage::getModel('ops/payment_kwixo_abstract')->getQuestion());
 
 
 
611
  }
612
 
613
  public function testGetQuestionedFormFields()
615
  $order = new Varien_Object();
616
  $params = array();
617
  $fields = Mage::getModel('ops/payment_kwixo_abstract')
618
+ ->getQuestionedFormFields($order);
619
  $this->assertTrue(in_array('OWNERADDRESS', $fields));
620
  $this->assertTrue(
621
  in_array('ECOM_BILLTO_POSTAL_STREET_NUMBER', $fields)
650
  );
651
  }
652
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
653
 
654
  public function testPopulateFromArray()
655
  {
app/code/community/Netresearch/OPS/Test/Model/Payment/Kwixo/AbstractTest/expectations/paymentMethods.yaml CHANGED
@@ -175,9 +175,6 @@ ops_ingHomePay:
175
  ops_kbcOnline:
176
  pm: KBC Online
177
  brand: KBC Online
178
- ops_mpass:
179
- pm: MPASS
180
- brand: MPASS
181
  ops_paysafecard:
182
  pm: paysafecard
183
  brand: paysafecard
175
  ops_kbcOnline:
176
  pm: KBC Online
177
  brand: KBC Online
 
 
 
178
  ops_paysafecard:
179
  pm: paysafecard
180
  brand: paysafecard
app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoApresReceptionTest.php CHANGED
@@ -28,12 +28,12 @@ class Netresearch_OPS_Test_Model_Payment_KwixoApresReceptionTest extends EcomDev
28
 
29
  public function testGetOpsCode()
30
  {
31
- $this->assertEquals('KWIXO_RNP',$this->kwixoApresReceptionModel->getOpsCode());
32
  }
33
 
34
  public function testGetCode()
35
  {
36
- $this->assertEquals('ops_kwixoApresReception',$this->kwixoApresReceptionModel->getCode());
37
  }
38
 
39
  public function testGetDeliveryDate()
@@ -42,10 +42,10 @@ class Netresearch_OPS_Test_Model_Payment_KwixoApresReceptionTest extends EcomDev
42
  $dateNow = date("Y-m-d");
43
  $path = 'payment/ops_kwixoApresReception/delivery_date';
44
  $this->store->setConfig($path, "0");
45
- $this->assertEquals($dateNow,$this->kwixoApresReceptionModel->getEstimatedDeliveryDate('ops_kwixoApresReception'));
46
  $dateNowPlusFiveDays = strtotime($dateNow ."+ 5 days");
47
  $this->store->setConfig($path, "5");
48
- $this->assertEquals(date("Y-m-d",$dateNowPlusFiveDays),$this->kwixoApresReceptionModel->getEstimatedDeliveryDate('ops_kwixoApresReception'));
49
  }
50
 
51
  public function testGetFormBlockType()
28
 
29
  public function testGetOpsCode()
30
  {
31
+ $this->assertEquals('KWIXO_RNP', $this->kwixoApresReceptionModel->getOpsCode());
32
  }
33
 
34
  public function testGetCode()
35
  {
36
+ $this->assertEquals('ops_kwixoApresReception', $this->kwixoApresReceptionModel->getCode());
37
  }
38
 
39
  public function testGetDeliveryDate()
42
  $dateNow = date("Y-m-d");
43
  $path = 'payment/ops_kwixoApresReception/delivery_date';
44
  $this->store->setConfig($path, "0");
45
+ $this->assertEquals($dateNow, $this->kwixoApresReceptionModel->getEstimatedDeliveryDate('ops_kwixoApresReception'));
46
  $dateNowPlusFiveDays = strtotime($dateNow ."+ 5 days");
47
  $this->store->setConfig($path, "5");
48
+ $this->assertEquals(date("Y-m-d", $dateNowPlusFiveDays), $this->kwixoApresReceptionModel->getEstimatedDeliveryDate('ops_kwixoApresReception'));
49
  }
50
 
51
  public function testGetFormBlockType()
app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoComptantTest.php CHANGED
@@ -28,12 +28,12 @@ class Netresearch_OPS_Test_Model_Payment_KwixoComptantTest extends EcomDev_PHPUn
28
 
29
  public function testGetOpsCode()
30
  {
31
- $this->assertEquals('KWIXO_STANDARD',$this->kwixoComptantModel->getOpsCode());
32
  }
33
 
34
  public function testGetCode()
35
  {
36
- $this->assertEquals('ops_kwixoComptant',$this->kwixoComptantModel->getCode());
37
  }
38
 
39
  public function testGetDeliveryDate()
@@ -42,10 +42,10 @@ class Netresearch_OPS_Test_Model_Payment_KwixoComptantTest extends EcomDev_PHPUn
42
  $dateNow = date("Y-m-d");
43
  $path = 'payment/ops_kwixoComptant/delivery_date';
44
  $this->store->setConfig($path, "0");
45
- $this->assertEquals($dateNow,$this->kwixoComptantModel->getEstimatedDeliveryDate('ops_kwixoComptant'));
46
  $dateNowPlusFiveDays = strtotime($dateNow ."+ 5 days");
47
  $this->store->setConfig($path, "5");
48
- $this->assertEquals(date("Y-m-d",$dateNowPlusFiveDays),$this->kwixoComptantModel->getEstimatedDeliveryDate('ops_kwixoComptant'));
49
  }
50
 
51
  public function testGetFormBlockType()
28
 
29
  public function testGetOpsCode()
30
  {
31
+ $this->assertEquals('KWIXO_STANDARD', $this->kwixoComptantModel->getOpsCode());
32
  }
33
 
34
  public function testGetCode()
35
  {
36
+ $this->assertEquals('ops_kwixoComptant', $this->kwixoComptantModel->getCode());
37
  }
38
 
39
  public function testGetDeliveryDate()
42
  $dateNow = date("Y-m-d");
43
  $path = 'payment/ops_kwixoComptant/delivery_date';
44
  $this->store->setConfig($path, "0");
45
+ $this->assertEquals($dateNow, $this->kwixoComptantModel->getEstimatedDeliveryDate('ops_kwixoComptant'));
46
  $dateNowPlusFiveDays = strtotime($dateNow ."+ 5 days");
47
  $this->store->setConfig($path, "5");
48
+ $this->assertEquals(date("Y-m-d", $dateNowPlusFiveDays), $this->kwixoComptantModel->getEstimatedDeliveryDate('ops_kwixoComptant'));
49
  }
50
 
51
  public function testGetFormBlockType()
app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoCreditTest.php CHANGED
@@ -46,7 +46,8 @@ class Netresearch_OPS_Test_Model_Payment_KwixoCreditTest extends EcomDev_PHPUnit
46
  $this->assertEquals($dateNow, $this->kwixoCreditModel->getEstimatedDeliveryDate('ops_kwixoCredit'));
47
  $dateNowPlusFiveDays = strtotime($dateNow . "+ 5 days");
48
  $this->store->setConfig($path, "5");
49
- $this->assertEquals(date("Y-m-d", $dateNowPlusFiveDays),
 
50
  $this->kwixoCreditModel->getEstimatedDeliveryDate('ops_kwixoCredit')
51
  );
52
  }
46
  $this->assertEquals($dateNow, $this->kwixoCreditModel->getEstimatedDeliveryDate('ops_kwixoCredit'));
47
  $dateNowPlusFiveDays = strtotime($dateNow . "+ 5 days");
48
  $this->store->setConfig($path, "5");
49
+ $this->assertEquals(
50
+ date("Y-m-d", $dateNowPlusFiveDays),
51
  $this->kwixoCreditModel->getEstimatedDeliveryDate('ops_kwixoCredit')
52
  );
53
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/OpenInvoiceAtTest.php CHANGED
@@ -57,4 +57,31 @@ class Netresearch_OPS_Test_Model_Payment_OpenInvoiceAtTest extends EcomDev_PHPUn
57
 
58
  $this->assertFalse($this->model->isAvailable($quote));
59
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
57
 
58
  $this->assertFalse($this->model->isAvailable($quote));
59
  }
60
+
61
+ public function testGetMethodDependendFormFields()
62
+ {
63
+ $customerHelper = $this->getHelperMock('customer/data', array('isLoggedIn'));
64
+ $customerHelper->expects($this->any())
65
+ ->method('isLoggedIn')
66
+ ->will($this->returnValue(false));
67
+ $this->replaceByMock('helper', 'customer/data', $customerHelper);
68
+
69
+ $order = Mage::getModel('sales/order');
70
+ $order->setCustomerDob('01/10/1970')
71
+ ->setCustomerGender(1);
72
+ $billingAddress = Mage::getModel('sales/order_address');
73
+ $billingAddress->setAddressType(Mage_Sales_Model_Order_Address::TYPE_BILLING)
74
+ ->setStreet('Klarna-Straße 1/2/3');
75
+ $order->setBillingAddress($billingAddress);
76
+ $payment = Mage::getModel('sales/order_payment');
77
+ $model = Mage::getModel('ops/payment_openInvoiceAt');
78
+ $payment->setMethod($model->getCode());
79
+ $model->setInfoInstance($payment);
80
+ $payment->setMethodInstance($model);
81
+ $order->setPayment($payment);
82
+ $params = $model->getMethodDependendFormFields($order);
83
+
84
+ $this->assertEquals(' ', $params['ECOM_BILLTO_POSTAL_STREET_NUMBER']);
85
+ $this->assertEquals('Klarna-Straße 1/2/3', $params['OWNERADDRESS']);
86
+ }
87
  }
app/code/community/Netresearch/OPS/Test/Model/Payment/OpenInvoiceNlTest.php CHANGED
@@ -24,15 +24,17 @@ class Netresearch_OPS_Test_Model_Payment_OpenInvoiceNlTest extends EcomDev_PHPUn
24
  'ECOM_SHIPTO_POSTAL_STREET_NUMBER' => ''
25
  );
26
 
27
- $method = $this->getModelMock('ops/payment_openInvoiceNl', array(
 
28
  'getFormFields'
29
- ));
 
30
  $method->expects($this->any())
31
  ->method('getFormFields')
32
  ->will($this->returnValue($formFields));
33
 
34
  $this->assertTrue($method->hasFormMissingParams($order, $requestParams, $formFields), 'expected missing params');
35
- $this->assertTrue(is_string($method->getQuestion($order, $requestParams)));
36
  $this->assertEquals(
37
  array(
38
  'OWNERADDRESS',
@@ -58,9 +60,11 @@ class Netresearch_OPS_Test_Model_Payment_OpenInvoiceNlTest extends EcomDev_PHPUn
58
  'ECOM_SHIPTO_POSTAL_STREET_NUMBER' => '1'
59
  );
60
 
61
- $method = $this->getModelMock('ops/payment_openInvoiceNl', array(
 
62
  'getFormFields'
63
- ));
 
64
  $method->expects($this->any())
65
  ->method('getFormFields')
66
  ->will($this->returnValue($formFields));
@@ -68,7 +72,7 @@ class Netresearch_OPS_Test_Model_Payment_OpenInvoiceNlTest extends EcomDev_PHPUn
68
  $this->assertFalse($method->hasFormMissingParams($order, $requestParams, $formFields), 'expected no missing params');
69
 
70
  /* independent from that we expect to get question and questioned params when calling these methods directly */
71
- $this->assertTrue(is_string($method->getQuestion($order, $requestParams)));
72
  $this->assertEquals(
73
  array(
74
  'OWNERADDRESS',
24
  'ECOM_SHIPTO_POSTAL_STREET_NUMBER' => ''
25
  );
26
 
27
+ $method = $this->getModelMock(
28
+ 'ops/payment_openInvoiceNl', array(
29
  'getFormFields'
30
+ )
31
+ );
32
  $method->expects($this->any())
33
  ->method('getFormFields')
34
  ->will($this->returnValue($formFields));
35
 
36
  $this->assertTrue($method->hasFormMissingParams($order, $requestParams, $formFields), 'expected missing params');
37
+ $this->assertTrue(is_string($method->getQuestion()));
38
  $this->assertEquals(
39
  array(
40
  'OWNERADDRESS',
60
  'ECOM_SHIPTO_POSTAL_STREET_NUMBER' => '1'
61
  );
62
 
63
+ $method = $this->getModelMock(
64
+ 'ops/payment_openInvoiceNl', array(
65
  'getFormFields'
66
+ )
67
+ );
68
  $method->expects($this->any())
69
  ->method('getFormFields')
70
  ->will($this->returnValue($formFields));
72
  $this->assertFalse($method->hasFormMissingParams($order, $requestParams, $formFields), 'expected no missing params');
73
 
74
  /* independent from that we expect to get question and questioned params when calling these methods directly */
75
+ $this->assertTrue(is_string($method->getQuestion()));
76
  $this->assertEquals(
77
  array(
78
  'OWNERADDRESS',
app/code/community/Netresearch/OPS/Test/Model/Payment/PayPerMailTest.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * PayPerMail.php
24
+ *
25
+ * @category Payment
26
+ * @package Netresearch_OPS
27
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
28
+ */
29
+ ?>
30
+ <?php
31
+
32
+
33
+ class Netresearch_OPS_Test_Model_Payment_PayPerMailTest extends EcomDev_PHPUnit_Test_Case
34
+ {
35
+
36
+ protected function getAdditionalInfo()
37
+ {
38
+ return array(
39
+
40
+ Netresearch_OPS_Model_Payment_PayPerMail::INFO_KEY_TITLE => 'Foobar',
41
+ Netresearch_OPS_Model_Payment_PayPerMail::INFO_KEY_PM => 'foo',
42
+ Netresearch_OPS_Model_Payment_PayPerMail::INFO_KEY_BRAND => 'bar'
43
+ );
44
+ }
45
+
46
+ public function testGetOpsCode()
47
+ {
48
+ $payment = Mage::getModel('sales/order_payment');
49
+ $additionalInfo = $this->getAdditionalInfo();
50
+ $payment->setMethod(Netresearch_OPS_Model_Payment_PayPerMail::CODE)
51
+ ->setAdditionalInformation(
52
+ $additionalInfo
53
+ );
54
+ /** @var Netresearch_OPS_Model_Payment_PayPerMail $subject */
55
+ $subject = $payment->getMethodInstance();
56
+
57
+ $this->assertEquals($additionalInfo[Netresearch_OPS_Model_Payment_PayPerMail::INFO_KEY_PM], $subject->getOpsCode());
58
+ }
59
+
60
+ public function testGetOpsBrand()
61
+ {
62
+ $payment = Mage::getModel('sales/order_payment');
63
+ $additionalInfo = $this->getAdditionalInfo();
64
+ $payment->setMethod(Netresearch_OPS_Model_Payment_PayPerMail::CODE)
65
+ ->setAdditionalInformation(
66
+ $additionalInfo
67
+ );
68
+ /** @var Netresearch_OPS_Model_Payment_Flex $subject */
69
+ $subject = $payment->getMethodInstance();
70
+
71
+ $this->assertEquals(
72
+ $additionalInfo[Netresearch_OPS_Model_Payment_PayPerMail::INFO_KEY_BRAND], $subject->getOpsBrand()
73
+ );
74
+
75
+ }
76
+
77
+ }
app/code/community/Netresearch/OPS/Test/Model/Payment/Recurring/Cc/ParameterBagTest.php CHANGED
@@ -112,6 +112,7 @@ class Netresearch_OPS_Test_Model_Payment_Recurring_Cc_ParameterBagTest extends E
112
  $profile = Mage::getModel('sales/recurring_profile');
113
  $address = Mage::getModel('sales/quote_address');
114
  $address->setCity('Leipzig');
 
115
  $quote = Mage::getModel('sales/quote');
116
  $quote->setShippingAddress($address);
117
  $quote->setBillingAddress($address);
@@ -222,7 +223,7 @@ class Netresearch_OPS_Test_Model_Payment_Recurring_Cc_ParameterBagTest extends E
222
 
223
  $params = $subject->collectProfileParameters($profile, true);
224
 
225
- $this->assertEquals(Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag::PERIOD_UNIT_DAY, $params['SUB_PERIOD_UNIT']);
226
 
227
  $id = Netresearch_OPS_Helper_Subscription::SUBSCRIPTION_PREFIX . $profile->getId() . Netresearch_OPS_Helper_Subscription::TRIAL_SUFFIX ;
228
  $this->assertArrayHasKey('SUBSCRIPTION_ID', $params);
112
  $profile = Mage::getModel('sales/recurring_profile');
113
  $address = Mage::getModel('sales/quote_address');
114
  $address->setCity('Leipzig');
115
+ $address->setStreet('Test 123');
116
  $quote = Mage::getModel('sales/quote');
117
  $quote->setShippingAddress($address);
118
  $quote->setBillingAddress($address);
223
 
224
  $params = $subject->collectProfileParameters($profile, true);
225
 
226
+ $this->assertEquals(Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag::PERIOD_UNIT_DAY, $params['SUB_PERIOD_UNIT']);
227
 
228
  $id = Netresearch_OPS_Helper_Subscription::SUBSCRIPTION_PREFIX . $profile->getId() . Netresearch_OPS_Helper_Subscription::TRIAL_SUFFIX ;
229
  $this->assertArrayHasKey('SUBSCRIPTION_ID', $params);
app/code/community/Netresearch/OPS/Test/Model/Payment/Recurring/CcTest.php CHANGED
@@ -514,7 +514,8 @@ class Netresearch_OPS_Test_Model_Payment_Recurring_CcTest extends EcomDev_PHPUni
514
  $subject = Mage::getModel('ops/payment_recurring_cc');
515
  $payment = Mage::getModel('payment/info');
516
  $payment->setAdditionalInformation('HTML_ANSWER', 'abc');
517
- $this->assertEquals($subject->getOrderPlaceRedirectUrl($payment),
 
518
  Mage::getModel('ops/config')->get3dSecureRedirectUrl()
519
  );
520
 
@@ -533,7 +534,8 @@ class Netresearch_OPS_Test_Model_Payment_Recurring_CcTest extends EcomDev_PHPUni
533
  {
534
  /** @var Netresearch_OPS_Model_Payment_Recurring_Cc $subject */
535
  $subject = Mage::getModel('ops/payment_recurring_cc');
536
- $this->assertEquals($subject->getBrandsForAliasInterface(),
 
537
  'American Express,Diners Club,MaestroUK,MasterCard,VISA,JCB'
538
  );
539
  }
@@ -547,7 +549,8 @@ class Netresearch_OPS_Test_Model_Payment_Recurring_CcTest extends EcomDev_PHPUni
547
  $subject->setSubscriptionManager('abc');
548
  $this->assertTrue($subject->getSubscriptionManager() === 'abc');
549
 
550
- $this->assertTrue($subject->getParameterModel() instanceof
 
551
  Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag
552
  );
553
  $subject->setParameterModel('abc');
514
  $subject = Mage::getModel('ops/payment_recurring_cc');
515
  $payment = Mage::getModel('payment/info');
516
  $payment->setAdditionalInformation('HTML_ANSWER', 'abc');
517
+ $this->assertEquals(
518
+ $subject->getOrderPlaceRedirectUrl($payment),
519
  Mage::getModel('ops/config')->get3dSecureRedirectUrl()
520
  );
521
 
534
  {
535
  /** @var Netresearch_OPS_Model_Payment_Recurring_Cc $subject */
536
  $subject = Mage::getModel('ops/payment_recurring_cc');
537
+ $this->assertEquals(
538
+ $subject->getBrandsForAliasInterface(),
539
  'American Express,Diners Club,MaestroUK,MasterCard,VISA,JCB'
540
  );
541
  }
549
  $subject->setSubscriptionManager('abc');
550
  $this->assertTrue($subject->getSubscriptionManager() === 'abc');
551
 
552
+ $this->assertTrue(
553
+ $subject->getParameterModel() instanceof
554
  Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag
555
  );
556
  $subject->setParameterModel('abc');
app/code/community/Netresearch/OPS/Test/Model/Response/TestCase.php CHANGED
@@ -37,12 +37,11 @@ abstract class Netresearch_OPS_Test_Model_Response_TestCase extends EcomDev_PHPU
37
  {
38
  protected function mockOrderConfig()
39
  {
40
- $configMock = $this->getModelMock('sales/order_config', ['getDefaultStatus']);
41
  $configMock
42
  ->expects($this->any())
43
  ->method('getDefaultStatus')
44
- ->will($this->returnArgument(0))
45
- ;
46
  $this->replaceByMock('singleton', 'sales/order_config', $configMock);
47
  }
48
 
@@ -53,12 +52,11 @@ abstract class Netresearch_OPS_Test_Model_Response_TestCase extends EcomDev_PHPU
53
  */
54
  protected function mockEmailHelper(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
55
  {
56
- $helperMock = $this->getHelperMock('ops/data', ['sendTransactionalEmail']);
57
  $helperMock
58
  ->expects($matcher)
59
  ->method('sendTransactionalEmail')
60
- ->with($this->isInstanceOf('Mage_Sales_Model_Order'))
61
- ;
62
  $this->replaceByMock('helper', 'ops/data', $helperMock);
63
  }
64
  }
37
  {
38
  protected function mockOrderConfig()
39
  {
40
+ $configMock = $this->getModelMock('sales/order_config', array('getDefaultStatus'));
41
  $configMock
42
  ->expects($this->any())
43
  ->method('getDefaultStatus')
44
+ ->will($this->returnArgument(0));
 
45
  $this->replaceByMock('singleton', 'sales/order_config', $configMock);
46
  }
47
 
52
  */
53
  protected function mockEmailHelper(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
54
  {
55
+ $helperMock = $this->getHelperMock('ops/data', array('sendTransactionalEmail'));
56
  $helperMock
57
  ->expects($matcher)
58
  ->method('sendTransactionalEmail')
59
+ ->with($this->isInstanceOf('Mage_Sales_Model_Order'));
 
60
  $this->replaceByMock('helper', 'ops/data', $helperMock);
61
  }
62
  }
app/code/community/Netresearch/OPS/Test/Model/Response/Type/AuthorizeTest.php CHANGED
@@ -190,7 +190,7 @@ class Netresearch_OPS_Test_Model_Response_Type_AuthorizeTest
190
 
191
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, $order->getState());
192
  $this->assertNotEmpty($order->getAllStatusHistory());
193
- $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
194
  }
195
 
196
  /**
@@ -203,7 +203,7 @@ class Netresearch_OPS_Test_Model_Response_Type_AuthorizeTest
203
  $order = Mage::getModel('sales/order')->load(30);
204
 
205
  $response = array(
206
- 'status' => 55,
207
  'payid' => 12345678,
208
  'payidsub' => 3,
209
  'amount' => 33.33
@@ -216,7 +216,7 @@ class Netresearch_OPS_Test_Model_Response_Type_AuthorizeTest
216
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, $order->getState());
217
  $this->assertEquals(Mage_Sales_Model_Order::STATUS_FRAUD, $order->getStatus());
218
  $this->assertNotEmpty($order->getAllStatusHistory());
219
- $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
220
  }
221
 
222
  /**
@@ -229,7 +229,7 @@ class Netresearch_OPS_Test_Model_Response_Type_AuthorizeTest
229
 
230
  $order = Mage::getModel('sales/order')->load(31);
231
  $response = array(
232
- 'status' => 55,
233
  'payid' => 1234567897,
234
  'payidsub' => 3,
235
  'amount' => 33.33
@@ -242,7 +242,7 @@ class Netresearch_OPS_Test_Model_Response_Type_AuthorizeTest
242
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, $order->getState());
243
  $this->assertEquals(Mage_Sales_Model_Order::STATUS_FRAUD, $order->getStatus());
244
  $this->assertNotEmpty($order->getAllStatusHistory());
245
- $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
246
  }
247
 
248
  public function testStatusAuthorizationUnclear()
190
 
191
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, $order->getState());
192
  $this->assertNotEmpty($order->getAllStatusHistory());
193
+ $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
194
  }
195
 
196
  /**
203
  $order = Mage::getModel('sales/order')->load(30);
204
 
205
  $response = array(
206
+ 'status' => Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT,
207
  'payid' => 12345678,
208
  'payidsub' => 3,
209
  'amount' => 33.33
216
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, $order->getState());
217
  $this->assertEquals(Mage_Sales_Model_Order::STATUS_FRAUD, $order->getStatus());
218
  $this->assertNotEmpty($order->getAllStatusHistory());
219
+ $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
220
  }
221
 
222
  /**
229
 
230
  $order = Mage::getModel('sales/order')->load(31);
231
  $response = array(
232
+ 'status' => Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT,
233
  'payid' => 1234567897,
234
  'payidsub' => 3,
235
  'amount' => 33.33
242
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, $order->getState());
243
  $this->assertEquals(Mage_Sales_Model_Order::STATUS_FRAUD, $order->getStatus());
244
  $this->assertNotEmpty($order->getAllStatusHistory());
245
+ $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
246
  }
247
 
248
  public function testStatusAuthorizationUnclear()
app/code/community/Netresearch/OPS/Test/Model/Response/Type/CaptureTest.php CHANGED
@@ -134,7 +134,7 @@ class Netresearch_OPS_Test_Model_Response_Type_CaptureTest
134
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PROCESSING, $order->getState());
135
  $this->assertNotEmpty($order->getAllStatusHistory());
136
  $this->assertNotEmpty($order->getInvoiceCollection());
137
- $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
138
  }
139
 
140
  /**
@@ -182,7 +182,7 @@ class Netresearch_OPS_Test_Model_Response_Type_CaptureTest
182
 
183
  /** @var Netresearch_OPS_Model_Response_Type_Capture $handler */
184
  $handler = Mage::getModel('ops/response_type_capture');
185
- $handler->handleResponse($response, $order->getPayment()->getMethodInstance());
186
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, $order->getState());
187
  }
188
  }
134
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PROCESSING, $order->getState());
135
  $this->assertNotEmpty($order->getAllStatusHistory());
136
  $this->assertNotEmpty($order->getInvoiceCollection());
137
+ $this->assertEquals($response['status'], $order->getPayment()->getAdditionalInformation('status'));
138
  }
139
 
140
  /**
182
 
183
  /** @var Netresearch_OPS_Model_Response_Type_Capture $handler */
184
  $handler = Mage::getModel('ops/response_type_capture');
185
+ $handler->handleResponse($response, $order->getPayment()->getMethodInstance());
186
  $this->assertEquals(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, $order->getState());
187
  }
188
  }
app/code/community/Netresearch/OPS/Test/Model/Source/ModeTest.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
-
3
- /**
4
- * ModeTest.php
5
- * @author paul.siedler@netresearch.de
6
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
8
- */
9
- class Netresearch_OPS_Test_Model_Source_ModeTest extends EcomDev_PHPUnit_Test_Case
10
- {
11
-
12
- public function testToOptionArray()
13
- {
14
- $model = Mage::getModel('ops/source_mode');
15
- $options = $model->toOptionArray();
16
- $this->assertTrue(is_array($options));
17
- $this->assertEquals(Netresearch_OPS_Model_Source_Mode::TEST, $options[0]['value']);
18
- $this->assertEquals(Netresearch_OPS_Model_Source_Mode::PROD, $options[1]['value']);
19
- $this->assertEquals(Netresearch_OPS_Model_Source_Mode::CUSTOM, $options[2]['value']);
20
- }
21
- }
1
+ <?php
2
+
3
+ /**
4
+ * ModeTest.php
5
+ * @author paul.siedler@netresearch.de
6
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
8
+ */
9
+ class Netresearch_OPS_Test_Model_Source_ModeTest extends EcomDev_PHPUnit_Test_Case
10
+ {
11
+
12
+ public function testToOptionArray()
13
+ {
14
+ $model = Mage::getModel('ops/source_mode');
15
+ $options = $model->toOptionArray();
16
+ $this->assertTrue(is_array($options));
17
+ $this->assertEquals(Netresearch_OPS_Model_Source_Mode::TEST, $options[0]['value']);
18
+ $this->assertEquals(Netresearch_OPS_Model_Source_Mode::PROD, $options[1]['value']);
19
+ $this->assertEquals(Netresearch_OPS_Model_Source_Mode::CUSTOM, $options[2]['value']);
20
+ }
21
+ }
app/code/community/Netresearch/OPS/Test/Model/Status/UpdateTest.php CHANGED
@@ -8,7 +8,8 @@
8
  class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_Case
9
  {
10
 
11
- protected function mockSessions(){
 
12
  $sessionMock = $this->getModelMock('admin/session', array());
13
  $sessionMock->disableOriginalConstructor();
14
  $this->replaceByMock('singleton', 'admin/session', $sessionMock);
@@ -92,14 +93,14 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
92
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
93
  $directLinkApiMock->expects($this->once())
94
  ->method('performRequest')
95
- ->with(array(
 
96
  'PAYID' => 4711
97
  ),
98
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
99
  $order->getStoreId()
100
  )
101
- ->will($this->returnValue(array('STATUS' => 5)))
102
- ;
103
  $statusUpdateApiMock->setDirectLinkApi($directLinkApiMock);
104
  $statusUpdateApiMock->updateStatusFor($order);
105
  $opsResponse = $statusUpdateApiMock->getOpsResponse();
@@ -122,15 +123,15 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
122
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
123
  $directLinkApiMock->expects($this->once())
124
  ->method('performRequest')
125
- ->with(array(
 
126
  'PAYID' => 4711,
127
  'PAYIDSUB' => 1
128
  ),
129
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
130
  $order->getStoreId()
131
  )
132
- ->will($this->returnValue(array('STATUS' => 5)))
133
- ;
134
  $statusUpdateApiMock->setDirectLinkApi($directLinkApiMock);
135
  $statusUpdateApiMock->updateStatusFor($order);
136
  $opsResponse = $statusUpdateApiMock->getOpsResponse();
@@ -152,15 +153,15 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
152
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
153
  $directLinkApiMock->expects($this->once())
154
  ->method('performRequest')
155
- ->with(array(
 
156
  'PAYID' => 4711,
157
  'PAYIDSUB' => 1,
158
  ),
159
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
160
  $order->getStoreId()
161
  )
162
- ->will($this->returnValue(array('STATUS' => 8, 'AMOUNT' => 1,)))
163
- ;
164
 
165
  $statusUpdateApiMock->setDirectLinkApi($directLinkApiMock);
166
  $statusUpdateApiMock->updateStatusFor($order);
@@ -189,12 +190,11 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
189
  ;
190
 
191
  // no email on refund response type
192
- $dataHelperMock = $this->getHelperMock('ops/data', ['sendTransactionalEmail']);
193
  $dataHelperMock
194
  ->expects($this->never())
195
  ->method('sendTransactionalEmail')
196
- ->with($this->isInstanceOf('Mage_Sales_Model_Order'))
197
- ;
198
  $this->replaceByMock('helper', 'ops/data', $dataHelperMock);
199
 
200
 
@@ -202,14 +202,14 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
202
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
203
  $directLinkApiMock->expects($this->once())
204
  ->method('performRequest')
205
- ->with(array(
 
206
  'PAYID' => 4711,
207
  ),
208
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
209
  $order->getStoreId()
210
  )
211
- ->will($this->returnValue(array('STATUS' => Netresearch_OPS_Model_Status::REFUNDED,)))
212
- ;
213
 
214
  $adminSessionMock = $this->getModelMock('adminhtml/session', array('init', 'save', 'addNotice'));
215
  $statusUpdateApi->setMessageContainer($adminSessionMock);
@@ -233,15 +233,13 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
233
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('saveOpsStatusToPayment'));
234
  $paymentHelperMock->expects($this->any())
235
  ->method('saveOpsStatusToPayment')
236
- ->with($payment, $response)
237
- ;
238
 
239
- $dataHelperMock = $this->getHelperMock('ops/data', ['sendTransactionalEmail']);
240
  $dataHelperMock
241
  ->expects($this->once())
242
  ->method('sendTransactionalEmail')
243
- ->with($this->isInstanceOf('Mage_Sales_Model_Order'))
244
- ;
245
  $this->replaceByMock('helper', 'ops/data', $dataHelperMock);
246
 
247
  $adminSessionMock = $this->getModelMock('adminhtml/session', array('init', 'save', 'addSuccess'));
@@ -251,14 +249,14 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
251
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
252
  $directLinkApiMock->expects($this->once())
253
  ->method('performRequest')
254
- ->with(array(
 
255
  'PAYID' => 4711,
256
  ),
257
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
258
  $order->getStoreId()
259
  )
260
- ->will($this->returnValue($response))
261
- ;
262
 
263
  $statusUpdateApi->setPaymentHelper($paymentHelperMock);
264
  $statusUpdateApi->setDirectLinkApi($directLinkApiMock);
@@ -280,27 +278,25 @@ class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_
280
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('saveOpsStatusToPayment', 'applyStateForOrder'));
281
  $paymentHelperMock->expects($this->any())
282
  ->method('saveOpsStatusToPayment')
283
- ->with($payment, $response)
284
- ;
285
 
286
  $paymentHelperMock->expects($this->any())
287
  ->method('applyStateForOrder')
288
- ->with($order, $response)
289
- ;
290
  $adminSessionMock = $this->getModelMock('adminhtml/session', array('init', 'save', 'addSuccess'));
291
  $statusUpdateApiMock = Mage::getModel('ops/status_update');
292
  $statusUpdateApiMock->setMessageContainer($adminSessionMock);
293
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
294
  $directLinkApiMock->expects($this->once())
295
  ->method('performRequest')
296
- ->with(array(
 
297
  'ORDERID' => Mage::getModel('ops/config')->getConfigData('devprefix') . '',
298
  ),
299
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
300
  $order->getStoreId()
301
  )
302
- ->will($this->returnValue($response))
303
- ;
304
 
305
 
306
  $statusUpdateApiMock->setPaymentHelper($paymentHelperMock);
8
  class Netresearch_OPS_Test_Model_Status_UpdateTest extends EcomDev_PHPUnit_Test_Case
9
  {
10
 
11
+ protected function mockSessions()
12
+ {
13
  $sessionMock = $this->getModelMock('admin/session', array());
14
  $sessionMock->disableOriginalConstructor();
15
  $this->replaceByMock('singleton', 'admin/session', $sessionMock);
93
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
94
  $directLinkApiMock->expects($this->once())
95
  ->method('performRequest')
96
+ ->with(
97
+ array(
98
  'PAYID' => 4711
99
  ),
100
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
101
  $order->getStoreId()
102
  )
103
+ ->will($this->returnValue(array('STATUS' => 5)));
 
104
  $statusUpdateApiMock->setDirectLinkApi($directLinkApiMock);
105
  $statusUpdateApiMock->updateStatusFor($order);
106
  $opsResponse = $statusUpdateApiMock->getOpsResponse();
123
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
124
  $directLinkApiMock->expects($this->once())
125
  ->method('performRequest')
126
+ ->with(
127
+ array(
128
  'PAYID' => 4711,
129
  'PAYIDSUB' => 1
130
  ),
131
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
132
  $order->getStoreId()
133
  )
134
+ ->will($this->returnValue(array('STATUS' => 5)));
 
135
  $statusUpdateApiMock->setDirectLinkApi($directLinkApiMock);
136
  $statusUpdateApiMock->updateStatusFor($order);
137
  $opsResponse = $statusUpdateApiMock->getOpsResponse();
153
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
154
  $directLinkApiMock->expects($this->once())
155
  ->method('performRequest')
156
+ ->with(
157
+ array(
158
  'PAYID' => 4711,
159
  'PAYIDSUB' => 1,
160
  ),
161
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
162
  $order->getStoreId()
163
  )
164
+ ->will($this->returnValue(array('STATUS' => 8, 'AMOUNT' => 1,)));
 
165
 
166
  $statusUpdateApiMock->setDirectLinkApi($directLinkApiMock);
167
  $statusUpdateApiMock->updateStatusFor($order);
190
  ;
191
 
192
  // no email on refund response type
193
+ $dataHelperMock = $this->getHelperMock('ops/data', array('sendTransactionalEmail'));
194
  $dataHelperMock
195
  ->expects($this->never())
196
  ->method('sendTransactionalEmail')
197
+ ->with($this->isInstanceOf('Mage_Sales_Model_Order'));
 
198
  $this->replaceByMock('helper', 'ops/data', $dataHelperMock);
199
 
200
 
202
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
203
  $directLinkApiMock->expects($this->once())
204
  ->method('performRequest')
205
+ ->with(
206
+ array(
207
  'PAYID' => 4711,
208
  ),
209
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
210
  $order->getStoreId()
211
  )
212
+ ->will($this->returnValue(array('STATUS' => Netresearch_OPS_Model_Status::REFUNDED,)));
 
213
 
214
  $adminSessionMock = $this->getModelMock('adminhtml/session', array('init', 'save', 'addNotice'));
215
  $statusUpdateApi->setMessageContainer($adminSessionMock);
233
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('saveOpsStatusToPayment'));
234
  $paymentHelperMock->expects($this->any())
235
  ->method('saveOpsStatusToPayment')
236
+ ->with($payment, $response);
 
237
 
238
+ $dataHelperMock = $this->getHelperMock('ops/data', array('sendTransactionalEmail'));
239
  $dataHelperMock
240
  ->expects($this->once())
241
  ->method('sendTransactionalEmail')
242
+ ->with($this->isInstanceOf('Mage_Sales_Model_Order'));
 
243
  $this->replaceByMock('helper', 'ops/data', $dataHelperMock);
244
 
245
  $adminSessionMock = $this->getModelMock('adminhtml/session', array('init', 'save', 'addSuccess'));
249
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
250
  $directLinkApiMock->expects($this->once())
251
  ->method('performRequest')
252
+ ->with(
253
+ array(
254
  'PAYID' => 4711,
255
  ),
256
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
257
  $order->getStoreId()
258
  )
259
+ ->will($this->returnValue($response));
 
260
 
261
  $statusUpdateApi->setPaymentHelper($paymentHelperMock);
262
  $statusUpdateApi->setDirectLinkApi($directLinkApiMock);
278
  $paymentHelperMock = $this->getHelperMock('ops/payment', array('saveOpsStatusToPayment', 'applyStateForOrder'));
279
  $paymentHelperMock->expects($this->any())
280
  ->method('saveOpsStatusToPayment')
281
+ ->with($payment, $response);
 
282
 
283
  $paymentHelperMock->expects($this->any())
284
  ->method('applyStateForOrder')
285
+ ->with($order, $response);
 
286
  $adminSessionMock = $this->getModelMock('adminhtml/session', array('init', 'save', 'addSuccess'));
287
  $statusUpdateApiMock = Mage::getModel('ops/status_update');
288
  $statusUpdateApiMock->setMessageContainer($adminSessionMock);
289
  $directLinkApiMock = $this->getModelMock('ops/api_directlink', array('performRequest'));
290
  $directLinkApiMock->expects($this->once())
291
  ->method('performRequest')
292
+ ->with(
293
+ array(
294
  'ORDERID' => Mage::getModel('ops/config')->getConfigData('devprefix') . '',
295
  ),
296
  Mage::getModel('ops/config')->getDirectLinkMaintenanceApiPath($order->getStoreId()),
297
  $order->getStoreId()
298
  )
299
+ ->will($this->returnValue($response));
 
300
 
301
 
302
  $statusUpdateApiMock->setPaymentHelper($paymentHelperMock);
app/code/community/Netresearch/OPS/Test/Model/StatusTest.php CHANGED
@@ -78,7 +78,7 @@ class Netresearch_OPS_Test_Model_StatusTest extends EcomDev_PHPUnit_Test_Case
78
  Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT,
79
  Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING,
80
  Netresearch_OPS_Model_Status::AUTHORIZED_UNKNOWN,
81
- Netresearch_OPS_Model_Status::STAND_BY_SUSPECTED_FRAUD,
82
  Netresearch_OPS_Model_Status::OK_WITH_SHEDULED_PAYMENTS,
83
  Netresearch_OPS_Model_Status::NOT_OK_WITH_SHEDULED_PAYMENTS,
84
  Netresearch_OPS_Model_Status::AUTHORISATION_TO_BE_REQUESTED_MANUALLY
78
  Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT,
79
  Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING,
80
  Netresearch_OPS_Model_Status::AUTHORIZED_UNKNOWN,
81
+ Netresearch_OPS_Model_Status::STAND_BY,
82
  Netresearch_OPS_Model_Status::OK_WITH_SHEDULED_PAYMENTS,
83
  Netresearch_OPS_Model_Status::NOT_OK_WITH_SHEDULED_PAYMENTS,
84
  Netresearch_OPS_Model_Status::AUTHORISATION_TO_BE_REQUESTED_MANUALLY
app/code/community/Netresearch/OPS/Test/Model/Subscription/ManagerTest.php CHANGED
@@ -108,7 +108,8 @@ class Netresearch_OPS_Test_Model_Subscription_ManagerTest extends EcomDev_PHPUni
108
  ->will($this->returnValue(''));
109
  $this->replaceByMock('model', 'sales/order', $orderMock);
110
 
111
- $paymentMock = $this->getModelMock('sales/order_payment',
 
112
  array('registerAuthorizationNotification', 'registerCaptureNotification')
113
  );
114
  $paymentMock->expects($this->any())
108
  ->will($this->returnValue(''));
109
  $this->replaceByMock('model', 'sales/order', $orderMock);
110
 
111
+ $paymentMock = $this->getModelMock(
112
+ 'sales/order_payment',
113
  array('registerAuthorizationNotification', 'registerCaptureNotification')
114
  );
115
  $paymentMock->expects($this->any())
app/code/community/Netresearch/OPS/Test/Model/System/Config/Backend/EncodingTest.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * PHP version 5
18
+ *
19
+ * @category OPS
20
+ * @package Netresearch_OPS
21
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
22
+ * @copyright 2016 Netresearch GmbH & Co. KG
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @link http://www.netresearch.de/
25
+ */
26
+
27
+ /**
28
+ * Netresearch_OPS_Test_Block_System_Config_EncodingTest
29
+ *
30
+ * @category OPS
31
+ * @package Netresearch_OPS
32
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
33
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
+ * @link http://www.netresearch.de/
35
+ */
36
+ class Netresearch_OPS_Test_Model_System_Config_Backend_EncodingTest
37
+ extends EcomDev_PHPUnit_Test_Case
38
+ {
39
+ /**
40
+ * @test
41
+ */
42
+ public function testToOptionArray()
43
+ {
44
+ /** @var Netresearch_Ops_Model_System_Config_Backend_PaymentLogo $optionModel */
45
+ $optionModel = Mage::getModel('ops/system_config_backend_encoding');
46
+
47
+ $result = $optionModel->toOptionArray();
48
+
49
+ $this->assertInternalType('array', $result);
50
+ $this->assertArrayHasKey('value', $result[0]);
51
+ $this->assertArrayHasKey('label', $result[0]);
52
+
53
+ $this->assertEquals('utf-8', $result[0]['value']);
54
+ $this->assertEquals('UTF-8', $result[0]['label']);
55
+
56
+ $this->assertEquals('other', $result[1]['value']);
57
+ $this->assertEquals('Other', $result[1]['label']);
58
+ }
59
+
60
+ }
app/code/community/Netresearch/OPS/Test/Model/System/Config/Backend/PaymentLogoTest.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * PHP version 5
18
+ *
19
+ * @category OPS
20
+ * @package Netresearch_OPS
21
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
22
+ * @copyright 2016 Netresearch GmbH & Co. KG
23
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24
+ * @link http://www.netresearch.de/
25
+ */
26
+
27
+ /**
28
+ * Netresearch_OPS_Test_Block_System_Config_PaymentLogoTest
29
+ *
30
+ * @category OPS
31
+ * @package Netresearch_OPS
32
+ * @author Benjamin Heuer <benjamin.heuer@netresearch.de>
33
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
+ * @link http://www.netresearch.de/
35
+ */
36
+ class Netresearch_OPS_Test_Model_System_Config_Backend_PaymentLogoTest
37
+ extends EcomDev_PHPUnit_Test_Case
38
+ {
39
+ /**
40
+ * @test
41
+ */
42
+ public function toOptionArray()
43
+ {
44
+ /** @var Netresearch_Ops_Model_System_Config_Backend_PaymentLogo $optionModel */
45
+ $optionModel = Mage::getModel('ops/system_config_backend_paymentLogo');
46
+
47
+ $result = $optionModel->toOptionArray();
48
+
49
+ $this->assertInternalType('array', $result);
50
+ $this->assertArrayHasKey('value', $result[0]);
51
+ }
52
+
53
+ }
app/code/community/Netresearch/OPS/Test/Model/Validator/Payment/DirectDebitTest.php DELETED
@@ -1,166 +0,0 @@
1
- <?php
2
- /**
3
- * @author Michael Lühr <michael.luehr@netresearch.de>
4
- * @category Netresearch
5
- * @package ${MODULENAME}
6
- * @copyright Copyright (c) 2013 Netresearch GmbH & Co. KG (http://www.netresearch.de)
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
-
10
-
11
- class Netresearch_OPS_Test_Model_Validator_Payment_DirectDebitTest
12
- extends EcomDev_PHPUnit_Test_Case
13
- {
14
-
15
- protected function getValidator()
16
- {
17
- return $validator = Mage::getModel('ops/validator_payment_directDebit');
18
- }
19
- public function testIsValidWithInvalidDataReturnsFalse()
20
- {
21
- /** @var $validator Netresearch_OPS_Model_Validator_Payment_DirectDebit */
22
- $validator = Mage::getModel('ops/validator_payment_directDebit');
23
- $directDebitData = array();
24
- $this->assertFalse($validator->isValid($directDebitData));
25
- $directDebitData = array('CN' => 'foo');
26
- $this->assertFalse($validator->isValid($directDebitData));
27
- $this->assertTrue(0 < $validator->getMessages());
28
- $directDebitData = array('CN' => 'foo', 'country' => 'de');
29
- $this->assertFalse($validator->isValid($directDebitData));
30
- }
31
-
32
- public function testIsValidWithBankAccountData()
33
- {
34
- /** @var $validator Netresearch_OPS_Model_Validator_Payment_DirectDebit */
35
- $validator = Mage::getModel('ops/validator_payment_directDebit');
36
- $directDebitData = array(
37
- 'CN' => 'foo', 'country' => 'de', 'account' => '12345678',
38
- 'iban' => ''
39
- );
40
- $this->assertFalse($validator->isValid($directDebitData));
41
-
42
- $directDebitData = array(
43
- 'CN' => 'foo', 'country' => 'de', 'account' => '12345678a',
44
- 'iban' => ''
45
- );
46
- $this->assertFalse($validator->isValid($directDebitData));
47
-
48
- $directDebitData = array(
49
- 'CN' => '', 'country' => 'de', 'account' => '12345678a',
50
- 'iban' => ''
51
- );
52
- $this->assertFalse($validator->isValid($directDebitData));
53
-
54
- $directDebitData = array(
55
- 'CN' => 'foo', 'country' => 'at', 'account' => '12345678',
56
- 'iban' => ''
57
- );
58
- $this->assertFalse($validator->isValid($directDebitData));
59
-
60
- $directDebitData = array(
61
- 'CN' => 'foo', 'country' => 'nl', 'account' => '12345678',
62
- 'iban' => ''
63
- );
64
- $this->assertTrue($validator->isValid($directDebitData));
65
-
66
- $directDebitData = array(
67
- 'CN' => 'foo', 'country' => 'de', 'account' => '12345678',
68
- 'iban' => '', 'bankcode' => '12345678'
69
- );
70
- $this->assertTrue($validator->isValid($directDebitData));
71
-
72
- $directDebitData = array(
73
- 'CN' => 'foo', 'country' => 'at', 'account' => '12345678',
74
- 'iban' => '', 'bankcode' => '12345678'
75
- );
76
- $this->assertTrue($validator->isValid($directDebitData));
77
-
78
-
79
- }
80
-
81
- public function testIsValidWithIbanData()
82
- {
83
- /** @var $validator Netresearch_OPS_Model_Validator_Payment_DirectDebit */
84
- $validator = Mage::getModel('ops/validator_payment_directDebit');
85
- $directDebitData = array(
86
- 'CN' => 'foo', 'country' => 'de', 'account' => '',
87
- 'iban' => 'DE12345456677891234545667789'
88
- );
89
- $this->assertFalse($validator->isValid($directDebitData));
90
-
91
- $directDebitData = array(
92
- 'CN' => 'foo', 'country' => 'at', 'account' => '',
93
- 'iban' => 'AT12345456677891234545667789'
94
- );
95
- $this->assertFalse($validator->isValid($directDebitData));
96
-
97
- $directDebitData = array(
98
- 'CN' => 'foo', 'country' => 'nl', 'account' => '',
99
- 'iban' => 'NL12345456677891234545667789'
100
- );
101
- $this->assertFalse($validator->isValid($directDebitData));
102
-
103
- $directDebitData = array(
104
- 'CN' => 'foo', 'country' => 'de', 'account' => '',
105
- 'iban' => 'DE65160500003502221536'
106
- );
107
- $this->assertTrue($validator->isValid($directDebitData));
108
-
109
- $directDebitData = array(
110
- 'CN' => 'foo', 'country' => 'de', 'account' => '',
111
- 'iban' => 'DE65 1605 0000 3502 2215 36'
112
- );
113
- $this->assertFalse($validator->isValid($directDebitData));
114
- $directDebitData = array(
115
- 'CN' => 'foo', 'country' => 'de', 'account' => '',
116
- 'iban' => 'DE89370400440532013000'
117
- );
118
- $this->assertTrue($validator->isValid($directDebitData));
119
-
120
- $directDebitData = array(
121
- 'CN' => 'foo', 'country' => 'nl', 'account' => '',
122
- 'iban' => 'NL39RABO0300065264'
123
- );
124
- $this->assertTrue($validator->isValid($directDebitData));
125
-
126
- $directDebitData = array(
127
- 'CN' => 'foo', 'country' => 'nl', 'account' => '',
128
- 'iban' => 'NL39RABO0300065264', 'bic' => 'RABONL2U'
129
- );
130
- $this->assertTrue($validator->isValid($directDebitData));
131
-
132
- $directDebitData = array(
133
- 'CN' => 'foo', 'country' => 'nl', 'account' => '',
134
- 'iban' => 'NL39RABO0300065264', 'bic' => '012345678912'
135
- );
136
- $this->assertFalse($validator->isValid($directDebitData));
137
-
138
- $directDebitData = array(
139
- 'CN' => 'foo', 'country' => 'nl', 'account' => '',
140
- 'iban' => 'NL39RABO0300065264', 'bic' => '01234567891'
141
- );
142
- $this->assertTrue($validator->isValid($directDebitData));
143
- }
144
-
145
- public function testSetDataHelper()
146
- {
147
- /** @var $validator Netresearch_OPS_Model_Validator_Payment_DirectDebit */
148
- $validator = Mage::getModel('ops/validator_payment_directDebit');
149
- $validator->setDataHelper(Mage::helper('core/data'));
150
- $this->assertEquals(
151
- get_class(Mage::helper('core/data')),
152
- get_class($validator->getDataHelper())
153
- );
154
- }
155
- public function testSetdirectDebitHelper()
156
- {
157
- /** @var $validator Netresearch_OPS_Model_Validator_Payment_DirectDebit */
158
- $validator = Mage::getModel('ops/validator_payment_directDebit');
159
- $validator->setDirectDebitHelper(Mage::helper('ops/directDebit'));
160
- $this->assertEquals(
161
- get_class(Mage::helper('ops/directDebit')),
162
- get_class($validator->getDirectDebitHelper())
163
- );
164
- }
165
-
166
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Netresearch/OPS/Test/var/fixtures/orders.yaml CHANGED
@@ -26,6 +26,7 @@ tables:
26
  state: 'pending_payment'
27
  status: 'pending_payment'
28
  quote_id: 24
 
29
 
30
  - entity_id: 13
31
  increment_id: 100000013
@@ -273,6 +274,34 @@ tables:
273
  state: 'pending_payment'
274
  status: 'pending_payment'
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  sales/quote:
277
  - entity_id: 1
278
  base_grand_total: 119.00
@@ -306,6 +335,10 @@ tables:
306
  store_id: 0
307
  created_at: '2013-05-14 14:45:00'
308
 
 
 
 
 
309
  sales/quote_payment:
310
  - payment_id: 1
311
  quote_id: 10
@@ -331,10 +364,16 @@ tables:
331
  method: 'ops_paypal'
332
  additional_information: a:7:{s:8:"CC_BRAND";s:4:"VISA";s:5:"CC_CN";s:10:"Max Muster";s:3:"cvc";s:3:"123";s:12:"saveOpsAlias";s:1:"0";s:5:"alias";s:4:"4714";s:12:"ops_response";a:22:{s:7:"orderID";s:11:"SER13041841";s:5:"PAYID";s:8:"20908736";s:8:"NCSTATUS";s:1:"0";s:7:"NCERROR";s:1:"0";s:10:"ACCEPTANCE";s:7:"test123";s:6:"STATUS";s:1:"5";s:5:"IPCTY";s:2:"AU";s:5:"CCCTY";s:2:"US";s:3:"ECI";s:2:"12";s:8:"CVCCheck";s:2:"NO";s:8:"AAVCheck";s:2:"NO";s:2:"VC";s:2:"NO";s:6:"AAVZIP";s:2:"NO";s:10:"AAVADDRESS";s:2:"NO";s:6:"amount";s:2:"35";s:8:"currency";s:3:"EUR";s:2:"PM";s:10:"CreditCard";s:5:"BRAND";s:4:"VISA";s:7:"SCORING";s:1:"3";s:12:"SCO_CATEGORY";s:1:"O";s:5:"ALIAS";s:12:"041907169941";s:11:"NCERRORPLUS";s:1:"!";}s:28:"checkoutFinishedSuccessfully";b:1;}
333
 
 
 
 
 
 
 
334
  sales/order_payment:
335
  - entity_id: 1
336
  parent_id: 11
337
- additional_information: a:6:{s:8:"CC_BRAND";s:4:"VISA";s:5:"CC_CN";s:10:"Max Muster";s:12:"saveOpsAlias";s:1:"0";s:5:"alias";s:12:"041907169941";s:12:"ops_response";a:22:{s:7:"orderID";s:11:"SER13041841";s:5:"PAYID";s:8:"20908736";s:8:"NCSTATUS";s:1:"0";s:7:"NCERROR";s:1:"0";s:10:"ACCEPTANCE";s:7:"test123";s:6:"STATUS";s:1:"5";s:5:"IPCTY";s:2:"AU";s:5:"CCCTY";s:2:"US";s:3:"ECI";s:2:"12";s:8:"CVCCheck";s:2:"NO";s:8:"AAVCheck";s:2:"NO";s:2:"VC";s:2:"NO";s:6:"AAVZIP";s:2:"NO";s:10:"AAVADDRESS";s:2:"NO";s:6:"amount";s:2:"35";s:8:"currency";s:3:"EUR";s:2:"PM";s:10:"CreditCard";s:5:"BRAND";s:4:"VISA";s:7:"SCORING";s:1:"3";s:12:"SCO_CATEGORY";s:1:"O";s:5:"ALIAS";s:12:"041907169941";s:11:"NCERRORPLUS";s:1:"!";}s:28:"checkoutFinishedSuccessfully";b:1;}
338
  method: 'ops_bankTransfer'
339
 
340
  - entity_id: 2
@@ -426,6 +465,16 @@ tables:
426
  additional_information: a:6:{s:8:"CC_BRAND";s:16:"PostFinance Card";s:5:"CC_CN";s:10:"Max Muster";s:12:"saveOpsAlias";s:1:"0";s:5:"alias";s:12:"041907169941";s:12:"ops_response";a:22:{s:7:"orderID";s:11:"SER13041841";s:5:"PAYID";s:8:"20908736";s:8:"NCSTATUS";s:1:"0";s:7:"NCERROR";s:1:"0";s:10:"ACCEPTANCE";s:7:"test123";s:6:"STATUS";s:1:"5";s:5:"IPCTY";s:2:"AU";s:5:"CCCTY";s:2:"US";s:3:"ECI";s:2:"12";s:8:"CVCCheck";s:2:"NO";s:8:"AAVCheck";s:2:"NO";s:2:"VC";s:2:"NO";s:6:"AAVZIP";s:2:"NO";s:10:"AAVADDRESS";s:2:"NO";s:6:"amount";s:2:"35";s:8:"currency";s:3:"EUR";s:2:"PM";s:10:"CreditCard";s:5:"BRAND";s:4:"VISA";s:7:"SCORING";s:1:"3";s:12:"SCO_CATEGORY";s:1:"O";s:5:"ALIAS";s:12:"041907169941";s:11:"NCERRORPLUS";s:1:"!";}s:28:"checkoutFinishedSuccessfully";b:1;}
427
  method: 'checkmo'
428
 
 
 
 
 
 
 
 
 
 
 
429
  sales/shipment:
430
  - entity_id: 1
431
  increment_id: 100000077
@@ -609,6 +658,21 @@ tables:
609
  suffix: 'MdL'
610
  company: ''
611
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  sales/order_item:
613
  - item_id: 11
614
  order_id: 11
26
  state: 'pending_payment'
27
  status: 'pending_payment'
28
  quote_id: 24
29
+ store_id: 0
30
 
31
  - entity_id: 13
32
  increment_id: 100000013
274
  state: 'pending_payment'
275
  status: 'pending_payment'
276
 
277
+ - entity_id: 31
278
+ increment_id: 100000031
279
+ shipping_address_id: 42
280
+ base_grand_total: 177.55
281
+ grand_total: 177.55
282
+ currency: 'EUR'
283
+ customer_gender: 1
284
+ shipping_method: 'flatrate_flatrate'
285
+ customer_email: 'willi.usa.customer@trash-mail.com'
286
+ state: 'processing'
287
+ status: 'processing'
288
+ quote_id: 25
289
+ store_id: 0
290
+
291
+ - entity_id: 32
292
+ increment_id: 100000032
293
+ shipping_address_id: 42
294
+ base_grand_total: 177.55
295
+ grand_total: 177.55
296
+ currency: 'EUR'
297
+ customer_gender: 1
298
+ shipping_method: 'flatrate_flatrate'
299
+ customer_email: 'willi.usa.customer@trash-mail.com'
300
+ state: 'processing'
301
+ status: 'processing'
302
+ quote_id: 32
303
+ store_id: 0
304
+
305
  sales/quote:
306
  - entity_id: 1
307
  base_grand_total: 119.00
335
  store_id: 0
336
  created_at: '2013-05-14 14:45:00'
337
 
338
+ - entity_id: 32
339
+ store_id: 0
340
+ created_at: '2013-05-14 14:45:00'
341
+
342
  sales/quote_payment:
343
  - payment_id: 1
344
  quote_id: 10
364
  method: 'ops_paypal'
365
  additional_information: a:7:{s:8:"CC_BRAND";s:4:"VISA";s:5:"CC_CN";s:10:"Max Muster";s:3:"cvc";s:3:"123";s:12:"saveOpsAlias";s:1:"0";s:5:"alias";s:4:"4714";s:12:"ops_response";a:22:{s:7:"orderID";s:11:"SER13041841";s:5:"PAYID";s:8:"20908736";s:8:"NCSTATUS";s:1:"0";s:7:"NCERROR";s:1:"0";s:10:"ACCEPTANCE";s:7:"test123";s:6:"STATUS";s:1:"5";s:5:"IPCTY";s:2:"AU";s:5:"CCCTY";s:2:"US";s:3:"ECI";s:2:"12";s:8:"CVCCheck";s:2:"NO";s:8:"AAVCheck";s:2:"NO";s:2:"VC";s:2:"NO";s:6:"AAVZIP";s:2:"NO";s:10:"AAVADDRESS";s:2:"NO";s:6:"amount";s:2:"35";s:8:"currency";s:3:"EUR";s:2:"PM";s:10:"CreditCard";s:5:"BRAND";s:4:"VISA";s:7:"SCORING";s:1:"3";s:12:"SCO_CATEGORY";s:1:"O";s:5:"ALIAS";s:12:"041907169941";s:11:"NCERRORPLUS";s:1:"!";}s:28:"checkoutFinishedSuccessfully";b:1;}
366
 
367
+ - payment_id: 5
368
+ quote_id: 32
369
+ updated_at: '1970-01-01'
370
+ method: 'ops_BCMC'
371
+ additional_information: a:37:{s:5:"PSPID";s:10:"NRMAGENTO8";s:6:"AMOUNT";d:34500;s:8:"CURRENCY";s:3:"EUR";s:7:"ORDERID";s:10:"#145000120";s:8:"LANGUAGE";s:5:"de_DE";s:2:"PM";s:10:"CreditCard";s:5:"EMAIL";s:31:"sebastian.ertner@netresearch.de";s:9:"ACCEPTURL";s:56:"http://ser-ogone-de.magento.nrdev.de/ops/payment/accept/";s:10:"DECLINEURL";s:57:"http://ser-ogone-de.magento.nrdev.de/ops/payment/decline/";s:12:"EXCEPTIONURL";s:59:"http://ser-ogone-de.magento.nrdev.de/ops/payment/exception/";s:9:"CANCELURL";s:56:"http://ser-ogone-de.magento.nrdev.de/ops/payment/cancel/";s:7:"BACKURL";s:125:"http://ser-ogone-de.magento.nrdev.de/ops/payment/retry/?SHASIGN=AEF578B3ED129000FC779255DC04CA535ABB155F&orderID=%23145000120";s:8:"FP_ACTIV";s:1:"0";s:9:"OPERATION";s:3:"RES";s:4:"ORIG";s:10:"OGmg160526";s:5:"BRAND";s:4:"BCMC";s:2:"CN";s:16:"Sebastian Ertner";s:3:"COM";s:27:"Lafayette Convertible Dress";s:8:"ADDMATCH";i:1;s:29:"ECOM_BILLTO_POSTAL_POSTALCODE";s:5:"04229";s:12:"OWNERADDRESS";s:18:"Nonnenstraße 11 d";s:9:"OWNERTOWN";s:7:"Leipzig";s:8:"OWNERZIP";s:5:"04229";s:10:"OWNERTELNO";s:11:"23123123123";s:8:"OWNERCTY";s:2:"DE";s:4:"CUID";s:3:"140";s:6:"DEVICE";s:8:"computer";s:2:"TP";s:57:"http://ser-ogone-de.magento.nrdev.de/ops/payment/paypage/";s:23:"ECOM_SHIPTO_POSTAL_CITY";s:7:"Leipzig";s:29:"ECOM_SHIPTO_POSTAL_POSTALCODE";s:5:"04229";s:24:"ECOM_SHIPTO_POSTAL_STATE";s:2:"SN";s:30:"ECOM_SHIPTO_POSTAL_COUNTRYCODE";s:2:"DE";s:29:"ECOM_SHIPTO_POSTAL_NAME_FIRST";s:9:"Sebastian";s:28:"ECOM_SHIPTO_POSTAL_NAME_LAST";s:6:"Ertner";s:31:"ECOM_SHIPTO_POSTAL_STREET_LINE1";s:13:"Nonnenstraße";s:32:"ECOM_BILLTO_POSTAL_STREET_NUMBER";s:4:"11 d";s:31:"ECOM_SHIPTO_POSTAL_STREET_LINE2";s:0:"";}
372
+
373
  sales/order_payment:
374
  - entity_id: 1
375
  parent_id: 11
376
+ additional_information: a:7:{s:8:"CC_BRAND";s:4:"VISA";s:5:"CC_CN";s:10:"Max Muster";s:12:"saveOpsAlias";s:1:"0";s:5:"alias";s:12:"041907169941";s:12:"ops_response";a:22:{s:7:"orderID";s:11:"SER13041841";s:5:"PAYID";s:8:"20908736";s:8:"NCSTATUS";s:1:"0";s:7:"NCERROR";s:1:"0";s:10:"ACCEPTANCE";s:7:"test123";s:6:"STATUS";s:1:"5";s:5:"IPCTY";s:2:"AU";s:5:"CCCTY";s:2:"US";s:3:"ECI";s:2:"12";s:8:"CVCCheck";s:2:"NO";s:8:"AAVCheck";s:2:"NO";s:2:"VC";s:2:"NO";s:6:"AAVZIP";s:2:"NO";s:10:"AAVADDRESS";s:2:"NO";s:6:"amount";s:2:"35";s:8:"currency";s:3:"EUR";s:2:"PM";s:10:"CreditCard";s:5:"BRAND";s:4:"VISA";s:7:"SCORING";s:1:"3";s:12:"SCO_CATEGORY";s:1:"O";s:5:"ALIAS";s:12:"041907169941";s:11:"NCERRORPLUS";s:1:"!";}s:28:"checkoutFinishedSuccessfully";b:1;s:6:"status";s:1:"0";}
377
  method: 'ops_bankTransfer'
378
 
379
  - entity_id: 2
465
  additional_information: a:6:{s:8:"CC_BRAND";s:16:"PostFinance Card";s:5:"CC_CN";s:10:"Max Muster";s:12:"saveOpsAlias";s:1:"0";s:5:"alias";s:12:"041907169941";s:12:"ops_response";a:22:{s:7:"orderID";s:11:"SER13041841";s:5:"PAYID";s:8:"20908736";s:8:"NCSTATUS";s:1:"0";s:7:"NCERROR";s:1:"0";s:10:"ACCEPTANCE";s:7:"test123";s:6:"STATUS";s:1:"5";s:5:"IPCTY";s:2:"AU";s:5:"CCCTY";s:2:"US";s:3:"ECI";s:2:"12";s:8:"CVCCheck";s:2:"NO";s:8:"AAVCheck";s:2:"NO";s:2:"VC";s:2:"NO";s:6:"AAVZIP";s:2:"NO";s:10:"AAVADDRESS";s:2:"NO";s:6:"amount";s:2:"35";s:8:"currency";s:3:"EUR";s:2:"PM";s:10:"CreditCard";s:5:"BRAND";s:4:"VISA";s:7:"SCORING";s:1:"3";s:12:"SCO_CATEGORY";s:1:"O";s:5:"ALIAS";s:12:"041907169941";s:11:"NCERRORPLUS";s:1:"!";}s:28:"checkoutFinishedSuccessfully";b:1;}
466
  method: 'checkmo'
467
 
468
+ - entity_id: 22
469
+ parent_id: 31
470
+ additional_information: a:3:{s:2:"PM";s:16:"Bank transfer DE";s:5:"BRAND";s:16:"Bank transfer DE";s:6:"status";s:2:"51";}
471
+ method: 'ops_bankTransfer'
472
+
473
+ - entity_id: 23
474
+ parent_id: 32
475
+ additional_information: a:29:{s:7:"orderID";s:10:"#145000119";s:8:"currency";s:3:"EUR";s:6:"amount";s:2:"80";s:2:"PM";s:10:"CreditCard";s:10:"ACCEPTANCE";s:7:"test123";s:6:"STATUS";s:1:"9";s:6:"CARDNO";s:18:"670300-XXXXXXXX-03";s:3:"BIN";s:6:"670300";s:2:"ED";s:4:"0926";s:2:"CN";s:16:"Sebastian Ertner";s:7:"TRXDATE";s:8:"09/15/16";s:5:"PAYID";s:10:"3009110929";s:7:"NCERROR";s:1:"0";s:5:"BRAND";s:22:"Bancontact/Mister Cash";s:11:"CREDITDEBIT";s:0:"";s:5:"IPCTY";s:2:"DE";s:5:"CCCTY";s:2:"BE";s:3:"ECI";s:1:"5";s:8:"CVCCheck";s:2:"NO";s:8:"AAVCheck";s:2:"NO";s:2:"VC";s:2:"NO";s:6:"AAVZIP";s:2:"NO";s:10:"AAVADDRESS";s:2:"NO";s:7:"AAVMAIL";s:2:"NO";s:7:"SCORING";s:1:"0";s:12:"SCO_CATEGORY";s:1:"G";s:2:"IP";s:13:"178.24.30.185";s:10:"MOBILEMODE";s:2:"QR";s:7:"SHASIGN";s:40:"76A28E77731F97339BB752509BBE46B8E464A8D6";}
476
+ method: 'ops_BCMC'
477
+
478
  sales/shipment:
479
  - entity_id: 1
480
  increment_id: 100000077
658
  suffix: 'MdL'
659
  company: ''
660
 
661
+ - entity_id: 52
662
+ parent_id: 32
663
+ address_type: 'billing'
664
+ firstname: 'Hubertus'
665
+ postcode: '04227'
666
+ lastname: 'Fürstenberg'
667
+ street: '44 rue Parmentier'
668
+ city: 'Leipzig'
669
+ email: 'hubertus.von.fuerstenberg@trash-mail.com'
670
+ country_id: 'DE'
671
+ prefix: 'Prof. Dr.'
672
+ middlename: 'von'
673
+ suffix: 'MdL'
674
+ company: ''
675
+
676
  sales/order_item:
677
  - item_id: 11
678
  order_id: 11
app/code/community/Netresearch/OPS/Trait/AliasController.php CHANGED
@@ -31,7 +31,7 @@
31
  trait Netresearch_OPS_Trait_AliasController
32
  {
33
  use Netresearch_OPS_Trait_PaymentHelper;
34
-
35
  /**
36
  * @return Netresearch_OPS_Model_Config
37
  */
@@ -39,7 +39,7 @@ trait Netresearch_OPS_Trait_AliasController
39
  {
40
  return Mage::getSingleton('ops/config');
41
  }
42
-
43
  /**
44
  * accept-action for Alias-generating iframe-response
45
  *
@@ -47,40 +47,41 @@ trait Netresearch_OPS_Trait_AliasController
47
  public function acceptAction()
48
  {
49
  $params = $this->getRequest()->getParams();
50
- $helper = Mage::helper('ops');
51
- $helper->log(
52
- $helper->__(
53
- "Incoming accepted PayEngine Alias Feedback\n\nRequest Path: %s\nParams: %s\n",
54
- $this->getRequest()->getPathInfo(),
55
- serialize($params)
56
- )
57
- );
58
- Mage::helper('ops/alias')->saveAlias($params);
59
-
60
 
61
- if (array_key_exists('Alias_OrderId', $params)) {
62
- $quote = Mage::getModel('sales/quote')->load($params['Alias_OrderId']);
63
- $this->updateAdditionalInformation($quote, $params);
64
  } else {
65
- $quote = Mage::getSingleton('checkout/session')->getQuote();
66
- }
 
 
 
 
 
 
 
67
 
68
- // OGNH-7 special handling for admin orders
69
- Mage::helper('ops/alias')->setAliasToPayment(
70
- $quote->getPayment(),
71
- array_change_key_case($params, CASE_LOWER),
72
- false
73
- );
74
 
75
- $result
76
- = sprintf(
77
- "<script type='application/javascript'>window.onload = function() { top.document.fire('alias:success', '%s'); };</script>",
78
- $params['Alias_AliasId']
79
- );
 
80
 
81
- return $this->getResponse()->setBody($result);
82
- }
 
 
 
 
83
 
 
 
 
 
84
  /**
85
  * exception-action for Alias-generating iframe-response
86
  *
@@ -89,13 +90,13 @@ trait Netresearch_OPS_Trait_AliasController
89
  {
90
  $params = $this->getRequest()->getParams();
91
  $errors = array();
92
-
93
  foreach ($params as $key => $value) {
94
  if (stristr($key, 'error') && 0 != $value) {
95
  $errors[] = $value;
96
  }
97
  }
98
-
99
  $helper = Mage::helper('ops');
100
  $helper->log(
101
  $helper->__(
@@ -104,13 +105,10 @@ trait Netresearch_OPS_Trait_AliasController
104
  serialize($params)
105
  )
106
  );
107
-
108
- $result
109
- = "<script type='application/javascript'>window.onload = function() { top.document.fire('alias:failure'); };</script>";
110
-
111
- return $this->getResponse()->setBody($result);
112
  }
113
-
114
  /**
115
  * Generates the hash for the hosted tokenization page request
116
  *
@@ -119,12 +117,12 @@ trait Netresearch_OPS_Trait_AliasController
119
  public function generateHashAction()
120
  {
121
  $storeId = $this->getStoreId();
122
-
123
  $result = $this->generateHash($storeId);
124
-
125
  $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
126
  }
127
-
128
  /**
129
  * Get store id from quote or request
130
  *
@@ -133,39 +131,39 @@ trait Netresearch_OPS_Trait_AliasController
133
  protected function getStoreId()
134
  {
135
  $storeId = null;
136
-
137
  if (Mage::app()->getStore()->isAdmin()) {
138
  $quote = Mage::getSingleton('adminhtml/session_quote');
139
  $storeId = $quote->getStoreId();
140
  } else {
141
- $quoteId = $this->_request->getParam('orderid');
142
-
143
  $quote = Mage::getModel('sales/quote')->load($quoteId);
144
-
145
- if (is_null($quote->getId())) {
146
  $quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
147
  }
148
-
149
- if (!is_null($quote->getId())) {
150
  $storeId = $quote->getStoreId();
151
  }
152
- if (false == is_null($this->_request->getParam('storeId'))) {
153
- $storeId = $this->_request->getParam('storeId');
154
  }
155
  }
156
-
157
  return $storeId;
158
  }
159
-
160
  /**
161
  * updates the additional information from payment, thats needed for backend reOrders
162
  *
163
  * @param Mage_Sales_Model_Quote $quote
164
- * @param array $params
165
  */
166
  public function updateAdditionalInformation(Mage_Sales_Model_Quote $quote, $params)
167
  {
168
- if (!is_null($quote->getId()) && $quote->getPayment() && !is_null($quote->getPayment()->getId())) {
169
  $payment = $quote->getPayment();
170
  if (array_key_exists('Alias_AliasId', $params)) {
171
  $payment->setAdditionalInformation('alias', $params['Alias_AliasId']);
@@ -183,7 +181,7 @@ trait Netresearch_OPS_Trait_AliasController
183
  $quote->setDataChanges(true)->save();
184
  }
185
  }
186
-
187
  /**
188
  * Checks if checkout method is registering
189
  *
@@ -194,7 +192,7 @@ trait Netresearch_OPS_Trait_AliasController
194
  return Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()
195
  === Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER;
196
  }
197
-
198
  /**
199
  * Generate hash from request parameters
200
  *
@@ -205,14 +203,14 @@ trait Netresearch_OPS_Trait_AliasController
205
  protected function generateHash($storeId)
206
  {
207
  $data = $this->cleanParamKeys();
208
-
209
  $secret = $this->getConfig()->getShaOutCode($storeId);
210
  $raw = $this->getPaymentHelper()->getSHAInSet($data, $secret);
211
  $result = array('hash' => Mage::helper('ops/payment')->shaCrypt($raw));
212
-
213
  return $result;
214
  }
215
-
216
  /**
217
  * Cleans param array from magentos admin params, fixes underscored keys
218
  *
@@ -221,13 +219,41 @@ trait Netresearch_OPS_Trait_AliasController
221
  protected function cleanParamKeys()
222
  {
223
  $data = array();
224
- foreach ($this->_request->getParams() as $key => $value) {
225
  if ($key == 'form_key' || $key == 'isAjax' || $key == 'key') {
226
  continue;
227
  }
228
  $data[str_replace('_', '.', $key)] = $value;
229
  }
230
-
231
  return $data;
232
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  }
31
  trait Netresearch_OPS_Trait_AliasController
32
  {
33
  use Netresearch_OPS_Trait_PaymentHelper;
34
+
35
  /**
36
  * @return Netresearch_OPS_Model_Config
37
  */
39
  {
40
  return Mage::getSingleton('ops/config');
41
  }
42
+
43
  /**
44
  * accept-action for Alias-generating iframe-response
45
  *
47
  public function acceptAction()
48
  {
49
  $params = $this->getRequest()->getParams();
50
+ $requiredParams = array_fill_keys(array('Alias_OrderId', 'Alias_AliasId'), '');
51
+ $missingParams = count(array_diff_key($requiredParams, $params));
52
+ if ($missingParams) {
 
 
 
 
 
 
 
53
 
54
+ return $this->parseFrontendException();
 
 
55
  } else {
56
+ $helper = Mage::helper('ops');
57
+ $helper->log(
58
+ $helper->__(
59
+ "Incoming accepted PayEngine Alias Feedback\n\nRequest Path: %s\nParams: %s\n",
60
+ $this->getRequest()->getPathInfo(),
61
+ serialize($params)
62
+ )
63
+ );
64
+ Mage::helper('ops/alias')->saveAlias($params);
65
 
 
 
 
 
 
 
66
 
67
+ if (array_key_exists('Alias_OrderId', $params)) {
68
+ $quote = Mage::getModel('sales/quote')->load($params['Alias_OrderId']);
69
+ $this->updateAdditionalInformation($quote, $params);
70
+ } else {
71
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
72
+ }
73
 
74
+ // OGNH-7 special handling for admin orders
75
+ Mage::helper('ops/alias')->setAliasToPayment(
76
+ $quote->getPayment(),
77
+ array_change_key_case($params, CASE_LOWER),
78
+ false
79
+ );
80
 
81
+ return $this->parseFrontendSuccess($params['Alias_AliasId']);
82
+ }
83
+ }
84
+
85
  /**
86
  * exception-action for Alias-generating iframe-response
87
  *
90
  {
91
  $params = $this->getRequest()->getParams();
92
  $errors = array();
93
+
94
  foreach ($params as $key => $value) {
95
  if (stristr($key, 'error') && 0 != $value) {
96
  $errors[] = $value;
97
  }
98
  }
99
+
100
  $helper = Mage::helper('ops');
101
  $helper->log(
102
  $helper->__(
105
  serialize($params)
106
  )
107
  );
108
+
109
+ return $this->parseFrontendException();
 
 
 
110
  }
111
+
112
  /**
113
  * Generates the hash for the hosted tokenization page request
114
  *
117
  public function generateHashAction()
118
  {
119
  $storeId = $this->getStoreId();
120
+
121
  $result = $this->generateHash($storeId);
122
+
123
  $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
124
  }
125
+
126
  /**
127
  * Get store id from quote or request
128
  *
131
  protected function getStoreId()
132
  {
133
  $storeId = null;
134
+
135
  if (Mage::app()->getStore()->isAdmin()) {
136
  $quote = Mage::getSingleton('adminhtml/session_quote');
137
  $storeId = $quote->getStoreId();
138
  } else {
139
+ $quoteId = $this->getRequest()->getParam('orderid');
140
+
141
  $quote = Mage::getModel('sales/quote')->load($quoteId);
142
+
143
+ if ($quote->getId() === null) {
144
  $quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
145
  }
146
+
147
+ if ($quote->getId() !== null) {
148
  $storeId = $quote->getStoreId();
149
  }
150
+ if ($this->getRequest()->getParam('storeId') !== null) {
151
+ $storeId = $this->getRequest()->getParam('storeId');
152
  }
153
  }
154
+
155
  return $storeId;
156
  }
157
+
158
  /**
159
  * updates the additional information from payment, thats needed for backend reOrders
160
  *
161
  * @param Mage_Sales_Model_Quote $quote
162
+ * @param string[] $params
163
  */
164
  public function updateAdditionalInformation(Mage_Sales_Model_Quote $quote, $params)
165
  {
166
+ if ($quote->getId() !== null && $quote->getPayment() && $quote->getPayment()->getId() !== null) {
167
  $payment = $quote->getPayment();
168
  if (array_key_exists('Alias_AliasId', $params)) {
169
  $payment->setAdditionalInformation('alias', $params['Alias_AliasId']);
181
  $quote->setDataChanges(true)->save();
182
  }
183
  }
184
+
185
  /**
186
  * Checks if checkout method is registering
187
  *
192
  return Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()
193
  === Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER;
194
  }
195
+
196
  /**
197
  * Generate hash from request parameters
198
  *
203
  protected function generateHash($storeId)
204
  {
205
  $data = $this->cleanParamKeys();
206
+
207
  $secret = $this->getConfig()->getShaOutCode($storeId);
208
  $raw = $this->getPaymentHelper()->getSHAInSet($data, $secret);
209
  $result = array('hash' => Mage::helper('ops/payment')->shaCrypt($raw));
210
+
211
  return $result;
212
  }
213
+
214
  /**
215
  * Cleans param array from magentos admin params, fixes underscored keys
216
  *
219
  protected function cleanParamKeys()
220
  {
221
  $data = array();
222
+ foreach ($this->getRequest()->getParams() as $key => $value) {
223
  if ($key == 'form_key' || $key == 'isAjax' || $key == 'key') {
224
  continue;
225
  }
226
  $data[str_replace('_', '.', $key)] = $value;
227
  }
228
+
229
  return $data;
230
  }
231
+
232
+ /**
233
+ * @return Mage_Core_Controller_Response_Http
234
+ */
235
+ protected function parseFrontendException()
236
+ {
237
+ $result = "<script type='application/javascript'>" .
238
+ "window.onload = function() { top.document.fire('alias:failure'); };" .
239
+ "</script>";
240
+
241
+ return $this->getResponse()->setBody($result);
242
+ }
243
+
244
+ /**
245
+ * @param string $alias alias to be parsed in frontend javascript event
246
+ *
247
+ * @return Mage_Core_Controller_Response_Http
248
+ */
249
+ protected function parseFrontendSuccess($alias)
250
+ {
251
+ $result = sprintf(
252
+ "<script type='application/javascript'>".
253
+ "window.onload = function() { top.document.fire('alias:success', '%s'); };</script>",
254
+ $alias
255
+ );
256
+
257
+ return $this->getResponse()->setBody($result);
258
+ }
259
  }
app/code/community/Netresearch/OPS/Trait/PaymentHelper.php CHANGED
@@ -37,7 +37,7 @@ trait Netresearch_OPS_Trait_PaymentHelper
37
  */
38
  public function getPaymentHelper()
39
  {
40
- if (is_null($this->paymentHelper)) {
41
  $this->paymentHelper = Mage::helper('ops/payment');
42
  }
43
 
37
  */
38
  public function getPaymentHelper()
39
  {
40
+ if (null === $this->paymentHelper) {
41
  $this->paymentHelper = Mage::helper('ops/payment');
42
  }
43
 
app/code/community/Netresearch/OPS/controllers/Adminhtml/AdminController.php CHANGED
@@ -43,10 +43,12 @@ class Netresearch_OPS_Adminhtml_AdminController extends Mage_Adminhtml_Controlle
43
  $message = Mage::helper('ops')->__('Log file could not be retrieved.');
44
  $this->_getSession()->addError($message);
45
  } else {
46
- $this->_prepareDownloadResponse('ops.log', array(
 
47
  'value' => $fileToDownload,
48
  'type' => 'filename'
49
- ));
 
50
  }
51
  $this->_redirectReferer();
52
  }
43
  $message = Mage::helper('ops')->__('Log file could not be retrieved.');
44
  $this->_getSession()->addError($message);
45
  } else {
46
+ $this->_prepareDownloadResponse(
47
+ 'ops.log', array(
48
  'value' => $fileToDownload,
49
  'type' => 'filename'
50
+ )
51
+ );
52
  }
53
  $this->_redirectReferer();
54
  }
app/code/community/Netresearch/OPS/controllers/Adminhtml/KwixocategoryController.php CHANGED
@@ -12,8 +12,12 @@ class Netresearch_OPS_Adminhtml_KwixocategoryController
12
  extends Mage_Adminhtml_Controller_Action
13
  {
14
 
15
- private $_block = 'ops/adminhtml_kwixocategory_edit';
16
 
 
 
 
 
17
  protected function _initCategory($getRootInstead = false)
18
  {
19
  $categoryId = (int)$this->getRequest()->getParam('id', false);
@@ -194,7 +198,8 @@ class Netresearch_OPS_Adminhtml_KwixocategoryController
194
  } catch (Exception $e) {
195
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
196
  }
197
- $this->_redirect('*/*/index/',
 
198
  array('_current' => true, "id" => $post['category_id'], "store" => $post['storeId'])
199
  );
200
  }
12
  extends Mage_Adminhtml_Controller_Action
13
  {
14
 
15
+ protected $_block = 'ops/adminhtml_kwixocategory_edit';
16
 
17
+ /**
18
+ * @param bool $getRootInstead
19
+ * @return bool
20
+ */
21
  protected function _initCategory($getRootInstead = false)
22
  {
23
  $categoryId = (int)$this->getRequest()->getParam('id', false);
198
  } catch (Exception $e) {
199
  Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
200
  }
201
+ $this->_redirect(
202
+ '*/*/index/',
203
  array('_current' => true, "id" => $post['category_id'], "store" => $post['storeId'])
204
  );
205
  }
app/code/community/Netresearch/OPS/controllers/Adminhtml/KwixoshippingController.php CHANGED
@@ -21,10 +21,10 @@ class Netresearch_OPS_Adminhtml_KwixoshippingController
21
  $this->loadLayout();
22
 
23
  $storeId = $this->getRequest()->getParam('store', 0);
24
- $this->getLayout()->getBLock('kwixoshipping')->setData(
25
  'store', $storeId
26
  );
27
- $this->getLayout()->getBLock('kwixoshipping')->setData(
28
  'postData',
29
  Mage::getModel('adminhtml/session')->getData('errorneousData')
30
  );
@@ -38,40 +38,26 @@ class Netresearch_OPS_Adminhtml_KwixoshippingController
38
  public function saveAction()
39
  {
40
  if ($this->getRequest()->isPost()) {
41
- $postData = $this->getRequest()->getPost();
42
- $methodCodes = array_keys(
43
- Mage::getSingleton('shipping/config')->getAllCarriers()
44
- );
45
  $validator = Mage::getModel('ops/validator_kwixo_shipping_setting');
46
  if (true === $validator->isValid($postData)) {
47
-
48
- foreach ($postData as $shippingCode => $kwixoData) {
49
-
50
- if (!in_array($shippingCode, $methodCodes)) continue;
51
- $kwixoShippingModel = Mage::getModel(
52
- 'ops/kwixo_shipping_setting'
53
- )
54
- ->load($shippingCode, 'shipping_code');
55
  $kwixoShippingModel
56
- ->setShippingCode($shippingCode)
57
- ->setKwixoShippingType(
58
- $kwixoData['kwixo_shipping_type']
59
- )
60
- ->setKwixoShippingSpeed(
61
- $kwixoData['kwixo_shipping_speed']
62
- )
63
- ->setKwixoShippingDetails(
64
- $kwixoData['kwixo_shipping_details']
65
- )
66
- ->save();
67
  }
 
68
  } else {
69
- $postData = array_merge_recursive(
70
- $postData, $validator->getMessages()
71
- );
72
- Mage::getModel('adminhtml/session')->setData(
73
- 'errorneousData', $postData
74
- );
75
  }
76
 
77
  }
@@ -83,5 +69,25 @@ class Netresearch_OPS_Adminhtml_KwixoshippingController
83
  return Mage::getSingleton('admin/session')->isAllowed('sales/shipment');
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  }
21
  $this->loadLayout();
22
 
23
  $storeId = $this->getRequest()->getParam('store', 0);
24
+ $this->getLayout()->getBlock('kwixoshipping')->setData(
25
  'store', $storeId
26
  );
27
+ $this->getLayout()->getBlock('kwixoshipping')->setData(
28
  'postData',
29
  Mage::getModel('adminhtml/session')->getData('errorneousData')
30
  );
38
  public function saveAction()
39
  {
40
  if ($this->getRequest()->isPost()) {
41
+ $postData = $this->getCleanPostData();
 
 
 
42
  $validator = Mage::getModel('ops/validator_kwixo_shipping_setting');
43
  if (true === $validator->isValid($postData)) {
44
+ $collection = Mage::getModel('ops/kwixo_shipping_setting')->getCollection()
45
+ ->addFieldToFilter('shipping_code', array('in' => array_keys($postData)));
46
+ /** @var Netresearch_OPS_Model_Kwixo_Shipping_Setting $kwixoShippingModel */
47
+ foreach ($collection->getItems() as $kwixoShippingModel) {
48
+ if (!array_key_exists($kwixoShippingModel->getShippingCode(), $postData)) {
49
+ continue;
50
+ }
51
+ $kwixoData = $postData[$kwixoShippingModel->getShippingCode()];
52
  $kwixoShippingModel
53
+ ->setKwixoShippingType($kwixoData['kwixo_shipping_type'])
54
+ ->setKwixoShippingSpeed($kwixoData['kwixo_shipping_speed'])
55
+ ->setKwixoShippingDetails($kwixoData['kwixo_shipping_details']);
 
 
 
 
 
 
 
 
56
  }
57
+ $collection->save();
58
  } else {
59
+ $postData = array_merge_recursive($postData, $validator->getMessages());
60
+ Mage::getModel('adminhtml/session')->setData('errorneousData', $postData);
 
 
 
 
61
  }
62
 
63
  }
69
  return Mage::getSingleton('admin/session')->isAllowed('sales/shipment');
70
  }
71
 
72
+ /**
73
+ * removes any methods not in the actual systems carrier list from the post parameters
74
+ *
75
+ * @return array
76
+ */
77
+ protected function getCleanPostData()
78
+ {
79
+ $postData = $this->getRequest()->getPost();
80
+ $methodCodes = array_keys(
81
+ Mage::getSingleton('shipping/config')->getAllCarriers()
82
+ );
83
+ $invalidateShippingCodes = function ($key) use ($methodCodes) {
84
+ return !in_array($key, $methodCodes);
85
+ };
86
+ $validKeys = array_filter(array_keys($postData), $invalidateShippingCodes);
87
+ $cleanPostData = array_diff_key($postData, $validKeys);
88
+
89
+ return $cleanPostData;
90
+ }
91
+
92
 
93
  }
app/code/community/Netresearch/OPS/controllers/AliasController.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
-
3
- /**
4
- * AliasController.php
5
- *
6
- * @author paul.siedler@netresearch.de
7
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
8
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
9
- */
10
- class Netresearch_OPS_AliasController extends Netresearch_OPS_Controller_Abstract
11
- {
12
- use Netresearch_OPS_Trait_AliasController;
13
- }
1
+ <?php
2
+
3
+ /**
4
+ * AliasController.php
5
+ *
6
+ * @author paul.siedler@netresearch.de
7
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
9
+ */
10
+ class Netresearch_OPS_AliasController extends Netresearch_OPS_Controller_Abstract
11
+ {
12
+ use Netresearch_OPS_Trait_AliasController;
13
+ }
app/code/community/Netresearch/OPS/controllers/ApiController.php CHANGED
@@ -69,12 +69,7 @@ class Netresearch_OPS_ApiController extends Netresearch_OPS_Controller_Abstract
69
  {
70
 
71
  $params = $this->getRequest()->getParams();
72
- Mage::log(
73
- "Incoming Request on Directlink: " . serialize($params),
74
- null,
75
- 'incoming.log',
76
- true
77
- );
78
  try {
79
  if (Mage::helper('ops/subscription')->isSubscriptionFeedback($params)) {
80
  $this->getSubscriptionManager()->processSubscriptionFeedback($params);
69
  {
70
 
71
  $params = $this->getRequest()->getParams();
72
+
 
 
 
 
 
73
  try {
74
  if (Mage::helper('ops/subscription')->isSubscriptionFeedback($params)) {
75
  $this->getSubscriptionManager()->processSubscriptionFeedback($params);
app/code/community/Netresearch/OPS/controllers/CustomerController.php CHANGED
@@ -24,7 +24,6 @@ class Netresearch_OPS_CustomerController extends Mage_Core_Controller_Front_Acti
24
  public function preDispatch()
25
  {
26
  parent::preDispatch();
27
- $action = $this->getRequest()->getActionName();
28
  $loginUrl = Mage::helper('customer')->getLoginUrl();
29
 
30
  if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
@@ -32,6 +31,9 @@ class Netresearch_OPS_CustomerController extends Mage_Core_Controller_Front_Acti
32
  }
33
  }
34
 
 
 
 
35
  public function aliasesAction()
36
  {
37
  $this->loadLayout();
24
  public function preDispatch()
25
  {
26
  parent::preDispatch();
 
27
  $loginUrl = Mage::helper('customer')->getLoginUrl();
28
 
29
  if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
31
  }
32
  }
33
 
34
+ /**
35
+ *
36
+ */
37
  public function aliasesAction()
38
  {
39
  $this->loadLayout();
app/code/community/Netresearch/OPS/controllers/DeviceController.php CHANGED
@@ -41,7 +41,7 @@ class Netresearch_OPS_DeviceController extends Mage_Core_Controller_Front_Action
41
  */
42
  public function getConfig()
43
  {
44
- if (is_null($this->config)) {
45
  $this->config = Mage::getModel('ops/config');
46
  }
47
 
@@ -72,8 +72,9 @@ class Netresearch_OPS_DeviceController extends Mage_Core_Controller_Front_Action
72
  $resultArray = array(self::CONSENT_PARAMETER_KEY => false);
73
 
74
  if ($this->getConfig()->getDeviceFingerPrinting()) {
75
- $resultArray[self::CONSENT_PARAMETER_KEY] = (bool)Mage::getSingleton('customer/session')
76
- ->getData(Netresearch_OPS_Model_Payment_Abstract::FINGERPRINT_CONSENT_SESSION_KEY);
 
77
  }
78
 
79
  $this->getResponse()->setHeader('Content-type', 'application/json');
41
  */
42
  public function getConfig()
43
  {
44
+ if (null === $this->config) {
45
  $this->config = Mage::getModel('ops/config');
46
  }
47
 
72
  $resultArray = array(self::CONSENT_PARAMETER_KEY => false);
73
 
74
  if ($this->getConfig()->getDeviceFingerPrinting()) {
75
+ $resultArray[self::CONSENT_PARAMETER_KEY] =
76
+ (bool)Mage::getSingleton('customer/session')
77
+ ->getData(Netresearch_OPS_Model_Payment_Abstract::FINGERPRINT_CONSENT_SESSION_KEY);
78
  }
79
 
80
  $this->getResponse()->setHeader('Content-type', 'application/json');
app/code/community/Netresearch/OPS/controllers/PaymentController.php CHANGED
@@ -1,37 +1,58 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /**
4
  * Netresearch_OPS_PaymentController
5
  *
6
- * @package
7
- * @copyright 2011 Netresearch
8
  * @author Thomas Kappel <thomas.kappel@netresearch.de>
9
  * @author André Herrn <andre.herrn@netresearch.de>
10
- * @license OSL 3.0
11
  */
12
  class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstract
13
  {
14
-
15
  /**
16
  * Load place from layout to make POST on ops
17
  */
18
  public function placeformAction()
19
  {
20
 
21
-
22
  $lastIncrementId = $this->_getCheckout()->getLastRealOrderId();
23
 
24
  if ($lastIncrementId) {
25
  $order = Mage::getModel('sales/order');
26
  $order->loadByIncrementId($lastIncrementId);
 
 
27
  }
28
 
29
- $this->_getCheckout()->getQuote()->setIsActive(false)->save();
 
 
 
30
  $this->_getCheckout()->setOPSQuoteId($this->_getCheckout()->getQuoteId());
31
  $this->_getCheckout()->setOPSLastSuccessQuoteId($this->_getCheckout()->getLastSuccessQuoteId());
32
  $this->_getCheckout()->clear();
33
 
34
-
35
  $this->loadLayout();
36
  $this->renderLayout();
37
  }
@@ -65,7 +86,7 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
65
  $redirect = '';
66
  try {
67
  $order = $this->_getOrder();
68
- if($this->getQuote()){
69
  $this->getQuote()->setIsActive(false)->save();
70
  }
71
  $this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());
@@ -99,6 +120,10 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
99
  $this->_getCheckout()->setLastQuoteId($order->getQuoteId());
100
  $this->_getCheckout()->setLastOrderId($order->getId());
101
 
 
 
 
 
102
  $this->redirectOpsRequest('checkout/onepage/success');
103
  }
104
 
@@ -113,7 +138,7 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
113
  try {
114
  $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOPSQuoteId());
115
  } catch (Exception $e) {
116
-
117
  }
118
 
119
  $this->getPaymentHelper()->refillCart($this->_getOrder());
@@ -131,14 +156,13 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
131
  * change order status to cancelled
132
  * need to redirect user to shopping cart
133
  *
134
- * @return Netresearch_OPS_ApiController
135
  */
136
  public function cancelAction()
137
  {
138
  try {
139
  $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOPSQuoteId());
140
  } catch (Exception $e) {
141
-
142
  }
143
  if (false == $this->_getOrder()->getId()) {
144
  $this->_order = null;
@@ -155,10 +179,10 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
155
  /**
156
  * when user cancel the payment and press on button "Back to Catalog" or "Back to Merchant Shop" in Orops
157
  *
158
- * @return Netresearch_OPS_ApiController
159
  */
160
  public function continueAction()
161
  {
 
162
  $order = Mage::getModel('sales/order')->load(
163
  $this->_getCheckout()->getLastOrderId()
164
  );
@@ -175,11 +199,10 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
175
  /*
176
  * Check the validation of the request from OPS
177
  */
178
-
179
  protected function checkRequestValidity()
180
  {
181
  if (!$this->_validateOPSData()) {
182
- throw new Exception("Hash is not valid");
183
  }
184
  }
185
 
@@ -204,18 +227,22 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
204
  $this->getResponse()->sendHeaders();
205
  }
206
 
207
-
208
  public function saveCcBrandAction()
209
  {
210
- $brand = $this->_request->getParam('brand');
211
- $alias = $this->_request->getParam('alias');
212
- $payment = $this->getQuote()->getPayment();
213
- $payment->setAdditionalInformation('CC_BRAND', $brand);
214
- $payment->setAdditionalInformation('alias', $alias);
215
- $payment->setDataChanges(true);
216
- $payment->save();
217
- Mage::helper('ops')->log('saved cc brand ' . $brand . ' for quote #' . $this->getQuote()->getId());
218
- $this->getResponse()->sendHeaders();
 
 
 
 
 
219
  }
220
 
221
  /**
@@ -226,18 +253,32 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
226
  {
227
 
228
  $order = $this->_getOrder();
 
229
  $payment = $order->getPayment();
230
  $message = false;
231
 
232
- if ($this->_validateOPSData() === false) {
 
 
 
 
 
 
233
  $message = Mage::helper('ops')->__('Hash not valid');
234
 
235
  } else {
236
 
237
- if (is_array($payment->getAdditionalInformation())
238
- && array_key_exists('status', $payment->getAdditionalInformation())
239
- && Mage::helper('ops/payment')->isPaymentFailed($payment->getAdditionalInformation('status'))
240
- ) {
 
 
 
 
 
 
 
241
 
242
  $this->loadLayout();
243
  $this->renderLayout();
@@ -254,6 +295,62 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
254
  }
255
  }
256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  protected function wasIframeRequest()
258
  {
259
  return $this->getConfig()->getConfigData('template', $this->_getOrder()->getStoreId())
@@ -278,7 +375,6 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
278
  return $javascript;
279
  }
280
 
281
-
282
  /**
283
  * Redirects the customer to the given redirect path or inserts the js-snippet needed for iframe template mode into
284
  * the response instead
@@ -293,4 +389,20 @@ class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstr
293
  $this->_redirect($redirect);
294
  }
295
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
1
  <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
 
22
  /**
23
  * Netresearch_OPS_PaymentController
24
  *
25
+ * @category controller
26
+ * @package Netresearch_OPS
27
  * @author Thomas Kappel <thomas.kappel@netresearch.de>
28
  * @author André Herrn <andre.herrn@netresearch.de>
29
+ * @author Paul Siedler <paul.siedler@netresearch.de>
30
  */
31
  class Netresearch_OPS_PaymentController extends Netresearch_OPS_Controller_Abstract
32
  {
 
33
  /**
34
  * Load place from layout to make POST on ops
35
  */
36
  public function placeformAction()
37
  {
38
 
 
39
  $lastIncrementId = $this->_getCheckout()->getLastRealOrderId();
40
 
41
  if ($lastIncrementId) {
42
  $order = Mage::getModel('sales/order');
43
  $order->loadByIncrementId($lastIncrementId);
44
+ } else {
45
+ return $this->_redirect('checkout/cart');
46
  }
47
 
48
+ $quote = $this->_getCheckout()->getQuote();
49
+ if ($quote) {
50
+ $quote->setIsActive(false)->save();
51
+ }
52
  $this->_getCheckout()->setOPSQuoteId($this->_getCheckout()->getQuoteId());
53
  $this->_getCheckout()->setOPSLastSuccessQuoteId($this->_getCheckout()->getLastSuccessQuoteId());
54
  $this->_getCheckout()->clear();
55
 
 
56
  $this->loadLayout();
57
  $this->renderLayout();
58
  }
86
  $redirect = '';
87
  try {
88
  $order = $this->_getOrder();
89
+ if ($this->getQuote()) {
90
  $this->getQuote()->setIsActive(false)->save();
91
  }
92
  $this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());
120
  $this->_getCheckout()->setLastQuoteId($order->getQuoteId());
121
  $this->_getCheckout()->setLastOrderId($order->getId());
122
 
123
+ $msg = 'Your order has been registered, but your payment is still marked as pending.';
124
+ $msg .= ' Please have patience until the final status is known.';
125
+ $this->_getCheckout()->addError(Mage::helper('ops/data')->__($msg));
126
+
127
  $this->redirectOpsRequest('checkout/onepage/success');
128
  }
129
 
138
  try {
139
  $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOPSQuoteId());
140
  } catch (Exception $e) {
141
+ Mage::logException($e);
142
  }
143
 
144
  $this->getPaymentHelper()->refillCart($this->_getOrder());
156
  * change order status to cancelled
157
  * need to redirect user to shopping cart
158
  *
 
159
  */
160
  public function cancelAction()
161
  {
162
  try {
163
  $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOPSQuoteId());
164
  } catch (Exception $e) {
165
+ Mage::logException($e);
166
  }
167
  if (false == $this->_getOrder()->getId()) {
168
  $this->_order = null;
179
  /**
180
  * when user cancel the payment and press on button "Back to Catalog" or "Back to Merchant Shop" in Orops
181
  *
 
182
  */
183
  public function continueAction()
184
  {
185
+ /** @var Mage_Sales_Model_Order $order */
186
  $order = Mage::getModel('sales/order')->load(
187
  $this->_getCheckout()->getLastOrderId()
188
  );
199
  /*
200
  * Check the validation of the request from OPS
201
  */
 
202
  protected function checkRequestValidity()
203
  {
204
  if (!$this->_validateOPSData()) {
205
+ Mage::throwException("Hash is not valid");
206
  }
207
  }
208
 
227
  $this->getResponse()->sendHeaders();
228
  }
229
 
 
230
  public function saveCcBrandAction()
231
  {
232
+ $brand = $this->getRequest()->getParam('brand');
233
+ $alias = $this->getRequest()->getParam('alias');
234
+ $quote = $this->getQuote();
235
+ if ($quote->getId() === null) {
236
+ $this->_redirect('checkout/cart');
237
+ } else {
238
+ $payment = $quote->getPayment();
239
+ $payment->setAdditionalInformation('CC_BRAND', $brand);
240
+ $payment->setAdditionalInformation('alias', $alias);
241
+ $payment->setDataChanges(true);
242
+ $payment->save();
243
+ Mage::helper('ops')->log('saved cc brand ' . $brand . ' for quote #' . $quote->getId());
244
+ $this->getResponse()->sendHeaders();
245
+ }
246
  }
247
 
248
  /**
253
  {
254
 
255
  $order = $this->_getOrder();
256
+ /** @var Mage_Sales_Model_Order_Payment $payment */
257
  $payment = $order->getPayment();
258
  $message = false;
259
 
260
+ // only validate the parameters we added to the BACKURL ourselves
261
+ $params = array(
262
+ 'SHASIGN' => $this->getRequest()->getParam('SHASIGN'),
263
+ 'orderID' => $this->getRequest()->getParam('orderID')
264
+ );
265
+
266
+ if ($this->_validateOPSData($params) === false) {
267
  $message = Mage::helper('ops')->__('Hash not valid');
268
 
269
  } else {
270
 
271
+ if ($this->canRetryPayment($payment)) {
272
+
273
+ // Add Quote to Session, for the payment methods
274
+ /** @var Mage_Sales_Model_Quote $quote */
275
+ $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
276
+ /** @var Mage_Checkout_Model_Session $checkoutSession */
277
+ $checkoutSession = Mage::getSingleton('checkout/session');
278
+ $checkoutSession->setQuoteId($quote->getId());
279
+ // Set Quote to Active, to be able to load quote data
280
+ $quote->setIsActive(1);
281
+ $quote->save();
282
 
283
  $this->loadLayout();
284
  $this->renderLayout();
295
  }
296
  }
297
 
298
+ public function updatePaymentAndPlaceFormAction()
299
+ {
300
+ // Save new payment method in order
301
+ /** @var Mage_Sales_Model_Order $order */
302
+ $order = $this->_getOrder();
303
+ /** @var Mage_Sales_Model_Order_Payment $payment */
304
+ $payment = $order->getPayment();
305
+ /** @var Mage_Sales_Model_Quote $quote */
306
+ $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
307
+ $quote->setIsActive(0);
308
+ $message = false;
309
+
310
+ try {
311
+ $newPayment = $this->getRequest()->getParam('payment');
312
+ $quote->getPayment()->importData($newPayment);
313
+ $payment->setMethod($newPayment['method'])->getMethodInstance()->assignData(new Varien_Object($newPayment));
314
+ $remoteAddr = Mage::helper('core/http')->getRemoteAddr();
315
+ $quote->setRemoteIp($remoteAddr);
316
+ $order->setRemoteIp($remoteAddr);
317
+ $quote->save();
318
+ $payment->save();
319
+ $order->save();
320
+
321
+ // Set Session Data for further process
322
+ /** @var Mage_Checkout_Model_Session $checkoutSession */
323
+ $checkoutSession = Mage::getSingleton('checkout/session');
324
+ $checkoutSession->replaceQuote($quote);
325
+ $checkoutSession->setLastOrderId($order->getId());
326
+ $checkoutSession->setLastRealOrderId($order->getIncrementId());
327
+ $checkoutSession->setLastQuoteId($quote->getId());
328
+ $checkoutSession->setLastSuccessQuoteId($quote->getId());
329
+
330
+ $redirectUrl = $payment->getMethodInstance()->getOrderPlaceRedirectUrl();
331
+
332
+ // Place order or rather in this case, send the inline payment method to PayEngine
333
+ if (empty($redirectUrl)) {
334
+ $checkoutSession->setRedirectUrl($redirectUrl);
335
+ $order->place();
336
+ $order->save();
337
+ }
338
+ } catch (Exception $e) {
339
+ $message = $e->getMessage();
340
+ }
341
+
342
+ if ($message) {
343
+ Mage::getSingleton('core/session')->addNotice($message);
344
+ $this->_redirect('checkout/cart');
345
+ } else {
346
+ if (empty($redirectUrl)) {
347
+ $this->_redirect('checkout/onepage/success');
348
+ } else {
349
+ $this->_redirectUrl($redirectUrl);
350
+ }
351
+ }
352
+ }
353
+
354
  protected function wasIframeRequest()
355
  {
356
  return $this->getConfig()->getConfigData('template', $this->_getOrder()->getStoreId())
375
  return $javascript;
376
  }
377
 
 
378
  /**
379
  * Redirects the customer to the given redirect path or inserts the js-snippet needed for iframe template mode into
380
  * the response instead
389
  $this->_redirect($redirect);
390
  }
391
  }
392
+
393
+ /**
394
+ * @param Mage_Sales_Model_Order_Payment $payment
395
+ *
396
+ * @return bool
397
+ */
398
+ protected function canRetryPayment($payment)
399
+ {
400
+ $additionalInformation = $payment->getAdditionalInformation();
401
+ if (is_array($additionalInformation) && array_key_exists('status', $additionalInformation)) {
402
+ $status = $additionalInformation['status'];
403
+ return Netresearch_OPS_Model_Status::canResendPaymentInfo($status);
404
+ }
405
+
406
+ return true;
407
+ }
408
  }
app/code/community/Netresearch/OPS/data/ops_setup/data-install-14.02.05.php CHANGED
@@ -1,12 +1,12 @@
1
- <?php
2
- /**
3
- * data-install-14.02.05.php
4
- * @author paul.siedler@netresearch.de
5
- * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
- */
8
-
9
- /* @var $installer Mage_Core_Model_Resource_Setup */
10
- $installer = $this;
11
- // for new installations set the default mode to test instead of custom
12
- $installer->setConfigData(Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH . 'mode', Netresearch_OPS_Model_Source_Mode::TEST);
1
+ <?php
2
+ /**
3
+ * data-install-14.02.05.php
4
+ * @author paul.siedler@netresearch.de
5
+ * @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License
7
+ */
8
+
9
+ /* @var $installer Mage_Core_Model_Resource_Setup */
10
+ $installer = $this;
11
+ // for new installations set the default mode to test instead of custom
12
+ $installer->setConfigData(Netresearch_OPS_Model_Config::OPS_PAYMENT_PATH . 'mode', Netresearch_OPS_Model_Source_Mode::TEST);
app/code/community/Netresearch/OPS/etc/config.xml CHANGED
@@ -28,7 +28,7 @@
28
  <config>
29
  <modules>
30
  <Netresearch_OPS>
31
- <version>16.05.26</version>
32
  </Netresearch_OPS>
33
  </modules>
34
  <global>
@@ -157,6 +157,11 @@
157
  <file>ops/suspend_subscription.html</file>
158
  <type>html</type>
159
  </payment_services_ops_suspendSubscription_template>
 
 
 
 
 
160
  </email>
161
  </template>
162
  </global>
@@ -222,6 +227,14 @@
222
  </append_resend_payment_info_button>
223
  </observers>
224
  </core_block_abstract_prepare_layout_before>
 
 
 
 
 
 
 
 
225
  </events>
226
  <translate>
227
  <modules>
@@ -309,7 +322,7 @@
309
  <directlink_gateway>https://secure.payengine.de/ncol/test/maintenancedirect.asp</directlink_gateway>
310
  <directlink_gateway_order>https://secure.payengine.de/ncol/test/orderdirect.asp</directlink_gateway_order>
311
  <directlink_maintenance_api>https://secure.payengine.de/ncol/test/querydirect.asp</directlink_maintenance_api>
312
- <ops_alias_gateway_test></ops_alias_gateway_test>
313
  <showcatalogbutton>1</showcatalogbutton>
314
  <showhomebutton>1</showhomebutton>
315
  <support_mail></support_mail>
@@ -334,6 +347,7 @@
334
  <ECOM_SHIPTO_POSTAL_POSTALCODE>10</ECOM_SHIPTO_POSTAL_POSTALCODE>
335
  <ECOM_SHIPTO_POSTAL_CITY>25</ECOM_SHIPTO_POSTAL_CITY>
336
  <ECOM_SHIPTO_POSTAL_STREET_NUMBER>10</ECOM_SHIPTO_POSTAL_STREET_NUMBER>
 
337
  <CN>35</CN>
338
  <OWNERZIP>10</OWNERZIP>
339
  <OWNERCTY>2</OWNERCTY>
@@ -341,6 +355,8 @@
341
  <OWNERTELNO>30</OWNERTELNO>
342
  <OWNERADDRESS>35</OWNERADDRESS>
343
  <ECOM_BILLTO_POSTAL_POSTALCODE>10</ECOM_BILLTO_POSTAL_POSTALCODE>
 
 
344
  </paramLength>
345
  <frontendFieldMapping>
346
  <CN>
@@ -352,21 +368,24 @@
352
  <OWNERTOWN>billing:city</OWNERTOWN>
353
  <OWNERTELNO>OWNERTELNO</OWNERTELNO>
354
  <OWNERADDRESS>billing:street1</OWNERADDRESS>
 
 
355
  <ECOM_BILLTO_POSTAL_POSTALCODE>billing:postcode</ECOM_BILLTO_POSTAL_POSTALCODE>
356
  <ECOM_SHIPTO_POSTAL_NAME_FIRST>shipping:firstname</ECOM_SHIPTO_POSTAL_NAME_FIRST>
357
  <ECOM_SHIPTO_POSTAL_NAME_LAST>shipping:lastname</ECOM_SHIPTO_POSTAL_NAME_LAST>
358
- <ECOM_SHIPTO_POSTAL_STREET1>shipping:street1</ECOM_SHIPTO_POSTAL_STREET1>
359
- <ECOM_SHIPTO_POSTAL_STREET2>shipping:street2</ECOM_SHIPTO_POSTAL_STREET2>
360
- <ECOM_SHIPTO_POSTAL_STREET3>shipping:street3</ECOM_SHIPTO_POSTAL_STREET3>
361
  <ECOM_SHIPTO_POSTAL_COUNTRYCODE>shipping:country_id</ECOM_SHIPTO_POSTAL_COUNTRYCODE>
362
  <ECOM_SHIPTO_POSTAL_COUNTY>shipping:region_id</ECOM_SHIPTO_POSTAL_COUNTY>
363
  <ECOM_SHIPTO_POSTAL_POSTALCODE>shipping:postcode</ECOM_SHIPTO_POSTAL_POSTALCODE>
364
  <ECOM_SHIPTO_POSTAL_CITY>shipping:city</ECOM_SHIPTO_POSTAL_CITY>
365
  <ECOM_SHIPTO_POSTAL_STREET_NUMBER>shipping:street</ECOM_SHIPTO_POSTAL_STREET_NUMBER>
366
- <ECOM_SHIPTO_POSTAL_POSTAL_STATE>shipping:region_id</ECOM_SHIPTO_POSTAL_POSTAL_STATE>
367
  </frontendFieldMapping>
368
  <resendPaymentInfo_identity>sales</resendPaymentInfo_identity>
369
  <resendPaymentInfo_template>payment_services_ops_resendPaymentInfo_template</resendPaymentInfo_template>
 
370
  <billing_day_month>15</billing_day_month>
371
  <billing_day_week>0</billing_day_week>
372
  <suspendSubscription_identity>sales</suspendSubscription_identity>
@@ -457,10 +476,6 @@
457
  <title>PayEngine CashU</title>
458
  <model>ops/payment_cashU</model>
459
  </ops_cashU>
460
- <ops_mpass>
461
- <title>PayEngine Mpass</title>
462
- <model>ops/payment_mpass</model>
463
- </ops_mpass>
464
  <ops_paypal>
465
  <title>PayEngine Paypal</title>
466
  <model>ops/payment_paypal</model>
@@ -530,9 +545,11 @@
530
  <additional_params_required>
531
  <capture>
532
  <OpenInvoiceNl>Netresearch_OPS_Model_Payment_OpenInvoiceNl</OpenInvoiceNl>
 
533
  </capture>
534
  <refund>
535
  <OpenInvoiceNl>Netresearch_OPS_Model_Payment_OpenInvoiceNl</OpenInvoiceNl>
 
536
  </refund>
537
  </additional_params_required>
538
  <ops_chinaUnionPay>
@@ -552,6 +569,11 @@
552
  <title><![CDATA[PayEngine Bancontact/MisterCash]]></title>
553
  <model>ops/payment_bancontact</model>
554
  </ops_BCMC>
 
 
 
 
 
555
  </payment>
556
 
557
  </default>
28
  <config>
29
  <modules>
30
  <Netresearch_OPS>
31
+ <version>16.12.14</version>
32
  </Netresearch_OPS>
33
  </modules>
34
  <global>
157
  <file>ops/suspend_subscription.html</file>
158
  <type>html</type>
159
  </payment_services_ops_suspendSubscription_template>
160
+ <payment_services_ops_payPerMail_template>
161
+ <label>PayEngine payPerMail template</label>
162
+ <file>ops/ops_pay_per_mail_info.html</file>
163
+ <type>html</type>
164
+ </payment_services_ops_payPerMail_template>
165
  </email>
166
  </template>
167
  </global>
227
  </append_resend_payment_info_button>
228
  </observers>
229
  </core_block_abstract_prepare_layout_before>
230
+ <sales_order_place_after>
231
+ <observers>
232
+ <send_payPerMail_info>
233
+ <class>ops/observer</class>
234
+ <method>sendPayPerMailInfo</method>
235
+ </send_payPerMail_info>
236
+ </observers>
237
+ </sales_order_place_after>
238
  </events>
239
  <translate>
240
  <modules>
322
  <directlink_gateway>https://secure.payengine.de/ncol/test/maintenancedirect.asp</directlink_gateway>
323
  <directlink_gateway_order>https://secure.payengine.de/ncol/test/orderdirect.asp</directlink_gateway_order>
324
  <directlink_maintenance_api>https://secure.payengine.de/ncol/test/querydirect.asp</directlink_maintenance_api>
325
+ <ops_alias_gateway_test>https://payengine.test.v-psp.com/Tokenization/Hostedpage</ops_alias_gateway_test>
326
  <showcatalogbutton>1</showcatalogbutton>
327
  <showhomebutton>1</showhomebutton>
328
  <support_mail></support_mail>
347
  <ECOM_SHIPTO_POSTAL_POSTALCODE>10</ECOM_SHIPTO_POSTAL_POSTALCODE>
348
  <ECOM_SHIPTO_POSTAL_CITY>25</ECOM_SHIPTO_POSTAL_CITY>
349
  <ECOM_SHIPTO_POSTAL_STREET_NUMBER>10</ECOM_SHIPTO_POSTAL_STREET_NUMBER>
350
+ <ECOM_SHIPTO_POSTAL_STATE>35</ECOM_SHIPTO_POSTAL_STATE>
351
  <CN>35</CN>
352
  <OWNERZIP>10</OWNERZIP>
353
  <OWNERCTY>2</OWNERCTY>
355
  <OWNERTELNO>30</OWNERTELNO>
356
  <OWNERADDRESS>35</OWNERADDRESS>
357
  <ECOM_BILLTO_POSTAL_POSTALCODE>10</ECOM_BILLTO_POSTAL_POSTALCODE>
358
+ <ECOM_BILLTO_POSTAL_NAME_FIRST>50</ECOM_BILLTO_POSTAL_NAME_FIRST>
359
+ <ECOM_BILLTO_POSTAL_NAME_LAST>50</ECOM_BILLTO_POSTAL_NAME_LAST>
360
  </paramLength>
361
  <frontendFieldMapping>
362
  <CN>
368
  <OWNERTOWN>billing:city</OWNERTOWN>
369
  <OWNERTELNO>OWNERTELNO</OWNERTELNO>
370
  <OWNERADDRESS>billing:street1</OWNERADDRESS>
371
+ <ECOM_BILLTO_POSTAL_NAME_FIRST>billing:firstname</ECOM_BILLTO_POSTAL_NAME_FIRST>
372
+ <ECOM_BILLTO_POSTAL_NAME_LAST>billing:lastname</ECOM_BILLTO_POSTAL_NAME_LAST>
373
  <ECOM_BILLTO_POSTAL_POSTALCODE>billing:postcode</ECOM_BILLTO_POSTAL_POSTALCODE>
374
  <ECOM_SHIPTO_POSTAL_NAME_FIRST>shipping:firstname</ECOM_SHIPTO_POSTAL_NAME_FIRST>
375
  <ECOM_SHIPTO_POSTAL_NAME_LAST>shipping:lastname</ECOM_SHIPTO_POSTAL_NAME_LAST>
376
+ <ECOM_SHIPTO_POSTAL_STREET_LINE1>shipping:street1</ECOM_SHIPTO_POSTAL_STREET_LINE1>
377
+ <ECOM_SHIPTO_POSTAL_STREET_LINE2>shipping:street2</ECOM_SHIPTO_POSTAL_STREET_LINE2>
378
+ <ECOM_SHIPTO_POSTAL_STREET_LINE3>shipping:street3</ECOM_SHIPTO_POSTAL_STREET_LINE3>
379
  <ECOM_SHIPTO_POSTAL_COUNTRYCODE>shipping:country_id</ECOM_SHIPTO_POSTAL_COUNTRYCODE>
380
  <ECOM_SHIPTO_POSTAL_COUNTY>shipping:region_id</ECOM_SHIPTO_POSTAL_COUNTY>
381
  <ECOM_SHIPTO_POSTAL_POSTALCODE>shipping:postcode</ECOM_SHIPTO_POSTAL_POSTALCODE>
382
  <ECOM_SHIPTO_POSTAL_CITY>shipping:city</ECOM_SHIPTO_POSTAL_CITY>
383
  <ECOM_SHIPTO_POSTAL_STREET_NUMBER>shipping:street</ECOM_SHIPTO_POSTAL_STREET_NUMBER>
384
+ <ECOM_SHIPTO_POSTAL_STATE>shipping:region_id</ECOM_SHIPTO_POSTAL_STATE>
385
  </frontendFieldMapping>
386
  <resendPaymentInfo_identity>sales</resendPaymentInfo_identity>
387
  <resendPaymentInfo_template>payment_services_ops_resendPaymentInfo_template</resendPaymentInfo_template>
388
+ <payPerMail_template>payment_services_ops_payPerMail_template</payPerMail_template>
389
  <billing_day_month>15</billing_day_month>
390
  <billing_day_week>0</billing_day_week>
391
  <suspendSubscription_identity>sales</suspendSubscription_identity>
476
  <title>PayEngine CashU</title>
477
  <model>ops/payment_cashU</model>
478
  </ops_cashU>
 
 
 
 
479
  <ops_paypal>
480
  <title>PayEngine Paypal</title>
481
  <model>ops/payment_paypal</model>
545
  <additional_params_required>
546
  <capture>
547
  <OpenInvoiceNl>Netresearch_OPS_Model_Payment_OpenInvoiceNl</OpenInvoiceNl>
548
+ <OpenInvoiceAt>Netresearch_OPS_Model_Payment_OpenInvoiceAt</OpenInvoiceAt>
549
  </capture>
550
  <refund>
551
  <OpenInvoiceNl>Netresearch_OPS_Model_Payment_OpenInvoiceNl</OpenInvoiceNl>
552
+ <OpenInvoiceAt>Netresearch_OPS_Model_Payment_OpenInvoiceAt</OpenInvoiceAt>
553
  </refund>
554
  </additional_params_required>
555
  <ops_chinaUnionPay>
569
  <title><![CDATA[PayEngine Bancontact/MisterCash]]></title>
570
  <model>ops/payment_bancontact</model>
571
  </ops_BCMC>
572
+ <ops_payPerMail>
573
+ <title><![CDATA[PayEngine PayPerMail]]></title>
574
+ <model>ops/payment_payPerMail</model>
575
+ <backend_enabled>1</backend_enabled>
576
+ </ops_payPerMail>
577
  </payment>
578
 
579
  </default>
app/code/community/Netresearch/OPS/etc/jstranslator.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <jstranslator>
3
+ <ops-payment-failed-switch-method translate="message" module="ops">
4
+ <message>Payment failed. Please select another payment method.</message>
5
+ </ops-payment-failed-switch-method>
6
+ <ops-payment-failed-review-input translate="message" module="ops">
7
+ <message>Payment failed. Please review your input or select another payment method.</message>
8
+ </ops-payment-failed-review-input>
9
+ <ops-htp-load-token translate="message" module="ops">
10
+ <message>LOAD_TOKEN</message>
11
+ </ops-htp-load-token>
12
+ <ops-htp-success-token translate="message" module="ops">
13
+ <message>SUCCESS_TOKEN</message>
14
+ </ops-htp-success-token>
15
+ <ops-htp-success-token-frontend translate="message" module="ops">
16
+ <message>SUCCESS_TOKEN_FRONTEND</message>
17
+ </ops-htp-success-token-frontend>
18
+ <ops-htp-failure-token translate="message" module="ops">
19
+ <message>FAILURE_TOKEN</message>
20
+ </ops-htp-failure-token>
21
+ <ops-htp-failure-token-frontend translate="message" module="ops">
22
+ <message>FAILURE_TOKEN_FRONTEND</message>
23
+ </ops-htp-failure-token-frontend>
24
+ <ops-required-field translate="message" module="ops">
25
+ <message>This is a required field.</message>
26
+ </ops-required-field>
27
+ </jstranslator>
app/code/community/Netresearch/OPS/etc/system.xml CHANGED
@@ -93,7 +93,7 @@
93
  </secret_key_type>
94
  <secret_key_in translate="label comment tooltip">
95
  <label>SHA-IN Pass phrase</label>
96
- <comment><![CDATA[Refer to PayEngine's backend in section <em>Technical Information</em> on tab <em>Data and origin verification</em>.]]></comment>
97
  <tooltip><![CDATA[This must be identical to the value in the PayEngine backend in section <em>Technical information</em> on tab <em>Data and origin verification</em>.]]></tooltip>
98
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
99
  <frontend_type>obscure</frontend_type>
@@ -104,7 +104,7 @@
104
  </secret_key_in>
105
  <secret_key_out translate="label comment tooltip">
106
  <label>SHA-OUT Pass phrase</label>
107
- <comment><![CDATA[Refer to PayEngine's backend in section <em>Technical Information</em> on tab <em>Transaction feedback</em>.]]></comment>
108
  <tooltip><![CDATA[This must be identical to the value in the PayEngine backend in section <em>Technical information</em> on tab <em>Transaction feedback</em>.]]></tooltip>
109
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
110
  <frontend_type>obscure</frontend_type>
@@ -133,21 +133,17 @@
133
  <show_in_default>1</show_in_default>
134
  <show_in_website>1</show_in_website>
135
  <show_in_store>1</show_in_store>
136
- <depends>
137
- <mode>custom</mode>
138
- </depends>
139
  </frontend_gateway>
140
  <ops_alias_gateway translate="label comment">
141
  <label>Alias Gateway URL</label>
142
  <frontend_type>text</frontend_type>
143
- <comment><![CDATA[Test url example: https://secure.payengine.de/ncol/test/Tokenization/HostedPage<br />Production url example: https://secure.payengine.de/ncol/prod/Tokenization/HostedPage]]></comment>
144
  <sort_order>71</sort_order>
145
  <show_in_default>1</show_in_default>
146
  <show_in_website>1</show_in_website>
147
  <show_in_store>1</show_in_store>
148
- <depends>
149
- <mode>custom</mode>
150
- </depends>
151
  </ops_alias_gateway>
152
  <directlink_gateway translate="label comment">
153
  <label>DirectLink Gateway URL</label>
@@ -157,9 +153,7 @@
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
- <depends>
161
- <mode>custom</mode>
162
- </depends>
163
  </directlink_gateway>
164
  <directlink_gateway_order translate="label comment">
165
  <label>DirectLink Gateway Order URL</label>
@@ -169,9 +163,7 @@
169
  <show_in_default>1</show_in_default>
170
  <show_in_website>1</show_in_website>
171
  <show_in_store>1</show_in_store>
172
- <depends>
173
- <mode>custom</mode>
174
- </depends>
175
  </directlink_gateway_order>
176
  <directlink_maintenance_api translate="label comment">
177
  <label>DirectLink Maintenance API URL</label>
@@ -181,9 +173,7 @@
181
  <show_in_default>1</show_in_default>
182
  <show_in_website>1</show_in_website>
183
  <show_in_store>1</show_in_store>
184
- <depends>
185
- <mode>custom</mode>
186
- </depends>
187
  </directlink_maintenance_api>
188
  <api_userid translate="label tooltip">
189
  <label>API User</label>
@@ -218,9 +208,7 @@
218
  <label>Send Invoice to Customer</label>
219
  <frontend_type>select</frontend_type>
220
  <source_model>adminhtml/system_config_source_yesno</source_model>
221
- <depends>
222
- <payment_action>authorize_capture</payment_action>
223
- </depends>
224
  <sort_order>95</sort_order>
225
  <show_in_default>1</show_in_default>
226
  <show_in_website>1</show_in_website>
@@ -237,7 +225,7 @@
237
  <show_in_default>1</show_in_default>
238
  <show_in_website>1</show_in_website>
239
  <show_in_store>1</show_in_store>
240
- <tooltip><![CDATA[For an easier PCI compliance we recommend redirect mode, iFrame mode or dynamic template with the template hosted on PayEngine servers.]]></tooltip>
241
  </template>
242
  <template_identifier translate="label comment">
243
  <label>Template Identifier/Url</label>
@@ -247,9 +235,7 @@
247
  <show_in_default>1</show_in_default>
248
  <show_in_website>1</show_in_website>
249
  <show_in_store>1</show_in_store>
250
- <depends>
251
- <template>ops_template</template>
252
- </depends>
253
  <validate>required-entry</validate>
254
  </template_identifier>
255
  <html_title translate="label comment">
@@ -259,9 +245,7 @@
259
  <show_in_default>1</show_in_default>
260
  <show_in_website>1</show_in_website>
261
  <show_in_store>1</show_in_store>
262
- <depends>
263
- <template separator=",">ops,ops_iframe</template>
264
- </depends>
265
  <validate>required-entry</validate>
266
  </html_title>
267
  <bgcolor translate="label comment">
@@ -272,9 +256,7 @@
272
  <show_in_default>1</show_in_default>
273
  <show_in_website>1</show_in_website>
274
  <show_in_store>1</show_in_store>
275
- <depends>
276
- <template separator=",">ops,ops_iframe</template>
277
- </depends>
278
  <validate>required-entry</validate>
279
  </bgcolor>
280
  <txtcolor translate="label comment">
@@ -285,9 +267,7 @@
285
  <show_in_default>1</show_in_default>
286
  <show_in_website>1</show_in_website>
287
  <show_in_store>1</show_in_store>
288
- <depends>
289
- <template separator=",">ops,ops_iframe</template>
290
- </depends>
291
  <validate>required-entry</validate>
292
  </txtcolor>
293
  <tblbgcolor translate="label comment">
@@ -298,9 +278,7 @@
298
  <show_in_default>1</show_in_default>
299
  <show_in_website>1</show_in_website>
300
  <show_in_store>1</show_in_store>
301
- <depends>
302
- <template separator=",">ops,ops_iframe</template>
303
- </depends>
304
  <validate>required-entry</validate>
305
  </tblbgcolor>
306
  <tbltxtcolor translate="label comment">
@@ -311,9 +289,7 @@
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
- <depends>
315
- <template separator=",">ops,ops_iframe</template>
316
- </depends>
317
  <validate>required-entry</validate>
318
  </tbltxtcolor>
319
  <showcatalogbutton translate="label">
@@ -324,9 +300,7 @@
324
  <show_in_default>1</show_in_default>
325
  <show_in_website>1</show_in_website>
326
  <show_in_store>1</show_in_store>
327
- <depends>
328
- <template separator=",">ops,ops_iframe</template>
329
- </depends>
330
  <validate>required-entry</validate>
331
  </showcatalogbutton>
332
  <showhomebutton translate="label">
@@ -337,9 +311,7 @@
337
  <show_in_default>1</show_in_default>
338
  <show_in_website>1</show_in_website>
339
  <show_in_store>1</show_in_store>
340
- <depends>
341
- <template separator=",">ops,ops_iframe</template>
342
- </depends>
343
  <validate>required-entry</validate>
344
  </showhomebutton>
345
  <buttonbgcolor translate="label">
@@ -349,9 +321,7 @@
349
  <show_in_default>1</show_in_default>
350
  <show_in_website>1</show_in_website>
351
  <show_in_store>1</show_in_store>
352
- <depends>
353
- <template separator=",">ops,ops_iframe</template>
354
- </depends>
355
  <validate>required-entry</validate>
356
  </buttonbgcolor>
357
  <buttontxtcolor translate="label comment">
@@ -362,9 +332,7 @@
362
  <show_in_default>1</show_in_default>
363
  <show_in_website>1</show_in_website>
364
  <show_in_store>1</show_in_store>
365
- <depends>
366
- <template separator=",">ops,ops_iframe</template>
367
- </depends>
368
  <validate>required-entry</validate>
369
  </buttontxtcolor>
370
  <fonttype translate="label comment">
@@ -375,9 +343,7 @@
375
  <show_in_default>1</show_in_default>
376
  <show_in_website>1</show_in_website>
377
  <show_in_store>1</show_in_store>
378
- <depends>
379
- <template separator=",">ops,ops_iframe</template>
380
- </depends>
381
  <validate>required-entry</validate>
382
  </fonttype>
383
  <logo translate="label comment">
@@ -388,27 +354,24 @@
388
  <show_in_default>1</show_in_default>
389
  <show_in_website>1</show_in_website>
390
  <show_in_store>1</show_in_store>
391
- <depends>
392
- <template separator=",">ops,ops_iframe</template>
393
- </depends>
394
  <validate>required-entry</validate>
395
  </logo>
396
  <pmlist translate="label comment">
397
  <label>Layout of Payment Methods</label>
 
398
  <frontend_type>select</frontend_type>
399
  <source_model>ops/source_pmlist</source_model>
400
  <sort_order>210</sort_order>
401
  <show_in_default>1</show_in_default>
402
  <show_in_website>1</show_in_website>
403
  <show_in_store>1</show_in_store>
404
- <depends>
405
- <template separator=",">ops,ops_iframe</template>
406
- </depends>
407
  <validate>required-entry</validate>
408
  </pmlist>
409
  <redirectOrderReference translate="label comment">
410
  <label>Order reference in case of redirect payments</label>
411
- <comment>See chapter 'configuration', section 'Magento - Backend in the documentation'. Please note that the option 'orderId' is not used the Kwixo payment methods.</comment>
412
  <frontend_type>select</frontend_type>
413
  <source_model>ops/source_orderReference</source_model>
414
  <sort_order>220</sort_order>
@@ -418,7 +381,7 @@
418
  </redirectOrderReference>
419
  <inlineOrderReference translate="label comment">
420
  <label>Order reference in case of inline payments</label>
421
- <comment>See chapter 'configuration', section 'Magento - Backend in the documentation'.</comment>
422
  <frontend_type>select</frontend_type>
423
  <source_model>ops/source_orderReference</source_model>
424
  <sort_order>221</sort_order>
@@ -479,7 +442,7 @@
479
  </device_fingerprinting>
480
  <ops_rtimeout translate="label tooltip comment">
481
  <label>Timeout for transactions</label>
482
- <comment>This value specifies the request timeout for that transaction. A value between 30 and 60 is possible.</comment>
483
  <frontend_type>text</frontend_type>
484
  <validate>validate-digits-range digits-range-30-60</validate>
485
  <sort_order>290</sort_order>
@@ -543,11 +506,11 @@
543
  </groups>
544
  </payment_services>
545
  <payment>
 
546
  <groups>
547
-
548
  <ops_directDebit translate="label">
549
  <label>PayEngine DirectDebit</label>
550
- <sort_order>12</sort_order>
551
  <show_in_default>1</show_in_default>
552
  <show_in_website>1</show_in_website>
553
  <show_in_store>1</show_in_store>
@@ -582,15 +545,54 @@
582
  <label>Countries</label>
583
  <frontend_type>multiselect</frontend_type>
584
  <validate>required-entry</validate>
585
- <depends>
586
- <active>1</active>
587
- </depends>
588
  <sort_order>30</sort_order>
589
  <source_model>ops/source_directDebit_countries</source_model>
590
  <show_in_default>1</show_in_default>
591
  <show_in_website>1</show_in_website>
592
  <show_in_store>1</show_in_store>
593
  </countryIds>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  <backend_enabled>
595
  <label>Enable for backend</label>
596
  <frontend_type>select</frontend_type>
@@ -600,11 +602,21 @@
600
  <show_in_website>1</show_in_website>
601
  <show_in_store>1</show_in_store>
602
  </backend_enabled>
 
 
 
 
 
 
 
 
 
 
603
  </fields>
604
  </ops_directDebit>
605
  <ops_postFinanceEFinance translate="label">
606
  <label>PayEngine PostFinanceEFinance</label>
607
- <sort_order>12</sort_order>
608
  <show_in_default>1</show_in_default>
609
  <show_in_website>1</show_in_website>
610
  <show_in_store>1</show_in_store>
@@ -635,11 +647,52 @@
635
  <show_in_website>1</show_in_website>
636
  <show_in_store>1</show_in_store>
637
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
638
  </fields>
639
  </ops_postFinanceEFinance>
640
  <ops_eDankort translate="label">
641
  <label>PayEngine EDankort</label>
642
- <sort_order>12</sort_order>
643
  <show_in_default>1</show_in_default>
644
  <show_in_website>1</show_in_website>
645
  <show_in_store>1</show_in_store>
@@ -670,11 +723,52 @@
670
  <show_in_website>1</show_in_website>
671
  <show_in_store>1</show_in_store>
672
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  </fields>
674
  </ops_eDankort>
675
  <ops_kbcOnline translate="label">
676
  <label>PayEngine KbcOnline</label>
677
- <sort_order>12</sort_order>
678
  <show_in_default>1</show_in_default>
679
  <show_in_website>1</show_in_website>
680
  <show_in_store>1</show_in_store>
@@ -705,11 +799,52 @@
705
  <show_in_website>1</show_in_website>
706
  <show_in_store>1</show_in_store>
707
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  </fields>
709
  </ops_kbcOnline>
710
  <ops_iDeal translate="label">
711
  <label>PayEngine iDEAL</label>
712
- <sort_order>12</sort_order>
713
  <show_in_default>1</show_in_default>
714
  <show_in_website>1</show_in_website>
715
  <show_in_store>1</show_in_store>
@@ -740,11 +875,52 @@
740
  <show_in_website>1</show_in_website>
741
  <show_in_store>1</show_in_store>
742
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
  </fields>
744
  </ops_iDeal>
745
  <ops_belfiusDirectNet translate="label">
746
  <label>PayEngine Belfius Direct Net</label>
747
- <sort_order>12</sort_order>
748
  <show_in_default>1</show_in_default>
749
  <show_in_website>1</show_in_website>
750
  <show_in_store>1</show_in_store>
@@ -775,11 +951,52 @@
775
  <show_in_website>1</show_in_website>
776
  <show_in_store>1</show_in_store>
777
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
778
  </fields>
779
  </ops_belfiusDirectNet>
780
  <ops_bankTransfer translate="label">
781
  <label>PayEngine BankTransfer</label>
782
- <sort_order>12</sort_order>
783
  <show_in_default>1</show_in_default>
784
  <show_in_website>1</show_in_website>
785
  <show_in_store>1</show_in_store>
@@ -814,20 +1031,59 @@
814
  <label>Countries</label>
815
  <frontend_type>multiselect</frontend_type>
816
  <validate>required-entry</validate>
817
- <depends>
818
- <active>1</active>
819
- </depends>
820
  <sort_order>30</sort_order>
821
  <source_model>ops/source_bankTransfer_countries</source_model>
822
  <show_in_default>1</show_in_default>
823
  <show_in_website>1</show_in_website>
824
  <show_in_store>1</show_in_store>
825
  </countryIds>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
826
  </fields>
827
  </ops_bankTransfer>
828
  <ops_openInvoiceDe translate="label">
829
  <label>PayEngine Open Invoice DE</label>
830
- <sort_order>12</sort_order>
831
  <show_in_default>1</show_in_default>
832
  <show_in_website>1</show_in_website>
833
  <show_in_store>1</show_in_store>
@@ -869,12 +1125,78 @@
869
  <show_in_website>1</show_in_website>
870
  <show_in_store>1</show_in_store>
871
  </sort_order>
872
- </fields>
873
- </ops_openInvoiceDe>
874
- <ops_openInvoiceAt translate="label">
875
- <label>PayEngine Open Invoice AT</label>
876
- <sort_order>12</sort_order>
877
- <show_in_default>1</show_in_default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
878
  <show_in_website>1</show_in_website>
879
  <show_in_store>1</show_in_store>
880
  <fields>
@@ -915,11 +1237,77 @@
915
  <show_in_website>1</show_in_website>
916
  <show_in_store>1</show_in_store>
917
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  </fields>
919
  </ops_openInvoiceAt>
920
  <ops_openInvoiceNl translate="label">
921
  <label>PayEngine Open Invoice NL</label>
922
- <sort_order>12</sort_order>
923
  <show_in_default>1</show_in_default>
924
  <show_in_website>1</show_in_website>
925
  <show_in_store>1</show_in_store>
@@ -951,11 +1339,77 @@
951
  <show_in_website>1</show_in_website>
952
  <show_in_store>1</show_in_store>
953
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
954
  </fields>
955
  </ops_openInvoiceNl>
956
  <ops_cbcOnline translate="label">
957
  <label>PayEngine CbcOnline</label>
958
- <sort_order>12</sort_order>
959
  <show_in_default>1</show_in_default>
960
  <show_in_website>1</show_in_website>
961
  <show_in_store>1</show_in_store>
@@ -986,11 +1440,52 @@
986
  <show_in_website>1</show_in_website>
987
  <show_in_store>1</show_in_store>
988
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
989
  </fields>
990
  </ops_cbcOnline>
991
  <ops_giroPay translate="label">
992
  <label>PayEngine GiroPay</label>
993
- <sort_order>12</sort_order>
994
  <show_in_default>1</show_in_default>
995
  <show_in_website>1</show_in_website>
996
  <show_in_store>1</show_in_store>
@@ -1021,11 +1516,52 @@
1021
  <show_in_website>1</show_in_website>
1022
  <show_in_store>1</show_in_store>
1023
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1024
  </fields>
1025
  </ops_giroPay>
1026
  <ops_Masterpass translate="label">
1027
  <label>PayEngine Masterpass</label>
1028
- <sort_order>12</sort_order>
1029
  <show_in_default>1</show_in_default>
1030
  <show_in_website>1</show_in_website>
1031
  <show_in_store>1</show_in_store>
@@ -1056,14 +1592,55 @@
1056
  <show_in_website>1</show_in_website>
1057
  <show_in_store>1</show_in_store>
1058
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  </fields>
1060
  </ops_Masterpass>
1061
  <ops_interSolve translate="label">
1062
  <label>PayEngine InterSolve</label>
1063
- <sort_order>12</sort_order>
1064
  <show_in_default>1</show_in_default>
1065
  <show_in_website>1</show_in_website>
1066
- <show_in_store>1</show_in_store>
1067
  <fields>
1068
  <active translate="label">
1069
  <label>Enabled</label>
@@ -1091,11 +1668,52 @@
1091
  <show_in_website>1</show_in_website>
1092
  <show_in_store>1</show_in_store>
1093
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1094
  <brands translate="label comment">
1095
  <label>Brand</label>
1096
  <frontend_model>ops/system_config_form_field_brand</frontend_model>
1097
  <backend_model>ops/system_config_backend_intersolve_brands</backend_model>
1098
- <sort_order>30</sort_order>
1099
  <show_in_default>1</show_in_default>
1100
  <show_in_website>1</show_in_website>
1101
  <show_in_store>1</show_in_store>
@@ -1105,7 +1723,7 @@
1105
  </ops_interSolve>
1106
  <ops_cashU translate="label">
1107
  <label>PayEngine CashU</label>
1108
- <sort_order>12</sort_order>
1109
  <show_in_default>1</show_in_default>
1110
  <show_in_website>1</show_in_website>
1111
  <show_in_store>1</show_in_store>
@@ -1136,11 +1754,52 @@
1136
  <show_in_website>1</show_in_website>
1137
  <show_in_store>1</show_in_store>
1138
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139
  </fields>
1140
  </ops_cashU>
1141
- <ops_mpass translate="label">
1142
- <label>PayEngine Mpass</label>
1143
- <sort_order>12</sort_order>
1144
  <show_in_default>1</show_in_default>
1145
  <show_in_website>1</show_in_website>
1146
  <show_in_store>1</show_in_store>
@@ -1171,46 +1830,52 @@
1171
  <show_in_website>1</show_in_website>
1172
  <show_in_store>1</show_in_store>
1173
  </sort_order>
1174
- </fields>
1175
- </ops_mpass>
1176
- <ops_paypal translate="label">
1177
- <label>PayEngine Paypal</label>
1178
- <sort_order>12</sort_order>
1179
- <show_in_default>1</show_in_default>
1180
- <show_in_website>1</show_in_website>
1181
- <show_in_store>1</show_in_store>
1182
- <fields>
1183
- <active translate="label">
1184
- <label>Enabled</label>
1185
- <frontend_type>select</frontend_type>
1186
- <source_model>adminhtml/system_config_source_yesno</source_model>
1187
- <sort_order>1</sort_order>
1188
  <show_in_default>1</show_in_default>
1189
  <show_in_website>1</show_in_website>
1190
  <show_in_store>0</show_in_store>
1191
- </active>
1192
- <title translate="label">
1193
- <label>Title</label>
1194
- <frontend_type>text</frontend_type>
1195
- <sort_order>10</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1196
  <show_in_default>1</show_in_default>
1197
  <show_in_website>1</show_in_website>
1198
  <show_in_store>1</show_in_store>
1199
- <validate>required-entry</validate>
1200
- </title>
1201
- <sort_order translate="label">
1202
- <label>Sort Order</label>
1203
- <frontend_type>text</frontend_type>
1204
- <sort_order>20</sort_order>
 
1205
  <show_in_default>1</show_in_default>
1206
  <show_in_website>1</show_in_website>
1207
  <show_in_store>1</show_in_store>
1208
- </sort_order>
1209
  </fields>
1210
  </ops_paypal>
1211
  <ops_eps translate="label">
1212
  <label>PayEngine Eps</label>
1213
- <sort_order>12</sort_order>
1214
  <show_in_default>1</show_in_default>
1215
  <show_in_website>1</show_in_website>
1216
  <show_in_store>1</show_in_store>
@@ -1241,11 +1906,52 @@
1241
  <show_in_website>1</show_in_website>
1242
  <show_in_store>1</show_in_store>
1243
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1244
  </fields>
1245
  </ops_eps>
1246
  <ops_pingPing translate="label">
1247
  <label>PayEngine PingPing</label>
1248
- <sort_order>12</sort_order>
1249
  <show_in_default>1</show_in_default>
1250
  <show_in_website>1</show_in_website>
1251
  <show_in_store>1</show_in_store>
@@ -1276,11 +1982,52 @@
1276
  <show_in_website>1</show_in_website>
1277
  <show_in_store>1</show_in_store>
1278
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1279
  </fields>
1280
  </ops_pingPing>
1281
  <ops_fortisPayButton translate="label">
1282
  <label>PayEngine FortisPayButton</label>
1283
- <sort_order>12</sort_order>
1284
  <show_in_default>1</show_in_default>
1285
  <show_in_website>1</show_in_website>
1286
  <show_in_store>1</show_in_store>
@@ -1311,11 +2058,52 @@
1311
  <show_in_website>1</show_in_website>
1312
  <show_in_store>1</show_in_store>
1313
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1314
  </fields>
1315
  </ops_fortisPayButton>
1316
  <ops_directEbanking translate="label">
1317
  <label>PayEngineSofortÜberweisung</label>
1318
- <sort_order>12</sort_order>
1319
  <show_in_default>1</show_in_default>
1320
  <show_in_website>1</show_in_website>
1321
  <show_in_store>1</show_in_store>
@@ -1342,9 +2130,7 @@
1342
  <label>Brands</label>
1343
  <frontend_type>multiselect</frontend_type>
1344
  <validate>required-entry</validate>
1345
- <depends>
1346
- <active>1</active>
1347
- </depends>
1348
  <sort_order>20</sort_order>
1349
  <source_model>ops/source_directEbanking_brands</source_model>
1350
  <show_in_default>1</show_in_default>
@@ -1359,11 +2145,52 @@
1359
  <show_in_website>1</show_in_website>
1360
  <show_in_store>1</show_in_store>
1361
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1362
  </fields>
1363
  </ops_directEbanking>
1364
  <ops_cc translate="label">
1365
  <label>PayEngine Cc</label>
1366
- <sort_order>11</sort_order>
1367
  <show_in_default>1</show_in_default>
1368
  <show_in_website>1</show_in_website>
1369
  <show_in_store>1</show_in_store>
@@ -1395,7 +2222,7 @@
1395
  <show_in_store>1</show_in_store>
1396
  </sort_order>
1397
  <types translate="label">
1398
- <label>Card Types</label>
1399
  <frontend_type>multiselect</frontend_type>
1400
  <sort_order>30</sort_order>
1401
  <source_model>ops/source_cc_types</source_model>
@@ -1405,7 +2232,7 @@
1405
  </types>
1406
  <redirect_all translate="label comment">
1407
  <label>Enable redirect payment for all card types</label>
1408
- <comment><![CDATA[If set to <em>Yes></em>, customers will be redirected to the external PayEngine payment page.]]></comment>
1409
  <frontend_type>select</frontend_type>
1410
  <source_model>adminhtml/system_config_source_yesno</source_model>
1411
  <sort_order>40</sort_order>
@@ -1414,14 +2241,12 @@
1414
  <show_in_store>1</show_in_store>
1415
  </redirect_all>
1416
  <inline_types translate="label tooltip">
1417
- <label>Enable inline payment for these card types</label>
1418
  <tooltip><![CDATA[For the selected card types, the customer can enter the credit card details directly in the checkout.]]></tooltip>
1419
  <frontend_type>multiselect</frontend_type>
1420
  <source_model>ops/source_cc_aliasInterfaceEnabledTypes</source_model>
1421
  <sort_order>41</sort_order>
1422
- <depends>
1423
- <redirect_all>0</redirect_all>
1424
- </depends>
1425
  <show_in_default>1</show_in_default>
1426
  <show_in_website>1</show_in_website>
1427
  <show_in_store>1</show_in_store>
@@ -1436,6 +2261,27 @@
1436
  <show_in_website>1</show_in_website>
1437
  <show_in_store>0</show_in_store>
1438
  </enabled_3dsecure>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1439
  <backend_enabled translate="label tooltip">
1440
  <label>Enable for backend</label>
1441
  <tooltip><![CDATA[This sets if this payment method should also be available for orders from the Magento backend.]]></tooltip>
@@ -1456,6 +2302,24 @@
1456
  <show_in_website>1</show_in_website>
1457
  <show_in_store>1</show_in_store>
1458
  </active_alias>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1459
  <zero_amount_checkout>
1460
  <label>Allow zero amount authorization</label>
1461
  <comment>Only if payment action is authorize.</comment>
@@ -1468,9 +2332,9 @@
1468
  </zero_amount_checkout>
1469
  </fields>
1470
  </ops_cc>
1471
- <ops_ingHomePay translate="label">
1472
- <label>PayEngine IngHomePay</label>
1473
- <sort_order>12</sort_order>
1474
  <show_in_default>1</show_in_default>
1475
  <show_in_website>1</show_in_website>
1476
  <show_in_store>1</show_in_store>
@@ -1479,7 +2343,7 @@
1479
  <label>Enabled</label>
1480
  <frontend_type>select</frontend_type>
1481
  <source_model>adminhtml/system_config_source_yesno</source_model>
1482
- <sort_order>1</sort_order>
1483
  <show_in_default>1</show_in_default>
1484
  <show_in_website>1</show_in_website>
1485
  <show_in_store>0</show_in_store>
@@ -1487,7 +2351,7 @@
1487
  <title translate="label">
1488
  <label>Title</label>
1489
  <frontend_type>text</frontend_type>
1490
- <sort_order>10</sort_order>
1491
  <show_in_default>1</show_in_default>
1492
  <show_in_website>1</show_in_website>
1493
  <show_in_store>1</show_in_store>
@@ -1501,72 +2365,307 @@
1501
  <show_in_website>1</show_in_website>
1502
  <show_in_store>1</show_in_store>
1503
  </sort_order>
1504
- </fields>
1505
- </ops_ingHomePay>
1506
- <ops_paysafecard translate="label">
1507
- <label>PayEngine Paysafecard</label>
1508
- <sort_order>12</sort_order>
1509
- <show_in_default>1</show_in_default>
1510
- <show_in_website>1</show_in_website>
1511
- <show_in_store>1</show_in_store>
1512
- <fields>
1513
- <active translate="label">
1514
- <label>Enabled</label>
1515
- <frontend_type>select</frontend_type>
1516
- <source_model>adminhtml/system_config_source_yesno</source_model>
1517
- <sort_order>1</sort_order>
1518
- <show_in_default>1</show_in_default>
1519
- <show_in_website>1</show_in_website>
1520
- <show_in_store>0</show_in_store>
1521
- </active>
1522
- <title translate="label">
1523
- <label>Title</label>
1524
- <frontend_type>text</frontend_type>
1525
- <sort_order>10</sort_order>
1526
  <show_in_default>1</show_in_default>
1527
  <show_in_website>1</show_in_website>
1528
  <show_in_store>1</show_in_store>
1529
- <validate>required-entry</validate>
1530
- </title>
1531
- <sort_order translate="label">
1532
- <label>Sort Order</label>
1533
- <frontend_type>text</frontend_type>
1534
- <sort_order>20</sort_order>
 
1535
  <show_in_default>1</show_in_default>
1536
  <show_in_website>1</show_in_website>
1537
  <show_in_store>1</show_in_store>
1538
- </sort_order>
1539
- </fields>
1540
- </ops_paysafecard>
1541
- <ops_kwixoCredit translate="label">
1542
- <label>PayEngine KwixoCredit</label>
1543
- <sort_order>13</sort_order>
1544
- <show_in_default>1</show_in_default>
1545
- <show_in_website>1</show_in_website>
1546
- <show_in_store>1</show_in_store>
1547
- <fields>
1548
- <kwixo_config translate="label">
1549
- <label>Kwixxo Config</label>
1550
- <frontend_type>text</frontend_type>
1551
- <frontend_model>ops/system_config_kwixoconfiguration</frontend_model>
1552
- <sort_order>0</sort_order>
1553
  <show_in_default>1</show_in_default>
1554
  <show_in_website>1</show_in_website>
1555
  <show_in_store>1</show_in_store>
1556
- </kwixo_config>
1557
- <active translate="label">
1558
- <label>Enabled</label>
 
1559
  <frontend_type>select</frontend_type>
1560
  <source_model>adminhtml/system_config_source_yesno</source_model>
1561
- <sort_order>1</sort_order>
1562
  <show_in_default>1</show_in_default>
1563
  <show_in_website>1</show_in_website>
1564
  <show_in_store>0</show_in_store>
1565
- </active>
1566
- <title translate="label">
1567
- <label>Title</label>
1568
- <frontend_type>text</frontend_type>
1569
- <sort_order>10</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1570
  <show_in_default>1</show_in_default>
1571
  <show_in_website>1</show_in_website>
1572
  <show_in_store>1</show_in_store>
@@ -1588,9 +2687,7 @@
1588
  <show_in_default>1</show_in_default>
1589
  <show_in_website>1</show_in_website>
1590
  <show_in_store>1</show_in_store>
1591
- <depends>
1592
- <active>1</active>
1593
- </depends>
1594
  </delivery_date>
1595
  <rnp_fee translate="label">
1596
  <label>RNP Fee</label>
@@ -1600,9 +2697,7 @@
1600
  <show_in_default>1</show_in_default>
1601
  <show_in_website>1</show_in_website>
1602
  <show_in_store>1</show_in_store>
1603
- <depends>
1604
- <active>1</active>
1605
- </depends>
1606
  </rnp_fee>
1607
  <ecom_shipMethodType>
1608
  <label>Default Shipping Method Type</label>
@@ -1625,9 +2720,7 @@
1625
  <show_in_default>1</show_in_default>
1626
  <show_in_website>1</show_in_website>
1627
  <show_in_store>1</show_in_store>
1628
- <depends>
1629
- <active>1</active>
1630
- </depends>
1631
  </ecom_shipMethodSpeed>
1632
  <shiping_method_details>
1633
  <label>Default Shipping Method Details</label>
@@ -1637,15 +2730,54 @@
1637
  <show_in_default>1</show_in_default>
1638
  <show_in_website>1</show_in_website>
1639
  <show_in_store>1</show_in_store>
1640
- <depends>
1641
- <active>1</active>
1642
- </depends>
1643
  </shiping_method_details>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1644
  </fields>
1645
  </ops_kwixoCredit>
1646
  <ops_kwixoApresReception translate="label">
1647
  <label>PayEngine KwixoApresReception</label>
1648
- <sort_order>13</sort_order>
1649
  <show_in_default>1</show_in_default>
1650
  <show_in_website>1</show_in_website>
1651
  <show_in_store>1</show_in_store>
@@ -1693,9 +2825,7 @@
1693
  <show_in_default>1</show_in_default>
1694
  <show_in_website>1</show_in_website>
1695
  <show_in_store>1</show_in_store>
1696
- <depends>
1697
- <active>1</active>
1698
- </depends>
1699
  </delivery_date>
1700
  <rnp_fee translate="label">
1701
  <label>RNP Fee</label>
@@ -1705,9 +2835,7 @@
1705
  <show_in_default>1</show_in_default>
1706
  <show_in_website>1</show_in_website>
1707
  <show_in_store>1</show_in_store>
1708
- <depends>
1709
- <active>1</active>
1710
- </depends>
1711
  </rnp_fee>
1712
  <ecom_shipMethodType>
1713
  <label>Default Shipping Method Type</label>
@@ -1717,9 +2845,7 @@
1717
  <show_in_default>1</show_in_default>
1718
  <show_in_website>1</show_in_website>
1719
  <show_in_store>1</show_in_store>
1720
- <depends>
1721
- <active>1</active>
1722
- </depends>
1723
  </ecom_shipMethodType>
1724
  <ecom_shipMethodSpeed>
1725
  <label>Default Shipping Speed (in hours)</label>
@@ -1729,9 +2855,7 @@
1729
  <show_in_default>1</show_in_default>
1730
  <show_in_website>1</show_in_website>
1731
  <show_in_store>1</show_in_store>
1732
- <depends>
1733
- <active>1</active>
1734
- </depends>
1735
  </ecom_shipMethodSpeed>
1736
  <shiping_method_details>
1737
  <label>Default Shipping Method Details</label>
@@ -1741,15 +2865,54 @@
1741
  <show_in_default>1</show_in_default>
1742
  <show_in_website>1</show_in_website>
1743
  <show_in_store>1</show_in_store>
1744
- <depends>
1745
- <active>1</active>
1746
- </depends>
1747
  </shiping_method_details>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1748
  </fields>
1749
  </ops_kwixoApresReception>
1750
  <ops_kwixoComptant translate="label">
1751
  <label>PayEngine KwixoComptant</label>
1752
- <sort_order>13</sort_order>
1753
  <show_in_default>1</show_in_default>
1754
  <show_in_website>1</show_in_website>
1755
  <show_in_store>1</show_in_store>
@@ -1797,9 +2960,7 @@
1797
  <show_in_default>1</show_in_default>
1798
  <show_in_website>1</show_in_website>
1799
  <show_in_store>1</show_in_store>
1800
- <depends>
1801
- <active>1</active>
1802
- </depends>
1803
  </delivery_date>
1804
  <rnp_fee translate="label">
1805
  <label>RNP Fee</label>
@@ -1809,9 +2970,7 @@
1809
  <show_in_default>1</show_in_default>
1810
  <show_in_website>1</show_in_website>
1811
  <show_in_store>1</show_in_store>
1812
- <depends>
1813
- <active>1</active>
1814
- </depends>
1815
  </rnp_fee>
1816
  <ecom_shipMethodType>
1817
  <label>Default Shipping Method Type</label>
@@ -1822,9 +2981,7 @@
1822
  <show_in_default>1</show_in_default>
1823
  <show_in_website>1</show_in_website>
1824
  <show_in_store>1</show_in_store>
1825
- <depends>
1826
- <active>1</active>
1827
- </depends>
1828
  </ecom_shipMethodType>
1829
  <ecom_shipMethodSpeed>
1830
  <label>Default Shipping Speed (in hours)</label>
@@ -1834,9 +2991,7 @@
1834
  <show_in_default>1</show_in_default>
1835
  <show_in_website>1</show_in_website>
1836
  <show_in_store>1</show_in_store>
1837
- <depends>
1838
- <active>1</active>
1839
- </depends>
1840
  </ecom_shipMethodSpeed>
1841
  <shiping_method_details>
1842
  <label>Default Shipping Method Details</label>
@@ -1846,15 +3001,54 @@
1846
  <show_in_default>1</show_in_default>
1847
  <show_in_website>1</show_in_website>
1848
  <show_in_store>1</show_in_store>
1849
- <depends>
1850
- <active>1</active>
1851
- </depends>
1852
  </shiping_method_details>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1853
  </fields>
1854
  </ops_kwixoComptant>
1855
  <ops_opsid translate="label">
1856
  <label>Existing PayEngine Transaction</label>
1857
- <sort_order>14</sort_order>
1858
  <show_in_default>1</show_in_default>
1859
  <show_in_website>0</show_in_website>
1860
  <show_in_store>0</show_in_store>
@@ -1884,15 +3078,54 @@
1884
  <show_in_default>1</show_in_default>
1885
  <show_in_website>0</show_in_website>
1886
  <show_in_store>0</show_in_store>
1887
- <depends>
1888
- <active>1</active>
1889
- </depends>
1890
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1891
  </fields>
1892
  </ops_opsid>
1893
  <ops_flex translate="label comment">
1894
  <label>PayEngine Flex payment method</label>
1895
- <sort_order>15</sort_order>
1896
  <show_in_default>1</show_in_default>
1897
  <show_in_website>1</show_in_website>
1898
  <show_in_store>1</show_in_store>
@@ -1914,9 +3147,7 @@
1914
  <show_in_website>1</show_in_website>
1915
  <show_in_store>1</show_in_store>
1916
  <validate>required-entry</validate>
1917
- <depends>
1918
- <active>1</active>
1919
- </depends>
1920
  </title>
1921
  <sort_order translate="label">
1922
  <label>Sort Order</label>
@@ -1925,9 +3156,7 @@
1925
  <show_in_default>1</show_in_default>
1926
  <show_in_website>1</show_in_website>
1927
  <show_in_store>1</show_in_store>
1928
- <depends>
1929
- <active>1</active>
1930
- </depends>
1931
  </sort_order>
1932
  <default translate="label tooltip">
1933
  <label>Show empty default option</label>
@@ -1938,9 +3167,7 @@
1938
  <show_in_website>1</show_in_website>
1939
  <show_in_store>1</show_in_store>
1940
  <tooltip><![CDATA[A generic option, that lets the customer choose the exact method on PayEngine side.]]></tooltip>
1941
- <depends>
1942
- <active>1</active>
1943
- </depends>
1944
  </default>
1945
  <default_title translate="label comment">
1946
  <label>Default option title</label>
@@ -1951,9 +3178,7 @@
1951
  <show_in_store>1</show_in_store>
1952
  <validate>required-entry</validate>
1953
  <tooltip>Title to display for the default option.</tooltip>
1954
- <depends>
1955
- <default>1</default>
1956
- </depends>
1957
  </default_title>
1958
  <methods translate="label comment">
1959
  <label>Methods</label>
@@ -1964,15 +3189,54 @@
1964
  <show_in_website>1</show_in_website>
1965
  <show_in_store>1</show_in_store>
1966
  <comment>Add one or more methods. In field 'PM' you will have to enter the PM value you got from PayEngine, same goes for the field 'BRAND'.</comment>
1967
- <depends>
1968
- <active>1</active>
1969
- </depends>
1970
  </methods>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1971
  </fields>
1972
  </ops_flex>
1973
  <ops_chinaUnionPay translate="label">
1974
  <label>PayEngine ChinaUnionPay</label>
1975
- <sort_order>15</sort_order>
1976
  <show_in_default>1</show_in_default>
1977
  <show_in_website>1</show_in_website>
1978
  <show_in_store>1</show_in_store>
@@ -2004,11 +3268,52 @@
2004
  <show_in_website>1</show_in_website>
2005
  <show_in_store>1</show_in_store>
2006
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2007
  </fields>
2008
  </ops_chinaUnionPay>
2009
  <ops_recurring_cc translate="label">
2010
  <label>PayEngine Subscription Manager via Cc</label>
2011
- <sort_order>11</sort_order>
2012
  <show_in_default>1</show_in_default>
2013
  <show_in_website>1</show_in_website>
2014
  <show_in_store>1</show_in_store>
@@ -2026,16 +3331,14 @@
2026
  <show_in_store>1</show_in_store>
2027
  </active>
2028
  <acceptedTypes translate="label">
2029
- <label>Card Types</label>
2030
  <frontend_type>multiselect</frontend_type>
2031
  <sort_order>30</sort_order>
2032
  <source_model>ops/source_cc_recurringTypes</source_model>
2033
  <show_in_default>1</show_in_default>
2034
  <show_in_website>1</show_in_website>
2035
  <show_in_store>1</show_in_store>
2036
- <depends>
2037
- <active>1</active>
2038
- </depends>
2039
  </acceptedTypes>
2040
  <enabled_3dsecure translate="label tooltip">
2041
  <label>Enable 3D secure</label>
@@ -2046,40 +3349,34 @@
2046
  <show_in_default>1</show_in_default>
2047
  <show_in_website>1</show_in_website>
2048
  <show_in_store>0</show_in_store>
2049
- <depends>
2050
- <active>1</active>
2051
- </depends>
2052
  </enabled_3dsecure>
2053
- <allowspecific translate="label">
2054
- <label>Payment from Applicable Countries</label>
2055
- <frontend_type>allowspecific</frontend_type>
2056
- <sort_order>60</sort_order>
2057
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
 
 
2058
  <show_in_default>1</show_in_default>
2059
  <show_in_website>1</show_in_website>
2060
- <show_in_store>0</show_in_store>
2061
- <depends>
2062
- <active>1</active>
2063
- </depends>
2064
- </allowspecific>
2065
- <specificcountry translate="label">
2066
- <label>Payment from Specific Countries</label>
2067
- <frontend_type>multiselect</frontend_type>
2068
- <sort_order>61</sort_order>
2069
- <source_model>adminhtml/system_config_source_country</source_model>
2070
  <show_in_default>1</show_in_default>
2071
  <show_in_website>1</show_in_website>
2072
- <show_in_store>0</show_in_store>
2073
- <can_be_empty>1</can_be_empty>
2074
- <depends>
2075
- <active>1</active>
2076
- </depends>
2077
- </specificcountry>
2078
  </fields>
2079
  </ops_recurring_cc>
2080
  <ops_BCMC translate="label">
2081
  <label>PayEngine BCMC</label>
2082
- <sort_order>15</sort_order>
2083
  <show_in_default>1</show_in_default>
2084
  <show_in_website>1</show_in_website>
2085
  <show_in_store>1</show_in_store>
@@ -2109,25 +3406,52 @@
2109
  <show_in_website>1</show_in_website>
2110
  <show_in_store>1</show_in_store>
2111
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2112
  </fields>
2113
  </ops_BCMC>
2114
- <!-- hide old ogone extension which is part of Magento EE due to a misunderstanding -->
2115
- <pbridge_ogone_direct>
2116
- <show_in_default>0</show_in_default>
2117
- <show_in_website>0</show_in_website>
2118
- <show_in_store>0</show_in_store>
2119
- </pbridge_ogone_direct>
2120
- <ogone>
2121
- <show_in_default>0</show_in_default>
2122
- <show_in_website>0</show_in_website>
2123
- <show_in_store>0</show_in_store>
2124
- </ogone>
2125
- <ccsave>
2126
- <sort_order>27</sort_order>
2127
- </ccsave>
2128
- <ops_dc translate="label">
2129
- <label>PayEngine Dc</label>
2130
- <sort_order>11</sort_order>
2131
  <show_in_default>1</show_in_default>
2132
  <show_in_website>1</show_in_website>
2133
  <show_in_store>1</show_in_store>
@@ -2136,7 +3460,7 @@
2136
  <label>Enabled</label>
2137
  <frontend_type>select</frontend_type>
2138
  <source_model>adminhtml/system_config_source_yesno</source_model>
2139
- <sort_order>10</sort_order>
2140
  <show_in_default>1</show_in_default>
2141
  <show_in_website>1</show_in_website>
2142
  <show_in_store>0</show_in_store>
@@ -2144,11 +3468,14 @@
2144
  <title translate="label">
2145
  <label>Title</label>
2146
  <frontend_type>text</frontend_type>
2147
- <sort_order>11</sort_order>
2148
  <show_in_default>1</show_in_default>
2149
  <show_in_website>1</show_in_website>
2150
  <show_in_store>1</show_in_store>
2151
  <validate>required-entry</validate>
 
 
 
2152
  </title>
2153
  <sort_order translate="label">
2154
  <label>Sort Order</label>
@@ -2157,92 +3484,58 @@
2157
  <show_in_default>1</show_in_default>
2158
  <show_in_website>1</show_in_website>
2159
  <show_in_store>1</show_in_store>
2160
- </sort_order>
2161
- <types translate="label">
2162
- <label>Card Types</label>
2163
- <frontend_type>multiselect</frontend_type>
2164
- <sort_order>30</sort_order>
2165
- <source_model>ops/source_debitCard_types</source_model>
2166
- <show_in_default>1</show_in_default>
2167
- <show_in_website>1</show_in_website>
2168
- <show_in_store>1</show_in_store>
2169
- </types>
2170
- <redirect_all translate="label comment">
2171
- <label>Enable redirect payment for all card types</label>
2172
- <comment><![CDATA[If set to <em>Yes></em>, customers will be redirected to the external PayEngine payment page.]]></comment>
2173
- <frontend_type>select</frontend_type>
2174
- <source_model>adminhtml/system_config_source_yesno</source_model>
2175
- <sort_order>40</sort_order>
2176
- <show_in_default>1</show_in_default>
2177
- <show_in_website>1</show_in_website>
2178
- <show_in_store>1</show_in_store>
2179
- </redirect_all>
2180
- <inline_types translate="label tooltip">
2181
- <label>Enable inline payment for these card types</label>
2182
- <tooltip><![CDATA[For the selected card types, the customer can enter the credit card details directly in the checkout.]]></tooltip>
2183
- <frontend_type>multiselect</frontend_type>
2184
- <source_model>ops/source_debitCard_aliasInterfaceEnabledTypes</source_model>
2185
- <sort_order>41</sort_order>
2186
  <depends>
2187
- <redirect_all>0</redirect_all>
2188
  </depends>
2189
- <show_in_default>1</show_in_default>
2190
- <show_in_website>1</show_in_website>
2191
- <show_in_store>1</show_in_store>
2192
- </inline_types>
2193
- <enabled_3dsecure translate="label tooltip">
2194
- <label>Enable 3D secure</label>
2195
- <tooltip><![CDATA[If the customer's credit card supports 3D Secure, he will be redirected to an external page to enter his password.]]></tooltip>
2196
- <frontend_type>select</frontend_type>
2197
- <source_model>adminhtml/system_config_source_yesno</source_model>
2198
  <sort_order>50</sort_order>
 
2199
  <show_in_default>1</show_in_default>
2200
  <show_in_website>1</show_in_website>
2201
  <show_in_store>0</show_in_store>
2202
- </enabled_3dsecure>
2203
- <backend_enabled translate="label tooltip">
2204
- <label>Enable for backend</label>
2205
- <tooltip><![CDATA[This sets if this payment method should also be available for orders from the Magento backend.]]></tooltip>
2206
- <frontend_type>select</frontend_type>
2207
- <source_model>adminhtml/system_config_source_yesno</source_model>
2208
- <sort_order>100</sort_order>
2209
- <show_in_default>1</show_in_default>
2210
- <show_in_website>1</show_in_website>
2211
- <show_in_store>1</show_in_store>
2212
- </backend_enabled>
2213
- <active_alias translate="label">
2214
- <label>Enabled Alias Manager</label>
2215
- <frontend_type>select</frontend_type>
2216
- <source_model>adminhtml/system_config_source_yesno</source_model>
2217
- <sort_order>110</sort_order>
2218
- <show_in_default>1</show_in_default>
2219
- <show_in_website>1</show_in_website>
2220
- <show_in_store>1</show_in_store>
2221
- </active_alias>
2222
- <show_alias_manager_info_for_guests translate="label">
2223
- <label>Show Alias Manager information for guests</label>
2224
- <frontend_type>select</frontend_type>
2225
- <source_model>adminhtml/system_config_source_yesno</source_model>
2226
- <sort_order>120</sort_order>
2227
  <show_in_default>1</show_in_default>
2228
  <show_in_website>1</show_in_website>
2229
- <show_in_store>1</show_in_store>
2230
- <depends>
2231
- <active_alias>1</active_alias>
2232
- </depends>
2233
- </show_alias_manager_info_for_guests>
2234
- <zero_amount_checkout>
2235
- <label>Allow zero amount authorization</label>
2236
- <comment>Only if payment action is authorize.</comment>
2237
  <frontend_type>select</frontend_type>
2238
- <source_model>adminhtml/system_config_source_yesno</source_model>
2239
- <sort_order>130</sort_order>
2240
  <show_in_default>1</show_in_default>
2241
  <show_in_website>1</show_in_website>
2242
  <show_in_store>1</show_in_store>
2243
- </zero_amount_checkout>
 
2244
  </fields>
2245
- </ops_dc>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2246
  </groups>
2247
  </payment>
2248
  </sections>
93
  </secret_key_type>
94
  <secret_key_in translate="label comment tooltip">
95
  <label>SHA-IN Pass phrase</label>
96
+ <comment><![CDATA[Only alphanumeric characters, not longer than 20 characters. Refer to PayEngine's backend in section <em>Technical Information</em> on tab <em>Data and origin verification</em>.]]></comment>
97
  <tooltip><![CDATA[This must be identical to the value in the PayEngine backend in section <em>Technical information</em> on tab <em>Data and origin verification</em>.]]></tooltip>
98
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
99
  <frontend_type>obscure</frontend_type>
104
  </secret_key_in>
105
  <secret_key_out translate="label comment tooltip">
106
  <label>SHA-OUT Pass phrase</label>
107
+ <comment><![CDATA[Only alphanumeric characters, not longer than 20 characters. Refer to PayEngine's backend in section <em>Technical Information</em> on tab <em>Transaction feedback</em>.]]></comment>
108
  <tooltip><![CDATA[This must be identical to the value in the PayEngine backend in section <em>Technical information</em> on tab <em>Transaction feedback</em>.]]></tooltip>
109
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
110
  <frontend_type>obscure</frontend_type>
133
  <show_in_default>1</show_in_default>
134
  <show_in_website>1</show_in_website>
135
  <show_in_store>1</show_in_store>
136
+ <depends><mode>custom</mode></depends>
 
 
137
  </frontend_gateway>
138
  <ops_alias_gateway translate="label comment">
139
  <label>Alias Gateway URL</label>
140
  <frontend_type>text</frontend_type>
141
+ <comment><![CDATA[Test url example: https://payengine.test.v-psp.com/Tokenization/Hostedpage<br />Production url example: https://secure.payengine.de/Tokenization/HostedPage]]></comment>
142
  <sort_order>71</sort_order>
143
  <show_in_default>1</show_in_default>
144
  <show_in_website>1</show_in_website>
145
  <show_in_store>1</show_in_store>
146
+ <depends><mode>custom</mode></depends>
 
 
147
  </ops_alias_gateway>
148
  <directlink_gateway translate="label comment">
149
  <label>DirectLink Gateway URL</label>
153
  <show_in_default>1</show_in_default>
154
  <show_in_website>1</show_in_website>
155
  <show_in_store>1</show_in_store>
156
+ <depends><mode>custom</mode></depends>
 
 
157
  </directlink_gateway>
158
  <directlink_gateway_order translate="label comment">
159
  <label>DirectLink Gateway Order URL</label>
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
+ <depends><mode>custom</mode></depends>
 
 
167
  </directlink_gateway_order>
168
  <directlink_maintenance_api translate="label comment">
169
  <label>DirectLink Maintenance API URL</label>
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
+ <depends><mode>custom</mode></depends>
 
 
177
  </directlink_maintenance_api>
178
  <api_userid translate="label tooltip">
179
  <label>API User</label>
208
  <label>Send Invoice to Customer</label>
209
  <frontend_type>select</frontend_type>
210
  <source_model>adminhtml/system_config_source_yesno</source_model>
211
+ <depends><payment_action>authorize_capture</payment_action></depends>
 
 
212
  <sort_order>95</sort_order>
213
  <show_in_default>1</show_in_default>
214
  <show_in_website>1</show_in_website>
225
  <show_in_default>1</show_in_default>
226
  <show_in_website>1</show_in_website>
227
  <show_in_store>1</show_in_store>
228
+ <tooltip><![CDATA[For an easier PCI compliance we recommend redirect mode, iFrame mode or dynamic template with the template hosted on PayEngine servers. This does NOT affect the Hosted Tokenization iFrame (HTP).]]></tooltip>
229
  </template>
230
  <template_identifier translate="label comment">
231
  <label>Template Identifier/Url</label>
235
  <show_in_default>1</show_in_default>
236
  <show_in_website>1</show_in_website>
237
  <show_in_store>1</show_in_store>
238
+ <depends><template>ops_template</template></depends>
 
 
239
  <validate>required-entry</validate>
240
  </template_identifier>
241
  <html_title translate="label comment">
245
  <show_in_default>1</show_in_default>
246
  <show_in_website>1</show_in_website>
247
  <show_in_store>1</show_in_store>
248
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
249
  <validate>required-entry</validate>
250
  </html_title>
251
  <bgcolor translate="label comment">
256
  <show_in_default>1</show_in_default>
257
  <show_in_website>1</show_in_website>
258
  <show_in_store>1</show_in_store>
259
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
260
  <validate>required-entry</validate>
261
  </bgcolor>
262
  <txtcolor translate="label comment">
267
  <show_in_default>1</show_in_default>
268
  <show_in_website>1</show_in_website>
269
  <show_in_store>1</show_in_store>
270
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
271
  <validate>required-entry</validate>
272
  </txtcolor>
273
  <tblbgcolor translate="label comment">
278
  <show_in_default>1</show_in_default>
279
  <show_in_website>1</show_in_website>
280
  <show_in_store>1</show_in_store>
281
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
282
  <validate>required-entry</validate>
283
  </tblbgcolor>
284
  <tbltxtcolor translate="label comment">
289
  <show_in_default>1</show_in_default>
290
  <show_in_website>1</show_in_website>
291
  <show_in_store>1</show_in_store>
292
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
293
  <validate>required-entry</validate>
294
  </tbltxtcolor>
295
  <showcatalogbutton translate="label">
300
  <show_in_default>1</show_in_default>
301
  <show_in_website>1</show_in_website>
302
  <show_in_store>1</show_in_store>
303
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
304
  <validate>required-entry</validate>
305
  </showcatalogbutton>
306
  <showhomebutton translate="label">
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
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
315
  <validate>required-entry</validate>
316
  </showhomebutton>
317
  <buttonbgcolor translate="label">
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
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
325
  <validate>required-entry</validate>
326
  </buttonbgcolor>
327
  <buttontxtcolor translate="label comment">
332
  <show_in_default>1</show_in_default>
333
  <show_in_website>1</show_in_website>
334
  <show_in_store>1</show_in_store>
335
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
336
  <validate>required-entry</validate>
337
  </buttontxtcolor>
338
  <fonttype translate="label comment">
343
  <show_in_default>1</show_in_default>
344
  <show_in_website>1</show_in_website>
345
  <show_in_store>1</show_in_store>
346
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
347
  <validate>required-entry</validate>
348
  </fonttype>
349
  <logo translate="label comment">
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
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
358
  <validate>required-entry</validate>
359
  </logo>
360
  <pmlist translate="label comment">
361
  <label>Layout of Payment Methods</label>
362
+ <tooltip><![CDATA[Layout on the external payment page (for redirect payment methods).]]></tooltip>
363
  <frontend_type>select</frontend_type>
364
  <source_model>ops/source_pmlist</source_model>
365
  <sort_order>210</sort_order>
366
  <show_in_default>1</show_in_default>
367
  <show_in_website>1</show_in_website>
368
  <show_in_store>1</show_in_store>
369
+ <depends><template separator=",">ops,ops_iframe</template></depends>
 
 
370
  <validate>required-entry</validate>
371
  </pmlist>
372
  <redirectOrderReference translate="label comment">
373
  <label>Order reference in case of redirect payments</label>
374
+ <comment>See chapter 'Configuration', section 'Magento - Backend' in the documentation. Please note that the option 'orderId' is not used for the Kwixo payment methods.</comment>
375
  <frontend_type>select</frontend_type>
376
  <source_model>ops/source_orderReference</source_model>
377
  <sort_order>220</sort_order>
381
  </redirectOrderReference>
382
  <inlineOrderReference translate="label comment">
383
  <label>Order reference in case of inline payments</label>
384
+ <comment>See chapter 'Configuration', section 'Magento - Backend' in the documentation.</comment>
385
  <frontend_type>select</frontend_type>
386
  <source_model>ops/source_orderReference</source_model>
387
  <sort_order>221</sort_order>
442
  </device_fingerprinting>
443
  <ops_rtimeout translate="label tooltip comment">
444
  <label>Timeout for transactions</label>
445
+ <comment>This value specifies the request timeout for that transaction. A value between 30 and 60 seconds is possible.</comment>
446
  <frontend_type>text</frontend_type>
447
  <validate>validate-digits-range digits-range-30-60</validate>
448
  <sort_order>290</sort_order>
506
  </groups>
507
  </payment_services>
508
  <payment>
509
+ <frontend_model>ops/system_config_paymentForm</frontend_model>
510
  <groups>
 
511
  <ops_directDebit translate="label">
512
  <label>PayEngine DirectDebit</label>
513
+ <sort_order>40</sort_order>
514
  <show_in_default>1</show_in_default>
515
  <show_in_website>1</show_in_website>
516
  <show_in_store>1</show_in_store>
545
  <label>Countries</label>
546
  <frontend_type>multiselect</frontend_type>
547
  <validate>required-entry</validate>
548
+ <depends><active>1</active></depends>
 
 
549
  <sort_order>30</sort_order>
550
  <source_model>ops/source_directDebit_countries</source_model>
551
  <show_in_default>1</show_in_default>
552
  <show_in_website>1</show_in_website>
553
  <show_in_store>1</show_in_store>
554
  </countryIds>
555
+ <allowspecific translate="label">
556
+ <label>Payment from Applicable Countries</label>
557
+ <sort_order>40</sort_order>
558
+ <frontend_type>allowspecific</frontend_type>
559
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
560
+ <show_in_default>1</show_in_default>
561
+ <show_in_website>1</show_in_website>
562
+ <show_in_store>0</show_in_store>
563
+ </allowspecific>
564
+ <specificcountry translate="label">
565
+ <label>Payment from Specific Countries</label>
566
+ <sort_order>50</sort_order>
567
+ <frontend_type>multiselect</frontend_type>
568
+ <source_model>adminhtml/system_config_source_country</source_model>
569
+ <show_in_default>1</show_in_default>
570
+ <show_in_website>1</show_in_website>
571
+ <show_in_store>0</show_in_store>
572
+ <can_be_empty>1</can_be_empty>
573
+ <depends><allowspecific>1</allowspecific></depends>
574
+ </specificcountry>
575
+ <image translate="label comment">
576
+ <label>Payment Logo</label>
577
+ <sort_order>60</sort_order>
578
+ <frontend_type>paymentLogo</frontend_type>
579
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
580
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
581
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
582
+ <show_in_default>1</show_in_default>
583
+ <show_in_website>1</show_in_website>
584
+ <show_in_store>1</show_in_store>
585
+ <comment>Allowed file types: jpeg, gif, png.</comment>
586
+ </image>
587
+ <position translate="label">
588
+ <label>Payment Logo Visibility</label>
589
+ <sort_order>70</sort_order>
590
+ <frontend_type>select</frontend_type>
591
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
592
+ <show_in_default>1</show_in_default>
593
+ <show_in_website>1</show_in_website>
594
+ <show_in_store>1</show_in_store>
595
+ </position>
596
  <backend_enabled>
597
  <label>Enable for backend</label>
598
  <frontend_type>select</frontend_type>
602
  <show_in_website>1</show_in_website>
603
  <show_in_store>1</show_in_store>
604
  </backend_enabled>
605
+ <active_alias translate="label comment">
606
+ <label>Enabled Alias Manager</label>
607
+ <frontend_type>select</frontend_type>
608
+ <source_model>adminhtml/system_config_source_yesno</source_model>
609
+ <sort_order>110</sort_order>
610
+ <comment>If this option is enabled, the customer's alias data will be saved in the shop. The data can then be used again later if the buyer has stored them permanently on PayEngine side.</comment>
611
+ <show_in_default>1</show_in_default>
612
+ <show_in_website>1</show_in_website>
613
+ <show_in_store>1</show_in_store>
614
+ </active_alias>
615
  </fields>
616
  </ops_directDebit>
617
  <ops_postFinanceEFinance translate="label">
618
  <label>PayEngine PostFinanceEFinance</label>
619
+ <sort_order>50</sort_order>
620
  <show_in_default>1</show_in_default>
621
  <show_in_website>1</show_in_website>
622
  <show_in_store>1</show_in_store>
647
  <show_in_website>1</show_in_website>
648
  <show_in_store>1</show_in_store>
649
  </sort_order>
650
+ <allowspecific translate="label">
651
+ <label>Payment from Applicable Countries</label>
652
+ <frontend_type>allowspecific</frontend_type>
653
+ <sort_order>30</sort_order>
654
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
655
+ <show_in_default>1</show_in_default>
656
+ <show_in_website>1</show_in_website>
657
+ <show_in_store>0</show_in_store>
658
+ </allowspecific>
659
+ <specificcountry translate="label">
660
+ <label>Payment from Specific Countries</label>
661
+ <frontend_type>multiselect</frontend_type>
662
+ <sort_order>40</sort_order>
663
+ <source_model>adminhtml/system_config_source_country</source_model>
664
+ <show_in_default>1</show_in_default>
665
+ <show_in_website>1</show_in_website>
666
+ <show_in_store>0</show_in_store>
667
+ <can_be_empty>1</can_be_empty>
668
+ <depends><allowspecific>1</allowspecific></depends>
669
+ </specificcountry>
670
+ <image translate="label comment">
671
+ <label>Payment Logo</label>
672
+ <sort_order>50</sort_order>
673
+ <frontend_type>paymentLogo</frontend_type>
674
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
675
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
676
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
677
+ <show_in_default>1</show_in_default>
678
+ <show_in_website>1</show_in_website>
679
+ <show_in_store>1</show_in_store>
680
+ <comment>Allowed file types: jpeg, gif, png.</comment>
681
+ </image>
682
+ <position translate="label">
683
+ <label>Payment Logo Visibility</label>
684
+ <sort_order>60</sort_order>
685
+ <frontend_type>select</frontend_type>
686
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
687
+ <show_in_default>1</show_in_default>
688
+ <show_in_website>1</show_in_website>
689
+ <show_in_store>1</show_in_store>
690
+ </position>
691
  </fields>
692
  </ops_postFinanceEFinance>
693
  <ops_eDankort translate="label">
694
  <label>PayEngine EDankort</label>
695
+ <sort_order>60</sort_order>
696
  <show_in_default>1</show_in_default>
697
  <show_in_website>1</show_in_website>
698
  <show_in_store>1</show_in_store>
723
  <show_in_website>1</show_in_website>
724
  <show_in_store>1</show_in_store>
725
  </sort_order>
726
+ <allowspecific translate="label">
727
+ <label>Payment from Applicable Countries</label>
728
+ <frontend_type>allowspecific</frontend_type>
729
+ <sort_order>30</sort_order>
730
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
731
+ <show_in_default>1</show_in_default>
732
+ <show_in_website>1</show_in_website>
733
+ <show_in_store>0</show_in_store>
734
+ </allowspecific>
735
+ <specificcountry translate="label">
736
+ <label>Payment from Specific Countries</label>
737
+ <frontend_type>multiselect</frontend_type>
738
+ <sort_order>40</sort_order>
739
+ <source_model>adminhtml/system_config_source_country</source_model>
740
+ <show_in_default>1</show_in_default>
741
+ <show_in_website>1</show_in_website>
742
+ <show_in_store>0</show_in_store>
743
+ <can_be_empty>1</can_be_empty>
744
+ <depends><allowspecific>1</allowspecific></depends>
745
+ </specificcountry>
746
+ <image translate="label comment">
747
+ <label>Payment Logo</label>
748
+ <sort_order>50</sort_order>
749
+ <frontend_type>paymentLogo</frontend_type>
750
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
751
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
752
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
753
+ <show_in_default>1</show_in_default>
754
+ <show_in_website>1</show_in_website>
755
+ <show_in_store>1</show_in_store>
756
+ <comment>Allowed file types: jpeg, gif, png.</comment>
757
+ </image>
758
+ <position translate="label">
759
+ <label>Payment Logo Visibility</label>
760
+ <sort_order>60</sort_order>
761
+ <frontend_type>select</frontend_type>
762
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
763
+ <show_in_default>1</show_in_default>
764
+ <show_in_website>1</show_in_website>
765
+ <show_in_store>1</show_in_store>
766
+ </position>
767
  </fields>
768
  </ops_eDankort>
769
  <ops_kbcOnline translate="label">
770
  <label>PayEngine KbcOnline</label>
771
+ <sort_order>70</sort_order>
772
  <show_in_default>1</show_in_default>
773
  <show_in_website>1</show_in_website>
774
  <show_in_store>1</show_in_store>
799
  <show_in_website>1</show_in_website>
800
  <show_in_store>1</show_in_store>
801
  </sort_order>
802
+ <allowspecific translate="label">
803
+ <label>Payment from Applicable Countries</label>
804
+ <frontend_type>allowspecific</frontend_type>
805
+ <sort_order>30</sort_order>
806
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
807
+ <show_in_default>1</show_in_default>
808
+ <show_in_website>1</show_in_website>
809
+ <show_in_store>0</show_in_store>
810
+ </allowspecific>
811
+ <specificcountry translate="label">
812
+ <label>Payment from Specific Countries</label>
813
+ <frontend_type>multiselect</frontend_type>
814
+ <sort_order>40</sort_order>
815
+ <source_model>adminhtml/system_config_source_country</source_model>
816
+ <show_in_default>1</show_in_default>
817
+ <show_in_website>1</show_in_website>
818
+ <show_in_store>0</show_in_store>
819
+ <can_be_empty>1</can_be_empty>
820
+ <depends><allowspecific>1</allowspecific></depends>
821
+ </specificcountry>
822
+ <image translate="label comment">
823
+ <label>Payment Logo</label>
824
+ <sort_order>50</sort_order>
825
+ <frontend_type>paymentLogo</frontend_type>
826
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
827
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
828
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
829
+ <show_in_default>1</show_in_default>
830
+ <show_in_website>1</show_in_website>
831
+ <show_in_store>1</show_in_store>
832
+ <comment>Allowed file types: jpeg, gif, png.</comment>
833
+ </image>
834
+ <position translate="label">
835
+ <label>Payment Logo Visibility</label>
836
+ <sort_order>60</sort_order>
837
+ <frontend_type>select</frontend_type>
838
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
839
+ <show_in_default>1</show_in_default>
840
+ <show_in_website>1</show_in_website>
841
+ <show_in_store>1</show_in_store>
842
+ </position>
843
  </fields>
844
  </ops_kbcOnline>
845
  <ops_iDeal translate="label">
846
  <label>PayEngine iDEAL</label>
847
+ <sort_order>80</sort_order>
848
  <show_in_default>1</show_in_default>
849
  <show_in_website>1</show_in_website>
850
  <show_in_store>1</show_in_store>
875
  <show_in_website>1</show_in_website>
876
  <show_in_store>1</show_in_store>
877
  </sort_order>
878
+ <allowspecific translate="label">
879
+ <label>Payment from Applicable Countries</label>
880
+ <frontend_type>allowspecific</frontend_type>
881
+ <sort_order>30</sort_order>
882
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
883
+ <show_in_default>1</show_in_default>
884
+ <show_in_website>1</show_in_website>
885
+ <show_in_store>0</show_in_store>
886
+ </allowspecific>
887
+ <specificcountry translate="label">
888
+ <label>Payment from Specific Countries</label>
889
+ <frontend_type>multiselect</frontend_type>
890
+ <sort_order>40</sort_order>
891
+ <source_model>adminhtml/system_config_source_country</source_model>
892
+ <show_in_default>1</show_in_default>
893
+ <show_in_website>1</show_in_website>
894
+ <show_in_store>0</show_in_store>
895
+ <can_be_empty>1</can_be_empty>
896
+ <depends><allowspecific>1</allowspecific></depends>
897
+ </specificcountry>
898
+ <image translate="label comment">
899
+ <label>Payment Logo</label>
900
+ <sort_order>50</sort_order>
901
+ <frontend_type>paymentLogo</frontend_type>
902
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
903
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
904
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
905
+ <show_in_default>1</show_in_default>
906
+ <show_in_website>1</show_in_website>
907
+ <show_in_store>1</show_in_store>
908
+ <comment>Allowed file types: jpeg, gif, png.</comment>
909
+ </image>
910
+ <position translate="label">
911
+ <label>Payment Logo Visibility</label>
912
+ <sort_order>60</sort_order>
913
+ <frontend_type>select</frontend_type>
914
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
915
+ <show_in_default>1</show_in_default>
916
+ <show_in_website>1</show_in_website>
917
+ <show_in_store>1</show_in_store>
918
+ </position>
919
  </fields>
920
  </ops_iDeal>
921
  <ops_belfiusDirectNet translate="label">
922
  <label>PayEngine Belfius Direct Net</label>
923
+ <sort_order>90</sort_order>
924
  <show_in_default>1</show_in_default>
925
  <show_in_website>1</show_in_website>
926
  <show_in_store>1</show_in_store>
951
  <show_in_website>1</show_in_website>
952
  <show_in_store>1</show_in_store>
953
  </sort_order>
954
+ <allowspecific translate="label">
955
+ <label>Payment from Applicable Countries</label>
956
+ <frontend_type>allowspecific</frontend_type>
957
+ <sort_order>30</sort_order>
958
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
959
+ <show_in_default>1</show_in_default>
960
+ <show_in_website>1</show_in_website>
961
+ <show_in_store>0</show_in_store>
962
+ </allowspecific>
963
+ <specificcountry translate="label">
964
+ <label>Payment from Specific Countries</label>
965
+ <frontend_type>multiselect</frontend_type>
966
+ <sort_order>40</sort_order>
967
+ <source_model>adminhtml/system_config_source_country</source_model>
968
+ <show_in_default>1</show_in_default>
969
+ <show_in_website>1</show_in_website>
970
+ <show_in_store>0</show_in_store>
971
+ <can_be_empty>1</can_be_empty>
972
+ <depends><allowspecific>1</allowspecific></depends>
973
+ </specificcountry>
974
+ <image translate="label comment">
975
+ <label>Payment Logo</label>
976
+ <sort_order>50</sort_order>
977
+ <frontend_type>paymentLogo</frontend_type>
978
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
979
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
980
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
981
+ <show_in_default>1</show_in_default>
982
+ <show_in_website>1</show_in_website>
983
+ <show_in_store>1</show_in_store>
984
+ <comment>Allowed file types: jpeg, gif, png.</comment>
985
+ </image>
986
+ <position translate="label">
987
+ <label>Payment Logo Visibility</label>
988
+ <sort_order>60</sort_order>
989
+ <frontend_type>select</frontend_type>
990
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
991
+ <show_in_default>1</show_in_default>
992
+ <show_in_website>1</show_in_website>
993
+ <show_in_store>1</show_in_store>
994
+ </position>
995
  </fields>
996
  </ops_belfiusDirectNet>
997
  <ops_bankTransfer translate="label">
998
  <label>PayEngine BankTransfer</label>
999
+ <sort_order>100</sort_order>
1000
  <show_in_default>1</show_in_default>
1001
  <show_in_website>1</show_in_website>
1002
  <show_in_store>1</show_in_store>
1031
  <label>Countries</label>
1032
  <frontend_type>multiselect</frontend_type>
1033
  <validate>required-entry</validate>
1034
+ <depends><active>1</active></depends>
 
 
1035
  <sort_order>30</sort_order>
1036
  <source_model>ops/source_bankTransfer_countries</source_model>
1037
  <show_in_default>1</show_in_default>
1038
  <show_in_website>1</show_in_website>
1039
  <show_in_store>1</show_in_store>
1040
  </countryIds>
1041
+ <allowspecific translate="label">
1042
+ <label>Payment from Applicable Countries</label>
1043
+ <frontend_type>allowspecific</frontend_type>
1044
+ <sort_order>40</sort_order>
1045
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1046
+ <show_in_default>1</show_in_default>
1047
+ <show_in_website>1</show_in_website>
1048
+ <show_in_store>0</show_in_store>
1049
+ </allowspecific>
1050
+ <specificcountry translate="label">
1051
+ <label>Payment from Specific Countries</label>
1052
+ <frontend_type>multiselect</frontend_type>
1053
+ <sort_order>50</sort_order>
1054
+ <source_model>adminhtml/system_config_source_country</source_model>
1055
+ <show_in_default>1</show_in_default>
1056
+ <show_in_website>1</show_in_website>
1057
+ <show_in_store>0</show_in_store>
1058
+ <can_be_empty>1</can_be_empty>
1059
+ <depends><allowspecific>1</allowspecific></depends>
1060
+ </specificcountry>
1061
+ <image translate="label comment">
1062
+ <label>Payment Logo</label>
1063
+ <sort_order>60</sort_order>
1064
+ <frontend_type>paymentLogo</frontend_type>
1065
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1066
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1067
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1068
+ <show_in_default>1</show_in_default>
1069
+ <show_in_website>1</show_in_website>
1070
+ <show_in_store>1</show_in_store>
1071
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1072
+ </image>
1073
+ <position translate="label">
1074
+ <label>Payment Logo Visibility</label>
1075
+ <sort_order>70</sort_order>
1076
+ <frontend_type>select</frontend_type>
1077
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1078
+ <show_in_default>1</show_in_default>
1079
+ <show_in_website>1</show_in_website>
1080
+ <show_in_store>1</show_in_store>
1081
+ </position>
1082
  </fields>
1083
  </ops_bankTransfer>
1084
  <ops_openInvoiceDe translate="label">
1085
  <label>PayEngine Open Invoice DE</label>
1086
+ <sort_order>110</sort_order>
1087
  <show_in_default>1</show_in_default>
1088
  <show_in_website>1</show_in_website>
1089
  <show_in_store>1</show_in_store>
1125
  <show_in_website>1</show_in_website>
1126
  <show_in_store>1</show_in_store>
1127
  </sort_order>
1128
+ <image translate="label comment">
1129
+ <label>Payment Logo</label>
1130
+ <sort_order>30</sort_order>
1131
+ <frontend_type>paymentLogo</frontend_type>
1132
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1133
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1134
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1135
+ <show_in_default>1</show_in_default>
1136
+ <show_in_website>1</show_in_website>
1137
+ <show_in_store>1</show_in_store>
1138
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1139
+ </image>
1140
+ <position translate="label">
1141
+ <label>Payment Logo Visibility</label>
1142
+ <sort_order>40</sort_order>
1143
+ <frontend_type>select</frontend_type>
1144
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1145
+ <show_in_default>1</show_in_default>
1146
+ <show_in_website>1</show_in_website>
1147
+ <show_in_store>1</show_in_store>
1148
+ </position>
1149
+ <encoding translate="label comment tooltip">
1150
+ <label>Request Data Encoding</label>
1151
+ <sort_order>50</sort_order>
1152
+ <frontend_type>select</frontend_type>
1153
+ <source_model>ops/system_config_backend_encoding</source_model>
1154
+ <comment><![CDATA[When using Klarna as your aquirer you will need to switch to the option 'Other'.]]></comment>
1155
+ <tooltip><![CDATA[When the option 'Other' is selected the request data will get converted to ASCII chararcters by using the appropriate transliterations for the given locale of the store.]]></tooltip>
1156
+ <show_in_default>1</show_in_default>
1157
+ <show_in_website>1</show_in_website>
1158
+ <show_in_store>1</show_in_store>
1159
+ </encoding>
1160
+ <show_invoice_terms translate="label tooltip">
1161
+ <label>Show invoice terms link</label>
1162
+ <sort_order>60</sort_order>
1163
+ <frontend_type>select</frontend_type>
1164
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1165
+ <tooltip><![CDATA[Allows you to display a configurable link to your aquirers invoicing terms and conditions.]]></tooltip>
1166
+ <show_in_default>1</show_in_default>
1167
+ <show_in_website>1</show_in_website>
1168
+ <show_in_store>1</show_in_store>
1169
+ </show_invoice_terms>
1170
+ <invoice_terms_title translate="label">
1171
+ <label>Invoice terms title</label>
1172
+ <sort_order>61</sort_order>
1173
+ <frontend_type>text</frontend_type>
1174
+ <show_in_default>1</show_in_default>
1175
+ <show_in_website>1</show_in_website>
1176
+ <show_in_store>1</show_in_store>
1177
+ <depends>
1178
+ <show_invoice_terms>1</show_invoice_terms>
1179
+ </depends>
1180
+ <validate>required-entry</validate>
1181
+ </invoice_terms_title>
1182
+ <invoice_terms_url translate="label">
1183
+ <label>Invoice terms URL</label>
1184
+ <sort_order>62</sort_order>
1185
+ <frontend_type>text</frontend_type>
1186
+ <show_in_default>1</show_in_default>
1187
+ <show_in_website>1</show_in_website>
1188
+ <show_in_store>1</show_in_store>
1189
+ <depends>
1190
+ <show_invoice_terms>1</show_invoice_terms>
1191
+ </depends>
1192
+ <validate>required-entry</validate>
1193
+ </invoice_terms_url>
1194
+ </fields>
1195
+ </ops_openInvoiceDe>
1196
+ <ops_openInvoiceAt translate="label">
1197
+ <label>PayEngine Open Invoice AT</label>
1198
+ <sort_order>120</sort_order>
1199
+ <show_in_default>1</show_in_default>
1200
  <show_in_website>1</show_in_website>
1201
  <show_in_store>1</show_in_store>
1202
  <fields>
1237
  <show_in_website>1</show_in_website>
1238
  <show_in_store>1</show_in_store>
1239
  </sort_order>
1240
+ <image translate="label comment">
1241
+ <label>Payment Logo</label>
1242
+ <sort_order>30</sort_order>
1243
+ <frontend_type>paymentLogo</frontend_type>
1244
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1245
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1246
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1247
+ <show_in_default>1</show_in_default>
1248
+ <show_in_website>1</show_in_website>
1249
+ <show_in_store>1</show_in_store>
1250
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1251
+ </image>
1252
+ <position translate="label">
1253
+ <label>Payment Logo Visibility</label>
1254
+ <sort_order>40</sort_order>
1255
+ <frontend_type>select</frontend_type>
1256
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1257
+ <show_in_default>1</show_in_default>
1258
+ <show_in_website>1</show_in_website>
1259
+ <show_in_store>1</show_in_store>
1260
+ </position>
1261
+ <encoding translate="label comment tooltip">
1262
+ <label>Request Data Encoding</label>
1263
+ <sort_order>50</sort_order>
1264
+ <frontend_type>select</frontend_type>
1265
+ <source_model>ops/system_config_backend_encoding</source_model>
1266
+ <comment><![CDATA[When using Klarna as your aquirer you will need to switch to the option 'Other'.]]></comment>
1267
+ <tooltip><![CDATA[When the option 'Other' is selected the request data will get converted to ASCII chararcters by using the appropriate transliterations for the given locale of the store.]]></tooltip>
1268
+ <show_in_default>1</show_in_default>
1269
+ <show_in_website>1</show_in_website>
1270
+ <show_in_store>1</show_in_store>
1271
+ </encoding>
1272
+ <show_invoice_terms translate="label tooltip">
1273
+ <label>Show invoice terms link</label>
1274
+ <sort_order>60</sort_order>
1275
+ <frontend_type>select</frontend_type>
1276
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1277
+ <tooltip><![CDATA[Allows you to display a configurable link to your aquirers invoicing terms and conditions.]]></tooltip>
1278
+ <show_in_default>1</show_in_default>
1279
+ <show_in_website>1</show_in_website>
1280
+ <show_in_store>1</show_in_store>
1281
+ </show_invoice_terms>
1282
+ <invoice_terms_title translate="label">
1283
+ <label>Invoice terms title</label>
1284
+ <sort_order>61</sort_order>
1285
+ <frontend_type>text</frontend_type>
1286
+ <show_in_default>1</show_in_default>
1287
+ <show_in_website>1</show_in_website>
1288
+ <show_in_store>1</show_in_store>
1289
+ <depends>
1290
+ <show_invoice_terms>1</show_invoice_terms>
1291
+ </depends>
1292
+ <validate>required-entry</validate>
1293
+ </invoice_terms_title>
1294
+ <invoice_terms_url translate="label">
1295
+ <label>Invoice terms URL</label>
1296
+ <sort_order>62</sort_order>
1297
+ <frontend_type>text</frontend_type>
1298
+ <show_in_default>1</show_in_default>
1299
+ <show_in_website>1</show_in_website>
1300
+ <show_in_store>1</show_in_store>
1301
+ <depends>
1302
+ <show_invoice_terms>1</show_invoice_terms>
1303
+ </depends>
1304
+ <validate>required-entry</validate>
1305
+ </invoice_terms_url>
1306
  </fields>
1307
  </ops_openInvoiceAt>
1308
  <ops_openInvoiceNl translate="label">
1309
  <label>PayEngine Open Invoice NL</label>
1310
+ <sort_order>130</sort_order>
1311
  <show_in_default>1</show_in_default>
1312
  <show_in_website>1</show_in_website>
1313
  <show_in_store>1</show_in_store>
1339
  <show_in_website>1</show_in_website>
1340
  <show_in_store>1</show_in_store>
1341
  </sort_order>
1342
+ <image translate="label comment">
1343
+ <label>Payment Logo</label>
1344
+ <sort_order>30</sort_order>
1345
+ <frontend_type>paymentLogo</frontend_type>
1346
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1347
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1348
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1349
+ <show_in_default>1</show_in_default>
1350
+ <show_in_website>1</show_in_website>
1351
+ <show_in_store>1</show_in_store>
1352
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1353
+ </image>
1354
+ <position translate="label">
1355
+ <label>Payment Logo Visibility</label>
1356
+ <sort_order>40</sort_order>
1357
+ <frontend_type>select</frontend_type>
1358
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1359
+ <show_in_default>1</show_in_default>
1360
+ <show_in_website>1</show_in_website>
1361
+ <show_in_store>1</show_in_store>
1362
+ </position>
1363
+ <encoding translate="label comment tooltip">
1364
+ <label>Request Data Encoding</label>
1365
+ <sort_order>50</sort_order>
1366
+ <frontend_type>select</frontend_type>
1367
+ <source_model>ops/system_config_backend_encoding</source_model>
1368
+ <comment><![CDATA[When using Klarna as your aquirer you will need to switch to the option 'Other'.]]></comment>
1369
+ <tooltip><![CDATA[When the option 'Other' is selected the request data will get converted to ASCII chararcters by using the appropriate transliterations for the given locale of the store.]]></tooltip>
1370
+ <show_in_default>1</show_in_default>
1371
+ <show_in_website>1</show_in_website>
1372
+ <show_in_store>1</show_in_store>
1373
+ </encoding>
1374
+ <show_invoice_terms translate="label tooltip">
1375
+ <label>Show invoice terms link</label>
1376
+ <sort_order>60</sort_order>
1377
+ <frontend_type>select</frontend_type>
1378
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1379
+ <show_in_default>1</show_in_default>
1380
+ <show_in_website>1</show_in_website>
1381
+ <show_in_store>1</show_in_store>
1382
+ <tooltip><![CDATA[Allows you to display a configurable link to your aquirers invoicing terms and conditions.]]></tooltip>
1383
+ </show_invoice_terms>
1384
+ <invoice_terms_title translate="label">
1385
+ <label>Invoice terms title</label>
1386
+ <sort_order>61</sort_order>
1387
+ <frontend_type>text</frontend_type>
1388
+ <show_in_default>1</show_in_default>
1389
+ <show_in_website>1</show_in_website>
1390
+ <show_in_store>1</show_in_store>
1391
+ <depends>
1392
+ <show_invoice_terms>1</show_invoice_terms>
1393
+ </depends>
1394
+ <validate>required-entry</validate>
1395
+ </invoice_terms_title>
1396
+ <invoice_terms_url translate="label">
1397
+ <label>Invoice terms URL</label>
1398
+ <sort_order>62</sort_order>
1399
+ <frontend_type>text</frontend_type>
1400
+ <show_in_default>1</show_in_default>
1401
+ <show_in_website>1</show_in_website>
1402
+ <show_in_store>1</show_in_store>
1403
+ <depends>
1404
+ <show_invoice_terms>1</show_invoice_terms>
1405
+ </depends>
1406
+ <validate>required-entry</validate>
1407
+ </invoice_terms_url>
1408
  </fields>
1409
  </ops_openInvoiceNl>
1410
  <ops_cbcOnline translate="label">
1411
  <label>PayEngine CbcOnline</label>
1412
+ <sort_order>140</sort_order>
1413
  <show_in_default>1</show_in_default>
1414
  <show_in_website>1</show_in_website>
1415
  <show_in_store>1</show_in_store>
1440
  <show_in_website>1</show_in_website>
1441
  <show_in_store>1</show_in_store>
1442
  </sort_order>
1443
+ <allowspecific translate="label">
1444
+ <label>Payment from Applicable Countries</label>
1445
+ <frontend_type>allowspecific</frontend_type>
1446
+ <sort_order>30</sort_order>
1447
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1448
+ <show_in_default>1</show_in_default>
1449
+ <show_in_website>1</show_in_website>
1450
+ <show_in_store>0</show_in_store>
1451
+ </allowspecific>
1452
+ <specificcountry translate="label">
1453
+ <label>Payment from Specific Countries</label>
1454
+ <frontend_type>multiselect</frontend_type>
1455
+ <sort_order>40</sort_order>
1456
+ <source_model>adminhtml/system_config_source_country</source_model>
1457
+ <show_in_default>1</show_in_default>
1458
+ <show_in_website>1</show_in_website>
1459
+ <show_in_store>0</show_in_store>
1460
+ <can_be_empty>1</can_be_empty>
1461
+ <depends><allowspecific>1</allowspecific></depends>
1462
+ </specificcountry>
1463
+ <image translate="label comment">
1464
+ <label>Payment Logo</label>
1465
+ <sort_order>50</sort_order>
1466
+ <frontend_type>paymentLogo</frontend_type>
1467
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1468
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1469
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1470
+ <show_in_default>1</show_in_default>
1471
+ <show_in_website>1</show_in_website>
1472
+ <show_in_store>1</show_in_store>
1473
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1474
+ </image>
1475
+ <position translate="label">
1476
+ <label>Payment Logo Visibility</label>
1477
+ <sort_order>60</sort_order>
1478
+ <frontend_type>select</frontend_type>
1479
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1480
+ <show_in_default>1</show_in_default>
1481
+ <show_in_website>1</show_in_website>
1482
+ <show_in_store>1</show_in_store>
1483
+ </position>
1484
  </fields>
1485
  </ops_cbcOnline>
1486
  <ops_giroPay translate="label">
1487
  <label>PayEngine GiroPay</label>
1488
+ <sort_order>150</sort_order>
1489
  <show_in_default>1</show_in_default>
1490
  <show_in_website>1</show_in_website>
1491
  <show_in_store>1</show_in_store>
1516
  <show_in_website>1</show_in_website>
1517
  <show_in_store>1</show_in_store>
1518
  </sort_order>
1519
+ <allowspecific translate="label">
1520
+ <label>Payment from Applicable Countries</label>
1521
+ <frontend_type>allowspecific</frontend_type>
1522
+ <sort_order>30</sort_order>
1523
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1524
+ <show_in_default>1</show_in_default>
1525
+ <show_in_website>1</show_in_website>
1526
+ <show_in_store>0</show_in_store>
1527
+ </allowspecific>
1528
+ <specificcountry translate="label">
1529
+ <label>Payment from Specific Countries</label>
1530
+ <frontend_type>multiselect</frontend_type>
1531
+ <sort_order>40</sort_order>
1532
+ <source_model>adminhtml/system_config_source_country</source_model>
1533
+ <show_in_default>1</show_in_default>
1534
+ <show_in_website>1</show_in_website>
1535
+ <show_in_store>0</show_in_store>
1536
+ <can_be_empty>1</can_be_empty>
1537
+ <depends><allowspecific>1</allowspecific></depends>
1538
+ </specificcountry>
1539
+ <image translate="label comment">
1540
+ <label>Payment Logo</label>
1541
+ <sort_order>50</sort_order>
1542
+ <frontend_type>paymentLogo</frontend_type>
1543
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1544
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1545
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1546
+ <show_in_default>1</show_in_default>
1547
+ <show_in_website>1</show_in_website>
1548
+ <show_in_store>1</show_in_store>
1549
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1550
+ </image>
1551
+ <position translate="label">
1552
+ <label>Payment Logo Visibility</label>
1553
+ <sort_order>60</sort_order>
1554
+ <frontend_type>select</frontend_type>
1555
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1556
+ <show_in_default>1</show_in_default>
1557
+ <show_in_website>1</show_in_website>
1558
+ <show_in_store>1</show_in_store>
1559
+ </position>
1560
  </fields>
1561
  </ops_giroPay>
1562
  <ops_Masterpass translate="label">
1563
  <label>PayEngine Masterpass</label>
1564
+ <sort_order>160</sort_order>
1565
  <show_in_default>1</show_in_default>
1566
  <show_in_website>1</show_in_website>
1567
  <show_in_store>1</show_in_store>
1592
  <show_in_website>1</show_in_website>
1593
  <show_in_store>1</show_in_store>
1594
  </sort_order>
1595
+ <allowspecific translate="label">
1596
+ <label>Payment from Applicable Countries</label>
1597
+ <frontend_type>allowspecific</frontend_type>
1598
+ <sort_order>30</sort_order>
1599
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1600
+ <show_in_default>1</show_in_default>
1601
+ <show_in_website>1</show_in_website>
1602
+ <show_in_store>0</show_in_store>
1603
+ </allowspecific>
1604
+ <specificcountry translate="label">
1605
+ <label>Payment from Specific Countries</label>
1606
+ <frontend_type>multiselect</frontend_type>
1607
+ <sort_order>40</sort_order>
1608
+ <source_model>adminhtml/system_config_source_country</source_model>
1609
+ <show_in_default>1</show_in_default>
1610
+ <show_in_website>1</show_in_website>
1611
+ <show_in_store>0</show_in_store>
1612
+ <can_be_empty>1</can_be_empty>
1613
+ <depends><allowspecific>1</allowspecific></depends>
1614
+ </specificcountry>
1615
+ <image translate="label comment">
1616
+ <label>Payment Logo</label>
1617
+ <sort_order>50</sort_order>
1618
+ <frontend_type>paymentLogo</frontend_type>
1619
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1620
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1621
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1622
+ <show_in_default>1</show_in_default>
1623
+ <show_in_website>1</show_in_website>
1624
+ <show_in_store>1</show_in_store>
1625
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1626
+ </image>
1627
+ <position translate="label">
1628
+ <label>Payment Logo Visibility</label>
1629
+ <sort_order>60</sort_order>
1630
+ <frontend_type>select</frontend_type>
1631
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1632
+ <show_in_default>1</show_in_default>
1633
+ <show_in_website>1</show_in_website>
1634
+ <show_in_store>1</show_in_store>
1635
+ </position>
1636
  </fields>
1637
  </ops_Masterpass>
1638
  <ops_interSolve translate="label">
1639
  <label>PayEngine InterSolve</label>
1640
+ <sort_order>170</sort_order>
1641
  <show_in_default>1</show_in_default>
1642
  <show_in_website>1</show_in_website>
1643
+ <show_in_store>1</show_in_store>fkbc
1644
  <fields>
1645
  <active translate="label">
1646
  <label>Enabled</label>
1668
  <show_in_website>1</show_in_website>
1669
  <show_in_store>1</show_in_store>
1670
  </sort_order>
1671
+ <allowspecific translate="label">
1672
+ <label>Payment from Applicable Countries</label>
1673
+ <frontend_type>allowspecific</frontend_type>
1674
+ <sort_order>30</sort_order>
1675
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1676
+ <show_in_default>1</show_in_default>
1677
+ <show_in_website>1</show_in_website>
1678
+ <show_in_store>0</show_in_store>
1679
+ </allowspecific>
1680
+ <specificcountry translate="label">
1681
+ <label>Payment from Specific Countries</label>
1682
+ <frontend_type>multiselect</frontend_type>
1683
+ <sort_order>40</sort_order>
1684
+ <source_model>adminhtml/system_config_source_country</source_model>
1685
+ <show_in_default>1</show_in_default>
1686
+ <show_in_website>1</show_in_website>
1687
+ <show_in_store>0</show_in_store>
1688
+ <can_be_empty>1</can_be_empty>
1689
+ <depends><allowspecific>1</allowspecific></depends>
1690
+ </specificcountry>
1691
+ <image translate="label comment">
1692
+ <label>Payment Logo</label>
1693
+ <sort_order>50</sort_order>
1694
+ <frontend_type>paymentLogo</frontend_type>
1695
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1696
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1697
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1698
+ <show_in_default>1</show_in_default>
1699
+ <show_in_website>1</show_in_website>
1700
+ <show_in_store>1</show_in_store>
1701
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1702
+ </image>
1703
+ <position translate="label">
1704
+ <label>Payment Logo Visibility</label>
1705
+ <sort_order>60</sort_order>
1706
+ <frontend_type>select</frontend_type>
1707
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1708
+ <show_in_default>1</show_in_default>
1709
+ <show_in_website>1</show_in_website>
1710
+ <show_in_store>1</show_in_store>
1711
+ </position>
1712
  <brands translate="label comment">
1713
  <label>Brand</label>
1714
  <frontend_model>ops/system_config_form_field_brand</frontend_model>
1715
  <backend_model>ops/system_config_backend_intersolve_brands</backend_model>
1716
+ <sort_order>70</sort_order>
1717
  <show_in_default>1</show_in_default>
1718
  <show_in_website>1</show_in_website>
1719
  <show_in_store>1</show_in_store>
1723
  </ops_interSolve>
1724
  <ops_cashU translate="label">
1725
  <label>PayEngine CashU</label>
1726
+ <sort_order>180</sort_order>
1727
  <show_in_default>1</show_in_default>
1728
  <show_in_website>1</show_in_website>
1729
  <show_in_store>1</show_in_store>
1754
  <show_in_website>1</show_in_website>
1755
  <show_in_store>1</show_in_store>
1756
  </sort_order>
1757
+ <allowspecific translate="label">
1758
+ <label>Payment from Applicable Countries</label>
1759
+ <frontend_type>allowspecific</frontend_type>
1760
+ <sort_order>30</sort_order>
1761
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1762
+ <show_in_default>1</show_in_default>
1763
+ <show_in_website>1</show_in_website>
1764
+ <show_in_store>0</show_in_store>
1765
+ </allowspecific>
1766
+ <specificcountry translate="label">
1767
+ <label>Payment from Specific Countries</label>
1768
+ <frontend_type>multiselect</frontend_type>
1769
+ <sort_order>40</sort_order>
1770
+ <source_model>adminhtml/system_config_source_country</source_model>
1771
+ <show_in_default>1</show_in_default>
1772
+ <show_in_website>1</show_in_website>
1773
+ <show_in_store>0</show_in_store>
1774
+ <can_be_empty>1</can_be_empty>
1775
+ <depends><allowspecific>1</allowspecific></depends>
1776
+ </specificcountry>
1777
+ <image translate="label comment">
1778
+ <label>Payment Logo</label>
1779
+ <sort_order>50</sort_order>
1780
+ <frontend_type>paymentLogo</frontend_type>
1781
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1782
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1783
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1784
+ <show_in_default>1</show_in_default>
1785
+ <show_in_website>1</show_in_website>
1786
+ <show_in_store>1</show_in_store>
1787
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1788
+ </image>
1789
+ <position translate="label">
1790
+ <label>Payment Logo Visibility</label>
1791
+ <sort_order>60</sort_order>
1792
+ <frontend_type>select</frontend_type>
1793
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1794
+ <show_in_default>1</show_in_default>
1795
+ <show_in_website>1</show_in_website>
1796
+ <show_in_store>1</show_in_store>
1797
+ </position>
1798
  </fields>
1799
  </ops_cashU>
1800
+ <ops_paypal translate="label">
1801
+ <label>PayEngine Paypal</label>
1802
+ <sort_order>200</sort_order>
1803
  <show_in_default>1</show_in_default>
1804
  <show_in_website>1</show_in_website>
1805
  <show_in_store>1</show_in_store>
1830
  <show_in_website>1</show_in_website>
1831
  <show_in_store>1</show_in_store>
1832
  </sort_order>
1833
+ <allowspecific translate="label">
1834
+ <label>Payment from Applicable Countries</label>
1835
+ <frontend_type>allowspecific</frontend_type>
1836
+ <sort_order>30</sort_order>
1837
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
 
 
 
 
 
 
 
 
 
1838
  <show_in_default>1</show_in_default>
1839
  <show_in_website>1</show_in_website>
1840
  <show_in_store>0</show_in_store>
1841
+ </allowspecific>
1842
+ <specificcountry translate="label">
1843
+ <label>Payment from Specific Countries</label>
1844
+ <frontend_type>multiselect</frontend_type>
1845
+ <sort_order>40</sort_order>
1846
+ <source_model>adminhtml/system_config_source_country</source_model>
1847
+ <show_in_default>1</show_in_default>
1848
+ <show_in_website>1</show_in_website>
1849
+ <show_in_store>0</show_in_store>
1850
+ <can_be_empty>1</can_be_empty>
1851
+ <depends><allowspecific>1</allowspecific></depends>
1852
+ </specificcountry>
1853
+ <image translate="label comment">
1854
+ <label>Payment Logo</label>
1855
+ <sort_order>50</sort_order>
1856
+ <frontend_type>paymentLogo</frontend_type>
1857
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1858
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1859
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1860
  <show_in_default>1</show_in_default>
1861
  <show_in_website>1</show_in_website>
1862
  <show_in_store>1</show_in_store>
1863
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1864
+ </image>
1865
+ <position translate="label">
1866
+ <label>Payment Logo Visibility</label>
1867
+ <sort_order>60</sort_order>
1868
+ <frontend_type>select</frontend_type>
1869
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1870
  <show_in_default>1</show_in_default>
1871
  <show_in_website>1</show_in_website>
1872
  <show_in_store>1</show_in_store>
1873
+ </position>
1874
  </fields>
1875
  </ops_paypal>
1876
  <ops_eps translate="label">
1877
  <label>PayEngine Eps</label>
1878
+ <sort_order>210</sort_order>
1879
  <show_in_default>1</show_in_default>
1880
  <show_in_website>1</show_in_website>
1881
  <show_in_store>1</show_in_store>
1906
  <show_in_website>1</show_in_website>
1907
  <show_in_store>1</show_in_store>
1908
  </sort_order>
1909
+ <allowspecific translate="label">
1910
+ <label>Payment from Applicable Countries</label>
1911
+ <frontend_type>allowspecific</frontend_type>
1912
+ <sort_order>30</sort_order>
1913
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1914
+ <show_in_default>1</show_in_default>
1915
+ <show_in_website>1</show_in_website>
1916
+ <show_in_store>0</show_in_store>
1917
+ </allowspecific>
1918
+ <specificcountry translate="label">
1919
+ <label>Payment from Specific Countries</label>
1920
+ <frontend_type>multiselect</frontend_type>
1921
+ <sort_order>40</sort_order>
1922
+ <source_model>adminhtml/system_config_source_country</source_model>
1923
+ <show_in_default>1</show_in_default>
1924
+ <show_in_website>1</show_in_website>
1925
+ <show_in_store>0</show_in_store>
1926
+ <can_be_empty>1</can_be_empty>
1927
+ <depends><allowspecific>1</allowspecific></depends>
1928
+ </specificcountry>
1929
+ <image translate="label comment">
1930
+ <label>Payment Logo</label>
1931
+ <sort_order>50</sort_order>
1932
+ <frontend_type>paymentLogo</frontend_type>
1933
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
1934
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
1935
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
1936
+ <show_in_default>1</show_in_default>
1937
+ <show_in_website>1</show_in_website>
1938
+ <show_in_store>1</show_in_store>
1939
+ <comment>Allowed file types: jpeg, gif, png.</comment>
1940
+ </image>
1941
+ <position translate="label">
1942
+ <label>Payment Logo Visibility</label>
1943
+ <sort_order>60</sort_order>
1944
+ <frontend_type>select</frontend_type>
1945
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
1946
+ <show_in_default>1</show_in_default>
1947
+ <show_in_website>1</show_in_website>
1948
+ <show_in_store>1</show_in_store>
1949
+ </position>
1950
  </fields>
1951
  </ops_eps>
1952
  <ops_pingPing translate="label">
1953
  <label>PayEngine PingPing</label>
1954
+ <sort_order>220</sort_order>
1955
  <show_in_default>1</show_in_default>
1956
  <show_in_website>1</show_in_website>
1957
  <show_in_store>1</show_in_store>
1982
  <show_in_website>1</show_in_website>
1983
  <show_in_store>1</show_in_store>
1984
  </sort_order>
1985
+ <allowspecific translate="label">
1986
+ <label>Payment from Applicable Countries</label>
1987
+ <frontend_type>allowspecific</frontend_type>
1988
+ <sort_order>30</sort_order>
1989
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1990
+ <show_in_default>1</show_in_default>
1991
+ <show_in_website>1</show_in_website>
1992
+ <show_in_store>0</show_in_store>
1993
+ </allowspecific>
1994
+ <specificcountry translate="label">
1995
+ <label>Payment from Specific Countries</label>
1996
+ <frontend_type>multiselect</frontend_type>
1997
+ <sort_order>40</sort_order>
1998
+ <source_model>adminhtml/system_config_source_country</source_model>
1999
+ <show_in_default>1</show_in_default>
2000
+ <show_in_website>1</show_in_website>
2001
+ <show_in_store>0</show_in_store>
2002
+ <can_be_empty>1</can_be_empty>
2003
+ <depends><allowspecific>1</allowspecific></depends>
2004
+ </specificcountry>
2005
+ <image translate="label comment">
2006
+ <label>Payment Logo</label>
2007
+ <sort_order>50</sort_order>
2008
+ <frontend_type>paymentLogo</frontend_type>
2009
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2010
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2011
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2012
+ <show_in_default>1</show_in_default>
2013
+ <show_in_website>1</show_in_website>
2014
+ <show_in_store>1</show_in_store>
2015
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2016
+ </image>
2017
+ <position translate="label">
2018
+ <label>Payment Logo Visibility</label>
2019
+ <sort_order>60</sort_order>
2020
+ <frontend_type>select</frontend_type>
2021
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2022
+ <show_in_default>1</show_in_default>
2023
+ <show_in_website>1</show_in_website>
2024
+ <show_in_store>1</show_in_store>
2025
+ </position>
2026
  </fields>
2027
  </ops_pingPing>
2028
  <ops_fortisPayButton translate="label">
2029
  <label>PayEngine FortisPayButton</label>
2030
+ <sort_order>230</sort_order>
2031
  <show_in_default>1</show_in_default>
2032
  <show_in_website>1</show_in_website>
2033
  <show_in_store>1</show_in_store>
2058
  <show_in_website>1</show_in_website>
2059
  <show_in_store>1</show_in_store>
2060
  </sort_order>
2061
+ <allowspecific translate="label">
2062
+ <label>Payment from Applicable Countries</label>
2063
+ <frontend_type>allowspecific</frontend_type>
2064
+ <sort_order>30</sort_order>
2065
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2066
+ <show_in_default>1</show_in_default>
2067
+ <show_in_website>1</show_in_website>
2068
+ <show_in_store>0</show_in_store>
2069
+ </allowspecific>
2070
+ <specificcountry translate="label">
2071
+ <label>Payment from Specific Countries</label>
2072
+ <frontend_type>multiselect</frontend_type>
2073
+ <sort_order>40</sort_order>
2074
+ <source_model>adminhtml/system_config_source_country</source_model>
2075
+ <show_in_default>1</show_in_default>
2076
+ <show_in_website>1</show_in_website>
2077
+ <show_in_store>0</show_in_store>
2078
+ <can_be_empty>1</can_be_empty>
2079
+ <depends><allowspecific>1</allowspecific></depends>
2080
+ </specificcountry>
2081
+ <image translate="label comment">
2082
+ <label>Payment Logo</label>
2083
+ <sort_order>50</sort_order>
2084
+ <frontend_type>paymentLogo</frontend_type>
2085
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2086
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2087
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2088
+ <show_in_default>1</show_in_default>
2089
+ <show_in_website>1</show_in_website>
2090
+ <show_in_store>1</show_in_store>
2091
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2092
+ </image>
2093
+ <position translate="label">
2094
+ <label>Payment Logo Visibility</label>
2095
+ <sort_order>60</sort_order>
2096
+ <frontend_type>select</frontend_type>
2097
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2098
+ <show_in_default>1</show_in_default>
2099
+ <show_in_website>1</show_in_website>
2100
+ <show_in_store>1</show_in_store>
2101
+ </position>
2102
  </fields>
2103
  </ops_fortisPayButton>
2104
  <ops_directEbanking translate="label">
2105
  <label>PayEngineSofortÜberweisung</label>
2106
+ <sort_order>240</sort_order>
2107
  <show_in_default>1</show_in_default>
2108
  <show_in_website>1</show_in_website>
2109
  <show_in_store>1</show_in_store>
2130
  <label>Brands</label>
2131
  <frontend_type>multiselect</frontend_type>
2132
  <validate>required-entry</validate>
2133
+ <depends><active>1</active></depends>
 
 
2134
  <sort_order>20</sort_order>
2135
  <source_model>ops/source_directEbanking_brands</source_model>
2136
  <show_in_default>1</show_in_default>
2145
  <show_in_website>1</show_in_website>
2146
  <show_in_store>1</show_in_store>
2147
  </sort_order>
2148
+ <allowspecific translate="label">
2149
+ <label>Payment from Applicable Countries</label>
2150
+ <frontend_type>allowspecific</frontend_type>
2151
+ <sort_order>40</sort_order>
2152
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2153
+ <show_in_default>1</show_in_default>
2154
+ <show_in_website>1</show_in_website>
2155
+ <show_in_store>0</show_in_store>
2156
+ </allowspecific>
2157
+ <specificcountry translate="label">
2158
+ <label>Payment from Specific Countries</label>
2159
+ <frontend_type>multiselect</frontend_type>
2160
+ <sort_order>50</sort_order>
2161
+ <source_model>adminhtml/system_config_source_country</source_model>
2162
+ <show_in_default>1</show_in_default>
2163
+ <show_in_website>1</show_in_website>
2164
+ <show_in_store>0</show_in_store>
2165
+ <can_be_empty>1</can_be_empty>
2166
+ <depends><allowspecific>1</allowspecific></depends>
2167
+ </specificcountry>
2168
+ <image translate="label comment">
2169
+ <label>Payment Logo</label>
2170
+ <sort_order>60</sort_order>
2171
+ <frontend_type>paymentLogo</frontend_type>
2172
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2173
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2174
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2175
+ <show_in_default>1</show_in_default>
2176
+ <show_in_website>1</show_in_website>
2177
+ <show_in_store>1</show_in_store>
2178
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2179
+ </image>
2180
+ <position translate="label">
2181
+ <label>Payment Logo Visibility</label>
2182
+ <sort_order>70</sort_order>
2183
+ <frontend_type>select</frontend_type>
2184
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2185
+ <show_in_default>1</show_in_default>
2186
+ <show_in_website>1</show_in_website>
2187
+ <show_in_store>1</show_in_store>
2188
+ </position>
2189
  </fields>
2190
  </ops_directEbanking>
2191
  <ops_cc translate="label">
2192
  <label>PayEngine Cc</label>
2193
+ <sort_order>250</sort_order>
2194
  <show_in_default>1</show_in_default>
2195
  <show_in_website>1</show_in_website>
2196
  <show_in_store>1</show_in_store>
2222
  <show_in_store>1</show_in_store>
2223
  </sort_order>
2224
  <types translate="label">
2225
+ <label>Enabled Card Types</label>
2226
  <frontend_type>multiselect</frontend_type>
2227
  <sort_order>30</sort_order>
2228
  <source_model>ops/source_cc_types</source_model>
2232
  </types>
2233
  <redirect_all translate="label comment">
2234
  <label>Enable redirect payment for all card types</label>
2235
+ <comment><![CDATA[If set to <em>Yes</em>, customers will be redirected to the external PayEngine payment page.]]></comment>
2236
  <frontend_type>select</frontend_type>
2237
  <source_model>adminhtml/system_config_source_yesno</source_model>
2238
  <sort_order>40</sort_order>
2241
  <show_in_store>1</show_in_store>
2242
  </redirect_all>
2243
  <inline_types translate="label tooltip">
2244
+ <label>Enable inline payment (Direct Link) for these card types</label>
2245
  <tooltip><![CDATA[For the selected card types, the customer can enter the credit card details directly in the checkout.]]></tooltip>
2246
  <frontend_type>multiselect</frontend_type>
2247
  <source_model>ops/source_cc_aliasInterfaceEnabledTypes</source_model>
2248
  <sort_order>41</sort_order>
2249
+ <depends><redirect_all>0</redirect_all></depends>
 
 
2250
  <show_in_default>1</show_in_default>
2251
  <show_in_website>1</show_in_website>
2252
  <show_in_store>1</show_in_store>
2261
  <show_in_website>1</show_in_website>
2262
  <show_in_store>0</show_in_store>
2263
  </enabled_3dsecure>
2264
+ <image translate="label comment">
2265
+ <label>Payment Logo</label>
2266
+ <sort_order>80</sort_order>
2267
+ <frontend_type>paymentLogo</frontend_type>
2268
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2269
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2270
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2271
+ <show_in_default>1</show_in_default>
2272
+ <show_in_website>1</show_in_website>
2273
+ <show_in_store>1</show_in_store>
2274
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2275
+ </image>
2276
+ <position translate="label">
2277
+ <label>Payment Logo Visibility</label>
2278
+ <sort_order>90</sort_order>
2279
+ <frontend_type>select</frontend_type>
2280
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2281
+ <show_in_default>1</show_in_default>
2282
+ <show_in_website>1</show_in_website>
2283
+ <show_in_store>1</show_in_store>
2284
+ </position>
2285
  <backend_enabled translate="label tooltip">
2286
  <label>Enable for backend</label>
2287
  <tooltip><![CDATA[This sets if this payment method should also be available for orders from the Magento backend.]]></tooltip>
2302
  <show_in_website>1</show_in_website>
2303
  <show_in_store>1</show_in_store>
2304
  </active_alias>
2305
+ <alias_usage_for_new_alias translate="label comment">
2306
+ <label>Aliasusage New</label>
2307
+ <frontend_type>text</frontend_type>
2308
+ <sort_order>110</sort_order>
2309
+ <comment>Here you can enter the desired text which will be displayed on PayEngine side.</comment>
2310
+ <show_in_default>1</show_in_default>
2311
+ <show_in_website>1</show_in_website>
2312
+ <show_in_store>1</show_in_store>
2313
+ </alias_usage_for_new_alias>
2314
+ <alias_usage_for_existing_alias translate="label comment">
2315
+ <label>Aliasusage existing Alias</label>
2316
+ <frontend_type>text</frontend_type>
2317
+ <sort_order>111</sort_order>
2318
+ <comment>Here you can enter the desired text which is used for existing alias, the text will be displayed on PayEngine side.</comment>
2319
+ <show_in_default>1</show_in_default>
2320
+ <show_in_website>1</show_in_website>
2321
+ <show_in_store>1</show_in_store>
2322
+ </alias_usage_for_existing_alias>
2323
  <zero_amount_checkout>
2324
  <label>Allow zero amount authorization</label>
2325
  <comment>Only if payment action is authorize.</comment>
2332
  </zero_amount_checkout>
2333
  </fields>
2334
  </ops_cc>
2335
+ <ops_dc translate="label">
2336
+ <label>PayEngine Dc</label>
2337
+ <sort_order>260</sort_order>
2338
  <show_in_default>1</show_in_default>
2339
  <show_in_website>1</show_in_website>
2340
  <show_in_store>1</show_in_store>
2343
  <label>Enabled</label>
2344
  <frontend_type>select</frontend_type>
2345
  <source_model>adminhtml/system_config_source_yesno</source_model>
2346
+ <sort_order>10</sort_order>
2347
  <show_in_default>1</show_in_default>
2348
  <show_in_website>1</show_in_website>
2349
  <show_in_store>0</show_in_store>
2351
  <title translate="label">
2352
  <label>Title</label>
2353
  <frontend_type>text</frontend_type>
2354
+ <sort_order>11</sort_order>
2355
  <show_in_default>1</show_in_default>
2356
  <show_in_website>1</show_in_website>
2357
  <show_in_store>1</show_in_store>
2365
  <show_in_website>1</show_in_website>
2366
  <show_in_store>1</show_in_store>
2367
  </sort_order>
2368
+ <types translate="label">
2369
+ <label>Enabled Card Types</label>
2370
+ <frontend_type>multiselect</frontend_type>
2371
+ <sort_order>30</sort_order>
2372
+ <source_model>ops/source_debitCard_types</source_model>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2373
  <show_in_default>1</show_in_default>
2374
  <show_in_website>1</show_in_website>
2375
  <show_in_store>1</show_in_store>
2376
+ </types>
2377
+ <redirect_all translate="label comment">
2378
+ <label>Enable redirect payment for all card types</label>
2379
+ <comment><![CDATA[If set to <em>Yes</em>, customers will be redirected to the external PayEngine payment page.]]></comment>
2380
+ <frontend_type>select</frontend_type>
2381
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2382
+ <sort_order>40</sort_order>
2383
  <show_in_default>1</show_in_default>
2384
  <show_in_website>1</show_in_website>
2385
  <show_in_store>1</show_in_store>
2386
+ </redirect_all>
2387
+ <inline_types translate="label tooltip">
2388
+ <label>Enable inline payment (Direct Link) for these card types</label>
2389
+ <tooltip><![CDATA[For the selected card types, the customer can enter the credit card details directly in the checkout.]]></tooltip>
2390
+ <frontend_type>multiselect</frontend_type>
2391
+ <source_model>ops/source_debitCard_aliasInterfaceEnabledTypes</source_model>
2392
+ <sort_order>41</sort_order>
2393
+ <depends><redirect_all>0</redirect_all></depends>
 
 
 
 
 
 
 
2394
  <show_in_default>1</show_in_default>
2395
  <show_in_website>1</show_in_website>
2396
  <show_in_store>1</show_in_store>
2397
+ </inline_types>
2398
+ <enabled_3dsecure translate="label tooltip">
2399
+ <label>Enable 3D secure</label>
2400
+ <tooltip><![CDATA[If the customer's credit card supports 3D Secure, he will be redirected to an external page to enter his password.]]></tooltip>
2401
  <frontend_type>select</frontend_type>
2402
  <source_model>adminhtml/system_config_source_yesno</source_model>
2403
+ <sort_order>50</sort_order>
2404
  <show_in_default>1</show_in_default>
2405
  <show_in_website>1</show_in_website>
2406
  <show_in_store>0</show_in_store>
2407
+ </enabled_3dsecure>
2408
+ <image translate="label comment">
2409
+ <label>Payment Logo</label>
2410
+ <sort_order>80</sort_order>
2411
+ <frontend_type>paymentLogo</frontend_type>
2412
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2413
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2414
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2415
+ <show_in_default>1</show_in_default>
2416
+ <show_in_website>1</show_in_website>
2417
+ <show_in_store>1</show_in_store>
2418
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2419
+ </image>
2420
+ <position translate="label">
2421
+ <label>Payment Logo Visibility</label>
2422
+ <sort_order>90</sort_order>
2423
+ <frontend_type>select</frontend_type>
2424
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2425
+ <show_in_default>1</show_in_default>
2426
+ <show_in_website>1</show_in_website>
2427
+ <show_in_store>1</show_in_store>
2428
+ </position>
2429
+ <backend_enabled translate="label tooltip">
2430
+ <label>Enable for backend</label>
2431
+ <tooltip><![CDATA[This sets if this payment method should also be available for orders from the Magento backend.]]></tooltip>
2432
+ <frontend_type>select</frontend_type>
2433
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2434
+ <sort_order>100</sort_order>
2435
+ <show_in_default>1</show_in_default>
2436
+ <show_in_website>1</show_in_website>
2437
+ <show_in_store>1</show_in_store>
2438
+ </backend_enabled>
2439
+ <active_alias translate="label">
2440
+ <label>Enabled Alias Manager</label>
2441
+ <frontend_type>select</frontend_type>
2442
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2443
+ <sort_order>110</sort_order>
2444
+ <show_in_default>1</show_in_default>
2445
+ <show_in_website>1</show_in_website>
2446
+ <show_in_store>1</show_in_store>
2447
+ </active_alias>
2448
+ <alias_usage_for_new_alias translate="label comment">
2449
+ <label>Aliasusage New</label>
2450
+ <frontend_type>text</frontend_type>
2451
+ <sort_order>111</sort_order>
2452
+ <comment>Here you can enter the desired text which will be displayed on PayEngine side.</comment>
2453
+ <show_in_default>1</show_in_default>
2454
+ <show_in_website>1</show_in_website>
2455
+ <show_in_store>1</show_in_store>
2456
+ </alias_usage_for_new_alias>
2457
+ <alias_usage_for_existing_alias translate="label comment">
2458
+ <label>Aliasusage existing Alias</label>
2459
+ <frontend_type>text</frontend_type>
2460
+ <sort_order>112</sort_order>
2461
+ <comment>Here you can enter the desired text which is used for existing alias, the text will be displayed on PayEngine side.</comment>
2462
+ <show_in_default>1</show_in_default>
2463
+ <show_in_website>1</show_in_website>
2464
+ <show_in_store>1</show_in_store>
2465
+ </alias_usage_for_existing_alias>
2466
+ <show_alias_manager_info_for_guests translate="label">
2467
+ <label>Show Alias Manager information for guests</label>
2468
+ <frontend_type>select</frontend_type>
2469
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2470
+ <sort_order>120</sort_order>
2471
+ <show_in_default>1</show_in_default>
2472
+ <show_in_website>1</show_in_website>
2473
+ <show_in_store>1</show_in_store>
2474
+ <depends><active_alias>1</active_alias></depends>
2475
+ </show_alias_manager_info_for_guests>
2476
+ <zero_amount_checkout>
2477
+ <label>Allow zero amount authorization</label>
2478
+ <comment>Only if payment action is authorize.</comment>
2479
+ <frontend_type>select</frontend_type>
2480
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2481
+ <sort_order>130</sort_order>
2482
+ <show_in_default>1</show_in_default>
2483
+ <show_in_website>1</show_in_website>
2484
+ <show_in_store>1</show_in_store>
2485
+ </zero_amount_checkout>
2486
+ </fields>
2487
+ </ops_dc>
2488
+ <ops_ingHomePay translate="label">
2489
+ <label>PayEngine IngHomePay</label>
2490
+ <sort_order>270</sort_order>
2491
+ <show_in_default>1</show_in_default>
2492
+ <show_in_website>1</show_in_website>
2493
+ <show_in_store>1</show_in_store>
2494
+ <fields>
2495
+ <active translate="label">
2496
+ <label>Enabled</label>
2497
+ <frontend_type>select</frontend_type>
2498
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2499
+ <sort_order>1</sort_order>
2500
+ <show_in_default>1</show_in_default>
2501
+ <show_in_website>1</show_in_website>
2502
+ <show_in_store>0</show_in_store>
2503
+ </active>
2504
+ <title translate="label">
2505
+ <label>Title</label>
2506
+ <frontend_type>text</frontend_type>
2507
+ <sort_order>10</sort_order>
2508
+ <show_in_default>1</show_in_default>
2509
+ <show_in_website>1</show_in_website>
2510
+ <show_in_store>1</show_in_store>
2511
+ <validate>required-entry</validate>
2512
+ </title>
2513
+ <sort_order translate="label">
2514
+ <label>Sort Order</label>
2515
+ <frontend_type>text</frontend_type>
2516
+ <sort_order>20</sort_order>
2517
+ <show_in_default>1</show_in_default>
2518
+ <show_in_website>1</show_in_website>
2519
+ <show_in_store>1</show_in_store>
2520
+ </sort_order>
2521
+ <allowspecific translate="label">
2522
+ <label>Payment from Applicable Countries</label>
2523
+ <frontend_type>allowspecific</frontend_type>
2524
+ <sort_order>30</sort_order>
2525
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2526
+ <show_in_default>1</show_in_default>
2527
+ <show_in_website>1</show_in_website>
2528
+ <show_in_store>0</show_in_store>
2529
+ </allowspecific>
2530
+ <specificcountry translate="label">
2531
+ <label>Payment from Specific Countries</label>
2532
+ <frontend_type>multiselect</frontend_type>
2533
+ <sort_order>40</sort_order>
2534
+ <source_model>adminhtml/system_config_source_country</source_model>
2535
+ <show_in_default>1</show_in_default>
2536
+ <show_in_website>1</show_in_website>
2537
+ <show_in_store>0</show_in_store>
2538
+ <can_be_empty>1</can_be_empty>
2539
+ <depends><allowspecific>1</allowspecific></depends>
2540
+ </specificcountry>
2541
+ <image translate="label comment">
2542
+ <label>Payment Logo</label>
2543
+ <sort_order>50</sort_order>
2544
+ <frontend_type>paymentLogo</frontend_type>
2545
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2546
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2547
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2548
+ <show_in_default>1</show_in_default>
2549
+ <show_in_website>1</show_in_website>
2550
+ <show_in_store>1</show_in_store>
2551
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2552
+ </image>
2553
+ <position translate="label">
2554
+ <label>Payment Logo Visibility</label>
2555
+ <sort_order>60</sort_order>
2556
+ <frontend_type>select</frontend_type>
2557
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2558
+ <show_in_default>1</show_in_default>
2559
+ <show_in_website>1</show_in_website>
2560
+ <show_in_store>1</show_in_store>
2561
+ </position>
2562
+ </fields>
2563
+ </ops_ingHomePay>
2564
+ <ops_paysafecard translate="label">
2565
+ <label>PayEngine Paysafecard</label>
2566
+ <sort_order>280</sort_order>
2567
+ <show_in_default>1</show_in_default>
2568
+ <show_in_website>1</show_in_website>
2569
+ <show_in_store>1</show_in_store>
2570
+ <fields>
2571
+ <active translate="label">
2572
+ <label>Enabled</label>
2573
+ <frontend_type>select</frontend_type>
2574
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2575
+ <sort_order>1</sort_order>
2576
+ <show_in_default>1</show_in_default>
2577
+ <show_in_website>1</show_in_website>
2578
+ <show_in_store>0</show_in_store>
2579
+ </active>
2580
+ <title translate="label">
2581
+ <label>Title</label>
2582
+ <frontend_type>text</frontend_type>
2583
+ <sort_order>10</sort_order>
2584
+ <show_in_default>1</show_in_default>
2585
+ <show_in_website>1</show_in_website>
2586
+ <show_in_store>1</show_in_store>
2587
+ <validate>required-entry</validate>
2588
+ </title>
2589
+ <sort_order translate="label">
2590
+ <label>Sort Order</label>
2591
+ <frontend_type>text</frontend_type>
2592
+ <sort_order>20</sort_order>
2593
+ <show_in_default>1</show_in_default>
2594
+ <show_in_website>1</show_in_website>
2595
+ <show_in_store>1</show_in_store>
2596
+ </sort_order>
2597
+ <allowspecific translate="label">
2598
+ <label>Payment from Applicable Countries</label>
2599
+ <frontend_type>allowspecific</frontend_type>
2600
+ <sort_order>30</sort_order>
2601
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2602
+ <show_in_default>1</show_in_default>
2603
+ <show_in_website>1</show_in_website>
2604
+ <show_in_store>0</show_in_store>
2605
+ </allowspecific>
2606
+ <specificcountry translate="label">
2607
+ <label>Payment from Specific Countries</label>
2608
+ <frontend_type>multiselect</frontend_type>
2609
+ <sort_order>40</sort_order>
2610
+ <source_model>adminhtml/system_config_source_country</source_model>
2611
+ <show_in_default>1</show_in_default>
2612
+ <show_in_website>1</show_in_website>
2613
+ <show_in_store>0</show_in_store>
2614
+ <can_be_empty>1</can_be_empty>
2615
+ <depends><allowspecific>1</allowspecific></depends>
2616
+ </specificcountry>
2617
+ <image translate="label comment">
2618
+ <label>Payment Logo</label>
2619
+ <sort_order>50</sort_order>
2620
+ <frontend_type>paymentLogo</frontend_type>
2621
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2622
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2623
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2624
+ <show_in_default>1</show_in_default>
2625
+ <show_in_website>1</show_in_website>
2626
+ <show_in_store>1</show_in_store>
2627
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2628
+ </image>
2629
+ <position translate="label">
2630
+ <label>Payment Logo Visibility</label>
2631
+ <sort_order>60</sort_order>
2632
+ <frontend_type>select</frontend_type>
2633
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2634
+ <show_in_default>1</show_in_default>
2635
+ <show_in_website>1</show_in_website>
2636
+ <show_in_store>1</show_in_store>
2637
+ </position>
2638
+ </fields>
2639
+ </ops_paysafecard>
2640
+ <ops_kwixoCredit translate="label">
2641
+ <label>PayEngine KwixoCredit</label>
2642
+ <sort_order>290</sort_order>
2643
+ <show_in_default>1</show_in_default>
2644
+ <show_in_website>1</show_in_website>
2645
+ <show_in_store>1</show_in_store>
2646
+ <fields>
2647
+ <kwixo_config translate="label">
2648
+ <label>Kwixxo Config</label>
2649
+ <frontend_type>text</frontend_type>
2650
+ <frontend_model>ops/system_config_kwixoconfiguration</frontend_model>
2651
+ <sort_order>0</sort_order>
2652
+ <show_in_default>1</show_in_default>
2653
+ <show_in_website>1</show_in_website>
2654
+ <show_in_store>1</show_in_store>
2655
+ </kwixo_config>
2656
+ <active translate="label">
2657
+ <label>Enabled</label>
2658
+ <frontend_type>select</frontend_type>
2659
+ <source_model>adminhtml/system_config_source_yesno</source_model>
2660
+ <sort_order>1</sort_order>
2661
+ <show_in_default>1</show_in_default>
2662
+ <show_in_website>1</show_in_website>
2663
+ <show_in_store>0</show_in_store>
2664
+ </active>
2665
+ <title translate="label">
2666
+ <label>Title</label>
2667
+ <frontend_type>text</frontend_type>
2668
+ <sort_order>10</sort_order>
2669
  <show_in_default>1</show_in_default>
2670
  <show_in_website>1</show_in_website>
2671
  <show_in_store>1</show_in_store>
2687
  <show_in_default>1</show_in_default>
2688
  <show_in_website>1</show_in_website>
2689
  <show_in_store>1</show_in_store>
2690
+ <depends><active>1</active></depends>
 
 
2691
  </delivery_date>
2692
  <rnp_fee translate="label">
2693
  <label>RNP Fee</label>
2697
  <show_in_default>1</show_in_default>
2698
  <show_in_website>1</show_in_website>
2699
  <show_in_store>1</show_in_store>
2700
+ <depends><active>1</active></depends>
 
 
2701
  </rnp_fee>
2702
  <ecom_shipMethodType>
2703
  <label>Default Shipping Method Type</label>
2720
  <show_in_default>1</show_in_default>
2721
  <show_in_website>1</show_in_website>
2722
  <show_in_store>1</show_in_store>
2723
+ <depends><active>1</active></depends>
 
 
2724
  </ecom_shipMethodSpeed>
2725
  <shiping_method_details>
2726
  <label>Default Shipping Method Details</label>
2730
  <show_in_default>1</show_in_default>
2731
  <show_in_website>1</show_in_website>
2732
  <show_in_store>1</show_in_store>
2733
+ <depends><active>1</active></depends>
 
 
2734
  </shiping_method_details>
2735
+ <allowspecific translate="label">
2736
+ <label>Payment from Applicable Countries</label>
2737
+ <frontend_type>allowspecific</frontend_type>
2738
+ <sort_order>90</sort_order>
2739
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2740
+ <show_in_default>1</show_in_default>
2741
+ <show_in_website>1</show_in_website>
2742
+ <show_in_store>0</show_in_store>
2743
+ </allowspecific>
2744
+ <specificcountry translate="label">
2745
+ <label>Payment from Specific Countries</label>
2746
+ <frontend_type>multiselect</frontend_type>
2747
+ <sort_order>100</sort_order>
2748
+ <source_model>adminhtml/system_config_source_country</source_model>
2749
+ <show_in_default>1</show_in_default>
2750
+ <show_in_website>1</show_in_website>
2751
+ <show_in_store>0</show_in_store>
2752
+ <can_be_empty>1</can_be_empty>
2753
+ <depends><allowspecific>1</allowspecific></depends>
2754
+ </specificcountry>
2755
+ <image translate="label comment">
2756
+ <label>Payment Logo</label>
2757
+ <sort_order>110</sort_order>
2758
+ <frontend_type>paymentLogo</frontend_type>
2759
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2760
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2761
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2762
+ <show_in_default>1</show_in_default>
2763
+ <show_in_website>1</show_in_website>
2764
+ <show_in_store>1</show_in_store>
2765
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2766
+ </image>
2767
+ <position translate="label">
2768
+ <label>Payment Logo Visibility</label>
2769
+ <sort_order>120</sort_order>
2770
+ <frontend_type>select</frontend_type>
2771
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2772
+ <show_in_default>1</show_in_default>
2773
+ <show_in_website>1</show_in_website>
2774
+ <show_in_store>1</show_in_store>
2775
+ </position>
2776
  </fields>
2777
  </ops_kwixoCredit>
2778
  <ops_kwixoApresReception translate="label">
2779
  <label>PayEngine KwixoApresReception</label>
2780
+ <sort_order>300</sort_order>
2781
  <show_in_default>1</show_in_default>
2782
  <show_in_website>1</show_in_website>
2783
  <show_in_store>1</show_in_store>
2825
  <show_in_default>1</show_in_default>
2826
  <show_in_website>1</show_in_website>
2827
  <show_in_store>1</show_in_store>
2828
+ <depends><active>1</active></depends>
 
 
2829
  </delivery_date>
2830
  <rnp_fee translate="label">
2831
  <label>RNP Fee</label>
2835
  <show_in_default>1</show_in_default>
2836
  <show_in_website>1</show_in_website>
2837
  <show_in_store>1</show_in_store>
2838
+ <depends><active>1</active></depends>
 
 
2839
  </rnp_fee>
2840
  <ecom_shipMethodType>
2841
  <label>Default Shipping Method Type</label>
2845
  <show_in_default>1</show_in_default>
2846
  <show_in_website>1</show_in_website>
2847
  <show_in_store>1</show_in_store>
2848
+ <depends><active>1</active></depends>
 
 
2849
  </ecom_shipMethodType>
2850
  <ecom_shipMethodSpeed>
2851
  <label>Default Shipping Speed (in hours)</label>
2855
  <show_in_default>1</show_in_default>
2856
  <show_in_website>1</show_in_website>
2857
  <show_in_store>1</show_in_store>
2858
+ <depends><active>1</active></depends>
 
 
2859
  </ecom_shipMethodSpeed>
2860
  <shiping_method_details>
2861
  <label>Default Shipping Method Details</label>
2865
  <show_in_default>1</show_in_default>
2866
  <show_in_website>1</show_in_website>
2867
  <show_in_store>1</show_in_store>
2868
+ <depends><active>1</active></depends>
 
 
2869
  </shiping_method_details>
2870
+ <allowspecific translate="label">
2871
+ <label>Payment from Applicable Countries</label>
2872
+ <frontend_type>allowspecific</frontend_type>
2873
+ <sort_order>80</sort_order>
2874
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
2875
+ <show_in_default>1</show_in_default>
2876
+ <show_in_website>1</show_in_website>
2877
+ <show_in_store>0</show_in_store>
2878
+ </allowspecific>
2879
+ <specificcountry translate="label">
2880
+ <label>Payment from Specific Countries</label>
2881
+ <frontend_type>multiselect</frontend_type>
2882
+ <sort_order>90</sort_order>
2883
+ <source_model>adminhtml/system_config_source_country</source_model>
2884
+ <show_in_default>1</show_in_default>
2885
+ <show_in_website>1</show_in_website>
2886
+ <show_in_store>0</show_in_store>
2887
+ <can_be_empty>1</can_be_empty>
2888
+ <depends><allowspecific>1</allowspecific></depends>
2889
+ </specificcountry>
2890
+ <image translate="label comment">
2891
+ <label>Payment Logo</label>
2892
+ <sort_order>100</sort_order>
2893
+ <frontend_type>paymentLogo</frontend_type>
2894
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
2895
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
2896
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
2897
+ <show_in_default>1</show_in_default>
2898
+ <show_in_website>1</show_in_website>
2899
+ <show_in_store>1</show_in_store>
2900
+ <comment>Allowed file types: jpeg, gif, png.</comment>
2901
+ </image>
2902
+ <position translate="label">
2903
+ <label>Payment Logo Visibility</label>
2904
+ <sort_order>110</sort_order>
2905
+ <frontend_type>select</frontend_type>
2906
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
2907
+ <show_in_default>1</show_in_default>
2908
+ <show_in_website>1</show_in_website>
2909
+ <show_in_store>1</show_in_store>
2910
+ </position>
2911
  </fields>
2912
  </ops_kwixoApresReception>
2913
  <ops_kwixoComptant translate="label">
2914
  <label>PayEngine KwixoComptant</label>
2915
+ <sort_order>310</sort_order>
2916
  <show_in_default>1</show_in_default>
2917
  <show_in_website>1</show_in_website>
2918
  <show_in_store>1</show_in_store>
2960
  <show_in_default>1</show_in_default>
2961
  <show_in_website>1</show_in_website>
2962
  <show_in_store>1</show_in_store>
2963
+ <depends><active>1</active></depends>
 
 
2964
  </delivery_date>
2965
  <rnp_fee translate="label">
2966
  <label>RNP Fee</label>
2970
  <show_in_default>1</show_in_default>
2971
  <show_in_website>1</show_in_website>
2972
  <show_in_store>1</show_in_store>
2973
+ <depends><active>1</active></depends>
 
 
2974
  </rnp_fee>
2975
  <ecom_shipMethodType>
2976
  <label>Default Shipping Method Type</label>
2981
  <show_in_default>1</show_in_default>
2982
  <show_in_website>1</show_in_website>
2983
  <show_in_store>1</show_in_store>
2984
+ <depends><active>1</active></depends>
 
 
2985
  </ecom_shipMethodType>
2986
  <ecom_shipMethodSpeed>
2987
  <label>Default Shipping Speed (in hours)</label>
2991
  <show_in_default>1</show_in_default>
2992
  <show_in_website>1</show_in_website>
2993
  <show_in_store>1</show_in_store>
2994
+ <depends><active>1</active></depends>
 
 
2995
  </ecom_shipMethodSpeed>
2996
  <shiping_method_details>
2997
  <label>Default Shipping Method Details</label>
3001
  <show_in_default>1</show_in_default>
3002
  <show_in_website>1</show_in_website>
3003
  <show_in_store>1</show_in_store>
3004
+ <depends><active>1</active></depends>
 
 
3005
  </shiping_method_details>
3006
+ <allowspecific translate="label">
3007
+ <label>Payment from Applicable Countries</label>
3008
+ <frontend_type>allowspecific</frontend_type>
3009
+ <sort_order>90</sort_order>
3010
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
3011
+ <show_in_default>1</show_in_default>
3012
+ <show_in_website>1</show_in_website>
3013
+ <show_in_store>0</show_in_store>
3014
+ </allowspecific>
3015
+ <specificcountry translate="label">
3016
+ <label>Payment from Specific Countries</label>
3017
+ <frontend_type>multiselect</frontend_type>
3018
+ <sort_order>100</sort_order>
3019
+ <source_model>adminhtml/system_config_source_country</source_model>
3020
+ <show_in_default>1</show_in_default>
3021
+ <show_in_website>1</show_in_website>
3022
+ <show_in_store>0</show_in_store>
3023
+ <can_be_empty>1</can_be_empty>
3024
+ <depends><allowspecific>1</allowspecific></depends>
3025
+ </specificcountry>
3026
+ <image translate="label comment">
3027
+ <label>Payment Logo</label>
3028
+ <sort_order>110</sort_order>
3029
+ <frontend_type>paymentLogo</frontend_type>
3030
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
3031
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
3032
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
3033
+ <show_in_default>1</show_in_default>
3034
+ <show_in_website>1</show_in_website>
3035
+ <show_in_store>1</show_in_store>
3036
+ <comment>Allowed file types: jpeg, gif, png.</comment>
3037
+ </image>
3038
+ <position translate="label">
3039
+ <label>Payment Logo Visibility</label>
3040
+ <sort_order>120</sort_order>
3041
+ <frontend_type>select</frontend_type>
3042
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
3043
+ <show_in_default>1</show_in_default>
3044
+ <show_in_website>1</show_in_website>
3045
+ <show_in_store>1</show_in_store>
3046
+ </position>
3047
  </fields>
3048
  </ops_kwixoComptant>
3049
  <ops_opsid translate="label">
3050
  <label>Existing PayEngine Transaction</label>
3051
+ <sort_order>320</sort_order>
3052
  <show_in_default>1</show_in_default>
3053
  <show_in_website>0</show_in_website>
3054
  <show_in_store>0</show_in_store>
3078
  <show_in_default>1</show_in_default>
3079
  <show_in_website>0</show_in_website>
3080
  <show_in_store>0</show_in_store>
3081
+ <depends><active>1</active></depends>
 
 
3082
  </sort_order>
3083
+ <allowspecific translate="label">
3084
+ <label>Payment from Applicable Countries</label>
3085
+ <frontend_type>allowspecific</frontend_type>
3086
+ <sort_order>30</sort_order>
3087
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
3088
+ <show_in_default>1</show_in_default>
3089
+ <show_in_website>1</show_in_website>
3090
+ <show_in_store>0</show_in_store>
3091
+ </allowspecific>
3092
+ <specificcountry translate="label">
3093
+ <label>Payment from Specific Countries</label>
3094
+ <frontend_type>multiselect</frontend_type>
3095
+ <sort_order>40</sort_order>
3096
+ <source_model>adminhtml/system_config_source_country</source_model>
3097
+ <show_in_default>1</show_in_default>
3098
+ <show_in_website>1</show_in_website>
3099
+ <show_in_store>0</show_in_store>
3100
+ <can_be_empty>1</can_be_empty>
3101
+ <depends><allowspecific>1</allowspecific></depends>
3102
+ </specificcountry>
3103
+ <image translate="label comment">
3104
+ <label>Payment Logo</label>
3105
+ <sort_order>50</sort_order>
3106
+ <frontend_type>paymentLogo</frontend_type>
3107
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
3108
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
3109
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
3110
+ <show_in_default>1</show_in_default>
3111
+ <show_in_website>1</show_in_website>
3112
+ <show_in_store>1</show_in_store>
3113
+ <comment>Allowed file types: jpeg, gif, png.</comment>
3114
+ </image>
3115
+ <position translate="label">
3116
+ <label>Payment Logo Visibility</label>
3117
+ <sort_order>60</sort_order>
3118
+ <frontend_type>select</frontend_type>
3119
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
3120
+ <show_in_default>1</show_in_default>
3121
+ <show_in_website>1</show_in_website>
3122
+ <show_in_store>1</show_in_store>
3123
+ </position>
3124
  </fields>
3125
  </ops_opsid>
3126
  <ops_flex translate="label comment">
3127
  <label>PayEngine Flex payment method</label>
3128
+ <sort_order>330</sort_order>
3129
  <show_in_default>1</show_in_default>
3130
  <show_in_website>1</show_in_website>
3131
  <show_in_store>1</show_in_store>
3147
  <show_in_website>1</show_in_website>
3148
  <show_in_store>1</show_in_store>
3149
  <validate>required-entry</validate>
3150
+ <depends><active>1</active></depends>
 
 
3151
  </title>
3152
  <sort_order translate="label">
3153
  <label>Sort Order</label>
3156
  <show_in_default>1</show_in_default>
3157
  <show_in_website>1</show_in_website>
3158
  <show_in_store>1</show_in_store>
3159
+ <depends><active>1</active></depends>
 
 
3160
  </sort_order>
3161
  <default translate="label tooltip">
3162
  <label>Show empty default option</label>
3167
  <show_in_website>1</show_in_website>
3168
  <show_in_store>1</show_in_store>
3169
  <tooltip><![CDATA[A generic option, that lets the customer choose the exact method on PayEngine side.]]></tooltip>
3170
+ <depends><active>1</active></depends>
 
 
3171
  </default>
3172
  <default_title translate="label comment">
3173
  <label>Default option title</label>
3178
  <show_in_store>1</show_in_store>
3179
  <validate>required-entry</validate>
3180
  <tooltip>Title to display for the default option.</tooltip>
3181
+ <depends><default>1</default></depends>
 
 
3182
  </default_title>
3183
  <methods translate="label comment">
3184
  <label>Methods</label>
3189
  <show_in_website>1</show_in_website>
3190
  <show_in_store>1</show_in_store>
3191
  <comment>Add one or more methods. In field 'PM' you will have to enter the PM value you got from PayEngine, same goes for the field 'BRAND'.</comment>
3192
+ <depends><active>1</active></depends>
 
 
3193
  </methods>
3194
+ <allowspecific translate="label">
3195
+ <label>Payment from Applicable Countries</label>
3196
+ <frontend_type>allowspecific</frontend_type>
3197
+ <sort_order>50</sort_order>
3198
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
3199
+ <show_in_default>1</show_in_default>
3200
+ <show_in_website>1</show_in_website>
3201
+ <show_in_store>0</show_in_store>
3202
+ </allowspecific>
3203
+ <specificcountry translate="label">
3204
+ <label>Payment from Specific Countries</label>
3205
+ <frontend_type>multiselect</frontend_type>
3206
+ <sort_order>60</sort_order>
3207
+ <source_model>adminhtml/system_config_source_country</source_model>
3208
+ <show_in_default>1</show_in_default>
3209
+ <show_in_website>1</show_in_website>
3210
+ <show_in_store>0</show_in_store>
3211
+ <can_be_empty>1</can_be_empty>
3212
+ <depends><allowspecific>1</allowspecific></depends>
3213
+ </specificcountry>
3214
+ <image translate="label comment">
3215
+ <label>Payment Logo</label>
3216
+ <sort_order>70</sort_order>
3217
+ <frontend_type>paymentLogo</frontend_type>
3218
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
3219
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
3220
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
3221
+ <show_in_default>1</show_in_default>
3222
+ <show_in_website>1</show_in_website>
3223
+ <show_in_store>1</show_in_store>
3224
+ <comment>Allowed file types: jpeg, gif, png.</comment>
3225
+ </image>
3226
+ <position translate="label">
3227
+ <label>Payment Logo Visibility</label>
3228
+ <sort_order>80</sort_order>
3229
+ <frontend_type>select</frontend_type>
3230
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
3231
+ <show_in_default>1</show_in_default>
3232
+ <show_in_website>1</show_in_website>
3233
+ <show_in_store>1</show_in_store>
3234
+ </position>
3235
  </fields>
3236
  </ops_flex>
3237
  <ops_chinaUnionPay translate="label">
3238
  <label>PayEngine ChinaUnionPay</label>
3239
+ <sort_order>340</sort_order>
3240
  <show_in_default>1</show_in_default>
3241
  <show_in_website>1</show_in_website>
3242
  <show_in_store>1</show_in_store>
3268
  <show_in_website>1</show_in_website>
3269
  <show_in_store>1</show_in_store>
3270
  </sort_order>
3271
+ <allowspecific translate="label">
3272
+ <label>Payment from Applicable Countries</label>
3273
+ <frontend_type>allowspecific</frontend_type>
3274
+ <sort_order>30</sort_order>
3275
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
3276
+ <show_in_default>1</show_in_default>
3277
+ <show_in_website>1</show_in_website>
3278
+ <show_in_store>0</show_in_store>
3279
+ </allowspecific>
3280
+ <specificcountry translate="label">
3281
+ <label>Payment from Specific Countries</label>
3282
+ <frontend_type>multiselect</frontend_type>
3283
+ <sort_order>40</sort_order>
3284
+ <source_model>adminhtml/system_config_source_country</source_model>
3285
+ <show_in_default>1</show_in_default>
3286
+ <show_in_website>1</show_in_website>
3287
+ <show_in_store>0</show_in_store>
3288
+ <can_be_empty>1</can_be_empty>
3289
+ <depends><allowspecific>1</allowspecific></depends>
3290
+ </specificcountry>
3291
+ <image translate="label comment">
3292
+ <label>Payment Logo</label>
3293
+ <sort_order>50</sort_order>
3294
+ <frontend_type>paymentLogo</frontend_type>
3295
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
3296
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
3297
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
3298
+ <show_in_default>1</show_in_default>
3299
+ <show_in_website>1</show_in_website>
3300
+ <show_in_store>1</show_in_store>
3301
+ <comment>Allowed file types: jpeg, gif, png.</comment>
3302
+ </image>
3303
+ <position translate="label">
3304
+ <label>Payment Logo Visibility</label>
3305
+ <sort_order>60</sort_order>
3306
+ <frontend_type>select</frontend_type>
3307
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
3308
+ <show_in_default>1</show_in_default>
3309
+ <show_in_website>1</show_in_website>
3310
+ <show_in_store>1</show_in_store>
3311
+ </position>
3312
  </fields>
3313
  </ops_chinaUnionPay>
3314
  <ops_recurring_cc translate="label">
3315
  <label>PayEngine Subscription Manager via Cc</label>
3316
+ <sort_order>350</sort_order>
3317
  <show_in_default>1</show_in_default>
3318
  <show_in_website>1</show_in_website>
3319
  <show_in_store>1</show_in_store>
3331
  <show_in_store>1</show_in_store>
3332
  </active>
3333
  <acceptedTypes translate="label">
3334
+ <label>Enabled Card Types</label>
3335
  <frontend_type>multiselect</frontend_type>
3336
  <sort_order>30</sort_order>
3337
  <source_model>ops/source_cc_recurringTypes</source_model>
3338
  <show_in_default>1</show_in_default>
3339
  <show_in_website>1</show_in_website>
3340
  <show_in_store>1</show_in_store>
3341
+ <depends><active>1</active></depends>
 
 
3342
  </acceptedTypes>
3343
  <enabled_3dsecure translate="label tooltip">
3344
  <label>Enable 3D secure</label>
3349
  <show_in_default>1</show_in_default>
3350
  <show_in_website>1</show_in_website>
3351
  <show_in_store>0</show_in_store>
3352
+ <depends><active>1</active></depends>
 
 
3353
  </enabled_3dsecure>
3354
+ <image translate="label comment">
3355
+ <label>Payment Logo</label>
3356
+ <sort_order>80</sort_order>
3357
+ <frontend_type>paymentLogo</frontend_type>
3358
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
3359
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
3360
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
3361
  <show_in_default>1</show_in_default>
3362
  <show_in_website>1</show_in_website>
3363
+ <show_in_store>1</show_in_store>
3364
+ <comment>Allowed file types: jpeg, gif, png.</comment>
3365
+ </image>
3366
+ <position translate="label">
3367
+ <label>Payment Logo Visibility</label>
3368
+ <sort_order>90</sort_order>
3369
+ <frontend_type>select</frontend_type>
3370
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
 
 
3371
  <show_in_default>1</show_in_default>
3372
  <show_in_website>1</show_in_website>
3373
+ <show_in_store>1</show_in_store>
3374
+ </position>
 
 
 
 
3375
  </fields>
3376
  </ops_recurring_cc>
3377
  <ops_BCMC translate="label">
3378
  <label>PayEngine BCMC</label>
3379
+ <sort_order>360</sort_order>
3380
  <show_in_default>1</show_in_default>
3381
  <show_in_website>1</show_in_website>
3382
  <show_in_store>1</show_in_store>
3406
  <show_in_website>1</show_in_website>
3407
  <show_in_store>1</show_in_store>
3408
  </sort_order>
3409
+ <allowspecific translate="label">
3410
+ <label>Payment from Applicable Countries</label>
3411
+ <frontend_type>allowspecific</frontend_type>
3412
+ <sort_order>30</sort_order>
3413
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
3414
+ <show_in_default>1</show_in_default>
3415
+ <show_in_website>1</show_in_website>
3416
+ <show_in_store>0</show_in_store>
3417
+ </allowspecific>
3418
+ <specificcountry translate="label">
3419
+ <label>Payment from Specific Countries</label>
3420
+ <frontend_type>multiselect</frontend_type>
3421
+ <sort_order>40</sort_order>
3422
+ <source_model>adminhtml/system_config_source_country</source_model>
3423
+ <show_in_default>1</show_in_default>
3424
+ <show_in_website>1</show_in_website>
3425
+ <show_in_store>0</show_in_store>
3426
+ <can_be_empty>1</can_be_empty>
3427
+ <depends><allowspecific>1</allowspecific></depends>
3428
+ </specificcountry>
3429
+ <image translate="label comment">
3430
+ <label>Payment Logo</label>
3431
+ <sort_order>50</sort_order>
3432
+ <frontend_type>paymentLogo</frontend_type>
3433
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
3434
+ <upload_dir config="system/filesystem/media" scope_info="1">ops/paymentLogo</upload_dir>
3435
+ <base_url type="media" scope_info="1">ops/paymentLogo</base_url>
3436
+ <show_in_default>1</show_in_default>
3437
+ <show_in_website>1</show_in_website>
3438
+ <show_in_store>1</show_in_store>
3439
+ <comment>Allowed file types: jpeg, gif, png.</comment>
3440
+ </image>
3441
+ <position translate="label">
3442
+ <label>Payment Logo Visibility</label>
3443
+ <sort_order>60</sort_order>
3444
+ <frontend_type>select</frontend_type>
3445
+ <source_model>ops/system_config_backend_paymentLogo</source_model>
3446
+ <show_in_default>1</show_in_default>
3447
+ <show_in_website>1</show_in_website>
3448
+ <show_in_store>1</show_in_store>
3449
+ </position>
3450
  </fields>
3451
  </ops_BCMC>
3452
+ <ops_payPerMail translate="label comment">
3453
+ <label>PayEngine PayPerMail</label>
3454
+ <sort_order>370</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3455
  <show_in_default>1</show_in_default>
3456
  <show_in_website>1</show_in_website>
3457
  <show_in_store>1</show_in_store>
3460
  <label>Enabled</label>
3461
  <frontend_type>select</frontend_type>
3462
  <source_model>adminhtml/system_config_source_yesno</source_model>
3463
+ <sort_order>1</sort_order>
3464
  <show_in_default>1</show_in_default>
3465
  <show_in_website>1</show_in_website>
3466
  <show_in_store>0</show_in_store>
3468
  <title translate="label">
3469
  <label>Title</label>
3470
  <frontend_type>text</frontend_type>
3471
+ <sort_order>10</sort_order>
3472
  <show_in_default>1</show_in_default>
3473
  <show_in_website>1</show_in_website>
3474
  <show_in_store>1</show_in_store>
3475
  <validate>required-entry</validate>
3476
+ <depends>
3477
+ <active>1</active>
3478
+ </depends>
3479
  </title>
3480
  <sort_order translate="label">
3481
  <label>Sort Order</label>
3484
  <show_in_default>1</show_in_default>
3485
  <show_in_website>1</show_in_website>
3486
  <show_in_store>1</show_in_store>
3487
+ <depends><active>1</active></depends>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3488
  <depends>
3489
+ <active>1</active>
3490
  </depends>
3491
+ </sort_order>
3492
+ <allowspecific translate="label">
3493
+ <label>Payment from Applicable Countries</label>
3494
+ <frontend_type>allowspecific</frontend_type>
 
 
 
 
 
3495
  <sort_order>50</sort_order>
3496
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
3497
  <show_in_default>1</show_in_default>
3498
  <show_in_website>1</show_in_website>
3499
  <show_in_store>0</show_in_store>
3500
+ </allowspecific>
3501
+ <specificcountry translate="label">
3502
+ <label>Payment from Specific Countries</label>
3503
+ <frontend_type>multiselect</frontend_type>
3504
+ <sort_order>60</sort_order>
3505
+ <source_model>adminhtml/system_config_source_country</source_model>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3506
  <show_in_default>1</show_in_default>
3507
  <show_in_website>1</show_in_website>
3508
+ <show_in_store>0</show_in_store>
3509
+ <can_be_empty>1</can_be_empty>
3510
+ <depends><allowspecific>1</allowspecific></depends>
3511
+ </specificcountry>
3512
+ <payPerMail_template translate="label tooltip">
3513
+ <label>PayPerMail Email Template</label>
 
 
3514
  <frontend_type>select</frontend_type>
3515
+ <source_model>adminhtml/system_config_source_email_template</source_model>
3516
+ <sort_order>260</sort_order>
3517
  <show_in_default>1</show_in_default>
3518
  <show_in_website>1</show_in_website>
3519
  <show_in_store>1</show_in_store>
3520
+ <tooltip>The email template to use. Choose 'Default Template from Locale' to use PayEngine extensions default template.</tooltip>
3521
+ </payPerMail_template>
3522
  </fields>
3523
+ </ops_payPerMail>
3524
+
3525
+ <!-- hide old ogone extension which is part of Magento EE due to a misunderstanding -->
3526
+ <pbridge_ogone_direct>
3527
+ <show_in_default>0</show_in_default>
3528
+ <show_in_website>0</show_in_website>
3529
+ <show_in_store>0</show_in_store>
3530
+ </pbridge_ogone_direct>
3531
+ <ogone>
3532
+ <show_in_default>0</show_in_default>
3533
+ <show_in_website>0</show_in_website>
3534
+ <show_in_store>0</show_in_store>
3535
+ </ogone>
3536
+ <ccsave>
3537
+ <sort_order>27</sort_order>
3538
+ </ccsave>
3539
  </groups>
3540
  </payment>
3541
  </sections>
app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-1.0.1-12.12.03.php CHANGED
@@ -2,7 +2,8 @@
2
  $installer = $this;
3
  $installer->startSetup();
4
 
5
- $installer->run("
 
6
  DROP TABLE IF EXISTS {$this->getTable('ops_alias')};
7
  CREATE TABLE {$this->getTable('ops_alias')} (
8
  `id` int(11) unsigned NOT NULL auto_increment,
@@ -17,6 +18,7 @@ $installer->run("
17
  `created_at` timestamp default CURRENT_TIMESTAMP,
18
  PRIMARY KEY (`id`)
19
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
20
- ");
 
21
 
22
  $installer->endSetup();
2
  $installer = $this;
3
  $installer->startSetup();
4
 
5
+ $installer->run(
6
+ "
7
  DROP TABLE IF EXISTS {$this->getTable('ops_alias')};
8
  CREATE TABLE {$this->getTable('ops_alias')} (
9
  `id` int(11) unsigned NOT NULL auto_increment,
18
  `created_at` timestamp default CURRENT_TIMESTAMP,
19
  PRIMARY KEY (`id`)
20
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+ "
22
+ );
23
 
24
  $installer->endSetup();
app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.04.10-13.04.16.php CHANGED
@@ -63,7 +63,8 @@ foreach ($ccTypes as $ccType) {
63
  }
64
 
65
  // delete obsolete payment method config acceptgiro and centea online
66
- $installer->run("
 
67
  DELETE FROM {$this->getTable('core_config_data')}
68
  WHERE 'path' IN
69
  ('payment/ops_acceptgiro/active',
@@ -76,7 +77,8 @@ $installer->run("
76
  'payment/ops_centeaonline/title',
77
  'payment/ops_centeaonline/sort_order'
78
  );
79
- ");
 
80
 
81
 
82
  // update dexiaOnline to belfiusOnline
@@ -84,33 +86,39 @@ $belfiusActive = Mage::getModel('core/config_data')->getCollection()
84
  ->addFieldToFilter('path', 'payment/ops_belfiusDirectNet/active')
85
  ->load();
86
  if (0 === $belfiusActive->count()) {
87
- $installer->run("
 
88
  UPDATE {$this->getTable('core_config_data')}
89
  SET path = 'payment/ops_belfiusDirectNet/active'
90
  WHERE path = 'payment/ops_dexiaDirectNet/active';
91
- ");
 
92
  }
93
 
94
  $belfiusTitle = Mage::getModel('core/config_data')->getCollection()
95
  ->addFieldToFilter('path', 'payment/ops_belfiusDirectNet/title')
96
  ->load();
97
  if (0 == $belfiusTitle->count()) {
98
- $installer->run("
 
99
  UPDATE {$this->getTable('core_config_data')}
100
  SET path = 'payment/ops_belfiusDirectNet/title'
101
  WHERE path = 'payment/ops_dexiaDirectNet/title';
102
- ");
 
103
  }
104
 
105
  $belfiusSortOrder = Mage::getModel('core/config_data')->getCollection()
106
  ->addFieldToFilter('path', 'payment/ops_belfiusDirectNet/sort_order')
107
  ->load();
108
  if (0 === $belfiusSortOrder->count()) {
109
- $installer->run("
 
110
  UPDATE {$this->getTable('core_config_data')}
111
  SET path = 'payment/ops_belfiusDirectNet/sort_order'
112
  WHERE path = 'payment/ops_dexiaDirectNet/sort_order';
113
- ");
 
114
  }
115
  /*
116
  *
63
  }
64
 
65
  // delete obsolete payment method config acceptgiro and centea online
66
+ $installer->run(
67
+ "
68
  DELETE FROM {$this->getTable('core_config_data')}
69
  WHERE 'path' IN
70
  ('payment/ops_acceptgiro/active',
77
  'payment/ops_centeaonline/title',
78
  'payment/ops_centeaonline/sort_order'
79
  );
80
+ "
81
+ );
82
 
83
 
84
  // update dexiaOnline to belfiusOnline
86
  ->addFieldToFilter('path', 'payment/ops_belfiusDirectNet/active')
87
  ->load();
88
  if (0 === $belfiusActive->count()) {
89
+ $installer->run(
90
+ "
91
  UPDATE {$this->getTable('core_config_data')}
92
  SET path = 'payment/ops_belfiusDirectNet/active'
93
  WHERE path = 'payment/ops_dexiaDirectNet/active';
94
+ "
95
+ );
96
  }
97
 
98
  $belfiusTitle = Mage::getModel('core/config_data')->getCollection()
99
  ->addFieldToFilter('path', 'payment/ops_belfiusDirectNet/title')
100
  ->load();
101
  if (0 == $belfiusTitle->count()) {
102
+ $installer->run(
103
+ "
104
  UPDATE {$this->getTable('core_config_data')}
105
  SET path = 'payment/ops_belfiusDirectNet/title'
106
  WHERE path = 'payment/ops_dexiaDirectNet/title';
107
+ "
108
+ );
109
  }
110
 
111
  $belfiusSortOrder = Mage::getModel('core/config_data')->getCollection()
112
  ->addFieldToFilter('path', 'payment/ops_belfiusDirectNet/sort_order')
113
  ->load();
114
  if (0 === $belfiusSortOrder->count()) {
115
+ $installer->run(
116
+ "
117
  UPDATE {$this->getTable('core_config_data')}
118
  SET path = 'payment/ops_belfiusDirectNet/sort_order'
119
  WHERE path = 'payment/ops_dexiaDirectNet/sort_order';
120
+ "
121
+ );
122
  }
123
  /*
124
  *
app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.05.30-13.06.07.php CHANGED
@@ -19,14 +19,17 @@ $conn->addColumn(
19
  "smallint(5) NULL DEFAULT NULL AFTER `state`"
20
  );
21
 
22
- $installer->run("
 
23
  UPDATE {$this->getTable('ops_alias')}
24
  SET state = '". Netresearch_OPS_Model_Alias_State::ACTIVE ."'
25
  WHERE alias IS NOT NULL;
26
 
27
- ");
 
28
 
29
- $installer->run("
 
30
  DELETE FROM {$this->getTable('ops_alias')}
31
  WHERE id NOT in (
32
  SELECT alias.id FROM (
@@ -35,27 +38,32 @@ $installer->run("
35
  ) as alias
36
  GROUP BY alias.customer_id, alias.billing_address_hash, alias.shipping_address_hash
37
  )
38
- ");
 
39
 
40
  $aliasActive = Mage::getModel('core/config_data')->getCollection()
41
  ->addFieldToFilter('path', 'payment/ops_cc/active_alias')
42
  ->load();
43
  if (0 === $aliasActive->count()) {
44
- $installer->run("
 
45
  UPDATE {$this->getTable('core_config_data')}
46
  SET path = 'payment/ops_cc/active_alias'
47
  WHERE path = 'payment/ops_alias/active';
48
- ");
 
49
  }
50
  $hintForGuestsActive = Mage::getModel('core/config_data')->getCollection()
51
  ->addFieldToFilter('path', 'payment/ops_cc/show_alias_manager_info_for_guests')
52
  ->load();
53
  if (0 == $hintForGuestsActive->count()) {
54
- $installer->run("
 
55
  UPDATE {$this->getTable('core_config_data')}
56
  SET path = 'payment/ops_cc/show_alias_manager_info_for_guests'
57
  WHERE path = 'payment/ops_alias/show_info_for_guests';
58
- ");
 
59
  }
60
 
61
  $installer->endSetup();
19
  "smallint(5) NULL DEFAULT NULL AFTER `state`"
20
  );
21
 
22
+ $installer->run(
23
+ "
24
  UPDATE {$this->getTable('ops_alias')}
25
  SET state = '". Netresearch_OPS_Model_Alias_State::ACTIVE ."'
26
  WHERE alias IS NOT NULL;
27
 
28
+ "
29
+ );
30
 
31
+ $installer->run(
32
+ "
33
  DELETE FROM {$this->getTable('ops_alias')}
34
  WHERE id NOT in (
35
  SELECT alias.id FROM (
38
  ) as alias
39
  GROUP BY alias.customer_id, alias.billing_address_hash, alias.shipping_address_hash
40
  )
41
+ "
42
+ );
43
 
44
  $aliasActive = Mage::getModel('core/config_data')->getCollection()
45
  ->addFieldToFilter('path', 'payment/ops_cc/active_alias')
46
  ->load();
47
  if (0 === $aliasActive->count()) {
48
+ $installer->run(
49
+ "
50
  UPDATE {$this->getTable('core_config_data')}
51
  SET path = 'payment/ops_cc/active_alias'
52
  WHERE path = 'payment/ops_alias/active';
53
+ "
54
+ );
55
  }
56
  $hintForGuestsActive = Mage::getModel('core/config_data')->getCollection()
57
  ->addFieldToFilter('path', 'payment/ops_cc/show_alias_manager_info_for_guests')
58
  ->load();
59
  if (0 == $hintForGuestsActive->count()) {
60
+ $installer->run(
61
+ "
62
  UPDATE {$this->getTable('core_config_data')}
63
  SET path = 'payment/ops_cc/show_alias_manager_info_for_guests'
64
  WHERE path = 'payment/ops_alias/show_info_for_guests';
65
+ "
66
+ );
67
  }
68
 
69
  $installer->endSetup();
app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.06.07-13.07.04.php CHANGED
@@ -4,12 +4,14 @@ $installer->startSetup();
4
 
5
 
6
 
7
- $installer->run("
 
8
  UPDATE {$this->getTable('core_config_data')}
9
  SET value = 'PayEngine Belfius Direct Net'
10
  WHERE path = 'payment/ops_belfiusDirectNet/title'
11
  AND value = 'PayEngine BelfiusDirectNet';
12
- ");
 
13
 
14
  $installer->endSetup();
15
 
4
 
5
 
6
 
7
+ $installer->run(
8
+ "
9
  UPDATE {$this->getTable('core_config_data')}
10
  SET value = 'PayEngine Belfius Direct Net'
11
  WHERE path = 'payment/ops_belfiusDirectNet/title'
12
  AND value = 'PayEngine BelfiusDirectNet';
13
+ "
14
+ );
15
 
16
  $installer->endSetup();
17
 
app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.11.04-13.11.05.php CHANGED
@@ -2,12 +2,14 @@
2
  $installer = $this;
3
  $installer->startSetup();
4
 
5
- $installer->run("
 
6
  UPDATE {$this->getTable('core_config_data')}
7
  SET value = '-100'
8
  WHERE path = 'payment/ops_cc/sort_order'
9
  AND value is NULL
10
- ");
 
11
 
12
  $installer->endSetup();
13
 
2
  $installer = $this;
3
  $installer->startSetup();
4
 
5
+ $installer->run(
6
+ "
7
  UPDATE {$this->getTable('core_config_data')}
8
  SET value = '-100'
9
  WHERE path = 'payment/ops_cc/sort_order'
10
  AND value is NULL
11
+ "
12
+ );
13
 
14
  $installer->endSetup();
15
 
app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-14.01.27-14.02.05.php CHANGED
@@ -46,8 +46,7 @@ $table = $installer->getConnection()
46
  ),
47
  'kwixo shipping details'
48
  )
49
- ->addIndex('unique', 'shipping_code')
50
- ;
51
  $installer->getConnection()->createTable($table);
52
  $installer->endSetup();
53
 
46
  ),
47
  'kwixo shipping details'
48
  )
49
+ ->addIndex('unique', 'shipping_code');
 
50
  $installer->getConnection()->createTable($table);
51
  $installer->endSetup();
52
 
app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-16.05.26-27.06.16.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @var Mage_Core_Model_Resource_Setup $installer */
3
+
4
+ $installer = $this;
5
+
6
+ $installer->getConnection()->modifyColumn(
7
+ $installer->getTable('ops/alias'), 'alias', "varchar(255) NULL DEFAULT NULL"
8
+ );
app/design/adminhtml/default/default/layout/ops.xml CHANGED
@@ -1,30 +1,25 @@
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
- * Magento
5
  *
6
  * NOTICE OF LICENSE
7
  *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
9
- * that is bundled with this package in the file LICENSE_AFL.txt.
10
  * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/afl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
  * DISCLAIMER
17
  *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
  *
22
- * @category design
23
- * @package default_default
24
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
25
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
  */
27
- -->
28
  <layout version="0.1.0">
29
  <add_order_grid_column_handle>
30
  <reference name="sales_order.grid">
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
+ * Netresearch_OPS
5
  *
6
  * NOTICE OF LICENSE
7
  *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
  * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
 
 
 
12
  *
13
  * DISCLAIMER
14
  *
15
+ * Do not edit or add to this file if you wish to upgrade this extension to
16
+ * newer versions in the future.
 
17
  *
18
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
19
+ * @license Open Software License (OSL 3.0)
20
+ * @link http://opensource.org/licenses/osl-3.0.php
 
21
  */
22
+ -->
23
  <layout version="0.1.0">
24
  <add_order_grid_column_handle>
25
  <reference name="sales_order.grid">
app/design/adminhtml/default/default/template/ops/categoriestree.phtml CHANGED
@@ -1,4 +1,23 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  ?>
3
  <div class="categories-side-col">
4
  <div class="content-header">
1
  <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
  ?>
22
  <div class="categories-side-col">
23
  <div class="content-header">
app/design/adminhtml/default/default/template/ops/form/cc.phtml CHANGED
@@ -27,37 +27,6 @@
27
 
28
  /** @var $this Netresearch_OPS_Block_Form_Cc */
29
  ?>
30
- <script type="text/javascript">
31
- Translator.add(
32
- 'Payment failed. Please select another payment method.',
33
- '<?php echo Mage::helper('ops')->__('Payment failed. Please select another payment method.') ?>'
34
- );
35
- Translator.add(
36
- 'Payment failed. Please review your input or select another payment method.',
37
- '<?php echo Mage::helper('ops')->__(
38
- 'Payment failed. Please review your input or select another payment method.'
39
- ) ?>'
40
- );
41
- Translator.add(
42
- 'LOAD_TOKEN',
43
- '<?php echo $this->__('Please wait, while we load the PayEngine payment form.'); ?>'
44
- );
45
-
46
- Translator.add(
47
- 'SUCCESS_TOKEN',
48
- "<?php echo $this->__(
49
- "Your payment data is ready to be processed by PayEngine. You can <a href='javascript:void(0)' onclick='payment.reloadIframe();'>reset it</a> or still select another payment method."
50
- ); ?>"
51
- );
52
-
53
- Translator.add(
54
- 'FAILURE_TOKEN',
55
- "<?php echo $this->__(
56
- "Your payment data could not be saved by PayEngine. Please <a href='javascript:void(0)' onclick='payment.reloadIframe();'>retry</a> or select another payment method."
57
- ); ?>"
58
- );
59
- </script>
60
-
61
  <style>
62
  .ops_tokenization_frame {
63
  height: 475px;
@@ -78,7 +47,7 @@
78
  <?php echo implode(', ', $this->getAliasBrands()), '.' ?>
79
  </li>
80
  <li><?php echo $this->__('Payment using 3D secure is not supported.'); ?></li>
81
- <input style="display:none;" name="payment[<?php echo $_code; ?>][alias]" value=""
82
  id="<?php echo $_code ?>_alias_input">
83
  </ul>
84
 
@@ -104,7 +73,9 @@
104
  'brandsForAliasInterface': '<?php echo json_encode(
105
  $this->getMethod()->getBrandsForAliasInterface()
106
  ) ?>'.evalJSON(),
107
- 'aliasManager': 'N'
 
 
108
  };
109
 
110
  locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
@@ -152,35 +123,12 @@
152
  }
153
  });
154
 
155
- payment.switchMethod = payment.switchMethod.wrap(function (originalMethod, method) {
156
-
157
- if (typeof window[method] != 'undefined') {
158
- if (typeof payment.currentMethodObject != 'undefined'
159
- && payment.currentMethodObject.code != method
160
- ) {
161
- payment.opsAliasSuccess = false;
162
- }
163
 
164
- payment.currentMethodObject = window[method];
165
- if (!payment.opsAliasSuccess && payment.currentMethodObject.tokenizationFrame.src == 'about:blank') {
166
- payment.reloadIframe();
167
- } else {
168
- toggleOrderSubmit(true);
169
- }
170
- } else {
171
- delete payment.currentMethodObject;
172
- }
173
  originalMethod(method);
174
  });
175
 
176
- var toggleOrderSubmit = function (active) {
177
- if (active) {
178
- enableElements('save')
179
- } else {
180
- disableElements('save')
181
- }
182
- };
183
-
184
  // on reload we have to hide the iframe and show a success token if save was successfull already
185
 
186
  if (payment.opsAliasSuccess && typeof payment.currentMethodObject != 'undefined') {
27
 
28
  /** @var $this Netresearch_OPS_Block_Form_Cc */
29
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  <style>
31
  .ops_tokenization_frame {
32
  height: 475px;
47
  <?php echo implode(', ', $this->getAliasBrands()), '.' ?>
48
  </li>
49
  <li><?php echo $this->__('Payment using 3D secure is not supported.'); ?></li>
50
+ <input style="display:none;" name="payment[<?php echo $_code; ?>_data][alias]" value=""
51
  id="<?php echo $_code ?>_alias_input">
52
  </ul>
53
 
73
  'brandsForAliasInterface': '<?php echo json_encode(
74
  $this->getMethod()->getBrandsForAliasInterface()
75
  ) ?>'.evalJSON(),
76
+ 'paymentMethod': 'CreditCard',
77
+ 'aliasManager': 'N',
78
+ 'brand': function () {return false}
79
  };
80
 
81
  locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
123
  }
124
  });
125
 
126
+ order.setPaymentMethod = order.setPaymentMethod.wrap(function (originalMethod, method) {
 
 
 
 
 
 
 
127
 
128
+ payment.opsAdminSwitchMethod(method);
 
 
 
 
 
 
 
 
129
  originalMethod(method);
130
  });
131
 
 
 
 
 
 
 
 
 
132
  // on reload we have to hide the iframe and show a success token if save was successfull already
133
 
134
  if (payment.opsAliasSuccess && typeof payment.currentMethodObject != 'undefined') {
app/design/adminhtml/default/default/template/ops/form/directDebit.phtml CHANGED
@@ -1,61 +1,189 @@
1
  <?php
2
  /**
3
- * Netresearch_OPS_Block_Form_OpsId
4
  *
5
- * @category design
6
- * @package OPS
7
- * @copyright 2012 Netresearch App Factory AG <http://www.netresearch.de>
8
- * @author Thomas Birke <thomas.birke@netresearch.de>
9
- * @license OSL 3.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  */
11
  ?>
 
 
 
 
 
 
 
 
12
  <?php
13
- /** @var Netresearch_OPS_Block_Form_DirectDebit $this */
14
- $this->getParams();
 
15
  ?>
16
- <script type="text/javascript">
17
- Translator.add(
18
- 'Account number must contain numbers only.',
19
- '<?php echo Mage::helper('ops')->__('Account number must contain numbers only.') ?>'
20
- );
21
- Translator.add(
22
- 'Bank code must contain numbers only.',
23
- '<?php echo Mage::helper('ops')->__('Bank code must contain numbers only.') ?>'
24
- );
25
- Translator.add(
26
- 'Payment failed. Please select another payment method.',
27
- '<?php echo Mage::helper('ops')->__('Payment failed. Please select another payment method.') ?>'
28
- );
29
- </script>
30
- <ul id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none">
31
- <li>
32
- <label for="ops_directdebit_country"><?php echo $this->__('country'); ?><em class="required">*</em></label><br/>
33
- <select title="ops_directdebit_country" class="required-entry" name="ops_directDebit[country]" id="ops_directdebit_country" onchange="payment.toggleOpsDirectDebitInputs(this.value)">
34
- <option value=""><?php echo $this->__('--Please Select--')?></option>
35
  <?php foreach ($this->getDirectDebitCountryIds() as $countryId) : ?>
36
- <option value="<?php echo $countryId; ?>" <?php if (strtoupper($countryId) == $this->getCountry()): ?> selected="selected" <?php endif; ?> ><?php echo Mage::getModel('directory/country')->loadByCode($countryId)->getName(); ?></option>
 
 
37
  <?php endforeach; ?>
38
  </select>
 
 
 
 
 
 
 
39
  </li>
40
- <li>
41
- <label for="ops_directdebit_CN"><?php echo $this->__('Account holder'); ?></label><br/>
42
- <?php $cn = trim($this->getQuote()->getBillingAddress()->getFirstname() . ' ' . $this->getQuote()->getBillingAddress()->getLastname()); ?>
43
- <input title="CN" value="<?php echo $this->getCardholderName(); ?>" class="input-text required-entry" autocomplete="off" type="text" name="ops_directDebit[CN]" id="ops_directdebit_CN" length="50" value="<?php echo $cn ?>"/>
44
- </li>
45
- <li>
46
- <label for="ops_directdebit_iban"><?php echo $this->__('IBAN'); ?></label><br/>
47
- <input title="IBAN" value="<?php echo $this->getIban(); ?>" class="input-text <?php if ($this->isIbanFieldRequired()): ?> required-entry <?php endif ?>" autocomplete="off" type="text" name="ops_directDebit[iban]" id="ops_directdebit_iban" onblur="payment.setRequiredDirectDebitFields(this);"/>
48
- </li>
49
- <li style="display:<?php echo ($this->isBicFieldVisible())? 'block' : 'none'; ?>">
50
- <label for="ops_directdebit_bic"><?php echo $this->__('BIC'); ?></label><br/>
51
- <input value="<?php echo $this->getBic(); ?>"class="input-text" type="text" name="ops_directDebit[bic]" id="ops_directdebit_bic" onblur="payment.setRequiredDirectDebitFields(this);"/>
52
- </li>
53
- <li>
54
- <label for="ops_directdebit_account"><?php echo $this->__('Account number'); ?></label><br/>
55
- <input value="<?php echo $this->getAccount(); ?>" title="account" class="input-text <?php if ($this->isAccountFieldRequired()): ?> required-entry <?php endif; ?>" autocomplete="off" type="text" name="ops_directDebit[account]" id="ops_directdebit_account" maxlength="11" onblur="payment.setRequiredDirectDebitFields(this);" />
56
- </li>
57
- <li style="display:<?php echo ($this->isBankCodeFieldVisible())? 'block' : 'none'; ?>">
58
- <label for="ops_directdebit_bankcode"><?php echo $this->__('Bank code'); ?></label><br/>
59
- <input value="<?php echo $this->getBankcode(); ?>" class="input-text <?php if ($this->isBankcodeFieldRequired()): ?> required-entry <?php endif; ?>" type="text" name="ops_directDebit[bankcode]" id="ops_directdebit_bankcode" maxlength="8" onblur="payment.setRequiredDirectDebitFields(this);" />
60
- </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </ul>
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ *
21
+ * Netresearch_OPS_Block_Form_DirectDebit
22
+ *
23
+ * @category design
24
+ * @package OPS
25
+ * @author Thomas Birke <thomas.birke@netresearch.de>
26
  */
27
  ?>
28
+
29
+ <style>
30
+ .ops_tokenization_frame {
31
+ height: 475px;
32
+ width: 100%;
33
+ border: none;
34
+ }
35
+ </style>
36
  <?php
37
+ /** @var Netresearch_OPS_Block_Form_DirectDebit $this */
38
+ $code = $this->getMethodCode();
39
+ $storeId = $this->getQuote()->getStoreId();
40
  ?>
41
+ <ul class="form-list ops-form-list ops_card" id="payment_form_<?php echo $code ?>" style="display:none;">
42
+
43
+ <!-- new Alias -->
44
+ <li id="insert_payment_details_<?php echo $code ?>" class="insert_payment_details" style="">
45
+ <label for="ops_directdebit_country_id"><?php echo $this->__('Country'); ?></label><br/>
46
+ <select title="ops_directebit_country_id" class="required-entry"
47
+ name="payment[<?php echo $code ?>_data][country_id]"
48
+ id="<?php echo $code ?>_country_id">
49
+ <option value=""><?php echo $this->__('--Please Select--') ?></option>
 
 
 
 
 
 
 
 
 
 
50
  <?php foreach ($this->getDirectDebitCountryIds() as $countryId) : ?>
51
+ <option value="<?php echo $countryId; ?>" <?php echo $this->getSelectedCountryId() == $countryId ? 'selected' : '' ?>>
52
+ <?php echo Mage::getModel('directory/country')->loadByCode($countryId)->getName(); ?>
53
+ </option>
54
  <?php endforeach; ?>
55
  </select>
56
+
57
+ <input style="display:none;" name="payment[<?php echo $code; ?>_data][alias]" value=""
58
+ id="<?php echo $code ?>_alias_input">
59
+
60
+ <iframe id="ops_iframe_<?php echo $code ?>" class="ops_tokenization_frame" style="display: block;"
61
+ src="about:blank"></iframe>
62
+ <div id="<?php echo $code ?>_loader" style="display: none; font-weight: bold;"></div>
63
  </li>
64
+ <script type="text/javascript">
65
+ opsHashUrl = '<?php echo $this->getGenerateHashUrl(null, true); ?>';
66
+ opsOrderId = '<?php echo $this->getQuote()->getId(); ?>';
67
+ opsPspid = '<?php echo $this->getPSPID($storeId); ?>';
68
+ opsAcceptUrl = '<?php echo $this->getAliasAcceptUrl(null, true); ?>';
69
+ opsExceptionUrl = '<?php echo $this->getAliasExceptionUrl(null, true); ?>';
70
+ opsUrl = '<?php echo $this->getAliasGatewayUrl($storeId); ?>';
71
+ opsAlias = '';
72
+
73
+ paramplus = 'RESPONSEFORMAT=JSON&isAjax=1';
74
+
75
+ <?php echo $code ?> = {
76
+ 'code': '<?php echo $code ?>',
77
+ 'loader': $('<?php echo $code ?>_loader'),
78
+ 'tokenizationFrame': $('ops_iframe_<?php echo $code ?>'),
79
+ 'aliasManager': 'N',
80
+ 'brand': function(){ return 'Direct Debits '+ $("<?php echo $code ?>_country_id").value;}
81
+ };
82
+
83
+ locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
84
+ transmitPaymentMethod = true;
85
+
86
+ Event.observe(document, 'alias:success', function (event) {
87
+ payment.fillOpsLoader('SUCCESS_TOKEN');
88
+ $(payment.currentMethodObject.code + '_alias_input').value = event.memo;
89
+ payment.opsAlias = {
90
+ "method": payment.currentMethodObject.code,
91
+ "alias": event.memo
92
+ };
93
+ toggleOrderSubmit(true);
94
+ payment.opsAliasSuccess = true;
95
+ });
96
+
97
+ Event.observe(document, 'alias:failure', function (event) {
98
+ payment.opsAliasSuccess = false;
99
+ payment.currentMethodObject.tokenizationFrame.src = 'about:blank';
100
+ payment.fillOpsLoader();
101
+ payment.fillOpsLoader('FAILURE_TOKEN');
102
+ });
103
+
104
+ Event.observe(<?php echo $code ?>.tokenizationFrame, 'load', function () {
105
+
106
+ if (<?php echo $code ?>.
107
+ tokenizationFrame.src != 'about:blank'
108
+ && !payment.opsAliasSuccess
109
+ )
110
+ {
111
+ <?php echo $code ?>.
112
+ loader.style.display = 'none';
113
+ <?php echo $code ?>.
114
+ tokenizationFrame.style.display = 'block';
115
+ }
116
+ }
117
+ )
118
+ ;
119
+ Event.observe('<?php echo $code; ?>_country_id', 'change', function () {
120
+ payment.handleBrandChange();
121
+ });
122
+
123
+ Event.observe(window, 'load', function (event) {
124
+ if (typeof window[order.paymentMethod] != 'undefined') {
125
+ payment.currentMethodObject = window[order.paymentMethod];
126
+ if (!payment.opsAliasSuccess
127
+ && payment.currentMethodObject.tokenizationFrame.src == 'about:blank'
128
+ && $(payment.currentMethodObject.code + '_country_id').value != ''
129
+ ) {
130
+ payment.handleBrandChange();
131
+ } else {
132
+ toggleOrderSubmit(true);
133
+ payment.fillOpsLoader('SUCCESS_TOKEN');
134
+ }
135
+ } else {
136
+ delete payment.currentMethodObject;
137
+ }
138
+ });
139
+
140
+ order.setPaymentMethod = order.setPaymentMethod.wrap(function (originalMethod, method) {
141
+
142
+ payment.opsAdminSwitchMethod(method);
143
+ originalMethod(method);
144
+ });
145
+
146
+ // on reload we have to hide the iframe and show a success token if save was successfull already
147
+
148
+ if (payment.opsAliasSuccess && typeof payment.currentMethodObject != 'undefined') {
149
+ payment.fillOpsLoader('SUCCESS_TOKEN');
150
+ }
151
+
152
+ payment.reloadIframe = function () {
153
+ toggleOrderSubmit(false);
154
+ payment.currentMethodObject.tokenizationFrame.src = 'about:blank';
155
+ payment.opsAliasSuccess = false;
156
+ payment.generateHash();
157
+ };
158
+
159
+ if (typeof payment.prepareOpsForm != 'undefined') {
160
+ payment.prepareOpsForm = payment.prepareOpsForm.wrap(function (originalMethod, hash) {
161
+ if (!hash) {
162
+ var form = originalMethod(hash);
163
+ var formKeyElement = document.createElement('input');
164
+ formKeyElement.id = 'form_key';
165
+ formKeyElement.name = 'form_key';
166
+ formKeyElement.value = '<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>';
167
+ form.appendChild(formKeyElement);
168
+
169
+ return form;
170
+ } else {
171
+ return originalMethod(hash);
172
+ }
173
+
174
+ });
175
+ }
176
+
177
+ if (typeof window[order.paymentMethod] != 'undefined') {
178
+ payment.currentMethodObject = window[order.paymentMethod];
179
+ }
180
+
181
+ if (typeof payment.opsAlias != 'undefined') {
182
+ if (payment.opsAlias.method == order.paymentMethod) {
183
+ $(payment.opsAlias.method + '_alias_input').value = payment.opsAlias.alias;
184
+ payment.fillOpsLoader();
185
+ payment.fillOpsLoader('SUCCESS_TOKEN');
186
+ }
187
+ }
188
+ </script>
189
  </ul>
app/design/adminhtml/default/default/template/ops/form/opsId.phtml CHANGED
@@ -1,12 +1,29 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * Netresearch_OPS_Block_Form_OpsId
4
  *
5
  * @category design
6
  * @package OPS
7
- * @copyright 2012 Netresearch App Factory AG <http://www.netresearch.de>
8
- * @author Thomas Birke <thomas.birke@netresearch.de>
9
- * @license OSL 3.0
10
  */
11
  ?>
12
  <ul id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none">
1
  <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
  /**
22
  * Netresearch_OPS_Block_Form_OpsId
23
  *
24
  * @category design
25
  * @package OPS
26
+ * @author Thomas Birke <thomas.birke@netresearch.de>
 
 
27
  */
28
  ?>
29
  <ul id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none">
app/design/adminhtml/default/default/template/ops/form/payPerMail.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ /**
22
+ * Netresearch_OPS_Block_Form_PayPerMail
23
+ *
24
+ * @category design
25
+ * @package OPS
26
+ * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
27
+ */
28
+ ?>
29
+ <ul id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none">
30
+ </ul>
31
+
app/design/adminhtml/default/default/template/ops/info.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?><br />
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?><br />
app/design/adminhtml/default/default/template/ops/info/bancontact.phtml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
+ <?php /** @var Netresearch_OPS_Block_Info_Bancontact $this */ ?>
23
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?><br />
24
+ <?php echo Mage::helper('payment')->__('Payment ID: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('paymentId'))) ?><br/>
25
+ <?php echo Mage::helper('payment')->__('Status: %s', Mage::helper('ops')->getStatusText($this->getInfo()->getAdditionalInformation('status'))) ?><br/>
26
+ <?php if ($this->getInfo()->hasAdditionalInformation('acceptance')): ?>
27
+ <?php echo Mage::helper('payment')->__('Acceptance: %s', $this->getInfo()->getAdditionalInformation('acceptance')) ?><br/>
28
+ <?php endif; ?>
29
+
30
+ <?php echo Mage::helper('payment')->__('Device: %s', $this->getDeviceParameter()) ?><br/>
31
+ <?php echo Mage::helper('payment')->__('Mobilemode: %s', $this->getMobileModeParameter()) ?><br/>
32
+
33
+ <?php $scoring = $this->getInfo()->getAdditionalInformation('scoring'); ?>
34
+ <?php $scoringCategory = $this->getInfo()->getAdditionalInformation('scoringCategory'); ?>
35
+
36
+ <?php
37
+ $scoringCssClass = '';
38
+ if (0 < strlen(trim($scoringCategory))):
39
+ $scoringCssClass = 'scoring-' . $scoringCategory;
40
+ endif; ?>
41
+ <?php $scoringInformation = $this->getInfo()->getAdditionalInformation('additionalScoringData'); ?>
42
+ <?php if ($scoringInformation): ?>
43
+ <table class="scoring <?php echo $this->htmlEscape($scoringCssClass); ?>">
44
+ <tr>
45
+ <th colspan="3" class="scoring scoring-<?php echo $this->htmlEscape($scoringCategory); ?>">
46
+ <?php if (is_numeric($scoring) && 0 <= (int) $scoring): ?>
47
+ <?php echo Mage::helper('ops')->__('Scoring Value: %s', $this->htmlEscape($scoring)) ?><br />
48
+ <?php endif; ?>
49
+ <?php if (0 < strlen(trim($scoringCategory))): ?>
50
+ <?php echo Mage::helper('ops')->__(sprintf('Scoring Category: %s', $this->htmlEscape($scoringCategory))) ?>
51
+ <?php endif; ?>
52
+ </th>
53
+ </tr>
54
+ <?php if (true === is_array($scoringInformation)): ?>
55
+ <?php foreach($scoringInformation as $key => $value): ?>
56
+ <tr>
57
+ <th><?php echo Mage::helper('ops')->__($key); ?></th>
58
+ <td><?php echo $value; ?></td>
59
+ <td class="ops_scoring_description">
60
+ <?php $descriptionTranslationTemplate = 'SCORING_DESCRIPTION_' . $key; ?>
61
+ <?php $description = Mage::helper('ops')->__($descriptionTranslationTemplate) ?>
62
+ <?php if ($description != $descriptionTranslationTemplate): ?>
63
+ <img src="<?php echo $this->getSkinUrl('images/fam_help.gif') ?>" alt="?" />
64
+ <div>
65
+ <?php echo $description ?>
66
+ </div>
67
+ <?php endif; ?>
68
+ </td>
69
+ </tr>
70
+ <?php endforeach; ?>
71
+ <?php endif; ?>
72
+ </table>
73
+ <?php endif; ?>
74
+ <?php if ('O' == $scoringCategory): ?>
75
+ <div class="notice-msg" style="padding: 9px 30px; margin-top: 3px">
76
+ <?php echo Mage::helper('ops')->__('This might be a fraud attempt. Please check details for more information.') ?>
77
+ </div>
78
+ <?php endif; ?>
79
+ <?php if (!is_numeric($scoring) && 0 < strlen(trim($scoringCategory)) && 0 == sizeof($scoringInformation)): ?>
80
+ <?php echo Mage::helper('ops')->__('No scoring information available'); ?>
81
+ <?php endif; ?>
app/design/adminhtml/default/default/template/ops/info/cc.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
app/design/adminhtml/default/default/template/ops/info/opsId.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
app/design/adminhtml/default/default/template/ops/info/payPerMail.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
23
+ <?php echo Mage::helper('payment')->__('Payment ID: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('paymentId'))) ?><br/>
app/design/adminhtml/default/default/template/ops/info/redirect.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
 
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
 
app/design/adminhtml/default/default/template/ops/sales/order/creditmemo/closed-transaction/warning.phtml CHANGED
@@ -1,3 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <ul class="messages">
2
  <li class="warning-msg">
3
  <?php
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
  <ul class="messages">
23
  <li class="warning-msg">
24
  <?php
app/design/adminhtml/default/default/template/ops/sales/order/creditmemo/totals/checkbox.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Michael Lühr <michael.luehr@netresearch.de>
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
  ?>
27
  <div class="order-totals-bottom">
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
  <div class="order-totals-bottom">
app/design/adminhtml/default/default/template/ops/system/config/kwixoconfiglinks.phtml CHANGED
@@ -1,3 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <span style="margin-right: 5px;">
2
  <?php echo $this->__(
3
  "Don't forget to set your shipping method to use KWIXO in the best way"
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
  <span style="margin-right: 5px;">
23
  <?php echo $this->__(
24
  "Don't forget to set your shipping method to use KWIXO in the best way"
app/design/adminhtml/default/default/template/ops/system/config/support.phtml CHANGED
@@ -1,3 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <table cellspacing="0" class="switcher" width="100%" class="form-list">
2
  <col width="300px"/>
3
  <col/>
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
  <table cellspacing="0" class="switcher" width="100%" class="form-list">
23
  <col width="300px"/>
24
  <col/>
app/design/frontend/base/default/layout/ops.xml CHANGED
@@ -1,28 +1,23 @@
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
- * Magento
5
  *
6
  * NOTICE OF LICENSE
7
  *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
9
- * that is bundled with this package in the file LICENSE_AFL.txt.
10
  * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/afl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
  *
16
  * DISCLAIMER
17
  *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
  *
22
- * @category design
23
- * @package default_default
24
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
25
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
  */
27
  -->
28
  <layout version="0.1.0">
@@ -114,15 +109,38 @@
114
  </ops_payment_placeform>
115
 
116
  <ops_payment_retry>
 
 
 
 
 
117
  <reference name="head">
 
 
 
 
118
  <action method="addCss">
119
  <stylesheet>css/ops.css</stylesheet>
120
  </action>
 
 
 
 
 
 
 
 
 
121
  </reference>
122
  <remove name="right"/>
123
  <remove name="left"/>
124
  <reference name="content">
125
- <block type="ops/retryPayment" name="ops_placeform" template="ops/placeform.phtml"/>
 
 
 
 
 
126
  </reference>
127
  </ops_payment_retry>
128
 
@@ -135,6 +153,11 @@
135
  </ops_payment_placeform3dsecure>
136
 
137
  <customer_account>
 
 
 
 
 
138
  <reference name="customer_account_navigation">
139
  <action method="addLink" translate="label" module="ops" ifconfig="payment/ops_cc/active_alias">
140
  <name>ops_payment_information</name>
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
+ * Netresearch_OPS
5
  *
6
  * NOTICE OF LICENSE
7
  *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
  * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
 
 
 
12
  *
13
  * DISCLAIMER
14
  *
15
+ * Do not edit or add to this file if you wish to upgrade this extension to
16
+ * newer versions in the future.
 
17
  *
18
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
19
+ * @license Open Software License (OSL 3.0)
20
+ * @link http://opensource.org/licenses/osl-3.0.php
 
21
  */
22
  -->
23
  <layout version="0.1.0">
109
  </ops_payment_placeform>
110
 
111
  <ops_payment_retry>
112
+ <reference name="root">
113
+ <action method="setTemplate">
114
+ <template>page/1column.phtml</template>
115
+ </action>
116
+ </reference>
117
  <reference name="head">
118
+ <action method="addItem">
119
+ <type>skin_js</type>
120
+ <name>js/opcheckout.js</name>
121
+ </action>
122
  <action method="addCss">
123
  <stylesheet>css/ops.css</stylesheet>
124
  </action>
125
+ <action method="addJs">
126
+ <script>netresearch/ops/tokenization.js</script>
127
+ </action>
128
+ <action method="addJs">
129
+ <script>netresearch/ops/payment.js</script>
130
+ </action>
131
+ <action method="addJs">
132
+ <script>varien/accordion.js</script>
133
+ </action>
134
  </reference>
135
  <remove name="right"/>
136
  <remove name="left"/>
137
  <reference name="content">
138
+ <block type="ops/retryPayment" name="ops_retryPayment" template="ops/retryPayment.phtml">
139
+ <block type="ops/retryPayment_methods" name="ops_retryPayment_methods" template="checkout/onepage/payment/methods.phtml">
140
+ <block type="core/template" name="checkout.onepage.payment.methods.scripts" as="scripts" />
141
+ <block type="core/template" name="checkout.onepage.payment.methods.additional" as="additional" />
142
+ </block>
143
+ </block>
144
  </reference>
145
  </ops_payment_retry>
146
 
153
  </ops_payment_placeform3dsecure>
154
 
155
  <customer_account>
156
+ <reference name="head">
157
+ <action method="addCss">
158
+ <stylesheet>css/ops.css</stylesheet>
159
+ </action>
160
+ </reference>
161
  <reference name="customer_account_navigation">
162
  <action method="addLink" translate="label" module="ops" ifconfig="payment/ops_cc/active_alias">
163
  <name>ops_payment_information</name>
app/design/frontend/base/default/template/ops/customer/alias/list.phtml CHANGED
@@ -28,23 +28,20 @@
28
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
29
  <?php echo $this->getChildHtml('pager'); ?>
30
  <?php if(count($aliases)): ?>
31
- <table class="data-table" id="ops-payment-information-table">
32
- <col width="1" />
33
- <col />
34
- <col width="1" />
35
- <col width="1" />
36
- <thead>
37
- <tr>
38
- <th><?php echo Mage::helper('ops')->__('Payment method') ?></th>
39
- <th><?php echo Mage::helper('ops')->__('Credit Card Type') ?></th>
40
- <th><?php echo Mage::helper('ops')->__('Card Number/Account Number') ?></th>
41
- <th><?php echo Mage::helper('ops')->__('Expiration Date') ?></th>
42
- <th><?php echo Mage::helper('ops')->__('Card Holder') ?></th>
43
- <th><?php echo Mage::helper('ops')->__('State') ?></th>
44
- <th></th>
45
- </tr>
46
- </thead>
47
- <tbody>
48
  <?php $_odd = ''; ?>
49
  <?php foreach ($aliases as $alias): ?>
50
  <?php $deleteUrl = $this->getAliasDeleteUrl($alias->getId()); ?>
@@ -58,8 +55,9 @@
58
  <td><a href="<?php echo $deleteUrl ?>"><?php echo Mage::helper('ops')->__('Delete') ?></a></td>
59
  </tr>
60
  <?php endforeach; ?>
61
- </tbody>
62
- </table>
 
63
  <?php else: ?>
64
  <p><?php echo Mage::helper('ops')->__('You did not save any payment information, yet.'); ?></p>
65
  <?php endif; ?>
28
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
29
  <?php echo $this->getChildHtml('pager'); ?>
30
  <?php if(count($aliases)): ?>
31
+ <div class="ops-table-responsive">
32
+ <table class="data-table" id="ops-payment-information-table">
33
+ <thead>
34
+ <tr>
35
+ <th><?php echo Mage::helper('ops')->__('Payment method') ?></th>
36
+ <th><?php echo Mage::helper('ops')->__('Credit Card Type') ?></th>
37
+ <th><?php echo Mage::helper('ops')->__('Card Number/Account Number') ?></th>
38
+ <th><?php echo Mage::helper('ops')->__('Expiration Date') ?></th>
39
+ <th><?php echo Mage::helper('ops')->__('Card Holder') ?></th>
40
+ <th><?php echo Mage::helper('ops')->__('State') ?></th>
41
+ <th></th>
42
+ </tr>
43
+ </thead>
44
+ <tbody>
 
 
 
45
  <?php $_odd = ''; ?>
46
  <?php foreach ($aliases as $alias): ?>
47
  <?php $deleteUrl = $this->getAliasDeleteUrl($alias->getId()); ?>
55
  <td><a href="<?php echo $deleteUrl ?>"><?php echo Mage::helper('ops')->__('Delete') ?></a></td>
56
  </tr>
57
  <?php endforeach; ?>
58
+ </tbody>
59
+ </table>
60
+ </div>
61
  <?php else: ?>
62
  <p><?php echo Mage::helper('ops')->__('You did not save any payment information, yet.'); ?></p>
63
  <?php endif; ?>
app/design/frontend/base/default/template/ops/form.phtml CHANGED
@@ -31,72 +31,8 @@
31
  $_code = $this->getMethodCode();
32
  $isUserRegistering = $this->isUserRegistering();
33
  ?>
34
-
35
- <script type="text/javascript">
36
- Translator.add(
37
- 'Payment failed. Please select another payment method.',
38
- '<?php echo Mage::helper('ops')->__('Payment failed. Please select another payment method.') ?>'
39
- );
40
- Translator.add(
41
- 'Payment failed. Please review your input or select another payment method.',
42
- '<?php echo Mage::helper('ops')->__(
43
- 'Payment failed. Please review your input or select another payment method.'
44
- ) ?>'
45
- );
46
- Translator.add(
47
- 'This is a required field.',
48
- '<?php echo Mage::helper('ops')->__('This is a required field.') ?>'
49
- );
50
- </script>
51
-
52
-
53
  <ul class="form-list ops-form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
54
-
55
- <?php if ($_code == 'ops_bankTransfer') : ?>
56
- <li>
57
- <label class="required-entry" for="ops_banktransfer_country_id"><?php echo $this->__(
58
- 'Country'
59
- ); ?></label><br/>
60
- <select title="ops_banktransfer_country_id" class="required-entry" name="payment[country_id]"
61
- id="ops_banktransfer_country_id">
62
- <option value=""><?php echo $this->__('--Please Select--') ?></option>
63
- <?php foreach ($this->getBankTransferCountryIds() as $countryId) : ?>
64
- <?php if ('*' == $countryId || '' == $countryId): ?>
65
- <option value="*">
66
- <?php echo Mage::helper('ops')->__('Miscellaneous Countries'); ?>
67
- </option>
68
- <?php else: ?>
69
- <option value="<?php echo $countryId; ?>">
70
- <?php echo Mage::getModel('directory/country')->loadByCode($countryId)->getName(); ?>
71
- </option>
72
- <?php endif ?>
73
- <?php endforeach; ?>
74
- </select>
75
- </li>
76
- <?php elseif ($_code == 'ops_directEbanking') : ?>
77
- <?php $brands = $this->getDirectEbankingBrands(); ?>
78
- <?php if (count($brands) == 1): ?>
79
- <li><input type="hidden" name="payment[directEbanking_brand]" id="ops_directEbanking_country_id"
80
- value="<?php echo $this->escapeHtml(current($brands)); ?>"></li>
81
- <?php endif; ?>
82
- <?php if (1 < count($brands)): ?>
83
- <li>
84
- <label class="required-entry" for="ops_directEbanking_country_id"><?php echo $this->__(
85
- 'country'
86
- ); ?></label><br/>
87
- <select class="required-entry" name="payment[directEbanking_brand]" id="ops_directEbanking_country_id">
88
- <option value=""><?php echo $this->__('--Please Select--') ?></option>
89
- <?php foreach ($brands as $brand) : ?>
90
- <option value="<?php echo $brand; ?>">
91
- <?php echo Mage::helper('ops')->__($brand); ?>
92
- </option>
93
- <?php endforeach; ?>
94
- </select>
95
- </li>
96
- <?php endif; ?>
97
- <?php else : ?>
98
- <?php echo $this->__('You will be redirected to PayEngine website when you place an order.') ?>
99
- <?php endif; ?>
100
  </ul>
101
 
102
 
31
  $_code = $this->getMethodCode();
32
  $isUserRegistering = $this->isUserRegistering();
33
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  <ul class="form-list ops-form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
35
+ <?php echo $this->getRedirectMessage(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  </ul>
37
 
38
 
app/design/frontend/base/default/template/ops/form/alias.phtml CHANGED
@@ -19,10 +19,10 @@
19
 
20
  /* $this instanceof Netresearch_OPS_Block_Form_Alias */
21
  ?>
22
- <?php $_code = $this->getMethodCode() ?>
23
  <?php $helper = Mage::helper('ops') ?>
24
 
25
- <ul class="form-list ops-form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
26
  <li>
27
  <?php $inputType = (1 < count($this->getAvailableAliases())) ? 'radio' : 'hidden' ?>
28
  <?php foreach ($this->getAvailableAliases() as $offset=>$alias): ?>
19
 
20
  /* $this instanceof Netresearch_OPS_Block_Form_Alias */
21
  ?>
22
+ <?php $code = $this->getMethodCode() ?>
23
  <?php $helper = Mage::helper('ops') ?>
24
 
25
+ <ul class="form-list ops-form-list" id="payment_form_<?php echo $code ?>" style="display:none;">
26
  <li>
27
  <?php $inputType = (1 < count($this->getAvailableAliases())) ? 'radio' : 'hidden' ?>
28
  <?php foreach ($this->getAvailableAliases() as $offset=>$alias): ?>
app/design/frontend/base/default/template/ops/form/bankTransfer.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
+
23
+ <?php
24
+ /** @var Netresearch_OPS_Block_Form_BankTransfer $this */
25
+ $code = $this->getMethodCode();
26
+ ?>
27
+
28
+
29
+ <ul class="form-list ops-form-list" id="payment_form_<?php echo $code ?>" style="display:none;">
30
+ <li>
31
+ <label class="required-entry" for="ops_banktransfer_country_id"><?php echo $this->__('Country'); ?></label><br/>
32
+ <select title="ops_banktransfer_country_id" class="required-entry" name="payment[country_id]"
33
+ id="ops_banktransfer_country_id">
34
+ <option value=""><?php echo $this->__('--Please Select--') ?></option>
35
+ <?php foreach ($this->getBankTransferCountryIds() as $countryId) : ?>
36
+ <?php if ('*' == $countryId || '' == $countryId): ?>
37
+ <option value="*">
38
+ <?php echo Mage::helper('ops')->__('Miscellaneous Countries'); ?>
39
+ </option>
40
+ <?php else: ?>
41
+ <option value="<?php echo $countryId; ?>">
42
+ <?php echo Mage::getModel('directory/country')->loadByCode($countryId)->getName(); ?>
43
+ </option>
44
+ <?php endif ?>
45
+ <?php endforeach; ?>
46
+ </select>
47
+ </li>
48
+ <p><?php echo $this->getRedirectMessage(); ?></p>
49
+ </ul>
50
+
51
+
app/design/frontend/base/default/template/ops/form/cc.phtml CHANGED
@@ -1,60 +1,40 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * @var Netresearch_OPS_Block_Form_Cc $this
4
  */
5
- $_code = $this->getMethodCode();
6
  ?>
7
- <script type="text/javascript">
8
- Translator.add(
9
- 'Payment failed. Please select another payment method.',
10
- '<?php echo Mage::helper('ops')->__('Payment failed. Please select another payment method.') ?>'
11
- );
12
- Translator.add(
13
- 'Payment failed. Please review your input or select another payment method.',
14
- '<?php echo Mage::helper('ops')->__(
15
- 'Payment failed. Please review your input or select another payment method.'
16
- ) ?>'
17
- );
18
- Translator.add(
19
- 'Incorrect credit card expiration date.',
20
- '<?php echo Mage::helper('ops')->__('Incorrect credit card expiration date.') ?>'
21
- );
22
-
23
- Translator.add(
24
- 'LOAD_TOKEN',
25
- '<?php echo $this->__('Please wait, while we load the PayEngine payment form.'); ?>'
26
- );
27
-
28
- Translator.add(
29
- 'SUCCESS_TOKEN',
30
- "<?php echo $this->__(
31
- "Your payment data is ready to be processed by PayEngine. You can <a href='javascript:void(0)' onclick='payment.handleBrandChange();'>reset it</a> or still select another payment method."
32
- ); ?>"
33
- );
34
-
35
- Translator.add(
36
- 'FAILURE_TOKEN',
37
- "<?php echo $this->__(
38
- "Your payment data could not be saved by PayEngine. Please <a href='javascript:void(0)' onclick='payment.handleBrandChange();'>retry</a> or select another payment method."
39
- ); ?>"
40
- );
41
- Translator.add(
42
- 'This is a required field.',
43
- '<?php echo Mage::helper('ops')->__('This is a required field.') ?>'
44
- );
45
- </script>
46
- <ul class="form-list ops-form-list ops_card" id="payment_form_<?php echo $_code ?>" style="display:none;">
47
 
48
  <?php
49
  $display = 'none';
50
  $storedAliases = $this->getStoredAliasForCustomer();
51
- $newAlias = Mage::helper('ops/alias')->getAlias($this->getQuote(), true);
52
  ?>
53
 
54
  <fieldset>
55
  <?php foreach ($storedAliases as $key => $alias): ?>
56
  <?php $brandName = $this->getStoredAliasBrand($alias->getId()) ?>
57
- <input type="radio" id="<?php echo $alias->getId() ?>" name="payment[<?php echo $_code ?>][alias]"
58
  value="<?php echo $alias->getAlias() ?>"
59
  data-brand="<?php echo $brandName ?>"
60
  data-cn="<?php echo $this->getCardHolderName($alias->getId()) ?>"
@@ -62,52 +42,54 @@ $_code = $this->getMethodCode();
62
  <label for="<?php echo $alias->getId() ?>">
63
  <ul>
64
  <li><?php echo $this->__('Name on Card') . ': ' . $this->getCardHolderName($alias->getId()) ?></li>
65
- <li><?php echo $this->__('Credit Card Number') . ': ' . $this->getAliasCardNumber(
66
- $alias->getId()
67
- ) ?></li>
 
 
68
  <li>
69
  <?php echo $this->__('Credit Card Type:') ?>
70
- <img src="<?php echo $this->getImageForBrand($brandName) ?>" alt="<?php echo $brandName ?>">
 
71
  </li>
72
- <li><?php echo $this->__('Expiration Date') . ': ' . $this->getExpirationDatePart(
73
- $alias->getId(), 'complete'
74
- ) ?></li>
75
-
76
- <li class="cvc" style="display: none;">
77
- <label class="required" for="<?php echo strtoupper($_code) ?>_CVC_<?php echo $alias->getId(
78
- ) ?>"><?php echo $this->__('Card Verification Number'); ?><em>*</em></label>
79
- <input title="<?php echo $this->__('Card Verification Number'); ?>"
80
- class="input-text required-entry"
81
- type="text" name="payment[<?php echo $_code ?>][cvc]"
82
- id="<?php echo strtoupper($_code) ?>_CVC_<?php echo $alias->getId() ?>" length="6"/>
83
-
84
  </li>
 
 
 
 
 
 
 
 
 
 
 
85
  </ul>
86
  </label>
87
  <?php endforeach; ?>
88
- <?php if (count($storedAliases) > 0): ?>
89
- <input type="select" id="<?php echo $_code; ?>_stored_alias_brand"
90
- name="payment[<?php echo $_code; ?>][CC_BRAND]" class="hidden">
91
  <?php foreach ($this->getAliasBrands() as $brand) : ?>
92
  <option value="<?php echo $brand; ?>" class="hidden">
93
  <?php echo $this->__($brand); ?>
94
  </option>
95
  <?php endforeach; ?>
96
  <?php endif; ?>
97
- </input>
98
- <input type="radio" id="new_alias_<?php echo $_code ?>" name="payment[<?php echo $_code ?>][alias]"
99
  class="validate-one-required-by-name" value="" <?php echo empty($storedAliases)
100
  ? 'checked' : ''; ?> required>
101
- <label for="new_alias_<?php echo $_code ?>" class="new_alias_label"> <?php echo $this->__(
102
- 'Enter new credit card data...'
103
- ) ?> </label>
104
- <li id="insert_payment_details_<?php echo $_code ?>" class="insert_payment_details" style="">
105
- <label class="required" for="<?php echo strtoupper($_code) ?>_BRAND"
106
- id="<?php echo strtoupper($_code) ?>_BRAND_LABEL"><?php echo $this->__(
107
- 'Credit Card Type'
108
- ); ?></label><br/>
109
- <select title="<?php echo strtoupper($_code) ?>_BRAND" class="required-entry" autocomplete="off"
110
- name="payment[<?php echo $_code; ?>][CC_BRAND]" id="<?php echo strtoupper($_code) ?>_BRAND">
111
  <option value=""><?php echo $this->__('--Please select--') ?></option>
112
  <?php foreach ($this->getCCBrands() as $brand) : ?>
113
  <option value="<?php echo $brand; ?>">
@@ -116,13 +98,11 @@ $_code = $this->getMethodCode();
116
  <?php endforeach; ?>
117
  </select>
118
 
119
- <div id="<?php echo $_code ?>_loader" class="ops_htp_loader" style="display: none;"></div>
120
- <iframe id="ops_iframe_<?php echo $_code ?>" class="ops_htp_iframe" style="display: none;"
121
  src="about:blank"></iframe>
122
- <p id="<?php echo $_code ?>_redirect_note" class="ops_htp_redirect"
123
- style="display: none;"><?php echo $this->__(
124
- 'You will be redirected to PayEngine website when you place an order.'
125
- ) ?></p>
126
  </li>
127
 
128
  <script type="text/javascript">
@@ -134,34 +114,41 @@ $_code = $this->getMethodCode();
134
  opsUrl = '<?php echo $this->getAliasGatewayUrl(); ?>';
135
  opsAlias = '';
136
 
 
137
  paramplus = 'RESPONSEFORMAT=JSON';
138
 
139
- <?php echo $_code ?> = {
140
- 'code': '<?php echo $_code ?>',
141
- 'loader': $('<?php echo $_code ?>_loader'),
142
- 'tokenizationFrame': $('ops_iframe_<?php echo $_code ?>'),
143
- 'redirectNote': $('<?php echo $_code ?>_redirect_note'),
144
  'brandsForAliasInterface': '<?php echo json_encode(
145
  $this->getMethod()->getBrandsForAliasInterface()
146
  ) ?>'.evalJSON(),
147
- 'aliasManager': <?php echo $this->getConfig()->isAliasManagerEnabled($this->getMethodCode()) ? 'true' : 'false' ?>
 
 
 
 
148
  };
149
  locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
150
  transmitPaymentMethod = false;
151
 
152
- Event.observe('<?php echo strtoupper($_code); ?>_BRAND', 'change', function () {
153
  payment.handleBrandChange();
154
  });
155
 
156
- Event.observe(<?php echo $_code ?>.tokenizationFrame, 'load', function () {
157
- payment.onOpsIframeLoad();
158
- }
159
- )
160
- ;
161
 
162
  Event.observe(document, 'alias:success', function (event) {
163
- payment.fillOpsLoader('SUCCESS_TOKEN');
164
- payment.toggleContinue(true);
 
 
165
  payment.opsAliasSuccess = true;
166
  $('new_alias_' + payment.currentMethod).value = event.memo;
167
  payment.save();
@@ -170,8 +157,10 @@ $_code = $this->getMethodCode();
170
  Event.observe(document, 'alias:failure', function (event) {
171
  payment.opsAliasSuccess = false;
172
  payment.currentMethodObject.tokenizationFrame.src = 'about:blank';
173
- payment.fillOpsLoader('FAILURE_TOKEN');
174
- payment.toggleContinue(false);
 
 
175
  });
176
 
177
  </script>
1
  <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
  /**
23
  * @var Netresearch_OPS_Block_Form_Cc $this
24
  */
25
+ $code = $this->getMethodCode();
26
  ?>
27
+ <ul class="form-list ops-form-list ops_card" id="payment_form_<?php echo $code ?>" style="display:none;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  <?php
30
  $display = 'none';
31
  $storedAliases = $this->getStoredAliasForCustomer();
 
32
  ?>
33
 
34
  <fieldset>
35
  <?php foreach ($storedAliases as $key => $alias): ?>
36
  <?php $brandName = $this->getStoredAliasBrand($alias->getId()) ?>
37
+ <input type="radio" id="<?php echo $alias->getId() ?>" name="payment[<?php echo $code ?>_data][alias]"
38
  value="<?php echo $alias->getAlias() ?>"
39
  data-brand="<?php echo $brandName ?>"
40
  data-cn="<?php echo $this->getCardHolderName($alias->getId()) ?>"
42
  <label for="<?php echo $alias->getId() ?>">
43
  <ul>
44
  <li><?php echo $this->__('Name on Card') . ': ' . $this->getCardHolderName($alias->getId()) ?></li>
45
+ <li>
46
+ <?php echo $this->__('Credit Card Number') . ': '
47
+ . $this->getAliasCardNumber($alias->getId());
48
+ ?>
49
+ </li>
50
  <li>
51
  <?php echo $this->__('Credit Card Type:') ?>
52
+ <img src="<?php echo $this->getImageForBrand($brandName) ?>" alt="<?php echo $brandName ?>"
53
+ class="ops-brandlogo">
54
  </li>
55
+ <li><?php echo $this->__('Expiration Date') . ': '
56
+ . $this->getExpirationDatePart($alias->getId(), 'complete');
57
+ ?>
 
 
 
 
 
 
 
 
 
58
  </li>
59
+
60
+ <?php if ($this->checkIfBrandHasAliasInterfaceSupport($alias->getId())): ?>
61
+ <li class="cvc" style="display: none;">
62
+ <label class="required" for="<?php echo strtoupper($code) ?>_CVC_<?php echo $alias->getId(
63
+ ) ?>"><?php echo $this->__('Card Verification Number'); ?><em>*</em></label>
64
+ <input title="<?php echo $this->__('Card Verification Number'); ?>"
65
+ class="input-text required-entry"
66
+ type="text" name="payment[<?php echo $code ?>_data][cvc]"
67
+ id="<?php echo strtoupper($code) ?>_CVC_<?php echo $alias->getId() ?>" length="6"/>
68
+ </li>
69
+ <?php endif; ?>
70
  </ul>
71
  </label>
72
  <?php endforeach; ?>
73
+ <?php if (!empty($storedAliases)): ?>
74
+ <input type="select" id="<?php echo $code; ?>_stored_alias_brand"
75
+ name="payment[<?php echo $code; ?>_data][CC_BRAND]" class="hidden">
76
  <?php foreach ($this->getAliasBrands() as $brand) : ?>
77
  <option value="<?php echo $brand; ?>" class="hidden">
78
  <?php echo $this->__($brand); ?>
79
  </option>
80
  <?php endforeach; ?>
81
  <?php endif; ?>
82
+ <input type="radio" id="new_alias_<?php echo $code ?>" name="payment[<?php echo $code ?>_data][alias]"
 
83
  class="validate-one-required-by-name" value="" <?php echo empty($storedAliases)
84
  ? 'checked' : ''; ?> required>
85
+ <label for="new_alias_<?php echo $code ?>" class="new_alias_label">
86
+ <?php echo $this->__('Enter new credit card data...') ?></label>
87
+ <li id="insert_payment_details_<?php echo $code ?>" class="insert_payment_details" style="">
88
+ <label class="required" for="<?php echo strtoupper($code) ?>_BRAND"
89
+ id="<?php echo strtoupper($code) ?>_BRAND_LABEL">
90
+ <?php echo $this->__('Credit Card Type'); ?></label><br/>
91
+ <select title="<?php echo strtoupper($code) ?>_BRAND" class="required-entry" autocomplete="off"
92
+ name="payment[<?php echo $code; ?>_data][CC_BRAND]" id="<?php echo strtoupper($code) ?>_BRAND">
 
 
93
  <option value=""><?php echo $this->__('--Please select--') ?></option>
94
  <?php foreach ($this->getCCBrands() as $brand) : ?>
95
  <option value="<?php echo $brand; ?>">
98
  <?php endforeach; ?>
99
  </select>
100
 
101
+ <div id="<?php echo $code ?>_loader" class="ops_htp_loader" style="display: none;"></div>
102
+ <iframe id="ops_iframe_<?php echo $code ?>" class="ops_htp_iframe" style="display: none;"
103
  src="about:blank"></iframe>
104
+ <p id="<?php echo $code ?>_redirect_note" class="ops_htp_redirect" style="display: none;">
105
+ <?php echo $this->getRedirectMessage(); ?></p>
 
 
106
  </li>
107
 
108
  <script type="text/javascript">
114
  opsUrl = '<?php echo $this->getAliasGatewayUrl(); ?>';
115
  opsAlias = '';
116
 
117
+
118
  paramplus = 'RESPONSEFORMAT=JSON';
119
 
120
+ <?php echo $code ?> = {
121
+ 'code': '<?php echo $code ?>',
122
+ 'loader': $('<?php echo $code ?>_loader'),
123
+ 'tokenizationFrame': $('ops_iframe_<?php echo $code ?>'),
124
+ 'redirectNote': $('<?php echo $code ?>_redirect_note'),
125
  'brandsForAliasInterface': '<?php echo json_encode(
126
  $this->getMethod()->getBrandsForAliasInterface()
127
  ) ?>'.evalJSON(),
128
+ 'aliasManager': <?php echo $this->getConfig()->isAliasManagerEnabled($this->getMethodCode()) ? 'true'
129
+ : 'false' ?>,
130
+ 'brand': function () {
131
+ return $(payment.currentMethodObject.code.toUpperCase() + '_BRAND').value;
132
+ }
133
  };
134
  locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
135
  transmitPaymentMethod = false;
136
 
137
+ Event.observe('<?php echo strtoupper($code); ?>_BRAND', 'change', function () {
138
  payment.handleBrandChange();
139
  });
140
 
141
+ Event.observe(<?php echo $code; ?>.tokenizationFrame, 'load', function () {
142
+ if (typeof payment.onOpsIframeLoad == 'function') {
143
+ payment.onOpsIframeLoad();
144
+ }
145
+ });
146
 
147
  Event.observe(document, 'alias:success', function (event) {
148
+ payment.fillOpsLoader('SUCCESS_TOKEN_FRONTEND');
149
+ if (typeof checkout != 'undefined' && checkout) {
150
+ payment.toggleContinue(true);
151
+ }
152
  payment.opsAliasSuccess = true;
153
  $('new_alias_' + payment.currentMethod).value = event.memo;
154
  payment.save();
157
  Event.observe(document, 'alias:failure', function (event) {
158
  payment.opsAliasSuccess = false;
159
  payment.currentMethodObject.tokenizationFrame.src = 'about:blank';
160
+ payment.fillOpsLoader('FAILURE_TOKEN_FRONTEND');
161
+ if (typeof checkout != 'undefined' && checkout) {
162
+ payment.toggleContinue(false);
163
+ }
164
  });
165
 
166
  </script>
app/design/frontend/base/default/template/ops/form/directDebit.phtml CHANGED
@@ -1,6 +1,25 @@
1
  <?php
2
  /**
3
- * Netresearch_OPS_Block_Form_OpsId
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  *
5
  * @category design
6
  * @package OPS
@@ -8,70 +27,119 @@
8
  * @author Thomas Birke <thomas.birke@netresearch.de>
9
  * @license OSL 3.0
10
  */
 
 
 
 
 
11
  ?>
12
- <?php $this->getParams(); ?>
13
- <script type="text/javascript">
14
- Translator.add(
15
- 'Account number must contain numbers only.',
16
- '<?php echo Mage::helper('ops')->__('Account number must contain numbers only.') ?>'
17
- );
18
- Translator.add(
19
- 'Bank code must contain numbers only.',
20
- '<?php echo Mage::helper('ops')->__('Bank code must contain numbers only.') ?>'
21
- );
22
- Translator.add(
23
- 'Payment failed. Please select another payment method.',
24
- '<?php echo Mage::helper('ops')->__('Payment failed. Please select another payment method.') ?>'
25
- );
26
- Translator.add(
27
- 'This is a required field.',
28
- '<?php echo Mage::helper('ops')->__('This is a required field.') ?>'
29
- );
30
- </script>
31
 
32
- <ul id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none">
33
- <li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  <label class="required" for="ops_directdebit_country_id"><?php echo $this->__('Country'); ?></label><br/>
35
- <select title="ops_directdebit_country_id" class="required-entry" name="ops_directdebit_country_id"
36
- id="ops_directdebit_country_id" onchange="payment.toggleOpsDirectDebitInputs(this.value)">
37
  <option value=""><?php echo $this->__('--Please Select--') ?></option>
38
  <?php foreach ($this->getDirectDebitCountryIds() as $countryId) : ?>
39
- <option value="<?php echo $countryId; ?>"><?php echo Mage::getModel('directory/country')->loadByCode(
40
- $countryId
41
- )->getName(); ?></option>
42
  <?php endforeach; ?>
43
  </select>
44
- </li>
45
- <li>
46
- <label class="required" for="ops_directdebit_CN"><?php echo $this->__('Account holder'); ?></label><br/>
47
- <input title="CN" class="input-text required-entry" autocomplete="off" type="text" name="CN"
48
- id="ops_directdebit_CN" length="50"
49
- value="<?php echo $this->getQuote()->getBillingAddress()->getFirstname() . ' ' . $this->getQuote()
50
- ->getBillingAddress()->getLastname() ?>"/>
51
- </li>
52
- <li>
53
- <label class="required" for="ops_directdebit_iban"><?php echo $this->__('IBAN'); ?></label><br/>
54
- <input title="IBAN" class="input-text required-entry" autocomplete="off" type="text" name="iban"
55
- id="ops_directdebit_iban" onblur="payment.setRequiredDirectDebitFields(this);"/>
56
- </li>
57
- <li style="display:none">
58
- <label class="" for="ops_directdebit_bic"><?php echo $this->__('BIC'); ?></label><br/>
59
- <input class="input-text" title="BIC" type="text" name="bic" id="ops_directdebit_bic"
60
- onblur="payment.setRequiredDirectDebitFields(this);"/>
61
- </li>
62
- <li>
63
- <label class="required" for="ops_directdebit_account_no"><?php echo $this->__('Account number'); ?></label><br/>
64
- <input title="account_no" class="input-text required-entry validate-number validate-length maximum-length-11"
65
- onblur="payment.setRequiredDirectDebitFields(this);" autocomplete="off" type="text" name="account_no"
66
- id="ops_directdebit_account_no" maxlength="11"/>
67
- </li>
68
- <li style="display:none">
69
- <label class="required" for="ops_directdebit_bank_code"><?php echo $this->__('Bank code'); ?></label><br/>
70
- <input class="input-text required-entry" type="text" name="bank_code"
71
- onblur="payment.setRequiredDirectDebitFields(this);" id="ops_directdebit_bank_code" maxlength="8"/>
72
  </li>
73
 
 
74
  <script type="text/javascript">
75
- opsDirectDebitUrl = '<?php echo $this->getRegisterDirectDebitPaymentUrl() ?>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  </script>
77
- </ul>
 
 
 
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ /**
22
+ * Netresearch_OPS_Block_Form_DirectDebit
23
  *
24
  * @category design
25
  * @package OPS
27
  * @author Thomas Birke <thomas.birke@netresearch.de>
28
  * @license OSL 3.0
29
  */
30
+
31
+ /** @var Netresearch_OPS_Block_Form_DirectDebit $this */
32
+ $code = $this->getMethodCode();
33
+ $display = 'none';
34
+ $storedAliases = $this->getStoredAliasForCustomer();
35
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ <ul class="form-list ops-form-list ops_card" id="payment_form_<?php echo $code ?>" style="display:none;">
38
+ <fieldset>
39
+ <?php foreach ($storedAliases as $key => $alias): ?>
40
+ <?php $brandName = $alias->getBrand() ?>
41
+ <input type="radio" id="<?php echo $alias->getId() ?>" name="payment[<?php echo $code ?>_data][alias]"
42
+ value="<?php echo $alias->getAlias() ?>"
43
+ data-countryid="<?php echo str_replace('Direct Debits ','', $brandName) ?>"
44
+ data-cn="<?php echo $this->getCardHolderName($alias->getId()) ?>"
45
+ required/>
46
+ <label for="<?php echo $alias->getId() ?>">
47
+ <ul>
48
+ <li><?php echo $this->__('Name on Card') . ': ' . $this->getCardHolderName($alias->getId()) ?></li>
49
+ <li>
50
+ <?php echo $this->__('IBAN') . ': '
51
+ . $this->getAliasCardNumber($alias->getId());
52
+ ?>
53
+ </li>
54
+ </ul>
55
+ </label>
56
+ <?php endforeach; ?>
57
+ <?php if (!empty($storedAliases)): ?>
58
+ <input type="select" id="<?php echo $code; ?>_stored_country_id"
59
+ name="payment[<?php echo $code; ?>_data][country_id]" class="hidden">
60
+ <?php foreach ($this->getDirectDebitCountryIds() as $countryId) : ?>
61
+ <option value="<?php echo $countryId; ?>" class="hidden">
62
+ <?php echo $this->__($countryId); ?>
63
+ </option>
64
+ <?php endforeach; ?>
65
+ <?php endif; ?>
66
+
67
+ <input type="radio" id="new_alias_<?php echo $code ?>" name="payment[<?php echo $code ?>_data][alias]"
68
+ class="validate-one-required-by-name" value="" <?php echo empty($storedAliases)
69
+ ? 'checked' : ''; ?> required>
70
+ <label for="new_alias_<?php echo $code ?>" class="new_alias_label">
71
+ <?php echo $this->__('Enter new bank data...') ?></label>
72
+ <!-- new Alias -->
73
+ <li id="insert_payment_details_<?php echo $code ?>" class="insert_payment_details" style="">
74
  <label class="required" for="ops_directdebit_country_id"><?php echo $this->__('Country'); ?></label><br/>
75
+ <select class="required-entry" name="payment[<?php echo $code ?>_data][country_id]"
76
+ id="<?php echo $code ?>_country_id">
77
  <option value=""><?php echo $this->__('--Please Select--') ?></option>
78
  <?php foreach ($this->getDirectDebitCountryIds() as $countryId) : ?>
79
+ <option value="<?php echo $countryId; ?>">
80
+ <?php echo Mage::getModel('directory/country')->loadByCode($countryId)->getName(); ?>
81
+ </option>
82
  <?php endforeach; ?>
83
  </select>
84
+
85
+ <div id="<?php echo $code ?>_loader" class="ops_htp_loader" style="display: none;"></div>
86
+ <iframe id="ops_iframe_<?php echo $code ?>" class="ops_htp_iframe" style="display: none;"
87
+ src="about:blank"></iframe>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  </li>
89
 
90
+
91
  <script type="text/javascript">
92
+ opsHashUrl = '<?php echo $this->getGenerateHashUrl(); ?>';
93
+ opsOrderId = '<?php echo $this->getQuote()->getId(); ?>';
94
+ opsPspid = '<?php echo $this->getPSPID(); ?>';
95
+ opsAcceptUrl = '<?php echo $this->getAliasAcceptUrl(); ?>';
96
+ opsExceptionUrl = '<?php echo $this->getAliasExceptionUrl(); ?>';
97
+ opsUrl = '<?php echo $this->getAliasGatewayUrl(); ?>';
98
+ opsAlias = '';
99
+
100
+ paramplus = 'RESPONSEFORMAT=JSON';
101
+
102
+ <?php echo $code ?> = {
103
+ 'code': '<?php echo $code ?>',
104
+ 'loader': $('<?php echo $code ?>_loader'),
105
+ 'tokenizationFrame': $('ops_iframe_<?php echo $code ?>'),
106
+ 'aliasManager': <?php echo $this->getConfig()->isAliasManagerEnabled($this->getMethodCode()) ? 'true'
107
+ : 'false' ?>,
108
+ 'brand': function(){ return 'Direct Debits '+ $("<?php echo $code ?>_country_id").value;}
109
+ };
110
+ locale = '<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>';
111
+ transmitPaymentMethod = false;
112
+
113
+ Event.observe('<?php echo $code; ?>_country_id', 'change', function () {
114
+ payment.handleBrandChange();
115
+ });
116
+
117
+ Event.observe(<?php echo $code; ?>.tokenizationFrame, 'load', function () {
118
+ if (typeof payment.onOpsIframeLoad == 'function') {
119
+ payment.onOpsIframeLoad();
120
+ }
121
+ });
122
+
123
+ Event.observe(document, 'alias:success', function (event) {
124
+ payment.fillOpsLoader('SUCCESS_TOKEN');
125
+ if (typeof checkout != 'undefined' && checkout) {
126
+ payment.toggleContinue(true);
127
+ }
128
+ payment.opsAliasSuccess = true;
129
+ $('new_alias_' + payment.currentMethod).value = event.memo;
130
+ payment.save();
131
+ });
132
+
133
+ Event.observe(document, 'alias:failure', function (event) {
134
+ payment.opsAliasSuccess = false;
135
+ payment.currentMethodObject.tokenizationFrame.src = 'about:blank';
136
+ payment.fillOpsLoader('FAILURE_TOKEN');
137
+ if (typeof checkout != 'undefined' && checkout) {
138
+ payment.toggleContinue(false);
139
+ }
140
+ });
141
  </script>
142
+ </fieldset>
143
+ </ul>
144
+
145
+
app/design/frontend/base/default/template/ops/form/directEbanking.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ /** @var Netresearch_OPS_Block_Form_DirectEbanking $this */
22
+ $code = $this->getMethodCode();
23
+ ?>
24
+
25
+
26
+ <ul class="form-list ops-form-list" id="payment_form_<?php echo $code ?>" style="display:none;">
27
+
28
+ <?php $brands = $this->getDirectEbankingBrands(); ?>
29
+ <?php if (count($brands) == 1): ?>
30
+ <li><input type="hidden" name="payment[directEbanking_brand]" id="ops_directEbanking_country_id"
31
+ value="<?php echo $this->escapeHtml(current($brands)); ?>"></li>
32
+ <?php endif; ?>
33
+ <?php if (!empty($brands)): ?>
34
+ <li>
35
+ <label class="required-entry" for="ops_directEbanking_country_id">
36
+ <?php echo $this->__('country'); ?>
37
+ </label><br/>
38
+ <select class="required-entry" name="payment[directEbanking_brand]" id="ops_directEbanking_country_id">
39
+ <option value=""><?php echo $this->__('--Please Select--') ?></option>
40
+ <?php foreach ($brands as $brand) : ?>
41
+ <option value="<?php echo $brand; ?>">
42
+ <?php echo Mage::helper('ops')->__($brand); ?>
43
+ </option>
44
+ <?php endforeach; ?>
45
+ </select>
46
+ </li>
47
+ <p><?php echo $this->getRedirectMessage(); ?></p>
48
+ <?php endif; ?>
49
+ </ul>
50
+
51
+
app/design/frontend/base/default/template/ops/form/flex.phtml CHANGED
@@ -51,14 +51,14 @@ $methods = $this->getFlexMethods();
51
  data-brand=""
52
  class="ops-flex-validation"
53
  data-pm=""
54
- name="payment[ops_flex][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE ?>]"
55
  id="flex_default">
56
  <label for="flex_default"><?php echo $this->escapeHtml($this->getDefaultOptionTitle()); ?></label>
57
  </li>
58
  <?php endif; ?>
59
  <?php foreach ($methods as $method): ?>
60
  <li><input type="radio" value="<?php echo $this->escapeHtml($method['title']); ?>"
61
- name="payment[ops_flex][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE ?>]"
62
  data-brand="<?php echo $this->escapeHtml($method['brand']); ?>"
63
  data-pm="<?php echo $this->escapeHtml($method['pm']); ?>"
64
  class="ops-flex-validation"
@@ -69,9 +69,9 @@ $methods = $this->getFlexMethods();
69
  </li>
70
  <?php endforeach; ?>
71
  <input type="text" class="hidden" id="ops_flex_pm"
72
- name="payment[ops_flex][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_PM ?>]"/>
73
  <input type="text" class="hidden" id="ops_flex_brand"
74
- name="payment[ops_flex][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_BRAND ?>]"/>
75
 
76
  <script type="application/javascript">
77
 
@@ -95,3 +95,4 @@ $methods = $this->getFlexMethods();
95
  });
96
  </script>
97
  </ul>
 
51
  data-brand=""
52
  class="ops-flex-validation"
53
  data-pm=""
54
+ name="payment[ops_flex_data][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE ?>]"
55
  id="flex_default">
56
  <label for="flex_default"><?php echo $this->escapeHtml($this->getDefaultOptionTitle()); ?></label>
57
  </li>
58
  <?php endif; ?>
59
  <?php foreach ($methods as $method): ?>
60
  <li><input type="radio" value="<?php echo $this->escapeHtml($method['title']); ?>"
61
+ name="payment[ops_flex_data][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE ?>]"
62
  data-brand="<?php echo $this->escapeHtml($method['brand']); ?>"
63
  data-pm="<?php echo $this->escapeHtml($method['pm']); ?>"
64
  class="ops-flex-validation"
69
  </li>
70
  <?php endforeach; ?>
71
  <input type="text" class="hidden" id="ops_flex_pm"
72
+ name="payment[ops_flex_data][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_PM ?>]"/>
73
  <input type="text" class="hidden" id="ops_flex_brand"
74
+ name="payment[ops_flex_data][<?php echo Netresearch_OPS_Model_Payment_Flex::INFO_KEY_BRAND ?>]"/>
75
 
76
  <script type="application/javascript">
77
 
95
  });
96
  </script>
97
  </ul>
98
+ <p><?php echo $this->getRedirectMessage(); ?></p>
app/design/frontend/base/default/template/ops/form/ideal.phtml CHANGED
@@ -1,11 +1,31 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /** @var $this Netresearch_OPS_Block_Form_Ideal */
 
3
  $issuers = $this->getIssuers();
4
  ?>
5
  <ul class="form-list ops-form-list" id="payment_form_ops_iDeal" style="display:none;">
6
  <li>
7
  <select name="payment[iDeal_issuer_id]" id="ops_iDeal_issuer_id" class="required-entry">
8
- <option value=""><?php echo $this->__('--Please Select--')?></option>
9
  <?php foreach ($issuers as $key => $value): ?>
10
  <option value=<?php echo $this->escapeHtml($key) ?>>
11
  <?php echo $this->escapeHtml($value) ?>
@@ -13,4 +33,5 @@ $issuers = $this->getIssuers();
13
  <?php endforeach; ?>
14
  </select>
15
  </li>
 
16
  </ul>
1
  <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
  /** @var $this Netresearch_OPS_Block_Form_Ideal */
22
+ $code = $this->getMethodCode();
23
  $issuers = $this->getIssuers();
24
  ?>
25
  <ul class="form-list ops-form-list" id="payment_form_ops_iDeal" style="display:none;">
26
  <li>
27
  <select name="payment[iDeal_issuer_id]" id="ops_iDeal_issuer_id" class="required-entry">
28
+ <option value=""><?php echo $this->__('--Please Select--') ?></option>
29
  <?php foreach ($issuers as $key => $value): ?>
30
  <option value=<?php echo $this->escapeHtml($key) ?>>
31
  <?php echo $this->escapeHtml($value) ?>
33
  <?php endforeach; ?>
34
  </select>
35
  </li>
36
+ <p><?php echo $this->getRedirectMessage(); ?></p>
37
  </ul>
app/design/frontend/base/default/template/ops/form/intersolve.phtml CHANGED
@@ -52,4 +52,5 @@
52
  </select>
53
  <?php endif; ?>
54
  <?php endif; ?>
 
55
  </ul>
52
  </select>
53
  <?php endif; ?>
54
  <?php endif; ?>
55
+ <p><?php echo $this->getRedirectMessage();?></p>
56
  </ul>
app/design/frontend/base/default/template/ops/form/openInvoice.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
+ /**
23
+ * openInvoice.phtml
24
+ *
25
+ * @category payment
26
+ * @package Netresearch_OPS
27
+ * @author Paul Siedler <paul.siedler@netresearch.de>
28
+ */
29
+
30
+ /** @var $this Netresearch_OPS_Block_Form_OpenInvoice */
31
+ ?>
32
+ <ul class="form-list ops-form-list" id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none;">
33
+ <?php
34
+ $code = $this->getMethodCode();
35
+ if ($this->showInvoiceTermsLink()):
36
+ ?>
37
+ <a href="<?php echo $this->escapeUrl($this->getInvoiceTermsUrl()); ?>"
38
+ title="<?php echo $this->escapeHtml($this->getInvoiceTermsTitle()); ?>"
39
+ target="_blank"><?php echo $this->escapeHtml($this->getInvoiceTermsTitle()); ?></a>
40
+ <?php endif; ?>
41
+ <p><?php echo $this->getRedirectMessage(); ?></p>
42
+ </ul>
app/design/frontend/base/default/template/ops/form/other.phtml CHANGED
@@ -1,3 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <ul class="form-list ops-form-list" id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none;">
2
- <li><?php echo $this->__('By choosing this payment method the choice of the concrete payment method will be on PayEngine side.'); ?></li>
 
 
3
  </ul>
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
  <ul class="form-list ops-form-list" id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none;">
23
+ <li><?php echo $this->__(
24
+ 'By choosing this payment method the choice of the concrete payment method will be on PayEngine side.'
25
+ ); ?></li>
26
  </ul>
app/design/frontend/base/default/template/ops/frauddetection.phtml CHANGED
@@ -1,4 +1,24 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /** @var Netresearch_OPS_Block_Frauddetection $this */
3
  $aid = $this->getTrackingCodeAid();
4
  $sid = $this->getTrackingSid();
1
  <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+
22
  /** @var Netresearch_OPS_Block_Frauddetection $this */
23
  $aid = $this->getTrackingCodeAid();
24
  $sid = $this->getTrackingSid();
app/design/frontend/base/default/template/ops/info/bancontact.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
+ <p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
23
+
app/design/frontend/base/default/template/ops/info/cc.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <p><?php echo $this->htmlEscape($this->getMethod()->getTitle() . ' - ' . $this->getMethod()->getOpsBrand($this->getInfo())) ?></p>
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
  <p><?php echo $this->htmlEscape($this->getMethod()->getTitle() . ' - ' . $this->getMethod()->getOpsBrand($this->getInfo())) ?></p>
app/design/frontend/base/default/template/ops/info/opsId.phtml CHANGED
@@ -1,2 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
2
  <?php echo Mage::helper('payment')->__('Payment ID: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('paymentId'))) ?><br/>
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
  <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
23
  <?php echo Mage::helper('payment')->__('Payment ID: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('paymentId'))) ?><br/>
app/design/frontend/base/default/template/ops/info/payPerMail.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netresearch_OPS
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
16
+ *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
20
+ */
21
+ ?>
22
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?> - <?php echo $this->htmlEscape($this->getMethod()->getOpsBrand($this->getInfo())) ?><br />
23
+ <?php echo Mage::helper('payment')->__('Payment ID: %s', $this->htmlEscape($this->getInfo()->getAdditionalInformation('paymentId'))) ?><br/>
app/design/frontend/base/default/template/ops/info/redirect.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
  <p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
app/design/frontend/base/default/template/ops/paypage.phtml CHANGED
@@ -1,27 +1,22 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
 
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
  ?>
22
 
app/design/frontend/base/default/template/ops/placeform.phtml CHANGED
@@ -1,34 +1,34 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
  * DISCLAIMER
16
  *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
27
  /** @var Netresearch_OPS_Block_Placeform $this */
28
  ?>
29
 
30
- <form name="ops" id="ops_review_form" action="<?php echo $this->getFormAction(); ?>" method="post"
31
- target="<?php echo $this->isIframeTarget() ? 'ops_placeform_iframe' : '_top'; ?>">
 
 
 
 
 
32
  <?php $formData = $this->getFormData(); ?>
33
  <?php if ($this->hasMissingParams()): ?>
34
  <div id="messages_product_view">
@@ -68,7 +68,7 @@
68
  <em>*</em></label>
69
  <div class="input-box"><input class="required-entry" id="<?php echo($name); ?>"
70
  name="<?php echo($name); ?>"
71
- value="<?php echo(htmlentities($value, ENT_COMPAT, 'UTF-8')); ?>"/>
72
  </div>
73
  <?php endif; ?>
74
  <?php if (($name === 'CIVILITY' || $name == 'ECOM_SHIPTO_POSTAL_NAME_PREFIX')): ?>
@@ -87,7 +87,7 @@
87
  <?php else: ?>
88
  <div>
89
  <input type="hidden" name="<?php echo($name); ?>"
90
- value="<?php echo(htmlentities($value, ENT_COMPAT, 'UTF-8')); ?>"/>
1
  <?php
2
  /**
3
+ * Netresearch_OPS
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
  *
12
  * DISCLAIMER
13
  *
14
+ * Do not edit or add to this file if you wish to upgrade this extension to
15
+ * newer versions in the future.
 
16
  *
17
+ * @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
18
+ * @license Open Software License (OSL 3.0)
19
+ * @link http://opensource.org/licenses/osl-3.0.php
 
20
  */
21
 
22
  /** @var Netresearch_OPS_Block_Placeform $this */
23
  ?>
24
 
25
+ <form accept-charset="UTF-8"
26
+ name="ops" id="ops_review_form"
27
+ action="<?php echo $this->getFormAction(); ?>"
28
+ enctype="application/x-www-form-urlencoded"
29
+ method="post"
30
+ target="<?php echo $this->isIframeTarget() ? 'ops_placeform_iframe' : '_top'; ?>"
31
+ >
32
  <?php $formData = $this->getFormData(); ?>
33
  <?php if ($this->hasMissingParams()): ?>
34
  <div id="messages_product_view">
68
  <em>*</em></label>
69
  <div class="input-box"><input class="required-entry" id="<?php echo($name); ?>"
70
  name="<?php echo($name); ?>"
71
+ value="<?php echo htmlentities($value, ENT_COMPAT, 'UTF-8', true); ?>"/>
72
  </div>
73
  <?php endif; ?>
74
  <?php if (($name === 'CIVILITY' || $name == 'ECOM_SHIPTO_POSTAL_NAME_PREFIX')): ?>
87
  <?php else: ?>
88
  <div>
89
  <input type="hidden" name="<?php echo($name); ?>"
90
+