Mage_Payone - Version 3.0.6

Version Notes

Mage_Payone-3.0.6

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Payone
Version 3.0.6
Comparing to
See all releases


Version 3.0.6

Files changed (244) hide show
  1. app/code/community/Payone/Core/Block/Adminhtml/Configuration/Wizard/Config/Form.php +193 -0
  2. app/code/community/Payone/Core/Block/Adminhtml/Configuration/Wizard/Page/Edit.php +115 -0
  3. app/code/community/Payone/Core/Block/Adminhtml/Configuration/Wizard/Page/View.php +120 -0
  4. app/code/community/Payone/Core/Block/Adminhtml/Information.php +44 -0
  5. app/code/community/Payone/Core/Block/Adminhtml/Information/Abstract.php +47 -0
  6. app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api.php +47 -0
  7. app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/Grid.php +194 -0
  8. app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View.php +87 -0
  9. app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Plane.php +43 -0
  10. app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Tab/Exception.php +99 -0
  11. app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Tab/General.php +119 -0
  12. app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Tabs.php +46 -0
  13. app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus.php +48 -0
  14. app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/Grid.php +244 -0
  15. app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View.php +134 -0
  16. app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View/Plane.php +40 -0
  17. app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View/Tab/General.php +88 -0
  18. app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View/Tabs.php +44 -0
  19. app/code/community/Payone/Core/Block/Adminhtml/Sales/Order.php +47 -0
  20. app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/Create/Init.php +35 -0
  21. app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/Grid.php +309 -0
  22. app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/View/Tab/Api.php +257 -0
  23. app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/View/Tab/Transaction.php +125 -0
  24. app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/View/Tab/TransactionStatus.php +277 -0
  25. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field.php +66 -0
  26. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/Abstract.php +132 -0
  27. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/Forwarding.php +82 -0
  28. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/Info.php +71 -0
  29. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/PaymentFee.php +89 -0
  30. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/PersonStatusMapping.php +76 -0
  31. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/StatusMapping.php +80 -0
  32. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment.php +64 -0
  33. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment/Method.php +192 -0
  34. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Hint.php +102 -0
  35. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Notice.php +99 -0
  36. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment.php +113 -0
  37. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Edit.php +155 -0
  38. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Grid.php +263 -0
  39. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Tooltip.php +206 -0
  40. app/code/community/Payone/Core/Block/Adminhtml/Transaction.php +48 -0
  41. app/code/community/Payone/Core/Block/Adminhtml/Transaction/Grid.php +232 -0
  42. app/code/community/Payone/Core/Block/Adminhtml/Transaction/View.php +109 -0
  43. app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Plane.php +43 -0
  44. app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Tab/General.php +97 -0
  45. app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Tab/TransactionStatus.php +290 -0
  46. app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Tabs.php +45 -0
  47. app/code/community/Payone/Core/Block/Adminhtml/Widget/Grid/Column/Renderer/Datetime.php +54 -0
  48. app/code/community/Payone/Core/Block/Adminhtml/Widget/Grid/Column/Renderer/UnixTimestamp.php +52 -0
  49. app/code/community/Payone/Core/Block/Adminhtml/Widget/Grid/Container.php +39 -0
  50. app/code/community/Payone/Core/Block/Adminhtml/Widget/View/Container.php +39 -0
  51. app/code/community/Payone/Core/Block/Checkout/Onepage/Payment/Additional.php +111 -0
  52. app/code/community/Payone/Core/Block/Checkout/Onepage/Payment/Methods.php +145 -0
  53. app/code/community/Payone/Core/Block/Payment/Method/Form/Abstract.php +262 -0
  54. app/code/community/Payone/Core/Block/Payment/Method/Form/AdvancePayment.php +41 -0
  55. app/code/community/Payone/Core/Block/Payment/Method/Form/CashOnDelivery.php +41 -0
  56. app/code/community/Payone/Core/Block/Payment/Method/Form/Creditcard.php +243 -0
  57. app/code/community/Payone/Core/Block/Payment/Method/Form/DebitPayment.php +59 -0
  58. app/code/community/Payone/Core/Block/Payment/Method/Form/Invoice.php +41 -0
  59. app/code/community/Payone/Core/Block/Payment/Method/Form/OnlineBankTransfer.php +99 -0
  60. app/code/community/Payone/Core/Block/Payment/Method/Form/Wallet.php +61 -0
  61. app/code/community/Payone/Core/Block/Payment/Method/Info/Abstract.php +112 -0
  62. app/code/community/Payone/Core/Block/Payment/Method/Info/AdvancePayment.php +106 -0
  63. app/code/community/Payone/Core/Block/Payment/Method/Info/CashOnDelivery.php +106 -0
  64. app/code/community/Payone/Core/Block/Payment/Method/Info/Creditcard.php +84 -0
  65. app/code/community/Payone/Core/Block/Payment/Method/Info/DebitPayment.php +67 -0
  66. app/code/community/Payone/Core/Block/Payment/Method/Info/Invoice.php +106 -0
  67. app/code/community/Payone/Core/Block/Payment/Method/Info/OnlineBankTransfer.php +68 -0
  68. app/code/community/Payone/Core/Block/Payment/Method/Info/Wallet.php +42 -0
  69. app/code/community/Payone/Core/Controller/Abstract.php +78 -0
  70. app/code/community/Payone/Core/Controller/Adminhtml/Abstract.php +72 -0
  71. app/code/community/Payone/Core/Controller/Adminhtml/Configuration/Wizard/Abstract.php +77 -0
  72. app/code/community/Payone/Core/Exception/InvalidRequestType.php +36 -0
  73. app/code/community/Payone/Core/Exception/InvoicePreparationNoItems.php +36 -0
  74. app/code/community/Payone/Core/Exception/InvoiceSave.php +36 -0
  75. app/code/community/Payone/Core/Exception/OrderCannotInvoice.php +36 -0
  76. app/code/community/Payone/Core/Exception/OrderNotFound.php +36 -0
  77. app/code/community/Payone/Core/Exception/PaymentMethodConfigNotFound.php +35 -0
  78. app/code/community/Payone/Core/Exception/PaymentTypeNotFound.php +43 -0
  79. app/code/community/Payone/Core/Exception/TransactionAlreadyExists.php +36 -0
  80. app/code/community/Payone/Core/Exception/TransactionStatusForward.php +36 -0
  81. app/code/community/Payone/Core/Helper/Abstract.php +78 -0
  82. app/code/community/Payone/Core/Helper/Config.php +229 -0
  83. app/code/community/Payone/Core/Helper/Data.php +213 -0
  84. app/code/community/Payone/Core/Helper/Email.php +173 -0
  85. app/code/community/Payone/Core/Helper/Sales/Button.php +100 -0
  86. app/code/community/Payone/Core/Helper/Url.php +77 -0
  87. app/code/community/Payone/Core/Helper/Wizard.php +235 -0
  88. app/code/community/Payone/Core/Model/Config.php +137 -0
  89. app/code/community/Payone/Core/Model/Config/AreaAbstract.php +108 -0
  90. app/code/community/Payone/Core/Model/Config/AreaInterface.php +57 -0
  91. app/code/community/Payone/Core/Model/Config/General.php +136 -0
  92. app/code/community/Payone/Core/Model/Config/General/Global.php +206 -0
  93. app/code/community/Payone/Core/Model/Config/General/ParameterInvoice.php +94 -0
  94. app/code/community/Payone/Core/Model/Config/General/ParameterNarrativeText.php +76 -0
  95. app/code/community/Payone/Core/Model/Config/General/PaymentCreditcard.php +55 -0
  96. app/code/community/Payone/Core/Model/Config/General/StatusMapping.php +243 -0
  97. app/code/community/Payone/Core/Model/Config/Interface.php +85 -0
  98. app/code/community/Payone/Core/Model/Config/Misc.php +135 -0
  99. app/code/community/Payone/Core/Model/Config/Misc/Email/Abstract.php +148 -0
  100. app/code/community/Payone/Core/Model/Config/Misc/Email/Interface.php +89 -0
  101. app/code/community/Payone/Core/Model/Config/Misc/EmailAvs.php +70 -0
  102. app/code/community/Payone/Core/Model/Config/Misc/EmailError.php +36 -0
  103. app/code/community/Payone/Core/Model/Config/Misc/ShippingCosts.php +55 -0
  104. app/code/community/Payone/Core/Model/Config/Misc/TransactionstatusForwarding.php +179 -0
  105. app/code/community/Payone/Core/Model/Config/Misc/TransactionstatusProcessing.php +104 -0
  106. app/code/community/Payone/Core/Model/Config/Payment.php +244 -0
  107. app/code/community/Payone/Core/Model/Config/Payment/Method.php +733 -0
  108. app/code/community/Payone/Core/Model/Config/Payment/Method/Interface.php +352 -0
  109. app/code/community/Payone/Core/Model/Config/Protect.php +75 -0
  110. app/code/community/Payone/Core/Model/Config/Protect/AddressCheck.php +363 -0
  111. app/code/community/Payone/Core/Model/Config/Protect/Creditrating.php +509 -0
  112. app/code/community/Payone/Core/Model/Cronjob/Abstract.php +62 -0
  113. app/code/community/Payone/Core/Model/Cronjob/TransactionStatus/Worker.php +52 -0
  114. app/code/community/Payone/Core/Model/Domain/Config/PaymentMethod.php +494 -0
  115. app/code/community/Payone/Core/Model/Domain/Protocol/Api.php +134 -0
  116. app/code/community/Payone/Core/Model/Domain/Protocol/TransactionStatus.php +292 -0
  117. app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod.php +44 -0
  118. app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod/Collection.php +194 -0
  119. app/code/community/Payone/Core/Model/Domain/Resource/Protocol/Api.php +44 -0
  120. app/code/community/Payone/Core/Model/Domain/Resource/Protocol/Api/Collection.php +53 -0
  121. app/code/community/Payone/Core/Model/Domain/Resource/Protocol/TransactionStatus.php +44 -0
  122. app/code/community/Payone/Core/Model/Domain/Resource/Protocol/TransactionStatus/Collection.php +84 -0
  123. app/code/community/Payone/Core/Model/Domain/Resource/Transaction.php +44 -0
  124. app/code/community/Payone/Core/Model/Domain/Resource/Transaction/Collection.php +44 -0
  125. app/code/community/Payone/Core/Model/Domain/Transaction.php +139 -0
  126. app/code/community/Payone/Core/Model/Factory.php +1353 -0
  127. app/code/community/Payone/Core/Model/Handler/Abstract.php +106 -0
  128. app/code/community/Payone/Core/Model/Handler/Interface.php +61 -0
  129. app/code/community/Payone/Core/Model/Handler/Management/GetInvoice.php +50 -0
  130. app/code/community/Payone/Core/Model/Handler/Payment/Abstract.php +352 -0
  131. app/code/community/Payone/Core/Model/Handler/Payment/Authorize.php +38 -0
  132. app/code/community/Payone/Core/Model/Handler/Payment/Capture.php +38 -0
  133. app/code/community/Payone/Core/Model/Handler/Payment/Debit.php +62 -0
  134. app/code/community/Payone/Core/Model/Handler/Payment/Interface.php +40 -0
  135. app/code/community/Payone/Core/Model/Handler/Payment/Preauthorize.php +38 -0
  136. app/code/community/Payone/Core/Model/Handler/Verification/Abstract.php +128 -0
  137. app/code/community/Payone/Core/Model/Handler/Verification/AddressCheck.php +217 -0
  138. app/code/community/Payone/Core/Model/Handler/Verification/Creditrating.php +213 -0
  139. app/code/community/Payone/Core/Model/Handler/Verification/Interface.php +36 -0
  140. app/code/community/Payone/Core/Model/Mapper/Abstract.php +123 -0
  141. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Abstract.php +37 -0
  142. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Management/GetInvoice.php +71 -0
  143. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Abstract.php +334 -0
  144. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize.php +50 -0
  145. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php +387 -0
  146. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Capture.php +175 -0
  147. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Debit.php +210 -0
  148. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Interface.php +62 -0
  149. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Preauthorize.php +44 -0
  150. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/Abstract.php +55 -0
  151. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/AddressCheck.php +112 -0
  152. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/BankAccountCheck.php +96 -0
  153. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/Creditrating.php +109 -0
  154. app/code/community/Payone/Core/Model/Observer/Abstract.php +102 -0
  155. app/code/community/Payone/Core/Model/Observer/Checkout/Onepage.php +233 -0
  156. app/code/community/Payone/Core/Model/Observer/Checkout/Onepage/Payment/Methods.php +138 -0
  157. app/code/community/Payone/Core/Model/Observer/Protocol/Api.php +62 -0
  158. app/code/community/Payone/Core/Model/Observer/Sales/Order.php +65 -0
  159. app/code/community/Payone/Core/Model/Observer/Sales/Order/Invoice.php +58 -0
  160. app/code/community/Payone/Core/Model/Observer/Sales/Quote/Address.php +91 -0
  161. app/code/community/Payone/Core/Model/Observer/Sales/Quote/Payment.php +61 -0
  162. app/code/community/Payone/Core/Model/Observer/TransactionStatus/Forwarding.php +109 -0
  163. app/code/community/Payone/Core/Model/Observer/TransactionStatus/InvoiceCreate.php +186 -0
  164. app/code/community/Payone/Core/Model/Observer/TransactionStatus/Reminder.php +53 -0
  165. app/code/community/Payone/Core/Model/Payment/Method/Abstract.php +401 -0
  166. app/code/community/Payone/Core/Model/Payment/Method/AdvancePayment.php +44 -0
  167. app/code/community/Payone/Core/Model/Payment/Method/CashOnDelivery.php +44 -0
  168. app/code/community/Payone/Core/Model/Payment/Method/Creditcard.php +64 -0
  169. app/code/community/Payone/Core/Model/Payment/Method/DebitPayment.php +44 -0
  170. app/code/community/Payone/Core/Model/Payment/Method/Invoice.php +44 -0
  171. app/code/community/Payone/Core/Model/Payment/Method/OnlineBankTransfer.php +65 -0
  172. app/code/community/Payone/Core/Model/Payment/Method/Wallet.php +64 -0
  173. app/code/community/Payone/Core/Model/Repository/Api.php +122 -0
  174. app/code/community/Payone/Core/Model/Repository/TransactionStatus.php +88 -0
  175. app/code/community/Payone/Core/Model/Sales/Quote/Address.php +149 -0
  176. app/code/community/Payone/Core/Model/Sales/Quote/Address/Total/Fee.php +106 -0
  177. app/code/community/Payone/Core/Model/Service/Abstract.php +99 -0
  178. app/code/community/Payone/Core/Model/Service/Config/XmlGenerate.php +387 -0
  179. app/code/community/Payone/Core/Model/Service/Export/Collection.php +97 -0
  180. app/code/community/Payone/Core/Model/Service/InitializeConfig.php +336 -0
  181. app/code/community/Payone/Core/Model/Service/InitializePayment.php +97 -0
  182. app/code/community/Payone/Core/Model/Service/Management/GetInvoice.php +117 -0
  183. app/code/community/Payone/Core/Model/Service/Payment/Abstract.php +155 -0
  184. app/code/community/Payone/Core/Model/Service/Payment/Authorize.php +73 -0
  185. app/code/community/Payone/Core/Model/Service/Payment/Capture.php +72 -0
  186. app/code/community/Payone/Core/Model/Service/Payment/Debit.php +72 -0
  187. app/code/community/Payone/Core/Model/Service/Payment/Interface.php +41 -0
  188. app/code/community/Payone/Core/Model/Service/Payment/Preauthorize.php +73 -0
  189. app/code/community/Payone/Core/Model/Service/Protocol/Api/Export.php +50 -0
  190. app/code/community/Payone/Core/Model/Service/Protocol/TransactionStatus/Export.php +73 -0
  191. app/code/community/Payone/Core/Model/Service/Sales/InvoiceCreate.php +120 -0
  192. app/code/community/Payone/Core/Model/Service/Sales/OrderComment.php +143 -0
  193. app/code/community/Payone/Core/Model/Service/Sales/OrderStatus.php +79 -0
  194. app/code/community/Payone/Core/Model/Service/Transaction/Create.php +77 -0
  195. app/code/community/Payone/Core/Model/Service/Transaction/Update.php +76 -0
  196. app/code/community/Payone/Core/Model/Service/TransactionStatus/Execute.php +157 -0
  197. app/code/community/Payone/Core/Model/Service/TransactionStatus/Forward.php +203 -0
  198. app/code/community/Payone/Core/Model/Service/TransactionStatus/Process.php +160 -0
  199. app/code/community/Payone/Core/Model/Service/Verification/Abstract.php +121 -0
  200. app/code/community/Payone/Core/Model/Service/Verification/AddressCheck.php +143 -0
  201. app/code/community/Payone/Core/Model/Service/Verification/BankAccountCheck.php +153 -0
  202. app/code/community/Payone/Core/Model/Service/Verification/Creditrating.php +211 -0
  203. app/code/community/Payone/Core/Model/System/Config/Abstract.php +75 -0
  204. app/code/community/Payone/Core/Model/System/Config/AddressCheckType.php +43 -0
  205. app/code/community/Payone/Core/Model/System/Config/AuthorizeMethod.php +48 -0
  206. app/code/community/Payone/Core/Model/System/Config/AvsResult.php +44 -0
  207. app/code/community/Payone/Core/Model/System/Config/Backend/Protect.php +63 -0
  208. app/code/community/Payone/Core/Model/System/Config/BankaccountcheckType.php +44 -0
  209. app/code/community/Payone/Core/Model/System/Config/ClearingType.php +45 -0
  210. app/code/community/Payone/Core/Model/System/Config/CreditCardType.php +44 -0
  211. app/code/community/Payone/Core/Model/System/Config/CreditScore.php +43 -0
  212. app/code/community/Payone/Core/Model/System/Config/CreditratingChecktype.php +44 -0
  213. app/code/community/Payone/Core/Model/System/Config/CreditratingIntegrationEvent.php +50 -0
  214. app/code/community/Payone/Core/Model/System/Config/HandleResponseError.php +51 -0
  215. app/code/community/Payone/Core/Model/System/Config/MethodType.php +94 -0
  216. app/code/community/Payone/Core/Model/System/Config/Mode.php +44 -0
  217. app/code/community/Payone/Core/Model/System/Config/OnlinebanktransferType.php +43 -0
  218. app/code/community/Payone/Core/Model/System/Config/PaymentMethodCode.php +60 -0
  219. app/code/community/Payone/Core/Model/System/Config/PaymentMethodType.php +58 -0
  220. app/code/community/Payone/Core/Model/System/Config/PersonStatus.php +44 -0
  221. app/code/community/Payone/Core/Model/System/Config/ReminderLevel.php +45 -0
  222. app/code/community/Payone/Core/Model/System/Config/RequestType.php +43 -0
  223. app/code/community/Payone/Core/Model/System/Config/ResponseType.php +51 -0
  224. app/code/community/Payone/Core/Model/System/Config/Status.php +48 -0
  225. app/code/community/Payone/Core/Model/System/Config/StatusTransaction.php +51 -0
  226. app/code/community/Payone/Core/Model/System/Config/TransactionStatus.php +43 -0
  227. app/code/community/Payone/Core/Model/System/Config/WalletType.php +43 -0
  228. app/code/community/Payone/Core/controllers/Adminhtml/Configuration/Wizard/Page/PaymentController.php +63 -0
  229. app/code/community/Payone/Core/controllers/Adminhtml/Configuration/Wizard/PageController.php +152 -0
  230. app/code/community/Payone/Core/controllers/Adminhtml/Configuration/WizardController.php +42 -0
  231. app/code/community/Payone/Core/controllers/Adminhtml/InformationController.php +43 -0
  232. app/code/community/Payone/Core/controllers/Adminhtml/Protocol/ApiController.php +149 -0
  233. app/code/community/Payone/Core/controllers/Adminhtml/Protocol/TransactionStatusController.php +150 -0
  234. app/code/community/Payone/Core/controllers/Adminhtml/Sales/Order/InvoiceController.php +78 -0
  235. app/code/community/Payone/Core/controllers/Adminhtml/Sales/OrderController.php +114 -0
  236. app/code/community/Payone/Core/controllers/Adminhtml/System/Config/PaymentController.php +205 -0
  237. app/code/community/Payone/Core/controllers/Adminhtml/System/ConfigurationController.php +102 -0
  238. app/code/community/Payone/Core/controllers/Adminhtml/TransactionController.php +128 -0
  239. app/code/community/Payone/Core/controllers/Checkout/Onepage/PaymentController.php +209 -0
  240. app/code/community/Payone/Core/controllers/Checkout/OnepageController.php +123 -0
  241. app/code/community/Payone/Core/controllers/TransactionStatusController.php +105 -0
  242. app/code/community/Payone/Core/etc/adminhtml.xml +241 -0
  243. app/code/community/Payone/Core/etc/config.xml +529 -0
  244. app/code/community/Payone/Core/etc/system.xml +1246 -0
app/code/community/Payone/Core/Block/Adminhtml/Configuration/Wizard/Config/Form.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Configuration
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Configuration
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Configuration_Wizard_Config_Form
34
+ extends Mage_Adminhtml_Block_System_Config_Form
35
+ {
36
+ /**
37
+ * @var string
38
+ */
39
+ protected $groupName = '';
40
+
41
+ protected function _prepareLayout()
42
+ {
43
+ $return = parent::_prepareLayout();
44
+
45
+ $this->initForm();
46
+
47
+ return $return;
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @return Mage_Adminhtml_Block_System_Config_Form
53
+ */
54
+ public function initForm()
55
+ {
56
+ $this->_initObjects();
57
+
58
+ $form = $this->_initForm();
59
+
60
+ $sections = $this->_configFields->getSection(
61
+ $this->getSectionCode(),
62
+ $this->getWebsiteCode(),
63
+ $this->getStoreCode()
64
+ );
65
+ $groups = $sections->groups;
66
+
67
+ $groupName = $this->getGroupName();
68
+ $group = $groups->$groupName;
69
+
70
+ /**
71
+ * @var $fieldsetRenderer Mage_Adminhtml_Block_System_Config_Form_Fieldset
72
+ */
73
+ if ($group->frontend_model) {
74
+ $fieldsetRenderer = Mage::getBlockSingleton((string)$group->frontend_model);
75
+ }
76
+ else {
77
+ $fieldsetRenderer = Mage::getBlockSingleton('Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset');
78
+ }
79
+
80
+ $fieldsetConfig = array(
81
+ 'legend' => Mage::helper('payone_core')->__((string)$group->label),
82
+ );
83
+ if (!empty($group->comment)) {
84
+ $fieldsetConfig['comment'] = Mage::helper('payone_core')->__((string)$group->comment);
85
+ }
86
+
87
+ /** @var $fieldset Varien_Data_Form_Element_Fieldset */
88
+ $fieldset = $form->addFieldset($sections->getName() . '_' . $group->getName(), $fieldsetConfig);
89
+ $fieldset->setRenderer($fieldsetRenderer);
90
+
91
+ $fieldsetRenderer->setForm($this);
92
+ $fieldsetRenderer->setConfigData($this->_configData);
93
+ $fieldsetRenderer->setGroup($group);
94
+
95
+ $this->_prepareFieldOriginalData($fieldset, $group);
96
+ $this->_addElementTypes($fieldset);
97
+
98
+ $this->initFields($fieldset, $group, $sections);
99
+
100
+ $fieldset->addField(
101
+ 'page_code',
102
+ 'hidden',
103
+ array(
104
+ 'name' => 'page_code',
105
+ 'value' => $this->getPageCode()
106
+ )
107
+ );
108
+
109
+ $form->setUseContainer(true);
110
+
111
+ $this->setForm($form);
112
+ return $this;
113
+ }
114
+
115
+ /**
116
+ * @return Varien_Data_Form
117
+ */
118
+ protected function _initForm()
119
+ {
120
+ $form = new Varien_Data_Form(
121
+ array(
122
+ 'id' => 'edit_form',
123
+ 'action' => $this->getSaveUrl(),
124
+ 'method' => 'post',
125
+ 'enctype' => 'multipart/form-data'
126
+ )
127
+ );
128
+ return $form;
129
+ }
130
+
131
+ protected function getSaveUrl()
132
+ {
133
+ return $this->getUrl('*/*/save', array('_current' => true));
134
+ }
135
+
136
+ /**
137
+ * @return string
138
+ */
139
+ public function getGroupName()
140
+ {
141
+ return $this->getConfigPage('group_name');
142
+ }
143
+
144
+ /**
145
+ * @return string
146
+ */
147
+ public function getPageCode()
148
+ {
149
+ return $this->getConfigPage('codes/page');
150
+ }
151
+
152
+ /**
153
+ * @return string
154
+ */
155
+ public function getSectionCode()
156
+ {
157
+ return $this->getConfigPage('codes/section');
158
+ }
159
+
160
+ /**
161
+ * @return string
162
+ */
163
+ public function getStoreCode()
164
+ {
165
+ return $this->getConfigPage('codes/store');
166
+ }
167
+
168
+ /**
169
+ * @return string
170
+ */
171
+ public function getWebsiteCode()
172
+ {
173
+ return $this->getConfigPage('codes/website');
174
+ }
175
+
176
+ /**
177
+ * @param string $path
178
+ * @return mixed
179
+ */
180
+ public function getConfigPage($path)
181
+ {
182
+ $config = $this->helperWizard()->getConfigPage();
183
+ return $config->getData($path);
184
+ }
185
+
186
+ /**
187
+ * @return Payone_Core_Helper_Wizard
188
+ */
189
+ public function helperWizard()
190
+ {
191
+ return Mage::helper('payone_core/wizard');
192
+ }
193
+ }
app/code/community/Payone/Core/Block/Adminhtml/Configuration/Wizard/Page/Edit.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Configuration
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Configuration
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Configuration_Wizard_Page_Edit
34
+ extends Mage_Adminhtml_Block_Widget_Form_Container
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+
43
+ $this->_objectId = 'id';
44
+ $this->_blockGroup = '';
45
+ $this->_controller = 'adminhtml_configuration_wizard_page';
46
+
47
+ $this->_removeButton('delete');
48
+ $this->_removeButton('reset');
49
+ $this->_removeButton('back');
50
+ $this->_removeButton('save');
51
+
52
+ $this->_addButton('cancel', array(
53
+ 'label' => Mage::helper('payone_core')->__('Cancel'),
54
+ 'onclick' => 'parent.window.wizardPopup.close()',
55
+ 'class' => 'default',
56
+ ));
57
+
58
+ $this->_addButton('back', array(
59
+ 'label' => Mage::helper('payone_core')->__('Back'),
60
+ 'onclick' => 'setLocation(\'' . $this->getBackUrl() . '\')',
61
+ 'class' => 'default',
62
+ ));
63
+
64
+ $this->_addButton('save', array(
65
+ 'label' => Mage::helper('payone_core')->__('Save & Continue'),
66
+ 'onclick' => 'editForm.submit();',
67
+ 'class' => 'default',
68
+ ));
69
+
70
+ $this->setData('edit_form_id', 'edit_form_wizard_page');
71
+ }
72
+
73
+ /**
74
+ * @return string
75
+ */
76
+ public function getHeaderText()
77
+ {
78
+ $headerText = $this->getConfigPage('header_text');
79
+ $text = Mage::helper('payone_core')->__($headerText);
80
+ return $text;
81
+ }
82
+
83
+ /**
84
+ * @return string
85
+ */
86
+ public function getBackUrl()
87
+ {
88
+ $url = $this->helperWizard()->getPreviousPageUrlAsString();
89
+ return $this->getUrl($url, array('_current' => true));
90
+ }
91
+
92
+ public function getDeleteUrl()
93
+ {
94
+ return '';
95
+ }
96
+
97
+ /**
98
+ * @param string $path
99
+ * @return mixed
100
+ */
101
+ public function getConfigPage($path)
102
+ {
103
+ $config = $this->helperWizard()->getConfigPage();
104
+ return $config->getData($path);
105
+ }
106
+
107
+ /**
108
+ * @return Payone_Core_Helper_Wizard
109
+ */
110
+ public function helperWizard()
111
+ {
112
+ return Mage::helper('payone_core/wizard');
113
+ }
114
+
115
+ }
app/code/community/Payone/Core/Block/Adminhtml/Configuration/Wizard/Page/View.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Configuration
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Configuration
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Configuration_Wizard_Page_View
34
+ extends Mage_Adminhtml_Block_Widget_View_Container
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ $this->_objectId = 'id';
42
+ $this->_controller = 'adminhtml_configuration_wizard_page';
43
+
44
+ parent::__construct();
45
+
46
+ $this->_removeButton('edit');
47
+ $this->_removeButton('back');
48
+
49
+ $this->_addButton('cancel', array(
50
+ 'label' => Mage::helper('adminhtml')->__('Cancel'),
51
+ 'onclick' => 'parent.window.wizardPopup.close()',
52
+ 'class' => 'default'
53
+ ));
54
+
55
+ $this->_addButton('back', array(
56
+ 'label' => Mage::helper('adminhtml')->__('Back'),
57
+ 'onclick' => 'window.location.href=\'' . $this->getBackUrl() . '\'',
58
+ 'class' => 'default',
59
+ ));
60
+
61
+ $this->_addButton('save', array(
62
+ 'label' => Mage::helper('adminhtml')->__('Continue'),
63
+ 'class' => 'default',
64
+ 'onclick' => 'window.location.href=\'' . $this->getNextUrl() . '\'',
65
+ ));
66
+
67
+ $this->setId('wizard_page_view');
68
+ }
69
+
70
+ public function getViewHtml()
71
+ {
72
+ $html = '';
73
+ foreach ($this->getSortedChildren() as $childName) {
74
+ $child = $this->getChild($childName);
75
+ /** @var $child Mage_Adminhtml_Block_Abstract */
76
+ $html .= $child->toHtml();
77
+ }
78
+ return $html;
79
+ }
80
+
81
+ protected function getBackUrl()
82
+ {
83
+ $url = $this->helperWizard()->getPreviousPageUrlAsString();
84
+ return $this->getUrl($url, array('_current' => true));
85
+ }
86
+
87
+ protected function getNextUrl()
88
+ {
89
+ $url = $this->helperWizard()->getNextPageUrlAsString();
90
+ return $this->getUrl($url, array('_current' => true));
91
+ }
92
+
93
+ /**
94
+ * @return string
95
+ */
96
+ public function getHeaderText()
97
+ {
98
+ $headerText = $this->getConfigPage('header_text');
99
+ $text = Mage::helper('payone_core')->__($headerText);
100
+ return $text;
101
+ }
102
+
103
+ /**
104
+ * @param string $path
105
+ * @return mixed
106
+ */
107
+ public function getConfigPage($path)
108
+ {
109
+ $config = $this->helperWizard()->getConfigPage();
110
+ return $config->getData($path);
111
+ }
112
+
113
+ /**
114
+ * @return Payone_Core_Helper_Wizard
115
+ */
116
+ public function helperWizard()
117
+ {
118
+ return Mage::helper('payone_core/wizard');
119
+ }
120
+ }
app/code/community/Payone/Core/Block/Adminhtml/Information.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Information extends Payone_Core_Block_Adminhtml_Information_Abstract
34
+ {
35
+
36
+ /**
37
+ * @return string
38
+ */
39
+ public function getPayoneUrl()
40
+ {
41
+ $url = $this->escapeUrl('http://embedded.payone.de/extensions/magento');
42
+ return $url;
43
+ }
44
+ }
app/code/community/Payone/Core/Block/Adminhtml/Information/Abstract.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Information
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Information
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Block_Adminhtml_Information_Abstract extends Mage_Adminhtml_Block_Template
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function _construct()
39
+ {
40
+ $this->setTemplate("payone/core/information/iframe.phtml");
41
+ }
42
+ /**
43
+ * @abstract
44
+ * @return mixed
45
+ */
46
+ abstract public function getPayoneUrl();
47
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_Api extends Payone_Core_Block_Adminhtml_Widget_Grid_Container
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ $this->_blockGroup = 'payone_core';
41
+ $this->_controller = 'adminhtml_protocol_api';
42
+ $this->_headerText = Mage::helper('payone_core')->__('Protocol - Api');
43
+
44
+ parent::__construct();
45
+ $this->removeButton('add');
46
+ }
47
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/Grid.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_Api_Grid extends Mage_Adminhtml_Block_Widget_Grid
34
+ {
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('protocol_api_grid');
43
+ $this->setUseAjax(true);
44
+ $this->setDefaultSort('id');
45
+ $this->setDefaultDir('DESC');
46
+ $this->setSaveParametersInSession(true);
47
+ }
48
+
49
+ /**
50
+ * @return Mage_Adminhtml_Block_Widget_Grid
51
+ */
52
+ protected function _prepareCollection()
53
+ {
54
+ /**
55
+ * @var Payone_Core_Model_Domain_Resource_Protocol_Api_Collection $collection
56
+ */
57
+ $collection = Mage::getModel('payone_core/domain_protocol_api')->getCollection();
58
+
59
+ $this->setCollection($collection);
60
+ return parent::_prepareCollection();
61
+ }
62
+
63
+ /**
64
+ * @return Mage_Adminhtml_Block_Widget_Grid
65
+ */
66
+ protected function _prepareColumns()
67
+ {
68
+ $this->addColumn(
69
+ 'id',
70
+ array(
71
+ 'header' => $this->helperPayone()->__('ID'),
72
+ 'width' => '5px',
73
+ 'type' => 'text',
74
+ 'filter' => false,
75
+ 'index' => 'id',
76
+ ));
77
+
78
+ $this->addColumn(
79
+ 'request',
80
+ array(
81
+ 'header' => $this->helperPayone()->__('Request'),
82
+ 'index' => 'request',
83
+ 'type' => 'options',
84
+ 'options' => $this->getFactory()->getModelSystemConfigRequestType()->toSelectArray()
85
+ ));
86
+
87
+ $this->addColumn(
88
+ 'response',
89
+ array(
90
+ 'header' => $this->helperPayone()->__('Response'),
91
+ 'index' => 'response',
92
+ 'type' => 'options',
93
+ 'options' => $this->getFactory()->getModelSystemConfigResponseType()->toSelectArray()
94
+ ));
95
+
96
+ $this->addColumn(
97
+ 'mode',
98
+ array(
99
+ 'header' => $this->helperPayone()->__('Modus'),
100
+ 'index' => 'mode',
101
+ 'type' => 'options',
102
+ 'options' => $this->getFactory()->getModelSystemConfigMode()->toSelectArray()
103
+ ));
104
+
105
+ $this->addColumn(
106
+ 'mid',
107
+ array(
108
+ 'header' => $this->helperPayone()->__('Merchant-ID'),
109
+ 'type' => 'text',
110
+ 'index' => 'mid',
111
+ ));
112
+
113
+ $this->addColumn(
114
+ 'portalid',
115
+ array(
116
+ 'header' => $this->helperPayone()->__('Portal ID'),
117
+ 'type' => 'text',
118
+ 'index' => 'portalid',
119
+ ));
120
+
121
+ $this->addColumn(
122
+ 'created_at',
123
+ array(
124
+ 'header' => $this->helperPayone()->__('Created at'),
125
+ 'index' => 'created_at',
126
+ 'type' => 'datetime',
127
+ 'width' => '80px',
128
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
129
+ ));
130
+
131
+ if (Mage::getSingleton('admin/session')->isAllowed('payone/protocol/api/view')) {
132
+ $this->addColumn('action',
133
+ array(
134
+ 'header' => $this->helperPayone()->__('Action'),
135
+ 'width' => '50px',
136
+ 'type' => 'action',
137
+ 'getter' => 'getId',
138
+ 'actions' => array(
139
+ array(
140
+ 'caption' => $this->helperPayone()->__('View'),
141
+ 'url' => array('base' => '*/*/view'),
142
+ 'field' => 'id'
143
+ )
144
+ ),
145
+ 'filter' => false,
146
+ 'sortable' => false,
147
+ 'index' => 'stores',
148
+ 'is_system' => true,
149
+ ));
150
+ }
151
+
152
+ if (Mage::getSingleton('admin/session')->isAllowed('payone/protocol/api/export')) {
153
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
154
+ $this->addExportType('*/*/exportCsvRaw', Mage::helper('sales')->__('CSV (including raw)'));
155
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
156
+ }
157
+
158
+ return parent::_prepareColumns();
159
+ }
160
+
161
+ /**
162
+ * @return string
163
+ */
164
+ public function getGridUrl()
165
+ {
166
+ return $this->getUrl('*/*/grid', array('_current' => true));
167
+ }
168
+
169
+ /**
170
+ * @param $row
171
+ * @return string
172
+ */
173
+ public function getRowUrl($row)
174
+ {
175
+ return $this->getUrl('*/*/view', array('id' => $row->getId()));
176
+ }
177
+
178
+ /**
179
+ *
180
+ * @return Payone_Core_Helper_Data
181
+ */
182
+ protected function helperPayone()
183
+ {
184
+ return Mage::helper('payone_core');
185
+ }
186
+
187
+ /**
188
+ * @return Payone_Core_Model_Factory
189
+ */
190
+ public function getFactory(){
191
+ return $this->helperPayone()->getFactory();
192
+ }
193
+
194
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_Api_View
34
+ extends Payone_Core_Block_Adminhtml_Widget_View_Container
35
+ {
36
+
37
+ /**
38
+ *
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_objectId = 'id';
43
+ $this->_blockGroup = 'payone_core_api_view';
44
+ $this->_controller = 'adminhtml_protocol_api';
45
+
46
+ parent::__construct();
47
+
48
+ $this->setId('protocol_api_view');
49
+
50
+ $this->_removeButton('edit');
51
+ }
52
+
53
+ /**
54
+ * @return string
55
+ */
56
+ public function getHeaderText()
57
+ {
58
+ $api = $this->getProtocolApi();
59
+ $text = Mage::helper('payone_core')->__('Protocol - Api #%s', $api->getId());
60
+ return $text;
61
+ }
62
+
63
+ /**
64
+ * @return Payone_Core_Block_Adminhtml_Protocol_Api_View
65
+ */
66
+ protected function _prepareLayout()
67
+ {
68
+ foreach ($this->_buttons as $level => $buttons) {
69
+ foreach ($buttons as $id => $data) {
70
+ $childId = $this->_prepareButtonBlockId($id);
71
+ $this->_addButtonChildBlock($childId);
72
+ }
73
+ }
74
+ $this->setChild('plane', $this->getLayout()
75
+ ->createBlock('payone_core/adminhtml_protocol_api_view_plane', 'payone_core_adminhtml_protocol_api_view_plane'));
76
+ return $this;
77
+ }
78
+
79
+ /**
80
+ * @return Payone_Core_Model_Domain_Protocol_Api
81
+ */
82
+ public function getProtocolApi()
83
+ {
84
+ return Mage::registry('payone_core_protocol_api');
85
+ }
86
+
87
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Plane.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_Api_View_Plane extends Mage_Adminhtml_Block_Widget
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ parent::__construct();
41
+ $this->setTemplate('payone/core/protocol/api/view/plane.phtml');
42
+ }
43
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Tab/Exception.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Christian Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_Api_View_Tab_Exception extends Mage_Adminhtml_Block_Widget
34
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
35
+ {
36
+
37
+ /**
38
+ *
39
+ * @return string
40
+ */
41
+ public function getTabTitle()
42
+ {
43
+ return $this->helperPayoneCore()->__('Exception');
44
+ }
45
+
46
+ /**
47
+ * @return bool
48
+ */
49
+ public function isHidden()
50
+ {
51
+ $stacktrace = $this->getStacktrace();
52
+ if(empty($stacktrace))
53
+ {
54
+ return true;
55
+ }
56
+ return false;
57
+ }
58
+
59
+ /**
60
+ * @return bool
61
+ */
62
+ public function canShowTab()
63
+ {
64
+ return true;
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function getTabLabel()
71
+ {
72
+ return $this->helperPayoneCore()->__('Exception');
73
+ }
74
+
75
+ /**
76
+ * @return Payone_Core_Model_Domain_Protocol_Api
77
+ */
78
+ public function getApi()
79
+ {
80
+ return Mage::registry('payone_core_protocol_api');
81
+ }
82
+
83
+ /**
84
+ * @return string
85
+ */
86
+ public function getStacktrace()
87
+ {
88
+ return nl2br(htmlspecialchars($this->getApi()->getStacktrace()));
89
+ }
90
+
91
+ /**
92
+ *
93
+ * @return Payone_Core_Helper_Data
94
+ */
95
+ protected function helperPayoneCore()
96
+ {
97
+ return Mage::helper('payone_core');
98
+ }
99
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Tab/General.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_Api_View_Tab_General extends Mage_Adminhtml_Block_Widget
34
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
35
+ {
36
+
37
+ /**
38
+ *
39
+ * @return string
40
+ */
41
+ public function getTabTitle()
42
+ {
43
+ return $this->helperPayoneCore()->__('General');
44
+ }
45
+
46
+ /**
47
+ * @return bool
48
+ */
49
+ public function isHidden()
50
+ {
51
+ return false;
52
+ }
53
+
54
+ /**
55
+ * @return bool
56
+ */
57
+ public function canShowTab()
58
+ {
59
+ return true;
60
+ }
61
+
62
+ /**
63
+ * @return string
64
+ */
65
+ public function getTabLabel()
66
+ {
67
+ return $this->helperPayoneCore()->__('General');
68
+ }
69
+
70
+ /**
71
+ * Converts timezone from "GMT" to locale timezone
72
+ * @param $string
73
+ * @return string|null
74
+ */
75
+ public function getLocaleDatetime($string)
76
+ {
77
+ $helper = $this->helperPayoneCore();
78
+ return $helper->getLocaleDatetime($string);
79
+ }
80
+
81
+ /**
82
+ * @return Payone_Core_Model_Domain_Protocol_Api
83
+ */
84
+ public function getApi()
85
+ {
86
+ return Mage::registry('payone_core_protocol_api');
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @return Payone_Core_Helper_Data
92
+ */
93
+ protected function helperPayoneCore()
94
+ {
95
+ return Mage::helper('payone_core');
96
+ }
97
+
98
+ /**
99
+ * @return string
100
+ */
101
+ public function getPreparedRawRequest()
102
+ {
103
+ $api = $this->getApi();
104
+ $rawRequestArray = $api->getRawRequestAsArray();
105
+
106
+ return $rawRequestArray;
107
+ }
108
+
109
+ /**
110
+ * @return string
111
+ */
112
+ public function getPreparedRawResponse()
113
+ {
114
+ $api = $this->getApi();
115
+ $rawResponseArray = $api->getRawResponseAsArray();
116
+
117
+ return $rawResponseArray;
118
+ }
119
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/Api/View/Tabs.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_Api_View_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
34
+ {
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('payone_core_api_view_tabs');
43
+ $this->setDestElementId('api_view');
44
+ $this->setTitle(Mage::helper('payone_core')->__('Information'));
45
+ }
46
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_TransactionStatus
34
+ extends Payone_Core_Block_Adminhtml_Widget_Grid_Container
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ $this->_blockGroup = 'payone_core';
42
+ $this->_controller = 'adminhtml_protocol_transactionStatus';
43
+ $this->_headerText = Mage::helper('payone_core')->__('Protocol - TransactionStatus');
44
+
45
+ parent::__construct();
46
+ $this->removeButton('add');
47
+ }
48
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/Grid.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_Grid extends Mage_Adminhtml_Block_Widget_Grid
34
+ {
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('protocol_transactionStatus_grid');
43
+ $this->setUseAjax(true);
44
+ $this->setDefaultSort('id');
45
+ $this->setDefaultDir('DESC');
46
+ $this->setSaveParametersInSession(true);
47
+ }
48
+
49
+ /**
50
+ * @return Mage_Adminhtml_Block_Widget_Grid
51
+ */
52
+ protected function _prepareCollection()
53
+ {
54
+ /**
55
+ * @var Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection $collection
56
+ */
57
+ $collection = Mage::getModel('payone_core/domain_protocol_transactionStatus')->getCollection();
58
+
59
+ $this->setCollection($collection);
60
+ return parent::_prepareCollection();
61
+ }
62
+
63
+ /**
64
+ * @return Mage_Adminhtml_Block_Widget_Grid
65
+ */
66
+ protected function _prepareColumns()
67
+ {
68
+ $this->addColumn(
69
+ 'id',
70
+ array(
71
+ 'header' => $this->helperPayone()->__('ID'),
72
+ 'width' => '5px',
73
+ 'type' => 'text',
74
+ 'index' => 'id',
75
+ 'filter' => false,
76
+ ));
77
+
78
+ $this->addColumn(
79
+ 'txid',
80
+ array(
81
+ 'header' => $this->helperPayone()->__('Txid'),
82
+ 'type' => 'text',
83
+ 'index' => 'txid',
84
+ ));
85
+
86
+ $this->addColumn(
87
+ 'reference',
88
+ array(
89
+ 'header' => $this->helperPayone()->__('Reference'),
90
+ 'type' => 'text',
91
+ 'index' => 'reference',
92
+ ));
93
+
94
+ $this->addColumn(
95
+ 'txaction',
96
+ array(
97
+ 'header' => $this->helperPayone()->__('Txaction'),
98
+ 'index' => 'txaction',
99
+ 'type' => 'options',
100
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigTransactionStatus()->toSelectArray()
101
+ ));
102
+
103
+ $this->addColumn(
104
+ 'txtime',
105
+ array(
106
+ 'header' => $this->helperPayone()->__('TxTime'),
107
+ 'index' => 'txtime',
108
+ 'type' => 'text',
109
+ ));
110
+
111
+ $this->addColumn(
112
+ 'sequencenumber',
113
+ array(
114
+ 'header' => $this->helperPayone()->__('Sequencenumber'),
115
+ 'index' => 'sequencenumber',
116
+ 'type' => 'text',
117
+ ));
118
+
119
+ $this->addColumn(
120
+ 'clearingtype',
121
+ array(
122
+ 'header' => $this->helperPayone()->__('Clearingtype'),
123
+ 'index' => 'clearingtype',
124
+ 'type' => 'options',
125
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigClearingType()->toSelectArray()
126
+ ));
127
+
128
+ $this->addColumn(
129
+ 'mode',
130
+ array(
131
+ 'header' => $this->helperPayone()->__('Mode'),
132
+ 'index' => 'mode',
133
+ 'type' => 'options',
134
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigMode()->toSelectArray()
135
+ ));
136
+
137
+ $this->addColumn(
138
+ 'portalid',
139
+ array(
140
+ 'header' => $this->helperPayone()->__('Portal-ID'),
141
+ 'index' => 'portalid',
142
+ 'type' => 'text',
143
+ ));
144
+
145
+ $this->addColumn(
146
+ 'receivable',
147
+ array(
148
+ 'header' => $this->helperPayone()->__('Receivable'),
149
+ 'index' => 'receivable',
150
+ 'type' => 'text',
151
+ ));
152
+
153
+ $this->addColumn(
154
+ 'balance',
155
+ array(
156
+ 'header' => $this->helperPayone()->__('Balance'),
157
+ 'index' => 'balance',
158
+ 'type' => 'text',
159
+ ));
160
+
161
+ $this->addColumn(
162
+ 'created_at',
163
+ array(
164
+ 'header' => $this->helperPayone()->__('Created at'),
165
+ 'index' => 'created_at',
166
+ 'type' => 'datetime',
167
+ 'width' => '80px',
168
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
169
+ ));
170
+
171
+ $this->addColumn(
172
+ 'updated_at',
173
+ array(
174
+ 'header' => $this->helperPayone()->__('Updated at'),
175
+ 'index' => 'updated_at',
176
+ 'type' => 'datetime',
177
+ 'width' => '80px',
178
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
179
+ ));
180
+
181
+ if (Mage::getSingleton('admin/session')->isAllowed('payone/protocol/transactionStatus/view')) {
182
+ $this->addColumn('action',
183
+ array(
184
+ 'header' => $this->helperPayone()->__('Action'),
185
+ 'width' => '50px',
186
+ 'type' => 'action',
187
+ 'getter' => 'getId',
188
+ 'actions' => array(
189
+ array(
190
+ 'caption' => $this->helperPayone()->__('View'),
191
+ 'url' => array('base' => '*/*/view'),
192
+ 'field' => 'id'
193
+ )
194
+ ),
195
+ 'filter' => false,
196
+ 'sortable' => false,
197
+ 'index' => 'stores',
198
+ 'is_system' => true,
199
+ ));
200
+ }
201
+
202
+ if (Mage::getSingleton('admin/session')->isAllowed('payone/protocol/transactionStatus/export')) {
203
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
204
+ $this->addExportType('*/*/exportCsvRaw', Mage::helper('sales')->__('CSV (including raw)'));
205
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
206
+ }
207
+
208
+ return parent::_prepareColumns();
209
+ }
210
+
211
+ /**
212
+ * @return string
213
+ */
214
+ public function getGridUrl()
215
+ {
216
+ return $this->getUrl('*/*/grid', array('_current' => true));
217
+ }
218
+
219
+ /**
220
+ * @param $row
221
+ * @return string
222
+ */
223
+ public function getRowUrl($row)
224
+ {
225
+ return $this->getUrl('*/*/view', array('id' => $row->getId()));
226
+ }
227
+
228
+ /**
229
+ *
230
+ * @return Payone_Core_Helper_Data
231
+ */
232
+ protected function helperPayone()
233
+ {
234
+ return Mage::helper('payone_core');
235
+ }
236
+
237
+ /**
238
+ * @return Payone_Core_Model_Factory
239
+ */
240
+ public function getPayoneFactory(){
241
+ return $this->helperPayone()->getFactory();
242
+ }
243
+
244
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_View
34
+ extends Payone_Core_Block_Adminhtml_Widget_View_Container
35
+ {
36
+
37
+ /**
38
+ *
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_objectId = 'id';
43
+ $this->_blockGroup = 'payone_core_transactionstatus_view';
44
+ $this->_controller = 'adminhtml_protocol_transactionStatus';
45
+
46
+ $this->_addButton('forward_to_order', array(
47
+ 'label' => Mage::helper('payone_core')->__('Go to Order'),
48
+ 'onclick' => 'setLocation(\'' . $this->getForwardToOrderUrl() . '\')',
49
+ 'class' => 'go',
50
+ ), 0, 250);
51
+
52
+ $this->_addButton('forward_to_transaction', array(
53
+ 'label' => Mage::helper('payone_core')->__('Go to Transaction'),
54
+ 'onclick' => 'setLocation(\'' . $this->getForwardToTransactionUrl() . '\')',
55
+ 'class' => 'go',
56
+ ), 0, 500);
57
+
58
+ parent::__construct();
59
+
60
+ $this->setId('transactionstatus_view');
61
+
62
+ $this->_removeButton('edit');
63
+ }
64
+
65
+ /**
66
+ * @return string
67
+ */
68
+ public function getForwardToOrderUrl()
69
+ {
70
+ $params = array('order_id' => $this->getTransactionStatus()->getOrderId());
71
+ return $this->getUrl('adminhtml/sales_order/view', $params);
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function getForwardToTransactionUrl()
78
+ {
79
+ $transaction = $this->getTransaction();
80
+ $params = array('id' => $transaction->getId());
81
+ return $this->getUrl('*/adminhtml_transaction/view', $params);
82
+ }
83
+
84
+ /**
85
+ * @return string
86
+ */
87
+ public function getHeaderText()
88
+ {
89
+ $transactionStatus = $this->getTransactionStatus();
90
+ $text = Mage::helper('payone_core')->__(
91
+ 'Protocol - TransactionStatus #%s | %s',
92
+ $transactionStatus->getId(),
93
+ $transactionStatus->getTxid()
94
+ );
95
+ return $text;
96
+ }
97
+
98
+ /**
99
+ * @return Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_View
100
+ */
101
+ protected function _prepareLayout()
102
+ {
103
+ foreach ($this->_buttons as $level => $buttons) {
104
+ foreach ($buttons as $id => $data) {
105
+ $childId = $this->_prepareButtonBlockId($id);
106
+ $this->_addButtonChildBlock($childId);
107
+ }
108
+ }
109
+ $this->setChild('plane',
110
+ $this->getLayout()->createBlock(
111
+ 'payone_core/adminhtml_protocol_transactionStatus_view_plane',
112
+ 'payone_core_adminhtml_protocol_transactionstatus_view_plane'
113
+ )
114
+ );
115
+ return $this;
116
+ }
117
+
118
+ /**
119
+ * @return Payone_Core_Model_Domain_Transaction
120
+ */
121
+ protected function getTransaction()
122
+ {
123
+ return Mage::registry('payone_core_protocol_transaction');
124
+ }
125
+
126
+ /**
127
+ * @return Payone_Core_Model_Domain_Protocol_TransactionStatus
128
+ */
129
+ public function getTransactionStatus()
130
+ {
131
+ return Mage::registry('payone_core_protocol_transactionstatus');
132
+ }
133
+
134
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View/Plane.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_View_Plane extends Mage_Adminhtml_Block_Widget
34
+ {
35
+ public function __construct()
36
+ {
37
+ parent::__construct();
38
+ $this->setTemplate('payone/core/protocol/transactionstatus/view/plane.phtml');
39
+ }
40
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View/Tab/General.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_View_Tab_General extends Mage_Adminhtml_Block_Widget
34
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
35
+ {
36
+
37
+ /**
38
+ *
39
+ * @return string
40
+ */
41
+ public function getTabTitle()
42
+ {
43
+ return $this->helperPayoneCore()->__('General');
44
+ }
45
+
46
+ public function isHidden()
47
+ {
48
+ return false;
49
+ }
50
+
51
+ public function canShowTab()
52
+ {
53
+ return true;
54
+ }
55
+
56
+ public function getTabLabel()
57
+ {
58
+ return $this->helperPayoneCore()->__('General');
59
+ }
60
+
61
+ /**
62
+ * Converts timezone from "GMT" to locale timezone
63
+ * @param $string
64
+ * @return string|null
65
+ */
66
+ public function getLocaleDatetime($string)
67
+ {
68
+ $helper = $this->helperPayoneCore();
69
+ return $helper->getLocaleDatetime($string);
70
+ }
71
+
72
+ /**
73
+ * @return Payone_Core_Model_Domain_Protocol_TransactionStatus
74
+ */
75
+ public function getTransactionStatus()
76
+ {
77
+ return Mage::registry('payone_core_protocol_transactionstatus');
78
+ }
79
+
80
+ /**
81
+ *
82
+ * @return Payone_Core_Helper_Data
83
+ */
84
+ protected function helperPayoneCore()
85
+ {
86
+ return Mage::helper('payone_core');
87
+ }
88
+ }
app/code/community/Payone/Core/Block/Adminhtml/Protocol/TransactionStatus/View/Tabs.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_View_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
34
+ {
35
+
36
+ public function __construct()
37
+ {
38
+ parent::__construct();
39
+ $this->setId('payone_core_transactionstatus_view_tabs');
40
+ $this->setDestElementId('transactionstatus_view');
41
+ $this->setTitle(Mage::helper('payone_core')->__('Information'));
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Block/Adminhtml/Sales/Order.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Sales_Order extends Payone_Core_Block_Adminhtml_Widget_Grid_Container
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ $this->_blockGroup = 'payone_core';
41
+ $this->_controller = 'adminhtml_sales_order';
42
+ $this->_headerText = Mage::helper('payone_core')->__('Orders');
43
+
44
+ parent::__construct();
45
+ $this->removeButton('add');
46
+ }
47
+ }
app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/Create/Init.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Sales_Order_Create_Init extends Mage_Adminhtml_Block_Template
34
+ {
35
+ }
app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/Grid.php ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
34
+ {
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('payone_sales_order_grid');
43
+ $this->setUseAjax(true);
44
+ $this->setDefaultSort('created_at');
45
+ $this->setDefaultDir('DESC');
46
+ $this->setSaveParametersInSession(true);
47
+ }
48
+
49
+ /**
50
+ * Retrieve collection class
51
+ *
52
+ * @return string
53
+ */
54
+ protected function _getCollectionClass()
55
+ {
56
+ return 'sales/order_grid_collection';
57
+ }
58
+
59
+ /**
60
+ * @return Mage_Adminhtml_Block_Widget_Grid
61
+ */
62
+ protected function _prepareCollection()
63
+ {
64
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
65
+ $this->setCollection($collection);
66
+ return parent::_prepareCollection();
67
+ }
68
+
69
+ /**
70
+ * @return Payone_Core_Block_Adminhtml_Sales_Order_Grid
71
+ */
72
+ public function _prepareColumns()
73
+ {
74
+
75
+ $this->addColumn('real_order_id', array(
76
+ 'header'=> Mage::helper('sales')->__('Order #'),
77
+ 'width' => '80px',
78
+ 'type' => 'text',
79
+ 'index' => 'increment_id',
80
+ ));
81
+
82
+ if (!Mage::app()->isSingleStoreMode()) {
83
+ $this->addColumn('store_id', array(
84
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
85
+ 'index' => 'store_id',
86
+ 'type' => 'store',
87
+ 'store_view'=> true,
88
+ 'display_deleted' => true,
89
+ ));
90
+ }
91
+
92
+ $this->addColumn('created_at', array(
93
+ 'header' => Mage::helper('sales')->__('Purchased On'),
94
+ 'index' => 'created_at',
95
+ 'type' => 'datetime',
96
+ 'width' => '100px',
97
+ ));
98
+
99
+ $this->addColumn('billing_name', array(
100
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
101
+ 'index' => 'billing_name',
102
+ ));
103
+
104
+ $this->addColumn('shipping_name', array(
105
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
106
+ 'index' => 'shipping_name',
107
+ ));
108
+
109
+ $this->addColumn('base_grand_total', array(
110
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
111
+ 'index' => 'base_grand_total',
112
+ 'type' => 'currency',
113
+ 'currency' => 'base_currency_code',
114
+ ));
115
+
116
+ $this->addColumn('grand_total', array(
117
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
118
+ 'index' => 'grand_total',
119
+ 'type' => 'currency',
120
+ 'currency' => 'order_currency_code',
121
+ ));
122
+
123
+ $this->addColumn('status', array(
124
+ 'header' => Mage::helper('sales')->__('Status'),
125
+ 'index' => 'status',
126
+ 'type' => 'options',
127
+ 'width' => '70px',
128
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
129
+ ));
130
+
131
+ $this->addColumnAfter(
132
+ 'payone_status',
133
+ array(
134
+ 'header' => $this->helperPayoneCore()->__('PAYONE Status'),
135
+ 'width' => '40px',
136
+ 'index' => 'payone_transaction_status',
137
+ 'align' => 'center',
138
+ 'type' => 'options',
139
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigStatusTransaction()->toSelectArray()
140
+ ),
141
+ 'status'
142
+ );
143
+
144
+ $this->addColumnAfter(
145
+ 'payone_payment_method',
146
+ array(
147
+ 'header' => $this->helperPayoneCore()->__('PAYONE Method'),
148
+ 'width' => '40px',
149
+ 'index' => 'payone_payment_method',
150
+ 'align' => 'center',
151
+ 'type' => 'options',
152
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigPaymentMethodCode()->toSelectArray(),
153
+ ),
154
+ 'payone_status'
155
+ );
156
+
157
+ $this->addColumnAfter(
158
+ 'payone_payment_method_type',
159
+ array(
160
+ 'header' => $this->helperPayoneCore()->__('PAYONE Type'),
161
+ 'width' => '40px',
162
+ 'index' => 'payone_payment_method_type',
163
+ 'align' => 'center',
164
+ 'type' => 'options',
165
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigMethodType()->toSelectArray(),
166
+ 'option_groups' => $this->getPayoneFactory()->getModelSystemConfigMethodType()->toOptionGroupArray(),
167
+ ),
168
+ 'payone_payment_method'
169
+ );
170
+
171
+ $this->addColumnAfter(
172
+ 'payone_dunning_status',
173
+ array(
174
+ 'header' => $this->helperPayoneCore()->__('PAYONE Dunning Status'),
175
+ 'width' => '40px',
176
+ 'index' => 'payone_dunning_status',
177
+ 'align' => 'center',
178
+ 'type' => 'options',
179
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigReminderLevel()->toSelectArray(),
180
+ ),
181
+ 'payone_payment_method_type'
182
+ );
183
+
184
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
185
+ $this->addColumn('action',
186
+ array(
187
+ 'header' => Mage::helper('sales')->__('Action'),
188
+ 'width' => '50px',
189
+ 'type' => 'action',
190
+ 'getter' => 'getId',
191
+ 'actions' => array(
192
+ array(
193
+ 'caption' => Mage::helper('sales')->__('View'),
194
+ 'url' => array('base' => 'adminhtml/sales_order/view'),
195
+ 'field' => 'order_id'
196
+ )
197
+ ),
198
+ 'filter' => false,
199
+ 'sortable' => false,
200
+ 'index' => 'stores',
201
+ 'is_system' => true,
202
+ ));
203
+ }
204
+
205
+ $this->setDefaultSort('created_at');
206
+ $this->setDefaultDir('DESC');
207
+
208
+
209
+ $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
210
+
211
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
212
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
213
+
214
+ return parent::_prepareColumns();
215
+ }
216
+
217
+ /**
218
+ * @return Payone_Core_Block_Adminhtml_Sales_Order_Grid
219
+ */
220
+ protected function _prepareMassaction()
221
+ {
222
+ $this->setMassactionIdField('entity_id');
223
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
224
+ $this->getMassactionBlock()->setUseSelectAll(false);
225
+
226
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
227
+ $this->getMassactionBlock()->addItem('cancel_order', array(
228
+ 'label'=> Mage::helper('sales')->__('Cancel'),
229
+ 'url' => $this->getUrl('*/*/massCancel'),
230
+ ));
231
+ }
232
+
233
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
234
+ $this->getMassactionBlock()->addItem('hold_order', array(
235
+ 'label'=> Mage::helper('sales')->__('Hold'),
236
+ 'url' => $this->getUrl('*/*/massHold'),
237
+ ));
238
+ }
239
+
240
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
241
+ $this->getMassactionBlock()->addItem('unhold_order', array(
242
+ 'label'=> Mage::helper('sales')->__('Unhold'),
243
+ 'url' => $this->getUrl('*/*/massUnhold'),
244
+ ));
245
+ }
246
+
247
+ $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
248
+ 'label'=> Mage::helper('sales')->__('Print Invoices'),
249
+ 'url' => $this->getUrl('*/*/pdfinvoices'),
250
+ ));
251
+
252
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
253
+ 'label'=> Mage::helper('sales')->__('Print Packingslips'),
254
+ 'url' => $this->getUrl('*/*/pdfshipments'),
255
+ ));
256
+
257
+ $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
258
+ 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
259
+ 'url' => $this->getUrl('*/*/pdfcreditmemos'),
260
+ ));
261
+
262
+ $this->getMassactionBlock()->addItem('pdfdocs_order', array(
263
+ 'label'=> Mage::helper('sales')->__('Print All'),
264
+ 'url' => $this->getUrl('*/*/pdfdocs'),
265
+ ));
266
+
267
+ $this->getMassactionBlock()->addItem('print_shipping_label', array(
268
+ 'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
269
+ 'url' => $this->getUrl('*/*/massPrintShippingLabel'),
270
+ ));
271
+
272
+ return $this;
273
+ }
274
+
275
+
276
+ /**
277
+ * @return string
278
+ */
279
+ public function getGridUrl()
280
+ {
281
+ return $this->getUrl('*/*/grid', array('_current' => true));
282
+ }
283
+
284
+ /**
285
+ * @param $row
286
+ * @return bool|string
287
+ */
288
+ public function getRowUrl($row)
289
+ {
290
+ return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
291
+ }
292
+
293
+ /**
294
+ *
295
+ * @return Payone_Core_Helper_Data
296
+ */
297
+ protected function helperPayoneCore()
298
+ {
299
+ return Mage::helper('payone_core');
300
+ }
301
+
302
+ /**
303
+ * @return Payone_Core_Model_Factory
304
+ */
305
+ public function getPayoneFactory()
306
+ {
307
+ return $this->helperPayoneCore()->getFactory();
308
+ }
309
+ }
app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/View/Tab/Api.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Sales_Order_View_Tab_Api
34
+ extends Mage_Adminhtml_Block_Widget_Grid
35
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
36
+ {
37
+ /**
38
+ *
39
+ */
40
+ public function __construct()
41
+ {
42
+ parent::__construct();
43
+ $this->setId('payone_core_block_adminhtml_sales_order_view_tab_api');
44
+ $this->setDefaultSort('created_at');
45
+ $this->setDefaultDir('DESC');
46
+ $this->setSaveParametersInSession(true);
47
+ $this->setUseAjax(true);
48
+ $this->setSkipGenerateContent(true);
49
+ }
50
+
51
+ /**
52
+ * @return string
53
+ */
54
+ public function getTabTitle()
55
+ {
56
+ return Mage::helper('payone_core')->__('Protocol - Api');
57
+ }
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ public function getTabLabel()
63
+ {
64
+ return '<span class="payone-tab">' . Mage::helper('payone_core')->__('Protocol - Api') . '</span>';
65
+ }
66
+
67
+ /**
68
+ * @return bool
69
+ */
70
+ public function isHidden()
71
+ {
72
+ return false;
73
+ }
74
+
75
+ /**
76
+ * @return string
77
+ */
78
+ public function getTabClass()
79
+ {
80
+ return 'ajax payone-widget-tab';
81
+ }
82
+
83
+ /**
84
+ * @return string
85
+ */
86
+ public function getAfter()
87
+ {
88
+ return 'payone_core_adminhtml_sales_order_view_tab_transactionStatus';
89
+ }
90
+
91
+ /**
92
+ * @return bool
93
+ */
94
+ public function canShowTab()
95
+ {
96
+ return true;
97
+ }
98
+
99
+ /**
100
+ * @param $row
101
+ * @return string
102
+ */
103
+ public function getRowUrl($row)
104
+ {
105
+ return $this->getUrl('payone_core/adminhtml_protocol_api/view', array('id' => $row->getId()));
106
+ }
107
+
108
+ /**
109
+ * @return string
110
+ */
111
+ public function getGridUrl()
112
+ {
113
+ return $this->getUrl('payone_core/adminhtml_sales_order/apiGrid', array('_current' => true));
114
+ }
115
+
116
+ /**
117
+ * @return string
118
+ */
119
+ public function getTabUrl()
120
+ {
121
+ return $this->getUrl('payone_core/adminhtml_sales_order/apiGrid', array('_current' => true));
122
+ }
123
+
124
+ /**
125
+ * @return Payone_Core_Block_Adminhtml_Sales_Order_View_Tab_Api
126
+ */
127
+ protected function _prepareCollection()
128
+ {
129
+ $collection = $this->getApiCollection();
130
+ $this->setCollection($collection);
131
+ return parent::_prepareCollection();
132
+ }
133
+
134
+ /**
135
+ * @return mixed
136
+ */
137
+ public function getApiCollection()
138
+ {
139
+ if (!Mage::registry('payone_core_protocol_api_collection')) {
140
+ $order = $this->getOrder();
141
+
142
+ /** @var $apiCollection Payone_Core_Model_Domain_Resource_Protocol_Api_Collection */
143
+ $apiCollection = $this->getPayoneFactory()->getModelApi()->getCollection();
144
+ $apiCollection->getByOrder($order);
145
+ Mage::register('payone_core_protocol_api_collection', $apiCollection);
146
+ }
147
+ return Mage::registry('payone_core_protocol_api_collection');
148
+ }
149
+
150
+ /**
151
+ * @return Mage_Adminhtml_Block_Widget_Grid
152
+ */
153
+ protected function _prepareColumns()
154
+ {
155
+ $this->addColumn(
156
+ 'id',
157
+ array(
158
+ 'header' => $this->helperPayoneCore()->__('ID'),
159
+ 'width' => '5px',
160
+ 'type' => 'text',
161
+ 'filter' => false,
162
+ 'index' => 'id',
163
+ ));
164
+
165
+ $this->addColumn(
166
+ 'request',
167
+ array(
168
+ 'header' => $this->helperPayoneCore()->__('Request'),
169
+ 'sortable' => false,
170
+ 'filter' => false,
171
+ 'index' => 'request',
172
+ 'type' => 'options',
173
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigRequestType()->toSelectArray()
174
+ ));
175
+
176
+ $this->addColumn(
177
+ 'response',
178
+ array(
179
+ 'header' => $this->helperPayoneCore()->__('Response'),
180
+ 'sortable' => false,
181
+ 'filter' => false,
182
+ 'index' => 'response',
183
+ 'type' => 'options',
184
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigResponseType()->toSelectArray()
185
+ ));
186
+
187
+ $this->addColumn(
188
+ 'mode',
189
+ array(
190
+ 'header' => $this->helperPayoneCore()->__('Mode'),
191
+ 'type' => 'text',
192
+ 'index' => 'mode',
193
+ ));
194
+
195
+ $this->addColumn(
196
+ 'mid',
197
+ array(
198
+ 'header' => $this->helperPayoneCore()->__('Merchant-ID'),
199
+ 'type' => 'text',
200
+ 'index' => 'mid',
201
+ ));
202
+
203
+ $this->addColumn(
204
+ 'portalid',
205
+ array(
206
+ 'header' => $this->helperPayoneCore()->__('Portal-ID'),
207
+ 'type' => 'text',
208
+ 'index' => 'portalid',
209
+ ));
210
+
211
+ $this->addColumn(
212
+ 'aid',
213
+ array(
214
+ 'header' => $this->helperPayoneCore()->__('Sub-Account-ID'),
215
+ 'type' => 'text',
216
+ 'index' => 'aid',
217
+ ));
218
+
219
+ $this->addColumn(
220
+ 'created_at',
221
+ array(
222
+ 'header' => $this->helperPayoneCore()->__('Created at'),
223
+ 'index' => 'created_at',
224
+ 'type' => 'datetime',
225
+ 'width' => '80px',
226
+ 'filter' => false,
227
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
228
+ ));
229
+
230
+ return parent::_prepareColumns();
231
+ }
232
+
233
+ /**
234
+ * @return Payone_Core_Model_Factory
235
+ */
236
+ public function getPayoneFactory()
237
+ {
238
+ return $this->helperPayoneCore()->getFactory();
239
+ }
240
+
241
+ /**
242
+ * @return Mage_Sales_Model_Order
243
+ */
244
+ public function getOrder()
245
+ {
246
+ return Mage::registry('current_order');
247
+ }
248
+
249
+ /**
250
+ *
251
+ * @return Payone_Core_Helper_Data
252
+ */
253
+ protected function helperPayoneCore()
254
+ {
255
+ return Mage::helper('payone_core');
256
+ }
257
+ }
app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/View/Tab/Transaction.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Sales_Order_View_Tab_Transaction
34
+ extends Mage_Adminhtml_Block_Widget
35
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
36
+ {
37
+ /**
38
+ *
39
+ * @return string
40
+ */
41
+ public function getTabTitle()
42
+ {
43
+ return $this->helperPayoneCore()->__('Transaction');
44
+ }
45
+
46
+ /**
47
+ * @return bool
48
+ */
49
+ public function isHidden()
50
+ {
51
+ return false;
52
+ }
53
+
54
+ public function getTabClass()
55
+ {
56
+ return 'payone-widget-tab';
57
+ }
58
+
59
+ /**
60
+ * @return bool
61
+ */
62
+ public function canShowTab()
63
+ {
64
+ return true;
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function getTabLabel()
71
+ {
72
+ return '<span class="payone-tab">' . Mage::helper('payone_core')->__('Transaction') . '</span>';
73
+ }
74
+
75
+ /**
76
+ * Converts timezone from "GMT" to locale timezone
77
+ * @param $string
78
+ * @return string|null
79
+ */
80
+ public function getLocaleDatetime($string)
81
+ {
82
+ $helper = $this->helperPayoneCore();
83
+ return $helper->getLocaleDatetime($string);
84
+ }
85
+
86
+ /**
87
+ * @return Payone_Core_Model_Domain_Transaction
88
+ */
89
+ public function getTransaction()
90
+ {
91
+ if (!Mage::registry('payone_core_protocol_transaction')) {
92
+ $payment = $this->getOrder()->getPayment();
93
+
94
+ /** @var $transactionStatusCollection Payone_Core_Model_Domain_Transaction */
95
+ $transaction = $this->getPayoneFactory()->getModelTransaction();
96
+ $transaction->loadByPayment($payment);
97
+ Mage::register('payone_core_protocol_transaction', $transaction);
98
+ }
99
+ return Mage::registry('payone_core_protocol_transaction');
100
+ }
101
+
102
+ /**
103
+ * @return Mage_Sales_Model_Order
104
+ */
105
+ public function getOrder()
106
+ {
107
+ return Mage::registry('current_order');
108
+ }
109
+
110
+ /**
111
+ * @return Payone_Core_Model_Factory
112
+ */
113
+ public function getPayoneFactory(){
114
+ return $this->helperPayoneCore()->getFactory();
115
+ }
116
+
117
+ /**
118
+ *
119
+ * @return Payone_Core_Helper_Data
120
+ */
121
+ protected function helperPayoneCore()
122
+ {
123
+ return Mage::helper('payone_core');
124
+ }
125
+ }
app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/View/Tab/TransactionStatus.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Sales_Order_View_Tab_TransactionStatus
34
+ extends Mage_Adminhtml_Block_Widget_Grid
35
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
36
+ {
37
+ public function __construct()
38
+ {
39
+ parent::__construct();
40
+ $this->setId('payone_core_block_adminhtml_sales_order_view_tab_transactionstatus');
41
+ $this->setDefaultSort('created_at');
42
+ $this->setDefaultDir('DESC');
43
+ $this->setSaveParametersInSession(true);
44
+ $this->setUseAjax(true);
45
+ $this->setSkipGenerateContent(true);
46
+ }
47
+
48
+ public function getTabTitle()
49
+ {
50
+ return $this->helperPayoneCore()->__('Protocol - TransactionStatus');
51
+ }
52
+
53
+ public function getTabLabel()
54
+ {
55
+ return '<span class="payone-tab">' .
56
+ Mage::helper('payone_core')->__('Protocol - Transaction') .
57
+ '</span>';
58
+ }
59
+
60
+ public function isHidden()
61
+ {
62
+ return false;
63
+ }
64
+
65
+ public function getTabClass()
66
+ {
67
+ return 'ajax payone-widget-tab';
68
+ }
69
+
70
+ public function getAfter()
71
+ {
72
+ return 'payone_core_adminhtml_sales_order_view_tab_transaction';
73
+ }
74
+
75
+ public function canShowTab()
76
+ {
77
+ return true;
78
+ }
79
+
80
+ public function getRowUrl($row)
81
+ {
82
+ return $this->getUrl('payone_core/adminhtml_protocol_transactionStatus/view', array('id' => $row->getId()));
83
+ }
84
+
85
+ public function getGridUrl()
86
+ {
87
+ return $this->getUrl('payone_core/adminhtml_sales_order/transactionStatusGrid', array('_current' => true));
88
+ }
89
+
90
+ public function getTabUrl()
91
+ {
92
+ return $this->getUrl('payone_core/adminhtml_sales_order/transactionStatusGrid', array('_current' => true));
93
+ }
94
+
95
+ protected function _prepareCollection()
96
+ {
97
+ $collection = $this->getTransactionStatusCollection();
98
+ $this->setCollection($collection);
99
+ return parent::_prepareCollection();
100
+ }
101
+
102
+ public function getTransactionStatusCollection()
103
+ {
104
+ if (!Mage::registry('payone_core_protocol_transactionstatus_collection')) {
105
+ $order = $this->getOrder();
106
+
107
+ /** @var $transactionStatusCollection Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection */
108
+ $transactionStatusCollection = $this->getPayoneFactory()->getModelTransactionStatus()->getCollection();
109
+ $transactionStatusCollection->getByOrder($order);
110
+ Mage::register('payone_core_protocol_transactionstatus_collection', $transactionStatusCollection);
111
+ }
112
+ return Mage::registry('payone_core_protocol_transactionstatus_collection');
113
+ }
114
+
115
+ protected function _prepareColumns()
116
+ {
117
+ $this->addColumn(
118
+ 'id',
119
+ array(
120
+ 'header' => $this->helperPayoneCore()->__('ID'),
121
+ 'width' => '5px',
122
+ 'type' => 'text',
123
+ 'index' => 'id',
124
+ 'filter' => false,
125
+ ));
126
+
127
+ $this->addColumn(
128
+ 'txid',
129
+ array(
130
+ 'header' => $this->helperPayoneCore()->__('Txid'),
131
+ 'width' => '200px',
132
+ 'type' => 'text',
133
+ 'index' => 'txid',
134
+ ));
135
+
136
+ $this->addColumn(
137
+ 'reference',
138
+ array(
139
+ 'header' => $this->helperPayoneCore()->__('Reference'),
140
+ 'width' => '5px',
141
+ 'type' => 'text',
142
+ 'sortable' => false,
143
+ 'filter' => false,
144
+ 'index' => 'reference',
145
+ ));
146
+
147
+ $this->addColumn(
148
+ 'txaction',
149
+ array(
150
+ 'header' => $this->helperPayoneCore()->__('Txaction'),
151
+ 'index' => 'txaction',
152
+ 'type' => 'options',
153
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigTransactionStatus()->toSelectArray()
154
+ ));
155
+
156
+ $this->addColumn(
157
+ 'txtime',
158
+ array(
159
+ 'header' => $this->helperPayoneCore()->__('TxTime'),
160
+ 'index' => 'txtime',
161
+ 'type' => 'text',
162
+ 'sortable' => false,
163
+ 'filter' => false,
164
+ 'width' => '80px',
165
+ ));
166
+
167
+ $this->addColumn(
168
+ 'sequencenumber',
169
+ array(
170
+ 'header' => $this->helperPayoneCore()->__('Sequencenumber'),
171
+ 'index' => 'sequencenumber',
172
+ 'sortable' => false,
173
+ 'filter' => false,
174
+ 'type' => 'text',
175
+ 'width' => '80px',
176
+ ));
177
+
178
+ $this->addColumn(
179
+ 'clearingtype',
180
+ array(
181
+ 'header' => $this->helperPayoneCore()->__('Clearingtype'),
182
+ 'index' => 'clearingtype',
183
+ 'sortable' => false,
184
+ 'filter' => false,
185
+ 'type' => 'text',
186
+ ));
187
+
188
+ $this->addColumn(
189
+ 'mode',
190
+ array(
191
+ 'header' => $this->helperPayoneCore()->__('Mode'),
192
+ 'index' => 'mode',
193
+ 'sortable' => false,
194
+ 'filter' => false,
195
+ 'type' => 'text',
196
+ ));
197
+
198
+ $this->addColumn(
199
+ 'portalid',
200
+ array(
201
+ 'header' => $this->helperPayoneCore()->__('Portal-ID'),
202
+ 'index' => 'portalid',
203
+ 'sortable' => false,
204
+ 'filter' => false,
205
+ 'type' => 'text',
206
+ ));
207
+
208
+ $this->addColumn(
209
+ 'receivable',
210
+ array(
211
+ 'header' => $this->helperPayoneCore()->__('Receivable'),
212
+ 'index' => 'receivable',
213
+ 'sortable' => false,
214
+ 'filter' => false,
215
+ 'type' => 'text',
216
+ ));
217
+
218
+ $this->addColumn(
219
+ 'balance',
220
+ array(
221
+ 'header' => $this->helperPayoneCore()->__('Balance'),
222
+ 'index' => 'balance',
223
+ 'sortable' => false,
224
+ 'filter' => false,
225
+ 'type' => 'text',
226
+ ));
227
+
228
+ $this->addColumn(
229
+ 'created_at',
230
+ array(
231
+ 'header' => $this->helperPayoneCore()->__('Created at'),
232
+ 'index' => 'created_at',
233
+ 'type' => 'datetime',
234
+ 'width' => '80px',
235
+ 'filter' => false,
236
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
237
+ ));
238
+
239
+ $this->addColumn(
240
+ 'updated_at',
241
+ array(
242
+ 'header' => $this->helperPayoneCore()->__('Updated at'),
243
+ 'index' => 'updated_at',
244
+ 'type' => 'datetime',
245
+ 'width' => '80px',
246
+ 'filter' => false,
247
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
248
+ ));
249
+
250
+ return parent::_prepareColumns();
251
+ }
252
+
253
+ /**
254
+ * @return Payone_Core_Model_Factory
255
+ */
256
+ public function getPayoneFactory()
257
+ {
258
+ return $this->helperPayoneCore()->getFactory();
259
+ }
260
+
261
+ /**
262
+ * @return Mage_Sales_Model_Order
263
+ */
264
+ public function getOrder()
265
+ {
266
+ return Mage::registry('current_order');
267
+ }
268
+
269
+ /**
270
+ *
271
+ * @return Payone_Core_Helper_Data
272
+ */
273
+ protected function helperPayoneCore()
274
+ {
275
+ return Mage::helper('payone_core');
276
+ }
277
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Field
34
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
35
+ {
36
+
37
+ /**
38
+ * Enter description here...
39
+ *
40
+ * @param Varien_Data_Form_Element_Abstract $element
41
+ * @return string
42
+ */
43
+ public function render(Varien_Data_Form_Element_Abstract $element)
44
+ {
45
+ $hint = (array) $element->getFieldConfig()->hint;
46
+ if (!count($hint)) {
47
+ return parent::render($element);
48
+ }
49
+
50
+ // Generate Tooltip
51
+ /** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
52
+ $tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
53
+ $tooltip->initFormElement($element);
54
+ $tooltipHtml = $tooltip->toHtml();
55
+
56
+ $element->setHint('__tooltip_html__');
57
+
58
+ $html = parent::render($element);
59
+
60
+ $hintToReplace = '<div class="hint" ><div style="display: none;">__tooltip_html__</div></div>';
61
+ $html = str_replace($hintToReplace, $tooltipHtml, $html);
62
+
63
+ return $html;
64
+ }
65
+
66
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/Abstract.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract
34
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
35
+ {
36
+ /** @var $factory Payone_Core_Model_Factory */
37
+ protected $factory;
38
+ const PAYONE_CORE_FIELD_MULTISELECT = 'multi';
39
+ const PAYONE_CORE_FIELD_SELECT = 'select';
40
+
41
+ /**
42
+ *
43
+ */
44
+ public function __construct()
45
+ {
46
+ parent::__construct();
47
+ $this->setTemplate('payone/core/system/config/form/field/array.phtml');
48
+ }
49
+
50
+ /**
51
+ * Enter description here...
52
+ *
53
+ * @param Varien_Data_Form_Element_Abstract $element
54
+ * @return string
55
+ */
56
+ public function render(Varien_Data_Form_Element_Abstract $element)
57
+ {
58
+ $hint = (array) $element->getFieldConfig()->hint;
59
+ if (!count($hint)) {
60
+ return parent::render($element);
61
+ }
62
+
63
+ // Generate Tooltip
64
+ /** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
65
+ $tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
66
+ $tooltip->initFormElement($element);
67
+ $tooltipHtml = $tooltip->toHtml();
68
+
69
+ $element->setHint('__tooltip_html__');
70
+
71
+ $html = parent::render($element);
72
+
73
+ $hintToReplace = '<div class="hint" ><div style="display: none;">__tooltip_html__</div></div>';
74
+ $html = str_replace($hintToReplace, $tooltipHtml, $html);
75
+
76
+ return $html;
77
+ }
78
+
79
+ /**
80
+ * @param $columnName string
81
+ * @param $selectType string
82
+ * @param $options array
83
+ * @return string
84
+ * @throws Exception
85
+ */
86
+ public function prepareCellTemplate($columnName, $selectType, $options)
87
+ {
88
+ if (empty($this->_columns[$columnName])) {
89
+ throw new Exception('Wrong column name specified.');
90
+ }
91
+ $column = $this->_columns[$columnName];
92
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . '][]';
93
+
94
+ // Write html for a multiselect input:
95
+ if ($selectType === self::PAYONE_CORE_FIELD_MULTISELECT) {
96
+ $definition = '" multiple="multiple" class="select multiselect"';
97
+ }
98
+ elseif ($selectType === self::PAYONE_CORE_FIELD_SELECT) {
99
+ $definition = '" class="select"';
100
+ }
101
+ else
102
+ throw new Exception('Unknown Type for Select');
103
+
104
+ $rendered = '<select name="' . $inputName . $definition . (isset($column['style']) ? ' style="' . $column['style'] . '"' : '').' >';
105
+
106
+ foreach ($options as $item) {
107
+ $value = $item['value'];
108
+ if(is_array($value))
109
+ {
110
+ $value = array_pop($value);
111
+ $value = $value['value'];
112
+ }
113
+ $rendered .= '<option value="' . $value . '">' . $item['label'] . '</option>';
114
+ }
115
+
116
+ $rendered .= '</select>';
117
+
118
+ return $rendered;
119
+ }
120
+
121
+ /**
122
+ * @return Payone_Core_Model_Factory
123
+ */
124
+ public function getFactory()
125
+ {
126
+ if (null === $this->factory) {
127
+ $this->factory = new Payone_Core_Model_Factory();
128
+ }
129
+ return $this->factory;
130
+ }
131
+
132
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/Forwarding.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Field_Forwarding
34
+ extends Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ protected function _prepareToRender()
40
+ {
41
+ $this->addColumn('txactions', array(
42
+ 'label' => Mage::helper('payone_core')->__('Status'),
43
+ 'style' => 'width:175px; height:100px;',
44
+ ));
45
+
46
+ $this->addColumn('url', array(
47
+ 'label' => Mage::helper('payone_core')->__('URL'),
48
+ 'style' => 'width:250px',
49
+ ));
50
+
51
+ $this->addColumn('timeout', array(
52
+ 'label' => Mage::helper('payone_core')->__('Timeout'),
53
+ 'style' => 'width:50px;',
54
+ ));
55
+ $this->_addAfter = false;
56
+ $this->_addButtonLabel = Mage::helper('payone_core')->__('Add');
57
+ parent::_prepareToRender();
58
+ }
59
+
60
+ /**
61
+ * @param $columnName
62
+ * @return string
63
+ * @throws Exception
64
+ */
65
+ protected function _renderCellTemplate($columnName)
66
+ {
67
+ if ($columnName == 'txactions') {
68
+ $selectType = Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract::PAYONE_CORE_FIELD_MULTISELECT;
69
+
70
+ $modelConfigCode = $this->getFactory()->getModelSystemConfigTransactionStatus();
71
+ $options = $modelConfigCode->toOptionArray();
72
+
73
+ $rendered = $this->prepareCellTemplate($columnName,$selectType,$options);
74
+ }
75
+ else
76
+ {
77
+ return parent::_renderCellTemplate($columnName);
78
+ }
79
+
80
+ return $rendered;
81
+ }
82
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/Info.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Field_Info
34
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
35
+ {
36
+ /**
37
+ * Render element html
38
+ *
39
+ * @param Varien_Data_Form_Element_Abstract $element
40
+ * @return string
41
+ */
42
+ public function render(Varien_Data_Form_Element_Abstract $element)
43
+ {
44
+ $hint = (array)$element->getFieldConfig()->hint;
45
+ if (!count($hint)) {
46
+ return $this->getHtmlTable($element);
47
+ }
48
+
49
+ // Generate Tooltip
50
+ /** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
51
+ $tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
52
+ $tooltip->initFormElement($element);
53
+ $tooltip->setHintText($this->getHintText());
54
+ $tooltipHtml = $tooltip->toHtml();
55
+
56
+ $html = sprintf('<tr id="row_%s">', $element->getHtmlId());
57
+ $html .= '<td class="" colspan="3">';
58
+ $html .= '<table class="payone-config-info"><tr><td>' . $tooltipHtml .' </td></tr></table>';
59
+ $html .= '</td>';
60
+ $html .= '</tr>';
61
+
62
+ return $html;
63
+ }
64
+
65
+ protected function getHintText()
66
+ {
67
+ $text = $this->helper('payone_core')
68
+ ->__('Klicken Sie hier um weitere Informationen zu diesem Bereich zu erhalten');
69
+ return $text;
70
+ }
71
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/PaymentFee.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Field_PaymentFee
34
+ extends Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ protected function _prepareToRender()
40
+ {
41
+ $this->addColumn('shipping_method', array(
42
+ 'label' => Mage::helper('payone_core')->__('Shipping Method'),
43
+ 'style' => 'min-width:120px;',
44
+ ));
45
+
46
+ $this->addColumn('countries', array(
47
+ 'label' => Mage::helper('payone_core')->__('Countries'),
48
+ 'style' => 'min-width:120px; min-height: 150px;',
49
+ ));
50
+
51
+ $this->addColumn('fee_config', array(
52
+ 'label' => Mage::helper('payone_core')->__('Fee'),
53
+ 'style' => 'width:120px;',
54
+ ));
55
+ $this->_addAfter = false;
56
+ $this->_addButtonLabel = Mage::helper('payone_core')->__('Add');
57
+ parent::_prepareToRender();
58
+ }
59
+
60
+ /**
61
+ * @param $columnName
62
+ * @return string
63
+ * @throws Exception
64
+ */
65
+ protected function _renderCellTemplate($columnName)
66
+ {
67
+ if ($columnName == 'countries')
68
+ {
69
+ $selectType = Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract::PAYONE_CORE_FIELD_MULTISELECT;
70
+ $modelConfigCode = $this->getFactory()->getModelSystemConfigCountryFull();
71
+ }
72
+ elseif ($columnName == 'shipping_method')
73
+ {
74
+ $selectType = Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract::PAYONE_CORE_FIELD_SELECT;
75
+ $modelConfigCode = $this->getFactory()->getModelSystemConfigShippingMethod();
76
+ }
77
+ else
78
+ {
79
+ return parent::_renderCellTemplate($columnName);
80
+ }
81
+
82
+ $options = $modelConfigCode->toOptionArray(true);
83
+
84
+ $rendered = $this->prepareCellTemplate($columnName,$selectType,$options);
85
+
86
+ return $rendered;
87
+ }
88
+
89
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/PersonStatusMapping.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Field_PersonStatusMapping
34
+ extends Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ protected function _prepareToRender()
40
+ {
41
+ $this->addColumn('personstatus', array(
42
+ 'label' => Mage::helper('payone_core')->__('Personstatus'),
43
+ 'style' => 'width:120px',
44
+ ));
45
+
46
+ $this->addColumn('score', array(
47
+ 'label' => Mage::helper('payone_core')->__('Score'),
48
+ 'style' => 'width:120px;',
49
+ ));
50
+ $this->_addAfter = false;
51
+ $this->_addButtonLabel = Mage::helper('payone_core')->__('Add Personstatus Mapping');
52
+ parent::_prepareToRender();
53
+ }
54
+
55
+ /**
56
+ * @param $columnName
57
+ * @return string
58
+ * @throws Exception
59
+ */
60
+ protected function _renderCellTemplate($columnName)
61
+ {
62
+ $selectType = Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract::PAYONE_CORE_FIELD_SELECT;
63
+ if ($columnName == 'personstatus') {
64
+ $modelConfigCode = $this->getFactory()->getModelSystemConfigPersonStatus();
65
+ }
66
+ elseif ($columnName == 'score')
67
+ {
68
+ $modelConfigCode = $this->getFactory()->getModelSystemConfigCreditScore();
69
+ }
70
+
71
+ $options = $modelConfigCode->toOptionArray();
72
+ $rendered = $this->prepareCellTemplate($columnName,$selectType,$options);
73
+
74
+ return $rendered;
75
+ }
76
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Field/StatusMapping.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Field_StatusMapping
34
+ extends Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ protected function _prepareToRender()
40
+ {
41
+ $this->addColumn('txaction', array(
42
+ 'label' => Mage::helper('payone_core')->__('Transactionstatus-Message'),
43
+ 'style' => 'width:150px',
44
+ ));
45
+
46
+ $this->addColumn('status', array(
47
+ 'label' => Mage::helper('payone_core')->__('Magento-Status'),
48
+ 'style' => 'width:120px;',
49
+ ));
50
+ $this->_addAfter = false;
51
+ $this->_addButtonLabel = Mage::helper('payone_core')->__('Add Statusmapping');
52
+ parent::_prepareToRender();
53
+ }
54
+
55
+ /**
56
+ * @param $columnName
57
+ * @return string
58
+ * @throws Exception
59
+ */
60
+ protected function _renderCellTemplate($columnName)
61
+ {
62
+ $selectType = Payone_Core_Block_Adminhtml_System_Config_Form_Field_Abstract::PAYONE_CORE_FIELD_SELECT;
63
+
64
+ if ($columnName == 'txaction')
65
+ {
66
+ $modelConfigCode = $this->getFactory()->getModelSystemConfigTransactionStatus();
67
+ }
68
+ elseif ($columnName == 'status')
69
+ {
70
+ $modelConfigCode = $this->getFactory()->getModelSystemConfigOrderStatus();
71
+ }
72
+
73
+ $options = $modelConfigCode->toOptionArray();
74
+
75
+ $rendered = $this->prepareCellTemplate($columnName, $selectType, $options);
76
+
77
+ return $rendered;
78
+ }
79
+
80
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Payment extends Mage_Adminhtml_Block_Abstract
34
+ {
35
+ public function _construct()
36
+ {
37
+ $this->setData('template', 'payone/core/system/config/form/iframe.phtml');
38
+ parent::_construct();
39
+ }
40
+
41
+
42
+ public function setParentBlock(Mage_Core_Block_Abstract $block)
43
+ {
44
+ $block->unsetChild('save_button');
45
+ return parent::setParentBlock($block);
46
+ }
47
+
48
+ /**
49
+ * only needed to implement required interface from Adminhtml_System_Config_Edit::initForm for frontend_model
50
+ *
51
+ * @return Payone_Core_Block_Adminhtml_System_Config_Form_Payment
52
+ */
53
+ public function initForm()
54
+ {
55
+ return $this;
56
+ }
57
+
58
+ public function getSourceUrl()
59
+ {
60
+ $url = $this->getUrl('payone_core/adminhtml_system_config_payment/', array('_current' => true));
61
+ return $url;
62
+ }
63
+
64
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment/Method.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Form_Payment_Method
34
+ extends Mage_Adminhtml_Block_System_Config_Form
35
+ {
36
+ const SECTION_PAYONE_PAYMENT = 'payone_payment';
37
+ const GROUP_TEMPLATE_PREFIX = 'template_';
38
+ const GROUP_TEMPLATE_DEFAULT = 'default';
39
+
40
+ /**
41
+ * @var string
42
+ */
43
+ protected $_methodType = '';
44
+
45
+ /**
46
+ *
47
+ * @return Mage_Adminhtml_Block_System_Config_Form
48
+ */
49
+ protected function _initObjects()
50
+ {
51
+ /** @var $_configRoot Mage_Core_Model_Config_Element */
52
+ $this->_configRoot = Mage::getConfig()->getNode(null, $this->getScope(), $this->getScopeCode());
53
+
54
+ $this->_configDataObject = Mage::getModel('adminhtml/config_data')
55
+ ->setSection($this->getSectionCode())
56
+ ->setWebsite($this->getWebsiteCode())
57
+ ->setStore($this->getStoreCode());
58
+
59
+ $this->_configData = $this->_configDataObject->load();
60
+
61
+ /** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
62
+ $model = Mage::registry('payone_core_config_payment_method');
63
+
64
+ $rootModel = $model->getParentModel();
65
+ if ($rootModel) {
66
+ foreach ($rootModel->getData() as $key => $value) {
67
+ if (isset($value)) {
68
+ $path = self::SECTION_PAYONE_PAYMENT . '/' . self::GROUP_TEMPLATE_PREFIX . $this->getMethodType() . '/' . $key;
69
+ $this->_configRoot->setNode($path, $value, true);
70
+ }
71
+ }
72
+ }
73
+
74
+ $this->_configData = $model->initConfigObject($this->getMethodType(), $this->getScope());
75
+
76
+ $this->_configFields = Mage::getSingleton('adminhtml/config');
77
+
78
+ $this->_defaultFieldsetRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_fieldset');
79
+ $this->_defaultFieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * @return Varien_Data_Form
85
+ */
86
+ protected function _initForm()
87
+ {
88
+ $form = new Varien_Data_Form(
89
+ array(
90
+ 'id' => 'edit_form',
91
+ 'action' => $this->getUrl(
92
+ '*/*/save',
93
+ array(
94
+ 'id' => $this->getRequest()->getParam('id'),
95
+ '_current' => true
96
+ )
97
+ ),
98
+ 'method' => 'post',
99
+ 'enctype' => 'multipart/form-data'
100
+ )
101
+ );
102
+ return $form;
103
+ }
104
+
105
+ /**
106
+ *
107
+ * @return Mage_Adminhtml_Block_System_Config_Form
108
+ */
109
+ public function initForm()
110
+ {
111
+ $this->_initObjects();
112
+
113
+ $form = $this->_initForm();
114
+
115
+ /**
116
+ * @var $sections Mage_Core_Model_Config_Element
117
+ */
118
+ $sections = $this->_configFields->getSection(
119
+ self::SECTION_PAYONE_PAYMENT,
120
+ $this->getWebsiteCode(),
121
+ $this->getStoreCode()
122
+ );
123
+ $groups = $sections->groups;
124
+
125
+ $groupName = self::GROUP_TEMPLATE_PREFIX . $this->getMethodType();
126
+ $group = $groups->$groupName;
127
+
128
+ $groupNameDefault = self::GROUP_TEMPLATE_PREFIX . self::GROUP_TEMPLATE_DEFAULT;
129
+ $groupDefault = $groups->$groupNameDefault;
130
+
131
+ /**
132
+ * @var $fieldsetRenderer Mage_Adminhtml_Block_System_Config_Form_Fieldset
133
+ */
134
+ if ($group->frontend_model) {
135
+ $fieldsetRenderer = Mage::getBlockSingleton((string)$group->frontend_model);
136
+ }
137
+ else {
138
+ $fieldsetRenderer = $this->_defaultFieldsetRenderer;
139
+ }
140
+
141
+ $fieldsetConfig = array(
142
+ 'legend' => Mage::helper('payone_core')->__((string)$group->label),
143
+ 'expanded' => true,
144
+ );
145
+ if (!empty($group->comment)) {
146
+ $fieldsetConfig['comment'] = Mage::helper('payone_core')->__((string)$group->comment);
147
+ }
148
+ if (!empty($group->expanded)) {
149
+ $fieldsetConfig['expanded'] = (bool)$group->expanded;
150
+ }
151
+
152
+ $fieldset = $form->addFieldset($sections->getName() . '_' . $group->getName(), $fieldsetConfig);
153
+ $fieldset->setRenderer($fieldsetRenderer);
154
+
155
+ $fieldsetRenderer->setForm($this);
156
+ $fieldsetRenderer->setConfigData($this->_configData);
157
+ $fieldsetRenderer->setGroup($group);
158
+
159
+ $this->_prepareFieldOriginalData($fieldset, $group);
160
+ $this->_addElementTypes($fieldset);
161
+
162
+
163
+ foreach ($groupDefault->fields as $elements) {
164
+ foreach ($elements as $e) {
165
+ $group->fields->appendChild($e);
166
+ }
167
+ }
168
+
169
+ $this->initFields($fieldset, $group, $sections);
170
+
171
+ $form->setUseContainer(true);
172
+ $this->setForm($form);
173
+ return $this;
174
+ }
175
+
176
+ /**
177
+ * @param string $methodType
178
+ */
179
+ public function setMethodType($methodType)
180
+ {
181
+ $this->_methodType = $methodType;
182
+ }
183
+
184
+ /**
185
+ * @return string
186
+ */
187
+ public function getMethodType()
188
+ {
189
+ return $this->_methodType;
190
+ }
191
+
192
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Hint.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Hint
34
+ extends Mage_Adminhtml_Block_Abstract
35
+ implements Varien_Data_Form_Element_Renderer_Interface
36
+ {
37
+ /**
38
+ * @var Mage_Core_Model_Config_Element
39
+ */
40
+ protected $configGroup = null;
41
+ /**
42
+ * @var Varien_Data_Form_Element_Abstract
43
+ */
44
+ protected $element = null;
45
+
46
+ /**
47
+ * Render fieldset html
48
+ *
49
+ * @param Varien_Data_Form_Element_Abstract $element
50
+ * @return string
51
+ */
52
+ public function render(Varien_Data_Form_Element_Abstract $element)
53
+ {
54
+ $this->element = $element;
55
+
56
+ return $this->getHintHtml();
57
+ }
58
+
59
+ public function getHintHtml()
60
+ {
61
+ $html = '';
62
+ $hintElement = $this->getHintElement();
63
+
64
+ if ($hintElement instanceof Mage_Core_Model_Config_Element) {
65
+ /** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
66
+ $tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
67
+ $tooltip->initByHintElement($hintElement);
68
+ $tooltip->setHintText($this->getHintText());
69
+ $tooltipHtml = $tooltip->toHtml();
70
+
71
+ $html .= '<table class="payone-config-info"><tr><td>' . $tooltipHtml . '</td></tr></table>';
72
+ }
73
+
74
+ return $html;
75
+ }
76
+
77
+ protected function getHintText()
78
+ {
79
+ $text = $this->helper('payone_core')
80
+ ->__('Klicken Sie hier um weitere Informationen zu diesem Bereich zu erhalten');
81
+ return $text;
82
+ }
83
+
84
+ protected function getHintElement()
85
+ {
86
+ if ($this->configGroup === null) {
87
+ $this->initConfigGroup();
88
+ }
89
+ return $this->configGroup->hint;
90
+ }
91
+
92
+ protected function initConfigGroup()
93
+ {
94
+ $this->configGroup = $this->getGroup();
95
+
96
+ if ($this->configGroup === null) {
97
+ $elementGroup = $this->element->getGroup();
98
+ $this->configGroup = $elementGroup;
99
+ }
100
+ }
101
+
102
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Notice.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Notice
34
+ extends Mage_Adminhtml_Block_Abstract
35
+ implements Varien_Data_Form_Element_Renderer_Interface
36
+ {
37
+ /**
38
+ * @var Mage_Core_Model_Config_Element
39
+ */
40
+ protected $configGroup = null;
41
+ /**
42
+ * @var Varien_Data_Form_Element_Abstract
43
+ */
44
+ protected $element = null;
45
+
46
+ /**
47
+ * Render fieldset html
48
+ *
49
+ * @param Varien_Data_Form_Element_Abstract $element
50
+ * @return string
51
+ */
52
+ public function render(Varien_Data_Form_Element_Abstract $element)
53
+ {
54
+ $this->element = $element;
55
+
56
+ if ($this->getTemplate() == null) {
57
+ $this->initTemplate();
58
+ }
59
+
60
+ $html = '';
61
+ if ($this->getTemplate() != '') {
62
+ $html = $this->toHtml();
63
+ }
64
+ return $html;
65
+ }
66
+
67
+ protected function initTemplate()
68
+ {
69
+ $hintElement = $this->getHintElement();
70
+
71
+ $template = '';
72
+ if ($hintElement instanceof Mage_Core_Model_Config_Element) {
73
+ /** @var $hintElement Mage_Core_Model_Config_Element */
74
+ $template = (string)$hintElement->template;
75
+ }
76
+ if ($template != '') {
77
+ $this->setTemplate($template);
78
+ }
79
+ }
80
+
81
+ protected function getHintElement()
82
+ {
83
+ if ($this->configGroup === null) {
84
+ $this->initConfigGroup();
85
+ }
86
+ return $this->configGroup->hint;
87
+ }
88
+
89
+ protected function initConfigGroup()
90
+ {
91
+ $this->configGroup = $this->getGroup();
92
+
93
+ if ($this->configGroup === null) {
94
+ $elementGroup = $this->element->getGroup();
95
+ $this->configGroup = $elementGroup;
96
+ }
97
+ }
98
+
99
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Payment extends Mage_Adminhtml_Block_Widget_Grid_Container
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ $this->_blockGroup = 'payone_core';
41
+ $this->_controller = 'adminhtml_system_config_payment';
42
+ $this->_headerText = $this->helperPayone()->__('');
43
+ $this->_addButtonLabel = $this->helperPayone()->__('Add Payment');
44
+ parent::__construct();
45
+ $this->_removeButton('add');
46
+
47
+ $showButtons = Mage::registry('show_new_payment_buttons');
48
+ if ($showButtons) {
49
+ $methodTypes = $this->getFactory()->getModelSystemConfigPaymentMethodType()->toArray();
50
+ foreach ($methodTypes as $key => $name) {
51
+ $this->_addNewMethodButton($key, $name);
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * @return string
58
+ */
59
+ public function getHintHtml()
60
+ {
61
+ /** @var $config Mage_Adminhtml_Model_Config */
62
+ $config = Mage::getSingleton('adminhtml/config');
63
+ $configSection = $config->getSection('payone_payment');
64
+ $hintGroup = $configSection->groups->hint;
65
+
66
+ /** @var $hint Payone_Core_Block_Adminhtml_System_Config_Hint */
67
+ $hint = Mage::getBlockSingleton('payone_core/adminhtml_system_config_hint');
68
+ $hint->setGroup($hintGroup);
69
+ $html = $hint->getHintHtml();
70
+ return $html;
71
+ }
72
+
73
+ /**
74
+ * @param $type
75
+ * @param $name
76
+ */
77
+ public function _addNewMethodButton($type, $name)
78
+ {
79
+ $this->_addButton('new_' . $type, array(
80
+ 'label' => $this->helperPayone()->__('New ' . $name),
81
+ 'onclick' => 'setLocation(\'' . $this->getNewUrl(array('type' => $type)) . '\')',
82
+ 'class' => 'add',
83
+ ));
84
+ }
85
+
86
+ /**
87
+ * @param array $params
88
+ * @return string
89
+ */
90
+ public function getNewUrl(array $params = array())
91
+ {
92
+ $params = array_merge($params, array('_current' => true, 'id' => ''));
93
+ return $this->getUrl('*/*/new', $params);
94
+ }
95
+
96
+ /**
97
+ *
98
+ * @return Payone_Core_Helper_Data
99
+ */
100
+ protected function helperPayone()
101
+ {
102
+ return Mage::helper('payone_core');
103
+ }
104
+
105
+ /**
106
+ * @return Payone_Core_Model_Factory
107
+ */
108
+ public function getFactory()
109
+ {
110
+ return $this->helperPayone()->getFactory();
111
+ }
112
+
113
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Edit.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Payment_Edit
34
+ extends Mage_Adminhtml_Block_Widget_Form_Container
35
+ {
36
+ /** @var Payone_Core_Model_Factory */
37
+ protected $factory = null;
38
+
39
+ /**
40
+ *
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+
46
+ $this->_objectId = 'id';
47
+ $this->_blockGroup = '';
48
+ $this->_controller = 'adminhtml_system_config_payment';
49
+
50
+ $this->_updateButton('save', 'label', Mage::helper('payone_core')->__('Save'));
51
+ $this->_updateButton('delete', 'label', Mage::helper('payone_core')->__('Delete'));
52
+
53
+ $this->setData('edit_form_id', 'edit_form_payment_method');
54
+ }
55
+
56
+ protected function _prepareLayout()
57
+ {
58
+ $type = $this->getPaymentMethodType();
59
+
60
+ $blockClass = 'payone_core/adminhtml_system_config_form_payment_method';
61
+
62
+ /**
63
+ * @var $block Payone_Core_Block_Adminhtml_System_Config_Form_Payment_Method
64
+ */
65
+ $block = $this->getLayout()->createBlock($blockClass);
66
+ if ($block) {
67
+ $block->setMethodType($type);
68
+ $block->initForm();
69
+
70
+ $this->setChild('form', $block);
71
+ }
72
+
73
+ return parent::_prepareLayout();
74
+ }
75
+
76
+ /**
77
+ * @return string
78
+ */
79
+ public function getHeaderText()
80
+ {
81
+ $type = $this->getPaymentMethodType();
82
+ $method = uc_words($type, ' ');
83
+ $headerText = 'Add ';
84
+ if ($this->getRequest()->getParam('id')) {
85
+ $headerText = 'Edit ';
86
+ }
87
+ $headerText .= $method;
88
+ return $this->helperPayone()->__($headerText);
89
+ }
90
+
91
+ /**
92
+ * Get URL for back (reset) button
93
+ *
94
+ * @return string
95
+ */
96
+ public function getBackUrl()
97
+ {
98
+ return $this->getUrl('*/*/', array('_current' => true));
99
+ }
100
+
101
+ public function getDeleteUrl()
102
+ {
103
+ $id = $this->getRequest()->getParam('id');
104
+ return $this->getUrl('*/*/delete', array('_current' => true, 'id' => $id));
105
+ }
106
+
107
+ /**
108
+ * @return string
109
+ * @throws Payone_Core_Exception_PaymentTypeNotFound
110
+ */
111
+ protected function getPaymentMethodType()
112
+ {
113
+ $id = $this->getRequest()->getParam('id');
114
+
115
+ $model = $this->getFactory()->getModelDomainConfigPaymentMethod();
116
+ $model->load($id);
117
+
118
+ $type = $model->getCode();
119
+
120
+ if ($type == '') {
121
+ $type = $this->getRequest()->getParam('type');
122
+ if ($type == '') {
123
+ throw new Payone_Core_Exception_PaymentTypeNotFound();
124
+ }
125
+ }
126
+ return $type;
127
+ }
128
+
129
+ /**
130
+ * @param Payone_Core_Model_Factory $factory
131
+ */
132
+ public function setFactory(Payone_Core_Model_Factory $factory)
133
+ {
134
+ $this->factory = $factory;
135
+ }
136
+
137
+ /**
138
+ * @return Payone_Core_Model_Factory
139
+ */
140
+ public function getFactory()
141
+ {
142
+ if ($this->factory === null) {
143
+ $this->factory = new Payone_Core_Model_Factory();
144
+ }
145
+ return $this->factory;
146
+ }
147
+
148
+ /**
149
+ * @return Payone_Core_Helper_Data
150
+ */
151
+ public function helperPayone()
152
+ {
153
+ return $this->getFactory()->helper();
154
+ }
155
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Grid.php ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Payment_Grid extends Mage_Adminhtml_Block_Widget_Grid
34
+ {
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('payone_core_system_config_payment_grid');
43
+ $this->setSaveParametersInSession(true);
44
+ // Enable Ajax
45
+ $this->setUseAjax(true);
46
+
47
+ $this->setPagerVisibility(false);
48
+ // $this->setHeadersVisibility(false);
49
+ $this->setMessageBlockVisibility(false);
50
+ $this->setFilterVisibility(false);
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @return $this
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ /** @var $collection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
60
+ $collection = $this->getConfigPaymentCollection();
61
+ $this->setCollection($collection);
62
+
63
+ return parent::_prepareCollection();
64
+ }
65
+
66
+ /**
67
+ * @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
68
+ */
69
+ protected function getConfigPaymentCollection()
70
+ {
71
+ if (!Mage::registry('payone_core_adminhtml_system_config_payment_collection')) {
72
+ /** @var $store Mage_Core_Model_Store */
73
+ $storeCode = $this->getRequest()->getParam('store');
74
+ $store = $this->getPayoneFactory()->getModelCoreStore();
75
+ $store->load($storeCode, 'code');
76
+
77
+ /** @var $methodConfigCollection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
78
+ $methodConfigCollection = $this->getPayoneFactory()->getModelDomainConfigPaymentMethod()->getCollection();
79
+ $methodConfigCollection->filterExcludeDeleted();
80
+ if (!$storeCode) {
81
+ $methodConfigCollection->filterExcludeStoresScope();
82
+ }
83
+ $methodConfigCollection->addSortOrder('id');
84
+ $methodConfigCollection->getCollectionByStoreId($store->getId(), true);
85
+
86
+ Mage::register('payone_core_adminhtml_system_config_payment_collection', $methodConfigCollection);
87
+ }
88
+ return Mage::registry('payone_core_adminhtml_system_config_payment_collection');
89
+ }
90
+
91
+ /**
92
+ *
93
+ * @return Mage_Adminhtml_Block_Widget_Grid
94
+ */
95
+ protected function _prepareColumns()
96
+ {
97
+ $this->addColumn(
98
+ 'sort_order',
99
+ array(
100
+ 'header' => $this->helperPayoneCore()->__('Sort order'),
101
+ 'align' => 'center',
102
+ 'width' => '20px',
103
+ 'index' => 'sort_order',
104
+ 'filter' => false,
105
+ 'sortable' => false
106
+ )
107
+ );
108
+
109
+ $this->addColumn(
110
+ 'name',
111
+ array(
112
+ 'header' => $this->helperPayoneCore()->__('Name'),
113
+ 'align' => 'left',
114
+ 'index' => 'name',
115
+ 'filter' => false,
116
+ 'sortable' => false,
117
+ )
118
+ );
119
+
120
+ $this->addColumn(
121
+ 'type',
122
+ array(
123
+ 'header' => $this->helperPayoneCore()->__('Type'),
124
+ 'align' => 'left',
125
+ 'index' => 'code',
126
+ 'filter' => false,
127
+ 'sortable' => false,
128
+ )
129
+ );
130
+
131
+ $this->addColumn(
132
+ 'scope',
133
+ array(
134
+ 'header' => $this->helperPayoneCore()->__('Scope'),
135
+ 'align' => 'left',
136
+ 'index' => 'scope',
137
+ 'filter' => false,
138
+ 'sortable' => false,
139
+ )
140
+ );
141
+
142
+ $this->addColumn(
143
+ 'enabled',
144
+ array(
145
+ 'header' => $this->helperPayoneCore()->__('Enabled'),
146
+ 'align' => 'left',
147
+ 'width' => '80px',
148
+ 'index' => 'enabled',
149
+ 'type' => 'options',
150
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigStatus()->toSelectArray(),
151
+ 'filter' => false,
152
+ 'sortable' => false,
153
+ )
154
+ );
155
+
156
+ $this->addColumn(
157
+ 'created_at',
158
+ array(
159
+ 'header' => $this->helperPayoneCore()->__('Created At'),
160
+ 'index' => 'created_at',
161
+ 'type' => 'datetime',
162
+ 'width' => '50px',
163
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
164
+ 'filter' => false,
165
+ 'sortable' => false,
166
+ )
167
+ );
168
+
169
+ $this->addColumn(
170
+ 'updated_at',
171
+ array(
172
+ 'header' => $this->helperPayoneCore()->__('Updated At'),
173
+ 'index' => 'updated_at',
174
+ 'type' => 'datetime',
175
+ 'width' => '50px',
176
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
177
+ 'filter' => false,
178
+ 'sortable' => false,
179
+ )
180
+ );
181
+
182
+ $this->addColumn(
183
+ 'id',
184
+ array(
185
+ 'header' => $this->helperPayoneCore()->__('ID'),
186
+ 'align' => 'right',
187
+ 'width' => '5px',
188
+ 'index' => 'id',
189
+ 'filter' => false,
190
+ 'sortable' => false,
191
+ )
192
+ );
193
+
194
+ $this->addColumn(
195
+ 'action',
196
+
197
+ array(
198
+ 'header' => $this->helperPayoneCore()->__('Action'),
199
+ 'width' => '100',
200
+ 'type' => 'action',
201
+ 'getter' => 'getId',
202
+ 'actions' => array(
203
+ array(
204
+ 'field' => 'id',
205
+ 'caption' => $this->helperPayoneCore()->__('Edit'),
206
+ 'url' => array(
207
+ 'base' => '*/*/edit',
208
+ 'params' => array(
209
+ '_current' => true,
210
+ 'type' => ''),
211
+
212
+ ),
213
+ )
214
+ ),
215
+ 'filter' => false,
216
+ 'sortable' => false,
217
+ 'index' => 'stores',
218
+ 'is_system' => true,
219
+ )
220
+ );
221
+
222
+ return parent::_prepareColumns();
223
+ }
224
+
225
+ public function getRowUrl($row)
226
+ {
227
+ return $this->getUrl(
228
+ '*/*/edit',
229
+ array(
230
+ '_current' => true,
231
+ 'id' => $row->getId(),
232
+ 'type' => $row->getCode()
233
+ )
234
+ );
235
+ }
236
+
237
+ public function getGridUrl()
238
+ {
239
+ return $this->getUrl(
240
+ '*/*/grid',
241
+ array(
242
+ '_current' => true
243
+ )
244
+ );
245
+ }
246
+
247
+ /**
248
+ *
249
+ * @return Payone_Core_Helper_Data
250
+ */
251
+ protected function helperPayoneCore()
252
+ {
253
+ return Mage::helper('payone_core');
254
+ }
255
+
256
+ /**
257
+ * @return Payone_Core_Model_Factory
258
+ */
259
+ public function getPayoneFactory()
260
+ {
261
+ return $this->helperPayoneCore()->getFactory();
262
+ }
263
+ }
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Tooltip.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_System_Config_Tooltip extends Mage_Adminhtml_Block_Template
34
+ {
35
+ const DEFAULT_BLOCK_CLASS = 'adminhtml/template';
36
+ /**
37
+ * @var Varien_Data_Form_Element_Abstract
38
+ */
39
+ protected $element = null;
40
+ /**
41
+ * @var Mage_Core_Model_Config_Element
42
+ */
43
+ protected $fieldConfig = null;
44
+
45
+ protected $label = null;
46
+ protected $block = null;
47
+ protected $blockTemplate = null;
48
+
49
+ public function _construct()
50
+ {
51
+ $this->setData('template', 'payone/core/system/config/tooltip.phtml');
52
+ parent::_construct();
53
+ }
54
+
55
+ public function getTitle()
56
+ {
57
+ return $this->label;
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ public function getHintHtml()
64
+ {
65
+ $hintHtml = null;
66
+ if ($this->block != '' or $this->blockTemplate != '') {
67
+ $hintHtml = $this->renderBlock();
68
+ }
69
+
70
+ if ($hintHtml === null) {
71
+ $hintHtml = $this->getHint();
72
+ }
73
+
74
+ return $hintHtml;
75
+ }
76
+
77
+ protected function renderBlock()
78
+ {
79
+ $hintHtml = '';
80
+ $block = $this->block;
81
+ $template = $this->blockTemplate;
82
+ if ($block == '') {
83
+ $block = self::DEFAULT_BLOCK_CLASS;
84
+ }
85
+ $hintBlock = $this->getLayout()->createBlock($block);
86
+ if ($hintBlock != null) {
87
+ $hintBlock->setParentBlock($this);
88
+ if ($template != '') {
89
+ $hintBlock->setTemplate($template);
90
+ }
91
+ if (is_callable(array($hintBlock, 'toHtml'))) {
92
+ $hintHtml = $hintBlock->toHtml();
93
+ }
94
+ }
95
+
96
+ return $hintHtml;
97
+ }
98
+
99
+ public function initFormElement(Varien_Data_Form_Element_Abstract $element)
100
+ {
101
+ $this->setElement($element);
102
+
103
+ /** @var $fieldConfig Mage_Core_Model_Config_Element */
104
+ $fieldConfig = $element->getFieldConfig();
105
+ $this->setFieldConfig($fieldConfig);
106
+
107
+ /** @var $hint string */
108
+ $hint = $element->getHint();
109
+ $this->setHint($hint);
110
+
111
+ // Init
112
+ $this->label = $element->getLabel();
113
+
114
+ if ($fieldConfig != null) {
115
+ $hintElement = $fieldConfig->hint;
116
+ if ($hintElement instanceof Mage_Core_Model_Config_Element) {
117
+ $this->initByHintElement($hintElement);
118
+ }
119
+ }
120
+ }
121
+
122
+ public function initByHintElement(Mage_Core_Model_Config_Element $hintElement)
123
+ {
124
+ /** @var $hintElement Mage_Core_Model_Config_Element */
125
+ $this->block = (string)$hintElement->block;
126
+ $this->blockTemplate = (string)$hintElement->template;
127
+ }
128
+
129
+ public function getChildHintHtml($template)
130
+ {
131
+ $result = null;
132
+ $templateFile = Mage::getDesign()->getTemplateFilename($template);
133
+ if(file_exists($templateFile))
134
+ {
135
+ $block = $this->getLayout()->createBlock(self::DEFAULT_BLOCK_CLASS);
136
+ $block->setParentBlock($this);
137
+ $block->setTemplate($template);
138
+ $result = $block->toHtml();
139
+ }
140
+ return $result;
141
+ }
142
+
143
+ /**
144
+ * @param string $hint
145
+ */
146
+ public function setHint($hint)
147
+ {
148
+ $this->setData('hint', $hint);
149
+ }
150
+
151
+ /**
152
+ * @return string
153
+ */
154
+ public function getHint()
155
+ {
156
+ return $this->getData('hint');
157
+ }
158
+
159
+ /**
160
+ * @param string $hint
161
+ */
162
+ public function setHintText($hint)
163
+ {
164
+ $this->setData('hint_text', $hint);
165
+ }
166
+
167
+ /**
168
+ * @return string
169
+ */
170
+ public function getHintText()
171
+ {
172
+ return $this->getData('hint_text');
173
+ }
174
+
175
+ /**
176
+ * @param Varien_Data_Form_Element_Abstract $element
177
+ */
178
+ public function setElement(Varien_Data_Form_Element_Abstract $element)
179
+ {
180
+ $this->element = $element;
181
+ }
182
+
183
+ /**
184
+ * @return Varien_Data_Form_Element_Abstract
185
+ */
186
+ public function getElement()
187
+ {
188
+ return $this->element;
189
+ }
190
+
191
+ /**
192
+ * @param Mage_Core_Model_Config_Element $fieldConfig
193
+ */
194
+ public function setFieldConfig($fieldConfig)
195
+ {
196
+ $this->fieldConfig = $fieldConfig;
197
+ }
198
+
199
+ /**
200
+ * @return Mage_Core_Model_Config_Element
201
+ */
202
+ public function getFieldConfig()
203
+ {
204
+ return $this->fieldConfig;
205
+ }
206
+ }
app/code/community/Payone/Core/Block/Adminhtml/Transaction.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Transaction extends Payone_Core_Block_Adminhtml_Widget_Grid_Container
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ $this->_blockGroup = 'payone_core';
41
+ $this->_controller = 'adminhtml_transaction';
42
+ $this->_headerText = Mage::helper('payone_core')->__('Transactions');
43
+
44
+ parent::__construct();
45
+ $this->removeButton('add');
46
+ }
47
+
48
+ }
app/code/community/Payone/Core/Block/Adminhtml/Transaction/Grid.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Transaction
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Transaction
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Transaction_Grid extends Mage_Adminhtml_Block_Widget_Grid
34
+ {
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('transaction_grid');
43
+ $this->setUseAjax(true);
44
+ $this->setDefaultSort('created_at');
45
+ $this->setDefaultDir('DESC');
46
+ $this->setSaveParametersInSession(true);
47
+ }
48
+
49
+ /**
50
+ * @return Mage_Adminhtml_Block_Widget_Grid
51
+ */
52
+ protected function _prepareCollection()
53
+ {
54
+ /**
55
+ * @var Payone_Core_Model_Domain_Resource_Transaction_Collection $collection
56
+ */
57
+ $collection = Mage::getModel('payone_core/domain_transaction')->getCollection();
58
+
59
+ $this->setCollection($collection);
60
+ return parent::_prepareCollection();
61
+ }
62
+
63
+ /**
64
+ * @return Mage_Adminhtml_Block_Widget_Grid
65
+ */
66
+ protected function _prepareColumns()
67
+ {
68
+ $this->addColumn(
69
+ 'id',
70
+ array(
71
+ 'header' => $this->helperPayone()->__('ID'),
72
+ 'width' => '5px',
73
+ 'type' => 'text',
74
+ 'index' => 'id',
75
+ 'filter' => false,
76
+ ));
77
+
78
+ $this->addColumn(
79
+ 'txid',
80
+ array(
81
+ 'header' => $this->helperPayone()->__('Txid'),
82
+ 'type' => 'text',
83
+ 'index' => 'txid',
84
+ ));
85
+
86
+ $this->addColumn(
87
+ 'reference',
88
+ array(
89
+ 'header' => $this->helperPayone()->__('Reference'),
90
+ 'type' => 'text',
91
+ 'index' => 'reference',
92
+ ));
93
+
94
+ $this->addColumn(
95
+ 'txaction',
96
+ array(
97
+ 'header' => $this->helperPayone()->__('Last Txaction'),
98
+ 'index' => 'last_txaction',
99
+ 'type' => 'options',
100
+ 'options' => $this->getFactory()->getModelSystemConfigStatusTransaction()->toSelectArray()
101
+ ));
102
+
103
+ $this->addColumn(
104
+ 'txtime',
105
+ array(
106
+ 'header' => $this->helperPayone()->__('Txtime'),
107
+ 'index' => 'txtime',
108
+ 'type' => 'datetime',
109
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_unixTimestamp',
110
+ ));
111
+
112
+ $this->addColumn(
113
+ 'clearingtype',
114
+ array(
115
+ 'header' => $this->helperPayone()->__('Clearingtype'),
116
+ 'index' => 'clearingtype',
117
+ 'type' => 'options',
118
+ 'options' => $this->getFactory()->getModelSystemConfigClearingType()->toSelectArray()
119
+ ));
120
+
121
+ $this->addColumn(
122
+ 'mode',
123
+ array(
124
+ 'header' => $this->helperPayone()->__('Mode'),
125
+ 'index' => 'mode',
126
+ 'type' => 'options',
127
+ 'options' => $this->getFactory()->getModelSystemConfigMode()->toSelectArray()
128
+ ));
129
+
130
+ $this->addColumn(
131
+ 'portalid',
132
+ array(
133
+ 'header' => $this->helperPayone()->__('Portal-ID'),
134
+ 'index' => 'portalid',
135
+ 'type' => 'text',
136
+ ));
137
+
138
+ $this->addColumn(
139
+ 'receivable',
140
+ array(
141
+ 'header' => $this->helperPayone()->__('Receivable'),
142
+ 'index' => 'receivable',
143
+ 'type' => 'text',
144
+ ));
145
+
146
+ $this->addColumn(
147
+ 'balance',
148
+ array(
149
+ 'header' => $this->helperPayone()->__('Balance'),
150
+ 'index' => 'balance',
151
+ 'type' => 'text',
152
+ ));
153
+
154
+ $this->addColumn(
155
+ 'created_at',
156
+ array(
157
+ 'header' => $this->helperPayone()->__('Created at'),
158
+ 'index' => 'created_at',
159
+ 'type' => 'datetime',
160
+ 'width' => '80px',
161
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
162
+ ));
163
+
164
+ $this->addColumn(
165
+ 'updated_at',
166
+ array(
167
+ 'header' => $this->helperPayone()->__('Updated at'),
168
+ 'index' => 'updated_at',
169
+ 'type' => 'datetime',
170
+ 'width' => '80px',
171
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
172
+ ));
173
+
174
+ if (Mage::getSingleton('admin/session')->isAllowed('payone/transaction/view')) {
175
+ $this->addColumn('action',
176
+ array(
177
+ 'header' => $this->helperPayone()->__('Action'),
178
+ 'width' => '50px',
179
+ 'type' => 'action',
180
+ 'getter' => 'getId',
181
+ 'actions' => array(
182
+ array(
183
+ 'caption' => $this->helperPayone()->__('View'),
184
+ 'url' => array('base' => '*/*/view'),
185
+ 'field' => 'id'
186
+ )
187
+ ),
188
+ 'filter' => false,
189
+ 'sortable' => false,
190
+ 'index' => 'stores',
191
+ 'is_system' => true,
192
+ ));
193
+ }
194
+
195
+ return parent::_prepareColumns();
196
+ }
197
+
198
+ /**
199
+ * @return string
200
+ */
201
+ public function getGridUrl()
202
+ {
203
+ return $this->getUrl('*/*/grid', array('_current' => true));
204
+ }
205
+
206
+ /**
207
+ * @param $row
208
+ * @return string
209
+ */
210
+ public function getRowUrl($row)
211
+ {
212
+ return $this->getUrl('*/*/view', array('id' => $row->getId()));
213
+ }
214
+
215
+ /**
216
+ *
217
+ * @return Payone_Core_Helper_Data
218
+ */
219
+ protected function helperPayone()
220
+ {
221
+ return Mage::helper('payone_core');
222
+ }
223
+
224
+ /**
225
+ * @return Payone_Core_Model_Factory
226
+ */
227
+ public function getFactory()
228
+ {
229
+ return $this->helperPayone()->getFactory();
230
+ }
231
+
232
+ }
app/code/community/Payone/Core/Block/Adminhtml/Transaction/View.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Transaction
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Transaction
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Transaction_View
34
+ extends Payone_Core_Block_Adminhtml_Widget_View_Container
35
+ {
36
+
37
+ /**
38
+ *
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_objectId = 'id';
43
+ $this->_blockGroup = 'payone_core_transaction_view';
44
+ $this->_controller = 'adminhtml_transaction';
45
+
46
+ $this->_addButton('forward_to_order', array(
47
+ 'label' => Mage::helper('payone_core')->__('Go to Order'),
48
+ 'onclick' => 'setLocation(\'' . $this->getForwardToOrderUrl() . '\')',
49
+ 'class' => 'go',
50
+ ), 0, 250);
51
+
52
+ parent::__construct();
53
+
54
+ $this->setId('transaction_view');
55
+
56
+ $this->_removeButton('edit');
57
+ }
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ public function getForwardToOrderUrl()
63
+ {
64
+ $params = array('order_id' => $this->getTransaction()->getOrderId());
65
+ return $this->getUrl('adminhtml/sales_order/view', $params);
66
+ }
67
+
68
+ /**
69
+ * @return Payone_Core_Model_Domain_Transaction
70
+ */
71
+ public function getTransaction()
72
+ {
73
+ return Mage::registry('payone_core_transaction');
74
+ }
75
+
76
+ /**
77
+ * @return string
78
+ */
79
+ public function getHeaderText()
80
+ {
81
+ $transaction = $this->getTransaction();
82
+ $text = Mage::helper('payone_core')->__(
83
+ 'Transaction #%s | %s',
84
+ $transaction->getId(),
85
+ $transaction->getTxid()
86
+ );
87
+
88
+ return $text;
89
+ }
90
+
91
+ /**
92
+ * @return Payone_Core_Block_Adminhtml_Transaction_View
93
+ */
94
+ protected function _prepareLayout()
95
+ {
96
+ foreach ($this->_buttons as $level => $buttons) {
97
+ foreach ($buttons as $id => $data) {
98
+ $childId = $this->_prepareButtonBlockId($id);
99
+ $this->_addButtonChildBlock($childId);
100
+ }
101
+ }
102
+ $this->setChild('plane',
103
+ $this->getLayout()->createBlock(
104
+ 'payone_core/adminhtml_transaction_view_plane',
105
+ 'payone_core_adminhtml_transaction_view_plane')
106
+ );
107
+ return $this;
108
+ }
109
+ }
app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Plane.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Transaction
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Transaction
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Transaction_View_Plane extends Mage_Adminhtml_Block_Widget
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ parent::__construct();
41
+ $this->setTemplate('payone/core/transaction/view/plane.phtml');
42
+ }
43
+ }
app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Tab/General.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Transaction
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Transaction
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Transaction_View_Tab_General extends Mage_Adminhtml_Block_Widget
34
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
35
+ {
36
+
37
+ /**
38
+ *
39
+ * @return string
40
+ */
41
+ public function getTabTitle()
42
+ {
43
+ return $this->helperPayoneCore()->__('General');
44
+ }
45
+
46
+ /**
47
+ * @return bool
48
+ */
49
+ public function isHidden()
50
+ {
51
+ return false;
52
+ }
53
+
54
+ /**
55
+ * @return bool
56
+ */
57
+ public function canShowTab()
58
+ {
59
+ return true;
60
+ }
61
+
62
+ /**
63
+ * @return string
64
+ */
65
+ public function getTabLabel()
66
+ {
67
+ return $this->helperPayoneCore()->__('General');
68
+ }
69
+
70
+ /**
71
+ * Converts timezone from "GMT" to locale timezone
72
+ * @param $string
73
+ * @return string|null
74
+ */
75
+ public function getLocaleDatetime($string)
76
+ {
77
+ $helper = $this->helperPayoneCore();
78
+ return $helper->getLocaleDatetime($string);
79
+ }
80
+
81
+ /**
82
+ * @return Payone_Core_Model_Domain_Transaction
83
+ */
84
+ public function getTransaction()
85
+ {
86
+ return Mage::registry('payone_core_transaction');
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @return Payone_Core_Helper_Data
92
+ */
93
+ protected function helperPayoneCore()
94
+ {
95
+ return Mage::helper('payone_core');
96
+ }
97
+ }
app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Tab/TransactionStatus.php ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Transaction
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Transaction
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Transaction_View_Tab_TransactionStatus extends Mage_Adminhtml_Block_Widget_Grid
34
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('payone_core_adminhtml_transaction_view_tab_transactionstatus');
43
+ $this->setDefaultSort('created_at');
44
+ $this->setDefaultDir('ASC');
45
+ $this->setSaveParametersInSession(true);
46
+ $this->setUseAjax(true);
47
+ $this->setSkipGenerateContent(true);
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @return string
53
+ */
54
+ public function getTabTitle()
55
+ {
56
+ return Mage::helper('payone_core')->__('Transactionstatus');
57
+ }
58
+
59
+ /**
60
+ * @return bool
61
+ */
62
+ public function isHidden()
63
+ {
64
+ return false;
65
+ }
66
+
67
+ /**
68
+ * @return bool
69
+ */
70
+ public function canShowTab()
71
+ {
72
+ return true;
73
+ }
74
+
75
+ /**
76
+ * @return string
77
+ */
78
+ public function getTabClass()
79
+ {
80
+ return 'ajax';
81
+ }
82
+
83
+ /**
84
+ * @return string
85
+ */
86
+ public function getTabLabel()
87
+ {
88
+ return Mage::helper('payone_core')->__('Transactionstatus');
89
+ }
90
+
91
+ /**
92
+ * @return string
93
+ */
94
+ public function getGridUrl()
95
+ {
96
+ return $this->getUrl('*/*/transactionStatusGrid', array('_current' => true));
97
+ }
98
+ /**
99
+ * @return string
100
+ */
101
+ public function getTabUrl()
102
+ {
103
+ return $this->getUrl('*/*/transactionStatusGrid', array('_current' => true));
104
+ }
105
+
106
+ /**
107
+ * @param $row
108
+ * @return string
109
+ */
110
+ public function getRowUrl($row)
111
+ {
112
+ return $this->getUrl('*/adminhtml_protocol_transactionStatus/view', array('id' => $row->getId()));
113
+ }
114
+
115
+
116
+ /**
117
+ * @return Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection
118
+ */
119
+ public function getTransactionStatusCollection()
120
+ {
121
+ return Mage::registry('payone_core_transactionstatus_collection');
122
+ }
123
+
124
+ /**
125
+ * @return Mage_Adminhtml_Block_Widget_Grid
126
+ */
127
+ protected function _prepareCollection()
128
+ {
129
+ $collection = $this->getTransactionStatusCollection();
130
+
131
+ $this->setCollection($collection);
132
+ return parent::_prepareCollection();
133
+ }
134
+
135
+ /**
136
+ * @return Mage_Adminhtml_Block_Widget_Grid
137
+ */
138
+ protected function _prepareColumns()
139
+ {
140
+ $this->addColumn(
141
+ 'id',
142
+ array(
143
+ 'header' => $this->helperPayoneCore()->__('ID'),
144
+ 'width' => '5px',
145
+ 'type' => 'text',
146
+ 'index' => 'id',
147
+ 'filter' => false,
148
+ ));
149
+
150
+ $this->addColumn(
151
+ 'txid',
152
+ array(
153
+ 'header' => $this->helperPayoneCore()->__('Txid'),
154
+ 'type' => 'text',
155
+ 'index' => 'txid',
156
+ ));
157
+
158
+ $this->addColumn(
159
+ 'reference',
160
+ array(
161
+ 'header' => $this->helperPayoneCore()->__('Reference'),
162
+ 'type' => 'text',
163
+ 'sortable' => false,
164
+ 'filter' => false,
165
+ 'index' => 'reference',
166
+ ));
167
+
168
+ $this->addColumn(
169
+ 'txaction',
170
+ array(
171
+ 'header' => $this->helperPayoneCore()->__('Txaction'),
172
+ 'index' => 'txaction',
173
+ 'type' => 'options',
174
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigTransactionStatus()->toSelectArray()
175
+ ));
176
+
177
+ $this->addColumn(
178
+ 'txtime',
179
+ array(
180
+ 'header' => $this->helperPayoneCore()->__('Txtime'),
181
+ 'index' => 'txtime',
182
+ 'type' => 'text',
183
+ 'sortable' => false,
184
+ 'filter' => false,
185
+ ));
186
+
187
+ $this->addColumn(
188
+ 'sequencenumber',
189
+ array(
190
+ 'header' => $this->helperPayoneCore()->__('Sequencenumber'),
191
+ 'index' => 'sequencenumber',
192
+ 'sortable' => false,
193
+ 'filter' => false,
194
+ 'type' => 'text',
195
+ ));
196
+
197
+ $this->addColumn(
198
+ 'clearingtype',
199
+ array(
200
+ 'header' => $this->helperPayoneCore()->__('Clearingtype'),
201
+ 'index' => 'clearingtype',
202
+ 'sortable' => false,
203
+ 'filter' => false,
204
+ 'type' => 'options',
205
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigClearingType()->toSelectArray()
206
+ ));
207
+
208
+ $this->addColumn(
209
+ 'mode',
210
+ array(
211
+ 'header' => $this->helperPayoneCore()->__('Mode'),
212
+ 'index' => 'mode',
213
+ 'sortable' => false,
214
+ 'filter' => false,
215
+ 'type' => 'options',
216
+ 'options' => $this->getPayoneFactory()->getModelSystemConfigMode()->toSelectArray()
217
+ ));
218
+
219
+ $this->addColumn(
220
+ 'portalid',
221
+ array(
222
+ 'header' => $this->helperPayoneCore()->__('Portal-ID'),
223
+ 'index' => 'portalid',
224
+ 'sortable' => false,
225
+ 'filter' => false,
226
+ 'type' => 'text',
227
+ ));
228
+
229
+ $this->addColumn(
230
+ 'receivable',
231
+ array(
232
+ 'header' => $this->helperPayoneCore()->__('Receivable'),
233
+ 'index' => 'receivable',
234
+ 'sortable' => false,
235
+ 'filter' => false,
236
+ 'type' => 'text',
237
+ ));
238
+
239
+ $this->addColumn(
240
+ 'balance',
241
+ array(
242
+ 'header' => $this->helperPayoneCore()->__('Balance'),
243
+ 'index' => 'balance',
244
+ 'sortable' => false,
245
+ 'filter' => false,
246
+ 'type' => 'text',
247
+ ));
248
+
249
+ $this->addColumn(
250
+ 'created_at',
251
+ array(
252
+ 'header' => $this->helperPayoneCore()->__('Created at'),
253
+ 'index' => 'created_at',
254
+ 'type' => 'datetime',
255
+ 'width' => '80px',
256
+ 'filter' => false,
257
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
258
+ ));
259
+
260
+ $this->addColumn(
261
+ 'updated_at',
262
+ array(
263
+ 'header' => $this->helperPayoneCore()->__('Updated at'),
264
+ 'index' => 'updated_at',
265
+ 'type' => 'datetime',
266
+ 'width' => '80px',
267
+ 'filter' => false,
268
+ 'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
269
+ ));
270
+
271
+ return parent::_prepareColumns();
272
+ }
273
+
274
+ /**
275
+ *
276
+ * @return Payone_Core_Helper_Data
277
+ */
278
+ protected function helperPayoneCore()
279
+ {
280
+ return Mage::helper('payone_core');
281
+ }
282
+
283
+ /**
284
+ * @return Payone_Core_Model_Factory
285
+ */
286
+ public function getPayoneFactory(){
287
+ return $this->helperPayoneCore()->getFactory();
288
+ }
289
+
290
+ }
app/code/community/Payone/Core/Block/Adminhtml/Transaction/View/Tabs.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Transaction
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Transaction
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Transaction_View_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function __construct()
39
+ {
40
+ parent::__construct();
41
+ $this->setId('payone_core_transaction_view_tabs');
42
+ $this->setDestElementId('transaction_view');
43
+ $this->setTitle(Mage::helper('payone_core')->__('Information'));
44
+ }
45
+ }
app/code/community/Payone/Core/Block/Adminhtml/Widget/Grid/Column/Renderer/Datetime.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Widget
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Widget
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Widget_Grid_Column_Renderer_Datetime
34
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Datetime
35
+ {
36
+ /**
37
+ * Renders grid column
38
+ *
39
+ * @param Varien_Object $row
40
+ * @return string
41
+ */
42
+ public function render(Varien_Object $row)
43
+ {
44
+ if ($data = $this->_getValue($row)) {
45
+ if ($data === '0000-00-00 00:00:00') {
46
+ return '';
47
+ }
48
+ else {
49
+ return parent::render($row);
50
+ }
51
+ }
52
+ return $this->getColumn()->getDefault();
53
+ }
54
+ }
app/code/community/Payone/Core/Block/Adminhtml/Widget/Grid/Column/Renderer/UnixTimestamp.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Widget
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Widget
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Widget_Grid_Column_Renderer_UnixTimestamp
34
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Datetime
35
+ {
36
+ /**
37
+ * Renders grid column
38
+ *
39
+ * @param Varien_Object $row
40
+ * @return string
41
+ */
42
+ public function render(Varien_Object $row)
43
+ {
44
+ $date = date(Varien_Date::DATETIME_PHP_FORMAT, $this->_getValue($row));
45
+ if($date)
46
+ {
47
+ $row->setData('txtime', $date);
48
+ return parent::render($row);
49
+ }
50
+ return $this->getColumn()->getDefault();
51
+ }
52
+ }
app/code/community/Payone/Core/Block/Adminhtml/Widget/Grid/Container.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Widget
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Widget
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Widget_Grid_Container extends Mage_Adminhtml_Block_Widget_Grid_Container
34
+ {
35
+ public function getHeaderCssClass()
36
+ {
37
+ return 'payone-adminhtml-head ' . parent::getHeaderCssClass();
38
+ }
39
+ }
app/code/community/Payone/Core/Block/Adminhtml/Widget/View/Container.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Adminhtml_Widget
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Adminhtml_Widget
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Adminhtml_Widget_View_Container extends Mage_Adminhtml_Block_Widget_View_Container
34
+ {
35
+ public function getHeaderCssClass()
36
+ {
37
+ return 'payone-adminhtml-head ' . parent::getHeaderCssClass();
38
+ }
39
+ }
app/code/community/Payone/Core/Block/Checkout/Onepage/Payment/Additional.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Checkout
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Checkout
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Checkout_Onepage_Payment_Additional extends Mage_Core_Block_Template
34
+ {
35
+ /** @var Payone_Core_Model_Factory */
36
+ private $factory = null;
37
+
38
+ /**
39
+ * @return bool
40
+ */
41
+ public function canShowAgreementMessage()
42
+ {
43
+ $config = $this->getConfigCreditrating();
44
+ if($config->isEnabled() && $config->isAgreementEnabled() && $config->isIntegrationEventAfterPayment())
45
+ {
46
+ return true;
47
+ }
48
+ return false;
49
+ }
50
+
51
+ /**
52
+ * @return string
53
+ */
54
+ public function getAgreementMessage()
55
+ {
56
+ $config = $this->getConfigCreditrating();
57
+ return $config->getAgreementMessage();
58
+ }
59
+
60
+ /**
61
+ * @return bool
62
+ */
63
+ public function canShowPaymentHintText()
64
+ {
65
+ $config = $this->getConfigCreditrating();
66
+ if($config->isEnabled() && $config->isPaymentHintEnabled() && $config->isIntegrationEventAfterPayment())
67
+ {
68
+ return true;
69
+ }
70
+ return false;
71
+ }
72
+
73
+ /**
74
+ * @return string
75
+ */
76
+ public function getPaymentHintText()
77
+ {
78
+ $config = $this->getConfigCreditrating();
79
+ return $config->getPaymentHintText();
80
+ }
81
+
82
+ /**
83
+ * @return Payone_Core_Model_Config_Protect_Creditrating
84
+ */
85
+ protected function getConfigCreditrating()
86
+ {
87
+ /** @var $quote Mage_Sales_Model_Quote */
88
+ $checkout = $this->getFactory()->getSingletonCheckoutSession();
89
+ $quote = $checkout->getQuote();
90
+ $helperConfig = $this->getHelperConfig();
91
+ return $helperConfig->getConfigProtect($quote->getStoreId())->getCreditrating();
92
+ }
93
+
94
+ /**
95
+ * @return Payone_Core_Helper_Config
96
+ */
97
+ protected function getHelperConfig()
98
+ {
99
+ return $this->getFactory()->helperConfig();
100
+ }
101
+ /**
102
+ * @return Payone_Core_Model_Factory
103
+ */
104
+ protected function getFactory()
105
+ {
106
+ if ($this->factory === null) {
107
+ $this->factory = new Payone_Core_Model_Factory();
108
+ }
109
+ return $this->factory;
110
+ }
111
+ }
app/code/community/Payone/Core/Block/Checkout/Onepage/Payment/Methods.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Checkout
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Checkout
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Checkout_Onepage_Payment_Methods
34
+ extends Mage_Checkout_Block_Onepage_Payment_Methods
35
+ {
36
+ const RESULT_HAVE_TO_FILTER_METHODS = 'have_to_filter_methods';
37
+ const RESULT_ALLOWED_METHODS = 'allowed_methods';
38
+
39
+ protected $_eventPrefix = 'checkout_onepage_payment_methods';
40
+
41
+ /**
42
+ * @var Mage_Payment_Model_Method_Abstract[]
43
+ */
44
+ protected $methods = null;
45
+
46
+ /**
47
+ * @return array
48
+ */
49
+ public function getMethods()
50
+ {
51
+ if ($this->methods !== null) {
52
+ return $this->methods;
53
+ }
54
+
55
+ //
56
+ $this->methods = parent::getMethods();
57
+
58
+ $allowedMethods = $this->getAllowedMethods();
59
+
60
+ // All Methods are allowed
61
+ if ($allowedMethods === true) {
62
+ return $this->methods;
63
+ }
64
+
65
+ $result = array();
66
+ foreach ($this->methods as $method) {
67
+ /**
68
+ * @var $method Mage_Payment_Model_Method_Abstract
69
+ */
70
+ $methodAvailable = $allowedMethods->getData($method->getCode());
71
+ if ($methodAvailable == 1) {
72
+ $result[] = $method;
73
+ }
74
+ }
75
+
76
+ // Overwrite Methods with the above created result array
77
+ $this->methods = $result;
78
+
79
+ return $this->methods;
80
+ }
81
+
82
+ /**
83
+ * @return bool|Varien_Object
84
+ */
85
+ protected function getAllowedMethods()
86
+ {
87
+ $allowedMethods = $this->getData('allowed_methods');
88
+
89
+ // Allowed Methods can be cached in registry
90
+ if ($allowedMethods == null) {
91
+ /**
92
+ * @var $allowedMethods Varien_Object
93
+ */
94
+ $allowedMethods = Mage::registry('payment_methods_allowed_methods');
95
+ }
96
+
97
+ // Determine allowed methods using event
98
+ if ($allowedMethods == null) {
99
+ // Trigger Event to determine allowed Methods
100
+ $settings = $this->dispatchEvent();
101
+
102
+ //
103
+ if (!$settings->getData(self::RESULT_HAVE_TO_FILTER_METHODS)) {
104
+ return true;
105
+ }
106
+
107
+ /**
108
+ * @var $allowedMethods Varien_Object
109
+ */
110
+ $allowedMethods = $settings->getData(self::RESULT_ALLOWED_METHODS);
111
+ }
112
+
113
+ $this->setData('allowed_methods', $allowedMethods);
114
+
115
+ return $allowedMethods;
116
+ }
117
+
118
+ /**
119
+ * @return Varien_Object
120
+ */
121
+ protected function dispatchEvent()
122
+ {
123
+ $settings = new Varien_Object();
124
+ $settings->setData(self::RESULT_HAVE_TO_FILTER_METHODS, false);
125
+
126
+ $allowedMethods = new Varien_Object();
127
+ $settings->setData(self::RESULT_ALLOWED_METHODS, $allowedMethods);
128
+
129
+ $parameters = array(
130
+ 'settings' => $settings,
131
+ 'quote' => $this->getQuote(),
132
+ 'full_action_name' => $this->getFullActionName(),
133
+ );
134
+
135
+ Mage::dispatchEvent($this->_eventPrefix . '_get_methods', $parameters);
136
+
137
+ return $settings;
138
+ }
139
+
140
+ protected function getFullActionName()
141
+ {
142
+ return $this->getAction()->getFullActionName('/');
143
+ }
144
+
145
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/Abstract.php ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_Abstract
34
+ extends Mage_Payment_Block_Form
35
+ {
36
+ /** @var Payone_Core_Model_Config_Payment_Method_Interface */
37
+ protected $paymentConfig = null;
38
+
39
+ /** @var Payone_Core_Model_Factory */
40
+ protected $factory = null;
41
+
42
+ /**
43
+ * @var array
44
+ */
45
+ protected $types = null;
46
+ /**
47
+ * @var bool
48
+ */
49
+ protected $hasTypes = false;
50
+
51
+ public function getMethodTitle()
52
+ {
53
+ return $this->getPaymentConfig()->getName();
54
+ }
55
+
56
+ /**
57
+ * @return Mage_Sales_Model_Quote
58
+ */
59
+ public function getQuote()
60
+ {
61
+ return $this->getMethod()->getInfoInstance()->getQuote();
62
+ }
63
+
64
+ /**
65
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
66
+ */
67
+ public function getPaymentConfig()
68
+ {
69
+ if ($this->paymentConfig === null) {
70
+ /** @var $method Payone_Core_Model_Payment_Method_Abstract */
71
+ $method = $this->getMethod();
72
+ $this->paymentConfig = $method->getConfigForQuote($this->getQuote());
73
+ }
74
+ return $this->paymentConfig;
75
+ }
76
+
77
+ /**
78
+ * @return Payone_Core_Model_Config_General
79
+ */
80
+ public function getConfigGeneral()
81
+ {
82
+ $storeId = $this->getQuote()->getStoreId();
83
+ return $this->helperConfig()->getConfigGeneral($storeId);
84
+ }
85
+
86
+ /**
87
+ * @return Payone_Core_Model_Config_Payment_Method_Interface[]
88
+ */
89
+ public function getPaymentConfigs()
90
+ {
91
+ $quote = $this->getQuote();
92
+ /** @var $method Payone_Core_Model_Payment_Method_Creditcard */
93
+ $method = $this->getMethod();
94
+ $configs = $method->getAllConfigsByQuote($quote);
95
+ return $configs;
96
+ }
97
+
98
+ /**
99
+ * @return array|bool
100
+ */
101
+ protected function getFeeConfig()
102
+ {
103
+ return $this->getPaymentConfig()->getFeeConfigForQuote($this->getQuote());
104
+ }
105
+
106
+ /**
107
+ * Formatted Fee price e.g. '2,50 €' or '$11.50'
108
+ * @return string
109
+ */
110
+ public function getFeePrice()
111
+ {
112
+ $feeConfig = $this->getFeeConfig();
113
+
114
+ $price = 0.0;
115
+ if (is_array($feeConfig) and array_key_exists('fee_config', $feeConfig) and !empty($feeConfig['fee_config'])) {
116
+ $price = $feeConfig['fee_config'];
117
+ }
118
+
119
+ $formattedPrice = $this->getQuote()->getStore()->formatPrice($price);
120
+ return $formattedPrice;
121
+ }
122
+
123
+ /**
124
+ * @param float $price
125
+ * @return string
126
+ */
127
+ protected function getFormattedFeePriceLabel($price)
128
+ {
129
+ $formattedFeePrice = $this->getQuote()->getStore()->formatPrice($price);
130
+ $text = $this->__('(+ %s)', $formattedFeePrice);
131
+ return $text;
132
+ }
133
+
134
+ /**
135
+ * Provide an array of credit card types for the template
136
+ *
137
+ * Each value is an array, with the keys:
138
+ * code - type code, e.g. 'V'
139
+ * name - name for display, e.g. "Visa"
140
+ * fee - Formatted fee price for this type, empty if no price is configured.
141
+ * check_cvc - 1 or 0, depends on the used configuration only set for Creditcard
142
+ * config_id - Id of the payment method configuration for this card type
143
+ *
144
+ * @api
145
+ * @return array
146
+ */
147
+ public function getTypes()
148
+ {
149
+ if($this->hasTypes === false){
150
+ return null;
151
+ }
152
+ if ($this->types === null) {
153
+ $quote = $this->getQuote();
154
+ $return = array();
155
+
156
+ $systemTypes = $this->getSystemConfigMethodTypes();
157
+
158
+ foreach ($this->getPaymentConfigs() as $key => $config) {
159
+ $feeConfig = $config->getFeeConfigForQuote($quote);
160
+
161
+ if (is_array($feeConfig) and array_key_exists('fee_config', $feeConfig) and !empty($feeConfig['fee_config'])) {
162
+ $formattedFeePrice = $this->getFormattedFeePriceLabel($feeConfig['fee_config']);
163
+ }
164
+ else {
165
+ $formattedFeePrice = '';
166
+ }
167
+
168
+ $checkCvc = $config->getCheckCvc();
169
+ $configId = $config->getId();
170
+
171
+ $configTypes = $config->getTypes();
172
+ if (!is_array($configTypes)) {
173
+ continue;
174
+ }
175
+
176
+ /** @var $config Payone_Core_Model_Config_Payment_Method */
177
+ foreach ($configTypes as $keyType => $typeCode) {
178
+ $configTypeKey = $configId . '_' . $typeCode; // key to correctly identify this config and type
179
+ $return[$configTypeKey]['code'] = $typeCode;
180
+
181
+ if (array_key_exists($typeCode, $systemTypes)) {
182
+ $typeName = $this->__($systemTypes[$typeCode]);
183
+ }
184
+ else {
185
+ $typeName = $this->__($this->getMethodCode() . '_type_'. $typeCode);
186
+ }
187
+
188
+ $return[$configTypeKey]['name'] = $typeName;
189
+ $return[$configTypeKey]['fee'] = $formattedFeePrice;
190
+ $return[$configTypeKey]['check_cvc'] = $checkCvc;
191
+ $return[$configTypeKey]['config_id'] = $configId;
192
+ }
193
+ }
194
+ $this->types = $return;
195
+ }
196
+ return $this->types;
197
+ }
198
+
199
+ /**
200
+ * @return array
201
+ */
202
+ protected function getSystemConfigMethodTypes()
203
+ {
204
+ }
205
+
206
+
207
+ /**
208
+ * Get formatted additional fee string
209
+ *
210
+ * @override Overrides magic method that is used in magento template (checkout/onepage/payment/methods.phtml)
211
+ * @return string
212
+ */
213
+ public function getMethodLabelAfterHtml()
214
+ {
215
+ if (false == $this->getFeeConfig()) {
216
+ return '';
217
+ }
218
+ $text = '(+ %s)';
219
+ $text = $this->__($text, $this->getFeePrice());
220
+
221
+ $id = 'payone_payment_fee_' . $this->getMethodCode();
222
+
223
+ $formatting = ' <span id=' . $id . '>' . $text . '</span>';
224
+
225
+ return $formatting;
226
+ }
227
+
228
+ /**
229
+ * @return bool
230
+ */
231
+ public function hasMethodTitle()
232
+ {
233
+ return true;
234
+ }
235
+
236
+ /**
237
+ * @return Payone_Core_Helper_Config
238
+ */
239
+ protected function helperConfig()
240
+ {
241
+ return $this->getFactory()->helperConfig();
242
+ }
243
+
244
+ /**
245
+ * @param Payone_Core_Model_Factory $factory
246
+ */
247
+ public function setFactory(Payone_Core_Model_Factory $factory)
248
+ {
249
+ $this->factory = $factory;
250
+ }
251
+
252
+ /**
253
+ * @return Payone_Core_Model_Factory
254
+ */
255
+ public function getFactory()
256
+ {
257
+ if ($this->factory === null) {
258
+ $this->factory = new Payone_Core_Model_Factory();
259
+ }
260
+ return $this->factory;
261
+ }
262
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/AdvancePayment.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_AdvancePayment
34
+ extends Payone_Core_Block_Payment_Method_Form_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/form/advancepayment.phtml');
40
+ }
41
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/CashOnDelivery.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_CashOnDelivery
34
+ extends Payone_Core_Block_Payment_Method_Form_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/form/cashondelivery.phtml');
40
+ }
41
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/Creditcard.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_Creditcard
34
+ extends Payone_Core_Block_Payment_Method_Form_Abstract
35
+ {
36
+ protected $hasTypes = true;
37
+
38
+ protected function _construct()
39
+ {
40
+ parent::_construct();
41
+ $this->setTemplate('payone/core/payment/method/form/creditcard.phtml');
42
+ }
43
+
44
+ /**
45
+ * Name from billing address in the format "Firstname Lastname".
46
+ * @return string
47
+ */
48
+ public function getBillingName()
49
+ {
50
+ $quote = $this->getQuote();
51
+ $address = $quote->getBillingAddress();
52
+ return $address->getFirstname() . ' ' . $address->getLastname();
53
+ }
54
+
55
+ /**
56
+ * @return Mage_Payment_Model_Config
57
+ */
58
+ protected function getMagentoPaymentConfig()
59
+ {
60
+ return $this->getFactory()->getSingletonPaymentConfig();
61
+ }
62
+
63
+ public function getCvcJson()
64
+ {
65
+ $return = array();
66
+ foreach ($this->getTypes() as $key => $type) {
67
+ $return[$key] = $type['check_cvc'];
68
+ }
69
+ return json_encode($return);
70
+ }
71
+
72
+ /**
73
+ * @return array
74
+ */
75
+ protected function getSystemConfigMethodTypes()
76
+ {
77
+ return $this->getFactory()->getModelSystemConfigCreditCardType()->toSelectArray();
78
+ }
79
+
80
+ /**
81
+ * @return string
82
+ */
83
+ public function getCreditCardType()
84
+ {
85
+ return $this->getInfoData('cc_type');
86
+ }
87
+
88
+ /**
89
+ * @return string
90
+ */
91
+ public function getCreditCardExpireYear()
92
+ {
93
+ $ccExpYear = $this->getInfoData('cc_exp_year');
94
+ return $ccExpYear;
95
+ }
96
+
97
+ /**
98
+ * @return string
99
+ */
100
+ public function getCreditCardExpireMonth()
101
+ {
102
+ $ccExpMonth = $this->getInfoData('cc_exp_month');
103
+ return $ccExpMonth;
104
+ }
105
+
106
+
107
+ /**
108
+ * Retrieve credit card expire months
109
+ *
110
+ * @return array
111
+ */
112
+ public function getCcMonths()
113
+ {
114
+ $months = $this->getData('cc_months');
115
+ if (is_null($months)) {
116
+ $months[0] = $this->__('Month');
117
+ $months = array_merge($months, $this->getMagentoPaymentConfig()->getMonths());
118
+ $this->setData('cc_months', $months);
119
+ }
120
+ return $months;
121
+ }
122
+
123
+ /**
124
+ * Retrieve credit card expire years
125
+ *
126
+ * @return array
127
+ */
128
+ public function getCcYears()
129
+ {
130
+ $years = $this->getData('cc_years');
131
+ if (is_null($years)) {
132
+ $years = $this->getMagentoPaymentConfig()->getYears();
133
+ $years = array(0 => $this->__('Year')) + $years;
134
+ $this->setData('cc_years', $years);
135
+ }
136
+ return $years;
137
+ }
138
+
139
+ /**
140
+ * @return string
141
+ */
142
+ public function getClientApiConfigAsJson()
143
+ {
144
+ return json_encode($this->getClientApiConfig());
145
+ }
146
+
147
+ /**
148
+ * @return array
149
+ */
150
+ public function getClientApiConfig()
151
+ {
152
+ $creditcardcheck = $this->getCreditcardcheckParams();
153
+ $allowedValidity = $this->getAllowedValidityTimestamp();
154
+
155
+ $params = array(
156
+ 'gateway' => $creditcardcheck,
157
+ 'validation' => array(
158
+ 'allowed_validity' => $allowedValidity
159
+ ),
160
+ );
161
+
162
+ return $params;
163
+ }
164
+
165
+ /**
166
+ * Returns the gateways, one for each payment configuration
167
+ * @return array
168
+ */
169
+ public function getCreditcardcheckParams()
170
+ {
171
+ $paymentConfigs = $this->getPaymentConfigs();
172
+ /** @var $helper Payone_Core_Helper_Data */
173
+ $helper = $this->helper('payone_core');
174
+ $factory = $this->getFactory();
175
+ $helperUrl = $this->getFactory()->helperUrl();
176
+
177
+ $serviceGenerateHash = $factory->getServiceClientApiGenerateHash();
178
+
179
+ $language = $helper->getDefaultLanguage();
180
+
181
+ $gateways = array();
182
+ foreach ($paymentConfigs as $paymentConfig) {
183
+ $request = $factory->getRequestClientApiCreditCardCheck();
184
+ $params = array(
185
+ 'aid' => $paymentConfig->getAid(),
186
+ 'mid' => $paymentConfig->getMid(),
187
+ 'portalid' => $paymentConfig->getPortalid(),
188
+ 'mode' => $paymentConfig->getMode(),
189
+ 'encoding' => 'UTF-8',
190
+ 'language' => $language,
191
+ 'solution_version' => $helper->getPayoneVersion(),
192
+ 'solution_name' => 'noovias',
193
+ 'integrator_version' => $helper->getMagentoVersion(),
194
+ 'integrator_name' => 'Magento',
195
+ 'storecarddata' => 'yes',
196
+ 'successurl' => $helperUrl->getSuccessUrl(),
197
+ 'errorurl' => $helperUrl->getErrorUrl()
198
+
199
+ );
200
+ $request->init($params);
201
+ $request->setResponsetype('JSON');
202
+
203
+ $hash = $serviceGenerateHash->generate($request, $paymentConfig->getKey());
204
+
205
+ $request->setHash($hash);
206
+
207
+ $params = $request->toArray();
208
+
209
+ $gateways[$paymentConfig->getId()] = $params;
210
+ }
211
+ return $gateways;
212
+ }
213
+
214
+ /**
215
+ * @return string
216
+ */
217
+ public function getAllowedValidityTimestamp()
218
+ {
219
+ $config = $this->getConfigGeneral();
220
+
221
+ $days = $config->getPaymentCreditcard()->getMinValidityPeriod();
222
+ if (empty($days)) {
223
+ $days = 0;
224
+ }
225
+
226
+ $allowedDate = new DateTime(now());
227
+ $allowedDate->modify('+ ' . $days . ' days');
228
+
229
+ $timestamp = $allowedDate->format('U');
230
+
231
+ return $timestamp;
232
+ }
233
+
234
+ /**
235
+ * @override To prevent display of fee config on payment method, as there might be differen fees for each credit card type
236
+ *
237
+ * @return string
238
+ */
239
+ public function getMethodLabelAfterHtml()
240
+ {
241
+ return '';
242
+ }
243
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/DebitPayment.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_DebitPayment
34
+ extends Payone_Core_Block_Payment_Method_Form_Abstract
35
+ {
36
+
37
+ protected function _construct()
38
+ {
39
+ parent::_construct();
40
+ $this->setTemplate('payone/core/payment/method/form/debitpayment.phtml');
41
+ }
42
+
43
+ public function getBillingName()
44
+ {
45
+ $quote = $this->getQuote();
46
+ $address = $quote->getBillingAddress();
47
+ return $address->getFirstname() . ' ' . $address->getLastname();
48
+ }
49
+
50
+ /**
51
+ * Returns quote country
52
+ * @return string
53
+ */
54
+ public function getCountry()
55
+ {
56
+ $quote = $this->getQuote();
57
+ return $quote->getBillingAddress()->getCountry();
58
+ }
59
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/Invoice.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_Invoice
34
+ extends Payone_Core_Block_Payment_Method_Form_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/form/invoice.phtml');
40
+ }
41
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/OnlineBankTransfer.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_OnlineBankTransfer
34
+ extends Payone_Core_Block_Payment_Method_Form_Abstract
35
+ {
36
+ protected $hasTypes = true;
37
+
38
+ protected function _construct()
39
+ {
40
+ parent::_construct();
41
+ $this->setTemplate('payone/core/payment/method/form/onlinebanktransfer.phtml');
42
+ }
43
+
44
+ /**
45
+ * Returns quote country
46
+ * @return string
47
+ */
48
+ public function getCountry()
49
+ {
50
+ $quote = $this->getQuote();
51
+ return $quote->getBillingAddress()->getCountry();
52
+ }
53
+
54
+ /**
55
+ * @return array
56
+ */
57
+ protected function getSystemConfigMethodTypes()
58
+ {
59
+ return $this->getFactory()->getModelSystemConfigOnlinebanktransferType()->toSelectArray();
60
+ }
61
+
62
+ /**
63
+ * @return bool
64
+ */
65
+ public function isAvailableAccountNumber()
66
+ {
67
+ $country = $this->getCountry();
68
+ return $country == 'DE' || $country == 'AT' || $country == 'NL';
69
+ }
70
+
71
+ /**
72
+ * @return bool
73
+ */
74
+ public function isAvailableBankCode()
75
+ {
76
+ $country = $this->getCountry();
77
+ return $country == 'DE' || $country == 'AT';
78
+ }
79
+
80
+ /**
81
+ * @return bool
82
+ */
83
+ public function isAvailableBankGroup()
84
+ {
85
+ $country = $this->getCountry();
86
+ return $country == 'AT';
87
+ }
88
+
89
+ public function getBlockHtmlBankGroup()
90
+ {
91
+ /** @var $block Mage_Core_Block_Template */
92
+ $block = $this->getLayout()->createBlock('core/template');
93
+ $block->setTemplate('payone/core/payment/method/form/onlinebanktransfer/bankgroup.phtml');
94
+ $block->setMethodCode($this->getMethodCode());
95
+ $block->setCountry($this->getCountry());
96
+ $html = $block->toHtml();
97
+ return $html;
98
+ }
99
+ }
app/code/community/Payone/Core/Block/Payment/Method/Form/Wallet.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Form_Wallet
34
+ extends Payone_Core_Block_Payment_Method_Form_Abstract
35
+ {
36
+ protected $hasTypes = true;
37
+
38
+ protected function _construct()
39
+ {
40
+ parent::_construct();
41
+ $this->setTemplate('payone/core/payment/method/form/wallet.phtml');
42
+ }
43
+
44
+ /**
45
+ * @override To prevent display of fee config on payment method, as there might be differen fees for each wallet type
46
+ *
47
+ * @return string
48
+ */
49
+ public function getMethodLabelAfterHtml()
50
+ {
51
+ return '';
52
+ }
53
+
54
+ /**
55
+ * @return array
56
+ */
57
+ protected function getSystemConfigMethodTypes()
58
+ {
59
+ return $this->getFactory()->getModelSystemConfigWalletType()->toSelectArray();
60
+ }
61
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/Abstract.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_Abstract
34
+ extends Mage_Payment_Block_Info
35
+ {
36
+
37
+ /** @var Payone_Core_Model_Config_Payment_Method_Interface */
38
+ protected $paymentConfig = null;
39
+
40
+ /** @var Payone_Core_Model_Factory */
41
+ protected $factory = null;
42
+
43
+ /**
44
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
45
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
46
+ */
47
+ public function getPaymentConfig()
48
+ {
49
+ if ($this->paymentConfig === null) {
50
+ /** @var $method Payone_Core_Model_Payment_Method_Abstract */
51
+ $method = $this->getMethod();
52
+ $paymentInfo = $method->getInfoInstance();
53
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
54
+ $order = $paymentInfo->getOrder();
55
+ $config = $this->helperConfig()->getConfigPaymentMethodByOrder($order);
56
+ }
57
+ elseif ($paymentInfo instanceof Mage_Sales_Model_Quote_Payment) {
58
+ $quote = $paymentInfo->getQuote();
59
+ $config = $this->helperConfig()->getConfigPaymentMethodByQuote($quote);
60
+ }
61
+ else {
62
+ throw new Payone_Core_Exception_PaymentMethodConfigNotFound();
63
+ }
64
+ $this->paymentConfig = $config;
65
+ }
66
+ return $this->paymentConfig;
67
+ }
68
+
69
+ /**
70
+ * @return string
71
+ */
72
+ public function getMethodTitle()
73
+ {
74
+ return $this->getPaymentConfig()->getName();
75
+ }
76
+
77
+ /**
78
+ * @return int
79
+ */
80
+ public function getLastTransId()
81
+ {
82
+ return $this->getInfo()->getLastTransId();
83
+ }
84
+
85
+ /**
86
+ * @return Payone_Core_Helper_Config
87
+ */
88
+ protected function helperConfig()
89
+ {
90
+ return $this->getFactory()->helperConfig();
91
+ }
92
+
93
+ /**
94
+ * @param Payone_Core_Model_Factory $factory
95
+ */
96
+ public function setFactory(Payone_Core_Model_Factory $factory)
97
+ {
98
+ $this->factory = $factory;
99
+ }
100
+
101
+ /**
102
+ * @return Payone_Core_Model_Factory
103
+ */
104
+ public function getFactory()
105
+ {
106
+ if ($this->factory === null) {
107
+ $this->factory = new Payone_Core_Model_Factory();
108
+ }
109
+ return $this->factory;
110
+ }
111
+
112
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/AdvancePayment.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_AdvancePayment
34
+ extends Payone_Core_Block_Payment_Method_Info_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/info/advancepayment.phtml');
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getPayoneClearingBankAccountholder()
46
+ {
47
+ return $this->getInfo()->getPayoneClearingBankAccountholder();
48
+ }
49
+
50
+ /**
51
+ * @return string
52
+ */
53
+ public function getPayoneClearingBankCountry()
54
+ {
55
+ return $this->getInfo()->getPayoneClearingBankCountry();
56
+ }
57
+
58
+ /**
59
+ * @return string
60
+ */
61
+ public function getPayoneClearingBankAccount()
62
+ {
63
+ return $this->getInfo()->getPayoneClearingBankAccount();
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getPayoneClearingBankCode()
70
+ {
71
+ return $this->getInfo()->getPayoneClearingBankCode();
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function getPayoneClearingBankIban()
78
+ {
79
+ return $this->getInfo()->getPayoneClearingBankIban();
80
+ }
81
+
82
+ /**
83
+ * @return string
84
+ */
85
+ public function getPayoneClearingBankBic()
86
+ {
87
+ return $this->getInfo()->getPayoneClearingBankBic();
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ public function getPayoneClearingBankCity()
94
+ {
95
+ return $this->getInfo()->getPayoneClearingBankCity();
96
+ }
97
+
98
+ /**
99
+ * @return string
100
+ */
101
+ public function getPayoneClearingBankName()
102
+ {
103
+ return $this->getInfo()->getPayoneClearingBankName();
104
+ }
105
+
106
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/CashOnDelivery.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_CashOnDelivery
34
+ extends Payone_Core_Block_Payment_Method_Info_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/info/cashondelivery.phtml');
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getPayoneClearingBankAccountholder()
46
+ {
47
+ return $this->getInfo()->getPayoneClearingBankAccountholder();
48
+ }
49
+
50
+ /**
51
+ * @return string
52
+ */
53
+ public function getPayoneClearingBankCountry()
54
+ {
55
+ return $this->getInfo()->getPayoneClearingBankCountry();
56
+ }
57
+
58
+ /**
59
+ * @return string
60
+ */
61
+ public function getPayoneClearingBankAccount()
62
+ {
63
+ return $this->getInfo()->getPayoneClearingBankAccount();
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getPayoneClearingBankCode()
70
+ {
71
+ return $this->getInfo()->getPayoneClearingBankCode();
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function getPayoneClearingBankIban()
78
+ {
79
+ return $this->getInfo()->getPayoneClearingBankIban();
80
+ }
81
+
82
+ /**
83
+ * @return string
84
+ */
85
+ public function getPayoneClearingBankBic()
86
+ {
87
+ return $this->getInfo()->getPayoneClearingBankBic();
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ public function getPayoneClearingBankCity()
94
+ {
95
+ return $this->getInfo()->getPayoneClearingBankCity();
96
+ }
97
+
98
+ /**
99
+ * @return string
100
+ */
101
+ public function getPayoneClearingBankName()
102
+ {
103
+ return $this->getInfo()->getPayoneClearingBankName();
104
+ }
105
+
106
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/Creditcard.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_Creditcard
34
+ extends Payone_Core_Block_Payment_Method_Info_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/info/creditcard.phtml');
40
+
41
+ }
42
+
43
+ /**
44
+ * @return string
45
+ */
46
+ public function getCcOwner()
47
+ {
48
+ return $this->getInfo()->getCcOwner();
49
+ }
50
+
51
+ /**
52
+ * @return string
53
+ */
54
+ public function getCcNumberEnc()
55
+ {
56
+ return $this->getInfo()->getCcNumberEnc();
57
+ }
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ public function getCcExpMonth()
63
+ {
64
+ return $this->getInfo()->getCcExpMonth();
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function getCcExpYear()
71
+ {
72
+ return $this->getInfo()->getCcExpYear();
73
+ }
74
+
75
+ /**
76
+ * @return string
77
+ */
78
+ public function getCcType()
79
+ {
80
+ $model = $this->getFactory()->getModelSystemConfigCreditCardType();
81
+ $array = $model->toSelectArray();
82
+ return $array[$this->getInfo()->getCcType()];
83
+ }
84
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/DebitPayment.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_DebitPayment
34
+ extends Payone_Core_Block_Payment_Method_Info_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/info/debitpayment.phtml');
40
+
41
+ }
42
+
43
+ /**
44
+ * @return string
45
+ */
46
+ public function getPayoneAccountOwner()
47
+ {
48
+ return $this->getInfo()->getPayoneAccountOwner();
49
+ }
50
+
51
+ /**
52
+ * @return string
53
+ */
54
+ public function getPayoneAccountNumber()
55
+ {
56
+ $accountNumber = $this->getInfo()->getPayoneAccountNumber();
57
+ return substr($accountNumber, strlen($accountNumber) - 4, 4);
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ public function getPayoneBankCode()
64
+ {
65
+ return $this->getInfo()->getPayoneBankCode();
66
+ }
67
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/Invoice.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_Invoice
34
+ extends Payone_Core_Block_Payment_Method_Info_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/info/invoice.phtml');
40
+ }
41
+
42
+ /**
43
+ * @return string
44
+ */
45
+ public function getPayoneClearingBankAccountholder()
46
+ {
47
+ return $this->getInfo()->getPayoneClearingBankAccountholder();
48
+ }
49
+
50
+ /**
51
+ * @return string
52
+ */
53
+ public function getPayoneClearingBankCountry()
54
+ {
55
+ return $this->getInfo()->getPayoneClearingBankCountry();
56
+ }
57
+
58
+ /**
59
+ * @return string
60
+ */
61
+ public function getPayoneClearingBankAccount()
62
+ {
63
+ return $this->getInfo()->getPayoneClearingBankAccount();
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getPayoneClearingBankCode()
70
+ {
71
+ return $this->getInfo()->getPayoneClearingBankCode();
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function getPayoneClearingBankIban()
78
+ {
79
+ return $this->getInfo()->getPayoneClearingBankIban();
80
+ }
81
+
82
+ /**
83
+ * @return string
84
+ */
85
+ public function getPayoneClearingBankBic()
86
+ {
87
+ return $this->getInfo()->getPayoneClearingBankBic();
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ public function getPayoneClearingBankCity()
94
+ {
95
+ return $this->getInfo()->getPayoneClearingBankCity();
96
+ }
97
+
98
+ /**
99
+ * @return string
100
+ */
101
+ public function getPayoneClearingBankName()
102
+ {
103
+ return $this->getInfo()->getPayoneClearingBankName();
104
+ }
105
+
106
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/OnlineBankTransfer.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_OnlineBankTransfer
34
+ extends Payone_Core_Block_Payment_Method_Info_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/info/onlinebanktransfer.phtml');
40
+
41
+ }
42
+
43
+ /**
44
+ * @return string
45
+ */
46
+ public function getOnlinebanktransferType()
47
+ {
48
+ $model = $this->getFactory()->getModelSystemConfigOnlinebanktransferType();
49
+ $array = $model->toSelectArray();
50
+ return $array[$this->getInfo()->getPayoneOnlinebanktransferType()];
51
+ }
52
+
53
+ /**
54
+ * @return string
55
+ */
56
+ public function getPayoneAccountNumber()
57
+ {
58
+ return $this->getInfo()->getPayoneAccountNumber();
59
+ }
60
+
61
+ /**
62
+ * @return string
63
+ */
64
+ public function getPayoneBankCode()
65
+ {
66
+ return $this->getInfo()->getPayoneBankCode();
67
+ }
68
+ }
app/code/community/Payone/Core/Block/Payment/Method/Info/Wallet.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Block
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Block
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Block_Payment_Method_Info_Wallet
34
+ extends Payone_Core_Block_Payment_Method_Info_Abstract
35
+ {
36
+ protected function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('payone/core/payment/method/info/wallet.phtml');
40
+
41
+ }
42
+ }
app/code/community/Payone/Core/Controller/Abstract.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Controller
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Controller
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Controller_Abstract
34
+ extends Mage_Core_Controller_Front_Action
35
+ {
36
+ /** @var Payone_Core_Model_Factory */
37
+ protected $factory = null;
38
+
39
+ /** @var Payone_Core_Helper_Data */
40
+ protected $helper = null;
41
+
42
+ /**
43
+ * @return Payone_Core_Helper_Config
44
+ */
45
+ protected function helperConfig(){
46
+ return $this->getFactory()->helperConfig();
47
+ }
48
+
49
+ /**
50
+ * @param Payone_Core_Model_Factory $factory
51
+ */
52
+ public function setFactory(Payone_Core_Model_Factory $factory)
53
+ {
54
+ $this->factory = $factory;
55
+ }
56
+
57
+ /**
58
+ * @return Payone_Core_Model_Factory
59
+ */
60
+ public function getFactory()
61
+ {
62
+ if ($this->factory === null) {
63
+ $this->factory = Mage::getModel('payone_core/factory');
64
+ }
65
+ return $this->factory;
66
+ }
67
+
68
+ /**
69
+ * @return Payone_Core_Helper_Data
70
+ */
71
+ protected function helper()
72
+ {
73
+ if ($this->helper === null) {
74
+ $this->helper = $this->getFactory()->helper();
75
+ }
76
+ return $this->helper;
77
+ }
78
+ }
app/code/community/Payone/Core/Controller/Adminhtml/Abstract.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Controller
17
+ * @subpackage Adminhtml
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Controller
28
+ * @subpackage Adminhtml
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Controller_Adminhtml_Abstract extends Mage_Adminhtml_Controller_Action
34
+ {
35
+ /** @var Payone_Core_Model_Factory */
36
+ protected $factory = null;
37
+
38
+ /**
39
+ * @return Payone_Core_Helper_Config
40
+ */
41
+ protected function helperConfig()
42
+ {
43
+ return $this->getFactory()->helperConfig();
44
+ }
45
+
46
+ /**
47
+ * @return Payone_Core_Helper_Data
48
+ */
49
+ public function helper()
50
+ {
51
+ return $this->getFactory()->helper();
52
+ }
53
+
54
+ /**
55
+ * @param Payone_Core_Model_Factory $factory
56
+ */
57
+ public function setFactory(Payone_Core_Model_Factory $factory)
58
+ {
59
+ $this->factory = $factory;
60
+ }
61
+
62
+ /**
63
+ * @return Payone_Core_Model_Factory
64
+ */
65
+ public function getFactory()
66
+ {
67
+ if ($this->factory === null) {
68
+ $this->factory = Mage::getModel('payone_core/factory');
69
+ }
70
+ return $this->factory;
71
+ }
72
+ }
app/code/community/Payone/Core/Controller/Adminhtml/Configuration/Wizard/Abstract.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Configuration_Wizard
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml_Configuration_Wizard
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Controller_Adminhtml_Configuration_Wizard_Abstract
34
+ extends Payone_Core_Controller_Adminhtml_Abstract
35
+ {
36
+ protected function _isSectionAllowed($section)
37
+ {
38
+ try {
39
+ $session = Mage::getSingleton('admin/session');
40
+ $resourceLookup = "admin/system/config/{$section}";
41
+ if ($session->getData('acl') instanceof Mage_Admin_Model_Acl) {
42
+ $resourceId = $session->getData('acl')->get($resourceLookup)->getResourceId();
43
+ if (!$session->isAllowed($resourceId)) {
44
+ throw new Exception('');
45
+ }
46
+ return true;
47
+ }
48
+ }
49
+ catch (Zend_Acl_Exception $e) {
50
+ $this->norouteAction();
51
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
52
+ return false;
53
+ }
54
+ catch (Exception $e) {
55
+ $this->deniedAction();
56
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
57
+ return false;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * @param $actionName
63
+ * @return Varien_Object
64
+ */
65
+ protected function initConfig($actionName)
66
+ {
67
+ return $this->helperWizard()->initConfig($actionName, $this->getRequest());
68
+ }
69
+
70
+ /**
71
+ * @return Payone_Core_Helper_Wizard
72
+ */
73
+ public function helperWizard()
74
+ {
75
+ return Mage::helper('payone_core/wizard');
76
+ }
77
+ }
app/code/community/Payone/Core/Exception/InvalidRequestType.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_InvalidRequestType extends Exception
34
+ {
35
+
36
+ }
app/code/community/Payone/Core/Exception/InvoicePreparationNoItems.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_InvoicePreparationNoItems extends Exception
34
+ {
35
+
36
+ }
app/code/community/Payone/Core/Exception/InvoiceSave.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_InvoiceSave extends Exception
34
+ {
35
+
36
+ }
app/code/community/Payone/Core/Exception/OrderCannotInvoice.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_OrderCannotInvoice extends Exception
34
+ {
35
+
36
+ }
app/code/community/Payone/Core/Exception/OrderNotFound.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_OrderNotFound extends Exception
34
+ {
35
+
36
+ }
app/code/community/Payone/Core/Exception/PaymentMethodConfigNotFound.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_PaymentMethodConfigNotFound extends Exception
34
+ {
35
+ }
app/code/community/Payone/Core/Exception/PaymentTypeNotFound.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_PaymentTypeNotFound extends Exception
34
+ {
35
+
36
+ /**
37
+ *
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct('Unknown Payment Type');
42
+ }
43
+ }
app/code/community/Payone/Core/Exception/TransactionAlreadyExists.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Christian Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_TransactionAlreadyExists extends Exception
34
+ {
35
+
36
+ }
app/code/community/Payone/Core/Exception/TransactionStatusForward.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Exception
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Exception
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Exception_TransactionStatusForward extends Exception
34
+ {
35
+
36
+ }
app/code/community/Payone/Core/Helper/Abstract.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Helper
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Helper
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Helper_Abstract extends Mage_Core_Helper_Abstract
34
+ {
35
+ /**
36
+ *
37
+ * @var Payone_Core_Model_Factory
38
+ */
39
+ protected $factory = null;
40
+
41
+ /**
42
+ * @var Payone_Core_Helper_Config
43
+ */
44
+ protected $helperConfig = null;
45
+
46
+ /**
47
+ * @return Payone_Core_Helper_Config
48
+ */
49
+ protected function helperConfig()
50
+ {
51
+ if (is_null($this->helperConfig)) {
52
+ $this->helperConfig = $this->getFactory()->helperConfig();
53
+ }
54
+ return $this->helperConfig;
55
+ }
56
+
57
+ /**
58
+ *
59
+ * @return Payone_Core_Model_Factory
60
+ */
61
+ public function getFactory()
62
+ {
63
+ if ($this->factory === null) {
64
+ $this->factory = new Payone_Core_Model_Factory();
65
+ }
66
+ return $this->factory;
67
+ }
68
+
69
+ /**
70
+ *
71
+ * @param Payone_Core_Model_Factory $factory
72
+ */
73
+ public function setFactory(Payone_Core_Model_Factory $factory)
74
+ {
75
+ $this->factory = $factory;
76
+ }
77
+
78
+ }
app/code/community/Payone/Core/Helper/Config.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Helper
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Helper
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Helper_Config
34
+ extends Payone_Core_Helper_Abstract
35
+ {
36
+ const CONFIG_KEY_CREDITRATING_SAMPLE_COUNTER = 'payone_creditrating_sample_counter';
37
+
38
+ /**
39
+ * @param int $storeId
40
+ * @return bool|Payone_Core_Model_Config_Interface
41
+ */
42
+ public function getConfigStore($storeId = null)
43
+ {
44
+ $config = $this->getFactory()->getServiceInitializeConfig()->execute($storeId);
45
+ return $config;
46
+ }
47
+
48
+ /**
49
+ * @param int $storeId
50
+ * @return Payone_Core_Model_Config_General
51
+ */
52
+ public function getConfigGeneral($storeId = null)
53
+ {
54
+ return $this->getConfigStore($storeId)->getGeneral();
55
+ }
56
+
57
+ /**
58
+ * @param int $storeId
59
+ * @return Payone_Core_Model_Config_Protect
60
+ */
61
+ public function getConfigProtect($storeId = null)
62
+ {
63
+ return $this->getConfigStore($storeId)->getProtect();
64
+ }
65
+
66
+ /**
67
+ * @param int $storeId
68
+ * @return Payone_Core_Model_Config_Misc
69
+ */
70
+ public function getConfigMisc($storeId = null)
71
+ {
72
+ return $this->getConfigStore($storeId)->getMisc();
73
+ }
74
+
75
+ /**
76
+ * @param int $storeId
77
+ * @return Payone_Core_Model_Config_Payment
78
+ */
79
+ public function getConfigPayment($storeId = null)
80
+ {
81
+ return $this->getConfigStore($storeId)->getPayment();
82
+ }
83
+
84
+ /**
85
+ * @param int $id
86
+ * @param int $storeId
87
+ * @return bool|Payone_Core_Model_Config_Payment_Method_Interface
88
+ */
89
+ public function getConfigPaymentMethodById($id, $storeId = null)
90
+ {
91
+ $configPayment = $this->getConfigPayment($storeId);
92
+ $config = $configPayment->getMethodById($id);
93
+ return $config;
94
+ }
95
+
96
+ /**
97
+ * Retrieve the payment configuration that was used in an order
98
+ *
99
+ * @param Mage_Sales_Model_Order $order
100
+ * @return Payone_Core_Model_Config_Payment
101
+ */
102
+ public function getConfigPaymentByOrder(Mage_Sales_Model_Order $order)
103
+ {
104
+ return $this->getConfigPayment($order->getStoreId());
105
+ }
106
+
107
+ /**
108
+ * Retrieve the payment configuration that is used in a quote
109
+ *
110
+ * @param Mage_Sales_Model_Quote $quote
111
+ * @return Payone_Core_Model_Config_Payment
112
+ */
113
+ public function getConfigPaymentByQuote(Mage_Sales_Model_Quote $quote)
114
+ {
115
+ return $this->getConfigPayment($quote->getStoreId());
116
+ }
117
+
118
+ /**
119
+ * Retrieve the paymentMethod configuration that was used in an order
120
+ *
121
+ * @param Mage_Sales_Model_Order $order
122
+ * @return bool|Payone_Core_Model_Config_Payment_Method_Interface
123
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
124
+ */
125
+ public function getConfigPaymentMethodByOrder(Mage_Sales_Model_Order $order)
126
+ {
127
+ $configId = $order->getPayment()->getData('payone_config_payment_method_id');
128
+ if (!$configId) {
129
+ $message = 'Payment method configuration with id "' . $configId . '" not found.';
130
+ throw new Payone_Core_Exception_PaymentMethodConfigNotFound($message);
131
+ }
132
+ $config = $this->getConfigPaymentMethodById($configId, $order->getStoreId());
133
+ return $config;
134
+ }
135
+
136
+ /**
137
+ * Retrieve the paymentMethod configuration that is used in a quote
138
+ *
139
+ * @param Mage_Sales_Model_Quote $quote
140
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
141
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
142
+ */
143
+ public function getConfigPaymentMethodByQuote(Mage_Sales_Model_Quote $quote)
144
+ {
145
+ $configId = $quote->getPayment()->getData('payone_config_payment_method_id');
146
+ if (!$configId) {
147
+ $message = 'Payment method configuration with id "' . $configId . '" not found.';
148
+ throw new Payone_Core_Exception_PaymentMethodConfigNotFound($message);
149
+ }
150
+ $config = $this->getConfigPaymentMethodById($configId, $quote->getStoreId());
151
+ return $config;
152
+ }
153
+
154
+ /**
155
+ * Retrieve the paymentMethod configuration that is used in a quote
156
+ *
157
+ * @param string $method
158
+ * @param Mage_Sales_Model_Quote $quote
159
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
160
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
161
+ */
162
+ public function getConfigPaymentMethodForQuote($method, Mage_Sales_Model_Quote $quote)
163
+ {
164
+ $configPayment = $this->getConfigPayment($quote->getStoreId());
165
+ $config = $configPayment->getMethodForQuote($method, $quote);
166
+ return $config;
167
+ }
168
+
169
+ public function getShippingTaxClassId($storeId)
170
+ {
171
+ return $this->getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $storeId);
172
+ }
173
+
174
+ /**
175
+ * Retrieve the creditrating sample counter from config
176
+ *
177
+ * @param int $storeId
178
+ * @return int
179
+ */
180
+ public function getCreditratingSampleCounter($storeId)
181
+ {
182
+ $counter = $this->getStoreConfig(self::CONFIG_KEY_CREDITRATING_SAMPLE_COUNTER, $storeId);
183
+ if (empty($counter) or !is_numeric($counter)) {
184
+ $counter = 0;
185
+ }
186
+ return $counter;
187
+ }
188
+
189
+ /**
190
+ * Store new value for creditrating sample counter in config
191
+ * @param $count
192
+ * @param $storeId
193
+ */
194
+ public function setCreditratingSampleCounter($count, $storeId)
195
+ {
196
+ Mage::getConfig()->saveConfig(self::CONFIG_KEY_CREDITRATING_SAMPLE_COUNTER, $count, 'stores', $storeId);
197
+ }
198
+
199
+ /**
200
+ * Increment creditrating sample counter in config
201
+ *
202
+ * @param $storeId
203
+ * @return int Returns the new counter value
204
+ */
205
+ public function incrementCreditratingSampleCounter($storeId)
206
+ {
207
+ $counter = $this->getCreditratingSampleCounter($storeId);
208
+
209
+ if (empty($counter) or !is_numeric($counter)) {
210
+ $counter = 0;
211
+ }
212
+ $counter += 1;
213
+
214
+ $this->setCreditratingSampleCounter($counter, $storeId);
215
+
216
+ return $counter;
217
+ }
218
+
219
+ /**
220
+ *
221
+ * @param string $path
222
+ * @param int $storeId
223
+ * @return mixed
224
+ */
225
+ public function getStoreConfig($path, $storeId = null)
226
+ {
227
+ return Mage::getStoreConfig($path, $storeId);
228
+ }
229
+ }
app/code/community/Payone/Core/Helper/Data.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Helper
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Helper
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Helper_Data
34
+ extends Payone_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * Retrieve Payone_Core version from Magento Module Config
38
+ * @return mixed
39
+ */
40
+ public function getPayoneVersion()
41
+ {
42
+ $module = Mage::getConfig()->getNode('modules/Payone_Core')->children();
43
+ $moduleArray = (array)$module;
44
+
45
+ $version = $moduleArray['version'];
46
+
47
+ return $version;
48
+ }
49
+
50
+ /**
51
+ * Retrieve Magento version
52
+ *
53
+ * @return mixed
54
+ */
55
+ public function getMagentoVersion()
56
+ {
57
+ return Mage::getVersion();
58
+ }
59
+
60
+ /**
61
+ * Retrieve Magento edition
62
+ *
63
+ * @return mixed
64
+ */
65
+ public function getMagentoEdition()
66
+ {
67
+ if (version_compare($this->getMagentoVersion(), '1.7', '>=')) {
68
+ // getEdition is only available after Magentoversion 1.7.0.0
69
+ $edition = Mage::getEdition();
70
+ switch ($edition) {
71
+ case Mage::EDITION_COMMUNITY :
72
+ $edition = 'CE';
73
+ break;
74
+ case Mage::EDITION_ENTERPRISE :
75
+ $edition = 'EE';
76
+ break;
77
+ case Mage::EDITION_PROFESSIONAL :
78
+ $edition = 'PE';
79
+ break;
80
+ case Mage::EDITION_GO :
81
+ $edition = 'GO';
82
+ break;
83
+ }
84
+ }
85
+ else {
86
+ // Check for different Licensetypes to get Magento-Edition
87
+ $path = Mage::getBaseDir();
88
+ if (file_exists($path . DS . 'LICENSE_EE.txt')) {
89
+ $edition = 'EE';
90
+ }
91
+ elseif (file_exists($path . DS . 'LICENSE_PRO.html')) {
92
+ $edition = 'PE';
93
+ }
94
+ else {
95
+ $edition = 'CE';
96
+ }
97
+ }
98
+ return $edition;
99
+ }
100
+
101
+ /**
102
+ * @return int
103
+ */
104
+ public function getCurrentMagentoStoreId()
105
+ {
106
+ return $this->getCurrentMagentoStore()->getId();
107
+ }
108
+
109
+ /**
110
+ * @return Mage_Core_Model_Store
111
+ */
112
+ public function getCurrentMagentoStore()
113
+ {
114
+ return Mage::app()->getStore();
115
+
116
+ }
117
+
118
+ /**
119
+ * Retrieve complete Magento Url
120
+ *
121
+ * @param string $controllerAction in the form "module/controller/action"
122
+ * @return string
123
+ */
124
+ public function getMagentoUrl($controllerAction)
125
+ {
126
+ return Mage::getUrl($controllerAction, array('_nosid' => true));
127
+ }
128
+
129
+ /**
130
+ * Format Magento Adress "street" into one string.
131
+ *
132
+ * @param $street
133
+ * @return string
134
+ */
135
+ public function normalizeStreet($street)
136
+ {
137
+ if (!is_array($street)) {
138
+ return $street;
139
+ }
140
+ return implode(' ', $street);
141
+ }
142
+
143
+ /**
144
+ * @return string
145
+ */
146
+ public function getDefaultLanguage()
147
+ {
148
+ $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
149
+ if (is_array($locale) && !empty($locale)) {
150
+ $locale = $locale[0];
151
+ }
152
+ else {
153
+ $locale = 'en';
154
+ }
155
+
156
+ return $locale;
157
+ }
158
+
159
+ /**
160
+ * Converts timezone from "GMT" to locale timezone
161
+ * @param $string
162
+ * @return string|null
163
+ */
164
+ public function getLocaleDatetime($string)
165
+ {
166
+ $localeTimeZone = $this->helperConfig()->getStoreConfig('general/locale/timezone');
167
+
168
+ if ($string == '0000-00-00 00:00:00' || $string == null) {
169
+ return null;
170
+ }
171
+ else {
172
+ $datetime = new DateTime($string, new DateTimeZone('GMT'));
173
+ $datetime->setTimezone(new DateTimeZone($localeTimeZone));
174
+ return $datetime->format('d.m.Y H:i:s');
175
+ }
176
+ }
177
+
178
+ /**
179
+ * @param string $date The date to test, in a format that can be parsed via strtotime(), e.g.
180
+ * @param int $validForSeconds How long the date stays valid
181
+ *
182
+ * @return bool
183
+ */
184
+ public function isDateStillValid($date, $validForSeconds)
185
+ {
186
+ $now = strtotime(now());
187
+ $date = strtotime($date);
188
+
189
+ $secondsElapsed = $now - $date;
190
+
191
+ if ($secondsElapsed > $validForSeconds) {
192
+ return false; // Allowed time has elapsed
193
+ }
194
+ return true;
195
+
196
+ }
197
+
198
+ /**
199
+ * Creates a hash from an addresses key data
200
+ *
201
+ * @param Mage_Customer_Model_Address_Abstract $address
202
+ * @return string
203
+ */
204
+ public function createAddressHash(Mage_Customer_Model_Address_Abstract $address)
205
+ {
206
+ $values = $address->getFirstname() . $address->getLastname() . $address->getStreetFull() . $address->getPostcode() . $address->getCity() . $address->getRegionCode() . $address->getCountry();
207
+
208
+ $hash = md5($values);
209
+
210
+ return $hash;
211
+ }
212
+
213
+ }
app/code/community/Payone/Core/Helper/Email.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Helper
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Helper
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Helper_Email extends Payone_Core_Helper_Abstract
34
+ {
35
+ /**
36
+ * @var Mage_Core_Model_Email_Template
37
+ */
38
+ protected $emailTemplate;
39
+
40
+ /** @var mixed */
41
+ protected $storeId = null;
42
+
43
+ /**
44
+ * @param string $errorName
45
+ * @param string $errorMessage
46
+ * @param string $stacktrace
47
+ * @param array $additional
48
+ * @return bool
49
+ */
50
+ public function sendEmailError($errorName, $errorMessage, $stacktrace = '', $additional = array())
51
+ {
52
+ $parameters = array(
53
+ 'error_name' => $errorName,
54
+ 'error_message' => $errorMessage,
55
+ 'error_stacktrace' => $stacktrace,
56
+ );
57
+ if (count($additional)) {
58
+ $parameters = array_merge($additional, $parameters);
59
+ }
60
+
61
+ $storeId = $this->getStoreId();
62
+ $config = $this->helperConfig()->getConfigMisc($storeId)->getEmailError();
63
+
64
+ return $this->send($config, $parameters);
65
+ }
66
+
67
+ /**
68
+ *
69
+ * @param Payone_Core_Model_Config_Misc_Email_Interface $config
70
+ * @param array $parameters
71
+ * @return bool
72
+ */
73
+ public function send(Payone_Core_Model_Config_Misc_Email_Interface $config, array $parameters = array())
74
+ {
75
+ if (!$config->isEnabled()) {
76
+ return false;
77
+ }
78
+ if ($config->getFrom() == '' or $config->getTo() == '') {
79
+ return false;
80
+ }
81
+
82
+ /**
83
+ * @var $emailTemplate Mage_Core_Model_Email_Template
84
+ */
85
+ $emailTemplate = $this->getEmailTemplate();
86
+
87
+ // From
88
+ $identFrom = $this->getTransEmailIdentity($config->getFrom());
89
+ $emailTemplate->setSenderName($identFrom['name']);
90
+ $emailTemplate->setSenderEmail($identFrom['email']);
91
+
92
+ // To
93
+ $identTo = $this->getTransEmailIdentity($config->getTo());
94
+ $names = array(
95
+ $identTo['name']
96
+ );
97
+ $emails = array(
98
+ $identTo['email']
99
+ );
100
+
101
+ // Bcc
102
+ $bcc = $config->getBcc();
103
+ if ($bcc != '') {
104
+ $bccArray = explode(',', $bcc);
105
+
106
+ foreach ($bccArray as $key => $bccEmail) {
107
+ if ($bccEmail == '') {
108
+ continue;
109
+ }
110
+ array_push($emails, $bccEmail);
111
+ }
112
+ }
113
+
114
+ // Template
115
+ $template = $config->getTemplate();
116
+ $emailTemplate->loadDefault($template);
117
+
118
+ // Send Mail
119
+ return $emailTemplate->send($emails, $names, $parameters);
120
+ }
121
+
122
+ /**
123
+ * @param $identity
124
+ * @return array
125
+ */
126
+ protected function getTransEmailIdentity($identity)
127
+ {
128
+ $storeId = $this->getStoreId();
129
+
130
+ $name = $this->helperConfig()->getStoreConfig('trans_email/ident_' . $identity . '/name', $storeId);
131
+ $email = $this->helperConfig()->getStoreConfig('trans_email/ident_' . $identity . '/email', $storeId);
132
+
133
+ return array(
134
+ 'name' => $name,
135
+ 'email' => $email,
136
+ );
137
+ }
138
+
139
+ /**
140
+ * @param Mage_Core_Model_Email_Template $emailTemplate
141
+ */
142
+ public function setEmailTemplate(Mage_Core_Model_Email_Template $emailTemplate)
143
+ {
144
+ $this->emailTemplate = $emailTemplate;
145
+ }
146
+
147
+ /**
148
+ * @return Mage_Core_Model_Email_Template
149
+ */
150
+ public function getEmailTemplate()
151
+ {
152
+ if($this->emailTemplate === null){
153
+ $this->emailTemplate = $this->getFactory()->getModelEmailTemplate();
154
+ }
155
+ return $this->emailTemplate;
156
+ }
157
+
158
+ /**
159
+ * @param mixed $storeId
160
+ */
161
+ public function setStoreId($storeId)
162
+ {
163
+ $this->storeId = $storeId;
164
+ }
165
+
166
+ /**
167
+ * @return mixed
168
+ */
169
+ public function getStoreId()
170
+ {
171
+ return $this->storeId;
172
+ }
173
+ }
app/code/community/Payone/Core/Helper/Sales/Button.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Helper
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Helper
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Helper_Sales_Button
34
+ extends Payone_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * @return array
38
+ */
39
+ public function getPayoneInvoicePdf()
40
+ {
41
+ /**
42
+ * @var $invoice Mage_Sales_Model_Order_Invoice
43
+ */
44
+ $invoice = Mage::registry('current_invoice');
45
+ $order = $invoice->getOrder();
46
+ $configPayment = $this->helperConfig()->getConfigPaymentMethodByOrder($order);
47
+ $data = array(
48
+ 'label' => $this->helperConfig()->__('Download PAYONE-Invoice'),
49
+ 'class' => 'save',
50
+ 'onclick' => 'setLocation(\'' . $this->getDownloadInvoiceUrl() . '\')',
51
+ );
52
+ if (!$configPayment || !$configPayment->isInvoiceTransmitEnabled() || $this->isAllowedAction('download_payone_invoice') === false) {
53
+ $data['disabled'] = 1;
54
+ }
55
+
56
+ return $data;
57
+ }
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ protected function getDownloadInvoiceUrl()
63
+ {
64
+ /** @var $invoice Mage_Sales_Model_Order_Invoice */
65
+ $invoice = Mage::registry('current_invoice');
66
+
67
+ $url = $this->getUrl('payone_core/adminhtml_sales_order_invoice/getInvoice', array('invoice_id' => $invoice->getId()));
68
+ return $url;
69
+ }
70
+
71
+ /**
72
+ * @param $action
73
+ * @return mixed
74
+ */
75
+ protected function isAllowedAction($action)
76
+ {
77
+ return Mage::getSingleton('admin/session')->isAllowed('sales/order/invoice/actions/' . $action);
78
+ }
79
+
80
+ /**
81
+ * @return Mage_Core_Model_Url
82
+ */
83
+ protected function getUrlModel()
84
+ {
85
+ return Mage::getModel('adminhtml/url');
86
+ }
87
+
88
+ /**
89
+ * Generate url by route and parameters
90
+ *
91
+ * @param string $route
92
+ * @param array $params
93
+ *
94
+ * @return string
95
+ */
96
+ public function getUrl($route = '', $params = array())
97
+ {
98
+ return $this->getUrlModel()->getUrl($route, $params);
99
+ }
100
+ }
app/code/community/Payone/Core/Helper/Url.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Helper
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Helper
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Helper_Url
34
+ extends Payone_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * Retrieve complete Magento Url
38
+ *
39
+ * @param string $controllerAction in the form "module/controller/action"
40
+ * @return string
41
+ */
42
+ public function getMagentoUrl($controllerAction)
43
+ {
44
+ return Mage::getUrl($controllerAction, array('_nosid' => true));
45
+ }
46
+
47
+ /**
48
+ * @return string
49
+ */
50
+ public function getSuccessUrl()
51
+ {
52
+ $successurl = $this->getMagentoUrl('payone_core/checkout_onepage_payment/success', false);
53
+
54
+ return $successurl;
55
+ }
56
+
57
+ /**
58
+ * @return string
59
+ */
60
+ public function getErrorUrl()
61
+ {
62
+ $errorurl = $this->getMagentoUrl('payone_core/checkout_onepage_payment/error', false);
63
+
64
+ return $errorurl;
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function getBackUrl()
71
+ {
72
+ $backurl = $this->getMagentoUrl('payone_core/checkout_onepage_payment/back', false);
73
+
74
+ return $backurl;
75
+ }
76
+
77
+ }
app/code/community/Payone/Core/Helper/Wizard.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Helper
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Helper
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Helper_Wizard
34
+ extends Payone_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * @var array
38
+ */
39
+ protected $config = array(
40
+ 'migrator' => array(
41
+ 'header_text' => '',
42
+ 'previous_page' => '',
43
+ 'next_page' => 'index',
44
+ ),
45
+ 'index' => array(
46
+ 'header_text' => '',
47
+ 'previous_page' => '',
48
+ 'next_page' => 'generalGlobal',
49
+ ),
50
+ 'generalGlobal' => array(
51
+ 'group_name' => 'global',
52
+ 'header_text' => 'Global Settings',
53
+ 'codes' => array(
54
+ 'page' => 'generalGlobal',
55
+ 'section' => 'payone_general',
56
+ ),
57
+ 'previous_page' => 'index',
58
+ 'next_page' => 'payment',
59
+ ),
60
+ 'payment' => array(
61
+ 'url' => '*/adminhtml_configuration_wizard_page_payment/index',
62
+ 'group_name' => 'payment',
63
+ 'header_text' => 'Payment-Method Configuration',
64
+ 'codes' => array(
65
+ 'page' => 'payment',
66
+ 'section' => 'payone_payment',
67
+ ),
68
+ 'previous_page' => 'generalGlobal',
69
+ 'next_page' => 'riskAddressCheck',
70
+ ),
71
+ 'riskAddressCheck' => array(
72
+ 'group_name' => 'address_check',
73
+ 'header_text' => 'Addresscheck',
74
+ 'codes' => array(
75
+ 'page' => 'riskAddressCheck',
76
+ 'section' => 'payone_protect',
77
+ ),
78
+ 'previous_page' => 'payment',
79
+ 'next_page' => 'riskCreditrating',
80
+ ),
81
+ 'riskCreditrating' => array(
82
+ 'group_name' => 'creditrating',
83
+ 'header_text' => 'Creditrating',
84
+ 'codes' => array(
85
+ 'page' => 'riskCreditrating',
86
+ 'section' => 'payone_protect',
87
+ ),
88
+ 'previous_page' => 'riskAddressCheck',
89
+ 'next_page' => 'finish'
90
+ ),
91
+ 'finish' => array(
92
+ 'header_text' => '',
93
+ 'previous_page' => 'riskCreditrating',
94
+ 'next_page' => '',
95
+ ),
96
+ );
97
+
98
+ /**
99
+ * @param $actionName
100
+ * @param $request
101
+ * @return Varien_Object
102
+ */
103
+ public function initConfig($actionName, $request)
104
+ {
105
+ $config = new Varien_Object($this->config);
106
+ $this->registerConfig($config);
107
+
108
+ $configPages = $this->initConfigPage($actionName);
109
+ $configPages = new Varien_Object($configPages);
110
+
111
+ $codes = $configPages->getData('codes');
112
+
113
+ $codes['website'] = $request->getParam('website');
114
+ $codes['store'] = $request->getParam('store');
115
+
116
+ $configPages->setData('codes', $codes);
117
+
118
+ $this->registerConfigPage($configPages);
119
+ return $configPages;
120
+ }
121
+
122
+ /**
123
+ * @return Varien_Object
124
+ */
125
+ public function getConfig()
126
+ {
127
+ /** @var $config Varien_Object */
128
+ return Mage::registry('payone_wizard_config');
129
+ }
130
+
131
+ /**
132
+ * @param Varien_Object $config
133
+ */
134
+ public function registerConfig(Varien_Object $config)
135
+ {
136
+ Mage::register('payone_wizard_config', $config);
137
+ }
138
+
139
+ /**
140
+ * @return Varien_Object
141
+ */
142
+ public function getConfigPage()
143
+ {
144
+ /** @var $config Varien_Object */
145
+ $config = Mage::registry('payone_wizard_config_page');
146
+ return $config;
147
+ }
148
+
149
+ /**
150
+ * @param Varien_Object $config
151
+ */
152
+ public function registerConfigPage(Varien_Object $config)
153
+ {
154
+ Mage::register('payone_wizard_config_page', $config);
155
+ }
156
+
157
+ /**
158
+ * @param $page
159
+ * @return array|null
160
+ */
161
+ public function initConfigPage($page)
162
+ {
163
+ if (!array_key_exists($page, $this->config)) {
164
+ return null;
165
+ }
166
+ return $this->config[$page];
167
+ }
168
+
169
+ /**
170
+ * @return array
171
+ */
172
+ public function initConfigArray()
173
+ {
174
+ return $this->config;
175
+ }
176
+
177
+ public function getNextPageUrlAsString()
178
+ {
179
+ $pageName = $this->getConfigPage()->getData('next_page');
180
+ $url = $this->getPageUrlAsString($pageName);
181
+ return $url;
182
+ }
183
+
184
+ public function getPreviousPageUrlAsString()
185
+ {
186
+ $pageName = $this->getConfigPage()->getData('previous_page');
187
+ $url = $this->getPageUrlAsString($pageName);
188
+ return $url;
189
+ }
190
+
191
+ public function getPageUrlAsString($nextPageName)
192
+ {
193
+ $config = $this->getConfig();
194
+ $nextPage = $config->getData($nextPageName);
195
+ if (array_key_exists('url', $nextPage)) {
196
+ $url = $nextPage['url'];
197
+ }
198
+ else {
199
+ $url = '*/adminhtml_configuration_wizard_page/' . $nextPageName;
200
+ }
201
+ return $url;
202
+ }
203
+
204
+ public function getNextPageCode($pageCode)
205
+ {
206
+ $pages = $this->initConfigPage($pageCode);
207
+
208
+ if ($pages === null) {
209
+ return 'index';
210
+ }
211
+ if (!array_key_exists('next_page', $pages)) {
212
+ return 'index';
213
+ }
214
+
215
+ $nextPageKey = $pages['next_page'];
216
+
217
+ return $nextPageKey;
218
+ }
219
+
220
+ public function getConfigButton($label, $onClick)
221
+ {
222
+ return array(
223
+ 'label' => $this->__($label),
224
+ 'class' => 'default',
225
+ 'onclick' => $onClick,
226
+ );
227
+ }
228
+
229
+ public function getConfigButtonFinish()
230
+ {
231
+ $onClick = 'parent.window.wizardPopup.close()';
232
+ return $this->getConfigButton('Finish', $onClick);
233
+ }
234
+
235
+ }
app/code/community/Payone/Core/Model/Config.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config implements Payone_Core_Model_Config_Interface
34
+ {
35
+ /**
36
+ * @var int
37
+ */
38
+ protected $storeId = null;
39
+
40
+ /**
41
+ * @var Payone_Core_Model_Config_General
42
+ */
43
+ protected $general = null;
44
+ /**
45
+ * @var Payone_Core_Model_Config_Payment
46
+ */
47
+ protected $payment = null;
48
+ /**
49
+ * @var Payone_Core_Model_Config_Protect
50
+ */
51
+ protected $protect = null;
52
+ /**
53
+ * @var Payone_Core_Model_Config_Misc
54
+ */
55
+ protected $misc = null;
56
+
57
+ /**
58
+ * @param int $storeId
59
+ */
60
+ public function setStoreId($storeId)
61
+ {
62
+ $this->storeId = $storeId;
63
+ }
64
+
65
+ /**
66
+ * @return int
67
+ */
68
+ public function getStoreId()
69
+ {
70
+ return $this->storeId;
71
+ }
72
+
73
+ /**
74
+ * @param Payone_Core_Model_Config_General $general
75
+ */
76
+ public function setGeneral(Payone_Core_Model_Config_General $general)
77
+ {
78
+ $this->general = $general;
79
+ }
80
+
81
+ /**
82
+ * @return Payone_Core_Model_Config_General
83
+ */
84
+ public function getGeneral()
85
+ {
86
+ return $this->general;
87
+ }
88
+
89
+ /**
90
+ * @param Payone_Core_Model_Config_Misc $misc
91
+ */
92
+ public function setMisc(Payone_Core_Model_Config_Misc $misc)
93
+ {
94
+ $this->misc = $misc;
95
+ }
96
+
97
+ /**
98
+ * @return Payone_Core_Model_Config_Misc
99
+ */
100
+ public function getMisc()
101
+ {
102
+ return $this->misc;
103
+ }
104
+
105
+ /**
106
+ * @param Payone_Core_Model_Config_Payment $payment
107
+ */
108
+ public function setPayment(Payone_Core_Model_Config_Payment $payment)
109
+ {
110
+ $this->payment = $payment;
111
+ }
112
+
113
+ /**
114
+ * @return Payone_Core_Model_Config_Payment
115
+ */
116
+ public function getPayment()
117
+ {
118
+ return $this->payment;
119
+ }
120
+
121
+ /**
122
+ * @param Payone_Core_Model_Config_Protect $protect
123
+ */
124
+ public function setProtect(Payone_Core_Model_Config_Protect $protect)
125
+ {
126
+ $this->protect = $protect;
127
+ }
128
+
129
+ /**
130
+ * @return Payone_Core_Model_Config_Protect
131
+ */
132
+ public function getProtect()
133
+ {
134
+ return $this->protect;
135
+ }
136
+
137
+ }
app/code/community/Payone/Core/Model/Config/AreaAbstract.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Config_AreaAbstract implements Payone_Core_Model_Config_AreaInterface
34
+ {
35
+ public function __construct(array $data = array())
36
+ {
37
+ if (count($data)) {
38
+ $this->init($data);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * this method is used to initialize an empty / fresh instance
44
+ * and furthermore it is used to to adjust specific parameters from an array
45
+ *
46
+ * if you want the instance to be cleared you should create a new instance
47
+ *
48
+ * @param array $data
49
+ */
50
+ public function init(array $data)
51
+ {
52
+ foreach ($data as $key => $value) {
53
+ $this->setValue($key, $value);
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @param string $key
59
+ * @param mixed $value
60
+ */
61
+ public function setValue($key, $value)
62
+ {
63
+ $method = 'set' . uc_words($key, '');
64
+
65
+ if (method_exists($this, $method)) {
66
+ $this->{$method}($value);
67
+ }
68
+ }
69
+ /**
70
+ * @param string $type
71
+ * @return array|null
72
+ */
73
+ public function getValue($type)
74
+ {
75
+ $method = 'get' . uc_words($type, '');
76
+ if (method_exists($this, $method)) {
77
+ return $this->{$method}();
78
+ }
79
+ return null;
80
+ }
81
+
82
+ /**
83
+ * @return array
84
+ */
85
+ public function toArray()
86
+ {
87
+ $result = array();
88
+ foreach ($this as $key => $data) {
89
+ if ($data === null) {
90
+ continue;
91
+ }
92
+ if ($data instanceof Payone_Core_Model_Config_AreaInterface) {
93
+ /**
94
+ * @var Payone_Core_Model_Config_AreaInterface $data
95
+ */
96
+ $result = array_merge($result, $data->toArray());
97
+ }
98
+ else {
99
+ $result[$key] = $data;
100
+ }
101
+ }
102
+
103
+ ksort($result);
104
+
105
+ return $result;
106
+ }
107
+
108
+ }
app/code/community/Payone/Core/Model/Config/AreaInterface.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Config_AreaInterface
34
+ {
35
+ /**
36
+ * @param array $data
37
+ */
38
+ public function __construct(array $data = array());
39
+
40
+ /**
41
+ * Initalize Config Object
42
+ *
43
+ * this method is used to initialize an empty / fresh instance
44
+ * and furthermore it is used to to adjust specific parameters from an array
45
+ *
46
+ * if you want the instance to be cleared you should create a new instance
47
+ *
48
+ * @param array $data
49
+ */
50
+ public function init(array $data);
51
+
52
+ /**
53
+ * @return array
54
+ */
55
+ public function toArray();
56
+
57
+ }
app/code/community/Payone/Core/Model/Config/General.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_General extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var Payone_Core_Model_Config_General_Global
37
+ */
38
+ protected $global;
39
+ /**
40
+ * @var Payone_Core_Model_Config_General_ParameterInvoice
41
+ */
42
+ protected $parameter_invoice;
43
+ /**
44
+ * @var Payone_Core_Model_Config_General_StatusMapping
45
+ */
46
+ protected $status_mapping;
47
+ /**
48
+ * @var Payone_Core_Model_Config_General_PaymentCreditcard
49
+ */
50
+ protected $payment_creditcard;
51
+
52
+ /**
53
+ * @var Payone_Core_Model_Config_General_ParameterNarrativeText
54
+ */
55
+ protected $parameter_narrative_text;
56
+
57
+ /**
58
+ * @param Payone_Core_Model_Config_General_Global $global
59
+ */
60
+ public function setGlobal(Payone_Core_Model_Config_General_Global $global)
61
+ {
62
+ $this->global = $global;
63
+ }
64
+
65
+ /**
66
+ * @return Payone_Core_Model_Config_General_Global
67
+ */
68
+ public function getGlobal()
69
+ {
70
+ return $this->global;
71
+ }
72
+
73
+ /**
74
+ * @param Payone_Core_Model_Config_General_ParameterInvoice $parameter_invoice
75
+ */
76
+ public function setParameterInvoice(Payone_Core_Model_Config_General_ParameterInvoice $parameter_invoice)
77
+ {
78
+ $this->parameter_invoice = $parameter_invoice;
79
+ }
80
+
81
+ /**
82
+ * @return Payone_Core_Model_Config_General_ParameterInvoice
83
+ */
84
+ public function getParameterInvoice()
85
+ {
86
+ return $this->parameter_invoice;
87
+ }
88
+
89
+ /**
90
+ * @param Payone_Core_Model_Config_General_PaymentCreditcard $payment_creditcard
91
+ */
92
+ public function setPaymentCreditcard(Payone_Core_Model_Config_General_PaymentCreditcard $payment_creditcard)
93
+ {
94
+ $this->payment_creditcard = $payment_creditcard;
95
+ }
96
+
97
+ /**
98
+ * @return Payone_Core_Model_Config_General_PaymentCreditcard
99
+ */
100
+ public function getPaymentCreditcard()
101
+ {
102
+ return $this->payment_creditcard;
103
+ }
104
+
105
+ /**
106
+ * @param Payone_Core_Model_Config_General_StatusMapping $status_mapping
107
+ */
108
+ public function setStatusMapping(Payone_Core_Model_Config_General_StatusMapping $status_mapping)
109
+ {
110
+ $this->status_mapping = $status_mapping;
111
+ }
112
+
113
+ /**
114
+ * @return Payone_Core_Model_Config_General_StatusMapping
115
+ */
116
+ public function getStatusMapping()
117
+ {
118
+ return $this->status_mapping;
119
+ }
120
+
121
+ /**
122
+ * @param Payone_Core_Model_Config_General_ParameterNarrativeText $parameter_narrative_text
123
+ */
124
+ public function setParameterNarrativeText($parameter_narrative_text)
125
+ {
126
+ $this->parameter_narrative_text = $parameter_narrative_text;
127
+ }
128
+
129
+ /**
130
+ * @return Payone_Core_Model_Config_General_ParameterNarrativeText
131
+ */
132
+ public function getParameterNarrativeText()
133
+ {
134
+ return $this->parameter_narrative_text;
135
+ }
136
+ }
app/code/community/Payone/Core/Model/Config/General/Global.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_General_Global extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var int
37
+ */
38
+ protected $mid = 0;
39
+ /**
40
+ * @var int
41
+ */
42
+ protected $portalid = 0;
43
+ /**
44
+ * @var int
45
+ */
46
+ protected $aid = 0;
47
+ /**
48
+ * @var string
49
+ */
50
+ protected $key = '';
51
+ /**
52
+ * @var int
53
+ */
54
+ protected $allowspecific = 0;
55
+ /**
56
+ * @var array
57
+ */
58
+ protected $specificcountry = array();
59
+ /**
60
+ * @var string
61
+ */
62
+ protected $request_type = '';
63
+
64
+ /**
65
+ * initialize config with specificcounty as array
66
+ * @param array $data
67
+ */
68
+ public function init(array $data)
69
+ {
70
+ if(array_key_exists('specificcountry',$data) && is_string($data['specificcountry']))
71
+ {
72
+ $data['specificcountry_by_string'] = $data['specificcountry'];
73
+ unset($data['specificcountry']);
74
+ }
75
+
76
+ parent::init($data);
77
+ }
78
+
79
+ /**
80
+ * @param int $aid
81
+ */
82
+ public function setAid($aid)
83
+ {
84
+ $this->aid = $aid;
85
+ }
86
+
87
+ /**
88
+ * @return int
89
+ */
90
+ public function getAid()
91
+ {
92
+ return $this->aid;
93
+ }
94
+
95
+ /**
96
+ * @param int $allowspecific
97
+ */
98
+ public function setAllowspecific($allowspecific)
99
+ {
100
+ $this->allowspecific = $allowspecific;
101
+ }
102
+
103
+ /**
104
+ * @return int
105
+ */
106
+ public function getAllowspecific()
107
+ {
108
+ return $this->allowspecific;
109
+ }
110
+
111
+ /**
112
+ * @param string $key
113
+ */
114
+ public function setKey($key)
115
+ {
116
+ $this->key = $key;
117
+ }
118
+
119
+ /**
120
+ * @return string
121
+ */
122
+ public function getKey()
123
+ {
124
+ return $this->key;
125
+ }
126
+
127
+ /**
128
+ * @param int $mid
129
+ */
130
+ public function setMid($mid)
131
+ {
132
+ $this->mid = $mid;
133
+ }
134
+
135
+ /**
136
+ * @return int
137
+ */
138
+ public function getMid()
139
+ {
140
+ return $this->mid;
141
+ }
142
+
143
+ /**
144
+ * @param int $portalid
145
+ */
146
+ public function setPortalid($portalid)
147
+ {
148
+ $this->portalid = $portalid;
149
+ }
150
+
151
+ /**
152
+ * @return int
153
+ */
154
+ public function getPortalid()
155
+ {
156
+ return $this->portalid;
157
+ }
158
+
159
+ /**
160
+ * @param string $request_type
161
+ */
162
+ public function setRequestType($request_type)
163
+ {
164
+ $this->request_type = $request_type;
165
+ }
166
+
167
+ /**
168
+ * @return string
169
+ */
170
+ public function getRequestType()
171
+ {
172
+ return $this->request_type;
173
+ }
174
+
175
+ /**
176
+ * @param array $specificcountry
177
+ */
178
+ public function setSpecificcountry(array $specificcountry)
179
+ {
180
+ $this->specificcountry = $specificcountry;
181
+ }
182
+
183
+ /**
184
+ * @return array
185
+ */
186
+ public function getSpecificcountry()
187
+ {
188
+ return $this->specificcountry;
189
+ }
190
+
191
+ /**
192
+ * @param $specificcountry
193
+ */
194
+ public function setSpecificcountryByString($specificcountry)
195
+ {
196
+ $this->specificcountry = explode(',', $specificcountry);
197
+ }
198
+
199
+ /**
200
+ * @return string
201
+ */
202
+ public function getSpecificcountryAsString()
203
+ {
204
+ return implode(',', $this->specificcountry);
205
+ }
206
+ }
app/code/community/Payone/Core/Model/Config/General/ParameterInvoice.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_General_ParameterInvoice extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var int
37
+ */
38
+ protected $transmit_enabled = 0;
39
+ /**
40
+ * @var string
41
+ */
42
+ protected $invoice_appendix = '';
43
+
44
+ /** @var string */
45
+ protected $invoice_appendix_refund = '';
46
+
47
+ /**
48
+ * @param string $invoice_appendix
49
+ */
50
+ public function setInvoiceAppendix($invoice_appendix)
51
+ {
52
+ $this->invoice_appendix = $invoice_appendix;
53
+ }
54
+
55
+ /**
56
+ * @return string
57
+ */
58
+ public function getInvoiceAppendix()
59
+ {
60
+ return $this->invoice_appendix;
61
+ }
62
+
63
+ /**
64
+ * @param int $transmit_enabled
65
+ */
66
+ public function setTransmitEnabled($transmit_enabled)
67
+ {
68
+ $this->transmit_enabled = $transmit_enabled;
69
+ }
70
+
71
+ /**
72
+ * @return int
73
+ */
74
+ public function getTransmitEnabled()
75
+ {
76
+ return $this->transmit_enabled;
77
+ }
78
+
79
+ /**
80
+ * @param string $invoice_appendix_refund
81
+ */
82
+ public function setInvoiceAppendixRefund($invoice_appendix_refund)
83
+ {
84
+ $this->invoice_appendix_refund = $invoice_appendix_refund;
85
+ }
86
+
87
+ /**
88
+ * @return string
89
+ */
90
+ public function getInvoiceAppendixRefund()
91
+ {
92
+ return $this->invoice_appendix_refund;
93
+ }
94
+ }
app/code/community/Payone/Core/Model/Config/General/ParameterNarrativeText.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_General_ParameterNarrativeText
34
+ extends Payone_Core_Model_Config_AreaAbstract
35
+ {
36
+ /**
37
+ * @var string
38
+ */
39
+ protected $creditcard = '';
40
+ /**
41
+ * @var string
42
+ */
43
+ protected $debit_payment = '';
44
+
45
+ /**
46
+ * @param string $creditcard
47
+ */
48
+ public function setCreditcard($creditcard)
49
+ {
50
+ $this->creditcard = $creditcard;
51
+ }
52
+
53
+ /**
54
+ * @return string
55
+ */
56
+ public function getCreditcard()
57
+ {
58
+ return $this->creditcard;
59
+ }
60
+
61
+ /**
62
+ * @param string $debit_payment
63
+ */
64
+ public function setDebitPayment($debit_payment)
65
+ {
66
+ $this->debit_payment = $debit_payment;
67
+ }
68
+
69
+ /**
70
+ * @return string
71
+ */
72
+ public function getDebitPayment()
73
+ {
74
+ return $this->debit_payment;
75
+ }
76
+ }
app/code/community/Payone/Core/Model/Config/General/PaymentCreditcard.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_General_PaymentCreditcard extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var int
37
+ */
38
+ protected $min_validity_period = 0;
39
+
40
+ /**
41
+ * @param int $min_validity_period
42
+ */
43
+ public function setMinValidityPeriod($min_validity_period)
44
+ {
45
+ $this->min_validity_period = $min_validity_period;
46
+ }
47
+
48
+ /**
49
+ * @return int
50
+ */
51
+ public function getMinValidityPeriod()
52
+ {
53
+ return $this->min_validity_period;
54
+ }
55
+ }
app/code/community/Payone/Core/Model/Config/General/StatusMapping.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_General_StatusMapping extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var null
37
+ */
38
+ protected $creditcard = null;
39
+ /**
40
+ * @var null
41
+ */
42
+ protected $invoice = null;
43
+ /**
44
+ * @var null
45
+ */
46
+ protected $debit_payment = null;
47
+ /**
48
+ * @var null
49
+ */
50
+ protected $advance_payment = null;
51
+ /**
52
+ * @var null
53
+ */
54
+ protected $online_bank_transfer = null;
55
+ /**
56
+ * @var null
57
+ */
58
+ protected $cash_on_delivery = null;
59
+ /**
60
+ * @var null
61
+ */
62
+ protected $wallet = null;
63
+
64
+ public function init(array $data)
65
+ {
66
+ foreach ($data as $key => $value) {
67
+ if (is_string($value)) {
68
+ $value = $this->initValue($value);
69
+ }
70
+ $this->setValue($key, $value);
71
+ }
72
+ }
73
+
74
+ /**
75
+ * @param string $value
76
+ * @return array|null
77
+ */
78
+ protected function initValue($value)
79
+ {
80
+ $return = array();
81
+ $raw = unserialize($value);
82
+ if (!is_array($raw)) {
83
+ return null;
84
+ }
85
+
86
+ foreach ($raw as $key => $data) {
87
+ $txaction = $orderStatus = '';
88
+ if (array_key_exists('txaction', $data)) {
89
+ $txaction = array_shift($data['txaction']);
90
+ }
91
+ if (array_key_exists('status', $data)) {
92
+ $orderStatus = array_shift($data['status']);
93
+ }
94
+ if ($txaction == '' and $orderStatus == '') {
95
+ continue;
96
+ }
97
+ $return[$txaction] = $orderStatus;
98
+ }
99
+ return $return;
100
+ }
101
+
102
+ /**
103
+ * @param string $type
104
+ * @return array|null
105
+ */
106
+ public function getByType($type)
107
+ {
108
+ return $this->getValue($type);
109
+ }
110
+
111
+ /**
112
+ * @param null $banktransfer
113
+ */
114
+ public function setOnlinebanktransfer($banktransfer)
115
+ {
116
+ if (is_string($banktransfer)) {
117
+ $banktransfer = $this->initValue($banktransfer);
118
+ }
119
+ $this->online_bank_transfer = $banktransfer;
120
+ }
121
+
122
+ /**
123
+ * @return null
124
+ */
125
+ public function getOnlinebanktransfer()
126
+ {
127
+ return $this->online_bank_transfer;
128
+ }
129
+
130
+ /**
131
+ * @param null $cash_on_delivery
132
+ */
133
+ public function setCashOnDelivery($cash_on_delivery)
134
+ {
135
+ if (is_string($cash_on_delivery)) {
136
+ $cash_on_delivery = $this->initValue($cash_on_delivery);
137
+ }
138
+ $this->cash_on_delivery = $cash_on_delivery;
139
+ }
140
+
141
+ /**
142
+ * @return null
143
+ */
144
+ public function getCashOnDelivery()
145
+ {
146
+ return $this->cash_on_delivery;
147
+ }
148
+
149
+ /**
150
+ * @param null $creditcard
151
+ */
152
+ public function setCreditcard($creditcard)
153
+ {
154
+ if (is_string($creditcard)) {
155
+ $creditcard = $this->initValue($creditcard);
156
+ }
157
+ $this->creditcard = $creditcard;
158
+ }
159
+
160
+ /**
161
+ * @return null
162
+ */
163
+ public function getCreditcard()
164
+ {
165
+ return $this->creditcard;
166
+ }
167
+
168
+ /**
169
+ * @param null $debit
170
+ */
171
+ public function setDebitPayment($debit)
172
+ {
173
+ if (is_string($debit)) {
174
+ $debit = $this->initValue($debit);
175
+ }
176
+ $this->debit_payment = $debit;
177
+ }
178
+
179
+ /**
180
+ * @return null
181
+ */
182
+ public function getDebitPayment()
183
+ {
184
+ return $this->debit_payment;
185
+ }
186
+
187
+ /**
188
+ * @param null $invoice
189
+ */
190
+ public function setInvoice($invoice)
191
+ {
192
+ if (is_string($invoice)) {
193
+ $invoice = $this->initValue($invoice);
194
+ }
195
+ $this->invoice = $invoice;
196
+ }
197
+
198
+ /**
199
+ * @return null
200
+ */
201
+ public function getInvoice()
202
+ {
203
+ return $this->invoice;
204
+ }
205
+
206
+ /**
207
+ * @param null $prepayment
208
+ */
209
+ public function setAdvancepayment($prepayment)
210
+ {
211
+ if (is_string($prepayment)) {
212
+ $prepayment = $this->initValue($prepayment);
213
+ }
214
+ $this->advance_payment = $prepayment;
215
+ }
216
+
217
+ /**
218
+ * @return null
219
+ */
220
+ public function getAdvancepayment()
221
+ {
222
+ return $this->advance_payment;
223
+ }
224
+
225
+ /**
226
+ * @param null $wallet
227
+ */
228
+ public function setWallet($wallet)
229
+ {
230
+ if (is_string($wallet)) {
231
+ $wallet = $this->initValue($wallet);
232
+ }
233
+ $this->wallet = $wallet;
234
+ }
235
+
236
+ /**
237
+ * @return null
238
+ */
239
+ public function getWallet()
240
+ {
241
+ return $this->wallet;
242
+ }
243
+ }
app/code/community/Payone/Core/Model/Config/Interface.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Config_Interface
34
+ {
35
+ /**
36
+ * @param int $storeId
37
+ */
38
+ public function setStoreId($storeId);
39
+
40
+ /**
41
+ * @return int
42
+ */
43
+ public function getStoreId();
44
+
45
+ /**
46
+ * @param Payone_Core_Model_Config_General $general
47
+ */
48
+ public function setGeneral(Payone_Core_Model_Config_General $general);
49
+
50
+ /**
51
+ * @return Payone_Core_Model_Config_General
52
+ */
53
+ public function getGeneral();
54
+
55
+ /**
56
+ * @param Payone_Core_Model_Config_Misc $misc
57
+ */
58
+ public function setMisc(Payone_Core_Model_Config_Misc $misc);
59
+
60
+ /**
61
+ * @return Payone_Core_Model_Config_Misc
62
+ */
63
+ public function getMisc();
64
+
65
+ /**
66
+ * @param Payone_Core_Model_Config_Payment $payment
67
+ */
68
+ public function setPayment(Payone_Core_Model_Config_Payment $payment);
69
+
70
+ /**
71
+ * @return Payone_Core_Model_Config_Payment
72
+ */
73
+ public function getPayment();
74
+
75
+ /**
76
+ * @param Payone_Core_Model_Config_Protect $protect
77
+ */
78
+ public function setProtect(Payone_Core_Model_Config_Protect $protect);
79
+
80
+ /**
81
+ * @return Payone_Core_Model_Config_Protect
82
+ */
83
+ public function getProtect();
84
+
85
+ }
app/code/community/Payone/Core/Model/Config/Misc.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Misc extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var Payone_Core_Model_Config_Misc_TransactionstatusForwarding
37
+ */
38
+ protected $transactionstatusForwarding = null;
39
+ /**
40
+ * @var Payone_Core_Model_Config_Misc_ShippingCosts
41
+ */
42
+ protected $shippingCosts = null;
43
+ /**
44
+ * @var Payone_Core_Model_Config_Misc_EmailError
45
+ */
46
+ protected $emailError = null;
47
+ /**
48
+ * @var Payone_Core_Model_Config_Misc_EmailAvs
49
+ */
50
+ protected $emailAvs = null;
51
+ /**
52
+ * @var Payone_Core_Model_Config_Misc_TransactionstatusProcessing
53
+ */
54
+ protected $transactionstatusProcessing = null;
55
+
56
+ /**
57
+ * @param Payone_Core_Model_Config_Misc_EmailAvs $emailConfigAvs
58
+ */
59
+ public function setEmailAvs(Payone_Core_Model_Config_Misc_EmailAvs $emailConfigAvs)
60
+ {
61
+ $this->emailAvs = $emailConfigAvs;
62
+ }
63
+
64
+ /**
65
+ * @return Payone_Core_Model_Config_Misc_EmailAvs
66
+ */
67
+ public function getEmailAvs()
68
+ {
69
+ return $this->emailAvs;
70
+ }
71
+
72
+ /**
73
+ * @param Payone_Core_Model_Config_Misc_EmailError $emailConfigError
74
+ */
75
+ public function setEmailError(Payone_Core_Model_Config_Misc_EmailError $emailConfigError)
76
+ {
77
+ $this->emailError = $emailConfigError;
78
+ }
79
+
80
+ /**
81
+ * @return Payone_Core_Model_Config_Misc_EmailError
82
+ */
83
+ public function getEmailError()
84
+ {
85
+ return $this->emailError;
86
+ }
87
+
88
+ /**
89
+ * @param Payone_Core_Model_Config_Misc_ShippingCosts $shippingCosts
90
+ */
91
+ public function setShippingCosts(Payone_Core_Model_Config_Misc_ShippingCosts $shippingCosts)
92
+ {
93
+ $this->shippingCosts = $shippingCosts;
94
+ }
95
+
96
+ /**
97
+ * @return Payone_Core_Model_Config_Misc_ShippingCosts
98
+ */
99
+ public function getShippingCosts()
100
+ {
101
+ return $this->shippingCosts;
102
+ }
103
+
104
+ /**
105
+ * @param Payone_Core_Model_Config_Misc_TransactionstatusForwarding $transactionstatusForwarding
106
+ */
107
+ public function setTransactionstatusForwarding(Payone_Core_Model_Config_Misc_TransactionstatusForwarding $transactionstatusForwarding)
108
+ {
109
+ $this->transactionstatusForwarding = $transactionstatusForwarding;
110
+ }
111
+
112
+ /**
113
+ * @return Payone_Core_Model_Config_Misc_TransactionstatusForwarding
114
+ */
115
+ public function getTransactionstatusForwarding()
116
+ {
117
+ return $this->transactionstatusForwarding;
118
+ }
119
+
120
+ /**
121
+ * @param \Payone_Core_Model_Config_Misc_TransactionstatusProcessing $transactionstatusProcessing
122
+ */
123
+ public function setTransactionstatusProcessing($transactionstatusProcessing)
124
+ {
125
+ $this->transactionstatusProcessing = $transactionstatusProcessing;
126
+ }
127
+
128
+ /**
129
+ * @return \Payone_Core_Model_Config_Misc_TransactionstatusProcessing
130
+ */
131
+ public function getTransactionstatusProcessing()
132
+ {
133
+ return $this->transactionstatusProcessing;
134
+ }
135
+ }
app/code/community/Payone/Core/Model/Config/Misc/Email/Abstract.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Config_Misc_Email_Abstract
34
+ extends Payone_Core_Model_Config_AreaAbstract
35
+ implements Payone_Core_Model_Config_Misc_Email_Interface
36
+ {
37
+ /**
38
+ * @var int
39
+ */
40
+ protected $enabled = 0;
41
+ /**
42
+ * @var string
43
+ */
44
+ protected $from = '';
45
+ /**
46
+ * @var string
47
+ */
48
+ protected $to = '';
49
+ /**
50
+ * @var string
51
+ */
52
+ protected $bcc = '';
53
+ /**
54
+ * @var string
55
+ */
56
+ protected $template = '';
57
+
58
+ /**
59
+ * @param string $bcc
60
+ */
61
+ public function setBcc($bcc)
62
+ {
63
+ $this->bcc = $bcc;
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getBcc()
70
+ {
71
+ return $this->bcc;
72
+ }
73
+
74
+ /**
75
+ * @return bool
76
+ */
77
+ public function isEnabled()
78
+ {
79
+ if ($this->getEnabled()) {
80
+ return true;
81
+ }
82
+ return false;
83
+ }
84
+
85
+ /**
86
+ * @param int $enabled
87
+ */
88
+ public function setEnabled($enabled)
89
+ {
90
+ $this->enabled = $enabled;
91
+ }
92
+
93
+ /**
94
+ * @return int
95
+ */
96
+ public function getEnabled()
97
+ {
98
+ return $this->enabled;
99
+ }
100
+
101
+ /**
102
+ * @param string $from
103
+ */
104
+ public function setFrom($from)
105
+ {
106
+ $this->from = $from;
107
+ }
108
+
109
+ /**
110
+ * @return string
111
+ */
112
+ public function getFrom()
113
+ {
114
+ return $this->from;
115
+ }
116
+
117
+ /**
118
+ * @param string $template
119
+ */
120
+ public function setTemplate($template)
121
+ {
122
+ $this->template = $template;
123
+ }
124
+
125
+ /**
126
+ * @return string
127
+ */
128
+ public function getTemplate()
129
+ {
130
+ return $this->template;
131
+ }
132
+
133
+ /**
134
+ * @param string $to
135
+ */
136
+ public function setTo($to)
137
+ {
138
+ $this->to = $to;
139
+ }
140
+
141
+ /**
142
+ * @return string
143
+ */
144
+ public function getTo()
145
+ {
146
+ return $this->to;
147
+ }
148
+ }
app/code/community/Payone/Core/Model/Config/Misc/Email/Interface.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Config_Misc_Email_Interface
34
+ {
35
+ /**
36
+ * @param string $bcc
37
+ */
38
+ public function setBcc($bcc);
39
+
40
+ /**
41
+ * @return string
42
+ */
43
+ public function getBcc();
44
+
45
+ /**
46
+ * @return bool
47
+ */
48
+ public function isEnabled();
49
+
50
+ /**
51
+ * @param int $enabled
52
+ */
53
+ public function setEnabled($enabled);
54
+
55
+ /**
56
+ * @return int
57
+ */
58
+ public function getEnabled();
59
+
60
+ /**
61
+ * @param string $from
62
+ */
63
+ public function setFrom($from);
64
+
65
+ /**
66
+ * @return string
67
+ */
68
+ public function getFrom();
69
+
70
+ /**
71
+ * @param string $template
72
+ */
73
+ public function setTemplate($template);
74
+
75
+ /**
76
+ * @return string
77
+ */
78
+ public function getTemplate();
79
+
80
+ /**
81
+ * @param string $to
82
+ */
83
+ public function setTo($to);
84
+
85
+ /**
86
+ * @return string
87
+ */
88
+ public function getTo();
89
+ }
app/code/community/Payone/Core/Model/Config/Misc/EmailAvs.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Misc_EmailAvs
34
+ extends Payone_Core_Model_Config_Misc_Email_Abstract
35
+ {
36
+ /**
37
+ * @var array
38
+ */
39
+ protected $result_avs = null;
40
+
41
+ /**
42
+ * @param array $result_avs
43
+ */
44
+ public function setResultAvs($result_avs)
45
+ {
46
+ $this->result_avs = $result_avs;
47
+ }
48
+
49
+ /**
50
+ * @return array
51
+ */
52
+ public function getResultAvs()
53
+ {
54
+ return $this->result_avs;
55
+ }
56
+
57
+ /**
58
+ * @param $responseAvs
59
+ * @return bool
60
+ */
61
+ public function isResultAvsInConfig($responseAvs)
62
+ {
63
+ $resultAvsArray = explode(',', $this->getResultAvs());
64
+ $resultAvsArray = array_flip($resultAvsArray);
65
+ if (array_key_exists($responseAvs, $resultAvsArray)) {
66
+ return true;
67
+ }
68
+ return false;
69
+ }
70
+ }
app/code/community/Payone/Core/Model/Config/Misc/EmailError.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Misc_EmailError
34
+ extends Payone_Core_Model_Config_Misc_Email_Abstract
35
+ {
36
+ }
app/code/community/Payone/Core/Model/Config/Misc/ShippingCosts.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Misc_ShippingCosts extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var string
37
+ */
38
+ protected $sku = '';
39
+
40
+ /**
41
+ * @param string $sku
42
+ */
43
+ public function setSku($sku)
44
+ {
45
+ $this->sku = $sku;
46
+ }
47
+
48
+ /**
49
+ * @return string
50
+ */
51
+ public function getSku()
52
+ {
53
+ return $this->sku;
54
+ }
55
+ }
app/code/community/Payone/Core/Model/Config/Misc/TransactionstatusForwarding.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Misc_TransactionstatusForwarding
34
+ extends Payone_Core_Model_Config_AreaAbstract
35
+ {
36
+ const DEFAULT_TIMEOUT = 15;
37
+
38
+ /**
39
+ * @var array
40
+ */
41
+ protected $config = array();
42
+
43
+ public function init(array $data)
44
+ {
45
+ foreach ($data as $key => $value) {
46
+ if ($key == 'config' and is_string($value)) {
47
+ $value = $this->initConfig($value);
48
+ }
49
+ $this->setValue($key, $value);
50
+ }
51
+ }
52
+
53
+ /**
54
+ * @return bool
55
+ */
56
+ public function isActive()
57
+ {
58
+ if (count($this->getConfig()) > 0) {
59
+ return true;
60
+ }
61
+ return false;
62
+ }
63
+
64
+ /**
65
+ * @param string $txaction
66
+ * @return bool
67
+ */
68
+ public function canForwardTxAction($txaction)
69
+ {
70
+ if (array_key_exists($txaction, $this->getConfig())) {
71
+ return true;
72
+ }
73
+ return false;
74
+ }
75
+
76
+ /**
77
+ * @param array $config
78
+ */
79
+ public function setConfig($config)
80
+ {
81
+ $this->config = $config;
82
+ }
83
+
84
+ /**
85
+ * @param string $txaction
86
+ * @return array
87
+ */
88
+ public function getConfig($txaction = '')
89
+ {
90
+ if($txaction != ''){
91
+ if($this->canForwardTxAction($txaction)){
92
+ return $this->config[$txaction];
93
+ }
94
+ }
95
+ return $this->config;
96
+ }
97
+
98
+ /**
99
+ * @param $value
100
+ * @return array
101
+ */
102
+ public function initConfig($value)
103
+ {
104
+ $return = array();
105
+ $raw = unserialize($value);
106
+ if (!is_array($raw)) {
107
+ return null;
108
+ }
109
+
110
+ foreach ($raw as $configSet) {
111
+ if (!array_key_exists('url', $configSet)) {
112
+ // Without URL we cannot forward => config is ignored
113
+ continue;
114
+ }
115
+ $url = $configSet['url'];
116
+
117
+ if (!array_key_exists('txactions', $configSet)) {
118
+ // Without actions we cannot forward => config is ignored
119
+ continue;
120
+ }
121
+ $txactions = $configSet['txactions'];
122
+ if (!count($txactions)) {
123
+ // Without actions we cannot forward => config is ignored
124
+ continue;
125
+ }
126
+
127
+ $timeout = self::DEFAULT_TIMEOUT;
128
+ if (array_key_exists('timeout', $configSet)) {
129
+ $timeout = $configSet['timeout'];
130
+ }
131
+
132
+ // All mandatory parameters could be found, now init txactions
133
+ $actionConfig = array(
134
+ 'url' => $url,
135
+ 'timeout' => $timeout,
136
+ );
137
+
138
+ foreach ($txactions as $txaction) {
139
+ if (!array_key_exists($txaction, $return)) {
140
+ $return[$txaction] = array();
141
+ }
142
+ array_push($return[$txaction], $actionConfig);
143
+ }
144
+ }
145
+ return $return;
146
+ }
147
+
148
+ /**
149
+ * @internal param $value
150
+ * @return array
151
+ */
152
+ public function getConfigSortedByUrl()
153
+ {
154
+ $return = array();
155
+
156
+ foreach ($this->getConfig() as $status => $statusArray) {
157
+
158
+ foreach ($statusArray as $urlArray) {
159
+ $url = $urlArray['url'];
160
+ $timeout = $urlArray['timeout'];
161
+
162
+ if(!array_key_exists($url,$return))
163
+ {
164
+ $return[$url] = array();
165
+ $return[$url]['timeout'] = $timeout;
166
+ }
167
+ if(!array_key_exists('status',$return[$url]))
168
+ {
169
+ $return[$url]['status'] = array();
170
+ }
171
+ array_push($return[$url]['status'],$status);
172
+
173
+ }
174
+
175
+ }
176
+
177
+ return $return;
178
+ }
179
+ }
app/code/community/Payone/Core/Model/Config/Misc/TransactionstatusProcessing.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Misc_TransactionstatusProcessing
34
+ extends Payone_Core_Model_Config_AreaAbstract
35
+ {
36
+ /**
37
+ * @var string
38
+ */
39
+ protected $cron_expr = '';
40
+
41
+ /** @var array */
42
+ protected $valid_ips = '';
43
+
44
+ public function init(array $data)
45
+ {
46
+ foreach ($data as $key => $value) {
47
+ if ($key == 'valid_ips' and is_string($value)) {
48
+ $value = $this->initValidIpsByString($value);
49
+ }
50
+ $this->setValue($key, $value);
51
+ }
52
+ }
53
+
54
+ /**
55
+ * @param $validIpString
56
+ * @return array
57
+ */
58
+ protected function initValidIpsByString($validIpString)
59
+ {
60
+ $validIps = explode("\n", $validIpString);
61
+
62
+ foreach ($validIps as $key => $ip) {
63
+ if (empty($ip)) {
64
+ unset($validIps[$key]);
65
+ }
66
+ else {
67
+ $validIps[$key] = trim($ip);
68
+ }
69
+ }
70
+ return $validIps;
71
+ }
72
+
73
+ /**
74
+ * @param string $cron_expr
75
+ */
76
+ public function setCronExpr($cron_expr)
77
+ {
78
+ $this->cron_expr = $cron_expr;
79
+ }
80
+
81
+ /**
82
+ * @return string
83
+ */
84
+ public function getCronExpr()
85
+ {
86
+ return $this->cron_expr;
87
+ }
88
+
89
+ /**
90
+ * @param array $valid_ips
91
+ */
92
+ public function setValidIps($valid_ips)
93
+ {
94
+ $this->valid_ips = $valid_ips;
95
+ }
96
+
97
+ /**
98
+ * @return array
99
+ */
100
+ public function getValidIps()
101
+ {
102
+ return $this->valid_ips;
103
+ }
104
+ }
app/code/community/Payone/Core/Model/Config/Payment.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Payment extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var array
37
+ */
38
+ protected $methods = array();
39
+
40
+ /**
41
+ * Retrieve Config by Id.
42
+ * Returns false if id does not exist.
43
+ *
44
+ * @param $configId
45
+ * @return bool|Payone_Core_Model_Config_Payment_Method_Interface
46
+ */
47
+ public function getMethodById($configId)
48
+ {
49
+ if (array_key_exists($configId, $this->methods)) {
50
+ return $this->methods[$configId];
51
+ }
52
+ else {
53
+ return false;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @param string $type
59
+ * @param Mage_Sales_Model_Quote $quote
60
+ * @return bool
61
+ */
62
+ public function isAvailable($type, Mage_Sales_Model_Quote $quote = null)
63
+ {
64
+ if (is_null($quote)) {
65
+ $methods = $this->getMethodsByType($type);
66
+ }
67
+ else {
68
+ $methods = $this->getMethodsForQuote($type, $quote);
69
+ }
70
+
71
+ if (count($methods) > 0) {
72
+ return true;
73
+ }
74
+ return false;
75
+ }
76
+
77
+ /**
78
+ * Check if Method can be used in Country
79
+ *
80
+ * @param string $type
81
+ * @param string $country
82
+ * @return bool
83
+ */
84
+ public function canUseForCountry($type, $country)
85
+ {
86
+ $canUse = false;
87
+
88
+ $availableMethods = $this->getMethodsForCountry($type, $country);
89
+
90
+ if (count($availableMethods) > 0) {
91
+ $canUse = true;
92
+ }
93
+
94
+ return $canUse;
95
+ }
96
+
97
+ /**
98
+ * @param string $type
99
+ * @param Mage_Sales_Model_Quote $quote
100
+ * @return mixed|null|Payone_Core_Model_Config_Payment_Method_Interface
101
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
102
+ */
103
+ public function getMethodForQuote($type, Mage_Sales_Model_Quote $quote)
104
+ {
105
+ $methods = $this->getMethodsForQuote($type, $quote);
106
+
107
+ if (count($methods) == 0) {
108
+ $message = 'Payment Method Configuration could not be found for ' . $type;
109
+ throw new Payone_Core_Exception_PaymentMethodConfigNotFound($message);
110
+ }
111
+
112
+ /** @var $config Payone_Core_Model_Config_Payment_Method_Interface */
113
+ $config = array_shift($methods); // Use the first matching method config
114
+
115
+ return $config;
116
+ }
117
+
118
+ /**
119
+ * Get Available Methods for Type by Quote
120
+ *
121
+ * @param $type
122
+ * @param Mage_Sales_Model_Quote $quote
123
+ * @return array
124
+ */
125
+ public function getMethodsForQuote($type, Mage_Sales_Model_Quote $quote)
126
+ {
127
+ $country = $quote->getBillingAddress()->getCountry();
128
+ $quoteTotal = $quote->getSubtotal();
129
+
130
+ $methodsForCountry = $this->getMethodsForCountry($type, $country);
131
+
132
+ $methods = array();
133
+ foreach ($methodsForCountry as $key => $method) {
134
+ /** @var $method Payone_Core_Model_Config_Payment_Method_Interface */
135
+ $maxOrderTotal = $method->getMaxOrderTotal();
136
+ $minOrderTotal = $method->getMinOrderTotal();
137
+
138
+ if (!empty($maxOrderTotal) and $maxOrderTotal < $quoteTotal) {
139
+ continue; // quote total too high.
140
+ }
141
+
142
+ if (!empty($minOrderTotal) and $minOrderTotal > $quoteTotal) {
143
+ continue; // quote total is too low.
144
+ }
145
+
146
+ $methods[] = $method;
147
+ }
148
+
149
+ return $methods;
150
+ }
151
+
152
+ /**
153
+ * Retrieve all Available Methods by MethodType
154
+ *
155
+ * @param string $type
156
+ * @param string $country
157
+ * @return array
158
+ */
159
+ public function getMethodsForCountry($type, $country)
160
+ {
161
+ $methodsbyType = $this->getMethodsByType($type);
162
+
163
+ $availableMethods = array();
164
+ foreach ($methodsbyType as $key => $method) {
165
+ /** @var $method Payone_Core_Model_Config_Payment_Method_Interface */
166
+ if (!$method->canUseForCountry($country)) {
167
+ continue;
168
+ }
169
+
170
+ $availableMethods[] = $method;
171
+ }
172
+
173
+ return $availableMethods;
174
+ }
175
+
176
+ /**
177
+ * Retrieve all Available Methods by MethodType
178
+ *
179
+ * @param string $type
180
+ * @return array
181
+ */
182
+ public function getMethodsByType($type)
183
+ {
184
+ $methods = array();
185
+ foreach ($this->getAvailableMethods() as $key => $method) {
186
+ /** @var $method Payone_Core_Model_Config_Payment_Method_Interface */
187
+ if ($method->getEnabled() and $method->getCode() == $type) {
188
+ $methods[] = $method;
189
+ }
190
+ }
191
+ return $methods;
192
+ }
193
+
194
+ /**
195
+ * Get Available Methods, only returns not deleted methods
196
+ *
197
+ * @return array
198
+ */
199
+ public function getAvailableMethods()
200
+ {
201
+ $methods = array();
202
+ foreach ($this->methods as $key => $method) {
203
+ /** @var $method Payone_Core_Model_Config_Payment_Method_Interface */
204
+ if(!$method->getIsDeleted()){
205
+ $methods[$key] = $method;
206
+ if($method->hasParent())
207
+ {
208
+ unset($methods[$method->getParent()]);
209
+ }
210
+ }
211
+ }
212
+ return $methods;
213
+ }
214
+
215
+ public function getAllMethods()
216
+ {
217
+ return $this->methods;
218
+ }
219
+
220
+ /**
221
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
222
+ */
223
+ public function addMethod(Payone_Core_Model_Config_Payment_Method_Interface $config)
224
+ {
225
+ $this->methods[$config->getId()] = $config;
226
+ }
227
+
228
+ /**
229
+ * @param array $methods
230
+ */
231
+ public function setMethods(array $methods)
232
+ {
233
+ $this->methods = $methods;
234
+ }
235
+
236
+ /**
237
+ * @return array
238
+ */
239
+ public function getMethods()
240
+ {
241
+ return $this->methods;
242
+ }
243
+
244
+ }
app/code/community/Payone/Core/Model/Config/Payment/Method.php ADDED
@@ -0,0 +1,733 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Payment_Method
34
+ extends Payone_Core_Model_Config_AreaAbstract
35
+ implements Payone_Core_Model_Config_Payment_Method_Interface
36
+ {
37
+ /**
38
+ * @var int
39
+ */
40
+ protected $id = 0;
41
+ /**
42
+ * @var string
43
+ */
44
+ protected $scope = '';
45
+ /**
46
+ * @var int
47
+ */
48
+ protected $scope_id = 0;
49
+ /**
50
+ * @var string
51
+ */
52
+ protected $code = '';
53
+ /**
54
+ * @var string
55
+ */
56
+ protected $name = '';
57
+ /**
58
+ * @var int
59
+ */
60
+ protected $sort_order = 0;
61
+ /**
62
+ * @var int
63
+ */
64
+ protected $enabled = 0;
65
+ /**
66
+ * @var array
67
+ */
68
+ protected $fee_config = array();
69
+
70
+ /** @var string */
71
+ protected $mode = '';
72
+
73
+ /**
74
+ * @var int
75
+ */
76
+ protected $use_global = 0;
77
+ /**
78
+ * @var int
79
+ */
80
+ protected $mid = 0;
81
+ /**
82
+ * @var int
83
+ */
84
+ protected $portalid = 0;
85
+ /**
86
+ * @var int
87
+ */
88
+ protected $aid = 0;
89
+ /**
90
+ * @var string
91
+ */
92
+ protected $key = '';
93
+ /**
94
+ * @var int
95
+ */
96
+ protected $allowspecific = 0;
97
+ /**
98
+ * @var array
99
+ */
100
+ protected $specificcountry = array();
101
+ /**
102
+ * @var array
103
+ */
104
+ protected $allowedCountries = array();
105
+ /**
106
+ * @var string
107
+ */
108
+ protected $request_type = '';
109
+
110
+ /**
111
+ * @var int
112
+ */
113
+ protected $invoice_transmit = 0;
114
+
115
+ /**
116
+ * @var array
117
+ */
118
+ protected $types = array();
119
+ /**
120
+ * @var int
121
+ */
122
+ protected $check_cvc = 0;
123
+ /**
124
+ * @var int
125
+ */
126
+ protected $check_bankaccount = 0;
127
+
128
+ /** @var string */
129
+ protected $bankaccountcheck_type = '';
130
+
131
+ /** @var string */
132
+ protected $message_response_blocked = '';
133
+
134
+ /**
135
+ * @var int
136
+ */
137
+ protected $is_deleted = 0;
138
+
139
+ /**
140
+ * @var string
141
+ */
142
+ protected $minValidityPeriod = '';
143
+
144
+ /** @var float */
145
+ protected $minOrderTotal = 0;
146
+
147
+ /** @var float */
148
+ protected $maxOrderTotal = 0;
149
+
150
+ /**
151
+ * @var int | null
152
+ */
153
+ protected $parent = null;
154
+
155
+ /**
156
+ * Check if Method can be used in Country
157
+ *
158
+ * @param string $country
159
+ * @return bool
160
+ */
161
+ public function canUseForCountry($country)
162
+ {
163
+ if ($this->getAllowspecific() and !in_array($country, $this->getSpecificcountry())) {
164
+ return false;
165
+ }
166
+ return true;
167
+ }
168
+
169
+ /**
170
+ * @param Mage_Sales_Model_Quote $quote
171
+ * @return array|bool
172
+ */
173
+ public function getFeeConfigForQuote(Mage_Sales_Model_Quote $quote)
174
+ {
175
+ $shippingAddress = $quote->getShippingAddress();
176
+ $country = $shippingAddress->getCountry();
177
+ $shippingMethod = $shippingAddress->getShippingMethod();
178
+
179
+ $feeConfigs = $this->getFeeConfig();
180
+
181
+ if (!is_array($feeConfigs)) {
182
+ return false;
183
+ }
184
+
185
+ foreach ($feeConfigs as $key => $feeConfig) {
186
+ if (in_array($shippingMethod, $feeConfig['shipping_method']) === false) {
187
+ unset($feeConfigs[$key]);
188
+ continue;
189
+ }
190
+ if (array_key_exists('countries', $feeConfig) and in_array($country, $feeConfig['countries']) === false) {
191
+ unset($feeConfigs[$key]);
192
+ continue;
193
+ }
194
+ }
195
+
196
+ if (count($feeConfigs) > 0) {
197
+ return array_shift($feeConfigs);
198
+ }
199
+ else {
200
+ return false;
201
+ }
202
+ }
203
+
204
+ /**
205
+ * @return bool
206
+ */
207
+ public function isRequestAuthorization()
208
+ {
209
+ if ($this->getRequestType() === Payone_Api_Enum_RequestType::AUTHORIZATION) {
210
+ return true;
211
+ }
212
+ return false;
213
+ }
214
+
215
+ /**
216
+ * @return bool
217
+ */
218
+ public function isRequestPreauthorization()
219
+ {
220
+ if ($this->getRequestType() === Payone_Api_Enum_RequestType::PREAUTHORIZATION) {
221
+ return true;
222
+ }
223
+ return false;
224
+ }
225
+
226
+ /**
227
+ * @return bool
228
+ */
229
+ public function isInvoiceTransmitEnabled()
230
+ {
231
+ if ($this->getInvoiceTransmit()) {
232
+ return true;
233
+ }
234
+ return false;
235
+ }
236
+
237
+ /**
238
+ * @return bool
239
+ */
240
+ public function isAllowspecific()
241
+ {
242
+ if ($this->getAllowspecific()) {
243
+ return true;
244
+ }
245
+ return false;
246
+ }
247
+
248
+ /**
249
+ * @param int $aid
250
+ */
251
+ public function setAid($aid)
252
+ {
253
+ $this->aid = $aid;
254
+ }
255
+
256
+ /**
257
+ * @return int
258
+ */
259
+ public function getAid()
260
+ {
261
+ return $this->aid;
262
+ }
263
+
264
+ /**
265
+ * @param int $allowspecific
266
+ */
267
+ public function setAllowspecific($allowspecific)
268
+ {
269
+ $this->allowspecific = $allowspecific;
270
+ }
271
+
272
+ /**
273
+ * @return int
274
+ */
275
+ public function getAllowspecific()
276
+ {
277
+ return $this->allowspecific;
278
+ }
279
+
280
+ /**
281
+ * @param int $check_bankaccount
282
+ */
283
+ public function setCheckBankAccount($check_bankaccount)
284
+ {
285
+ $this->check_bankaccount = $check_bankaccount;
286
+ }
287
+
288
+ /**
289
+ * @return int
290
+ */
291
+ public function getCheckBankAccount()
292
+ {
293
+ return $this->check_bankaccount;
294
+ }
295
+
296
+ /**
297
+ * @param int $check_cvc
298
+ */
299
+ public function setCheckCvc($check_cvc)
300
+ {
301
+ $this->check_cvc = $check_cvc;
302
+ }
303
+
304
+ /**
305
+ * @return int
306
+ */
307
+ public function getCheckCvc()
308
+ {
309
+ return $this->check_cvc;
310
+ }
311
+
312
+ /**
313
+ * @param string $code
314
+ */
315
+ public function setCode($code)
316
+ {
317
+ $this->code = $code;
318
+ }
319
+
320
+ /**
321
+ * @return string
322
+ */
323
+ public function getCode()
324
+ {
325
+ return $this->code;
326
+ }
327
+
328
+ /**
329
+ * @param int $enabled
330
+ */
331
+ public function setEnabled($enabled)
332
+ {
333
+ $this->enabled = $enabled;
334
+ }
335
+
336
+ /**
337
+ * @return int
338
+ */
339
+ public function getEnabled()
340
+ {
341
+ return $this->enabled;
342
+ }
343
+
344
+ /**
345
+ * @param array $fee_config
346
+ */
347
+ public function setFeeConfig($fee_config)
348
+ {
349
+ $this->fee_config = $fee_config;
350
+ }
351
+
352
+ /**
353
+ * @return array
354
+ */
355
+ public function getFeeConfig()
356
+ {
357
+ return $this->fee_config;
358
+ }
359
+
360
+ /**
361
+ * @param int $id
362
+ */
363
+ public function setId($id)
364
+ {
365
+ $this->id = $id;
366
+ }
367
+
368
+ /**
369
+ * @return int
370
+ */
371
+ public function getId()
372
+ {
373
+ return $this->id;
374
+ }
375
+
376
+ /**
377
+ * @param int $invoice_transmit
378
+ */
379
+ public function setInvoiceTransmit($invoice_transmit)
380
+ {
381
+ $this->invoice_transmit = $invoice_transmit;
382
+ }
383
+
384
+ /**
385
+ * @return int
386
+ */
387
+ public function getInvoiceTransmit()
388
+ {
389
+ return $this->invoice_transmit;
390
+ }
391
+
392
+ /**
393
+ * @param int $is_deleted
394
+ */
395
+ public function setIsDeleted($is_deleted)
396
+ {
397
+ $this->is_deleted = $is_deleted;
398
+ }
399
+
400
+ /**
401
+ * @return int
402
+ */
403
+ public function getIsDeleted()
404
+ {
405
+ return $this->is_deleted;
406
+ }
407
+
408
+ /**
409
+ * @param string $key
410
+ */
411
+ public function setKey($key)
412
+ {
413
+ $this->key = $key;
414
+ }
415
+
416
+ /**
417
+ * @return string
418
+ */
419
+ public function getKey()
420
+ {
421
+ return $this->key;
422
+ }
423
+
424
+ /**
425
+ * @param int $mid
426
+ */
427
+ public function setMid($mid)
428
+ {
429
+ $this->mid = $mid;
430
+ }
431
+
432
+ /**
433
+ * @return int
434
+ */
435
+ public function getMid()
436
+ {
437
+ return $this->mid;
438
+ }
439
+
440
+ /**
441
+ * @param string $name
442
+ */
443
+ public function setName($name)
444
+ {
445
+ $this->name = $name;
446
+ }
447
+
448
+ /**
449
+ * @return string
450
+ */
451
+ public function getName()
452
+ {
453
+ return $this->name;
454
+ }
455
+
456
+ /**
457
+ * @param int $portalid
458
+ */
459
+ public function setPortalid($portalid)
460
+ {
461
+ $this->portalid = $portalid;
462
+ }
463
+
464
+ /**
465
+ * @return int
466
+ */
467
+ public function getPortalid()
468
+ {
469
+ return $this->portalid;
470
+ }
471
+
472
+ /**
473
+ * @param string $request_type
474
+ */
475
+ public function setRequestType($request_type)
476
+ {
477
+ $this->request_type = $request_type;
478
+ }
479
+
480
+ /**
481
+ * @return string
482
+ */
483
+ public function getRequestType()
484
+ {
485
+ return $this->request_type;
486
+ }
487
+
488
+ /**
489
+ * @param string $scope
490
+ */
491
+ public function setScope($scope)
492
+ {
493
+ $this->scope = $scope;
494
+ }
495
+
496
+ /**
497
+ * @return string
498
+ */
499
+ public function getScope()
500
+ {
501
+ return $this->scope;
502
+ }
503
+
504
+ /**
505
+ * @param int $scope_id
506
+ */
507
+ public function setScopeId($scope_id)
508
+ {
509
+ $this->scope_id = $scope_id;
510
+ }
511
+
512
+ /**
513
+ * @return int
514
+ */
515
+ public function getScopeId()
516
+ {
517
+ return $this->scope_id;
518
+ }
519
+
520
+ /**
521
+ * @param int $sort_order
522
+ */
523
+ public function setSortOrder($sort_order)
524
+ {
525
+ $this->sort_order = $sort_order;
526
+ }
527
+
528
+ /**
529
+ * @return int
530
+ */
531
+ public function getSortOrder()
532
+ {
533
+ return $this->sort_order;
534
+ }
535
+
536
+ /**
537
+ * @param array $specificcountry
538
+ */
539
+ public function setSpecificcountry($specificcountry)
540
+ {
541
+ $this->specificcountry = $specificcountry;
542
+ }
543
+
544
+ /**
545
+ * @return array
546
+ */
547
+ public function getSpecificcountry()
548
+ {
549
+ return $this->specificcountry;
550
+ }
551
+
552
+ /**
553
+ * @param array $allowedCountries
554
+ */
555
+ public function setAllowedCountries($allowedCountries)
556
+ {
557
+ $this->allowedCountries = $allowedCountries;
558
+ }
559
+
560
+ /**
561
+ * @return array
562
+ */
563
+ public function getAllowedCountries()
564
+ {
565
+ return $this->allowedCountries;
566
+ }
567
+
568
+ /**
569
+ * @param array $types
570
+ */
571
+ public function setTypes($types)
572
+ {
573
+ $this->types = $types;
574
+ }
575
+
576
+ /**
577
+ * @return array
578
+ */
579
+ public function getTypes()
580
+ {
581
+ return $this->types;
582
+ }
583
+
584
+ /**
585
+ * @param int $use_global
586
+ */
587
+ public function setUseGlobal($use_global)
588
+ {
589
+ $this->use_global = $use_global;
590
+ }
591
+
592
+ /**
593
+ * @return int
594
+ */
595
+ public function getUseGlobal()
596
+ {
597
+ return $this->use_global;
598
+ }
599
+
600
+ /**
601
+ * @param string $minValidityPeriod
602
+ */
603
+ public function setMinValidityPeriod($minValidityPeriod)
604
+ {
605
+ $this->minValidityPeriod = $minValidityPeriod;
606
+ }
607
+
608
+ /**
609
+ * @return string
610
+ */
611
+ public function getMinValidityPeriod()
612
+ {
613
+ return $this->minValidityPeriod;
614
+ }
615
+
616
+ /**
617
+ * @param float $maxOrderTotal
618
+ */
619
+ public function setMaxOrderTotal($maxOrderTotal)
620
+ {
621
+ $this->maxOrderTotal = $maxOrderTotal;
622
+ }
623
+
624
+ /**
625
+ * @return float
626
+ */
627
+ public function getMaxOrderTotal()
628
+ {
629
+ return $this->maxOrderTotal;
630
+ }
631
+
632
+ /**
633
+ * @param float $minOrderTotal
634
+ */
635
+ public function setMinOrderTotal($minOrderTotal)
636
+ {
637
+ $this->minOrderTotal = $minOrderTotal;
638
+ }
639
+
640
+ /**
641
+ * @return float
642
+ */
643
+ public function getMinOrderTotal()
644
+ {
645
+ return $this->minOrderTotal;
646
+ }
647
+
648
+ /**
649
+ * @param string $mode
650
+ */
651
+ public function setMode($mode)
652
+ {
653
+ $this->mode = $mode;
654
+ }
655
+
656
+ /**
657
+ * @return string
658
+ */
659
+ public function getMode()
660
+ {
661
+ return $this->mode;
662
+ }
663
+
664
+ /**
665
+ * @param $parentId
666
+ */
667
+ public function setParent($parentId)
668
+ {
669
+ $this->parent = $parentId;
670
+ }
671
+
672
+ /**
673
+ * @return int
674
+ */
675
+ public function getParent()
676
+ {
677
+ return $this->parent;
678
+ }
679
+
680
+ /**
681
+ * @return bool
682
+ */
683
+ public function hasParent()
684
+ {
685
+ if ($this->getParent()) {
686
+ return true;
687
+ }
688
+ return false;
689
+ }
690
+
691
+ /**
692
+ * @param string $message_response_blocked
693
+ */
694
+ public function setMessageResponseBlocked($message_response_blocked)
695
+ {
696
+ $this->message_response_blocked = $message_response_blocked;
697
+ }
698
+
699
+ /**
700
+ * @return string
701
+ */
702
+ public function getMessageResponseBlocked()
703
+ {
704
+ return $this->message_response_blocked;
705
+ }
706
+
707
+ /**
708
+ * @param string $bankaccountcheck_type
709
+ */
710
+ public function setBankAccountCheckType($bankaccountcheck_type)
711
+ {
712
+ $this->bankaccountcheck_type = $bankaccountcheck_type;
713
+ }
714
+
715
+ /**
716
+ * @return string
717
+ */
718
+ public function getBankAccountCheckType()
719
+ {
720
+ return $this->bankaccountcheck_type;
721
+ }
722
+
723
+ /**
724
+ * @return bool
725
+ */
726
+ public function isBankAccountCheckEnabled()
727
+ {
728
+ if ($this->getCheckBankAccount()) {
729
+ return true;
730
+ }
731
+ return false;
732
+ }
733
+ }
app/code/community/Payone/Core/Model/Config/Payment/Method/Interface.php ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Config_Payment_Method_Interface
34
+ {
35
+ /**
36
+ * @return bool
37
+ */
38
+ public function isRequestAuthorization();
39
+
40
+ /**
41
+ * @return bool
42
+ */
43
+ public function isRequestPreauthorization();
44
+
45
+ /**
46
+ * @return bool
47
+ */
48
+ public function isInvoiceTransmitEnabled();
49
+
50
+ /**
51
+ * @return bool
52
+ */
53
+ public function isBankAccountCheckEnabled();
54
+
55
+ /**
56
+ * @param string $country
57
+ * @return bool
58
+ */
59
+ public function canUseForCountry($country);
60
+
61
+ /**
62
+ * @abstract
63
+ * @param Mage_Sales_Model_Quote $quote
64
+ * @return array
65
+ */
66
+ public function getFeeConfigForQuote(Mage_Sales_Model_Quote $quote);
67
+
68
+ /**
69
+ * @param int $aid
70
+ */
71
+ public function setAid($aid);
72
+
73
+ /**
74
+ * @return int
75
+ */
76
+ public function getAid();
77
+
78
+ /**
79
+ * @param int $allowspecific
80
+ */
81
+ public function setAllowspecific($allowspecific);
82
+
83
+ /**
84
+ * @return int
85
+ */
86
+ public function getAllowspecific();
87
+
88
+ /**
89
+ * @param int $check_bankaccount
90
+ */
91
+ public function setCheckBankAccount($check_bankaccount);
92
+
93
+ /**
94
+ * @return int
95
+ */
96
+ public function getCheckBankAccount();
97
+
98
+ /**
99
+ * @abstract
100
+ * @param $bankaccountcheckType
101
+ * @return void
102
+ */
103
+ public function setBankAccountCheckType($bankaccountcheckType);
104
+
105
+ /**
106
+ * @return int
107
+ */
108
+ public function getBankAccountCheckType();
109
+
110
+ /**
111
+ * @abstract
112
+ * @param string $message_response_blocked
113
+ * @return string
114
+ */
115
+ public function setMessageResponseBlocked($message_response_blocked);
116
+
117
+ /**
118
+ * @abstract
119
+ * @return string
120
+ */
121
+ public function getMessageResponseBlocked();
122
+
123
+ /**
124
+ * @param int $check_cvc
125
+ */
126
+ public function setCheckCvc($check_cvc);
127
+
128
+ /**
129
+ * @return int
130
+ */
131
+ public function getCheckCvc();
132
+
133
+ /**
134
+ * @param string $code
135
+ */
136
+ public function setCode($code);
137
+
138
+ /**
139
+ * @return string
140
+ */
141
+ public function getCode();
142
+
143
+ /**
144
+ * @param int $enabled
145
+ */
146
+ public function setEnabled($enabled);
147
+
148
+ /**
149
+ * @return int
150
+ */
151
+ public function getEnabled();
152
+
153
+ /**
154
+ * @param array $fee_config
155
+ */
156
+ public function setFeeConfig($fee_config);
157
+
158
+ /**
159
+ * @return array
160
+ */
161
+ public function getFeeConfig();
162
+
163
+ /**
164
+ * @abstract
165
+ * @param $mode
166
+ * @return mixed
167
+ */
168
+ public function setMode($mode);
169
+
170
+ /**
171
+ * @abstract
172
+ * @return string
173
+ */
174
+ public function getMode();
175
+
176
+ /**
177
+ * @param int $id
178
+ */
179
+ public function setId($id);
180
+
181
+ /**
182
+ * @return int
183
+ */
184
+ public function getId();
185
+
186
+ /**
187
+ * @param int $invoice_transmit
188
+ */
189
+ public function setInvoiceTransmit($invoice_transmit);
190
+
191
+ /**
192
+ * @return int
193
+ */
194
+ public function getInvoiceTransmit();
195
+
196
+ /**
197
+ * @param int $is_deleted
198
+ */
199
+ public function setIsDeleted($is_deleted);
200
+
201
+ /**
202
+ * @return int
203
+ */
204
+ public function getIsDeleted();
205
+
206
+ /**
207
+ * @param string $key
208
+ */
209
+ public function setKey($key);
210
+
211
+ /**
212
+ * @return string
213
+ */
214
+ public function getKey();
215
+
216
+ /**
217
+ * @param int $mid
218
+ */
219
+ public function setMid($mid);
220
+
221
+ /**
222
+ * @return int
223
+ */
224
+ public function getMid();
225
+
226
+ /**
227
+ * @param string $name
228
+ */
229
+ public function setName($name);
230
+
231
+ /**
232
+ * @return string
233
+ */
234
+ public function getName();
235
+
236
+ /**
237
+ * @param int $portalid
238
+ */
239
+ public function setPortalid($portalid);
240
+
241
+ /**
242
+ * @return int
243
+ */
244
+ public function getPortalid();
245
+
246
+ /**
247
+ * @param string $request_type
248
+ */
249
+ public function setRequestType($request_type);
250
+
251
+ /**
252
+ * @return string
253
+ */
254
+ public function getRequestType();
255
+
256
+ /**
257
+ * @param string $scope
258
+ */
259
+ public function setScope($scope);
260
+
261
+ /**
262
+ * @return string
263
+ */
264
+ public function getScope();
265
+
266
+ /**
267
+ * @param int $scope_id
268
+ */
269
+ public function setScopeId($scope_id);
270
+
271
+ /**
272
+ * @return int
273
+ */
274
+ public function getScopeId();
275
+
276
+ /**
277
+ * @param int $sort_order
278
+ */
279
+ public function setSortOrder($sort_order);
280
+
281
+ /**
282
+ * @return int
283
+ */
284
+ public function getSortOrder();
285
+
286
+ /**
287
+ * @param array $specificcountry
288
+ */
289
+ public function setSpecificcountry($specificcountry);
290
+
291
+ /**
292
+ * @return array
293
+ */
294
+ public function getSpecificcountry();
295
+
296
+ /**
297
+ * @param array $allowedCountries
298
+ */
299
+ public function setAllowedCountries($allowedCountries);
300
+
301
+ /**
302
+ * @return array
303
+ */
304
+ public function getAllowedCountries();
305
+
306
+ /**
307
+ * @param array $types
308
+ */
309
+ public function setTypes($types);
310
+
311
+ /**
312
+ * @return array
313
+ */
314
+ public function getTypes();
315
+
316
+ /**
317
+ * @param int $use_global
318
+ */
319
+ public function setUseGlobal($use_global);
320
+
321
+ /**
322
+ * @return int
323
+ */
324
+ public function getUseGlobal();
325
+
326
+ /**
327
+ * @param string $minValidityPeriod
328
+ */
329
+ public function setMinValidityPeriod($minValidityPeriod);
330
+
331
+ /**
332
+ * @return string
333
+ */
334
+ public function getMinValidityPeriod();
335
+
336
+ /**
337
+ * @return float
338
+ */
339
+ public function getMaxOrderTotal();
340
+
341
+ /**
342
+ * @return float
343
+ */
344
+ public function getMinOrderTotal();
345
+
346
+ public function getParent();
347
+
348
+ public function setParent($parentId);
349
+
350
+ public function hasParent();
351
+
352
+ }
app/code/community/Payone/Core/Model/Config/Protect.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Protect extends Payone_Core_Model_Config_AreaAbstract
34
+ {
35
+ /**
36
+ * @var Payone_Core_Model_Config_Protect_AddressCheck
37
+ */
38
+ protected $addressCheck = null;
39
+ /**
40
+ * @var Payone_Core_Model_Config_Protect_Creditrating
41
+ */
42
+ protected $creditrating = null;
43
+
44
+ /**
45
+ * @param Payone_Core_Model_Config_Protect_AddressCheck $addressCheck
46
+ */
47
+ public function setAddressCheck(Payone_Core_Model_Config_Protect_AddressCheck $addressCheck)
48
+ {
49
+ $this->addressCheck = $addressCheck;
50
+ }
51
+
52
+ /**
53
+ * @return Payone_Core_Model_Config_Protect_AddressCheck
54
+ */
55
+ public function getAddressCheck()
56
+ {
57
+ return $this->addressCheck;
58
+ }
59
+
60
+ /**
61
+ * @param Payone_Core_Model_Config_Protect_Creditrating $creditrating
62
+ */
63
+ public function setCreditrating(Payone_Core_Model_Config_Protect_Creditrating $creditrating)
64
+ {
65
+ $this->creditrating = $creditrating;
66
+ }
67
+
68
+ /**
69
+ * @return Payone_Core_Model_Config_Protect_Creditrating
70
+ */
71
+ public function getCreditrating()
72
+ {
73
+ return $this->creditrating;
74
+ }
75
+ }
app/code/community/Payone/Core/Model/Config/Protect/AddressCheck.php ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Protect_AddressCheck
34
+ extends Payone_Core_Model_Config_AreaAbstract
35
+ {
36
+ /**
37
+ * @var int
38
+ */
39
+ protected $enabled = 0;
40
+
41
+ /** @var int */
42
+ protected $check_billing = '';
43
+
44
+ /** @var string */
45
+ protected $check_shipping = '';
46
+
47
+ /**
48
+ * @var float
49
+ */
50
+ protected $min_order_total = 0.00;
51
+ /**
52
+ * @var float
53
+ */
54
+ protected $max_order_total = 0.00;
55
+
56
+ /** @var string */
57
+ protected $mode = '';
58
+
59
+ /** @var bool */
60
+ protected $confirm_address_correction = 0;
61
+
62
+ /** @var int */
63
+ protected $result_lifetime = 0;
64
+
65
+ /** @var string */
66
+ protected $handle_response_error = '';
67
+
68
+ /** @var string */
69
+ protected $stop_checkout_message = '';
70
+
71
+ /** @var string */
72
+ protected $message_response_invalid = '';
73
+
74
+ /**
75
+ * @var null
76
+ */
77
+ protected $mapping_personstatus = null;
78
+
79
+ public function init(array $data)
80
+ {
81
+ foreach ($data as $key => $value) {
82
+ if ($key == 'mapping_personstatus' and is_string($value)) {
83
+ $value = $this->initValue($value);
84
+ }
85
+ $this->setValue($key, $value);
86
+ }
87
+ }
88
+
89
+
90
+ /**
91
+ * @param string $value
92
+ * @return array|null
93
+ */
94
+ protected function initValue($value)
95
+ {
96
+ $return = array();
97
+ $raw = unserialize($value);
98
+ if (!is_array($raw)) {
99
+ return null;
100
+ }
101
+
102
+ foreach ($raw as $key => $data) {
103
+ $personStatus = $score = '';
104
+ if (array_key_exists('personstatus', $data)) {
105
+ $personStatus = array_shift($data['personstatus']);
106
+ }
107
+ if (array_key_exists('score', $data)) {
108
+ $score = array_shift($data['score']);
109
+ }
110
+ if ($personStatus == '' and $score == '') {
111
+ continue;
112
+ }
113
+ $return[$personStatus] = $score;
114
+ }
115
+ return $return;
116
+ }
117
+
118
+ /**
119
+ * @param string $check_billing
120
+ */
121
+ public function setCheckBilling($check_billing)
122
+ {
123
+ $this->check_billing = $check_billing;
124
+ }
125
+
126
+ /**
127
+ * @return string
128
+ */
129
+ public function getCheckBilling()
130
+ {
131
+ return $this->check_billing;
132
+ }
133
+
134
+ /**
135
+ * @return bool
136
+ */
137
+ public function mustCheckBilling()
138
+ {
139
+ if ($this->check_billing === Payone_Api_Enum_AddressCheckType::NONE) {
140
+ return false;
141
+ }
142
+ return true;
143
+ }
144
+
145
+ /**
146
+ * @return bool
147
+ */
148
+ public function mustCheckShipping()
149
+ {
150
+ if ($this->check_shipping === Payone_Api_Enum_AddressCheckType::NONE) {
151
+ return false;
152
+ }
153
+ return true;
154
+ }
155
+
156
+ /**
157
+ * @param int $check_shipping
158
+ */
159
+ public function setCheckShipping($check_shipping)
160
+ {
161
+ $this->check_shipping = $check_shipping;
162
+ }
163
+
164
+ /**
165
+ * @return int
166
+ */
167
+ public function getCheckShipping()
168
+ {
169
+ return $this->check_shipping;
170
+ }
171
+
172
+ /**
173
+ * @param int $enabled
174
+ */
175
+ public function setEnabled($enabled)
176
+ {
177
+ $this->enabled = $enabled;
178
+ }
179
+
180
+ /**
181
+ * @return int
182
+ */
183
+ public function getEnabled()
184
+ {
185
+ return $this->enabled;
186
+ }
187
+
188
+ /**
189
+ * @param null $mapping_personstatus
190
+ */
191
+ public function setMappingPersonstatus($mapping_personstatus)
192
+ {
193
+ $this->mapping_personstatus = $mapping_personstatus;
194
+ }
195
+
196
+ /**
197
+ * @return null
198
+ */
199
+ public function getMappingPersonstatus()
200
+ {
201
+ return $this->mapping_personstatus;
202
+ }
203
+
204
+ /**
205
+ * @param float $max_order_total
206
+ */
207
+ public function setMaxOrderTotal($max_order_total)
208
+ {
209
+ $this->max_order_total = $max_order_total;
210
+ }
211
+
212
+ /**
213
+ * @return float
214
+ */
215
+ public function getMaxOrderTotal()
216
+ {
217
+ return $this->max_order_total;
218
+ }
219
+
220
+ /**
221
+ * @param float $min_order_total
222
+ */
223
+ public function setMinOrderTotal($min_order_total)
224
+ {
225
+ $this->min_order_total = $min_order_total;
226
+ }
227
+
228
+ /**
229
+ * @return float
230
+ */
231
+ public function getMinOrderTotal()
232
+ {
233
+ return $this->min_order_total;
234
+ }
235
+
236
+ /**
237
+ * @param string $mode
238
+ */
239
+ public function setMode($mode)
240
+ {
241
+ $this->mode = $mode;
242
+ }
243
+
244
+ /**
245
+ * @return string
246
+ */
247
+ public function getMode()
248
+ {
249
+ return $this->mode;
250
+ }
251
+
252
+ /**
253
+ * @param int $result_lifetime
254
+ */
255
+ public function setResultLifetime($result_lifetime)
256
+ {
257
+ $this->result_lifetime = $result_lifetime;
258
+ }
259
+
260
+ /**
261
+ * @return int
262
+ */
263
+ public function getResultLifetime()
264
+ {
265
+ return $this->result_lifetime;
266
+ }
267
+
268
+ /**
269
+ * @return int
270
+ */
271
+ public function getResultLifetimeInSeconds()
272
+ {
273
+ return $this->result_lifetime * 24 * 3600;
274
+ }
275
+
276
+ /**
277
+ * @param boolean $confirm_address_correction
278
+ */
279
+ public function setConfirmAddressCorrection($confirm_address_correction)
280
+ {
281
+ $this->confirm_address_correction = $confirm_address_correction;
282
+ }
283
+
284
+ /**
285
+ * @return boolean
286
+ */
287
+ public function getConfirmAddressCorrection()
288
+ {
289
+ return $this->confirm_address_correction;
290
+ }
291
+
292
+ /**
293
+ * @param string $handle_response_error
294
+ */
295
+ public function setHandleResponseError($handle_response_error)
296
+ {
297
+ $this->handle_response_error = $handle_response_error;
298
+ }
299
+
300
+ /**
301
+ * @return string
302
+ */
303
+ public function getHandleResponseError()
304
+ {
305
+ return $this->handle_response_error;
306
+ }
307
+
308
+ /**
309
+ * @return bool
310
+ */
311
+ public function onErrorContinueCheckout()
312
+ {
313
+ if ($this->handle_response_error === Payone_Core_Model_System_Config_HandleResponseError::CONTINUE_CHECKOUT) {
314
+ return true;
315
+ }
316
+ return false;
317
+ }
318
+
319
+ /**
320
+ * @return bool
321
+ */
322
+ public function onErrorStopCheckout()
323
+ {
324
+ if ($this->handle_response_error === Payone_Core_Model_System_Config_HandleResponseError::STOP_CHECKOUT) {
325
+ return true;
326
+ }
327
+ return false;
328
+ }
329
+
330
+ /**
331
+ * @param string $stop_checkout_message
332
+ */
333
+ public function setStopCheckoutMessage($stop_checkout_message)
334
+ {
335
+ $this->stop_checkout_message = $stop_checkout_message;
336
+ }
337
+
338
+ /**
339
+ * @return string
340
+ */
341
+ public function getStopCheckoutMessage()
342
+ {
343
+ return $this->stop_checkout_message;
344
+ }
345
+
346
+ /**
347
+ * @param string $message_response_invalid
348
+ */
349
+ public function setMessageResponseInvalid($message_response_invalid)
350
+ {
351
+ $this->message_response_invalid = $message_response_invalid;
352
+ }
353
+
354
+ /**
355
+ * @return string
356
+ */
357
+ public function getMessageResponseInvalid()
358
+ {
359
+ return $this->message_response_invalid;
360
+ }
361
+
362
+
363
+ }
app/code/community/Payone/Core/Model/Config/Protect/Creditrating.php ADDED
@@ -0,0 +1,509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Config
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Config_Protect_Creditrating
34
+ extends Payone_Core_Model_Config_AreaAbstract
35
+ {
36
+ /**
37
+ * @var int
38
+ */
39
+ protected $enabled = 0;
40
+ /**
41
+ * @var string
42
+ */
43
+ protected $type = '';
44
+
45
+ /** @var string */
46
+ protected $mode = '';
47
+
48
+ /** @var int */
49
+ protected $payment_hint_enabled = 0;
50
+ /** @var string */
51
+ protected $payment_hint_text = '';
52
+
53
+ /** @var int */
54
+ protected $agreement_enabled = 0;
55
+
56
+ /** @var string */
57
+ protected $agreement_message ='';
58
+
59
+ /**
60
+ * @var string
61
+ */
62
+ protected $integration_event = '';
63
+ /**
64
+ * @var array
65
+ */
66
+ protected $enabled_for_payment_methods = array();
67
+
68
+ /**
69
+ * @var array
70
+ */
71
+ protected $allow_payment_methods_yellow = null;
72
+ /**
73
+ * @var array
74
+ */
75
+ protected $allow_payment_methods_red = null;
76
+ /**
77
+ * @var int
78
+ */
79
+ protected $result_lifetime = 0;
80
+
81
+ /**
82
+ * @var float
83
+ */
84
+ protected $min_order_total = 0.00;
85
+
86
+ /**
87
+ * @var float
88
+ */
89
+ protected $max_order_total = 0.00;
90
+
91
+ /** @var string */
92
+ protected $handle_response_error = '';
93
+
94
+ /** @var string */
95
+ protected $stop_checkout_message = '';
96
+
97
+ /** @var int */
98
+ protected $sample_mode_enabled = 0;
99
+
100
+ /** @var int */
101
+ protected $sample_mode_frequency = 0;
102
+
103
+ public function init(array $data)
104
+ {
105
+ foreach ($data as $key => $value) {
106
+ if ($key == 'enabled_for_payment_methods'
107
+ or $key == 'allow_payment_methods_yellow'
108
+ or $key == 'allow_payment_methods_red'
109
+ ) {
110
+ if (is_string($value)) {
111
+ $value = explode(',', $value);
112
+ }
113
+ }
114
+ $this->setValue($key, $value);
115
+ }
116
+ }
117
+
118
+ /**
119
+ * @return bool
120
+ */
121
+ public function isIntegrationEventBeforePayment()
122
+ {
123
+ return $this->integration_event == Payone_Core_Model_System_Config_CreditratingIntegrationEvent::BEFORE_PAYMENT;
124
+ }
125
+
126
+ /**
127
+ * @return bool
128
+ */
129
+ public function isIntegrationEventAfterPayment()
130
+ {
131
+ return $this->integration_event == Payone_Core_Model_System_Config_CreditratingIntegrationEvent::AFTER_PAYMENT;
132
+ }
133
+
134
+ /**
135
+ * @param string $code
136
+ * @return bool
137
+ */
138
+ public function isEnabledForMethod($code)
139
+ {
140
+ return in_array($code, $this->enabled_for_payment_methods);
141
+ }
142
+
143
+ /**
144
+ * @param array $allow_payment_methods_red
145
+ */
146
+ public function setAllowPaymentMethodsRed($allow_payment_methods_red)
147
+ {
148
+ $this->allow_payment_methods_red = $allow_payment_methods_red;
149
+ }
150
+
151
+ /**
152
+ * @return array
153
+ */
154
+ public function getAllowPaymentMethodsRed()
155
+ {
156
+ return $this->allow_payment_methods_red;
157
+ }
158
+
159
+ /**
160
+ * @param array $allow_payment_methods_yellow
161
+ */
162
+ public function setAllowPaymentMethodsYellow($allow_payment_methods_yellow)
163
+ {
164
+ $this->allow_payment_methods_yellow = $allow_payment_methods_yellow;
165
+ }
166
+
167
+ /**
168
+ * @return array
169
+ */
170
+ public function getAllowPaymentMethodsYellow()
171
+ {
172
+ return $this->allow_payment_methods_yellow;
173
+ }
174
+
175
+ /**
176
+ * @param int $enabled
177
+ */
178
+ public function setEnabled($enabled)
179
+ {
180
+ $this->enabled = $enabled;
181
+ }
182
+
183
+ /**
184
+ * @return int
185
+ */
186
+ public function getEnabled()
187
+ {
188
+ return $this->enabled;
189
+ }
190
+
191
+ /**
192
+ * @return bool
193
+ */
194
+ public function isEnabled()
195
+ {
196
+ if($this->getEnabled())
197
+ {
198
+ return true;
199
+ }
200
+ return false;
201
+ }
202
+
203
+ /**
204
+ * @param float $max_order_total
205
+ */
206
+ public function setMaxOrderTotal($max_order_total)
207
+ {
208
+ $this->max_order_total = $max_order_total;
209
+ }
210
+
211
+ /**
212
+ * @return float
213
+ */
214
+ public function getMaxOrderTotal()
215
+ {
216
+ return $this->max_order_total;
217
+ }
218
+
219
+ /**
220
+ * @param float $min_order_total
221
+ */
222
+ public function setMinOrderTotal($min_order_total)
223
+ {
224
+ $this->min_order_total = $min_order_total;
225
+ }
226
+
227
+ /**
228
+ * @return float
229
+ */
230
+ public function getMinOrderTotal()
231
+ {
232
+ return $this->min_order_total;
233
+ }
234
+
235
+ /**
236
+ * @param int $result_lifetime
237
+ */
238
+ public function setResultLifetime($result_lifetime)
239
+ {
240
+ $this->result_lifetime = $result_lifetime;
241
+ }
242
+
243
+ /**
244
+ * @return int
245
+ */
246
+ public function getResultLifetime()
247
+ {
248
+ return $this->result_lifetime;
249
+ }
250
+
251
+ /**
252
+ * @return int
253
+ */
254
+ public function getResultLifetimeInSeconds()
255
+ {
256
+ return $this->result_lifetime * 24 * 3600;
257
+ }
258
+
259
+ /**
260
+ * @param string $type
261
+ */
262
+ public function setType($type)
263
+ {
264
+ $this->type = $type;
265
+ }
266
+
267
+ /**
268
+ * @return string
269
+ */
270
+ public function getType()
271
+ {
272
+ return $this->type;
273
+ }
274
+
275
+ /**
276
+ * @param string $mode
277
+ */
278
+ public function setMode($mode)
279
+ {
280
+ $this->mode = $mode;
281
+ }
282
+
283
+ /**
284
+ * @return string
285
+ */
286
+ public function getMode()
287
+ {
288
+ return $this->mode;
289
+ }
290
+
291
+ /**
292
+ * @param array $enabled_for_payment_methods
293
+ */
294
+ public function setEnabledForPaymentMethods($enabled_for_payment_methods)
295
+ {
296
+ $this->enabled_for_payment_methods = $enabled_for_payment_methods;
297
+ }
298
+
299
+ /**
300
+ * @return array
301
+ */
302
+ public function getEnabledForPaymentMethods()
303
+ {
304
+ return $this->enabled_for_payment_methods;
305
+ }
306
+
307
+ /**
308
+ * @param string $integration_event
309
+ */
310
+ public function setIntegrationEvent($integration_event)
311
+ {
312
+ $this->integration_event = $integration_event;
313
+ }
314
+
315
+ /**
316
+ * @return string
317
+ */
318
+ public function getIntegrationEvent()
319
+ {
320
+ return $this->integration_event;
321
+ }
322
+
323
+ /**
324
+ * @param string $handle_response_error
325
+ */
326
+ public function setHandleResponseError($handle_response_error)
327
+ {
328
+ $this->handle_response_error = $handle_response_error;
329
+ }
330
+
331
+ /**
332
+ * @return string
333
+ */
334
+ public function getHandleResponseError()
335
+ {
336
+ return $this->handle_response_error;
337
+ }
338
+
339
+ /**
340
+ * @return bool
341
+ */
342
+ public function onErrorContinueCheckout()
343
+ {
344
+ if ($this->handle_response_error === Payone_Core_Model_System_Config_HandleResponseError::CONTINUE_CHECKOUT) {
345
+ return true;
346
+ }
347
+ return false;
348
+ }
349
+
350
+ /**
351
+ * @return bool
352
+ */
353
+ public function onErrorStopCheckout()
354
+ {
355
+ if ($this->handle_response_error === Payone_Core_Model_System_Config_HandleResponseError::STOP_CHECKOUT) {
356
+ return true;
357
+ }
358
+ return false;
359
+ }
360
+
361
+ /**
362
+ * @param string $stop_checkout_message
363
+ */
364
+ public function setStopCheckoutMessage($stop_checkout_message)
365
+ {
366
+ $this->stop_checkout_message = $stop_checkout_message;
367
+ }
368
+
369
+ /**
370
+ * @return string
371
+ */
372
+ public function getStopCheckoutMessage()
373
+ {
374
+ return $this->stop_checkout_message;
375
+ }
376
+
377
+ /**
378
+ * @param int $sample_mode_enabled
379
+ */
380
+ public function setSampleModeEnabled($sample_mode_enabled)
381
+ {
382
+ $this->sample_mode_enabled = $sample_mode_enabled;
383
+ }
384
+
385
+ /**
386
+ * @return int
387
+ */
388
+ public function getSampleModeEnabled()
389
+ {
390
+ return $this->sample_mode_enabled;
391
+ }
392
+
393
+ /**
394
+ * @return bool
395
+ */
396
+ public function isSampleModeEnabled()
397
+ {
398
+ if ($this->getSampleModeEnabled()) {
399
+ return true;
400
+ }
401
+ return false;
402
+ }
403
+
404
+ /**
405
+ * @param int $sample_mode_frequency
406
+ */
407
+ public function setSampleModeFrequency($sample_mode_frequency)
408
+ {
409
+ $this->sample_mode_frequency = $sample_mode_frequency;
410
+ }
411
+
412
+ /**
413
+ * How often a sample must be taken, 1 out of X
414
+ *
415
+ * @return int
416
+ */
417
+ public function getSampleModeFrequency()
418
+ {
419
+ return $this->sample_mode_frequency;
420
+ }
421
+
422
+ /**
423
+ * @param int $agreement_enabled
424
+ */
425
+ public function setAgreementEnabled($agreement_enabled)
426
+ {
427
+ $this->agreement_enabled = $agreement_enabled;
428
+ }
429
+
430
+ /**
431
+ * @return int
432
+ */
433
+ public function getAgreementEnabled()
434
+ {
435
+ return $this->agreement_enabled;
436
+ }
437
+
438
+ /**
439
+ * @return bool
440
+ */
441
+ public function isAgreementEnabled()
442
+ {
443
+ if($this->getAgreementEnabled())
444
+ {
445
+ return true;
446
+ }
447
+ return false;
448
+ }
449
+
450
+ /**
451
+ * @param string $agreement_message
452
+ */
453
+ public function setAgreementMessage($agreement_message)
454
+ {
455
+ $this->agreement_message = $agreement_message;
456
+ }
457
+
458
+ /**
459
+ * @return string
460
+ */
461
+ public function getAgreementMessage()
462
+ {
463
+ return $this->agreement_message;
464
+ }
465
+
466
+ /**
467
+ * @param int $payment_hint_enabled
468
+ */
469
+ public function setPaymentHintEnabled($payment_hint_enabled)
470
+ {
471
+ $this->payment_hint_enabled = $payment_hint_enabled;
472
+ }
473
+
474
+ /**
475
+ * @return int
476
+ */
477
+ public function getPaymentHintEnabled()
478
+ {
479
+ return $this->payment_hint_enabled;
480
+ }
481
+
482
+ /**
483
+ * @return bool
484
+ */
485
+ public function isPaymentHintEnabled()
486
+ {
487
+ if($this->getPaymentHintEnabled())
488
+ {
489
+ return true;
490
+ }
491
+ return false;
492
+ }
493
+
494
+ /**
495
+ * @param string $payment_hint_text
496
+ */
497
+ public function setPaymentHintText($payment_hint_text)
498
+ {
499
+ $this->payment_hint_text = $payment_hint_text;
500
+ }
501
+
502
+ /**
503
+ * @return string
504
+ */
505
+ public function getPaymentHintText()
506
+ {
507
+ return $this->payment_hint_text;
508
+ }
509
+ }
app/code/community/Payone/Core/Model/Cronjob/Abstract.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Cronjob
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Cronjob
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Cronjob_Abstract
34
+ {
35
+ /**
36
+ *
37
+ * @var Payone_Core_Model_Factory
38
+ */
39
+ protected $factory = null;
40
+
41
+ /**
42
+ *
43
+ * @return Payone_Core_Model_Factory
44
+ */
45
+ public function getFactory()
46
+ {
47
+ if ($this->factory === null) {
48
+ $this->factory = new Payone_Core_Model_Factory();
49
+ }
50
+ return $this->factory;
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @param Payone_Core_Model_Factory $factory
56
+ */
57
+ public function setFactory(Payone_Core_Model_Factory $factory)
58
+ {
59
+ $this->factory = $factory;
60
+ }
61
+
62
+ }
app/code/community/Payone/Core/Model/Cronjob/TransactionStatus/Worker.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Cronjob
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Cronjob
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Cronjob_TransactionStatus_Worker
34
+ extends Payone_Core_Model_Cronjob_Abstract
35
+ {
36
+ /** @var Payone_Core_Model_Service_TransactionStatus_Process */
37
+ protected $serviceProcessRequest = null;
38
+
39
+ /**
40
+ * @param Mage_Cron_Model_Schedule $schedule
41
+ * @return void
42
+ */
43
+ public function execute(Mage_Cron_Model_Schedule $schedule)
44
+ {
45
+ $service = $this->getFactory()->getServiceTransactionStatusExecute();
46
+
47
+ $count = $service->executePending();
48
+
49
+ $schedule->setMessages($count . ' Transaction-Status processed');
50
+ }
51
+
52
+ }
app/code/community/Payone/Core/Model/Domain/Config/PaymentMethod.php ADDED
@@ -0,0 +1,494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ *
33
+ * @method setId($id)
34
+ * @method int getId()
35
+ * @method setScope($scope)
36
+ * @method string getScope()
37
+ * @method setScopeId($scopeId)
38
+ * @method int getScopeId()
39
+ * @method setCode($code)
40
+ * @method string getCode()
41
+ * @method setName($name)
42
+ * @method string getName()
43
+ * @mehtod setSortOrder($sortOrder)
44
+ * @method int getSortOrder()
45
+ * @method setEnabled($enabled)
46
+ * @method int getEnabled()
47
+ * @method setFeeConfig($config)
48
+ * @method setMode($mode)
49
+ * @method string getMode()
50
+ * @method setUseGlobal($useGlobal)
51
+ * @method int getUseGlobal()
52
+ * @method setMid($mid)
53
+ * @method int getMid()
54
+ * @method setAid($aid)
55
+ * @method int getAid()
56
+ * @method setPortalid($portalid)
57
+ * @method int getPortalid()
58
+ * @method setKey($key)
59
+ * @method string getKey()
60
+ * @method setRequestType($requestType)
61
+ * @method string getRequestType()
62
+ * @method setAllowspecific($allowspecific)
63
+ * @method int getAllowspecific()
64
+ * @method setSpecificcountry($specificcountry)
65
+ * @method setInvoiceTransmit($invoiceTransmit)
66
+ * @method int getInvoiceTransmit()
67
+ * @method setTypes($types)
68
+ * @method setCheckCvc($checkCvc)
69
+ * @method int getCheckCvc()
70
+ * @method setCheckBankAccount($checkBankaccount)
71
+ * @method int getCheckBankAccount()
72
+ * @method setMinOrderTotal($minOrderTotal)
73
+ * @method float getMinOrderTotal()
74
+ * @method setMaxOrderTotal($maxOrderTotal)
75
+ * @method float getMaxOrderTotal()
76
+ * @method setParentDefaultId($id)
77
+ * @method int getParentDefaultId()
78
+ * @method setParentWebsitesId($id)
79
+ * @method int getParentWebsitesId()
80
+ * @method setIsDeleted($isDeleted)
81
+ * @method int getIsDeleted()
82
+ * @method setCreatedAt(string $dateTime)
83
+ * @method string getCreatedAt()
84
+ * @method setUpdatedAt(string $dateTime)
85
+ * @method string getUpdatedAt()
86
+ *
87
+ * @method setStore($store)
88
+ * @method string getStore()
89
+ * @method setWebsite($website)
90
+ * @method string getWebsite()
91
+ * @method setGroups($groups)
92
+ * @method array getGroups()
93
+ */
94
+ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abstract
95
+ {
96
+ /**
97
+ *
98
+ */
99
+ public function _construct()
100
+ {
101
+ parent::_construct();
102
+ $this->_init('payone_core/config_paymentMethod');
103
+ }
104
+
105
+ /**
106
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
107
+ */
108
+ protected function _beforeSave()
109
+ {
110
+ $this->validate();
111
+ $this->prepareScope();
112
+
113
+ $groups = $this->getGroups();
114
+ if (is_array($groups)) {
115
+ $data = $this->initDataObject($groups);
116
+ $this->addData($data);
117
+ }
118
+
119
+ $originModel = $this->loadOriginPaymentMethodConfig();
120
+ if ($originModel
121
+ && ($this->getScope() != $originModel->getScope()
122
+ || $this->getScopeId() != $originModel->getScopeId()
123
+ )
124
+ ) {
125
+ $parentScope = '';
126
+ if ($this->getScope() == 'stores') {
127
+ $parentScope = 'websites';
128
+ }
129
+ elseif ($this->getScope() == 'websites') {
130
+ $parentScope = 'default';
131
+ }
132
+
133
+ // only add an empty paymentMethod if we are in store-scope
134
+ if ($originModel->getScope() != $parentScope) {
135
+ $parentField = 'parent_' . $originModel->getScope() . '_id';
136
+ /** @var $dummy Payone_Core_Model_Domain_Config_PaymentMethod */
137
+ $dummy = Mage::getModel('payone_core/domain_config_paymentMethod');
138
+ $dummy->setScope($parentScope);
139
+ $dummy->setScopeId($this->getScopeId());
140
+ $dummy->setCode($originModel->getCode());
141
+ $dummy->setData($parentField, $this->getId());
142
+ $dummy->setMode(null);
143
+ // set because they where shown in the grid
144
+ $dummy->setName($originModel->getName());
145
+ $dummy->save();
146
+ }
147
+ else
148
+ {
149
+ $dummy = null;
150
+ }
151
+
152
+ $parentField = 'parent_' . $parentScope . '_id';
153
+ $parentId = $dummy ? $dummy->getId() : $this->getId();
154
+ $this->setData($parentField, $parentId);
155
+ $this->unsetData('id');
156
+ }
157
+
158
+ $code = $this->getCode();
159
+ if (empty($code)) {
160
+ $this->setCode($originModel->getCode());
161
+ }
162
+
163
+ $this->prepareData();
164
+
165
+ if ($this->isObjectNew()) {
166
+ $this->setCreatedAt(date('Y-m-d H:i:s'));
167
+ $this->setUpdatedAt(date('Y-m-d H:i:s'));
168
+ }
169
+ else {
170
+ $this->setUpdatedAt(date('Y-m-d H:i:s'));
171
+ }
172
+
173
+ return $this;
174
+ }
175
+
176
+ /**
177
+ * Load original PaymentMethod from Database
178
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
179
+ */
180
+ public function loadOriginPaymentMethodConfig()
181
+ {
182
+ if ($this->getId()) {
183
+
184
+ /** @var $originModel Payone_Core_Model_Domain_Config_PaymentMethod */
185
+ $originModel = Mage::getModel('payone_core/domain_config_paymentMethod');
186
+ $originModel->load($this->getId());
187
+ $originModel->prepareData();
188
+ return $originModel;
189
+ }
190
+ return null;
191
+ }
192
+
193
+ /**
194
+ * Validate Store and Website
195
+ */
196
+ private function validate()
197
+ {
198
+ if (is_null($this->getWebsite())) {
199
+ $this->setWebsite('');
200
+ }
201
+ if (is_null($this->getStore())) {
202
+ $this->setStore('');
203
+ }
204
+ }
205
+
206
+ /**
207
+ * Prepare Scope and ScopeId
208
+ */
209
+ private function prepareScope()
210
+ {
211
+ $scope = $this->getScope();
212
+ $scopeId = $this->getScopeId();
213
+ if (!isset($scope) && !isset($scopeId)) {
214
+
215
+
216
+ if ($this->getStore()) {
217
+ $scope = 'stores';
218
+ $scopeId = (int)Mage::getConfig()->getNode('stores/' . $this->getStore() . '/system/store/id');
219
+ }
220
+ elseif ($this->getWebsite()) {
221
+ $scope = 'websites';
222
+ $scopeId = (int)Mage::getConfig()->getNode('websites/' . $this->getWebsite() . '/system/website/id');
223
+ }
224
+ else {
225
+ $scope = 'default';
226
+ $scopeId = 0;
227
+ }
228
+ $this->setScope($scope);
229
+ $this->setScopeId($scopeId);
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Prepares data for ConfigData
235
+ * @param $methodType
236
+ * @param $currentScope
237
+ * @return array|null
238
+ */
239
+ public function initConfigObject($methodType, $currentScope)
240
+ {
241
+ $this->validate();
242
+ $this->prepareScope();
243
+ if ($this->getScope() != $currentScope) {
244
+ return null;
245
+ }
246
+ $data = $this->getData();
247
+ $configData = array();
248
+ $keyPrefix = Payone_Core_Block_Adminhtml_System_Config_Form_Payment_Method::SECTION_PAYONE_PAYMENT . '/';
249
+ $keyPrefix .= Payone_Core_Block_Adminhtml_System_Config_Form_Payment_Method::GROUP_TEMPLATE_PREFIX . $methodType . '/';
250
+ foreach ($data as $key => $value) {
251
+ $configData[$keyPrefix . $key] = $value;
252
+ }
253
+
254
+ return $configData;
255
+ }
256
+
257
+ /**
258
+ * Prepares the data, before the model could be saved
259
+ * @param $groups
260
+ * @return array
261
+ */
262
+ protected function initDataObject($groups)
263
+ {
264
+ $templateArr = array_pop($groups);
265
+ $data = array_pop($templateArr);
266
+ $mappedData = array();
267
+ foreach ($data as $fieldKey => $fieldValue) {
268
+ $inherit = !empty($fieldValue['inherit']);
269
+ if ($inherit) {
270
+ $mappedData[$fieldKey] = null;
271
+ }
272
+ else {
273
+ $value = array_pop($fieldValue);
274
+ switch ($fieldKey) {
275
+ case 'fee_config':
276
+ unset($value['__empty']);
277
+ $value = empty($value) ? null : $value;
278
+ break;
279
+ case 'use_global':
280
+ if($value){
281
+ // set data to null if we use global config
282
+ $mappedData['allowspecific'] = null;
283
+ $mappedData['specificcountry'] = null;
284
+ $mappedData['mid'] = null;
285
+ $mappedData['portalid'] = null;
286
+ $mappedData['aid'] = null;
287
+ $mappedData['key'] = null;
288
+ $mappedData['request_type'] = null;
289
+ $mappedData['invoice_transmit'] = null;
290
+ }
291
+ break;
292
+ default:
293
+ if (!isset($value)) {
294
+ continue 2;
295
+ }elseif($value == '')
296
+ {
297
+ $value = null;
298
+ }
299
+ break;
300
+ }
301
+ $mappedData[$fieldKey] = $value;
302
+ }
303
+ }
304
+ return $mappedData;
305
+ }
306
+
307
+ /**
308
+ * Loads parent model if it has one
309
+ * @return null|Payone_Core_Model_Domain_Config_PaymentMethod
310
+ */
311
+ public function getParentModel()
312
+ {
313
+ $originModel = $this->loadOriginPaymentMethodConfig();
314
+ if ($originModel) {
315
+ return $this->loadParentModel($originModel);
316
+ }
317
+ return null;
318
+ }
319
+
320
+ /**
321
+ * Checks if there is a parent model and returns it
322
+ * @param $model Payone_Core_Model_Domain_Config_PaymentMethod
323
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
324
+ */
325
+ protected function loadParentModel($model)
326
+ {
327
+ $model->validate();
328
+ $model->prepareScope();
329
+ if ($model->getScope() == 'websites') {
330
+ $parentField = 'parent_default_id';
331
+ }
332
+ elseif ($model->getScope() == 'stores') {
333
+ $parentField = 'parent_websites_id';
334
+ }
335
+ else {
336
+ $model->prepareData();
337
+ return $model;
338
+ }
339
+ /** @var $parentModel Payone_Core_Model_Domain_Config_PaymentMethod */
340
+ $parentModel = Mage::getModel('payone_core/domain_config_paymentMethod');
341
+ $parentModel->load($model->getData($parentField));
342
+ $parentModel->prepareData();
343
+ return $parentModel;
344
+
345
+ }
346
+
347
+ /**
348
+ * Loads originData, checks if it has parent PaymentMethodConfigs and merges the data together
349
+ * @param bool $prepareData
350
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
351
+ */
352
+ public function loadMergedData($prepareData = true)
353
+ {
354
+ $parentModel = $this->getParentModel();
355
+ if ($parentModel) {
356
+ $grandParentModel = $this->loadParentModel($parentModel);
357
+ $parentCleanModel = $this->removeEmptyData($parentModel);
358
+ $currentCleanModel = $this->removeEmptyData($this);
359
+ $mergedArray = array_merge($grandParentModel->getData(), $parentCleanModel->getData(), $currentCleanModel->getData());
360
+ $this->setData($mergedArray);
361
+ }
362
+ // prepare data
363
+ if ($prepareData) {
364
+ $this->afterLoadPrepareData();
365
+ }
366
+ return $this;
367
+ }
368
+
369
+ /**
370
+ * Cleans $model. Remove all empty data
371
+ * @param $model Payone_Core_Model_Domain_Config_PaymentMethod
372
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
373
+ */
374
+ private function removeEmptyData($model)
375
+ {
376
+ $data = $model->getData();
377
+ $model->unsetData();
378
+ foreach ($data as $key => $value) {
379
+ if (isset($value)) {
380
+ $model->setData($key, $value);
381
+ }
382
+ }
383
+ return $model;
384
+ }
385
+
386
+ /**
387
+ * @return Mage_Core_Model_Abstract | Payone_Core_Model_Domain_Config_PaymentMethod
388
+ */
389
+ protected function _afterLoad()
390
+ {
391
+ $this->afterLoadPrepareData();
392
+
393
+ return $this;
394
+ }
395
+
396
+ /**
397
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
398
+ */
399
+ public function afterLoadPrepareData()
400
+ {
401
+ // prepare fee_config
402
+ $this->unserializeData('fee_config');
403
+ $this->explodeData('types');
404
+ $this->explodeData('specificcountry');
405
+ }
406
+
407
+ /**
408
+ *
409
+ */
410
+ protected function prepareData()
411
+ {
412
+ // prepare types
413
+ $this->implodeData('types');
414
+
415
+ // prepare specificcountry
416
+ $this->implodeData('specificcountry');
417
+
418
+ // prepare fee_config
419
+ $this->serializeData('fee_config');
420
+ }
421
+
422
+ /**
423
+ * @param string $key
424
+ */
425
+ private function serializeData($key)
426
+ {
427
+ $data = $this->getData($key);
428
+ if (is_array($data)) {
429
+ unset($data['__empty']);
430
+ $this->setData($key, serialize($data));
431
+ }
432
+ }
433
+
434
+ /**
435
+ * @param $key
436
+ */
437
+ private function unserializeData($key)
438
+ {
439
+ $data = $this->getData($key);
440
+ if (!is_array($data) && $data != '') {
441
+ $this->setData($key, empty($data) ? false : unserialize($data));
442
+ }
443
+ }
444
+
445
+ /**
446
+ * @param string $key
447
+ */
448
+ private function implodeData($key)
449
+ {
450
+ $data = $this->getData($key);
451
+ if (is_array($data)) {
452
+ $this->setData($key, implode(',', $data));
453
+ }
454
+
455
+ }
456
+
457
+ /**
458
+ * @param string $key
459
+ */
460
+ private function explodeData($key)
461
+ {
462
+ $data = $this->getData($key);
463
+ if ($data !== null && !is_array($data)) {
464
+ $this->setData($key, empty($data) ? false : explode(',', $data));
465
+ }
466
+ }
467
+
468
+ /**
469
+ * @return array
470
+ */
471
+ public function getTypes()
472
+ {
473
+ $this->explodeData('types');
474
+ return $this->getData('types');
475
+ }
476
+
477
+ /**
478
+ * @return array
479
+ */
480
+ public function getFeeConfig()
481
+ {
482
+ $this->unserializeData('fee_config');
483
+ return $this->getData('fee_config');
484
+ }
485
+
486
+ /**
487
+ * @return array
488
+ */
489
+ public function getSpecificcountry()
490
+ {
491
+ $this->explodeData('specificcountry');
492
+ return $this->getData('specificcountry');
493
+ }
494
+ }
app/code/community/Payone/Core/Model/Domain/Protocol/Api.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ *
33
+ * @method setCreatedAt(string $dateTime)
34
+ * @method string getCreatedAt()
35
+ * @method setUpdatedAt(string $dateTime)
36
+ * @method string getUpdatedAt()
37
+ * @method int getId()
38
+ * @method setId(int $id)
39
+ * @method int getId()
40
+ * @method setRawResponse(string $rawResponse)
41
+ * @method string getRawResponse()
42
+ * @method setRawRequest(string $rawRequest)
43
+ * @method string getRawRequest()
44
+ * @method setResponse(string $response)
45
+ * @method string getResponse()
46
+ * @method setRequest(string $Request)
47
+ * @method string getRequest()
48
+ * @method setStacktrace(string $message)
49
+ * @method setStoreId(int $storeid)
50
+ * @method int getStoreId()
51
+ * @method string getStacktrace()
52
+ * @method setId(int $id)
53
+ * @method setOrderId(int $orderid)
54
+ * @method int getOrderId()
55
+ */
56
+ class Payone_Core_Model_Domain_Protocol_Api extends Mage_Core_Model_Abstract
57
+ {
58
+
59
+ protected $_eventPrefix = 'payone_core_api_protocol';
60
+
61
+ /**
62
+ *
63
+ */
64
+ public function _construct()
65
+ {
66
+ parent::_construct();
67
+ $this->_init('payone_core/protocol_api');
68
+ }
69
+
70
+ /**
71
+ * @return Payone_Core_Model_Domain_Protocol_Api
72
+ */
73
+ protected function _beforeSave()
74
+ {
75
+ parent::_beforeSave();
76
+
77
+ if ($this->isObjectNew()) {
78
+ $this->setCreatedAt(date('Y-m-d H:i:s'));
79
+ }
80
+ else {
81
+ $this->setUpdatedAt(date('Y-m-d H:i:s'));
82
+ }
83
+
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ * Returns the raw request to Payone as an array
89
+ * @return array
90
+ */
91
+ public function getRawRequestAsArray()
92
+ {
93
+ $rawRequest = $this->getRawRequest();
94
+ $preparedRawRequest = $this->prepareData($rawRequest);
95
+
96
+ ksort($preparedRawRequest);
97
+
98
+ return $preparedRawRequest;
99
+ }
100
+
101
+ /**
102
+ * Returns the raw request to Payone as an array
103
+ * @return array
104
+ */
105
+ public function getRawResponseAsArray()
106
+ {
107
+ $rawResponse = $this->getRawResponse();
108
+ $preparedRawResponse = $this->prepareData($rawResponse);
109
+ ksort($preparedRawResponse);
110
+
111
+ return $preparedRawResponse;
112
+ }
113
+
114
+ /**
115
+ * @param $data
116
+ * @return array
117
+ */
118
+ protected function prepareData($data)
119
+ {
120
+ if (!is_array($data)) {
121
+ $data = explode('|', $data);
122
+ }
123
+
124
+ $preparedData = array();
125
+ foreach ($data as $key => $value) {
126
+ $valuearr = explode('=', $value);
127
+ if (isset($valuearr[1]) && $valuearr[1] !=='') {
128
+ $preparedData[$valuearr[0]] = $valuearr[1];
129
+ }
130
+ }
131
+
132
+ return $preparedData;
133
+ }
134
+ }
app/code/community/Payone/Core/Model/Domain/Protocol/TransactionStatus.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ *
33
+ * @method int getStoreId()
34
+ * @method setStoreId(int $id)
35
+ * @method int getOrderId()
36
+ * @method setOrderId(int $id)
37
+ * @method string getReference()
38
+ * @method setCreatedAt(string $dateTime)
39
+ * @method string getCreatedAt()
40
+ * @method setUpdatedAt(string $dateTime)
41
+ * @method string getUpdatedAt()
42
+ * @method setTxid(int $txid)
43
+ * @method int getTxid()
44
+ * @method setTxaction(string $txAction)
45
+ * @method string getTxaction()
46
+ * @method string getReminderlevel()
47
+ * @method setSequencenumber(int $nr)
48
+ * @method string getSequencenumber()
49
+ * @method setClearingtype(string $type)
50
+ * @method string getClearingtype()
51
+ */
52
+ class Payone_Core_Model_Domain_Protocol_TransactionStatus extends Mage_Core_Model_Abstract
53
+ {
54
+ const STATUS_PENDING = 'pending';
55
+ const STATUS_RUNNING = 'running';
56
+ const STATUS_OK = 'complete';
57
+ const STATUS_ERROR = 'error';
58
+
59
+ /**
60
+ *
61
+ */
62
+ public function _construct()
63
+ {
64
+ parent::_construct();
65
+ $this->_init('payone_core/protocol_transactionStatus');
66
+ }
67
+
68
+ /**
69
+ * @return Payone_Core_Model_Domain_Protocol_TransactionStatus
70
+ */
71
+ protected function _beforeSave()
72
+ {
73
+ parent::_beforeSave();
74
+
75
+ if ($this->isObjectNew()) {
76
+ $this->setCreatedAt(date('Y-m-d H:i:s'));
77
+ $this->setStatusPending();
78
+ }
79
+ else {
80
+ $this->setUpdatedAt(date('Y-m-d H:i:s'));
81
+ }
82
+
83
+ return $this;
84
+ }
85
+
86
+ /**
87
+ * Filters Data result only containing allowedKey
88
+ *
89
+ * if allowedkeys is empty, all will be returned
90
+ *
91
+ * @param array $allowedKeys
92
+ * @return string
93
+ */
94
+ public function toStringKeyValue(array $allowedKeys = array())
95
+ {
96
+ $filter = false;
97
+ if (count($allowedKeys)) {
98
+ $filter = true;
99
+ }
100
+ $stringArray = array();
101
+ foreach ($this->toArray() as $key => $value) {
102
+ if ($filter and !in_array($key, $allowedKeys)) {
103
+ continue;
104
+ }
105
+ $stringArray[] = $key . '=' . $value;
106
+ }
107
+
108
+ $result = implode("\n", $stringArray);
109
+ return $result;
110
+ }
111
+
112
+ /**
113
+ * @param array $allowedKeys
114
+ * @return array
115
+ */
116
+ public function __toArray(array $allowedKeys = array())
117
+ {
118
+ if (empty($allowedKeys)) {
119
+ return $this->_data;
120
+ }
121
+
122
+ $arrRes = array();
123
+ foreach ($allowedKeys as $attribute) {
124
+ if (isset($this->_data[$attribute]) && $this->_data[$attribute] !== '') {
125
+ $arrRes[$attribute] = $this->_data[$attribute];
126
+ }
127
+ }
128
+ return $arrRes;
129
+ }
130
+
131
+ /**
132
+ * Returns the raw request to Payone as an array
133
+ * @return array
134
+ */
135
+ public function getRawRequest()
136
+ {
137
+ $allowedKeys = array(
138
+ 'key',
139
+ 'txaction',
140
+ 'mode',
141
+ 'portalid',
142
+ 'aid',
143
+ 'clearingtype',
144
+ 'txtime',
145
+ 'currency',
146
+ 'userid',
147
+ 'customerid',
148
+ 'param',
149
+ 'reference',
150
+ 'sequencenumber',
151
+ 'receivable',
152
+ 'balance',
153
+ 'failedcause',
154
+ 'productid',
155
+ 'accessid',
156
+ 'reminderlevel',
157
+ 'vaid',
158
+ 'vreference',
159
+ 'vxid',
160
+ 'txid',
161
+ 'invoiceid',
162
+ 'invoice_grossamount',
163
+ 'invoice_date',
164
+ 'invoice_deliverydate',
165
+ 'invoice_deliveryenddate');
166
+
167
+ $rawData = $this->__toArray($allowedKeys);
168
+ ksort($rawData);
169
+
170
+ return $rawData;
171
+
172
+ }
173
+
174
+ /**
175
+ * @return bool
176
+ */
177
+ public function isAppointed()
178
+ {
179
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::APPOINTED;
180
+ }
181
+
182
+ /**
183
+ * @return bool
184
+ */
185
+ public function isCapture()
186
+ {
187
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::CAPTURE;
188
+ }
189
+
190
+ /**
191
+ * @return bool
192
+ */
193
+ public function isPaid()
194
+ {
195
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::PAID;
196
+ }
197
+
198
+ /**
199
+ * @return bool
200
+ */
201
+ public function isUnderpaid()
202
+ {
203
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::UNDERPAID;
204
+ }
205
+
206
+ /**
207
+ * @return bool
208
+ */
209
+ public function isCancelation()
210
+ {
211
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::CANCELATION;
212
+ }
213
+
214
+ /**
215
+ * @return bool
216
+ */
217
+ public function isRefund()
218
+ {
219
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::REFUND;
220
+ }
221
+
222
+ /**
223
+ * @return bool
224
+ */
225
+ public function isDebit()
226
+ {
227
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::DEBIT;
228
+ }
229
+
230
+ /**
231
+ * @return bool
232
+ */
233
+ public function isReminder()
234
+ {
235
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::REMINDER;
236
+ }
237
+
238
+ /**
239
+ * @return bool
240
+ */
241
+ public function isTransfer()
242
+ {
243
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::TRANSFER;
244
+ }
245
+
246
+ /**
247
+ * @return bool
248
+ */
249
+ public function isVauthorization()
250
+ {
251
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::VAUTHORIZATION;
252
+ }
253
+
254
+ /**
255
+ * @return bool
256
+ */
257
+ public function isVsettlement()
258
+ {
259
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::VSETTLEMENT;
260
+ }
261
+
262
+ /**
263
+ * @return bool
264
+ */
265
+ public function isInvoice()
266
+ {
267
+ return $this->getTxaction() == Payone_TransactionStatus_Enum_Txaction::INVOICE;
268
+ }
269
+
270
+ public function setStatusPending()
271
+ {
272
+ $this->setProcessingStatus(self::STATUS_PENDING);
273
+ }
274
+
275
+ public function setStatusOk()
276
+ {
277
+ $this->setProcessingStatus(self::STATUS_OK);
278
+ }
279
+
280
+
281
+ public function setStatusRunning()
282
+ {
283
+ $this->setProcessingStatus(self::STATUS_RUNNING);
284
+ }
285
+
286
+
287
+ public function setStatusError()
288
+ {
289
+ $this->setProcessingStatus(self::STATUS_ERROR);
290
+ }
291
+
292
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Config_PaymentMethod
34
+ extends Mage_Core_Model_Mysql4_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ $this->_init('payone_core/config_payment_method', 'id');
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod/Collection.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
34
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ parent::_construct();
42
+ $this->_init('payone_core/domain_config_paymentMethod');
43
+ }
44
+
45
+ public function addItem(Varien_Object $item)
46
+ {
47
+ /** @var $item Payone_Core_Model_Domain_Config_PaymentMethod */
48
+ $item->afterLoadPrepareData();
49
+ return parent::addItem($item);
50
+ }
51
+
52
+ /**
53
+ * if activated, the result will only return not deleted methods
54
+ */
55
+ public function filterExcludeDeleted()
56
+ {
57
+ $this->addFilterIsDeleted(0);
58
+ }
59
+
60
+ /**
61
+ * 0 => deleted methods are excluded
62
+ * 1 => deleted methods are included
63
+ *
64
+ * @param int $isDeleted
65
+ */
66
+ protected function addFilterIsDeleted($isDeleted = 0)
67
+ {
68
+ $this->addFieldToFilter('is_deleted', array('eq' => $isDeleted));
69
+ }
70
+
71
+ /**
72
+ * if used, all paymentmethod-configs with scope 'default' and 'websites' were returned
73
+ */
74
+ public function filterExcludeStoresScope()
75
+ {
76
+ $this->addFilterScope('websites');
77
+ }
78
+
79
+ /**
80
+ * @param $scope
81
+ */
82
+ protected function addFilterScope($scope)
83
+ {
84
+ // OR-Statement
85
+ $this->addFieldToFilter('scope',
86
+ array(
87
+ array('attribute' => 'scope', 'eq' => 'default'),
88
+ array('attribute' => 'scope', 'eq' => $scope)
89
+ ));
90
+ }
91
+
92
+ /**
93
+ * @param $store Mage_Core_Model_Store
94
+ */
95
+ public function filterByStore(Mage_Core_Model_Store $store)
96
+ {
97
+ $this->filterExcludeDeleted();
98
+ $this->addFieldToFilter('scope_id', $store->getWebsiteId());
99
+ }
100
+
101
+ /**
102
+ * @param string $order
103
+ * @param string $orderDir
104
+ */
105
+ public function addSortOrder($order = 'sort_order', $orderDir = self::SORT_ORDER_ASC)
106
+ {
107
+ $this->addOrder($order, $orderDir);
108
+ }
109
+
110
+ /**
111
+ * @param $storeId int
112
+ * @param bool $removeParent
113
+ * @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
114
+ */
115
+ public function getCollectionByStoreId($storeId, $removeParent = false)
116
+ {
117
+ // Add Filter is_deleted = 0
118
+ $store = Mage::app()->getStore($storeId);
119
+ $scopeId = $store->getId();
120
+
121
+ // Add Filter (scope_id = 0) OR (scope_id = $this->getScopeId())
122
+ $this->addFieldToFilter('scope_id',
123
+ array(
124
+ array('attribute' => 'scope_id', 'eq' => 0),
125
+ array('attribute' => 'scope_id', 'eq' => $scopeId)
126
+ )
127
+ );
128
+
129
+ foreach ($this->getItems() as $key => $data) {
130
+ /**@var $data Payone_Core_Model_Domain_Config_PaymentMethod */
131
+ if ($data->getScope() == 'stores' && $data->getScopeId() == $scopeId) {
132
+ $parentScope = 'websites';
133
+ }
134
+ elseif ($data->getScope() == 'websites' && $data->getScopeId() == $scopeId) {
135
+ $parentScope = 'default';
136
+ }
137
+ else {
138
+ continue;
139
+ }
140
+
141
+ $parentField = 'parent_' . $parentScope . '_id';
142
+ $parentId = $data->getData($parentField);
143
+ /** @var $parentItem Payone_Core_Model_Domain_Config_PaymentMethod */
144
+ $parentItem = $this->getItemById($parentId);
145
+ //check for parent payment_config
146
+ if ($parentItem) {
147
+ $removeId = $parentId;
148
+ $grandParentScope = '';
149
+ if ($parentItem->getScope() == 'websites') {
150
+ $grandParentScope = 'default';
151
+ if ($removeParent) {
152
+ $this->removeItemByKey($parentId);
153
+ }
154
+ }
155
+ $grandParentField = 'parent_' . $grandParentScope . '_id';
156
+ $grandParentId = $parentItem->getData($grandParentField);
157
+ /** @var $grandParentItem Payone_Core_Model_Domain_Config_PaymentMethod */
158
+ $grandParentItem = $this->getItemById($grandParentId);
159
+ // check for grandparent payment_config
160
+ if ($grandParentItem) {
161
+ $removeId = $grandParentId;
162
+ $this->mergeData($parentItem, $grandParentItem);
163
+ }
164
+
165
+ $this->mergeData($data, $parentItem);
166
+
167
+ // necessary to remove items from the result-collection, otherwise they items won't be removed
168
+ $item = $this->getItemById($removeId);
169
+ if ($removeParent) {
170
+ $this->removeItemByKey($removeId);
171
+ }
172
+ }
173
+ }
174
+ return $this;
175
+ }
176
+
177
+ /**
178
+ * @param Payone_Core_Model_Domain_Config_PaymentMethod $child
179
+ * @param Payone_Core_Model_Domain_Config_PaymentMethod $parent
180
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
181
+ */
182
+ protected function mergeData(
183
+ Payone_Core_Model_Domain_Config_PaymentMethod $child,
184
+ Payone_Core_Model_Domain_Config_PaymentMethod $parent
185
+ )
186
+ {
187
+ foreach ($child->getData() as $key => $value) {
188
+ if ($value === null || $value === false) {
189
+ $child->setData($key, $parent->getData($key));
190
+ }
191
+ }
192
+ return $child;
193
+ }
194
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Protocol/Api.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Protocol_Api
34
+ extends Mage_Core_Model_Mysql4_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ $this->_init('payone_core/protocol_api', 'id');
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Protocol/Api/Collection.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Protocol_Api_Collection
34
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ parent::_construct();
42
+ $this->_init('payone_core/domain_protocol_api');
43
+ }
44
+
45
+ /**
46
+ * @param Mage_Sales_Model_Order $order
47
+ * @return void
48
+ */
49
+ public function getByOrder(Mage_Sales_Model_Order $order)
50
+ {
51
+ $this->addFieldToFilter('order_id', $order->getId());
52
+ }
53
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Protocol/TransactionStatus.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus
34
+ extends Mage_Core_Model_Mysql4_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ $this->_init('payone_core/protocol_transactionStatus', 'id');
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Protocol/TransactionStatus/Collection.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection
34
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ parent::_construct();
42
+ $this->_init('payone_core/domain_protocol_transactionStatus');
43
+ }
44
+
45
+ /**
46
+ * @param Mage_Sales_Model_Order $order
47
+ * @return void
48
+ */
49
+ public function getByOrder(Mage_Sales_Model_Order $order)
50
+ {
51
+ $this->addFieldToFilter('order_id', $order->getId());
52
+ }
53
+
54
+ /**
55
+ * @param Payone_Core_Model_Domain_Transaction $transaction
56
+ * @return void
57
+ */
58
+ public function getByTransaction(Payone_Core_Model_Domain_Transaction $transaction)
59
+ {
60
+ $this->addFieldToFilter('txid', $transaction->getTxid());
61
+ }
62
+
63
+ /**
64
+ * @return Payone_Core_Model_Domain_Protocol_TransactionStatus
65
+ */
66
+ public function getNextPending()
67
+ {
68
+ $status = Payone_Core_Model_Domain_Protocol_TransactionStatus::STATUS_PENDING;
69
+
70
+ $this->clear();
71
+ $this->addFieldToFilter('processing_status', $status);
72
+ $this->setOrder('id', 'ASC');
73
+ $this->getSelect()->limit(1);
74
+
75
+ $this->load();
76
+
77
+ foreach ($this as $data) {
78
+ return $data;
79
+ }
80
+
81
+ return null;
82
+ }
83
+
84
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Transaction.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Transaction
34
+ extends Mage_Core_Model_Mysql4_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ $this->_init('payone_core/transaction', 'id');
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Model/Domain/Resource/Transaction/Collection.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Domain_Resource_Transaction_Collection
34
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
35
+ {
36
+ /**
37
+ *
38
+ */
39
+ public function _construct()
40
+ {
41
+ parent::_construct();
42
+ $this->_init('payone_core/domain_transaction');
43
+ }
44
+ }
app/code/community/Payone/Core/Model/Domain/Transaction.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Domain
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Domain
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ *
33
+ * @method setStoreId($storeId)
34
+ * @method int getStoreId()
35
+ * @method setOrderId($orderId)
36
+ * @method int getOrderId()
37
+ * @method setTxid(int $txid)
38
+ * @method int getTxid()
39
+ * @method setTxtime($txtime)
40
+ * @method string getTxtime()
41
+ * @method setReference($reference)
42
+ * @method string getReference()
43
+ * @method setLastTxaction(string $txAction)
44
+ * @method string getLastTxaction()
45
+ * @method setLastSequencenumber(int $nr)
46
+ * @method int getLastSequencenumber()
47
+ * @method setClearingtype(string $type)
48
+ * @method string getClearingtype()
49
+ * @method setMode($mode)
50
+ * @method string getMode()
51
+ * @method setMid($mid)
52
+ * @method int getMid()
53
+ * @method setAid($aid)
54
+ * @method int getAid()
55
+ * @method setPortalid($portalid)
56
+ * @method int getPortalid()
57
+ * @method setProductid($productid)
58
+ * @method int getroductid()
59
+ * @method setCurrency($currency)
60
+ * @method string getCurrency()
61
+ * @method setReceivable($receivable)
62
+ * @method float getReceivable()
63
+ * @method setBalance($balance)
64
+ * @method float getBalance()
65
+ * @method setCustomerid($customerid)
66
+ * @method int getCustomerid()
67
+ * @method setUserid($userid)
68
+ * @method int getUserid()
69
+ * @method setReminderlevel($level)
70
+ * @method string getReminderlevel()
71
+ * @method setFailedcause($reason)
72
+ * @method string getFailedcause()
73
+ * @method setAccessid($id)
74
+ * @method int getAccessid()
75
+ * @method setCreatedAt(string $dateTime)
76
+ * @method string getCreatedAt()
77
+ * @method setUpdatedAt(string $dateTime)
78
+ * @method string getUpdatedAt()
79
+ */
80
+ class Payone_Core_Model_Domain_Transaction
81
+ extends Mage_Core_Model_Abstract
82
+ {
83
+ /**
84
+ *
85
+ */
86
+ public function _construct()
87
+ {
88
+ parent::_construct();
89
+ $this->_init('payone_core/transaction');
90
+ }
91
+
92
+ /**
93
+ * @return Payone_Core_Model_Domain_Transaction
94
+ */
95
+ protected function _beforeSave()
96
+ {
97
+ parent::_beforeSave();
98
+
99
+ if ($this->isObjectNew()) {
100
+ $this->setCreatedAt(date('Y-m-d H:i:s'));
101
+ }
102
+ else {
103
+ $this->setUpdatedAt(date('Y-m-d H:i:s'));
104
+ }
105
+
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * @param Mage_Sales_Model_Order_Payment $payment
111
+ * @return Payone_Core_Model_Domain_Transaction
112
+ */
113
+ public function loadByPayment(Mage_Sales_Model_Order_Payment $payment)
114
+ {
115
+ $this->load($payment->getLastTransId(), 'txid');
116
+ return $this;
117
+ }
118
+
119
+ /**
120
+ * @return int
121
+ */
122
+ public function getNextSequenceNumber()
123
+ {
124
+ $sequenceNumber = $this->getLastSequencenumber();
125
+ $sequenceNumber++;
126
+ return $sequenceNumber;
127
+ }
128
+
129
+ /**
130
+ * @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
131
+ * @return Payone_Core_Model_Domain_Transaction
132
+ */
133
+ public function loadByTransactionStatus(Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
134
+ {
135
+ $this->load($transactionStatus->getTxid(), 'txid');
136
+ return $this;
137
+ }
138
+
139
+ }
app/code/community/Payone/Core/Model/Factory.php ADDED
@@ -0,0 +1,1353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
18
+ * @author Matthias Walter <info@noovias.com>
19
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
+ * @link http://www.noovias.com
21
+ */
22
+
23
+ /**
24
+ *
25
+ * @category Payone
26
+ * @package Payone_Core_Model
27
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
28
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
29
+ * @link http://www.noovias.com
30
+ */
31
+ class Payone_Core_Model_Factory
32
+ {
33
+ /** @var Payone_Core_Helper_Data */
34
+ protected $helper = null;
35
+
36
+ /** @var Payone_Builder */
37
+ protected $builder = null;
38
+
39
+ /** @var Payone_Config */
40
+ protected $config = null;
41
+
42
+ public function __construct()
43
+ {
44
+ // Boot Payone:
45
+ $bootstrap = new Payone_Bootstrap();
46
+ $bootstrap->init();
47
+ }
48
+
49
+ /**
50
+ *
51
+ * @return Payone_Core_Helper_Data
52
+ */
53
+ public function helper()
54
+ {
55
+ if ($this->helper === null) {
56
+ $this->helper = Mage::helper('payone_core');
57
+ }
58
+ return $this->helper;
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @return Payone_Core_Helper_Email
64
+ */
65
+ public function helperEmail()
66
+ {
67
+ return Mage::helper('payone_core/email');
68
+ }
69
+
70
+ /**
71
+ * @return Payone_Core_Helper_Config
72
+ */
73
+ public function helperConfig()
74
+ {
75
+ return Mage::helper('payone_core/config');
76
+ }
77
+
78
+ /**
79
+ * @return Payone_Core_Helper_Url
80
+ */
81
+ public function helperUrl()
82
+ {
83
+ return Mage::helper('payone_core/url');
84
+ }
85
+
86
+ /**
87
+ * @return Payone_Core_Helper_Wizard
88
+ */
89
+ public function helperWizard()
90
+ {
91
+ return Mage::helper('payone_core/wizard');
92
+ }
93
+
94
+ /**
95
+ * @return Mage_Tax_Helper_Data
96
+ */
97
+ public function helperMageTax()
98
+ {
99
+ return Mage::helper('tax');
100
+ }
101
+
102
+ /**
103
+ *
104
+ * @param Payone_Core_Helper_Data $helper
105
+ */
106
+ public function setHelper(Payone_Core_Helper_Data $helper)
107
+ {
108
+ $this->helper = $helper;
109
+ }
110
+
111
+ /**
112
+ * @param string $key
113
+ * @param array $ipConfig
114
+ * @return Payone_TransactionStatus_Service_HandleRequest
115
+ */
116
+ public function getServiceTransactionStatusHandleRequest($key, array $ipConfig)
117
+ {
118
+ $key = md5($key);
119
+ $service = $this->getBuilder()->buildServiceTransactionStatusHandleRequest($key, $ipConfig);
120
+
121
+ /** @var $repository Payone_Core_Model_Repository_TransactionStatus */
122
+ $repository = Mage::getModel('payone_core/repository_transactionStatus');
123
+ $service->getServiceProtocol()->addRepository($repository);
124
+
125
+ return $service;
126
+ }
127
+
128
+ /**
129
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
130
+ * @return Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize
131
+ */
132
+ public function getMapperPaymentRequestAuthorize(Payone_Core_Model_Config_Payment_Method_Interface $config)
133
+ {
134
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize */
135
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_payment_authorize');
136
+ $mapper->setConfigPayment($config);
137
+ $mapper->setFactory($this);
138
+ $mapper->setIsAdmin($this->getIsAdmin());
139
+
140
+ return $mapper;
141
+
142
+ }
143
+
144
+ /**
145
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
146
+ * @return Payone_Core_Model_Mapper_ApiRequest_Payment_Preauthorize
147
+ */
148
+ public function getMapperPaymentRequestPreauthorize(Payone_Core_Model_Config_Payment_Method_Interface $config)
149
+ {
150
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Payment_Preauthorize */
151
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_payment_preauthorize');
152
+ $mapper->setConfigPayment($config);
153
+ $mapper->setFactory($this);
154
+ $mapper->setIsAdmin($this->getIsAdmin());
155
+
156
+ return $mapper;
157
+
158
+ }
159
+
160
+ /**
161
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
162
+ * @return Payone_Core_Model_Mapper_ApiRequest_Payment_Capture
163
+ */
164
+ public function getMapperPaymentRequestCapture(Payone_Core_Model_Config_Payment_Method_Interface $config)
165
+ {
166
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Payment_Capture */
167
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_payment_capture');
168
+ $mapper->setConfigPayment($config);
169
+ $mapper->setFactory($this);
170
+ $mapper->setIsAdmin($this->getIsAdmin());
171
+
172
+ return $mapper;
173
+
174
+ }
175
+
176
+ /**
177
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
178
+ * @return Payone_Core_Model_Mapper_ApiRequest_Payment_Debit
179
+ */
180
+ public function getMapperPaymentRequestDebit(Payone_Core_Model_Config_Payment_Method_Interface $config)
181
+ {
182
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Payment_Debit */
183
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_payment_debit');
184
+ $mapper->setConfigPayment($config);
185
+ $mapper->setFactory($this);
186
+ $mapper->setIsAdmin($this->getIsAdmin());
187
+
188
+ return $mapper;
189
+ }
190
+
191
+ /**
192
+ * @param Payone_Core_Model_Config_Protect_AddressCheck $configAddresscheck
193
+ * @return Payone_Core_Model_Mapper_ApiRequest_Verification_AddressCheck
194
+ */
195
+ public function getMapperVerificationRequestAddressCheck(Payone_Core_Model_Config_Protect_AddressCheck $configAddresscheck)
196
+ {
197
+ $configGlobal = $this->helperConfig()->getConfigGeneral()->getGlobal();
198
+
199
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Verification_AddressCheck */
200
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_verification_addressCheck');
201
+ $mapper->setFactory($this);
202
+ $mapper->setConfig($configAddresscheck);
203
+ $mapper->setConfigGlobal($configGlobal);
204
+
205
+ return $mapper;
206
+ }
207
+
208
+ /**
209
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $paymentConfig Payment configuration for "debit_payment"
210
+ * @return Payone_Core_Model_Mapper_ApiRequest_Verification_BankAccountCheck
211
+ */
212
+ public function getMapperVerificationRequestBankAccountCheck(Payone_Core_Model_Config_Payment_Method_Interface $paymentConfig)
213
+ {
214
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Verification_BankAccountCheck */
215
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_verification_BankAccountCheck');
216
+ $mapper->setFactory($this);
217
+ $mapper->setConfig($paymentConfig);
218
+
219
+ return $mapper;
220
+ }
221
+
222
+ /**
223
+ * @return Payone_Core_Model_Mapper_ApiRequest_Management_GetInvoice
224
+ */
225
+ public function getMapperManagementRequestGetInvoice()
226
+ {
227
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Management_GetInvoice */
228
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_management_getInvoice');
229
+ $mapper->setFactory($this);
230
+
231
+ return $mapper;
232
+ }
233
+
234
+ /**
235
+ * @param Payone_Core_Model_Config_Protect_Creditrating $config
236
+ * @return Payone_Core_Model_Mapper_ApiRequest_Verification_Creditrating
237
+ */
238
+ public function getMapperVerificationRequestCreditrating(Payone_Core_Model_Config_Protect_Creditrating $config)
239
+ {
240
+ $configGlobal = $this->helperConfig()->getConfigGeneral()->getGlobal();
241
+ /** @var $mapper Payone_Core_Model_Mapper_ApiRequest_Verification_Creditrating */
242
+ $mapper = Mage::getModel('payone_core/mapper_apiRequest_verification_creditrating');
243
+ $mapper->setFactory($this);
244
+ $mapper->setConfig($config);
245
+ $mapper->setConfigGlobal($configGlobal);
246
+
247
+ return $mapper;
248
+ }
249
+
250
+ /**
251
+ * @return bool
252
+ */
253
+ protected function getIsAdmin()
254
+ {
255
+ return Mage::app()->getStore()->isAdmin();
256
+ }
257
+
258
+ /**
259
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
260
+ * @return Payone_Core_Model_Service_Payment_Authorize
261
+ */
262
+ public function getServicePaymentAuthorize(Payone_Core_Model_Config_Payment_Method_Interface $config)
263
+ {
264
+ $mapper = $this->getMapperPaymentRequestAuthorize($config);
265
+ $handler = $this->getHandlerPaymentAuthorize($config);
266
+
267
+ /** @var $service Payone_Core_Model_Service_Payment_Authorize */
268
+ $service = Mage::getModel('payone_core/service_payment_authorize');
269
+ $service->setMapper($mapper);
270
+ $service->setHandler($handler);
271
+ $service->setServiceApiPayment($this->getServiceApiPaymentAuthorize());
272
+
273
+ return $service;
274
+ }
275
+
276
+ /**
277
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
278
+ * @return Payone_Core_Model_Service_Payment_Preauthorize
279
+ */
280
+ public function getServicePaymentPreauthorize(Payone_Core_Model_Config_Payment_Method_Interface $config)
281
+ {
282
+ $mapper = $this->getMapperPaymentRequestPreauthorize($config);
283
+ $handler = $this->getHandlerPaymentPreauthorize($config);
284
+
285
+ /** @var $service Payone_Core_Model_Service_Payment_Preauthorize */
286
+ $service = Mage::getModel('payone_core/service_payment_preauthorize');
287
+ $service->setMapper($mapper);
288
+ $service->setHandler($handler);
289
+ $service->setServiceApiPayment($this->getServiceApiPaymentPreauthorize());
290
+
291
+ return $service;
292
+ }
293
+
294
+ /**
295
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
296
+ * @return Payone_Core_Model_Service_Payment_Capture
297
+ */
298
+ public function getServicePaymentCapture(Payone_Core_Model_Config_Payment_Method_Interface $config)
299
+ {
300
+ $mapper = $this->getMapperPaymentRequestCapture($config);
301
+ $handler = $this->getHandlerPaymentCapture($config);
302
+
303
+ /** @var $service Payone_Core_Model_Service_Payment_Capture */
304
+ $service = Mage::getModel('payone_core/service_payment_capture');
305
+ $service->setMapper($mapper);
306
+ $service->setHandler($handler);
307
+ $service->setServiceApiPayment($this->getServiceApiPaymentCapture());
308
+
309
+ return $service;
310
+ }
311
+
312
+ /**
313
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
314
+ * @return Payone_Core_Model_Service_Payment_Debit
315
+ */
316
+ public function getServicePaymentDebit(Payone_Core_Model_Config_Payment_Method_Interface $config)
317
+ {
318
+ $mapper = $this->getMapperPaymentRequestDebit($config);
319
+ $handler = $this->getHandlerPaymentDebit($config);
320
+
321
+ /** @var $service Payone_Core_Model_Service_Payment_Debit */
322
+ $service = Mage::getModel('payone_core/service_payment_debit');
323
+ $service->setMapper($mapper);
324
+ $service->setHandler($handler);
325
+ $service->setServiceApiPayment($this->getServiceApiPaymentDebit());
326
+
327
+ return $service;
328
+ }
329
+
330
+ /**
331
+ * @return Payone_Core_Model_Service_Management_GetInvoice
332
+ */
333
+ public function getServiceManagementGetInvoice()
334
+ {
335
+ $mapper = $this->getMapperManagementRequestGetInvoice();
336
+ $handler = $this->getHandlerManagementGetInvoice();
337
+
338
+ /** @var $service Payone_Core_Model_Service_Management_GetInvoice */
339
+ $service = Mage::getModel('payone_core/service_management_getInvoice');
340
+ $service->setMapper($mapper);
341
+ $service->setHandler($handler);
342
+ $service->setServiceApiGetInvoice($this->getServiceApiManagementGetInvoice());
343
+
344
+ return $service;
345
+ }
346
+
347
+ /**
348
+ * @param Payone_Core_Model_Config_Protect_AddressCheck $config
349
+ * @return Payone_Core_Model_Service_Verification_AddressCheck
350
+ */
351
+ public function getServiceVerificationAddressCheck(Payone_Core_Model_Config_Protect_AddressCheck $config)
352
+ {
353
+ $mapper = $this->getMapperVerificationRequestAddressCheck($config);
354
+ $handler = $this->getHandlerVerificationAddressCheck($config);
355
+
356
+ /** @var $service Payone_Core_Model_Service_Verification_AddressCheck */
357
+ $service = Mage::getModel('payone_core/service_verification_addressCheck');
358
+ $service->setConfig($config);
359
+ $service->setMapper($mapper);
360
+ $service->setHandler($handler);
361
+ $service->setServiceApiAddressCheck($this->getServiceApiVerificationAddressCheck());
362
+
363
+ return $service;
364
+ }
365
+
366
+ /**
367
+ * @param $paymentMethodConfigId
368
+ * @param $storeId
369
+ * @return Payone_Core_Model_Service_Verification_BankAccountCheck
370
+ */
371
+ public function getServiceVerificationBankAccountCheck($paymentMethodConfigId, $storeId)
372
+ {
373
+ $config = $this->helperConfig()->getConfigPaymentMethodById($paymentMethodConfigId, $storeId);
374
+ $mapper = $this->getMapperVerificationRequestBankAccountCheck($config);
375
+
376
+ /** @var $service Payone_Core_Model_Service_Verification_BankAccountCheck */
377
+ $service = Mage::getModel('payone_core/service_verification_bankAccountCheck');
378
+ $service->setMapper($mapper);
379
+ $service->setConfigPayment($config);
380
+ $service->setServiceApiBankAccountCheck($this->getServiceApiVerificationBankAccountCheck());
381
+
382
+ return $service;
383
+ }
384
+
385
+ /**
386
+ * @param Payone_Core_Model_Config_Protect_AddressCheck $config
387
+ * @return Payone_Core_Model_Handler_Verification_AddressCheck
388
+ */
389
+ public function getHandlerVerificationAddressCheck(Payone_Core_Model_Config_Protect_AddressCheck $config)
390
+ {
391
+ /** @var $handler Payone_Core_Model_Handler_Verification_AddressCheck */
392
+ $handler = Mage::getModel('payone_core/handler_verification_addressCheck');
393
+ $handler->setConfig($config);
394
+
395
+ return $handler;
396
+ }
397
+
398
+ /**
399
+ * @param Payone_Core_Model_Config_Protect_Creditrating $config
400
+ * @return Payone_Core_Model_Handler_Verification_Creditrating
401
+ */
402
+ public function getHandlerVerificationCreditrating(Payone_Core_Model_Config_Protect_Creditrating $config)
403
+ {
404
+ /** @var $handler Payone_Core_Model_Handler_Verification_Creditrating */
405
+ $handler = Mage::getModel('payone_core/handler_verification_creditrating');
406
+ $handler->setConfig($config);
407
+
408
+ return $handler;
409
+ }
410
+
411
+ /**
412
+ * @param Payone_Core_Model_Config_Protect_Creditrating $config
413
+ * @return Payone_Core_Model_Service_Verification_Creditrating
414
+ */
415
+ public function getServiceVerificationCreditrating(Payone_Core_Model_Config_Protect_Creditrating $config)
416
+ {
417
+ $mapper = $this->getMapperVerificationRequestCreditrating($config);
418
+ $handler = $this->getHandlerVerificationCreditrating($config);
419
+
420
+ /** @var $service Payone_Core_Model_Service_Verification_Creditrating */
421
+ $service = Mage::getModel('payone_core/service_verification_creditrating');
422
+ $service->setMapper($mapper);
423
+ $service->setHandler($handler);
424
+ $service->setConfig($config);
425
+ $service->setServiceApiConsumerScore($this->getServiceApiVerificationConsumerScore());
426
+
427
+ return $service;
428
+ }
429
+
430
+ /**
431
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
432
+ * @return Payone_Core_Model_Handler_Payment_Abstract|Payone_Core_Model_Handler_Payment_Authorize
433
+ */
434
+ public function getHandlerPaymentAuthorize(Payone_Core_Model_Config_Payment_Method_Interface $config)
435
+ {
436
+ /** @var $handler Payone_Core_Model_Handler_Payment_Authorize */
437
+ $handler = $this->getHandlerPayment('payone_core/handler_payment_authorize', $config);
438
+ return $handler;
439
+ }
440
+
441
+ /**
442
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
443
+ * @return Payone_Core_Model_Handler_Payment_Abstract|Payone_Core_Model_Handler_Payment_Preauthorize
444
+ */
445
+ public function getHandlerPaymentPreauthorize(Payone_Core_Model_Config_Payment_Method_Interface $config)
446
+ {
447
+ /** @var $handler Payone_Core_Model_Handler_Payment_Preauthorize */
448
+ $handler = $this->getHandlerPayment('payone_core/handler_payment_preauthorize', $config);
449
+ return $handler;
450
+ }
451
+
452
+ /**
453
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
454
+ * @return Payone_Core_Model_Handler_Payment_Abstract|Payone_Core_Model_Handler_Payment_Capture
455
+ */
456
+ public function getHandlerPaymentCapture(Payone_Core_Model_Config_Payment_Method_Interface $config)
457
+ {
458
+ /** @var $handler Payone_Core_Model_Handler_Payment_Capture */
459
+ $handler = $this->getHandlerPayment('payone_core/handler_payment_capture', $config);
460
+ return $handler;
461
+ }
462
+
463
+ /**
464
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
465
+ * @return Payone_Core_Model_Handler_Payment_Abstract|Payone_Core_Model_Handler_Payment_Debit
466
+ */
467
+ public function getHandlerPaymentDebit(Payone_Core_Model_Config_Payment_Method_Interface $config)
468
+ {
469
+ /** @var $handler Payone_Core_Model_Handler_Payment_Debit */
470
+ $handler = $this->getHandlerPayment('payone_core/handler_payment_debit', $config);
471
+ return $handler;
472
+ }
473
+
474
+ /**
475
+ * @return Payone_Core_Model_Handler_Management_GetInvoice
476
+ */
477
+ public function getHandlerManagementGetInvoice()
478
+ {
479
+ /** @var $handler Payone_Core_Model_Handler_Management_GetInvoice */
480
+ $handler = Mage::getModel('payone_core/handler_management_getInvoice');
481
+
482
+ return $handler;
483
+ }
484
+
485
+ /**
486
+ * @param $modelName
487
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
488
+ * @return Payone_Core_Model_Handler_Payment_Abstract
489
+ */
490
+ protected function getHandlerPayment($modelName, Payone_Core_Model_Config_Payment_Method_Interface $config)
491
+ {
492
+ /** @var $handler Payone_Core_Model_Handler_Payment_Abstract */
493
+ $handler = Mage::getModel($modelName);
494
+ $handler->setFactory($this);
495
+ $handler->setServiceOrderComment($this->getServiceSalesOrderComment());
496
+ $handler->setServiceOrderStatus($this->getServiceSalesOrderStatus());
497
+ $handler->setServiceTransactionCreate($this->getServiceTransactionCreate());
498
+ $handler->setServiceTransactionUpdate($this->getServiceTransactionUpdate());
499
+ $handler->setConfigPaymentMethod($config);
500
+ return $handler;
501
+ }
502
+
503
+ /**
504
+ * @return Payone_Api_Request_Authorization
505
+ */
506
+ public function getRequestPaymentAuthorization()
507
+ {
508
+ $request = new Payone_Api_Request_Authorization();
509
+ return $request;
510
+ }
511
+
512
+ /**
513
+ * @return Payone_Api_Request_Preauthorization
514
+ */
515
+ public function getRequestPaymentPreauthorize()
516
+ {
517
+ $request = new Payone_Api_Request_Preauthorization();
518
+ return $request;
519
+ }
520
+
521
+ /**
522
+ * @return Payone_Api_Request_Capture
523
+ */
524
+ public function getRequestPaymentCapture()
525
+ {
526
+ $request = new Payone_Api_Request_Capture();
527
+ return $request;
528
+ }
529
+
530
+ /**
531
+ * @return Payone_Api_Request_Debit
532
+ */
533
+ public function getRequestPaymentDebit()
534
+ {
535
+ $request = new Payone_Api_Request_Debit();
536
+ return $request;
537
+ }
538
+
539
+
540
+ /**
541
+ * @return Payone_Api_Request_AddressCheck
542
+ */
543
+ public function getRequestVerificationAddressCheck()
544
+ {
545
+ $request = new Payone_Api_Request_AddressCheck();
546
+ return $request;
547
+ }
548
+
549
+
550
+ /**
551
+ * @return Payone_Api_Request_BankAccountCheck
552
+ */
553
+ public function getRequestVerificationBankAccountCheck()
554
+ {
555
+ $request = new Payone_Api_Request_BankAccountCheck();
556
+ return $request;
557
+ }
558
+
559
+ /**
560
+ * @return Payone_Api_Request_GetInvoice
561
+ */
562
+ public function getRequestManagementGetInvoice()
563
+ {
564
+ $request = new Payone_Api_Request_GetInvoice();
565
+ return $request;
566
+ }
567
+
568
+ /**
569
+ * @return Payone_Api_Request_AddressCheck
570
+ */
571
+ public function getRequestVerificationConsumerScore()
572
+ {
573
+ $request = new Payone_Api_Request_Consumerscore();
574
+ return $request;
575
+ }
576
+
577
+ /**
578
+ * @return Payone_Api_Service_Payment_Authorize
579
+ */
580
+ public function getServiceApiPaymentAuthorize()
581
+ {
582
+ $builder = $this->getBuilder();
583
+ $service = $builder->buildServicePaymentAuthorize();
584
+
585
+ $this->afterBuildServiceApi($service);
586
+
587
+ return $service;
588
+ }
589
+
590
+ /**
591
+ * @return Payone_Api_Service_Payment_PReauthorize
592
+ */
593
+ public function getServiceApiPaymentPreauthorize()
594
+ {
595
+ $builder = $this->getBuilder();
596
+ $service = $builder->buildServicePaymentPreauthorize();
597
+
598
+ $this->afterBuildServiceApi($service);
599
+
600
+ return $service;
601
+ }
602
+
603
+ /**
604
+ * @return Payone_Api_Service_Payment_Capture
605
+ */
606
+ public function getServiceApiPaymentCapture()
607
+ {
608
+ $builder = $this->getBuilder();
609
+ $service = $builder->buildServicePaymentCapture();
610
+
611
+ $this->afterBuildServiceApi($service);
612
+
613
+ return $service;
614
+ }
615
+
616
+ /**
617
+ * @return Payone_Api_Service_Payment_Debit
618
+ */
619
+ public function getServiceApiPaymentDebit()
620
+ {
621
+ $builder = $this->getBuilder();
622
+ $service = $builder->buildServicePaymentDebit();
623
+
624
+ $this->afterBuildServiceApi($service);
625
+
626
+ return $service;
627
+ }
628
+
629
+ /**
630
+ * @return Payone_ClientApi_Service_GenerateHash
631
+ */
632
+ public function getServiceClientApiGenerateHash()
633
+ {
634
+ $builder = $this->getBuilder();
635
+ $service = $builder->buildServiceClientApiGenerateHash();
636
+
637
+ return $service;
638
+ }
639
+
640
+ /**
641
+ * @return Payone_Api_Service_Verification_AddressCheck
642
+ */
643
+ public function getServiceApiVerificationAddressCheck()
644
+ {
645
+ $builder = $this->getBuilder();
646
+ $service = $builder->buildServiceVerificationAddressCheck();
647
+
648
+ $this->afterBuildServiceApi($service);
649
+
650
+ return $service;
651
+ }
652
+
653
+ /**
654
+ * @return Payone_Api_Service_Verification_BankAccountCheck
655
+ */
656
+ public function getServiceApiVerificationBankAccountCheck()
657
+ {
658
+ $builder = $this->getBuilder();
659
+ $service = $builder->buildServiceVerificationBankAccountCheck();
660
+
661
+ $this->afterBuildServiceApi($service);
662
+
663
+ return $service;
664
+ }
665
+
666
+ /**
667
+ * @return Payone_Api_Service_Management_GetInvoice
668
+ */
669
+ public function getServiceApiManagementGetInvoice()
670
+ {
671
+ $builder = $this->getBuilder();
672
+ $service = $builder->buildServiceManagementGetInvoice();
673
+
674
+ $this->afterBuildServiceApi($service);
675
+
676
+ return $service;
677
+ }
678
+
679
+ /**
680
+ * @return Payone_Api_Service_Verification_ConsumerScore
681
+ */
682
+ public function getServiceApiVerificationConsumerScore()
683
+ {
684
+ $builder = $this->getBuilder();
685
+ $service = $builder->buildServiceVerificationConsumerScore();
686
+
687
+ $this->afterBuildServiceApi($service);
688
+
689
+ return $service;
690
+ }
691
+
692
+ /**
693
+ * @return Payone_Settings_Service_XmlGenerate
694
+ */
695
+ public function getServiceApiSettingsXmlGenerate()
696
+ {
697
+ $builder = $this->getBuilder();
698
+ $service = $builder->buildServiceSettingsXmlGenerate();
699
+
700
+ return $service;
701
+ }
702
+
703
+ /**
704
+ * @return Payone_ClientApi_Request_CreditCardCheck
705
+ */
706
+ public function getRequestClientApiCreditCardCheck()
707
+ {
708
+ $request = new Payone_ClientApi_Request_CreditCardCheck();
709
+ return $request;
710
+ }
711
+
712
+
713
+ /**
714
+ * @param Payone_Api_Service_Interface $service
715
+ */
716
+ protected function afterBuildServiceApi(Payone_Api_Service_Interface $service)
717
+ {
718
+ /** @var $repository Payone_Core_Model_Repository_Api */
719
+ $repository = Mage::getModel('payone_core/repository_api');
720
+ $service->getServiceProtocol()->addRepository($repository);
721
+ }
722
+
723
+ /**
724
+ * @param null|Payone_Core_Model_Config_Payment_Method_Interface $config
725
+ * @return Payone_Core_Model_Service_InitializePayment
726
+ */
727
+ public function getServiceInitializePayment(Payone_Core_Model_Config_Payment_Method_Interface $config = null)
728
+ {
729
+ /** @var $service Payone_Core_Model_Service_InitializePayment */
730
+ $service = Mage::getModel('payone_core/service_initializePayment');
731
+ $service->setFactory($this);
732
+
733
+ if (!is_null($config)) {
734
+ $service->setConfigPaymentMethod($config);
735
+ }
736
+
737
+ return $service;
738
+ }
739
+
740
+ /**
741
+ * @return Payone_Core_Model_Service_InitializeConfig
742
+ */
743
+ public function getServiceInitializeConfig()
744
+ {
745
+ /** @var $service Payone_Core_Model_Service_InitializeConfig */
746
+ $service = Mage::getSingleton('payone_core/service_initializeConfig');
747
+ $service->setFactory($this);
748
+
749
+ return $service;
750
+ }
751
+
752
+ /**
753
+ * @return Payone_Core_Model_Service_TransactionStatus_Execute
754
+ */
755
+ public function getServiceTransactionStatusExecute()
756
+ {
757
+ $maxExecutionTime = $this->helperConfig()
758
+ ->getStoreConfig('payone_general/transactionstatus_execute/max_execution_time');
759
+
760
+ /** @var $service Payone_Core_Model_Service_TransactionStatus_Execute */
761
+ $service = Mage::getModel('payone_core/service_transactionStatus_execute');
762
+ $service->setServiceProcess($this->getServiceTransactionStatusProcess());
763
+ $service->setFactory($this);
764
+ $service->setMaxExecutionTime($maxExecutionTime);
765
+
766
+ return $service;
767
+ }
768
+
769
+ /**
770
+ * @return Payone_Core_Model_Service_TransactionStatus_Process
771
+ */
772
+ public function getServiceTransactionStatusProcess()
773
+ {
774
+ /** @var $service Payone_Core_Model_Service_TransactionStatus_Process */
775
+ $service = Mage::getModel('payone_core/service_transactionStatus_process');
776
+ $service->setFactory($this);
777
+ $service->setServiceTransaction($this->getServiceTransactionUpdate());
778
+ $service->setServiceOrderStatus($this->getServiceSalesOrderStatus());
779
+ $service->setServiceOrderComment($this->getServiceSalesOrderComment());
780
+
781
+ return $service;
782
+ }
783
+
784
+ /**
785
+ * @return Payone_Core_Model_Service_TransactionStatus_Forward
786
+ */
787
+ public function getServiceTransactionStatusForward()
788
+ {
789
+ /** @var $service Payone_Core_Model_Service_TransactionStatus_Forward */
790
+ $service = Mage::getModel('payone_core/service_transactionStatus_forward');
791
+ $service->setFactory($this);
792
+ $service->setHttpClient($this->getModelVarienHttpClient());
793
+ return $service;
794
+ }
795
+
796
+ /**
797
+ * @return Payone_Core_Model_Service_Transaction_Update
798
+ */
799
+ public function getServiceTransactionUpdate()
800
+ {
801
+ /**
802
+ * @var $service Payone_Core_Model_Service_Transaction_Update
803
+ */
804
+ $service = Mage::getModel('payone_core/service_transaction_update');
805
+ $service->setFactory($this);
806
+ return $service;
807
+ }
808
+
809
+ /**
810
+ * @return Payone_Core_Model_Service_Transaction_Create
811
+ */
812
+ public function getServiceTransactionCreate()
813
+ {
814
+ /**
815
+ * @var $service Payone_Core_Model_Service_Transaction_Create
816
+ */
817
+ $service = Mage::getModel('payone_core/service_transaction_create');
818
+ $service->setFactory($this);
819
+ return $service;
820
+ }
821
+
822
+ /**
823
+ * @return Payone_Core_Model_Service_Sales_OrderStatus
824
+ */
825
+ public function getServiceSalesOrderStatus()
826
+ {
827
+ /**
828
+ * @var $service Payone_Core_Model_Service_Sales_OrderStatus
829
+ */
830
+ $service = Mage::getModel('payone_core/service_sales_orderStatus');
831
+ $service->setFactory($this);
832
+ return $service;
833
+ }
834
+
835
+ /**
836
+ * @return Payone_Core_Model_Service_Sales_OrderComment
837
+ */
838
+ public function getServiceSalesOrderComment()
839
+ {
840
+ /**
841
+ * @var $service Payone_Core_Model_Service_Sales_OrderComment
842
+ */
843
+ $service = Mage::getModel('payone_core/service_sales_orderComment');
844
+ $service->setFactory($this);
845
+ return $service;
846
+ }
847
+
848
+ /**
849
+ * @return Payone_Core_Model_Service_Sales_InvoiceCreate
850
+ */
851
+ public function getServiceSalesInvoiceCreate()
852
+ {
853
+ /**
854
+ * @var $service Payone_Core_Model_Service_Sales_InvoiceCreate
855
+ */
856
+ $service = Mage::getModel('payone_core/service_sales_invoiceCreate');
857
+ $service->setFactory($this);
858
+ return $service;
859
+ }
860
+
861
+ /**
862
+ * @return Payone_Settings_Service_XmlGenerate
863
+ */
864
+ public function getServiceXmlGenerate()
865
+ {
866
+ $service = $this->getBuilder()->buildServiceSettingsXmlGenerate();
867
+ return $service;
868
+ }
869
+
870
+ /**
871
+ * @return Payone_Core_Model_Service_Config_XmlGenerate
872
+ */
873
+ public function getServiceConfigXmlGenerate()
874
+ {
875
+ /** @var $service Payone_Core_Model_Service_Config_XmlGenerate */
876
+ $service = Mage::getModel('payone_core/service_config_xmlGenerate');
877
+ $service->setFactory($this);
878
+
879
+ return $service;
880
+ }
881
+
882
+ /**
883
+ * @return Payone_Core_Model_Service_Protocol_Api_Export
884
+ */
885
+ public function getServiceProtocolApiExport()
886
+ {
887
+ return Mage::getModel('payone_core/service_protocol_api_export');
888
+ }
889
+
890
+ /**
891
+ * @return Payone_Core_Model_Service_Protocol_TransactionStatus_Export
892
+ */
893
+ public function getServiceProtocolTransactionStatusExport()
894
+ {
895
+ return Mage::getModel('payone_core/service_protocol_transactionStatus_export');
896
+ }
897
+
898
+ /**
899
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
900
+ */
901
+ public function getModelDomainConfigPaymentMethod()
902
+ {
903
+ /** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
904
+ $model = Mage::getModel('payone_core/domain_config_paymentMethod');
905
+
906
+ return $model;
907
+ }
908
+
909
+ /**
910
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
911
+ */
912
+ public function getModelConfigPaymentMethod()
913
+ {
914
+ /** @var $model Payone_Core_Model_Config_Payment_Method_Interface */
915
+ $model = Mage::getModel('payone_core/config_payment_method');
916
+
917
+ return $model;
918
+ }
919
+
920
+ /**
921
+ * @return Payone_Core_Model_Domain_Transaction
922
+ */
923
+ public function getModelTransaction()
924
+ {
925
+ /** @var $model Payone_Core_Model_Domain_Transaction */
926
+ $model = Mage::getModel('payone_core/domain_transaction');
927
+
928
+ return $model;
929
+ }
930
+
931
+ /**
932
+ * @return Payone_Core_Model_Domain_Protocol_TransactionStatus
933
+ */
934
+ public function getModelTransactionStatus()
935
+ {
936
+ /** @var $model Payone_Core_Model_Domain_Protocol_TransactionStatus */
937
+ $model = Mage::getModel('payone_core/domain_protocol_transactionStatus');
938
+
939
+ return $model;
940
+ }
941
+
942
+ /**
943
+ * @return Payone_Core_Model_Domain_Protocol_Api
944
+ */
945
+ public function getModelApi()
946
+ {
947
+ /** @var $model Payone_Core_Model_Domain_Protocol_Api */
948
+ $model = Mage::getModel('payone_core/domain_protocol_api');
949
+
950
+ return $model;
951
+ }
952
+
953
+ /**
954
+ * @return Mage_Sales_Model_Order
955
+ */
956
+ public function getModelSalesOrder()
957
+ {
958
+ /** @var $model Mage_Sales_Model_Order */
959
+ $model = Mage::getModel('sales/order');
960
+
961
+ return $model;
962
+ }
963
+
964
+ /**
965
+ * @return Mage_Sales_Model_Quote
966
+ */
967
+ public function getModelSalesQuote()
968
+ {
969
+ /** @var $model Mage_Sales_Model_Quote */
970
+ $model = Mage::getModel('sales/quote');
971
+
972
+ return $model;
973
+ }
974
+
975
+ /**
976
+ * @return Mage_Sales_Model_Order_Invoice
977
+ */
978
+ public function getModelSalesOrderInvoice()
979
+ {
980
+ /** @var $model Mage_Sales_Model_Order_Invoice */
981
+ $model = Mage::getModel('sales/order_invoice');
982
+ return $model;
983
+ }
984
+
985
+ /**
986
+ * @return Mage_Customer_Model_Customer
987
+ */
988
+ public function getModelCustomer()
989
+ {
990
+ /** @var $model Mage_Customer_Model_Customer */
991
+ $model = Mage::getModel('customer/customer');
992
+
993
+ return $model;
994
+ }
995
+
996
+ /**
997
+ * @return Mage_Customer_Model_Address
998
+ */
999
+ public function getModelCustomerAddress()
1000
+ {
1001
+ /** @var $model Mage_Customer_Model_Address*/
1002
+ $model = Mage::getModel('customer/address');
1003
+
1004
+ return $model;
1005
+ }
1006
+
1007
+ /**
1008
+ * @return Mage_Core_Model_Store
1009
+ */
1010
+ public function getModelCoreStore()
1011
+ {
1012
+ return Mage::getModel('core/store');
1013
+ }
1014
+
1015
+ /**
1016
+ * @return Mage_Tax_Model_Calculation
1017
+ */
1018
+ public function getSingletonTaxCalculation()
1019
+ {
1020
+ return Mage::getModel('tax/calculation');
1021
+ }
1022
+
1023
+ /**
1024
+ * @return Mage_Core_Model_Abstract
1025
+ */
1026
+ public function getModelCoreWebsite()
1027
+ {
1028
+ return Mage::getModel('core/website');
1029
+ }
1030
+
1031
+ /**
1032
+ * @return Mage_Checkout_Model_Session
1033
+ */
1034
+ public function getSingletonCheckoutSession()
1035
+ {
1036
+ /** @var $session Mage_Checkout_Model_Session */
1037
+ $session = Mage::getSingleton('checkout/session');
1038
+
1039
+ return $session;
1040
+ }
1041
+
1042
+ /**
1043
+ * @return Mage_Core_Model_Session
1044
+ */
1045
+ public function getSingletonCoreSession()
1046
+ {
1047
+ /** @var $session Mage_Core_Model_Session */
1048
+ $session = Mage::getSingleton('core/session');
1049
+
1050
+ return $session;
1051
+ }
1052
+
1053
+ /**
1054
+ * @return Mage_Payment_Model_Config
1055
+ */
1056
+ public function getSingletonPaymentConfig()
1057
+ {
1058
+ return Mage::getSingleton('payment/config');
1059
+ }
1060
+
1061
+ /**
1062
+ * @param Payone_Builder $builder
1063
+ */
1064
+ public function setBuilder(Payone_Builder $builder)
1065
+ {
1066
+ $this->builder = $builder;
1067
+ }
1068
+
1069
+ /**
1070
+ * @return Payone_Builder
1071
+ */
1072
+ protected function getBuilder()
1073
+ {
1074
+ if ($this->builder === null) {
1075
+ $config = $this->getConfig();
1076
+ $this->builder = new Payone_Builder($config);
1077
+ }
1078
+ return $this->builder;
1079
+ }
1080
+
1081
+ /**
1082
+ * @param Payone_Config $config
1083
+ */
1084
+ public function setConfig(Payone_Config $config)
1085
+ {
1086
+ $this->config = $config;
1087
+ }
1088
+
1089
+ /**
1090
+ * @return Payone_Config
1091
+ */
1092
+ protected function getConfig()
1093
+ {
1094
+ if ($this->config === null) {
1095
+ // Default config:
1096
+ $this->config = new Payone_Config();
1097
+
1098
+ // Set Magento logger configuration:
1099
+ $this->config->setValue('api/default/protocol/loggers', $this->getConfigApiLogger());
1100
+ $this->config->setValue('transaction_status/default/protocol/loggers/', $this->getConfigTransactionStatusLogger());
1101
+ }
1102
+ return $this->config;
1103
+ }
1104
+
1105
+
1106
+ /**
1107
+ * @return array
1108
+ */
1109
+ protected function getConfigApiLogger()
1110
+ {
1111
+ $options = array(
1112
+ 'filename' => Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . 'payone_api.log',
1113
+ 'max_file_size' => '1MB',
1114
+ 'max_file_count' => 20,);
1115
+
1116
+ $config = array('Payone_Protocol_Logger_Log4php' => $options);
1117
+
1118
+ return $config;
1119
+
1120
+ }
1121
+
1122
+ /**
1123
+ * @return array
1124
+ */
1125
+ protected function getConfigTransactionStatusLogger()
1126
+ {
1127
+ $options = array(
1128
+ 'filename' => Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . 'payone_transactionstatus.log',
1129
+ 'max_file_size' => '1MB',
1130
+ 'max_file_count' => 20,);
1131
+
1132
+ $config = array('Payone_Protocol_Logger_Log4php' => $options);
1133
+
1134
+ return $config;
1135
+ }
1136
+
1137
+ /**
1138
+ * @return Payone_Core_Model_System_Config_TransactionStatus
1139
+ */
1140
+ public function getModelSystemConfigTransactionStatus()
1141
+ {
1142
+ return Mage::getSingleton('payone_core/system_config_transactionStatus');
1143
+ }
1144
+
1145
+ /**
1146
+ * @return Payone_Core_Model_System_Config_StatusTransaction
1147
+ */
1148
+ public function getModelSystemConfigStatusTransaction()
1149
+ {
1150
+ return Mage::getSingleton('payone_core/system_config_statusTransaction');
1151
+ }
1152
+
1153
+ /**
1154
+ * @return Payone_Core_Model_System_Config_ResponseType
1155
+ */
1156
+ public function getModelSystemConfigResponseType()
1157
+ {
1158
+ return Mage::getSingleton('payone_core/system_config_responseType');
1159
+ }
1160
+
1161
+ /**
1162
+ * @return Payone_Core_Model_System_Config_RequestType
1163
+ */
1164
+ public function getModelSystemConfigRequestType()
1165
+ {
1166
+ $model = Mage::getSingleton('payone_core/system_config_requestType');
1167
+ return $model;
1168
+ }
1169
+
1170
+ /**
1171
+ * @return Payone_Core_Model_System_Config_PersonStatus
1172
+ */
1173
+ public function getModelSystemConfigPersonStatus()
1174
+ {
1175
+ return Mage::getSingleton('payone_core/system_config_personStatus');
1176
+ }
1177
+
1178
+ /**
1179
+ * @return Payone_Core_Model_System_Config_CreditScore
1180
+ */
1181
+ public function getModelSystemConfigCreditScore()
1182
+ {
1183
+ return Mage::getSingleton('payone_core/system_config_creditScore');
1184
+ }
1185
+
1186
+ /**
1187
+ * @return Mage_Adminhtml_Model_System_Config_Source_Order_Status
1188
+ */
1189
+ public function getModelSystemConfigOrderStatus()
1190
+ {
1191
+ return Mage::getSingleton('adminhtml/system_config_source_order_status');
1192
+ }
1193
+
1194
+ /**
1195
+ * @return Mage_Adminhtml_Model_System_Config_Source_Country_Full
1196
+ */
1197
+ public function getModelSystemConfigCountryFull()
1198
+ {
1199
+ return Mage::getSingleton('adminhtml/system_config_source_country_full');
1200
+ }
1201
+
1202
+ /**
1203
+ * @return Mage_Adminhtml_Model_System_Config_Source_Shipping_Allmethods
1204
+ */
1205
+ public function getModelSystemConfigShippingMethod()
1206
+ {
1207
+ return Mage::getSingleton('adminhtml/system_config_source_shipping_allmethods');
1208
+ }
1209
+
1210
+ /**
1211
+ * @return Payone_Core_Model_System_Config_ClearingType
1212
+ */
1213
+ public function getModelSystemConfigClearingType()
1214
+ {
1215
+ return Mage::getSingleton('payone_core/system_config_clearingType');
1216
+ }
1217
+
1218
+ /**
1219
+ * @return Payone_Core_Model_System_Config_Mode
1220
+ */
1221
+ public function getModelSystemConfigMode()
1222
+ {
1223
+ return Mage::getSingleton('payone_core/system_config_mode');
1224
+ }
1225
+
1226
+ /**
1227
+ * @return Payone_Core_Model_System_Config_ReminderLevel
1228
+ */
1229
+ public function getModelSystemConfigReminderLevel()
1230
+ {
1231
+ return Mage::getSingleton('payone_core/system_config_reminderLevel');
1232
+ }
1233
+
1234
+ /**
1235
+ * @return Payone_Core_Model_System_Config_Status
1236
+ */
1237
+ public function getModelSystemConfigStatus()
1238
+ {
1239
+ return Mage::getSingleton('payone_core/system_config_status');
1240
+ }
1241
+
1242
+ /**
1243
+ * @return Payone_Core_Model_System_Config_PaymentMethodType
1244
+ */
1245
+ public function getModelSystemConfigPaymentMethodType()
1246
+ {
1247
+ return Mage::getSingleton('payone_core/system_config_paymentMethodType');
1248
+ }
1249
+
1250
+ /**
1251
+ * @return Payone_Core_Model_System_Config_CreditCardType
1252
+ */
1253
+ public function getModelSystemConfigCreditCardType()
1254
+ {
1255
+ return Mage::getSingleton('payone_core/system_config_creditCardType');
1256
+ }
1257
+
1258
+ /**
1259
+ * @return Payone_Core_Model_System_Config_OnlinebanktransferType
1260
+ */
1261
+ public function getModelSystemConfigOnlinebanktransferType()
1262
+ {
1263
+ return Mage::getSingleton('payone_core/system_config_onlinebanktransferType');
1264
+ }
1265
+
1266
+ /**
1267
+ * @return Payone_Core_Model_System_Config_WalletType
1268
+ */
1269
+ public function getModelSystemConfigWalletType()
1270
+ {
1271
+ return Mage::getSingleton('payone_core/system_config_walletType');
1272
+ }
1273
+
1274
+ /**
1275
+ * @return Payone_Core_Model_System_Config_AddressCheckType
1276
+ */
1277
+ public function getModelSystemConfigAddressCheckType()
1278
+ {
1279
+ return Mage::getSingleton('payone_core/system_config_addressCheckType');
1280
+ }
1281
+
1282
+ /**
1283
+ * @return Payone_Core_Model_System_Config_AuthorizeMethod
1284
+ */
1285
+ public function getModelSystemConfigAuthorizeMethod()
1286
+ {
1287
+ return Mage::getSingleton('payone_core/system_config_authorizeMethod');
1288
+ }
1289
+
1290
+ /**
1291
+ * @return Payone_Core_Model_System_Config_AvsResult
1292
+ */
1293
+ public function getModelSystemConfigAvsResult()
1294
+ {
1295
+ return Mage::getSingleton('payone_core/system_config_avsResult');
1296
+ }
1297
+
1298
+ /**
1299
+ * @return Payone_Core_Model_System_Config_CreditratingChecktype
1300
+ */
1301
+ public function getModelSystemConfigCreditratingChecktype()
1302
+ {
1303
+ return Mage::getSingleton('payone_core/system_config_creditratingChecktype');
1304
+ }
1305
+
1306
+ /**
1307
+ * @return Payone_Core_Model_System_Config_PaymentMethodCode
1308
+ */
1309
+ public function getModelSystemConfigPaymentMethodCode()
1310
+ {
1311
+ return Mage::getSingleton('payone_core/system_config_paymentMethodCode');
1312
+ }
1313
+
1314
+ /**
1315
+ * @return Payone_Core_Model_System_Config_MethodType
1316
+ */
1317
+ public function getModelSystemConfigMethodType()
1318
+ {
1319
+ return Mage::getSingleton('payone_core/system_config_methodType');
1320
+ }
1321
+
1322
+ /**
1323
+ * @return Mage_Core_Model_Resource_Transaction
1324
+ */
1325
+ public function getModelResourceTransaction()
1326
+ {
1327
+ return Mage::getModel('core/resource_transaction');
1328
+ }
1329
+
1330
+ /**
1331
+ * @return Mage_Core_Model_Email_Template
1332
+ */
1333
+ public function getModelEmailTemplate()
1334
+ {
1335
+ return Mage::getModel('core/email_template');
1336
+ }
1337
+
1338
+ /**
1339
+ * @return Mage_Eav_Model_Entity_Type
1340
+ */
1341
+ public function getModelEavEntityType()
1342
+ {
1343
+ return Mage::getModel('eav/entity_type');
1344
+ }
1345
+
1346
+ /**
1347
+ * @return Varien_Http_Client
1348
+ */
1349
+ public function getModelVarienHttpClient()
1350
+ {
1351
+ return new Varien_Http_Client();
1352
+ }
1353
+ }
app/code/community/Payone/Core/Model/Handler/Abstract.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Handler_Abstract
34
+ {
35
+ /**
36
+ * @var Payone_Core_Model_Config_Interface
37
+ */
38
+ protected $configStore = null;
39
+ /** @var Payone_Core_Model_Factory */
40
+ protected $factory = null;
41
+
42
+ /** @var Payone_Core_Helper_Data */
43
+ protected $helper = null;
44
+
45
+ /**
46
+ * @param Payone_Core_Model_Config_Interface $config
47
+ */
48
+ public function setConfigStore(Payone_Core_Model_Config_Interface $config)
49
+ {
50
+ $this->configStore = $config;
51
+ }
52
+
53
+ /**
54
+ * @return Payone_Core_Model_Config_Interface
55
+ */
56
+ public function getConfigStore()
57
+ {
58
+ return $this->configStore;
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @return Payone_Core_Model_Factory
64
+ */
65
+ public function getFactory()
66
+ {
67
+ if ($this->factory === null) {
68
+ $this->factory = new Payone_Core_Model_Factory();
69
+ }
70
+ return $this->factory;
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @param Payone_Core_Model_Factory $factory
76
+ */
77
+ public function setFactory(Payone_Core_Model_Factory $factory)
78
+ {
79
+ $this->factory = $factory;
80
+ }
81
+
82
+ /**
83
+ * @return Payone_Core_Helper_Data
84
+ */
85
+ protected function helper()
86
+ {
87
+ return $this->getFactory()->helper();
88
+ }
89
+
90
+ /**
91
+ * @return Payone_Core_Helper_Config
92
+ */
93
+ protected function helperConfig()
94
+ {
95
+ return $this->getFactory()->helperConfig();
96
+ }
97
+
98
+ /**
99
+ * @return Payone_Core_Helper_Email
100
+ */
101
+ protected function helperEmail()
102
+ {
103
+ return $this->getFactory()->helperEmail();
104
+ }
105
+
106
+ }
app/code/community/Payone/Core/Model/Handler/Interface.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Handler_Interface
34
+ {
35
+ /**
36
+ * @todo should return a result Object
37
+ *
38
+ * @param Payone_Api_Response_Interface $response
39
+ */
40
+ public function handle(Payone_Api_Response_Interface $response);
41
+
42
+ /**
43
+ * @param Payone_Core_Model_Config_Interface $config
44
+ */
45
+ public function setConfigStore(Payone_Core_Model_Config_Interface $config);
46
+
47
+ /**
48
+ * @return Payone_Core_Model_Config_Interface
49
+ */
50
+ public function getConfigStore();
51
+
52
+ /**
53
+ * @param Payone_Api_Request_Interface $request
54
+ */
55
+ public function setRequest(Payone_Api_Request_Interface $request);
56
+
57
+ /**
58
+ * @return Payone_Api_Request_Interface
59
+ */
60
+ public function getRequest();
61
+ }
app/code/community/Payone/Core/Model/Handler/Management/GetInvoice.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Handler_Management_GetInvoice
34
+ extends Payone_Core_Model_Handler_Abstract
35
+ {
36
+ /**
37
+ * @param Payone_Api_Response_Management_GetInvoice $response
38
+ * @return string
39
+ */
40
+ public function handle(Payone_Api_Response_Management_GetInvoice $response)
41
+ {
42
+ $return = false;
43
+ if (!$response->isError()) {
44
+ $return = $response->getRawResponse();
45
+ }
46
+
47
+ return $return;
48
+ }
49
+
50
+ }
app/code/community/Payone/Core/Model/Handler/Payment/Abstract.php ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Handler_Payment_Abstract
34
+ extends Payone_Core_Model_Handler_Abstract
35
+ implements Payone_Core_Model_Handler_Payment_Interface
36
+ {
37
+ /**
38
+ * @var Payone_Core_Model_Config_Payment_Method_Interface
39
+ */
40
+ protected $configPaymentMethod = null;
41
+ /**
42
+ * @var Mage_Sales_Model_Order_Payment
43
+ */
44
+ protected $payment = null;
45
+ /**
46
+ * @var Payone_Core_Model_Service_Sales_OrderStatus
47
+ */
48
+ protected $serviceOrderStatus = null;
49
+
50
+ /**
51
+ * @var Payone_Core_Model_Service_Sales_OrderComment
52
+ */
53
+ protected $serviceOrderComment = null;
54
+
55
+ /**
56
+ * @var Payone_Core_Model_Service_Transaction_Create
57
+ */
58
+ protected $serviceTransactionCreate = null;
59
+
60
+ /** @var Payone_Core_Model_Service_Transaction_Update */
61
+ protected $serviceTransactionUpdate = null;
62
+
63
+ /**
64
+ * @var Payone_Api_Request_Interface
65
+ */
66
+ protected $request = null;
67
+
68
+ /**
69
+ * @param Payone_Api_Response_Interface $response
70
+ * @return Payone_Core_Model_Handler_Payment_Abstract
71
+ */
72
+ public function handle(Payone_Api_Response_Interface $response)
73
+ {
74
+ $order = $this->getOrder();
75
+ $paymentMethod = $this->getPaymentMethod();
76
+ $request = $this->getRequest();
77
+
78
+ if ($response->isError()) {
79
+ return $this;
80
+ }
81
+
82
+ if ($response->isApproved()) {
83
+ $this->sendAvsMail($response);
84
+ }
85
+ elseif ($response->isRedirect()) {
86
+ $redirectUrl = $response->getRedirecturl();
87
+ $paymentMethod->setRedirectUrl($redirectUrl);
88
+ }
89
+
90
+ $this->updatePaymentByResponse($response);
91
+
92
+ // Set Payment Initialized
93
+ $this->updatePaymentByOrder($order);
94
+
95
+ if ($response instanceof Payone_Api_Response_Authorization_Abstract ||
96
+ $response instanceof Payone_Api_Response_Authorization_Redirect) {
97
+ // Create Transaction
98
+ $this->getServiceTransactionCreate()->createByApiResponse($order, $response, $request);
99
+ }
100
+ else
101
+ {
102
+ $this->getServiceTransactionUpdate()->updateByApiResponse($response);
103
+ }
104
+
105
+ // Update Order Status
106
+ $this->getServiceOrderStatus()->setConfigStore($this->getConfigStore());
107
+ $this->getServiceOrderStatus()->updateByApiResponse($order, $response);
108
+
109
+ // Add Order Comment
110
+ $this->getServiceOrderComment()->addByApiResponse($order, $response);
111
+
112
+ // Update Order
113
+ $this->updateOrder($order);
114
+
115
+ // Update Customer
116
+ $this->updateCustomerByResponse($response);
117
+
118
+ return $this;
119
+ }
120
+
121
+ /**
122
+ * @param Mage_Sales_Model_Order $order
123
+ */
124
+ protected function updatePaymentByOrder(Mage_Sales_Model_Order $order)
125
+ {
126
+ // Set Amount Authorized
127
+ $this->getPayment()->setAmountAuthorized($order->getTotalDue());
128
+ $this->getPayment()->setBaseAmountAuthorized($order->getBaseTotalDue());
129
+ }
130
+
131
+ /**
132
+ * @param Mage_Sales_Model_Order $order
133
+ */
134
+ protected function updateOrder(Mage_Sales_Model_Order $order)
135
+ {
136
+ if ($this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_Creditcard) {
137
+ $order->setData('payone_payment_method_type', $this->getPayment()->getData('cc_type'));
138
+ }
139
+ elseif ($this->getPaymentMethod() instanceof Payone_Core_Model_Payment_Method_OnlineBankTransfer) {
140
+ $order->setData('payone_payment_method_type',
141
+ $this->getPayment()->getData('payone_onlinebanktransfer_type'));
142
+ }
143
+ }
144
+
145
+ /**
146
+ * @param Payone_Api_Response_Interface $response
147
+ */
148
+ protected function updatePaymentByResponse(Payone_Api_Response_Interface $response)
149
+ {
150
+ $payment = $this->getPayment();
151
+ $paymentMethod = $this->getPaymentMethod();
152
+
153
+ $payment->setLastTransId($response->getTxid());
154
+
155
+ if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_AdvancePayment
156
+ or $paymentMethod instanceof Payone_Core_Model_Payment_Method_Invoice
157
+ or $paymentMethod instanceof Payone_Core_Model_Payment_Method_CashOnDelivery
158
+ ) {
159
+ /** @var $response Payone_Api_Response_Authorization_Approved */
160
+ $payment->setPayoneClearingBankAccountholder($response->getClearingBankaccountholder());
161
+ $payment->setPayoneClearingBankCountry($response->getClearingBankcountry());
162
+ $payment->setPayoneClearingBankAccount($response->getClearingBankaccount());
163
+ $payment->setPayoneClearingBankCode($response->getClearingBankcode());
164
+ $payment->setPayoneClearingBankIban($response->getClearingBankiban());
165
+ $payment->setPayoneClearingBankBic($response->getClearingBankbic());
166
+ $payment->setPayoneClearingBankCity($response->getClearingBankcity());
167
+ $payment->setPayoneClearingBankName($response->getClearingBankname());
168
+ }
169
+ }
170
+
171
+ /**
172
+ * @param Payone_Api_Response_Interface $response
173
+ *
174
+ * @return void
175
+ */
176
+ protected function updateCustomerByResponse(Payone_Api_Response_Interface $response)
177
+ {
178
+ if (!$response instanceof Payone_Api_Response_Authorization_Abstract) {
179
+ return;
180
+ }
181
+
182
+ $customerId = $this->getOrder()->getCustomerId();
183
+ if (empty($customerId)) {
184
+ return;
185
+ }
186
+
187
+ $customer = $this->getFactory()->getModelCustomer();
188
+ $customer->load($customerId);
189
+
190
+ if (!$customer->hasData()) {
191
+ return;
192
+ }
193
+
194
+ $customer->setPayoneUserId($response->getUserid());
195
+ $customer->save();
196
+ }
197
+
198
+ /**
199
+ * @param Payone_Api_Response_Authorization_Approved|Payone_Api_Response_Refund_Approved|Payone_Api_Response_Interface $response
200
+ */
201
+ protected function sendAvsMail(Payone_Api_Response_Interface $response)
202
+ {
203
+ $storeId = $this->getOrder()->getStore()->getId();
204
+
205
+ $configMisc = $this->helperConfig()->getConfigMisc($storeId);
206
+ $configEmailAvs = $configMisc->getEmailAvs();
207
+
208
+ if ($response instanceof Payone_Api_Response_Refund_Approved ||
209
+ $response instanceof Payone_Api_Response_Authorization_Approved ||
210
+ $response instanceof Payone_Api_Response_Preauthorization_Approved
211
+ ) {
212
+ if ($configEmailAvs->isResultAvsInConfig($response->getProtectResultAvs())) {
213
+
214
+ // Mailtemplates need an Varien_Object if we want to use Getter from the Object
215
+ $responseMailObject = new Varien_Object($response->toArray());
216
+
217
+ $helperEmail = $this->helperEmail();
218
+ $helperEmail->setStoreId($storeId);
219
+ $result = $helperEmail->send($configEmailAvs, array('response' => $responseMailObject));
220
+ }
221
+ }
222
+ }
223
+
224
+ /**
225
+ * @param Mage_Sales_Model_Order_Payment $payment
226
+ */
227
+ public function setPayment(Mage_Sales_Model_Order_Payment $payment)
228
+ {
229
+ $this->payment = $payment;
230
+ }
231
+
232
+ /**
233
+ * @return Mage_Sales_Model_Order_Payment
234
+ */
235
+ public function getPayment()
236
+ {
237
+ return $this->payment;
238
+ }
239
+
240
+ /**
241
+ * @return Payone_Core_Model_Payment_Method_Abstract
242
+ */
243
+ protected function getPaymentMethod()
244
+ {
245
+ return $this->getPayment()->getMethodInstance();
246
+ }
247
+
248
+ /**
249
+ * @return Mage_Sales_Model_Order
250
+ */
251
+ protected function getOrder()
252
+ {
253
+ return $this->getPayment()->getOrder();
254
+ }
255
+
256
+ /**
257
+ * @param Payone_Core_Model_Service_Sales_OrderStatus $service
258
+ */
259
+ public function setServiceOrderStatus(Payone_Core_Model_Service_Sales_OrderStatus $service)
260
+ {
261
+ $this->serviceOrderStatus = $service;
262
+ }
263
+
264
+ /**
265
+ * @return Payone_Core_Model_Service_Sales_OrderStatus
266
+ */
267
+ public function getServiceOrderStatus()
268
+ {
269
+ return $this->serviceOrderStatus;
270
+ }
271
+
272
+ /**
273
+ * @param Payone_Core_Model_Service_Sales_OrderComment $service
274
+ */
275
+ public function setServiceOrderComment(Payone_Core_Model_Service_Sales_OrderComment $service)
276
+ {
277
+ $this->serviceOrderComment = $service;
278
+ }
279
+
280
+ /**
281
+ * @return Payone_Core_Model_Service_Sales_OrderComment
282
+ */
283
+ public function getServiceOrderComment()
284
+ {
285
+ return $this->serviceOrderComment;
286
+ }
287
+
288
+ /**
289
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
290
+ */
291
+ public function setConfigPaymentMethod(Payone_Core_Model_Config_Payment_Method_Interface $config)
292
+ {
293
+ $this->configPaymentMethod = $config;
294
+ }
295
+
296
+ /**
297
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
298
+ */
299
+ public function getConfigPaymentMethod()
300
+ {
301
+ return $this->configPaymentMethod;
302
+ }
303
+
304
+ /**
305
+ * @param Payone_Core_Model_Service_Transaction_Create $service
306
+ */
307
+ public function setServiceTransactionCreate(Payone_Core_Model_Service_Transaction_Create $service)
308
+ {
309
+ $this->serviceTransactionCreate = $service;
310
+ }
311
+
312
+ /**
313
+ * @return Payone_Core_Model_Service_Transaction_Create
314
+ */
315
+ public function getServiceTransactionCreate()
316
+ {
317
+ return $this->serviceTransactionCreate;
318
+ }
319
+
320
+ /**
321
+ * @param Payone_Api_Request_Interface $request
322
+ */
323
+ public function setRequest(Payone_Api_Request_Interface $request)
324
+ {
325
+ $this->request = $request;
326
+ }
327
+
328
+ /**
329
+ * @return Payone_Api_Request_Interface
330
+ */
331
+ public function getRequest()
332
+ {
333
+ return $this->request;
334
+ }
335
+
336
+ /**
337
+ * @param \Payone_Core_Model_Service_Transaction_Update $serviceTransactionUpdate
338
+ */
339
+ public function setServiceTransactionUpdate($serviceTransactionUpdate)
340
+ {
341
+ $this->serviceTransactionUpdate = $serviceTransactionUpdate;
342
+ }
343
+
344
+ /**
345
+ * @return \Payone_Core_Model_Service_Transaction_Update
346
+ */
347
+ public function getServiceTransactionUpdate()
348
+ {
349
+ return $this->serviceTransactionUpdate;
350
+ }
351
+
352
+ }
app/code/community/Payone/Core/Model/Handler/Payment/Authorize.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Handler_Payment_Authorize
34
+ extends Payone_Core_Model_Handler_Payment_Abstract
35
+ implements Payone_Core_Model_Handler_Payment_Interface
36
+ {
37
+
38
+ }
app/code/community/Payone/Core/Model/Handler/Payment/Capture.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Handler_Payment_Capture
34
+ extends Payone_Core_Model_Handler_Payment_Abstract
35
+ implements Payone_Core_Model_Handler_Payment_Interface
36
+ {
37
+
38
+ }
app/code/community/Payone/Core/Model/Handler/Payment/Debit.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Handler_Payment_Debit
34
+ extends Payone_Core_Model_Handler_Payment_Abstract
35
+ implements Payone_Core_Model_Handler_Payment_Interface
36
+ {
37
+ /**
38
+ * @param Payone_Api_Response_Interface $response
39
+ * @return Payone_Core_Model_Handler_Payment_Abstract|Payone_Core_Model_Handler_Payment_Debit
40
+ */
41
+ public function handle(Payone_Api_Response_Interface $response)
42
+ {
43
+ $order = $this->getOrder();
44
+ $paymentMethod = $this->getPaymentMethod();
45
+
46
+ if ($response->isApproved()) {
47
+ $this->getPayment()->setLastTransId($response->getTxid());
48
+ }
49
+ elseif($response->isError()) {
50
+ return $this;
51
+ }
52
+
53
+ // Update Order Status
54
+ $this->getServiceOrderStatus()->setConfigStore($this->getConfigStore());
55
+ $this->getServiceOrderStatus()->updateByApiResponse($order, $response);
56
+
57
+ // Add Order Comment
58
+ $this->getServiceOrderComment()->addByApiResponse($order, $response);
59
+
60
+ return $this;
61
+ }
62
+ }
app/code/community/Payone/Core/Model/Handler/Payment/Interface.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Handler_Payment_Interface extends Payone_Core_Model_Handler_Interface
34
+ {
35
+ /**
36
+ * @param Mage_Sales_Model_Order_Payment $payment
37
+ */
38
+ public function setPayment(Mage_Sales_Model_Order_Payment $payment);
39
+
40
+ }
app/code/community/Payone/Core/Model/Handler/Payment/Preauthorize.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Handler_Payment_Preauthorize
34
+ extends Payone_Core_Model_Handler_Payment_Abstract
35
+ implements Payone_Core_Model_Handler_Payment_Interface
36
+ {
37
+
38
+ }
app/code/community/Payone/Core/Model/Handler/Verification/Abstract.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Handler_Verification_Abstract
34
+ extends Payone_Core_Model_Handler_Abstract
35
+ implements Payone_Core_Model_Handler_Verification_Interface
36
+ {
37
+ /** @var Mage_Customer_Model_Address_Abstract */
38
+ protected $address = null;
39
+
40
+ /** @var Varien_Object */
41
+ protected $errors = null;
42
+
43
+ protected $prefix = 'abstract';
44
+
45
+ /** @var Payone_Api_Request_Interface */
46
+ protected $request = null;
47
+
48
+ /**
49
+ * Store date and score to customerAddress.
50
+ * If the quoteAddress is not a saved customerAddress we do nothing
51
+ * If it gets saved to the addressBook at end of checkout Magento´ convert functionality saves the data for us
52
+ *
53
+ * @param Mage_Customer_Model_Address_Abstract $address
54
+ * @return bool
55
+ */
56
+ public function saveCustomerAddress(Mage_Customer_Model_Address_Abstract $address)
57
+ {
58
+ $customerAddressId = $address->getCustomerAddressId();
59
+ if (empty($customerAddressId)) {
60
+ return false;
61
+ }
62
+ $customerAddress = $this->getFactory()->getModelCustomerAddress();
63
+ $customerAddress->load($customerAddressId);
64
+
65
+ if (!$customerAddress->hasData()) {
66
+ return false;
67
+ }
68
+
69
+ $customerAddress->setData($this->prefix . '_score', $address->getData($this->prefix . '_score'));
70
+ $customerAddress->setData($this->prefix . '_date', $address->getData($this->prefix . '_date'));
71
+ $customerAddress->setData($this->prefix . '_hash', $address->getData($this->prefix . '_hash'));
72
+
73
+ $customerAddress->setCity($address->getCity());
74
+ $customerAddress->setStreetFull($address->getStreetFull());
75
+ $customerAddress->setZip($address->getZip());
76
+
77
+ $customerAddress->save();
78
+ return true;
79
+ }
80
+
81
+ /**
82
+ * @param Mage_Customer_Model_Address_Abstract $address
83
+ */
84
+ public function setAddress(Mage_Customer_Model_Address_Abstract $address)
85
+ {
86
+ $this->address = $address;
87
+ }
88
+
89
+ /**
90
+ * @return Mage_Customer_Model_Address_Abstract
91
+ */
92
+ public function getAddress()
93
+ {
94
+ return $this->address;
95
+ }
96
+
97
+ /**
98
+ * @param Varien_Object $errors
99
+ */
100
+ public function setErrors(Varien_Object $errors)
101
+ {
102
+ $this->errors = $errors;
103
+ }
104
+
105
+ /**
106
+ * @return Varien_Object
107
+ */
108
+ public function getErrors()
109
+ {
110
+ return $this->errors;
111
+ }
112
+
113
+ /**
114
+ * @param Payone_Api_Request_Interface $request
115
+ */
116
+ public function setRequest(Payone_Api_Request_Interface $request)
117
+ {
118
+ $this->request = $request;
119
+ }
120
+
121
+ /**
122
+ * @return Payone_Api_Request_Interface
123
+ */
124
+ public function getRequest()
125
+ {
126
+ return $this->request;
127
+ }
128
+ }
app/code/community/Payone/Core/Model/Handler/Verification/AddressCheck.php ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Handler_Verification_AddressCheck
34
+ extends Payone_Core_Model_Handler_Verification_Abstract
35
+ implements Payone_Core_Model_Handler_Verification_Interface
36
+ {
37
+ /** @var Payone_Core_Model_Config_Protect_AddressCheck */
38
+ protected $config = null;
39
+
40
+ protected $prefix = 'payone_addresscheck';
41
+
42
+ /**
43
+ * @param Payone_Api_Response_Interface $response
44
+ */
45
+ public function handle(Payone_Api_Response_Interface $response)
46
+ {
47
+ $address = $this->getAddress();
48
+ $errors = $this->getErrors();
49
+ $config = $this->getConfig();
50
+
51
+ $mapping = $config->getMappingPersonstatus();
52
+
53
+ if ($response instanceof Payone_Api_Response_AddressCheck_Valid) {
54
+ /** @var $response Payone_Api_Response_AddressCheck_Valid */
55
+ if ($response->isCorrect()) {
56
+ $this->handleCorrectAddress();
57
+ // Do nothing, best case, resume with personStatus mapping.
58
+ }
59
+ elseif ($response->isCorrectable()) {
60
+
61
+ if ($this->getConfig()->getConfirmAddressCorrection()) {
62
+ // Address correction must be confirmed by customer, hand it up to controller/frontend
63
+ $correctedAddress = $this->prepareAddressCorrectionDataForCustomer($response);
64
+ $errors->setData('payone_address_corrected', $correctedAddress);
65
+ }
66
+ else {
67
+ // Automatically correct address, allowing customer to resume checkout
68
+ $this->correctAddress($response);
69
+ }
70
+ }
71
+
72
+ $personStatus = $response->getPersonstatus();
73
+ if (array_key_exists($personStatus, $mapping) and $personStatus != 'NONE') {
74
+ $score = $mapping[$personStatus];
75
+
76
+ $address->setData('payone_addresscheck_score', $score);
77
+ }
78
+ $this->saveCustomerAddress($address);
79
+ }
80
+ elseif ($response instanceof Payone_Api_Response_AddressCheck_Invalid) {
81
+ /** @var $response Payone_Api_Response_AddressCheck_Invalid */
82
+ $message = $this->getMessageForInvalidData($response->getCustomermessage());
83
+ $errors->setData('payone_address_invalid', $message);
84
+ }
85
+ elseif ($response instanceof Payone_Api_Response_Error) {
86
+ /** @var $response Payone_Api_Response_Error */
87
+ $this->handleError();
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @param Exception|null $ex
93
+ */
94
+ public function handleException(Exception $ex = null)
95
+ {
96
+ $this->handleError();
97
+ }
98
+
99
+ /**
100
+ * Endpoint for handling all kinds of errors and exceptions, handles output to customer
101
+ * Does not take a message parameter, as we don´ want to expose this to the customer
102
+ *
103
+ * @return void
104
+ */
105
+ protected function handleError()
106
+ {
107
+ $config = $this->getConfig();
108
+ if ($config->onErrorContinueCheckout()) {
109
+ // Forced continuation of checkout, ignoring failed address check
110
+ return;
111
+ }
112
+
113
+ $message = $config->getStopCheckoutMessage();
114
+ if (empty($message)) {
115
+ $message = $this->getGenericErrorMessage();
116
+ }
117
+ $message = $this->helper()->__($message); // Trying to translate the message
118
+
119
+ $this->getErrors()->setData('payone_address_error', $message);
120
+ }
121
+
122
+ /**
123
+ * @return void
124
+ */
125
+ public function handleCorrectAddress()
126
+ {
127
+ $address = $this->getAddress();
128
+ $hash = $this->helper()->createAddressHash($address);
129
+
130
+ $address->setData('payone_addresscheck_hash', $hash);
131
+ $address->setData('payone_addresscheck_date', now());
132
+ }
133
+
134
+ /**
135
+ * Auto-corrects address
136
+ * Updated customer address (if available) as well
137
+ *
138
+ * @param Payone_Api_Response_AddressCheck_Valid $response
139
+ */
140
+ protected function correctAddress(Payone_Api_Response_AddressCheck_Valid $response)
141
+ {
142
+ $address = $this->getAddress();
143
+
144
+ $newCity = $response->getCity();
145
+ $newZip = $response->getZip();
146
+ $newStreet = $response->getStreet();
147
+
148
+ $address->setCity($newCity);
149
+ $address->setPostcode($newZip);
150
+ $address->setStreetFull($newStreet);
151
+
152
+ $this->handleCorrectAddress();
153
+ }
154
+
155
+
156
+ /**
157
+ * @param Payone_Api_Response_AddressCheck_Valid $response
158
+ *
159
+ * @return array|bool Corrected address data as array, false on no correction
160
+ */
161
+ protected function prepareAddressCorrectionDataForCustomer(Payone_Api_Response_AddressCheck_Valid $response)
162
+ {
163
+ $correctedAddress = array(
164
+ 'city' => $response->getCity(),
165
+ 'postcode' => $response->getZip(),
166
+ 'street' => $response->getStreet(),
167
+ 'customermessage' => $this->helper()->__('Address corrected. Please confirm.'));
168
+
169
+ return $correctedAddress;
170
+ }
171
+
172
+ /**
173
+ * @return string
174
+ */
175
+ protected function getGenericErrorMessage()
176
+ {
177
+ return 'There has been an error processing your request.';
178
+ }
179
+
180
+ /**
181
+ * @param $customermessage
182
+ * @return string
183
+ */
184
+ protected function getMessageForInvalidData($customermessage)
185
+ {
186
+
187
+ $message = $this->getConfig()->getMessageResponseInvalid();
188
+
189
+ if(empty($message))
190
+ {
191
+ $message = $this->helper()->__('Address data invalid.');
192
+ }
193
+ $substitutionArray = array(
194
+ '{{payone_customermessage}}' => $customermessage,
195
+ );
196
+
197
+ $message = str_replace(array_keys($substitutionArray), array_values($substitutionArray), $message);
198
+
199
+ return $message;
200
+ }
201
+
202
+ /**
203
+ * @param Payone_Core_Model_Config_Protect_AddressCheck $config
204
+ */
205
+ public function setConfig(Payone_Core_Model_Config_Protect_AddressCheck $config)
206
+ {
207
+ $this->config = $config;
208
+ }
209
+
210
+ /**
211
+ * @return Payone_Core_Model_Config_Protect_AddressCheck
212
+ */
213
+ public function getConfig()
214
+ {
215
+ return $this->config;
216
+ }
217
+ }
app/code/community/Payone/Core/Model/Handler/Verification/Creditrating.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Handler_Verification_Creditrating
34
+ extends Payone_Core_Model_Handler_Verification_Abstract
35
+ implements Payone_Core_Model_Handler_Verification_Interface
36
+ {
37
+ /** @var Payone_Core_Model_Config_Protect_Creditrating */
38
+ protected $config = null;
39
+
40
+ protected $prefix = 'payone_protect';
41
+
42
+ /**
43
+ * Handle Creditrating by Payone API response:
44
+ *
45
+ * @param Payone_Api_Response_Interface $response
46
+ * @return array|bool will return true if all methods are available
47
+ * @throws Exception|Mage_Payment_Exception
48
+ */
49
+ public function handle(Payone_Api_Response_Interface $response)
50
+ {
51
+ $address = $this->getAddress();
52
+ $scoreAddressCheck = $address->getPayoneAddresscheckScore();
53
+
54
+ $allowedMethods = array();
55
+ if ($response instanceof Payone_Api_Response_Consumerscore_Valid) {
56
+ /** @var $response Payone_Api_Response_Consumerscore_Valid */
57
+ $scoreProtect = $this->getProtectScore($scoreAddressCheck, $response->getScore());
58
+
59
+ $allowedMethods = $this->handleProtectScore($scoreProtect);
60
+
61
+ $address->setPayoneProtectDate(now());
62
+ $address->setPayoneProtectHash($this->helper()->createAddressHash($address));
63
+
64
+ $this->saveCustomerAddress($address);
65
+ }
66
+ elseif ($response instanceof Payone_Api_Response_Consumerscore_Invalid) {
67
+ /** @var $response Payone_Api_Response_Consumerscore_Invalid*/
68
+ $allowedMethods = $this->handleProtectScore(Payone_Api_Enum_ConsumerscoreScore::RED);
69
+
70
+ $address->setPayoneProtectDate(now());
71
+ $address->setPayoneProtectHash($this->helper()->createAddressHash($address));
72
+
73
+ $this->saveCustomerAddress($address);
74
+ }
75
+ elseif ($response instanceof Payone_Api_Response_Error) {
76
+ /** @var $response Payone_Api_Response_Error */
77
+
78
+ $allowedMethods = $this->handleError(null, $response);
79
+ }
80
+ return $allowedMethods;
81
+ }
82
+
83
+ /**
84
+ * @param Exception|null $ex
85
+ * @return array|bool
86
+ *
87
+ */
88
+ public function handleException(Exception $ex = null)
89
+ {
90
+ return $this->handleError($ex);
91
+ }
92
+
93
+ /**
94
+ * Endpoint for handling all kinds of errors and exceptions,
95
+ * Notifies Magento admin of error (by email), allows displaying of ALL payment methods
96
+ *
97
+ * Takes Exception and/or Error response as parameter, to provide information for error email
98
+ *
99
+ * @param null|Exception $ex
100
+ * @param null|Payone_Api_Response_Error $response
101
+ * @throws Mage_Payment_Exception
102
+ * @return bool
103
+ */
104
+ protected function handleError(Exception $ex = null, Payone_Api_Response_Error $response = null)
105
+ {
106
+ $config = $this->getConfig();
107
+ if ($config->isIntegrationEventAfterPayment()) {
108
+ if ($config->onErrorStopCheckout()) {
109
+ // Mage_Payment_Exception is caught in checkout and message gets displayed to customer.
110
+ throw new Mage_Payment_Exception($config->getStopCheckoutMessage());
111
+ }
112
+ return true;
113
+ }
114
+
115
+ $additionalInfo = array();
116
+ if (!empty($response)) {
117
+ $errorName = 'Creditrating check ERROR. Code: ' . $response->getErrorcode();
118
+ $errorMessage = $response->getErrormessage();
119
+ $stackTrace = '';
120
+ $additionalInfo['customermessage'] = $response->getCustomermessage();
121
+ }
122
+ elseif (!empty($ex)) {
123
+ $errorName = 'Creditrating check Exception. ' . get_class($ex);
124
+ $errorMessage = $ex->getMessage();
125
+ $stackTrace = $ex->getTraceAsString();
126
+ }
127
+ else {
128
+ $errorName = 'Creditrating check unexpected error. ';
129
+ $errorMessage = 'An unexpected error occured during creditrating check.';
130
+ $stackTrace = '';
131
+ }
132
+
133
+ $helperEmail = $this->helperEmail();
134
+ $helperEmail->setStoreId($this->getConfigStore()->getStoreId());
135
+ $helperEmail->sendEmailError($errorName, $errorMessage, $stackTrace, $additionalInfo);
136
+ return true;
137
+ }
138
+
139
+
140
+ /**
141
+ * Handle Creditrating by Protect score (G)reen, (Y)ellow, (R)ed
142
+ *
143
+ * @param $scoreProtect
144
+ * @return array|bool will return true if all methods are available
145
+ */
146
+ public function handleProtectScore($scoreProtect)
147
+ {
148
+
149
+ $config = $this->getConfig();
150
+ $address = $this->getAddress();
151
+ $configuredMethods = array();
152
+ $allowedMethods = array();
153
+
154
+ if ($scoreProtect === Payone_Api_Enum_AddressCheckScore::RED) {
155
+ $configuredMethods = $config->getAllowPaymentMethodsRed();
156
+ }
157
+ elseif ($scoreProtect === Payone_Api_Enum_AddressCheckScore::YELLOW) {
158
+ $configuredMethods = $config->getAllowPaymentMethodsYellow();
159
+ }
160
+ elseif ($scoreProtect === Payone_Api_Enum_AddressCheckScore::GREEN) {
161
+ $configuredMethods = true;
162
+ }
163
+
164
+ $address->setPayoneProtectScore($scoreProtect);
165
+
166
+ if ($configuredMethods === true) {
167
+ return true;
168
+ }
169
+
170
+ foreach ($configuredMethods as $value) {
171
+ $allowedMethods[$value] = 1;
172
+ }
173
+
174
+ return $allowedMethods;
175
+ }
176
+
177
+ /**
178
+ * Compares addresscheck score and creditrating score, determine total score (worst result)
179
+ *
180
+ * @param $scoreAddressCheck
181
+ * @param $scoreCreditratingCheck
182
+ */
183
+ protected function getProtectScore($scoreAddressCheck, $scoreCreditratingCheck)
184
+ {
185
+ switch ($scoreAddressCheck) {
186
+ case Payone_Api_Enum_AddressCheckScore::YELLOW :
187
+ if ($scoreCreditratingCheck === Payone_Api_Enum_AddressCheckScore::GREEN) {
188
+ return $scoreAddressCheck;
189
+ }
190
+ break;
191
+ case Payone_Api_Enum_AddressCheckScore::RED :
192
+ return $scoreAddressCheck; // score1 is worst or equal to score2.
193
+ break;
194
+ }
195
+ return $scoreCreditratingCheck;
196
+ }
197
+
198
+ /**
199
+ * @param Payone_Core_Model_Config_Protect_Creditrating $config
200
+ */
201
+ public function setConfig(Payone_Core_Model_Config_Protect_Creditrating $config)
202
+ {
203
+ $this->config = $config;
204
+ }
205
+
206
+ /**
207
+ * @return Payone_Core_Model_Config_Protect_Creditrating
208
+ */
209
+ public function getConfig()
210
+ {
211
+ return $this->config;
212
+ }
213
+ }
app/code/community/Payone/Core/Model/Handler/Verification/Interface.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Handler
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Handler
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Handler_Verification_Interface extends Payone_Core_Model_Handler_Interface
34
+ {
35
+ public function setAddress(Mage_Customer_Model_Address_Abstract $address);
36
+ }
app/code/community/Payone/Core/Model/Mapper/Abstract.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_Abstract
34
+ {
35
+ /** @var Payone_Core_Model_Factory */
36
+ protected $factory = null;
37
+
38
+ /** @var Payone_Core_Helper_Data */
39
+ protected $helper = null;
40
+
41
+ /** @var Payone_Core_Helper_Url */
42
+ protected $helperUrl = null;
43
+
44
+ /** @var bool */
45
+ protected $isAdmin = false;
46
+
47
+ /**
48
+ *
49
+ * @return Payone_Core_Model_Factory
50
+ */
51
+ public function getFactory()
52
+ {
53
+ if ($this->factory === null) {
54
+ $this->factory = new Payone_Core_Model_Factory();
55
+ }
56
+ return $this->factory;
57
+ }
58
+
59
+ /**
60
+ *
61
+ * @param Payone_Core_Model_Factory $factory
62
+ */
63
+ public function setFactory(Payone_Core_Model_Factory $factory)
64
+ {
65
+ $this->factory = $factory;
66
+ }
67
+
68
+ /**
69
+ * @param Payone_Core_Helper_Data $helper
70
+ */
71
+ public function setHelper(Payone_Core_Helper_Data $helper)
72
+ {
73
+ $this->helper = $helper;
74
+ }
75
+
76
+ /**
77
+ * @return Payone_Core_Helper_Data
78
+ */
79
+ public function helper()
80
+ {
81
+ if ($this->helper === null) {
82
+ $this->helper = $this->getFactory()->helper();
83
+ }
84
+ return $this->helper;
85
+ }
86
+
87
+ /**
88
+ * @param Payone_Core_Helper_Url $helperUrl
89
+ */
90
+ public function setHelperUrl(Payone_Core_Helper_Url $helperUrl)
91
+ {
92
+ $this->helperUrl = $helperUrl;
93
+ }
94
+
95
+ /**
96
+ * @return Payone_Core_Helper_Url
97
+ */
98
+ public function helperUrl()
99
+ {
100
+ if ($this->helperUrl === null) {
101
+ $this->helperUrl = $this->getFactory()->helperUrl();
102
+ }
103
+ return $this->helperUrl;
104
+ }
105
+
106
+
107
+ /**
108
+ * @param boolean $isAdmin
109
+ */
110
+ public function setIsAdmin($isAdmin)
111
+ {
112
+ $this->isAdmin = $isAdmin;
113
+ }
114
+
115
+ /**
116
+ * @return boolean
117
+ */
118
+ public function getIsAdmin()
119
+ {
120
+ return $this->isAdmin;
121
+ }
122
+
123
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Abstract.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Abstract
34
+ extends Payone_Core_Model_Mapper_Abstract
35
+ {
36
+
37
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Management/GetInvoice.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Management_GetInvoice
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Abstract
35
+ {
36
+ /**
37
+ * @param Mage_Sales_Model_Order_Invoice $invoice
38
+ * @return Payone_Api_Request_GetInvoice
39
+ */
40
+ public function mapFromInvoice(Mage_Sales_Model_Order_Invoice $invoice)
41
+ {
42
+ /** @var $paymentMethod Payone_Core_Model_Payment_Method_Abstract */
43
+ $order = $invoice->getOrder();
44
+ $payment = $order->getPayment();
45
+ $paymentMethod = $payment->getMethodInstance();
46
+ $paymentConfig = $paymentMethod->getConfigByOrder($order);
47
+
48
+ $request = $this->getFactory()->getRequestManagementGetInvoice();
49
+ $helper = $this->helper();
50
+
51
+ $txId = $payment->getLastTransId();
52
+
53
+ $sequenceNumber = $invoice->getPayoneSequencenumber();
54
+
55
+ $request->setMid($paymentConfig->getMid());
56
+ $request->setMode($paymentConfig->getMode());
57
+ $request->setPortalid($paymentConfig->getPortalid());
58
+ $request->setKey($paymentConfig->getKey());
59
+ $request->setEncoding('UTF-8');
60
+
61
+ $request->setIntegratorName('Magento');
62
+ $request->setIntegratorVersion($helper->getMagentoVersion());
63
+ $request->setSolutionName('noovias');
64
+ $request->setSolutionVersion($helper->getPayoneVersion());
65
+
66
+ $invoiceTitle = 'RG-' . $txId . '-' . $sequenceNumber;
67
+ $request->setInvoiceTitle($invoiceTitle);
68
+
69
+ return $request;
70
+ }
71
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Abstract.php ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Abstract
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Abstract
35
+ implements Payone_Core_Model_Mapper_ApiRequest_Payment_Interface
36
+ {
37
+ const DEFAULT_SHIPPING_SKU = 'Shipping';
38
+
39
+ /** @var float */
40
+ protected $amount = 0.00;
41
+
42
+ /** @var Mage_Sales_Model_Order */
43
+ protected $order = null;
44
+
45
+ /** @var Payone_Core_Model_Payment_Method_Abstract */
46
+ protected $paymentMethod = null;
47
+
48
+ /** @var Payone_Core_Model_Config_Payment_Method_Interface */
49
+ protected $configPayment = null;
50
+
51
+ /** @var Payone_Core_Model_Config_Misc */
52
+ protected $configMisc = null;
53
+
54
+ /**
55
+ * @param Mage_Sales_Model_Order_Payment $payment
56
+ */
57
+ protected function init(Mage_Sales_Model_Order_Payment $payment)
58
+ {
59
+ $this->setOrder($payment->getOrder());
60
+ $this->setPaymentMethod($payment->getMethodInstance());
61
+ }
62
+
63
+ /**
64
+ * @param Payone_Api_Request_Interface $request
65
+ */
66
+ protected function mapDefaultParameters(Payone_Api_Request_Interface $request)
67
+ {
68
+ $helper = $this->helper();
69
+
70
+ $solutionName = 'noovias';
71
+ $solutionVersion = $helper->getPayoneVersion();
72
+ $integratorName = 'magento';
73
+ $integratorVersion = $helper->getMagentoVersion();
74
+
75
+ $request->setEncoding('UTF-8');
76
+ $request->setMid($this->getConfigPayment()->getMid());
77
+ $request->setPortalid($this->getConfigPayment()->getPortalid());
78
+ $request->setMode($this->getConfigPayment()->getMode());
79
+ $request->setKey($this->getConfigPayment()->getKey());
80
+ $request->setIntegratorName($integratorName);
81
+ $request->setIntegratorVersion($integratorVersion);
82
+ $request->setSolutionName($solutionName);
83
+ $request->setSolutionVersion($solutionVersion);
84
+ }
85
+
86
+ protected function mapShippingFeeAsItem()
87
+ {
88
+ $order = $this->getOrder();
89
+
90
+ $configMiscShipping = $this->getConfigMisc()->getShippingCosts();
91
+ $sku = $configMiscShipping->getSku();
92
+ if (empty($sku)) {
93
+ $sku = self::DEFAULT_SHIPPING_SKU;
94
+ }
95
+ $params['id'] = $sku;
96
+ $params['de'] = $order->getShippingDescription();
97
+ $params['no'] = 1;
98
+ $params['pr'] = $order->getShippingInclTax();
99
+ $params['va'] = $this->getShippingTaxRate();
100
+
101
+ $item = new Payone_Api_Request_Parameter_Invoicing_Item();
102
+ $item->init($params);
103
+
104
+ return $item;
105
+ }
106
+
107
+ protected function getShippingTaxRate()
108
+ {
109
+ $order = $this->getOrder();
110
+ $storeId = $this->getStoreId();
111
+ $factory = $this->getFactory();
112
+ $store = $factory->getModelCoreStore()->load($storeId);
113
+
114
+ /** @var $taxCalculationModel Mage_Tax_Model_Calculation */
115
+ $taxCalculationModel = $factory->getSingletonTaxCalculation();
116
+
117
+ $shippingAddress = $order->getShippingAddress();
118
+ $billingAddress = $order->getBillingAddress();
119
+ $quoteId = $order->getQuoteId();
120
+ $quote = $factory->getModelSalesQuote();
121
+ $quote->load($quoteId);
122
+
123
+ $customerTaxClassId = $quote->getCustomerTaxClassId();
124
+ $request = $taxCalculationModel->getRateRequest($shippingAddress, $billingAddress, $customerTaxClassId, $store);
125
+
126
+ $shippingTaxClass = $this->helperConfig()->getShippingTaxClassId($storeId);
127
+ if ($shippingTaxClass) {
128
+ $request->setProductClassId($shippingTaxClass);
129
+ return $taxCalculationModel->getRate($request);
130
+ }
131
+ else {
132
+ return 0.0;
133
+ }
134
+ }
135
+
136
+
137
+ /**
138
+ * Returns the invoice appendix and substitutes the placeholders, as far as possible
139
+ *
140
+ * @param Mage_Sales_Model_Order_Invoice|null $invoice
141
+ * @return mixed|string
142
+ */
143
+ public function getInvoiceAppendix(Mage_Sales_Model_Order_Invoice $invoice = null)
144
+ {
145
+ $order = $this->getOrder();
146
+
147
+ /** @var $customer Mage_Customer_Model_Customer */
148
+ $customer = $this->getFactory()->getModelCustomer();
149
+ $customer->load($order->getCustomerId());
150
+
151
+ $invoiceIncrementId = '';
152
+ if (!is_null($invoice)) {
153
+ $invoiceIncrementId = $invoice->getIncrementId();
154
+ }
155
+
156
+ $substitutionArray = array(
157
+ '{{order_increment_id}}' => $order->getIncrementId(),
158
+ '{{order_id}}' => $order->getId(),
159
+ '{{invoice_increment_id}}' => $invoiceIncrementId,
160
+ '{{customer_increment_id}}' => $customer->getIncrementId(),
161
+ '{{customer_id}}' => $order->getCustomerId(),
162
+ );
163
+
164
+ $appendix = $this->getConfigParameterInvoice()->getInvoiceAppendix();
165
+ $appendix = str_replace(array_keys($substitutionArray), array_values($substitutionArray), $appendix);
166
+
167
+ return $appendix;
168
+ }
169
+
170
+ /**
171
+ * Returns the refund appendix and substitutes the placeholders, as far as possible
172
+ *
173
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
174
+ * @return string
175
+ */
176
+ public function getInvoiceAppendixRefund(Mage_Sales_Model_Order_Creditmemo $creditmemo)
177
+ {
178
+ $order = $this->getOrder();
179
+
180
+ /** @var $customer Mage_Customer_Model_Customer */
181
+ $customer = $this->getFactory()->getModelCustomer();
182
+ $customer->load($order->getCustomerId());
183
+
184
+ /** @var $invoice Mage_Sales_Model_Order_Invoice */
185
+ $invoice = $creditmemo->getInvoice();
186
+
187
+ $substitutionArray = array(
188
+ '{{order_increment_id}}' => $order->getIncrementId(),
189
+ '{{order_id}}' => $order->getId(),
190
+ '{{creditmemo_increment_id}}' => $creditmemo->getIncrementId(),
191
+ '{{invoice_increment_id}}' => $invoice->getIncrementId(),
192
+ '{{invoice_id}}' => $invoice->getId(),
193
+ '{{customer_increment_id}}' => $customer->getIncrementId(),
194
+ '{{customer_id}}' => $order->getCustomerId(),
195
+ );
196
+
197
+ $appendix = $this->getConfigParameterInvoice()->getInvoiceAppendixRefund();
198
+ $appendix = str_replace(array_keys($substitutionArray), array_values($substitutionArray), $appendix);
199
+
200
+ return $appendix;
201
+ }
202
+
203
+ /**
204
+ * @param Mage_Sales_Model_Abstract $object
205
+ * @return string
206
+ */
207
+ protected function fetchNewIncrementId(Mage_Sales_Model_Abstract $object)
208
+ {
209
+ $entityTypeModel = $this->getFactory()->getModelEavEntityType();
210
+
211
+ $code = '';
212
+ if ($object instanceof Mage_Sales_Model_Order_Invoice) {
213
+ $code = 'invoice';
214
+ }
215
+ elseif ($object instanceof Mage_Sales_Model_Order_Creditmemo) {
216
+ $code = 'creditmemo';
217
+ }
218
+ $entityType = $entityTypeModel->loadByCode($code);
219
+ $newIncrementId = $entityType->fetchNewIncrementId($this->getStoreId());
220
+ if ($newIncrementId !== false) {
221
+ $object->setIncrementId($newIncrementId);
222
+ }
223
+ return $newIncrementId;
224
+ }
225
+
226
+ /**
227
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $configPayment
228
+ */
229
+ public function setConfigPayment(Payone_Core_Model_Config_Payment_Method_Interface $configPayment)
230
+ {
231
+ $this->configPayment = $configPayment;
232
+ }
233
+
234
+ /**
235
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
236
+ */
237
+ public function getConfigPayment()
238
+ {
239
+ return $this->configPayment;
240
+ }
241
+
242
+ /**
243
+ * @return Payone_Core_Model_Config_Misc
244
+ */
245
+ protected function getConfigMisc()
246
+ {
247
+ if($this->configMisc === null)
248
+ {
249
+ $this->configMisc = $this->helperConfig()->getConfigMisc($this->getStoreId());
250
+ }
251
+ return $this->configMisc;
252
+ }
253
+
254
+
255
+ /**
256
+ * @param Payone_Core_Model_Config_Misc $configMisc
257
+ */
258
+ public function setConfigMisc(Payone_Core_Model_Config_Misc $configMisc)
259
+ {
260
+ $this->configMisc = $configMisc;
261
+ }
262
+
263
+ /**
264
+ * @return Payone_Core_Model_Config_General_ParameterInvoice
265
+ */
266
+ protected function getConfigParameterInvoice()
267
+ {
268
+ return $this->helperConfig()->getConfigGeneral($this->getStoreId())->getParameterInvoice();
269
+ }
270
+
271
+ /**
272
+ * @return int
273
+ */
274
+ protected function getStoreId()
275
+ {
276
+ return $this->getPaymentMethod()->getStore();
277
+ }
278
+
279
+ /**
280
+ * @param Mage_Sales_Model_Order $order
281
+ */
282
+ public function setOrder(Mage_Sales_Model_Order $order)
283
+ {
284
+ $this->order = $order;
285
+ }
286
+
287
+ /**
288
+ * @return Mage_Sales_Model_Order
289
+ */
290
+ public function getOrder()
291
+ {
292
+ return $this->order;
293
+ }
294
+
295
+ /**
296
+ * @param float $amount
297
+ */
298
+ public function setAmount($amount)
299
+ {
300
+ $this->amount = $amount;
301
+ }
302
+
303
+ /**
304
+ * @return float
305
+ */
306
+ public function getAmount()
307
+ {
308
+ return $this->amount;
309
+ }
310
+
311
+ /**
312
+ * @param Payone_Core_Model_Payment_Method_Abstract $paymentMethod
313
+ */
314
+ public function setPaymentMethod(Payone_Core_Model_Payment_Method_Abstract $paymentMethod)
315
+ {
316
+ $this->paymentMethod = $paymentMethod;
317
+ }
318
+
319
+ /**
320
+ * @return Payone_Core_Model_Payment_Method_Abstract
321
+ */
322
+ public function getPaymentMethod()
323
+ {
324
+ return $this->paymentMethod;
325
+ }
326
+
327
+ /**
328
+ * @return Payone_Core_Helper_Config
329
+ */
330
+ protected function helperConfig()
331
+ {
332
+ return $this->getFactory()->helperConfig();
333
+ }
334
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize_Abstract
35
+ {
36
+ /**
37
+ * @param Payone_Api_Request_Authorization_Abstract $request
38
+ */
39
+ public function afterMapFromPayment(Payone_Api_Request_Authorization_Abstract $request)
40
+ {
41
+ }
42
+
43
+ /**
44
+ * @return Payone_Api_Request_Authorization
45
+ */
46
+ protected function getRequest()
47
+ {
48
+ return $this->getFactory()->getRequestPaymentAuthorization();
49
+ }
50
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize_Abstract
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Payment_Abstract
35
+ {
36
+ /**
37
+ * @return Payone_Api_Request_Authorization_Abstract
38
+ */
39
+ abstract protected function getRequest();
40
+
41
+ /**
42
+ *
43
+ * @param Mage_Sales_Model_Order_Payment $payment
44
+ * @return Payone_Api_Request_Preauthorization|Payone_Api_Request_Authorization
45
+ */
46
+ public function mapFromPayment(Mage_Sales_Model_Order_Payment $payment)
47
+ {
48
+ $this->init($payment);
49
+
50
+ $configPayment = $this->getConfigPayment();
51
+
52
+ $request = $this->getRequest();
53
+
54
+ $this->beforeMapFromPayment($request);
55
+
56
+ // Add Default Api Parameters
57
+ $this->mapDefaultParameters($request);
58
+
59
+ // Add Default Authorize Parameters
60
+ $this->mapDefaultAuthorizeParameters($request);
61
+
62
+ // PersonalData
63
+ $personalData = $this->mapPersonalParameters();
64
+ $request->setPersonalData($personalData);
65
+
66
+ // ShippingData
67
+ $deliveryData = $this->mapDeliveryParameters();
68
+ $request->setDeliveryData($deliveryData);
69
+
70
+ // Only add Invoiceing Parameters if enabled
71
+ if ($configPayment->isInvoiceTransmitEnabled()) {
72
+ $invoicing = $this->mapInvoicingParameters();
73
+ $request->setInvoicing($invoicing);
74
+ }
75
+
76
+ $payment = $this->mapPaymentParameters();
77
+
78
+ // Not every Paymentmethod has an extra Parameter Set
79
+ if ($payment !== null) {
80
+ $request->setPayment($payment);
81
+ }
82
+
83
+ $this->afterMapFromPayment($request);
84
+
85
+ return $request;
86
+ }
87
+
88
+ /**
89
+ * @param Payone_Api_Request_Authorization_Abstract $request
90
+ */
91
+ public function beforeMapFromPayment(Payone_Api_Request_Authorization_Abstract $request)
92
+ {
93
+
94
+ }
95
+
96
+ /**
97
+ * @param Payone_Api_Request_Authorization_Abstract $request
98
+ */
99
+ public function afterMapFromPayment(Payone_Api_Request_Authorization_Abstract $request)
100
+ {
101
+
102
+ }
103
+
104
+ /**
105
+ * @param Payone_Api_Request_Authorization_Abstract $request
106
+ */
107
+ protected function mapDefaultAuthorizeParameters(Payone_Api_Request_Authorization_Abstract $request)
108
+ {
109
+ $order = $this->getOrder();
110
+ $paymentMethod = $this->getPaymentMethod();
111
+
112
+ $request->setRequest($this->configPayment->getRequestType());
113
+ $request->setAid($this->configPayment->getAid());
114
+ $request->setClearingtype($this->mapClearingType($paymentMethod));
115
+ $request->setCurrency($order->getOrderCurrencyCode());
116
+ $request->setReference($order->getIncrementId());
117
+ $request->setParam(''); // @comment currently empty
118
+
119
+ $narrativeText = '';
120
+ /** load correct narrative text from config */
121
+ if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Creditcard) {
122
+ $narrativeText = $this->getNarrativeText('creditcard');
123
+ }
124
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_DebitPayment) {
125
+ $narrativeText = $this->getNarrativeText('debit_payment');
126
+ }
127
+ $request->setNarrativeText($narrativeText);
128
+
129
+ $request->setAmount($order->getGrandTotal());
130
+ }
131
+
132
+
133
+ /**
134
+ * @return Payone_Api_Request_Parameter_Authorization_PersonalData
135
+ */
136
+ protected function mapPersonalParameters()
137
+ {
138
+ $helper = $this->helper();
139
+ $order = $this->getOrder();
140
+ $billingAddress = $order->getBillingAddress();
141
+ $billingCountry = $billingAddress->getCountry();
142
+ $customer = $order->getCustomer();
143
+
144
+ $personalData = new Payone_Api_Request_Parameter_Authorization_PersonalData();
145
+ $personalData->setCustomerid($customer->getIncrementId());
146
+ $personalData->setTitle($billingAddress->getPrefix());
147
+ $personalData->setFirstname($billingAddress->getFirstname());
148
+ $personalData->setLastname($billingAddress->getLastname());
149
+ $personalData->setCompany($billingAddress->getCompany());
150
+
151
+ $street = $helper->normalizeStreet($billingAddress->getStreet());
152
+ $personalData->setStreet($street);
153
+ $personalData->setAddressaddition('');
154
+ $personalData->setZip($billingAddress->getPostcode());
155
+ $personalData->setCity($billingAddress->getCity());
156
+ $personalData->setCountry($billingCountry);
157
+ $personalData->setEmail($billingAddress->getEmail());
158
+ $personalData->setTelephonenumber($billingAddress->getTelephone());
159
+
160
+ $birthday = $this->formatBirthday($order->getCustomerDob());
161
+ $personalData->setBirthday($birthday);
162
+
163
+ $language = $helper->getDefaultLanguage();
164
+ $personalData->setLanguage($language);
165
+ $personalData->setVatid($order->getCustomerTaxvat());
166
+ $personalData->setIp($order->getRemoteIp());
167
+
168
+ // US and CA always need state and shipping_state paramters
169
+ if ($billingCountry == 'US' or $billingCountry == 'CA') {
170
+ $personalData->setState($billingAddress->getRegionCode());
171
+ }
172
+
173
+ return $personalData;
174
+ }
175
+
176
+ /**
177
+ * @return Payone_Api_Request_Parameter_Authorization_DeliveryData
178
+ */
179
+ protected function mapDeliveryParameters()
180
+ {
181
+ $helper = $this->helper();
182
+ $shippingAddress = $this->getOrder()->getShippingAddress();
183
+ $shippingCountry = $shippingAddress->getCountry();
184
+
185
+ $deliveryData = new Payone_Api_Request_Parameter_Authorization_DeliveryData();
186
+
187
+ $deliveryData->setShippingFirstname($shippingAddress->getFirstname());
188
+ $deliveryData->setShippingLastname($shippingAddress->getLastname());
189
+ $deliveryData->setShippingCompany($shippingAddress->getCompany());
190
+ $street = $helper->normalizeStreet($shippingAddress->getStreet());
191
+ $deliveryData->setShippingStreet($street);
192
+ $deliveryData->setShippingZip($shippingAddress->getPostcode());
193
+ $deliveryData->setShippingCity($shippingAddress->getCity());
194
+ $deliveryData->setShippingCountry($shippingCountry);
195
+
196
+ // US and CA always need shipping_state paramters
197
+ if ($shippingCountry == 'US' or $shippingCountry == 'CA') {
198
+ $deliveryData->setShippingState($shippingAddress->getRegionCode());
199
+ }
200
+
201
+ return $deliveryData;
202
+ }
203
+
204
+ /**
205
+ * @return Payone_Api_Request_Parameter_Invoicing_Transaction
206
+ */
207
+ protected function mapInvoicingParameters()
208
+ {
209
+ $order = $this->getOrder();
210
+
211
+ $invoiceAppendix = $this->getInvoiceAppendix();
212
+
213
+ $invoicing = new Payone_Api_Request_Parameter_Invoicing_Transaction();
214
+ $invoicing->setInvoiceappendix($invoiceAppendix);
215
+
216
+ // Order items:
217
+ foreach ($order->getItemsCollection() as $key => $itemData) {
218
+ /** @var $itemData Mage_Sales_Model_Order_Item */
219
+ $params['id'] = $itemData->getSku();
220
+ $params['pr'] = $itemData->getPriceInclTax();
221
+ $params['no'] = $itemData->getQtyToInvoice();
222
+ $params['de'] = $itemData->getName();
223
+ $params['va'] = number_format($itemData->getTaxPercent(), 0, '.', '');
224
+
225
+ $item = new Payone_Api_Request_Parameter_Invoicing_Item();
226
+ $item->init($params);
227
+ $invoicing->addItem($item);
228
+ }
229
+
230
+ // Shipping / Fees:
231
+ if ($order->getShippingInclTax() > 0) {
232
+ $invoicing->addItem($this->mapShippingFeeAsItem());
233
+ }
234
+
235
+ return $invoicing;
236
+ }
237
+
238
+ /**
239
+ * @return Payone_Api_Request_Parameter_Authorization_3dsecure
240
+ */
241
+ protected function map3dSecureParameters()
242
+ {
243
+ $secure3d = new Payone_Api_Request_Parameter_Authorization_3dsecure();
244
+ // @comment 3D Secure is currently not available in Magento
245
+ return $secure3d;
246
+ }
247
+
248
+ /**
249
+ * @return Payone_Api_Request_Parameter_Authorization_PaymentMethod_Abstract
250
+ */
251
+ protected function mapPaymentParameters()
252
+ {
253
+ $payment = null;
254
+ $paymentMethod = $this->getPaymentMethod();
255
+ $info = $paymentMethod->getInfoInstance();
256
+ $isRedirect = false;
257
+
258
+ if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_CashOnDelivery) {
259
+ $payment = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_CashOnDelivery();
260
+ $payment->setShippingprovider(Payone_Api_Enum_Shippingprovider::DHL);
261
+ }
262
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Creditcard) {
263
+ $payment = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_CreditCard();
264
+
265
+ // check if it is an adminorder and set ecommercemode to moto
266
+ if ($this->getIsAdmin()) {
267
+ $payment->setEcommercemode('moto');
268
+ }
269
+ $payment->setPseudocardpan($info->getPayonePseudocardpan());
270
+ $isRedirect = true;
271
+ }
272
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_OnlineBankTransfer) {
273
+ $country = $this->getOrder()->getBillingAddress()->getCountry();
274
+
275
+ $payment = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_OnlineBankTransfer();
276
+ $payment->setBankcountry($country);
277
+ $payment->setBankaccount($info->getPayoneAccountNumber());
278
+ $payment->setBankcode($info->getPayoneBankCode());
279
+ $payment->setBankgrouptype($info->getPayoneBankGroup());
280
+ $payment->setOnlinebanktransfertype($info->getPayoneOnlinebanktransferType());
281
+
282
+ $isRedirect = true;
283
+ }
284
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Wallet) {
285
+ $payment = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_Wallet();
286
+ // @comment currently hardcoded because there is no other Type
287
+ $payment->setWallettype(Payone_Api_Enum_WalletType::PAYPAL_EXPRESS);
288
+
289
+ $isRedirect = true;
290
+ }
291
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_DebitPayment) {
292
+ $country = $this->getOrder()->getBillingAddress()->getCountry();
293
+
294
+ $payment = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_DebitPayment();
295
+ $payment->setBankcountry($country);
296
+ $payment->setBankaccount($info->getPayoneAccountNumber());
297
+ $payment->setBankaccountholder($info->getPayoneAccountOwner());
298
+ $payment->setBankcode($info->getPayoneBankCode());
299
+ }
300
+
301
+ if($isRedirect === true)
302
+ {
303
+ $successurl = $this->helperUrl()->getSuccessUrl();
304
+ $errorurl = $this->helperUrl()->getErrorUrl();
305
+ $backurl = $this->helperUrl()->getBackUrl();
306
+
307
+ $payment->setSuccessurl($successurl);
308
+ $payment->setErrorurl($errorurl);
309
+ $payment->setBackurl($backurl);
310
+ }
311
+
312
+ return $payment;
313
+ }
314
+
315
+ /**
316
+ * @param Payone_Core_Model_Payment_Method_Abstract $paymentMethod
317
+ * @return string
318
+ */
319
+ protected function mapClearingType(Payone_Core_Model_Payment_Method_Abstract $paymentMethod)
320
+ {
321
+ $clearingType = '';
322
+
323
+ if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_CashOnDelivery) {
324
+ $clearingType = Payone_Enum_ClearingType::CASHONDELIVERY;
325
+ }
326
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Creditcard) {
327
+ $clearingType = Payone_Enum_ClearingType::CREDITCARD;
328
+ }
329
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_OnlineBankTransfer) {
330
+ $clearingType = Payone_Enum_ClearingType::ONLINEBANKTRANSFER;
331
+ }
332
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Wallet) {
333
+ $clearingType = Payone_Enum_ClearingType::WALLET;
334
+ }
335
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Invoice) {
336
+ $clearingType = Payone_Enum_ClearingType::INVOICE;
337
+ }
338
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_AdvancePayment) {
339
+ $clearingType = Payone_Enum_ClearingType::ADVANCEPAYMENT;
340
+ }
341
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_DebitPayment) {
342
+ $clearingType = Payone_Enum_ClearingType::DEBITPAYMENT;
343
+ }
344
+
345
+ return $clearingType;
346
+ }
347
+
348
+ /**
349
+ * @param $date
350
+ * @return string
351
+ */
352
+ public function formatBirthday($date)
353
+ {
354
+ if (strlen($date) > 0) {
355
+ $date = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2);
356
+ }
357
+ return $date;
358
+ }
359
+
360
+ /**
361
+ * Returns the narrative text and substitutes the placeholder if neccessary
362
+ * @param $type
363
+ * @return string
364
+ */
365
+ protected function getNarrativeText($type)
366
+ {
367
+ $storeId = $this->getPaymentMethod()->getStore();
368
+ $general = $this->helperConfig()->getConfigGeneral($storeId);
369
+ $parameterNarrativeText = $general->getParameterNarrativeText();
370
+
371
+ $narrativeText = '';
372
+ if ($type === 'creditcard') {
373
+ $narrativeText = $parameterNarrativeText->getCreditcard();
374
+ }
375
+ elseif ($type === 'debit_payment') {
376
+ $narrativeText = $parameterNarrativeText->getDebitPayment();
377
+ }
378
+
379
+ $substitutionArray = array(
380
+ '{{order_increment_id}}' => $this->getOrder()->getIncrementId()
381
+ );
382
+
383
+ $narrativeText = str_replace(array_keys($substitutionArray), array_values($substitutionArray), $narrativeText);
384
+
385
+ return $narrativeText;
386
+ }
387
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Capture.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Payment_Capture
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Payment_Abstract
35
+ {
36
+ /** @var Mage_Sales_Model_Order_Invoice */
37
+ protected $invoice = null;
38
+
39
+ /**
40
+ * @return Payone_Api_Request_Capture
41
+ */
42
+ protected function getRequest()
43
+ {
44
+ return $this->getFactory()->getRequestPaymentCapture();
45
+ }
46
+
47
+ /**
48
+ * @param Mage_Sales_Model_Order_Payment $payment
49
+ * @return Payone_Api_Request_Capture
50
+ */
51
+ public function mapFromPayment(Mage_Sales_Model_Order_Payment $payment)
52
+ {
53
+ $this->init($payment);
54
+
55
+ $request = $this->getRequest();
56
+
57
+ $this->mapDefaultParameters($request);
58
+
59
+ $this->mapDefaultCaptureParameters($request);
60
+
61
+ $business = $this->mapBusinessParameters();
62
+ $request->setBusiness($business);
63
+
64
+ /** Set Invoiceing-Parameter only if enabled in Config */
65
+ if ($this->getConfigPayment()->isInvoiceTransmitEnabled()) {
66
+ $invoicing = $this->mapInvoicingParameters();
67
+ $request->setInvoicing($invoicing);
68
+ }
69
+
70
+ return $request;
71
+ }
72
+
73
+ /**
74
+ * @param Payone_Api_Request_Capture $request
75
+ */
76
+ protected function mapDefaultCaptureParameters(Payone_Api_Request_Capture $request)
77
+ {
78
+ $order = $this->getOrder();
79
+
80
+ $transaction = $this->getFactory()->getModelTransaction();
81
+ $transaction = $transaction->loadByPayment($order->getPayment());
82
+
83
+ $request->setTxid($order->getPayment()->getLastTransId());
84
+ $request->setSequencenumber($transaction->getNextSequenceNumber());
85
+ $request->setCurrency($order->getOrderCurrencyCode());
86
+ $request->setAmount($this->getAmount());
87
+ $request->setRequest(Payone_Api_Enum_RequestType::CAPTURE);
88
+ }
89
+
90
+ /**
91
+ * @return Payone_Api_Request_Parameter_Capture_Business
92
+ */
93
+ protected function mapBusinessParameters()
94
+ {
95
+ $business = new Payone_Api_Request_Parameter_Capture_Business();
96
+ $business->setSettleaccount('auto');
97
+ $business->setBookingDate('');
98
+ $business->setDocumentDate('');
99
+ $business->setDueTime('');
100
+ return $business;
101
+ }
102
+
103
+ /**
104
+ * @return Payone_Api_Request_Parameter_Invoicing_Transaction
105
+ */
106
+ protected function mapInvoicingParameters()
107
+ {
108
+ $order = $this->getOrder();
109
+ $invoice = $this->getInvoice();
110
+
111
+ $invoiceIncrementId = $invoice->getIncrementId();
112
+ if ($invoiceIncrementId === null) {
113
+ $invoiceIncrementId = $this->fetchNewIncrementId($invoice);
114
+ }
115
+
116
+ $appendix = $this->getInvoiceAppendix($invoice);
117
+
118
+ $invoicing = new Payone_Api_Request_Parameter_Invoicing_Transaction();
119
+ $invoicing->setInvoiceid($invoiceIncrementId);
120
+ $invoicing->setInvoiceappendix($appendix);
121
+
122
+ // Regular order items:
123
+ foreach ($invoice->getItemsCollection() as $itemData) {
124
+ /** @var $itemData Mage_Sales_Model_Order_Invoice_Item */
125
+ $params['id'] = $itemData->getSku();
126
+ $params['de'] = $itemData->getName();
127
+ $params['no'] = number_format($itemData->getQty(), 0, '.', '');
128
+ $params['pr'] = $itemData->getPriceInclTax();
129
+
130
+ // We have to load the tax percentage from the order item
131
+ /** @var $orderItem Mage_Sales_Model_Order_Item */
132
+ $orderItem = $order->getItemById($itemData->getOrderItemId());
133
+
134
+ $params['va'] = number_format($orderItem->getTaxPercent(), 0, '.', '');
135
+
136
+ $item = new Payone_Api_Request_Parameter_Invoicing_Item();
137
+ $item->init($params);
138
+ $invoicing->addItem($item);
139
+ }
140
+
141
+ // Shipping / Fees:
142
+ if ($invoice->getShippingInclTax() > 0) {
143
+ $invoicing->addItem($this->mapShippingFeeAsItem());
144
+ }
145
+
146
+ return $invoicing;
147
+ }
148
+
149
+ /**
150
+ * @return Mage_Sales_Model_Order_Invoice|null
151
+ */
152
+ protected function getInvoice()
153
+ {
154
+ if ($this->invoice === null) {
155
+ // we need to check registry because Magento won't give the invoice instance to PaymentMethodInstance
156
+ $invoice = Mage::registry('current_invoice');
157
+ if (is_null($invoice)) {
158
+ // fallback to lastInvoice when invoice could not be fetched from Registry
159
+ $order = $this->getOrder();
160
+ $invoice = $order->getInvoiceCollection()->getLastItem();
161
+ }
162
+ $this->invoice = $invoice;
163
+ }
164
+ return $this->invoice;
165
+ }
166
+
167
+ /**
168
+ * @param Mage_Sales_Model_Order_Invoice $invoice
169
+ */
170
+ public function setInvoice(Mage_Sales_Model_Order_Invoice $invoice)
171
+ {
172
+ $this->invoice = $invoice;
173
+ }
174
+
175
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Debit.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Payment_Debit
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Payment_Abstract
35
+ {
36
+ /** @var Mage_Sales_Model_Order_Creditmemo */
37
+ protected $creditmemo = null;
38
+
39
+ /**
40
+ * @return Payone_Api_Request_Debit
41
+ */
42
+ protected function getRequest()
43
+ {
44
+ return $this->getFactory()->getRequestPaymentDebit();
45
+ }
46
+
47
+ /**
48
+ * @param Mage_Sales_Model_Order_Payment $payment
49
+ * @return Payone_Api_Request_Debit
50
+ */
51
+ public function mapFromPayment(Mage_Sales_Model_Order_Payment $payment)
52
+ {
53
+ $this->init($payment);
54
+
55
+ $request = $this->getRequest();
56
+
57
+ $this->mapDefaultParameters($request);
58
+
59
+ $this->mapDefaultDebitParameters($request);
60
+
61
+ $business = $this->mapBusinessParameters();
62
+ $request->setBusiness($business);
63
+
64
+ /** Set Invoiceing-Parameter only if enabled in Config */
65
+ if ($this->getConfigPayment()->isInvoiceTransmitEnabled()) {
66
+ $invoicing = $this->mapInvoicingParameters();
67
+ $request->setInvoicing($invoicing);
68
+ }
69
+
70
+ return $request;
71
+ }
72
+
73
+ /**
74
+ * @param Payone_Api_Request_Debit $request
75
+ */
76
+ protected function mapDefaultDebitParameters(Payone_Api_Request_Debit $request)
77
+ {
78
+ $order = $this->getOrder();
79
+
80
+ $transaction = $this->getFactory()->getModelTransaction();
81
+ $transaction = $transaction->loadByPayment($order->getPayment());
82
+
83
+ $request->setTxid($order->getPayment()->getLastTransId());
84
+ $request->setSequencenumber($transaction->getNextSequenceNumber());
85
+ $request->setCurrency($order->getOrderCurrencyCode());
86
+ $request->setAmount($this->getAmount() * -1);
87
+ $request->setRequest(Payone_Api_Enum_RequestType::DEBIT);
88
+ $request->setUseCustomerdata('yes');
89
+ }
90
+
91
+ /**
92
+ * @return Payone_Api_Request_Parameter_Debit_Business
93
+ */
94
+ protected function mapBusinessParameters()
95
+ {
96
+ $business = new Payone_Api_Request_Parameter_Debit_Business();
97
+ $business->setSettleaccount('auto');
98
+ $business->setTransactiontype('');
99
+ $business->setBookingDate('');
100
+ $business->setDocumentDate('');
101
+
102
+ return $business;
103
+ }
104
+
105
+ /**
106
+ * @return Payone_Api_Request_Parameter_Invoicing_Transaction
107
+ */
108
+ protected function mapInvoicingParameters()
109
+ {
110
+ $order = $this->getOrder();
111
+ $creditmemo = $this->getCreditmemo();
112
+
113
+ $creditmemoIncrementId = $creditmemo->getIncrementId();
114
+ if ($creditmemoIncrementId === null) {
115
+ $creditmemoIncrementId = $this->fetchNewIncrementId($creditmemo);
116
+ }
117
+
118
+ $appendix = $this->getInvoiceAppendixRefund($creditmemo);
119
+
120
+ $invoicing = new Payone_Api_Request_Parameter_Invoicing_Transaction();
121
+ $invoicing->setInvoiceid($creditmemoIncrementId);
122
+ $invoicing->setInvoiceappendix($appendix);
123
+
124
+ // Regular order items:
125
+ foreach ($creditmemo->getItemsCollection() as $itemData) {
126
+ /** @var $itemData Mage_Sales_Model_Order_Creditmemo_Item */
127
+ $params['id'] = $itemData->getSku();
128
+ $params['de'] = $itemData->getName();
129
+ $params['no'] = number_format($itemData->getQty(), 0, '.', '');
130
+ $params['pr'] = $itemData->getPriceInclTax();
131
+
132
+ // We have to load the tax percentage from the order item
133
+ /** @var $orderItem Mage_Sales_Model_Order_Item */
134
+ $orderItem = $order->getItemById($itemData->getOrderItemId());
135
+
136
+ $params['va'] = number_format($orderItem->getTaxPercent(), 0, '.', '');
137
+
138
+ $item = new Payone_Api_Request_Parameter_Invoicing_Item();
139
+ $item->init($params);
140
+ $invoicing->addItem($item);
141
+ }
142
+
143
+ // Shipping / Fees
144
+ if ($creditmemo->getShippingInclTax() > 0) {
145
+ $invoicing->addItem($this->mapShippingFeeAsItem());
146
+ }
147
+
148
+ return $invoicing;
149
+ }
150
+
151
+ /**
152
+ * @param Payone_Core_Model_Payment_Method_Abstract $paymentMethod
153
+ * @return string
154
+ */
155
+ protected function mapClearingType(Payone_Core_Model_Payment_Method_Abstract $paymentMethod)
156
+ {
157
+ $clearingType = '';
158
+
159
+ if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_CashOnDelivery) {
160
+ $clearingType = Payone_Enum_ClearingType::CASHONDELIVERY;
161
+ }
162
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Creditcard) {
163
+ $clearingType = Payone_Enum_ClearingType::CREDITCARD;
164
+ }
165
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_OnlineBankTransfer) {
166
+ $clearingType = Payone_Enum_ClearingType::ONLINEBANKTRANSFER;
167
+ }
168
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Wallet) {
169
+ $clearingType = Payone_Enum_ClearingType::WALLET;
170
+ }
171
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Invoice) {
172
+ $clearingType = Payone_Enum_ClearingType::INVOICE;
173
+ }
174
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_AdvancePayment) {
175
+ $clearingType = Payone_Enum_ClearingType::ADVANCEPAYMENT;
176
+ }
177
+ elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_DebitPayment) {
178
+ $clearingType = Payone_Enum_ClearingType::DEBITPAYMENT;
179
+ }
180
+
181
+ return $clearingType;
182
+ }
183
+
184
+ /**
185
+ * @return Mage_Sales_Model_Order_Creditmemo
186
+ */
187
+ protected function getCreditmemo()
188
+ {
189
+ if ($this->creditmemo === null) {
190
+ // we need to check registry because Magento won't give the creditmemo instance to PaymentMethodInstance
191
+ $creditmemo = Mage::registry('current_creditmemo');
192
+ if (is_null($creditmemo)) {
193
+ // fallback to lastInvoice when invoice could not be fetched from Registry
194
+ $order = $this->getOrder();
195
+ $creditmemo = $order->getCreditmemosCollection()->getLastItem();
196
+ }
197
+ $this->creditmemo = $creditmemo;
198
+ }
199
+ return $this->creditmemo;
200
+ }
201
+
202
+ /**
203
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
204
+ */
205
+ public function setCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
206
+ {
207
+ $this->creditmemo = $creditmemo;
208
+ }
209
+
210
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Interface.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Mapper_ApiRequest_Payment_Interface
34
+ {
35
+ /**
36
+ * @param Mage_Sales_Model_Order_Payment $payment
37
+ * @return mixed
38
+ */
39
+ public function mapFromPayment(Mage_Sales_Model_Order_Payment $payment);
40
+
41
+ /**
42
+ * @param float $amount
43
+ */
44
+ public function setAmount($amount);
45
+
46
+ /**
47
+ * @return float
48
+ */
49
+ public function getAmount();
50
+
51
+ /**
52
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $configPayment
53
+ * @return void
54
+ */
55
+ public function setConfigPayment(Payone_Core_Model_Config_Payment_Method_Interface $configPayment);
56
+
57
+ /**
58
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
59
+ */
60
+ public function getConfigPayment();
61
+
62
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Preauthorize.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Payment_Preauthorize
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize_Abstract
35
+ {
36
+ /**
37
+ * @return Payone_Api_Request_Preauthorization
38
+ */
39
+ protected function getRequest()
40
+ {
41
+ return $this->getFactory()->getRequestPaymentPreauthorize();
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/Abstract.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Mapper_ApiRequest_Verification_Abstract
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Abstract
35
+ {
36
+ /** @var Payone_Core_Model_Config_General_Global */
37
+ protected $configGlobal = null;
38
+
39
+ /**
40
+ * @param Payone_Core_Model_Config_General_Global $configGlobal
41
+ */
42
+ public function setConfigGlobal(Payone_Core_Model_Config_General_Global $configGlobal)
43
+ {
44
+ $this->configGlobal = $configGlobal;
45
+ }
46
+
47
+ /**
48
+ * @return Payone_Core_Model_Config_General_Global
49
+ */
50
+ public function getConfigGlobal()
51
+ {
52
+ return $this->configGlobal;
53
+ }
54
+
55
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/AddressCheck.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Verification_AddressCheck
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Verification_Abstract
35
+ {
36
+ /** @var Payone_Core_Model_Config_Protect_AddressCheck */
37
+ protected $config = null;
38
+
39
+
40
+ /**
41
+ * @param Mage_Customer_Model_Address_Abstract $address
42
+ * @return Payone_Api_Request_AddressCheck
43
+ */
44
+ public function mapFromAddress(Mage_Customer_Model_Address_Abstract $address)
45
+ {
46
+ $request = $this->getFactory()->getRequestVerificationAddressCheck();
47
+ $helper = $this->helper();
48
+ $configGlobal = $this->getConfigGlobal();
49
+ $config = $this->getConfig();
50
+
51
+ if ($address->getAddressType() === 'billing') {
52
+ $request->setAddresschecktype($config->getCheckBilling());
53
+ }
54
+ elseif ($address->getAddressType() === 'shipping') {
55
+ $request->setAddresschecktype($config->getCheckShipping());
56
+ }
57
+ else {
58
+ throw new Exception('Invalid Address Check Type');
59
+ }
60
+
61
+ $request->setAid($configGlobal->getAid());
62
+ $request->setMid($configGlobal->getMid());
63
+ $request->setMode($config->getMode());
64
+ $request->setPortalid($configGlobal->getPortalid());
65
+ $request->setKey($configGlobal->getKey());
66
+
67
+
68
+ $request->setCity($address->getCity());
69
+ $request->setCompany($address->getCompany());
70
+ $request->setCountry($address->getCountry());
71
+ $request->setFirstname($address->getFirstname());
72
+ $request->setLastname($address->getLastname());
73
+
74
+ $request->setIntegratorName('Magento');
75
+ $request->setIntegratorVersion($helper->getMagentoVersion());
76
+ $request->setSolutionName('noovias');
77
+ $request->setSolutionVersion($helper->getPayoneVersion());
78
+
79
+
80
+ $request->setEncoding('UTF-8');
81
+ $request->setLanguage($helper->getDefaultLanguage());
82
+ $request->setStreet($address->getStreetFull());
83
+ $request->setTelephonenumber($address->getTelephone());
84
+
85
+ $countryId = $address->getCountryId();
86
+
87
+ if ($countryId == "US" || $countryId == "CA") {
88
+ $request->setState($address->getRegionCode());
89
+ }
90
+
91
+ $request->setZip($address->getPostcode());
92
+
93
+
94
+ return $request;
95
+ }
96
+
97
+ /**
98
+ * @param Payone_Core_Model_Config_Protect_AddressCheck $configProtect
99
+ */
100
+ public function setConfig(Payone_Core_Model_Config_Protect_AddressCheck $configProtect)
101
+ {
102
+ $this->config = $configProtect;
103
+ }
104
+
105
+ /**
106
+ * @return Payone_Core_Model_Config_Protect_AddressCheck
107
+ */
108
+ public function getConfig()
109
+ {
110
+ return $this->config;
111
+ }
112
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/BankAccountCheck.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Verification_BankAccountCheck
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Verification_Abstract
35
+ {
36
+ /**
37
+ * @var Payone_Core_Model_Config_Payment_Method_Interface
38
+ */
39
+ protected $config = null;
40
+
41
+ /**
42
+ * @param string $bankaccount
43
+ * @param string $bankcode
44
+ * @param string $bankcountry
45
+ *
46
+ * @return Payone_Api_Request_BankAccountCheck
47
+ */
48
+ public function map($bankaccount, $bankcode, $bankcountry)
49
+ {
50
+ $request = $this->getFactory()->getRequestVerificationBankAccountCheck();
51
+ $helper = $this->helper();
52
+ $config = $this->getConfig();
53
+
54
+ $request->setAid($config->getAid());
55
+ $request->setMid($config->getMid());
56
+ $request->setPortalid($config->getPortalid());
57
+ $request->setKey($config->getKey());
58
+ $request->setMode($config->getMode());
59
+
60
+ $request->setIntegratorName('Magento');
61
+ $request->setIntegratorVersion($helper->getMagentoVersion());
62
+ $request->setSolutionName('noovias');
63
+ $request->setSolutionVersion($helper->getPayoneVersion());
64
+
65
+
66
+ $request->setEncoding('UTF-8');
67
+ $request->setLanguage($helper->getDefaultLanguage());
68
+
69
+ $request->setChecktype($config->getBankAccountCheckType());
70
+
71
+ $request->setBankaccount($bankaccount);
72
+ $request->setBankcode($bankcode);
73
+ $request->setBankcountry($bankcountry);
74
+
75
+
76
+
77
+ return $request;
78
+ }
79
+
80
+ /**
81
+ * A config for payment method "debit_payment"
82
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
83
+ */
84
+ public function setConfig(Payone_Core_Model_Config_Payment_Method_Interface $config)
85
+ {
86
+ $this->config = $config;
87
+ }
88
+
89
+ /**
90
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
91
+ */
92
+ public function getConfig()
93
+ {
94
+ return $this->config;
95
+ }
96
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Verification/Creditrating.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Mapper
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Mapper
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Mapper_ApiRequest_Verification_Creditrating
34
+ extends Payone_Core_Model_Mapper_ApiRequest_Verification_Abstract
35
+ {
36
+
37
+ /** @var Payone_Core_Model_Config_Protect_Creditrating */
38
+ protected $config = null;
39
+
40
+
41
+ /**
42
+ * @param Mage_Customer_Model_Address_Abstract $address
43
+ * @return Payone_Api_Request_Consumerscore
44
+ */
45
+ public function mapFromAddress(Mage_Customer_Model_Address_Abstract $address)
46
+ {
47
+ $factory = $this->getFactory();
48
+ $request = $factory->getRequestVerificationConsumerScore();
49
+
50
+ $helper = $this->helper();
51
+ $configGlobal = $this->getConfigGlobal();
52
+ $config = $this->getConfig();
53
+
54
+
55
+ $request->setConsumerscoretype($config->getType());
56
+ $request->setAddresschecktype(Payone_Api_Enum_AddressCheckType::NONE);
57
+
58
+ $request->setAid($configGlobal->getAid());
59
+ $request->setMid($configGlobal->getMid());
60
+ $request->setMode($config->getMode());
61
+ $request->setPortalid($configGlobal->getPortalid());
62
+ $request->setKey($configGlobal->getKey());
63
+
64
+
65
+ $request->setCity($address->getCity());
66
+ $request->setCompany($address->getCompany());
67
+ $request->setCountry($address->getCountry());
68
+ $request->setFirstname($address->getFirstname());
69
+ $request->setLastname($address->getLastname());
70
+
71
+ $request->setIntegratorName('Magento');
72
+ $request->setIntegratorVersion($helper->getMagentoVersion());
73
+ $request->setSolutionName('noovias');
74
+ $request->setSolutionVersion($helper->getPayoneVersion());
75
+ if($customerId = $address->getCustomerId())
76
+ {
77
+ $customer = $factory->getModelCustomer();
78
+ $customer->load($customerId);
79
+ $date = $customer->getDob();
80
+ $date = date('Ymd', strtotime($date));
81
+ $request->setBirthday($date);
82
+ }
83
+
84
+ $request->setEncoding('UTF-8');
85
+ $request->setLanguage($helper->getDefaultLanguage());
86
+ $request->setStreet($address->getStreetFull());
87
+ $request->setTelephonenumber($address->getTelephone());
88
+ $request->setZip($address->getPostcode());
89
+
90
+
91
+ return $request;
92
+ }
93
+
94
+ /**
95
+ * @param Payone_Core_Model_Config_Protect_Creditrating $configProtect
96
+ */
97
+ public function setConfig(Payone_Core_Model_Config_Protect_Creditrating $configProtect)
98
+ {
99
+ $this->config = $configProtect;
100
+ }
101
+
102
+ /**
103
+ * @return Payone_Core_Model_Config_Protect_Creditrating
104
+ */
105
+ public function getConfig()
106
+ {
107
+ return $this->config;
108
+ }
109
+ }
app/code/community/Payone/Core/Model/Observer/Abstract.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Observer_Abstract
34
+ {
35
+ /**
36
+ *
37
+ * @var Payone_Core_Model_Factory
38
+ */
39
+ protected $factory = null;
40
+ /** @var Payone_Core_Helper_Data */
41
+ protected $helper = null;
42
+ /** @var Payone_Core_Helper_Email */
43
+ protected $helperEmail = null;
44
+
45
+ /** @var Payone_Core_Helper_Config */
46
+ protected $helperConfig = null;
47
+
48
+ /**
49
+ *
50
+ * @return Payone_Core_Model_Factory
51
+ */
52
+ public function getFactory()
53
+ {
54
+ if ($this->factory === null) {
55
+ $this->factory = new Payone_Core_Model_Factory();
56
+ }
57
+ return $this->factory;
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @param Payone_Core_Model_Factory $factory
63
+ */
64
+ public function setFactory(Payone_Core_Model_Factory $factory)
65
+ {
66
+ $this->factory = $factory;
67
+ }
68
+
69
+ /**
70
+ * @return Payone_Core_Helper_Data
71
+ */
72
+ protected function helper()
73
+ {
74
+ if ($this->helper === null) {
75
+ $this->helper = $this->getFactory()->helper();
76
+ }
77
+ return $this->helper;
78
+ }
79
+
80
+ /**
81
+ * @return Payone_Core_Helper_Email
82
+ */
83
+ protected function helperEmail()
84
+ {
85
+ if ($this->helperEmail === null) {
86
+ $this->helperEmail = $this->getFactory()->helperEmail();
87
+ }
88
+ return $this->helperEmail;
89
+ }
90
+
91
+
92
+ /**
93
+ * @return Payone_Core_Helper_Config
94
+ */
95
+ protected function helperConfig()
96
+ {
97
+ if ($this->helperConfig === null) {
98
+ $this->helperConfig = $this->getFactory()->helperConfig();
99
+ }
100
+ return $this->helperConfig;
101
+ }
102
+ }
app/code/community/Payone/Core/Model/Observer/Checkout/Onepage.php ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_Checkout_Onepage extends Payone_Core_Model_Observer_Abstract
34
+ {
35
+ /**
36
+ * @var Varien_Object
37
+ */
38
+ protected $settings = null;
39
+
40
+ /** @var array */
41
+ protected $paymentData = array();
42
+
43
+ /** @var Mage_Sales_Model_Quote */
44
+ protected $quote = null;
45
+
46
+ /**
47
+ * @param Varien_Event_Observer $observer
48
+ * @return void
49
+ */
50
+ public function verifyPayment(Varien_Event_Observer $observer)
51
+ {
52
+ $this->init($observer);
53
+ /**
54
+ * @var $quote Mage_Sales_Model_Quote
55
+ */
56
+ $quote = $observer->getEvent()->getQuote();
57
+ /** @var $selectedMethod string */
58
+ $selectedMethod = $observer->getEvent()->getSelectedMethod();
59
+
60
+ if ($selectedMethod === 'payone_debit_payment') {
61
+ $this->performBankaccountCheck();
62
+ }
63
+
64
+ // Check creditrating config:
65
+ $configCreditrating = $this->helperConfig()->getConfigProtect($quote->getStoreId())->getCreditrating();
66
+ if (!$configCreditrating->getEnabled()
67
+ or !$configCreditrating->isIntegrationEventAfterPayment()
68
+ or !$configCreditrating->isEnabledForMethod($selectedMethod)
69
+ ) {
70
+ return;
71
+ }
72
+
73
+ $isCreditratingAllowed = $this->isCreditratingAllowed();
74
+ if ($configCreditrating->getAgreementEnabled() && $isCreditratingAllowed === false) {
75
+ return;
76
+ }
77
+
78
+ // Perform creditrating check:
79
+ $serviceCreditrating = $this->getFactory()->getServiceVerificationCreditrating($configCreditrating);
80
+ $allowedMethods = $serviceCreditrating->execute($quote);
81
+
82
+ if ($allowedMethods === true) {
83
+ $this->setSettingsHavetoFilterMethods(false);
84
+ return;
85
+ }
86
+
87
+ // Check if selectedMethod is allowed
88
+ if (!array_key_exists($selectedMethod, $allowedMethods)) {
89
+ // set Filter Methods to trigger Payment Methods Block generation
90
+ $this->setSettingsHavetoFilterMethods(true);
91
+ $this->getSettingsAllowedMethods()->addData($allowedMethods);
92
+ }
93
+ else {
94
+ // Selected Method is available no need to render Methods Block again
95
+ $this->setSettingsHavetoFilterMethods(false);
96
+ }
97
+
98
+ }
99
+
100
+ /**
101
+ * @return bool
102
+ */
103
+ protected function isCreditratingAllowed()
104
+ {
105
+ $paymentData = $this->getPaymentData();
106
+ if (!array_key_exists('payone_creditrating_agreement', $paymentData) ||
107
+ (array_key_exists('payone_creditrating_agreement', $paymentData) && $paymentData['payone_creditrating_agreement'] !== '1')
108
+ ) {
109
+ return false;
110
+ }
111
+ return true;
112
+ }
113
+
114
+ /**
115
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound|Mage_Core_Exception
116
+ */
117
+ protected function performBankaccountCheck()
118
+ {
119
+ $paymentData = $this->getPaymentData();
120
+ $quote = $this->getQuote();
121
+
122
+
123
+ // Determine if check must/can be performed:
124
+ if (!array_key_exists('payone_config_payment_method_id', $paymentData)) {
125
+ throw new Payone_Core_Exception_PaymentMethodConfigNotFound();
126
+ }
127
+ $paymentMethodConfigId = $paymentData['payone_config_payment_method_id'];
128
+ if (empty($paymentMethodConfigId)) {
129
+ throw new Payone_Core_Exception_PaymentMethodConfigNotFound();
130
+ }
131
+
132
+ $config = $this->helperConfig()->getConfigPaymentMethodById($paymentMethodConfigId, $quote->getStoreId());
133
+ if (!$config->isBankAccountCheckEnabled()) {
134
+ return; // Check disabled, abort.
135
+ }
136
+
137
+ // Gather data:
138
+ $bankAccountNumber = array_key_exists('payone_account_number', $paymentData) ? $paymentData['payone_account_number'] : '';
139
+ $bankCode = array_key_exists('payone_bank_code', $paymentData) ? $paymentData['payone_bank_code'] : '';
140
+ $bankCountry = $this->getQuote()->getBillingAddress()->getCountry();
141
+
142
+
143
+ // Perform check:
144
+ $serviceBankaccountCheck = $this->getFactory()
145
+ ->getServiceVerificationBankAccountCheck($paymentMethodConfigId, $this->getQuote()->getStoreId());
146
+ $serviceBankaccountCheck->execute($bankAccountNumber, $bankCode, $bankCountry);
147
+ }
148
+
149
+ /**
150
+ * @param int $value
151
+ */
152
+ protected function setSettingsHavetoFilterMethods($value)
153
+ {
154
+ $key = 'have_to_filter_methods';
155
+ $this->getSettings()->setData($key, $value);
156
+ }
157
+
158
+ /**
159
+ * @return Varien_Object
160
+ */
161
+ protected function getSettingsAllowedMethods()
162
+ {
163
+ return $this->getSettings()->getData('allowed_methods');
164
+ }
165
+
166
+ /**
167
+ * @param Varien_Object $value
168
+ * @return Varien_Object
169
+ */
170
+ protected function setSettingsAllowedMethods(Varien_Object $value)
171
+ {
172
+ return $this->getSettings()->setData('allowed_methods', $value);
173
+ }
174
+
175
+ /**
176
+ * @param Varien_Event_Observer $observer
177
+ */
178
+ protected function init(Varien_Event_Observer $observer)
179
+ {
180
+ $this->setSettings($observer->getEvent()->getSettings());
181
+ $this->setPaymentData($observer->getEvent()->getPaymentData());
182
+ $this->setQuote($observer->getEvent()->getQuote());
183
+ }
184
+
185
+ /**
186
+ * @param Varien_Object $settings
187
+ */
188
+ public function setSettings(Varien_Object $settings)
189
+ {
190
+ $this->settings = $settings;
191
+ }
192
+
193
+ /**
194
+ * @return Varien_Object
195
+ */
196
+ public function getSettings()
197
+ {
198
+ return $this->settings;
199
+ }
200
+
201
+ /**
202
+ * @param array $paymentData
203
+ */
204
+ public function setPaymentData(array $paymentData)
205
+ {
206
+ $this->paymentData = $paymentData;
207
+ }
208
+
209
+ /**
210
+ * @return array
211
+ */
212
+ public function getPaymentData()
213
+ {
214
+ return $this->paymentData;
215
+ }
216
+
217
+ /**
218
+ * @param Mage_Sales_Model_Quote $quote
219
+ */
220
+ public function setQuote(Mage_Sales_Model_Quote $quote)
221
+ {
222
+ $this->quote = $quote;
223
+ }
224
+
225
+ /**
226
+ * @return Mage_Sales_Model_Quote
227
+ */
228
+ public function getQuote()
229
+ {
230
+ return $this->quote;
231
+ }
232
+
233
+ }
app/code/community/Payone/Core/Model/Observer/Checkout/Onepage/Payment/Methods.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_Checkout_Onepage_Payment_Methods
34
+ extends Payone_Core_Model_Observer_Abstract
35
+ {
36
+ /**
37
+ * @var Varien_Object
38
+ */
39
+ protected $settings = null;
40
+
41
+ /**
42
+ * @param Varien_Event_Observer $observer
43
+ * @return void
44
+ */
45
+ public function getMethods(Varien_Event_Observer $observer)
46
+ {
47
+ $this->init($observer);
48
+ /**
49
+ * @var $quote Mage_Sales_Model_Quote
50
+ */
51
+ $quote = $observer->getEvent()->getQuote();
52
+
53
+ /** @var $fullActionName string */
54
+ $fullActionName = $observer->getEvent()->getFullActionName();
55
+ if ($fullActionName === 'checkout/onepage/index') {
56
+ return;
57
+ }
58
+
59
+ $config = $this->helperConfig()->getConfigProtect($quote->getStoreId())->getCreditrating();
60
+ if (!$config->getEnabled()) {
61
+ return;
62
+ }
63
+
64
+ // After Payment Select Checks will be run when action is verifyPayment
65
+ if ($config->isIntegrationEventAfterPayment()) {
66
+ // @comment we should never come into this observer using after_payment:
67
+ // methods are determined using onepage_verify_payment event
68
+ return;
69
+ }
70
+
71
+ if ($config->isIntegrationEventBeforePayment()) {
72
+ $service = $this->getFactory()->getServiceVerificationCreditrating($config);
73
+ $allowedMethods = $service->execute($quote);
74
+
75
+ // Check not necessary
76
+ if ($allowedMethods === true) {
77
+ $this->setSettingsHavetoFilterMethods(false);
78
+ return;
79
+ }
80
+
81
+ $this->setSettingsHavetoFilterMethods(true);
82
+ $this->getSettingsAllowedMethods()->addData($allowedMethods);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * @param int $value
88
+ */
89
+ protected function setSettingsHavetoFilterMethods($value)
90
+ {
91
+ $key = Payone_Core_Block_Checkout_Onepage_Payment_Methods::RESULT_HAVE_TO_FILTER_METHODS;
92
+ $this->getSettings()->setData($key, $value);
93
+ }
94
+
95
+ /**
96
+ * @return Varien_Object
97
+ */
98
+ protected function getSettingsAllowedMethods()
99
+ {
100
+ $key = Payone_Core_Block_Checkout_Onepage_Payment_Methods::RESULT_ALLOWED_METHODS;
101
+ return $this->getSettings()->getData($key);
102
+ }
103
+
104
+ /**
105
+ * @param Varien_Object $value
106
+ * @return Varien_Object
107
+ */
108
+ protected function setSettingsAllowedMethods(Varien_Object $value)
109
+ {
110
+ $key = Payone_Core_Block_Checkout_Onepage_Payment_Methods::RESULT_ALLOWED_METHODS;
111
+ return $this->getSettings()->setData($key, $value);
112
+ }
113
+
114
+ /**
115
+ * @param Varien_Event_Observer $observer
116
+ */
117
+ protected function init(Varien_Event_Observer $observer)
118
+ {
119
+ $this->setSettings($observer->getEvent()->getSettings());
120
+ }
121
+
122
+ /**
123
+ * @param Varien_Object $settings
124
+ */
125
+ public function setSettings(Varien_Object $settings)
126
+ {
127
+ $this->settings = $settings;
128
+ }
129
+
130
+ /**
131
+ * @return Varien_Object
132
+ */
133
+ public function getSettings()
134
+ {
135
+ return $this->settings;
136
+ }
137
+
138
+ }
app/code/community/Payone/Core/Model/Observer/Protocol/Api.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Christian Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_Protocol_Api
34
+ extends Payone_Core_Model_Observer_Abstract
35
+ {
36
+ /** @var Payone_Core_Model_Domain_Protocol_Api */
37
+ protected $protocolApi = null;
38
+
39
+ /**
40
+ * @param Varien_Event_Observer $observer
41
+ */
42
+ public function prepareApi(Varien_Event_Observer $observer)
43
+ {
44
+ $event = $observer->getEvent();
45
+ $this->protocolApi = $event->getObject();
46
+ }
47
+
48
+ /**
49
+ * @param Varien_Event_Observer $observer
50
+ */
51
+ public function updateApiData(Varien_Event_Observer $observer)
52
+ {
53
+ if ($this->protocolApi != null) {
54
+ /** @var $order Mage_Sales_Model_Order */
55
+ $order = $observer->getEvent()->getOrder();
56
+
57
+ $this->protocolApi->setStoreId($order->getStoreId());
58
+ $this->protocolApi->setOrderId($order->getId());
59
+ $this->protocolApi->save();
60
+ }
61
+ }
62
+ }
app/code/community/Payone/Core/Model/Observer/Sales/Order.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_Sales_Order
34
+ extends Payone_Core_Model_Observer_Abstract
35
+ {
36
+ /**
37
+ * @param Varien_Event_Observer $observer
38
+ * @return void
39
+ */
40
+ public function updateOrderGrid(Varien_Event_Observer $observer)
41
+ {
42
+ /**
43
+ * @var $resource Mage_Sales_Model_Mysql4_Order
44
+ */
45
+ $resource = $observer->getEvent()->getResource();
46
+
47
+ $resource->addVirtualGridColumn(
48
+ 'payone_payment_method',
49
+ 'order_payment',
50
+ array('entity_id' => 'parent_id'),
51
+ 'method'
52
+ );
53
+ }
54
+
55
+ /**
56
+ * @param Varien_Event_Observer $observer
57
+ * @return void
58
+ */
59
+ public function incrementSampleCounter(Varien_Event_Observer $observer)
60
+ {
61
+ $storeId = $observer->getEvent()->getOrder()->getStoreId();
62
+
63
+ $this->helperConfig()->incrementCreditratingSampleCounter($storeId);
64
+ }
65
+ }
app/code/community/Payone/Core/Model/Observer/Sales/Order/Invoice.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Christian Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_Sales_Order_Invoice
34
+ extends Payone_Core_Model_Observer_Abstract
35
+ {
36
+ /** @var Mage_Sales_Model_Order_Invoice */
37
+ protected $invoice = null;
38
+
39
+ /**
40
+ * @param Varien_Event_Observer $observer
41
+ */
42
+ public function prepareInvoice(Varien_Event_Observer $observer)
43
+ {
44
+ $event = $observer->getEvent();
45
+ $this->invoice = $event->getInvoice();
46
+ }
47
+
48
+ /**
49
+ * @param Varien_Event_Observer $observer
50
+ */
51
+ public function prepareSequencenumber(Varien_Event_Observer $observer)
52
+ {
53
+ $event = $observer->getEvent();
54
+ /** @var $request Payone_Api_Request_Capture */
55
+ $request = $event->getRequest();
56
+ $this->invoice->setPayoneSequencenumber($request->getSequencenumber());
57
+ }
58
+ }
app/code/community/Payone/Core/Model/Observer/Sales/Quote/Address.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_Sales_Quote_Address
34
+ extends Payone_Core_Model_Observer_Abstract
35
+ {
36
+ /**
37
+ * @param Varien_Event_Observer $observer
38
+ * @return void
39
+ */
40
+ public function validateAfter(Varien_Event_Observer $observer)
41
+ {
42
+ /** @var $quote Mage_Sales_Model_Quote */
43
+ /** @var $quoteAddress Payone_Core_Model_Sales_Quote_Address */
44
+ /** @var $errors Varien_Object */
45
+ $event = $observer->getEvent();
46
+ $quote = $event->getQuote();
47
+ $quoteAddress = $event->getQuoteAddress();
48
+ $errors = $event->getErrors();
49
+
50
+ $fullActionName = $event->getFullActionName();
51
+
52
+ if ($this->isEnabledForAction($fullActionName)) {
53
+ $config = $this->helperConfig()->getConfigProtect($quote->getStoreId())->getAddressCheck();
54
+ if (!$config->getEnabled()) {
55
+ return;
56
+ }
57
+
58
+
59
+ $addressType = $quoteAddress->getAddressType();
60
+ if (($addressType === 'billing' and $config->mustCheckBilling())
61
+ or ($addressType === 'shipping' and $config->mustCheckShipping()))
62
+ {
63
+ // Config says we must perform an addresscheck:
64
+ $service = $this->getFactory()->getServiceVerificationAddressCheck($config);
65
+
66
+ $service->execute($quoteAddress, $errors);
67
+ }
68
+ }
69
+ }
70
+
71
+ /**
72
+ * @param $fullActionName
73
+ * @return bool
74
+ */
75
+ protected function isEnabledForAction($fullActionName)
76
+ {
77
+ return in_array($fullActionName, $this->getEnabledActions());
78
+ }
79
+
80
+ /**
81
+ * @return array
82
+ */
83
+ protected function getEnabledActions()
84
+ {
85
+ $actions = array(
86
+ 'checkout/onepage/saveBilling',
87
+ 'checkout/onepage/saveShipping',
88
+ );
89
+ return $actions;
90
+ }
91
+ }
app/code/community/Payone/Core/Model/Observer/Sales/Quote/Payment.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_Sales_Quote_Payment
34
+ extends Payone_Core_Model_Observer_Abstract
35
+ {
36
+ /**
37
+ * Sets 'payone_config_payment_method_id' to payment.
38
+ * This is required because collectTotals() runs _before_ the payment data gets assigned to the payment object.
39
+ * (Checkout -> savePayment)
40
+ *
41
+ * @param Varien_Event_Observer $observer
42
+ * @return void
43
+ */
44
+ public function importDataBefore(Varien_Event_Observer $observer)
45
+ {
46
+ /** @var $payment Mage_Sales_Model_Quote_Payment */
47
+ /** @var $input Varien_Object */
48
+ /** @var $event Varien_Event */
49
+ $event = $observer->getEvent();
50
+ $payment = $event->getPayment();
51
+ $data = $event->getData();
52
+ $input = $data['input'];
53
+
54
+ $configId = $input->getPayoneConfigPaymentMethodId();
55
+
56
+ if (!empty($configId)) {
57
+ $payment->setPayoneConfigPaymentMethodId($configId);
58
+ }
59
+
60
+ }
61
+ }
app/code/community/Payone/Core/Model/Observer/TransactionStatus/Forwarding.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_TransactionStatus_Forwarding extends Payone_Core_Model_Observer_Abstract
34
+ {
35
+ /**
36
+ * @var Payone_Core_Model_Service_TransactionStatus_Forward
37
+ */
38
+ protected $serviceForwarding = null;
39
+
40
+ /**
41
+ * @param Varien_Event_Observer $observer
42
+ */
43
+ public function onAll(Varien_Event_Observer $observer)
44
+ {
45
+ $event = $observer->getEvent();
46
+ /**
47
+ * @var $config Payone_Core_Model_Config_Interface
48
+ */
49
+ $config = $event->getConfig();
50
+ /**
51
+ * @var $transactionStatus Payone_Core_Model_Domain_Protocol_TransactionStatus
52
+ */
53
+ $transactionStatus = $event->getTransactionStatus();
54
+
55
+ $configForwarding = $config->getMisc()->getTransactionstatusForwarding();
56
+
57
+ if (!$configForwarding->isActive()) {
58
+ return;
59
+ }
60
+
61
+ $currentTxAction = $transactionStatus->getTxaction();
62
+ if (!$configForwarding->canForwardTxAction($currentTxAction)) {
63
+ return;
64
+ }
65
+
66
+ $this->getServiceForwarding()->setConfigForwarding($configForwarding);
67
+ $success = $this->getServiceForwarding()->forward($transactionStatus);
68
+
69
+ if(!$success){
70
+ $exceptions = $this->getServiceForwarding()->getExceptions();
71
+
72
+ $msg = '';
73
+ foreach ($exceptions as $url => $e) {
74
+ /**
75
+ * @var $e Exception
76
+ */
77
+ $msg .= $url .': '.get_class($e).' > '.$e->getMessage();
78
+ }
79
+
80
+ $helperEmail = $this->helperEmail();
81
+ $helperEmail->setStoreId($config->getStoreId());
82
+ $helperEmail->sendEmailError(
83
+ 'TransactionStatus Forwarding',
84
+ $msg,
85
+ __METHOD__
86
+ );
87
+ }
88
+ }
89
+
90
+ /**
91
+ * @param Payone_Core_Model_Service_TransactionStatus_Forward $service
92
+ */
93
+ public function setServiceForwarding(Payone_Core_Model_Service_TransactionStatus_Forward $service)
94
+ {
95
+ $this->serviceForwarding = $service;
96
+ }
97
+
98
+ /**
99
+ * @return Payone_Core_Model_Service_TransactionStatus_Forward
100
+ */
101
+ public function getServiceForwarding()
102
+ {
103
+ if($this->serviceForwarding === null){
104
+ $this->serviceForwarding = $this->getFactory()->getServiceTransactionStatusForward();
105
+ }
106
+ return $this->serviceForwarding;
107
+ }
108
+
109
+ }
app/code/community/Payone/Core/Model/Observer/TransactionStatus/InvoiceCreate.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Observer
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Observer
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Observer_TransactionStatus_InvoiceCreate
34
+ extends Payone_Core_Model_Observer_Abstract
35
+ {
36
+ /**
37
+ * @var Payone_Core_Model_Service_Sales_InvoiceCreate
38
+ */
39
+ protected $serviceInvoiceCreate = null;
40
+
41
+ /** @var $method Payone_Core_Model_Payment_Method_Abstract */
42
+ private $method = null;
43
+
44
+ /** @var $order Mage_Sales_Model_Order */
45
+ private $order = null;
46
+
47
+ /** @var $config Payone_Core_Model_Config */
48
+ private $config = null;
49
+
50
+ /** @var $payment Mage_Sales_Model_Order_Payment */
51
+ private $payment = null;
52
+
53
+ /** @var $transactionStatus Payone_Core_Model_Domain_Protocol_TransactionStatus */
54
+ private $transactionStatus = null;
55
+
56
+ /**
57
+ * @param Varien_Event_Observer $observer
58
+ */
59
+ public function onAppointed(Varien_Event_Observer $observer)
60
+ {
61
+ $this->initData($observer);
62
+
63
+ $configMethod = $this->getConfigPaymentMethodById();
64
+ // All Other PaymentMethods create Invoice if request-type is authorization
65
+ if ($configMethod->isRequestAuthorization()) {
66
+ if (!$this->method instanceof Payone_Core_Model_Payment_Method_AdvancePayment) {
67
+ // Create Invoice
68
+ $invoice = $this->getServiceInvoiceCreate()->createByOrder($this->order);
69
+
70
+ $this->sendInvoiceEmail($invoice);
71
+ }
72
+ // Advance Payment: invoice is created on Transaction Paid
73
+ }
74
+ }
75
+
76
+ /**
77
+ * @param Varien_Event_Observer $observer
78
+ */
79
+ public function onPaid(Varien_Event_Observer $observer)
80
+ {
81
+ $this->initData($observer);
82
+
83
+ $configMethod = $this->getConfigPaymentMethodById();
84
+ // Advance Payment create Invoice if request-type is authorization
85
+ if ($configMethod->isRequestAuthorization()) {
86
+ if ($this->method instanceof Payone_Core_Model_Payment_Method_AdvancePayment) {
87
+ // Create Invoice
88
+ $invoice = $this->getServiceInvoiceCreate()->createByOrder($this->order);
89
+ $invoice->pay();
90
+ $this->sendInvoiceEmail($invoice);
91
+ }
92
+ else {
93
+ // Load Invoice which has been created in 'onAppointed'
94
+ $invoice = $this->getInvoiceForOrder();
95
+ if ($invoice) {
96
+ $invoice->pay();
97
+ $invoice->save();
98
+ }
99
+ }
100
+ }
101
+ // All Other PaymentMethods already have an invoice
102
+ }
103
+
104
+ /**
105
+ * @param Varien_Event_Observer $observer
106
+ */
107
+ protected function initData(Varien_Event_Observer $observer)
108
+ {
109
+ $event = $observer->getEvent();
110
+
111
+ /** @var $transactionStatus Payone_Core_Model_Domain_Protocol_TransactionStatus */
112
+ $this->transactionStatus = $event->getTransactionStatus();
113
+
114
+ $order = $this->getOrderByTransactionStatus($this->transactionStatus);
115
+ $payment = $order->getPayment();
116
+ $this->method = $payment->getMethodInstance();
117
+ /** @var $method Payone_Core_Model_Payment_Method_Abstract */
118
+ $this->method = $payment->getMethodInstance();
119
+ $this->order = $order;
120
+ $this->config = $event->getConfig();
121
+ $this->payment = $payment;
122
+ }
123
+
124
+ /**
125
+ * @param Mage_Sales_Model_Order_Invoice $invoice
126
+ */
127
+ protected function sendInvoiceEmail(Mage_Sales_Model_Order_Invoice $invoice)
128
+ {
129
+ $invoice->setEmailSent(true);
130
+ $invoice->sendEmail();
131
+ $invoice->save();
132
+ }
133
+
134
+ /**
135
+ * @param Payone_Core_Model_Service_Sales_InvoiceCreate $service
136
+ */
137
+ public function setServiceInvoiceCreate(Payone_Core_Model_Service_Sales_InvoiceCreate $service)
138
+ {
139
+ $this->serviceInvoiceCreate = $service;
140
+ }
141
+
142
+ /**
143
+ * @return Payone_Core_Model_Service_Sales_InvoiceCreate
144
+ */
145
+ public function getServiceInvoiceCreate()
146
+ {
147
+ if ($this->serviceInvoiceCreate === null) {
148
+ $this->serviceInvoiceCreate = $this->getFactory()->getServiceSalesInvoiceCreate();
149
+ }
150
+ return $this->serviceInvoiceCreate;
151
+ }
152
+
153
+ /**
154
+ * @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
155
+ * @return Mage_Sales_Model_Order
156
+ */
157
+ protected function getOrderByTransactionStatus(Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
158
+ {
159
+ $order = $this->getFactory()->getModelSalesOrder();
160
+ $order->load($transactionStatus->getOrderId());
161
+ return $order;
162
+ }
163
+
164
+ /**
165
+ * @return bool|Payone_Core_Model_Config_Payment_Method_Interface
166
+ */
167
+ protected function getConfigPaymentMethodById()
168
+ {
169
+ $id = $this->payment->getPayoneConfigPaymentMethodId();
170
+ $configPaymentMethod = $this->config->getPayment()->getMethodById($id);
171
+ return $configPaymentMethod;
172
+ }
173
+
174
+ /**
175
+ * @return Mage_Sales_Model_Order_Invoice
176
+ */
177
+ protected function getInvoiceForOrder()
178
+ {
179
+ /** @var $invoiceCollection Mage_Sales_Model_Mysql4_Order_Invoice_Collection */
180
+ $invoiceCollection = $this->order->getInvoiceCollection();
181
+ $invoiceCollection->addFieldToFilter('payone_sequencenumber', $this->transactionStatus->getSequencenumber());
182
+ $invoice = $invoiceCollection->getFirstItem();
183
+ return $invoice;
184
+ }
185
+
186
+ }
app/code/community/Payone/Core/Model/Observer/TransactionStatus/Reminder.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model_Service_Abstract
17
+ * @subpackage Response
18
+ * @copyright Copyright (c) 2012 <info@payone.de> - www.noovias.com
19
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
+ * @link http://www.noovias.com
21
+ */
22
+
23
+ /**
24
+ *
25
+ * @category Payone
26
+ * @package Payone_Core_Model_Service_Abstract
27
+ * @subpackage Response
28
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
29
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
30
+ * @link http://www.noovias.com
31
+ *
32
+ */
33
+ class Payone_Core_Model_Observer_TransactionStatus_Reminder extends Payone_Core_Model_Observer_Abstract
34
+ {
35
+ /**
36
+ * @param Varien_Event_Observer $observer
37
+ */
38
+ public function onReminder(Varien_Event_Observer $observer)
39
+ {
40
+ $event = $observer->getEvent();
41
+
42
+ /**
43
+ * @var $transactionStatus Payone_Core_Model_Domain_Protocol_TransactionStatus
44
+ */
45
+ $transactionStatus = $event->getTransactionStatus();
46
+
47
+ $order = $this->getFactory()->getModelSalesOrder();
48
+ $order->load($transactionStatus->getOrderId());
49
+
50
+ $order->setPayoneDunningStatus($transactionStatus->getReminderlevel());
51
+ $order->save();
52
+ }
53
+ }
app/code/community/Payone/Core/Model/Payment/Method/Abstract.php ADDED
@@ -0,0 +1,401 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Payment_Method_Abstract
34
+ extends Mage_Payment_Model_Method_Abstract
35
+ {
36
+ protected $_code = 'payone_abstract';
37
+
38
+ protected $_isGateway = false;
39
+ protected $_canAuthorize = false;
40
+ protected $_canCapture = true;
41
+ protected $_canCapturePartial = true;
42
+ protected $_canRefund = true;
43
+ protected $_canRefundInvoicePartial = true;
44
+ protected $_canVoid = false;
45
+ protected $_canUseInternal = true;
46
+ protected $_canUseCheckout = true;
47
+ protected $_canUseForMultishipping = false;
48
+ protected $_isInitializeNeeded = true;
49
+
50
+ /** @var Payone_Core_Model_Factory */
51
+ protected $factory = null;
52
+
53
+ protected $methodType = '';
54
+ protected $redirectUrl = '';
55
+
56
+ /**
57
+ * @var Payone_Core_Model_Config_Interface
58
+ */
59
+ protected $configStore = null;
60
+ /**
61
+ * @var Payone_Core_Model_Config_Payment_Method_Interface
62
+ */
63
+ protected $config = null;
64
+
65
+ /**
66
+ * @param Mage_Sales_Model_Quote $quote
67
+ * @return bool
68
+ */
69
+ public function isAvailable($quote = null)
70
+ {
71
+ if ($quote === null) {
72
+ $configPayment = $this->getConfigPayment(null);
73
+ return $configPayment->isAvailable($this->getMethodType());
74
+ }
75
+ $configPayment = $this->helperConfig()->getConfigPaymentByQuote($quote);
76
+ return $configPayment->isAvailable($this->getMethodType(), $quote);
77
+ }
78
+
79
+ /**
80
+ * To check billing country is allowed for the payment method
81
+ * Is used during Magento Onepage Checkout
82
+ *
83
+ * @override
84
+ *
85
+ * @param string $country
86
+ * @return bool
87
+ */
88
+ public function canUseForCountry($country)
89
+ {
90
+ $paymentInfo = $this->getData('info_instance');
91
+
92
+ if (!($paymentInfo instanceof Mage_Payment_Model_Info)) {
93
+ /**
94
+ * @important !! store can be either an int or Mage_Core_Model_Store !!
95
+ * @comment Config should be initialized before by calling isAvailable
96
+ * @comment but to be sure the right config is loaded we detect it again
97
+ */
98
+ $store = $this->getData('store');
99
+ $storeId = ($store instanceof Mage_Core_Model_Store) ? $store->getId() : $store;
100
+ }
101
+ elseif ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
102
+ $storeId = $paymentInfo->getOrder()->getStoreId();
103
+ }
104
+ elseif ($paymentInfo instanceof Mage_Sales_Model_Quote_Payment) {
105
+ $storeId = $paymentInfo->getQuote()->getStoreId();
106
+ }
107
+ else {
108
+ $storeId = null;
109
+ }
110
+
111
+ $configPayment = $this->getConfigPayment($storeId);
112
+ $canUse = $configPayment->canUseForCountry($this->getMethodType(), $country);
113
+ return $canUse;
114
+ }
115
+
116
+ /**
117
+ * Called before initalize to determine action needed
118
+ *
119
+ * @return string
120
+ */
121
+ public function getConfigPaymentAction()
122
+ {
123
+ /** @var $order Mage_Sales_Model_Order */
124
+ $order = $this->getInfoInstance()->getOrder();
125
+ $config = $this->helperConfig()->getConfigPaymentMethodByOrder($order);
126
+ return $config->getRequestType();
127
+ }
128
+
129
+ /**
130
+ * @param string $paymentAction
131
+ * @param Varien_Object $stateObject
132
+ * @return Payone_Core_Model_Payment_Method_Abstract
133
+ *
134
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
135
+ */
136
+ public function initialize($paymentAction, $stateObject)
137
+ {
138
+ /** @var $payment Mage_Sales_Model_Order_Payment */
139
+ $payment = $this->getInfoInstance();
140
+
141
+ /** @var $order Mage_Sales_Model_Order */
142
+ $order = $payment->getOrder();
143
+ $configPayment = $this->getConfigByOrder($order);
144
+
145
+ // Execute Payment Initialization
146
+ $service = $this->getFactory()->getServiceInitializePayment($configPayment);
147
+ $service->setConfigStore($this->getConfigStore($order->getStoreId()));
148
+ $response = $service->execute($payment);
149
+
150
+ // @comment by default state=new and status=pending
151
+ if ($this->getRedirectUrl() != '') {
152
+ $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
153
+ $this->setRedirectToQuotePaymentMethod();
154
+ }
155
+ return $this;
156
+ }
157
+
158
+ /**
159
+ * Tells Magento Checkout where to redirect after checkout.
160
+ * @note: Onepage checkout retrieves it´s redirect url from the quote, NOT from order.
161
+ *
162
+ * @see Mage_Checkout_Model_Type_Onepage::saveOrder()
163
+ *
164
+ */
165
+ protected function setRedirectToQuotePaymentMethod()
166
+ {
167
+ /** @var $quote Mage_Sales_Model_Quote */
168
+ $quote = $this->getInfoInstance()->getOrder()->getQuote();
169
+ if (!($quote instanceof Mage_Sales_Model_Quote)) {
170
+ // In case quote is not on info instance, workaround:
171
+ // Onepage checkout retrieves its payment method instance from session.
172
+ $quote = $this->getFactory()->getSingletonCheckoutSession()->getQuote();
173
+ }
174
+
175
+ /** @var $paymentMethodInstance Payone_Core_Model_Payment_Method_Abstract */
176
+ $paymentMethodInstance = $quote->getPayment()->getMethodInstance();
177
+ // Yes, this is an object of the same type as $this, unfortunately, there are two instances during a Magento checkout
178
+ $paymentMethodInstance->setRedirectUrl($this->getRedirectUrl());
179
+ }
180
+
181
+ public function capture(Varien_Object $payment, $amount)
182
+ {
183
+ /** @var $payment Mage_Sales_Model_Order_Payment */
184
+ if ($this->canCapture()) {
185
+ /** @var $order Mage_Sales_Model_Order */
186
+ $order = $payment->getOrder();
187
+ $config = $this->getConfigByOrder($order);
188
+ $service = $this->getFactory()->getServicePaymentCapture($config);
189
+ $service->setConfigStore($this->getConfigStore($order->getStoreId()));
190
+ $service->execute($payment, $amount);
191
+ }
192
+ return $this;
193
+ }
194
+
195
+ public function refund(Varien_Object $payment, $amount)
196
+ {
197
+ /** @var $payment Mage_Sales_Model_Order_Payment */
198
+ if ($this->canRefund()) {
199
+ /** @var $order Mage_Sales_Model_Order */
200
+ $order = $payment->getOrder();
201
+ $config = $this->getConfigByOrder($order);
202
+ $service = $this->getFactory()->getServicePaymentDebit($config);
203
+ $service->setConfigStore($this->getConfigStore($order->getStoreId()));
204
+ $service->execute($payment, $amount);
205
+ }
206
+ return $this;
207
+ }
208
+
209
+ /**
210
+ * @param Payone_Core_Model_Config_Interface $config
211
+ */
212
+ public function setConfigStore(Payone_Core_Model_Config_Interface $config)
213
+ {
214
+ $this->configStore = $config;
215
+ }
216
+
217
+ /**
218
+ * @param string $storeId
219
+ * @return Payone_Core_Model_Config_Interface
220
+ */
221
+ public function getConfigStore($storeId = null)
222
+ {
223
+ if ($this->configStore === null) {
224
+ $this->initConfigStore($storeId);
225
+ }
226
+ return $this->configStore;
227
+ }
228
+
229
+ /**
230
+ * @param int $storeId
231
+ */
232
+ protected function initConfigStore($storeId = null)
233
+ {
234
+ $this->configStore = $this->helperConfig()->getConfigStore($storeId);
235
+ }
236
+
237
+ /**
238
+ * @param null $storeId
239
+ * @return Payone_Core_Model_Config_Payment
240
+ */
241
+ public function getConfigPayment($storeId = null)
242
+ {
243
+ return $this->helperConfig()->getConfigPayment($storeId);
244
+ }
245
+
246
+ /**
247
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
248
+ */
249
+ public function getConfig()
250
+ {
251
+ return $this->config;
252
+ }
253
+
254
+ /**
255
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $config
256
+ */
257
+ public function setConfig(Payone_Core_Model_Config_Payment_Method_Interface $config)
258
+ {
259
+ $this->config = $config;
260
+ }
261
+
262
+ /**
263
+ * Get a payment configuration that is applicable for the order
264
+ *
265
+ * @param Mage_Sales_Model_Order $order
266
+ * @return null|Payone_Core_Model_Config_Payment_Method_Interface
267
+ */
268
+ public function getConfigByOrder(Mage_Sales_Model_Order $order = null)
269
+ {
270
+ if (is_null($this->config)) {
271
+ if (is_null($order)) {
272
+ $order = $this->getInfoInstance()->getOrder();
273
+ }
274
+ $this->config = $this->helperConfig()->getConfigPaymentMethodByOrder($order);
275
+ }
276
+ return $this->config;
277
+ }
278
+
279
+ /**
280
+ * Get a payment configuration that is applicable for the quote
281
+ *
282
+ * @param Mage_Sales_Model_Quote $quote is need to get various values like order_total
283
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
284
+ * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
285
+ */
286
+ public function getConfigForQuote(Mage_Sales_Model_Quote $quote = null)
287
+ {
288
+ if (is_null($this->config)) {
289
+ if (is_null($quote)) {
290
+ /** @var $session Mage_Checkout_Model_Session */
291
+ $session = Mage::getSingleton('checkout/session');
292
+ $quote = $session->getQuote();
293
+ }
294
+ if (is_null($quote)) {
295
+ $quote = $this->getInfoInstance()->getQuote();
296
+ }
297
+ $this->config = $this->helperConfig()->getConfigPaymentMethodForQuote($this->getMethodType(), $quote);
298
+ }
299
+ return $this->config;
300
+ }
301
+
302
+ /**
303
+ * @param string $field
304
+ * @param int $storeId
305
+ * @return mixed
306
+ */
307
+ public function getConfigData($field, $storeId = null)
308
+ {
309
+ if ($field == 'sort_order') {
310
+ try {
311
+ $data = $this->getConfigForQuote()->getSortOrder();
312
+ } catch (Payone_Core_Exception_PaymentMethodConfigNotFound $e) {
313
+ return 0;
314
+ }
315
+ }
316
+ else {
317
+ $data = parent::getConfigData($field, $storeId);
318
+ }
319
+ return $data;
320
+ }
321
+
322
+ /**
323
+ * This is called during Mage_Checkout_Model_Type_Onepage::saveOrder()
324
+ *
325
+ * @return string
326
+ */
327
+ public function getOrderPlaceRedirectUrl()
328
+ {
329
+ return $this->redirectUrl;
330
+ }
331
+
332
+ /**
333
+ * @return string
334
+ */
335
+ public function getRedirectUrl()
336
+ {
337
+ return $this->redirectUrl;
338
+ }
339
+
340
+ /**
341
+ * @note Getter is
342
+ * @param $redirectUrl
343
+ */
344
+ public function setRedirectUrl($redirectUrl)
345
+ {
346
+ $this->redirectUrl = $redirectUrl;
347
+ }
348
+
349
+ /**
350
+ * @return Payone_Core_Helper_Data
351
+ */
352
+ protected function helper()
353
+ {
354
+ return $this->getFactory()->helper();
355
+ }
356
+
357
+ /**
358
+ * @return Payone_Core_Helper_Config
359
+ */
360
+ protected function helperConfig()
361
+ {
362
+ return $this->getFactory()->helperConfig();
363
+ }
364
+
365
+
366
+ /**
367
+ * @param Payone_Core_Model_Factory $factory
368
+ */
369
+ public function setFactory(Payone_Core_Model_Factory $factory)
370
+ {
371
+ $this->factory = $factory;
372
+ }
373
+
374
+ /**
375
+ * @return Payone_Core_Model_Factory
376
+ */
377
+ public function getFactory()
378
+ {
379
+ if ($this->factory === null) {
380
+ $this->factory = Mage::getModel('payone_core/factory');
381
+ }
382
+ return $this->factory;
383
+ }
384
+
385
+ /**
386
+ * @param string $methodType
387
+ */
388
+ public function setMethodType($methodType)
389
+ {
390
+ $this->methodType = $methodType;
391
+ }
392
+
393
+ /**
394
+ * @return string
395
+ */
396
+ public function getMethodType()
397
+ {
398
+ return $this->methodType;
399
+ }
400
+
401
+ }
app/code/community/Payone/Core/Model/Payment/Method/AdvancePayment.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Payment_Method_AdvancePayment extends Payone_Core_Model_Payment_Method_Abstract
34
+ {
35
+ protected $_canUseForMultishipping = true;
36
+
37
+ protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::ADVANCEPAYMENT;
38
+
39
+ protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::ADVANCEPAYMENT;
40
+
41
+ protected $_formBlockType = 'payone_core/payment_method_form_advancePayment';
42
+ protected $_infoBlockType = 'payone_core/payment_method_info_advancePayment';
43
+
44
+ }
app/code/community/Payone/Core/Model/Payment/Method/CashOnDelivery.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Payment_Method_CashOnDelivery extends Payone_Core_Model_Payment_Method_Abstract
34
+ {
35
+ protected $_canUseForMultishipping = true;
36
+
37
+ protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::CASHONDELIVERY;
38
+
39
+ protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::CASHONDELIVERY;
40
+
41
+ protected $_formBlockType = 'payone_core/payment_method_form_cashOnDelivery';
42
+ protected $_infoBlockType = 'payone_core/payment_method_info_cashOnDelivery';
43
+
44
+ }
app/code/community/Payone/Core/Model/Payment/Method/Creditcard.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Payment_Method_Creditcard extends Payone_Core_Model_Payment_Method_Abstract
34
+ {
35
+ protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::CREDITCARD;
36
+
37
+ protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::CREDITCARD;
38
+
39
+ protected $_formBlockType = 'payone_core/payment_method_form_creditcard';
40
+ protected $_infoBlockType = 'payone_core/payment_method_info_creditcard';
41
+ protected $_canSaveCc = true;
42
+
43
+ /** @var Payone_Core_Model_Config_Payment_Method_Interface[] */
44
+ protected $matchingConfigs = array();
45
+
46
+ /**
47
+ * @api
48
+ *
49
+ * To be used in Form_Block, which has to display all creditcard types
50
+ *
51
+ * @param Mage_Sales_Model_Quote $quote
52
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
53
+ */
54
+ public function getAllConfigsByQuote(Mage_Sales_Model_Quote $quote)
55
+ {
56
+ if (empty($this->matchingConfigs)) {
57
+ $configStore = $this->getConfigStore($quote->getStoreId());
58
+
59
+ $this->matchingConfigs = $configStore->getPayment()->getMethodsForQuote($this->methodType ,$quote);
60
+ }
61
+ return $this->matchingConfigs;
62
+ }
63
+
64
+ }
app/code/community/Payone/Core/Model/Payment/Method/DebitPayment.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Payment_Method_DebitPayment extends Payone_Core_Model_Payment_Method_Abstract
34
+ {
35
+ protected $_canUseForMultishipping = true;
36
+
37
+ protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::DEBITPAYMENT;
38
+
39
+ protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::DEBITPAYMENT;
40
+
41
+ protected $_formBlockType = 'payone_core/payment_method_form_debitPayment';
42
+ protected $_infoBlockType = 'payone_core/payment_method_info_debitPayment';
43
+
44
+ }
app/code/community/Payone/Core/Model/Payment/Method/Invoice.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Payment_Method_Invoice extends Payone_Core_Model_Payment_Method_Abstract
34
+ {
35
+ protected $_canUseForMultishipping = true;
36
+
37
+ protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::INVOICE;
38
+
39
+ protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::INVOICE;
40
+
41
+ protected $_formBlockType = 'payone_core/payment_method_form_invoice';
42
+ protected $_infoBlockType = 'payone_core/payment_method_info_invoice';
43
+
44
+ }
app/code/community/Payone/Core/Model/Payment/Method/OnlineBankTransfer.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Payment_Method_OnlineBankTransfer
34
+ extends Payone_Core_Model_Payment_Method_Abstract
35
+ {
36
+ protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::ONLINEBANKTRANSFER;
37
+
38
+ protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::ONLINEBANKTRANSFER;
39
+
40
+ protected $_formBlockType = 'payone_core/payment_method_form_onlineBankTransfer';
41
+ protected $_infoBlockType = 'payone_core/payment_method_info_onlineBankTransfer';
42
+
43
+ /** @var Payone_Core_Model_Config_Payment_Method_Interface[] */
44
+ protected $matchingConfigs = array();
45
+
46
+ protected $_canUseInternal = false;
47
+
48
+ /**
49
+ * @api
50
+ *
51
+ * To be used in Form_Block, which has to display all online bank transfer types
52
+ *
53
+ * @param Mage_Sales_Model_Quote $quote
54
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
55
+ */
56
+ public function getAllConfigsByQuote(Mage_Sales_Model_Quote $quote)
57
+ {
58
+ if (empty($this->matchingConfigs)) {
59
+ $configStore = $this->getConfigStore($quote->getStoreId());
60
+
61
+ $this->matchingConfigs = $configStore->getPayment()->getMethodsForQuote($this->methodType ,$quote);
62
+ }
63
+ return $this->matchingConfigs;
64
+ }
65
+ }
app/code/community/Payone/Core/Model/Payment/Method/Wallet.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Payment
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Payment
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Payment_Method_Wallet extends Payone_Core_Model_Payment_Method_Abstract
34
+ {
35
+ protected $methodType = Payone_Core_Model_System_Config_PaymentMethodType::WALLET;
36
+
37
+ protected $_code = Payone_Core_Model_System_Config_PaymentMethodCode::WALLET;
38
+
39
+ protected $_formBlockType = 'payone_core/payment_method_form_wallet';
40
+ protected $_infoBlockType = 'payone_core/payment_method_info_wallet';
41
+
42
+ /** @var Payone_Core_Model_Config_Payment_Method_Interface[] */
43
+ protected $matchingConfigs = array();
44
+
45
+ protected $_canUseInternal = false;
46
+
47
+ /**
48
+ * @api
49
+ *
50
+ * To be used in Form_Block, which has to display all wallet types
51
+ *
52
+ * @param Mage_Sales_Model_Quote $quote
53
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
54
+ */
55
+ public function getAllConfigsByQuote(Mage_Sales_Model_Quote $quote)
56
+ {
57
+ if (empty($this->matchingConfigs)) {
58
+ $configStore = $this->getConfigStore($quote->getStoreId());
59
+
60
+ $this->matchingConfigs = $configStore->getPayment()->getMethodsForQuote($this->methodType ,$quote);
61
+ }
62
+ return $this->matchingConfigs;
63
+ }
64
+ }
app/code/community/Payone/Core/Model/Repository/Api.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Repository
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Repository
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Repository_Api
34
+ implements Payone_Api_Persistence_Interface
35
+ {
36
+ /** @var Payone_Core_Model_Factory */
37
+ protected $factory = null;
38
+
39
+ /** @var Payone_Core_Helper_Data */
40
+ protected $helper = null;
41
+
42
+ const KEY = 'p1_magento_api';
43
+
44
+ /**
45
+ * @return string
46
+ */
47
+ public function getKey()
48
+ {
49
+ return self::KEY;
50
+ }
51
+
52
+ /**
53
+ * @param Payone_Api_Request_Interface $request
54
+ * @param Payone_Api_Response_Interface $response
55
+ * @return boolean
56
+ */
57
+ public function save(
58
+ Payone_Api_Request_Interface $request,
59
+ Payone_Api_Response_Interface $response)
60
+ {
61
+ $domainObject = $this->getFactory()->getModelApi();
62
+ $domainObject->setData($request->toArray());
63
+ $domainObject->setRawRequest($request->__toString());
64
+ $domainObject->setRawResponse($response->__toString());
65
+ $domainObject->setResponse($response->getStatus());
66
+ $domainObject->save();
67
+ }
68
+
69
+ /**
70
+ * @param Payone_Api_Request_Interface $request
71
+ * @param Exception
72
+ * @return boolean
73
+ */
74
+ public function saveException(Payone_Api_Request_Interface $request, Exception $ex)
75
+ {
76
+ $domainObject = $this->getFactory()->getModelApi();
77
+ $domainObject->setData($request->toArray());
78
+ $domainObject->setRawRequest($request->__toString());
79
+ $domainObject->setStacktrace($ex->getTraceAsString());
80
+ $domainObject->setResponse(Payone_Core_Model_System_Config_ResponseType::EXCEPTION);
81
+ $domainObject->save();
82
+ }
83
+
84
+ /**
85
+ * @return Payone_Core_Helper_Data
86
+ */
87
+ protected function helper()
88
+ {
89
+ if ($this->helper === null) {
90
+ $this->helper = Mage::helper('payone_core');
91
+ }
92
+ return $this->helper;
93
+ }
94
+
95
+ /**
96
+ * @param Payone_Core_Helper_Data $helper
97
+ */
98
+ public function setHelper(Payone_Core_Helper_Data $helper)
99
+ {
100
+ $this->helper = $helper;
101
+ }
102
+
103
+ /**
104
+ * @param Payone_Core_Model_Factory $factory
105
+ */
106
+ public function setFactory(Payone_Core_Model_Factory $factory)
107
+ {
108
+ $this->factory = $factory;
109
+ }
110
+
111
+ /**
112
+ * @return Payone_Core_Model_Factory
113
+ */
114
+ public function getFactory()
115
+ {
116
+ if ($this->factory === null) {
117
+ $this->factory = new Payone_Core_Model_Factory();
118
+ }
119
+ return $this->factory;
120
+ }
121
+
122
+ }
app/code/community/Payone/Core/Model/Repository/TransactionStatus.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Repository
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Repository
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Repository_TransactionStatus
34
+ implements Payone_TransactionStatus_Persistence_Interface
35
+ {
36
+ /** @var Payone_Core_Model_Factory */
37
+ protected $factory = null;
38
+
39
+ const KEY = 'p1_magento_ts';
40
+
41
+ /**
42
+ * @return string
43
+ */
44
+ public function getKey()
45
+ {
46
+ return self::KEY;
47
+ }
48
+
49
+ /**
50
+ * @param Payone_TransactionStatus_Request_Interface $request
51
+ * @param Payone_TransactionStatus_Response_Interface $response
52
+ * @return boolean
53
+ */
54
+ public function save(
55
+ Payone_TransactionStatus_Request_Interface $request,
56
+ Payone_TransactionStatus_Response_Interface $response
57
+ )
58
+ {
59
+ $factory = $this->getFactory();
60
+ $domainObject = $factory->getModelTransactionStatus();
61
+
62
+ /* map request to domain object */
63
+ $data = $request->toArray();
64
+ $domainObject->setData($data);
65
+
66
+ $domainObject->save();
67
+ }
68
+
69
+ /**
70
+ * @param Payone_Core_Model_Factory $factory
71
+ */
72
+ public function setFactory(Payone_Core_Model_Factory $factory)
73
+ {
74
+ $this->factory = $factory;
75
+ }
76
+
77
+ /**
78
+ * @return Payone_Core_Model_Factory
79
+ */
80
+ public function getFactory()
81
+ {
82
+ if ($this->factory === null) {
83
+ $this->factory = new Payone_Core_Model_Factory();
84
+ }
85
+ return $this->factory;
86
+ }
87
+
88
+ }
app/code/community/Payone/Core/Model/Sales/Quote/Address.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
34
+ {
35
+ /**
36
+ * Validate address attribute values
37
+ *
38
+ * @return bool
39
+ */
40
+ public function validate()
41
+ {
42
+ $errors = $this->_beforeValidate()->toArray();
43
+
44
+ if (!empty($errors)) {
45
+ return $errors;
46
+ }
47
+
48
+ $errors = parent::validate();
49
+
50
+ if (!empty($errors) and $errors !== true) {
51
+ return $errors;
52
+ }
53
+
54
+ $errors = $this->_afterValidate($errors)->toArray();
55
+
56
+ if (empty($errors)) {
57
+ return true;
58
+ }
59
+
60
+ return $errors;
61
+ }
62
+
63
+ /**
64
+ * @return Varien_Object
65
+ */
66
+ protected function _beforeValidate()
67
+ {
68
+ $errors = new Varien_Object();
69
+
70
+ $errors = $this->dispatchEvent($this->_eventPrefix . '_validate_before', $errors);
71
+
72
+ return $errors;
73
+ }
74
+
75
+ /**
76
+ * @param array|bool $errors
77
+ * @return Varien_Object
78
+ */
79
+ protected function _afterValidate($errors)
80
+ {
81
+ if ($errors === true) {
82
+ $errors = array();
83
+ }
84
+ if (!($errors instanceof Varien_Object)) {
85
+ $errors = new Varien_Object($errors);
86
+ }
87
+
88
+ $errors = $this->dispatchEvent($this->_eventPrefix . '_validate_after', $errors);
89
+
90
+ return $errors;
91
+ }
92
+
93
+ /**
94
+ * used to dispatch Validate Events
95
+ *
96
+ * you should check the module/controller/action
97
+ * Validate is triggered very often, but you may only want to do something in checkout
98
+ *
99
+ * @param string $eventName
100
+ * @param Varien_Object $errors
101
+ * @return Varien_Object
102
+ */
103
+ protected function dispatchEvent($eventName, Varien_Object $errors)
104
+ {
105
+ try {
106
+ $params = array(
107
+ $this->_eventObject => $this,
108
+ 'quote' => $this->getQuote(),
109
+ 'errors' => $errors,
110
+ 'full_action_name' => $this->getFullActionName(),
111
+ );
112
+ Mage::dispatchEvent($eventName, $params);
113
+ } catch (Mage_Core_Exception $e) {
114
+ $msg = $this->helper()->__($e->getMessage());
115
+ $errors->addData(array($msg));
116
+ }
117
+ catch (Exception $e) {
118
+ $msg = $this->helper()->__('Entered Address could not be validated.');
119
+ $errors->addData(array($msg));
120
+ }
121
+ return $errors;
122
+ }
123
+
124
+ protected function getFullActionName()
125
+ {
126
+ $controller = Mage::app()->getFrontController();
127
+ $request = $controller->getRequest();
128
+ $action = $controller->getAction();
129
+ if ($action) {
130
+ $fullActionName = $action->getFullActionName('/');
131
+ }
132
+ else {
133
+ $fullActionName = $request->getModuleName() . '/' .
134
+ $request->getControllerName() . '/' .
135
+ $request->getActionName();
136
+ }
137
+ return $fullActionName;
138
+ }
139
+
140
+ /**
141
+ *
142
+ * @return Payone_Core_Helper_Data
143
+ */
144
+ protected function helper()
145
+ {
146
+ return Mage::helper('payone_core');
147
+ }
148
+
149
+ }
app/code/community/Payone/Core/Model/Sales/Quote/Address/Total/Fee.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Sales
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Sales_Quote_Address_Total_Fee
34
+ extends Mage_Sales_Model_Quote_Address_Total_Abstract
35
+ {
36
+
37
+ /** @var Payone_Core_Model_Factory */
38
+ protected $factory = null;
39
+
40
+
41
+ /**
42
+ * @param Mage_Sales_Model_Quote_Address $address
43
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
44
+ */
45
+ public function collect(Mage_Sales_Model_Quote_Address $address)
46
+ {
47
+ $quote = $address->getQuote();
48
+ $payment = $quote->getPayment();
49
+
50
+ $configId = $payment->getPayoneConfigPaymentMethodId();
51
+ if (empty($configId)) {
52
+ return $this;
53
+ }
54
+
55
+ $config = $this->helperConfig()->getConfigPaymentMethodById($configId, $quote->getStoreId());
56
+ if (empty($config)) {
57
+ return $this;
58
+ }
59
+
60
+ $feeConfig = $config->getFeeConfigForQuote($quote);
61
+ if (!is_array($feeConfig) or !array_key_exists('fee_config', $feeConfig)) {
62
+ return $this;
63
+ }
64
+
65
+ $paymentFee = $feeConfig['fee_config'];
66
+ $oldShippingAmount = $address->getBaseShippingAmount();
67
+ $newShippingAmount = $oldShippingAmount + $paymentFee;
68
+
69
+ $address->setBaseShippingAmount($newShippingAmount);
70
+ $address->setShippingAmount(
71
+ $quote->getStore()->convertPrice($newShippingAmount, false)
72
+ );
73
+
74
+ return parent::collect($address);
75
+ }
76
+
77
+ /**
78
+ *
79
+ * @return Payone_Core_Model_Factory
80
+ */
81
+ public function getFactory()
82
+ {
83
+ if ($this->factory === null) {
84
+ $this->factory = new Payone_Core_Model_Factory();
85
+ }
86
+ return $this->factory;
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @param Payone_Core_Model_Factory $factory
92
+ */
93
+ public function setFactory(Payone_Core_Model_Factory $factory)
94
+ {
95
+ $this->factory = $factory;
96
+ }
97
+
98
+ /**
99
+ * @return Payone_Core_Helper_Config
100
+ */
101
+ protected function helperConfig()
102
+ {
103
+ return $this->getFactory()->helperConfig();
104
+ }
105
+
106
+ }
app/code/community/Payone/Core/Model/Service/Abstract.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Service_Abstract
34
+ {
35
+ /**
36
+ * @var Payone_Core_Model_Config_Interface
37
+ */
38
+ protected $configStore = null;
39
+ /** @var Payone_Core_Model_Factory */
40
+ protected $factory = null;
41
+ /** @var Payone_Core_Helper_Data */
42
+ protected $helper = null;
43
+
44
+ /**
45
+ *
46
+ * @return Payone_Core_Model_Factory
47
+ */
48
+ public function getFactory()
49
+ {
50
+ if ($this->factory === null) {
51
+ $this->factory = new Payone_Core_Model_Factory();
52
+ }
53
+ return $this->factory;
54
+ }
55
+
56
+ /**
57
+ *
58
+ * @param Payone_Core_Model_Factory $factory
59
+ */
60
+ public function setFactory(Payone_Core_Model_Factory $factory)
61
+ {
62
+ $this->factory = $factory;
63
+ }
64
+
65
+ /**
66
+ * @return Payone_Core_Helper_Data
67
+ */
68
+ protected function helper()
69
+ {
70
+ if ($this->helper === null) {
71
+ $this->helper = $this->getFactory()->helper();
72
+ }
73
+ return $this->helper;
74
+ }
75
+
76
+ /**
77
+ * @param Payone_Core_Model_Config_Interface $config
78
+ */
79
+ public function setConfigStore(Payone_Core_Model_Config_Interface $config)
80
+ {
81
+ $this->configStore = $config;
82
+ }
83
+
84
+ /**
85
+ * @return Payone_Core_Model_Config_Interface
86
+ */
87
+ public function getConfigStore()
88
+ {
89
+ return $this->configStore;
90
+ }
91
+
92
+ /**
93
+ * @return Payone_Core_Helper_Config
94
+ */
95
+ protected function helperConfig()
96
+ {
97
+ return $this->getFactory()->helperConfig();
98
+ }
99
+ }
app/code/community/Payone/Core/Model/Service/Config/XmlGenerate.php ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Config_XmlGenerate
34
+ extends Payone_Core_Model_Service_Abstract
35
+ {
36
+ const CLASS_PREFIX = 'Payone_Settings_Data_ConfigFile_';
37
+ const PAYMENT_METHOD_CLASS_PREFIX = 'Payone_Settings_Data_ConfigFile_PaymentMethod_';
38
+
39
+ /** @var Mage_Core_Model_Store */
40
+ private $store = NULL;
41
+
42
+ /**
43
+ * @return mixed
44
+ */
45
+ public function execute()
46
+ {
47
+ $service = $this->getFactory()->getServiceApiSettingsXmlGenerate();
48
+ $serviceConfig = $this->getFactory()->getServiceInitializeConfig();
49
+
50
+ /** @var $rootConfig Payone_Settings_Data_ConfigFile_Root */
51
+ $rootConfig = $this->getSettingsClass('root');
52
+
53
+ $stores = Mage::app()->getStores();
54
+ foreach ($stores as $store) {
55
+ /** @var $store Mage_Core_Model_Store */
56
+ /** @var $config Payone_Core_Model_Config */
57
+ $this->store = $store;
58
+ $config = $serviceConfig->execute($store->getStoreId());
59
+ $shopConfig = $this->generateSettingsShop($config);
60
+ $rootConfig->addShop($shopConfig);
61
+ }
62
+
63
+ $xml = $service->generate($rootConfig);
64
+
65
+ return $xml;
66
+ }
67
+
68
+ /**
69
+ * @param $sectionName
70
+ * @param $section
71
+ * @return Payone_Settings_Data_ConfigFile_Abstract
72
+ */
73
+ protected function generateSettingsBySection($sectionName, $section)
74
+ {
75
+ /** @var $sectionConfig Payone_Settings_Data_ConfigFile_Abstract */
76
+ $sectionConfig = $this->getSettingsClass($sectionName);
77
+
78
+ foreach ($section->toArray() as $key => $data) {
79
+ if ($key === 'enabled') {
80
+ $key = 'active';
81
+ }
82
+ $setterName = 'set' . uc_words($key, '');
83
+ if (method_exists($sectionConfig, $setterName)) {
84
+ $sectionConfig->$setterName($data);
85
+ }
86
+ }
87
+
88
+ return $sectionConfig;
89
+ }
90
+
91
+ /**
92
+ * @param $config
93
+ * @return Payone_Settings_Data_ConfigFile_Abstract|Payone_Settings_Data_ConfigFile_Shop
94
+ */
95
+ protected function generateSettingsShop($config)
96
+ {
97
+ /** @var $shopConfig Payone_Settings_Data_ConfigFile_Shop */
98
+ $shopConfig = $this->getSettingsClass('shop');
99
+
100
+ $helper = $this->helper();
101
+ $shopCode = $this->store->getCode();
102
+ $shopName = $this->store->getName();
103
+
104
+ $shopConfig->setCode($shopCode);
105
+ $shopConfig->setName($shopName);
106
+
107
+ $systemConfig = $this->generateSettingsSystem();
108
+ $shopConfig->setSystem($systemConfig);
109
+
110
+ $globalConfig = $this->generateSettingsGlobal($config);
111
+ $shopConfig->setGlobal($globalConfig);
112
+
113
+ $clearingtypesConfig = $this->generateSettingsClearingtypes($config);
114
+ $shopConfig->setClearingtypes($clearingtypesConfig);
115
+
116
+ $protectConfig = $this->generateSettingsProtect($config);
117
+ $shopConfig->setProtect($protectConfig);
118
+
119
+ $miscConfig = $this->generateSettingsMisc($config);
120
+ $shopConfig->setMisc($miscConfig);
121
+
122
+ return $shopConfig;
123
+ }
124
+
125
+ /**
126
+ * @return Payone_Settings_Data_ConfigFile_Abstract|Payone_Settings_Data_ConfigFile_Shop_System
127
+ */
128
+ protected function generateSettingsSystem()
129
+ {
130
+ $helper = $this->helper();
131
+ /** @var $systemConfig Payone_Settings_Data_ConfigFile_Shop_System */
132
+ $systemConfig = $this->getSettingsClass('shop_system');
133
+ $modulesArray = $this->loadInstalledActiveModules();
134
+ $systemConfig->setName('Magento');
135
+ $systemConfig->setVersion($helper->getMagentoVersion());
136
+ $systemConfig->setEdition($helper->getMagentoEdition());
137
+ $systemConfig->setModules($modulesArray);
138
+
139
+ return $systemConfig;
140
+ }
141
+
142
+ /**
143
+ * @param Payone_Core_Model_Config $config
144
+ * @return Payone_Settings_Data_ConfigFile_Abstract|Payone_Settings_Data_ConfigFile_Shop_Global
145
+ */
146
+ protected function generateSettingsGlobal(Payone_Core_Model_Config $config)
147
+ {
148
+ $general = $config->getGeneral();
149
+ $global = $general->getGlobal();
150
+ $parameterInvoice = $general->getParameterInvoice();
151
+ $statusMapping = $general->getStatusMapping();
152
+ $paymentCreditcard = $general->getPaymentCreditcard();
153
+
154
+ /** @var $globalConfig Payone_Settings_Data_ConfigFile_Shop_Global */
155
+ $globalConfig = $this->generateSettingsBySection('shop_global', $global);
156
+ $statusMappingConfig = new Payone_Settings_Data_ConfigFile_Global_StatusMapping();
157
+ foreach ($statusMapping->toArray() as $keyClearingType => $mapping) {
158
+ $keyClearingType = $this->getPayoneShortKey($keyClearingType);
159
+ if ($keyClearingType !== NULL) {
160
+ $data = array();
161
+
162
+ foreach ($mapping as $key => $value) {
163
+ $singleMap = array();
164
+ $singleMap['from'] = $key;
165
+ $singleMap['to'] = $value;
166
+ array_push($data, $singleMap);
167
+ }
168
+ $statusMappingConfig->addStatusMapping($keyClearingType, $data);
169
+ }
170
+ }
171
+
172
+ $globalConfig->setStatusMapping($statusMappingConfig);
173
+ $globalConfig->setParameterInvoice($parameterInvoice->toArray());
174
+ $globalConfig->setPaymentCreditcard($paymentCreditcard->toArray());
175
+
176
+ return $globalConfig;
177
+ }
178
+
179
+ /**
180
+ * @param Payone_Core_Model_Config $config
181
+ * @return Payone_Settings_Data_ConfigFile_Abstract|Payone_Settings_Data_ConfigFile_Shop_ClearingTypes
182
+ */
183
+ protected function generateSettingsClearingtypes(Payone_Core_Model_Config $config)
184
+ {
185
+ /** @var $clearingTypes Payone_Settings_Data_ConfigFile_Shop_ClearingTypes */
186
+ $clearingTypes = $this->getSettingsClass('shop_clearingTypes');
187
+
188
+ $payment = $config->getPayment();
189
+ $clearingTypesArray = array();
190
+ foreach ($payment->getMethods() as $paymentMethod) {
191
+ /** @var $paymentMethod Payone_Core_Model_Config_Payment_Method */
192
+ /** @var $paymentMethodConfig Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract */
193
+ $paymentMethodConfig = $this->getPaymentMethodClass($paymentMethod->getCode());
194
+
195
+ foreach ($paymentMethod->toArray() as $key => $value) {
196
+ if ($key === 'enabled') {
197
+ $key = 'active';
198
+ }
199
+ $setterName = 'set' . uc_words($key, '');
200
+ if (method_exists($paymentMethodConfig, $setterName)) {
201
+ $paymentMethodConfig->$setterName($value);
202
+ }
203
+ }
204
+
205
+ $allowedCountries = $paymentMethod->getAllowedCountries();
206
+ if (method_exists($paymentMethodConfig, 'setCountries')) {
207
+ $paymentMethodConfig->setCountries(implode(',', $allowedCountries));
208
+ }
209
+ if (method_exists($paymentMethodConfig, 'setAuthorization')) {
210
+ $paymentMethodConfig->setAuthorization($paymentMethod->getRequestType());
211
+ }
212
+ $paymentMethodConfig->setTitle($paymentMethod->getName());
213
+
214
+ if ($paymentMethod->getTypes() !== NULL && $paymentMethod->getTypes() !== false) {
215
+ $types = $paymentMethod->getTypes();
216
+ if (is_array($types)) {
217
+ $types = implode(',', $types);
218
+ }
219
+ if ($paymentMethodConfig instanceof Payone_Settings_Data_ConfigFile_PaymentMethod_Creditcard) {
220
+ /**@var $paymentMethodConfig Payone_Settings_Data_ConfigFile_PaymentMethod_Creditcard */
221
+ $paymentMethodConfig->setCvc2($paymentMethod->getCheckCvc());
222
+ }
223
+ $paymentMethodConfig->setTypes($types);
224
+
225
+ }
226
+ $feeConfigs = $paymentMethod->getFeeConfig();
227
+ $feeConfigArray = array();
228
+ if (is_array($feeConfigs)) {
229
+ foreach ($feeConfigs as $feeConfig) {
230
+ $attributeCountry = $attributeShippingMethod = '';
231
+ if (is_array($feeConfig)) {
232
+ if (array_key_exists('countries', $feeConfig)) {
233
+ $attributeCountry = array_shift($feeConfig['countries']);
234
+ }
235
+ if (array_key_exists('shipping_method', $feeConfig)) {
236
+ $attributeShippingMethod = array_shift($feeConfig['shipping_method']);
237
+ }
238
+ }
239
+ $attributeArray = array(
240
+ 'country' => $attributeCountry,
241
+ 'shipping_method' => $attributeShippingMethod);
242
+
243
+ $configArray = array(
244
+ 'value' => $feeConfig['fee_config'],
245
+ 'attribute' => $attributeArray);
246
+ array_push($feeConfigArray, $configArray);
247
+ }
248
+ }
249
+
250
+ $paymentMethodConfig->setFeeConfig($feeConfigArray);
251
+
252
+ array_push($clearingTypesArray, $paymentMethodConfig);
253
+ }
254
+
255
+ $clearingTypes->setClearingtypes($clearingTypesArray);
256
+
257
+ return $clearingTypes;
258
+ }
259
+
260
+ /**
261
+ * @param Payone_Core_Model_Config $config
262
+ * @return Payone_Settings_Data_ConfigFile_Abstract|Payone_Settings_Data_ConfigFile_Shop_Protect
263
+ */
264
+ protected function generateSettingsProtect(Payone_Core_Model_Config $config)
265
+ {
266
+ /** @var $protectConfig Payone_Settings_Data_ConfigFile_Shop_Protect */
267
+ $protectConfig = $this->getSettingsClass('shop_protect');
268
+
269
+ $protect = $config->getProtect();
270
+ $creditrating = $protect->getCreditrating();
271
+
272
+ /** @var $consumerScore Payone_Settings_Data_ConfigFile_Protect_Consumerscore */
273
+ $consumerScore = $this->generateSettingsBySection('protect_consumerscore', $creditrating);
274
+ $yellow = $this->getAllowedPaymentMethods('yellow', $creditrating);
275
+ $consumerScore->setYellow($yellow);
276
+ $red = $this->getAllowedPaymentMethods('red', $creditrating);
277
+ $consumerScore->setRed($red);
278
+ $consumerScore->setDuetime($creditrating->getResultLifetimeInSeconds());
279
+
280
+ /** @var $addressCheck Payone_Settings_Data_ConfigFile_Protect_Addresscheck */
281
+ $addressCheck = $this->generateSettingsBySection('protect_addresscheck', $protect->getAddressCheck());
282
+ $personStatusmapping = $protect->getAddressCheck()->getMappingPersonstatus();
283
+ if (!is_array($personStatusmapping)) {
284
+ $personStatusmapping = array();
285
+ }
286
+ $addressCheck->setPersonstatusmapping($personStatusmapping);
287
+ $protectConfig->setConsumerscore($consumerScore);
288
+ $protectConfig->setAddresscheck($addressCheck);
289
+
290
+ return $protectConfig;
291
+ }
292
+
293
+ protected function getAllowedPaymentMethods($color, Payone_Core_Model_Config_Protect_Creditrating $creditrating)
294
+ {
295
+ $color = ucfirst($color);
296
+ $getter = 'getAllowPaymentMethods' . $color;
297
+ $paymentMethods = $creditrating->$getter();
298
+ if (is_array($paymentMethods)) {
299
+ $paymentMethods = str_replace('payone_', '', implode(',', $paymentMethods));
300
+ }
301
+ return $paymentMethods;
302
+ }
303
+
304
+ /**
305
+ * @param Payone_Core_Model_Config $config
306
+ * @return Payone_Settings_Data_ConfigFile_Abstract|Payone_Settings_Data_ConfigFile_Shop_Misc
307
+ */
308
+ protected function generateSettingsMisc(Payone_Core_Model_Config $config)
309
+ {
310
+ /** @var $miscConfig Payone_Settings_Data_ConfigFile_Shop_Misc */
311
+ $miscConfig = $this->getSettingsClass('shop_misc');
312
+
313
+ $misc = $config->getMisc();
314
+
315
+ /** @var $transactionStatusForwarding Payone_Settings_Data_ConfigFile_Misc_TransactionstatusForwarding */
316
+ $transactionStatusForwarding = $this->getSettingsClass('misc_transactionstatusForwarding');
317
+
318
+ foreach ($misc->getTransactionstatusForwarding()->getConfigSortedByUrl() as $key => $value) {
319
+ $status = implode(',', $value['status']);
320
+ $data = array('status' => $status, 'url' => $key, 'timeout' => $value['timeout']);
321
+ $transactionStatusForwarding->addTransactionstatusForwarding($data);
322
+ }
323
+
324
+ $miscConfig->setTransactionstatusforwarding($transactionStatusForwarding);
325
+ $miscConfig->setShippingcosts($misc->getShippingCosts()->toArray());
326
+
327
+ return $miscConfig;
328
+ }
329
+
330
+ /**
331
+ * @param $key
332
+ * @return Payone_Settings_Data_ConfigFile_Abstract
333
+ */
334
+ protected function getSettingsClass($key)
335
+ {
336
+ $key = uc_words($key);
337
+ $classname = self::CLASS_PREFIX . $key;
338
+ $classInstance = new $classname();
339
+ return $classInstance;
340
+ }
341
+
342
+ /**
343
+ * @param $key
344
+ * @return Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract
345
+ */
346
+ protected function getPaymentMethodClass($key)
347
+ {
348
+ $key = uc_words($key, '');
349
+ $classname = self::PAYMENT_METHOD_CLASS_PREFIX . $key;
350
+ $classInstance = new $classname();
351
+ return $classInstance;
352
+ }
353
+
354
+ /**
355
+ * @param $key
356
+ * @return null
357
+ */
358
+ protected function getPayoneShortKey($key)
359
+ {
360
+ $key = strtoupper(uc_words($key, ''));
361
+ $clearingTypes = $this->getFactory()->getModelSystemConfigClearingType();
362
+ $keyArray = $clearingTypes->toArray();
363
+ $keyArray = array_flip($keyArray);
364
+ if (array_key_exists($key, $keyArray)) {
365
+ return $keyArray[$key];
366
+ }
367
+
368
+ return null;
369
+ }
370
+
371
+ /**
372
+ * @return array
373
+ */
374
+ protected function loadInstalledActiveModules()
375
+ {
376
+ $modulesArray = Mage::getConfig()->getNode('modules')->children();
377
+
378
+ $activeModules = array();
379
+ foreach ($modulesArray as $key => $value) {
380
+ /**@var $value Mage_Core_Model_Config_Element */
381
+ if ($value->is('active') && !$value->is('codePool', 'core')) {
382
+ $activeModules[$key] = (string)$value->version;
383
+ }
384
+ }
385
+ return $activeModules;
386
+ }
387
+ }
app/code/community/Payone/Core/Model/Service/Export/Collection.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Export_Collection extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ protected $columns = array();
36
+
37
+ public function __construct(array $columns = array())
38
+ {
39
+ if(count($columns) > 0){
40
+ $this->setColumns($columns);
41
+ }
42
+ }
43
+ /**
44
+ * @param Mage_Core_Model_Resource_Db_Collection_Abstract $collection
45
+ * @return string
46
+ */
47
+ public function exportCsv(Mage_Core_Model_Resource_Db_Collection_Abstract $collection)
48
+ {
49
+ $this->prepareCollection($collection);
50
+
51
+ $csv = '';
52
+ $data = array();
53
+ // Header
54
+ foreach ($this->getColumns() as $column) {
55
+ $data[] = '"' . $this->helper()->__($column) . '"';
56
+ }
57
+
58
+ $csv .= implode(',', $data) . "\n";
59
+
60
+ // Items
61
+ foreach ($collection as $item) {
62
+ /**
63
+ * @var $item Varien_Object
64
+ */
65
+ $data = array();
66
+ foreach ($this->getColumns() as $column) {
67
+ $data[] = '"' . $item->getData($column) . '"';
68
+ }
69
+ $csv .= implode(',', $data) . "\n";
70
+ }
71
+ return $csv;
72
+ }
73
+
74
+ protected function prepareCollection(Mage_Core_Model_Resource_Db_Collection_Abstract $collection)
75
+ {
76
+ $collection->getSelect()->limit();
77
+ $collection->setPageSize(0);
78
+ $collection->load();
79
+ }
80
+
81
+ /**
82
+ * @param array $columns
83
+ */
84
+ public function setColumns(array $columns)
85
+ {
86
+ $this->columns = $columns;
87
+ }
88
+
89
+ /**
90
+ * @return array
91
+ */
92
+ public function getColumns()
93
+ {
94
+ return $this->columns;
95
+ }
96
+
97
+ }
app/code/community/Payone/Core/Model/Service/InitializeConfig.php ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_InitializeConfig
34
+ extends Payone_Core_Model_Service_Abstract
35
+ {
36
+ const CONFIG_CACHE_ID = 'store_%s_payone_config_cache';
37
+ const CONIG_REGISTRY_KEY = 'payone_core_config_%s';
38
+ const CACHE_TAG = 'payone_config';
39
+
40
+ const CONFIG_SECTION_PREFIX = 'payone_';
41
+ const CONFIG_SECTION_GENERAL = 'general';
42
+ const CONFIG_SECTION_PAYMENT = 'payment';
43
+ const CONFIG_SECTION_PROTECT = 'protect';
44
+ const CONFIG_SECTION_MISC = 'misc';
45
+
46
+ /** @var int */
47
+ protected $storeId = null;
48
+
49
+ /**
50
+ * Generates the Configuration Object for Payone Settings
51
+ *
52
+ * Each StoreId will have an Object respresenting its Configuration
53
+ * The Config Object will be cached
54
+ *
55
+ * @param int $storeId
56
+ * @return Payone_Core_Model_Config_Interface
57
+ */
58
+ public function execute($storeId = null)
59
+ {
60
+ $this->setStoreId($storeId);
61
+
62
+ // @todo registry handling should be moved to helper
63
+ $registryKey = $this->getConfigRegistryKey($storeId);
64
+ $config = Mage::registry($registryKey);
65
+ if ($config instanceof Payone_Core_Model_Config_Interface) {
66
+ return $config;
67
+ }
68
+
69
+ $config = $this->loadFromCache();
70
+ if ($config instanceof Payone_Core_Model_Config_Interface) {
71
+ Mage::register($registryKey, $config);
72
+ return $config;
73
+ }
74
+
75
+ /** @var $config Payone_Core_Model_Config */
76
+ $config = $this->getConfigModel();
77
+
78
+ // Store Id
79
+ $config->setStoreId($storeId);
80
+
81
+ // General
82
+ $general = $this->initConfigBySection(self::CONFIG_SECTION_GENERAL);
83
+ $config->setGeneral($general);
84
+
85
+ // Payment
86
+ $payment = $this->initConfigPayment($general);
87
+ $config->setPayment($payment);
88
+
89
+ // Protect
90
+ $protect = $this->initConfigBySection(self::CONFIG_SECTION_PROTECT);
91
+ $config->setProtect($protect);
92
+
93
+ // Misc
94
+ $misc = $this->initConfigBySection(self::CONFIG_SECTION_MISC);
95
+ $config->setMisc($misc);
96
+
97
+ // Caching
98
+ $this->saveToCache($config);
99
+
100
+ return $config;
101
+ }
102
+
103
+ /**
104
+ * @param $sectionKey
105
+ * @return null|Payone_Core_Model_Config_AreaAbstract
106
+ */
107
+ protected function initConfigBySection($sectionKey)
108
+ {
109
+ $configSection = $this->getConfigModel($sectionKey);
110
+
111
+ $_configFields = Mage::getSingleton('adminhtml/config');
112
+ /**
113
+ * @var $section Mage_Core_Model_Config_Element
114
+ */
115
+ $section = $_configFields->getSection(self::CONFIG_SECTION_PREFIX . $sectionKey);
116
+
117
+ /**
118
+ * @var $groups Mage_Core_Model_Config_Element
119
+ */
120
+ $groups = $section->groups;
121
+
122
+ foreach ($groups->children() as $groupKey => $group) {
123
+ /**
124
+ * @var $group Mage_Core_Model_Config_Element
125
+ */
126
+ if (!property_exists($group, 'fields')) {
127
+ continue;
128
+ }
129
+ // we want a clean directory structure
130
+ $configGroup = $this->initConfigByGroup($sectionKey, $groupKey);
131
+ $configSection->init(array($groupKey => $configGroup));
132
+ }
133
+
134
+ return $configSection;
135
+ }
136
+
137
+ /**
138
+ * @param string $sectionKey
139
+ * @param string $groupKey
140
+ * @return null|Payone_Core_Model_Config_AreaAbstract
141
+ */
142
+ protected function initConfigByGroup($sectionKey, $groupKey)
143
+ {
144
+ $classKey = $sectionKey . '_' . uc_words($groupKey, '');
145
+
146
+ $data = $this->getStoreConfig(self::CONFIG_SECTION_PREFIX . $sectionKey . '/' . $groupKey);
147
+
148
+ $config = $this->getConfigModel($classKey);
149
+ if ($config === null) {
150
+ return null;
151
+ }
152
+
153
+ if ($data !== null) {
154
+ $config->init($data);
155
+ }
156
+ return $config;
157
+ }
158
+
159
+ /**
160
+ * @param Payone_Core_Model_Config_General $general
161
+ * @return Payone_Core_Model_Config_Payment
162
+ */
163
+ protected function initConfigPayment(Payone_Core_Model_Config_General $general)
164
+ {
165
+ $global = $general->getGlobal();
166
+ $defaultConfig = $global->toArray();
167
+ $invoiceTransmit = $general->getParameterInvoice()->getTransmitEnabled();
168
+
169
+ // Add invoice_transmit to defaultConfig
170
+ $defaultConfig['invoice_transmit'] = $invoiceTransmit;
171
+
172
+ /** @var $payment Payone_Core_Model_Config_Payment */
173
+ $payment = $this->getConfigModel(self::CONFIG_SECTION_PAYMENT);
174
+
175
+ /** @var $methodConfigCollection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
176
+ $methodConfigCollection = Mage::getModel('payone_core/domain_config_paymentMethod')->getCollection();
177
+ $methodConfigCollection->getCollectionByStoreId($this->getStoreId());
178
+ $methodConfigCollection->addSortOrder();
179
+
180
+ foreach ($methodConfigCollection as $methodConfig) {
181
+ /**
182
+ * @var $methodConfig Payone_Core_Model_Domain_Config_PaymentMethod
183
+ */
184
+
185
+ $configData = $methodConfig->getData();
186
+
187
+ /**
188
+ * @var $configMethod Payone_Core_Model_Config_Payment_Method_Interface
189
+ */
190
+ $configMethod = $this->getConfigModel('payment_method');
191
+
192
+ $configMethod->init($configData);
193
+
194
+ // Use Global Config if use_global is set
195
+ if ($configMethod->getUseGlobal()) {
196
+ $configMethod->init($defaultConfig);
197
+ }
198
+ else {
199
+ // Check globals also if they are not to use
200
+ foreach ($defaultConfig as $key => $value) {
201
+ if ($configData[$key] == '') {
202
+ $configData[$key] = $value;
203
+ }
204
+ }
205
+ $configMethod->init($configData);
206
+ }
207
+
208
+ // init Allowed Countries
209
+ if (array_key_exists('allowspecific', $configData) and $methodConfig->getAllowspecific()) {
210
+ $allowedCountries = $configMethod->getSpecificcountry();
211
+ }
212
+ else {
213
+ $generalAllowedCountries = $this->getStoreConfig('general/country/allow');
214
+ $allowedCountries = explode(',', $generalAllowedCountries);
215
+ }
216
+ $configMethod->setAllowedCountries($allowedCountries);
217
+
218
+ $parentDefaultId = $methodConfig->getParentDefaultId();
219
+ $parentWebsitesId = $methodConfig->getParentWebsitesId();
220
+ if (!empty($parentDefaultId) && empty($parentWebsitesId)) {
221
+ $configMethod->setParent($parentDefaultId);
222
+ }
223
+ elseif (!empty($parentWebsitesId)) {
224
+ $configMethod->setParent($parentWebsitesId);
225
+ }
226
+
227
+ $payment->addMethod($configMethod);
228
+ }
229
+
230
+ return $payment;
231
+ }
232
+
233
+ /**
234
+ *
235
+ * @param string $path
236
+ * @return mixed
237
+ */
238
+ protected function getStoreConfig($path)
239
+ {
240
+ return $this->helperConfig()->getStoreConfig($path, $this->getStoreId());
241
+ }
242
+
243
+ /**
244
+ * @param string $key
245
+ * @return Payone_Core_Model_Config_AreaAbstract
246
+ */
247
+ protected function getConfigModel($key = '')
248
+ {
249
+ if ($key != '') {
250
+ $key = '_' . $key;
251
+ }
252
+ $className = 'payone_core/config' . $key;
253
+ return Mage::getModel($className);
254
+ }
255
+
256
+ public function getConfigRegistryKey($storeId = null)
257
+ {
258
+ if ($storeId === null) {
259
+ $storeId = $this->getStoreId();
260
+ }
261
+ if ($storeId === null) {
262
+ $storeId = 0;
263
+ }
264
+ $cacheId = sprintf(self::CONIG_REGISTRY_KEY, $storeId);
265
+ return $cacheId;
266
+ }
267
+
268
+ public function getConfigCacheId($storeId = null)
269
+ {
270
+ if ($storeId === null) {
271
+ $storeId = $this->getStoreId();
272
+ }
273
+ if ($storeId === null) {
274
+ $storeId = 0;
275
+ }
276
+ $cacheId = sprintf(self::CONFIG_CACHE_ID, $storeId);
277
+ return $cacheId;
278
+ }
279
+
280
+ /**
281
+ * @todo move Mage:: calls to new Helper_Cache?
282
+ * @return Payone_Core_Model_Config_Interface|null
283
+ */
284
+ protected function loadFromCache()
285
+ {
286
+ // Check cache and if its there, return stored config:
287
+ if (Mage::app()->useCache('config')) {
288
+ $cacheId = $this->getConfigCacheId();
289
+ $data = Mage::app()->loadCache($cacheId);
290
+
291
+ if ($data) {
292
+ $config = unserialize($data);
293
+ return $config;
294
+ }
295
+ }
296
+ return NULL;
297
+ }
298
+
299
+ /**
300
+ * @todo move Cache handling to Helper_Cache_Config
301
+ *
302
+ * @param Payone_Core_Model_Config_Interface $config
303
+ */
304
+ protected function saveToCache(Payone_Core_Model_Config_Interface $config)
305
+ {
306
+ // Cache Config Object
307
+ if (Mage::app()->useCache('config')) {
308
+ $cacheId = $this->getConfigCacheId();
309
+ Mage::app()->saveCache(
310
+ serialize($config),
311
+ $cacheId,
312
+ array(
313
+ self::CACHE_TAG,
314
+ Mage_Core_Model_Store::CACHE_TAG,
315
+ Mage_Core_Model_Config::CACHE_TAG
316
+ ));
317
+ }
318
+ }
319
+
320
+ /**
321
+ * @param int $storeId
322
+ */
323
+ public function setStoreId($storeId)
324
+ {
325
+ $this->storeId = $storeId;
326
+ }
327
+
328
+ /**
329
+ * @return int
330
+ */
331
+ public function getStoreId()
332
+ {
333
+ return $this->storeId;
334
+ }
335
+
336
+ }
app/code/community/Payone/Core/Model/Service/InitializePayment.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_InitializePayment
34
+ extends Payone_Core_Model_Service_Abstract
35
+ {
36
+ /** @var Payone_Core_Model_Factory */
37
+ protected $factory = null;
38
+
39
+ /**
40
+ * @var Payone_Core_Model_Config_Payment_Method_Interface
41
+ */
42
+ protected $configPaymentMethod = null;
43
+
44
+ /**
45
+ * @param Mage_Sales_Model_Order_Payment $payment
46
+ * @return Payone_Api_Response_Authorization_Approved|Payone_Api_Response_Authorization_Redirect|Payone_Api_Response_Error
47
+ * @throws Payone_Core_Exception_InvalidRequestType
48
+ */
49
+ public function execute(Mage_Sales_Model_Order_Payment $payment)
50
+ {
51
+ $config = $this->getConfigPaymentMethod();
52
+
53
+ /** @var $service Payone_Core_Model_Service_Payment_Interface */
54
+ $service = null;
55
+ if ($config->isRequestAuthorization()) {
56
+ $service = $this->getFactory()->getServicePaymentAuthorize($config);
57
+ }
58
+ elseif ($config->isRequestPreauthorization()) {
59
+ $service = $this->getFactory()->getServicePaymentPreauthorize($config);
60
+ }
61
+ else {
62
+ $msg = 'Invalid request type configured: "' . $config->getRequestType() . '"';
63
+ throw new Payone_Core_Exception_InvalidRequestType($msg);
64
+ }
65
+
66
+ $service->setConfigStore($this->getConfigStore());
67
+
68
+ $response = $service->execute($payment);
69
+ return $response;
70
+ }
71
+
72
+ /**
73
+ * @param Payone_Core_Model_Factory $factory
74
+ */
75
+ public function setFactory(Payone_Core_Model_Factory $factory)
76
+ {
77
+ $this->factory = $factory;
78
+ }
79
+
80
+ /**
81
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $configPaymentMethod
82
+ */
83
+ public function setConfigPaymentMethod(Payone_Core_Model_Config_Payment_Method_Interface $configPaymentMethod)
84
+ {
85
+ $this->configPaymentMethod = $configPaymentMethod;
86
+ }
87
+
88
+ /**
89
+ * @return Payone_Core_Model_Config_Payment_Method_Interface
90
+ */
91
+ public function getConfigPaymentMethod()
92
+ {
93
+ return $this->configPaymentMethod;
94
+ }
95
+
96
+
97
+ }
app/code/community/Payone/Core/Model/Service/Management/GetInvoice.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Management_GetInvoice
34
+ extends Payone_Core_Model_Service_Verification_Abstract
35
+ {
36
+ protected $prefix = 'payone_getinvoice';
37
+
38
+ /** @var Payone_Api_Service_Management_GetInvoice */
39
+ protected $serviceApiGetInvoice = null;
40
+
41
+ /** @var Payone_Core_Model_Mapper_ApiRequest_Management_GetInvoice */
42
+ protected $mapper = null;
43
+
44
+ /** @var Payone_Core_Model_Handler_Management_GetInvoice */
45
+ protected $handler = null;
46
+
47
+ /**
48
+ * @param Mage_Sales_Model_Order_Invoice $invoice
49
+ * @return string
50
+ */
51
+ public function execute(Mage_Sales_Model_Order_Invoice $invoice)
52
+ {
53
+ $handler = $this->getHandler();
54
+
55
+ // Map Api request:
56
+ $request = $this->getMapper()->mapFromInvoice($invoice);
57
+
58
+ // Send request via Api:
59
+ $responseRaw = $this->getServiceApiGetInvoice()->getInvoice($request);
60
+
61
+ if($responseRaw instanceof Payone_Api_Response_Error)
62
+ return false;
63
+
64
+ $response = $handler->handle($responseRaw);
65
+
66
+ return $response;
67
+ }
68
+
69
+ /**
70
+ * @param Payone_Core_Model_Handler_Management_GetInvoice $handler
71
+ */
72
+ public function setHandler(Payone_Core_Model_Handler_Management_GetInvoice $handler)
73
+ {
74
+ $this->handler = $handler;
75
+ }
76
+
77
+ /**
78
+ * @return Payone_Core_Model_Handler_Management_GetInvoice
79
+ */
80
+ public function getHandler()
81
+ {
82
+ return $this->handler;
83
+ }
84
+
85
+ /**
86
+ * @param Payone_Api_Service_Management_GetInvoice $serviceApiGetInvoice
87
+ */
88
+ public function setServiceApiGetInvoice($serviceApiGetInvoice)
89
+ {
90
+ $this->serviceApiGetInvoice = $serviceApiGetInvoice;
91
+ }
92
+
93
+ /**
94
+ * @return Payone_Api_Service_Management_GetInvoice
95
+ */
96
+ public function getServiceApiGetInvoice()
97
+ {
98
+ return $this->serviceApiGetInvoice;
99
+ }
100
+
101
+ /**
102
+ * @param Payone_Core_Model_Mapper_ApiRequest_Management_GetInvoice $mapper
103
+ */
104
+ public function setMapper($mapper)
105
+ {
106
+ $this->mapper = $mapper;
107
+ }
108
+
109
+ /**
110
+ * @return Payone_Core_Model_Mapper_ApiRequest_Management_GetInvoice
111
+ */
112
+ public function getMapper()
113
+ {
114
+ return $this->mapper;
115
+ }
116
+
117
+ }
app/code/community/Payone/Core/Model/Service/Payment/Abstract.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Service_Payment_Abstract
34
+ extends Payone_Core_Model_Service_Abstract
35
+ implements Payone_Core_Model_Service_Payment_Interface
36
+ {
37
+ const EVENT_GROUP = 'payone_core_service_payment';
38
+
39
+ /** @var Payone_Core_Model_Mapper_ApiRequest_Payment_Interface */
40
+ protected $mapper = null;
41
+
42
+ /**
43
+ * @var Payone_Core_Model_Handler_Payment_Interface
44
+ */
45
+ protected $handler = null;
46
+
47
+ /**
48
+ * @param Payone_Api_Request_Interface $request
49
+ * @return mixed
50
+ */
51
+ abstract protected function perform(Payone_Api_Request_Interface $request);
52
+
53
+ /**
54
+ * @return string
55
+ */
56
+ abstract public function getEventType();
57
+
58
+ /**
59
+ * @inheritdoc
60
+ */
61
+ public function execute(Mage_Sales_Model_Order_Payment $payment, $amount = 0.00)
62
+ {
63
+ $this->getMapper()->setAmount($amount);
64
+
65
+ $request = $this->getMapper()->mapFromPayment($payment);
66
+
67
+ $response = $this->perform($request);
68
+
69
+ $this->getHandler()->setConfigStore($this->getConfigStore());
70
+ $this->getHandler()->setPayment($payment);
71
+ $this->getHandler()->setRequest($request);
72
+ $this->getHandler()->handle($response);
73
+
74
+ // Trigger Event
75
+ $params = array(
76
+ 'request' => $request,
77
+ 'response' => $response,
78
+ 'payment_method' => $payment->getMethodInstance(),
79
+ 'payment' => $payment,
80
+ 'order' => $payment->getOrder()
81
+ );
82
+ $this->dispatchEvent($this->getEventGroup(), $params);
83
+ $this->dispatchEvent($this->getEventName(), $params);
84
+ $this->dispatchEvent($this->getEventName() . '_' . strtolower($response->getStatus()), $params);
85
+
86
+ if ($response instanceof Payone_Api_Response_Error) {
87
+ /** @var $response Payone_Api_Response_Error */
88
+ $this->throwMageException('There has been an error processing your payment');
89
+ }
90
+
91
+ return $response;
92
+ }
93
+
94
+ protected function getEventName()
95
+ {
96
+ return $this->getEventGroup() . '_' . $this->getEventType();
97
+ }
98
+
99
+ protected function getEventGroup()
100
+ {
101
+ return self::EVENT_GROUP;
102
+ }
103
+
104
+ /**
105
+ * @param $message
106
+ * @throws Mage_Core_Exception
107
+ */
108
+ protected function throwMageException($message)
109
+ {
110
+ Mage::throwException($message);
111
+ }
112
+
113
+ /**
114
+ * @param $name
115
+ * @param array $data
116
+ *
117
+ * @return Mage_Core_Model_App
118
+ */
119
+ protected function dispatchEvent($name, array $data = array())
120
+ {
121
+ return Mage::dispatchEvent($name, $data);
122
+ }
123
+
124
+ /**
125
+ * @param Payone_Core_Model_Mapper_ApiRequest_Payment_Interface $mapper
126
+ */
127
+ public function setMapper(Payone_Core_Model_Mapper_ApiRequest_Payment_Interface $mapper)
128
+ {
129
+ $this->mapper = $mapper;
130
+ }
131
+
132
+ /**
133
+ * @return Payone_Core_Model_Mapper_ApiRequest_Payment_Interface
134
+ */
135
+ public function getMapper()
136
+ {
137
+ return $this->mapper;
138
+ }
139
+
140
+ /**
141
+ * @param Payone_Core_Model_Handler_Payment_Interface $handler
142
+ */
143
+ public function setHandler(Payone_Core_Model_Handler_Payment_Interface $handler)
144
+ {
145
+ $this->handler = $handler;
146
+ }
147
+
148
+ /**
149
+ * @return Payone_Core_Model_Handler_Payment_Interface
150
+ */
151
+ public function getHandler()
152
+ {
153
+ return $this->handler;
154
+ }
155
+ }
app/code/community/Payone/Core/Model/Service/Payment/Authorize.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Payment_Authorize
34
+ extends Payone_Core_Model_Service_Payment_Abstract
35
+ {
36
+ const EVENT_TYPE = 'authorization';
37
+
38
+ /** @var Payone_Api_Service_Payment_AuthorizeInterface */
39
+ protected $serviceApiPayment = null;
40
+
41
+ /**
42
+ * @param Payone_Api_Request_Interface $request
43
+ * @return Payone_Api_Response_Authorization_Approved|Payone_Api_Response_Authorization_Redirect|Payone_Api_Response_Error
44
+ */
45
+ protected function perform(Payone_Api_Request_Interface $request)
46
+ {
47
+ return $this->getServiceApiPayment()->authorize($request);
48
+ }
49
+
50
+ /**
51
+ * @param Payone_Api_Service_Payment_AuthorizeInterface $serviceApiPayment
52
+ */
53
+ public function setServiceApiPayment(Payone_Api_Service_Payment_AuthorizeInterface $serviceApiPayment)
54
+ {
55
+ $this->serviceApiPayment = $serviceApiPayment;
56
+ }
57
+
58
+ /**
59
+ * @return Payone_Api_Service_Payment_AuthorizeInterface
60
+ */
61
+ public function getServiceApiPayment()
62
+ {
63
+ return $this->serviceApiPayment;
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getEventType()
70
+ {
71
+ return self::EVENT_TYPE;
72
+ }
73
+ }
app/code/community/Payone/Core/Model/Service/Payment/Capture.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Payment_Capture
34
+ extends Payone_Core_Model_Service_Payment_Abstract
35
+ {
36
+ const EVENT_TYPE = 'capture';
37
+
38
+ /** @var Payone_Api_Service_Payment_CaptureInterface */
39
+ protected $serviceApiPayment = null;
40
+
41
+ /**
42
+ * @param Payone_Api_Request_Interface $request
43
+ * @return mixed
44
+ */
45
+ protected function perform(Payone_Api_Request_Interface $request)
46
+ {
47
+ return $this->getServiceApiPayment()->capture($request);
48
+ }
49
+
50
+ /**
51
+ * @param Payone_Api_Service_Payment_CaptureInterface $serviceApiPayment
52
+ */
53
+ public function setServiceApiPayment(Payone_Api_Service_Payment_CaptureInterface $serviceApiPayment)
54
+ {
55
+ $this->serviceApiPayment = $serviceApiPayment;
56
+ }
57
+
58
+ /**
59
+ * @return Payone_Api_Service_Payment_CaptureInterface
60
+ */
61
+ public function getServiceApiPayment()
62
+ {
63
+ return $this->serviceApiPayment;
64
+ }
65
+ /**
66
+ * @return string
67
+ */
68
+ public function getEventType()
69
+ {
70
+ return self::EVENT_TYPE;
71
+ }
72
+ }
app/code/community/Payone/Core/Model/Service/Payment/Debit.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Payment_Debit
34
+ extends Payone_Core_Model_Service_Payment_Abstract
35
+ {
36
+ const EVENT_TYPE = 'debit';
37
+
38
+ /** @var Payone_Api_Service_Payment_DebitInterface */
39
+ protected $serviceApiPayment = null;
40
+
41
+ /**
42
+ * @param Payone_Api_Request_Interface $request
43
+ * @return mixed
44
+ */
45
+ protected function perform(Payone_Api_Request_Interface $request)
46
+ {
47
+ return $this->getServiceApiPayment()->debit($request);
48
+ }
49
+
50
+ /**
51
+ * @param Payone_Api_Service_Payment_DebitInterface $serviceApiPayment
52
+ */
53
+ public function setServiceApiPayment(Payone_Api_Service_Payment_DebitInterface $serviceApiPayment)
54
+ {
55
+ $this->serviceApiPayment = $serviceApiPayment;
56
+ }
57
+
58
+ /**
59
+ * @return Payone_Api_Service_Payment_DebitInterface
60
+ */
61
+ public function getServiceApiPayment()
62
+ {
63
+ return $this->serviceApiPayment;
64
+ }
65
+ /**
66
+ * @return string
67
+ */
68
+ public function getEventType()
69
+ {
70
+ return self::EVENT_TYPE;
71
+ }
72
+ }
app/code/community/Payone/Core/Model/Service/Payment/Interface.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ interface Payone_Core_Model_Service_Payment_Interface
34
+ {
35
+ /**
36
+ * @param Mage_Sales_Model_Order_Payment $payment
37
+ * @param float $amount
38
+ * @return Payone_Api_Response_Interface|Payone_Api_Response_Error|Payone_Api_Response_Invalid
39
+ */
40
+ public function execute(Mage_Sales_Model_Order_Payment $payment, $amount = 0.00);
41
+ }
app/code/community/Payone/Core/Model/Service/Payment/Preauthorize.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Payment_Preauthorize
34
+ extends Payone_Core_Model_Service_Payment_Abstract
35
+ {
36
+ const EVENT_TYPE = 'preauthorization';
37
+
38
+ /** @var Payone_Api_Service_Payment_PreauthorizeInterface */
39
+ protected $serviceApiPayment = null;
40
+
41
+ /**
42
+ * @param Payone_Api_Request_Interface $request
43
+ * @return Payone_Api_Response_Error|Payone_Api_Response_Preauthorization_Approved|Payone_Api_Response_Preauthorization_Redirect
44
+ */
45
+ protected function perform(Payone_Api_Request_Interface $request)
46
+ {
47
+ return $this->getServiceApiPayment()->preauthorize($request);
48
+ }
49
+
50
+ /**
51
+ * @param Payone_Api_Service_Payment_PreauthorizeInterface $serviceApiPayment
52
+ */
53
+ public function setServiceApiPayment(Payone_Api_Service_Payment_PreauthorizeInterface $serviceApiPayment)
54
+ {
55
+ $this->serviceApiPayment = $serviceApiPayment;
56
+ }
57
+
58
+ /**
59
+ * @return Payone_Api_Service_Payment_PreauthorizeInterface
60
+ */
61
+ public function getServiceApiPayment()
62
+ {
63
+ return $this->serviceApiPayment;
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getEventType()
70
+ {
71
+ return self::EVENT_TYPE;
72
+ }
73
+ }
app/code/community/Payone/Core/Model/Service/Protocol/Api/Export.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Protocol_Api_Export
34
+ extends Payone_Core_Model_Service_Export_Collection
35
+ {
36
+ protected $columns = array(
37
+ 'id',
38
+ 'store_id',
39
+ 'reference',
40
+ 'request',
41
+ 'response',
42
+ 'mode',
43
+ 'mid',
44
+ 'portalid',
45
+ 'aid',
46
+ 'created_at',
47
+ 'raw_request',
48
+ 'raw_response',
49
+ );
50
+ }
app/code/community/Payone/Core/Model/Service/Protocol/TransactionStatus/Export.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Protocol_TransactionStatus_Export
34
+ extends Payone_Core_Model_Service_Export_Collection
35
+ {
36
+ protected $columns = array(
37
+ 'store_id',
38
+ 'order_id',
39
+ 'txid',
40
+ 'txtime',
41
+ 'reference',
42
+ 'key',
43
+ 'txaction',
44
+ 'mode',
45
+ 'mid',
46
+ 'aid',
47
+ 'portalid',
48
+ 'clearingtype',
49
+ 'sequencenumber',
50
+ 'balance',
51
+ 'receivable',
52
+ 'failedcause',
53
+ 'currency',
54
+ 'userid',
55
+ 'customerid',
56
+ 'param',
57
+ 'productid',
58
+ 'accessid',
59
+ 'reminderlevel',
60
+ 'invoiceid',
61
+ 'invoice_grossamount',
62
+ 'invoice_date',
63
+ 'invoice_deliverydate',
64
+ 'invoice_deliveryenddate',
65
+ 'vaid',
66
+ 'vreference',
67
+ 'vxid',
68
+ 'created_at',
69
+ 'updated_at',
70
+ 'processing_status',
71
+ 'processed_at'
72
+ );
73
+ }
app/code/community/Payone/Core/Model/Service/Sales/InvoiceCreate.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Sales_InvoiceCreate extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ /**
36
+ * @throws Payone_Core_Exception_OrderCannotInvoice|Payone_Core_Exception_OrderNotFound
37
+ * @param Mage_Sales_Model_Order $order
38
+ * @param array $itemsQty
39
+ * @param string $invoiceIncrementId
40
+ * @return Mage_Sales_Model_Order_Invoice
41
+ */
42
+ public function createByOrder(Mage_Sales_Model_Order $order, array $itemsQty = array(), $invoiceIncrementId = null)
43
+ {
44
+ $orderIncrementId = $order->getIncrementId();
45
+
46
+ if (!$order->getId()) {
47
+ throw new Payone_Core_Exception_OrderNotFound($orderIncrementId);
48
+ }
49
+
50
+ if (!$order->canInvoice()) {
51
+ throw new Payone_Core_Exception_OrderCannotInvoice($orderIncrementId);
52
+ }
53
+
54
+ return $this->create($order, $itemsQty, $invoiceIncrementId);
55
+ }
56
+
57
+ /**
58
+ * @throws Payone_Core_Exception_OrderCannotInvoice|Payone_Core_Exception_OrderNotFound
59
+ * @param string $orderIncrementId
60
+ * @param array $itemsQty
61
+ * @param string $invoiceIncrementId
62
+ * @return Mage_Sales_Model_Order_Invoice
63
+ */
64
+ public function createByOrderIncrementId($orderIncrementId, array $itemsQty = array(), $invoiceIncrementId = null)
65
+ {
66
+ /**
67
+ * @var $order Mage_Sales_Model_Order
68
+ */
69
+ $order = $this->getFactory()->getModelSalesOrder();
70
+ $order->loadByIncrementId($orderIncrementId);
71
+
72
+ if (!$order->getId()) {
73
+ throw new Payone_Core_Exception_OrderNotFound($orderIncrementId);
74
+ }
75
+
76
+ if (!$order->canInvoice()) {
77
+ throw new Payone_Core_Exception_OrderCannotInvoice($orderIncrementId);
78
+ }
79
+
80
+ return $this->create($order, $itemsQty, $invoiceIncrementId);
81
+ }
82
+
83
+ /**
84
+ * @throws Payone_Core_Exception_InvoicePreparationNoItems|Payone_Core_Exception_InvoiceSave
85
+ * @param Mage_Sales_Model_Order $order
86
+ * @param array $itemsQty
87
+ * @param null $invoiceIncrementId
88
+ * @return Mage_Sales_Model_Order_Invoice
89
+ */
90
+ protected function create(Mage_Sales_Model_Order $order, array $itemsQty = array(), $invoiceIncrementId = null)
91
+ {
92
+ /* @var $invoice Mage_Sales_Model_Order_Invoice */
93
+ $invoice = $order->prepareInvoice($itemsQty);
94
+
95
+ if ($invoiceIncrementId) {
96
+ $invoice->setIncrementId($invoiceIncrementId);
97
+ }
98
+
99
+ if (count($invoice->getAllItems()) <= 0) {
100
+ throw new Payone_Core_Exception_InvoicePreparationNoItems($order->getIncrementId());
101
+ }
102
+
103
+ if ($invoice) {
104
+ $invoice->register();
105
+ $invoice->setEmailSent(false);
106
+ $invoice->getOrder()->setIsInProcess(true);
107
+ try {
108
+ $transactionSave = $this->getFactory()->getModelResourceTransaction();
109
+ $transactionSave->addObject($invoice);
110
+ $transactionSave->addObject($invoice->getOrder());
111
+ $transactionSave->save();
112
+ } catch (Mage_Core_Exception $e) {
113
+ throw new Payone_Core_Exception_InvoiceSave($e->getMessage());
114
+ }
115
+ return $invoice;
116
+ }
117
+ return null;
118
+ }
119
+
120
+ }
app/code/community/Payone/Core/Model/Service/Sales/OrderComment.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Sales_OrderComment extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ /**
36
+ * @var Payone_Core_Model_Service_InitializeConfig
37
+ */
38
+ protected $serviceConfig = null;
39
+
40
+ /**
41
+ * @param Mage_Sales_Model_Order $order
42
+ * @param Payone_Api_Response_Interface $response
43
+ */
44
+ public function addByApiResponse(
45
+ Mage_Sales_Model_Order $order, Payone_Api_Response_Interface $response)
46
+ {
47
+ // Preauthorization
48
+ if ($response instanceof Payone_Api_Response_Preauthorization_Approved) {
49
+ $comment = 'PAYONE successfully processed the payment-request.';
50
+ }
51
+ // Authorization
52
+ elseif ($response instanceof Payone_Api_Response_Authorization_Approved) {
53
+ $comment = 'PAYONE successfully processed and confirmed the payment-request.';
54
+ }
55
+ // Redirects
56
+ elseif ($response instanceof Payone_Api_Response_Preauthorization_Redirect
57
+ or $response instanceof Payone_Api_Response_Authorization_Redirect
58
+ ) {
59
+ $comment = 'The payment-request has been forwarded.';
60
+ }
61
+ // Capture
62
+ elseif ($response instanceof Payone_Api_Response_Capture_Approved) {
63
+ $comment = 'PAYONE successfully processed the capture-request.';
64
+ }
65
+ // Debit
66
+ elseif ($response instanceof Payone_Api_Response_Debit_Approved) {
67
+ $comment = 'PAYONE successfully processed the debit-request.';
68
+ }
69
+ // Error
70
+ elseif ($response instanceof Payone_Api_Response_Error) {
71
+ $comment = 'The payment-request was incorrect. Please check the protocol.';
72
+ }
73
+ else {
74
+ $comment = $response->getStatus();
75
+ }
76
+
77
+ $this->addCommentToOrder($order, $comment);
78
+ }
79
+
80
+ /**
81
+ * @param Mage_Sales_Model_Order $order
82
+ * @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
83
+ */
84
+ public function addByTransactionStatus(
85
+ Mage_Sales_Model_Order $order, Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
86
+ )
87
+ {
88
+ if ($transactionStatus->isAppointed()) {
89
+ $comment = 'PAYONE accepted the payment-request.';
90
+ }
91
+ elseif ($transactionStatus->isCapture()) {
92
+ $comment = 'PAYONE confirmed the collection.';
93
+ }
94
+ elseif ($transactionStatus->isPaid()) {
95
+ $comment = 'PAYONE confirmed the payment receipt.';
96
+ }
97
+ elseif ($transactionStatus->isUnderpaid()) {
98
+ $comment = 'PAYONE confirmed the payment receipt. There is an underpayment.';
99
+ }
100
+ elseif ($transactionStatus->isCancelation()) {
101
+ $comment = 'The payment was rejected.';
102
+ }
103
+ elseif ($transactionStatus->isRefund()) {
104
+ $comment = 'PAYONE confirmed the credit.';
105
+ }
106
+ elseif ($transactionStatus->isDebit()) {
107
+ $comment = 'PAYONE confirmed the claim.';
108
+ }
109
+ elseif ($transactionStatus->isReminder()) {
110
+ $comment = 'The dunning status was updated, status is %s';
111
+ }
112
+ elseif ($transactionStatus->isTransfer()) {
113
+ $comment = 'Transactionstatus: transfer';
114
+ }
115
+ elseif ($transactionStatus->isVauthorization()) {
116
+ $comment = 'Transactionstatus: vauthorization';
117
+ }
118
+ elseif ($transactionStatus->isVsettlement()) {
119
+ $comment = 'Transactionstatus: vsettlement';
120
+ }
121
+ elseif ($transactionStatus->isInvoice()) {
122
+ $comment = 'Transactionstatus: invoice';
123
+ }
124
+ else {
125
+ $comment = $transactionStatus->getTxaction();
126
+ }
127
+
128
+ $this->addCommentToOrder($order, $comment);
129
+ }
130
+
131
+ /**
132
+ * @param Mage_Sales_Model_Order $order
133
+ * @param string $comment
134
+ * @return Mage_Sales_Model_Order_Status_History
135
+ */
136
+ protected function addCommentToOrder(Mage_Sales_Model_Order $order, $comment)
137
+ {
138
+ $comment = $this->helper()->__($comment);
139
+
140
+ return $order->addStatusHistoryComment($comment);
141
+ }
142
+
143
+ }
app/code/community/Payone/Core/Model/Service/Sales/OrderStatus.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Sales_OrderStatus extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ public function updateByTransactionStatus(
36
+ Mage_Sales_Model_Order $order, Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
37
+ )
38
+ {
39
+ // Update Status of Transaction
40
+ $order->setPayoneTransactionStatus($transactionStatus->getTxaction());
41
+
42
+ // Update dunning status
43
+ if($transactionStatus->getReminderlevel()){
44
+ $order->setPayoneDunningStatus($transactionStatus->getReminderlevel());
45
+ }
46
+
47
+ // Status mapping of Order by Transaction Status
48
+ $statusMapping = $this->getConfigStore()->getGeneral()->getStatusMapping();
49
+
50
+ $txAction = $transactionStatus->getTxaction();
51
+ /**
52
+ * @var $paymentMethod Payone_Core_Model_Payment_Method_Abstract
53
+ */
54
+ $paymentMethod = $order->getPayment()->getMethodInstance();
55
+ $type = $paymentMethod->getMethodType();
56
+
57
+ $mapping = $statusMapping->getByType($type);
58
+
59
+ if (!array_key_exists($txAction, $mapping)) {
60
+ return;
61
+ }
62
+
63
+ $newOrderStatus = $mapping[$txAction];
64
+
65
+ $order->setStatus($newOrderStatus);
66
+ }
67
+
68
+ /**
69
+ * @param Mage_Sales_Model_Order $order
70
+ * @param Payone_Api_Response_Interface $response
71
+ */
72
+ public function updateByApiResponse(
73
+ Mage_Sales_Model_Order $order, Payone_Api_Response_Interface $response
74
+ )
75
+ {
76
+ $order->setPayoneTransactionStatus($response->getStatus());
77
+ }
78
+
79
+ }
app/code/community/Payone/Core/Model/Service/Transaction/Create.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Transaction_Create extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ /**
36
+ * @param Mage_Sales_Model_Order $order
37
+ * @param Payone_Api_Response_Interface $response
38
+ * @param Payone_Api_Request_Interface $request
39
+ * @throws Payone_Core_Exception_TransactionAlreadyExists
40
+ * @return null|Payone_Core_Model_Domain_Transaction
41
+ */
42
+ public function createByApiResponse(
43
+ Mage_Sales_Model_Order $order, Payone_Api_Response_Interface $response,
44
+ Payone_Api_Request_Interface $request
45
+ )
46
+ {
47
+ $transaction = $this->getFactory()->getModelTransaction();
48
+ $transaction->load($response->getTxid(), 'txid'); // should not exist but to be sure load by txid
49
+ if ($transaction->hasData()) {
50
+ throw new Payone_Core_Exception_TransactionAlreadyExists($response->getTxid());
51
+ }
52
+
53
+ $transaction->setTxid($response->getTxid());
54
+ $transaction->setLastTxaction($response->getStatus());
55
+ $transaction->setUserid($response->getUserid());
56
+
57
+ $transaction->setStoreId($order->getStoreId());
58
+ $transaction->setOrderId($order->getId());
59
+ $transaction->setReference($order->getIncrementId());
60
+ $transaction->setCurrency($order->getOrderCurrencyCode());
61
+ $transaction->setCustomerId($order->getCustomerId());
62
+ $transaction->setClearingtype($request->getClearingtype());
63
+ $transaction->setMode($request->getMode());
64
+ $transaction->setMid($request->getMid());
65
+ $transaction->setAid($request->getAid());
66
+ $transaction->setPortalid($request->getPortalid());
67
+ $transaction->setLastSequencenumber(0);
68
+
69
+ $data = $response->toArray();
70
+
71
+ $transaction->addData($data);
72
+ $transaction->save();
73
+
74
+ return $transaction;
75
+ }
76
+
77
+ }
app/code/community/Payone/Core/Model/Service/Transaction/Update.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Transaction_Update extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ /**
36
+ * @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
37
+ * @return Payone_Core_Model_Domain_Transaction
38
+ */
39
+ public function updateByTransactionStatus(Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
40
+ {
41
+ $transaction = $this->getFactory()->getModelTransaction();
42
+ $transaction->load($transactionStatus->getTxid(), 'txid');
43
+
44
+ $data = $transactionStatus->getData();
45
+ unset($data['id']);
46
+ unset($data['created_at']);
47
+ unset($data['updated_at']);
48
+ unset($data['processed_at']);
49
+ unset($data['processing_status']);
50
+
51
+ $transaction->setLastTxaction($transactionStatus->getTxaction());
52
+ $transaction->setLastSequencenumber($transactionStatus->getSequencenumber());
53
+
54
+ $transaction->addData($data);
55
+ $transaction->save();
56
+
57
+ return $transaction;
58
+ }
59
+
60
+ /**
61
+ * @param Payone_Api_Response_Interface $response
62
+ * @return Payone_Core_Model_Domain_Transaction
63
+ */
64
+ public function updateByApiResponse(Payone_Api_Response_Interface $response)
65
+ {
66
+ $transaction = $this->getFactory()->getModelTransaction();
67
+ $transaction->load($response->getTxid(), 'txid'); // should not exist but to be sure load by txid
68
+
69
+ $transaction->setLastTxaction($response->getStatus());
70
+
71
+ $transaction->save();
72
+
73
+ return $transaction;
74
+ }
75
+
76
+ }
app/code/community/Payone/Core/Model/Service/TransactionStatus/Execute.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_TransactionStatus_Execute extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ const MAX_EXECUTION_TIME = 30;
36
+ /**
37
+ * @var int
38
+ */
39
+ protected $maxExecutionTime;
40
+ /**
41
+ * @var Payone_Core_Model_Service_TransactionStatus_Process
42
+ */
43
+ protected $serviceProcess = null;
44
+
45
+ /**
46
+ * @return int
47
+ */
48
+ public function executePending()
49
+ {
50
+ /** @var $collection Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection */
51
+ $collection = $this->getFactory()->getModelTransactionStatus()->getCollection();
52
+
53
+ $startTime = time();
54
+ $continue = true;
55
+ $countExecuted = 0;
56
+ $maxExecutionTime = $this->getMaxExecutionTime() ? $this->getMaxExecutionTime() : self::MAX_EXECUTION_TIME;
57
+ while (((time() - $startTime) < $maxExecutionTime) && ($continue)) {
58
+ // Get next pending TransactionStatus
59
+ $transactionStatus = $collection->getNextPending();
60
+
61
+ // Execute
62
+ if ($transactionStatus) {
63
+ $this->execute($transactionStatus);
64
+ $countExecuted++;
65
+ }
66
+ else {
67
+ $continue = false;
68
+ }
69
+ }
70
+
71
+ return $countExecuted;
72
+ }
73
+
74
+ /**
75
+ * @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
76
+ */
77
+ public function execute(Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
78
+ {
79
+ $storeId = $transactionStatus->getStoreId();
80
+
81
+ $storeBefore = $this->getApp()->getStore();
82
+ $areaBefore = $this->getDesign()->getArea();
83
+
84
+ // Set Store
85
+ $store = $this->getApp()->getStore($storeId);
86
+ $this->getApp()->setCurrentStore($store);
87
+
88
+ // Load Area to get Translation
89
+ $this->getApp()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND, Mage_Core_Model_App_Area::PART_TRANSLATE);
90
+ $this->getApp()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND, Mage_Core_Model_App_Area::PART_DESIGN);
91
+
92
+ $transactionStatus->setStatusRunning();
93
+ $transactionStatus->save();
94
+
95
+ $this->getServiceProcess()->execute($transactionStatus);
96
+
97
+ $transactionStatus->setProcessedAt(date('Y-m-d H:i:s'));
98
+ $transactionStatus->setStatusOk();
99
+ $transactionStatus->save();
100
+
101
+ // Reset Store
102
+ $this->getApp()->setCurrentStore($storeBefore);
103
+
104
+ // Reset Area to old Area
105
+ $this->getDesign()->setArea($areaBefore);
106
+ $this->getApp()->loadArea($areaBefore);
107
+ }
108
+
109
+ /**
110
+ * @return Mage_Core_Model_App
111
+ */
112
+ protected function getApp()
113
+ {
114
+ return Mage::app();
115
+ }
116
+
117
+ /**
118
+ * @return Mage_Core_Model_Design_Package
119
+ */
120
+ protected function getDesign()
121
+ {
122
+ return Mage::getDesign();
123
+ }
124
+
125
+
126
+ /**
127
+ * @param Payone_Core_Model_Service_TransactionStatus_Process $serviceProcess
128
+ */
129
+ public function setServiceProcess(Payone_Core_Model_Service_TransactionStatus_Process $serviceProcess)
130
+ {
131
+ $this->serviceProcess = $serviceProcess;
132
+ }
133
+
134
+ /**
135
+ * @return Payone_Core_Model_Service_TransactionStatus_Process
136
+ */
137
+ public function getServiceProcess()
138
+ {
139
+ return $this->serviceProcess;
140
+ }
141
+
142
+ /**
143
+ * @param int $maxExecutionTime Define how long the service executes pending transactionStatus (in seconds)
144
+ */
145
+ public function setMaxExecutionTime($maxExecutionTime)
146
+ {
147
+ $this->maxExecutionTime = $maxExecutionTime;
148
+ }
149
+
150
+ /**
151
+ * @return int Maximum execution time in seconds
152
+ */
153
+ public function getMaxExecutionTime()
154
+ {
155
+ return $this->maxExecutionTime;
156
+ }
157
+ }
app/code/community/Payone/Core/Model/Service/TransactionStatus/Forward.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_TransactionStatus_Forward extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ const DEFAULT_TIMEOUT = 15;
36
+ /**
37
+ * @var Payone_Core_Model_Config_Misc_TransactionstatusForwarding
38
+ */
39
+ protected $configForwarding = null;
40
+
41
+ /**
42
+ * @var Varien_Http_Client
43
+ */
44
+ protected $httpClient = null;
45
+
46
+ protected $allowedKeys = array(
47
+ 'txid',
48
+ 'txtime',
49
+ 'reference',
50
+ 'key',
51
+ 'txaction',
52
+ 'mode',
53
+ 'mid',
54
+ 'aid',
55
+ 'portalid',
56
+ 'clearingtype',
57
+ 'sequencenumber',
58
+ 'balance',
59
+ 'receivable',
60
+ 'failedcause',
61
+ 'currency',
62
+ 'userid',
63
+ 'customerid',
64
+ 'param',
65
+ 'productid',
66
+ 'accessid',
67
+ 'reminderlevel',
68
+ 'invoiceid',
69
+ 'invoice_grossamount',
70
+ 'invoice_date',
71
+ 'invoice_deliverydate',
72
+ 'invoice_deliveryenddate',
73
+ 'vaid',
74
+ 'vreference',
75
+ 'vxid',
76
+ );
77
+
78
+ /**
79
+ * @var array
80
+ */
81
+ protected $exceptions = array();
82
+
83
+ /**
84
+ * @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
85
+ * @return bool
86
+ */
87
+ public function forward(Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
88
+ {
89
+ $currentTxAction = $transactionStatus->getTxaction();
90
+ $config = $this->getConfigForwarding()->getConfig($currentTxAction);
91
+
92
+ foreach ($config as $configHost) {
93
+ $response = $this->forwardToHost($configHost, $transactionStatus);
94
+ }
95
+
96
+ if ($this->hasExceptions()) {
97
+ return false;
98
+ }
99
+ return true;
100
+ }
101
+
102
+ public function forwardToHost(
103
+ array $configHost,
104
+ Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
105
+ )
106
+ {
107
+ $url = '';
108
+ $response = '';
109
+
110
+ try {
111
+ if (!array_key_exists('url', $configHost)) {
112
+ throw new Payone_Core_Exception_TransactionStatusForward('Missing Url');
113
+ }
114
+ $url = $configHost['url'];
115
+
116
+ $timeout = self::DEFAULT_TIMEOUT;
117
+ if (array_key_exists('timeout', $configHost)) {
118
+ $timeout = $configHost['timeout'];
119
+ }
120
+
121
+ $parameters = $transactionStatus->toArray($this->allowedKeys);
122
+
123
+ $configClient = array(
124
+ 'timeout' => $timeout,
125
+ );
126
+
127
+ $httpClient = $this->getHttpClient();
128
+ $httpClient->setUri($url);
129
+ $httpClient->setConfig($configClient);
130
+ $httpClient->setMethod(Varien_Http_Client::POST);
131
+ $httpClient->setParameterPost($parameters);
132
+ $response = $httpClient->request();
133
+
134
+ if ($response !== 'TSOK') {
135
+ throw new Payone_Core_Exception_TransactionStatusForward($response);
136
+ }
137
+ } catch (Exception $e) {
138
+ $this->addForwardException($url, $e);
139
+ }
140
+ return $response;
141
+ }
142
+
143
+ /**
144
+ * @param Payone_Core_Model_Config_Misc_TransactionstatusForwarding $config
145
+ */
146
+ public function setConfigForwarding(Payone_Core_Model_Config_Misc_TransactionstatusForwarding $config)
147
+ {
148
+ $this->configForwarding = $config;
149
+ }
150
+
151
+ /**
152
+ * @return Payone_Core_Model_Config_Misc_TransactionstatusForwarding
153
+ */
154
+ public function getConfigForwarding()
155
+ {
156
+ return $this->configForwarding;
157
+ }
158
+
159
+ /**
160
+ * @param string $url
161
+ * @param Exception $e
162
+ */
163
+ protected function addForwardException($url, Exception $e)
164
+ {
165
+ $this->exceptions[$url] = $e;
166
+ }
167
+
168
+ /**
169
+ * @return bool
170
+ */
171
+ public function hasExceptions()
172
+ {
173
+ if (count($this->getExceptions())) {
174
+ return true;
175
+ }
176
+ return false;
177
+ }
178
+
179
+ /**
180
+ * @return array
181
+ */
182
+ public function getExceptions()
183
+ {
184
+ return $this->exceptions;
185
+ }
186
+
187
+ /**
188
+ * @param Varien_Http_Client $httpClient
189
+ */
190
+ public function setHttpClient(Varien_Http_Client $httpClient)
191
+ {
192
+ $this->httpClient = $httpClient;
193
+ }
194
+
195
+ /**
196
+ * @return Varien_Http_Client
197
+ */
198
+ public function getHttpClient()
199
+ {
200
+ return $this->httpClient;
201
+ }
202
+
203
+ }
app/code/community/Payone/Core/Model/Service/TransactionStatus/Process.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_TransactionStatus_Process extends Payone_Core_Model_Service_Abstract
34
+ {
35
+ const EVENT_NAME_PREFIX = 'payone_core_transactionstatus_';
36
+ const EVENT_NAME_ALL = 'all';
37
+
38
+ const EVENT_PARAMETER_TRANSACTION = 'transaction';
39
+ const EVENT_PARAMETER_TRANSACTIONSTATUS = 'transaction_status';
40
+ const EVENT_PARAMETER_CONFIG = 'config';
41
+
42
+ /**
43
+ * @var Payone_Core_Model_Service_Transaction_Update
44
+ */
45
+ protected $serviceTransaction = null;
46
+
47
+ /**
48
+ * @var Payone_Core_Model_Service_Sales_OrderStatus
49
+ */
50
+ protected $serviceOrderStatus = null;
51
+
52
+ /**
53
+ * @var Payone_Core_Model_Service_Sales_OrderComment
54
+ */
55
+ protected $serviceOrderComment = null;
56
+
57
+ /**
58
+ * @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
59
+ * @throws Payone_Core_Exception_OrderNotFound
60
+ */
61
+ public function execute(Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
62
+ {
63
+ $order = $this->getFactory()->getModelSalesOrder();
64
+ $order->loadByIncrementId($transactionStatus->getReference());
65
+
66
+ if (!$order->hasData()) {
67
+ throw new Payone_Core_Exception_OrderNotFound();
68
+ }
69
+
70
+ $config = $this->helperConfig()->getConfigStore($order->getStoreId());
71
+
72
+ $transactionStatus->setStoreId($order->getStoreId());
73
+ $transactionStatus->setOrderId($order->getId());
74
+
75
+ // Update Transaction
76
+ $transaction = $this->getServiceTransaction()->updateByTransactionStatus($transactionStatus);
77
+
78
+ // Update Order Status
79
+ $this->getServiceOrderStatus()->setConfigStore($config);
80
+ $this->getServiceOrderStatus()->updateByTransactionStatus($order, $transactionStatus);
81
+
82
+ // Add Order Comment
83
+ $this->getServiceOrderComment()->addByTransactionStatus($order, $transactionStatus);
84
+
85
+ // Save before Event is triggerd
86
+ $resouce = $this->getFactory()->getModelResourceTransaction();
87
+ $resouce->addObject($order);
88
+ $resouce->addObject($transactionStatus);
89
+ $resouce->save();
90
+
91
+ // Trigger Event
92
+ $params = array(
93
+ self::EVENT_PARAMETER_TRANSACTIONSTATUS => $transactionStatus,
94
+ self::EVENT_PARAMETER_TRANSACTION => $transaction,
95
+ self::EVENT_PARAMETER_CONFIG => $config,
96
+ );
97
+ $this->dispatchEvent(self::EVENT_NAME_PREFIX . self::EVENT_NAME_ALL, $params);
98
+ $this->dispatchEvent(self::EVENT_NAME_PREFIX . $transactionStatus->getTxaction(), $params);
99
+ }
100
+
101
+ /**
102
+ * @param $name
103
+ * @param array $data
104
+ *
105
+ * @return Mage_Core_Model_App
106
+ */
107
+ protected function dispatchEvent($name, array $data = array())
108
+ {
109
+ return Mage::dispatchEvent($name, $data);
110
+ }
111
+
112
+ /**
113
+ * @param Payone_Core_Model_Service_Sales_OrderStatus $service
114
+ */
115
+ public function setServiceOrderStatus(Payone_Core_Model_Service_Sales_OrderStatus $service)
116
+ {
117
+ $this->serviceOrderStatus = $service;
118
+ }
119
+
120
+ /**
121
+ * @return Payone_Core_Model_Service_Sales_OrderStatus
122
+ */
123
+ public function getServiceOrderStatus()
124
+ {
125
+ return $this->serviceOrderStatus;
126
+ }
127
+
128
+ /**
129
+ * @param Payone_Core_Model_Service_Sales_OrderComment $service
130
+ */
131
+ public function setServiceOrderComment(Payone_Core_Model_Service_Sales_OrderComment $service)
132
+ {
133
+ $this->serviceOrderComment = $service;
134
+ }
135
+
136
+ /**
137
+ * @return Payone_Core_Model_Service_Sales_OrderComment
138
+ */
139
+ public function getServiceOrderComment()
140
+ {
141
+ return $this->serviceOrderComment;
142
+ }
143
+
144
+ /**
145
+ * @param Payone_Core_Model_Service_Transaction_Update $serviceTransaction
146
+ */
147
+ public function setServiceTransaction(Payone_Core_Model_Service_Transaction_Update $serviceTransaction)
148
+ {
149
+ $this->serviceTransaction = $serviceTransaction;
150
+ }
151
+
152
+ /**
153
+ * @return Payone_Core_Model_Service_Transaction_Update
154
+ */
155
+ public function getServiceTransaction()
156
+ {
157
+ return $this->serviceTransaction;
158
+ }
159
+
160
+ }
app/code/community/Payone/Core/Model/Service/Verification/Abstract.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_Service_Verification_Abstract
34
+ extends Payone_Core_Model_Service_Abstract
35
+ {
36
+ protected $prefix = 'abstract';
37
+
38
+ /**
39
+ * @param Mage_Customer_Model_Address_Abstract $address
40
+ * @return bool
41
+ */
42
+ protected function addressHasChanged(Mage_Customer_Model_Address_Abstract $address)
43
+ {
44
+ $hashSaved = $address->getData($this->prefix . '_hash');
45
+ $hashNew = $this->helper()->createAddressHash($address);
46
+
47
+ if ($hashNew === $hashSaved) {
48
+ return false;
49
+ }
50
+ else {
51
+ return true;
52
+ }
53
+ }
54
+
55
+
56
+ /**
57
+ * Retrieve saved score if:
58
+ * - It exists
59
+ * - It is not expired
60
+ * - The address has not changed
61
+ *
62
+ * @param Mage_Customer_Model_Address_Abstract $address
63
+ * @param int $validityInSeconds maximum validity period / lifetime of the saved score
64
+ *
65
+ * @return bool|string score (G,Y,R) on success, false otherwise
66
+ */
67
+ protected function getSavedScore(Mage_Customer_Model_Address_Abstract $address, $validityInSeconds)
68
+ {
69
+ // 1. check address:
70
+ $savedScore = $this->checkAddress($address, $validityInSeconds);
71
+
72
+ if ($savedScore) {
73
+ return $savedScore;
74
+ }
75
+
76
+ // Nothing saved on address, see if there is a saved customer address that has the value:
77
+ $customerAddressId = $address->getCustomerAddressId();
78
+ if (empty($customerAddressId)) {
79
+ return false;
80
+ }
81
+ $customerAddress = $this->getFactory()->getModelCustomerAddress();
82
+ $customerAddress->load($customerAddressId);
83
+
84
+ // Verify the addresses are the same (customer address might have changed since last check), and that the saved hash is still valid for it´ address:
85
+ $helper = $this->helper();
86
+ $customerAddressHash = $helper->createAddressHash($customerAddress);
87
+ $currentAddressHash = $helper->createAddressHash($address);
88
+ if ($customerAddressHash !== $currentAddressHash) {
89
+ return false;
90
+ }
91
+
92
+ // Run the check on the customer address:
93
+ return $this->checkAddress($customerAddress, $validityInSeconds);
94
+ }
95
+
96
+ protected function checkAddress(Mage_Customer_Model_Address_Abstract $address, $validityInSeconds)
97
+ {
98
+ if (!$address->hasData()) {
99
+ return false;
100
+ }
101
+
102
+ $savedDate = $address->getData($this->prefix . '_date');
103
+ $savedScore = $address->getData($this->prefix . '_score');
104
+ if (empty($savedDate) or empty($savedScore)) {
105
+ return false;
106
+ }
107
+
108
+
109
+ if ($this->addressHasChanged($address)) {
110
+ return false;
111
+ }
112
+
113
+ // Verify the validity period is not expired:
114
+ if (!$this->helper()->isDateStillValid($savedDate, $validityInSeconds)) {
115
+ return false;
116
+ }
117
+
118
+ $address->setData($this->prefix . '_score', $savedScore);
119
+ return $savedScore;
120
+ }
121
+ }
app/code/community/Payone/Core/Model/Service/Verification/AddressCheck.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Verification_AddressCheck
34
+ extends Payone_Core_Model_Service_Verification_Abstract
35
+ {
36
+ protected $prefix = 'payone_addresscheck';
37
+
38
+ /** @var Payone_Api_Service_Verification_AddressCheck */
39
+ protected $serviceApiAddressCheck = null;
40
+
41
+ /** @var Payone_Core_Model_Mapper_ApiRequest_Verification_AddressCheck */
42
+ protected $mapper = null;
43
+
44
+ /** @var Payone_Core_Model_Handler_Verification_AddressCheck */
45
+ protected $handler = null;
46
+
47
+ /** @var Payone_Core_Model_Config_Protect_AddressCheck */
48
+ protected $config = null;
49
+
50
+ /**
51
+ * @param Mage_Customer_Model_Address_Abstract $address
52
+ * @param Varien_Object $errors
53
+ *
54
+ * @return Payone_Api_Response_AddressCheck_Invalid|Payone_Api_Response_AddressCheck_Valid|Payone_Api_Response_Error
55
+ */
56
+ public function execute(Mage_Customer_Model_Address_Abstract $address, Varien_Object $errors)
57
+ {
58
+ $handler = $this->getHandler();
59
+ $handler->setAddress($address);
60
+ $handler->setErrors($errors);
61
+
62
+ if ($this->getSavedScore($address, $this->getConfig()->getResultLifetimeInSeconds())) {
63
+ // Valid, saved score exists, we can skip the API request.
64
+ return;
65
+ }
66
+
67
+ $request = $this->getMapper()->mapFromAddress($address);
68
+
69
+ try {
70
+ $response = $this->getServiceApiAddressCheck()->check($request);
71
+ $handler->handle($response);
72
+ }
73
+ catch (Exception $ex) {
74
+ $handler->handleException($ex);
75
+ }
76
+ }
77
+
78
+
79
+ /**
80
+ * @param Payone_Api_Service_Verification_AddressCheck $serviceApiAddressCheck
81
+ */
82
+ public function setServiceApiAddressCheck(Payone_Api_Service_Verification_AddressCheck $serviceApiAddressCheck)
83
+ {
84
+ $this->serviceApiAddressCheck = $serviceApiAddressCheck;
85
+ }
86
+
87
+ /**
88
+ * @return Payone_Api_Service_Verification_AddressCheck
89
+ */
90
+ public function getServiceApiAddressCheck()
91
+ {
92
+ return $this->serviceApiAddressCheck;
93
+ }
94
+
95
+ /**
96
+ * @param Payone_Core_Model_Mapper_ApiRequest_Verification_AddressCheck $mapper
97
+ */
98
+ public function setMapper(Payone_Core_Model_Mapper_ApiRequest_Verification_AddressCheck $mapper)
99
+ {
100
+ $this->mapper = $mapper;
101
+ }
102
+
103
+ /**
104
+ * @return Payone_Core_Model_Mapper_ApiRequest_Verification_AddressCheck
105
+ */
106
+ public function getMapper()
107
+ {
108
+ return $this->mapper;
109
+ }
110
+
111
+ /**
112
+ * @param Payone_Core_Model_Handler_Verification_AddressCheck $handler
113
+ */
114
+ public function setHandler(Payone_Core_Model_Handler_Verification_AddressCheck $handler)
115
+ {
116
+ $this->handler = $handler;
117
+ }
118
+
119
+ /**
120
+ * @return Payone_Core_Model_Handler_Verification_AddressCheck
121
+ */
122
+ public function getHandler()
123
+ {
124
+ return $this->handler;
125
+ }
126
+
127
+ /**
128
+ * @param Payone_Core_Model_Config_Protect_AddressCheck $config
129
+ */
130
+ public function setConfig(Payone_Core_Model_Config_Protect_AddressCheck $config)
131
+ {
132
+ $this->config = $config;
133
+ }
134
+
135
+ /**
136
+ * @return Payone_Core_Model_Config_Protect_AddressCheck
137
+ */
138
+ public function getConfig()
139
+ {
140
+ return $this->config;
141
+ }
142
+
143
+ }
app/code/community/Payone/Core/Model/Service/Verification/BankAccountCheck.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Verification_BankAccountCheck
34
+ extends Payone_Core_Model_Service_Verification_Abstract
35
+ {
36
+ /** @var Payone_Api_Service_Verification_BankAccountCheck */
37
+ protected $serviceApiBankAccountCheck = null;
38
+
39
+ /** @var Payone_Core_Model_Mapper_ApiRequest_Verification_BankAccountCheck */
40
+ protected $mapper = null;
41
+
42
+ /** @var Payone_Core_Model_Config_Payment_Method_Interface */
43
+ protected $configPayment = null;
44
+
45
+ /**
46
+ * @param $bankaccount
47
+ * @param $bankcode
48
+ * @param $bankcountry
49
+ *
50
+ * @return void
51
+ * @throws Mage_Core_Exception
52
+ */
53
+ public function execute($bankaccount, $bankcode, $bankcountry)
54
+ {
55
+ $request = $this->getMapper()->map($bankaccount, $bankcode, $bankcountry);
56
+
57
+ $response = $this->getServiceApiBankAccountCheck()->check($request);
58
+
59
+ // Response handling:
60
+ if ($response instanceof Payone_Api_Response_BankAccountCheck_Valid) {
61
+ return;
62
+ }
63
+ elseif ($response instanceof Payone_Api_Response_BankAccountCheck_Blocked) {
64
+ throw new Mage_Core_Exception($this->getMessageForInvalidData());
65
+ }
66
+ elseif ($response instanceof Payone_Api_Response_BankAccountCheck_Invalid) {
67
+ throw new Mage_Core_Exception($response->getCustomermessage());
68
+ }
69
+ elseif ($response instanceof Payone_Api_Response_Error) {
70
+ throw new Mage_Core_Exception($response->getCustomermessage());
71
+ }
72
+ }
73
+
74
+ /**
75
+ * @param Mage_Sales_Model_Quote_Payment $payment
76
+ * @return void
77
+ */
78
+ public function executeByPayment(Mage_Sales_Model_Quote_Payment $payment)
79
+ {
80
+ $bankaccount = $payment->getPayoneAccountNumber();
81
+ $bankcode = $payment->getPayoneBankCode();
82
+ $bankcountry = $payment->getPayoneBankCountry();
83
+ if (empty($bankcountry)) {
84
+ $bankcountry = $payment->getQuote()->getBillingAddress()->getCountry();
85
+ }
86
+
87
+ $this->execute($bankaccount, $bankcode, $bankcountry);
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ protected function getMessageForInvalidData()
94
+ {
95
+
96
+ $message = $this->getConfigPayment()->getMessageResponseBlocked();
97
+
98
+ if (empty($message)) {
99
+ $message = $this->helper()->__('There has been an error procesing your payment.');
100
+ }
101
+
102
+ return $message;
103
+ }
104
+
105
+
106
+ /**
107
+ * @param Payone_Api_Service_Verification_BankAccountCheck $serviceApiBankAccountCheck
108
+ */
109
+ public function setServiceApiBankAccountCheck(Payone_Api_Service_Verification_BankAccountCheck $serviceApiBankAccountCheck)
110
+ {
111
+ $this->serviceApiBankAccountCheck = $serviceApiBankAccountCheck;
112
+ }
113
+
114
+ /**
115
+ * @return Payone_Api_Service_Verification_BankAccountCheck
116
+ */
117
+ public function getServiceApiBankAccountCheck()
118
+ {
119
+ return $this->serviceApiBankAccountCheck;
120
+ }
121
+
122
+ /**
123
+ * @param Payone_Core_Model_Mapper_ApiRequest_Verification_BankAccountCheck $mapper
124
+ */
125
+ public function setMapper(Payone_Core_Model_Mapper_ApiRequest_Verification_BankAccountCheck $mapper)
126
+ {
127
+ $this->mapper = $mapper;
128
+ }
129
+
130
+ /**
131
+ * @return Payone_Core_Model_Mapper_ApiRequest_Verification_BankAccountCheck
132
+ */
133
+ public function getMapper()
134
+ {
135
+ return $this->mapper;
136
+ }
137
+
138
+ /**
139
+ * @param Payone_Core_Model_Config_Payment_Method_Interface $configPayment (config for debit_payment)
140
+ */
141
+ public function setConfigPayment(Payone_Core_Model_Config_Payment_Method_Interface $configPayment)
142
+ {
143
+ $this->configPayment = $configPayment;
144
+ }
145
+
146
+ /**
147
+ * @return \Payone_Core_Model_Config_Payment_Method_Interface
148
+ */
149
+ public function getConfigPayment()
150
+ {
151
+ return $this->configPayment;
152
+ }
153
+ }
app/code/community/Payone/Core/Model/Service/Verification/Creditrating.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage Service
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage Service
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_Service_Verification_Creditrating
34
+ extends Payone_Core_Model_Service_Verification_Abstract
35
+ {
36
+ protected $prefix = 'payone_protect';
37
+
38
+ /** @var Payone_Api_Service_Verification_Consumerscore */
39
+ protected $serviceApiConsumerScore = null;
40
+
41
+ /** @var Payone_Core_Model_Mapper_ApiRequest_Verification_Creditrating */
42
+ protected $mapper = null;
43
+
44
+ /** @var Payone_Core_Model_Config_Protect_Creditrating */
45
+ protected $config = null;
46
+
47
+
48
+ /** @var Payone_Core_Model_Handler_Verification_Creditrating */
49
+ protected $handler = null;
50
+
51
+ /**
52
+ * @param Mage_Sales_Model_Quote $quote
53
+ * @return array|bool array of payment method codes, or true if check not required
54
+ */
55
+ public function execute(Mage_Sales_Model_Quote $quote)
56
+ {
57
+ $config = $this->getConfig();
58
+ if (!$config->getEnabled()) {
59
+ return true;
60
+ }
61
+
62
+ if ($this->isRequiredForQuote($quote) === false) {
63
+ return true;
64
+ }
65
+
66
+ if (!$this->haveToTakeSample($quote->getStoreId())) {
67
+ return true;
68
+ }
69
+
70
+ $address = $quote->getBillingAddress();
71
+ $handler = $this->getHandler();
72
+ $handler->setAddress($address);
73
+ $configStore = $this->helperConfig()->getConfigStore($quote->getStoreId());
74
+ $handler->setConfigStore($configStore);
75
+
76
+ $savedProtectScore = $this->getSavedScore($address, $config->getResultLifetimeInSeconds());
77
+ if ($savedProtectScore) {
78
+ // Valid, saved score exists, we can skip the API request:
79
+ return $handler->handleProtectScore($savedProtectScore);
80
+ }
81
+
82
+ $request = $this->getMapper()->mapFromAddress($address);
83
+
84
+
85
+ try {
86
+ $response = $this->getServiceApiConsumerScore()->score($request);
87
+
88
+ $result = $handler->handle($response);
89
+ }
90
+ catch (Exception $ex) {
91
+ $result = $handler->handleException($ex);
92
+ }
93
+ return $result;
94
+
95
+ }
96
+
97
+ /**
98
+ * @param Mage_Sales_Model_Quote $quote
99
+ * @return bool
100
+ */
101
+ protected function isRequiredForQuote(Mage_Sales_Model_Quote $quote)
102
+ {
103
+ $config = $this->getConfig();
104
+ $quoteTotal = $quote->getSubtotal();
105
+
106
+ /** @var $method Payone_Core_Model_Config_Payment_Method_Interface */
107
+ $maxOrderTotal = $config->getMaxOrderTotal();
108
+ $minOrderTotal = $config->getMinOrderTotal();
109
+
110
+ if (!empty($maxOrderTotal) and $maxOrderTotal < $quoteTotal) {
111
+ return false; // quote total too high.
112
+ }
113
+
114
+ if (!empty($minOrderTotal) and $minOrderTotal > $quoteTotal) {
115
+ return false; // quote total is too low.
116
+ }
117
+ return true;
118
+ }
119
+
120
+ /**
121
+ * @param Payone_Api_Service_Verification_Consumerscore $serviceApiConsumerScore
122
+ */
123
+ public function setServiceApiConsumerScore(Payone_Api_Service_Verification_Consumerscore $serviceApiConsumerScore)
124
+ {
125
+ $this->serviceApiConsumerScore = $serviceApiConsumerScore;
126
+ }
127
+
128
+ /**
129
+ * @return Payone_Api_Service_Verification_Consumerscore
130
+ */
131
+ public function getServiceApiConsumerScore()
132
+ {
133
+ return $this->serviceApiConsumerScore;
134
+ }
135
+
136
+ /**
137
+ * @param Payone_Core_Model_Mapper_ApiRequest_Verification_Creditrating $mapper
138
+ */
139
+ public function setMapper(Payone_Core_Model_Mapper_ApiRequest_Verification_Creditrating $mapper)
140
+ {
141
+ $this->mapper = $mapper;
142
+ }
143
+
144
+ /**
145
+ * @return Payone_Core_Model_Mapper_ApiRequest_Verification_Creditrating
146
+ */
147
+ public function getMapper()
148
+ {
149
+ return $this->mapper;
150
+ }
151
+
152
+ /**
153
+ * @param Payone_Core_Model_Handler_Verification_Creditrating $handler
154
+ */
155
+ public function setHandler(Payone_Core_Model_Handler_Verification_Creditrating $handler)
156
+ {
157
+ $this->handler = $handler;
158
+ }
159
+
160
+ /**
161
+ * @return Payone_Core_Model_Handler_Verification_Creditrating
162
+ */
163
+ public function getHandler()
164
+ {
165
+ return $this->handler;
166
+ }
167
+
168
+ /**
169
+ * @param Payone_Core_Model_Config_Protect_Creditrating $config
170
+ */
171
+ public function setConfig(Payone_Core_Model_Config_Protect_Creditrating $config)
172
+ {
173
+ $this->config = $config;
174
+ }
175
+
176
+ /**
177
+ * @return Payone_Core_Model_Config_Protect_Creditrating
178
+ */
179
+ public function getConfig()
180
+ {
181
+ return $this->config;
182
+ }
183
+
184
+ /**
185
+ * Determine if a creditcard check has to be performed, via sample mode config.
186
+ * Sample mode deactivated = We must perform every creditrating check.
187
+ *
188
+ * @param int $storeId
189
+ * @return bool
190
+ */
191
+ protected function haveToTakeSample($storeId)
192
+ {
193
+ $config = $this->getConfig();
194
+ $frequency = $config->getSampleModeFrequency();
195
+
196
+ if (!$config->isSampleModeEnabled()
197
+ or empty($frequency)
198
+ ) {
199
+ return true; // Sample mode disabled / badly configured. Check has to be performed.
200
+ }
201
+
202
+ $counter = $this->helperConfig()->getCreditratingSampleCounter($storeId);
203
+
204
+
205
+ if ($counter % $frequency === 0) {
206
+ return true;
207
+ }
208
+ return false;
209
+
210
+ }
211
+ }
app/code/community/Payone/Core/Model/System/Config/Abstract.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ abstract class Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ protected $dataArray;
36
+
37
+ /**
38
+ * @abstract
39
+ * @return array
40
+ */
41
+ abstract public function toArray();
42
+
43
+ /**
44
+ * @return array
45
+ */
46
+ public function toOptionArray()
47
+ {
48
+ $data = array();
49
+ foreach ($this->toArray() as $key => $value) {
50
+ $data[] = array(
51
+ 'value' => $key,
52
+ 'label' => $this->helper()->__($value)
53
+ );
54
+ }
55
+ return $data;
56
+ }
57
+
58
+ /**
59
+ * @return array
60
+ */
61
+ public function toSelectArray()
62
+ {
63
+ $data = array();
64
+ foreach ($this->toArray() as $key => $value) {
65
+ $data[$key] = $this->helper()->__($value);
66
+ }
67
+ return $data;
68
+ }
69
+
70
+ protected function helper()
71
+ {
72
+ return Mage::helper('payone_core');
73
+ }
74
+
75
+ }
app/code/community/Payone/Core/Model/System/Config/AddressCheckType.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_AddressCheckType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_Verification_AddressCheck();
41
+ return $settings->getTypes();
42
+ }
43
+ }
app/code/community/Payone/Core/Model/System/Config/AuthorizeMethod.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_AuthorizeMethod extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ const PREAUTHORIZATION = Payone_Api_Enum_RequestType::PREAUTHORIZATION;
36
+ const AUTHORIZATION = Payone_Api_Enum_RequestType::AUTHORIZATION;
37
+
38
+ /**
39
+ * @return array
40
+ */
41
+ public function toArray()
42
+ {
43
+ return array(
44
+ self::PREAUTHORIZATION => 'PREAUTHORIZATION',
45
+ self::AUTHORIZATION => 'AUTHORIZATION'
46
+ );
47
+ }
48
+ }
app/code/community/Payone/Core/Model/System/Config/AvsResult.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_AvsResult extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+
36
+ /**
37
+ * @return array
38
+ */
39
+ public function toArray()
40
+ {
41
+ $settings = new Payone_Settings_Configuration_Verification_AvsResult();
42
+ return $settings->getTypes();
43
+ }
44
+ }
app/code/community/Payone/Core/Model/System/Config/Backend/Protect.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_Backend_Protect extends Mage_Core_Model_Config_Data
34
+ {
35
+ protected function _beforeSave()
36
+ {
37
+ $addressCheckEnabled = $this->getData('groups/address_check/fields/enabled/value');
38
+ $creditratingEnabled = $this->getData('groups/creditrating/fields/enabled/value');
39
+
40
+ if ($addressCheckEnabled == 1 or $creditratingEnabled == 1) {
41
+ $protectValue = 1;
42
+ }
43
+ else {
44
+ $protectValue = 0;
45
+ }
46
+
47
+ $path = 'payone_protect/general/enabled';
48
+
49
+ /**
50
+ * @var $protect Mage_Core_Model_Config_Data
51
+ */
52
+ $protect = Mage::getModel('core/config_data');
53
+ $protect->setScope($this->getScope());
54
+ $protect->setScopeId($this->getScopeId());
55
+
56
+ $protect->setPath($path);
57
+ $protect->setValue($protectValue);
58
+
59
+ $protect->save();
60
+
61
+ parent::_beforeSave();
62
+ }
63
+ }
app/code/community/Payone/Core/Model/System/Config/BankaccountcheckType.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_BankaccountcheckType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_Verification_BankaccountCheck();
41
+
42
+ return $settings->getTypes();
43
+ }
44
+ }
app/code/community/Payone/Core/Model/System/Config/ClearingType.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_ClearingType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+
36
+ /**
37
+ * @return array
38
+ */
39
+ public function toArray()
40
+ {
41
+ $settings = new Payone_Settings_Configuration_PaymentMethod();
42
+ return $settings->getTypes();
43
+ }
44
+
45
+ }
app/code/community/Payone/Core/Model/System/Config/CreditCardType.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_CreditCardType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_PaymentMethod_CreditCard();
41
+ return $settings->getTypes();
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Model/System/Config/CreditScore.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_CreditScore extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_Verification_Consumerscore();
41
+ return $settings->getScores();
42
+ }
43
+ }
app/code/community/Payone/Core/Model/System/Config/CreditratingChecktype.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_CreditratingChecktype extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+
36
+ /**
37
+ * @return array
38
+ */
39
+ public function toArray()
40
+ {
41
+ $settings = new Payone_Settings_Configuration_Verification_Consumerscore();
42
+ return $settings->getTypes();
43
+ }
44
+ }
app/code/community/Payone/Core/Model/System/Config/CreditratingIntegrationEvent.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_CreditratingIntegrationEvent
34
+ extends Payone_Core_Model_System_Config_Abstract
35
+ {
36
+ const BEFORE_PAYMENT = 'before_payment';
37
+ const AFTER_PAYMENT = 'after_payment';
38
+
39
+ /**
40
+ * @return array
41
+ */
42
+ public function toArray()
43
+ {
44
+ $settings = array(
45
+ self::BEFORE_PAYMENT => 'Before Payment Selection',
46
+ self::AFTER_PAYMENT => 'After Payment Selection',
47
+ );
48
+ return $settings;
49
+ }
50
+ }
app/code/community/Payone/Core/Model/System/Config/HandleResponseError.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_HandleResponseError
34
+ extends Payone_Core_Model_System_Config_Abstract
35
+ {
36
+ const CONTINUE_CHECKOUT = 'continue_checkout';
37
+ const STOP_CHECKOUT = 'stop_checkout';
38
+
39
+ /**
40
+ * @return array
41
+ */
42
+ public function toArray()
43
+ {
44
+ $settings = array(
45
+ self::CONTINUE_CHECKOUT => 'Continue Checkout',
46
+ self::STOP_CHECKOUT => 'Stop Checkout',
47
+ );
48
+ return $settings;
49
+ }
50
+
51
+ }
app/code/community/Payone/Core/Model/System/Config/MethodType.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Christian Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_MethodType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settingsCreditcard = new Payone_Settings_Configuration_PaymentMethod_CreditCard();
41
+ $settingsOnlineBankTransfer = new Payone_Settings_Configuration_PaymentMethod_OnlineBankTransfer();
42
+ $settingsWallet = new Payone_Settings_Configuration_PaymentMethod_Wallet();
43
+
44
+ $return = array_merge(
45
+ $settingsCreditcard->getTypes(),
46
+ $settingsOnlineBankTransfer->getTypes(),
47
+ $settingsWallet->getTypes()
48
+ );
49
+
50
+ return $return;
51
+ }
52
+
53
+ /**
54
+ * @return array
55
+ */
56
+ public function toGroupArray()
57
+ {
58
+ $settingsCreditcard = new Payone_Settings_Configuration_PaymentMethod_CreditCard();
59
+ $settingsOnlineBankTransfer = new Payone_Settings_Configuration_PaymentMethod_OnlineBankTransfer();
60
+ $settingsWallet = new Payone_Settings_Configuration_PaymentMethod_Wallet();
61
+
62
+ $return = array(
63
+ 'Creditcard' => $settingsCreditcard->getTypes(),
64
+ 'Online Bank Transfer' => $settingsOnlineBankTransfer->getTypes(),
65
+ 'Wallet' => $settingsWallet->getTypes()
66
+ );
67
+
68
+ return $return;
69
+ }
70
+
71
+ /**
72
+ * @return array
73
+ */
74
+ public function toOptionGroupArray()
75
+ {
76
+ $data = array();
77
+ foreach ($this->toGroupArray() as $groupKey => $group) {
78
+ if (!array_key_exists($groupKey, $data)) {
79
+ $data[$groupKey] = array(
80
+ 'label' => $this->helper()->__($groupKey),
81
+ 'value' => array(),
82
+ );
83
+ }
84
+
85
+ foreach ($group as $key => $value) {
86
+ $data[$groupKey]['value'][$key] = array(
87
+ 'value' => $key,
88
+ 'label' => Mage::helper('payone_core')->__($value)
89
+ );
90
+ }
91
+ }
92
+ return $data;
93
+ }
94
+ }
app/code/community/Payone/Core/Model/System/Config/Mode.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_Mode extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_Mode();
41
+ return $settings->getModes();
42
+ }
43
+
44
+ }
app/code/community/Payone/Core/Model/System/Config/OnlinebanktransferType.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_OnlinebanktransferType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_PaymentMethod_OnlineBankTransfer();
41
+ return $settings->getTypes();
42
+ }
43
+ }
app/code/community/Payone/Core/Model/System/Config/PaymentMethodCode.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_PaymentMethodCode extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ const PREFIX = 'payone_';
36
+
37
+ const ADVANCEPAYMENT = 'payone_advance_payment';
38
+ const CASHONDELIVERY = 'payone_cash_on_delivery';
39
+ const CREDITCARD = 'payone_creditcard';
40
+ const DEBITPAYMENT = 'payone_debit_payment';
41
+ const INVOICE = 'payone_invoice';
42
+ const ONLINEBANKTRANSFER = 'payone_online_bank_transfer';
43
+ const WALLET = 'payone_wallet';
44
+
45
+ /**
46
+ * @return array
47
+ */
48
+ public function toArray()
49
+ {
50
+ return array(
51
+ self::ADVANCEPAYMENT => 'Advance Payment',
52
+ self::CASHONDELIVERY => 'Cash on Delivery',
53
+ self::CREDITCARD => 'Creditcard',
54
+ self::DEBITPAYMENT => 'Debit Payment',
55
+ self::INVOICE => 'Invoice',
56
+ self::ONLINEBANKTRANSFER => 'Online Bank Transfer',
57
+ self::WALLET => 'Wallet'
58
+ );
59
+ }
60
+ }
app/code/community/Payone/Core/Model/System/Config/PaymentMethodType.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_PaymentMethodType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ const ADVANCEPAYMENT = 'advance_payment';
36
+ const CASHONDELIVERY = 'cash_on_delivery';
37
+ const CREDITCARD = 'creditcard';
38
+ const DEBITPAYMENT = 'debit_payment';
39
+ const INVOICE = 'invoice';
40
+ const ONLINEBANKTRANSFER = 'online_bank_transfer';
41
+ const WALLET = 'wallet';
42
+
43
+ /**
44
+ * @return array
45
+ */
46
+ public function toArray()
47
+ {
48
+ return array(
49
+ self::ADVANCEPAYMENT => 'Advance Payment',
50
+ self::CASHONDELIVERY => 'Cash on Delivery',
51
+ self::CREDITCARD => 'Creditcard',
52
+ self::DEBITPAYMENT => 'Debit Payment',
53
+ self::INVOICE => 'Invoice',
54
+ self::ONLINEBANKTRANSFER => 'Online Bank Transfer',
55
+ self::WALLET => 'Wallet'
56
+ );
57
+ }
58
+ }
app/code/community/Payone/Core/Model/System/Config/PersonStatus.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_PersonStatus extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+
36
+ /**
37
+ * @return array
38
+ */
39
+ public function toArray()
40
+ {
41
+ $settings = new Payone_Settings_Configuration_Verification_Personstatus();
42
+ return $settings->getStatus();
43
+ }
44
+ }
app/code/community/Payone/Core/Model/System/Config/ReminderLevel.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_ReminderLevel extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+
36
+ /**
37
+ * @return array
38
+ */
39
+ public function toArray()
40
+ {
41
+ $settings = new Payone_Settings_Configuration_Reminderlevel();
42
+ return $settings->getLevels();
43
+ }
44
+
45
+ }
app/code/community/Payone/Core/Model/System/Config/RequestType.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_RequestType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_Api_RequestType();
41
+ return $settings->getTypes();
42
+ }
43
+ }
app/code/community/Payone/Core/Model/System/Config/ResponseType.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_ResponseType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ const EXCEPTION = 'EXCEPTION';
36
+
37
+ /**
38
+ * @return array
39
+ */
40
+ public function toArray()
41
+ {
42
+ $settings = new Payone_Settings_Configuration_Api_ResponseType();
43
+
44
+ $types = array(
45
+ self::EXCEPTION => self::EXCEPTION
46
+ );
47
+ $return = array_merge($types, $settings->getTypes());
48
+
49
+ return $return;
50
+ }
51
+ }
app/code/community/Payone/Core/Model/System/Config/Status.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_Status extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ const STATUS_DISABLED = 0;
36
+ const STATUS_ENABLED = 1;
37
+
38
+ /**
39
+ * @return array
40
+ */
41
+ public function toArray()
42
+ {
43
+ return array(
44
+ self::STATUS_ENABLED => 'Enabled',
45
+ self::STATUS_DISABLED => 'Disabled'
46
+ );
47
+ }
48
+ }
app/code/community/Payone/Core/Model/System/Config/StatusTransaction.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_StatusTransaction extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settingsTxaction = new Payone_Settings_Configuration_TransactionStatus_Action();
41
+
42
+ $types = array(
43
+ Payone_Api_Enum_ResponseType::APPROVED => Payone_Api_Enum_ResponseType::APPROVED,
44
+ Payone_Api_Enum_ResponseType::REDIRECT => Payone_Api_Enum_ResponseType::REDIRECT
45
+ );
46
+
47
+ $return = array_merge($types, $settingsTxaction->getActions());
48
+
49
+ return $return;
50
+ }
51
+ }
app/code/community/Payone/Core/Model/System/Config/TransactionStatus.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_TransactionStatus extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_TransactionStatus_Action();
41
+ return $settings->getActions();
42
+ }
43
+ }
app/code/community/Payone/Core/Model/System/Config/WalletType.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_Model
17
+ * @subpackage System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_Model
28
+ * @subpackage System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Model_System_Config_WalletType extends Payone_Core_Model_System_Config_Abstract
34
+ {
35
+ /**
36
+ * @return array
37
+ */
38
+ public function toArray()
39
+ {
40
+ $settings = new Payone_Settings_Configuration_PaymentMethod_Wallet();
41
+ return $settings->getTypes();
42
+ }
43
+ }
app/code/community/Payone/Core/controllers/Adminhtml/Configuration/Wizard/Page/PaymentController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Configuration_Wizard
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+ require_once 'Payone/Core/controllers/Adminhtml/System/Config/PaymentController.php';
24
+
25
+ /**
26
+ *
27
+ * @category Payone
28
+ * @package Payone_Core_controllers
29
+ * @subpackage Adminhtml_Configuration_Wizard
30
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
31
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
32
+ * @link http://www.noovias.com
33
+ */
34
+ class Payone_Core_Adminhtml_Configuration_Wizard_Page_PaymentController
35
+ extends Payone_Core_Adminhtml_System_Config_PaymentController
36
+ {
37
+ /**
38
+ *
39
+ */
40
+ public function indexAction()
41
+ {
42
+ $this->initConfig('payment');
43
+
44
+ parent::indexAction();
45
+ }
46
+
47
+ /**
48
+ * @param $actionName
49
+ * @return Varien_Object
50
+ */
51
+ protected function initConfig($actionName)
52
+ {
53
+ return $this->helperWizard()->initConfig($actionName, $this->getRequest());
54
+ }
55
+
56
+ /**
57
+ * @return Payone_Core_Helper_Wizard
58
+ */
59
+ public function helperWizard()
60
+ {
61
+ return Mage::helper('payone_core/wizard');
62
+ }
63
+ }
app/code/community/Payone/Core/controllers/Adminhtml/Configuration/Wizard/PageController.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Configuration_Wizard
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml_Configuration_Wizard
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_Configuration_Wizard_PageController
34
+ extends Payone_Core_Controller_Adminhtml_Configuration_Wizard_Abstract
35
+ {
36
+ public function preDispatch()
37
+ {
38
+ parent::preDispatch();
39
+
40
+ if ($this->getRequest()->getParam('section')) {
41
+ $this->_isSectionAllowedFlag = $this->_isSectionAllowed($this->getRequest()->getParam('section'));
42
+ }
43
+
44
+ return $this;
45
+ }
46
+
47
+ public function indexAction()
48
+ {
49
+ $this->initConfig('index');
50
+
51
+ $this->loadLayout();
52
+ $this->renderLayout();
53
+ }
54
+
55
+ public function generalGlobalAction()
56
+ {
57
+ $this->_editAction('generalGlobal');
58
+ }
59
+
60
+ public function riskAddressCheckAction()
61
+ {
62
+ $this->_editAction('riskAddressCheck');
63
+ }
64
+
65
+ public function riskCreditratingAction()
66
+ {
67
+ $this->_editAction('riskCreditrating');
68
+ }
69
+
70
+ protected function _editAction($actionName)
71
+ {
72
+ // $actionName = $this->getRequest()->getActionName(); // @comment we could use ActionName from Request
73
+ $this->initConfig($actionName);
74
+
75
+ $this->loadLayout('payone_core_adminhtml_configuration_wizard_page_edit');
76
+ $this->renderLayout();
77
+ }
78
+
79
+ public function finishAction()
80
+ {
81
+ $this->initConfig('finish');
82
+
83
+ $this->loadLayout();
84
+ $this->renderLayout();
85
+ }
86
+
87
+ public function _redirectByPageConfig()
88
+ {
89
+ $url = $this->helperWizard()->getNextPageUrlAsString();
90
+ $this->_redirect($url, array('_current' => true));
91
+ }
92
+
93
+ /**
94
+ * Save configuration
95
+ *
96
+ */
97
+ public function saveAction()
98
+ {
99
+ $pageCode = $this->getRequest()->getParam('page_code');
100
+
101
+ $config = $this->initConfig($pageCode);
102
+
103
+ /* @var $session Mage_Adminhtml_Model_Session */
104
+ $session = Mage::getSingleton('adminhtml/session');
105
+
106
+ try {
107
+ // $section = $this->getRequest()->getParam('section');
108
+ $section = $config->getData('codes/section'); // Section is defined by Action
109
+ $website = $this->getRequest()->getParam('website');
110
+ $store = $this->getRequest()->getParam('store');
111
+ $groups = $this->getRequest()->getPost('groups');
112
+
113
+ if (!$this->_isSectionAllowed($section)) {
114
+ throw new Exception(Mage::helper('payone_core')->__('This section is not allowed.'));
115
+ }
116
+
117
+ /**
118
+ * @var $configData Mage_Adminhtml_Model_Config_Data
119
+ */
120
+ $configData = Mage::getModel('adminhtml/config_data');
121
+ $configData->setSection($section)
122
+ ->setWebsite($website)
123
+ ->setStore($store)
124
+ ->setGroups($groups)
125
+ ->save();
126
+
127
+ // reinit configuration
128
+ Mage::getConfig()->reinit();
129
+ Mage::app()->reinitStores();
130
+
131
+ // website and store codes can be used in event implementation, so set them as well
132
+ $params = array('website' => $website, 'store' => $store);
133
+ Mage::dispatchEvent("admin_system_config_changed_section_{$section}", $params);
134
+
135
+ $session->addSuccess(Mage::helper('payone_core')->__('The configuration has been saved.'));
136
+ }
137
+ catch (Mage_Core_Exception $e) {
138
+ foreach (explode("\n", $e->getMessage()) as $message) {
139
+ $session->addError($message);
140
+ }
141
+ }
142
+ catch (Exception $e) {
143
+ $msg = Mage::helper('payone_core')->__('An error occurred while saving:') . ' ' . $e->getMessage();
144
+ $session->addException($e, $msg);
145
+ }
146
+
147
+ // $this->_saveState($this->getRequest()->getPost('config_state'));
148
+
149
+ $this->_redirectByPageConfig();
150
+ }
151
+
152
+ }
app/code/community/Payone/Core/controllers/Adminhtml/Configuration/WizardController.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Configuration_Wizard
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml_Configuration_Wizard
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_Configuration_WizardController
34
+ extends Payone_Core_Controller_Adminhtml_Abstract
35
+ {
36
+ public function indexAction()
37
+ {
38
+ $this->loadLayout();
39
+ $this->renderLayout();
40
+ }
41
+
42
+ }
app/code/community/Payone/Core/controllers/Adminhtml/InformationController.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_InformationController extends Payone_Core_Controller_Adminhtml_Abstract
34
+ {
35
+ /**
36
+ *
37
+ */
38
+ public function indexAction()
39
+ {
40
+ $this->loadLayout();
41
+ $this->renderLayout();
42
+ }
43
+ }
app/code/community/Payone/Core/controllers/Adminhtml/Protocol/ApiController.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_Protocol_ApiController extends Payone_Core_Controller_Adminhtml_Abstract
34
+ {
35
+ /**
36
+ * @return \Payone_Core_Adminhtml_Protocol_ApiController
37
+ */
38
+ protected function _initAction()
39
+ {
40
+ $this->loadLayout();
41
+ $this->setUsedModuleName('payone_core');
42
+ $this->_setActiveMenu('payone');
43
+ $this->_addBreadcrumb(
44
+ $this->helper()->__('Payone'),
45
+ $this->helper()->__('Payone')
46
+ );
47
+
48
+ $this->_title($this->helper()->__('Payone'));
49
+ $this->_title($this->helper()->__('Protocol - API'));
50
+
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ *
56
+ */
57
+ public function indexAction()
58
+ {
59
+ $this->_initAction();
60
+ $this->renderLayout();
61
+ }
62
+
63
+ /**
64
+ *
65
+ */
66
+ public function gridAction()
67
+ {
68
+ $this->getResponse()->setBody(
69
+ $this->getLayout()->createBlock('payone_core/adminhtml_protocol_api_grid')->toHtml()
70
+ );
71
+ }
72
+
73
+ /**
74
+ *
75
+ */
76
+ public function viewAction()
77
+ {
78
+ $id = $this->getRequest()->getParam('id');
79
+ /** @var $model Payone_Core_Model_Domain_Protocol_Api */
80
+ $model = Mage::getModel('payone_core/domain_protocol_api')->load($id);
81
+ if ($model->getId() || $id == 0) {
82
+
83
+ Mage::register('payone_core_protocol_api', $model);
84
+
85
+ $this->_initAction();
86
+
87
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
88
+
89
+ $this->_title(sprintf("#%s", $id));
90
+
91
+ $this->renderLayout();
92
+ }
93
+ else {
94
+ Mage::getSingleton('adminhtml/session')->addError(
95
+ $this->helper()->__('Api does not exist')
96
+ );
97
+ $this->_redirect('*/*/');
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Export order grid to CSV format
103
+ */
104
+ public function exportCsvAction()
105
+ {
106
+ $fileName = 'protocol_api.csv';
107
+
108
+ /**
109
+ * @var $grid Payone_Core_Block_Adminhtml_Protocol_Api_Grid
110
+ */
111
+ $grid = $this->getLayout()->createBlock('payone_core/adminhtml_protocol_api_grid');
112
+
113
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
114
+ }
115
+
116
+ /**
117
+ * Export order grid to XML format
118
+ */
119
+ public function exportExcelAction()
120
+ {
121
+ $fileName = 'protocol_api.xls';
122
+
123
+ /**
124
+ * @var $grid Payone_Core_Block_Adminhtml_Protocol_Api_Grid
125
+ */
126
+ $grid = $this->getLayout()->createBlock('payone_core/adminhtml_protocol_api_grid');
127
+
128
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile());
129
+ }
130
+
131
+ /**
132
+ * Export order grid to CSV format
133
+ */
134
+ public function exportCsvRawAction()
135
+ {
136
+ $fileName = 'protocol_api_raw.csv';
137
+
138
+ /**
139
+ * @var $collection Payone_Core_Model_Domain_Resource_Protocol_Api_Collection
140
+ */
141
+ $collection = Mage::getModel('payone_core/domain_protocol_api')->getCollection();
142
+
143
+ $serviceExport = $this->getFactory()->getServiceProtocolApiExport();
144
+ $csv = $serviceExport->exportCsv($collection);
145
+
146
+ $this->_prepareDownloadResponse($fileName, $csv);
147
+ }
148
+
149
+ }
app/code/community/Payone/Core/controllers/Adminhtml/Protocol/TransactionStatusController.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Protocol
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml_Protocol
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_Protocol_TransactionStatusController
34
+ extends Payone_Core_Controller_Adminhtml_Abstract
35
+ {
36
+ /**
37
+ * @return Payone_Core_Adminhtml_Protocol_TransactionStatusController
38
+ */
39
+ protected function _initAction()
40
+ {
41
+ $this->loadLayout();
42
+ $this->setUsedModuleName('payone_core');
43
+ $this->_setActiveMenu('payone');
44
+ $this->_addBreadcrumb(
45
+ Mage::helper('payone_core')->__('Payone'),
46
+ Mage::helper('payone_core')->__('Payone')
47
+ );
48
+
49
+ $this->_title(Mage::helper('payone_core')->__('Payone'));
50
+ $this->_title(Mage::helper('payone_core')->__('Protocol - TransactionStatus'));
51
+
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ *
57
+ */
58
+ public function indexAction()
59
+ {
60
+ $this->_initAction();
61
+ $this->renderLayout();
62
+ }
63
+
64
+ public function gridAction()
65
+ {
66
+ $this->getResponse()->setBody(
67
+ $this->getLayout()->createBlock('payone_core/adminhtml_protocol_transactionStatus_grid')->toHtml()
68
+ );
69
+ }
70
+
71
+ public function viewAction()
72
+ {
73
+ $id = $this->getRequest()->getParam('id');
74
+ /** @var $modelTransactionStatus Payone_Core_Model_Domain_Protocol_TransactionStatus */
75
+ $modelTransactionStatus = Mage::getModel('payone_core/domain_protocol_transactionStatus')->load($id);
76
+ if ($modelTransactionStatus->getId() || $id == 0) {
77
+
78
+ Mage::register('payone_core_protocol_transactionstatus', $modelTransactionStatus);
79
+
80
+ /** @var $modelTransaction Payone_Core_Model_Domain_Transaction */
81
+ $modelTransaction = Mage::getModel('payone_core/domain_transaction');
82
+ $modelTransaction->loadByTransactionStatus($modelTransactionStatus);
83
+
84
+ Mage::register('payone_core_protocol_transaction', $modelTransaction);
85
+
86
+ $this->_initAction();
87
+
88
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
89
+
90
+ $this->_title(sprintf("#%s", $id));
91
+
92
+ $this->renderLayout();
93
+ }
94
+ else {
95
+ Mage::getSingleton('adminhtml/session')->addError(
96
+ Mage::helper('payone_core')->__('TransactionStatus does not exist')
97
+ );
98
+ $this->_redirect('*/*/');
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Export order grid to CSV format
104
+ */
105
+ public function exportCsvAction()
106
+ {
107
+ $fileName = 'protocol_transaction_status.csv';
108
+
109
+ /**
110
+ * @var $grid Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_Grid
111
+ */
112
+ $grid = $this->getLayout()->createBlock('payone_core/adminhtml_protocol_transactionStatus_grid');
113
+
114
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
115
+ }
116
+
117
+ /**
118
+ * Export order grid to XML format
119
+ */
120
+ public function exportExcelAction()
121
+ {
122
+ $fileName = 'protocol_transaction_status.xls';
123
+
124
+ /**
125
+ * @var $grid Payone_Core_Block_Adminhtml_Protocol_TransactionStatus_Grid
126
+ */
127
+ $grid = $this->getLayout()->createBlock('payone_core/adminhtml_protocol_transactionStatus_grid');
128
+
129
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile());
130
+ }
131
+
132
+ /**
133
+ * Export order grid to CSV format
134
+ */
135
+ public function exportCsvRawAction()
136
+ {
137
+ $fileName = 'protocol_transaction_status_raw.csv';
138
+
139
+ /**
140
+ * @var $collection Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection
141
+ */
142
+ $collection = Mage::getModel('payone_core/domain_protocol_transactionStatus')->getCollection();
143
+
144
+ $serviceExport = $this->getFactory()->getServiceProtocolTransactionStatusExport();
145
+ $csv = $serviceExport->exportCsv($collection);
146
+
147
+ $this->_prepareDownloadResponse($fileName, $csv);
148
+ }
149
+
150
+ }
app/code/community/Payone/Core/controllers/Adminhtml/Sales/Order/InvoiceController.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Christian Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ require_once 'Mage' . DS . 'Adminhtml' . DS . 'controllers' . DS . 'Sales' . DS . 'Order'. DS .'InvoiceController.php';
25
+
26
+ /**
27
+ *
28
+ * @category Payone
29
+ * @package Payone_Core_controllers
30
+ * @subpackage Adminhtml_Sales
31
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
32
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
33
+ * @link http://www.noovias.com
34
+ */
35
+ class Payone_Core_Adminhtml_Sales_Order_InvoiceController extends Mage_Adminhtml_Sales_Order_InvoiceController
36
+ {
37
+ /**
38
+ * @return Mage_Core_Controller_Varien_Action
39
+ */
40
+ public function getInvoiceAction()
41
+ {
42
+ /** @var $order Mage_Sales_Model_Order */
43
+ $invoice = $this->_initInvoice();
44
+ $order = $invoice->getOrder();
45
+ $service = $this->getPayoneFactory()->getServiceManagementGetInvoice();
46
+ $pdfBinary = $service->execute($invoice);
47
+
48
+ if ($pdfBinary !== false) {
49
+ return $this->_prepareDownloadResponse(
50
+ 'payone_order_' . $order->getIncrementId() . '_invoice.pdf', $pdfBinary,
51
+ 'application/pdf'
52
+ );
53
+ }
54
+
55
+ $this->_getSession()->addError($this->__('Failed to get the Payone Invoice.'));
56
+
57
+ $this->_redirect('adminhtml/sales_order_invoice/view', array('invoice_id' => $invoice->getId()));
58
+
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ *
64
+ * @return Payone_Core_Helper_Data
65
+ */
66
+ protected function helperPayoneCore()
67
+ {
68
+ return Mage::helper('payone_core');
69
+ }
70
+
71
+ /**
72
+ * @return Payone_Core_Model_Factory
73
+ */
74
+ public function getPayoneFactory()
75
+ {
76
+ return $this->helperPayoneCore()->getFactory();
77
+ }
78
+ }
app/code/community/Payone/Core/controllers/Adminhtml/Sales/OrderController.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_Sales
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ require_once 'Mage' . DS . 'Adminhtml' . DS . 'controllers' . DS . 'Sales' . DS . 'OrderController.php';
25
+
26
+ /**
27
+ *
28
+ * @category Payone
29
+ * @package Payone_Core_controllers
30
+ * @subpackage Adminhtml_Sales
31
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
32
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
33
+ * @link http://www.noovias.com
34
+ */
35
+ class Payone_Core_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
36
+ {
37
+
38
+ /**
39
+ *
40
+ */
41
+ public function transactionStatusGridAction()
42
+ {
43
+ $this->_initOrder();
44
+ $this->getResponse()->setBody(
45
+ Mage::getBlockSingleton('payone_core/adminhtml_sales_order_view_tab_transactionStatus')->toHtml()
46
+ );
47
+ }
48
+
49
+ /**
50
+ *
51
+ */
52
+ public function apiGridAction()
53
+ {
54
+ $this->_initOrder();
55
+ $this->getResponse()->setBody(
56
+ Mage::getBlockSingleton('payone_core/adminhtml_sales_order_view_tab_api')->toHtml()
57
+ );
58
+ }
59
+
60
+ /**
61
+ *
62
+ */
63
+ public function gridAction()
64
+ {
65
+ $this->getResponse()->setBody(
66
+ $this->getLayout()->createBlock('payone_core/adminhtml_sales_order_grid')->toHtml()
67
+ );
68
+ }
69
+
70
+ /**
71
+ * @return Mage_Adminhtml_Sales_OrderController| Payone_Core_Adminhtml_Sales_OrderController
72
+ */
73
+ protected function _initAction()
74
+ {
75
+ $this->loadLayout();
76
+ $this->setUsedModuleName('payone_core');
77
+ $this->_setActiveMenu('payone');
78
+ $this->_addBreadcrumb(
79
+ Mage::helper('payone_core')->__('Payone'),
80
+ Mage::helper('payone_core')->__('Payone')
81
+ );
82
+
83
+ $this->_title($this->helperPayoneCore()->__('Payone'));
84
+ $this->_title($this->helperPayoneCore()->__('Order'));
85
+
86
+ return $this;
87
+ }
88
+
89
+ /**
90
+ *
91
+ */
92
+ public function indexAction()
93
+ {
94
+ $this->_initAction();
95
+ $this->renderLayout();
96
+ }
97
+
98
+ /**
99
+ *
100
+ * @return Payone_Core_Helper_Data
101
+ */
102
+ protected function helperPayoneCore()
103
+ {
104
+ return Mage::helper('payone_core');
105
+ }
106
+
107
+ /**
108
+ * @return Payone_Core_Model_Factory
109
+ */
110
+ public function getPayoneFactory()
111
+ {
112
+ return $this->helperPayoneCore()->getFactory();
113
+ }
114
+ }
app/code/community/Payone/Core/controllers/Adminhtml/System/Config/PaymentController.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_System_Config_PaymentController
34
+ extends Payone_Core_Controller_Adminhtml_Abstract
35
+ {
36
+ /**
37
+ * @return Payone_Core_Adminhtml_System_Config_PaymentController
38
+ */
39
+ protected function _initAction()
40
+ {
41
+ $this->loadLayout();
42
+ return $this;
43
+ }
44
+
45
+ /**
46
+ *
47
+ */
48
+ public function indexAction()
49
+ {
50
+ $websiteCode = $this->getRequest()->getParam('website');
51
+
52
+ $showButtons = true;
53
+ if ($websiteCode) {
54
+ $showButtons = false;
55
+ }
56
+
57
+ Mage::register('show_new_payment_buttons', $showButtons);
58
+
59
+ $this->_initAction();
60
+ $this->renderLayout();
61
+ }
62
+
63
+ public function gridAction()
64
+ {
65
+ $this->getResponse()->setBody(
66
+ Mage::getBlockSingleton('payone_core/adminhtml_system_config_payment_grid')->toHtml()
67
+ );
68
+ }
69
+
70
+ /**
71
+ *
72
+ */
73
+ public function newAction()
74
+ {
75
+ $type = $this->getRequest()->getParam('type');
76
+ if ($type == null) {
77
+ $this->_redirect('*/*/', array('_current' => true));
78
+ }
79
+
80
+ $this->_forward('edit');
81
+ }
82
+
83
+ /**
84
+ *
85
+ */
86
+ public function editAction()
87
+ {
88
+ $id = $this->getRequest()->getParam('id');
89
+ $website = $this->getRequest()->getParam('website');
90
+ $store = $this->getRequest()->getParam('store');
91
+ $type = $this->getRequest()->getParam('type');
92
+
93
+ /** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
94
+ $model = $this->getModelDomainConfigPaymentMethod()->load($id);
95
+
96
+ if ($model->getId() || $id == 0) {
97
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
98
+ if (!empty($data)) {
99
+ $model->setData($data);
100
+ }
101
+ $model->setWebsite($website);
102
+ $model->setStore($store);
103
+ $model->setCode($type);
104
+
105
+ Mage::register('payone_core_config_payment_method', $model);
106
+
107
+ $this->loadLayout();
108
+
109
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
110
+
111
+ $this->renderLayout();
112
+ }
113
+ else {
114
+ Mage::getSingleton('adminhtml/session')->addError(
115
+ $this->helper()->__('PaymentMethod-Config does not exist.')
116
+ );
117
+ $this->_redirect('*/*/', array('_current' => true));
118
+ }
119
+ }
120
+
121
+ /**
122
+ *
123
+ */
124
+ public function saveAction()
125
+ {
126
+ $data = $this->getRequest()->getParam('groups');
127
+ $website = $this->getRequest()->getParam('website');
128
+ $store = $this->getRequest()->getParam('store');
129
+ $type = $this->getRequest()->getParam('type');
130
+
131
+ if ($data) {
132
+ /** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
133
+ $model = $this->getModelDomainConfigPaymentMethod();
134
+ $model->setWebsite($website);
135
+ $model->setStore($store);
136
+ $model->setCode($type);
137
+ $model->setGroups($data);
138
+ $model->setId($this->getRequest()->getParam('id'));
139
+
140
+ try {
141
+ $model->save();
142
+ Mage::getSingleton('adminhtml/session')->addSuccess(
143
+ $this->helper()->__('PaymentMethod-Config was successfully saved.')
144
+ );
145
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
146
+
147
+ $this->_redirect('*/*/', array('_current' => true));
148
+ return;
149
+ }
150
+ catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
153
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'), '_current' => true));
154
+ return;
155
+ }
156
+ }
157
+ Mage::getSingleton('adminhtml/session')->addError(
158
+ $this->helper()->__('Unable to find PaymentMethod-Config to save.')
159
+ );
160
+ $this->_redirect('*/*/', array('_current' => true));
161
+ }
162
+
163
+ /**
164
+ *
165
+ */
166
+ public function deleteAction()
167
+ {
168
+ $id = $this->getRequest()->getParam('id');
169
+ if ($id > 0) {
170
+ $data = $this->getRequest()->getParam('groups');
171
+ $website = $this->getRequest()->getParam('website');
172
+ $store = $this->getRequest()->getParam('store');
173
+ $type = $this->getRequest()->getParam('type');
174
+ try {
175
+ /** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
176
+ $model = $this->getModelDomainConfigPaymentMethod();
177
+ $model->setWebsite($website);
178
+ $model->setStore($store);
179
+ $model->setCode($type);
180
+ $model->setGroups($data);
181
+ $model->setId($id);
182
+ $model->setIsDeleted(1);
183
+ $model->save();
184
+
185
+ Mage::getSingleton('adminhtml/session')->addSuccess(
186
+ Mage::helper('adminhtml')->__('PaymentMethod Config was successfully deleted.')
187
+ );
188
+ $this->_redirect('*/*/', array('_current' => true));
189
+ }
190
+ catch (Exception $e) {
191
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
192
+ $this->_redirect('*/*/edit', array('id' => $id, '_current' => true));
193
+ }
194
+ }
195
+ $this->_redirect('*/*/', array('_current' => true));
196
+ }
197
+
198
+ /**
199
+ * @return Payone_Core_Model_Domain_Config_PaymentMethod
200
+ */
201
+ protected function getModelDomainConfigPaymentMethod()
202
+ {
203
+ return $this->getFactory()->getModelDomainConfigPaymentMethod();
204
+ }
205
+ }
app/code/community/Payone/Core/controllers/Adminhtml/System/ConfigurationController.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml_System
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml_System
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_System_ConfigurationController
34
+ extends Payone_Core_Controller_Adminhtml_Abstract
35
+ {
36
+ /**
37
+ * @return Mage_Core_Controller_Varien_Action
38
+ */
39
+ public function exportAction()
40
+ {
41
+ $service = $this->getFactory()->getServiceXmlGenerate();
42
+ $configService = $this->getFactory()->getServiceConfigXmlGenerate();
43
+ $configXml = $configService->execute();
44
+ return $this->_prepareDownloadResponse(
45
+ 'payone_config_export' . Mage::getSingleton('core/date')->date('Y-m-d_H-i-s') . '.xml', $configXml,
46
+ 'application/xml'
47
+ );
48
+ }
49
+
50
+ /**
51
+ * @return Mage_Core_Controller_Varien_Action
52
+ */
53
+ public function exportOldAction()
54
+ {
55
+ $config = '';
56
+
57
+ $storeId = null;
58
+
59
+ $configPaymentCc = Mage::getStoreConfig('payment/payone_cc', $storeId);
60
+ $configPaymentElv = Mage::getStoreConfig('payment/payone_elv', $storeId);
61
+ $configPaymentVor = Mage::getStoreConfig('payment/payone_vor', $storeId);
62
+ $configPaymentRec = Mage::getStoreConfig('payment/payone_rec', $storeId);
63
+ $configPaymentCod = Mage::getStoreConfig('payment/payone_cod', $storeId);
64
+ $configPaymentSb = Mage::getStoreConfig('payment/payone_sb', $storeId);
65
+ $configPaymentWlt = Mage::getStoreConfig('payment/payone_wlt', $storeId);
66
+
67
+ $configCreditrating = Mage::getStoreConfig('payonecreditrating', $storeId);
68
+
69
+ $configPayment = array(
70
+ 'payone_cc' => $configPaymentCc,
71
+ 'payone_elv' => $configPaymentElv,
72
+ 'payone_vor' => $configPaymentVor,
73
+ 'payone_rec' => $configPaymentRec,
74
+ 'payone_cod' => $configPaymentCod,
75
+ 'payone_sb' => $configPaymentSb,
76
+ 'payone_wlt' => $configPaymentWlt,
77
+ );
78
+
79
+ // PAYMENT
80
+ foreach ($configPayment as $methodCode => $configMethod) {
81
+ $config .= '[' . $methodCode . ']' . "\n";
82
+ foreach ($configMethod as $key => $value) {
83
+ $config .= $key . ' = ' . $value . "\n";
84
+ }
85
+ $config .= "\n";
86
+ }
87
+
88
+ // CREDITRATING
89
+ foreach ($configCreditrating as $methodCode => $configMethod) {
90
+ $config .= '[' . $methodCode . ']' . "\n";
91
+ foreach ($configMethod as $key => $value) {
92
+ $config .= $key . ' = ' . $value . "\n";
93
+ }
94
+ $config .= "\n";
95
+ }
96
+
97
+ return $this->_prepareDownloadResponse(
98
+ 'payone_config_export' . Mage::getSingleton('core/date')->date('Y-m-d_H-i-s') . '.txt', $config,
99
+ 'application/text'
100
+ );
101
+ }
102
+ }
app/code/community/Payone/Core/controllers/Adminhtml/TransactionController.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Adminhtml
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Adminhtml
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Adminhtml_TransactionController extends Payone_Core_Controller_Adminhtml_Abstract
34
+ {
35
+ /**
36
+ * @return Payone_Core_Adminhtml_TransactionController
37
+ */
38
+ protected function _initAction()
39
+ {
40
+ $this->loadLayout();
41
+ $this->setUsedModuleName('payone_core');
42
+ $this->_setActiveMenu('payone');
43
+ $this->_addBreadcrumb(
44
+ $this->helper()->__('Payone'),
45
+ $this->helper()->__('Payone')
46
+ );
47
+
48
+ $this->_title($this->helper()->__('Payone'));
49
+ $this->_title($this->helper()->__('Transaction'));
50
+
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ *
56
+ */
57
+ public function indexAction()
58
+ {
59
+ $this->_initAction();
60
+ $this->renderLayout();
61
+ }
62
+
63
+ /**
64
+ *
65
+ */
66
+ public function gridAction()
67
+ {
68
+ $this->getResponse()->setBody(
69
+ $this->getLayout()->createBlock('payone_core/adminhtml_transaction_grid')->toHtml()
70
+ );
71
+ }
72
+
73
+ /**
74
+ *
75
+ */
76
+ public function viewAction()
77
+ {
78
+ $id = $this->getRequest()->getParam('id');
79
+ /** @var $transactionModel Payone_Core_Model_Domain_Transaction */
80
+ $transactionModel = Mage::getModel('payone_core/domain_transaction')->load($id);
81
+ if ($transactionModel->getId() || $id == 0) {
82
+
83
+ Mage::register('payone_core_transaction', $transactionModel);
84
+
85
+ /** @var $transactionStatusCollection Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection */
86
+ $transactionStatusCollection = Mage::getModel('payone_core/domain_protocol_transactionStatus')
87
+ ->getCollection();
88
+ $transactionStatusCollection->getByTransaction($transactionModel);
89
+
90
+ Mage::register('payone_core_transactionstatus_collection', $transactionStatusCollection);
91
+
92
+ $this->_initAction();
93
+
94
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
95
+
96
+ $this->_title(sprintf("#%s", $id));
97
+
98
+ $this->renderLayout();
99
+ }
100
+ else {
101
+ Mage::getSingleton('adminhtml/session')->addError(
102
+ $this->helper()->__('Transaction does not exist')
103
+ );
104
+ $this->_redirect('*/*/');
105
+ }
106
+ }
107
+
108
+ /**
109
+ *
110
+ */
111
+ public function transactionStatusGridAction()
112
+ {
113
+ $id = $this->getRequest()->getParam('id');
114
+ $transactionModel = Mage::getModel('payone_core/domain_transaction')->load($id);
115
+
116
+ /** @var $transactionStatusCollection Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection */
117
+ $transactionStatusCollection = Mage::getModel('payone_core/domain_protocol_transactionStatus')
118
+ ->getCollection();
119
+ $transactionStatusCollection->getByTransaction($transactionModel);
120
+
121
+ Mage::register('payone_core_transactionstatus_collection', $transactionStatusCollection);
122
+
123
+ $this->getResponse()->setBody(
124
+ Mage::getBlockSingleton('payone_core/adminhtml_transaction_view_tab_transactionStatus')
125
+ ->toHtml()
126
+ );
127
+ }
128
+ }
app/code/community/Payone/Core/controllers/Checkout/Onepage/PaymentController.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Checkout
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage Checkout
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_Checkout_Onepage_PaymentController extends Payone_Core_Controller_Abstract
34
+ {
35
+ /**
36
+ * Payment has been canceled by user.
37
+ *
38
+ * Cancel order and redirect user to the shopping cart. Reactivate quote.
39
+ */
40
+ public function backAction()
41
+ {
42
+ try {
43
+ $this->checkoutCancel(true);
44
+ } catch (Exception $e) {
45
+ $this->handleException($e);
46
+ }
47
+ // Redirect customer to cart
48
+ $this->_redirect('checkout/cart');
49
+ }
50
+
51
+ /**
52
+ * @return mixed
53
+ */
54
+ public function successAction()
55
+ {
56
+ try {
57
+ $success = $this->checkoutSucccess();
58
+
59
+ if ($success === true) {
60
+ // Payment is okay. Redirect to standard Magento success page:
61
+ $this->_redirect('checkout/onepage/success');
62
+ return;
63
+ }
64
+ } catch (Exception $e) {
65
+ $this->handleException($e);
66
+ }
67
+
68
+ $this->_redirect('checkout/cart');
69
+ }
70
+
71
+ /**
72
+ * An error occured during the payment process.
73
+ * Cancel order and redirect user to the shopping cart.
74
+ */
75
+ public function errorAction()
76
+ {
77
+ try {
78
+ $this->checkoutCancel(false);
79
+ } catch (Exception $e) {
80
+ $this->handleException($e);
81
+ }
82
+ // Redirect customer to cart
83
+ $this->_redirect('checkout/cart');
84
+
85
+ }
86
+
87
+ /**
88
+ * @return bool
89
+ */
90
+ protected function checkoutSucccess()
91
+ {
92
+ // Get singleton of Checkout Session Model
93
+ $checkoutSession = $this->getFactory()->getSingletonCheckoutSession();
94
+
95
+ // Load actors:
96
+ $order = $this->getOrderByCheckoutSession($checkoutSession);
97
+ $quote = $this->getQuoteByCheckoutSession($checkoutSession);
98
+ $helper = $this->helper();
99
+
100
+ if ($order->getStatus() == Mage_Sales_Model_Order::STATE_CANCELED) {
101
+ // Order was cancelled, reactivate quote, notify customer:
102
+ $this->reactivateQuote($quote);
103
+
104
+ $message = $helper->__('The order has been canceled.');
105
+ $checkoutSession->addError($message);
106
+ return false;
107
+ }
108
+
109
+ // Load transaction status via order id, check for APPOINTED:
110
+ $txStatus = $this->getFactory()->getModelTransactionStatus();
111
+ $txStatus->load($order->getIncrementId(), 'reference');
112
+
113
+ if (!$txStatus->hasData() or !$txStatus->getId() or !$txStatus->isAppointed()) {
114
+ // Wrong or no transactionStatus for this order, failure.
115
+ $message = $helper->__('Sorry, your payment has not been confirmed by the payment provider.');
116
+ $checkoutSession->addError($message);
117
+ return false;
118
+ }
119
+
120
+ // Success!
121
+ $checkoutSession->setLastSuccessQuoteId($quote->getId());
122
+
123
+ return true;
124
+ }
125
+
126
+ /**
127
+ * @param bool $reactivateQuote
128
+ */
129
+ protected function checkoutCancel($reactivateQuote = false)
130
+ {
131
+ // Get singleton of Checkout Session Model
132
+ $checkoutSession = $this->getFactory()->getSingletonCheckoutSession();
133
+
134
+ // Load order
135
+ $order = $this->getOrderByCheckoutSession($checkoutSession);
136
+
137
+ // Cancel order and add history comment:
138
+ if ($order->canCancel()) {
139
+ $order->cancel();
140
+ $statusMessage = $this->helper()->__('The Payone transaction has been canceled.');
141
+ $order->addStatusHistoryComment($statusMessage, Mage_Sales_Model_Order::STATE_CANCELED);
142
+ $order->save();
143
+ }
144
+
145
+ // Reactivate quote
146
+ if ($reactivateQuote === true) {
147
+ // Load quote
148
+ $quote = $this->getQuoteByCheckoutSession($checkoutSession);
149
+ $this->reactivateQuote($quote);
150
+ }
151
+
152
+ // Add error message to Magento checkout:
153
+ $errorMessage = $this->helper()->__('The order has been canceled.');
154
+ $checkoutSession->addError($errorMessage);
155
+ }
156
+
157
+ /**
158
+ * @param Mage_Sales_Model_Quote $quote
159
+ */
160
+ protected function reactivateQuote(Mage_Sales_Model_Quote $quote)
161
+ {
162
+ if ($quote->getId()) {
163
+ /* @note: Reset reserved_order_id, Magento up to and including version 1.7 has a bug in Mage_Sales_Model_Resource_Quote::isOrderIncrementIdUsed()
164
+ * They cast the orderIncrementId to (int), which breaks the checkout/cart for all non-numerical incrementIds
165
+ * (Causes Integrity Constraint Violation, because orderIncrementId already exists */
166
+ $quote->setData('reserved_order_id', '');
167
+
168
+ $quote->setIsActive(true);
169
+ $quote->save();
170
+ }
171
+ }
172
+
173
+ /**
174
+ * @param Mage_Checkout_Model_Session $session
175
+ * @return Mage_Sales_Model_Order
176
+ */
177
+ protected function getOrderByCheckoutSession(Mage_Checkout_Model_Session $session)
178
+ {
179
+ $orderId = $session->getLastOrderId();
180
+
181
+ $order = $this->getFactory()->getModelSalesOrder();
182
+ $order->load($orderId);
183
+
184
+ return $order;
185
+ }
186
+
187
+ /**
188
+ * @param Mage_Checkout_Model_Session $session
189
+ * @return Mage_Sales_Model_Quote
190
+ */
191
+ protected function getQuoteByCheckoutSession(Mage_Checkout_Model_Session $session)
192
+ {
193
+ $quoteId = $session->getLastQuoteId();
194
+
195
+ $quote = $this->getFactory()->getModelSalesQuote();
196
+ $quote->load($quoteId);
197
+
198
+ return $quote;
199
+ }
200
+
201
+ /**
202
+ * @param Exception $exception
203
+ */
204
+ protected function handleException(Exception $exception)
205
+ {
206
+ // Log exceptions, any messages relevant to customer have been set to the session by service
207
+ Mage::logException($exception);
208
+ }
209
+ }
app/code/community/Payone/Core/controllers/Checkout/OnepageController.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage Checkout
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ require_once 'Mage' . DS . 'Checkout' . DS . 'controllers' . DS . 'OnepageController.php';
25
+
26
+ /**
27
+ *
28
+ * @category Payone
29
+ * @package Payone_Core_controllers
30
+ * @subpackage Checkout
31
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
32
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
33
+ * @link http://www.noovias.com
34
+ */
35
+ class Payone_Core_Checkout_OnepageController extends Mage_Checkout_OnepageController
36
+ {
37
+ protected $eventPrefix = 'payone_core_checkout_onepage';
38
+
39
+ /**
40
+ * verfiy payment ajax action
41
+ *
42
+ * Sets either redirect or a JSON response
43
+ */
44
+ public function verifyPaymentAction()
45
+ {
46
+ if ($this->_expireAjax()) {
47
+ return;
48
+ }
49
+ try {
50
+ if (!$this->getRequest()->isPost()) {
51
+ $this->_ajaxRedirectResponse();
52
+ return;
53
+ }
54
+
55
+ // Dispatch Event
56
+ $settings = $this->dispatchEvent();
57
+
58
+ $result = array();
59
+ if ($settings->getData('have_to_filter_methods') == true) {
60
+
61
+ // register Allowed methods
62
+ $allowedMethods = $settings->getData('allowed_methods');
63
+ Mage::register('payment_methods_allowed_methods', $allowedMethods, true);
64
+
65
+ $result['goto_section'] = 'payment';
66
+ $result['update_section'] = array(
67
+ 'name' => 'payment-method',
68
+ 'html' => $this->_getPaymentMethodsHtml()
69
+ );
70
+ }
71
+ else {
72
+ $this->_forward('savePayment', 'onepage', 'checkout');
73
+ return;
74
+ }
75
+ }
76
+ catch (Mage_Payment_Exception $e) {
77
+ if ($e->getFields()) {
78
+ $result['fields'] = $e->getFields();
79
+ }
80
+ $result['error'] = $e->getMessage();
81
+ }
82
+ catch (Mage_Core_Exception $e) {
83
+ $result['error'] = $e->getMessage();
84
+ }
85
+ catch (Exception $e) {
86
+ Mage::logException($e);
87
+ $result['error'] = $this->__('Unable to set Payment Method.');
88
+ }
89
+
90
+ $this->getResponse()->setBody(
91
+ Mage::helper('core')->jsonEncode($result)
92
+ );
93
+ }
94
+
95
+ /**
96
+ * @return Varien_Object
97
+ */
98
+ protected function dispatchEvent()
99
+ {
100
+ $settings = new Varien_Object();
101
+ $settings->setData('have_to_filter_methods', false);
102
+
103
+ $allowedMethods = new Varien_Object();
104
+ $settings->setData('allowed_methods', $allowedMethods);
105
+
106
+ $paymentData = $this->getRequest()->getPost('payment', array());
107
+ $selectedMethod = $paymentData['method'];
108
+
109
+ $parameters = array(
110
+ 'settings' => $settings,
111
+ 'quote' => $this->getOnepage()->getQuote(),
112
+ 'selected_method' => $selectedMethod,
113
+ 'payment_data' => $paymentData,
114
+ 'full_action_name' => $this->getFullActionName('/'),
115
+ );
116
+
117
+ // Dispatch Event
118
+ Mage::dispatchEvent($this->eventPrefix . '_verify_payment', $parameters);
119
+
120
+ return $settings;
121
+ }
122
+
123
+ }
app/code/community/Payone/Core/controllers/TransactionStatusController.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core_controllers
17
+ * @subpackage
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+
24
+ /**
25
+ *
26
+ * @category Payone
27
+ * @package Payone_Core_controllers
28
+ * @subpackage
29
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
30
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
+ * @link http://www.noovias.com
32
+ */
33
+ class Payone_Core_TransactionStatusController extends Payone_Core_Controller_Abstract
34
+ {
35
+ /**
36
+ * Receives TransactionStatus from Payone, maps and saves it in database.
37
+ * Reports TSOK response to Payone if successful.
38
+ * Processing of saved TransactionStatus does not happen immediately.
39
+ *
40
+ * @return mixed
41
+ * @throws Payone_Core_Exception_OrderNotFound
42
+ */
43
+ public function indexAction()
44
+ {
45
+ try {
46
+ // Show no-route page if no Post Request
47
+ if (!$this->getRequest()->isPost()) {
48
+ $this->norouteAction();
49
+ return;
50
+ }
51
+
52
+ // only retrieve Data from POST
53
+ $this->getRequest()->setParamSources(array('_POST'));
54
+
55
+ // Get Reference (order increment_id)
56
+ $reference = $this->getRequest()->getParam('reference');
57
+
58
+ // Load Order by Reference
59
+ $order = $this->getFactory()->getModelSalesOrder();
60
+ $order->loadByIncrementId($reference);
61
+
62
+ if (!$order->hasData()) {
63
+ throw new Payone_Core_Exception_OrderNotFound();
64
+ }
65
+
66
+ // Get used config for this order
67
+ $configPaymentMethod = $this->getConfigPaymentMethod($order);
68
+ $configTransactionStatusProcessing = $this->getConfigTransactionStatusProcessing($order->getStoreId());
69
+
70
+ // Prepare Transaction Status handler
71
+ $key = $configPaymentMethod->getKey();
72
+ $validIps = $configTransactionStatusProcessing->getValidIps();
73
+ $service = $this->getFactory()->getServiceTransactionStatusHandleRequest($key, $validIps);
74
+
75
+ // Handle Request:
76
+ $response = $service->handleByPost();
77
+
78
+ // Send Confirmation Message
79
+ $this->getResponse()->setBody($response->getStatus());
80
+ }
81
+ catch (Exception $e) {
82
+ $msg = $e->getMessage();
83
+ $type = get_class($e);
84
+
85
+ Mage::throwException($type . ' : ' . $msg);
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Detects used Config for this Order
91
+ *
92
+ * @param Mage_Sales_Model_Order $order
93
+ * @return bool|Payone_Core_Model_Config_Payment_Method_Interface
94
+ */
95
+ protected function getConfigPaymentMethod(Mage_Sales_Model_Order $order)
96
+ {
97
+ return $this->helperConfig()->getConfigPaymentMethodByOrder($order);
98
+ }
99
+
100
+ protected function getConfigTransactionStatusProcessing($storeId)
101
+ {
102
+ return $this->helperConfig()->getConfigMisc($storeId)->getTransactionstatusProcessing();
103
+ }
104
+
105
+ }
app/code/community/Payone/Core/etc/adminhtml.xml ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+ -->
24
+ <config>
25
+ <menu>
26
+ <payone module="payone_core">
27
+ <title>PAYONE</title>
28
+ <sort_order>100</sort_order>
29
+ <children>
30
+ <sales_order module="payone_core">
31
+ <title>Orders</title>
32
+ <sort_order>10</sort_order>
33
+ <action>payone_core/adminhtml_sales_order</action>
34
+ </sales_order>
35
+ <transaction module="payone_core">
36
+ <title>Transactions</title>
37
+ <sort_order>20</sort_order>
38
+ <action>payone_core/adminhtml_transaction</action>
39
+ </transaction>
40
+ <protocol module="payone_core">
41
+ <title>Logs</title>
42
+ <sort_order>30</sort_order>
43
+ <children>
44
+ <transactionStatus module="payone_core">
45
+ <title>Transactionstatus</title>
46
+ <sort_order>10</sort_order>
47
+ <action>payone_core/adminhtml_protocol_transactionStatus</action>
48
+ </transactionStatus>
49
+ <api module="payone_core">
50
+ <title>API</title>
51
+ <sort_order>20</sort_order>
52
+ <action>payone_core/adminhtml_protocol_api</action>
53
+ </api>
54
+ </children>
55
+ </protocol>
56
+ <configuration module="payone_core">
57
+ <title>Configuration</title>
58
+ <sort_order>40</sort_order>
59
+ <children>
60
+ <general module="payone_core">
61
+ <title>General</title>
62
+ <sort_order>10</sort_order>
63
+ <action>adminhtml/system_config/edit/section/payone_general/</action>
64
+ </general>
65
+ <payment module="payone_core">
66
+ <title>Payment-Methods</title>
67
+ <sort_order>20</sort_order>
68
+ <action>adminhtml/system_config/edit/section/payone_payment/</action>
69
+ </payment>
70
+ <protect module="payone_core">
71
+ <title>PROTECT</title>
72
+ <sort_order>30</sort_order>
73
+ <action>adminhtml/system_config/edit/section/payone_protect/</action>
74
+ </protect>
75
+ <misc module="payone_core">
76
+ <title>Misc</title>
77
+ <sort_order>40</sort_order>
78
+ <action>adminhtml/system_config/edit/section/payone_misc/</action>
79
+ </misc>
80
+ <configuration_export module="payone_core">
81
+ <title>Export Configuration</title>
82
+ <sort_order>50</sort_order>
83
+ <action>payone_core/adminhtml_system_configuration/export</action>
84
+ </configuration_export>
85
+ </children>
86
+ </configuration>
87
+ <configuration_wizard module="payone_core">
88
+ <title>Configuration-Wizard</title>
89
+ <sort_order>50</sort_order>
90
+ <action>payone_core/adminhtml_configuration_wizard</action>
91
+ </configuration_wizard>
92
+ <information module="payone_core">
93
+ <title>Information</title>
94
+ <sort_order>60</sort_order>
95
+ <action>payone_core/adminhtml_information/</action>
96
+ </information>
97
+ </children>
98
+ </payone>
99
+ </menu>
100
+ <acl>
101
+ <resources>
102
+ <admin>
103
+ <children>
104
+ <system>
105
+ <children>
106
+ <config>
107
+ <children>
108
+ <payone_general>
109
+ <title>General</title>
110
+ <sort_order>10</sort_order>
111
+ </payone_general>
112
+ <payone_protect>
113
+ <title>PROTECT</title>
114
+ <sort_order>20</sort_order>
115
+ </payone_protect>
116
+ <payone_payment>
117
+ <title>Payment</title>
118
+ <sort_order>30</sort_order>
119
+ </payone_payment>
120
+ <payone_misc>
121
+ <title>Misc</title>
122
+ <sort_order>40</sort_order>
123
+ </payone_misc>
124
+ </children>
125
+ </config>
126
+ </children>
127
+ </system>
128
+ <payone>
129
+ <title>PAYONE</title>
130
+ <sort_order>100</sort_order>
131
+ <children>
132
+ <sales_order>
133
+ <title>Order</title>
134
+ <sort_order>10</sort_order>
135
+ </sales_order>
136
+ <transaction>
137
+ <title>Transaction</title>
138
+ <sort_order>20</sort_order>
139
+ <children>
140
+ <view>
141
+ <title>View</title>
142
+ <sort_order>10</sort_order>
143
+ </view>
144
+ </children>
145
+ </transaction>
146
+ <protocol>
147
+ <title>Logs</title>
148
+ <sort_order>30</sort_order>
149
+ <children>
150
+ <transactionStatus>
151
+ <title>Transactionstatus</title>
152
+ <sort_order>10</sort_order>
153
+ <children>
154
+ <view>
155
+ <title>View</title>
156
+ <sort_order>10</sort_order>
157
+ </view>
158
+ <export>
159
+ <title>Export</title>
160
+ <sort_order>20</sort_order>
161
+ </export>
162
+ </children>
163
+ </transactionStatus>
164
+ <api>
165
+ <title>Api</title>
166
+ <sort_order>20</sort_order>
167
+ <children>
168
+ <view>
169
+ <title>View</title>
170
+ <sort_order>10</sort_order>
171
+ </view>
172
+ <export>
173
+ <title>Export</title>
174
+ <sort_order>20</sort_order>
175
+ </export>
176
+ </children>
177
+ </api>
178
+ </children>
179
+ </protocol>
180
+ <configuration>
181
+ <title>Configuration</title>
182
+ <sort_order>40</sort_order>
183
+ <children>
184
+ <general>
185
+ <title>General</title>
186
+ <sort_order>10</sort_order>
187
+ </general>
188
+ <payment>
189
+ <title>Payment-Methods</title>
190
+ <sort_order>20</sort_order>
191
+ </payment>
192
+ <protect>
193
+ <title>PROTECT</title>
194
+ <sort_order>30</sort_order>
195
+ </protect>
196
+ <misc>
197
+ <title>Misc</title>
198
+ <sort_order>40</sort_order>
199
+ </misc>
200
+ <configuration_export>
201
+ <title>Export Configuration</title>
202
+ <sort_order>50</sort_order>
203
+ </configuration_export>
204
+ </children>
205
+ </configuration>
206
+ <configuration_wizard>
207
+ <title>Configuration-Wizard</title>
208
+ <sort_order>50</sort_order>
209
+ </configuration_wizard>
210
+ <information>
211
+ <title>Information</title>
212
+ <sort_order>60</sort_order>
213
+ </information>
214
+ </children>
215
+ </payone>
216
+ <sales>
217
+ <children>
218
+ <order>
219
+ <children>
220
+ <actions>
221
+ <children>
222
+ <invoice>
223
+ <children>
224
+ <download_payone_invoice translate="title">
225
+ <title>Download Payone-Invoice</title>
226
+ </download_payone_invoice>
227
+ </children>
228
+
229
+ </invoice>
230
+ </children>
231
+ </actions>
232
+ </children>
233
+ </order>
234
+ </children>
235
+ </sales>
236
+ </children>
237
+ </admin>
238
+ </resources>
239
+ </acl>
240
+
241
+ </config>
app/code/community/Payone/Core/etc/config.xml ADDED
@@ -0,0 +1,529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Payone_Core>
27
+ <version>3.0.6</version>
28
+ </Payone_Core>
29
+ </modules>
30
+
31
+
32
+ <global>
33
+ <blocks>
34
+ <payone_core>
35
+ <class>Payone_Core_Block</class>
36
+ </payone_core>
37
+
38
+ <checkout>
39
+ <rewrite>
40
+ <onepage_payment_methods>Payone_Core_Block_Checkout_Onepage_Payment_Methods</onepage_payment_methods>
41
+ </rewrite>
42
+ </checkout>
43
+ </blocks>
44
+
45
+ <helpers>
46
+ <payone_core>
47
+ <class>Payone_Core_Helper</class>
48
+ </payone_core>
49
+ </helpers>
50
+
51
+ <models>
52
+ <payone_core>
53
+ <class>Payone_Core_Model</class>
54
+ <resourceModel>payone_core_resource</resourceModel>
55
+ </payone_core>
56
+ <payone_core_resource>
57
+ <class>Payone_Core_Model_Domain_Resource</class>
58
+ <entities>
59
+ <transaction>
60
+ <table>payone_transaction</table>
61
+ </transaction>
62
+ <protocol_transactionStatus>
63
+ <table>payone_protocol_transactionstatus</table>
64
+ </protocol_transactionStatus>
65
+ <protocol_api>
66
+ <table>payone_protocol_api</table>
67
+ </protocol_api>
68
+ <config_payment_method>
69
+ <table>payone_config_payment_method</table>
70
+ </config_payment_method>
71
+ </entities>
72
+ </payone_core_resource>
73
+
74
+ <sales>
75
+ <rewrite>
76
+ <quote_address>Payone_Core_Model_Sales_Quote_Address</quote_address>
77
+ </rewrite>
78
+ </sales>
79
+ </models>
80
+
81
+ <resources>
82
+ <payone_core_setup>
83
+ <setup>
84
+ <module>Payone_Core</module>
85
+ </setup>
86
+ <connection>
87
+ <use>core_setup</use>
88
+ </connection>
89
+ </payone_core_setup>
90
+ <payone_core_write>
91
+ <connection>
92
+ <use>core_write</use>
93
+ </connection>
94
+ </payone_core_write>
95
+ <payone_core_read>
96
+ <connection>
97
+ <use>core_read</use>
98
+ </connection>
99
+ </payone_core_read>
100
+ </resources>
101
+ <rewrite>
102
+ <!-- Rewrite controller action from old Payone extension to Payone_Core
103
+ To allow old transactions to be finished. -->
104
+ <payone_core_transaction_status>
105
+ <from><![CDATA[#^/payone/processing/status#]]></from>
106
+ <to>/payone_core/transactionStatus/</to>
107
+ </payone_core_transaction_status>
108
+ </rewrite>
109
+ <payment>
110
+ <groups>
111
+ <payone>PAYONE</payone>
112
+ </groups>
113
+ <cc>
114
+ <types>
115
+ <MCI>
116
+ <code>MCI</code>
117
+ <name>Maestro (International)</name>
118
+ <order>53</order>
119
+ </MCI>
120
+ <JCB>
121
+ <code>JCB</code>
122
+ <name>JCB</name>
123
+ <order>55</order>
124
+ <is_cvv_required>0</is_cvv_required>
125
+ </JCB>
126
+ </types>
127
+ </cc>
128
+ </payment>
129
+ <payone>
130
+ <urls>
131
+ <api>https://api.pay1.de/post-gateway/</api>
132
+ </urls>
133
+ <payment>
134
+ </payment>
135
+ </payone>
136
+
137
+ <sales>
138
+ <quote>
139
+ <totals>
140
+ <payone_fee>
141
+ <class>payone_core/sales_quote_address_total_fee</class>
142
+ <after>shipping</after>
143
+ </payone_fee>
144
+ </totals>
145
+ </quote>
146
+ </sales>
147
+
148
+ <fieldsets>
149
+ <sales_convert_quote_payment>
150
+ <payone_config_payment_method_id>
151
+ <to_order_payment>*</to_order_payment>
152
+ </payone_config_payment_method_id>
153
+ <payone_onlinebanktransfer_type>
154
+ <!-- Online Bank Transfer: Type -->
155
+ <to_order_payment>*</to_order_payment>
156
+ </payone_onlinebanktransfer_type>
157
+ <payone_account_number>
158
+ <!-- Account number for: OnlineBankTransfer, DebitPayment -->
159
+ <to_order_payment>*</to_order_payment>
160
+ </payone_account_number>
161
+ <payone_account_owner>
162
+ <!-- Account owner for: DebitPayment -->
163
+ <to_order_payment>*</to_order_payment>
164
+ </payone_account_owner>
165
+ <payone_bank_country>
166
+ <!-- Online Bank Transfer: Bank Country -->
167
+ <to_order_payment>*</to_order_payment>
168
+ </payone_bank_country>
169
+ <payone_bank_code>
170
+ <!-- Bank Account Code for: OnlineBankTransfer, DebitPayment -->
171
+ <to_order_payment>*</to_order_payment>
172
+ </payone_bank_code>
173
+ <payone_bank_group>
174
+ <!-- Online Bank Transfer: Bank Group -->
175
+ <to_order_payment>*</to_order_payment>
176
+ </payone_bank_group>
177
+ <payone_pseudocardpan>
178
+ <!-- Creditcard: Pseudo Card PAN-->
179
+ <to_order_payment>*</to_order_payment>
180
+ </payone_pseudocardpan>
181
+ </sales_convert_quote_payment>
182
+ <sales_convert_quote_address>
183
+ <payone_addresscheck_score>
184
+ <to_customer_address>*</to_customer_address>
185
+ </payone_addresscheck_score>
186
+ <payone_protect_score>
187
+ <to_customer_address>*</to_customer_address>
188
+ </payone_protect_score>
189
+ <payone_protect_date>
190
+ <to_customer_address>*</to_customer_address>
191
+ </payone_protect_date>
192
+ </sales_convert_quote_address>
193
+ </fieldsets>
194
+
195
+ <template>
196
+ <email>
197
+ <payone_misc_email_error_template translate="label" module="payone_core">
198
+ <label>PAYONE - Email Error</label>
199
+ <file>payone/core/error_template.phtml</file>
200
+ <type>html</type>
201
+ </payone_misc_email_error_template>
202
+ <payone_misc_email_avs_template translate="label" module="payone_core">
203
+ <label>PAYONE - Email AVS</label>
204
+ <file>payone/core/avs_template.phtml</file>
205
+ <type>html</type>
206
+ </payone_misc_email_avs_template>
207
+ </email>
208
+ </template>
209
+
210
+ <events>
211
+ <sales_quote_address_validate_after>
212
+ <observers>
213
+ <payone_core_observer>
214
+ <type>singleton</type>
215
+ <class>payone_core/observer_sales_quote_address</class>
216
+ <method>validateAfter</method>
217
+ </payone_core_observer>
218
+ </observers>
219
+ </sales_quote_address_validate_after>
220
+ <sales_quote_payment_import_data_before>
221
+ <observers>
222
+ <payone_core_observer>
223
+ <type>singleton</type>
224
+ <class>payone_core/observer_sales_quote_payment</class>
225
+ <method>importDataBefore</method>
226
+ </payone_core_observer>
227
+ </observers>
228
+ </sales_quote_payment_import_data_before>
229
+ <checkout_onepage_payment_methods_get_methods>
230
+ <observers>
231
+ <payone_core_observer>
232
+ <type>singleton</type>
233
+ <class>payone_core/observer_checkout_onepage_payment_methods</class>
234
+ <method>getMethods</method>
235
+ </payone_core_observer>
236
+ </observers>
237
+ </checkout_onepage_payment_methods_get_methods>
238
+ <payone_core_checkout_onepage_verify_payment>
239
+ <observers>
240
+ <payone_core_observer>
241
+ <type>singleton</type>
242
+ <class>payone_core/observer_checkout_onepage</class>
243
+ <method>verifyPayment</method>
244
+ </payone_core_observer>
245
+ </observers>
246
+ </payone_core_checkout_onepage_verify_payment>
247
+ <sales_order_resource_init_virtual_grid_columns>
248
+ <observers>
249
+ <payone_core_observer>
250
+ <class>payone_core/observer_sales_order</class>
251
+ <method>updateOrderGrid</method>
252
+ </payone_core_observer>
253
+ </observers>
254
+ </sales_order_resource_init_virtual_grid_columns>
255
+ <sales_order_place_after>
256
+ <observers>
257
+ <payone_core_observer>
258
+ <class>payone_core/observer_sales_order</class>
259
+ <method>incrementSampleCounter</method>
260
+ </payone_core_observer>
261
+ </observers>
262
+ </sales_order_place_after>
263
+ <payone_core_transactionstatus_all>
264
+ <observers>
265
+ <payone_core_observer_forwarding>
266
+ <type>singleton</type>
267
+ <class>payone_core/observer_transactionStatus_forwarding</class>
268
+ <method>onAll</method>
269
+ </payone_core_observer_forwarding>
270
+ </observers>
271
+ </payone_core_transactionstatus_all>
272
+ <payone_core_transactionstatus_appointed>
273
+ <observers>
274
+ <payone_core_observer_invoiceCreate>
275
+ <type>singleton</type>
276
+ <class>payone_core/observer_transactionStatus_invoiceCreate</class>
277
+ <method>onAppointed</method>
278
+ </payone_core_observer_invoiceCreate>
279
+ </observers>
280
+ </payone_core_transactionstatus_appointed>
281
+ <payone_core_transactionstatus_paid>
282
+ <observers>
283
+ <payone_core_observer_invoiceCreate>
284
+ <type>singleton</type>
285
+ <class>payone_core/observer_transactionStatus_invoiceCreate</class>
286
+ <method>onPaid</method>
287
+ </payone_core_observer_invoiceCreate>
288
+ </observers>
289
+ </payone_core_transactionstatus_paid>
290
+ <payone_core_transactionstatus_reminder>
291
+ <observers>
292
+ <payone_core_observer_reminder>
293
+ <type>singleton</type>
294
+ <class>payone_core/observer_transactionStatus_reminder</class>
295
+ <method>onReminder</method>
296
+ </payone_core_observer_reminder>
297
+ </observers>
298
+ </payone_core_transactionstatus_reminder>
299
+ <sales_order_payment_capture>
300
+ <observers>
301
+ <payone_core_observer_invoice>
302
+ <type>singleton</type>
303
+ <class>payone_core/observer_sales_order_invoice</class>
304
+ <method>prepareInvoice</method>
305
+ </payone_core_observer_invoice>
306
+ </observers>
307
+ </sales_order_payment_capture>
308
+ <payone_core_capture_approved>
309
+ <observers>
310
+ <payone_core_observer_invoice>
311
+ <type>singleton</type>
312
+ <class>payone_core/observer_sales_order_invoice</class>
313
+ <method>prepareSequencenumber</method>
314
+ </payone_core_observer_invoice>
315
+ </observers>
316
+ </payone_core_capture_approved>
317
+ <payone_core_api_protocol_save_after>
318
+ <observers>
319
+ <payone_core_observer_protocol_api>
320
+ <type>singleton</type>
321
+ <class>payone_core/observer_protocol_api</class>
322
+ <method>prepareApi</method>
323
+ </payone_core_observer_protocol_api>
324
+ </observers>
325
+ </payone_core_api_protocol_save_after>
326
+ <payone_core_service_payment>
327
+ <observers>
328
+ <payone_core_observer_protocol_api>
329
+ <type>singleton</type>
330
+ <class>payone_core/observer_protocol_api</class>
331
+ <method>updateApiData</method>
332
+ </payone_core_observer_protocol_api>
333
+ </observers>
334
+ </payone_core_service_payment>
335
+ </events>
336
+ </global>
337
+
338
+ <admin>
339
+ <routers>
340
+ <payone_core>
341
+ <use>admin</use>
342
+ <args>
343
+ <module>Payone_Core</module>
344
+ <frontName>payone_core</frontName>
345
+ </args>
346
+ </payone_core>
347
+ </routers>
348
+ </admin>
349
+
350
+ <adminhtml>
351
+ <layout>
352
+ <updates>
353
+ <payone_core>
354
+ <file>payone/core.xml</file>
355
+ </payone_core>
356
+ <payone_configuration>
357
+ <file>payone/configuration.xml</file>
358
+ </payone_configuration>
359
+ <payone_transaction>
360
+ <file>payone/transaction.xml</file>
361
+ </payone_transaction>
362
+ </updates>
363
+ </layout>
364
+
365
+ <translate>
366
+ <modules>
367
+ <Payone_Core>
368
+ <files>
369
+ <default>Payone_Core.csv</default>
370
+ </files>
371
+ </Payone_Core>
372
+ </modules>
373
+ </translate>
374
+
375
+ </adminhtml>
376
+
377
+ <frontend>
378
+ <routers>
379
+ <payone_core>
380
+ <use>standard</use>
381
+ <args>
382
+ <module>Payone_Core</module>
383
+ <frontName>payone_core</frontName>
384
+ </args>
385
+ </payone_core>
386
+ </routers>
387
+
388
+ <layout>
389
+ <updates>
390
+ <payone_core>
391
+ <file>payone/core.xml</file>
392
+ </payone_core>
393
+ </updates>
394
+ </layout>
395
+
396
+ <translate>
397
+ <modules>
398
+ <Payone_Core>
399
+ <files>
400
+ <default>Payone_Core.csv</default>
401
+ </files>
402
+ </Payone_Core>
403
+ </modules>
404
+ </translate>
405
+ </frontend>
406
+
407
+ <default>
408
+ <payment>
409
+ <payone_creditcard translate="title" module="payone_core">
410
+ <title>PAYONE - CreditCard</title>
411
+ <model>payone_core/payment_method_creditcard</model>
412
+ <group>payone</group>
413
+ </payone_creditcard>
414
+ <payone_cash_on_delivery translate="title" module="payone_core">
415
+ <title>PAYONE - Cash on Delivery</title>
416
+ <model>payone_core/payment_method_cashOnDelivery</model>
417
+ <group>payone</group>
418
+ </payone_cash_on_delivery>
419
+ <payone_debit_payment translate="title" module="payone_core">
420
+ <title>PAYONE - DebitPayment</title>
421
+ <model>payone_core/payment_method_debitPayment</model>
422
+ <group>payone</group>
423
+ </payone_debit_payment>
424
+ <payone_invoice translate="title" module="payone_core">
425
+ <title>PAYONE - Invoice</title>
426
+ <model>payone_core/payment_method_invoice</model>
427
+ <group>payone</group>
428
+ </payone_invoice>
429
+ <payone_online_bank_transfer translate="title" module="payone_core">
430
+ <title>PAYONE - Online Bank Transfer</title>
431
+ <model>payone_core/payment_method_onlineBankTransfer</model>
432
+ <group>payone</group>
433
+ </payone_online_bank_transfer>
434
+ <payone_advance_payment translate="title" module="payone_core">
435
+ <title>PAYONE - AdvancePayment</title>
436
+ <model>payone_core/payment_method_advancePayment</model>
437
+ <group>payone</group>
438
+ </payone_advance_payment>
439
+ <payone_wallet translate="title" module="payone_core">
440
+ <title>PAYONE - Wallet</title>
441
+ <model>payone_core/payment_method_wallet</model>
442
+ <group>payone</group>
443
+ </payone_wallet>
444
+ </payment>
445
+ <payone_payment>
446
+ <template_creditcard>
447
+ <use_global>1</use_global>
448
+ </template_creditcard>
449
+ <template_debit_payment>
450
+ <use_global>1</use_global>
451
+ <check_bankaccount>0</check_bankaccount>
452
+ </template_debit_payment>
453
+ <template_online_bank_transfer>
454
+ <use_global>1</use_global>
455
+ </template_online_bank_transfer>
456
+ <template_invoice>
457
+ <use_global>1</use_global>
458
+ </template_invoice>
459
+ <template_wallet>
460
+ <use_global>1</use_global>
461
+ </template_wallet>
462
+ <template_advance_payment>
463
+ <use_global>1</use_global>
464
+ </template_advance_payment>
465
+ <template_cash_on_delivery>
466
+ <use_global>1</use_global>
467
+ </template_cash_on_delivery>
468
+ </payone_payment>
469
+ <payone_general>
470
+ <transactionstatus_execute>
471
+ <max_execution_time>35</max_execution_time>
472
+ </transactionstatus_execute>
473
+ <status_mapping>
474
+ <creditcard>a:1:{s:23:"_payone_status_mapping1";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:6:"status";a:1:{i:0;s:10:"processing";}}}</creditcard>
475
+ <invoice>a:1:{s:23:"_payone_status_mapping2";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:6:"status";a:1:{i:0;s:10:"processing";}}}</invoice>
476
+ <debit_payment>a:1:{s:23:"_payone_status_mapping3";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:6:"status";a:1:{i:0;s:10:"processing";}}}</debit_payment>
477
+ <advance_payment>a:2:{s:23:"_payone_status_mapping4";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:6:"status";a:1:{i:0;s:7:"pending";}}s:23:"_payone_status_mapping5";a:2:{s:8:"txaction";a:1:{i:0;s:4:"paid";}s:6:"status";a:1:{i:0;s:10:"processing";}}}</advance_payment>
478
+ <online_bank_transfer>a:1:{s:23:"_payone_status_mapping6";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:6:"status";a:1:{i:0;s:10:"processing";}}}</online_bank_transfer>
479
+ <cash_on_delivery>a:1:{s:23:"_payone_status_mapping7";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:6:"status";a:1:{i:0;s:10:"processing";}}}</cash_on_delivery>
480
+ <wallet>a:1:{s:23:"_payone_status_mapping8";a:2:{s:8:"txaction";a:1:{i:0;s:9:"appointed";}s:6:"status";a:1:{i:0;s:10:"processing";}}}</wallet>
481
+ </status_mapping>
482
+ </payone_general>
483
+ <payone_protect>
484
+ <general>
485
+ <enabled>1</enabled>
486
+ </general>
487
+ <addresscheck>
488
+ <handle_response_error>continue_checkout</handle_response_error>
489
+ </addresscheck>
490
+ <creditcrating>
491
+ <integration_event>before_payment</integration_event>
492
+ <handle_response_error>continue_checkout</handle_response_error>
493
+ </creditcrating>
494
+ </payone_protect>
495
+ <payone_misc>
496
+ <transactionstatus_processing>
497
+ <cron_expr>* * * * *</cron_expr>
498
+ <valid_ips><![CDATA[213.178.72.196
499
+ 213.178.72.197
500
+ 217.70.200.*]]></valid_ips>
501
+ </transactionstatus_processing>
502
+ <email_exception>
503
+ <enabled>0</enabled>
504
+ <template>payone_misc_email_error_template</template>
505
+ </email_exception>
506
+ <email_avs>
507
+ <enabled>0</enabled>
508
+ <template>payone_misc_email_avs_template</template>
509
+ </email_avs>
510
+ <shipping_costs>
511
+ <sku>Shipping</sku>
512
+ </shipping_costs>
513
+ </payone_misc>
514
+ </default>
515
+
516
+ <crontab>
517
+ <jobs>
518
+ <!-- decoupled processing of transactionStatus-->
519
+ <payone_core_cronjob_transactionstatus_process>
520
+ <schedule>
521
+ <config_path>payone_misc/transactionstatus_processing/cron_expr</config_path>
522
+ </schedule>
523
+ <run>
524
+ <model>payone_core/cronjob_transactionStatus_worker::execute</model>
525
+ </run>
526
+ </payone_core_cronjob_transactionstatus_process>
527
+ </jobs>
528
+ </crontab>
529
+ </config>
app/code/community/Payone/Core/etc/system.xml ADDED
@@ -0,0 +1,1313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?><!--
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the GNU General Public License (GPL 3)
7
+ * that is bundled with this package in the file LICENSE.txt
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
12
+ * versions in the future. If you wish to customize Payone_Core for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Core
17
+ * @subpackage etc
18
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
19
+ * @author Matthias Walter <info@noovias.com>
20
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
+ * @link http://www.noovias.com
22
+ */
23
+ -->
24
+ <config>
25
+ <tabs>
26
+ <payone translate="label" module="payone_core">
27
+ <label>PAYONE</label>
28
+ <class>tab-payone</class>
29
+ <sort_order>401</sort_order>
30
+ </payone>
31
+ </tabs>
32
+ <sections>
33
+ <payment>
34
+ <groups>
35
+ <payone_hint>
36
+ <frontend_model>payone_core/adminhtml_system_config_notice</frontend_model>
37
+ <hint>
38
+ <template>payone/core/system/config/hint/payment_reference.phtml</template>
39
+ </hint>
40
+ <sort_order>-10</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </payone_hint>
45
+ </groups>
46
+ </payment>
47
+ <payone_general translate="label" module="payone_core">
48
+ <label>General</label>
49
+ <tab>payone</tab>
50
+ <header_css>payone-config-header</header_css>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>10</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <groups>
57
+ <global>
58
+ <label>Global</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>10</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <fields>
65
+ <hint translate="label">
66
+ <label>Global</label>
67
+ <sort_order>0</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <hint>
72
+ <template>payone/core/system/config/tooltip/general/global.phtml</template>
73
+ </hint>
74
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
75
+ </hint>
76
+ <mid translate="label">
77
+ <label>Merchant-ID</label>
78
+ <frontend_type>text</frontend_type>
79
+ <sort_order>10</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ </mid>
84
+ <portalid translate="label">
85
+ <label>Portal-ID</label>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>20</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </portalid>
92
+ <aid translate="label">
93
+ <label>Sub-Account-ID</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>30</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </aid>
100
+ <key translate="label">
101
+ <label>Security Key</label>
102
+ <frontend_type>text</frontend_type>
103
+ <sort_order>40</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ </key>
108
+ <allowspecific translate="label">
109
+ <label>Payment from Applicable Countries</label>
110
+ <frontend_type>allowspecific</frontend_type>
111
+ <sort_order>50</sort_order>
112
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </allowspecific>
117
+ <specificcountry translate="label">
118
+ <label>Specific Countries</label>
119
+ <frontend_type>multiselect</frontend_type>
120
+ <sort_order>50</sort_order>
121
+ <depends>
122
+ <allowspecific>1</allowspecific>
123
+ </depends>
124
+ <source_model>adminhtml/system_config_source_country</source_model>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ </specificcountry>
129
+ <request_type translate="label">
130
+ <label>Authorize-Method</label>
131
+ <frontend_type>select</frontend_type>
132
+ <source_model>payone_core/system_config_authorizeMethod</source_model>
133
+ <sort_order>60</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>1</show_in_store>
137
+ </request_type>
138
+ </fields>
139
+ </global>
140
+ <parameter_invoice>
141
+ <label>Send Invoicing Information</label>
142
+ <frontend_type>text</frontend_type>
143
+ <sort_order>20</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>1</show_in_store>
147
+ <fields>
148
+ <hint translate="label">
149
+ <label>Send Invoicing Information</label>
150
+ <sort_order>0</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ <hint>
155
+ <template>payone/core/system/config/tooltip/general/parameter_invoice.phtml</template>
156
+ </hint>
157
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
158
+ </hint>
159
+ <transmit_enabled translate="label">
160
+ <label>Transmit Invoice Information</label>
161
+ <frontend_type>select</frontend_type>
162
+ <source_model>adminhtml/system_config_source_yesno</source_model>
163
+ <sort_order>10</sort_order>
164
+ <comment>Please note that you can use these options only, if you subscribe to the invoicing module of Payone.</comment>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>1</show_in_store>
168
+ </transmit_enabled>
169
+ <invoice_appendix translate="label,comment">
170
+ <label>Dynamic Invoice Message</label>
171
+ <frontend_type>textarea</frontend_type>
172
+ <sort_order>20</sort_order>
173
+ <comment>Maximum 255 digits. Placeholders: {{order_increment_id}}, {{order_id}}, {{customer_increment_id}}, {{customer_id}}, {{invoice_increment_id}}</comment>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ </invoice_appendix>
178
+ <invoice_appendix_refund translate="label,comment">
179
+ <label>Dynamic Refund Message</label>
180
+ <frontend_type>textarea</frontend_type>
181
+ <sort_order>30</sort_order>
182
+ <comment>Maximum 255 digits. Placeholders: {{order_increment_id}}, {{order_id}}, {{customer_increment_id}}, {{customer_id}}, {{creditmemo_increment_id}}, {{invoice_increment_id}}, {{invoice_id}}</comment>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ </invoice_appendix_refund>
187
+
188
+ </fields>
189
+ </parameter_invoice>
190
+ <status_mapping>
191
+ <label>Status Mapping</label>
192
+ <frontend_type>text</frontend_type>
193
+ <sort_order>30</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ <fields>
198
+ <hint translate="label">
199
+ <label>Status Mapping</label>
200
+ <sort_order>0</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>1</show_in_website>
203
+ <show_in_store>1</show_in_store>
204
+ <hint>
205
+ <template>payone/core/system/config/tooltip/general/status_mapping.phtml</template>
206
+ </hint>
207
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
208
+ </hint>
209
+ <creditcard translate="label">
210
+ <label>Creditcard</label>
211
+ <frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
212
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
213
+ <sort_order>10</sort_order>
214
+ <show_in_default>1</show_in_default>
215
+ <show_in_website>1</show_in_website>
216
+ <show_in_store>1</show_in_store>
217
+ </creditcard>
218
+ <invoice translate="label">
219
+ <label>Invoice</label>
220
+ <frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
221
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
222
+ <sort_order>20</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>1</show_in_store>
226
+ </invoice>
227
+ <debit_payment translate="label">
228
+ <label>Debit Payment</label>
229
+ <frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
230
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
231
+ <sort_order>30</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>1</show_in_store>
235
+ </debit_payment>
236
+ <advance_payment translate="label">
237
+ <label>Advance Payment</label>
238
+ <frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
239
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
240
+ <sort_order>40</sort_order>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>1</show_in_store>
244
+ </advance_payment>
245
+ <online_bank_transfer translate="label">
246
+ <label>Online Bank Transfer</label>
247
+ <frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
248
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
249
+ <sort_order>50</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ <show_in_store>1</show_in_store>
253
+ </online_bank_transfer>
254
+ <cash_on_delivery translate="label">
255
+ <label>Cash on Delivery</label>
256
+ <frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
257
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
258
+ <sort_order>60</sort_order>
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
+ </cash_on_delivery>
263
+ <wallet translate="label">
264
+ <label>Wallet</label>
265
+ <frontend_model>payone_core/adminhtml_system_config_form_field_statusMapping</frontend_model>
266
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
267
+ <sort_order>70</sort_order>
268
+ <show_in_default>1</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>1</show_in_store>
271
+ </wallet>
272
+ </fields>
273
+ </status_mapping>
274
+ <payment_creditcard>
275
+ <label>Payment Creditcard</label>
276
+ <frontend_type>text</frontend_type>
277
+ <sort_order>100</sort_order>
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
+ <fields>
282
+ <hint translate="label">
283
+ <label>Payment Creditcard</label>
284
+ <sort_order>0</sort_order>
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
+ <hint>
289
+ <template>payone/core/system/config/tooltip/general/payment_creditcard.phtml</template>
290
+ </hint>
291
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
292
+ </hint>
293
+ <min_validity_period translate="label,comment">
294
+ <label>Minimum Validity Period</label>
295
+ <comment>Minimum period a CreditCard has to be valid. (in days)</comment>
296
+ <frontend_type>text</frontend_type>
297
+ <sort_order>10</sort_order>
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
+ </min_validity_period>
302
+ </fields>
303
+ </payment_creditcard>
304
+ <parameter_narrative_text>
305
+ <label>Narrative Text</label>
306
+ <frontend_type>text</frontend_type>
307
+ <sort_order>110</sort_order>
308
+ <show_in_default>1</show_in_default>
309
+ <show_in_website>1</show_in_website>
310
+ <show_in_store>1</show_in_store>
311
+ <fields>
312
+ <hint translate="label">
313
+ <label>Narrative Text</label>
314
+ <sort_order>0</sort_order>
315
+ <show_in_default>1</show_in_default>
316
+ <show_in_website>1</show_in_website>
317
+ <show_in_store>1</show_in_store>
318
+ <hint>
319
+ <template>payone/core/system/config/tooltip/general/narrative_text.phtml</template>
320
+ </hint>
321
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
322
+ </hint>
323
+ <creditcard>
324
+ <label>Creditcard</label>
325
+ <comment>Maximum 81 digits. Placeholders: {{order_increment_id}}</comment>
326
+ <frontend_type>textarea</frontend_type>
327
+ <sort_order>10</sort_order>
328
+ <show_in_default>1</show_in_default>
329
+ <show_in_website>1</show_in_website>
330
+ <show_in_store>1</show_in_store>
331
+ </creditcard>
332
+ <debit_payment>
333
+ <label>Debit Payment</label>
334
+ <comment>Maximum 3 lines à 27 digits. Placeholders: {{order_increment_id}}</comment>
335
+ <frontend_type>textarea</frontend_type>
336
+ <sort_order>20</sort_order>
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
+ </debit_payment>
341
+ </fields>
342
+ </parameter_narrative_text>
343
+ </groups>
344
+ </payone_general>
345
+
346
+ <payone_payment translate="label" module="payone_core">
347
+ <label>Payment</label>
348
+ <tab>payone</tab>
349
+ <header_css>payone-config-header</header_css>
350
+ <frontend_type>text</frontend_type>
351
+ <frontend_model>payone_core/adminhtml_system_config_form_payment</frontend_model>
352
+ <sort_order>30</sort_order>
353
+ <show_in_default>1</show_in_default>
354
+ <show_in_website>1</show_in_website>
355
+ <show_in_store>1</show_in_store>
356
+ <groups>
357
+ <hint>
358
+ <frontend_model>payone_core/adminhtml_system_config_hint</frontend_model>
359
+ <hint>
360
+ <template>payone/core/system/config/hint/payment.phtml</template>
361
+ </hint>
362
+ <sort_order>0</sort_order>
363
+ <show_in_default>1</show_in_default>
364
+ <show_in_website>1</show_in_website>
365
+ <show_in_store>1</show_in_store>
366
+ </hint>
367
+ <template_default>
368
+ <label>Default Data</label>
369
+ <frontend_type>text</frontend_type>
370
+ <sort_order>1</sort_order>
371
+ <show_in_default>1</show_in_default>
372
+ <show_in_website>1</show_in_website>
373
+ <show_in_store>1</show_in_store>
374
+ <expanded>1</expanded>
375
+ <fields>
376
+ <hint translate="label">
377
+ <label>Payment</label>
378
+ <sort_order>0</sort_order>
379
+ <show_in_default>1</show_in_default>
380
+ <show_in_website>1</show_in_website>
381
+ <show_in_store>1</show_in_store>
382
+ <hint>
383
+ <template>payone/core/system/config/tooltip/payment/method.phtml</template>
384
+ </hint>
385
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
386
+ </hint>
387
+ <enabled translate="label">
388
+ <label>Enabled</label>
389
+ <frontend_type>select</frontend_type>
390
+ <source_model>adminhtml/system_config_source_yesno</source_model>
391
+ <sort_order>10</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>1</show_in_store>
395
+ </enabled>
396
+ <sort_order translate="label">
397
+ <label>Sort order</label>
398
+ <frontend_type>text</frontend_type>
399
+ <sort_order>30</sort_order>
400
+ <show_in_default>1</show_in_default>
401
+ <show_in_website>1</show_in_website>
402
+ <show_in_store>1</show_in_store>
403
+ </sort_order>
404
+ <name translate="label">
405
+ <label>Name</label>
406
+ <frontend_type>text</frontend_type>
407
+ <sort_order>40</sort_order>
408
+ <show_in_default>1</show_in_default>
409
+ <show_in_website>1</show_in_website>
410
+ <show_in_store>1</show_in_store>
411
+ </name>
412
+ <fee_config translate="label">
413
+ <label>Handling Fee</label>
414
+ <frontend_model>payone_core/adminhtml_system_config_form_field_paymentFee</frontend_model>
415
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
416
+ <sort_order>50</sort_order>
417
+ <show_in_default>1</show_in_default>
418
+ <show_in_website>1</show_in_website>
419
+ <show_in_store>1</show_in_store>
420
+ </fee_config>
421
+ <min_order_total translate="label">
422
+ <label>Minimum Order Total</label>
423
+ <frontend_type>text</frontend_type>
424
+ <sort_order>60</sort_order>
425
+ <show_in_default>1</show_in_default>
426
+ <show_in_website>1</show_in_website>
427
+ <show_in_store>1</show_in_store>
428
+ </min_order_total>
429
+ <max_order_total translate="label">
430
+ <label>Maximum Order Total</label>
431
+ <frontend_type>text</frontend_type>
432
+ <sort_order>70</sort_order>
433
+ <show_in_default>1</show_in_default>
434
+ <show_in_website>1</show_in_website>
435
+ <show_in_store>1</show_in_store>
436
+ </max_order_total>
437
+ <mode>
438
+ <label>Mode</label>
439
+ <frontend_type>select</frontend_type>
440
+ <source_model>payone_core/system_config_mode</source_model>
441
+ <sort_order>80</sort_order>
442
+ <show_in_default>1</show_in_default>
443
+ <show_in_website>1</show_in_website>
444
+ <show_in_store>1</show_in_store>
445
+ </mode>
446
+ <use_global>
447
+ <label>Use Global Settings</label>
448
+ <frontend_type>select</frontend_type>
449
+ <source_model>adminhtml/system_config_source_yesno</source_model>
450
+ <sort_order>1000</sort_order>
451
+ <show_in_default>1</show_in_default>
452
+ <show_in_website>1</show_in_website>
453
+ <show_in_store>1</show_in_store>
454
+ </use_global>
455
+ <allowspecific translate="label">
456
+ <label>Payment from Applicable Countries</label>
457
+ <frontend_type>allowspecific</frontend_type>
458
+ <sort_order>1010</sort_order>
459
+ <depends>
460
+ <use_global>0</use_global>
461
+ </depends>
462
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
463
+ <show_in_default>1</show_in_default>
464
+ <show_in_website>1</show_in_website>
465
+ <show_in_store>1</show_in_store>
466
+ </allowspecific>
467
+ <specificcountry translate="label">
468
+ <label>Payment from Specific Countries</label>
469
+ <frontend_type>multiselect</frontend_type>
470
+ <sort_order>1020</sort_order>
471
+ <depends>
472
+ <use_global>0</use_global>
473
+ <allowspecific>1</allowspecific>
474
+ </depends>
475
+ <source_model>adminhtml/system_config_source_country</source_model>
476
+ <show_in_default>1</show_in_default>
477
+ <show_in_website>1</show_in_website>
478
+ <show_in_store>1</show_in_store>
479
+ </specificcountry>
480
+ <mid translate="label">
481
+ <label>Merchant-ID</label>
482
+ <frontend_type>text</frontend_type>
483
+ <sort_order>1100</sort_order>
484
+ <depends>
485
+ <use_global>0</use_global>
486
+ </depends>
487
+ <show_in_default>1</show_in_default>
488
+ <show_in_website>1</show_in_website>
489
+ <show_in_store>1</show_in_store>
490
+ </mid>
491
+ <portalid translate="label">
492
+ <label>Portal-ID</label>
493
+ <frontend_type>text</frontend_type>
494
+ <sort_order>1110</sort_order>
495
+ <depends>
496
+ <use_global>0</use_global>
497
+ </depends>
498
+ <show_in_default>1</show_in_default>
499
+ <show_in_website>1</show_in_website>
500
+ <show_in_store>1</show_in_store>
501
+ </portalid>
502
+ <aid translate="label">
503
+ <label>Sub-Account-ID</label>
504
+ <frontend_type>text</frontend_type>
505
+ <sort_order>1120</sort_order>
506
+ <depends>
507
+ <use_global>0</use_global>
508
+ </depends>
509
+ <show_in_default>1</show_in_default>
510
+ <show_in_website>1</show_in_website>
511
+ <show_in_store>1</show_in_store>
512
+ </aid>
513
+ <key translate="label">
514
+ <label>Security Key</label>
515
+ <frontend_type>text</frontend_type>
516
+ <sort_order>1130</sort_order>
517
+ <depends>
518
+ <use_global>0</use_global>
519
+ </depends>
520
+ <show_in_default>1</show_in_default>
521
+ <show_in_website>1</show_in_website>
522
+ <show_in_store>1</show_in_store>
523
+ </key>
524
+ <request_type translate="label">
525
+ <label>Authorize-Method</label>
526
+ <frontend_type>select</frontend_type>
527
+ <source_model>payone_core/system_config_authorizeMethod</source_model>
528
+ <sort_order>1140</sort_order>
529
+ <depends>
530
+ <use_global>0</use_global>
531
+ </depends>
532
+ <show_in_default>1</show_in_default>
533
+ <show_in_website>1</show_in_website>
534
+ <show_in_store>1</show_in_store>
535
+ </request_type>
536
+ <invoice_transmit translate="label">
537
+ <label>Transmit Invoice Information</label>
538
+ <frontend_type>select</frontend_type>
539
+ <source_model>adminhtml/system_config_source_yesno</source_model>
540
+ <sort_order>1150</sort_order>
541
+ <depends>
542
+ <use_global>0</use_global>
543
+ </depends>
544
+ <show_in_default>1</show_in_default>
545
+ <show_in_website>1</show_in_website>
546
+ <show_in_store>1</show_in_store>
547
+ </invoice_transmit>
548
+ </fields>
549
+ </template_default>
550
+ <template_creditcard translate="label" module="payone_core">
551
+ <label>Creditcard</label>
552
+ <frontend_type>text</frontend_type>
553
+ <sort_order>1</sort_order>
554
+ <show_in_default>1</show_in_default>
555
+ <show_in_website>1</show_in_website>
556
+ <show_in_store>1</show_in_store>
557
+ <expanded>1</expanded>
558
+ <fields>
559
+ <types>
560
+ <label>Creditcard-Type</label>
561
+ <frontend_type>multiselect</frontend_type>
562
+ <source_model>payone_core/system_config_creditCardType</source_model>
563
+ <sort_order>200</sort_order>
564
+ <show_in_default>1</show_in_default>
565
+ <show_in_website>1</show_in_website>
566
+ <show_in_store>1</show_in_store>
567
+ </types>
568
+ <check_cvc translate="label">
569
+ <label>Check Card Validation Code</label>
570
+ <frontend_type>select</frontend_type>
571
+ <source_model>adminhtml/system_config_source_yesno</source_model>
572
+ <sort_order>250</sort_order>
573
+ <show_in_default>1</show_in_default>
574
+ <show_in_website>1</show_in_website>
575
+ <show_in_store>1</show_in_store>
576
+ </check_cvc>
577
+ </fields>
578
+ </template_creditcard>
579
+ <template_debit_payment translate="label" module="payone_core">
580
+ <label>Debit Payment</label>
581
+ <frontend_type>text</frontend_type>
582
+ <sort_order>2</sort_order>
583
+ <show_in_default>1</show_in_default>
584
+ <show_in_website>1</show_in_website>
585
+ <show_in_store>1</show_in_store>
586
+ <fields>
587
+ <check_bankaccount translate="label,comment">
588
+ <label>Validate bank code</label>
589
+ <comment>Requires PAYONE API access.</comment>
590
+ <frontend_type>select</frontend_type>
591
+ <source_model>adminhtml/system_config_source_yesno</source_model>
592
+ <sort_order>200</sort_order>
593
+ <show_in_default>1</show_in_default>
594
+ <show_in_website>1</show_in_website>
595
+ <show_in_store>1</show_in_store>
596
+ </check_bankaccount>
597
+ <bankaccountcheck_type translate="label,comment">
598
+ <label>Bank code validation type</label>
599
+ <depends>
600
+ <check_bankaccount>1</check_bankaccount>
601
+ </depends>
602
+ <frontend_type>select</frontend_type>
603
+ <source_model>payone_core/system_config_bankaccountcheckType</source_model>
604
+ <sort_order>210</sort_order>
605
+ <show_in_default>1</show_in_default>
606
+ <show_in_website>1</show_in_website>
607
+ <show_in_store>1</show_in_store>
608
+ </bankaccountcheck_type>
609
+ <message_response_blocked translate="label,comment">
610
+ <label>Message to display for blocked bank accounts</label>
611
+ <depends>
612
+ <check_bankaccount>1</check_bankaccount>
613
+ </depends>
614
+ <frontend_type>text</frontend_type>
615
+ <sort_order>220</sort_order>
616
+ <show_in_default>1</show_in_default>
617
+ <show_in_website>1</show_in_website>
618
+ <show_in_store>1</show_in_store>
619
+ </message_response_blocked>
620
+ </fields>
621
+ </template_debit_payment>
622
+ <template_online_bank_transfer translate="label" module="payone_core">
623
+ <label>Online Bank Transfer</label>
624
+ <frontend_type>text</frontend_type>
625
+ <sort_order>3</sort_order>
626
+ <show_in_default>1</show_in_default>
627
+ <show_in_website>1</show_in_website>
628
+ <show_in_store>1</show_in_store>
629
+ <fields>
630
+ <types translate="label,comment">
631
+ <label>Banktransfer-Type</label>
632
+ <frontend_type>multiselect</frontend_type>
633
+ <source_model>payone_core/system_config_onlinebanktransferType</source_model>
634
+ <sort_order>200</sort_order>
635
+ <show_in_default>1</show_in_default>
636
+ <show_in_website>1</show_in_website>
637
+ <show_in_store>1</show_in_store>
638
+ </types>
639
+ </fields>
640
+ </template_online_bank_transfer>
641
+ <template_invoice translate="label" module="payone_core">
642
+ <label>Invoice</label>
643
+ <frontend_type>text</frontend_type>
644
+ <sort_order>4</sort_order>
645
+ <show_in_default>1</show_in_default>
646
+ <show_in_website>1</show_in_website>
647
+ <show_in_store>1</show_in_store>
648
+ <fields></fields>
649
+ </template_invoice>
650
+ <template_wallet translate="label" module="payone_core">
651
+ <label>Wallet</label>
652
+ <frontend_type>text</frontend_type>
653
+ <sort_order>5</sort_order>
654
+ <show_in_default>1</show_in_default>
655
+ <show_in_website>1</show_in_website>
656
+ <show_in_store>1</show_in_store>
657
+ <fields>
658
+ <types translate="label,comment">
659
+ <label>Wallet-Type</label>
660
+ <frontend_type>multiselect</frontend_type>
661
+ <source_model>payone_core/system_config_walletType</source_model>
662
+ <sort_order>200</sort_order>
663
+ <show_in_default>1</show_in_default>
664
+ <show_in_website>1</show_in_website>
665
+ <show_in_store>1</show_in_store>
666
+ </types>
667
+ </fields>
668
+ </template_wallet>
669
+ <template_advance_payment translate="label" module="payone_core">
670
+ <label>Advance Payment</label>
671
+ <frontend_type>text</frontend_type>
672
+ <sort_order>5</sort_order>
673
+ <show_in_default>1</show_in_default>
674
+ <show_in_website>1</show_in_website>
675
+ <show_in_store>1</show_in_store>
676
+ <fields></fields>
677
+ </template_advance_payment>
678
+ <template_cash_on_delivery translate="label" module="payone_core">
679
+ <label>Cash on Delivery</label>
680
+ <frontend_type>text</frontend_type>
681
+ <sort_order>6</sort_order>
682
+ <show_in_default>1</show_in_default>
683
+ <show_in_website>1</show_in_website>
684
+ <show_in_store>1</show_in_store>
685
+ <fields></fields>
686
+ </template_cash_on_delivery>
687
+ </groups>
688
+ </payone_payment>
689
+
690
+ <payone_protect translate="label" module="payone_core">
691
+ <label>PROTECT</label>
692
+ <tab>payone</tab>
693
+ <header_css>payone-config-header</header_css>
694
+ <frontend_type>text</frontend_type>
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>
699
+ <groups>
700
+ <hint>
701
+ <frontend_model>payone_core/adminhtml_system_config_hint</frontend_model>
702
+ <hint>
703
+ <template>payone/core/system/config/hint/protect.phtml</template>
704
+ </hint>
705
+ <sort_order>0</sort_order>
706
+ <show_in_default>1</show_in_default>
707
+ <show_in_website>1</show_in_website>
708
+ <show_in_store>1</show_in_store>
709
+ </hint>
710
+ <address_check>
711
+ <label>Addresscheck</label>
712
+ <frontend_type>text</frontend_type>
713
+ <sort_order>10</sort_order>
714
+ <show_in_default>1</show_in_default>
715
+ <show_in_website>1</show_in_website>
716
+ <show_in_store>1</show_in_store>
717
+ <fields>
718
+ <hint translate="label">
719
+ <label>Addresscheck</label>
720
+ <sort_order>0</sort_order>
721
+ <show_in_default>1</show_in_default>
722
+ <show_in_website>1</show_in_website>
723
+ <show_in_store>1</show_in_store>
724
+ <hint>
725
+ <template>payone/core/system/config/tooltip/protect/addresscheck.phtml</template>
726
+ </hint>
727
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
728
+ </hint>
729
+ <enabled translate="label">
730
+ <label>Enabled</label>
731
+ <frontend_type>select</frontend_type>
732
+ <source_model>adminhtml/system_config_source_yesno</source_model>
733
+ <backend_model>payone_core/system_config_backend_protect</backend_model>
734
+ <sort_order>10</sort_order>
735
+ <show_in_default>1</show_in_default>
736
+ <show_in_website>1</show_in_website>
737
+ <show_in_store>1</show_in_store>
738
+ </enabled>
739
+ <check_billing translate="label">
740
+ <label>Check Billing Address</label>
741
+ <frontend_type>select</frontend_type>
742
+ <hint>
743
+ <template>payone/core/system/config/tooltip/protect/addresscheck_type.phtml</template>
744
+ </hint>
745
+ <frontend_model>payone_core/adminhtml_system_config_form_field</frontend_model>
746
+ <source_model>payone_core/system_config_addressCheckType</source_model>
747
+ <sort_order>30</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>
751
+ </check_billing>
752
+ <check_shipping translate="label">
753
+ <label>Check Shipping Address</label>
754
+ <frontend_type>select</frontend_type>
755
+ <source_model>payone_core/system_config_addressCheckType</source_model>
756
+ <sort_order>40</sort_order>
757
+ <show_in_default>1</show_in_default>
758
+ <show_in_website>1</show_in_website>
759
+ <show_in_store>1</show_in_store>
760
+ </check_shipping>
761
+ <confirm_address_correction translate="label,comment">
762
+ <label>Confirm Address correction</label>
763
+ <frontend_type>select</frontend_type>
764
+ <source_model>adminhtml/system_config_source_yesno</source_model>
765
+ <comment>Consumer must confirm corrections to their address</comment>
766
+ <sort_order>45</sort_order>
767
+ <show_in_default>1</show_in_default>
768
+ <show_in_website>1</show_in_website>
769
+ <show_in_store>1</show_in_store>
770
+ </confirm_address_correction>
771
+ <mode>
772
+ <label>Mode</label>
773
+ <frontend_type>select</frontend_type>
774
+ <source_model>payone_core/system_config_mode</source_model>
775
+ <sort_order>45</sort_order>
776
+ <show_in_default>1</show_in_default>
777
+ <show_in_website>1</show_in_website>
778
+ <show_in_store>1</show_in_store>
779
+ </mode>
780
+ <min_order_total translate="label">
781
+ <label>Minimum Order Total</label>
782
+ <frontend_type>text</frontend_type>
783
+ <sort_order>50</sort_order>
784
+ <show_in_default>1</show_in_default>
785
+ <show_in_website>1</show_in_website>
786
+ <show_in_store>1</show_in_store>
787
+ </min_order_total>
788
+ <max_order_total translate="label">
789
+ <label>Maximum Order Total</label>
790
+ <frontend_type>text</frontend_type>
791
+ <sort_order>60</sort_order>
792
+ <show_in_default>1</show_in_default>
793
+ <show_in_website>1</show_in_website>
794
+ <show_in_store>1</show_in_store>
795
+ </max_order_total>
796
+ <mapping_personstatus translate="label">
797
+ <label>Personstatus Mapping</label>
798
+ <frontend_model>payone_core/adminhtml_system_config_form_field_personStatusMapping</frontend_model>
799
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
800
+ <sort_order>70</sort_order>
801
+ <show_in_default>1</show_in_default>
802
+ <show_in_website>1</show_in_website>
803
+ <show_in_store>1</show_in_store>
804
+ </mapping_personstatus>
805
+ <message_response_invalid translate="label,comment">
806
+ <label>Message to display for invalid data</label>
807
+ <comment>Placeholder: {{payone_customermessage}} (Message from Payone-Addresscheck</comment>
808
+ <frontend_type>text</frontend_type>
809
+ <sort_order>76</sort_order>
810
+ <show_in_default>1</show_in_default>
811
+ <show_in_website>1</show_in_website>
812
+ <show_in_store>1</show_in_store>
813
+ </message_response_invalid>
814
+ <handle_response_error translate="label,comment">
815
+ <label>Response ERROR Handling</label>
816
+ <comment>Action in case Addresscheck responds with ERROR</comment>
817
+ <frontend_type>select</frontend_type>
818
+ <source_model>payone_core/system_config_handleResponseError</source_model>
819
+ <sort_order>80</sort_order>
820
+ <show_in_default>1</show_in_default>
821
+ <show_in_website>1</show_in_website>
822
+ <show_in_store>1</show_in_store>
823
+ </handle_response_error>
824
+ <stop_checkout_message translate="label">
825
+ <label>Message for 'Stop-Checkout'</label>
826
+ <frontend_type>text</frontend_type>
827
+ <depends>
828
+ <handle_response_error>stop_checkout</handle_response_error>
829
+ </depends>
830
+ <sort_order>90</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>
834
+ </stop_checkout_message>
835
+ <result_lifetime translate="label,comment">
836
+ <label>Lifetime</label>
837
+ <frontend_type>text</frontend_type>
838
+ <comment>Result lifetime in days</comment>
839
+ <sort_order>100</sort_order>
840
+ <show_in_default>1</show_in_default>
841
+ <show_in_website>1</show_in_website>
842
+ <show_in_store>1</show_in_store>
843
+ </result_lifetime>
844
+ </fields>
845
+ </address_check>
846
+ <creditrating>
847
+ <label>Creditrating</label>
848
+ <frontend_type>text</frontend_type>
849
+ <sort_order>20</sort_order>
850
+ <show_in_default>1</show_in_default>
851
+ <show_in_website>1</show_in_website>
852
+ <show_in_store>1</show_in_store>
853
+ <fields>
854
+ <hint translate="label">
855
+ <label>Creditrating</label>
856
+ <sort_order>0</sort_order>
857
+ <show_in_default>1</show_in_default>
858
+ <show_in_website>1</show_in_website>
859
+ <show_in_store>1</show_in_store>
860
+ <hint>
861
+ <template>payone/core/system/config/tooltip/protect/creditrating.phtml</template>
862
+ </hint>
863
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
864
+ </hint>
865
+ <enabled translate="label">
866
+ <label>Enabled</label>
867
+ <frontend_type>select</frontend_type>
868
+ <source_model>adminhtml/system_config_source_yesno</source_model>
869
+ <sort_order>10</sort_order>
870
+ <show_in_default>1</show_in_default>
871
+ <show_in_website>1</show_in_website>
872
+ <show_in_store>1</show_in_store>
873
+ </enabled>
874
+ <integration_event>
875
+ <label>Integration Event</label>
876
+ <frontend_type>select</frontend_type>
877
+ <source_model>payone_core/system_config_creditratingIntegrationEvent</source_model>
878
+ <sort_order>20</sort_order>
879
+ <show_in_default>1</show_in_default>
880
+ <show_in_website>1</show_in_website>
881
+ <show_in_store>1</show_in_store>
882
+ </integration_event>
883
+ <enabled_for_payment_methods translate="label">
884
+ <label>Enabled for Payment-Methods</label>
885
+ <frontend_type>multiselect</frontend_type>
886
+ <source_model>adminhtml/system_config_source_payment_allowedmethods</source_model>
887
+ <sort_order>30</sort_order>
888
+ <depends>
889
+ <integration_event>after_payment</integration_event>
890
+ </depends>
891
+ <show_in_default>1</show_in_default>
892
+ <show_in_website>1</show_in_website>
893
+ <show_in_store>1</show_in_store>
894
+ </enabled_for_payment_methods>
895
+ <payment_hint_enabled translate="label">
896
+ <label>Payment hint enabled</label>
897
+ <frontend_type>select</frontend_type>
898
+ <source_model>adminhtml/system_config_source_yesno</source_model>
899
+ <sort_order>32</sort_order>
900
+ <depends>
901
+ <integration_event>after_payment</integration_event>
902
+ </depends>
903
+ <show_in_default>1</show_in_default>
904
+ <show_in_website>1</show_in_website>
905
+ <show_in_store>1</show_in_store>
906
+ </payment_hint_enabled>
907
+ <payment_hint_text translate="label">
908
+ <label>Payment hint text</label>
909
+ <frontend_type>textarea</frontend_type>
910
+ <sort_order>33</sort_order>
911
+ <depends>
912
+ <integration_event>after_payment</integration_event>
913
+ <payment_hint_enabled>1</payment_hint_enabled>
914
+ </depends>
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
+ </payment_hint_text>
919
+ <agreement_enabled translate="label">
920
+ <label>Agreement enabled</label>
921
+ <frontend_type>select</frontend_type>
922
+ <source_model>adminhtml/system_config_source_yesno</source_model>
923
+ <sort_order>35</sort_order>
924
+ <depends>
925
+ <integration_event>after_payment</integration_event>
926
+ </depends>
927
+ <show_in_default>1</show_in_default>
928
+ <show_in_website>1</show_in_website>
929
+ <show_in_store>1</show_in_store>
930
+ </agreement_enabled>
931
+ <agreement_message translate="label">
932
+ <label>Agreement message</label>
933
+ <frontend_type>textarea</frontend_type>
934
+ <sort_order>36</sort_order>
935
+ <depends>
936
+ <agreement_enabled>1</agreement_enabled>
937
+ <integration_event>after_payment</integration_event>
938
+ </depends>
939
+ <show_in_default>1</show_in_default>
940
+ <show_in_website>1</show_in_website>
941
+ <show_in_store>1</show_in_store>
942
+ </agreement_message>
943
+ <type translate="label">
944
+ <label>Creditrating-Checktype</label>
945
+ <frontend_type>select</frontend_type>
946
+ <hint>
947
+ <template>payone/core/system/config/tooltip/protect/creditrating_type.phtml</template>
948
+ </hint>
949
+ <frontend_model>payone_core/adminhtml_system_config_form_field</frontend_model>
950
+ <source_model>payone_core/system_config_creditratingChecktype</source_model>
951
+ <sort_order>40</sort_order>
952
+ <show_in_default>1</show_in_default>
953
+ <show_in_website>1</show_in_website>
954
+ <show_in_store>1</show_in_store>
955
+ </type>
956
+ <allow_payment_methods_yellow translate="label">
957
+ <label>Allowed Payment-Methods for Result "YELLOW"</label>
958
+ <frontend_type>multiselect</frontend_type>
959
+ <source_model>adminhtml/system_config_source_payment_allowedmethods</source_model>
960
+ <sort_order>50</sort_order>
961
+ <show_in_default>1</show_in_default>
962
+ <show_in_website>1</show_in_website>
963
+ <show_in_store>1</show_in_store>
964
+ </allow_payment_methods_yellow>
965
+ <allow_payment_methods_red translate="label">
966
+ <label>Allowed Payment-Methods for Result "RED"</label>
967
+ <frontend_type>multiselect</frontend_type>
968
+ <source_model>adminhtml/system_config_source_payment_allowedmethods</source_model>
969
+ <sort_order>60</sort_order>
970
+ <show_in_default>1</show_in_default>
971
+ <show_in_website>1</show_in_website>
972
+ <show_in_store>1</show_in_store>
973
+ </allow_payment_methods_red>
974
+ <sample_mode_enabled translate="label,comment">
975
+ <label>Sample Mode Enabled</label>
976
+ <comment>Activate to perform Creditrating check every n-th order</comment>
977
+ <frontend_type>select</frontend_type>
978
+ <source_model>adminhtml/system_config_source_yesno</source_model>
979
+ <sort_order>65</sort_order>
980
+ <show_in_default>1</show_in_default>
981
+ <show_in_website>1</show_in_website>
982
+ <show_in_store>1</show_in_store>
983
+ </sample_mode_enabled>
984
+ <sample_mode_frequency translate="label,comment">
985
+ <label>Sample Mode Frequency</label>
986
+ <comment>Perform creditrating for 1 out of n orders.</comment>
987
+ <frontend_type>text</frontend_type>
988
+ <depends>
989
+ <sample_mode_enabled>1</sample_mode_enabled>
990
+ </depends>
991
+ <sort_order>66</sort_order>
992
+ <show_in_default>1</show_in_default>
993
+ <show_in_website>1</show_in_website>
994
+ <show_in_store>1</show_in_store>
995
+ </sample_mode_frequency>
996
+
997
+ <handle_response_error translate="label,comment">
998
+ <label>Response ERROR Handling</label>
999
+ <frontend_type>select</frontend_type>
1000
+ <source_model>payone_core/system_config_handleResponseError</source_model>
1001
+ <comment>Action in case Creditrating check responds with ERROR</comment>
1002
+ <sort_order>68</sort_order>
1003
+ <show_in_default>1</show_in_default>
1004
+ <show_in_website>1</show_in_website>
1005
+ <show_in_store>1</show_in_store>
1006
+ </handle_response_error>
1007
+ <stop_checkout_message translate="label">
1008
+ <label>Message for 'Stop-Checkout'</label>
1009
+ <frontend_type>text</frontend_type>
1010
+ <depends>
1011
+ <handle_response_error>stop_checkout</handle_response_error>
1012
+ </depends>
1013
+ <sort_order>69</sort_order>
1014
+ <show_in_default>1</show_in_default>
1015
+ <show_in_website>1</show_in_website>
1016
+ <show_in_store>1</show_in_store>
1017
+ </stop_checkout_message>
1018
+ <result_lifetime translate="label">
1019
+ <label>Lifetime</label>
1020
+ <hint>
1021
+ <template>payone/core/system/config/tooltip/protect/creditrating_lifetime.phtml</template>
1022
+ </hint>
1023
+ <frontend_model>payone_core/adminhtml_system_config_form_field</frontend_model>
1024
+ <frontend_type>text</frontend_type>
1025
+ <comment>Result lifetime in days</comment>
1026
+ <sort_order>70</sort_order>
1027
+ <show_in_default>1</show_in_default>
1028
+ <show_in_website>1</show_in_website>
1029
+ <show_in_store>1</show_in_store>
1030
+ </result_lifetime>
1031
+ <mode>
1032
+ <label>Mode</label>
1033
+ <frontend_type>select</frontend_type>
1034
+ <source_model>payone_core/system_config_mode</source_model>
1035
+ <sort_order>80</sort_order>
1036
+ <show_in_default>1</show_in_default>
1037
+ <show_in_website>1</show_in_website>
1038
+ <show_in_store>1</show_in_store>
1039
+ </mode>
1040
+ <min_order_total translate="label">
1041
+ <label>Minimum Order Total</label>
1042
+ <frontend_type>text</frontend_type>
1043
+ <sort_order>90</sort_order>
1044
+ <show_in_default>1</show_in_default>
1045
+ <show_in_website>1</show_in_website>
1046
+ <show_in_store>1</show_in_store>
1047
+ </min_order_total>
1048
+ <max_order_total translate="label">
1049
+ <label>Maximum Order Total</label>
1050
+ <frontend_type>text</frontend_type>
1051
+ <sort_order>100</sort_order>
1052
+ <show_in_default>1</show_in_default>
1053
+ <show_in_website>1</show_in_website>
1054
+ <show_in_store>1</show_in_store>
1055
+ </max_order_total>
1056
+ </fields>
1057
+ </creditrating>
1058
+ </groups>
1059
+ </payone_protect>
1060
+
1061
+ <payone_misc translate="label" module="payone_core">
1062
+ <label>Miscellaneous</label>
1063
+ <tab>payone</tab>
1064
+ <header_css>payone-config-header</header_css>
1065
+ <frontend_type>text</frontend_type>
1066
+ <sort_order>100</sort_order>
1067
+ <show_in_default>1</show_in_default>
1068
+ <show_in_website>1</show_in_website>
1069
+ <show_in_store>1</show_in_store>
1070
+ <groups>
1071
+ <transactionstatus_processing>
1072
+ <label>Transaction-Status Processing</label>
1073
+ <frontend_type>text</frontend_type>
1074
+ <sort_order>5</sort_order>
1075
+ <show_in_default>1</show_in_default>
1076
+ <show_in_website>1</show_in_website>
1077
+ <show_in_store>1</show_in_store>
1078
+ <fields>
1079
+ <hint translate="label">
1080
+ <label>Transaction-Status Processing</label>
1081
+ <sort_order>0</sort_order>
1082
+ <show_in_default>1</show_in_default>
1083
+ <show_in_website>1</show_in_website>
1084
+ <show_in_store>1</show_in_store>
1085
+ <hint>
1086
+ <template>payone/core/system/config/tooltip/misc/transactionstatus_processing.phtml</template>
1087
+ </hint>
1088
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
1089
+ </hint>
1090
+ <cron_expr translate="label">
1091
+ <label>Cron Expression</label>
1092
+ <frontend_type>text</frontend_type>
1093
+ <sort_order>10</sort_order>
1094
+ <show_in_default>1</show_in_default>
1095
+ <show_in_website>1</show_in_website>
1096
+ <show_in_store>1</show_in_store>
1097
+ </cron_expr>
1098
+ <valid_ips translate="label">
1099
+ <label>Valid PAYONE IPs</label>
1100
+ <comment>Enter valid PAYONE IPs (Format xxx.xxx.xxx.xxx). As a Wildcard You can use * </comment>
1101
+ <frontend_type>textarea</frontend_type>
1102
+ <sort_order>20</sort_order>
1103
+ <show_in_default>1</show_in_default>
1104
+ <show_in_website>1</show_in_website>
1105
+ <show_in_store>1</show_in_store>
1106
+ </valid_ips>
1107
+ </fields>
1108
+ </transactionstatus_processing>
1109
+ <transactionstatus_forwarding>
1110
+ <label>Transaction-Status Forwarding</label>
1111
+ <frontend_type>text</frontend_type>
1112
+ <sort_order>10</sort_order>
1113
+ <show_in_default>1</show_in_default>
1114
+ <show_in_website>1</show_in_website>
1115
+ <show_in_store>1</show_in_store>
1116
+ <fields>
1117
+ <hint translate="label">
1118
+ <label>Transaction-Status Forwarding</label>
1119
+ <sort_order>0</sort_order>
1120
+ <show_in_default>1</show_in_default>
1121
+ <show_in_website>1</show_in_website>
1122
+ <show_in_store>1</show_in_store>
1123
+ <hint>
1124
+ <template>payone/core/system/config/tooltip/misc/transactionstatus_forwarding.phtml</template>
1125
+ </hint>
1126
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
1127
+ </hint>
1128
+ <config translate="label">
1129
+ <label>Forwarding</label>
1130
+ <hint>
1131
+ <template>payone/core/system/config/tooltip/misc/transaction_status_forwarding.phtml</template>
1132
+ </hint>
1133
+ <frontend_model>payone_core/adminhtml_system_config_form_field_forwarding</frontend_model>
1134
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
1135
+ <sort_order>10</sort_order>
1136
+ <show_in_default>1</show_in_default>
1137
+ <show_in_website>1</show_in_website>
1138
+ <show_in_store>1</show_in_store>
1139
+ </config>
1140
+ </fields>
1141
+ </transactionstatus_forwarding>
1142
+ <shipping_costs>
1143
+ <label>Shipping Costs</label>
1144
+ <frontend_type>text</frontend_type>
1145
+ <sort_order>20</sort_order>
1146
+ <show_in_default>1</show_in_default>
1147
+ <show_in_website>1</show_in_website>
1148
+ <show_in_store>1</show_in_store>
1149
+ <fields>
1150
+ <hint translate="label">
1151
+ <label>Shipping Costs</label>
1152
+ <sort_order>0</sort_order>
1153
+ <show_in_default>1</show_in_default>
1154
+ <show_in_website>1</show_in_website>
1155
+ <show_in_store>1</show_in_store>
1156
+ <hint>
1157
+ <template>payone/core/system/config/tooltip/misc/shipping_costs.phtml</template>
1158
+ </hint>
1159
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
1160
+ </hint>
1161
+ <sku translate="label">
1162
+ <label>SKU</label>
1163
+ <frontend_type>text</frontend_type>
1164
+ <sort_order>10</sort_order>
1165
+ <show_in_default>1</show_in_default>
1166
+ <show_in_website>1</show_in_website>
1167
+ <show_in_store>1</show_in_store>
1168
+ </sku>
1169
+ </fields>
1170
+ </shipping_costs>
1171
+ <email_error>
1172
+ <label>Email-Configuration for Error</label>
1173
+ <frontend_type>text</frontend_type>
1174
+ <sort_order>30</sort_order>
1175
+ <show_in_default>1</show_in_default>
1176
+ <show_in_website>1</show_in_website>
1177
+ <show_in_store>1</show_in_store>
1178
+ <fields>
1179
+ <hint translate="label">
1180
+ <label>Email-Configuration for Error</label>
1181
+ <sort_order>0</sort_order>
1182
+ <show_in_default>1</show_in_default>
1183
+ <show_in_website>1</show_in_website>
1184
+ <show_in_store>1</show_in_store>
1185
+ <hint>
1186
+ <template>payone/core/system/config/tooltip/misc/email_error.phtml</template>
1187
+ </hint>
1188
+ <frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
1189
+ </hint>
1190
+ <enabled translate="label">
1191
+ <label>Enabled</label>
1192
+ <frontend_type>select</frontend_type>
1193
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1194
+ <sort_order>10</sort_order>
1195
+ <show_in_default>1</show_in_default>
1196
+ <show_in_website>1</show_in_website>
1197
+ <show_in_store>1</show_in_store>
1198
+ </enabled>
1199
+ <from translate="label">
1200
+ <label>Sender</label>
1201
+ <frontend_type>select</frontend_type>
1202
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
1203
+ <sort_order>20</sort_order>
1204
+ <show_in_default>1</show_in_default>
1205
+ <show_in_website>1</show_in_website>
1206
+ <show_in_store>1</show_in_store>
1207
+ </from>
1208
+ <to translate="label">
1209
+ <label>Recipient</label>
1210
+ <frontend_type>select</frontend_type>
1211
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
1212
+ <sort_order>30</sort_order>
1213
+ <show_in_default>1</show_in_default>
1214
+ <show_in_website>1</show_in_website>
1215
+ <show_in_store>1</show_in_store>
1216
+ </to>
1217
+ <bcc translate="label">
1218
+ <label>Copy to</label>
1219
+ <frontend_type>text</frontend_type>
1220
+ <sort_order>40</sort_order>
1221
+ <show_in_default>1</show_in_default>
1222
+ <show_in_website>1</show_in_website>
1223
+ <show_in_store>1</show_in_store>
1224
+ </bcc>
1225
+ <template translate="label">
1226
+ <label>Template</label>
1227
+ <frontend_type>select</frontend_type>
1228
+ <source_model>adminhtml/system_config_source_email_template</source_model>
1229
+ <sort_order>50</sort_order>
1230
+ <show_in_default>1</show_in_default>
1231
+ <show_in_website>1</show_in_website>
1232
+ <show_in_store>1</show_in_store>
1233
+ </template>
1234
+ </fields>
1235
+ </email_error>
1236
+ <email_avs>
1237
+ <label>Email-Configuration for AVS</label>
1238
+ <frontend_type>text</frontend_type>
1239
+ <sort_order>40</sort_order>
1240
+ <show_in_default>1</show_in_default>
1241
+ <show_in_website>1</show_in_website>
1242
+ <show_in_store>1</show_in_store>
1243
+ <fields>
1244
+ <hint translate="label">
1245
+ <label>Email-Configuration for AVS</label>
1246
+ <sort_order>0<