Version Notes
Download this release
Release Info
Developer | Sebastian Ertner |
Extension | Acceptance_ePayments |
Version | 16.12.14 |
Comparing to | |
See all releases |
Code changes from version 16.05.26 to 16.12.14
- app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Edit/Tab/Alias.php +32 -29
- app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Renderer/PaymentMethod.php +8 -1
- app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixo/Shipping/Edit.php +7 -4
- app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/CategoryTree.php +11 -4
- app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/Edit/Form.php +47 -30
- app/code/community/Netresearch/OPS/Block/Alias/List.php +4 -1
- app/code/community/Netresearch/OPS/Block/Checkout/SubscriptionNotice.php +19 -10
- app/code/community/Netresearch/OPS/Block/Form.php +170 -23
- app/code/community/Netresearch/OPS/Block/Form/Alias.php +3 -3
- app/code/community/Netresearch/OPS/Block/Form/BankTransfer.php +42 -0
- app/code/community/Netresearch/OPS/Block/Form/Cc.php +17 -107
- app/code/community/Netresearch/OPS/Block/Form/DirectDebit.php +7 -193
- app/code/community/Netresearch/OPS/Block/Form/DirectEbanking.php +42 -0
- app/code/community/Netresearch/OPS/Block/Form/Flex.php +1 -2
- app/code/community/Netresearch/OPS/Block/Form/Ideal.php +2 -2
- app/code/community/Netresearch/OPS/Block/Form/Kwixo/ApresReception.php +1 -0
- app/code/community/Netresearch/OPS/Block/Form/Kwixo/Comptant.php +1 -0
- app/code/community/Netresearch/OPS/Block/Form/Kwixo/Credit.php +1 -0
- app/code/community/Netresearch/OPS/Block/Form/OpenInvoice.php +63 -0
- app/code/community/Netresearch/OPS/Block/Form/PayPerMail.php +43 -0
- app/code/community/Netresearch/OPS/Block/Form/RecurringCc.php +2 -1
- app/code/community/Netresearch/OPS/Block/Info/Alias.php +1 -0
- app/code/community/Netresearch/OPS/Block/Info/Bancontact.php +54 -0
- app/code/community/Netresearch/OPS/Block/Info/Cc.php +1 -0
- app/code/community/Netresearch/OPS/Block/Info/Flex.php +2 -0
- app/code/community/Netresearch/OPS/Block/Info/OpsId.php +1 -0
- app/code/community/Netresearch/OPS/Block/Info/PayPerMail.php +44 -0
- app/code/community/Netresearch/OPS/Block/Info/RecurringCc.php +4 -1
- app/code/community/Netresearch/OPS/Block/Info/Redirect.php +1 -0
- app/code/community/Netresearch/OPS/Block/Placeform.php +38 -14
- app/code/community/Netresearch/OPS/Block/Placeform3dsecure.php +1 -1
- app/code/community/Netresearch/OPS/Block/RetryPayment.php +64 -10
- app/code/community/Netresearch/OPS/Block/RetryPayment/Methods.php +80 -0
- app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Brand.php +8 -4
- app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Image.php +87 -0
- app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Method.php +12 -6
- app/code/community/Netresearch/OPS/Block/System/Config/Mode.php +32 -31
- app/code/community/Netresearch/OPS/Block/System/Config/PaymentForm.php +47 -0
- app/code/community/Netresearch/OPS/Block/System/Config/Support.php +9 -7
- app/code/community/Netresearch/OPS/Controller/Abstract.php +17 -8
- app/code/community/Netresearch/OPS/Helper/Address.php +181 -0
- app/code/community/Netresearch/OPS/Helper/Alias.php +103 -80
- app/code/community/Netresearch/OPS/Helper/Api.php +16 -12
- app/code/community/Netresearch/OPS/Helper/Creditcard.php +8 -6
- app/code/community/Netresearch/OPS/Helper/Data.php +5 -6
- app/code/community/Netresearch/OPS/Helper/Debitcard.php +1 -1
- app/code/community/Netresearch/OPS/Helper/DirectDebit.php +16 -183
- app/code/community/Netresearch/OPS/Helper/Directlink.php +21 -27
- app/code/community/Netresearch/OPS/Helper/Kwixo.php +7 -15
- app/code/community/Netresearch/OPS/Helper/MobileDetect.php +68 -0
- app/code/community/Netresearch/OPS/Helper/Order.php +2 -3
- app/code/community/Netresearch/OPS/Helper/Order/Refund.php +8 -4
- app/code/community/Netresearch/OPS/Helper/Payment.php +73 -278
- app/code/community/Netresearch/OPS/Helper/Payment/DirectLink/Request.php +6 -3
- app/code/community/Netresearch/OPS/Helper/Payment/Request.php +170 -91
- app/code/community/Netresearch/OPS/Helper/Quote.php +6 -4
- app/code/community/Netresearch/OPS/Helper/Subscription.php +1 -1
- app/code/community/Netresearch/OPS/Helper/Validation/Checkout/Step.php +51 -30
- app/code/community/Netresearch/OPS/Helper/Validation/Result.php +7 -7
- app/code/community/Netresearch/OPS/Model/Alias.php +11 -5
- app/code/community/Netresearch/OPS/Model/Api/Directlink.php +43 -23
- app/code/community/Netresearch/OPS/Model/Backend/Operation/Capture/Parameter.php +3 -2
- app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter.php +3 -3
- app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Abstract.php +11 -9
- app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/Interface.php +1 -1
- app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/OpenInvoiceNlAbstract.php +52 -45
- app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Additional/OpenInvoiceNl.php +59 -62
- app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Parameter.php +6 -4
- app/code/community/Netresearch/OPS/Model/Config.php +151 -16
- app/code/community/Netresearch/OPS/Model/File/Download.php +3 -3
- app/code/community/Netresearch/OPS/Model/Kwixo/Category/Mapping.php +4 -3
- app/code/community/Netresearch/OPS/Model/Kwixo/Shipping/Setting.php +0 -1
- app/code/community/Netresearch/OPS/Model/Mysql4/Alias.php +6 -6
- app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Category/Mapping.php +1 -1
- app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Shipping/Setting.php +0 -1
- app/code/community/Netresearch/OPS/Model/Observer.php +43 -17
- app/code/community/Netresearch/OPS/Model/Payment/Abstract.php +142 -120
- app/code/community/Netresearch/OPS/Model/Payment/Bancontact.php +55 -1
- app/code/community/Netresearch/OPS/Model/Payment/BankTransfer.php +4 -1
- app/code/community/Netresearch/OPS/Model/Payment/Cc.php +31 -6
- app/code/community/Netresearch/OPS/Model/Payment/Debitcard.php +4 -1
- app/code/community/Netresearch/OPS/Model/Payment/DirectDebit.php +6 -5
- app/code/community/Netresearch/OPS/Model/Payment/DirectEbanking.php +7 -14
- app/code/community/Netresearch/OPS/Model/Payment/DirectLink.php +4 -2
- app/code/community/Netresearch/OPS/Model/Payment/Features/PaymentEmail.php +198 -197
- app/code/community/Netresearch/OPS/Model/Payment/Features/ZeroAmountAuth.php +2 -1
- app/code/community/Netresearch/OPS/Model/Payment/IDeal.php +1 -5
- app/code/community/Netresearch/OPS/Model/Payment/InterSolve.php +1 -1
- app/code/community/Netresearch/OPS/Model/Payment/Kwixo/Abstract.php +53 -115
- app/code/community/Netresearch/OPS/Model/Payment/Masterpass.php +9 -9
- app/code/community/Netresearch/OPS/Model/Payment/Mpass.php +0 -25
- app/code/community/Netresearch/OPS/Model/Payment/OpenInvoice/Abstract.php +55 -17
- app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceAt.php +93 -84
- app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceDe.php +3 -3
- app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceNl.php +16 -22
- app/code/community/Netresearch/OPS/Model/Payment/PayPerMail.php +41 -0
- app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc.php +21 -12
- app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc/ParameterBag.php +22 -15
- app/code/community/Netresearch/OPS/Model/Response/Handler.php +2 -1
- app/code/community/Netresearch/OPS/Model/Response/Type/Abstract.php +41 -9
- app/code/community/Netresearch/OPS/Model/Response/Type/Authorize.php +179 -115
- app/code/community/Netresearch/OPS/Model/Response/Type/Capture.php +79 -45
- app/code/community/Netresearch/OPS/Model/Response/Type/Refund.php +66 -42
- app/code/community/Netresearch/OPS/Model/Response/Type/Special.php +6 -8
- app/code/community/Netresearch/OPS/Model/Response/Type/Void.php +3 -4
- app/code/community/Netresearch/OPS/Model/Source/BankTransfer/Countries.php +11 -2
- app/code/community/Netresearch/OPS/Model/Source/DirectDebit/Countries.php +7 -1
- app/code/community/Netresearch/OPS/Model/Source/DirectEbanking/Brands.php +1 -1
- app/code/community/Netresearch/OPS/Model/Source/Kwixo/ShipMethodType.php +6 -6
- app/code/community/Netresearch/OPS/Model/Source/Mode.php +31 -29
- app/code/community/Netresearch/OPS/Model/Source/OrderReference.php +8 -2
- app/code/community/Netresearch/OPS/Model/Source/PaymentAction.php +8 -2
- app/code/community/Netresearch/OPS/Model/Source/Pmlist.php +12 -3
- app/code/community/Netresearch/OPS/Model/Source/Template.php +16 -4
- app/code/community/Netresearch/OPS/Model/Source/TemplateType.php +23 -21
- app/code/community/Netresearch/OPS/Model/Status.php +4 -3
- app/code/community/Netresearch/OPS/Model/Status/Update.php +4 -2
- app/code/community/Netresearch/OPS/Model/Subscription/Manager.php +10 -8
- app/code/community/Netresearch/OPS/Model/System/Config/Backend/Encoding.php +46 -0
- app/code/community/Netresearch/OPS/Model/System/Config/Backend/Flex/Methods.php +2 -2
- app/code/community/Netresearch/OPS/Model/System/Config/Backend/Intersolve/Brands.php +1 -1
- app/code/community/Netresearch/OPS/Model/System/Config/Backend/PaymentLogo.php +47 -0
- app/code/community/Netresearch/OPS/Model/System/Config/Mode.php +40 -39
- app/code/community/Netresearch/OPS/Model/System/Config/Template.php +63 -63
- app/code/community/Netresearch/OPS/Model/Validator/CompositeInterface.php +1 -1
- app/code/community/Netresearch/OPS/Model/Validator/Kwixo/Shipping/Setting.php +4 -4
- app/code/community/Netresearch/OPS/Model/Validator/Parameter/Factory.php +8 -3
- app/code/community/Netresearch/OPS/Model/Validator/Parameter/Length.php +9 -3
- app/code/community/Netresearch/OPS/Model/Validator/Payment/DirectDebit.php +0 -250
- app/code/community/Netresearch/OPS/Test/Block/Adminhtml/Customer/Renderer/StateTest.php +1 -1
- app/code/community/Netresearch/OPS/Test/Block/Alias/ListTest.php +1 -1
- app/code/community/Netresearch/OPS/Test/Block/Checkout/DeviceFingerprintingTest.php +2 -2
- app/code/community/Netresearch/OPS/Test/Block/Form/CcTest.php +4 -4
- app/code/community/Netresearch/OPS/Test/Block/Form/DirectDebitTest.php +0 -281
- app/code/community/Netresearch/OPS/Test/Block/Form/Ideal.php +1 -1
- app/code/community/Netresearch/OPS/Test/Block/FormTest.php +50 -77
- app/code/community/Netresearch/OPS/Test/Block/FormTest/fixtures/FormTest.yaml +22 -0
- app/code/community/Netresearch/OPS/Test/Block/FrauddetectionTest.php +16 -3
- app/code/community/Netresearch/OPS/Test/Block/PlaceformTest.php +20 -2
- app/code/community/Netresearch/OPS/Test/Block/RetryPayment/MethodsTest.php +86 -0
- app/code/community/Netresearch/OPS/Test/Block/RetryPaymentTest.php +94 -0
- app/code/community/Netresearch/OPS/Test/Block/System/Config/Form/Field/ImageTest.php +73 -0
- app/code/community/Netresearch/OPS/Test/Block/System/Config/ModeTest.php +21 -20
- app/code/community/Netresearch/OPS/Test/Controller/Adminhtml/AdminControllerTest.php +82 -80
- app/code/community/Netresearch/OPS/Test/Controller/Adminhtml/KwixoshippingControllerTest.php +8 -23
- app/code/community/Netresearch/OPS/Test/Controller/AliasControllerTest.php +125 -106
- app/code/community/Netresearch/OPS/Test/Controller/PaymentControllerTest.php +223 -56
- app/code/community/Netresearch/OPS/Test/Controller/PaymentControllerTest/fixtures/orders.yaml +26 -0
- app/code/community/Netresearch/OPS/Test/Helper/AddressTest.php +22 -0
- app/code/community/Netresearch/OPS/Test/Helper/AddressTest/expectations/splitStreet.yaml +209 -0
- app/code/community/Netresearch/OPS/Test/Helper/AddressTest/providers/splitStreet.yaml +105 -0
- app/code/community/Netresearch/OPS/Test/Helper/AliasTest.php +88 -58
- app/code/community/Netresearch/OPS/Test/Helper/DataTest.php +18 -22
- app/code/community/Netresearch/OPS/Test/Helper/DirectDebitTest.php +67 -424
- app/code/community/Netresearch/OPS/Test/Helper/DirectDebitTest/fixtures/orders.yaml +79 -0
- app/code/community/Netresearch/OPS/Test/Helper/DirectLinkTest.php +26 -8
- app/code/community/Netresearch/OPS/Test/Helper/MobileDetectTest.php +77 -0
- app/code/community/Netresearch/OPS/Test/Helper/Payment/RequestTest.php +5 -2
- app/code/community/Netresearch/OPS/Test/Helper/PaymentTest.php +101 -170
- app/code/community/Netresearch/OPS/Test/Helper/SubscriptionTest.php +2 -1
- app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Capture/Additional/OpenInvoiceNlTest.php +23 -37
- app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Capture/ParameterTest.php +17 -3
- app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/ParameterTest.php +2 -1
- app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Refund/Additional/OpenInvoiceNlTest.php +68 -52
- app/code/community/Netresearch/OPS/Test/Model/Backend/Operation/Refund/ParameterTest.php +9 -3
- app/code/community/Netresearch/OPS/Test/Model/ConfigTest.php +40 -0
- app/code/community/Netresearch/OPS/Test/Model/File/Download.php +4 -3
- app/code/community/Netresearch/OPS/Test/Model/Mysql4/Alias/AliasTest.php +2 -1
- app/code/community/Netresearch/OPS/Test/Model/ObserverTest.php +122 -71
- app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractRefundTest.php +7 -7
- app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest.php +69 -30
- app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest/expectations/paymentMethods.yaml +0 -3
- app/code/community/Netresearch/OPS/Test/Model/Payment/AbstractTest/fixtures/.gitkeep +0 -0
- app/code/community/Netresearch/OPS/Test/Model/Payment/BancontactTest.php +50 -0
- app/code/community/Netresearch/OPS/Test/Model/Payment/BancontactTest/fixtures/.gitkeep +0 -0
- app/code/community/Netresearch/OPS/Test/Model/Payment/CcTest.php +3 -3
- app/code/community/Netresearch/OPS/Test/Model/Payment/DirectLinkTest.php +4 -7
- app/code/community/Netresearch/OPS/Test/Model/Payment/Features/PaymentEmailTest.php +12 -16
- app/code/community/Netresearch/OPS/Test/Model/Payment/IDealTest.php +21 -44
- app/code/community/Netresearch/OPS/Test/Model/Payment/InterSolveTest.php +4 -29
- app/code/community/Netresearch/OPS/Test/Model/Payment/Kwixo/AbstractTest.php +2 -40
- app/code/community/Netresearch/OPS/Test/Model/Payment/Kwixo/AbstractTest/expectations/paymentMethods.yaml +0 -3
- app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoApresReceptionTest.php +4 -4
- app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoComptantTest.php +4 -4
- app/code/community/Netresearch/OPS/Test/Model/Payment/KwixoCreditTest.php +2 -1
- app/code/community/Netresearch/OPS/Test/Model/Payment/OpenInvoiceAtTest.php +27 -0
- app/code/community/Netresearch/OPS/Test/Model/Payment/OpenInvoiceNlTest.php +10 -6
- app/code/community/Netresearch/OPS/Test/Model/Payment/PayPerMailTest.php +77 -0
- app/code/community/Netresearch/OPS/Test/Model/Payment/Recurring/Cc/ParameterBagTest.php +2 -1
- app/code/community/Netresearch/OPS/Test/Model/Payment/Recurring/CcTest.php +6 -3
- app/code/community/Netresearch/OPS/Test/Model/Response/TestCase.php +4 -6
- app/code/community/Netresearch/OPS/Test/Model/Response/Type/AuthorizeTest.php +5 -5
- app/code/community/Netresearch/OPS/Test/Model/Response/Type/CaptureTest.php +2 -2
- app/code/community/Netresearch/OPS/Test/Model/Source/ModeTest.php +21 -21
- app/code/community/Netresearch/OPS/Test/Model/Status/UpdateTest.php +27 -31
- app/code/community/Netresearch/OPS/Test/Model/StatusTest.php +1 -1
- app/code/community/Netresearch/OPS/Test/Model/Subscription/ManagerTest.php +2 -1
- app/code/community/Netresearch/OPS/Test/Model/System/Config/Backend/EncodingTest.php +60 -0
- app/code/community/Netresearch/OPS/Test/Model/System/Config/Backend/PaymentLogoTest.php +53 -0
- app/code/community/Netresearch/OPS/Test/Model/Validator/Payment/DirectDebitTest.php +0 -166
- app/code/community/Netresearch/OPS/Test/var/fixtures/orders.yaml +65 -1
- app/code/community/Netresearch/OPS/Trait/AliasController.php +87 -61
- app/code/community/Netresearch/OPS/Trait/PaymentHelper.php +1 -1
- app/code/community/Netresearch/OPS/controllers/Adminhtml/AdminController.php +4 -2
- app/code/community/Netresearch/OPS/controllers/Adminhtml/KwixocategoryController.php +7 -2
- app/code/community/Netresearch/OPS/controllers/Adminhtml/KwixoshippingController.php +37 -31
- app/code/community/Netresearch/OPS/controllers/AliasController.php +13 -13
- app/code/community/Netresearch/OPS/controllers/ApiController.php +1 -6
- app/code/community/Netresearch/OPS/controllers/CustomerController.php +3 -1
- app/code/community/Netresearch/OPS/controllers/DeviceController.php +4 -3
- app/code/community/Netresearch/OPS/controllers/PaymentController.php +142 -30
- app/code/community/Netresearch/OPS/data/ops_setup/data-install-14.02.05.php +12 -12
- app/code/community/Netresearch/OPS/etc/config.xml +32 -10
- app/code/community/Netresearch/OPS/etc/jstranslator.xml +27 -0
- app/code/community/Netresearch/OPS/etc/system.xml +1673 -380
- app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-1.0.1-12.12.03.php +4 -2
- app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.04.10-13.04.16.php +16 -8
- app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.05.30-13.06.07.php +16 -8
- app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.06.07-13.07.04.php +4 -2
- app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-13.11.04-13.11.05.php +4 -2
- app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-14.01.27-14.02.05.php +1 -2
- app/code/community/Netresearch/OPS/sql/ops_setup/mysql4-upgrade-16.05.26-27.06.16.php +8 -0
- app/design/adminhtml/default/default/layout/ops.xml +10 -15
- app/design/adminhtml/default/default/template/ops/categoriestree.phtml +19 -0
- app/design/adminhtml/default/default/template/ops/form/cc.phtml +6 -58
- app/design/adminhtml/default/default/template/ops/form/directDebit.phtml +177 -49
- app/design/adminhtml/default/default/template/ops/form/opsId.phtml +20 -3
- app/design/adminhtml/default/default/template/ops/form/payPerMail.phtml +31 -0
- app/design/adminhtml/default/default/template/ops/info.phtml +9 -14
- app/design/adminhtml/default/default/template/ops/info/bancontact.phtml +81 -0
- app/design/adminhtml/default/default/template/ops/info/cc.phtml +9 -14
- app/design/adminhtml/default/default/template/ops/info/opsId.phtml +9 -14
- app/design/adminhtml/default/default/template/ops/info/payPerMail.phtml +23 -0
- app/design/adminhtml/default/default/template/ops/info/redirect.phtml +9 -14
- app/design/adminhtml/default/default/template/ops/sales/order/creditmemo/closed-transaction/warning.phtml +21 -0
- app/design/adminhtml/default/default/template/ops/sales/order/creditmemo/totals/checkbox.phtml +9 -14
- app/design/adminhtml/default/default/template/ops/system/config/kwixoconfiglinks.phtml +21 -0
- app/design/adminhtml/default/default/template/ops/system/config/support.phtml +21 -0
- app/design/frontend/base/default/layout/ops.xml +38 -15
- app/design/frontend/base/default/template/ops/customer/alias/list.phtml +17 -19
- app/design/frontend/base/default/template/ops/form.phtml +1 -65
- app/design/frontend/base/default/template/ops/form/alias.phtml +2 -2
- app/design/frontend/base/default/template/ops/form/bankTransfer.phtml +51 -0
- app/design/frontend/base/default/template/ops/form/cc.phtml +85 -96
- app/design/frontend/base/default/template/ops/form/directDebit.phtml +125 -57
- app/design/frontend/base/default/template/ops/form/directEbanking.phtml +51 -0
- app/design/frontend/base/default/template/ops/form/flex.phtml +5 -4
- app/design/frontend/base/default/template/ops/form/ideal.phtml +22 -1
- app/design/frontend/base/default/template/ops/form/intersolve.phtml +1 -0
- app/design/frontend/base/default/template/ops/form/openInvoice.phtml +42 -0
- app/design/frontend/base/default/template/ops/form/other.phtml +24 -1
- app/design/frontend/base/default/template/ops/frauddetection.phtml +20 -0
- app/design/frontend/base/default/template/ops/info/bancontact.phtml +23 -0
- app/design/frontend/base/default/template/ops/info/cc.phtml +9 -14
- app/design/frontend/base/default/template/ops/info/opsId.phtml +21 -0
- app/design/frontend/base/default/template/ops/info/payPerMail.phtml +23 -0
- app/design/frontend/base/default/template/ops/info/redirect.phtml +9 -14
- app/design/frontend/base/default/template/ops/paypage.phtml +9 -14
- app/design/frontend/base/default/template/ops/placeform.phtml +17 -17
app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Edit/Tab/Alias.php
CHANGED
@@ -78,15 +78,6 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Edit_Tab_Alias
|
|
78 |
return 'orders';
|
79 |
}
|
80 |
|
81 |
-
/*
|
82 |
-
* Retrieves Grid Url
|
83 |
-
*
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
public function getGridUrl()
|
87 |
-
{
|
88 |
-
//return $this->getUrl('*/ops/customer', array('_current'=>true));
|
89 |
-
}
|
90 |
|
91 |
protected function _prepareCollection()
|
92 |
{
|
@@ -102,45 +93,60 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Edit_Tab_Alias
|
|
102 |
|
103 |
protected function _prepareColumns()
|
104 |
{
|
105 |
-
$this->addColumn(
|
|
|
106 |
'header' => Mage::helper('ops')->__('Alias'),
|
107 |
'align' => 'right',
|
108 |
'index' => 'alias',
|
109 |
-
|
|
|
110 |
|
111 |
-
$this->addColumn(
|
|
|
112 |
'header' => Mage::helper('ops')->__('Payment method'),
|
113 |
'index' => 'payment_method',
|
114 |
'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_PaymentMethod'
|
115 |
-
|
|
|
116 |
|
117 |
-
$this->addColumn(
|
|
|
118 |
'header' => Mage::helper('ops')->__('Credit Card Type'),
|
119 |
'index' => 'brand',
|
120 |
-
|
|
|
121 |
|
122 |
-
$this->addColumn(
|
|
|
123 |
'header' => Mage::helper('ops')->__('Card Number/Account Number'),
|
124 |
'index' => 'pseudo_account_or_cc_no',
|
125 |
-
|
|
|
126 |
|
127 |
-
$this->addColumn(
|
|
|
128 |
'header' => Mage::helper('ops')->__('Expiration Date'),
|
129 |
'index' => 'expiration_date',
|
130 |
-
|
|
|
131 |
|
132 |
-
$this->addColumn(
|
|
|
133 |
'header' => Mage::helper('ops')->__('Card Holder'),
|
134 |
'index' => 'card_holder',
|
135 |
-
|
|
|
136 |
|
137 |
-
$this->addColumn(
|
|
|
138 |
'header' => Mage::helper('ops')->__('State'),
|
139 |
'index' => 'state',
|
140 |
'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_State',
|
141 |
-
|
|
|
142 |
|
143 |
-
$this->addColumn(
|
|
|
144 |
array(
|
145 |
'header' => Mage::helper('ops')->__('Action'),
|
146 |
'width' => '100',
|
@@ -157,13 +163,10 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Edit_Tab_Alias
|
|
157 |
'sortable' => false,
|
158 |
'index' => 'stores',
|
159 |
'is_system' => true,
|
160 |
-
|
|
|
161 |
|
162 |
return parent::_prepareColumns();
|
163 |
}
|
164 |
|
165 |
-
public function getRowUrl($row)
|
166 |
-
{
|
167 |
-
//return $this->getUrl('*/customer/edit', array('id' => $row->getId()));
|
168 |
-
}
|
169 |
}
|
78 |
return 'orders';
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
protected function _prepareCollection()
|
83 |
{
|
93 |
|
94 |
protected function _prepareColumns()
|
95 |
{
|
96 |
+
$this->addColumn(
|
97 |
+
'alias', array(
|
98 |
'header' => Mage::helper('ops')->__('Alias'),
|
99 |
'align' => 'right',
|
100 |
'index' => 'alias',
|
101 |
+
)
|
102 |
+
);
|
103 |
|
104 |
+
$this->addColumn(
|
105 |
+
'payment_method', array(
|
106 |
'header' => Mage::helper('ops')->__('Payment method'),
|
107 |
'index' => 'payment_method',
|
108 |
'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_PaymentMethod'
|
109 |
+
)
|
110 |
+
);
|
111 |
|
112 |
+
$this->addColumn(
|
113 |
+
'brand', array(
|
114 |
'header' => Mage::helper('ops')->__('Credit Card Type'),
|
115 |
'index' => 'brand',
|
116 |
+
)
|
117 |
+
);
|
118 |
|
119 |
+
$this->addColumn(
|
120 |
+
'pseudo_account_or_cc_no', array(
|
121 |
'header' => Mage::helper('ops')->__('Card Number/Account Number'),
|
122 |
'index' => 'pseudo_account_or_cc_no',
|
123 |
+
)
|
124 |
+
);
|
125 |
|
126 |
+
$this->addColumn(
|
127 |
+
'expiration_date', array(
|
128 |
'header' => Mage::helper('ops')->__('Expiration Date'),
|
129 |
'index' => 'expiration_date',
|
130 |
+
)
|
131 |
+
);
|
132 |
|
133 |
+
$this->addColumn(
|
134 |
+
'card_holder', array(
|
135 |
'header' => Mage::helper('ops')->__('Card Holder'),
|
136 |
'index' => 'card_holder',
|
137 |
+
)
|
138 |
+
);
|
139 |
|
140 |
+
$this->addColumn(
|
141 |
+
'state', array(
|
142 |
'header' => Mage::helper('ops')->__('State'),
|
143 |
'index' => 'state',
|
144 |
'renderer' => 'Netresearch_OPS_Block_Adminhtml_Customer_Renderer_State',
|
145 |
+
)
|
146 |
+
);
|
147 |
|
148 |
+
$this->addColumn(
|
149 |
+
'action',
|
150 |
array(
|
151 |
'header' => Mage::helper('ops')->__('Action'),
|
152 |
'width' => '100',
|
163 |
'sortable' => false,
|
164 |
'index' => 'stores',
|
165 |
'is_system' => true,
|
166 |
+
)
|
167 |
+
);
|
168 |
|
169 |
return parent::_prepareColumns();
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
172 |
}
|
app/code/community/Netresearch/OPS/Block/Adminhtml/Customer/Renderer/PaymentMethod.php
CHANGED
@@ -9,12 +9,19 @@ class Netresearch_OPS_Block_Adminhtml_Customer_Renderer_PaymentMethod
|
|
9 |
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
10 |
{
|
11 |
|
|
|
|
|
|
|
|
|
12 |
public function render(Varien_Object $row)
|
13 |
{
|
|
|
14 |
$methodCode = $row->getData($this->getColumn()->getIndex());
|
15 |
$instance = Mage::helper('payment')->getMethodInstance($methodCode);
|
16 |
if ($instance) {
|
17 |
-
|
18 |
}
|
|
|
|
|
19 |
}
|
20 |
}
|
9 |
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
10 |
{
|
11 |
|
12 |
+
/**
|
13 |
+
* @param Varien_Object $row
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
public function render(Varien_Object $row)
|
17 |
{
|
18 |
+
$title = '';
|
19 |
$methodCode = $row->getData($this->getColumn()->getIndex());
|
20 |
$instance = Mage::helper('payment')->getMethodInstance($methodCode);
|
21 |
if ($instance) {
|
22 |
+
$title = $instance->getTitle();
|
23 |
}
|
24 |
+
|
25 |
+
return $title;
|
26 |
}
|
27 |
}
|
app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixo/Shipping/Edit.php
CHANGED
@@ -13,7 +13,7 @@ class Netresearch_OPS_Block_Adminhtml_Kwixo_Shipping_Edit
|
|
13 |
{
|
14 |
|
15 |
|
16 |
-
|
17 |
|
18 |
/**
|
19 |
* gets the form action url
|
@@ -64,15 +64,18 @@ class Netresearch_OPS_Block_Adminhtml_Kwixo_Shipping_Edit
|
|
64 |
return $this->kwixoShippingModel;
|
65 |
}
|
66 |
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
69 |
{
|
70 |
$values = array(
|
71 |
'kwixo_shipping_type' => '',
|
72 |
'kwixo_shipping_speed' => '',
|
73 |
'kwixo_shipping_details' => ''
|
74 |
);
|
75 |
-
if (
|
76 |
$errorData = $this->getData('postData');
|
77 |
$values = $errorData[$carrierCode];
|
78 |
} else {
|
13 |
{
|
14 |
|
15 |
|
16 |
+
protected $kwixoShippingModel = null;
|
17 |
|
18 |
/**
|
19 |
* gets the form action url
|
64 |
return $this->kwixoShippingModel;
|
65 |
}
|
66 |
|
67 |
+
/**
|
68 |
+
* @param $carrierCode
|
69 |
+
* @return array
|
70 |
+
*/
|
71 |
+
protected function getValues($carrierCode)
|
72 |
{
|
73 |
$values = array(
|
74 |
'kwixo_shipping_type' => '',
|
75 |
'kwixo_shipping_speed' => '',
|
76 |
'kwixo_shipping_details' => ''
|
77 |
);
|
78 |
+
if (null != ($this->getData('postData')) && array_key_exists($carrierCode, $this->getData('postData'))) {
|
79 |
$errorData = $this->getData('postData');
|
80 |
$values = $errorData[$carrierCode];
|
81 |
} else {
|
app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/CategoryTree.php
CHANGED
@@ -33,7 +33,16 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_CategoryTree
|
|
33 |
|
34 |
public function getSwitchTreeUrl()
|
35 |
{
|
36 |
-
return $this->getUrl(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
public function getNodesUrl()
|
@@ -50,8 +59,6 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_CategoryTree
|
|
50 |
{
|
51 |
$item = array();
|
52 |
$item['text'] = $this->buildNodeName($node);
|
53 |
-
//$rootForStores = in_array($node->getEntityId(), $this->getRootIds());
|
54 |
-
|
55 |
$item['id'] = $node->getId();
|
56 |
$item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
|
57 |
$item['store'] = (int) $this->getStore()->getId();
|
@@ -92,7 +99,7 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_CategoryTree
|
|
92 |
|
93 |
public function buildNodeName($node)
|
94 |
{
|
95 |
-
$result = $this->
|
96 |
return $result;
|
97 |
}
|
98 |
|
33 |
|
34 |
public function getSwitchTreeUrl()
|
35 |
{
|
36 |
+
return $this->getUrl(
|
37 |
+
"*/*/tree",
|
38 |
+
array(
|
39 |
+
'_current' => true,
|
40 |
+
'store' => null,
|
41 |
+
'_query' => false,
|
42 |
+
'id' => null,
|
43 |
+
'parent' => null
|
44 |
+
)
|
45 |
+
);
|
46 |
}
|
47 |
|
48 |
public function getNodesUrl()
|
59 |
{
|
60 |
$item = array();
|
61 |
$item['text'] = $this->buildNodeName($node);
|
|
|
|
|
62 |
$item['id'] = $node->getId();
|
63 |
$item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
|
64 |
$item['store'] = (int) $this->getStore()->getId();
|
99 |
|
100 |
public function buildNodeName($node)
|
101 |
{
|
102 |
+
$result = $this->escapeHtml($node->getName());
|
103 |
return $result;
|
104 |
}
|
105 |
|
app/code/community/Netresearch/OPS/Block/Adminhtml/Kwixocategory/Edit/Form.php
CHANGED
@@ -4,12 +4,14 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_Edit_Form
|
|
4 |
{
|
5 |
protected function _prepareForm()
|
6 |
{
|
7 |
-
$form = new Varien_Data_Form(
|
|
|
8 |
'id' => 'edit_form',
|
9 |
'action' => $this->getUrl('*/*/save'),
|
10 |
'method' => 'post',
|
11 |
'enctype' => 'multipart/form-data'
|
12 |
-
|
|
|
13 |
|
14 |
$categoryId = (int) $this->getRequest()->getParam('id');
|
15 |
if ($categoryId <= 0) {
|
@@ -18,38 +20,53 @@ class Netresearch_OPS_Block_Adminhtml_Kwixocategory_Edit_Form
|
|
18 |
$kwixoCategoryMapping = Mage::getModel('ops/kwixo_category_mapping')->loadByCategoryId($categoryId);
|
19 |
$storeId = (int) $this->getRequest()->getParam('store');
|
20 |
|
21 |
-
$fieldset = $form->addFieldset(
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
$fieldset->addField(
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
$fieldset->addField(
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
|
40 |
-
$fieldset->addField(
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
|
49 |
-
$fieldset->addField(
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
53 |
|
54 |
$form->setUseContainer(true);
|
55 |
$this->setForm($form);
|
4 |
{
|
5 |
protected function _prepareForm()
|
6 |
{
|
7 |
+
$form = new Varien_Data_Form(
|
8 |
+
array(
|
9 |
'id' => 'edit_form',
|
10 |
'action' => $this->getUrl('*/*/save'),
|
11 |
'method' => 'post',
|
12 |
'enctype' => 'multipart/form-data'
|
13 |
+
)
|
14 |
+
);
|
15 |
|
16 |
$categoryId = (int) $this->getRequest()->getParam('id');
|
17 |
if ($categoryId <= 0) {
|
20 |
$kwixoCategoryMapping = Mage::getModel('ops/kwixo_category_mapping')->loadByCategoryId($categoryId);
|
21 |
$storeId = (int) $this->getRequest()->getParam('store');
|
22 |
|
23 |
+
$fieldset = $form->addFieldset(
|
24 |
+
'ops_form',
|
25 |
+
array(
|
26 |
+
'legend' => Mage::helper('ops/data')->__('Categories configuration')
|
27 |
+
)
|
28 |
+
);
|
29 |
|
30 |
+
$fieldset->addField(
|
31 |
+
'storeId', 'hidden', array(
|
32 |
+
'required' => true,
|
33 |
+
'name' => 'storeId',
|
34 |
+
'value' => $storeId,
|
35 |
+
)
|
36 |
+
);
|
37 |
|
38 |
+
$fieldset->addField(
|
39 |
+
'id', 'hidden', array(
|
40 |
+
'required' => false,
|
41 |
+
'name' => 'id',
|
42 |
+
'value' => $kwixoCategoryMapping->getId(),
|
43 |
+
)
|
44 |
+
);
|
45 |
+
$fieldset->addField(
|
46 |
+
'category_id', 'hidden', array(
|
47 |
+
'required' => true,
|
48 |
+
'name' => 'category_id',
|
49 |
+
'value' => $categoryId,
|
50 |
+
)
|
51 |
+
);
|
52 |
|
53 |
+
$fieldset->addField(
|
54 |
+
'kwixoCategory_id', 'select', array(
|
55 |
+
'label' => Mage::Helper('ops/data')->__('Kwixo category'),
|
56 |
+
'class' => 'required-entry',
|
57 |
+
'required' => true,
|
58 |
+
'name' => 'kwixoCategory_id',
|
59 |
+
'value' => $kwixoCategoryMapping->getKwixoCategoryId(),
|
60 |
+
'values' => Mage::getModel('ops/source_kwixo_productCategories')->toOptionArray()
|
61 |
+
)
|
62 |
+
);
|
63 |
|
64 |
+
$fieldset->addField(
|
65 |
+
'applysubcat', 'checkbox', array(
|
66 |
+
'label' => Mage::Helper('ops/data')->__('Apply to sub-categories'),
|
67 |
+
'name' => 'applysubcat'
|
68 |
+
)
|
69 |
+
);
|
70 |
|
71 |
$form->setUseContainer(true);
|
72 |
$this->setForm($form);
|
app/code/community/Netresearch/OPS/Block/Alias/List.php
CHANGED
@@ -40,10 +40,13 @@ class Netresearch_OPS_Block_Alias_List
|
|
40 |
*/
|
41 |
public function getMethodName($methodCode)
|
42 |
{
|
|
|
43 |
$instance = Mage::helper('payment')->getMethodInstance($methodCode);
|
44 |
if ($instance) {
|
45 |
-
|
46 |
}
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
40 |
*/
|
41 |
public function getMethodName($methodCode)
|
42 |
{
|
43 |
+
$title = '';
|
44 |
$instance = Mage::helper('payment')->getMethodInstance($methodCode);
|
45 |
if ($instance) {
|
46 |
+
$title = $instance->getTitle();
|
47 |
}
|
48 |
+
|
49 |
+
return $title;
|
50 |
}
|
51 |
|
52 |
/**
|
app/code/community/Netresearch/OPS/Block/Checkout/SubscriptionNotice.php
CHANGED
@@ -93,7 +93,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
|
|
93 |
*/
|
94 |
public function getInitialFeeText()
|
95 |
{
|
96 |
-
return $this->__(
|
|
|
97 |
$this->helper('checkout')->formatPrice($this->getProfile()->getInitAmount())
|
98 |
);
|
99 |
}
|
@@ -105,7 +106,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
|
|
105 |
{
|
106 |
$profile = $this->getProfile();
|
107 |
|
108 |
-
return $this->__(
|
|
|
109 |
$this->helper('checkout')->formatPrice(
|
110 |
$profile->getTrialBillingAmount() + $profile->getShippingAmount()
|
111 |
),
|
@@ -122,7 +124,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
|
|
122 |
{
|
123 |
$profile = $this->getProfile();
|
124 |
|
125 |
-
$message = $this->__(
|
|
|
126 |
$this->helper('checkout')->formatPrice(
|
127 |
$profile->getBillingAmount() + $profile->getTaxAmount() + $profile->getShippingAmount()
|
128 |
),
|
@@ -130,16 +133,19 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
|
|
130 |
$profile->getPeriodUnitLabel($profile->getPeriodUnit())
|
131 |
);
|
132 |
|
133 |
-
if($this->getRegularSubscriptionEndDate()){
|
134 |
-
$message .= $this->__(
|
135 |
-
|
|
|
|
|
136 |
}
|
137 |
return $message;
|
138 |
}
|
139 |
|
140 |
public function getCancelInformationText()
|
141 |
{
|
142 |
-
return $this->__(
|
|
|
143 |
' or request this by clicking the suspend button on the subscriptions detail view in your customer account.'
|
144 |
. ' A link to that page will be displayed on the checkout success page.'
|
145 |
);
|
@@ -163,7 +169,8 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
|
|
163 |
$parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
|
164 |
$enddate = null;
|
165 |
$startDate = new DateTime($this->getProfile()->getStartDatetime());
|
166 |
-
$enddate = $parameterModel->calculateEndDate(
|
|
|
167 |
$this->getProfile()->getTrialPeriodFrequency(), $this->getProfile()->getTrialPeriodMaxCycles()
|
168 |
);
|
169 |
|
@@ -179,14 +186,16 @@ class Netresearch_OPS_Block_Checkout_SubscriptionNotice extends Mage_Core_Block_
|
|
179 |
} else {
|
180 |
$startDate = new DateTime($this->getProfile()->getStartDatetime());
|
181 |
}
|
182 |
-
$enddate = $parameterModel->calculateEndDate(
|
|
|
183 |
$this->getProfile()->getPeriodFrequency(), $this->getProfile()->getPeriodMaxCycles()
|
184 |
);
|
185 |
|
186 |
return $enddate;
|
187 |
}
|
188 |
|
189 |
-
protected function localizeDate(DateTime $date)
|
|
|
190 |
$date = new Zend_Date($date->getTimestamp());
|
191 |
return Mage::helper('core')->formatDate($date);
|
192 |
}
|
93 |
*/
|
94 |
public function getInitialFeeText()
|
95 |
{
|
96 |
+
return $this->__(
|
97 |
+
'You will be charged an initial amount of %s.',
|
98 |
$this->helper('checkout')->formatPrice($this->getProfile()->getInitAmount())
|
99 |
);
|
100 |
}
|
106 |
{
|
107 |
$profile = $this->getProfile();
|
108 |
|
109 |
+
return $this->__(
|
110 |
+
'A trial subscription will be created. This will charge you %s every %s %s until %s.',
|
111 |
$this->helper('checkout')->formatPrice(
|
112 |
$profile->getTrialBillingAmount() + $profile->getShippingAmount()
|
113 |
),
|
124 |
{
|
125 |
$profile = $this->getProfile();
|
126 |
|
127 |
+
$message = $this->__(
|
128 |
+
'A subscription will be created. This will charge you %s every %s %s.',
|
129 |
$this->helper('checkout')->formatPrice(
|
130 |
$profile->getBillingAmount() + $profile->getTaxAmount() + $profile->getShippingAmount()
|
131 |
),
|
133 |
$profile->getPeriodUnitLabel($profile->getPeriodUnit())
|
134 |
);
|
135 |
|
136 |
+
if ($this->getRegularSubscriptionEndDate()) {
|
137 |
+
$message .= $this->__(
|
138 |
+
' The subscription will end on %s.',
|
139 |
+
$this->localizeDate($this->getRegularSubscriptionEndDate())
|
140 |
+
);
|
141 |
}
|
142 |
return $message;
|
143 |
}
|
144 |
|
145 |
public function getCancelInformationText()
|
146 |
{
|
147 |
+
return $this->__(
|
148 |
+
'To cancel the subscription, please send an email to the shop owner' .
|
149 |
' or request this by clicking the suspend button on the subscriptions detail view in your customer account.'
|
150 |
. ' A link to that page will be displayed on the checkout success page.'
|
151 |
);
|
169 |
$parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
|
170 |
$enddate = null;
|
171 |
$startDate = new DateTime($this->getProfile()->getStartDatetime());
|
172 |
+
$enddate = $parameterModel->calculateEndDate(
|
173 |
+
$startDate, $this->getProfile()->getTrialPeriodUnit(),
|
174 |
$this->getProfile()->getTrialPeriodFrequency(), $this->getProfile()->getTrialPeriodMaxCycles()
|
175 |
);
|
176 |
|
186 |
} else {
|
187 |
$startDate = new DateTime($this->getProfile()->getStartDatetime());
|
188 |
}
|
189 |
+
$enddate = $parameterModel->calculateEndDate(
|
190 |
+
$startDate, $this->getProfile()->getPeriodUnit(),
|
191 |
$this->getProfile()->getPeriodFrequency(), $this->getProfile()->getPeriodMaxCycles()
|
192 |
);
|
193 |
|
194 |
return $enddate;
|
195 |
}
|
196 |
|
197 |
+
protected function localizeDate(DateTime $date)
|
198 |
+
{
|
199 |
$date = new Zend_Date($date->getTimestamp());
|
200 |
return Mage::helper('core')->formatDate($date);
|
201 |
}
|
app/code/community/Netresearch/OPS/Block/Form.php
CHANGED
@@ -33,6 +33,8 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
|
|
33 |
|
34 |
protected $config = null;
|
35 |
|
|
|
|
|
36 |
/**
|
37 |
* Frontend Payment Template
|
38 |
*/
|
@@ -78,7 +80,12 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
|
|
78 |
*/
|
79 |
public function getQuote()
|
80 |
{
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
|
84 |
/**
|
@@ -159,34 +166,13 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
|
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
-
* @return
|
163 |
*/
|
164 |
protected function getFieldMapping()
|
165 |
{
|
166 |
return $this->getConfig()->getFrontendFieldMapping();
|
167 |
}
|
168 |
|
169 |
-
/**
|
170 |
-
* returns the corresponding fields for frontend validation if needed
|
171 |
-
*
|
172 |
-
* @return string - the json encoded fields
|
173 |
-
*/
|
174 |
-
public function getFrontendValidators()
|
175 |
-
{
|
176 |
-
$frontendFields = array();
|
177 |
-
if ($this->getConfig()->canSubmitExtraParameter($this->getQuote()->getStoreId())) {
|
178 |
-
$fieldsToValidate = $this->getConfig()->getParameterLengths();
|
179 |
-
$mappedFields = $this->getFieldMapping();
|
180 |
-
foreach ($fieldsToValidate as $key => $value) {
|
181 |
-
if (array_key_exists($key, $mappedFields)) {
|
182 |
-
$frontendFields = $this->getFrontendValidationFields($mappedFields, $key, $value, $frontendFields);
|
183 |
-
}
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
-
return Mage::helper('core/data')->jsonEncode($frontendFields);
|
188 |
-
}
|
189 |
-
|
190 |
/**
|
191 |
* @param $mappedFields
|
192 |
* @param $key
|
@@ -213,4 +199,165 @@ class Netresearch_OPS_Block_Form extends Mage_Payment_Block_Form_Cc
|
|
213 |
$brandName = str_replace(' ', '', $brand);
|
214 |
return $this->getSkinUrl('images/ops/alias/brands/'. $brandName .'.png');
|
215 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
}
|
33 |
|
34 |
protected $config = null;
|
35 |
|
36 |
+
protected $_aliasDataForCustomer = array();
|
37 |
+
|
38 |
/**
|
39 |
* Frontend Payment Template
|
40 |
*/
|
80 |
*/
|
81 |
public function getQuote()
|
82 |
{
|
83 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
84 |
+
if (Mage::app()->getStore()->isAdmin()) {
|
85 |
+
$quote = Mage::getSingleton('adminhtml/sales_order_create')->getQuote();
|
86 |
+
}
|
87 |
+
|
88 |
+
return $quote;
|
89 |
}
|
90 |
|
91 |
/**
|
166 |
}
|
167 |
|
168 |
/**
|
169 |
+
* @return array
|
170 |
*/
|
171 |
protected function getFieldMapping()
|
172 |
{
|
173 |
return $this->getConfig()->getFrontendFieldMapping();
|
174 |
}
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
/**
|
177 |
* @param $mappedFields
|
178 |
* @param $key
|
199 |
$brandName = str_replace(' ', '', $brand);
|
200 |
return $this->getSkinUrl('images/ops/alias/brands/'. $brandName .'.png');
|
201 |
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Function to add the Payment Logo to the according title
|
205 |
+
*
|
206 |
+
* @return string
|
207 |
+
*/
|
208 |
+
public function getMethodLabelAfterHtml()
|
209 |
+
{
|
210 |
+
$paymentCode = $this->getMethod()->getCode();
|
211 |
+
$logoValue = Mage::getStoreConfig('payment/' . $paymentCode . '/image');
|
212 |
+
$logoPosition = Mage::getStoreConfig('payment/' . $paymentCode . '/position');
|
213 |
+
|
214 |
+
if ($logoPosition != 'hidden') {
|
215 |
+
if (!empty($logoValue)) {
|
216 |
+
$url = Mage::getBaseUrl('media') . 'ops/paymentLogo/' . $logoValue;
|
217 |
+
} else {
|
218 |
+
$url = Mage::helper('ops/payment')->getPaymentDefaultLogo($paymentCode);
|
219 |
+
}
|
220 |
+
|
221 |
+
return "<span class='payment-logo $logoPosition'><img src='$url' alt='$paymentCode' title='$paymentCode'/></span>";
|
222 |
+
}
|
223 |
+
|
224 |
+
return '';
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Obtain redirect message.
|
229 |
+
*
|
230 |
+
* @return string
|
231 |
+
*/
|
232 |
+
public function getRedirectMessage()
|
233 |
+
{
|
234 |
+
return $this->__('You will be redirected to finalize your payment.');
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* retrieves the alias data for the logged in customer
|
239 |
+
*
|
240 |
+
* @return array | null - array the alias data or null if the customer
|
241 |
+
* is not logged in
|
242 |
+
*/
|
243 |
+
protected function getStoredAliasForCustomer()
|
244 |
+
{
|
245 |
+
if (Mage::helper('customer/data')->isLoggedIn()
|
246 |
+
&& Mage::getModel('ops/config')->isAliasManagerEnabled($this->getMethodCode())
|
247 |
+
) {
|
248 |
+
$quote = $this->getQuote();
|
249 |
+
$aliases = Mage::helper('ops/alias')->getAliasesForAddresses(
|
250 |
+
$quote->getCustomer()->getId(), $quote->getBillingAddress(),
|
251 |
+
$quote->getShippingAddress(), $quote->getStoreId()
|
252 |
+
)
|
253 |
+
->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE)
|
254 |
+
->addFieldToFilter('payment_method', $this->getMethodCode())
|
255 |
+
->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC);
|
256 |
+
|
257 |
+
|
258 |
+
foreach ($aliases as $key => $alias) {
|
259 |
+
$this->_aliasDataForCustomer[$key] = $alias;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
return $this->_aliasDataForCustomer;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* @param null $storeId
|
268 |
+
* @param bool $admin
|
269 |
+
*
|
270 |
+
* @return string
|
271 |
+
*/
|
272 |
+
public function getAliasAcceptUrl($storeId = null, $admin = false)
|
273 |
+
{
|
274 |
+
return Mage::getModel('ops/config')->getAliasAcceptUrl($storeId, $admin);
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* @param null $storeId
|
279 |
+
* @param bool $admin
|
280 |
+
*
|
281 |
+
* @return string
|
282 |
+
*/
|
283 |
+
public function getAliasExceptionUrl($storeId = null, $admin = false)
|
284 |
+
{
|
285 |
+
return Mage::getModel('ops/config')->getAliasExceptionUrl($storeId, $admin);
|
286 |
+
}
|
287 |
+
|
288 |
+
|
289 |
+
/**
|
290 |
+
* @param null $storeId
|
291 |
+
*
|
292 |
+
* @return string
|
293 |
+
*/
|
294 |
+
public function getAliasGatewayUrl($storeId = null)
|
295 |
+
{
|
296 |
+
return Mage::getModel('ops/config')->getAliasGatewayUrl($storeId);
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
*
|
301 |
+
* @param $aliasId
|
302 |
+
*
|
303 |
+
* @return null|string - the card holder either from alias data or
|
304 |
+
* the name from the the user who is logged in, null otherwise
|
305 |
+
*/
|
306 |
+
public function getCardHolderName($aliasId)
|
307 |
+
{
|
308 |
+
$cardHolderName = $this->getStoredAliasDataForCustomer($aliasId, 'card_holder');
|
309 |
+
$customerHelper = Mage::helper('customer/data');
|
310 |
+
if ((null === $cardHolderName || 0 === strlen(trim($cardHolderName)))
|
311 |
+
&& $customerHelper->isLoggedIn()
|
312 |
+
&& Mage::getModel('ops/config')->isAliasManagerEnabled($this->getMethodCode())
|
313 |
+
) {
|
314 |
+
$cardHolderName = $customerHelper->getCustomerName();
|
315 |
+
}
|
316 |
+
|
317 |
+
return $cardHolderName;
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* @param $aliasId
|
322 |
+
* @return null|string
|
323 |
+
*/
|
324 |
+
public function getAliasCardNumber($aliasId)
|
325 |
+
{
|
326 |
+
$aliasCardNumber = $this->getStoredAliasDataForCustomer($aliasId, 'pseudo_account_or_cc_no');
|
327 |
+
if (0 < strlen(trim($aliasCardNumber))) {
|
328 |
+
$aliasCardNumber = Mage::helper('ops/alias')->formatAliasCardNo(
|
329 |
+
$this->getStoredAliasDataForCustomer($aliasId, 'brand'), $aliasCardNumber
|
330 |
+
);
|
331 |
+
}
|
332 |
+
|
333 |
+
return $aliasCardNumber;
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* retrieves single values to given keys from the alias data
|
338 |
+
*
|
339 |
+
* @param $aliasId
|
340 |
+
* @param $key - string the key for the alias data
|
341 |
+
*
|
342 |
+
* @return null|string - null if key is not set in the alias data, otherwise
|
343 |
+
* the value for the given key from the alias data
|
344 |
+
*/
|
345 |
+
protected function getStoredAliasDataForCustomer($aliasId, $key)
|
346 |
+
{
|
347 |
+
$returnValue = null;
|
348 |
+
$aliasData = array();
|
349 |
+
|
350 |
+
if (empty($this->_aliasDataForCustomer)) {
|
351 |
+
$aliasData = $this->getStoredAliasForCustomer();
|
352 |
+
} else {
|
353 |
+
$aliasData = $this->_aliasDataForCustomer;
|
354 |
+
}
|
355 |
+
|
356 |
+
if (array_key_exists($aliasId, $aliasData) && $aliasData[$aliasId]->hasData($key)) {
|
357 |
+
$returnValue = $aliasData[$aliasId]->getData($key);
|
358 |
+
}
|
359 |
+
|
360 |
+
return $returnValue;
|
361 |
+
}
|
362 |
+
|
363 |
}
|
app/code/community/Netresearch/OPS/Block/Form/Alias.php
CHANGED
@@ -39,10 +39,10 @@ class Netresearch_OPS_Block_Form_Alias extends Netresearch_OPS_Block_Form
|
|
39 |
}
|
40 |
return array();
|
41 |
}
|
42 |
-
|
43 |
/**
|
44 |
-
*
|
45 |
-
* @
|
46 |
*/
|
47 |
protected function getHumanReadableAlias($alias)
|
48 |
{
|
39 |
}
|
40 |
return array();
|
41 |
}
|
42 |
+
|
43 |
/**
|
44 |
+
* @param $alias
|
45 |
+
* @return string
|
46 |
*/
|
47 |
protected function getHumanReadableAlias($alias)
|
48 |
{
|
app/code/community/Netresearch/OPS/Block/Form/BankTransfer.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* DISCLAIMER
|
13 |
+
*
|
14 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
+
* newer versions in the future.
|
16 |
+
*
|
17 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
+
* @license Open Software License (OSL 3.0)
|
19 |
+
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* BankTransfer.php
|
24 |
+
*
|
25 |
+
* @category Payment
|
26 |
+
* @package Netresearch_OPS
|
27 |
+
* @author Sebastian Ertner <sebastian.ertner@netresearch.de>
|
28 |
+
*/
|
29 |
+
?>
|
30 |
+
<?php
|
31 |
+
|
32 |
+
class Netresearch_OPS_Block_Form_BankTransfer extends Netresearch_OPS_Block_Form
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* @inheritDoc
|
36 |
+
*/
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
parent::_construct();
|
40 |
+
$this->setTemplate('ops/form/bankTransfer.phtml');
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Netresearch/OPS/Block/Form/Cc.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
|
12 |
{
|
13 |
|
14 |
-
|
15 |
|
16 |
/**
|
17 |
* CC Payment Template
|
@@ -36,38 +36,6 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
|
|
36 |
->getAliasInterfaceCompatibleTypes();
|
37 |
}
|
38 |
|
39 |
-
/**
|
40 |
-
* @param null $storeId
|
41 |
-
* @param bool $admin
|
42 |
-
*
|
43 |
-
* @return string
|
44 |
-
*/
|
45 |
-
public function getAliasAcceptUrl($storeId = null, $admin = false)
|
46 |
-
{
|
47 |
-
return Mage::getModel('ops/config')->getAliasAcceptUrl($storeId, $admin);
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @param null $storeId
|
52 |
-
* @param bool $admin
|
53 |
-
*
|
54 |
-
* @return string
|
55 |
-
*/
|
56 |
-
public function getAliasExceptionUrl($storeId = null, $admin = false)
|
57 |
-
{
|
58 |
-
return Mage::getModel('ops/config')->getAliasExceptionUrl($storeId, $admin);
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @param null $storeId
|
63 |
-
*
|
64 |
-
* @return string
|
65 |
-
*/
|
66 |
-
public function getAliasGatewayUrl($storeId = null)
|
67 |
-
{
|
68 |
-
return Mage::getModel('ops/config')->getAliasGatewayUrl($storeId);
|
69 |
-
}
|
70 |
-
|
71 |
/**
|
72 |
* @return string
|
73 |
*/
|
@@ -122,47 +90,20 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
|
|
122 |
|
123 |
|
124 |
foreach ($aliases as $key => $alias) {
|
125 |
-
$this->
|
126 |
}
|
127 |
}
|
128 |
|
129 |
-
return $this->
|
130 |
}
|
131 |
|
132 |
|
133 |
-
/**
|
134 |
-
* retrieves single values to given keys from the alias data
|
135 |
-
*
|
136 |
-
* @param $aliasId
|
137 |
-
* @param $key - string the key for the alias data
|
138 |
-
*
|
139 |
-
* @return null|string - null if key is not set in the alias data, otherwise
|
140 |
-
* the value for the given key from the alias data
|
141 |
-
*/
|
142 |
-
protected function getStoredAliasDataForCustomer($aliasId, $key)
|
143 |
-
{
|
144 |
-
$returnValue = null;
|
145 |
-
$aliasData = array();
|
146 |
-
|
147 |
-
if (empty($this->aliasDataForCustomer)) {
|
148 |
-
$aliasData = $this->getStoredAliasForCustomer();
|
149 |
-
} else {
|
150 |
-
$aliasData = $this->aliasDataForCustomer;
|
151 |
-
}
|
152 |
-
|
153 |
-
if (array_key_exists($aliasId, $aliasData) && $aliasData[$aliasId]->hasData($key)) {
|
154 |
-
$returnValue = $aliasData[$aliasId]->getData($key);
|
155 |
-
}
|
156 |
|
157 |
-
return $returnValue;
|
158 |
-
}
|
159 |
|
160 |
/**
|
161 |
-
*
|
162 |
-
*
|
163 |
-
* @
|
164 |
-
*
|
165 |
-
* @return null | string the extracted part of the date
|
166 |
*/
|
167 |
public function getExpirationDatePart($aliasId, $key)
|
168 |
{
|
@@ -193,56 +134,17 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
|
|
193 |
|
194 |
}
|
195 |
|
196 |
-
/**
|
197 |
-
* retrieves the masked alias card number and formats it in a card specific format
|
198 |
-
*
|
199 |
-
* @return null|string - null if no alias data were found,
|
200 |
-
* otherwise the formatted card number
|
201 |
-
*/
|
202 |
-
public function getAliasCardNumber($aliasId)
|
203 |
-
{
|
204 |
-
$aliasCardNumber = $this->getStoredAliasDataForCustomer($aliasId, 'pseudo_account_or_cc_no');
|
205 |
-
if (0 < strlen(trim($aliasCardNumber))) {
|
206 |
-
$aliasCardNumber = Mage::helper('ops/alias')->formatAliasCardNo(
|
207 |
-
$this->getStoredAliasDataForCustomer($aliasId, 'brand'), $aliasCardNumber
|
208 |
-
);
|
209 |
-
}
|
210 |
-
|
211 |
-
return $aliasCardNumber;
|
212 |
-
}
|
213 |
-
|
214 |
-
/**
|
215 |
-
* @return null|string - the card holder either from alias data or
|
216 |
-
* the name from the the user who is logged in, null otherwise
|
217 |
-
*/
|
218 |
-
public function getCardHolderName($aliasId)
|
219 |
-
{
|
220 |
-
$cardHolderName = $this->getStoredAliasDataForCustomer($aliasId, 'card_holder');
|
221 |
-
$customerHelper = Mage::helper('customer/data');
|
222 |
-
if ((is_null($cardHolderName) || 0 === strlen(trim($cardHolderName)))
|
223 |
-
&& $customerHelper->isLoggedIn()
|
224 |
-
&& Mage::getModel('ops/config')->isAliasManagerEnabled($this->getMethodCode())
|
225 |
-
) {
|
226 |
-
$cardHolderName = $customerHelper->getCustomerName();
|
227 |
-
}
|
228 |
-
|
229 |
-
return $cardHolderName;
|
230 |
-
}
|
231 |
|
232 |
/**
|
233 |
* the brand of the stored card data
|
234 |
*
|
|
|
|
|
235 |
* @return null|string - string if stored card data were found, null otherwise
|
236 |
*/
|
237 |
public function getStoredAliasBrand($aliasId)
|
238 |
{
|
239 |
-
|
240 |
-
$methodCode = $this->getMethodCode();
|
241 |
-
if (in_array($storedBrand, Mage::getModel('ops/config')->getInlinePaymentCcTypes($methodCode))) {
|
242 |
-
return $storedBrand;
|
243 |
-
}
|
244 |
-
|
245 |
-
return '';
|
246 |
}
|
247 |
|
248 |
/**
|
@@ -265,4 +167,12 @@ class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
|
|
265 |
return explode(',', $this->getConfig()->getAcceptedCcTypes($this->getMethodCode()));
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
11 |
class Netresearch_OPS_Block_Form_Cc extends Netresearch_OPS_Block_Form
|
12 |
{
|
13 |
|
14 |
+
protected $_aliasDataForCustomer = array();
|
15 |
|
16 |
/**
|
17 |
* CC Payment Template
|
36 |
->getAliasInterfaceCompatibleTypes();
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* @return string
|
41 |
*/
|
90 |
|
91 |
|
92 |
foreach ($aliases as $key => $alias) {
|
93 |
+
$this->_aliasDataForCustomer[$key] = $alias;
|
94 |
}
|
95 |
}
|
96 |
|
97 |
+
return $this->_aliasDataForCustomer;
|
98 |
}
|
99 |
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
|
|
|
|
102 |
|
103 |
/**
|
104 |
+
* @param $aliasId
|
105 |
+
* @param $key
|
106 |
+
* @return null|string
|
|
|
|
|
107 |
*/
|
108 |
public function getExpirationDatePart($aliasId, $key)
|
109 |
{
|
134 |
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
/**
|
139 |
* the brand of the stored card data
|
140 |
*
|
141 |
+
* @param $aliasId
|
142 |
+
*
|
143 |
* @return null|string - string if stored card data were found, null otherwise
|
144 |
*/
|
145 |
public function getStoredAliasBrand($aliasId)
|
146 |
{
|
147 |
+
return $this->getStoredAliasDataForCustomer($aliasId, 'brand');
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
|
150 |
/**
|
167 |
return explode(',', $this->getConfig()->getAcceptedCcTypes($this->getMethodCode()));
|
168 |
}
|
169 |
|
170 |
+
public function checkIfBrandHasAliasInterfaceSupport($alias)
|
171 |
+
{
|
172 |
+
$brand = $this->getStoredAliasBrand($alias);
|
173 |
+
$allowedBrands = $this->getMethod()->getBrandsForAliasInterface();
|
174 |
+
|
175 |
+
return in_array($brand, $allowedBrands);
|
176 |
+
}
|
177 |
+
|
178 |
}
|
app/code/community/Netresearch/OPS/Block/Form/DirectDebit.php
CHANGED
@@ -10,8 +10,6 @@
|
|
10 |
class Netresearch_OPS_Block_Form_DirectDebit extends Netresearch_OPS_Block_Form
|
11 |
{
|
12 |
|
13 |
-
protected $previousParams = array();
|
14 |
-
|
15 |
/**
|
16 |
* Backend Payment Template
|
17 |
*/
|
@@ -34,200 +32,16 @@ class Netresearch_OPS_Block_Form_DirectDebit extends Netresearch_OPS_Block_Form
|
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
-
*
|
38 |
-
*
|
39 |
-
* @return array - the previously entred params
|
40 |
-
*/
|
41 |
-
public function getParams()
|
42 |
-
{
|
43 |
-
$params = Mage::getModel('adminhtml/session')->getData(
|
44 |
-
'ops_direct_debit_params'
|
45 |
-
);
|
46 |
-
|
47 |
-
Mage::getModel('adminhtml/session')->unsetData(
|
48 |
-
'ops_direct_debit_params'
|
49 |
-
);
|
50 |
-
if (!is_array($params)) {
|
51 |
-
$params = array(
|
52 |
-
'country' => '',
|
53 |
-
'CN' => '',
|
54 |
-
'iban' => '',
|
55 |
-
'bic' => '',
|
56 |
-
'account' => '',
|
57 |
-
'bankcode' => ''
|
58 |
-
);
|
59 |
-
}
|
60 |
-
$this->previousParams = $params;
|
61 |
-
|
62 |
-
return $this->previousParams;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* checks if the iban field is required
|
67 |
-
*
|
68 |
-
* @return bool - true if so, false otherwise
|
69 |
-
*/
|
70 |
-
public function isIbanFieldRequired()
|
71 |
-
{
|
72 |
-
return (count($this->previousParams) == 0
|
73 |
-
|| (array_key_exists(
|
74 |
-
'iban', $this->previousParams
|
75 |
-
)
|
76 |
-
&& 0 < strlen('iban')
|
77 |
-
|| array_key_exists('account', $this->previousParams)
|
78 |
-
&& 0 == strlen($this->previousParams['account'])));
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* checks if the account field is required
|
83 |
-
*
|
84 |
-
* @return bool - true if so, false otherwise
|
85 |
-
*/
|
86 |
-
public function isAccountFieldRequired()
|
87 |
-
{
|
88 |
-
return (count($this->previousParams) == 0
|
89 |
-
|| (array_key_exists(
|
90 |
-
'account', $this->previousParams
|
91 |
-
)
|
92 |
-
&& (!array_key_exists('iban', $this->previousParams)
|
93 |
-
|| 0 == strlen($this->previousParams['iban']))));
|
94 |
-
}
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
/**
|
99 |
-
* checks if the bankcode field is required
|
100 |
-
*
|
101 |
-
* @return bool - true if so, false otherwise
|
102 |
-
*/
|
103 |
-
public function isBankCodeFieldRequired()
|
104 |
-
{
|
105 |
-
return $this->isAccountFieldRequired()
|
106 |
-
&& array_key_exists(
|
107 |
-
'country', $this->previousParams
|
108 |
-
)
|
109 |
-
&& ('DE' == strtoupper(
|
110 |
-
$this->getCountry())
|
111 |
-
|| 'AT' == strtoupper($this->getCountry())
|
112 |
-
|
113 |
-
);
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* checks if the bankcode field is visible
|
118 |
-
*
|
119 |
-
* @return bool - true if so, false otherwise
|
120 |
-
*/
|
121 |
-
public function isBankCodeFieldVisible()
|
122 |
-
{
|
123 |
-
return array_key_exists('country', $this->previousParams)
|
124 |
-
&& ('DE' == strtoupper($this->getCountry())
|
125 |
-
|| 'AT' == strtoupper($this->getCountry()));
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* checks if the bic field is visible
|
130 |
-
*
|
131 |
-
* @return bool - true if so, false otherwise
|
132 |
-
*/
|
133 |
-
public function isBicFieldVisible()
|
134 |
-
{
|
135 |
-
return ('NL' == strtoupper($this->getCountry()));
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* gets the previously entered country (if any)
|
140 |
-
*
|
141 |
-
* @return string - empty string if no country is given, otherwise the country
|
142 |
*/
|
143 |
-
public function
|
144 |
{
|
145 |
-
$
|
146 |
-
if (
|
147 |
-
$
|
|
|
148 |
}
|
|
|
149 |
|
150 |
-
return $country;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* gets the previously entered iban (if any)
|
155 |
-
*
|
156 |
-
* @return string - empty string if no iban is given, otherwise the iban
|
157 |
-
*/
|
158 |
-
public function getIban()
|
159 |
-
{
|
160 |
-
$iban = '';
|
161 |
-
if (array_key_exists('iban', $this->previousParams)) {
|
162 |
-
$iban = $this->previousParams['iban'];
|
163 |
-
}
|
164 |
-
|
165 |
-
return $iban;
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* gets the previously entered bic (if any)
|
170 |
-
*
|
171 |
-
* @return string - empty string if no bic is given, otherwise the bic
|
172 |
-
*/
|
173 |
-
public function getBic()
|
174 |
-
{
|
175 |
-
$bic = '';
|
176 |
-
if (array_key_exists('bic', $this->previousParams)) {
|
177 |
-
$bic = $this->previousParams['bic'];
|
178 |
-
}
|
179 |
-
|
180 |
-
return $bic;
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* gets the previously entered account (if any)
|
185 |
-
*
|
186 |
-
* @return string - empty string if no account is given, otherwise the account
|
187 |
-
*/
|
188 |
-
public function getAccount()
|
189 |
-
{
|
190 |
-
$account = '';
|
191 |
-
if (array_key_exists('account', $this->previousParams)) {
|
192 |
-
$account = $this->previousParams['account'];
|
193 |
-
}
|
194 |
-
|
195 |
-
return $account;
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* gets the previously entered bankcode (if any)
|
200 |
-
*
|
201 |
-
* @return string - empty string if no bankcode is given, otherwise the bankcode
|
202 |
-
*/
|
203 |
-
public function getBankcode()
|
204 |
-
{
|
205 |
-
$bankcode = '';
|
206 |
-
if (array_key_exists('bankcode', $this->previousParams)) {
|
207 |
-
$bankcode = $this->previousParams['bankcode'];
|
208 |
-
}
|
209 |
-
|
210 |
-
return $bankcode;
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* gets the previously entered card holder (if any)
|
215 |
-
* @param $aliasId - not used, but required by parent methods
|
216 |
-
*
|
217 |
-
* @return string - empty string if no card holder is given, otherwise the card holder
|
218 |
-
*/
|
219 |
-
public function getCardholderName($aliasId = null)
|
220 |
-
{
|
221 |
-
$cardholder = '';
|
222 |
-
if (array_key_exists('CN', $this->previousParams)) {
|
223 |
-
$cardholder = $this->previousParams['CN'];
|
224 |
-
}
|
225 |
-
|
226 |
-
return $cardholder;
|
227 |
-
}
|
228 |
-
|
229 |
-
public function getRegisterDirectDebitPaymentUrl()
|
230 |
-
{
|
231 |
-
return Mage::getModel('ops/config')->getRegisterDirectDebitPaymentUrl();
|
232 |
}
|
233 |
}
|
10 |
class Netresearch_OPS_Block_Form_DirectDebit extends Netresearch_OPS_Block_Form
|
11 |
{
|
12 |
|
|
|
|
|
13 |
/**
|
14 |
* Backend Payment Template
|
15 |
*/
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
+
* @return string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
*/
|
37 |
+
public function getSelectedCountryId()
|
38 |
{
|
39 |
+
$countryId = $this->getQuote()->getPayment()->getAdditionalInformation('country_id');
|
40 |
+
if (Mage::app()->getStore()->isAdmin()) {
|
41 |
+
$data = $this->getQuote()->getPayment()->getData('ops_directDebit_data');
|
42 |
+
$countryId = $data && array_key_exists('country_id', $data) ? $data['country_id'] : '';
|
43 |
}
|
44 |
+
return $countryId;
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
}
|
app/code/community/Netresearch/OPS/Block/Form/DirectEbanking.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* DISCLAIMER
|
13 |
+
*
|
14 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
+
* newer versions in the future.
|
16 |
+
*
|
17 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
+
* @license Open Software License (OSL 3.0)
|
19 |
+
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* DirectEbanking.php
|
24 |
+
*
|
25 |
+
* @category Payment
|
26 |
+
* @package Netresearch_OPS
|
27 |
+
* @author Sebastian Ertner <sebastian.ertner@netresearch.de>
|
28 |
+
*/
|
29 |
+
?>
|
30 |
+
<?php
|
31 |
+
|
32 |
+
class Netresearch_OPS_Block_Form_DirectEbanking extends Netresearch_OPS_Block_Form
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* @inheritDoc
|
36 |
+
*/
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
parent::_construct();
|
40 |
+
$this->setTemplate('ops/form/directEbanking.phtml');
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Netresearch/OPS/Block/Form/Flex.php
CHANGED
@@ -47,9 +47,8 @@ class Netresearch_OPS_Block_Form_Flex extends Netresearch_OPS_Block_Form
|
|
47 |
*/
|
48 |
public function getFlexMethods()
|
49 |
{
|
50 |
-
|
51 |
$methods = $this->getMethod()->getConfigData('methods');
|
52 |
-
if(!is_array($methods)){
|
53 |
$methods = unserialize($methods);
|
54 |
}
|
55 |
|
47 |
*/
|
48 |
public function getFlexMethods()
|
49 |
{
|
|
|
50 |
$methods = $this->getMethod()->getConfigData('methods');
|
51 |
+
if (!is_array($methods)) {
|
52 |
$methods = unserialize($methods);
|
53 |
}
|
54 |
|
app/code/community/Netresearch/OPS/Block/Form/Ideal.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
|
9 |
|
10 |
class Netresearch_OPS_Block_Form_Ideal
|
11 |
-
extends
|
12 |
{
|
13 |
|
14 |
/**
|
@@ -30,4 +30,4 @@ class Netresearch_OPS_Block_Form_Ideal
|
|
30 |
{
|
31 |
return Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
|
32 |
}
|
33 |
-
}
|
8 |
|
9 |
|
10 |
class Netresearch_OPS_Block_Form_Ideal
|
11 |
+
extends Netresearch_OPS_Block_Form
|
12 |
{
|
13 |
|
14 |
/**
|
30 |
{
|
31 |
return Mage::getModel('ops/payment_iDeal')->getIDealIssuers();
|
32 |
}
|
33 |
+
}
|
app/code/community/Netresearch/OPS/Block/Form/Kwixo/ApresReception.php
CHANGED
@@ -21,6 +21,7 @@ class Netresearch_OPS_Block_Form_Kwixo_ApresReception extends Netresearch_OPS_Bl
|
|
21 |
protected function _construct()
|
22 |
{
|
23 |
parent::_construct();
|
|
|
24 |
$this->setTemplate(self::FRONTEND_TEMPLATE);
|
25 |
}
|
26 |
}
|
21 |
protected function _construct()
|
22 |
{
|
23 |
parent::_construct();
|
24 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
25 |
$this->setTemplate(self::FRONTEND_TEMPLATE);
|
26 |
}
|
27 |
}
|
app/code/community/Netresearch/OPS/Block/Form/Kwixo/Comptant.php
CHANGED
@@ -22,6 +22,7 @@ class Netresearch_OPS_Block_Form_Kwixo_Comptant extends Netresearch_OPS_Block_Fo
|
|
22 |
protected function _construct()
|
23 |
{
|
24 |
parent::_construct();
|
|
|
25 |
$this->setTemplate(self::FRONTEND_TEMPLATE);
|
26 |
}
|
27 |
|
22 |
protected function _construct()
|
23 |
{
|
24 |
parent::_construct();
|
25 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
26 |
$this->setTemplate(self::FRONTEND_TEMPLATE);
|
27 |
}
|
28 |
|
app/code/community/Netresearch/OPS/Block/Form/Kwixo/Credit.php
CHANGED
@@ -22,6 +22,7 @@ class Netresearch_OPS_Block_Form_Kwixo_Credit extends Netresearch_OPS_Block_Form
|
|
22 |
protected function _construct()
|
23 |
{
|
24 |
parent::_construct();
|
|
|
25 |
$this->setTemplate(self::FRONTEND_TEMPLATE);
|
26 |
}
|
27 |
}
|
22 |
protected function _construct()
|
23 |
{
|
24 |
parent::_construct();
|
25 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
26 |
$this->setTemplate(self::FRONTEND_TEMPLATE);
|
27 |
}
|
28 |
}
|
app/code/community/Netresearch/OPS/Block/Form/OpenInvoice.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* DISCLAIMER
|
13 |
+
*
|
14 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
+
* newer versions in the future.
|
16 |
+
*
|
17 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
+
* @license Open Software License (OSL 3.0)
|
19 |
+
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Netresearch_OPS_Block_Form_OpenInvoice
|
24 |
+
*
|
25 |
+
* @category Payment
|
26 |
+
* @package Netresearch_OPS
|
27 |
+
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
+
*/
|
29 |
+
class Netresearch_OPS_Block_Form_OpenInvoice extends Netresearch_OPS_Block_Form
|
30 |
+
{
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
parent::_construct();
|
34 |
+
$this->setTemplate('ops/form/openInvoice.phtml');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @return string
|
39 |
+
* @see Netresearch_OPS_Model_Payment_OpenInvoice_Abstract::getInvoiceTermsTitle
|
40 |
+
*/
|
41 |
+
public function getInvoiceTermsTitle()
|
42 |
+
{
|
43 |
+
return $this->getMethod()->getInvoiceTermsTitle();
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return string
|
48 |
+
* @see Netresearch_OPS_Model_Payment_OpenInvoice_Abstract::getInvoiceTermsUrl
|
49 |
+
*/
|
50 |
+
public function getInvoiceTermsUrl()
|
51 |
+
{
|
52 |
+
return $this->getMethod()->getInvoiceTermsUrl();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @return bool
|
57 |
+
* @see Netresearch_OPS_Model_Payment_OpenInvoice_Abstract::showInvoiceTermsLink
|
58 |
+
*/
|
59 |
+
public function showInvoiceTermsLink()
|
60 |
+
{
|
61 |
+
return $this->getMethod()->showInvoiceTermsLink();
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Netresearch/OPS/Block/Form/PayPerMail.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* DISCLAIMER
|
13 |
+
*
|
14 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
+
* newer versions in the future.
|
16 |
+
*
|
17 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
+
* @license Open Software License (OSL 3.0)
|
19 |
+
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* PayPerMail.php
|
24 |
+
*
|
25 |
+
* @category Payment
|
26 |
+
* @package Netresearch_OPS
|
27 |
+
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
+
*/
|
29 |
+
?>
|
30 |
+
<?php
|
31 |
+
|
32 |
+
class Netresearch_OPS_Block_Form_PayPerMail extends Netresearch_OPS_Block_Form
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* @inheritDoc
|
36 |
+
*/
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
parent::_construct();
|
40 |
+
$this->setTemplate('ops/form/payPerMail.phtml');
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/Netresearch/OPS/Block/Form/RecurringCc.php
CHANGED
@@ -27,7 +27,8 @@
|
|
27 |
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
*/
|
29 |
|
30 |
-
class Netresearch_OPS_Block_Form_RecurringCc extends Netresearch_OPS_Block_Form_Cc
|
|
|
31 |
|
32 |
public function getCcBrands()
|
33 |
{
|
27 |
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
*/
|
29 |
|
30 |
+
class Netresearch_OPS_Block_Form_RecurringCc extends Netresearch_OPS_Block_Form_Cc
|
31 |
+
{
|
32 |
|
33 |
public function getCcBrands()
|
34 |
{
|
app/code/community/Netresearch/OPS/Block/Info/Alias.php
CHANGED
@@ -25,6 +25,7 @@ class Netresearch_OPS_Block_Info_Alias extends Netresearch_OPS_Block_Info_Redire
|
|
25 |
protected function _construct()
|
26 |
{
|
27 |
parent::_construct();
|
|
|
28 |
$this->setTemplate('ops/info/cc.phtml');
|
29 |
}
|
30 |
}
|
25 |
protected function _construct()
|
26 |
{
|
27 |
parent::_construct();
|
28 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
29 |
$this->setTemplate('ops/info/cc.phtml');
|
30 |
}
|
31 |
}
|
app/code/community/Netresearch/OPS/Block/Info/Bancontact.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Netresearch_OPS
|
23 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* OPS payment information block
|
29 |
+
*/
|
30 |
+
class Netresearch_OPS_Block_Info_Bancontact extends Mage_Payment_Block_Info
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Init ops payment information block
|
34 |
+
*
|
35 |
+
*/
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
parent::_construct();
|
39 |
+
$this->setTemplate('ops/info/bancontact.phtml');
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
public function getDeviceParameter()
|
44 |
+
{
|
45 |
+
return $this->getInfo()->getAdditionalInformation('DEVICE');
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
public function getMobileModeParameter()
|
50 |
+
{
|
51 |
+
return $this->getInfo()->getAdditionalInformation('MOBILEMODE');
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
app/code/community/Netresearch/OPS/Block/Info/Cc.php
CHANGED
@@ -36,6 +36,7 @@ class Netresearch_OPS_Block_Info_Cc extends Netresearch_OPS_Block_Info_Redirect
|
|
36 |
protected function _construct()
|
37 |
{
|
38 |
parent::_construct();
|
|
|
39 |
$this->setTemplate('ops/info/cc.phtml');
|
40 |
}
|
41 |
}
|
36 |
protected function _construct()
|
37 |
{
|
38 |
parent::_construct();
|
39 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
40 |
$this->setTemplate('ops/info/cc.phtml');
|
41 |
}
|
42 |
}
|
app/code/community/Netresearch/OPS/Block/Info/Flex.php
CHANGED
@@ -37,6 +37,7 @@ class Netresearch_OPS_Block_Info_Flex extends Mage_Payment_Block_Info
|
|
37 |
protected function _construct()
|
38 |
{
|
39 |
parent::_construct();
|
|
|
40 |
$this->setTemplate('ops/info/flex.phtml');
|
41 |
}
|
42 |
|
@@ -46,6 +47,7 @@ class Netresearch_OPS_Block_Info_Flex extends Mage_Payment_Block_Info
|
|
46 |
*/
|
47 |
public function getFlexTitle()
|
48 |
{
|
|
|
49 |
return $this->getMethod()->getInfoInstance()->getAdditionalInformation(
|
50 |
Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE
|
51 |
);
|
37 |
protected function _construct()
|
38 |
{
|
39 |
parent::_construct();
|
40 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
41 |
$this->setTemplate('ops/info/flex.phtml');
|
42 |
}
|
43 |
|
47 |
*/
|
48 |
public function getFlexTitle()
|
49 |
{
|
50 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
51 |
return $this->getMethod()->getInfoInstance()->getAdditionalInformation(
|
52 |
Netresearch_OPS_Model_Payment_Flex::INFO_KEY_TITLE
|
53 |
);
|
app/code/community/Netresearch/OPS/Block/Info/OpsId.php
CHANGED
@@ -36,6 +36,7 @@ class Netresearch_OPS_Block_Info_OpsId extends Mage_Payment_Block_Info
|
|
36 |
protected function _construct()
|
37 |
{
|
38 |
parent::_construct();
|
|
|
39 |
$this->setTemplate('ops/info/opsId.phtml');
|
40 |
}
|
41 |
}
|
36 |
protected function _construct()
|
37 |
{
|
38 |
parent::_construct();
|
39 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
40 |
$this->setTemplate('ops/info/opsId.phtml');
|
41 |
}
|
42 |
}
|
app/code/community/Netresearch/OPS/Block/Info/PayPerMail.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* DISCLAIMER
|
13 |
+
*
|
14 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
+
* newer versions in the future.
|
16 |
+
*
|
17 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
+
* @license Open Software License (OSL 3.0)
|
19 |
+
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* PayPerMail.php
|
24 |
+
*
|
25 |
+
* @category Payment
|
26 |
+
* @package Netresearch_OPS
|
27 |
+
* @author Sebastian Ertner <sebastian.ertner@netresearch.de>
|
28 |
+
*/
|
29 |
+
?>
|
30 |
+
<?php
|
31 |
+
|
32 |
+
class Netresearch_OPS_Block_Info_PayPerMail extends Mage_Payment_Block_Info
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* @inheritDoc
|
36 |
+
*/
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
parent::_construct();
|
40 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
41 |
+
$this->setTemplate('ops/info/payPerMail.phtml');
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/Netresearch/OPS/Block/Info/RecurringCc.php
CHANGED
@@ -27,6 +27,9 @@
|
|
27 |
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
*/
|
29 |
|
30 |
-
class Netresearch_OPS_Block_Info_RecurringCc extends Netresearch_OPS_Block_Info_Cc
|
|
|
|
|
|
|
31 |
|
32 |
}
|
27 |
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
*/
|
29 |
|
30 |
+
class Netresearch_OPS_Block_Info_RecurringCc extends Netresearch_OPS_Block_Info_Cc
|
31 |
+
{
|
32 |
+
|
33 |
+
|
34 |
|
35 |
}
|
app/code/community/Netresearch/OPS/Block/Info/Redirect.php
CHANGED
@@ -36,6 +36,7 @@ class Netresearch_OPS_Block_Info_Redirect extends Mage_Payment_Block_Info
|
|
36 |
protected function _construct()
|
37 |
{
|
38 |
parent::_construct();
|
|
|
39 |
$this->setTemplate('ops/info/redirect.phtml');
|
40 |
}
|
41 |
}
|
36 |
protected function _construct()
|
37 |
{
|
38 |
parent::_construct();
|
39 |
+
/** @noinspection PhpUndefinedMethodInspection */
|
40 |
$this->setTemplate('ops/info/redirect.phtml');
|
41 |
}
|
42 |
}
|
app/code/community/Netresearch/OPS/Block/Placeform.php
CHANGED
@@ -31,11 +31,10 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
|
|
31 |
protected $formFields;
|
32 |
protected $question;
|
33 |
|
34 |
-
public function __construct()
|
35 |
-
{
|
36 |
-
|
37 |
-
}
|
38 |
|
|
|
|
|
|
|
39 |
public function getConfig()
|
40 |
{
|
41 |
return Mage::getModel('ops/config');
|
@@ -58,10 +57,13 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
|
|
58 |
*/
|
59 |
protected function _getApi()
|
60 |
{
|
|
|
61 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
|
62 |
-
if ($order &&
|
63 |
-
|
64 |
}
|
|
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
@@ -102,7 +104,8 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
|
|
102 |
*/
|
103 |
public function getFormData()
|
104 |
{
|
105 |
-
if (
|
|
|
106 |
$this->formFields = $this->_getApi()->getFormFields($this->_getOrder(), $this->getRequest()->getParams());
|
107 |
}
|
108 |
return $this->formFields;
|
@@ -121,7 +124,9 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
|
|
121 |
$question = $this->getQuestion();
|
122 |
|
123 |
if ($this->getRequest()->isPost() || empty($question)) {
|
124 |
-
|
|
|
|
|
125 |
} else {
|
126 |
$formAction = Mage::getUrl(
|
127 |
'*/*/*', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
|
@@ -131,33 +136,52 @@ class Netresearch_OPS_Block_Placeform extends Mage_Core_Block_Template
|
|
131 |
return $formAction;
|
132 |
}
|
133 |
|
|
|
|
|
|
|
134 |
public function hasMissingParams()
|
135 |
{
|
136 |
-
if (
|
137 |
return null;
|
138 |
}
|
139 |
-
if (
|
140 |
-
$this->hasMissingParams = $this->_getApi()
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
return $this->hasMissingParams;
|
143 |
}
|
144 |
|
|
|
|
|
|
|
145 |
public function getQuestion()
|
146 |
{
|
147 |
-
if (
|
148 |
-
$this->question = $this->_getApi()->getQuestion(
|
149 |
}
|
150 |
return $this->question;
|
151 |
}
|
152 |
|
|
|
|
|
|
|
153 |
public function getQuestionedFormFields()
|
154 |
{
|
155 |
if (is_null($this->missingFormFields) && $this->_getOrder() && !is_null($this->_getOrder()->getId())) {
|
156 |
-
$this->missingFormFields = $this->_getApi()
|
|
|
157 |
}
|
|
|
158 |
return $this->missingFormFields;
|
159 |
}
|
160 |
|
|
|
|
|
|
|
161 |
public function isIframeTarget()
|
162 |
{
|
163 |
return $this->getConfig()->getConfigData('template') === Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME;
|
31 |
protected $formFields;
|
32 |
protected $question;
|
33 |
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
/**
|
36 |
+
* @return Netresearch_OPS_Model_Config
|
37 |
+
*/
|
38 |
public function getConfig()
|
39 |
{
|
40 |
return Mage::getModel('ops/config');
|
57 |
*/
|
58 |
protected function _getApi()
|
59 |
{
|
60 |
+
$methodInstance = null;
|
61 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
|
62 |
+
if ($order && null != $order->getId()) {
|
63 |
+
$methodInstance = $order->getPayment()->getMethodInstance();
|
64 |
}
|
65 |
+
|
66 |
+
return $methodInstance;
|
67 |
}
|
68 |
|
69 |
/**
|
104 |
*/
|
105 |
public function getFormData()
|
106 |
{
|
107 |
+
if (null == $this->formFields && $this->_getOrder()
|
108 |
+
&& null != $this->_getOrder()->getId()) {
|
109 |
$this->formFields = $this->_getApi()->getFormFields($this->_getOrder(), $this->getRequest()->getParams());
|
110 |
}
|
111 |
return $this->formFields;
|
124 |
$question = $this->getQuestion();
|
125 |
|
126 |
if ($this->getRequest()->isPost() || empty($question)) {
|
127 |
+
/** @var Netresearch_OPS_Model_Payment_Abstract $method */
|
128 |
+
$method = $this->_getOrder()->getPayment()->getMethodInstance();
|
129 |
+
$formAction = $method->getFrontendGateWay();
|
130 |
} else {
|
131 |
$formAction = Mage::getUrl(
|
132 |
'*/*/*', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
|
136 |
return $formAction;
|
137 |
}
|
138 |
|
139 |
+
/**
|
140 |
+
* @return bool|null
|
141 |
+
*/
|
142 |
public function hasMissingParams()
|
143 |
{
|
144 |
+
if (null === $this->_getOrder()) {
|
145 |
return null;
|
146 |
}
|
147 |
+
if (null === $this->hasMissingParams) {
|
148 |
+
$this->hasMissingParams = $this->_getApi()
|
149 |
+
->hasFormMissingParams(
|
150 |
+
$this->_getOrder(),
|
151 |
+
$this->getRequest()->getParams(),
|
152 |
+
$this->getFormData()
|
153 |
+
);
|
154 |
}
|
155 |
return $this->hasMissingParams;
|
156 |
}
|
157 |
|
158 |
+
/**
|
159 |
+
* @return string
|
160 |
+
*/
|
161 |
public function getQuestion()
|
162 |
{
|
163 |
+
if (null === $this->question && $this->_getOrder() && null != $this->_getOrder()->getId()) {
|
164 |
+
$this->question = $this->_getApi()->getQuestion();
|
165 |
}
|
166 |
return $this->question;
|
167 |
}
|
168 |
|
169 |
+
/**
|
170 |
+
* @return array
|
171 |
+
*/
|
172 |
public function getQuestionedFormFields()
|
173 |
{
|
174 |
if (is_null($this->missingFormFields) && $this->_getOrder() && !is_null($this->_getOrder()->getId())) {
|
175 |
+
$this->missingFormFields = $this->_getApi()
|
176 |
+
->getQuestionedFormFields($this->_getOrder());
|
177 |
}
|
178 |
+
|
179 |
return $this->missingFormFields;
|
180 |
}
|
181 |
|
182 |
+
/**
|
183 |
+
* @return bool
|
184 |
+
*/
|
185 |
public function isIframeTarget()
|
186 |
{
|
187 |
return $this->getConfig()->getConfigData('template') === Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_IFRAME;
|
app/code/community/Netresearch/OPS/Block/Placeform3dsecure.php
CHANGED
@@ -34,7 +34,7 @@ class Netresearch_OPS_Block_Placeform3dsecure extends Netresearch_OPS_Block_Plac
|
|
34 |
*/
|
35 |
public function getFormData()
|
36 |
{
|
37 |
-
if (
|
38 |
return base64_decode($this->_getOrder()->getPayment()->getAdditionalInformation('HTML_ANSWER'));
|
39 |
}
|
40 |
return null;
|
34 |
*/
|
35 |
public function getFormData()
|
36 |
{
|
37 |
+
if (null != $this->_getOrder()) {
|
38 |
return base64_decode($this->_getOrder()->getPayment()->getAdditionalInformation('HTML_ANSWER'));
|
39 |
}
|
40 |
return null;
|
app/code/community/Netresearch/OPS/Block/RetryPayment.php
CHANGED
@@ -20,16 +20,16 @@
|
|
20 |
*/
|
21 |
|
22 |
/**
|
23 |
-
*
|
24 |
*
|
25 |
* @category payment
|
26 |
* @package Netresearch_OPS
|
27 |
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
-
*/
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
protected $
|
33 |
|
34 |
protected function _getApi()
|
35 |
{
|
@@ -38,12 +38,66 @@ class Netresearch_OPS_Block_RetryPayment extends Netresearch_OPS_Block_Placeform
|
|
38 |
|
39 |
protected function _getOrder()
|
40 |
{
|
41 |
-
if(
|
42 |
-
$opsOrderId = $this->
|
43 |
-
$this->
|
44 |
}
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
*/
|
21 |
|
22 |
/**
|
23 |
+
* Netresearch_OPS_Block_RetryPayment
|
24 |
*
|
25 |
* @category payment
|
26 |
* @package Netresearch_OPS
|
27 |
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
+
*/
|
29 |
+
class Netresearch_OPS_Block_RetryPayment extends Netresearch_OPS_Block_Placeform
|
30 |
+
{
|
31 |
|
32 |
+
protected $_order = null;
|
33 |
|
34 |
protected function _getApi()
|
35 |
{
|
38 |
|
39 |
protected function _getOrder()
|
40 |
{
|
41 |
+
if (null === $this->_order) {
|
42 |
+
$opsOrderId = $this->getOrderId();
|
43 |
+
$this->_order = Mage::helper('ops/order')->getOrder($opsOrderId);
|
44 |
}
|
45 |
+
|
46 |
+
return $this->_order;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Getting placeform url
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function getFormAction()
|
55 |
+
{
|
56 |
+
$formAction = Mage::getUrl(
|
57 |
+
'*/*/updatePaymentAndPlaceForm',
|
58 |
+
array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
|
59 |
+
);
|
60 |
+
|
61 |
+
return $formAction;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Getting cancel url
|
66 |
+
*
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getCancelUrl()
|
70 |
+
{
|
71 |
+
$formAction = Mage::getUrl(
|
72 |
+
'*/*/cancel',
|
73 |
+
array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())
|
74 |
+
);
|
75 |
+
|
76 |
+
return $formAction;
|
77 |
}
|
78 |
|
79 |
+
public function getOrderId()
|
80 |
+
{
|
81 |
+
return $this->getRequest()->getParam('orderID');
|
82 |
+
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Returns the orders billing address
|
86 |
+
*
|
87 |
+
* @return Mage_Sales_Model_Order_Address
|
88 |
+
*/
|
89 |
+
public function getBillingAddress()
|
90 |
+
{
|
91 |
+
return $this->_getOrder()->getBillingAddress();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Returns the orders shipping address or false in case of a virtual order
|
96 |
+
*
|
97 |
+
* @return Mage_Sales_Model_Order_Address|false
|
98 |
+
*/
|
99 |
+
public function getShippingAddress()
|
100 |
+
{
|
101 |
+
return $this->_getOrder()->getShippingAddress();
|
102 |
+
}
|
103 |
+
}
|
app/code/community/Netresearch/OPS/Block/RetryPayment/Methods.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* DISCLAIMER
|
13 |
+
*
|
14 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
+
* newer versions in the future.
|
16 |
+
*
|
17 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
+
* @license Open Software License (OSL 3.0)
|
19 |
+
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Netresearch_OPS_Block_RetryPayment_Methods
|
24 |
+
*
|
25 |
+
* @category OPS
|
26 |
+
* @package Netresearch_OPS
|
27 |
+
* @author Benjamin Heuer <benjamin.heuer@netresearch.de>
|
28 |
+
*/
|
29 |
+
class Netresearch_OPS_Block_RetryPayment_Methods extends Mage_Checkout_Block_Onepage_Payment_Methods
|
30 |
+
{
|
31 |
+
protected $quote = null;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get Order ID from Url
|
35 |
+
*
|
36 |
+
* @return null
|
37 |
+
* @throws Exception
|
38 |
+
*/
|
39 |
+
public function getQuote()
|
40 |
+
{
|
41 |
+
if (null === $this->quote) {
|
42 |
+
$opsOrderId = $this->getRequest()->getParam('orderID');
|
43 |
+
$order = Mage::helper('ops/order')-> getOrder($opsOrderId);
|
44 |
+
$quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
|
45 |
+
|
46 |
+
if ($quote->getId()) {
|
47 |
+
$quote->setIsActive(1)
|
48 |
+
->save();
|
49 |
+
Mage::getSingleton('checkout/session')
|
50 |
+
->replaceQuote($quote);
|
51 |
+
}
|
52 |
+
|
53 |
+
$this->quote = $quote;
|
54 |
+
}
|
55 |
+
|
56 |
+
return $this->quote;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Retrieve available payment methods - filtered by OPS methods
|
61 |
+
*
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
public function getMethods()
|
65 |
+
{
|
66 |
+
$methods = $this->getData('methods');
|
67 |
+
if ($methods === null) {
|
68 |
+
$methods = parent::getMethods();
|
69 |
+
foreach ($methods as $key => $method) {
|
70 |
+
if (!$method instanceof Netresearch_OPS_Model_Payment_Abstract) {
|
71 |
+
$this->_assignMethod($method);
|
72 |
+
unset($methods[$key]);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
$this->setData('methods', $methods);
|
76 |
+
}
|
77 |
+
|
78 |
+
return $methods;
|
79 |
+
}
|
80 |
+
}
|
app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Brand.php
CHANGED
@@ -34,14 +34,18 @@ class Netresearch_OPS_Block_System_Config_Form_Field_Brand
|
|
34 |
{
|
35 |
public function __construct()
|
36 |
{
|
37 |
-
$this->addColumn(
|
|
|
38 |
'label' => Mage::helper('ops')->__('Brand'),
|
39 |
'style' => 'width:120px',
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
'label' => Mage::helper('ops')->__('Title'),
|
43 |
'style' => 'width:120px',
|
44 |
-
|
|
|
45 |
$this->_addAfter = false;
|
46 |
$this->_addButtonLabel = Mage::helper('ops')->__('Add Brand');
|
47 |
parent::__construct();
|
34 |
{
|
35 |
public function __construct()
|
36 |
{
|
37 |
+
$this->addColumn(
|
38 |
+
'brand', array(
|
39 |
'label' => Mage::helper('ops')->__('Brand'),
|
40 |
'style' => 'width:120px',
|
41 |
+
)
|
42 |
+
);
|
43 |
+
$this->addColumn(
|
44 |
+
'value', array(
|
45 |
'label' => Mage::helper('ops')->__('Title'),
|
46 |
'style' => 'width:120px',
|
47 |
+
)
|
48 |
+
);
|
49 |
$this->_addAfter = false;
|
50 |
$this->_addButtonLabel = Mage::helper('ops')->__('Add Brand');
|
51 |
parent::__construct();
|
app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Image.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Netresearch OPS
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
16 |
+
* newer versions in the future.
|
17 |
+
*
|
18 |
+
* @category Netresearch
|
19 |
+
* @package Netresearch_OPS
|
20 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Netresearch
|
26 |
+
*
|
27 |
+
* @category Netresearch
|
28 |
+
* @package Netresearch_OPS
|
29 |
+
* @author Benjamin Heuer <benjamin.heuer@netresearch.de>
|
30 |
+
*/
|
31 |
+
class Netresearch_OPS_Block_System_Config_Form_Field_Image
|
32 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field_Image
|
33 |
+
{
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Return element html code
|
37 |
+
*
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public function getElementHtml()
|
41 |
+
{
|
42 |
+
$html = '';
|
43 |
+
$url = $this->_getUrl();
|
44 |
+
|
45 |
+
if (!empty($url)) {
|
46 |
+
$value = $this->getData('value');
|
47 |
+
$html = '<a href="' . $url . '"'
|
48 |
+
. ' onclick="imagePreview(\'' . $this->getHtmlId() . '_image\'); return false;">'
|
49 |
+
. '<img src="' . $url . '" id="' . $this->getHtmlId() . '_image" title="' . $value . '"'
|
50 |
+
. ' alt="' . $value . '" height="22" width="22" class="small-image-preview v-middle" />'
|
51 |
+
. '</a> ';
|
52 |
+
}
|
53 |
+
$this->setData('class', 'input-file');
|
54 |
+
$html .= Varien_Data_Form_Element_Abstract::getElementHtml();
|
55 |
+
$html .= $this->_getDeleteCheckbox();
|
56 |
+
|
57 |
+
return $html;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get image preview url
|
62 |
+
*
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
protected function _getUrl()
|
66 |
+
{
|
67 |
+
$url = $this->getData('value');
|
68 |
+
$config = $this->getData('field_config');
|
69 |
+
|
70 |
+
if (!empty($url)) {
|
71 |
+
/* @var $config Varien_Simplexml_Element */
|
72 |
+
if (!empty($config->base_url)) {
|
73 |
+
$el = $config->descend('base_url');
|
74 |
+
$urlType = empty($el['type']) ? 'link' : (string)$el['type'];
|
75 |
+
$url = Mage::getBaseUrl($urlType) . (string)$config->base_url . '/' . $url;
|
76 |
+
}
|
77 |
+
} else {
|
78 |
+
preg_match("/groups\[([a-zA-Z_]*)/", $this->getData('name'), $imageName);
|
79 |
+
|
80 |
+
if (isset($imageName[1])) {
|
81 |
+
$url = Mage::helper('ops/payment')->getPaymentDefaultLogo($imageName[1]);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
return $url;
|
86 |
+
}
|
87 |
+
}
|
app/code/community/Netresearch/OPS/Block/System/Config/Form/Field/Method.php
CHANGED
@@ -31,20 +31,26 @@ class Netresearch_OPS_Block_System_Config_Form_Field_Method extends Mage_Adminht
|
|
31 |
{
|
32 |
public function __construct()
|
33 |
{
|
34 |
-
$this->addColumn(
|
|
|
35 |
'label' => Mage::helper('ops')->__('Title'),
|
36 |
'style' => 'width:80px',
|
37 |
'class' => 'required-entry'
|
38 |
-
|
39 |
-
|
|
|
|
|
40 |
'label' => 'PM',
|
41 |
'style' => 'width:80px',
|
42 |
'class' => 'required-entry'
|
43 |
-
|
44 |
-
|
|
|
|
|
45 |
'label' => 'BRAND',
|
46 |
'style' => 'width:80px',
|
47 |
-
|
|
|
48 |
|
49 |
$this->_addAfter = false;
|
50 |
$this->_addButtonLabel = Mage::helper('ops')->__('Add Method');
|
31 |
{
|
32 |
public function __construct()
|
33 |
{
|
34 |
+
$this->addColumn(
|
35 |
+
'title', array(
|
36 |
'label' => Mage::helper('ops')->__('Title'),
|
37 |
'style' => 'width:80px',
|
38 |
'class' => 'required-entry'
|
39 |
+
)
|
40 |
+
);
|
41 |
+
$this->addColumn(
|
42 |
+
'pm', array(
|
43 |
'label' => 'PM',
|
44 |
'style' => 'width:80px',
|
45 |
'class' => 'required-entry'
|
46 |
+
)
|
47 |
+
);
|
48 |
+
$this->addColumn(
|
49 |
+
'brand', array(
|
50 |
'label' => 'BRAND',
|
51 |
'style' => 'width:80px',
|
52 |
+
)
|
53 |
+
);
|
54 |
|
55 |
$this->_addAfter = false;
|
56 |
$this->_addButtonLabel = Mage::helper('ops')->__('Add Method');
|
app/code/community/Netresearch/OPS/Block/System/Config/Mode.php
CHANGED
@@ -1,31 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Mode.php
|
4 |
-
* @author paul.siedler@netresearch.de
|
5 |
-
* @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
|
6 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
7 |
-
*/
|
8 |
-
|
9 |
-
class Netresearch_OPS_Block_System_Config_Mode extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mode.php
|
4 |
+
* @author paul.siedler@netresearch.de
|
5 |
+
* @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Netresearch_OPS_Block_System_Config_Mode extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$html = parent::_getElementHtml($element);
|
15 |
+
|
16 |
+
$javascript = "
|
17 |
+
<script type=\"text/javascript\">
|
18 |
+
element = $('".$element->getHtmlId()."');
|
19 |
+
Event.observe(element, 'change', function(){
|
20 |
+
if(element.selectedOptions[0].value != '".$element->getValue()."'){
|
21 |
+
$('ops_mode_comment').style.display = 'block';
|
22 |
+
} else {
|
23 |
+
$('ops_mode_comment').style.display = 'none';
|
24 |
+
}
|
25 |
+
});
|
26 |
+
</script>";
|
27 |
+
|
28 |
+
return $html.$javascript;
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
}
|
app/code/community/Netresearch/OPS/Block/System/Config/PaymentForm.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Netresearch OPS
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
16 |
+
* newer versions in the future.
|
17 |
+
*
|
18 |
+
* @category Netresearch
|
19 |
+
* @package Netresearch_OPS
|
20 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Netresearch
|
26 |
+
*
|
27 |
+
* @category Netresearch
|
28 |
+
* @package Netresearch_OPS
|
29 |
+
* @author Benjamin Heuer <benjamin.heuer@netresearch.de>
|
30 |
+
*/
|
31 |
+
class Netresearch_Ops_Block_System_Config_PaymentForm
|
32 |
+
extends Mage_Adminhtml_Block_System_Config_Form
|
33 |
+
{
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Add Payment Logo Image Renderer to renderer types
|
37 |
+
*
|
38 |
+
* @return array
|
39 |
+
*/
|
40 |
+
protected function _getAdditionalElementTypes()
|
41 |
+
{
|
42 |
+
$elementTypes = parent::_getAdditionalElementTypes();
|
43 |
+
$elementTypes['paymentLogo'] = Mage::getConfig()->getBlockClassName('ops/system_config_form_field_image');
|
44 |
+
|
45 |
+
return $elementTypes;
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Netresearch/OPS/Block/System/Config/Support.php
CHANGED
@@ -20,9 +20,11 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
|
|
20 |
public function render(Varien_Data_Form_Element_Abstract $fieldset)
|
21 |
{
|
22 |
$originalData = $fieldset->getOriginalData();
|
23 |
-
$this->addData(
|
|
|
24 |
'fieldset_label' => $fieldset->getLegend(),
|
25 |
-
|
|
|
26 |
return $this->toHtml();
|
27 |
}
|
28 |
|
@@ -58,7 +60,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
|
|
58 |
public function getSupportMail()
|
59 |
{
|
60 |
$mail = $this->getConfig()->getConfigData('support_mail');
|
61 |
-
if (
|
62 |
return $mail;
|
63 |
}
|
64 |
}
|
@@ -81,7 +83,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
|
|
81 |
public function getDocLinkDe()
|
82 |
{
|
83 |
$link = $this->getConfig()->getConfigData('doc_link_de');
|
84 |
-
if (
|
85 |
return $link;
|
86 |
}
|
87 |
}
|
@@ -94,7 +96,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
|
|
94 |
public function getDocLinkEn()
|
95 |
{
|
96 |
$link = $this->getConfig()->getConfigData('doc_link_en');
|
97 |
-
if (
|
98 |
return $link;
|
99 |
}
|
100 |
}
|
@@ -116,7 +118,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
|
|
116 |
public function getFaqLinkDe()
|
117 |
{
|
118 |
$link = $this->getConfig()->getConfigData('faq_link_de');
|
119 |
-
if (
|
120 |
return $link;
|
121 |
}
|
122 |
|
@@ -130,7 +132,7 @@ class Netresearch_OPS_Block_System_Config_Support extends Mage_Adminhtml_Block_A
|
|
130 |
public function getFaqLinkEn()
|
131 |
{
|
132 |
$link = $this->getConfig()->getConfigData('faq_link_en');
|
133 |
-
if (
|
134 |
return $link;
|
135 |
}
|
136 |
}
|
20 |
public function render(Varien_Data_Form_Element_Abstract $fieldset)
|
21 |
{
|
22 |
$originalData = $fieldset->getOriginalData();
|
23 |
+
$this->addData(
|
24 |
+
array(
|
25 |
'fieldset_label' => $fieldset->getLegend(),
|
26 |
+
)
|
27 |
+
);
|
28 |
return $this->toHtml();
|
29 |
}
|
30 |
|
60 |
public function getSupportMail()
|
61 |
{
|
62 |
$mail = $this->getConfig()->getConfigData('support_mail');
|
63 |
+
if (false !== strpos($mail, '@')) {
|
64 |
return $mail;
|
65 |
}
|
66 |
}
|
83 |
public function getDocLinkDe()
|
84 |
{
|
85 |
$link = $this->getConfig()->getConfigData('doc_link_de');
|
86 |
+
if (false !== strpos($link, '://')) {
|
87 |
return $link;
|
88 |
}
|
89 |
}
|
96 |
public function getDocLinkEn()
|
97 |
{
|
98 |
$link = $this->getConfig()->getConfigData('doc_link_en');
|
99 |
+
if (false !== strpos($link, '://')) {
|
100 |
return $link;
|
101 |
}
|
102 |
}
|
118 |
public function getFaqLinkDe()
|
119 |
{
|
120 |
$link = $this->getConfig()->getConfigData('faq_link_de');
|
121 |
+
if (false !== strpos($link, '://')) {
|
122 |
return $link;
|
123 |
}
|
124 |
|
132 |
public function getFaqLinkEn()
|
133 |
{
|
134 |
$link = $this->getConfig()->getConfigData('faq_link_en');
|
135 |
+
if (false !== strpos($link, '://')) {
|
136 |
return $link;
|
137 |
}
|
138 |
}
|
app/code/community/Netresearch/OPS/Controller/Abstract.php
CHANGED
@@ -39,17 +39,20 @@ class Netresearch_OPS_Controller_Abstract extends Mage_Core_Controller_Front_Act
|
|
39 |
/**
|
40 |
* Return order instance loaded by increment id'
|
41 |
*
|
|
|
|
|
42 |
* @return Mage_Sales_Model_Order
|
43 |
*/
|
44 |
|
45 |
protected function _getOrder($opsOrderId = null)
|
46 |
{
|
47 |
if (empty($this->_order)) {
|
48 |
-
if (
|
49 |
$opsOrderId = $this->getRequest()->getParam('orderID');
|
50 |
}
|
51 |
$this->_order = Mage::helper('ops/order')->getOrder($opsOrderId);
|
52 |
}
|
|
|
53 |
return $this->_order;
|
54 |
}
|
55 |
|
@@ -60,11 +63,12 @@ class Netresearch_OPS_Controller_Abstract extends Mage_Core_Controller_Front_Act
|
|
60 |
*/
|
61 |
protected function _getApi()
|
62 |
{
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -95,12 +99,17 @@ class Netresearch_OPS_Controller_Abstract extends Mage_Core_Controller_Front_Act
|
|
95 |
/**
|
96 |
* Validation of incoming OPS data
|
97 |
*
|
|
|
|
|
|
|
98 |
* @return bool
|
99 |
*/
|
100 |
-
protected function _validateOPSData()
|
101 |
{
|
102 |
$helper = Mage::helper('ops');
|
103 |
-
|
|
|
|
|
104 |
if ($this->getSubscriptionHelper()->isSubscriptionFeedback($params)) {
|
105 |
$profile = $this->getSubscriptionHelper()->getProfileForSubscription($params['orderID']);
|
106 |
if (!$profile->getId()) {
|
39 |
/**
|
40 |
* Return order instance loaded by increment id'
|
41 |
*
|
42 |
+
* @param $opsOrderId
|
43 |
+
*
|
44 |
* @return Mage_Sales_Model_Order
|
45 |
*/
|
46 |
|
47 |
protected function _getOrder($opsOrderId = null)
|
48 |
{
|
49 |
if (empty($this->_order)) {
|
50 |
+
if (null === $opsOrderId) {
|
51 |
$opsOrderId = $this->getRequest()->getParam('orderID');
|
52 |
}
|
53 |
$this->_order = Mage::helper('ops/order')->getOrder($opsOrderId);
|
54 |
}
|
55 |
+
|
56 |
return $this->_order;
|
57 |
}
|
58 |
|
63 |
*/
|
64 |
protected function _getApi()
|
65 |
{
|
66 |
+
$api = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance();
|
67 |
+
if (null != $this->getRequest()->getParam('orderID')) {
|
68 |
+
$api = $this->_getOrder()->getPayment()->getMethodInstance();
|
69 |
+
}
|
70 |
+
|
71 |
+
return $api;
|
72 |
}
|
73 |
|
74 |
/**
|
99 |
/**
|
100 |
* Validation of incoming OPS data
|
101 |
*
|
102 |
+
* @param mixed[]|bool $paramOverwrite array of parameters with SHASIGN to validate instead of standard request
|
103 |
+
* parameters
|
104 |
+
*
|
105 |
* @return bool
|
106 |
*/
|
107 |
+
protected function _validateOPSData($paramOverwrite = false)
|
108 |
{
|
109 |
$helper = Mage::helper('ops');
|
110 |
+
|
111 |
+
$params = $paramOverwrite ? : $this->getRequest()->getParams();
|
112 |
+
|
113 |
if ($this->getSubscriptionHelper()->isSubscriptionFeedback($params)) {
|
114 |
$profile = $this->getSubscriptionHelper()->getProfileForSubscription($params['orderID']);
|
115 |
if (!$profile->getId()) {
|
app/code/community/Netresearch/OPS/Helper/Address.php
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS_Helper_Address
|
4 |
+
*
|
5 |
+
* @package
|
6 |
+
* @copyright 2016 Netresearch
|
7 |
+
* @author Sebastian Ertner <sebastian.ertner@netresearch.de>
|
8 |
+
* @license OSL 3.0
|
9 |
+
*/
|
10 |
+
class Netresearch_OPS_Helper_Address extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
const OPTION_A_ADDITION_1 = 'A_Addition_to_address_1';
|
14 |
+
const OPTION_A_STREET_NAME = 'A_Street_name_1';
|
15 |
+
const OPTION_A_HOUSE_NUMBER = 'A_House_number_1';
|
16 |
+
const OPTION_A_ADDITION_2 = 'A_Addition_to_address_2';
|
17 |
+
const OPTION_B_ADDITION_1 = 'B_Addition_to_address_1';
|
18 |
+
const OPTION_B_STREET_NAME = 'B_Street_name';
|
19 |
+
const OPTION_B_HOUSE_NUMBER = 'B_House_number';
|
20 |
+
const OPTION_B_ADDITION_2 = 'B_Addition_to_address_2';
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* split street into street name, number and additional street information
|
25 |
+
*
|
26 |
+
* @param string $street
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function splitStreet($street)
|
31 |
+
{
|
32 |
+
$result = array(
|
33 |
+
'street_name' => $street,
|
34 |
+
'street_number' => '',
|
35 |
+
'supplement' => ''
|
36 |
+
);
|
37 |
+
|
38 |
+
if (preg_match($this->getStreetSplitter(), $street, $matches)) {
|
39 |
+
|
40 |
+
// Pattern A
|
41 |
+
if (isset($matches[self::OPTION_A_STREET_NAME]) && !empty($matches[self::OPTION_A_STREET_NAME])) {
|
42 |
+
|
43 |
+
$result['street_name'] = trim($matches[self::OPTION_A_STREET_NAME]);
|
44 |
+
|
45 |
+
if (isset($matches[self::OPTION_A_HOUSE_NUMBER]) && !empty($matches[self::OPTION_A_HOUSE_NUMBER])) {
|
46 |
+
$result['street_number'] = trim($matches[self::OPTION_A_HOUSE_NUMBER]);
|
47 |
+
}
|
48 |
+
|
49 |
+
if (isset($matches[self::OPTION_A_ADDITION_1]) && isset($matches[self::OPTION_A_ADDITION_2])) {
|
50 |
+
$result['supplement'] = trim($matches[self::OPTION_A_ADDITION_1] . ' '
|
51 |
+
. $matches[self::OPTION_A_ADDITION_2]
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
return $result ;
|
56 |
+
|
57 |
+
// Pattern B
|
58 |
+
} elseif (isset($matches[self::OPTION_B_STREET_NAME]) && !empty($matches[self::OPTION_B_STREET_NAME])) {
|
59 |
+
|
60 |
+
$result['street_name'] = trim($matches[self::OPTION_B_STREET_NAME]);
|
61 |
+
|
62 |
+
if (isset($matches[self::OPTION_B_HOUSE_NUMBER]) && !empty($matches[self::OPTION_B_HOUSE_NUMBER])) {
|
63 |
+
$result['street_number'] = trim($matches[self::OPTION_B_HOUSE_NUMBER]);
|
64 |
+
}
|
65 |
+
|
66 |
+
if (isset($matches[self::OPTION_B_ADDITION_1]) && isset($matches[self::OPTION_B_ADDITION_2])) {
|
67 |
+
$result['supplement'] = trim($matches[self::OPTION_B_ADDITION_1] . ' '
|
68 |
+
. $matches[self::OPTION_B_ADDITION_2]
|
69 |
+
);
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
return $result;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
return $result;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Regex to analyze addresses and split them into the groups Street Name, House Number and Additional Information
|
82 |
+
* Pattern A is addition number street addition
|
83 |
+
* Pattern B is addition street number addition
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
protected function getStreetSplitter()
|
88 |
+
{
|
89 |
+
return "/\\A\\s*
|
90 |
+
(?:
|
91 |
+
#########################################################################
|
92 |
+
# Option A: [<Addition to address 1>] <House number> <Street name> #
|
93 |
+
# [<Addition to address 2>] #
|
94 |
+
#########################################################################
|
95 |
+
(?:
|
96 |
+
(?P<A_Addition_to_address_1>.*?)
|
97 |
+
,\\s*
|
98 |
+
)?
|
99 |
+
# Addition to address 1
|
100 |
+
(?:No\\.\\s*)?
|
101 |
+
(?P<A_House_number_1>
|
102 |
+
\\pN+[a-zA-Z]?
|
103 |
+
(?:\\s*[-\\/\\pP]\\s*\\pN+[a-zA-Z]?)*
|
104 |
+
)
|
105 |
+
# House number
|
106 |
+
\\s*,?\\s*
|
107 |
+
(?P<A_Street_name_1>
|
108 |
+
(?:[a-zA-Z]\\s*|\\pN\\pL{2,}\\s\\pL)
|
109 |
+
\\S[^,#]*?
|
110 |
+
(?<!\\s)
|
111 |
+
)
|
112 |
+
# Street name
|
113 |
+
\\s*
|
114 |
+
(?:
|
115 |
+
(?:
|
116 |
+
[,\\/]|
|
117 |
+
(?=\\#)
|
118 |
+
)
|
119 |
+
\\s*
|
120 |
+
(?!\\s*No\\.)
|
121 |
+
(?P<A_Addition_to_address_2>
|
122 |
+
(?!\\s)
|
123 |
+
.*?
|
124 |
+
)
|
125 |
+
)?
|
126 |
+
# Addition to address 2
|
127 |
+
|
|
128 |
+
#########################################################################
|
129 |
+
# Option B: [<Addition to address 1>] <Street name> <House number> #
|
130 |
+
# [<Addition to address 2>] #
|
131 |
+
#########################################################################
|
132 |
+
(?:
|
133 |
+
(?P<B_Addition_to_address_1>.*?)
|
134 |
+
,\\s*
|
135 |
+
(?=.*[,\\/])
|
136 |
+
)?
|
137 |
+
# Addition to address 1
|
138 |
+
(?!\\s*No\\.)
|
139 |
+
(?P<B_Street_name>
|
140 |
+
\\S\\s*\\S
|
141 |
+
(?:
|
142 |
+
[^,#]
|
143 |
+
(?!\\b\\pN+\\s)
|
144 |
+
)*?
|
145 |
+
(?<!\\s)
|
146 |
+
)
|
147 |
+
# Street name
|
148 |
+
\\s*[\\/,]?\\s*
|
149 |
+
(?:\\sNo\\.)?
|
150 |
+
\\s+
|
151 |
+
(?P<B_House_number>
|
152 |
+
\\pN+\\s*-?[a-zA-Z]?
|
153 |
+
(?:
|
154 |
+
\\s*[-\\/\\pP]?\\s*\\pN+
|
155 |
+
(?:\\s*[\\-a-zA-Z])?
|
156 |
+
)*|
|
157 |
+
[IVXLCDM]+
|
158 |
+
(?!.*\\b\\pN+\\b)
|
159 |
+
)
|
160 |
+
(?<!\\s)
|
161 |
+
# House number
|
162 |
+
\\s*
|
163 |
+
(?:
|
164 |
+
(?:
|
165 |
+
[,\\/]|
|
166 |
+
(?=\\#)|
|
167 |
+
\\s
|
168 |
+
)
|
169 |
+
\\s*
|
170 |
+
(?!\\s*No\\.)
|
171 |
+
\\s*
|
172 |
+
(?P<B_Addition_to_address_2>
|
173 |
+
(?!\\s)
|
174 |
+
.*?
|
175 |
+
)
|
176 |
+
)?
|
177 |
+
# Addition to address 2
|
178 |
+
)
|
179 |
+
\\s*\\Z/x";
|
180 |
+
}
|
181 |
+
}
|
app/code/community/Netresearch/OPS/Helper/Alias.php
CHANGED
@@ -64,73 +64,43 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
64 |
return $payment;
|
65 |
}
|
66 |
|
67 |
-
/**
|
68 |
-
* get alias or generate a new one
|
69 |
-
*
|
70 |
-
* alias has length 16 and consists of quote creation date, a separator,
|
71 |
-
* and the quote id to make sure we have the full quote id we shorten
|
72 |
-
* the creation date accordingly
|
73 |
-
*
|
74 |
-
* @param Mage_Sales_Model_Quote $quote
|
75 |
-
*
|
76 |
-
* @return string
|
77 |
-
*/
|
78 |
-
public function getAlias($quote, $forceNew = false)
|
79 |
-
{
|
80 |
-
|
81 |
-
$alias = $quote->getPayment()->getAdditionalInformation('alias');
|
82 |
-
if (0 == strlen($alias) || $forceNew) {
|
83 |
-
/* turn createdAt into format MMDDHHii */
|
84 |
-
$createdAt = time();
|
85 |
-
$quoteId = $quote->getId();
|
86 |
-
/* shorten createdAt, if we would exceed maximum length */
|
87 |
-
$maxAliasLength = 16;
|
88 |
-
$separator = '99';
|
89 |
-
$maxCreatedAtLength
|
90 |
-
= $maxAliasLength - strlen($quoteId) - strlen($separator);
|
91 |
-
$alias = substr($createdAt, 0, $maxCreatedAtLength) . $separator
|
92 |
-
. $quoteId;
|
93 |
-
}
|
94 |
-
|
95 |
-
if ($this->isAdminSession() && !strpos($alias,'BE')) {
|
96 |
-
$alias = $alias.'BE';
|
97 |
-
}
|
98 |
-
return $alias;
|
99 |
-
}
|
100 |
-
|
101 |
/**
|
102 |
* saves the alias if customer is logged in (and want to create an alias)
|
103 |
*
|
104 |
-
* @param $
|
105 |
-
* @param Mage_Sales_Model_Quote $quote
|
106 |
*
|
107 |
* @return Netresearch_OPS_Model_Alias | null
|
108 |
*/
|
109 |
-
public function saveAlias($
|
110 |
{
|
111 |
$quote = null;
|
112 |
$aliasModel = null;
|
113 |
-
Mage::helper('ops')->log('aliasData ' . Zend_Json::encode(Mage::helper('ops/data')->clearMsg($
|
114 |
-
if (array_key_exists('Alias_OrderId', $
|
115 |
-
$quote = Mage::getModel('sales/quote')->load($
|
116 |
}
|
117 |
|
118 |
if ($quote instanceof Mage_Sales_Model_Quote
|
119 |
&& $quote->getPayment()
|
120 |
&& Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()
|
121 |
!= Mage_Checkout_Model_Type_Onepage::METHOD_GUEST
|
122 |
-
&& (array_key_exists('Alias_StorePermanently'
|
123 |
) {
|
124 |
|
125 |
// alias does not exist -> create a new one if requested
|
126 |
-
if (
|
127 |
// create new alias
|
128 |
-
$aliasModel = $this->
|
129 |
$quote->getPayment()->setAdditionalInformation(
|
130 |
'opsAliasId', $aliasModel->getId()
|
131 |
);
|
132 |
$quote->getPayment()->save();
|
133 |
}
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
|
136 |
return $aliasModel;
|
@@ -164,7 +134,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
164 |
}
|
165 |
}
|
166 |
|
167 |
-
protected function
|
168 |
{
|
169 |
$customerId = $quote->getCustomer()->getId();
|
170 |
$billingAddressHash = $this->generateAddressHash(
|
@@ -174,23 +144,67 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
174 |
$quote->getShippingAddress()
|
175 |
);
|
176 |
|
177 |
-
|
178 |
-
$
|
179 |
-
$
|
180 |
-
$
|
181 |
-
$
|
182 |
-
$
|
183 |
-
$
|
184 |
-
$
|
185 |
-
$
|
186 |
-
$
|
187 |
-
$
|
188 |
-
|
189 |
-
|
|
|
|
|
190 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
Mage::helper('ops')->log(
|
192 |
'saving alias' . Zend_Json::encode($aliasModel->getData())
|
193 |
);
|
|
|
|
|
194 |
$aliasModel->save();
|
195 |
|
196 |
return $aliasModel;
|
@@ -199,14 +213,11 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
199 |
/**
|
200 |
* generates hash from address data
|
201 |
*
|
202 |
-
* @param
|
203 |
*
|
204 |
* @returns string hash of address
|
205 |
*/
|
206 |
-
public function generateAddressHash(
|
207 |
-
Mage_Customer_Model_Address_Abstract $address
|
208 |
-
)
|
209 |
-
{
|
210 |
/** @var Netresearch_OPS_Helper_Payment $opsHelper */
|
211 |
$opsHelper = Mage::helper('ops/payment');
|
212 |
$addressString = $address->getFirstname();
|
@@ -241,7 +252,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
241 |
$billingAddressHash = null;
|
242 |
$shippingAddressHash = null;
|
243 |
$storeId = null;
|
244 |
-
if (
|
245 |
$billingAddressHash = $this->generateAddressHash(
|
246 |
$quote->getBillingAddress()
|
247 |
);
|
@@ -253,7 +264,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
253 |
return Mage::getModel('ops/alias')
|
254 |
->getAliasesForCustomer(
|
255 |
$customerId, $billingAddressHash, $shippingAddressHash, $storeId
|
256 |
-
|
257 |
}
|
258 |
|
259 |
/**
|
@@ -263,6 +274,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
263 |
* @param string $alias
|
264 |
* @param Mage_Sales_Model_Quote_Address $billingAddress
|
265 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress
|
|
|
266 |
*
|
267 |
* @return boolean
|
268 |
*/
|
@@ -271,11 +283,11 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
271 |
)
|
272 |
{
|
273 |
$aliasCollection = $this->getAliasesForAddresses(
|
274 |
-
|
275 |
-
|
276 |
->addFieldToFilter('alias', $alias)
|
277 |
->setPageSize(1);
|
278 |
-
return (1 == $aliasCollection->
|
279 |
}
|
280 |
|
281 |
/**
|
@@ -284,6 +296,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
284 |
* @param int $customerId Id of customer
|
285 |
* @param Mage_Sales_Model_Quote_Address $billingAddress billing address
|
286 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress shipping address
|
|
|
287 |
*
|
288 |
* @return Netresearch_OPS_Model_Mysql4_Alias_Collection
|
289 |
*/
|
@@ -334,7 +347,12 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
334 |
* @param boolean $userIsRegistering - is registering method in checkout
|
335 |
* @param boolean $paymentSave - is it necessary to save the payment afterwards
|
336 |
*/
|
337 |
-
public function setAliasToPayment(
|
|
|
|
|
|
|
|
|
|
|
338 |
{
|
339 |
if (array_key_exists('alias_aliasid', $aliasData) && 0 < strlen(trim($aliasData['alias_aliasid']))) {
|
340 |
$payment->setAdditionalInformation('alias', trim($aliasData['alias_aliasid']));
|
@@ -351,7 +369,7 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
351 |
}
|
352 |
|
353 |
$payment->setDataChanges(true);
|
354 |
-
if($paymentSave === true){
|
355 |
$payment->save();
|
356 |
}
|
357 |
} else {
|
@@ -373,7 +391,8 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
373 |
->addFieldToFilter('store_id', array(array('eq' => $quote->getStoreId()), array('null' => true)))
|
374 |
->getFirstItem();
|
375 |
// and if so update this alias with alias data from alias gateway
|
376 |
-
if (is_numeric($oldAlias->getId()) &&
|
|
|
377 |
) {
|
378 |
$oldAlias->setCardHolder($aliasData['Card_CardHolderName']);
|
379 |
$oldAlias->save();
|
@@ -382,27 +401,31 @@ class Netresearch_OPS_Helper_Alias extends Mage_Core_Helper_Abstract
|
|
382 |
|
383 |
/**
|
384 |
* set the last pending alias to active and remove other aliases for customer based on address
|
385 |
-
*
|
|
|
386 |
* @param Mage_Sales_Model_Quote $quote
|
|
|
|
|
387 |
*/
|
388 |
public function setAliasActive(
|
389 |
Mage_Sales_Model_Quote $quote,
|
390 |
Mage_Sales_Model_Order $order = null,
|
391 |
$saveSalesObjects = false
|
392 |
-
)
|
393 |
-
|
|
|
394 |
|| false == $quote->getPayment()->getAdditionalInformation('userIsRegistering')
|
395 |
) {
|
396 |
$aliasesToDelete = Mage::helper('ops/alias')->getAliasesForAddresses(
|
397 |
-
|
398 |
-
|
399 |
->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE);
|
400 |
$lastPendingAlias = Mage::helper('ops/alias')->getAliasesForAddresses(
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
->addFieldToFilter('alias', $quote->getPayment()->getAdditionalInformation('alias'))
|
407 |
->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::PENDING)
|
408 |
->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC)
|
64 |
return $payment;
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
/**
|
68 |
* saves the alias if customer is logged in (and want to create an alias)
|
69 |
*
|
70 |
+
* @param $params
|
|
|
71 |
*
|
72 |
* @return Netresearch_OPS_Model_Alias | null
|
73 |
*/
|
74 |
+
public function saveAlias($params)
|
75 |
{
|
76 |
$quote = null;
|
77 |
$aliasModel = null;
|
78 |
+
Mage::helper('ops')->log('aliasData ' . Zend_Json::encode(Mage::helper('ops/data')->clearMsg($params)));
|
79 |
+
if (array_key_exists('Alias_OrderId', $params) && is_numeric($params['Alias_OrderId'])) {
|
80 |
+
$quote = Mage::getModel('sales/quote')->load($params['Alias_OrderId']);
|
81 |
}
|
82 |
|
83 |
if ($quote instanceof Mage_Sales_Model_Quote
|
84 |
&& $quote->getPayment()
|
85 |
&& Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()
|
86 |
!= Mage_Checkout_Model_Type_Onepage::METHOD_GUEST
|
87 |
+
&& (array_key_exists('Alias_StorePermanently', $params) && 'Y' == $params['Alias_StorePermanently'])
|
88 |
) {
|
89 |
|
90 |
// alias does not exist -> create a new one if requested
|
91 |
+
if (null != $quote && $quote->getPayment()) {
|
92 |
// create new alias
|
93 |
+
$aliasModel = $this->saveNewAliasFromQuote($quote, $params);
|
94 |
$quote->getPayment()->setAdditionalInformation(
|
95 |
'opsAliasId', $aliasModel->getId()
|
96 |
);
|
97 |
$quote->getPayment()->save();
|
98 |
}
|
99 |
+
} elseif (array_key_exists('orderid', $params)) {
|
100 |
+
/** @var Mage_Sales_Model_Order $order */
|
101 |
+
$order = Mage::helper('ops/order')->getOrder($params['orderid']);
|
102 |
+
$aliasModel = $this->saveNewAliasFromOrder($order, $params);
|
103 |
+
$order->getPayment()->setAdditionalInformation('opsAliasId', $aliasModel->getId());
|
104 |
}
|
105 |
|
106 |
return $aliasModel;
|
134 |
}
|
135 |
}
|
136 |
|
137 |
+
protected function saveNewAliasFromQuote(Mage_Sales_Model_Quote $quote, $params)
|
138 |
{
|
139 |
$customerId = $quote->getCustomer()->getId();
|
140 |
$billingAddressHash = $this->generateAddressHash(
|
144 |
$quote->getShippingAddress()
|
145 |
);
|
146 |
|
147 |
+
|
148 |
+
$aliasData = array();
|
149 |
+
$aliasData['customer_id'] = $customerId;
|
150 |
+
$aliasData['alias'] = $params['Alias_AliasId'];
|
151 |
+
$aliasData['expiration_date'] = $params['Card_ExpiryDate'];
|
152 |
+
$aliasData['billing_address_hash'] = $billingAddressHash;
|
153 |
+
$aliasData['shipping_address_hash'] = $shippingAddressHash;
|
154 |
+
$aliasData['brand'] = $params['Card_Brand'];
|
155 |
+
$aliasData['payment_method'] = $quote->getPayment()->getMethod();
|
156 |
+
$aliasData['pseudo_account_or_cc_no'] = $params['Card_CardNumber'];
|
157 |
+
$aliasData['state'] = Netresearch_OPS_Model_Alias_State::PENDING;
|
158 |
+
$aliasData['store_id'] = $quote->getStoreId();
|
159 |
+
|
160 |
+
if (array_key_exists('Card_CardHolderName', $params)) {
|
161 |
+
$aliasData['card_holder'] = $params['Card_CardHolderName'];
|
162 |
}
|
163 |
+
|
164 |
+
$aliasModel = $this->persistAlias($aliasData);
|
165 |
+
|
166 |
+
return $aliasModel;
|
167 |
+
}
|
168 |
+
|
169 |
+
public function saveNewAliasFromOrder(Mage_Sales_Model_Order $order, $params)
|
170 |
+
{
|
171 |
+
$customerId = $order->getCustomerId();
|
172 |
+
$billingAddressHash = $this->generateAddressHash(
|
173 |
+
$order->getBillingAddress()
|
174 |
+
);
|
175 |
+
$shippingAddressHash = $this->generateAddressHash(
|
176 |
+
$order->getShippingAddress()
|
177 |
+
);
|
178 |
+
|
179 |
+
$aliasData = array();
|
180 |
+
$aliasData['customer_id'] = $customerId;
|
181 |
+
$aliasData['alias'] = $params['alias'];
|
182 |
+
$aliasData['expiration_date'] = $params['ed'];
|
183 |
+
$aliasData['billing_address_hash'] = $billingAddressHash;
|
184 |
+
$aliasData['shipping_address_hash'] = $shippingAddressHash;
|
185 |
+
$aliasData['brand'] = $params['brand'];
|
186 |
+
$aliasData['payment_method'] = $order->getPayment()->getMethod();
|
187 |
+
$aliasData['pseudo_account_or_cc_no'] = $params['cardno'];
|
188 |
+
$aliasData['state'] = Netresearch_OPS_Model_Alias_State::ACTIVE;
|
189 |
+
$aliasData['store_id'] = $order->getStoreId();
|
190 |
+
$aliasData['card_holder'] = $params['cn'];
|
191 |
+
|
192 |
+
$aliasModel = $this->persistAlias($aliasData);
|
193 |
+
|
194 |
+
return $aliasModel;
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
public function persistAlias(array $aliasParams)
|
199 |
+
{
|
200 |
+
/** @var Netresearch_OPS_Model_Alias $aliasModel */
|
201 |
+
$aliasModel = Mage::getModel('ops/alias')->load($aliasParams['alias'], 'alias');
|
202 |
+
|
203 |
Mage::helper('ops')->log(
|
204 |
'saving alias' . Zend_Json::encode($aliasModel->getData())
|
205 |
);
|
206 |
+
|
207 |
+
$aliasModel->addData($aliasParams);
|
208 |
$aliasModel->save();
|
209 |
|
210 |
return $aliasModel;
|
213 |
/**
|
214 |
* generates hash from address data
|
215 |
*
|
216 |
+
* @param Mage_Customer_Model_Address_Abstract $address the address data to hash
|
217 |
*
|
218 |
* @returns string hash of address
|
219 |
*/
|
220 |
+
public function generateAddressHash(Mage_Customer_Model_Address_Abstract $address) {
|
|
|
|
|
|
|
221 |
/** @var Netresearch_OPS_Helper_Payment $opsHelper */
|
222 |
$opsHelper = Mage::helper('ops/payment');
|
223 |
$addressString = $address->getFirstname();
|
252 |
$billingAddressHash = null;
|
253 |
$shippingAddressHash = null;
|
254 |
$storeId = null;
|
255 |
+
if (null !=($quote)) {
|
256 |
$billingAddressHash = $this->generateAddressHash(
|
257 |
$quote->getBillingAddress()
|
258 |
);
|
264 |
return Mage::getModel('ops/alias')
|
265 |
->getAliasesForCustomer(
|
266 |
$customerId, $billingAddressHash, $shippingAddressHash, $storeId
|
267 |
+
);
|
268 |
}
|
269 |
|
270 |
/**
|
274 |
* @param string $alias
|
275 |
* @param Mage_Sales_Model_Quote_Address $billingAddress
|
276 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress
|
277 |
+
* @param int $storeId
|
278 |
*
|
279 |
* @return boolean
|
280 |
*/
|
283 |
)
|
284 |
{
|
285 |
$aliasCollection = $this->getAliasesForAddresses(
|
286 |
+
$customerId, $billingAddress, $shippingAddress, $storeId
|
287 |
+
)
|
288 |
->addFieldToFilter('alias', $alias)
|
289 |
->setPageSize(1);
|
290 |
+
return (1 == $aliasCollection->getSize());
|
291 |
}
|
292 |
|
293 |
/**
|
296 |
* @param int $customerId Id of customer
|
297 |
* @param Mage_Sales_Model_Quote_Address $billingAddress billing address
|
298 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress shipping address
|
299 |
+
* @param int $storeId
|
300 |
*
|
301 |
* @return Netresearch_OPS_Model_Mysql4_Alias_Collection
|
302 |
*/
|
347 |
* @param boolean $userIsRegistering - is registering method in checkout
|
348 |
* @param boolean $paymentSave - is it necessary to save the payment afterwards
|
349 |
*/
|
350 |
+
public function setAliasToPayment(
|
351 |
+
Mage_Payment_Model_Info $payment,
|
352 |
+
array $aliasData,
|
353 |
+
$userIsRegistering = false,
|
354 |
+
$paymentSave = false
|
355 |
+
)
|
356 |
{
|
357 |
if (array_key_exists('alias_aliasid', $aliasData) && 0 < strlen(trim($aliasData['alias_aliasid']))) {
|
358 |
$payment->setAdditionalInformation('alias', trim($aliasData['alias_aliasid']));
|
369 |
}
|
370 |
|
371 |
$payment->setDataChanges(true);
|
372 |
+
if ($paymentSave === true) {
|
373 |
$payment->save();
|
374 |
}
|
375 |
} else {
|
391 |
->addFieldToFilter('store_id', array(array('eq' => $quote->getStoreId()), array('null' => true)))
|
392 |
->getFirstItem();
|
393 |
// and if so update this alias with alias data from alias gateway
|
394 |
+
if (is_numeric($oldAlias->getId()) && null === $oldAlias->getCardHolder()
|
395 |
+
&& array_key_exists('Card_CardHolderName', $aliasData)
|
396 |
) {
|
397 |
$oldAlias->setCardHolder($aliasData['Card_CardHolderName']);
|
398 |
$oldAlias->save();
|
401 |
|
402 |
/**
|
403 |
* set the last pending alias to active and remove other aliases for customer based on address
|
404 |
+
*
|
405 |
+
*
|
406 |
* @param Mage_Sales_Model_Quote $quote
|
407 |
+
* @param Mage_Sales_Model_Order|null $order
|
408 |
+
* @param bool $saveSalesObjects
|
409 |
*/
|
410 |
public function setAliasActive(
|
411 |
Mage_Sales_Model_Quote $quote,
|
412 |
Mage_Sales_Model_Order $order = null,
|
413 |
$saveSalesObjects = false
|
414 |
+
)
|
415 |
+
{
|
416 |
+
if (null === $quote->getPayment()->getAdditionalInformation('userIsRegistering')
|
417 |
|| false == $quote->getPayment()->getAdditionalInformation('userIsRegistering')
|
418 |
) {
|
419 |
$aliasesToDelete = Mage::helper('ops/alias')->getAliasesForAddresses(
|
420 |
+
$quote->getCustomer()->getId(), $quote->getBillingAddress(), $quote->getShippingAddress()
|
421 |
+
)
|
422 |
->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE);
|
423 |
$lastPendingAlias = Mage::helper('ops/alias')->getAliasesForAddresses(
|
424 |
+
$quote->getCustomer()->getId(),
|
425 |
+
$quote->getBillingAddress(),
|
426 |
+
$quote->getShippingAddress(),
|
427 |
+
$quote->getStoreId()
|
428 |
+
)
|
429 |
->addFieldToFilter('alias', $quote->getPayment()->getAdditionalInformation('alias'))
|
430 |
->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::PENDING)
|
431 |
->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC)
|
app/code/community/Netresearch/OPS/Helper/Api.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
|
14 |
-
|
15 |
|
16 |
|
17 |
/**
|
@@ -38,7 +38,7 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
|
38 |
}
|
39 |
|
40 |
// in case none of the cases above match then the status is not known
|
41 |
-
if (
|
42 |
Mage::throwException('invalid status provided');
|
43 |
}
|
44 |
|
@@ -51,9 +51,9 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
|
51 |
*
|
52 |
* @return Netresearch_OPS_Model_Config
|
53 |
*/
|
54 |
-
|
55 |
{
|
56 |
-
if (
|
57 |
$this->configModel = Mage::getModel('ops/config');
|
58 |
}
|
59 |
return $this->configModel;
|
@@ -66,9 +66,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
|
66 |
*
|
67 |
* @return bool - true if the status is known as accept status, false otherwise
|
68 |
*/
|
69 |
-
|
70 |
{
|
71 |
-
return in_array(
|
|
|
72 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT
|
73 |
)
|
74 |
);
|
@@ -81,9 +82,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
|
81 |
*
|
82 |
* @return bool - true if the status is known as canceled status, false otherwise
|
83 |
*/
|
84 |
-
|
85 |
{
|
86 |
-
return in_array(
|
|
|
87 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_CANCEL
|
88 |
)
|
89 |
);
|
@@ -96,9 +98,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
|
96 |
*
|
97 |
* @return bool - true if the status is known as declined status, false otherwise
|
98 |
*/
|
99 |
-
|
100 |
{
|
101 |
-
return in_array(
|
|
|
102 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE
|
103 |
)
|
104 |
);
|
@@ -111,9 +114,10 @@ class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
|
111 |
*
|
112 |
* @return bool - true if the status is known as exception status, false otherwise
|
113 |
*/
|
114 |
-
|
115 |
{
|
116 |
-
return in_array(
|
|
|
117 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION
|
118 |
)
|
119 |
);
|
11 |
class Netresearch_OPS_Helper_Api extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
|
14 |
+
protected $configModel = null;
|
15 |
|
16 |
|
17 |
/**
|
38 |
}
|
39 |
|
40 |
// in case none of the cases above match then the status is not known
|
41 |
+
if (null === $route) {
|
42 |
Mage::throwException('invalid status provided');
|
43 |
}
|
44 |
|
51 |
*
|
52 |
* @return Netresearch_OPS_Model_Config
|
53 |
*/
|
54 |
+
protected function getConfigModel()
|
55 |
{
|
56 |
+
if (null === $this->configModel) {
|
57 |
$this->configModel = Mage::getModel('ops/config');
|
58 |
}
|
59 |
return $this->configModel;
|
66 |
*
|
67 |
* @return bool - true if the status is known as accept status, false otherwise
|
68 |
*/
|
69 |
+
protected function isAcceptStatus($status)
|
70 |
{
|
71 |
+
return in_array(
|
72 |
+
$status, array(
|
73 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT
|
74 |
)
|
75 |
);
|
82 |
*
|
83 |
* @return bool - true if the status is known as canceled status, false otherwise
|
84 |
*/
|
85 |
+
protected function isCancelStatus($status)
|
86 |
{
|
87 |
+
return in_array(
|
88 |
+
$status, array(
|
89 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_CANCEL
|
90 |
)
|
91 |
);
|
98 |
*
|
99 |
* @return bool - true if the status is known as declined status, false otherwise
|
100 |
*/
|
101 |
+
protected function isDeclineStatus($status)
|
102 |
{
|
103 |
+
return in_array(
|
104 |
+
$status, array(
|
105 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE
|
106 |
)
|
107 |
);
|
114 |
*
|
115 |
* @return bool - true if the status is known as exception status, false otherwise
|
116 |
*/
|
117 |
+
protected function isExceptionStatus($status)
|
118 |
{
|
119 |
+
return in_array(
|
120 |
+
$status, array(
|
121 |
Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION
|
122 |
)
|
123 |
);
|
app/code/community/Netresearch/OPS/Helper/Creditcard.php
CHANGED
@@ -33,10 +33,10 @@ class Netresearch_OPS_Helper_Creditcard extends Netresearch_OPS_Helper_Payment_D
|
|
33 |
}
|
34 |
|
35 |
|
36 |
-
|
37 |
/**
|
38 |
-
* @param $quote
|
39 |
-
* @param $requestParams
|
|
|
40 |
*/
|
41 |
public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
|
42 |
{
|
@@ -46,13 +46,15 @@ class Netresearch_OPS_Helper_Creditcard extends Netresearch_OPS_Helper_Payment_D
|
|
46 |
protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
|
47 |
{
|
48 |
$alias = $quote->getPayment()->getAdditionalInformation('alias');
|
49 |
-
if (
|
50 |
$alias = $this->getAliasHelper()->getAlias($quote);
|
51 |
}
|
|
|
52 |
$params = array (
|
53 |
-
'ALIAS' => $alias
|
|
|
54 |
);
|
55 |
-
if($this->getConfig()->getCreditDebitSplit($quote->getStoreId())){
|
56 |
$params['CREDITDEBIT'] = 'C';
|
57 |
}
|
58 |
if (is_numeric($quote->getPayment()->getAdditionalInformation('cvc'))) {
|
33 |
}
|
34 |
|
35 |
|
|
|
36 |
/**
|
37 |
+
* @param Mage_Sales_Model_Quote $quote
|
38 |
+
* @param array $requestParams
|
39 |
+
* @return $this
|
40 |
*/
|
41 |
public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
|
42 |
{
|
46 |
protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
|
47 |
{
|
48 |
$alias = $quote->getPayment()->getAdditionalInformation('alias');
|
49 |
+
if (null === $alias && $this->getDataHelper()->isAdminSession()) {
|
50 |
$alias = $this->getAliasHelper()->getAlias($quote);
|
51 |
}
|
52 |
+
$saveAlias = Mage::getModel('ops/alias')->load($alias, 'alias')->getId();
|
53 |
$params = array (
|
54 |
+
'ALIAS' => $alias,
|
55 |
+
'ALIASPERSISTEDAFTERUSE' => $saveAlias ? 'Y' : 'N',
|
56 |
);
|
57 |
+
if ($this->getConfig()->getCreditDebitSplit($quote->getStoreId())) {
|
58 |
$params['CREDITDEBIT'] = 'C';
|
59 |
}
|
60 |
if (is_numeric($quote->getPayment()->getAdditionalInformation('cvc'))) {
|
app/code/community/Netresearch/OPS/Helper/Data.php
CHANGED
@@ -29,7 +29,7 @@ class Netresearch_OPS_Helper_Data extends Mage_Core_Helper_Abstract
|
|
29 |
public function getModuleVersionString()
|
30 |
{
|
31 |
$version = Mage::getConfig()->getNode('modules/Netresearch_OPS/version');
|
32 |
-
$plainversion = preg_replace('/\.|[+-].+$/','', $version);
|
33 |
return 'AC1X' . $plainversion;
|
34 |
}
|
35 |
|
@@ -75,10 +75,10 @@ class Netresearch_OPS_Helper_Data extends Mage_Core_Helper_Abstract
|
|
75 |
}
|
76 |
}
|
77 |
if (is_string($message)) {
|
78 |
-
$message = preg_replace('/"CVC":".*"(,)/i',''
|
79 |
-
$message = preg_replace('/"CVC":".*"/i',''
|
80 |
-
$message = preg_replace('/"CVC".*"[A-Z]*";/',''
|
81 |
-
$message = preg_replace('/"CVC":".*"(})/i','}'
|
82 |
}
|
83 |
return $message;
|
84 |
}
|
@@ -87,7 +87,6 @@ class Netresearch_OPS_Helper_Data extends Mage_Core_Helper_Abstract
|
|
87 |
{
|
88 |
Mage::app()->getResponse()->setRedirect($url);
|
89 |
Mage::app()->getResponse()->sendResponse();
|
90 |
-
exit();
|
91 |
}
|
92 |
|
93 |
/**
|
29 |
public function getModuleVersionString()
|
30 |
{
|
31 |
$version = Mage::getConfig()->getNode('modules/Netresearch_OPS/version');
|
32 |
+
$plainversion = preg_replace('/\.|[+-].+$/', '', $version);
|
33 |
return 'AC1X' . $plainversion;
|
34 |
}
|
35 |
|
75 |
}
|
76 |
}
|
77 |
if (is_string($message)) {
|
78 |
+
$message = preg_replace('/"CVC":".*"(,)/i', '', $message);
|
79 |
+
$message = preg_replace('/"CVC":".*"/i', '', $message);
|
80 |
+
$message = preg_replace('/"CVC".*"[A-Z]*";/', '', $message);
|
81 |
+
$message = preg_replace('/"CVC":".*"(})/i', '}', $message);
|
82 |
}
|
83 |
return $message;
|
84 |
}
|
87 |
{
|
88 |
Mage::app()->getResponse()->setRedirect($url);
|
89 |
Mage::app()->getResponse()->sendResponse();
|
|
|
90 |
}
|
91 |
|
92 |
/**
|
app/code/community/Netresearch/OPS/Helper/Debitcard.php
CHANGED
@@ -13,7 +13,7 @@ class Netresearch_OPS_Helper_Debitcard extends Netresearch_OPS_Helper_Creditcard
|
|
13 |
protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
|
14 |
{
|
15 |
$params = parent::getPaymentSpecificParams($quote);
|
16 |
-
if($this->getConfig()->getCreditDebitSplit($quote->getStoreId())){
|
17 |
$params['CREDITDEBIT'] = 'D';
|
18 |
}
|
19 |
return $params;
|
13 |
protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
|
14 |
{
|
15 |
$params = parent::getPaymentSpecificParams($quote);
|
16 |
+
if ($this->getConfig()->getCreditDebitSplit($quote->getStoreId())) {
|
17 |
$params['CREDITDEBIT'] = 'D';
|
18 |
}
|
19 |
return $params;
|
app/code/community/Netresearch/OPS/Helper/DirectDebit.php
CHANGED
@@ -19,10 +19,6 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
|
|
19 |
|
20 |
protected $customerHelper = null;
|
21 |
|
22 |
-
protected $validator = null;
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
/**
|
28 |
* sets the data helper
|
@@ -31,13 +27,13 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
|
|
31 |
*/
|
32 |
public function setDataHelper(Netresearch_OPS_Helper_Data $dataHelper)
|
33 |
{
|
34 |
-
$this->dataHelper =
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
* gets the data helper
|
39 |
*
|
40 |
-
* @return
|
41 |
*/
|
42 |
public function getDataHelper()
|
43 |
{
|
@@ -120,165 +116,6 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
|
|
120 |
return $this->customerHelper;
|
121 |
}
|
122 |
|
123 |
-
|
124 |
-
/**
|
125 |
-
* sets the validator
|
126 |
-
*
|
127 |
-
* @param Netresearch_OPS_Model_Validator_Payment_DirectDebit $validator
|
128 |
-
*/
|
129 |
-
public function setValidator(
|
130 |
-
Netresearch_OPS_Model_Validator_Payment_DirectDebit $validator
|
131 |
-
)
|
132 |
-
{
|
133 |
-
$this->validator = $validator;
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* gets the validator
|
138 |
-
*
|
139 |
-
* @return Netresearch_OPS_Model_Validator_Payment_DirectDebit
|
140 |
-
*/
|
141 |
-
public function getValidator()
|
142 |
-
{
|
143 |
-
if (null === $this->validator) {
|
144 |
-
$this->validator = Mage::getModel(
|
145 |
-
'ops/validator_payment_directDebit'
|
146 |
-
);
|
147 |
-
}
|
148 |
-
|
149 |
-
return $this->validator;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* gets the country from a given array
|
154 |
-
*
|
155 |
-
* @param array $params
|
156 |
-
*
|
157 |
-
* @return string - the country in uppercase, empty string if no country
|
158 |
-
* was provided
|
159 |
-
*/
|
160 |
-
public function getCountry(array $params)
|
161 |
-
{
|
162 |
-
$country = '';
|
163 |
-
if (array_key_exists('country', $params)) {
|
164 |
-
$country = strtoupper($params['country']);
|
165 |
-
}
|
166 |
-
|
167 |
-
return $country;
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* checks whether the given data has an iban field or not
|
172 |
-
*
|
173 |
-
* @param array $accountData
|
174 |
-
*
|
175 |
-
* @return bool - true if iban field is present and filled, false otherwise
|
176 |
-
*/
|
177 |
-
public function hasIban(array $accountData)
|
178 |
-
{
|
179 |
-
return array_key_exists('iban', $accountData)
|
180 |
-
&& 0 < strlen(trim($accountData['iban']));
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* sets the direct debit data to given payment
|
185 |
-
*
|
186 |
-
* @param Mage_Sales_Model_Quote_Payment $payment - the payment which
|
187 |
-
* should contain the
|
188 |
-
* additional data
|
189 |
-
* @param array $params -
|
190 |
-
*
|
191 |
-
* @return Mage_Sales_Model_Quote_Payment
|
192 |
-
*/
|
193 |
-
public function setDirectDebitDataToPayment(
|
194 |
-
Mage_Sales_Model_Quote_Payment $payment, array $params
|
195 |
-
)
|
196 |
-
{
|
197 |
-
$payment->setAdditionalInformation(
|
198 |
-
'PM', 'Direct Debits ' . $this->getCountry($params)
|
199 |
-
);
|
200 |
-
$this->setAccountHolder($payment, $params);
|
201 |
-
$this->setAccountData($payment, $params);
|
202 |
-
|
203 |
-
return $payment;
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* sets the account holder to given payment
|
208 |
-
*
|
209 |
-
* @param Mage_Sales_Model_Quote_Payment $payment
|
210 |
-
* @param array $params
|
211 |
-
*/
|
212 |
-
protected function setAccountHolder(
|
213 |
-
Mage_Sales_Model_Quote_Payment $payment, array $params
|
214 |
-
)
|
215 |
-
{
|
216 |
-
if (array_key_exists('CN', $params)
|
217 |
-
&& 0 < strlen(trim($params['CN']))
|
218 |
-
) {
|
219 |
-
$payment->setAdditionalInformation('CN', trim($params['CN']));
|
220 |
-
}
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* set the account data to given payment
|
225 |
-
*
|
226 |
-
* @param Mage_Sales_Model_Quote_Payment $payment
|
227 |
-
* @param array $params
|
228 |
-
*/
|
229 |
-
protected function setAccountData(
|
230 |
-
Mage_Sales_Model_Quote_Payment $payment, array $params
|
231 |
-
)
|
232 |
-
{
|
233 |
-
$country = $this->getCountry($params);
|
234 |
-
|
235 |
-
if ('DE' == $country || 'AT' == $country) {
|
236 |
-
if ($this->hasIban($params) && 'DE' == $country) {
|
237 |
-
$payment->setAdditionalInformation(
|
238 |
-
'CARDNO', trim($params['iban'])
|
239 |
-
);
|
240 |
-
} else {
|
241 |
-
$payment->setAdditionalInformation(
|
242 |
-
'CARDNO',
|
243 |
-
trim($params['account']) . 'BLZ' . trim($params['bankcode'])
|
244 |
-
);
|
245 |
-
}
|
246 |
-
|
247 |
-
|
248 |
-
}
|
249 |
-
if ('NL' == $country) {
|
250 |
-
if ($this->hasIban($params)) {
|
251 |
-
$payment->setAdditionalInformation(
|
252 |
-
'CARDNO', trim($params['iban'])
|
253 |
-
);
|
254 |
-
$payment->setAdditionalInformation('BIC', trim($params['bic']));
|
255 |
-
} else {
|
256 |
-
$payment->setAdditionalInformation(
|
257 |
-
'CARDNO', str_pad($params['account'], '0', STR_PAD_LEFT)
|
258 |
-
);
|
259 |
-
}
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* validates direct debit payment from the backend
|
265 |
-
*
|
266 |
-
* @param $requestParams - the params passed on order submission
|
267 |
-
* @throws Mage_Core_Exception - if the data is not valid
|
268 |
-
* @return boolean - true if data were valid
|
269 |
-
*/
|
270 |
-
protected function validateAdminDirectDebit($requestParams)
|
271 |
-
{
|
272 |
-
$validator = $this->getValidator();
|
273 |
-
if (false === $validator->isValid($requestParams)) {
|
274 |
-
Mage::getModel('adminhtml/session')->setData('ops_direct_debit_params', $requestParams);
|
275 |
-
Mage::throwException(
|
276 |
-
implode('<br />', $validator->getMessages())
|
277 |
-
);
|
278 |
-
}
|
279 |
-
return true;
|
280 |
-
}
|
281 |
-
|
282 |
/**
|
283 |
* @param Mage_Sales_Model_Quote $quote
|
284 |
* @param array $requestParams
|
@@ -286,30 +123,26 @@ class Netresearch_OPS_Helper_DirectDebit extends Netresearch_OPS_Helper_Payment_
|
|
286 |
*/
|
287 |
public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
|
288 |
{
|
289 |
-
if ($this->getDataHelper()->isAdminSession() && is_array($requestParams)) {
|
290 |
-
$this->validateAdminDirectDebit($requestParams);
|
291 |
-
$this->setDirectDebitDataToPayment($quote->getPayment(), $requestParams);
|
292 |
-
$quote->getPayment()->save();
|
293 |
-
}
|
294 |
-
|
295 |
return $this;
|
296 |
}
|
297 |
|
|
|
|
|
|
|
|
|
|
|
298 |
protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
|
299 |
{
|
300 |
-
$
|
301 |
-
$
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
'
|
306 |
-
'
|
|
|
|
|
307 |
);
|
308 |
-
if (0 < strlen(trim($quote->getPayment()->getAdditionalInformation('BIC')))) {
|
309 |
-
$bic = $quote->getPayment()->getAdditionalInformation('BIC');
|
310 |
-
$params['BIC'] = $bic;
|
311 |
-
}
|
312 |
-
$params['BRAND'] = $params['PM'];
|
313 |
|
314 |
return $params;
|
315 |
}
|
19 |
|
20 |
protected $customerHelper = null;
|
21 |
|
|
|
|
|
|
|
|
|
22 |
|
23 |
/**
|
24 |
* sets the data helper
|
27 |
*/
|
28 |
public function setDataHelper(Netresearch_OPS_Helper_Data $dataHelper)
|
29 |
{
|
30 |
+
$this->dataHelper = Mage::helper('ops/data');
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
* gets the data helper
|
35 |
*
|
36 |
+
* @return Netresearch_OPS_Helper_Data
|
37 |
*/
|
38 |
public function getDataHelper()
|
39 |
{
|
116 |
return $this->customerHelper;
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
/**
|
120 |
* @param Mage_Sales_Model_Quote $quote
|
121 |
* @param array $requestParams
|
123 |
*/
|
124 |
public function handleAdminPayment(Mage_Sales_Model_Quote $quote, $requestParams)
|
125 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
return $this;
|
127 |
}
|
128 |
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param Mage_Sales_Model_Quote $quote
|
132 |
+
* @return array
|
133 |
+
*/
|
134 |
protected function getPaymentSpecificParams(Mage_Sales_Model_Quote $quote)
|
135 |
{
|
136 |
+
$alias = $quote->getPayment()->getAdditionalInformation('alias');
|
137 |
+
$saveAlias = Mage::getModel('ops/alias')->load($alias, 'alias')->getId();
|
138 |
+
|
139 |
+
$paymentMethod = 'Direct Debits ' . $quote->getPayment()->getAdditionalInformation('country_id');
|
140 |
+
$params = array (
|
141 |
+
'ALIAS' => $alias,
|
142 |
+
'ALIASPERSISTEDAFTERUSE' => $saveAlias ? 'Y' : 'N',
|
143 |
+
'PM' => $paymentMethod,
|
144 |
+
'BRAND' => $paymentMethod
|
145 |
);
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
return $params;
|
148 |
}
|
app/code/community/Netresearch/OPS/Helper/Directlink.php
CHANGED
@@ -26,7 +26,6 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
26 |
{
|
27 |
$payment = $order->getPayment();
|
28 |
$payment->setTransactionId($transactionID."/".$subPayID);
|
29 |
-
// $transaction = $payment->addTransaction($typename, null, false, $comment);
|
30 |
$payment->setParentTransactionId($transactionID);
|
31 |
$payment->setIsTransactionClosed($closed);
|
32 |
$payment->setTransactionAdditionalInfo($arrInformation, null);
|
@@ -105,8 +104,6 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
105 |
{
|
106 |
Mage::getModel('ops/response_handler')->processResponse($params, $order->getPayment()->getMethodInstance());
|
107 |
$order->getPayment()->save();
|
108 |
-
|
109 |
-
return;
|
110 |
}
|
111 |
|
112 |
/**
|
@@ -132,19 +129,19 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
132 |
$transactionCollection->addAttributeToFilter('parent_txn_id', $payId);
|
133 |
}
|
134 |
|
135 |
-
if ($transactionCollection->
|
136 |
$errorMsq = $helper->__(
|
137 |
"Warning, transaction count is %s instead of 1 for the Payid '%s', order '%s' and Operation '%s'.",
|
138 |
-
$transactionCollection->
|
139 |
$payId,
|
140 |
$order->getId(),
|
141 |
$operation
|
142 |
);
|
143 |
$helper->log($errorMsq);
|
144 |
-
|
145 |
}
|
146 |
|
147 |
-
if ($transactionCollection->
|
148 |
$transaction = $transactionCollection->getLastItem();
|
149 |
$transaction->setOrderPaymentObject($order->getPayment());
|
150 |
return $transaction;
|
@@ -168,7 +165,7 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
168 |
->addAttributeToFilter('is_closed', 0)
|
169 |
->addAttributeToFilter('order_id', $order->getId());
|
170 |
|
171 |
-
return (0 < $transactionCollection->
|
172 |
}
|
173 |
|
174 |
/**
|
@@ -181,7 +178,9 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
181 |
{
|
182 |
// Avoid quotes added somewhere unknown
|
183 |
if (preg_match("/^[\"']([0-9-\..,-]+)[\"']$/i", $amount, $matches)) {
|
184 |
-
Mage::helper('ops')->log(
|
|
|
|
|
185 |
$amount = $matches[1];
|
186 |
}
|
187 |
|
@@ -197,7 +196,11 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
197 |
*
|
198 |
* @return boolean
|
199 |
*/
|
200 |
-
public function isValidOpsRequest(
|
|
|
|
|
|
|
|
|
201 |
{
|
202 |
if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_DELETE_TRANSACTION_TYPE) {
|
203 |
return false;
|
@@ -210,13 +213,10 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
210 |
|
211 |
/* find expected amount */
|
212 |
$expectedAmount = null;
|
213 |
-
if (
|
214 |
$transactionInfo = unserialize($openTransaction->getAdditionalInformation('arrInfo'));
|
215 |
if (array_key_exists('amount', $transactionInfo)) {
|
216 |
-
if (
|
217 |
-
is_null($expectedAmount)
|
218 |
-
|| $transactionInfo['amount'] == $requestedAmount
|
219 |
-
) {
|
220 |
$expectedAmount = $this->formatAmount($transactionInfo['amount']);
|
221 |
}
|
222 |
}
|
@@ -225,24 +225,19 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
225 |
if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE
|
226 |
|| $this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_VOID_TRANSACTION_TYPE
|
227 |
) {
|
228 |
-
if (
|
229 |
-
|| 0 == count($openTransaction)
|
230 |
-
|| $requestedAmount != $expectedAmount
|
231 |
-
) {
|
232 |
return false;
|
233 |
}
|
234 |
}
|
235 |
|
236 |
if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
|
237 |
-
if (
|
238 |
Mage::helper('ops')->log('Please configure Acceptance to submit amount');
|
239 |
return false;
|
240 |
}
|
241 |
$grandTotal = $this->formatAmount(Mage::helper('ops/payment')->getBaseGrandTotalFromSalesObject($order));
|
242 |
if ($grandTotal != $requestedAmount) {
|
243 |
-
if (
|
244 |
-
|| $expectedAmount != $requestedAmount
|
245 |
-
) {
|
246 |
return false;
|
247 |
}
|
248 |
}
|
@@ -257,12 +252,11 @@ class Netresearch_OPS_Helper_Directlink extends Mage_Core_Helper_Abstract
|
|
257 |
/**
|
258 |
* allow null as valid state for creating the order with status 'pending'
|
259 |
*/
|
260 |
-
if (
|
261 |
-
&& Mage::helper('ops/payment')->isPaymentFailed($response['STATUS'])
|
262 |
-
) {
|
263 |
Mage::getSingleton('checkout/type_onepage')->getCheckout()->setGotoSection('payment');
|
264 |
-
|
265 |
}
|
|
|
266 |
return $response;
|
267 |
}
|
268 |
}
|
26 |
{
|
27 |
$payment = $order->getPayment();
|
28 |
$payment->setTransactionId($transactionID."/".$subPayID);
|
|
|
29 |
$payment->setParentTransactionId($transactionID);
|
30 |
$payment->setIsTransactionClosed($closed);
|
31 |
$payment->setTransactionAdditionalInfo($arrInformation, null);
|
104 |
{
|
105 |
Mage::getModel('ops/response_handler')->processResponse($params, $order->getPayment()->getMethodInstance());
|
106 |
$order->getPayment()->save();
|
|
|
|
|
107 |
}
|
108 |
|
109 |
/**
|
129 |
$transactionCollection->addAttributeToFilter('parent_txn_id', $payId);
|
130 |
}
|
131 |
|
132 |
+
if ($transactionCollection->getSize()>1 || $transactionCollection->getSize() == 0) {
|
133 |
$errorMsq = $helper->__(
|
134 |
"Warning, transaction count is %s instead of 1 for the Payid '%s', order '%s' and Operation '%s'.",
|
135 |
+
$transactionCollection->getSize(),
|
136 |
$payId,
|
137 |
$order->getId(),
|
138 |
$operation
|
139 |
);
|
140 |
$helper->log($errorMsq);
|
141 |
+
Mage::throwException($errorMsq);
|
142 |
}
|
143 |
|
144 |
+
if ($transactionCollection->getSize() == 1) {
|
145 |
$transaction = $transactionCollection->getLastItem();
|
146 |
$transaction->setOrderPaymentObject($order->getPayment());
|
147 |
return $transaction;
|
165 |
->addAttributeToFilter('is_closed', 0)
|
166 |
->addAttributeToFilter('order_id', $order->getId());
|
167 |
|
168 |
+
return (0 < $transactionCollection->getSize());
|
169 |
}
|
170 |
|
171 |
/**
|
178 |
{
|
179 |
// Avoid quotes added somewhere unknown
|
180 |
if (preg_match("/^[\"']([0-9-\..,-]+)[\"']$/i", $amount, $matches)) {
|
181 |
+
Mage::helper('ops')->log(
|
182 |
+
"Warning in formatAmount: Found quotes around amount in '" . var_export($amount, true) . "'"
|
183 |
+
);
|
184 |
$amount = $matches[1];
|
185 |
}
|
186 |
|
196 |
*
|
197 |
* @return boolean
|
198 |
*/
|
199 |
+
public function isValidOpsRequest(
|
200 |
+
$openTransaction,
|
201 |
+
Mage_Sales_Model_Order $order,
|
202 |
+
$opsRequestParams
|
203 |
+
)
|
204 |
{
|
205 |
if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_DELETE_TRANSACTION_TYPE) {
|
206 |
return false;
|
213 |
|
214 |
/* find expected amount */
|
215 |
$expectedAmount = null;
|
216 |
+
if (null !== $openTransaction) {
|
217 |
$transactionInfo = unserialize($openTransaction->getAdditionalInformation('arrInfo'));
|
218 |
if (array_key_exists('amount', $transactionInfo)) {
|
219 |
+
if (null === $expectedAmount || $transactionInfo['amount'] == $requestedAmount) {
|
|
|
|
|
|
|
220 |
$expectedAmount = $this->formatAmount($transactionInfo['amount']);
|
221 |
}
|
222 |
}
|
225 |
if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE
|
226 |
|| $this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_VOID_TRANSACTION_TYPE
|
227 |
) {
|
228 |
+
if (null === $requestedAmount || 0 == count($openTransaction) || $requestedAmount != $expectedAmount) {
|
|
|
|
|
|
|
229 |
return false;
|
230 |
}
|
231 |
}
|
232 |
|
233 |
if ($this->getTypeForStatus($opsRequestParams['STATUS']) == Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
|
234 |
+
if (null === $requestedAmount) {
|
235 |
Mage::helper('ops')->log('Please configure Acceptance to submit amount');
|
236 |
return false;
|
237 |
}
|
238 |
$grandTotal = $this->formatAmount(Mage::helper('ops/payment')->getBaseGrandTotalFromSalesObject($order));
|
239 |
if ($grandTotal != $requestedAmount) {
|
240 |
+
if (null === $openTransaction || $expectedAmount != $requestedAmount) {
|
|
|
|
|
241 |
return false;
|
242 |
}
|
243 |
}
|
252 |
/**
|
253 |
* allow null as valid state for creating the order with status 'pending'
|
254 |
*/
|
255 |
+
if (null != $response['STATUS'] && Mage::helper('ops/payment')->isPaymentFailed($response['STATUS'])) {
|
|
|
|
|
256 |
Mage::getSingleton('checkout/type_onepage')->getCheckout()->setGotoSection('payment');
|
257 |
+
Mage::throwException(Mage::helper('ops/data')->__('Acceptance Payment failed'));
|
258 |
}
|
259 |
+
|
260 |
return $response;
|
261 |
}
|
262 |
}
|
app/code/community/Netresearch/OPS/Helper/Kwixo.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
|
14 |
-
|
15 |
|
16 |
protected function getHelper()
|
17 |
{
|
@@ -59,13 +59,9 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
|
|
59 |
);
|
60 |
$subcategories = $category->getAllChildren(true);
|
61 |
foreach ($subcategories as $subcategory) {
|
62 |
-
$kwixoCatMapModel = Mage::getModel(
|
63 |
-
'ops/kwixo_category_mapping'
|
64 |
-
)->loadByCategoryId($subcategory);
|
65 |
$kwixoCatMapModel->setCategoryId($subcategory);
|
66 |
-
$kwixoCatMapModel->setKwixoCategoryId(
|
67 |
-
$postData['kwixoCategory_id']
|
68 |
-
);
|
69 |
$kwixoCatMapModel->save();
|
70 |
}
|
71 |
}
|
@@ -85,7 +81,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
|
|
85 |
*
|
86 |
* @throws Mage_Core_Exception - if the structure does not match
|
87 |
*/
|
88 |
-
|
89 |
{
|
90 |
$helper = $this->getHelper();
|
91 |
$isValid = true;
|
@@ -122,7 +118,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
|
|
122 |
* information
|
123 |
*
|
124 |
*/
|
125 |
-
|
126 |
{
|
127 |
$helper = $this->getHelper();
|
128 |
$kwixoCategories = Mage::getModel('ops/source_kwixo_productCategories')
|
@@ -145,7 +141,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
|
|
145 |
*
|
146 |
* @throws Mage_Core_Exception - if an invalid setting is given
|
147 |
*/
|
148 |
-
|
149 |
{
|
150 |
$helper = $this->getHelper();
|
151 |
$isValid = true;
|
@@ -157,11 +153,7 @@ class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
|
|
157 |
}
|
158 |
if ($isValid
|
159 |
&& (!is_numeric($postData['category_id'])
|
160 |
-
|
161 |
-
Mage::getModel('catalog/category')->load(
|
162 |
-
$postData['category_id']
|
163 |
-
)->getId()
|
164 |
-
))
|
165 |
) {
|
166 |
$isValid = false;
|
167 |
$message = $helper->__('Invalid category provided');
|
11 |
class Netresearch_OPS_Helper_Kwixo extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
|
14 |
+
protected $helper = null;
|
15 |
|
16 |
protected function getHelper()
|
17 |
{
|
59 |
);
|
60 |
$subcategories = $category->getAllChildren(true);
|
61 |
foreach ($subcategories as $subcategory) {
|
62 |
+
$kwixoCatMapModel = Mage::getModel('ops/kwixo_category_mapping')->loadByCategoryId($subcategory);
|
|
|
|
|
63 |
$kwixoCatMapModel->setCategoryId($subcategory);
|
64 |
+
$kwixoCatMapModel->setKwixoCategoryId($postData['kwixoCategory_id']);
|
|
|
|
|
65 |
$kwixoCatMapModel->save();
|
66 |
}
|
67 |
}
|
81 |
*
|
82 |
* @throws Mage_Core_Exception - if the structure does not match
|
83 |
*/
|
84 |
+
protected function validateKwixoConfigurationData(array $postData)
|
85 |
{
|
86 |
$helper = $this->getHelper();
|
87 |
$isValid = true;
|
118 |
* information
|
119 |
*
|
120 |
*/
|
121 |
+
protected function validateKwixoMappingExist(array $postData)
|
122 |
{
|
123 |
$helper = $this->getHelper();
|
124 |
$kwixoCategories = Mage::getModel('ops/source_kwixo_productCategories')
|
141 |
*
|
142 |
* @throws Mage_Core_Exception - if an invalid setting is given
|
143 |
*/
|
144 |
+
protected function validateCategoryExist(array $postData)
|
145 |
{
|
146 |
$helper = $this->getHelper();
|
147 |
$isValid = true;
|
153 |
}
|
154 |
if ($isValid
|
155 |
&& (!is_numeric($postData['category_id'])
|
156 |
+
|| null === Mage::getModel('catalog/category')->load($postData['category_id'])->getId())
|
|
|
|
|
|
|
|
|
157 |
) {
|
158 |
$isValid = false;
|
159 |
$message = $helper->__('Invalid category provided');
|
app/code/community/Netresearch/OPS/Helper/MobileDetect.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch_OPS_Helper_MobileDetect
|
4 |
+
*
|
5 |
+
* @package
|
6 |
+
* @copyright 2016 Netresearch
|
7 |
+
* @author Sebastian Ertner <sebastian.ertner@netresearch.de>
|
8 |
+
* @license OSL 3.0
|
9 |
+
*/
|
10 |
+
require_once Mage::getBaseDir('lib') . DS . 'MobileDetect' .DS. 'Mobile_Detect.php';
|
11 |
+
|
12 |
+
class Netresearch_OPS_Helper_MobileDetect extends Mage_Core_Helper_Abstract
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Computer device type string
|
16 |
+
*/
|
17 |
+
const DEVICE_TYPE_COMPUTER = 'Computer';
|
18 |
+
/**
|
19 |
+
* mobile device type string
|
20 |
+
*/
|
21 |
+
const DEVICE_TYPE_MOBILE = 'Mobile';
|
22 |
+
/**
|
23 |
+
* tablet device type string
|
24 |
+
*/
|
25 |
+
const DEVICE_TYPE_TABLET = 'Tablet';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var Mobile_Detect
|
29 |
+
*/
|
30 |
+
private $_detector = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* create class instance
|
34 |
+
*
|
35 |
+
* Netresearch_OPS_Helper_MobileDetect constructor.
|
36 |
+
* @param null $headers
|
37 |
+
* @param null $userAgent
|
38 |
+
* @param null $detector
|
39 |
+
*/
|
40 |
+
public function __construct()
|
41 |
+
{
|
42 |
+
$this->_detector = new Mobile_Detect();
|
43 |
+
}
|
44 |
+
|
45 |
+
public function setDetector($detector)
|
46 |
+
{
|
47 |
+
$this->_detector = $detector;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* determine device type with help of mobile_detect lib and return it
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function getDeviceType()
|
56 |
+
{
|
57 |
+
$deviceType = self::DEVICE_TYPE_COMPUTER;
|
58 |
+
if ($this->_detector->isMobile()) {
|
59 |
+
$deviceType = self::DEVICE_TYPE_MOBILE;
|
60 |
+
}
|
61 |
+
|
62 |
+
if ($this->_detector->isTablet()) {
|
63 |
+
$deviceType = self::DEVICE_TYPE_TABLET;
|
64 |
+
}
|
65 |
+
|
66 |
+
return $deviceType;
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Netresearch/OPS/Helper/Order.php
CHANGED
@@ -14,7 +14,7 @@ class Netresearch_OPS_Helper_Order extends Mage_Core_Helper_Abstract
|
|
14 |
const DELIMITER = '#';
|
15 |
|
16 |
/** @var $config Netresearch_OPS_Model_Config */
|
17 |
-
|
18 |
|
19 |
protected $statusMappingModel = null;
|
20 |
|
@@ -48,7 +48,7 @@ class Netresearch_OPS_Helper_Order extends Mage_Core_Helper_Abstract
|
|
48 |
*/
|
49 |
protected function getConfig()
|
50 |
{
|
51 |
-
if (
|
52 |
$this->config = Mage::getModel('ops/config');
|
53 |
}
|
54 |
|
@@ -113,7 +113,6 @@ class Netresearch_OPS_Helper_Order extends Mage_Core_Helper_Abstract
|
|
113 |
$fieldToFilter = 'increment_id';
|
114 |
}
|
115 |
|
116 |
-
|
117 |
/* @var $order Mage_Sales_Model_Resource_Order_Collection */
|
118 |
$order = Mage::getModel('sales/order')->getCollection()
|
119 |
->addFieldToFilter($fieldToFilter, $opsOrderId)
|
14 |
const DELIMITER = '#';
|
15 |
|
16 |
/** @var $config Netresearch_OPS_Model_Config */
|
17 |
+
protected $config = null;
|
18 |
|
19 |
protected $statusMappingModel = null;
|
20 |
|
48 |
*/
|
49 |
protected function getConfig()
|
50 |
{
|
51 |
+
if (null === $this->config) {
|
52 |
$this->config = Mage::getModel('ops/config');
|
53 |
}
|
54 |
|
113 |
$fieldToFilter = 'increment_id';
|
114 |
}
|
115 |
|
|
|
116 |
/* @var $order Mage_Sales_Model_Resource_Order_Collection */
|
117 |
$order = Mage::getModel('sales/order')->getCollection()
|
118 |
->addFieldToFilter($fieldToFilter, $opsOrderId)
|
app/code/community/Netresearch/OPS/Helper/Order/Refund.php
CHANGED
@@ -32,6 +32,7 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
|
|
32 |
|
33 |
/**
|
34 |
* @param Varien_Object $payment
|
|
|
35 |
*/
|
36 |
public function setPayment(Varien_Object $payment)
|
37 |
{
|
@@ -41,7 +42,8 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
|
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
-
* @param
|
|
|
45 |
*/
|
46 |
public function setAmount($amount)
|
47 |
{
|
@@ -94,8 +96,9 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
|
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
-
* @param
|
98 |
-
* @param
|
|
|
99 |
*/
|
100 |
public function prepareOperation($payment, $amount)
|
101 |
{
|
@@ -124,7 +127,8 @@ class Netresearch_OPS_Helper_Order_Refund extends Netresearch_OPS_Helper_Order_A
|
|
124 |
*
|
125 |
* @return Mage_Sales_Model_Order_Payment_Transaction|null
|
126 |
*/
|
127 |
-
public function getOpenRefundTransaction($payment)
|
|
|
128 |
/** @var Mage_Sales_Model_Resource_Order_Payment_Transaction_Collection $refundTransactions */
|
129 |
$refundTransactions = Mage::getModel('sales/order_payment_transaction')->getCollection();
|
130 |
$transaction = $refundTransactions->addPaymentIdFilter($payment->getId())
|
32 |
|
33 |
/**
|
34 |
* @param Varien_Object $payment
|
35 |
+
* @return $this
|
36 |
*/
|
37 |
public function setPayment(Varien_Object $payment)
|
38 |
{
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
+
* @param $amount
|
46 |
+
* @return $this
|
47 |
*/
|
48 |
public function setAmount($amount)
|
49 |
{
|
96 |
}
|
97 |
|
98 |
/**
|
99 |
+
* @param $payment
|
100 |
+
* @param $amount
|
101 |
+
* @return mixed
|
102 |
*/
|
103 |
public function prepareOperation($payment, $amount)
|
104 |
{
|
127 |
*
|
128 |
* @return Mage_Sales_Model_Order_Payment_Transaction|null
|
129 |
*/
|
130 |
+
public function getOpenRefundTransaction($payment)
|
131 |
+
{
|
132 |
/** @var Mage_Sales_Model_Resource_Order_Payment_Transaction_Collection $refundTransactions */
|
133 |
$refundTransactions = Mage::getModel('sales/order_payment_transaction')->getCollection();
|
134 |
$transaction = $refundTransactions->addPaymentIdFilter($payment->getId())
|
app/code/community/Netresearch/OPS/Helper/Payment.php
CHANGED
@@ -71,7 +71,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
71 |
* Check hash crypted by SHA1 with existing data
|
72 |
*
|
73 |
* @param array $data
|
74 |
-
* @param string $
|
75 |
* @param string $key
|
76 |
*
|
77 |
* @return bool
|
@@ -97,7 +97,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
97 |
}
|
98 |
}
|
99 |
|
100 |
-
|
101 |
{
|
102 |
$helper = Mage::helper('ops');
|
103 |
$helper->log(
|
@@ -120,8 +120,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
120 |
/**
|
121 |
* Return set of data which is ready for SHA crypt
|
122 |
*
|
123 |
-
* @param array $
|
124 |
-
* @param string $
|
125 |
*
|
126 |
* @return string
|
127 |
*/
|
@@ -130,7 +130,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
130 |
$params = $this->prepareParamsAndSort($params);
|
131 |
$plainHashString = "";
|
132 |
foreach ($params as $paramSet):
|
133 |
-
if ($paramSet['value'] == '' || $paramSet['key'] == 'SHASIGN') {
|
134 |
continue;
|
135 |
}
|
136 |
$plainHashString .= strtoupper($paramSet['key']) . "=" . $paramSet['value'] . $SHAkey;
|
@@ -177,14 +177,14 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
177 |
*/
|
178 |
public function getSHASign($formFields, $shaCode = null, $storeId = null)
|
179 |
{
|
180 |
-
if (
|
181 |
$shaCode = Mage::getModel('ops/config')->getShaOutCode($storeId);
|
182 |
}
|
183 |
$formFields = array_change_key_case($formFields, CASE_UPPER);
|
184 |
uksort($formFields, 'strnatcasecmp');
|
185 |
$plainHashString = '';
|
186 |
foreach ($formFields as $formKey => $formVal) {
|
187 |
-
if (
|
188 |
continue;
|
189 |
}
|
190 |
$plainHashString .= strtoupper($formKey) . '=' . $formVal . $shaCode;
|
@@ -193,13 +193,35 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
193 |
return $plainHashString;
|
194 |
}
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
/**
|
197 |
* We get some CC info from ops, so we must save it
|
198 |
*
|
199 |
* @param Mage_Sales_Model_Order $order
|
200 |
* @param array $ccInfo
|
201 |
*
|
202 |
-
* @return
|
203 |
*/
|
204 |
public function _prepareCCInfo($order, $ccInfo)
|
205 |
{
|
@@ -287,7 +309,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
287 |
case Netresearch_OPS_Model_Status::AUTHORIZED:
|
288 |
case Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT:
|
289 |
case Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING:
|
290 |
-
case Netresearch_OPS_Model_Status::AUTHORIZED_UNKNOWN:
|
291 |
case Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT:
|
292 |
$feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT;
|
293 |
break;
|
@@ -298,7 +319,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
298 |
break;
|
299 |
case Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED:
|
300 |
case Netresearch_OPS_Model_Status::PAYMENT_REFUSED:
|
301 |
-
// $this->declineOrder($order, $params);
|
302 |
$feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE;
|
303 |
break;
|
304 |
case Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER:
|
@@ -306,7 +326,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
306 |
break;
|
307 |
default:
|
308 |
//all unknown transaction will accept as exceptional
|
309 |
-
// $this->handleException($order, $params);
|
310 |
$feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION;
|
311 |
}
|
312 |
|
@@ -316,8 +335,11 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
316 |
/**
|
317 |
* Process success action by accept url
|
318 |
*
|
319 |
-
*
|
320 |
-
* @param
|
|
|
|
|
|
|
321 |
*/
|
322 |
public function acceptOrder($order, $params, $instantCapture = 0)
|
323 |
{
|
@@ -365,7 +387,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
365 |
* so capture or cancel won't work. So we need to create a new authorization transaction for them
|
366 |
* when a payment was accepted by Acceptance
|
367 |
*
|
368 |
-
* In exception-case we create the authorization-transaction too
|
|
|
369 |
*/
|
370 |
if (('accept' === $action || 'exception' === $action)
|
371 |
&& in_array($code, array('ops_cc', 'ops_directDebit'))
|
@@ -433,142 +456,15 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
433 |
$payment->setAdditionalInformation('additionalScoringData', $additionalScoringData);
|
434 |
}
|
435 |
|
436 |
-
/**
|
437 |
-
* Process cancel action by cancel url
|
438 |
-
*
|
439 |
-
* @param Mage_Sales_Model_Order $order Order
|
440 |
-
* @param string[] $params Request params
|
441 |
-
* @param string $status Order status
|
442 |
-
* @param string $comment Order comment
|
443 |
-
* @throws Exception
|
444 |
-
* @deprecated
|
445 |
-
*/
|
446 |
-
public function cancelOrder($order, $params, $status, $comment)
|
447 |
-
{
|
448 |
-
//@TODO: remove obsolete function
|
449 |
-
|
450 |
-
try {
|
451 |
-
Mage::register('ops_auto_void', true); //Set this session value to true to allow cancel
|
452 |
-
$this->cancelInvoices($order);
|
453 |
-
$order->cancel();
|
454 |
-
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, $status, $comment);
|
455 |
-
$order->save();
|
456 |
-
|
457 |
-
try {
|
458 |
-
$this->setPaymentTransactionInformation($order->getPayment(), $params, 'cancel');
|
459 |
-
} catch (Exception $e) {
|
460 |
-
// just ignore that
|
461 |
-
Mage::helper('ops')->log(
|
462 |
-
'Catched exception while saving payment transaction information of a canceled order: '
|
463 |
-
. $e->getMessage()
|
464 |
-
);
|
465 |
-
}
|
466 |
-
} catch (Exception $e) {
|
467 |
-
$this->_getCheckout()->addError(Mage::helper('ops')->__('Order can not be canceled for system reason.'));
|
468 |
-
throw $e;
|
469 |
-
}
|
470 |
-
}
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Process decline action by ops decline url
|
474 |
-
*
|
475 |
-
* @param Mage_Sales_Model_Order $order Order
|
476 |
-
* @param array $params Request params
|
477 |
-
*/
|
478 |
-
public function declineOrder($order, $params)
|
479 |
-
{
|
480 |
-
//@TODO: remove obsolete function
|
481 |
-
|
482 |
-
try {
|
483 |
-
Mage::register('ops_auto_void', true); //Set this session value to true to allow cancel
|
484 |
-
$this->cancelInvoices($order);
|
485 |
-
$order->cancel();
|
486 |
-
$order->setState(
|
487 |
-
Mage_Sales_Model_Order::STATE_CANCELED,
|
488 |
-
Mage_Sales_Model_Order::STATE_CANCELED,
|
489 |
-
Mage::helper('ops')->__(
|
490 |
-
'Order declined on ops side. Acceptance status: %s, Payment ID: %s.',
|
491 |
-
Mage::helper('ops')->getStatusText($params['STATUS']),
|
492 |
-
$params['PAYID']
|
493 |
-
)
|
494 |
-
);
|
495 |
-
$order->save();
|
496 |
-
|
497 |
-
$this->setPaymentTransactionInformation($order->getPayment(), $params, 'decline');
|
498 |
-
} catch (Exception $e) {
|
499 |
-
$this->_getCheckout()->addError(Mage::helper('ops')->__('Order can not be canceled for system reason.'));
|
500 |
-
throw $e;
|
501 |
-
}
|
502 |
-
}
|
503 |
-
|
504 |
-
/**
|
505 |
-
* Wait for 3D secure confirmation
|
506 |
-
*
|
507 |
-
* @param Mage_Sales_Model_Order $order Order
|
508 |
-
* @param array $params Request params
|
509 |
-
*/
|
510 |
-
public function waitOrder($order, $params)
|
511 |
-
{
|
512 |
-
|
513 |
-
//@TODO: remove obsolete function
|
514 |
-
try {
|
515 |
-
$order->setState(
|
516 |
-
Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW,
|
517 |
-
Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW,
|
518 |
-
Mage::helper('ops')->__(
|
519 |
-
'Order is waiting for Acceptance confirmation of 3D-Secure. Acceptance status: %s, Payment ID: %s.',
|
520 |
-
Mage::helper('ops')->getStatusText($params['STATUS']),
|
521 |
-
$params['PAYID']
|
522 |
-
)
|
523 |
-
);
|
524 |
-
$order->save();
|
525 |
-
$this->setPaymentTransactionInformation($order->getPayment(), $params, 'wait');
|
526 |
-
} catch (Exception $e) {
|
527 |
-
$this->_getCheckout()->addError(
|
528 |
-
Mage::helper('ops')->__('Error during 3D-Secure processing of Acceptance. Error: %s', $e->getMessage())
|
529 |
-
);
|
530 |
-
throw $e;
|
531 |
-
}
|
532 |
-
}
|
533 |
|
534 |
-
/**
|
535 |
-
* Process exception action by ops exception url
|
536 |
-
*
|
537 |
-
* @param Mage_Sales_Model_Order $order Order
|
538 |
-
* @param array $params Request params
|
539 |
-
*/
|
540 |
-
public function handleException($order, $params)
|
541 |
-
{
|
542 |
-
//@TODO: remove obsolete function
|
543 |
-
$exceptionMessage = $this->getPaymentExceptionMessage($params['STATUS']);
|
544 |
|
545 |
-
if (!empty($exceptionMessage)) {
|
546 |
-
try {
|
547 |
-
$this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());
|
548 |
-
$this->_prepareCCInfo($order, $params);
|
549 |
-
$order->getPayment()->setLastTransId($params['PAYID']);
|
550 |
-
//to send new order email only when state is pending payment
|
551 |
-
if (!$order->getEmailSent() != 1
|
552 |
-
&& $order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
|
553 |
-
) {
|
554 |
-
$order->sendNewOrderEmail();
|
555 |
|
556 |
-
}
|
557 |
-
$order->addStatusHistoryComment($exceptionMessage);
|
558 |
-
$order->save();
|
559 |
-
$this->setPaymentTransactionInformation($order->getPayment(), $params, 'exception');
|
560 |
-
} catch (Exception $e) {
|
561 |
-
$this->_getCheckout()->addError(Mage::helper('ops')->__('Order can not be saved for system reason.'));
|
562 |
-
}
|
563 |
-
} else {
|
564 |
-
$this->_getCheckout()->addError(Mage::helper('ops')->__('An unknown exception occured.'));
|
565 |
-
}
|
566 |
-
}
|
567 |
|
568 |
/**
|
569 |
* Get Payment Exception Message
|
570 |
*
|
571 |
-
* @param
|
|
|
572 |
*/
|
573 |
protected function getPaymentExceptionMessage($ops_status)
|
574 |
{
|
@@ -590,122 +486,6 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
590 |
return $exceptionMessage;
|
591 |
}
|
592 |
|
593 |
-
/**
|
594 |
-
* Process Configured Payment Action: Direct Sale, create invoice if state is Pending
|
595 |
-
*
|
596 |
-
* @param Mage_Sales_Model_Order $order Order
|
597 |
-
* @param array $params Request params
|
598 |
-
*/
|
599 |
-
protected function _processDirectSale($order, $params, $instantCapture = 0)
|
600 |
-
{
|
601 |
-
//@TODO: remove obsolete function
|
602 |
-
|
603 |
-
Mage::register('ops_auto_capture', true);
|
604 |
-
$status = $params['STATUS'];
|
605 |
-
if ($status == Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT) {
|
606 |
-
$order->setState(
|
607 |
-
Mage_Sales_Model_Order::STATE_PROCESSING,
|
608 |
-
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
609 |
-
Mage::helper('ops')->__('Waiting for the payment of the customer')
|
610 |
-
);
|
611 |
-
|
612 |
-
// send new order mail for bank transfer, since it is 'successfully' authorized at this point
|
613 |
-
if ($order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_BankTransfer
|
614 |
-
&& $order->getEmailSent() != 1
|
615 |
-
) {
|
616 |
-
$order->sendNewOrderEmail();
|
617 |
-
}
|
618 |
-
|
619 |
-
$order->save();
|
620 |
-
} elseif ($status == Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING) {
|
621 |
-
$order->setState(
|
622 |
-
Mage_Sales_Model_Order::STATE_PROCESSING,
|
623 |
-
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
624 |
-
Mage::helper('ops')->__('Authorization waiting from Acceptance')
|
625 |
-
);
|
626 |
-
$order->save();
|
627 |
-
} elseif (($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
|
628 |
-
|| $instantCapture)
|
629 |
-
&& !$this->isPaypalSpecialStatus($order->getPayment()->getMethodInstance(), $status)
|
630 |
-
) {
|
631 |
-
if ($status == Netresearch_OPS_Model_Status::AUTHORIZED) {
|
632 |
-
if ($order->getStatus() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
633 |
-
$order->setState(
|
634 |
-
Mage_Sales_Model_Order::STATE_PROCESSING,
|
635 |
-
Mage_Sales_Model_Order::STATE_PROCESSING,
|
636 |
-
Mage::helper('ops')->__('Processed by Acceptance')
|
637 |
-
);
|
638 |
-
|
639 |
-
}
|
640 |
-
} else {
|
641 |
-
$order->setState(
|
642 |
-
Mage_Sales_Model_Order::STATE_PROCESSING,
|
643 |
-
true,
|
644 |
-
Mage::helper('ops')->__('Processed by Acceptance')
|
645 |
-
);
|
646 |
-
$order->save();
|
647 |
-
}
|
648 |
-
if (!$order->getInvoiceCollection()->getSize()
|
649 |
-
&& $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
|
650 |
-
&& $order->canInvoice()
|
651 |
-
) {
|
652 |
-
$invoice = $order->prepareInvoice();
|
653 |
-
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
654 |
-
$invoice->register();
|
655 |
-
$invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID);
|
656 |
-
$invoice->getOrder()->setIsInProcess(true);
|
657 |
-
$invoice->save();
|
658 |
-
$this->sendInvoiceToCustomer($invoice);
|
659 |
-
|
660 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
661 |
-
->addObject($invoice)
|
662 |
-
->addObject($invoice->getOrder())
|
663 |
-
->save();
|
664 |
-
|
665 |
-
/*
|
666 |
-
* If the payment method is a redirect-payment-method send the email
|
667 |
-
* In any other case Magento sends an email automatically in Mage_Checkout_Model_Type_Onepage::saveOrder
|
668 |
-
*/
|
669 |
-
if ($this->isRedirectPaymentMethod($order) === true
|
670 |
-
&& $order->getEmailSent() != 1
|
671 |
-
) {
|
672 |
-
$order->sendNewOrderEmail();
|
673 |
-
}
|
674 |
-
$eventData = array('data_object' => $order, 'order' => $order);
|
675 |
-
Mage::dispatchEvent('ops_sales_order_save_commit_after', $eventData);
|
676 |
-
}
|
677 |
-
|
678 |
-
if ($this->isInlinePayment($order->getPayment())
|
679 |
-
&& 0 < strlen(trim($order->getPayment()->getAdditionalInformation('HTML_ANSWER')))
|
680 |
-
&& $order->getPayment()->getAdditionalInformation('status') == Netresearch_OPS_Model_Status::PAYMENT_REQUESTED
|
681 |
-
) {
|
682 |
-
$order->getPayment()->setIsTransactionApproved(true)->registerPaymentReviewAction(
|
683 |
-
Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, true
|
684 |
-
)->save();
|
685 |
-
$this->setInvoicesToPaid($order);
|
686 |
-
$order->getPayment()->getAuthorizationTransaction()->setIsClosed(true)->save();
|
687 |
-
$order->getPayment()->addTransaction(
|
688 |
-
Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $order->getPayment()
|
689 |
-
)->setIsClosed(true)->save();
|
690 |
-
|
691 |
-
if ($order->getEmailSent() != 1) {
|
692 |
-
$order->sendNewOrderEmail();
|
693 |
-
}
|
694 |
-
|
695 |
-
$order->save();
|
696 |
-
}
|
697 |
-
if ($this->isInlinePayment($order->getPayment()) && Mage::getModel('ops/config')->getSendInvoice()
|
698 |
-
&& Mage::getModel('ops/config')->getPaymentAction($order->getStoreId())
|
699 |
-
=== Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE
|
700 |
-
) {
|
701 |
-
foreach ($order->getInvoiceCollection() as $invoice) {
|
702 |
-
$this->sendInvoiceToCustomer($invoice);
|
703 |
-
}
|
704 |
-
}
|
705 |
-
} else {
|
706 |
-
$order->save();
|
707 |
-
}
|
708 |
-
}
|
709 |
|
710 |
/**
|
711 |
* send invoice to customer if that was configured by the merchant
|
@@ -719,7 +499,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
719 |
if (false == $invoice->getEmailSent()
|
720 |
&& $this->getConfig()->getSendInvoice()
|
721 |
) {
|
722 |
-
$invoice->sendEmail(
|
723 |
}
|
724 |
}
|
725 |
|
@@ -806,20 +586,20 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
806 |
/**
|
807 |
* Fetches transaction with given transaction id
|
808 |
*
|
809 |
-
* @param string $
|
810 |
*
|
811 |
* @return mixed Mage_Sales_Model_Order_Payment_Transaction | boolean
|
812 |
*/
|
813 |
public function getTransactionByTransactionId($transactionId)
|
814 |
{
|
815 |
if (!$transactionId) {
|
816 |
-
return;
|
817 |
}
|
818 |
$transaction = Mage::getModel('sales/order_payment_transaction')
|
819 |
->getCollection()
|
820 |
->addAttributeToFilter('txn_id', $transactionId)
|
821 |
->getLastItem();
|
822 |
-
if (
|
823 |
return false;
|
824 |
}
|
825 |
$transaction->getOrderPaymentObject();
|
@@ -839,7 +619,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
839 |
// add items
|
840 |
$cart = Mage::getSingleton('checkout/cart');
|
841 |
|
842 |
-
if (0 < $cart->getQuote()->getItemsCollection()->
|
843 |
//cart is not empty, so refilling it is not required
|
844 |
return;
|
845 |
}
|
@@ -855,7 +635,7 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
855 |
// add coupon code
|
856 |
$coupon = $order->getCouponCode();
|
857 |
$session = Mage::getSingleton('checkout/session');
|
858 |
-
if (
|
859 |
$session->getQuote()->setCouponCode($coupon)->save();
|
860 |
}
|
861 |
}
|
@@ -878,19 +658,21 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
878 |
/**
|
879 |
* Check is payment method is a redirect method
|
880 |
*
|
881 |
-
* @param
|
|
|
882 |
*/
|
883 |
protected function isRedirectPaymentMethod($order)
|
884 |
{
|
|
|
885 |
$method = $order->getPayment()->getMethodInstance();
|
886 |
if ($method
|
887 |
-
&& $method->getOrderPlaceRedirectUrl() != '' //Magento returns ''
|
888 |
-
&& $method->getOrderPlaceRedirectUrl() !== false
|
889 |
-
) {
|
890 |
-
|
891 |
-
} else {
|
892 |
-
return false;
|
893 |
}
|
|
|
|
|
894 |
}
|
895 |
|
896 |
public function getQuote()
|
@@ -933,11 +715,11 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
933 |
*/
|
934 |
public function getBaseGrandTotalFromSalesObject($salesObject)
|
935 |
{
|
936 |
-
if ($salesObject instanceof Mage_Sales_Model_Order
|
937 |
-
return $salesObject->getBaseGrandTotal();
|
938 |
-
} else {
|
939 |
Mage::throwException('$salesObject is not a quote or an order instance');
|
940 |
}
|
|
|
|
|
941 |
}
|
942 |
|
943 |
|
@@ -1107,8 +889,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
1107 |
{
|
1108 |
return $this->isInlinePayment($payment)
|
1109 |
&& (0 === strlen(
|
1110 |
-
|
1111 |
-
|
1112 |
}
|
1113 |
|
1114 |
/**
|
@@ -1124,8 +906,8 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
1124 |
foreach ($order->getInvoiceCollection() as $invoice) {
|
1125 |
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
1126 |
$invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID);
|
1127 |
-
$invoice->save();
|
1128 |
}
|
|
|
1129 |
|
1130 |
return $this;
|
1131 |
}
|
@@ -1171,4 +953,17 @@ class Netresearch_OPS_Helper_Payment extends Mage_Core_Helper_Abstract
|
|
1171 |
);
|
1172 |
}
|
1173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1174 |
}
|
71 |
* Check hash crypted by SHA1 with existing data
|
72 |
*
|
73 |
* @param array $data
|
74 |
+
* @param string $hashFromOPS
|
75 |
* @param string $key
|
76 |
*
|
77 |
* @return bool
|
97 |
}
|
98 |
}
|
99 |
|
100 |
+
protected function compareHashes($hashFromOPS, $actual)
|
101 |
{
|
102 |
$helper = Mage::helper('ops');
|
103 |
$helper->log(
|
120 |
/**
|
121 |
* Return set of data which is ready for SHA crypt
|
122 |
*
|
123 |
+
* @param array $params
|
124 |
+
* @param string $SHAkey
|
125 |
*
|
126 |
* @return string
|
127 |
*/
|
130 |
$params = $this->prepareParamsAndSort($params);
|
131 |
$plainHashString = "";
|
132 |
foreach ($params as $paramSet):
|
133 |
+
if ($paramSet['value'] == '' || $paramSet['key'] == 'SHASIGN' || is_array($paramSet['value'])) {
|
134 |
continue;
|
135 |
}
|
136 |
$plainHashString .= strtoupper($paramSet['key']) . "=" . $paramSet['value'] . $SHAkey;
|
177 |
*/
|
178 |
public function getSHASign($formFields, $shaCode = null, $storeId = null)
|
179 |
{
|
180 |
+
if (null === $shaCode) {
|
181 |
$shaCode = Mage::getModel('ops/config')->getShaOutCode($storeId);
|
182 |
}
|
183 |
$formFields = array_change_key_case($formFields, CASE_UPPER);
|
184 |
uksort($formFields, 'strnatcasecmp');
|
185 |
$plainHashString = '';
|
186 |
foreach ($formFields as $formKey => $formVal) {
|
187 |
+
if (null === $formVal || '' === $formVal || $formKey == 'SHASIGN') {
|
188 |
continue;
|
189 |
}
|
190 |
$plainHashString .= strtoupper($formKey) . '=' . $formVal . $shaCode;
|
193 |
return $plainHashString;
|
194 |
}
|
195 |
|
196 |
+
/**
|
197 |
+
* @param int $opsOrderId
|
198 |
+
* @param int $storeId
|
199 |
+
*
|
200 |
+
* @return array
|
201 |
+
*/
|
202 |
+
public function validateOrderForReuse($opsOrderId, $storeId)
|
203 |
+
{
|
204 |
+
|
205 |
+
return array(
|
206 |
+
'orderID' => $opsOrderId,
|
207 |
+
'SHASIGN' => strtoupper(
|
208 |
+
$this->shaCrypt(
|
209 |
+
$this->getSHAInSet(
|
210 |
+
array('orderId' => $opsOrderId),
|
211 |
+
$this->getConfig()->getShaOutCode($storeId)
|
212 |
+
)
|
213 |
+
)
|
214 |
+
),
|
215 |
+
);
|
216 |
+
}
|
217 |
+
|
218 |
/**
|
219 |
* We get some CC info from ops, so we must save it
|
220 |
*
|
221 |
* @param Mage_Sales_Model_Order $order
|
222 |
* @param array $ccInfo
|
223 |
*
|
224 |
+
* @return $this
|
225 |
*/
|
226 |
public function _prepareCCInfo($order, $ccInfo)
|
227 |
{
|
309 |
case Netresearch_OPS_Model_Status::AUTHORIZED:
|
310 |
case Netresearch_OPS_Model_Status::AUTHORIZED_WAITING_EXTERNAL_RESULT:
|
311 |
case Netresearch_OPS_Model_Status::AUTHORIZATION_WAITING:
|
|
|
312 |
case Netresearch_OPS_Model_Status::WAITING_CLIENT_PAYMENT:
|
313 |
$feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_ACCEPT;
|
314 |
break;
|
319 |
break;
|
320 |
case Netresearch_OPS_Model_Status::AUTHORISATION_DECLINED:
|
321 |
case Netresearch_OPS_Model_Status::PAYMENT_REFUSED:
|
|
|
322 |
$feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_DECLINE;
|
323 |
break;
|
324 |
case Netresearch_OPS_Model_Status::CANCELED_BY_CUSTOMER:
|
326 |
break;
|
327 |
default:
|
328 |
//all unknown transaction will accept as exceptional
|
|
|
329 |
$feedbackStatus = Netresearch_OPS_Model_Status_Feedback::OPS_ORDER_FEEDBACK_STATUS_EXCEPTION;
|
330 |
}
|
331 |
|
335 |
/**
|
336 |
* Process success action by accept url
|
337 |
*
|
338 |
+
*
|
339 |
+
* @param $order
|
340 |
+
* @param $params
|
341 |
+
* @param int $instantCapture
|
342 |
+
* @throws Exception
|
343 |
*/
|
344 |
public function acceptOrder($order, $params, $instantCapture = 0)
|
345 |
{
|
387 |
* so capture or cancel won't work. So we need to create a new authorization transaction for them
|
388 |
* when a payment was accepted by Acceptance
|
389 |
*
|
390 |
+
* In exception-case we create the authorization-transaction too
|
391 |
+
* because some exception-cases can turn into accepted
|
392 |
*/
|
393 |
if (('accept' === $action || 'exception' === $action)
|
394 |
&& in_array($code, array('ops_cc', 'ops_directDebit'))
|
456 |
$payment->setAdditionalInformation('additionalScoringData', $additionalScoringData);
|
457 |
}
|
458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
|
463 |
/**
|
464 |
* Get Payment Exception Message
|
465 |
*
|
466 |
+
* @param $ops_status
|
467 |
+
* @return string
|
468 |
*/
|
469 |
protected function getPaymentExceptionMessage($ops_status)
|
470 |
{
|
486 |
return $exceptionMessage;
|
487 |
}
|
488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
|
490 |
/**
|
491 |
* send invoice to customer if that was configured by the merchant
|
499 |
if (false == $invoice->getEmailSent()
|
500 |
&& $this->getConfig()->getSendInvoice()
|
501 |
) {
|
502 |
+
$invoice->sendEmail(true);
|
503 |
}
|
504 |
}
|
505 |
|
586 |
/**
|
587 |
* Fetches transaction with given transaction id
|
588 |
*
|
589 |
+
* @param string $transactionId
|
590 |
*
|
591 |
* @return mixed Mage_Sales_Model_Order_Payment_Transaction | boolean
|
592 |
*/
|
593 |
public function getTransactionByTransactionId($transactionId)
|
594 |
{
|
595 |
if (!$transactionId) {
|
596 |
+
return false;
|
597 |
}
|
598 |
$transaction = Mage::getModel('sales/order_payment_transaction')
|
599 |
->getCollection()
|
600 |
->addAttributeToFilter('txn_id', $transactionId)
|
601 |
->getLastItem();
|
602 |
+
if (null === $transaction->getId()) {
|
603 |
return false;
|
604 |
}
|
605 |
$transaction->getOrderPaymentObject();
|
619 |
// add items
|
620 |
$cart = Mage::getSingleton('checkout/cart');
|
621 |
|
622 |
+
if (0 < $cart->getQuote()->getItemsCollection()->getSize()) {
|
623 |
//cart is not empty, so refilling it is not required
|
624 |
return;
|
625 |
}
|
635 |
// add coupon code
|
636 |
$coupon = $order->getCouponCode();
|
637 |
$session = Mage::getSingleton('checkout/session');
|
638 |
+
if (null != $coupon) {
|
639 |
$session->getQuote()->setCouponCode($coupon)->save();
|
640 |
}
|
641 |
}
|
658 |
/**
|
659 |
* Check is payment method is a redirect method
|
660 |
*
|
661 |
+
* @param $order
|
662 |
+
* @return bool
|
663 |
*/
|
664 |
protected function isRedirectPaymentMethod($order)
|
665 |
{
|
666 |
+
$result = false;
|
667 |
$method = $order->getPayment()->getMethodInstance();
|
668 |
if ($method
|
669 |
+
&& $method->getOrderPlaceRedirectUrl() != '' // Magento returns ''
|
670 |
+
&& $method->getOrderPlaceRedirectUrl() !== false // Ops returns false
|
671 |
+
) {
|
672 |
+
$result = true;
|
|
|
|
|
673 |
}
|
674 |
+
|
675 |
+
return $result;
|
676 |
}
|
677 |
|
678 |
public function getQuote()
|
715 |
*/
|
716 |
public function getBaseGrandTotalFromSalesObject($salesObject)
|
717 |
{
|
718 |
+
if (!($salesObject instanceof Mage_Sales_Model_Order || $salesObject instanceof Mage_Sales_Model_Quote)) {
|
|
|
|
|
719 |
Mage::throwException('$salesObject is not a quote or an order instance');
|
720 |
}
|
721 |
+
|
722 |
+
return $salesObject->getBaseGrandTotal();
|
723 |
}
|
724 |
|
725 |
|
889 |
{
|
890 |
return $this->isInlinePayment($payment)
|
891 |
&& (0 === strlen(
|
892 |
+
trim($payment->getMethodInstance()->getConfigPaymentAction())
|
893 |
+
));
|
894 |
}
|
895 |
|
896 |
/**
|
906 |
foreach ($order->getInvoiceCollection() as $invoice) {
|
907 |
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
908 |
$invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID);
|
|
|
909 |
}
|
910 |
+
$order->getInvoiceCollection()->save();
|
911 |
|
912 |
return $this;
|
913 |
}
|
953 |
);
|
954 |
}
|
955 |
|
956 |
+
/**
|
957 |
+
* @param $paymentCode
|
958 |
+
*
|
959 |
+
* @return string
|
960 |
+
*/
|
961 |
+
public function getPaymentDefaultLogo($paymentCode)
|
962 |
+
{
|
963 |
+
return Mage::getSingleton('core/design_package')->getSkinUrl(
|
964 |
+
'images/ops/logos/' . $paymentCode . '.png',
|
965 |
+
array('_area' => 'frontend')
|
966 |
+
);
|
967 |
+
}
|
968 |
+
|
969 |
}
|
app/code/community/Netresearch/OPS/Helper/Payment/DirectLink/Request.php
CHANGED
@@ -162,7 +162,8 @@ abstract class Netresearch_OPS_Helper_Payment_DirectLink_Request
|
|
162 |
|
163 |
|
164 |
/**
|
165 |
-
* extracts the parameter for the direct link request from the quote,
|
|
|
166 |
*
|
167 |
* @param Mage_Sales_Model_Quote $quote
|
168 |
* @param Mage_Sales_Model_Order $order
|
@@ -170,7 +171,8 @@ abstract class Netresearch_OPS_Helper_Payment_DirectLink_Request
|
|
170 |
*
|
171 |
* @return array - the parameters for the direct link request
|
172 |
*/
|
173 |
-
public function getDirectLinkRequestParams(
|
|
|
174 |
{
|
175 |
$billingAddress = $order->getBillingAddress();
|
176 |
$shippingAddress = $this->getShippingAddress($order, $billingAddress);
|
@@ -262,8 +264,9 @@ abstract class Netresearch_OPS_Helper_Payment_DirectLink_Request
|
|
262 |
{
|
263 |
if ($this->getDataHelper()->isAdminSession()) {
|
264 |
$requestParams['ECI'] = Netresearch_OPS_Model_Eci_Values::MANUALLY_KEYED_FROM_MOTO;
|
265 |
-
$requestParams['REMOTE_ADDR'] = 'NONE'
|
266 |
}
|
|
|
267 |
return $requestParams;
|
268 |
}
|
269 |
|
162 |
|
163 |
|
164 |
/**
|
165 |
+
* extracts the parameter for the direct link request from the quote,
|
166 |
+
* order and, optionally from existing request params
|
167 |
*
|
168 |
* @param Mage_Sales_Model_Quote $quote
|
169 |
* @param Mage_Sales_Model_Order $order
|
171 |
*
|
172 |
* @return array - the parameters for the direct link request
|
173 |
*/
|
174 |
+
public function getDirectLinkRequestParams(
|
175 |
+
Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order, $requestParams = array())
|
176 |
{
|
177 |
$billingAddress = $order->getBillingAddress();
|
178 |
$shippingAddress = $this->getShippingAddress($order, $billingAddress);
|
264 |
{
|
265 |
if ($this->getDataHelper()->isAdminSession()) {
|
266 |
$requestParams['ECI'] = Netresearch_OPS_Model_Eci_Values::MANUALLY_KEYED_FROM_MOTO;
|
267 |
+
$requestParams['REMOTE_ADDR'] = 'NONE';
|
268 |
}
|
269 |
+
|
270 |
return $requestParams;
|
271 |
}
|
272 |
|
app/code/community/Netresearch/OPS/Helper/Payment/Request.php
CHANGED
@@ -51,19 +51,23 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
51 |
$address = $salesObject->getBillingAddress();
|
52 |
}
|
53 |
|
54 |
-
if(!$address){
|
55 |
return $paramValues;
|
56 |
}
|
57 |
}
|
58 |
|
59 |
-
$
|
60 |
-
$
|
61 |
-
|
62 |
-
$paramValues['
|
63 |
-
$paramValues['
|
64 |
-
$paramValues['
|
65 |
-
$paramValues['
|
66 |
-
$paramValues['
|
|
|
|
|
|
|
|
|
67 |
|
68 |
return $paramValues;
|
69 |
}
|
@@ -81,24 +85,28 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
81 |
$paramValues = array();
|
82 |
|
83 |
if (!$address instanceof Mage_Customer_Model_Address_Abstract) {
|
84 |
-
if(!is_null($salesObject)) {
|
85 |
$address = $salesObject->getBillingAddress();
|
86 |
}
|
87 |
-
if(!$address){
|
88 |
return $paramValues;
|
89 |
}
|
90 |
}
|
91 |
|
92 |
-
$
|
93 |
-
$
|
94 |
-
|
95 |
-
$paramValues['
|
96 |
-
$paramValues['
|
97 |
-
$paramValues['
|
98 |
-
$paramValues['
|
99 |
-
$paramValues['
|
100 |
-
$paramValues['
|
101 |
-
$paramValues['
|
|
|
|
|
|
|
|
|
102 |
|
103 |
return $paramValues;
|
104 |
}
|
@@ -106,9 +114,9 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
106 |
/**
|
107 |
* extraxcts the according Acceptance owner* parameter
|
108 |
*
|
109 |
-
* @param Mage_Customer_Model_Address_Abstract
|
110 |
*
|
111 |
-
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order
|
112 |
*
|
113 |
* @return string[]
|
114 |
*/
|
@@ -117,11 +125,11 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
117 |
$ownerParams = array();
|
118 |
if ($this->getConfig()->canSubmitExtraParameter($salesObject->getStoreId())) {
|
119 |
$ownerParams = array(
|
120 |
-
'OWNERADDRESS'
|
121 |
-
'OWNERTOWN'
|
122 |
-
'OWNERZIP'
|
123 |
-
'OWNERTELNO'
|
124 |
-
'OWNERCTY'
|
125 |
|
126 |
'ECOM_BILLTO_POSTAL_POSTALCODE' => $billingAddress->getPostcode(),
|
127 |
);
|
@@ -141,7 +149,7 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
141 |
$formFields = array();
|
142 |
switch ($this->getConfig()->getConfigData('template')) {
|
143 |
case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL:
|
144 |
-
$formFields['TP'] = $this->getConfig()->getPayPageTemplate(
|
145 |
break;
|
146 |
case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE:
|
147 |
$formFields['TP'] = $this->getConfig()->getTemplateIdentifier($storeId);
|
@@ -159,8 +167,12 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
159 |
$formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor', $storeId);
|
160 |
$formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype', $storeId);
|
161 |
$formFields['LOGO'] = $this->getConfig()->getConfigData('logo', $storeId);
|
162 |
-
$formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(
|
163 |
-
|
|
|
|
|
|
|
|
|
164 |
break;
|
165 |
default:
|
166 |
break;
|
@@ -240,7 +252,7 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
240 |
return $this->getRegionsMappingForLatvia();
|
241 |
}
|
242 |
|
243 |
-
return array()
|
244 |
}
|
245 |
|
246 |
/**
|
@@ -491,21 +503,25 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
491 |
|
492 |
public function getMandatoryRequestFields(Mage_Sales_Model_Order $order)
|
493 |
{
|
494 |
-
$payment
|
495 |
-
$
|
496 |
-
$formFields
|
497 |
-
$formFields['
|
|
|
498 |
$formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();
|
499 |
-
$formFields['ORDERID']
|
500 |
$formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();
|
501 |
-
$formFields['PM']
|
502 |
-
$formFields['EMAIL']
|
503 |
|
504 |
-
$formFields['ACCEPTURL']
|
505 |
-
$formFields['DECLINEURL']
|
506 |
$formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
|
507 |
-
$formFields['CANCELURL']
|
508 |
-
|
|
|
|
|
|
|
509 |
|
510 |
$formFields['FP_ACTIV'] = $this->isFingerPrintingActive($order) ? '1' : '0';
|
511 |
|
@@ -522,49 +538,71 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
522 |
protected function isFingerPrintingActive($order)
|
523 |
{
|
524 |
return $this->getConfig()->getDeviceFingerPrinting($order->getStoreId())
|
525 |
-
&& Mage::getSingleton('customer/session')->getData(
|
|
|
|
|
526 |
}
|
527 |
|
528 |
/**
|
529 |
* Extracts the order item parameters and puts them in a array like
|
530 |
*
|
531 |
-
* @param Mage_Sales_Model_Order $
|
532 |
*
|
533 |
-
* @return
|
534 |
*/
|
535 |
-
public function extractOrderItemParameters(
|
536 |
{
|
537 |
$formFields = array();
|
538 |
-
|
539 |
// add order items
|
540 |
$count = 1;
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
) {
|
546 |
continue;
|
547 |
}
|
548 |
-
|
|
|
|
|
549 |
$count++;
|
550 |
}
|
551 |
|
552 |
// add discount item
|
553 |
-
|
554 |
-
|
555 |
-
|
|
|
556 |
$count++;
|
557 |
}
|
558 |
|
559 |
// add shipping item
|
560 |
-
$shippingItemFields
|
561 |
-
|
562 |
-
|
|
|
563 |
}
|
564 |
|
565 |
return $formFields;
|
566 |
}
|
567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
/**
|
569 |
* @param Mage_Sales_Model_Order $order
|
570 |
*
|
@@ -586,19 +624,41 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
586 |
/**
|
587 |
* Genereates item array for shipping, returns false if order is virtual
|
588 |
*
|
589 |
-
* @param Mage_Sales_Model_Order $
|
|
|
590 |
*
|
591 |
-
* @return
|
592 |
*/
|
593 |
-
protected function getShippingItemFormFields($
|
594 |
{
|
595 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
/* add shipping item */
|
597 |
-
$formFields['
|
598 |
-
$formFields['
|
599 |
-
$formFields['
|
600 |
-
|
601 |
-
$formFields['
|
|
|
|
|
602 |
return $formFields;
|
603 |
}
|
604 |
|
@@ -608,20 +668,25 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
608 |
/**
|
609 |
* Returns item array for Acceptance request for the specified item
|
610 |
*
|
611 |
-
* @param $
|
612 |
-
* @param $
|
613 |
*
|
614 |
* @return array
|
615 |
*/
|
616 |
-
protected function getItemFormFields($
|
617 |
{
|
618 |
$formFields = array();
|
619 |
-
$formFields['ITEMID'
|
620 |
-
$formFields['ITEMNAME'
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
|
|
|
|
|
|
|
|
|
|
625 |
|
626 |
return $formFields;
|
627 |
}
|
@@ -629,31 +694,45 @@ class Netresearch_OPS_Helper_Payment_Request
|
|
629 |
/**
|
630 |
* Creates array
|
631 |
*
|
632 |
-
* @param
|
633 |
-
* @param
|
634 |
*
|
635 |
-
* @return mixed
|
636 |
*/
|
637 |
-
protected function getDiscountItemFormFields(
|
638 |
{
|
639 |
$formFields = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
/* add coupon item */
|
641 |
-
if ($
|
642 |
-
$couponAmount = $order->getBaseDiscountAmount();
|
643 |
-
$formFields['ITEMID' . $count] = 'DISCOUNT';
|
644 |
$couponRuleName = 'DISCOUNT';
|
645 |
if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
|
646 |
$couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
|
647 |
}
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
= str_replace(',', '.', (string)(float)$this->getShippingTaxRate($order)) . '%';
|
653 |
-
$formFields['TAXINCLUDED'
|
|
|
654 |
return $formFields;
|
655 |
|
656 |
}
|
|
|
657 |
return false;
|
658 |
}
|
659 |
-
}
|
51 |
$address = $salesObject->getBillingAddress();
|
52 |
}
|
53 |
|
54 |
+
if (!$address) {
|
55 |
return $paramValues;
|
56 |
}
|
57 |
}
|
58 |
|
59 |
+
$shippingStreet = str_replace("\n", ' ', $address->getStreet(-1));
|
60 |
+
$splittedShippingStreet = Mage::Helper('ops/address')->splitStreet($shippingStreet);
|
61 |
+
|
62 |
+
$paramValues['ECOM_SHIPTO_POSTAL_CITY'] = $address->getCity();
|
63 |
+
$paramValues['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $address->getPostcode();
|
64 |
+
$paramValues['ECOM_SHIPTO_POSTAL_STATE'] = $this->getIsoRegionCode($address);
|
65 |
+
$paramValues['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $address->getCountry();
|
66 |
+
$paramValues['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $address->getFirstname();
|
67 |
+
$paramValues['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $address->getLastname();
|
68 |
+
$paramValues['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $splittedShippingStreet['street_name'];
|
69 |
+
$paramValues['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = $splittedShippingStreet['street_number'];
|
70 |
+
$paramValues['ECOM_SHIPTO_POSTAL_STREET_LINE2'] = $splittedShippingStreet['supplement'];
|
71 |
|
72 |
return $paramValues;
|
73 |
}
|
85 |
$paramValues = array();
|
86 |
|
87 |
if (!$address instanceof Mage_Customer_Model_Address_Abstract) {
|
88 |
+
if (!is_null($salesObject)) {
|
89 |
$address = $salesObject->getBillingAddress();
|
90 |
}
|
91 |
+
if (!$address) {
|
92 |
return $paramValues;
|
93 |
}
|
94 |
}
|
95 |
|
96 |
+
$billingStreet = str_replace("\n", ' ', $address->getStreet(-1));
|
97 |
+
$splittedBillingStreet = Mage::Helper('ops/address')->splitStreet($billingStreet);
|
98 |
+
|
99 |
+
$paramValues['ECOM_BILLTO_POSTAL_CITY'] = $address->getCity();
|
100 |
+
$paramValues['ECOM_BILLTO_POSTAL_POSTALCODE'] = $address->getPostcode();
|
101 |
+
$paramValues['ECOM_BILLTO_POSTAL_COUNTY'] = $this->getIsoRegionCode($address);
|
102 |
+
$paramValues['ECOM_BILLTO_POSTAL_COUNTRYCODE'] = $address->getCountry();
|
103 |
+
$paramValues['ECOM_BILLTO_POSTAL_NAME_FIRST'] = $address->getFirstname();
|
104 |
+
$paramValues['ECOM_BILLTO_POSTAL_NAME_LAST'] = $address->getLastname();
|
105 |
+
$paramValues['ECOM_BILLTO_POSTAL_POSTALCODE'] = $address->getPostcode();
|
106 |
+
$paramValues['ECOM_BILLTO_POSTAL_STREET_LINE1'] = $splittedBillingStreet['street_name'];
|
107 |
+
$paramValues['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = $splittedBillingStreet['street_number'];
|
108 |
+
$paramValues['ECOM_BILLTO_POSTAL_STREET_LINE2'] = $splittedBillingStreet['supplement'];
|
109 |
+
$paramValues['ECOM_BILLTO_POSTAL_STREET_LINE3'] = $address->getStreet(3);
|
110 |
|
111 |
return $paramValues;
|
112 |
}
|
114 |
/**
|
115 |
* extraxcts the according Acceptance owner* parameter
|
116 |
*
|
117 |
+
* @param Mage_Customer_Model_Address_Abstract $billingAddress
|
118 |
*
|
119 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $salesObject
|
120 |
*
|
121 |
* @return string[]
|
122 |
*/
|
125 |
$ownerParams = array();
|
126 |
if ($this->getConfig()->canSubmitExtraParameter($salesObject->getStoreId())) {
|
127 |
$ownerParams = array(
|
128 |
+
'OWNERADDRESS' => str_replace("\n", ' ', $billingAddress->getStreet(1)),
|
129 |
+
'OWNERTOWN' => $billingAddress->getCity(),
|
130 |
+
'OWNERZIP' => $billingAddress->getPostcode(),
|
131 |
+
'OWNERTELNO' => $billingAddress->getTelephone(),
|
132 |
+
'OWNERCTY' => $billingAddress->getCountry(),
|
133 |
|
134 |
'ECOM_BILLTO_POSTAL_POSTALCODE' => $billingAddress->getPostcode(),
|
135 |
);
|
149 |
$formFields = array();
|
150 |
switch ($this->getConfig()->getConfigData('template')) {
|
151 |
case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_MAGENTO_INTERNAL:
|
152 |
+
$formFields['TP'] = $this->getConfig()->getPayPageTemplate();
|
153 |
break;
|
154 |
case Netresearch_OPS_Model_Payment_Abstract::TEMPLATE_OPS_TEMPLATE:
|
155 |
$formFields['TP'] = $this->getConfig()->getTemplateIdentifier($storeId);
|
167 |
$formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor', $storeId);
|
168 |
$formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype', $storeId);
|
169 |
$formFields['LOGO'] = $this->getConfig()->getConfigData('logo', $storeId);
|
170 |
+
$formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(
|
171 |
+
array('redirect' => 'home')
|
172 |
+
) : 'NONE';
|
173 |
+
$formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(
|
174 |
+
array('redirect' => 'catalog')
|
175 |
+
) : '';
|
176 |
break;
|
177 |
default:
|
178 |
break;
|
252 |
return $this->getRegionsMappingForLatvia();
|
253 |
}
|
254 |
|
255 |
+
return array();
|
256 |
}
|
257 |
|
258 |
/**
|
503 |
|
504 |
public function getMandatoryRequestFields(Mage_Sales_Model_Order $order)
|
505 |
{
|
506 |
+
$payment = $order->getPayment()->getMethodInstance();
|
507 |
+
$opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
|
508 |
+
$formFields = array();
|
509 |
+
$formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());
|
510 |
+
$formFields['AMOUNT'] = Mage::helper('ops')->getAmount($order->getBaseGrandTotal());
|
511 |
$formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();
|
512 |
+
$formFields['ORDERID'] = $opsOrderId;
|
513 |
$formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();
|
514 |
+
$formFields['PM'] = $payment->getOpsCode($order->getPayment());
|
515 |
+
$formFields['EMAIL'] = $order->getCustomerEmail();
|
516 |
|
517 |
+
$formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();
|
518 |
+
$formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();
|
519 |
$formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
|
520 |
+
$formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();
|
521 |
+
|
522 |
+
$formFields['BACKURL'] = $this->getConfig()->getPaymentRetryUrl(
|
523 |
+
Mage::helper('ops/payment')->validateOrderForReuse($opsOrderId, $order->getStoreId())
|
524 |
+
);
|
525 |
|
526 |
$formFields['FP_ACTIV'] = $this->isFingerPrintingActive($order) ? '1' : '0';
|
527 |
|
538 |
protected function isFingerPrintingActive($order)
|
539 |
{
|
540 |
return $this->getConfig()->getDeviceFingerPrinting($order->getStoreId())
|
541 |
+
&& Mage::getSingleton('customer/session')->getData(
|
542 |
+
Netresearch_OPS_Model_Payment_Abstract::FINGERPRINT_CONSENT_SESSION_KEY
|
543 |
+
);
|
544 |
}
|
545 |
|
546 |
/**
|
547 |
* Extracts the order item parameters and puts them in a array like
|
548 |
*
|
549 |
+
* @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice $salesObject
|
550 |
*
|
551 |
+
* @return mixed[]
|
552 |
*/
|
553 |
+
public function extractOrderItemParameters($salesObject)
|
554 |
{
|
555 |
$formFields = array();
|
556 |
+
$formatAmounts = $salesObject instanceof Mage_Sales_Model_Order_Invoice;
|
557 |
// add order items
|
558 |
$count = 1;
|
559 |
+
$addItemCount = function (&$value, $key, $count) use (&$formFields) {
|
560 |
+
$formFields[$key . $count] = $value;
|
561 |
+
};
|
562 |
+
foreach ($salesObject->getAllItems() as $item) {
|
563 |
+
if ($this->isNonDataItem($item)) {
|
564 |
continue;
|
565 |
}
|
566 |
+
|
567 |
+
$itemFields = $this->getItemFormFields($item, $formatAmounts);
|
568 |
+
array_walk($itemFields, $addItemCount, $count);
|
569 |
$count++;
|
570 |
}
|
571 |
|
572 |
// add discount item
|
573 |
+
/** @var mixed|false $discountItemFormFields */
|
574 |
+
$discountItemFormFields = $this->getDiscountItemFormFields($salesObject, $formatAmounts);
|
575 |
+
if ($discountItemFormFields) {
|
576 |
+
array_walk($discountItemFormFields, $addItemCount, $count);
|
577 |
$count++;
|
578 |
}
|
579 |
|
580 |
// add shipping item
|
581 |
+
/** @var mixed|false $shippingItemFields */
|
582 |
+
$shippingItemFields = $this->getShippingItemFormFields($salesObject, $formatAmounts);
|
583 |
+
if ($shippingItemFields) {
|
584 |
+
array_walk($shippingItemFields, $addItemCount, $count);
|
585 |
}
|
586 |
|
587 |
return $formFields;
|
588 |
}
|
589 |
|
590 |
+
/**
|
591 |
+
* @param Mage_Sales_Model_Order_Item|Mage_Sales_Model_Order_Invoice_Item $item
|
592 |
+
*
|
593 |
+
* @return bool
|
594 |
+
*/
|
595 |
+
protected function isNonDataItem($item)
|
596 |
+
{
|
597 |
+
if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
|
598 |
+
$item = $item->getOrderItem();
|
599 |
+
}
|
600 |
+
|
601 |
+
return $item->getParentItemId()
|
602 |
+
&& $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
|
603 |
+
|| $item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE;
|
604 |
+
}
|
605 |
+
|
606 |
/**
|
607 |
* @param Mage_Sales_Model_Order $order
|
608 |
*
|
624 |
/**
|
625 |
* Genereates item array for shipping, returns false if order is virtual
|
626 |
*
|
627 |
+
* @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice $salesObject
|
628 |
+
* @param bool $formatAmount
|
629 |
*
|
630 |
+
* @return mixed[] | false
|
631 |
*/
|
632 |
+
protected function getShippingItemFormFields($salesObject, $formatAmount = false)
|
633 |
{
|
634 |
+
|
635 |
+
if ($salesObject instanceof Mage_Sales_Model_Order_Invoice) {
|
636 |
+
/** @var Mage_Sales_Model_Order_Invoice $salesObject */
|
637 |
+
$order = $salesObject->getOrder();
|
638 |
+
} else {
|
639 |
+
/** @var Mage_Sales_Model_Order $salesObject */
|
640 |
+
$order = $salesObject;
|
641 |
+
}
|
642 |
+
/** @var string $taxRate */
|
643 |
+
$taxRate = str_replace(',', '.', (string)(float)$this->getShippingTaxRate($order)) . '%';
|
644 |
+
|
645 |
+
if ($order->getIsNotVirtual() && 0 < $salesObject->getBaseShippingInclTax()) {
|
646 |
+
$formFields = array();
|
647 |
+
|
648 |
+
if ($formatAmount) {
|
649 |
+
$amount = Mage::helper('ops')->getAmount($salesObject->getBaseShippingInclTax());
|
650 |
+
} else {
|
651 |
+
$amount = number_format($salesObject->getBaseShippingInclTax(), 2, '.', '');
|
652 |
+
}
|
653 |
+
|
654 |
/* add shipping item */
|
655 |
+
$formFields['ITEMID'] = 'SHIPPING';
|
656 |
+
$formFields['ITEMNAME'] = substr($order->getShippingDescription(), 0, 25);
|
657 |
+
$formFields['ITEMPRICE'] = $amount;
|
658 |
+
$formFields['TAXINCLUDED'] = 1;
|
659 |
+
$formFields['ITEMQUANT'] = 1;
|
660 |
+
$formFields['ITEMVATCODE'] = $taxRate;
|
661 |
+
|
662 |
return $formFields;
|
663 |
}
|
664 |
|
668 |
/**
|
669 |
* Returns item array for Acceptance request for the specified item
|
670 |
*
|
671 |
+
* @param Mage_Sales_Model_Order_Invoice_Item|Mage_Sales_Model_Order_Item $item
|
672 |
+
* @param bool $formatAmount
|
673 |
*
|
674 |
* @return array
|
675 |
*/
|
676 |
+
protected function getItemFormFields($item, $formatAmount = false)
|
677 |
{
|
678 |
$formFields = array();
|
679 |
+
$formFields['ITEMID'] = $item->getItemId() ?: $item->getOrderItemId();
|
680 |
+
$formFields['ITEMNAME'] = substr($item->getName(), 0, 40);
|
681 |
+
if ($formatAmount) {
|
682 |
+
$amount = Mage::helper('ops')->getAmount($item->getBasePriceInclTax());
|
683 |
+
} else {
|
684 |
+
$amount = number_format($item->getBasePriceInclTax(), 2, '.', '');
|
685 |
+
}
|
686 |
+
$formFields['ITEMPRICE'] = $amount;
|
687 |
+
$formFields['ITEMQUANT'] = (int)$item->getQtyOrdered() ?: $item->getQty();
|
688 |
+
$formFields['ITEMVATCODE'] = str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
|
689 |
+
$formFields['TAXINCLUDED'] = 1;
|
690 |
|
691 |
return $formFields;
|
692 |
}
|
694 |
/**
|
695 |
* Creates array
|
696 |
*
|
697 |
+
* @param Mage_Sales_Model_Abstract $salesObject
|
698 |
+
* @param bool $formatAmount
|
699 |
*
|
700 |
+
* @return bool|mixed[]
|
701 |
*/
|
702 |
+
protected function getDiscountItemFormFields(Mage_Sales_Model_Abstract $salesObject, $formatAmount = false)
|
703 |
{
|
704 |
$formFields = array();
|
705 |
+
if ($salesObject instanceof Mage_Sales_Model_Order_Invoice) {
|
706 |
+
$order = $salesObject->getOrder();
|
707 |
+
} else {
|
708 |
+
$order = $salesObject;
|
709 |
+
}
|
710 |
+
/** @var Mage_Sales_Model_Order $order */
|
711 |
/* add coupon item */
|
712 |
+
if ($salesObject->getBaseDiscountAmount() != 0.00) {
|
|
|
|
|
713 |
$couponRuleName = 'DISCOUNT';
|
714 |
if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
|
715 |
$couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
|
716 |
}
|
717 |
+
|
718 |
+
if ($formatAmount) {
|
719 |
+
$couponAmount = Mage::helper('ops')->getAmount($salesObject->getBaseDiscountAmount());
|
720 |
+
} else {
|
721 |
+
$couponAmount = number_format($salesObject->getBaseDiscountAmount(), 2, '.', '');
|
722 |
+
}
|
723 |
+
|
724 |
+
$formFields['ITEMID'] = 'DISCOUNT';
|
725 |
+
$formFields['ITEMNAME'] = $couponRuleName;
|
726 |
+
$formFields['ITEMPRICE'] = $couponAmount;
|
727 |
+
$formFields['ITEMQUANT'] = 1;
|
728 |
+
$formFields['ITEMVATCODE']
|
729 |
= str_replace(',', '.', (string)(float)$this->getShippingTaxRate($order)) . '%';
|
730 |
+
$formFields['TAXINCLUDED'] = 1;
|
731 |
+
|
732 |
return $formFields;
|
733 |
|
734 |
}
|
735 |
+
|
736 |
return false;
|
737 |
}
|
738 |
+
}
|
app/code/community/Netresearch/OPS/Helper/Quote.php
CHANGED
@@ -22,9 +22,11 @@ class Netresearch_OPS_Helper_Quote extends Mage_Core_Helper_Abstract
|
|
22 |
*/
|
23 |
public function cleanUpOldPaymentInformation()
|
24 |
{
|
25 |
-
$allowedTimestamp = new Zend_Db_Expr(
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
/*
|
29 |
* fetching possible affected information from the sales_quote_payment table
|
30 |
* criteria are:
|
@@ -42,7 +44,7 @@ class Netresearch_OPS_Helper_Quote extends Mage_Core_Helper_Abstract
|
|
42 |
->setOrder('created_at', 'DESC')
|
43 |
->setPageSize(self::PAGE_SIZE);
|
44 |
foreach ($paymentInformation as $payment) {
|
45 |
-
if (
|
46 |
// quote needs to be loaded, because saving the payment information would fail otherwise
|
47 |
$payment->setQuote(
|
48 |
Mage::getModel('sales/quote')->load($payment->getQuoteId())
|
22 |
*/
|
23 |
public function cleanUpOldPaymentInformation()
|
24 |
{
|
25 |
+
$allowedTimestamp = new Zend_Db_Expr(
|
26 |
+
sprintf(
|
27 |
+
'NOW() - INTERVAL %d MINUTE', self::MINUTES_IN_PAST
|
28 |
+
)
|
29 |
+
);
|
30 |
/*
|
31 |
* fetching possible affected information from the sales_quote_payment table
|
32 |
* criteria are:
|
44 |
->setOrder('created_at', 'DESC')
|
45 |
->setPageSize(self::PAGE_SIZE);
|
46 |
foreach ($paymentInformation as $payment) {
|
47 |
+
if (null != $payment->getAdditionalInformation('cvc')) {
|
48 |
// quote needs to be loaded, because saving the payment information would fail otherwise
|
49 |
$payment->setQuote(
|
50 |
Mage::getModel('sales/quote')->load($payment->getQuoteId())
|
app/code/community/Netresearch/OPS/Helper/Subscription.php
CHANGED
@@ -37,7 +37,7 @@ class Netresearch_OPS_Helper_Subscription extends Mage_Core_Helper_Abstract
|
|
37 |
* SUB-subscriptionId-TRIAL
|
38 |
*
|
39 |
* @param Mage_Payment_Model_Recurring_Profile $profile - the profile itself
|
40 |
-
* @param bool
|
41 |
*
|
42 |
* @return string
|
43 |
*/
|
37 |
* SUB-subscriptionId-TRIAL
|
38 |
*
|
39 |
* @param Mage_Payment_Model_Recurring_Profile $profile - the profile itself
|
40 |
+
* @param bool $withTrial - if you wish the trial suffix appended in case the profile has a trial subscription
|
41 |
*
|
42 |
* @return string
|
43 |
*/
|
app/code/community/Netresearch/OPS/Helper/Validation/Checkout/Step.php
CHANGED
@@ -13,43 +13,51 @@ class Netresearch_OPS_Helper_Validation_Checkout_Step
|
|
13 |
|
14 |
const SHIPPING_STEP = 'shipping';
|
15 |
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* retrieves the params for pushing back to the billing step
|
18 |
*
|
19 |
* @return array
|
20 |
*/
|
21 |
-
protected function
|
22 |
{
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
* @return array
|
37 |
-
*/
|
38 |
-
protected function getShippingParams()
|
39 |
{
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -62,16 +70,29 @@ class Netresearch_OPS_Helper_Validation_Checkout_Step
|
|
62 |
public function getStep(array $erroneousFields)
|
63 |
{
|
64 |
$checkoutStep = '';
|
|
|
65 |
foreach ($erroneousFields as $erroneousField) {
|
66 |
-
if (
|
|
|
|
|
67 |
$checkoutStep = self::BILLING_STEP;
|
68 |
break;
|
69 |
}
|
70 |
-
if (
|
|
|
|
|
71 |
$checkoutStep = self::SHIPPING_STEP;
|
72 |
}
|
73 |
}
|
74 |
|
75 |
return $checkoutStep;
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
13 |
|
14 |
const SHIPPING_STEP = 'shipping';
|
15 |
|
16 |
+
const BILLING_PARAMETER_STRING_VALUE = 'billing';
|
17 |
+
|
18 |
+
const SHIPPING_PARAMETER_STRING_VALUE = 'shipping';
|
19 |
+
|
20 |
/**
|
21 |
* retrieves the params for pushing back to the billing step
|
22 |
*
|
23 |
* @return array
|
24 |
*/
|
25 |
+
protected function determineStep()
|
26 |
{
|
27 |
+
$result = array();
|
28 |
+
$mappedParams = $this->getMappedParams();
|
29 |
+
|
30 |
+
foreach ($mappedParams as $paramName => $value) {
|
31 |
+
if (strpos($value, self::BILLING_PARAMETER_STRING_VALUE) === 0) {
|
32 |
+
$result[self::BILLING_PARAMETER_STRING_VALUE][] = $paramName;
|
33 |
+
}
|
34 |
+
if (strpos($value, self::SHIPPING_PARAMETER_STRING_VALUE) === 0) {
|
35 |
+
$result[self::SHIPPING_STEP][] = $paramName;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
return $result;
|
40 |
}
|
41 |
|
42 |
+
|
43 |
+
protected function getMappedParams()
|
|
|
|
|
|
|
|
|
44 |
{
|
45 |
+
$result = array();
|
46 |
+
$paramLengthFields = $this->getConfig()->getParameterLengths();
|
47 |
+
$frontendFieldMapping = $this->getConfig()->getFrontendFieldMapping();
|
48 |
+
|
49 |
+
foreach (array_keys($paramLengthFields) as $key) {
|
50 |
+
if (isset($frontendFieldMapping[$key])) {
|
51 |
+
$frontendField = !is_array($frontendFieldMapping[$key])
|
52 |
+
? $frontendFieldMapping[$key]
|
53 |
+
: implode(
|
54 |
+
',', $frontendFieldMapping[$key]
|
55 |
+
);
|
56 |
+
$result[$key] = $frontendField;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
return $result;
|
61 |
}
|
62 |
|
63 |
/**
|
70 |
public function getStep(array $erroneousFields)
|
71 |
{
|
72 |
$checkoutStep = '';
|
73 |
+
$stepParams = $this->determineStep();
|
74 |
foreach ($erroneousFields as $erroneousField) {
|
75 |
+
if (isset($stepParams[self::BILLING_STEP])
|
76 |
+
&& in_array($erroneousField, $stepParams[self::BILLING_STEP])
|
77 |
+
) {
|
78 |
$checkoutStep = self::BILLING_STEP;
|
79 |
break;
|
80 |
}
|
81 |
+
if (isset($stepParams[self::SHIPPING_STEP])
|
82 |
+
&& in_array($erroneousField, $stepParams[self::SHIPPING_STEP])
|
83 |
+
) {
|
84 |
$checkoutStep = self::SHIPPING_STEP;
|
85 |
}
|
86 |
}
|
87 |
|
88 |
return $checkoutStep;
|
89 |
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* @return Netresearch_OPS_Model_Config
|
93 |
+
*/
|
94 |
+
protected function getConfig()
|
95 |
+
{
|
96 |
+
return Mage::getModel('ops/config');
|
97 |
+
}
|
98 |
}
|
app/code/community/Netresearch/OPS/Helper/Validation/Result.php
CHANGED
@@ -107,7 +107,7 @@ class Netresearch_OPS_Helper_Validation_Result
|
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
-
* @return
|
111 |
*/
|
112 |
public function getFormBlock()
|
113 |
{
|
@@ -139,7 +139,6 @@ class Netresearch_OPS_Helper_Validation_Result
|
|
139 |
|
140 |
/**
|
141 |
* @param $messages
|
142 |
-
* @param $result
|
143 |
*
|
144 |
* @return mixed
|
145 |
*/
|
@@ -163,8 +162,10 @@ class Netresearch_OPS_Helper_Validation_Result
|
|
163 |
}
|
164 |
|
165 |
/**
|
166 |
-
* @param $quote
|
167 |
-
* @param $gotoSection
|
|
|
|
|
168 |
*/
|
169 |
protected function addErrorToExistingAddress($quote, $gotoSection)
|
170 |
{
|
@@ -183,9 +184,8 @@ class Netresearch_OPS_Helper_Validation_Result
|
|
183 |
}
|
184 |
|
185 |
/**
|
186 |
-
* @param $messages
|
187 |
-
* @param $
|
188 |
-
* @param $gotoSection
|
189 |
*
|
190 |
* @return mixed
|
191 |
*/
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
+
* @return Netresearch_OPS_Block_Form
|
111 |
*/
|
112 |
public function getFormBlock()
|
113 |
{
|
139 |
|
140 |
/**
|
141 |
* @param $messages
|
|
|
142 |
*
|
143 |
* @return mixed
|
144 |
*/
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
+
* @param Mage_Sales_Model_Quote $quote
|
166 |
+
* @param string $gotoSection
|
167 |
+
*
|
168 |
+
* @return $this
|
169 |
*/
|
170 |
protected function addErrorToExistingAddress($quote, $gotoSection)
|
171 |
{
|
184 |
}
|
185 |
|
186 |
/**
|
187 |
+
* @param string[] $messages
|
188 |
+
* @param string $gotoSection
|
|
|
189 |
*
|
190 |
* @return mixed
|
191 |
*/
|
app/code/community/Netresearch/OPS/Model/Alias.php
CHANGED
@@ -44,19 +44,25 @@ class Netresearch_OPS_Model_Alias extends Mage_Core_Model_Abstract
|
|
44 |
/**
|
45 |
* @param $customerId - the id of the customer
|
46 |
* @param $billingAddressHash - optional billing address hash
|
47 |
-
* @param $
|
|
|
|
|
48 |
* @return Netresearch_OPS_Model_Mysql4_Alias_Collection - collection of aliases for given customer
|
49 |
*/
|
50 |
-
public function getAliasesForCustomer(
|
|
|
|
|
|
|
|
|
|
|
51 |
{
|
52 |
$collection = $this->getCollection()
|
53 |
->addFieldToFilter('customer_id', $customerId);
|
54 |
-
if (
|
55 |
$collection
|
56 |
->addFieldToFilter('billing_address_hash', $billingAddressHash)
|
57 |
->addFieldToFilter('shipping_address_hash', $shippingAddressHash)
|
58 |
-
->addFieldToFilter('store_id', array('eq' => $storeId, 'null' => 'null'))
|
59 |
-
;
|
60 |
}
|
61 |
return $collection->load();
|
62 |
}
|
44 |
/**
|
45 |
* @param $customerId - the id of the customer
|
46 |
* @param $billingAddressHash - optional billing address hash
|
47 |
+
* @param $shippingAddressHash - optional shipping address hash
|
48 |
+
* @param $storeId
|
49 |
+
*
|
50 |
* @return Netresearch_OPS_Model_Mysql4_Alias_Collection - collection of aliases for given customer
|
51 |
*/
|
52 |
+
public function getAliasesForCustomer(
|
53 |
+
$customerId,
|
54 |
+
$billingAddressHash = null,
|
55 |
+
$shippingAddressHash = null,
|
56 |
+
$storeId = null
|
57 |
+
)
|
58 |
{
|
59 |
$collection = $this->getCollection()
|
60 |
->addFieldToFilter('customer_id', $customerId);
|
61 |
+
if (null != $billingAddressHash && null != $shippingAddressHash) {
|
62 |
$collection
|
63 |
->addFieldToFilter('billing_address_hash', $billingAddressHash)
|
64 |
->addFieldToFilter('shipping_address_hash', $shippingAddressHash)
|
65 |
+
->addFieldToFilter('store_id', array('eq' => $storeId, 'null' => 'null'));
|
|
|
66 |
}
|
67 |
return $collection->load();
|
68 |
}
|
app/code/community/Netresearch/OPS/Model/Api/Directlink.php
CHANGED
@@ -36,6 +36,8 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
|
|
36 |
* Perform a CURL call and log request end response to logfile
|
37 |
*
|
38 |
* @param array $params
|
|
|
|
|
39 |
* @return mixed
|
40 |
*/
|
41 |
public function call($params, $url)
|
@@ -47,36 +49,47 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
|
|
47 |
$http->write(Zend_Http_Client::POST, $url, '1.1', array(), http_build_query($params));
|
48 |
$response = $http->read();
|
49 |
$response = substr($response, strpos($response, "<?xml"), strlen($response));
|
50 |
-
|
51 |
-
return $response;
|
52 |
-
} catch (Exception $e) {
|
53 |
Mage::logException($e);
|
54 |
Mage::throwException(
|
55 |
Mage::helper('ops')->__('Acceptance server is temporarily not available, please try again later.')
|
56 |
);
|
57 |
-
|
|
|
|
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
* Performs a POST request to the Direct Link Gateway with the given
|
62 |
* parameters and returns the result parameters as array
|
63 |
*
|
64 |
-
* @param array $
|
|
|
|
|
|
|
65 |
* @return array
|
66 |
*/
|
67 |
public function performRequest($requestParams, $url, $storeId = 0)
|
68 |
{
|
69 |
$helper = Mage::helper('ops');
|
70 |
$params = $this->getEncodedParametersWithHash(
|
71 |
-
array_merge(
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
73 |
$responseParams = $this->getResponseParams($params, $url);
|
74 |
-
$helper->log(
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
80 |
|
81 |
$this->checkResponse($responseParams);
|
82 |
|
@@ -122,7 +135,8 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
|
|
122 |
} elseif (array_key_exists('PAYID', $params)) {
|
123 |
$ref = $params['PAYID'];
|
124 |
}
|
125 |
-
Mage::helper('ops')->log(
|
|
|
126 |
$e->getMessage() . ' current retry count: ' . $retryCount . ' for quote ' . $ref
|
127 |
);
|
128 |
$responseParams = $this->getResponseParams($params, $url, ++$retryCount);
|
@@ -137,6 +151,8 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
|
|
137 |
/**
|
138 |
* Return Authentication Params for OPS Call
|
139 |
*
|
|
|
|
|
140 |
* @return array
|
141 |
*/
|
142 |
protected function buildAuthenticationParams($storeId = 0)
|
@@ -148,11 +164,12 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
|
|
148 |
);
|
149 |
}
|
150 |
|
151 |
-
|
152 |
* Parses the XML-String to an array with the result data
|
153 |
*
|
154 |
-
* @param
|
155 |
-
* @return
|
|
|
156 |
*/
|
157 |
public function getParamArrFromXmlString($xmlString)
|
158 |
{
|
@@ -171,16 +188,19 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
|
|
171 |
throw $e;
|
172 |
}
|
173 |
}
|
174 |
-
|
175 |
-
|
176 |
* Check if the Response from OPS reports Errors
|
177 |
*
|
178 |
-
* @param
|
179 |
-
* @return mixed
|
180 |
*/
|
181 |
public function checkResponse($responseParams)
|
182 |
{
|
183 |
-
if (false === is_array($responseParams)
|
|
|
|
|
|
|
|
|
184 |
if (empty($responseParams['NCERRORPLUS'])) {
|
185 |
$responseParams['NCERRORPLUS'] = Mage::helper('ops')->__('Invalid payment information')." Errorcode:".$responseParams['NCERROR'];
|
186 |
}
|
@@ -191,7 +211,7 @@ class Netresearch_OPS_Model_Api_DirectLink extends Mage_Core_Model_Abstract
|
|
191 |
}
|
192 |
|
193 |
Mage::throwException(
|
194 |
-
Mage::helper('ops')->__("An error occured during the Acceptance request. Your action could not be executed. Message: '%s.'"
|
195 |
);
|
196 |
}
|
197 |
}
|
36 |
* Perform a CURL call and log request end response to logfile
|
37 |
*
|
38 |
* @param array $params
|
39 |
+
* @param string $url
|
40 |
+
*
|
41 |
* @return mixed
|
42 |
*/
|
43 |
public function call($params, $url)
|
49 |
$http->write(Zend_Http_Client::POST, $url, '1.1', array(), http_build_query($params));
|
50 |
$response = $http->read();
|
51 |
$response = substr($response, strpos($response, "<?xml"), strlen($response));
|
52 |
+
} catch (Exception $e) {
|
|
|
|
|
53 |
Mage::logException($e);
|
54 |
Mage::throwException(
|
55 |
Mage::helper('ops')->__('Acceptance server is temporarily not available, please try again later.')
|
56 |
);
|
57 |
+
}
|
58 |
+
|
59 |
+
return $response;
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
* Performs a POST request to the Direct Link Gateway with the given
|
64 |
* parameters and returns the result parameters as array
|
65 |
*
|
66 |
+
* @param array $requestParams
|
67 |
+
* @param string $url
|
68 |
+
* @param int $storeId
|
69 |
+
*
|
70 |
* @return array
|
71 |
*/
|
72 |
public function performRequest($requestParams, $url, $storeId = 0)
|
73 |
{
|
74 |
$helper = Mage::helper('ops');
|
75 |
$params = $this->getEncodedParametersWithHash(
|
76 |
+
array_merge(
|
77 |
+
$requestParams,
|
78 |
+
$this->buildAuthenticationParams($storeId)
|
79 |
+
),//Merge Logic Operation Data with Authentication Data
|
80 |
+
null,
|
81 |
+
$storeId
|
82 |
+
);
|
83 |
$responseParams = $this->getResponseParams($params, $url);
|
84 |
+
$helper->log(
|
85 |
+
$helper->__(
|
86 |
+
"Direct Link Request/Response in Acceptance \n\nRequest: %s\nResponse: %s\nMagento-URL: %s\nAPI-URL: %s",
|
87 |
+
serialize($params),
|
88 |
+
serialize($responseParams),
|
89 |
+
Mage::helper('core/url')->getCurrentUrl(),
|
90 |
+
$url
|
91 |
+
)
|
92 |
+
);
|
93 |
|
94 |
$this->checkResponse($responseParams);
|
95 |
|
135 |
} elseif (array_key_exists('PAYID', $params)) {
|
136 |
$ref = $params['PAYID'];
|
137 |
}
|
138 |
+
Mage::helper('ops')->log(
|
139 |
+
'DirectLink::getResponseParams failed: ' .
|
140 |
$e->getMessage() . ' current retry count: ' . $retryCount . ' for quote ' . $ref
|
141 |
);
|
142 |
$responseParams = $this->getResponseParams($params, $url, ++$retryCount);
|
151 |
/**
|
152 |
* Return Authentication Params for OPS Call
|
153 |
*
|
154 |
+
* @param int $storeId
|
155 |
+
*
|
156 |
* @return array
|
157 |
*/
|
158 |
protected function buildAuthenticationParams($storeId = 0)
|
164 |
);
|
165 |
}
|
166 |
|
167 |
+
/**
|
168 |
* Parses the XML-String to an array with the result data
|
169 |
*
|
170 |
+
* @param $xmlString
|
171 |
+
* @return mixed
|
172 |
+
* @throws Exception
|
173 |
*/
|
174 |
public function getParamArrFromXmlString($xmlString)
|
175 |
{
|
188 |
throw $e;
|
189 |
}
|
190 |
}
|
191 |
+
|
192 |
+
/**
|
193 |
* Check if the Response from OPS reports Errors
|
194 |
*
|
195 |
+
* @param $responseParams
|
|
|
196 |
*/
|
197 |
public function checkResponse($responseParams)
|
198 |
{
|
199 |
+
if (false === is_array($responseParams)
|
200 |
+
|| false === array_key_exists('NCERROR', $responseParams)
|
201 |
+
|| $responseParams['NCERROR'] > 0
|
202 |
+
)
|
203 |
+
{
|
204 |
if (empty($responseParams['NCERRORPLUS'])) {
|
205 |
$responseParams['NCERRORPLUS'] = Mage::helper('ops')->__('Invalid payment information')." Errorcode:".$responseParams['NCERROR'];
|
206 |
}
|
211 |
}
|
212 |
|
213 |
Mage::throwException(
|
214 |
+
Mage::helper('ops')->__("An error occured during the Acceptance request. Your action could not be executed. Message: '%s.'", $responseParams['NCERRORPLUS'])
|
215 |
);
|
216 |
}
|
217 |
}
|
app/code/community/Netresearch/OPS/Model/Backend/Operation/Capture/Parameter.php
CHANGED
@@ -20,7 +20,8 @@ class Netresearch_OPS_Model_Backend_Operation_Capture_Parameter
|
|
20 |
{
|
21 |
$opsPaymentMethodClass = get_class($opsPaymentMethod);
|
22 |
$opsPmsRequiringSpecialParams = $this->getOpsConfig()
|
23 |
-
->getMethodsRequiringAdditionalParametersFor(
|
|
|
24 |
);
|
25 |
|
26 |
return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
|
@@ -33,7 +34,7 @@ class Netresearch_OPS_Model_Backend_Operation_Capture_Parameter
|
|
33 |
*/
|
34 |
protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
|
35 |
{
|
36 |
-
if ($opsPaymentMethod instanceof
|
37 |
$this->additionalParamsModel = Mage::getModel('ops/backend_operation_capture_additional_openInvoiceNl');
|
38 |
}
|
39 |
}
|
20 |
{
|
21 |
$opsPaymentMethodClass = get_class($opsPaymentMethod);
|
22 |
$opsPmsRequiringSpecialParams = $this->getOpsConfig()
|
23 |
+
->getMethodsRequiringAdditionalParametersFor(
|
24 |
+
Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE
|
25 |
);
|
26 |
|
27 |
return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
|
34 |
*/
|
35 |
protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
|
36 |
{
|
37 |
+
if ($opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_OpenInvoice_Abstract) {
|
38 |
$this->additionalParamsModel = Mage::getModel('ops/backend_operation_capture_additional_openInvoiceNl');
|
39 |
}
|
40 |
}
|
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter.php
CHANGED
@@ -19,7 +19,6 @@ class Netresearch_OPS_Model_Backend_Operation_Parameter
|
|
19 |
* @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
|
20 |
* @param Varien_Object $payment
|
21 |
* @param $amount
|
22 |
-
* @param $arrInfo
|
23 |
*
|
24 |
* @return array
|
25 |
*/
|
@@ -28,7 +27,8 @@ class Netresearch_OPS_Model_Backend_Operation_Parameter
|
|
28 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
29 |
Varien_Object $payment,
|
30 |
$amount
|
31 |
-
)
|
|
|
32 |
return $this->getParameterModel($operation)->getRequestParams($opsPaymentMethod, $payment, $amount);
|
33 |
}
|
34 |
|
@@ -46,7 +46,7 @@ class Netresearch_OPS_Model_Backend_Operation_Parameter
|
|
46 |
if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
|
47 |
return Mage::getModel('ops/backend_operation_capture_parameter');
|
48 |
}
|
49 |
-
if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE){
|
50 |
return Mage::getModel('ops/backend_operation_refund_parameter');
|
51 |
}
|
52 |
|
19 |
* @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
|
20 |
* @param Varien_Object $payment
|
21 |
* @param $amount
|
|
|
22 |
*
|
23 |
* @return array
|
24 |
*/
|
27 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
28 |
Varien_Object $payment,
|
29 |
$amount
|
30 |
+
)
|
31 |
+
{
|
32 |
return $this->getParameterModel($operation)->getRequestParams($opsPaymentMethod, $payment, $amount);
|
33 |
}
|
34 |
|
46 |
if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE) {
|
47 |
return Mage::getModel('ops/backend_operation_capture_parameter');
|
48 |
}
|
49 |
+
if ($operation === Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE) {
|
50 |
return Mage::getModel('ops/backend_operation_refund_parameter');
|
51 |
}
|
52 |
|
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Abstract.php
CHANGED
@@ -27,8 +27,9 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
|
|
27 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
28 |
Varien_Object $payment,
|
29 |
$amount
|
30 |
-
)
|
31 |
-
|
|
|
32 |
$this->addPmSpecificParams($opsPaymentMethod, $payment, $amount);
|
33 |
|
34 |
return $this->requestParams;
|
@@ -40,7 +41,6 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
|
|
40 |
* @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
|
41 |
* @param Varien_Object $payment
|
42 |
* @param $amount
|
43 |
-
* @param $arrInfo
|
44 |
*
|
45 |
* @return $this
|
46 |
*/
|
@@ -48,11 +48,12 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
|
|
48 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
49 |
Varien_Object $payment,
|
50 |
$amount
|
51 |
-
)
|
52 |
-
|
53 |
-
$this->requestParams['
|
|
|
54 |
$this->requestParams['OPERATION'] = $this->getOrderHelper()->determineOperationCode($payment, $amount);
|
55 |
-
$this->requestParams['CURRENCY']
|
56 |
->getBaseCurrencyCode();
|
57 |
|
58 |
return $this;
|
@@ -83,13 +84,14 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Abstract
|
|
83 |
*/
|
84 |
protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
85 |
Varien_Object $payment, $amount
|
86 |
-
)
|
|
|
87 |
if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
|
88 |
$this->setAdditionalParamsModelFor($opsPaymentMethod);
|
89 |
if ($this->additionalParamsModel instanceof
|
90 |
Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
91 |
) {
|
92 |
-
$params = $this->additionalParamsModel->extractAdditionalParams($payment
|
93 |
$this->requestParams = array_merge($this->requestParams, $params);
|
94 |
}
|
95 |
}
|
27 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
28 |
Varien_Object $payment,
|
29 |
$amount
|
30 |
+
)
|
31 |
+
{
|
32 |
+
$this->getBaseParams($opsPaymentMethod, $payment, $amount);
|
33 |
$this->addPmSpecificParams($opsPaymentMethod, $payment, $amount);
|
34 |
|
35 |
return $this->requestParams;
|
41 |
* @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
|
42 |
* @param Varien_Object $payment
|
43 |
* @param $amount
|
|
|
44 |
*
|
45 |
* @return $this
|
46 |
*/
|
48 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
49 |
Varien_Object $payment,
|
50 |
$amount
|
51 |
+
)
|
52 |
+
{
|
53 |
+
$this->requestParams['AMOUNT'] = $this->getDataHelper()->getAmount($amount);
|
54 |
+
$this->requestParams['PAYID'] = $payment->getAdditionalInformation('paymentId');
|
55 |
$this->requestParams['OPERATION'] = $this->getOrderHelper()->determineOperationCode($payment, $amount);
|
56 |
+
$this->requestParams['CURRENCY'] = Mage::app()->getStore($payment->getOrder()->getStoreId())
|
57 |
->getBaseCurrencyCode();
|
58 |
|
59 |
return $this;
|
84 |
*/
|
85 |
protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
86 |
Varien_Object $payment, $amount
|
87 |
+
)
|
88 |
+
{
|
89 |
if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
|
90 |
$this->setAdditionalParamsModelFor($opsPaymentMethod);
|
91 |
if ($this->additionalParamsModel instanceof
|
92 |
Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
93 |
) {
|
94 |
+
$params = $this->additionalParamsModel->extractAdditionalParams($payment);
|
95 |
$this->requestParams = array_merge($this->requestParams, $params);
|
96 |
}
|
97 |
}
|
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/Interface.php
CHANGED
@@ -7,5 +7,5 @@
|
|
7 |
*/
|
8 |
interface Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
9 |
{
|
10 |
-
public function extractAdditionalParams(
|
11 |
}
|
7 |
*/
|
8 |
interface Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
9 |
{
|
10 |
+
public function extractAdditionalParams(Mage_Sales_Model_Order_Payment $payment);
|
11 |
}
|
app/code/community/Netresearch/OPS/Model/Backend/Operation/Parameter/Additional/OpenInvoiceNlAbstract.php
CHANGED
@@ -6,65 +6,68 @@
|
|
6 |
* @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
*/
|
9 |
-
|
10 |
abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
|
11 |
implements Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
12 |
{
|
13 |
-
protected $
|
14 |
-
protected $
|
15 |
-
protected $
|
16 |
|
17 |
|
18 |
/**
|
19 |
-
* @param
|
20 |
*
|
21 |
* @return array
|
22 |
*/
|
23 |
-
public function extractAdditionalParams(
|
24 |
{
|
|
|
25 |
if ($itemContainer instanceof Mage_Sales_Model_Order_Invoice) {
|
26 |
-
$
|
27 |
-
$this->
|
28 |
-
$this->extractFromInvoicedShippingMethod($itemContainer);
|
29 |
}
|
30 |
|
31 |
-
return $this->
|
32 |
}
|
33 |
|
34 |
/**
|
|
|
|
|
35 |
* extracts all necessary data from the invoice items
|
36 |
*
|
37 |
* @param Mage_Sales_Model_Order_Invoice $invoice
|
|
|
|
|
38 |
*/
|
39 |
protected function extractFromInvoiceItems(Mage_Sales_Model_Order_Invoice $invoice)
|
40 |
{
|
41 |
foreach ($invoice->getItemsCollection() as $item) {
|
42 |
/** @var $item Mage_Sales_Model_Order_Invoice_Item */
|
43 |
// filter out configurable products
|
44 |
-
if ($item
|
45 |
-
&& $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
|
46 |
-
|| $item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
47 |
continue;
|
48 |
}
|
49 |
-
$this->
|
50 |
-
$this->
|
51 |
-
$this->
|
52 |
-
|
53 |
);
|
54 |
-
$this->
|
55 |
-
$this->
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
++$this->itemIdx;
|
60 |
}
|
61 |
|
62 |
return $this;
|
63 |
}
|
64 |
|
|
|
65 |
/**
|
66 |
* extract the necessary data from the shipping data of the invoice
|
67 |
*
|
|
|
|
|
68 |
* @param Mage_Sales_Model_Order_Invoice $invoice
|
69 |
*
|
70 |
* @return $this
|
@@ -73,14 +76,14 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
|
|
73 |
{
|
74 |
$amount = $invoice->getBaseShippingInclTax();
|
75 |
if (0 < $amount) {
|
76 |
-
$this->
|
77 |
-
$this->
|
78 |
-
substr($invoice->getOrder()->getShippingDescription(), 0, 30);
|
79 |
-
$this->
|
80 |
-
$this->
|
81 |
-
$this->
|
82 |
-
$this->
|
83 |
-
++$this->
|
84 |
}
|
85 |
|
86 |
|
@@ -88,6 +91,8 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
|
|
88 |
}
|
89 |
|
90 |
/**
|
|
|
|
|
91 |
* retrieves used shipping tax rate
|
92 |
*
|
93 |
* @param Mage_Sales_Model_Order_Invoice $invoice
|
@@ -96,8 +101,8 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
|
|
96 |
*/
|
97 |
protected function getShippingTaxRate(Mage_Sales_Model_Order_Invoice $invoice)
|
98 |
{
|
99 |
-
$taxRate
|
100 |
-
$order
|
101 |
|
102 |
$taxRate = (floatval(Mage::helper('ops/payment_request')->getShippingTaxRate($order)));
|
103 |
|
@@ -112,33 +117,35 @@ abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Open
|
|
112 |
*/
|
113 |
protected function getOpsDataHelper()
|
114 |
{
|
115 |
-
if (null === $this->
|
116 |
-
$this->
|
117 |
}
|
118 |
|
119 |
-
return $this->
|
120 |
}
|
121 |
|
122 |
|
123 |
/**
|
124 |
-
* @
|
|
|
|
|
125 |
*/
|
126 |
protected function extractFromDiscountData($invoice)
|
127 |
{
|
128 |
$amount = $invoice->getBaseDiscountAmount();
|
129 |
if (0 > $amount) {
|
130 |
$couponRuleName = 'DISCOUNT';
|
131 |
-
$order
|
132 |
if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
|
133 |
$couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
|
134 |
}
|
135 |
-
$this->
|
136 |
-
$this->
|
137 |
-
$this->
|
138 |
-
$this->
|
139 |
-
$this->
|
140 |
-
$this->
|
141 |
-
++$this->
|
142 |
}
|
143 |
}
|
144 |
}
|
6 |
* @copyright Copyright (c) 2014 Netresearch GmbH & Co. KG (http://www.netresearch.de)
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
*/
|
|
|
9 |
abstract class Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
|
10 |
implements Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
11 |
{
|
12 |
+
protected $_additionalParams = array();
|
13 |
+
protected $_opsDataHelper = null;
|
14 |
+
protected $_itemIdx = 1;
|
15 |
|
16 |
|
17 |
/**
|
18 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
19 |
*
|
20 |
* @return array
|
21 |
*/
|
22 |
+
public function extractAdditionalParams(Mage_Sales_Model_Order_Payment $payment)
|
23 |
{
|
24 |
+
$itemContainer = $payment->getInvoice();
|
25 |
if ($itemContainer instanceof Mage_Sales_Model_Order_Invoice) {
|
26 |
+
$requestHelper = Mage::helper('ops/payment_request');
|
27 |
+
$this->_additionalParams = $requestHelper->extractOrderItemParameters($itemContainer);
|
|
|
28 |
}
|
29 |
|
30 |
+
return $this->_additionalParams;
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
+
* @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
|
35 |
+
*
|
36 |
* extracts all necessary data from the invoice items
|
37 |
*
|
38 |
* @param Mage_Sales_Model_Order_Invoice $invoice
|
39 |
+
*
|
40 |
+
* @return Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
41 |
*/
|
42 |
protected function extractFromInvoiceItems(Mage_Sales_Model_Order_Invoice $invoice)
|
43 |
{
|
44 |
foreach ($invoice->getItemsCollection() as $item) {
|
45 |
/** @var $item Mage_Sales_Model_Order_Invoice_Item */
|
46 |
// filter out configurable products
|
47 |
+
if (!$this->isDataItem($item)) {
|
|
|
|
|
48 |
continue;
|
49 |
}
|
50 |
+
$this->_additionalParams['ITEMID' . $this->_itemIdx] = substr($item->getOrderItemId(), 0, 15);
|
51 |
+
$this->_additionalParams['ITEMNAME' . $this->_itemIdx] = substr($item->getName(), 0, 30);
|
52 |
+
$this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount(
|
53 |
+
$item->getBasePriceInclTax()
|
54 |
);
|
55 |
+
$this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = $item->getQty();
|
56 |
+
$this->_additionalParams['ITEMVATCODE' . $this->_itemIdx]
|
57 |
+
= str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
|
58 |
+
$this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
|
59 |
+
++$this->_itemIdx;
|
|
|
60 |
}
|
61 |
|
62 |
return $this;
|
63 |
}
|
64 |
|
65 |
+
|
66 |
/**
|
67 |
* extract the necessary data from the shipping data of the invoice
|
68 |
*
|
69 |
+
* @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
|
70 |
+
*
|
71 |
* @param Mage_Sales_Model_Order_Invoice $invoice
|
72 |
*
|
73 |
* @return $this
|
76 |
{
|
77 |
$amount = $invoice->getBaseShippingInclTax();
|
78 |
if (0 < $amount) {
|
79 |
+
$this->_additionalParams['ITEMID' . $this->_itemIdx] = 'SHIPPING';
|
80 |
+
$this->_additionalParams['ITEMNAME' . $this->_itemIdx]
|
81 |
+
= substr($invoice->getOrder()->getShippingDescription(), 0, 30);
|
82 |
+
$this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount($amount);
|
83 |
+
$this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
|
84 |
+
$this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
|
85 |
+
$this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
|
86 |
+
++$this->_itemIdx;
|
87 |
}
|
88 |
|
89 |
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
+
* @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
|
95 |
+
*
|
96 |
* retrieves used shipping tax rate
|
97 |
*
|
98 |
* @param Mage_Sales_Model_Order_Invoice $invoice
|
101 |
*/
|
102 |
protected function getShippingTaxRate(Mage_Sales_Model_Order_Invoice $invoice)
|
103 |
{
|
104 |
+
$taxRate = 0.0;
|
105 |
+
$order = $invoice->getOrder();
|
106 |
|
107 |
$taxRate = (floatval(Mage::helper('ops/payment_request')->getShippingTaxRate($order)));
|
108 |
|
117 |
*/
|
118 |
protected function getOpsDataHelper()
|
119 |
{
|
120 |
+
if (null === $this->_opsDataHelper) {
|
121 |
+
$this->_opsDataHelper = Mage::helper('ops/data');
|
122 |
}
|
123 |
|
124 |
+
return $this->_opsDataHelper;
|
125 |
}
|
126 |
|
127 |
|
128 |
/**
|
129 |
+
* @deprecated Netresearch_OPS_Helper_Payment_Request should be used instead
|
130 |
+
*
|
131 |
+
* @param $invoice
|
132 |
*/
|
133 |
protected function extractFromDiscountData($invoice)
|
134 |
{
|
135 |
$amount = $invoice->getBaseDiscountAmount();
|
136 |
if (0 > $amount) {
|
137 |
$couponRuleName = 'DISCOUNT';
|
138 |
+
$order = $invoice->getOrder();
|
139 |
if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
|
140 |
$couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
|
141 |
}
|
142 |
+
$this->_additionalParams['ITEMID' . $this->_itemIdx] = 'DISCOUNT';
|
143 |
+
$this->_additionalParams['ITEMNAME' . $this->_itemIdx] = $couponRuleName;
|
144 |
+
$this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount($amount);
|
145 |
+
$this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
|
146 |
+
$this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
|
147 |
+
$this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
|
148 |
+
++$this->_itemIdx;
|
149 |
}
|
150 |
}
|
151 |
}
|
app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Additional/OpenInvoiceNl.php
CHANGED
@@ -10,69 +10,63 @@
|
|
10 |
class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
|
11 |
extends Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
|
12 |
{
|
13 |
-
|
|
|
14 |
protected $amount = 0;
|
15 |
protected $refundHelper = null;
|
16 |
|
17 |
/**
|
18 |
-
* @param
|
19 |
* @return array
|
20 |
*/
|
21 |
-
public function extractAdditionalParams(
|
22 |
{
|
23 |
-
$invoice =
|
24 |
-
if ($itemContainer instanceof Mage_Sales_Model_Order_Invoice && $itemContainer) {
|
25 |
-
$invoice = $itemContainer;
|
26 |
-
} else if ($itemContainer instanceof Mage_Sales_Block_Order_Creditmemo && $itemContainer){
|
27 |
-
$invoice = Mage::getModel('sales/order_invoice')->load($itemContainer->getInvoiceId());
|
28 |
-
}
|
29 |
|
30 |
-
if($invoice == null){
|
31 |
// if invoice is not set we load id hard from the request params
|
32 |
$invoice = $this->getRefundHelper()->getInvoiceFromCreditMemoRequest();
|
33 |
}
|
34 |
-
$this->creditmemo = $
|
35 |
|
36 |
if ($invoice instanceof Mage_Sales_Model_Order_Invoice) {
|
37 |
$this->extractFromCreditMemoItems($invoice);
|
38 |
// We dont extract from discount data for the moment, because partial refunds are a problem
|
39 |
-
// $this->extractFromDiscountData($invoice);
|
40 |
$this->extractFromInvoicedShippingMethod($invoice);
|
41 |
$this->extractFromAdjustments($invoice);
|
42 |
// Overwrite amount to fix Magentos rounding problems (eg +1ct)
|
43 |
-
$this->
|
44 |
}
|
45 |
|
46 |
-
return $this->
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
* extracts all data from the invoice according to the credit memo items
|
51 |
*
|
52 |
-
* @param $itemContainer
|
53 |
*/
|
54 |
-
protected function extractFromCreditMemoItems(
|
55 |
{
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
$this->additionalParams['ITEMID' . $this->itemIdx] = substr($item->getOrderItemId(), 0, 15);
|
64 |
-
$this->additionalParams['ITEMNAME' . $this->itemIdx] = substr($item->getName(), 0, 30);
|
65 |
-
$this->additionalParams['ITEMPRICE' . $this->itemIdx] = $this->getOpsDataHelper()->getAmount(
|
66 |
-
$item->getBasePriceInclTax()
|
67 |
-
);
|
68 |
-
$this->amount += $this->getOpsDataHelper()->getAmount($item->getBasePriceInclTax()) * $this->creditmemo['items'][$item->getOrderItemId()]['qty'];
|
69 |
-
$this->additionalParams['ITEMQUANT' . $this->itemIdx] = $this->creditmemo['items'][$item->getOrderItemId()]['qty'];
|
70 |
-
$this->additionalParams['ITEMVATCODE' . $this->itemIdx]
|
71 |
-
=
|
72 |
-
str_replace(',', '.', (string)(float)$item->getTaxPercent()) . '%';
|
73 |
-
$this->additionalParams['TAXINCLUDED' . $this->itemIdx] = 1;
|
74 |
-
++$this->itemIdx;
|
75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
}
|
@@ -80,16 +74,17 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
|
|
80 |
|
81 |
protected function extractFromInvoicedShippingMethod(Mage_Sales_Model_Order_Invoice $invoice)
|
82 |
{
|
83 |
-
if ($this->creditmemo
|
84 |
-
$this->
|
85 |
-
$this->
|
86 |
substr($invoice->getOrder()->getShippingDescription(), 0, 30);
|
87 |
-
$this->
|
88 |
-
|
89 |
-
$this->
|
90 |
-
$this->
|
91 |
-
$this->
|
92 |
-
|
|
|
93 |
}
|
94 |
|
95 |
}
|
@@ -102,26 +97,28 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
|
|
102 |
protected function extractFromAdjustments(Mage_Sales_Model_Order_Invoice $invoice)
|
103 |
{
|
104 |
|
105 |
-
if ($this->creditmemo
|
106 |
-
$this->
|
107 |
-
$this->
|
108 |
-
$this->
|
109 |
-
|
110 |
-
$this->
|
111 |
-
$this->
|
112 |
-
$this->
|
113 |
-
|
|
|
114 |
|
115 |
}
|
116 |
-
if ($this->creditmemo
|
117 |
-
$this->
|
118 |
-
$this->
|
119 |
-
$this->
|
120 |
-
|
121 |
-
$this->
|
122 |
-
$this->
|
123 |
-
$this->
|
124 |
-
|
|
|
125 |
}
|
126 |
}
|
127 |
|
10 |
class Netresearch_OPS_Model_Backend_Operation_Refund_Additional_OpenInvoiceNl
|
11 |
extends Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_OpenInvoiceNlAbstract
|
12 |
{
|
13 |
+
/** @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
|
14 |
+
protected $creditmemo = null;
|
15 |
protected $amount = 0;
|
16 |
protected $refundHelper = null;
|
17 |
|
18 |
/**
|
19 |
+
* @param Mage_Sales_Model_Order_Payment $itemContainer
|
20 |
* @return array
|
21 |
*/
|
22 |
+
public function extractAdditionalParams(Mage_Sales_Model_Order_Payment $payment = null)
|
23 |
{
|
24 |
+
$invoice = $payment->getInvoice();
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
if ($invoice == null) {
|
27 |
// if invoice is not set we load id hard from the request params
|
28 |
$invoice = $this->getRefundHelper()->getInvoiceFromCreditMemoRequest();
|
29 |
}
|
30 |
+
$this->creditmemo = $payment->getCreditmemo();
|
31 |
|
32 |
if ($invoice instanceof Mage_Sales_Model_Order_Invoice) {
|
33 |
$this->extractFromCreditMemoItems($invoice);
|
34 |
// We dont extract from discount data for the moment, because partial refunds are a problem
|
|
|
35 |
$this->extractFromInvoicedShippingMethod($invoice);
|
36 |
$this->extractFromAdjustments($invoice);
|
37 |
// Overwrite amount to fix Magentos rounding problems (eg +1ct)
|
38 |
+
$this->_additionalParams['AMOUNT'] = $this->amount;
|
39 |
}
|
40 |
|
41 |
+
return $this->_additionalParams;
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
* extracts all data from the invoice according to the credit memo items
|
46 |
*
|
|
|
47 |
*/
|
48 |
+
protected function extractFromCreditMemoItems()
|
49 |
{
|
50 |
+
/** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
|
51 |
+
foreach ($this->creditmemo->getAllItems() as $item) {
|
52 |
+
if ($item->getOrderItem()->getParentItemId()
|
53 |
+
&& $item->getOrderItem()->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
|
54 |
+
|| $item->getOrderItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE
|
55 |
+
) {
|
56 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
+
$this->_additionalParams['ITEMID' . $this->_itemIdx] = substr($item->getOrderItemId(), 0, 15);
|
59 |
+
$this->_additionalParams['ITEMNAME' . $this->_itemIdx] = substr($item->getName(), 0, 30);
|
60 |
+
$this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()->getAmount(
|
61 |
+
$item->getBasePriceInclTax()
|
62 |
+
);
|
63 |
+
$this->amount += $this->getOpsDataHelper()
|
64 |
+
->getAmount($item->getBasePriceInclTax()) * $item->getQty();
|
65 |
+
$this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = $item->getQty();
|
66 |
+
$this->_additionalParams['ITEMVATCODE' . $this->_itemIdx]
|
67 |
+
= str_replace(',', '.', (string)(float)$item->getOrderItem()->getTaxPercent()) . '%';
|
68 |
+
$this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
|
69 |
+
++$this->_itemIdx;
|
70 |
}
|
71 |
|
72 |
}
|
74 |
|
75 |
protected function extractFromInvoicedShippingMethod(Mage_Sales_Model_Order_Invoice $invoice)
|
76 |
{
|
77 |
+
if ($this->creditmemo->getBaseShippingInclTax() > 0) {
|
78 |
+
$this->_additionalParams['ITEMID' . $this->_itemIdx] = 'SHIPPING';
|
79 |
+
$this->_additionalParams['ITEMNAME' . $this->_itemIdx] =
|
80 |
substr($invoice->getOrder()->getShippingDescription(), 0, 30);
|
81 |
+
$this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()
|
82 |
+
->getAmount($this->creditmemo->getBaseShippingInclTax());
|
83 |
+
$this->amount += $this->getOpsDataHelper()->getAmount($this->creditmemo->getBaseShippingInclTax());
|
84 |
+
$this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
|
85 |
+
$this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
|
86 |
+
$this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
|
87 |
+
++$this->_itemIdx;
|
88 |
}
|
89 |
|
90 |
}
|
97 |
protected function extractFromAdjustments(Mage_Sales_Model_Order_Invoice $invoice)
|
98 |
{
|
99 |
|
100 |
+
if ($this->creditmemo->getBaseAdjustmentPositive() > 0) {
|
101 |
+
$this->_additionalParams['ITEMID' . $this->_itemIdx] = 'ADJUSTREFUND';
|
102 |
+
$this->_additionalParams['ITEMNAME' . $this->_itemIdx] = 'Adjustment Refund';
|
103 |
+
$this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()
|
104 |
+
->getAmount($this->creditmemo->getBaseAdjustmentPositive());
|
105 |
+
$this->amount += $this->getOpsDataHelper()->getAmount($this->creditmemo->getBaseAdjustmentPositive());
|
106 |
+
$this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
|
107 |
+
$this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
|
108 |
+
$this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
|
109 |
+
++$this->_itemIdx;
|
110 |
|
111 |
}
|
112 |
+
if ($this->creditmemo->getBaseAdjustmentNegative() > 0) {
|
113 |
+
$this->_additionalParams['ITEMID' . $this->_itemIdx] = 'ADJUSTFEE';
|
114 |
+
$this->_additionalParams['ITEMNAME' . $this->_itemIdx] = 'Adjustment Fee';
|
115 |
+
$this->_additionalParams['ITEMPRICE' . $this->_itemIdx] = $this->getOpsDataHelper()
|
116 |
+
->getAmount(-$this->creditmemo->getBaseAdjustmentNegative());
|
117 |
+
$this->amount += $this->getOpsDataHelper()->getAmount(-$this->creditmemo->getBaseAdjustmentNegative());
|
118 |
+
$this->_additionalParams['ITEMQUANT' . $this->_itemIdx] = 1;
|
119 |
+
$this->_additionalParams['ITEMVATCODE' . $this->_itemIdx] = $this->getShippingTaxRate($invoice) . '%';
|
120 |
+
$this->_additionalParams['TAXINCLUDED' . $this->_itemIdx] = 1;
|
121 |
+
++$this->_itemIdx;
|
122 |
}
|
123 |
}
|
124 |
|
app/code/community/Netresearch/OPS/Model/Backend/Operation/Refund/Parameter.php
CHANGED
@@ -20,7 +20,8 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Parameter
|
|
20 |
{
|
21 |
$opsPaymentMethodClass = get_class($opsPaymentMethod);
|
22 |
$opsPmsRequiringSpecialParams = $this->getOpsConfig()
|
23 |
-
->getMethodsRequiringAdditionalParametersFor(
|
|
|
24 |
);
|
25 |
|
26 |
return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
|
@@ -33,20 +34,21 @@ class Netresearch_OPS_Model_Backend_Operation_Refund_Parameter
|
|
33 |
*/
|
34 |
protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
|
35 |
{
|
36 |
-
if ($opsPaymentMethod instanceof
|
37 |
$this->additionalParamsModel = Mage::getModel('ops/backend_operation_refund_additional_openInvoiceNl');
|
38 |
}
|
39 |
}
|
40 |
|
41 |
protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
42 |
Varien_Object $payment, $amount
|
43 |
-
)
|
|
|
44 |
if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
|
45 |
$this->setAdditionalParamsModelFor($opsPaymentMethod);
|
46 |
if ($this->additionalParamsModel instanceof
|
47 |
Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
48 |
) {
|
49 |
-
$params = $this->additionalParamsModel->extractAdditionalParams(
|
50 |
$this->requestParams = array_merge($this->requestParams, $params);
|
51 |
}
|
52 |
}
|
20 |
{
|
21 |
$opsPaymentMethodClass = get_class($opsPaymentMethod);
|
22 |
$opsPmsRequiringSpecialParams = $this->getOpsConfig()
|
23 |
+
->getMethodsRequiringAdditionalParametersFor(
|
24 |
+
Netresearch_OPS_Model_Payment_Abstract::OPS_REFUND_TRANSACTION_TYPE
|
25 |
);
|
26 |
|
27 |
return (in_array($opsPaymentMethodClass, array_values($opsPmsRequiringSpecialParams)));
|
34 |
*/
|
35 |
protected function setAdditionalParamsModelFor(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod)
|
36 |
{
|
37 |
+
if ($opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_OpenInvoice_Abstract) {
|
38 |
$this->additionalParamsModel = Mage::getModel('ops/backend_operation_refund_additional_openInvoiceNl');
|
39 |
}
|
40 |
}
|
41 |
|
42 |
protected function addPmSpecificParams(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
43 |
Varien_Object $payment, $amount
|
44 |
+
)
|
45 |
+
{
|
46 |
if ($this->isPmRequiringAdditionalParams($opsPaymentMethod)) {
|
47 |
$this->setAdditionalParamsModelFor($opsPaymentMethod);
|
48 |
if ($this->additionalParamsModel instanceof
|
49 |
Netresearch_OPS_Model_Backend_Operation_Parameter_Additional_Interface
|
50 |
) {
|
51 |
+
$params = $this->additionalParamsModel->extractAdditionalParams($payment);
|
52 |
$this->requestParams = array_merge($this->requestParams, $params);
|
53 |
}
|
54 |
}
|
app/code/community/Netresearch/OPS/Model/Config.php
CHANGED
@@ -44,11 +44,12 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
44 |
*/
|
45 |
public function getConfigData($path, $storeId = null)
|
46 |
{
|
|
|
47 |
if (!empty($path)) {
|
48 |
-
|
49 |
}
|
50 |
|
51 |
-
return
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -78,6 +79,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
78 |
/**
|
79 |
* Return frontend gateway path, get from config. Setup on admin place.
|
80 |
*
|
|
|
81 |
* @param int $storeId
|
82 |
*
|
83 |
* @return string
|
@@ -185,7 +187,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
185 |
'_secure' => $this->isCurrentlySecure(),
|
186 |
'_nosid' => true
|
187 |
);
|
188 |
-
if (
|
189 |
$params['_store'] = $storeId;
|
190 |
}
|
191 |
|
@@ -238,7 +240,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
238 |
'_secure' => $this->isCurrentlySecure(),
|
239 |
'_nosid' => true
|
240 |
);
|
241 |
-
if (
|
242 |
$params['_store'] = $storeId;
|
243 |
}
|
244 |
if ($admin) {
|
@@ -320,7 +322,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
320 |
'_secure' => $this->isCurrentlySecure(),
|
321 |
'_nosid' => true,
|
322 |
);
|
323 |
-
if (
|
324 |
$params['_store'] = $storeId;
|
325 |
}
|
326 |
if ($admin) {
|
@@ -333,34 +335,37 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
333 |
|
334 |
}
|
335 |
|
336 |
-
public function getRegisterDirectDebitPaymentUrl()
|
337 |
-
{
|
338 |
-
return Mage::getUrl(
|
339 |
-
self::OPS_CONTROLLER_ROUTE_PAYMENT . 'registerDirectDebitPayment',
|
340 |
-
array('_secure' => $this->isCurrentlySecure(), '_nosid' => true)
|
341 |
-
);
|
342 |
-
}
|
343 |
-
|
344 |
/**
|
345 |
* Checks if requests should be logged or not regarding configuration
|
346 |
*
|
347 |
-
* @
|
|
|
348 |
*/
|
349 |
public function shouldLogRequests($storeId = null)
|
350 |
{
|
351 |
return $this->getConfigData('debug_flag', $storeId);
|
352 |
}
|
353 |
|
|
|
|
|
|
|
354 |
public function hasCatalogUrl()
|
355 |
{
|
356 |
return Mage::getStoreConfig('payment_services/ops/showcatalogbutton');
|
357 |
}
|
358 |
|
|
|
|
|
|
|
359 |
public function hasHomeUrl()
|
360 |
{
|
361 |
return Mage::getStoreConfig('payment_services/ops/showhomebutton');
|
362 |
}
|
363 |
|
|
|
|
|
|
|
|
|
364 |
public function getAcceptedCcTypes($code)
|
365 |
{
|
366 |
return Mage::getStoreConfig('payment/' . $code . '/types');
|
@@ -388,21 +393,33 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
388 |
return $inlineTypes;
|
389 |
}
|
390 |
|
|
|
|
|
|
|
391 |
public function get3dSecureIsActive()
|
392 |
{
|
393 |
return Mage::getStoreConfig('payment/ops_cc/enabled_3dsecure');
|
394 |
}
|
395 |
|
|
|
|
|
|
|
396 |
public function getDirectDebitCountryIds()
|
397 |
{
|
398 |
return Mage::getStoreConfig('payment/ops_directDebit/countryIds');
|
399 |
}
|
400 |
|
|
|
|
|
|
|
401 |
public function getBankTransferCountryIds()
|
402 |
{
|
403 |
return Mage::getStoreConfig('payment/ops_bankTransfer/countryIds');
|
404 |
}
|
405 |
|
|
|
|
|
|
|
406 |
public function getDirectEbankingBrands()
|
407 |
{
|
408 |
return Mage::getStoreConfig('payment/ops_directEbanking/brands');
|
@@ -430,6 +447,11 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
430 |
return $url;
|
431 |
}
|
432 |
|
|
|
|
|
|
|
|
|
|
|
433 |
public function getCcSaveAliasUrl($storeId = null, $admin = false)
|
434 |
{
|
435 |
$params = array(
|
@@ -466,7 +488,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
466 |
{
|
467 |
$result = array();
|
468 |
$brands = Mage::getStoreConfig('payment/ops_interSolve/brands', $storeId);
|
469 |
-
if (
|
470 |
$result = unserialize($brands);
|
471 |
}
|
472 |
|
@@ -482,19 +504,25 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
482 |
{
|
483 |
$result = array();
|
484 |
$methods = Mage::getStoreConfig('payment/ops_flex/methods', $storeId);
|
485 |
-
if (
|
486 |
$result = unserialize($methods);
|
487 |
}
|
488 |
|
489 |
return $result;
|
490 |
}
|
491 |
|
|
|
|
|
|
|
492 |
public function getAllCcTypes()
|
493 |
{
|
494 |
return explode(',', Mage::getStoreConfig('payment/ops_cc/availableTypes'));
|
495 |
}
|
496 |
|
497 |
|
|
|
|
|
|
|
498 |
public function getAllDcTypes()
|
499 |
{
|
500 |
return explode(',', Mage::getStoreConfig('payment/ops_dc/availableTypes'));
|
@@ -509,6 +537,7 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
509 |
{
|
510 |
return array(
|
511 |
'AAVCHECK',
|
|
|
512 |
'CVCCHECK',
|
513 |
'CCCTY',
|
514 |
'IPCTY',
|
@@ -523,6 +552,9 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
523 |
);
|
524 |
}
|
525 |
|
|
|
|
|
|
|
526 |
public function getSendInvoice()
|
527 |
{
|
528 |
return (bool)(int)Mage::getStoreConfig('payment_services/ops/send_invoice');
|
@@ -540,6 +572,9 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
540 |
return (bool)(int)Mage::getStoreConfig('payment/' . $code . '/backend_enabled', $storeId);
|
541 |
}
|
542 |
|
|
|
|
|
|
|
543 |
public function isAliasInfoBlockEnabled()
|
544 |
{
|
545 |
return (bool)(int)Mage::getStoreConfig('payment/ops_cc/show_alias_manager_info_for_guests');
|
@@ -558,6 +593,33 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
558 |
return (bool)Mage::getStoreConfig('payment/' . $code . '/active_alias', $storeId);
|
559 |
}
|
560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
/**
|
562 |
* getter for usage of order reference
|
563 |
*/
|
@@ -628,6 +690,10 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
628 |
}
|
629 |
|
630 |
|
|
|
|
|
|
|
|
|
631 |
public function getMethodsRequiringAdditionalParametersFor($operation)
|
632 |
{
|
633 |
return Mage::getStoreConfig('payment/additional_params_required/' . $operation);
|
@@ -673,12 +739,18 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
673 |
return $this->getConfigData('paramLength');
|
674 |
}
|
675 |
|
|
|
|
|
|
|
676 |
public function getFrontendFieldMapping()
|
677 |
{
|
678 |
return $this->getConfigData('frontendFieldMapping');
|
679 |
|
680 |
}
|
681 |
|
|
|
|
|
|
|
682 |
public function getValidationUrl()
|
683 |
{
|
684 |
return Mage::getUrl(
|
@@ -687,6 +759,10 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
687 |
);
|
688 |
}
|
689 |
|
|
|
|
|
|
|
|
|
690 |
public function getInlineOrderReference($storeId = null)
|
691 |
{
|
692 |
return $this->getConfigData('inlineOrderReference', $storeId);
|
@@ -750,26 +826,56 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
750 |
}
|
751 |
}
|
752 |
|
|
|
|
|
|
|
|
|
753 |
public function getTemplateIdentifier($storeId = null)
|
754 |
{
|
755 |
return $this->getConfigData('template_identifier', $storeId);
|
756 |
}
|
757 |
|
|
|
|
|
|
|
|
|
758 |
public function getResendPaymentInfoIdentity($storeId = null)
|
759 |
{
|
760 |
return $this->getConfigData('resendPaymentInfo_identity', $storeId);
|
761 |
}
|
762 |
|
|
|
|
|
|
|
|
|
763 |
public function getResendPaymentInfoTemplate($storeId = null)
|
764 |
{
|
765 |
return $this->getConfigData('resendPaymentInfo_template', $storeId);
|
766 |
}
|
767 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
768 |
public function getStateRestriction()
|
769 |
{
|
770 |
return $this->getConfigData('ops_state_restriction');
|
771 |
}
|
772 |
|
|
|
|
|
|
|
|
|
|
|
773 |
public function getPaymentRetryUrl($params, $storeId = null)
|
774 |
{
|
775 |
return Mage::getUrl(
|
@@ -792,6 +898,10 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
792 |
return (bool)$this->getConfigData('device_fingerprinting', $storeId);
|
793 |
}
|
794 |
|
|
|
|
|
|
|
|
|
795 |
public function getTransActionTimeout($storeId = null)
|
796 |
{
|
797 |
return (int)$this->getConfigData('ops_rtimeout', $storeId);
|
@@ -808,34 +918,59 @@ class Netresearch_OPS_Model_Config extends Mage_Payment_Model_Config
|
|
808 |
return (bool)$this->getConfigData('creditdebit_split', $storeId);
|
809 |
}
|
810 |
|
|
|
|
|
|
|
811 |
public function getAllRecurringCcTypes()
|
812 |
{
|
813 |
return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/availableTypes'));
|
814 |
}
|
815 |
|
|
|
|
|
|
|
816 |
public function getAcceptedRecurringCcTypes()
|
817 |
{
|
818 |
return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/acceptedTypes'));
|
819 |
}
|
820 |
|
|
|
|
|
|
|
|
|
821 |
public function getMonthlyBillingDay($storeId = null)
|
822 |
{
|
823 |
return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_month', $storeId);
|
824 |
}
|
825 |
|
|
|
|
|
|
|
|
|
826 |
public function getWeeklyBillingDay($storeId = null)
|
827 |
{
|
828 |
return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_week', $storeId);
|
829 |
}
|
830 |
|
|
|
|
|
|
|
|
|
831 |
public function getSuspendSubscriptionTemplate($storeId = null)
|
832 |
{
|
833 |
return $this->getConfigData('suspendSubscription_template', $storeId);
|
834 |
}
|
835 |
|
|
|
|
|
|
|
|
|
836 |
public function getSuspendSubscriptionIdentity($storeId = null)
|
837 |
{
|
838 |
return $this->getConfigData('suspendSubscription_identity', $storeId);
|
839 |
}
|
|
|
|
|
|
|
840 |
}
|
841 |
|
44 |
*/
|
45 |
public function getConfigData($path, $storeId = null)
|
46 |
{
|
47 |
+
$result = false;
|
48 |
if (!empty($path)) {
|
49 |
+
$result = Mage::getStoreConfig(self::OPS_PAYMENT_PATH . $path, $storeId);
|
50 |
}
|
51 |
|
52 |
+
return $result;
|
53 |
}
|
54 |
|
55 |
/**
|
79 |
/**
|
80 |
* Return frontend gateway path, get from config. Setup on admin place.
|
81 |
*
|
82 |
+
* @param string $path
|
83 |
* @param int $storeId
|
84 |
*
|
85 |
* @return string
|
187 |
'_secure' => $this->isCurrentlySecure(),
|
188 |
'_nosid' => true
|
189 |
);
|
190 |
+
if (null != $storeId) {
|
191 |
$params['_store'] = $storeId;
|
192 |
}
|
193 |
|
240 |
'_secure' => $this->isCurrentlySecure(),
|
241 |
'_nosid' => true
|
242 |
);
|
243 |
+
if (null !=$storeId) {
|
244 |
$params['_store'] = $storeId;
|
245 |
}
|
246 |
if ($admin) {
|
322 |
'_secure' => $this->isCurrentlySecure(),
|
323 |
'_nosid' => true,
|
324 |
);
|
325 |
+
if (null != $storeId) {
|
326 |
$params['_store'] = $storeId;
|
327 |
}
|
328 |
if ($admin) {
|
335 |
|
336 |
}
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
/**
|
339 |
* Checks if requests should be logged or not regarding configuration
|
340 |
*
|
341 |
+
* @param null $storeId
|
342 |
+
* @return Simple_Xml
|
343 |
*/
|
344 |
public function shouldLogRequests($storeId = null)
|
345 |
{
|
346 |
return $this->getConfigData('debug_flag', $storeId);
|
347 |
}
|
348 |
|
349 |
+
/**
|
350 |
+
* @return mixed
|
351 |
+
*/
|
352 |
public function hasCatalogUrl()
|
353 |
{
|
354 |
return Mage::getStoreConfig('payment_services/ops/showcatalogbutton');
|
355 |
}
|
356 |
|
357 |
+
/**
|
358 |
+
* @return mixed
|
359 |
+
*/
|
360 |
public function hasHomeUrl()
|
361 |
{
|
362 |
return Mage::getStoreConfig('payment_services/ops/showhomebutton');
|
363 |
}
|
364 |
|
365 |
+
/**
|
366 |
+
* @param $code
|
367 |
+
* @return mixed
|
368 |
+
*/
|
369 |
public function getAcceptedCcTypes($code)
|
370 |
{
|
371 |
return Mage::getStoreConfig('payment/' . $code . '/types');
|
393 |
return $inlineTypes;
|
394 |
}
|
395 |
|
396 |
+
/**
|
397 |
+
* @return mixed
|
398 |
+
*/
|
399 |
public function get3dSecureIsActive()
|
400 |
{
|
401 |
return Mage::getStoreConfig('payment/ops_cc/enabled_3dsecure');
|
402 |
}
|
403 |
|
404 |
+
/**
|
405 |
+
* @return mixed
|
406 |
+
*/
|
407 |
public function getDirectDebitCountryIds()
|
408 |
{
|
409 |
return Mage::getStoreConfig('payment/ops_directDebit/countryIds');
|
410 |
}
|
411 |
|
412 |
+
/**
|
413 |
+
* @return mixed
|
414 |
+
*/
|
415 |
public function getBankTransferCountryIds()
|
416 |
{
|
417 |
return Mage::getStoreConfig('payment/ops_bankTransfer/countryIds');
|
418 |
}
|
419 |
|
420 |
+
/**
|
421 |
+
* @return mixed
|
422 |
+
*/
|
423 |
public function getDirectEbankingBrands()
|
424 |
{
|
425 |
return Mage::getStoreConfig('payment/ops_directEbanking/brands');
|
447 |
return $url;
|
448 |
}
|
449 |
|
450 |
+
/**
|
451 |
+
* @param null $storeId
|
452 |
+
* @param bool $admin
|
453 |
+
* @return mixed
|
454 |
+
*/
|
455 |
public function getCcSaveAliasUrl($storeId = null, $admin = false)
|
456 |
{
|
457 |
$params = array(
|
488 |
{
|
489 |
$result = array();
|
490 |
$brands = Mage::getStoreConfig('payment/ops_interSolve/brands', $storeId);
|
491 |
+
if (null !=$brands) {
|
492 |
$result = unserialize($brands);
|
493 |
}
|
494 |
|
504 |
{
|
505 |
$result = array();
|
506 |
$methods = Mage::getStoreConfig('payment/ops_flex/methods', $storeId);
|
507 |
+
if (null !=$methods) {
|
508 |
$result = unserialize($methods);
|
509 |
}
|
510 |
|
511 |
return $result;
|
512 |
}
|
513 |
|
514 |
+
/**
|
515 |
+
* @return array
|
516 |
+
*/
|
517 |
public function getAllCcTypes()
|
518 |
{
|
519 |
return explode(',', Mage::getStoreConfig('payment/ops_cc/availableTypes'));
|
520 |
}
|
521 |
|
522 |
|
523 |
+
/**
|
524 |
+
* @return array
|
525 |
+
*/
|
526 |
public function getAllDcTypes()
|
527 |
{
|
528 |
return explode(',', Mage::getStoreConfig('payment/ops_dc/availableTypes'));
|
537 |
{
|
538 |
return array(
|
539 |
'AAVCHECK',
|
540 |
+
'ACCEPTANCE',
|
541 |
'CVCCHECK',
|
542 |
'CCCTY',
|
543 |
'IPCTY',
|
552 |
);
|
553 |
}
|
554 |
|
555 |
+
/**
|
556 |
+
* @return bool
|
557 |
+
*/
|
558 |
public function getSendInvoice()
|
559 |
{
|
560 |
return (bool)(int)Mage::getStoreConfig('payment_services/ops/send_invoice');
|
572 |
return (bool)(int)Mage::getStoreConfig('payment/' . $code . '/backend_enabled', $storeId);
|
573 |
}
|
574 |
|
575 |
+
/**
|
576 |
+
* @return bool
|
577 |
+
*/
|
578 |
public function isAliasInfoBlockEnabled()
|
579 |
{
|
580 |
return (bool)(int)Mage::getStoreConfig('payment/ops_cc/show_alias_manager_info_for_guests');
|
593 |
return (bool)Mage::getStoreConfig('payment/' . $code . '/active_alias', $storeId);
|
594 |
}
|
595 |
|
596 |
+
/**
|
597 |
+
* return configured text for alias usage parameter for new alias creation
|
598 |
+
*
|
599 |
+
* @param $code
|
600 |
+
* @param null $storeId
|
601 |
+
*
|
602 |
+
* @return string
|
603 |
+
*/
|
604 |
+
public function getAliasUsageForNewAlias($code, $storeId = null)
|
605 |
+
{
|
606 |
+
return Mage::getStoreConfig('payment/' . $code . '/alias_usage_for_new_alias', $storeId);
|
607 |
+
}
|
608 |
+
|
609 |
+
/**
|
610 |
+
* return configured text for alias usage parameter when using a existing alias
|
611 |
+
*
|
612 |
+
* @param $code
|
613 |
+
* @param null $storeId
|
614 |
+
*
|
615 |
+
* @return string
|
616 |
+
*/
|
617 |
+
public function getAliasUsageForExistingAlias($code, $storeId = null)
|
618 |
+
{
|
619 |
+
return Mage::getStoreConfig('payment/' . $code . '/alias_usage_for_existing_alias', $storeId);
|
620 |
+
}
|
621 |
+
|
622 |
+
|
623 |
/**
|
624 |
* getter for usage of order reference
|
625 |
*/
|
690 |
}
|
691 |
|
692 |
|
693 |
+
/**
|
694 |
+
* @param $operation
|
695 |
+
* @return mixed
|
696 |
+
*/
|
697 |
public function getMethodsRequiringAdditionalParametersFor($operation)
|
698 |
{
|
699 |
return Mage::getStoreConfig('payment/additional_params_required/' . $operation);
|
739 |
return $this->getConfigData('paramLength');
|
740 |
}
|
741 |
|
742 |
+
/**
|
743 |
+
* @return Simple_Xml
|
744 |
+
*/
|
745 |
public function getFrontendFieldMapping()
|
746 |
{
|
747 |
return $this->getConfigData('frontendFieldMapping');
|
748 |
|
749 |
}
|
750 |
|
751 |
+
/**
|
752 |
+
* @return mixed
|
753 |
+
*/
|
754 |
public function getValidationUrl()
|
755 |
{
|
756 |
return Mage::getUrl(
|
759 |
);
|
760 |
}
|
761 |
|
762 |
+
/**
|
763 |
+
* @param null $storeId
|
764 |
+
* @return Simple_Xml
|
765 |
+
*/
|
766 |
public function getInlineOrderReference($storeId = null)
|
767 |
{
|
768 |
return $this->getConfigData('inlineOrderReference', $storeId);
|
826 |
}
|
827 |
}
|
828 |
|
829 |
+
/**
|
830 |
+
* @param null $storeId
|
831 |
+
* @return Simple_Xml
|
832 |
+
*/
|
833 |
public function getTemplateIdentifier($storeId = null)
|
834 |
{
|
835 |
return $this->getConfigData('template_identifier', $storeId);
|
836 |
}
|
837 |
|
838 |
+
/**
|
839 |
+
* @param null $storeId
|
840 |
+
* @return Simple_Xml
|
841 |
+
*/
|
842 |
public function getResendPaymentInfoIdentity($storeId = null)
|
843 |
{
|
844 |
return $this->getConfigData('resendPaymentInfo_identity', $storeId);
|
845 |
}
|
846 |
|
847 |
+
/**
|
848 |
+
* @param null $storeId
|
849 |
+
* @return Simple_Xml
|
850 |
+
*/
|
851 |
public function getResendPaymentInfoTemplate($storeId = null)
|
852 |
{
|
853 |
return $this->getConfigData('resendPaymentInfo_template', $storeId);
|
854 |
}
|
855 |
|
856 |
+
|
857 |
+
/**
|
858 |
+
* @param null $storeId
|
859 |
+
* @return Simple_Xml
|
860 |
+
*/
|
861 |
+
public function getPayPerMailTemplate($storeId = null)
|
862 |
+
{
|
863 |
+
return $this->getConfigData('payPerMail_template', $storeId);
|
864 |
+
}
|
865 |
+
|
866 |
+
/**
|
867 |
+
* @return Simple_Xml
|
868 |
+
*/
|
869 |
public function getStateRestriction()
|
870 |
{
|
871 |
return $this->getConfigData('ops_state_restriction');
|
872 |
}
|
873 |
|
874 |
+
/**
|
875 |
+
* @param $params
|
876 |
+
* @param null $storeId
|
877 |
+
* @return mixed
|
878 |
+
*/
|
879 |
public function getPaymentRetryUrl($params, $storeId = null)
|
880 |
{
|
881 |
return Mage::getUrl(
|
898 |
return (bool)$this->getConfigData('device_fingerprinting', $storeId);
|
899 |
}
|
900 |
|
901 |
+
/**
|
902 |
+
* @param null $storeId
|
903 |
+
* @return int
|
904 |
+
*/
|
905 |
public function getTransActionTimeout($storeId = null)
|
906 |
{
|
907 |
return (int)$this->getConfigData('ops_rtimeout', $storeId);
|
918 |
return (bool)$this->getConfigData('creditdebit_split', $storeId);
|
919 |
}
|
920 |
|
921 |
+
/**
|
922 |
+
* @return array
|
923 |
+
*/
|
924 |
public function getAllRecurringCcTypes()
|
925 |
{
|
926 |
return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/availableTypes'));
|
927 |
}
|
928 |
|
929 |
+
/**
|
930 |
+
* @return array
|
931 |
+
*/
|
932 |
public function getAcceptedRecurringCcTypes()
|
933 |
{
|
934 |
return explode(',', Mage::getStoreConfig('payment/ops_recurring_cc/acceptedTypes'));
|
935 |
}
|
936 |
|
937 |
+
/**
|
938 |
+
* @param null $storeId
|
939 |
+
* @return mixed
|
940 |
+
*/
|
941 |
public function getMonthlyBillingDay($storeId = null)
|
942 |
{
|
943 |
return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_month', $storeId);
|
944 |
}
|
945 |
|
946 |
+
/**
|
947 |
+
* @param null $storeId
|
948 |
+
* @return mixed
|
949 |
+
*/
|
950 |
public function getWeeklyBillingDay($storeId = null)
|
951 |
{
|
952 |
return Mage::getStoreConfig(self::OPS_PAYMENT_PATH . 'billing_day_week', $storeId);
|
953 |
}
|
954 |
|
955 |
+
/**
|
956 |
+
* @param null $storeId
|
957 |
+
* @return Simple_Xml
|
958 |
+
*/
|
959 |
public function getSuspendSubscriptionTemplate($storeId = null)
|
960 |
{
|
961 |
return $this->getConfigData('suspendSubscription_template', $storeId);
|
962 |
}
|
963 |
|
964 |
+
/**
|
965 |
+
* @param null $storeId
|
966 |
+
* @return Simple_Xml
|
967 |
+
*/
|
968 |
public function getSuspendSubscriptionIdentity($storeId = null)
|
969 |
{
|
970 |
return $this->getConfigData('suspendSubscription_identity', $storeId);
|
971 |
}
|
972 |
+
|
973 |
+
|
974 |
+
|
975 |
}
|
976 |
|
app/code/community/Netresearch/OPS/Model/File/Download.php
CHANGED
@@ -25,11 +25,11 @@ class Netresearch_OPS_Model_File_Download
|
|
25 |
public function getFile($path, $threshold = self::ONE_MEGABYTE)
|
26 |
{
|
27 |
$this->_filePath = $path;
|
28 |
-
if(!file_exists($this->_filePath) || !is_readable($this->_filePath)){
|
29 |
Mage::throwException('File '.$this->_filePath.' does not exist or is not readable.');
|
30 |
return '';
|
31 |
}
|
32 |
-
if(filesize($path) > $threshold){
|
33 |
return $this->_trimFileToThreshold($threshold);
|
34 |
} else {
|
35 |
return $this->_filePath;
|
@@ -46,7 +46,7 @@ class Netresearch_OPS_Model_File_Download
|
|
46 |
protected function _trimFileToThreshold($threshold)
|
47 |
{
|
48 |
$this->_fileHandler = fopen($this->_filePath, 'r');
|
49 |
-
if(0 > fseek($this->_fileHandler, filesize($this->_filePath)-$threshold, SEEK_SET)){
|
50 |
Mage::throwException('Function fseek on file '. $this->_filePath.' failed.');
|
51 |
}
|
52 |
$content = fread($this->_fileHandler, $threshold);
|
25 |
public function getFile($path, $threshold = self::ONE_MEGABYTE)
|
26 |
{
|
27 |
$this->_filePath = $path;
|
28 |
+
if (!file_exists($this->_filePath) || !is_readable($this->_filePath)) {
|
29 |
Mage::throwException('File '.$this->_filePath.' does not exist or is not readable.');
|
30 |
return '';
|
31 |
}
|
32 |
+
if (filesize($path) > $threshold) {
|
33 |
return $this->_trimFileToThreshold($threshold);
|
34 |
} else {
|
35 |
return $this->_filePath;
|
46 |
protected function _trimFileToThreshold($threshold)
|
47 |
{
|
48 |
$this->_fileHandler = fopen($this->_filePath, 'r');
|
49 |
+
if (0 > fseek($this->_fileHandler, filesize($this->_filePath)-$threshold, SEEK_SET)) {
|
50 |
Mage::throwException('Function fseek on file '. $this->_filePath.' failed.');
|
51 |
}
|
52 |
$content = fread($this->_fileHandler, $threshold);
|
app/code/community/Netresearch/OPS/Model/Kwixo/Category/Mapping.php
CHANGED
@@ -36,7 +36,6 @@ class Netresearch_OPS_Model_Kwixo_Category_Mapping
|
|
36 |
* Constructor
|
37 |
*
|
38 |
* @see lib/Varien/Varien_Object#_construct()
|
39 |
-
* @return Netresearch_OPS_Model_Kwixo_Category_Mapping
|
40 |
*/
|
41 |
public function _construct()
|
42 |
{
|
@@ -49,8 +48,10 @@ class Netresearch_OPS_Model_Kwixo_Category_Mapping
|
|
49 |
{
|
50 |
$collection = $this->getCollection()
|
51 |
->addFieldToFilter('category_id', $categoryId)
|
52 |
-
->load()
|
53 |
-
|
|
|
|
|
54 |
}
|
55 |
|
56 |
}
|
36 |
* Constructor
|
37 |
*
|
38 |
* @see lib/Varien/Varien_Object#_construct()
|
|
|
39 |
*/
|
40 |
public function _construct()
|
41 |
{
|
48 |
{
|
49 |
$collection = $this->getCollection()
|
50 |
->addFieldToFilter('category_id', $categoryId)
|
51 |
+
->load()
|
52 |
+
->getFirstItem();
|
53 |
+
|
54 |
+
return $collection;
|
55 |
}
|
56 |
|
57 |
}
|
app/code/community/Netresearch/OPS/Model/Kwixo/Shipping/Setting.php
CHANGED
@@ -15,7 +15,6 @@ class Netresearch_OPS_Model_Kwixo_Shipping_Setting
|
|
15 |
* Constructor
|
16 |
*
|
17 |
* @see lib/Varien/Varien_Object#_construct()
|
18 |
-
* @return Netresearch_OPS_Model_Kwixo_Shipping_Setting
|
19 |
*/
|
20 |
public function _construct()
|
21 |
{
|
15 |
* Constructor
|
16 |
*
|
17 |
* @see lib/Varien/Varien_Object#_construct()
|
|
|
18 |
*/
|
19 |
public function _construct()
|
20 |
{
|
app/code/community/Netresearch/OPS/Model/Mysql4/Alias.php
CHANGED
@@ -21,13 +21,13 @@ class Netresearch_OPS_Model_Mysql4_Alias
|
|
21 |
extends Mage_Core_Model_Mysql4_Abstract
|
22 |
{
|
23 |
/**
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
public function _construct()
|
30 |
{
|
31 |
-
|
32 |
}
|
33 |
}
|
21 |
extends Mage_Core_Model_Mysql4_Abstract
|
22 |
{
|
23 |
/**
|
24 |
+
* Constructor
|
25 |
+
*
|
26 |
+
* @see lib/Varien/Varien_Object#_construct()
|
27 |
+
* @return Netresearch_OPS_Model_Mysql4_Alias
|
28 |
+
*/
|
29 |
public function _construct()
|
30 |
{
|
31 |
+
$this->_init('ops/alias', 'id');
|
32 |
}
|
33 |
}
|
app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Category/Mapping.php
CHANGED
@@ -26,7 +26,7 @@ class Netresearch_OPS_Model_Mysql4_Kwixo_Category_Mapping
|
|
26 |
*/
|
27 |
public function _construct()
|
28 |
{
|
29 |
-
$this->_init('ops/kwixo_category_mapping','id');
|
30 |
}
|
31 |
|
32 |
}
|
26 |
*/
|
27 |
public function _construct()
|
28 |
{
|
29 |
+
$this->_init('ops/kwixo_category_mapping', 'id');
|
30 |
}
|
31 |
|
32 |
}
|
app/code/community/Netresearch/OPS/Model/Mysql4/Kwixo/Shipping/Setting.php
CHANGED
@@ -10,7 +10,6 @@
|
|
10 |
|
11 |
class Netresearch_OPS_Model_Mysql4_Kwixo_Shipping_Setting
|
12 |
extends Mage_Core_Model_Mysql4_Abstract
|
13 |
-
|
14 |
{
|
15 |
|
16 |
public function _construct()
|
10 |
|
11 |
class Netresearch_OPS_Model_Mysql4_Kwixo_Shipping_Setting
|
12 |
extends Mage_Core_Model_Mysql4_Abstract
|
|
|
13 |
{
|
14 |
|
15 |
public function _construct()
|
app/code/community/Netresearch/OPS/Model/Observer.php
CHANGED
@@ -44,7 +44,7 @@ class Netresearch_OPS_Model_Observer
|
|
44 |
|
45 |
public function getHelper($name = null)
|
46 |
{
|
47 |
-
if (
|
48 |
return Mage::helper('ops');
|
49 |
}
|
50 |
|
@@ -74,7 +74,7 @@ class Netresearch_OPS_Model_Observer
|
|
74 |
$quote->getPayment()
|
75 |
)
|
76 |
) {
|
77 |
-
$this->confirmDdPayment($order, $quote
|
78 |
} elseif ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
|
79 |
$requestParams = $quote->getPayment()->getMethodInstance()->getFormFields($order, array(), false);
|
80 |
$this->invokeRequestParamValidation($requestParams);
|
@@ -82,7 +82,7 @@ class Netresearch_OPS_Model_Observer
|
|
82 |
} catch (Exception $e) {
|
83 |
$quote->setIsActive(true);
|
84 |
$this->getOnepage()->getCheckout()->setGotoSection('payment');
|
85 |
-
|
86 |
}
|
87 |
}
|
88 |
|
@@ -135,10 +135,8 @@ class Netresearch_OPS_Model_Observer
|
|
135 |
/**
|
136 |
* allow null as valid state for creating the order with status 'pending'
|
137 |
*/
|
138 |
-
if (
|
139 |
-
|
140 |
-
) {
|
141 |
-
throw new Mage_Core_Exception($this->getHelper()->__('Acceptance Payment failed'));
|
142 |
}
|
143 |
$quote->getPayment()->setAdditionalInformation('ops_response', $response)->save();
|
144 |
|
@@ -184,7 +182,9 @@ class Netresearch_OPS_Model_Observer
|
|
184 |
) {
|
185 |
//Build message and update cancel button
|
186 |
$message = Mage::helper('ops')->__(
|
187 |
-
"Are you sure you want to cancel this order? Warning:
|
|
|
|
|
188 |
);
|
189 |
$block->updateButton(
|
190 |
'order_cancel',
|
@@ -204,7 +204,7 @@ class Netresearch_OPS_Model_Observer
|
|
204 |
*
|
205 |
* @param Varien_Event_Observer $observer
|
206 |
*
|
207 |
-
* @return
|
208 |
*/
|
209 |
public function appendCheckBoxToRefundForm($observer)
|
210 |
{
|
@@ -251,7 +251,7 @@ class Netresearch_OPS_Model_Observer
|
|
251 |
*
|
252 |
* @param Varien_Event_Observer $observer
|
253 |
*
|
254 |
-
* @return
|
255 |
*/
|
256 |
public function showWarningForClosedTransactions($observer)
|
257 |
{
|
@@ -290,7 +290,7 @@ class Netresearch_OPS_Model_Observer
|
|
290 |
*
|
291 |
* @param $observer
|
292 |
*/
|
293 |
-
public function cleanUpOldPaymentData(
|
294 |
{
|
295 |
Mage::helper('ops/quote')->cleanUpOldPaymentInformation();
|
296 |
}
|
@@ -425,13 +425,15 @@ class Netresearch_OPS_Model_Observer
|
|
425 |
$controller = $event->getControllerAction();
|
426 |
$quote = $this->getOnepage()->getQuote();
|
427 |
if ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
|
|
|
428 |
$paramHelper = Mage::helper('ops/payment_request');
|
429 |
$shippingParams = array();
|
430 |
-
$
|
|
|
431 |
if ($quote->getShippingAddress()) {
|
432 |
$shippingParams = $paramHelper->extractShipToParameters($quote->getShippingAddress(), $quote);
|
433 |
}
|
434 |
-
$params = array_merge($
|
435 |
$validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
|
436 |
Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
|
437 |
);
|
@@ -541,7 +543,9 @@ class Netresearch_OPS_Model_Observer
|
|
541 |
if ($profile->getMethodCode() == Netresearch_OPS_Model_Payment_Recurring_Cc::CODE) {
|
542 |
$cancelMessage = Mage::helper('ops')
|
543 |
->__(
|
544 |
-
'Are you sure you want to perform this action?
|
|
|
|
|
545 |
);
|
546 |
$cancelUrl = $block->getUrl(
|
547 |
'*/*/updateState',
|
@@ -556,7 +560,9 @@ class Netresearch_OPS_Model_Observer
|
|
556 |
|
557 |
$suspendMessage = Mage::helper('ops')
|
558 |
->__(
|
559 |
-
'Are you sure you want to perform this action?
|
|
|
|
|
560 |
);
|
561 |
$suspendUrl = $block->getUrl(
|
562 |
'*/*/updateState',
|
@@ -677,14 +683,14 @@ class Netresearch_OPS_Model_Observer
|
|
677 |
{
|
678 |
/** @var Mage_Sales_Model_Order $order */
|
679 |
$order = $observer->getOrder();
|
680 |
-
if (!$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
|
681 |
// ignore third-party payment methods
|
682 |
return;
|
683 |
}
|
684 |
|
685 |
/** @var Mage_Sales_Model_Quote $quote */
|
686 |
$quote = $observer->getQuote();
|
687 |
-
if ($quote->getPayment()->getOrderPlaceRedirectUrl()) {
|
688 |
// redirect payments require special treatment, may still get cancelled or declined
|
689 |
return;
|
690 |
}
|
@@ -696,4 +702,24 @@ class Netresearch_OPS_Model_Observer
|
|
696 |
Mage::logException($e);
|
697 |
}
|
698 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
699 |
}
|
44 |
|
45 |
public function getHelper($name = null)
|
46 |
{
|
47 |
+
if (null === $name) {
|
48 |
return Mage::helper('ops');
|
49 |
}
|
50 |
|
74 |
$quote->getPayment()
|
75 |
)
|
76 |
) {
|
77 |
+
$this->confirmDdPayment($order, $quote );
|
78 |
} elseif ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
|
79 |
$requestParams = $quote->getPayment()->getMethodInstance()->getFormFields($order, array(), false);
|
80 |
$this->invokeRequestParamValidation($requestParams);
|
82 |
} catch (Exception $e) {
|
83 |
$quote->setIsActive(true);
|
84 |
$this->getOnepage()->getCheckout()->setGotoSection('payment');
|
85 |
+
Mage::throwException($e->getMessage());
|
86 |
}
|
87 |
}
|
88 |
|
135 |
/**
|
136 |
* allow null as valid state for creating the order with status 'pending'
|
137 |
*/
|
138 |
+
if (null != $response['STATUS'] && Mage::helper('ops/payment')->isPaymentFailed($response['STATUS'])) {
|
139 |
+
Mage::throwException($this->getHelper()->__('Acceptance Payment failed'));
|
|
|
|
|
140 |
}
|
141 |
$quote->getPayment()->setAdditionalInformation('ops_response', $response)->save();
|
142 |
|
182 |
) {
|
183 |
//Build message and update cancel button
|
184 |
$message = Mage::helper('ops')->__(
|
185 |
+
"Are you sure you want to cancel this order? Warning:" .
|
186 |
+
" Please check the payment status in the back-office of Acceptance before." .
|
187 |
+
" By cancelling this order you won\\'t be able to update the status in Magento anymore."
|
188 |
);
|
189 |
$block->updateButton(
|
190 |
'order_cancel',
|
204 |
*
|
205 |
* @param Varien_Event_Observer $observer
|
206 |
*
|
207 |
+
* @return string
|
208 |
*/
|
209 |
public function appendCheckBoxToRefundForm($observer)
|
210 |
{
|
251 |
*
|
252 |
* @param Varien_Event_Observer $observer
|
253 |
*
|
254 |
+
* @return string
|
255 |
*/
|
256 |
public function showWarningForClosedTransactions($observer)
|
257 |
{
|
290 |
*
|
291 |
* @param $observer
|
292 |
*/
|
293 |
+
public function cleanUpOldPaymentData()
|
294 |
{
|
295 |
Mage::helper('ops/quote')->cleanUpOldPaymentInformation();
|
296 |
}
|
425 |
$controller = $event->getControllerAction();
|
426 |
$quote = $this->getOnepage()->getQuote();
|
427 |
if ($quote->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
|
428 |
+
/** @var Netresearch_OPS_Helper_Payment_Request $paramHelper */
|
429 |
$paramHelper = Mage::helper('ops/payment_request');
|
430 |
$shippingParams = array();
|
431 |
+
$ownerParams = $paramHelper->getOwnerParams($quote->getBillingAddress(), $quote);
|
432 |
+
$billingParams = $paramHelper->extractBillToParameters($quote->getBillingAddress(), $quote);
|
433 |
if ($quote->getShippingAddress()) {
|
434 |
$shippingParams = $paramHelper->extractShipToParameters($quote->getShippingAddress(), $quote);
|
435 |
}
|
436 |
+
$params = array_merge($ownerParams, $shippingParams, $billingParams);
|
437 |
$validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
|
438 |
Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
|
439 |
);
|
543 |
if ($profile->getMethodCode() == Netresearch_OPS_Model_Payment_Recurring_Cc::CODE) {
|
544 |
$cancelMessage = Mage::helper('ops')
|
545 |
->__(
|
546 |
+
'Are you sure you want to perform this action?' .
|
547 |
+
' Canceling the subscription here will not actually cancel the subscription on Acceptance side.' .
|
548 |
+
' To stop charging the customer you will have to deactivate the subscription there.'
|
549 |
);
|
550 |
$cancelUrl = $block->getUrl(
|
551 |
'*/*/updateState',
|
560 |
|
561 |
$suspendMessage = Mage::helper('ops')
|
562 |
->__(
|
563 |
+
'Are you sure you want to perform this action?' .
|
564 |
+
'Suspending the subscription here will not actually cancel the subscription on Acceptance side.' .
|
565 |
+
'To stop charging the customer you will have to deactivate the subscription there.'
|
566 |
);
|
567 |
$suspendUrl = $block->getUrl(
|
568 |
'*/*/updateState',
|
683 |
{
|
684 |
/** @var Mage_Sales_Model_Order $order */
|
685 |
$order = $observer->getOrder();
|
686 |
+
if ($order == null || !$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Abstract) {
|
687 |
// ignore third-party payment methods
|
688 |
return;
|
689 |
}
|
690 |
|
691 |
/** @var Mage_Sales_Model_Quote $quote */
|
692 |
$quote = $observer->getQuote();
|
693 |
+
if ($quote && $quote->getPayment()->getOrderPlaceRedirectUrl()) {
|
694 |
// redirect payments require special treatment, may still get cancelled or declined
|
695 |
return;
|
696 |
}
|
702 |
Mage::logException($e);
|
703 |
}
|
704 |
}
|
705 |
+
|
706 |
+
/**
|
707 |
+
* triggers the email sending for payment method payPerMail
|
708 |
+
*
|
709 |
+
* event: sales_order_place_after
|
710 |
+
*
|
711 |
+
* @param Varien_Event_Observer $observer
|
712 |
+
*/
|
713 |
+
public function sendPayPerMailInfo(Varien_Event_Observer $observer)
|
714 |
+
{
|
715 |
+
/** @var Mage_Sales_Model_Order $order */
|
716 |
+
$order = $observer->getOrder();
|
717 |
+
if (!$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_PayPerMail) {
|
718 |
+
return;
|
719 |
+
}
|
720 |
+
|
721 |
+
/** @var Netresearch_OPS_Model_Payment_Features_PaymentEmail $sendEmailModel */
|
722 |
+
$sendEmailModel = Mage::getModel('ops/payment_features_paymentEmail');
|
723 |
+
$sendEmailModel->resendPaymentInfo($order);
|
724 |
+
}
|
725 |
}
|
app/code/community/Netresearch/OPS/Model/Payment/Abstract.php
CHANGED
@@ -39,26 +39,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
39 |
protected $_config = null;
|
40 |
protected $requestHelper = null;
|
41 |
protected $backendOperationParameterModel = null;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @param null $backendOperationParameterModel
|
45 |
-
*/
|
46 |
-
public function setBackendOperationParameterModel($backendOperationParameterModel)
|
47 |
-
{
|
48 |
-
$this->backendOperationParameterModel = $backendOperationParameterModel;
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @return Netresearch_OPS_Model_Backend_Operation_Parameter
|
53 |
-
*/
|
54 |
-
public function getBackendOperationParameterModel()
|
55 |
-
{
|
56 |
-
if (null === $this->backendOperationParameterModel) {
|
57 |
-
$this->backendOperationParameterModel = Mage::getModel('ops/backend_operation_parameter');
|
58 |
-
}
|
59 |
-
|
60 |
-
return $this->backendOperationParameterModel;
|
61 |
-
}
|
62 |
|
63 |
/**
|
64 |
* Magento Payment Behaviour Settings
|
@@ -81,10 +62,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
81 |
*/
|
82 |
|
83 |
protected $_needsCartDataForRequest = false;
|
84 |
-
|
85 |
protected $_needsShipToParams = true;
|
86 |
-
|
87 |
-
protected $_needsBillToParams = false;
|
88 |
|
89 |
/**
|
90 |
* OPS template modes
|
@@ -94,11 +73,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
94 |
const TEMPLATE_OPS_TEMPLATE = 'ops_template';
|
95 |
const TEMPLATE_MAGENTO_INTERNAL = 'magento';
|
96 |
|
97 |
-
|
98 |
/**
|
99 |
* redirect references
|
100 |
*/
|
101 |
-
|
102 |
const REFERENCE_QUOTE_ID = 'quoteId';
|
103 |
const REFERENCE_ORDER_ID = 'orderId';
|
104 |
|
@@ -141,6 +118,42 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
141 |
*/
|
142 |
const FINGERPRINT_CONSENT_SESSION_KEY = 'device_fingerprinting_consent';
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
/**
|
145 |
* Return OPS Config
|
146 |
*
|
@@ -148,7 +161,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
148 |
*/
|
149 |
public function getConfig()
|
150 |
{
|
151 |
-
if (
|
152 |
$this->_config = Mage::getSingleton('ops/config');
|
153 |
}
|
154 |
|
@@ -160,6 +173,16 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
160 |
return $this->getPaymentAction();
|
161 |
}
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
/**
|
164 |
* return if shipment params are needed for request
|
165 |
*
|
@@ -206,7 +229,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
206 |
|
207 |
$storeId = 0;
|
208 |
// allow multi store/site for backend orders with disabled backend payment methods in default store
|
209 |
-
if (
|
210 |
$storeId = $quote->getStoreId();
|
211 |
}
|
212 |
if (Mage_Core_Model_App::ADMIN_STORE_ID == Mage::app()->getStore()->getId()
|
@@ -221,6 +244,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
221 |
/**
|
222 |
* if method is enabled for backend payments
|
223 |
*
|
|
|
224 |
* @return bool
|
225 |
*/
|
226 |
public function isEnabledForBackend($storeId = 0)
|
@@ -238,18 +262,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
238 |
return $this->getConfig()->getPaymentRedirectUrl();
|
239 |
}
|
240 |
|
241 |
-
protected function getPayment()
|
242 |
-
{
|
243 |
-
$checkout = Mage::getSingleton('checkout/session');
|
244 |
-
$payment = $checkout->getQuote()->getPayment();
|
245 |
-
if (!$payment->getId()) {
|
246 |
-
$payment = Mage::getModel('sales/order')->loadByIncrementId($checkout->getLastRealOrderId())->getPayment();
|
247 |
-
}
|
248 |
-
}
|
249 |
-
|
250 |
public function getOpsBrand($payment = null)
|
251 |
{
|
252 |
-
if (
|
253 |
$payment = $this->getInfoInstance();
|
254 |
}
|
255 |
$brand = trim($payment->getAdditionalInformation('BRAND'));
|
@@ -262,7 +277,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
262 |
|
263 |
public function getOpsCode($payment = null)
|
264 |
{
|
265 |
-
if (
|
266 |
$payment = $this->getInfoInstance();
|
267 |
}
|
268 |
$pm = trim($payment->getAdditionalInformation('PM'));
|
@@ -361,9 +376,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
361 |
/**
|
362 |
* Prepare params array to send it to gateway page via POST
|
363 |
*
|
364 |
-
* @param
|
365 |
-
* @param
|
366 |
-
*
|
367 |
* @return array
|
368 |
*/
|
369 |
public function getFormFields($order, $requestParams, $isRequest = true)
|
@@ -379,13 +394,6 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
379 |
// get mandatory parameters
|
380 |
$formFields = $this->getMandatoryFormFields($order);
|
381 |
|
382 |
-
// get method specific parameters
|
383 |
-
$methodDependendFields = $this->getMethodDependendFormFields($order, $requestParams);
|
384 |
-
if (is_array($methodDependendFields)) {
|
385 |
-
$formFields = array_merge($formFields, $methodDependendFields);
|
386 |
-
}
|
387 |
-
|
388 |
-
|
389 |
$paymentAction = $this->_getOPSPaymentOperation();
|
390 |
if ($paymentAction ) {
|
391 |
$formFields['OPERATION'] = $paymentAction;
|
@@ -393,11 +401,14 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
393 |
|
394 |
$formFields = array_merge($formFields, $requestHelper->getTemplateParams($order->getStoreId()));
|
395 |
|
396 |
-
$
|
397 |
-
$formFields['
|
398 |
-
$formFields['
|
399 |
-
$formFields['
|
400 |
-
$formFields['
|
|
|
|
|
|
|
401 |
|
402 |
|
403 |
/** @var $order Mage_Sales_Model_Order */
|
@@ -423,6 +434,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
423 |
$formFields = array_merge($formFields, $methodDependendFields);
|
424 |
}
|
425 |
|
|
|
|
|
426 |
$shaSign = Mage::helper('ops/payment')->shaCrypt(
|
427 |
Mage::helper('ops/payment')
|
428 |
->getSHASign($formFields, null, $order->getStoreId())
|
@@ -465,19 +478,6 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
465 |
return $value;
|
466 |
}
|
467 |
|
468 |
-
protected function convertToLatin1($StringToConvert)
|
469 |
-
{
|
470 |
-
$returnString = '';
|
471 |
-
$chars = str_split($StringToConvert);
|
472 |
-
foreach ($chars as $char) {
|
473 |
-
if (31 < ord($char) && ord($char) < 127) {
|
474 |
-
$returnString .= $char;
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
return $returnString;
|
479 |
-
}
|
480 |
-
|
481 |
/**
|
482 |
* get formated order description
|
483 |
*
|
@@ -487,22 +487,18 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
487 |
*/
|
488 |
public function _getOrderDescription($order)
|
489 |
{
|
490 |
-
$
|
491 |
-
$
|
492 |
-
$
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
if (100 <= Mage::helper('core/string')->strlen($description)) {
|
503 |
-
break;
|
504 |
-
}
|
505 |
-
}
|
506 |
|
507 |
return $description;
|
508 |
}
|
@@ -561,7 +557,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
561 |
parent::acceptPayment($payment);
|
562 |
$status = $payment->getAdditionalInformation('status');
|
563 |
|
564 |
-
if ($status == Netresearch_OPS_Model_Status::AUTHORIZED
|
|
|
|
|
565 |
return true;
|
566 |
}
|
567 |
|
@@ -587,7 +585,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
587 |
parent::denyPayment($payment);
|
588 |
|
589 |
Mage::getSingleton('admin/session')->addNotice(
|
590 |
-
$this->getHelper()->__(
|
|
|
591 |
);
|
592 |
|
593 |
return true;
|
@@ -640,9 +639,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
640 |
self::OPS_CAPTURE_TRANSACTION_TYPE,
|
641 |
$this,
|
642 |
$payment,
|
643 |
-
$amount
|
644 |
-
$arrInfo
|
645 |
);
|
|
|
646 |
$response = Mage::getSingleton('ops/api_directlink')->performRequest(
|
647 |
$requestParams,
|
648 |
Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
|
@@ -651,13 +650,13 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
651 |
|
652 |
Mage::getModel('ops/response_handler')->processResponse($response, $this, false);
|
653 |
|
654 |
-
return $this;
|
655 |
-
|
656 |
} catch (Exception $e) {
|
657 |
Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
|
658 |
Mage::helper('ops')->log("Exception in capture request:" . $e->getMessage());
|
659 |
Mage::throwException($e->getMessage());
|
660 |
}
|
|
|
|
|
661 |
}
|
662 |
|
663 |
/**
|
@@ -670,14 +669,19 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
670 |
*/
|
671 |
public function refund(Varien_Object $payment, $amount)
|
672 |
{
|
|
|
673 |
$refundHelper = Mage::helper('ops/order_refund');
|
674 |
|
675 |
if ($refundHelper->getOpenRefundTransaction($payment)->getId()) {
|
676 |
-
Mage::throwException(
|
|
|
|
|
|
|
|
|
|
|
677 |
}
|
678 |
|
679 |
$refundHelper->setAmount($amount)->setPayment($payment);
|
680 |
-
$arrInfo = $refundHelper->prepareOperation($payment, $amount);
|
681 |
$storeId = $payment->getOrder()->getStoreId();
|
682 |
|
683 |
try {
|
@@ -685,9 +689,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
685 |
self::OPS_REFUND_TRANSACTION_TYPE,
|
686 |
$this,
|
687 |
$payment,
|
688 |
-
$amount
|
689 |
-
$arrInfo
|
690 |
);
|
|
|
691 |
$response = Mage::getSingleton('ops/api_directlink')->performRequest(
|
692 |
$requestParams,
|
693 |
Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
|
@@ -756,11 +760,10 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
756 |
*/
|
757 |
|
758 |
//Proceed parent cancel method in case that regirstry value ops_auto_void is set
|
759 |
-
if (true === Mage::registry('ops_auto_void'))
|
760 |
Mage::unregister('ops_auto_void');
|
761 |
-
|
762 |
return parent::cancel($payment);
|
763 |
-
|
764 |
|
765 |
//If order has state 'pending_payment' and the payment has Acceptance-status 0 or null (unknown) then cancel the order
|
766 |
if (true === $this->canCancelManually($payment->getOrder())) {
|
@@ -772,23 +775,21 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
772 |
}
|
773 |
|
774 |
//Abort cancel method by throwing a Mage_Core_Exception
|
775 |
-
|
776 |
}
|
777 |
|
778 |
/**
|
779 |
* Custom void behavior, trigger Acceptance cancel request
|
780 |
*
|
781 |
-
* @param
|
782 |
-
*
|
783 |
-
* @return void
|
784 |
-
* @throws Mage_Core_Exception
|
785 |
*/
|
786 |
public function void(Varien_Object $payment)
|
787 |
{
|
788 |
|
789 |
$status = $payment->getAdditionalInformation('status');
|
790 |
|
791 |
-
if(!Netresearch_OPS_Model_Status::canVoidTransaction($status)){
|
792 |
Mage::throwException($this->getHelper()->__('Status %s can not be voided.', $status));
|
793 |
}
|
794 |
|
@@ -854,7 +855,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
854 |
Mage::helper('ops')->log(
|
855 |
"Exception in void request:" . $e->getMessage()
|
856 |
);
|
857 |
-
|
858 |
}
|
859 |
}
|
860 |
|
@@ -862,12 +863,10 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
862 |
* get question for fields with disputable value
|
863 |
* users are asked to correct the values before redirect to Acceptance
|
864 |
*
|
865 |
-
* @param Mage_Sales_Model_Order $order Current order
|
866 |
-
* @param array $requestParams Request parameters
|
867 |
*
|
868 |
* @return string
|
869 |
*/
|
870 |
-
public function getQuestion(
|
871 |
{
|
872 |
return '';
|
873 |
}
|
@@ -877,11 +876,10 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
877 |
* users are asked to correct the values before redirect to Acceptance
|
878 |
*
|
879 |
* @param Mage_Sales_Model_Order $order Current order
|
880 |
-
* @param array $requestParams Request parameters
|
881 |
*
|
882 |
* @return array
|
883 |
*/
|
884 |
-
public function getQuestionedFormFields($
|
885 |
{
|
886 |
return array();
|
887 |
}
|
@@ -901,11 +899,11 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
901 |
if (false == is_array($requestParams)) {
|
902 |
$requestParams = array();
|
903 |
}
|
904 |
-
if (
|
905 |
$formFields = $this->getFormFields($order, $requestParams, false);
|
906 |
}
|
907 |
$availableParams = array_merge($requestParams, $formFields);
|
908 |
-
$requiredParams = $this->getQuestionedFormFields($order
|
909 |
foreach ($requiredParams as $requiredParam) {
|
910 |
if (false == array_key_exists($requiredParam, $availableParams)
|
911 |
|| 0 == strlen($availableParams[$requiredParam])
|
@@ -931,7 +929,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
931 |
//If payment has Acceptance-status 0 or null (unknown) or another offline cancelable status
|
932 |
$status = $payment->getAdditionalInformation('status');
|
933 |
|
934 |
-
return
|
935 |
|| in_array(
|
936 |
$status, array(
|
937 |
Netresearch_OPS_Model_Status::INVALID_INCOMPLETE,
|
@@ -945,9 +943,9 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
945 |
public function getOpsHtmlAnswer($payment = null)
|
946 |
{
|
947 |
$returnValue = '';
|
948 |
-
if (
|
949 |
$quoteId = Mage::getSingleton('checkout/session')->getQuote()->getId();
|
950 |
-
if (
|
951 |
$orderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
952 |
$order = Mage::getModel('sales/order')->loadByAttribute('increment_id', $orderIncrementId);
|
953 |
} else {
|
@@ -1033,8 +1031,7 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
1033 |
*/
|
1034 |
public function canVoid(Varien_Object $payment)
|
1035 |
{
|
1036 |
-
|
1037 |
-
if(Netresearch_OPS_Model_Status::canVoidTransaction($payment->getAdditionalInformation('status'))){
|
1038 |
return parent::canVoid($payment);
|
1039 |
} else {
|
1040 |
return false;
|
@@ -1050,8 +1047,8 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
1050 |
parent::assignData($data);
|
1051 |
|
1052 |
$paymentInfo = $this->getInfoInstance();
|
1053 |
-
if ($
|
1054 |
-
foreach ($
|
1055 |
$paymentInfo->setAdditionalInformation($key, $value);
|
1056 |
}
|
1057 |
}
|
@@ -1072,11 +1069,13 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
1072 |
$shippingAddress = $paymentInfo->getOrder()->getShippingAddress();
|
1073 |
$salesObject = $paymentInfo->getOrder();
|
1074 |
} else {
|
|
|
1075 |
$salesObject = $paymentInfo->getQuote();
|
1076 |
$billingAddress = $salesObject->getBillingAddress();
|
1077 |
$shippingAddress = $salesObject->getShippingAddress();
|
1078 |
}
|
1079 |
|
|
|
1080 |
$validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
|
1081 |
Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
|
1082 |
);
|
@@ -1084,22 +1083,45 @@ class Netresearch_OPS_Model_Payment_Abstract extends Mage_Payment_Model_Method_A
|
|
1084 |
$params = $this->getRequestHelper()->getOwnerParams($billingAddress, $salesObject);
|
1085 |
$billingParams = $this->getBillToParams($billingAddress);
|
1086 |
$shippingParams = $this->getShipToParams($shippingAddress);
|
1087 |
-
if($shippingParams) {
|
1088 |
$params = array_merge($params, $shippingParams);
|
1089 |
}
|
1090 |
-
if($billingParams){
|
1091 |
$params = array_merge($params, $billingParams);
|
1092 |
}
|
|
|
1093 |
|
1094 |
-
if(false === $validator->isValid($params)){
|
1095 |
$result = Mage::helper('ops/validation_result')->getValidationFailedResult(
|
1096 |
$validator->getMessages(), $salesObject
|
1097 |
);
|
1098 |
-
throw
|
1099 |
}
|
1100 |
|
1101 |
return parent::validate();
|
1102 |
}
|
1103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1104 |
|
1105 |
}
|
39 |
protected $_config = null;
|
40 |
protected $requestHelper = null;
|
41 |
protected $backendOperationParameterModel = null;
|
42 |
+
protected $encoding = 'utf-8';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
/**
|
45 |
* Magento Payment Behaviour Settings
|
62 |
*/
|
63 |
|
64 |
protected $_needsCartDataForRequest = false;
|
|
|
65 |
protected $_needsShipToParams = true;
|
66 |
+
protected $_needsBillToParams = true;
|
|
|
67 |
|
68 |
/**
|
69 |
* OPS template modes
|
73 |
const TEMPLATE_OPS_TEMPLATE = 'ops_template';
|
74 |
const TEMPLATE_MAGENTO_INTERNAL = 'magento';
|
75 |
|
|
|
76 |
/**
|
77 |
* redirect references
|
78 |
*/
|
|
|
79 |
const REFERENCE_QUOTE_ID = 'quoteId';
|
80 |
const REFERENCE_ORDER_ID = 'orderId';
|
81 |
|
118 |
*/
|
119 |
const FINGERPRINT_CONSENT_SESSION_KEY = 'device_fingerprinting_consent';
|
120 |
|
121 |
+
/**
|
122 |
+
* @return string
|
123 |
+
*/
|
124 |
+
public function getEncoding()
|
125 |
+
{
|
126 |
+
return $this->encoding;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @param string $encoding
|
131 |
+
*/
|
132 |
+
public function setEncoding($encoding)
|
133 |
+
{
|
134 |
+
$this->encoding = $encoding;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* @param null $backendOperationParameterModel
|
139 |
+
*/
|
140 |
+
public function setBackendOperationParameterModel($backendOperationParameterModel)
|
141 |
+
{
|
142 |
+
$this->backendOperationParameterModel = $backendOperationParameterModel;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* @return Netresearch_OPS_Model_Backend_Operation_Parameter
|
147 |
+
*/
|
148 |
+
public function getBackendOperationParameterModel()
|
149 |
+
{
|
150 |
+
if (null === $this->backendOperationParameterModel) {
|
151 |
+
$this->backendOperationParameterModel = Mage::getModel('ops/backend_operation_parameter');
|
152 |
+
}
|
153 |
+
|
154 |
+
return $this->backendOperationParameterModel;
|
155 |
+
}
|
156 |
+
|
157 |
/**
|
158 |
* Return OPS Config
|
159 |
*
|
161 |
*/
|
162 |
public function getConfig()
|
163 |
{
|
164 |
+
if (null === $this->_config) {
|
165 |
$this->_config = Mage::getSingleton('ops/config');
|
166 |
}
|
167 |
|
173 |
return $this->getPaymentAction();
|
174 |
}
|
175 |
|
176 |
+
/**
|
177 |
+
* get the frontend gateway path based on encoding property
|
178 |
+
*/
|
179 |
+
public function getFrontendGateWay()
|
180 |
+
{
|
181 |
+
$gateway = $this->getConfig()->getFrontendGatewayPath();
|
182 |
+
|
183 |
+
return $gateway;
|
184 |
+
}
|
185 |
+
|
186 |
/**
|
187 |
* return if shipment params are needed for request
|
188 |
*
|
229 |
|
230 |
$storeId = 0;
|
231 |
// allow multi store/site for backend orders with disabled backend payment methods in default store
|
232 |
+
if (null != $quote && null != $quote->getId()) {
|
233 |
$storeId = $quote->getStoreId();
|
234 |
}
|
235 |
if (Mage_Core_Model_App::ADMIN_STORE_ID == Mage::app()->getStore()->getId()
|
244 |
/**
|
245 |
* if method is enabled for backend payments
|
246 |
*
|
247 |
+
* @param int $storeId
|
248 |
* @return bool
|
249 |
*/
|
250 |
public function isEnabledForBackend($storeId = 0)
|
262 |
return $this->getConfig()->getPaymentRedirectUrl();
|
263 |
}
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
public function getOpsBrand($payment = null)
|
266 |
{
|
267 |
+
if (null === $payment) {
|
268 |
$payment = $this->getInfoInstance();
|
269 |
}
|
270 |
$brand = trim($payment->getAdditionalInformation('BRAND'));
|
277 |
|
278 |
public function getOpsCode($payment = null)
|
279 |
{
|
280 |
+
if (null === $payment) {
|
281 |
$payment = $this->getInfoInstance();
|
282 |
}
|
283 |
$pm = trim($payment->getAdditionalInformation('PM'));
|
376 |
/**
|
377 |
* Prepare params array to send it to gateway page via POST
|
378 |
*
|
379 |
+
* @param $order
|
380 |
+
* @param $requestParams
|
381 |
+
* @param bool $isRequest
|
382 |
* @return array
|
383 |
*/
|
384 |
public function getFormFields($order, $requestParams, $isRequest = true)
|
394 |
// get mandatory parameters
|
395 |
$formFields = $this->getMandatoryFormFields($order);
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
$paymentAction = $this->_getOPSPaymentOperation();
|
398 |
if ($paymentAction ) {
|
399 |
$formFields['OPERATION'] = $paymentAction;
|
401 |
|
402 |
$formFields = array_merge($formFields, $requestHelper->getTemplateParams($order->getStoreId()));
|
403 |
|
404 |
+
$opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
|
405 |
+
$formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();
|
406 |
+
$formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();
|
407 |
+
$formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();
|
408 |
+
$formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();
|
409 |
+
$formFields['BACKURL'] = $this->getConfig()->getPaymentRetryUrl(
|
410 |
+
Mage::helper('ops/payment')->validateOrderForReuse($opsOrderId, $order->getStoreId())
|
411 |
+
);
|
412 |
|
413 |
|
414 |
/** @var $order Mage_Sales_Model_Order */
|
434 |
$formFields = array_merge($formFields, $methodDependendFields);
|
435 |
}
|
436 |
|
437 |
+
$formFields = $this->transliterateParams($formFields);
|
438 |
+
|
439 |
$shaSign = Mage::helper('ops/payment')->shaCrypt(
|
440 |
Mage::helper('ops/payment')
|
441 |
->getSHASign($formFields, null, $order->getStoreId())
|
478 |
return $value;
|
479 |
}
|
480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
/**
|
482 |
* get formated order description
|
483 |
*
|
487 |
*/
|
488 |
public function _getOrderDescription($order)
|
489 |
{
|
490 |
+
/** @var Mage_Sales_Model_Order_Item[] $items */
|
491 |
+
$items = $order->getAllItems();
|
492 |
+
$description = array_reduce(
|
493 |
+
$items,
|
494 |
+
function ($acc, $item) {
|
495 |
+
/** @var Mage_Sales_Model_Order_Item $item */
|
496 |
+
if (!$item->getParentItem()) {
|
497 |
+
$acc .= ($acc != '' ? ', ' : '') . $item->getName();
|
498 |
+
}
|
499 |
+
return $acc;
|
500 |
+
}, ''
|
501 |
+
);
|
|
|
|
|
|
|
|
|
502 |
|
503 |
return $description;
|
504 |
}
|
557 |
parent::acceptPayment($payment);
|
558 |
$status = $payment->getAdditionalInformation('status');
|
559 |
|
560 |
+
if ($status == Netresearch_OPS_Model_Status::AUTHORIZED
|
561 |
+
|| $status == Netresearch_OPS_Model_Status::PAYMENT_REQUESTED)
|
562 |
+
{
|
563 |
return true;
|
564 |
}
|
565 |
|
585 |
parent::denyPayment($payment);
|
586 |
|
587 |
Mage::getSingleton('admin/session')->addNotice(
|
588 |
+
$this->getHelper()->__(
|
589 |
+
'Order has been canceled permanently in Magento. Changes in Acceptance platform will no longer be considered.')
|
590 |
);
|
591 |
|
592 |
return true;
|
639 |
self::OPS_CAPTURE_TRANSACTION_TYPE,
|
640 |
$this,
|
641 |
$payment,
|
642 |
+
$amount
|
|
|
643 |
);
|
644 |
+
$requestParams = $this->transliterateParams($requestParams);
|
645 |
$response = Mage::getSingleton('ops/api_directlink')->performRequest(
|
646 |
$requestParams,
|
647 |
Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
|
650 |
|
651 |
Mage::getModel('ops/response_handler')->processResponse($response, $this, false);
|
652 |
|
|
|
|
|
653 |
} catch (Exception $e) {
|
654 |
Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
|
655 |
Mage::helper('ops')->log("Exception in capture request:" . $e->getMessage());
|
656 |
Mage::throwException($e->getMessage());
|
657 |
}
|
658 |
+
|
659 |
+
return $this;
|
660 |
}
|
661 |
|
662 |
/**
|
669 |
*/
|
670 |
public function refund(Varien_Object $payment, $amount)
|
671 |
{
|
672 |
+
/** @var Netresearch_OPS_Helper_Order_Refund $refundHelper */
|
673 |
$refundHelper = Mage::helper('ops/order_refund');
|
674 |
|
675 |
if ($refundHelper->getOpenRefundTransaction($payment)->getId()) {
|
676 |
+
Mage::throwException(
|
677 |
+
$this->getHelper()->__(
|
678 |
+
"There is already one creditmemo in the queue." .
|
679 |
+
"The Creditmemo will be created automatically as soon as Acceptance sends an acknowledgement."
|
680 |
+
)
|
681 |
+
);
|
682 |
}
|
683 |
|
684 |
$refundHelper->setAmount($amount)->setPayment($payment);
|
|
|
685 |
$storeId = $payment->getOrder()->getStoreId();
|
686 |
|
687 |
try {
|
689 |
self::OPS_REFUND_TRANSACTION_TYPE,
|
690 |
$this,
|
691 |
$payment,
|
692 |
+
$amount
|
|
|
693 |
);
|
694 |
+
$requestParams = $this->transliterateParams($requestParams);
|
695 |
$response = Mage::getSingleton('ops/api_directlink')->performRequest(
|
696 |
$requestParams,
|
697 |
Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId),
|
760 |
*/
|
761 |
|
762 |
//Proceed parent cancel method in case that regirstry value ops_auto_void is set
|
763 |
+
if (true === Mage::registry('ops_auto_void')) {
|
764 |
Mage::unregister('ops_auto_void');
|
|
|
765 |
return parent::cancel($payment);
|
766 |
+
}
|
767 |
|
768 |
//If order has state 'pending_payment' and the payment has Acceptance-status 0 or null (unknown) then cancel the order
|
769 |
if (true === $this->canCancelManually($payment->getOrder())) {
|
775 |
}
|
776 |
|
777 |
//Abort cancel method by throwing a Mage_Core_Exception
|
778 |
+
Mage::throwException($this->getHelper()->__('Please use void to cancel the operation.'));
|
779 |
}
|
780 |
|
781 |
/**
|
782 |
* Custom void behavior, trigger Acceptance cancel request
|
783 |
*
|
784 |
+
* @param Varien_Object $payment
|
785 |
+
* @return $this|void
|
|
|
|
|
786 |
*/
|
787 |
public function void(Varien_Object $payment)
|
788 |
{
|
789 |
|
790 |
$status = $payment->getAdditionalInformation('status');
|
791 |
|
792 |
+
if (!Netresearch_OPS_Model_Status::canVoidTransaction($status)) {
|
793 |
Mage::throwException($this->getHelper()->__('Status %s can not be voided.', $status));
|
794 |
}
|
795 |
|
855 |
Mage::helper('ops')->log(
|
856 |
"Exception in void request:" . $e->getMessage()
|
857 |
);
|
858 |
+
Mage::throwException($e->getMessage());
|
859 |
}
|
860 |
}
|
861 |
|
863 |
* get question for fields with disputable value
|
864 |
* users are asked to correct the values before redirect to Acceptance
|
865 |
*
|
|
|
|
|
866 |
*
|
867 |
* @return string
|
868 |
*/
|
869 |
+
public function getQuestion()
|
870 |
{
|
871 |
return '';
|
872 |
}
|
876 |
* users are asked to correct the values before redirect to Acceptance
|
877 |
*
|
878 |
* @param Mage_Sales_Model_Order $order Current order
|
|
|
879 |
*
|
880 |
* @return array
|
881 |
*/
|
882 |
+
public function getQuestionedFormFields($order)
|
883 |
{
|
884 |
return array();
|
885 |
}
|
899 |
if (false == is_array($requestParams)) {
|
900 |
$requestParams = array();
|
901 |
}
|
902 |
+
if (null === $formFields) {
|
903 |
$formFields = $this->getFormFields($order, $requestParams, false);
|
904 |
}
|
905 |
$availableParams = array_merge($requestParams, $formFields);
|
906 |
+
$requiredParams = $this->getQuestionedFormFields($order);
|
907 |
foreach ($requiredParams as $requiredParam) {
|
908 |
if (false == array_key_exists($requiredParam, $availableParams)
|
909 |
|| 0 == strlen($availableParams[$requiredParam])
|
929 |
//If payment has Acceptance-status 0 or null (unknown) or another offline cancelable status
|
930 |
$status = $payment->getAdditionalInformation('status');
|
931 |
|
932 |
+
return (null === $status)
|
933 |
|| in_array(
|
934 |
$status, array(
|
935 |
Netresearch_OPS_Model_Status::INVALID_INCOMPLETE,
|
943 |
public function getOpsHtmlAnswer($payment = null)
|
944 |
{
|
945 |
$returnValue = '';
|
946 |
+
if (null === $payment) {
|
947 |
$quoteId = Mage::getSingleton('checkout/session')->getQuote()->getId();
|
948 |
+
if (null === $quoteId) {
|
949 |
$orderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
950 |
$order = Mage::getModel('sales/order')->loadByAttribute('increment_id', $orderIncrementId);
|
951 |
} else {
|
1031 |
*/
|
1032 |
public function canVoid(Varien_Object $payment)
|
1033 |
{
|
1034 |
+
if (Netresearch_OPS_Model_Status::canVoidTransaction($payment->getAdditionalInformation('status'))) {
|
|
|
1035 |
return parent::canVoid($payment);
|
1036 |
} else {
|
1037 |
return false;
|
1047 |
parent::assignData($data);
|
1048 |
|
1049 |
$paymentInfo = $this->getInfoInstance();
|
1050 |
+
if ($data instanceof Varien_Object && $data->getData($this->getCode().'_data')) {
|
1051 |
+
foreach ($data->getData($this->getCode().'_data') as $key => $value) {
|
1052 |
$paymentInfo->setAdditionalInformation($key, $value);
|
1053 |
}
|
1054 |
}
|
1069 |
$shippingAddress = $paymentInfo->getOrder()->getShippingAddress();
|
1070 |
$salesObject = $paymentInfo->getOrder();
|
1071 |
} else {
|
1072 |
+
/** @var Mage_Sales_Model_Quote $salesObject */
|
1073 |
$salesObject = $paymentInfo->getQuote();
|
1074 |
$billingAddress = $salesObject->getBillingAddress();
|
1075 |
$shippingAddress = $salesObject->getShippingAddress();
|
1076 |
}
|
1077 |
|
1078 |
+
/** @var Netresearch_OPS_Model_Validator_Parameter_Length $validator */
|
1079 |
$validator = Mage::getModel('ops/validator_parameter_factory')->getValidatorFor(
|
1080 |
Netresearch_OPS_Model_Validator_Parameter_Factory::TYPE_REQUEST_PARAMS_VALIDATION
|
1081 |
);
|
1083 |
$params = $this->getRequestHelper()->getOwnerParams($billingAddress, $salesObject);
|
1084 |
$billingParams = $this->getBillToParams($billingAddress);
|
1085 |
$shippingParams = $this->getShipToParams($shippingAddress);
|
1086 |
+
if ($shippingParams) {
|
1087 |
$params = array_merge($params, $shippingParams);
|
1088 |
}
|
1089 |
+
if ($billingParams) {
|
1090 |
$params = array_merge($params, $billingParams);
|
1091 |
}
|
1092 |
+
$params['CN'] = $billingAddress->getFirstname() . ' ' . $billingAddress->getLastname();
|
1093 |
|
1094 |
+
if (false === $validator->isValid($params)) {
|
1095 |
$result = Mage::helper('ops/validation_result')->getValidationFailedResult(
|
1096 |
$validator->getMessages(), $salesObject
|
1097 |
);
|
1098 |
+
throw Mage::exception('Mage_Payment', implode(', ', $result['fields']));
|
1099 |
}
|
1100 |
|
1101 |
return parent::validate();
|
1102 |
}
|
1103 |
|
1104 |
+
/**
|
1105 |
+
* Transliterates params if necessary by configuration
|
1106 |
+
*
|
1107 |
+
* @param string[] $formFields formfields to transliterate
|
1108 |
+
*
|
1109 |
+
* @return string[]
|
1110 |
+
*/
|
1111 |
+
protected function transliterateParams($formFields)
|
1112 |
+
{
|
1113 |
+
if (strtoupper($this->getEncoding()) != 'UTF-8') {
|
1114 |
+
setlocale(LC_CTYPE, Mage::app()->getLocale()->getLocaleCode());
|
1115 |
+
array_walk(
|
1116 |
+
$formFields,
|
1117 |
+
function (&$value) {
|
1118 |
+
$value = iconv('UTF-8', 'ASCII//TRANSLIT', $value);
|
1119 |
+
}
|
1120 |
+
);
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
return $formFields;
|
1124 |
+
}
|
1125 |
+
|
1126 |
|
1127 |
}
|
app/code/community/Netresearch/OPS/Model/Payment/Bancontact.php
CHANGED
@@ -38,11 +38,65 @@ class Netresearch_OPS_Model_Payment_Bancontact
|
|
38 |
protected $_canBackendDirectCapture = true;
|
39 |
|
40 |
/** info source path */
|
41 |
-
protected $_infoBlockType = 'ops/
|
42 |
|
43 |
/** payment code */
|
44 |
protected $_code = self::CODE;
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
}
|
48 |
|
38 |
protected $_canBackendDirectCapture = true;
|
39 |
|
40 |
/** info source path */
|
41 |
+
protected $_infoBlockType = 'ops/info_bancontact';
|
42 |
|
43 |
/** payment code */
|
44 |
protected $_code = self::CODE;
|
45 |
|
46 |
+
protected $_mobileDetectHelper = null;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* add needed params to dependend formfields
|
50 |
+
*
|
51 |
+
* @param Mage_Sales_Model_Order $order
|
52 |
+
* @param null $requestParams
|
53 |
+
* @return string[]
|
54 |
+
*/
|
55 |
+
public function getMethodDependendFormFields($order, $requestParams = null)
|
56 |
+
{
|
57 |
+
$formFields = parent::getMethodDependendFormFields($order, $requestParams);
|
58 |
+
$formFields['DEVICE'] = $this->getInfoInstance()->getAdditionalInformation('DEVICE');
|
59 |
+
|
60 |
+
return $formFields;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @param mixed $data
|
65 |
+
* @return $this
|
66 |
+
*/
|
67 |
+
public function assignData($data)
|
68 |
+
{
|
69 |
+
parent::assignData($data);
|
70 |
+
$payment = $this->getInfoInstance();
|
71 |
+
$payment->setAdditionalInformation('DEVICE', $this->getMobileDetectHelper()->getDeviceType());
|
72 |
+
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Get Mobile Detect Helper
|
78 |
+
*
|
79 |
+
* @return Netresearch_OPS_Helper_MobileDetect
|
80 |
+
*/
|
81 |
+
public function getMobileDetectHelper()
|
82 |
+
{
|
83 |
+
if ($this->_mobileDetectHelper === null) {
|
84 |
+
$this->_mobileDetectHelper = Mage::helper('ops/mobileDetect');
|
85 |
+
}
|
86 |
+
return $this->_mobileDetectHelper;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param Netresearch_OPS_Helper_MobileDetect $mobileHelper
|
91 |
+
*
|
92 |
+
* @returns $this
|
93 |
+
*/
|
94 |
+
public function setMobileDetectHelper($mobileHelper)
|
95 |
+
{
|
96 |
+
$this->_mobileDetectHelper = $mobileHelper;
|
97 |
+
|
98 |
+
return $this;
|
99 |
+
}
|
100 |
|
101 |
}
|
102 |
|
app/code/community/Netresearch/OPS/Model/Payment/BankTransfer.php
CHANGED
@@ -16,6 +16,9 @@ class Netresearch_OPS_Model_Payment_BankTransfer
|
|
16 |
/** info source path */
|
17 |
protected $_infoBlockType = 'ops/info_redirect';
|
18 |
|
|
|
|
|
|
|
19 |
/** payment code */
|
20 |
protected $_code = 'ops_bankTransfer';
|
21 |
|
@@ -37,7 +40,7 @@ class Netresearch_OPS_Model_Payment_BankTransfer
|
|
37 |
$pm = $brand = trim('Bank transfer' . (('*' == $countryId) ? '' : ' ' . $countryId));
|
38 |
|
39 |
$payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
40 |
-
$payment->setAdditionalInformation('PM',
|
41 |
$payment->setAdditionalInformation('BRAND', $brand);
|
42 |
|
43 |
parent::assignData($data);
|
16 |
/** info source path */
|
17 |
protected $_infoBlockType = 'ops/info_redirect';
|
18 |
|
19 |
+
/** form block type */
|
20 |
+
protected $_formBlockType = 'ops/form_bankTransfer';
|
21 |
+
|
22 |
/** payment code */
|
23 |
protected $_code = 'ops_bankTransfer';
|
24 |
|
40 |
$pm = $brand = trim('Bank transfer' . (('*' == $countryId) ? '' : ' ' . $countryId));
|
41 |
|
42 |
$payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
43 |
+
$payment->setAdditionalInformation('PM', $pm);
|
44 |
$payment->setAdditionalInformation('BRAND', $brand);
|
45 |
|
46 |
parent::assignData($data);
|
app/code/community/Netresearch/OPS/Model/Payment/Cc.php
CHANGED
@@ -24,7 +24,10 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
|
|
24 |
protected $featureModel = null;
|
25 |
|
26 |
|
27 |
-
/**
|
|
|
|
|
|
|
28 |
public function getOpsCode($payment = null)
|
29 |
{
|
30 |
$opsBrand = $this->getOpsBrand($payment);
|
@@ -45,7 +48,7 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
|
|
45 |
*/
|
46 |
public function getOpsBrand($payment = null)
|
47 |
{
|
48 |
-
if (
|
49 |
$payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
50 |
}
|
51 |
|
@@ -63,7 +66,7 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
|
|
63 |
public function getOrderPlaceRedirectUrl($payment = null)
|
64 |
{
|
65 |
$salesObject = $this->getInfoInstance()->getOrder() ? : $this->getInfoInstance()->getQuote();
|
66 |
-
if ($this->hasBrandAliasInterfaceSupport($payment) ||
|
67 |
if ('' == $this->getOpsHtmlAnswer($payment)) {
|
68 |
return false;
|
69 |
} // Prevent redirect on cc payment
|
@@ -143,9 +146,11 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
|
|
143 |
}
|
144 |
|
145 |
|
146 |
-
protected function performPreDirectLinkCallActions(
|
|
|
147 |
$requestParams = array()
|
148 |
-
)
|
|
|
149 |
Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true);
|
150 |
if (true === Mage::getModel('ops/config')->isAliasManagerEnabled($this->getCode())) {
|
151 |
$this->validateAlias($quote, $payment);
|
@@ -246,7 +251,7 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
|
|
246 |
*/
|
247 |
public function isAvailable($quote = null)
|
248 |
{
|
249 |
-
if (
|
250 |
/* Disable payment method in backend as long as there are no items in quote to
|
251 |
* avoid problems with alias creation in EE1.12 & EE1.13
|
252 |
*/
|
@@ -271,6 +276,26 @@ class Netresearch_OPS_Model_Payment_Cc extends Netresearch_OPS_Model_Payment_Dir
|
|
271 |
$formFields['CREDITDEBIT'] = "C";
|
272 |
}
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
return $formFields;
|
275 |
}
|
276 |
}
|
24 |
protected $featureModel = null;
|
25 |
|
26 |
|
27 |
+
/**
|
28 |
+
* @param null $payment
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
public function getOpsCode($payment = null)
|
32 |
{
|
33 |
$opsBrand = $this->getOpsBrand($payment);
|
48 |
*/
|
49 |
public function getOpsBrand($payment = null)
|
50 |
{
|
51 |
+
if (null === $payment) {
|
52 |
$payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
53 |
}
|
54 |
|
66 |
public function getOrderPlaceRedirectUrl($payment = null)
|
67 |
{
|
68 |
$salesObject = $this->getInfoInstance()->getOrder() ? : $this->getInfoInstance()->getQuote();
|
69 |
+
if ($this->hasBrandAliasInterfaceSupport($payment) || null === $salesObject->getRemoteIp()) {
|
70 |
if ('' == $this->getOpsHtmlAnswer($payment)) {
|
71 |
return false;
|
72 |
} // Prevent redirect on cc payment
|
146 |
}
|
147 |
|
148 |
|
149 |
+
protected function performPreDirectLinkCallActions(
|
150 |
+
Mage_Sales_Model_Quote $quote, Varien_Object $payment,
|
151 |
$requestParams = array()
|
152 |
+
)
|
153 |
+
{
|
154 |
Mage::helper('ops/alias')->cleanUpAdditionalInformation($payment, true);
|
155 |
if (true === Mage::getModel('ops/config')->isAliasManagerEnabled($this->getCode())) {
|
156 |
$this->validateAlias($quote, $payment);
|
251 |
*/
|
252 |
public function isAvailable($quote = null)
|
253 |
{
|
254 |
+
if (null != $quote && !$quote->getItemsCount() > 0 && $this->getDataHelper()->isAdminSession()) {
|
255 |
/* Disable payment method in backend as long as there are no items in quote to
|
256 |
* avoid problems with alias creation in EE1.12 & EE1.13
|
257 |
*/
|
276 |
$formFields['CREDITDEBIT'] = "C";
|
277 |
}
|
278 |
|
279 |
+
$alias = $order->getPayment()->getAdditionalInformation('alias');
|
280 |
+
|
281 |
+
if ($alias) {
|
282 |
+
$formFields['ALIAS'] = $alias;
|
283 |
+
$formFields['ALIASOPERATION'] = "BYPSP";
|
284 |
+
$formFields['ECI'] = 9;
|
285 |
+
$formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForExistingAlias(
|
286 |
+
$order->getPayment()->getMethodInstance()->getCode(),
|
287 |
+
$order->getStoreId()
|
288 |
+
);
|
289 |
+
} else {
|
290 |
+
$formFields['ALIAS'] = "";
|
291 |
+
$formFields['ALIASOPERATION'] = "BYPSP";
|
292 |
+
$formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForNewAlias(
|
293 |
+
$order->getPayment()->getMethodInstance()->getCode(),
|
294 |
+
$order->getStoreId()
|
295 |
+
);
|
296 |
+
|
297 |
+
}
|
298 |
+
|
299 |
return $formFields;
|
300 |
}
|
301 |
}
|
app/code/community/Netresearch/OPS/Model/Payment/Debitcard.php
CHANGED
@@ -15,7 +15,10 @@ class Netresearch_OPS_Model_Payment_Debitcard extends Netresearch_OPS_Model_Paym
|
|
15 |
protected $_code = 'ops_dc';
|
16 |
|
17 |
|
18 |
-
/**
|
|
|
|
|
|
|
19 |
public function getOpsCode($payment = null)
|
20 |
{
|
21 |
return 'CreditCard';
|
15 |
protected $_code = 'ops_dc';
|
16 |
|
17 |
|
18 |
+
/**
|
19 |
+
* @param null $payment
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
public function getOpsCode($payment = null)
|
23 |
{
|
24 |
return 'CreditCard';
|
app/code/community/Netresearch/OPS/Model/Payment/DirectDebit.php
CHANGED
@@ -38,22 +38,23 @@ class Netresearch_OPS_Model_Payment_DirectDebit
|
|
38 |
return $this->requestParamsHelper;
|
39 |
}
|
40 |
|
41 |
-
protected function performPreDirectLinkCallActions(
|
|
|
|
|
|
|
42 |
{
|
43 |
return $this;
|
44 |
}
|
45 |
|
46 |
protected function performPostDirectLinkCallAction(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order)
|
47 |
{
|
|
|
|
|
48 |
return $this;
|
49 |
}
|
50 |
|
51 |
protected function handleAdminPayment(Mage_Sales_Model_Quote $quote)
|
52 |
{
|
53 |
-
$directDebitHelper = Mage::helper('ops/directDebit');
|
54 |
-
$requestParams = Mage::app()->getRequest()->getParam('ops_directDebit');
|
55 |
-
$directDebitHelper->handleAdminPayment($quote, $requestParams);
|
56 |
-
|
57 |
return $this;
|
58 |
}
|
59 |
}
|
38 |
return $this->requestParamsHelper;
|
39 |
}
|
40 |
|
41 |
+
protected function performPreDirectLinkCallActions(
|
42 |
+
Mage_Sales_Model_Quote $quote,
|
43 |
+
Varien_Object $payment, $requestParams = array()
|
44 |
+
)
|
45 |
{
|
46 |
return $this;
|
47 |
}
|
48 |
|
49 |
protected function performPostDirectLinkCallAction(Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Order $order)
|
50 |
{
|
51 |
+
Mage::helper('ops/alias')->setAliasActive($quote, $order);
|
52 |
+
|
53 |
return $this;
|
54 |
}
|
55 |
|
56 |
protected function handleAdminPayment(Mage_Sales_Model_Quote $quote)
|
57 |
{
|
|
|
|
|
|
|
|
|
58 |
return $this;
|
59 |
}
|
60 |
}
|
app/code/community/Netresearch/OPS/Model/Payment/DirectEbanking.php
CHANGED
@@ -16,20 +16,12 @@ class Netresearch_OPS_Model_Payment_DirectEbanking
|
|
16 |
/** info source path */
|
17 |
protected $_infoBlockType = 'ops/info_redirect';
|
18 |
|
|
|
|
|
|
|
19 |
/** payment code */
|
20 |
protected $_code = 'ops_directEbanking';
|
21 |
|
22 |
-
|
23 |
-
protected function getPayment()
|
24 |
-
{
|
25 |
-
$checkout = Mage::getSingleton('checkout/session');
|
26 |
-
$payment = $checkout->getQuote()->getPayment();
|
27 |
-
if (!$payment->getId()) {
|
28 |
-
$payment = Mage::getModel('sales/order')->loadByIncrementId($checkout->getLastRealOrderId())->getPayment();
|
29 |
-
}
|
30 |
-
return $payment;
|
31 |
-
}
|
32 |
-
|
33 |
/**
|
34 |
* Assign data to info model instance
|
35 |
*
|
@@ -51,7 +43,7 @@ class Netresearch_OPS_Model_Payment_DirectEbanking
|
|
51 |
|
52 |
$payment = $this->getInfoInstance();
|
53 |
// brand == pm for all DirectEbanking methods
|
54 |
-
$payment->setAdditionalInformation('PM',
|
55 |
$payment->setAdditionalInformation('BRAND', $brand);
|
56 |
parent::assignData($data);
|
57 |
return $this;
|
@@ -64,8 +56,9 @@ class Netresearch_OPS_Model_Payment_DirectEbanking
|
|
64 |
* @param string $value
|
65 |
* @return string
|
66 |
*/
|
67 |
-
protected function fixSofortUberweisungBrand($value)
|
68 |
-
|
|
|
69 |
return 'DirectEbanking';
|
70 |
}
|
71 |
return $value;
|
16 |
/** info source path */
|
17 |
protected $_infoBlockType = 'ops/info_redirect';
|
18 |
|
19 |
+
/** form block type */
|
20 |
+
protected $_formBlockType = 'ops/form_directEbanking';
|
21 |
+
|
22 |
/** payment code */
|
23 |
protected $_code = 'ops_directEbanking';
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Assign data to info model instance
|
27 |
*
|
43 |
|
44 |
$payment = $this->getInfoInstance();
|
45 |
// brand == pm for all DirectEbanking methods
|
46 |
+
$payment->setAdditionalInformation('PM', $brand);
|
47 |
$payment->setAdditionalInformation('BRAND', $brand);
|
48 |
parent::assignData($data);
|
49 |
return $this;
|
56 |
* @param string $value
|
57 |
* @return string
|
58 |
*/
|
59 |
+
protected function fixSofortUberweisungBrand($value)
|
60 |
+
{
|
61 |
+
if ($value === 'Sofort Uberweisung') {
|
62 |
return 'DirectEbanking';
|
63 |
}
|
64 |
return $value;
|
app/code/community/Netresearch/OPS/Model/Payment/DirectLink.php
CHANGED
@@ -155,7 +155,8 @@ abstract class Netresearch_OPS_Model_Payment_DirectLink extends Netresearch_OPS_
|
|
155 |
|
156 |
protected function confirmPayment(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote $quote,
|
157 |
Varien_Object $payment
|
158 |
-
)
|
|
|
159 |
$this->handleAdminPayment($quote);
|
160 |
$requestParams = $this->getRequestParamsHelper()->getDirectLinkRequestParams($quote, $order, $payment);
|
161 |
$this->invokeRequestParamValidation($requestParams);
|
@@ -215,7 +216,8 @@ abstract class Netresearch_OPS_Model_Payment_DirectLink extends Netresearch_OPS_
|
|
215 |
|
216 |
|
217 |
/**
|
218 |
-
* performs direct link request either for inline payments and
|
|
|
219 |
*
|
220 |
* @override
|
221 |
*
|
155 |
|
156 |
protected function confirmPayment(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote $quote,
|
157 |
Varien_Object $payment
|
158 |
+
)
|
159 |
+
{
|
160 |
$this->handleAdminPayment($quote);
|
161 |
$requestParams = $this->getRequestParamsHelper()->getDirectLinkRequestParams($quote, $order, $payment);
|
162 |
$this->invokeRequestParamValidation($requestParams);
|
216 |
|
217 |
|
218 |
/**
|
219 |
+
* performs direct link request either for inline payments and
|
220 |
+
* direct sale mode or the normal maintenance call (invoice)
|
221 |
*
|
222 |
* @override
|
223 |
*
|
app/code/community/Netresearch/OPS/Model/Payment/Features/PaymentEmail.php
CHANGED
@@ -1,197 +1,198 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Netresearch OPS
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
12 |
-
* DISCLAIMER
|
13 |
-
*
|
14 |
-
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
-
* newer versions in the future.
|
16 |
-
*
|
17 |
-
* @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
-
* @license Open Software License (OSL 3.0)
|
19 |
-
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
-
*/
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Implements functionality to send Acceptance specific mails
|
24 |
-
*
|
25 |
-
* @category Payment method
|
26 |
-
* @package Netresearch OPS
|
27 |
-
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
-
*/
|
29 |
-
class Netresearch_OPS_Model_Payment_Features_PaymentEmail
|
30 |
-
{
|
31 |
-
|
32 |
-
protected function getConfig()
|
33 |
-
{
|
34 |
-
return Mage::getModel('ops/config');
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Check if payment email is available for order
|
39 |
-
*
|
40 |
-
* @param $order
|
41 |
-
*
|
42 |
-
* @return bool
|
43 |
-
*/
|
44 |
-
public function isAvailableForOrder($order)
|
45 |
-
{
|
46 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
47 |
-
$status = $order->getPayment()->getAdditionalInformation('status');
|
48 |
-
|
49 |
-
return Netresearch_OPS_Model_Status::canResendPaymentInfo($status);
|
50 |
-
}
|
51 |
-
|
52 |
-
return false;
|
53 |
-
}
|
54 |
-
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Resends the payment information and returns true/false, depending if succeeded or not
|
58 |
-
*
|
59 |
-
* @param Mage_Sales_Model_Order $order
|
60 |
-
*
|
61 |
-
* @return boolean success state
|
62 |
-
*/
|
63 |
-
public function resendPaymentInfo(Mage_Sales_Model_Order $order)
|
64 |
-
{
|
65 |
-
|
66 |
-
// reset payment method so the customer can choose freely from all available methods
|
67 |
-
$this->setPaymentMethodToGeneric($order);
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
$
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
$
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
*
|
115 |
-
*
|
116 |
-
*
|
117 |
-
*
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
*
|
128 |
-
*
|
129 |
-
* @param
|
130 |
-
*
|
131 |
-
*
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
$
|
142 |
-
$customer->
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
"
|
150 |
-
"
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
*
|
163 |
-
*
|
164 |
-
*
|
165 |
-
*
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
$identity
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
*
|
180 |
-
* @param string $
|
181 |
-
* @param string $
|
182 |
-
*
|
183 |
-
*
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Netresearch OPS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* DISCLAIMER
|
13 |
+
*
|
14 |
+
* Do not edit or add to this file if you wish to upgrade this extension to
|
15 |
+
* newer versions in the future.
|
16 |
+
*
|
17 |
+
* @copyright Copyright (c) 2015 Netresearch GmbH & Co. KG (http://www.netresearch.de/)
|
18 |
+
* @license Open Software License (OSL 3.0)
|
19 |
+
* @link http://opensource.org/licenses/osl-3.0.php
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Implements functionality to send Acceptance specific mails
|
24 |
+
*
|
25 |
+
* @category Payment method
|
26 |
+
* @package Netresearch OPS
|
27 |
+
* @author Paul Siedler <paul.siedler@netresearch.de>
|
28 |
+
*/
|
29 |
+
class Netresearch_OPS_Model_Payment_Features_PaymentEmail
|
30 |
+
{
|
31 |
+
|
32 |
+
protected function getConfig()
|
33 |
+
{
|
34 |
+
return Mage::getModel('ops/config');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Check if payment email is available for order
|
39 |
+
*
|
40 |
+
* @param $order
|
41 |
+
*
|
42 |
+
* @return bool
|
43 |
+
*/
|
44 |
+
public function isAvailableForOrder($order)
|
45 |
+
{
|
46 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
47 |
+
$status = $order->getPayment()->getAdditionalInformation('status');
|
48 |
+
|
49 |
+
return Netresearch_OPS_Model_Status::canResendPaymentInfo($status);
|
50 |
+
}
|
51 |
+
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Resends the payment information and returns true/false, depending if succeeded or not
|
58 |
+
*
|
59 |
+
* @param Mage_Sales_Model_Order $order
|
60 |
+
*
|
61 |
+
* @return boolean success state
|
62 |
+
*/
|
63 |
+
public function resendPaymentInfo(Mage_Sales_Model_Order $order)
|
64 |
+
{
|
65 |
+
|
66 |
+
// reset payment method so the customer can choose freely from all available methods
|
67 |
+
$this->setPaymentMethodToGeneric($order);
|
68 |
+
|
69 |
+
$identity = $this->getIdentity($this->getConfig()->getResendPaymentInfoIdentity($order->getStoreId()));
|
70 |
+
|
71 |
+
if ($order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_PayPerMail) {
|
72 |
+
$template = $this->getConfig()->getPayPerMailTemplate($order->getStoreId());
|
73 |
+
} else {
|
74 |
+
$template = $this->getConfig()->getResendPaymentInfoTemplate($order->getStoreId());
|
75 |
+
}
|
76 |
+
|
77 |
+
$emailTemplate = $this->prepareTemplate(
|
78 |
+
$template,
|
79 |
+
$identity->getEmail(),
|
80 |
+
$identity->getName()
|
81 |
+
);
|
82 |
+
|
83 |
+
$parameters = array(
|
84 |
+
"order" => $order,
|
85 |
+
"paymentLink" => $this->generatePaymentLink($order),
|
86 |
+
"store" => Mage::app()->getStore($order->getStoreId())
|
87 |
+
);
|
88 |
+
|
89 |
+
return $emailTemplate->send($order->getCustomerEmail(), $order->getCustomerName(), $parameters);
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Generates the payment url
|
95 |
+
*
|
96 |
+
* @param Mage_Sales_Model_Order $order
|
97 |
+
*
|
98 |
+
* @return string
|
99 |
+
*/
|
100 |
+
protected function generatePaymentLink(Mage_Sales_Model_Order $order)
|
101 |
+
{
|
102 |
+
$opsOrderId = Mage::helper('ops/order')->getOpsOrderId($order);
|
103 |
+
|
104 |
+
$url = Mage::getModel('ops/config')->getPaymentRetryUrl(
|
105 |
+
Mage::helper('ops/payment')->validateOrderForReuse($opsOrderId, $order->getStoreId()),
|
106 |
+
$order->getStoreId()
|
107 |
+
);
|
108 |
+
|
109 |
+
return $url;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Set payment method to Netresearch_OPS_Model_Payment_Flex
|
114 |
+
*
|
115 |
+
* @param Mage_Sales_Model_Order $order
|
116 |
+
*
|
117 |
+
* @throws Exception
|
118 |
+
*/
|
119 |
+
protected function setPaymentMethodToGeneric(Mage_Sales_Model_Order $order)
|
120 |
+
{
|
121 |
+
if (!$order->getPayment()->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_PayPerMail) {
|
122 |
+
$order->getPayment()->setMethod(Netresearch_OPS_Model_Payment_Flex::CODE)->save();
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Sends suspend subscription mail to configured store contact via configured mail template
|
128 |
+
*
|
129 |
+
* @param Mage_Sales_Model_Recurring_Profile $profile
|
130 |
+
* @param Mage_Customer_Model_Customer $customer
|
131 |
+
*
|
132 |
+
* @return bool
|
133 |
+
*/
|
134 |
+
public function sendSuspendSubscriptionMail($profile, $customer)
|
135 |
+
{
|
136 |
+
if (null === $profile || null === $customer) {
|
137 |
+
Mage::throwException('Could not send mail due to internal error!');
|
138 |
+
}
|
139 |
+
|
140 |
+
$emailTemplate = $this->prepareTemplate(
|
141 |
+
$this->getConfig()->getSuspendSubscriptionTemplate($profile->getStoreId()),
|
142 |
+
$customer->getEmail(),
|
143 |
+
$customer->getName()
|
144 |
+
);
|
145 |
+
|
146 |
+
$emailTemplate->addBcc($customer->getEmail());
|
147 |
+
|
148 |
+
$parameters = array(
|
149 |
+
"profile" => $profile,
|
150 |
+
"customer" => $customer,
|
151 |
+
"store" => Mage::app()->getStore($profile->getStoreId())
|
152 |
+
);
|
153 |
+
|
154 |
+
$identity = $this->getIdentity($this->getConfig()->getSuspendSubscriptionIdentity($profile->getStoreId()));
|
155 |
+
|
156 |
+
return $emailTemplate->send($identity->getEmail(), $identity->getName(), $parameters);
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Loads email and name of the given store identity
|
163 |
+
*
|
164 |
+
* @param string $key - identity to load, defaults to sales
|
165 |
+
*
|
166 |
+
* @return Varien_Object with data name and email
|
167 |
+
*/
|
168 |
+
protected function getIdentity($key = 'sales')
|
169 |
+
{
|
170 |
+
$identity = new Varien_Object();
|
171 |
+
$identity->setName(Mage::getStoreConfig('trans_email/ident_' . $key . '/name'))
|
172 |
+
->setEmail(Mage::getStoreConfig('trans_email/ident_' . $key . '/email'));
|
173 |
+
|
174 |
+
return $identity;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Loads the given template by identifier, sets sender mail and name
|
179 |
+
*
|
180 |
+
* @param string $template
|
181 |
+
* @param string $senderMail
|
182 |
+
* @param string $senderName
|
183 |
+
*
|
184 |
+
* @return Mage_Core_Model_Email_Template
|
185 |
+
*/
|
186 |
+
protected function prepareTemplate($template, $senderMail, $senderName)
|
187 |
+
{
|
188 |
+
$emailTemplate = Mage::getModel('core/email_template')->load($template);
|
189 |
+
if (null === $emailTemplate->getTemplateSubject()) {
|
190 |
+
$emailTemplate = $emailTemplate->loadDefault($template);
|
191 |
+
}
|
192 |
+
$emailTemplate->setSenderName($senderName)
|
193 |
+
->setSenderEmail($senderMail);
|
194 |
+
|
195 |
+
return $emailTemplate;
|
196 |
+
}
|
197 |
+
|
198 |
+
}
|
app/code/community/Netresearch/OPS/Model/Payment/Features/ZeroAmountAuth.php
CHANGED
@@ -21,7 +21,8 @@ class Netresearch_OPS_Model_Payment_Features_ZeroAmountAuth
|
|
21 |
public function isCCAndZeroAmountAuthAllowed(
|
22 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
23 |
Mage_Sales_Model_Quote $quote
|
24 |
-
)
|
|
|
25 |
$result = false;
|
26 |
$storeId = $quote->getStoreId();
|
27 |
if ($quote->getBaseGrandTotal() < 0.01
|
21 |
public function isCCAndZeroAmountAuthAllowed(
|
22 |
Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod,
|
23 |
Mage_Sales_Model_Quote $quote
|
24 |
+
)
|
25 |
+
{
|
26 |
$result = false;
|
27 |
$storeId = $quote->getStoreId();
|
28 |
if ($quote->getBaseGrandTotal() < 0.01
|
app/code/community/Netresearch/OPS/Model/Payment/IDeal.php
CHANGED
@@ -38,11 +38,7 @@ class Netresearch_OPS_Model_Payment_IDeal
|
|
38 |
$data = $data->getData();
|
39 |
}
|
40 |
if (array_key_exists('iDeal_issuer_id', $data)) {
|
41 |
-
$
|
42 |
-
->getQuote()
|
43 |
-
->getPayment();
|
44 |
-
$payment
|
45 |
-
->setAdditionalInformation('iDeal_issuer_id', $data['iDeal_issuer_id']);
|
46 |
}
|
47 |
parent::assignData($data);
|
48 |
|
38 |
$data = $data->getData();
|
39 |
}
|
40 |
if (array_key_exists('iDeal_issuer_id', $data)) {
|
41 |
+
$this->getInfoInstance()->setAdditionalInformation('iDeal_issuer_id', $data['iDeal_issuer_id']);
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
parent::assignData($data);
|
44 |
|
app/code/community/Netresearch/OPS/Model/Payment/InterSolve.php
CHANGED
@@ -41,7 +41,7 @@ class Netresearch_OPS_Model_Payment_InterSolve
|
|
41 |
if (strlen(trim($brand)) === 0) {
|
42 |
$brand = 'InterSolve';
|
43 |
}
|
44 |
-
$payment =
|
45 |
$payment->setAdditionalInformation('BRAND', $brand);
|
46 |
|
47 |
parent::assignData($data);
|
41 |
if (strlen(trim($brand)) === 0) {
|
42 |
$brand = 'InterSolve';
|
43 |
}
|
44 |
+
$payment = $this->getInfoInstance();
|
45 |
$payment->setAdditionalInformation('BRAND', $brand);
|
46 |
|
47 |
parent::assignData($data);
|
app/code/community/Netresearch/OPS/Model/Payment/Kwixo/Abstract.php
CHANGED
@@ -30,14 +30,14 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
30 |
extends Netresearch_OPS_Model_Payment_Abstract
|
31 |
{
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
/**
|
38 |
-
*
|
39 |
* @param Mage_Sales_Model_Order $order
|
40 |
-
* @param
|
|
|
41 |
*/
|
42 |
public function getMethodDependendFormFields($order, $requestParams = null)
|
43 |
{
|
@@ -58,8 +58,8 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
58 |
|
59 |
$formFields['ECOM_ESTIMATEDELIVERYDATE']
|
60 |
= $this->getEstimatedDeliveryDate(
|
61 |
-
|
62 |
-
|
63 |
$formFields['RNPOFFERT'] = $this->getRnpFee(
|
64 |
$this->getCode(), $order->getStoreId()
|
65 |
);
|
@@ -122,7 +122,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
122 |
foreach ($product->getCategoryIds() as $categoryId) {
|
123 |
$kwixoCategory = Mage::getModel('ops/kwixo_category_mapping')
|
124 |
->loadByCategoryId($categoryId);
|
125 |
-
if (
|
126 |
$kwixoCategoryId = $kwixoCategory->getKwixoCategoryId();
|
127 |
break;
|
128 |
}
|
@@ -135,38 +135,23 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
135 |
*
|
136 |
*
|
137 |
* @param Mage_Sales_Model_Order $order
|
138 |
-
* @param array $requestParams
|
139 |
*
|
140 |
* @return array
|
141 |
*/
|
142 |
public function getKwixoBillToParams(Mage_Sales_Model_Order $order)
|
143 |
{
|
144 |
-
$formFields
|
145 |
-
$billingAddress
|
146 |
-
|
147 |
-
$
|
148 |
-
|
149 |
-
|
150 |
-
$formFields['ECOM_BILLTO_POSTAL_NAME_FIRST']
|
151 |
-
|
152 |
-
$formFields['
|
153 |
-
|
154 |
-
$formFields['
|
155 |
-
|
156 |
-
);
|
157 |
-
if (array_key_exists('street', $splittedStreet)) {
|
158 |
-
$formFields['OWNERADDRESS'] = trim($splittedStreet['street']);
|
159 |
-
}
|
160 |
-
$streetAppendix = trim($billingAddress->getStreet2());
|
161 |
-
if (0 < strlen($streetAppendix)) {
|
162 |
-
$formFields['OWNERADDRESS2'] = $streetAppendix;
|
163 |
-
}
|
164 |
-
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = '';
|
165 |
-
if (array_key_exists('housenumber', $splittedStreet)) {
|
166 |
-
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER']
|
167 |
-
= $splittedStreet['housenumber'];
|
168 |
-
}
|
169 |
-
$formFields['OWNERTELNO'] = $billingAddress->getTelephone();
|
170 |
|
171 |
return $formFields;
|
172 |
}
|
@@ -175,7 +160,6 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
175 |
* return the shipping parameters as array based on shipping method type
|
176 |
*
|
177 |
* @param Mage_Sales_Model_Order $order
|
178 |
-
* @param array $requestParams
|
179 |
*
|
180 |
* @return array
|
181 |
*/
|
@@ -183,66 +167,42 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
183 |
{
|
184 |
$formFields = array();
|
185 |
$shippingAddress = $order->getShippingAddress();
|
|
|
186 |
if ($shippingAddress === false) {
|
187 |
$shippingAddress = $order->getBillingAddress();
|
188 |
}
|
189 |
-
$splittedStreet = $this->splitHouseNumber(
|
190 |
-
$shippingAddress->getStreet1()
|
191 |
-
);
|
192 |
|
193 |
-
$
|
194 |
-
|
195 |
-
);
|
196 |
|
197 |
-
if (in_array(
|
198 |
-
$shippingMethodType, $this->getShippingMethodTypeValues()
|
199 |
-
)
|
200 |
-
) {
|
201 |
if (4 === $shippingMethodType) {
|
202 |
-
$formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX']
|
203 |
-
= $shippingAddress->getPrefix();
|
204 |
}
|
205 |
|
206 |
-
|
207 |
$company = trim($shippingAddress->getCompany());
|
208 |
if (0 < strlen($company)) {
|
209 |
$formFields['ECOM_SHIPTO_COMPANY'] = $company;
|
210 |
}
|
|
|
211 |
$fax = trim($shippingAddress->getFax());
|
212 |
if (0 < strlen($fax)) {
|
213 |
$formFields['ECOM_SHIPTO_TELECOM_FAX_NUMBER'] = $fax;
|
214 |
}
|
215 |
|
216 |
-
|
217 |
-
$formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1']
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
$streetAppendix = trim($shippingAddress->getStreet2());
|
224 |
-
if (0 < strlen($streetAppendix)) {
|
225 |
-
$formFields['ECOM_SHIPTO_POSTAL_STREET_LINE2']
|
226 |
-
= $streetAppendix;
|
227 |
-
}
|
228 |
-
$formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = '';
|
229 |
-
if (array_key_exists('housenumber', $splittedStreet)) {
|
230 |
-
$formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER']
|
231 |
-
= $splittedStreet['housenumber'];
|
232 |
-
}
|
233 |
-
$formFields['ECOM_SHIPTO_POSTAL_POSTALCODE']
|
234 |
-
= $shippingAddress->getPostcode();
|
235 |
-
$formFields['ECOM_SHIPTO_POSTAL_CITY']
|
236 |
-
= $shippingAddress->getCity();
|
237 |
-
$formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE']
|
238 |
-
= $shippingAddress->getCountryId();
|
239 |
}
|
240 |
-
|
241 |
-
|
242 |
-
$formFields['ECOM_SHIPTO_POSTAL_NAME_LAST']
|
243 |
-
|
244 |
-
$formFields['ECOM_SHIPTO_TELECOM_PHONE_NUMBER']
|
245 |
-
= $shippingAddress->getTelephone();
|
246 |
|
247 |
return $formFields;
|
248 |
}
|
@@ -268,11 +228,11 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
268 |
}
|
269 |
|
270 |
$subtotal += $item->getBasePriceInclTax(
|
271 |
-
|
272 |
$formFields['ITEMFDMPRODUCTCATEG' . $itemCounter]
|
273 |
= $this->getKwixoCategoryFromOrderItem(
|
274 |
-
|
275 |
-
|
276 |
$formFields['ITEMID' . $itemCounter] = $item->getItemId();
|
277 |
$formFields['ITEMNAME' . $itemCounter] = substr(
|
278 |
$item->getName(), 0, 40
|
@@ -282,7 +242,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
282 |
);
|
283 |
$formFields['ITEMQUANT' . $itemCounter]
|
284 |
= (int)$item->getQtyOrdered(
|
285 |
-
|
286 |
$formFields['ITEMVAT' . $itemCounter] = str_replace(
|
287 |
',', '.', (string)(float)$item->getBaseTaxAmount()
|
288 |
);
|
@@ -318,25 +278,6 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
318 |
return $formFields;
|
319 |
}
|
320 |
|
321 |
-
/**
|
322 |
-
* splits house number and street for france addresses
|
323 |
-
*
|
324 |
-
* @param string $address
|
325 |
-
*
|
326 |
-
* @return array
|
327 |
-
*/
|
328 |
-
public function splitHouseNumber($address)
|
329 |
-
{
|
330 |
-
$splittedStreet = array();
|
331 |
-
$street = str_replace("\n", ' ', $address);
|
332 |
-
$regexp = '/(?P<housenumber>[0-9]+)([,:\s])(?P<street>.+)/';
|
333 |
-
if (!preg_match($regexp, $street, $splittedStreet)) {
|
334 |
-
$splittedStreet[1] = $street;
|
335 |
-
$splittedStreet[2] = '';
|
336 |
-
}
|
337 |
-
|
338 |
-
return $splittedStreet;
|
339 |
-
}
|
340 |
|
341 |
/**
|
342 |
* returns the delivery date as date based on actual date and adding
|
@@ -376,10 +317,10 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
376 |
/**
|
377 |
* returns the Shipping Method Type configured in backend
|
378 |
*
|
379 |
-
* @param
|
380 |
-
* @param
|
381 |
-
*
|
382 |
-
* @return
|
383 |
*/
|
384 |
public function getShippingMethodType(
|
385 |
$code, $storeId = null, $isVirtual = false
|
@@ -463,12 +404,10 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
463 |
* get question for fields with disputable value
|
464 |
* users are asked to correct the values before redirect to Acceptance
|
465 |
*
|
466 |
-
* @param Mage_Sales_Model_Order $order Current order
|
467 |
-
* @param array $requestParams Request parameters
|
468 |
*
|
469 |
* @return string
|
470 |
*/
|
471 |
-
public function getQuestion(
|
472 |
{
|
473 |
return Mage::helper('ops/data')->__(
|
474 |
'Please make sure that the displayed data is correct.'
|
@@ -480,12 +419,12 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
480 |
* users are asked to correct the values before redirect to Acceptance
|
481 |
*
|
482 |
* @param Mage_Sales_Model_Order $order Current order
|
483 |
-
* @param array $requestParams Request parameters
|
484 |
*
|
485 |
* @return array
|
486 |
*/
|
487 |
-
public function getQuestionedFormFields($order
|
488 |
{
|
|
|
489 |
$questionedFormFields = array(
|
490 |
'CIVILITY',
|
491 |
'OWNERADDRESS',
|
@@ -499,10 +438,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
499 |
$shippingMethodType = (int)$this->getShippingMethodType(
|
500 |
$this->getCode(), $storeId
|
501 |
);
|
502 |
-
if (in_array(
|
503 |
-
$shippingMethodType, $this->getShippingMethodTypeValues()
|
504 |
-
)
|
505 |
-
) {
|
506 |
$questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_NUMBER';
|
507 |
$questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_LINE1';
|
508 |
}
|
@@ -530,6 +466,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
530 |
*
|
531 |
* @param array $formFields - the array to populate
|
532 |
* @param null $dataArray - the array containing the data
|
|
|
533 |
*
|
534 |
* @return array - the populated array
|
535 |
*/
|
@@ -544,7 +481,7 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
544 |
if (array_key_exists($key, $formFields)
|
545 |
&& in_array(
|
546 |
$key,
|
547 |
-
$this->getQuestionedFormFields($order
|
548 |
)
|
549 |
|| $key == 'CIVILITY'
|
550 |
) {
|
@@ -601,8 +538,9 @@ class Netresearch_OPS_Model_Payment_Kwixo_Abstract
|
|
601 |
|
602 |
/**
|
603 |
* @param $carrierCode
|
|
|
604 |
*/
|
605 |
-
|
606 |
{
|
607 |
$this->shippingSettings = $this->getKwixoShippingModel()->load(
|
608 |
$carrierCode, 'shipping_code'
|
30 |
extends Netresearch_OPS_Model_Payment_Abstract
|
31 |
{
|
32 |
|
33 |
+
protected $kwixoShippingModel = null;
|
34 |
|
35 |
+
protected $shippingSettings = null;
|
36 |
|
37 |
/**
|
|
|
38 |
* @param Mage_Sales_Model_Order $order
|
39 |
+
* @param null $requestParams
|
40 |
+
* @return string[]
|
41 |
*/
|
42 |
public function getMethodDependendFormFields($order, $requestParams = null)
|
43 |
{
|
58 |
|
59 |
$formFields['ECOM_ESTIMATEDELIVERYDATE']
|
60 |
= $this->getEstimatedDeliveryDate(
|
61 |
+
$this->getCode(), $order->getStoreId()
|
62 |
+
);
|
63 |
$formFields['RNPOFFERT'] = $this->getRnpFee(
|
64 |
$this->getCode(), $order->getStoreId()
|
65 |
);
|
122 |
foreach ($product->getCategoryIds() as $categoryId) {
|
123 |
$kwixoCategory = Mage::getModel('ops/kwixo_category_mapping')
|
124 |
->loadByCategoryId($categoryId);
|
125 |
+
if (null != $kwixoCategory->getId()) {
|
126 |
$kwixoCategoryId = $kwixoCategory->getKwixoCategoryId();
|
127 |
break;
|
128 |
}
|
135 |
*
|
136 |
*
|
137 |
* @param Mage_Sales_Model_Order $order
|
|
|
138 |
*
|
139 |
* @return array
|
140 |
*/
|
141 |
public function getKwixoBillToParams(Mage_Sales_Model_Order $order)
|
142 |
{
|
143 |
+
$formFields = array();
|
144 |
+
$billingAddress = $order->getBillingAddress();
|
145 |
+
|
146 |
+
$billingStreet = str_replace("\n", ' ', $billingAddress->getStreet(-1));
|
147 |
+
$splittedBillingStreet = Mage::Helper('ops/address')->splitStreet($billingStreet);
|
148 |
+
|
149 |
+
$formFields['ECOM_BILLTO_POSTAL_NAME_FIRST'] = $billingAddress->getFirstname();
|
150 |
+
$formFields['ECOM_BILLTO_POSTAL_NAME_LAST'] = $billingAddress->getLastname();
|
151 |
+
$formFields['OWNERADDRESS'] = $splittedBillingStreet['street_name'];
|
152 |
+
$formFields['OWNERADDRESS2'] = $splittedBillingStreet['supplement'];
|
153 |
+
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = $splittedBillingStreet['street_number'];
|
154 |
+
$formFields['OWNERTELNO'] = $billingAddress->getTelephone();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
return $formFields;
|
157 |
}
|
160 |
* return the shipping parameters as array based on shipping method type
|
161 |
*
|
162 |
* @param Mage_Sales_Model_Order $order
|
|
|
163 |
*
|
164 |
* @return array
|
165 |
*/
|
167 |
{
|
168 |
$formFields = array();
|
169 |
$shippingAddress = $order->getShippingAddress();
|
170 |
+
|
171 |
if ($shippingAddress === false) {
|
172 |
$shippingAddress = $order->getBillingAddress();
|
173 |
}
|
|
|
|
|
|
|
174 |
|
175 |
+
$shippingStreet = str_replace("\n", ' ', $shippingAddress->getStreet(-1));
|
176 |
+
$splittedShippingStreet = Mage::Helper('ops/address')->splitStreet($shippingStreet);
|
177 |
+
$shippingMethodType = (int)$this->getShippingMethodType($this->getCode(), $order->getStoreId());
|
178 |
|
179 |
+
if (in_array($shippingMethodType, $this->getShippingMethodTypeValues())) {
|
|
|
|
|
|
|
180 |
if (4 === $shippingMethodType) {
|
181 |
+
$formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix();
|
|
|
182 |
}
|
183 |
|
|
|
184 |
$company = trim($shippingAddress->getCompany());
|
185 |
if (0 < strlen($company)) {
|
186 |
$formFields['ECOM_SHIPTO_COMPANY'] = $company;
|
187 |
}
|
188 |
+
|
189 |
$fax = trim($shippingAddress->getFax());
|
190 |
if (0 < strlen($fax)) {
|
191 |
$formFields['ECOM_SHIPTO_TELECOM_FAX_NUMBER'] = $fax;
|
192 |
}
|
193 |
|
194 |
+
$formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $shippingAddress->getStreet1();
|
195 |
+
$formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $splittedShippingStreet['street_name'];
|
196 |
+
$formFields['ECOM_SHIPTO_POSTAL_STREET_LINE2'] = $splittedShippingStreet['supplement'];
|
197 |
+
$formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = $splittedShippingStreet['street_number'];
|
198 |
+
$formFields['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippingAddress->getPostcode();
|
199 |
+
$formFields['ECOM_SHIPTO_POSTAL_CITY'] = $shippingAddress->getCity();
|
200 |
+
$formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shippingAddress->getCountryId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
+
|
203 |
+
$formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shippingAddress->getFirstname();
|
204 |
+
$formFields['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shippingAddress->getLastname();
|
205 |
+
$formFields['ECOM_SHIPTO_TELECOM_PHONE_NUMBER'] = $shippingAddress->getTelephone();
|
|
|
|
|
206 |
|
207 |
return $formFields;
|
208 |
}
|
228 |
}
|
229 |
|
230 |
$subtotal += $item->getBasePriceInclTax(
|
231 |
+
) * $item->getQtyOrdered();
|
232 |
$formFields['ITEMFDMPRODUCTCATEG' . $itemCounter]
|
233 |
= $this->getKwixoCategoryFromOrderItem(
|
234 |
+
$item
|
235 |
+
);
|
236 |
$formFields['ITEMID' . $itemCounter] = $item->getItemId();
|
237 |
$formFields['ITEMNAME' . $itemCounter] = substr(
|
238 |
$item->getName(), 0, 40
|
242 |
);
|
243 |
$formFields['ITEMQUANT' . $itemCounter]
|
244 |
= (int)$item->getQtyOrdered(
|
245 |
+
);
|
246 |
$formFields['ITEMVAT' . $itemCounter] = str_replace(
|
247 |
',', '.', (string)(float)$item->getBaseTaxAmount()
|
248 |
);
|
278 |
return $formFields;
|
279 |
}
|
280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
/**
|
283 |
* returns the delivery date as date based on actual date and adding
|
317 |
/**
|
318 |
* returns the Shipping Method Type configured in backend
|
319 |
*
|
320 |
+
* @param $code
|
321 |
+
* @param null $storeId
|
322 |
+
* @param bool $isVirtual
|
323 |
+
* @return int
|
324 |
*/
|
325 |
public function getShippingMethodType(
|
326 |
$code, $storeId = null, $isVirtual = false
|
404 |
* get question for fields with disputable value
|
405 |
* users are asked to correct the values before redirect to Acceptance
|
406 |
*
|
|
|
|
|
407 |
*
|
408 |
* @return string
|
409 |
*/
|
410 |
+
public function getQuestion()
|
411 |
{
|
412 |
return Mage::helper('ops/data')->__(
|
413 |
'Please make sure that the displayed data is correct.'
|
419 |
* users are asked to correct the values before redirect to Acceptance
|
420 |
*
|
421 |
* @param Mage_Sales_Model_Order $order Current order
|
|
|
422 |
*
|
423 |
* @return array
|
424 |
*/
|
425 |
+
public function getQuestionedFormFields($order)
|
426 |
{
|
427 |
+
|
428 |
$questionedFormFields = array(
|
429 |
'CIVILITY',
|
430 |
'OWNERADDRESS',
|
438 |
$shippingMethodType = (int)$this->getShippingMethodType(
|
439 |
$this->getCode(), $storeId
|
440 |
);
|
441 |
+
if (in_array($shippingMethodType, $this->getShippingMethodTypeValues())) {
|
|
|
|
|
|
|
442 |
$questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_NUMBER';
|
443 |
$questionedFormFields [] = 'ECOM_SHIPTO_POSTAL_STREET_LINE1';
|
444 |
}
|
466 |
*
|
467 |
* @param array $formFields - the array to populate
|
468 |
* @param null $dataArray - the array containing the data
|
469 |
+
* @param Mage_Sales_Model_Order $order
|
470 |
*
|
471 |
* @return array - the populated array
|
472 |
*/
|
481 |
if (array_key_exists($key, $formFields)
|
482 |
&& in_array(
|
483 |
$key,
|
484 |
+
$this->getQuestionedFormFields($order), true
|
485 |
)
|
486 |
|| $key == 'CIVILITY'
|
487 |
) {
|
538 |
|
539 |
/**
|
540 |
* @param $carrierCode
|
541 |
+
* @return null
|
542 |
*/
|
543 |
+
protected function loadShippingSettingForCarrierCode($carrierCode)
|
544 |
{
|
545 |
$this->shippingSettings = $this->getKwixoShippingModel()->load(
|
546 |
$carrierCode, 'shipping_code'
|
app/code/community/Netresearch/OPS/Model/Payment/Masterpass.php
CHANGED
@@ -9,19 +9,19 @@
|
|
9 |
* @license OSL 3.0
|
10 |
*/
|
11 |
class Netresearch_OPS_Model_Payment_Masterpass
|
12 |
-
|
13 |
{
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
|
26 |
}
|
27 |
|
9 |
* @license OSL 3.0
|
10 |
*/
|
11 |
class Netresearch_OPS_Model_Payment_Masterpass
|
12 |
+
extends Netresearch_OPS_Model_Payment_Abstract
|
13 |
{
|
14 |
+
protected $pm = 'MasterPass';
|
15 |
+
protected $brand = 'MasterPass';
|
16 |
|
17 |
+
/** Check if we can capture directly from the backend */
|
18 |
+
protected $_canBackendDirectCapture = true;
|
19 |
|
20 |
+
/** info source path */
|
21 |
+
protected $_infoBlockType = 'ops/info_redirect';
|
22 |
|
23 |
+
/** payment code */
|
24 |
+
protected $_code = 'ops_Masterpass';
|
25 |
|
26 |
}
|
27 |
|
app/code/community/Netresearch/OPS/Model/Payment/Mpass.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Netresearch_OPS_Model_Payment_Mpass
|
4 |
-
*
|
5 |
-
* @package
|
6 |
-
* @copyright 2011 Netresearch
|
7 |
-
* @author Thomas Kappel <thomas.kappel@netresearch.de>
|
8 |
-
* @license OSL 3.0
|
9 |
-
*/
|
10 |
-
class Netresearch_OPS_Model_Payment_Mpass
|
11 |
-
extends Netresearch_OPS_Model_Payment_Abstract
|
12 |
-
{
|
13 |
-
protected $pm = 'MPASS';
|
14 |
-
protected $brand = 'MPASS';
|
15 |
-
|
16 |
-
/** Check if we can capture directly from the backend */
|
17 |
-
protected $_canBackendDirectCapture = true;
|
18 |
-
|
19 |
-
/** info source path */
|
20 |
-
protected $_infoBlockType = 'ops/info_redirect';
|
21 |
-
|
22 |
-
/** payment code */
|
23 |
-
protected $_code = 'ops_mpass';
|
24 |
-
}
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoice/Abstract.php
CHANGED
@@ -32,35 +32,73 @@ class Netresearch_OPS_Model_Payment_OpenInvoice_Abstract extends Netresearch_OPS
|
|
32 |
protected $_needsCartDataForRequest = true;
|
33 |
protected $_needsShipToParams = false;
|
34 |
|
35 |
-
|
36 |
-
{
|
37 |
-
$formFields = parent::getMethodDependendFormFields($order, $requestParams);
|
38 |
-
|
39 |
-
$billingAddress = $order->getBillingAddress();
|
40 |
-
$birthday = new DateTime($order->getCustomerDob());
|
41 |
-
|
42 |
|
43 |
-
|
|
|
|
|
44 |
|
|
|
45 |
|
|
|
|
|
|
|
46 |
$billingAddress = $order->getBillingAddress();
|
47 |
-
$
|
48 |
-
$
|
|
|
|
|
|
|
49 |
if (!preg_match($regexp, $street, $splittedStreet)) {
|
50 |
$splittedStreet[1] = $street;
|
51 |
$splittedStreet[2] = '';
|
52 |
}
|
53 |
|
54 |
-
$formFields['OWNERADDRESS']
|
55 |
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]);
|
56 |
-
|
57 |
-
|
58 |
-
$formFields['
|
59 |
-
$formFields['
|
60 |
-
$formFields['ECOM_SHIPTO_DOB'] = $birthday->format('d/m/Y');
|
61 |
-
$formFields['ECOM_CONSUMER_GENDER'] = $gender;
|
62 |
|
63 |
return $formFields;
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
32 |
protected $_needsCartDataForRequest = true;
|
33 |
protected $_needsShipToParams = false;
|
34 |
|
35 |
+
protected $_formBlockType = 'ops/form_openInvoice';
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
$this->setEncoding($this->getConfigData('encoding'));
|
40 |
|
41 |
+
}
|
42 |
|
43 |
+
public function getMethodDependendFormFields($order, $requestParams = null)
|
44 |
+
{
|
45 |
+
$formFields = parent::getMethodDependendFormFields($order, $requestParams);
|
46 |
$billingAddress = $order->getBillingAddress();
|
47 |
+
$birthday = new DateTime($order->getCustomerDob());
|
48 |
+
$gender = $order->getCustomerGender() == 1 ? 'M' : 'F';
|
49 |
+
$street = str_replace("\n", ' ', $billingAddress->getStreet(-1));
|
50 |
+
$regexp = '/^([^0-9]*)([0-9].*)$/';
|
51 |
+
|
52 |
if (!preg_match($regexp, $street, $splittedStreet)) {
|
53 |
$splittedStreet[1] = $street;
|
54 |
$splittedStreet[2] = '';
|
55 |
}
|
56 |
|
57 |
+
$formFields['OWNERADDRESS'] = trim($splittedStreet[1]);
|
58 |
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]);
|
59 |
+
$formFields['ECOM_BILLTO_POSTAL_NAME_FIRST'] = substr($billingAddress->getFirstname(), 0, 50);
|
60 |
+
$formFields['ECOM_BILLTO_POSTAL_NAME_LAST'] = substr($billingAddress->getLastname(), 0, 50);
|
61 |
+
$formFields['ECOM_SHIPTO_DOB'] = $birthday->format('d/m/Y');
|
62 |
+
$formFields['ECOM_CONSUMER_GENDER'] = $gender;
|
|
|
|
|
63 |
|
64 |
return $formFields;
|
65 |
}
|
66 |
|
67 |
+
/**
|
68 |
+
* @return string title for invoice termes configured in backend
|
69 |
+
*/
|
70 |
+
public function getInvoiceTermsTitle()
|
71 |
+
{
|
72 |
+
return $this->getConfigData('invoice_terms_title');
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @return string url to the invoice terms configured in backend
|
77 |
+
*/
|
78 |
+
public function getInvoiceTermsUrl()
|
79 |
+
{
|
80 |
+
return $this->getConfigData('invoice_terms_url');
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @return bool if invoice terms should be displayed in checkout
|
85 |
+
*/
|
86 |
+
public function showInvoiceTermsLink()
|
87 |
+
{
|
88 |
+
return (bool) $this->getConfigData('show_invoice_terms');
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* @param Mage_Sales_Model_Quote $quote
|
93 |
+
*
|
94 |
+
* @return bool
|
95 |
+
*/
|
96 |
+
public function isAvailable($quote = null)
|
97 |
+
{
|
98 |
+
if ($quote && !$quote->isVirtual() && !$quote->getShippingAddress()->getSameAsBilling()) {
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
return parent::isAvailable($quote);
|
103 |
+
}
|
104 |
}
|
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceAt.php
CHANGED
@@ -9,90 +9,99 @@
|
|
9 |
* @license OSL 3.0
|
10 |
*/
|
11 |
class Netresearch_OPS_Model_Payment_OpenInvoiceAt
|
12 |
-
|
13 |
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
}
|
9 |
* @license OSL 3.0
|
10 |
*/
|
11 |
class Netresearch_OPS_Model_Payment_OpenInvoiceAt
|
12 |
+
extends Netresearch_OPS_Model_Payment_OpenInvoice_Abstract
|
13 |
{
|
14 |
+
protected $pm = 'Open Invoice AT';
|
15 |
+
protected $brand = 'Open Invoice AT';
|
16 |
+
|
17 |
+
/** if we can capture directly from the backend */
|
18 |
+
protected $_canBackendDirectCapture = false;
|
19 |
+
protected $_canCapturePartial = false;
|
20 |
+
protected $_canRefundInvoicePartial = false;
|
21 |
+
|
22 |
+
/** info source path */
|
23 |
+
protected $_infoBlockType = 'ops/info_redirect';
|
24 |
+
|
25 |
+
/** payment code */
|
26 |
+
protected $_code = 'ops_openInvoiceAt';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Open Invoice AT is not available if quote has a coupon
|
30 |
+
*
|
31 |
+
* @param Mage_Sales_Model_Quote $quote
|
32 |
+
*
|
33 |
+
* @return boolean
|
34 |
+
*/
|
35 |
+
public function isAvailable( $quote = null )
|
36 |
+
{
|
37 |
+
/* availability depends on quote */
|
38 |
+
if ( false == $quote instanceof Mage_Sales_Model_Quote ) {
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
/* not available if quote contains a coupon and allow_discounted_carts is disabled */
|
43 |
+
if ( !$this->isAvailableForDiscountedCarts()
|
44 |
+
&& $quote->getSubtotal() != $quote->getSubtotalWithDiscount()
|
45 |
+
) {
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
/* not available if there is no gender or no birthday */
|
50 |
+
if ($quote->getCustomerGender() == null || $quote->getCustomerDob() == null) {
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
+
return parent::isAvailable($quote);
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getPaymentAction()
|
58 |
+
{
|
59 |
+
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param Mage_Sales_Model_Order $order
|
64 |
+
* @param array|null $requestParams
|
65 |
+
*
|
66 |
+
* @return array
|
67 |
+
*/
|
68 |
+
public function getMethodDependendFormFields( $order, $requestParams = null )
|
69 |
+
{
|
70 |
+
$formFields = parent::getMethodDependendFormFields($order, $requestParams);
|
71 |
+
|
72 |
+
$shippingAddress = $order->getShippingAddress();
|
73 |
+
|
74 |
+
$gender = Mage::getSingleton('eav/config')
|
75 |
+
->getAttribute('customer', 'gender')
|
76 |
+
->getSource()
|
77 |
+
->getOptionText($order->getCustomerGender());
|
78 |
+
|
79 |
+
$formFields[ 'CIVILITY' ] = $gender == 'Male' ? 'Herr' : 'Frau';
|
80 |
+
$formFields[ 'ECOM_CONSUMER_GENDER' ] = $gender == 'Male' ? 'M' : 'F';
|
81 |
+
|
82 |
+
// Change address format to make austrian addresses compatible with platform data transfer to Klarna
|
83 |
+
$billToParams = $this->getRequestHelper()->extractBillToParameters($order->getBillingAddress(), $order);
|
84 |
+
$formFields['OWNERADDRESS'] = $billToParams['ECOM_BILLTO_POSTAL_STREET_LINE1'] . ' '
|
85 |
+
. $billToParams['ECOM_BILLTO_POSTAL_STREET_NUMBER'];
|
86 |
+
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = ' ';
|
87 |
+
|
88 |
+
if (!$this->getConfig()->canSubmitExtraParameter($order->getStoreId()) ) {
|
89 |
+
// add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice
|
90 |
+
$shipToParams = $this->getRequestHelper()->extractShipToParameters($shippingAddress, $order);
|
91 |
+
$formFields = array_merge($formFields, $shipToParams);
|
92 |
+
}
|
93 |
+
|
94 |
+
return $formFields;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* getter for the allow_discounted_carts
|
99 |
+
*
|
100 |
+
* @return bool
|
101 |
+
*/
|
102 |
+
protected function isAvailableForDiscountedCarts()
|
103 |
+
{
|
104 |
+
return (bool) $this->getConfigData('allow_discounted_carts');
|
105 |
+
}
|
106 |
|
107 |
}
|
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceDe.php
CHANGED
@@ -46,7 +46,7 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceDe
|
|
46 |
}
|
47 |
|
48 |
/* not available if there is no gender or no birthday */
|
49 |
-
if (
|
50 |
return false;
|
51 |
}
|
52 |
|
@@ -69,8 +69,8 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceDe
|
|
69 |
->getSource()
|
70 |
->getOptionText($order->getCustomerGender());
|
71 |
|
72 |
-
|
73 |
-
|
74 |
|
75 |
if (!$this->getConfig()->canSubmitExtraParameter($order->getStoreId())) {
|
76 |
// add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice
|
46 |
}
|
47 |
|
48 |
/* not available if there is no gender or no birthday */
|
49 |
+
if (null === $quote->getCustomerGender() || is_null($quote->getCustomerDob())) {
|
50 |
return false;
|
51 |
}
|
52 |
|
69 |
->getSource()
|
70 |
->getOptionText($order->getCustomerGender());
|
71 |
|
72 |
+
$formFields[ 'CIVILITY' ] = $gender == 'Male' ? 'Herr' : 'Frau';
|
73 |
+
$formFields[ 'ECOM_CONSUMER_GENDER' ] = $gender == 'Male' ? 'M' : 'F';
|
74 |
|
75 |
if (!$this->getConfig()->canSubmitExtraParameter($order->getStoreId())) {
|
76 |
// add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice
|
app/code/community/Netresearch/OPS/Model/Payment/OpenInvoiceNl.php
CHANGED
@@ -38,7 +38,7 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
|
|
38 |
}
|
39 |
|
40 |
/* not available if there is no gender or no birthday */
|
41 |
-
if (
|
42 |
return false;
|
43 |
}
|
44 |
|
@@ -49,18 +49,16 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
|
|
49 |
* get some method dependend form fields
|
50 |
*
|
51 |
* @param Mage_Sales_Model_Quote $order
|
|
|
52 |
* @return array
|
53 |
*/
|
54 |
public function getMethodDependendFormFields($order, $requestParams=null)
|
55 |
{
|
56 |
$billingAddress = $order->getBillingAddress();
|
57 |
$shippingAddress = $order->getShippingAddress();
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
$splittedStreet[1] = $street;
|
62 |
-
$splittedStreet[2] = '';
|
63 |
-
}
|
64 |
$formFields = parent::getMethodDependendFormFields($order, $requestParams);
|
65 |
|
66 |
$gender = Mage::getSingleton('eav/config')
|
@@ -70,23 +68,22 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
|
|
70 |
|
71 |
$formFields['CIVILITY'] = $gender == 'Male' ? 'M' : 'V';
|
72 |
$formFields['ECOM_CONSUMER_GENDER'] = $gender == 'Male' ? 'M' : 'V';
|
73 |
-
$formFields['OWNERADDRESS'] =
|
74 |
-
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] =
|
75 |
$formFields['OWNERZIP'] = $billingAddress->getPostcode();
|
76 |
$formFields['OWNERTOWN'] = $billingAddress->getCity();
|
77 |
$formFields['OWNERCTY'] = $billingAddress->getCountry();
|
78 |
$formFields['OWNERTELNO'] = $billingAddress->getTelephone();
|
79 |
|
80 |
-
$
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
}
|
85 |
$formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix();
|
86 |
$formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shippingAddress->getFirstname();
|
87 |
$formFields['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shippingAddress->getLastname();
|
88 |
-
$formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] =
|
89 |
-
$formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] =
|
90 |
$formFields['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippingAddress->getPostcode();
|
91 |
$formFields['ECOM_SHIPTO_POSTAL_CITY'] = $shippingAddress->getCity();
|
92 |
$formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shippingAddress->getCountry();
|
@@ -116,11 +113,9 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
|
|
116 |
* get question for fields with disputable value
|
117 |
* users are asked to correct the values before redirect to Acceptance
|
118 |
*
|
119 |
-
* @param Mage_Sales_Model_Order $order Current order
|
120 |
-
* @param array $requestParams Request parameters
|
121 |
* @return string
|
122 |
*/
|
123 |
-
public function getQuestion(
|
124 |
{
|
125 |
return Mage::helper('ops')->__('Please make sure that your street and house number are correct.');
|
126 |
}
|
@@ -129,11 +124,10 @@ class Netresearch_OPS_Model_Payment_OpenInvoiceNl
|
|
129 |
* get an array of fields with disputable value
|
130 |
* users are asked to correct the values before redirect to Acceptance
|
131 |
*
|
132 |
-
*
|
133 |
-
* @param array $requestParams Request parameters
|
134 |
* @return array
|
135 |
*/
|
136 |
-
public function getQuestionedFormFields($order
|
137 |
{
|
138 |
return array(
|
139 |
'OWNERADDRESS',
|
38 |
}
|
39 |
|
40 |
/* not available if there is no gender or no birthday */
|
41 |
+
if (null === $quote->getCustomerGender() || is_null($quote->getCustomerDob())) {
|
42 |
return false;
|
43 |
}
|
44 |
|
49 |
* get some method dependend form fields
|
50 |
*
|
51 |
* @param Mage_Sales_Model_Quote $order
|
52 |
+
* @param array $requestParams
|
53 |
* @return array
|
54 |
*/
|
55 |
public function getMethodDependendFormFields($order, $requestParams=null)
|
56 |
{
|
57 |
$billingAddress = $order->getBillingAddress();
|
58 |
$shippingAddress = $order->getShippingAddress();
|
59 |
+
$billingStreet = str_replace("\n", ' ', $billingAddress->getStreet(-1));
|
60 |
+
|
61 |
+
$splittedBillingStreet = Mage::helper('ops/address')->splitStreet($billingStreet);
|
|
|
|
|
|
|
62 |
$formFields = parent::getMethodDependendFormFields($order, $requestParams);
|
63 |
|
64 |
$gender = Mage::getSingleton('eav/config')
|
68 |
|
69 |
$formFields['CIVILITY'] = $gender == 'Male' ? 'M' : 'V';
|
70 |
$formFields['ECOM_CONSUMER_GENDER'] = $gender == 'Male' ? 'M' : 'V';
|
71 |
+
$formFields['OWNERADDRESS'] = $splittedBillingStreet['street_name'];
|
72 |
+
$formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = $splittedBillingStreet['street_number'];
|
73 |
$formFields['OWNERZIP'] = $billingAddress->getPostcode();
|
74 |
$formFields['OWNERTOWN'] = $billingAddress->getCity();
|
75 |
$formFields['OWNERCTY'] = $billingAddress->getCountry();
|
76 |
$formFields['OWNERTELNO'] = $billingAddress->getTelephone();
|
77 |
|
78 |
+
$shippingStreet = str_replace("\n", ' ', $shippingAddress->getStreet(-1));
|
79 |
+
|
80 |
+
$splittedShippingStreet = Mage::Helper('ops/address')->splitStreet($shippingStreet);
|
81 |
+
|
|
|
82 |
$formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix();
|
83 |
$formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shippingAddress->getFirstname();
|
84 |
$formFields['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shippingAddress->getLastname();
|
85 |
+
$formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $splittedShippingStreet['street_name'];
|
86 |
+
$formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = $splittedShippingStreet['street_number'];
|
87 |
$formFields['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippingAddress->getPostcode();
|
88 |
$formFields['ECOM_SHIPTO_POSTAL_CITY'] = $shippingAddress->getCity();
|
89 |
$formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shippingAddress->getCountry();
|
113 |
* get question for fields with disputable value
|
114 |
* users are asked to correct the values before redirect to Acceptance
|
115 |
*
|
|
|
|
|
116 |
* @return string
|
117 |
*/
|
118 |
+
public function getQuestion()
|
119 |
{
|
120 |
return Mage::helper('ops')->__('Please make sure that your street and house number are correct.');
|
121 |
}
|
124 |
* get an array of fields with disputable value
|
125 |
* users are asked to correct the values before redirect to Acceptance
|
126 |
*
|
127 |
+
*
|
|
|
128 |
* @return array
|
129 |
*/
|
130 |
+
public function getQuestionedFormFields($order)
|
131 |
{
|
132 |
return array(
|
133 |
'OWNERADDRESS',
|
app/code/community/Netresearch/OPS/Model/Payment/PayPerMail.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* PayPerMail.php
|
5 |
+
*
|
6 |
+
* @author Sebastian Ertner sebastian.ertner@netresearch.de
|
7 |
+
* @copyright Copyright (c) 2016 Netresearch GmbH & Co. KG
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
9 |
+
*/
|
10 |
+
class Netresearch_OPS_Model_Payment_PayPerMail extends Netresearch_OPS_Model_Payment_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
const CODE = 'ops_payPerMail';
|
14 |
+
const INFO_KEY_TITLE = 'paypermail_title';
|
15 |
+
const INFO_KEY_PM = 'paypermail_pm';
|
16 |
+
const INFO_KEY_BRAND = 'paypermail_brand';
|
17 |
+
|
18 |
+
protected $_canUseCheckout = false;
|
19 |
+
protected $_canUseInternal = true;
|
20 |
+
|
21 |
+
|
22 |
+
/** info source path */
|
23 |
+
protected $_infoBlockType = 'ops/info_payPerMail';
|
24 |
+
|
25 |
+
protected $_formBlockType = 'ops/form_payPerMail';
|
26 |
+
|
27 |
+
/** payment code */
|
28 |
+
protected $_code = self::CODE;
|
29 |
+
|
30 |
+
|
31 |
+
public function getOpsCode($payment = null)
|
32 |
+
{
|
33 |
+
return $this->getInfoInstance()->getAdditionalInformation(self::INFO_KEY_PM);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getOpsBrand($payment = null)
|
37 |
+
{
|
38 |
+
return $this->getInfoInstance()->getAdditionalInformation(self::INFO_KEY_BRAND);
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc.php
CHANGED
@@ -52,7 +52,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
52 |
*/
|
53 |
public function getSubscriptionManager()
|
54 |
{
|
55 |
-
if (
|
56 |
$this->subscriptionManager = Mage::getModel('ops/subscription_manager');
|
57 |
}
|
58 |
|
@@ -77,7 +77,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
77 |
*/
|
78 |
public function getParameterModel()
|
79 |
{
|
80 |
-
if (
|
81 |
$this->parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
|
82 |
}
|
83 |
|
@@ -119,12 +119,12 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
119 |
* @param Mage_Payment_Model_Recurring_Profile $profile
|
120 |
* @param Mage_Payment_Model_Info $paymentInfo
|
121 |
*
|
122 |
-
* @return string[]
|
123 |
*/
|
124 |
protected function submitTrialSubscription(
|
125 |
Mage_Payment_Model_Recurring_Profile $profile,
|
126 |
Mage_Payment_Model_Info $paymentInfo
|
127 |
-
)
|
|
|
128 |
if ($profile->getTrialPeriodUnit()) {
|
129 |
$requestParams = $this->getParameterModel()->collectAllParametersForTrial($paymentInfo, $profile);
|
130 |
$this->getParameterModel()->unsetData();
|
@@ -149,7 +149,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
149 |
public function submitRecurringProfile(
|
150 |
Mage_Payment_Model_Recurring_Profile $profile,
|
151 |
Mage_Payment_Model_Info $paymentInfo
|
152 |
-
)
|
|
|
153 |
$this->performPreDirectLinkCallActions($profile->getQuote(), $paymentInfo);
|
154 |
|
155 |
$this->submitTrialSubscription($profile, $paymentInfo);
|
@@ -202,17 +203,21 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
202 |
switch ($profile->getNewState()) {
|
203 |
case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE:
|
204 |
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
205 |
-
$this->addAdminNotice(
|
|
|
206 |
);
|
207 |
} else {
|
208 |
Mage::throwException(
|
209 |
-
$this->getDataHelper()->__(
|
|
|
|
|
210 |
);
|
211 |
}
|
212 |
break;
|
213 |
case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED:
|
214 |
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
215 |
-
$this->addAdminNotice(
|
|
|
216 |
);
|
217 |
} else {
|
218 |
$this->sendSuspendMail($profile);
|
@@ -220,7 +225,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
220 |
break;
|
221 |
case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED:
|
222 |
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
223 |
-
$this->addAdminNotice(
|
|
|
224 |
);
|
225 |
} else {
|
226 |
$this->sendSuspendMail($profile);
|
@@ -270,7 +276,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
270 |
$profile->setOverrideState(true);
|
271 |
$session->addSuccess(
|
272 |
$this->getDataHelper()
|
273 |
-
->__(
|
|
|
274 |
)
|
275 |
);
|
276 |
} else {
|
@@ -336,7 +343,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
336 |
*/
|
337 |
protected function submitRegularSubscription(Mage_Payment_Model_Recurring_Profile $profile,
|
338 |
Mage_Payment_Model_Info $paymentInfo
|
339 |
-
)
|
|
|
340 |
$requestParams = $this->getParameterModel()->collectAllParameters($paymentInfo, $profile);
|
341 |
$this->getParameterModel()->unsetData();
|
342 |
$response = $this->getDirectLinkHelper()->performDirectLinkRequest(
|
@@ -355,7 +363,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc
|
|
355 |
protected function submitInitialFee(
|
356 |
Mage_Payment_Model_Recurring_Profile $profile,
|
357 |
Mage_Payment_Model_Info $paymentInfo
|
358 |
-
)
|
|
|
359 |
/** @var $profile Mage_Sales_Model_Recurring_Profile */
|
360 |
if ($profile->getInitAmount() > 0) {
|
361 |
$order = $this->getSubscriptionManager()->createInitialOrder($profile);
|
52 |
*/
|
53 |
public function getSubscriptionManager()
|
54 |
{
|
55 |
+
if (null === $this->subscriptionManager) {
|
56 |
$this->subscriptionManager = Mage::getModel('ops/subscription_manager');
|
57 |
}
|
58 |
|
77 |
*/
|
78 |
public function getParameterModel()
|
79 |
{
|
80 |
+
if (null === $this->parameterModel) {
|
81 |
$this->parameterModel = Mage::getModel('ops/payment_recurring_cc_parameterBag');
|
82 |
}
|
83 |
|
119 |
* @param Mage_Payment_Model_Recurring_Profile $profile
|
120 |
* @param Mage_Payment_Model_Info $paymentInfo
|
121 |
*
|
|
|
122 |
*/
|
123 |
protected function submitTrialSubscription(
|
124 |
Mage_Payment_Model_Recurring_Profile $profile,
|
125 |
Mage_Payment_Model_Info $paymentInfo
|
126 |
+
)
|
127 |
+
{
|
128 |
if ($profile->getTrialPeriodUnit()) {
|
129 |
$requestParams = $this->getParameterModel()->collectAllParametersForTrial($paymentInfo, $profile);
|
130 |
$this->getParameterModel()->unsetData();
|
149 |
public function submitRecurringProfile(
|
150 |
Mage_Payment_Model_Recurring_Profile $profile,
|
151 |
Mage_Payment_Model_Info $paymentInfo
|
152 |
+
)
|
153 |
+
{
|
154 |
$this->performPreDirectLinkCallActions($profile->getQuote(), $paymentInfo);
|
155 |
|
156 |
$this->submitTrialSubscription($profile, $paymentInfo);
|
203 |
switch ($profile->getNewState()) {
|
204 |
case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE:
|
205 |
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
206 |
+
$this->addAdminNotice(
|
207 |
+
'To actually activate the subscription an update in the Acceptance backend is needed.'
|
208 |
);
|
209 |
} else {
|
210 |
Mage::throwException(
|
211 |
+
$this->getDataHelper()->__(
|
212 |
+
'Automatic activation not possible. Please contact our support team.'
|
213 |
+
)
|
214 |
);
|
215 |
}
|
216 |
break;
|
217 |
case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED:
|
218 |
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
219 |
+
$this->addAdminNotice(
|
220 |
+
'To actually cancel the subscription an update in the Acceptance backend is needed.'
|
221 |
);
|
222 |
} else {
|
223 |
$this->sendSuspendMail($profile);
|
225 |
break;
|
226 |
case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED:
|
227 |
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
228 |
+
$this->addAdminNotice(
|
229 |
+
'To actually suspend the subscription an update in the Acceptance backend is needed.'
|
230 |
);
|
231 |
} else {
|
232 |
$this->sendSuspendMail($profile);
|
276 |
$profile->setOverrideState(true);
|
277 |
$session->addSuccess(
|
278 |
$this->getDataHelper()
|
279 |
+
->__(
|
280 |
+
'Your suspend request was successfully sent. A copy of the email will be sent to your address.'
|
281 |
)
|
282 |
);
|
283 |
} else {
|
343 |
*/
|
344 |
protected function submitRegularSubscription(Mage_Payment_Model_Recurring_Profile $profile,
|
345 |
Mage_Payment_Model_Info $paymentInfo
|
346 |
+
)
|
347 |
+
{
|
348 |
$requestParams = $this->getParameterModel()->collectAllParameters($paymentInfo, $profile);
|
349 |
$this->getParameterModel()->unsetData();
|
350 |
$response = $this->getDirectLinkHelper()->performDirectLinkRequest(
|
363 |
protected function submitInitialFee(
|
364 |
Mage_Payment_Model_Recurring_Profile $profile,
|
365 |
Mage_Payment_Model_Info $paymentInfo
|
366 |
+
)
|
367 |
+
{
|
368 |
/** @var $profile Mage_Sales_Model_Recurring_Profile */
|
369 |
if ($profile->getInitAmount() > 0) {
|
370 |
$order = $this->getSubscriptionManager()->createInitialOrder($profile);
|
app/code/community/Netresearch/OPS/Model/Payment/Recurring/Cc/ParameterBag.php
CHANGED
@@ -49,7 +49,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
49 |
*/
|
50 |
public function getSubscriptionHelper()
|
51 |
{
|
52 |
-
if (
|
53 |
$this->subscriptionHelper = Mage::helper('ops/subscription');
|
54 |
}
|
55 |
|
@@ -73,7 +73,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
73 |
*/
|
74 |
public function getDataHelper()
|
75 |
{
|
76 |
-
if (
|
77 |
$this->dataHelper = Mage::helper('ops');
|
78 |
}
|
79 |
|
@@ -97,7 +97,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
97 |
*/
|
98 |
public function getQuoteHelper()
|
99 |
{
|
100 |
-
if (
|
101 |
$this->quoteHelper = Mage::helper('ops/quote');
|
102 |
}
|
103 |
|
@@ -121,7 +121,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
121 |
*/
|
122 |
public function getConfig()
|
123 |
{
|
124 |
-
if (
|
125 |
$this->config = Mage::getModel('ops/config');
|
126 |
}
|
127 |
|
@@ -145,7 +145,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
145 |
*/
|
146 |
public function getRequestHelper()
|
147 |
{
|
148 |
-
if (
|
149 |
$this->requestHelper = Mage::helper('ops/payment_request');
|
150 |
}
|
151 |
|
@@ -223,7 +223,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
223 |
*
|
224 |
* @return Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag
|
225 |
*/
|
226 |
-
public function collectPaymentParameters(Mage_Payment_Model_Info $paymentInfo
|
227 |
{
|
228 |
$this->setData('CN', $paymentInfo->getAdditionalInformation('CC_CN'))
|
229 |
->setData('ALIAS', $paymentInfo->getAdditionalInformation('alias'))
|
@@ -286,7 +286,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
286 |
->setData('SUB_AMOUNT', $this->getDataHelper()->getAmount($subscriptionAmount))
|
287 |
// amount is always 0 for subscription transactions
|
288 |
->setData('AMOUNT', 0)
|
289 |
-
->setData(
|
|
|
290 |
$this->getSubscriptionHelper()->getBillingDayForPeriodUnit($periodUnit, $profile->getStoreId())
|
291 |
);
|
292 |
|
@@ -309,7 +310,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
309 |
*/
|
310 |
public function calculateEndDate(DateTime $startDate, $periodUnit, $frequency, $maxCycles)
|
311 |
{
|
312 |
-
if(!$this->isMappedUnit($periodUnit)){
|
313 |
$frequency = $this->adjustFrequencyToUnitSpecialCases($periodUnit, $frequency);
|
314 |
$periodUnit = $this->mapUnit($periodUnit);
|
315 |
}
|
@@ -337,12 +338,15 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
337 |
*
|
338 |
* @return bool
|
339 |
*/
|
340 |
-
protected function isMappedUnit($unit)
|
341 |
-
|
|
|
|
|
342 |
self::PERIOD_UNIT_DAY,
|
343 |
self::PERIOD_UNIT_WEEK,
|
344 |
self::PERIOD_UNIT_MONTH
|
345 |
-
|
|
|
346 |
}
|
347 |
|
348 |
/**
|
@@ -355,7 +359,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
355 |
*/
|
356 |
public function collectAllParameters(Mage_Payment_Model_Info $paymentInfo,
|
357 |
Mage_Payment_Model_Recurring_Profile $profile
|
358 |
-
)
|
|
|
359 |
$this->collectProfileParameters($profile)
|
360 |
->collectPaymentParameters($paymentInfo);
|
361 |
|
@@ -372,7 +377,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
372 |
*/
|
373 |
public function collectAllParametersForTrial(Mage_Payment_Model_Info $paymentInfo,
|
374 |
Mage_Payment_Model_Recurring_Profile $profile
|
375 |
-
)
|
|
|
376 |
$this->collectProfileParameters($profile, true)
|
377 |
->collectPaymentParameters($paymentInfo, true);
|
378 |
|
@@ -391,7 +397,8 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
391 |
public function collectAllParametersForInitialFee(Mage_Payment_Model_Info $paymentInfo,
|
392 |
Mage_Payment_Model_Recurring_Profile $profile,
|
393 |
Mage_Sales_Model_Order $order
|
394 |
-
)
|
|
|
395 |
/** @var $profile Mage_Sales_Model_Recurring_Profile */
|
396 |
$this->collectPaymentParameters($paymentInfo)->collectAddressParameters($profile);
|
397 |
|
@@ -419,7 +426,7 @@ class Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag extends Varien_Obj
|
|
419 |
* Determines base values for the subscription depending on the trial parameter
|
420 |
*
|
421 |
* @param Mage_Sales_Model_Recurring_Profile $profile
|
422 |
-
* @param
|
423 |
*
|
424 |
* @return string[] - containing the following:
|
425 |
* [0] => amount for the subscription,
|
49 |
*/
|
50 |
public function getSubscriptionHelper()
|
51 |
{
|
52 |
+
if (null === $this->subscriptionHelper) {
|
53 |
$this->subscriptionHelper = Mage::helper('ops/subscription');
|
54 |
}
|
55 |
|
73 |
*/
|
74 |
public function getDataHelper()
|
75 |
{
|
76 |
+
if (null === $this->dataHelper) {
|
77 |
$this->dataHelper = Mage::helper('ops');
|
78 |
}
|
79 |
|
97 |
*/
|
98 |
public function getQuoteHelper()
|
99 |
{
|
100 |
+
if (null === $this->quoteHelper) {
|
101 |
$this->quoteHelper = Mage::helper('ops/quote');
|
102 |
}
|
103 |
|
121 |
*/
|
122 |
public function getConfig()
|
123 |
{
|
124 |
+
if (null === $this->config) {
|
125 |
$this->config = Mage::getModel('ops/config');
|
126 |
}
|
127 |
|
145 |
*/
|
146 |
public function getRequestHelper()
|
147 |
{
|
148 |
+
if (null === $this->requestHelper) {
|
149 |
$this->requestHelper = Mage::helper('ops/payment_request');
|
150 |
}
|
151 |
|
223 |
*
|
224 |
* @return Netresearch_OPS_Model_Payment_Recurring_Cc_ParameterBag
|
225 |
*/
|
226 |
+
public function collectPaymentParameters(Mage_Payment_Model_Info $paymentInfo)
|
227 |
{
|
228 |
$this->setData('CN', $paymentInfo->getAdditionalInformation('CC_CN'))
|
229 |
->setData('ALIAS', $paymentInfo->getAdditionalInformation('alias'))
|
286 |
->setData('SUB_AMOUNT', $this->getDataHelper()->getAmount($subscriptionAmount))
|
287 |
// amount is always 0 for subscription transactions
|
288 |
->setData('AMOUNT', 0)
|
289 |
+
->setData(
|
290 |
+
'SUB_PERIOD_MOMENT',
|
291 |
$this->getSubscriptionHelper()->getBillingDayForPeriodUnit($periodUnit, $profile->getStoreId())
|
292 |
);
|
293 |
|
310 |
*/
|
311 |
public function calculateEndDate(DateTime $startDate, $periodUnit, $frequency, $maxCycles)
|
312 |
{
|
313 |
+
if (!$this->isMappedUnit($periodUnit)) {
|
314 |
$frequency = $this->adjustFrequencyToUnitSpecialCases($periodUnit, $frequency);
|
315 |
$periodUnit = $this->mapUnit($periodUnit);
|
316 |
}
|
338 |
*
|
339 |
* @return bool
|
340 |
*/
|
341 |
+
protected function isMappedUnit($unit)
|
342 |
+
{
|
343 |
+
return in_array(
|
344 |
+
$unit, array(
|
345 |
self::PERIOD_UNIT_DAY,
|
346 |
self::PERIOD_UNIT_WEEK,
|
347 |
self::PERIOD_UNIT_MONTH
|
348 |
+
)
|
349 |
+
);
|
350 |
}
|
351 |
|
352 |
/**
|
359 |
*/
|
360 |
public function collectAllParameters(Mage_Payment_Model_Info $paymentInfo,
|
361 |
Mage_Payment_Model_Recurring_Profile $profile
|
362 |
+
)
|
363 |
+
{
|
364 |
$this->collectProfileParameters($profile)
|
365 |
->collectPaymentParameters($paymentInfo);
|
366 |
|
377 |
*/
|
378 |
public function collectAllParametersForTrial(Mage_Payment_Model_Info $paymentInfo,
|
379 |
Mage_Payment_Model_Recurring_Profile $profile
|
380 |
+
)
|
381 |
+
{
|
382 |
$this->collectProfileParameters($profile, true)
|
383 |
->collectPaymentParameters($paymentInfo, true);
|
384 |
|
397 |
public function collectAllParametersForInitialFee(Mage_Payment_Model_Info $paymentInfo,
|
398 |
Mage_Payment_Model_Recurring_Profile $profile,
|
399 |
Mage_Sales_Model_Order $order
|
400 |
+
)
|
401 |
+
{
|
402 |
/** @var $profile Mage_Sales_Model_Recurring_Profile */
|
403 |
$this->collectPaymentParameters($paymentInfo)->collectAddressParameters($profile);
|
404 |
|
426 |
* Determines base values for the subscription depending on the trial parameter
|
427 |
*
|
428 |
* @param Mage_Sales_Model_Recurring_Profile $profile
|
429 |
+
* @param $trial - if the values for the trial subscription should be used or not
|
430 |
*
|
431 |
* @return string[] - containing the following:
|
432 |
* [0] => amount for the subscription,
|
app/code/community/Netresearch/OPS/Model/Response/Handler.php
CHANGED
@@ -42,7 +42,8 @@ class Netresearch_OPS_Model_Response_Handler
|
|
42 |
*/
|
43 |
public function processResponse(
|
44 |
$responseArray, Netresearch_OPS_Model_Payment_Abstract $paymentMethod, $shouldRegisterFeedback = true
|
45 |
-
)
|
|
|
46 |
$responseArray = array_change_key_case($responseArray, CASE_LOWER);
|
47 |
$this->getTypeHandler($responseArray['status'])
|
48 |
->handleResponse($responseArray, $paymentMethod, $shouldRegisterFeedback);
|
42 |
*/
|
43 |
public function processResponse(
|
44 |
$responseArray, Netresearch_OPS_Model_Payment_Abstract $paymentMethod, $shouldRegisterFeedback = true
|
45 |
+
)
|
46 |
+
{
|
47 |
$responseArray = array_change_key_case($responseArray, CASE_LOWER);
|
48 |
$this->getTypeHandler($responseArray['status'])
|
49 |
->handleResponse($responseArray, $paymentMethod, $shouldRegisterFeedback);
|
app/code/community/Netresearch/OPS/Model/Response/Type/Abstract.php
CHANGED
@@ -66,6 +66,9 @@
|
|
66 |
* @method string getIpcty()
|
67 |
* @method bool hasAcceptance()
|
68 |
* @method bool hasBrand()
|
|
|
|
|
|
|
69 |
* @method bool getShouldRegisterFeedback() if feedback should get registered on payment object
|
70 |
* @method Netresearch_OPS_Model_Response_Type_Abstract setShouldRegisterFeedback($shouldRegisterFeedback)
|
71 |
*
|
@@ -79,7 +82,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
79 |
*/
|
80 |
public function getConfig()
|
81 |
{
|
82 |
-
if (
|
83 |
$this->setData('config', Mage::getModel('ops/config'));
|
84 |
}
|
85 |
|
@@ -92,8 +95,9 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
92 |
*
|
93 |
* @param array $responseArray
|
94 |
* @param Netresearch_OPS_Model_Payment_Abstract $paymentMethod
|
95 |
-
* @param bool $shouldRegisterFeedback
|
96 |
-
*
|
|
|
97 |
*
|
98 |
* @return Netresearch_OPS_Model_Response_TypeInterface
|
99 |
*/
|
@@ -105,7 +109,8 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
105 |
$this->setShouldRegisterFeedback($shouldRegisterFeedback);
|
106 |
|
107 |
if ($this->getStatus() == $this->getMethodInstance()->getInfoInstance()->getAdditionalInformation('status')
|
108 |
-
|
|
|
109 |
return $this;
|
110 |
}
|
111 |
|
@@ -113,6 +118,10 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
113 |
$this->_handleResponse();
|
114 |
$this->updateAdditionalInformation();
|
115 |
|
|
|
|
|
|
|
|
|
116 |
return $this;
|
117 |
}
|
118 |
|
@@ -130,8 +139,10 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
130 |
*/
|
131 |
protected function updateAdditionalInformation()
|
132 |
{
|
|
|
133 |
$this->updateDefaultInformation();
|
134 |
$this->setFraudDetectionParameters();
|
|
|
135 |
}
|
136 |
|
137 |
/**
|
@@ -144,6 +155,10 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
144 |
$payment->setAdditionalInformation('paymentId', $this->getPayid())
|
145 |
->setAdditionalInformation('status', $this->getStatus());
|
146 |
|
|
|
|
|
|
|
|
|
147 |
if ($this->hasAcceptance()) {
|
148 |
$payment->setAdditionalInformation('acceptence', $this->getAcceptance());
|
149 |
}
|
@@ -153,6 +168,18 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
153 |
}
|
154 |
}
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
/**
|
157 |
* Sets Transaction details (TransactionId etc.)
|
158 |
*/
|
@@ -161,9 +188,13 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
161 |
$payment = $this->getMethodInstance()->getInfoInstance();
|
162 |
|
163 |
$payment->setTransactionParentId($this->getPayid());
|
164 |
-
$transId = $this->getTransactionId();
|
165 |
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
167 |
$payment->setTransactionId($transId);
|
168 |
$payment->setIsTransactionClosed(false);
|
169 |
}
|
@@ -201,11 +232,9 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
201 |
* @param string $orderComment
|
202 |
* @param string $additionalInfo
|
203 |
*
|
204 |
-
* @return string
|
205 |
*/
|
206 |
protected function addOrderComment($orderComment, $additionalInfo = '')
|
207 |
{
|
208 |
-
|
209 |
$orderComment = $this->getOrderComment($orderComment, $additionalInfo);
|
210 |
$this->getMethodInstance()->getInfoInstance()->getOrder()->addStatusHistoryComment($orderComment);
|
211 |
}
|
@@ -261,8 +290,8 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
261 |
$orderComment = Mage::helper('ops')->__(
|
262 |
'Received Acceptance feedback status update with final status %s.',
|
263 |
$this->getStatus()
|
264 |
-
|
265 |
);
|
|
|
266 |
return $this->getOrderComment($orderComment, $additionalInfo);
|
267 |
|
268 |
}
|
@@ -278,6 +307,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
278 |
'Received Acceptance feedback status update with intermediate status %s.',
|
279 |
$this->getStatus()
|
280 |
);
|
|
|
281 |
return $this->getOrderComment($orderComment, $additionalInfo);
|
282 |
}
|
283 |
|
@@ -292,6 +322,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
292 |
'Received Acceptance feedback status update with refused status %s.',
|
293 |
$this->getStatus()
|
294 |
);
|
|
|
295 |
return $this->getOrderComment($orderComment, $additionalInfo);
|
296 |
}
|
297 |
|
@@ -306,6 +337,7 @@ abstract class Netresearch_OPS_Model_Response_Type_Abstract extends Varien_Objec
|
|
306 |
'Received Acceptance feedback status update with suspected fraud status %s.',
|
307 |
$this->getStatus()
|
308 |
);
|
|
|
309 |
return $this->getOrderComment($orderComment, $additionalInfo);
|
310 |
}
|
311 |
|
66 |
* @method string getIpcty()
|
67 |
* @method bool hasAcceptance()
|
68 |
* @method bool hasBrand()
|
69 |
+
* @method bool hasAlias()
|
70 |
+
* @method bool hasMobilemode()
|
71 |
+
* @method string getAlias()
|
72 |
* @method bool getShouldRegisterFeedback() if feedback should get registered on payment object
|
73 |
* @method Netresearch_OPS_Model_Response_Type_Abstract setShouldRegisterFeedback($shouldRegisterFeedback)
|
74 |
*
|
82 |
*/
|
83 |
public function getConfig()
|
84 |
{
|
85 |
+
if ($this->getData('config') === null) {
|
86 |
$this->setData('config', Mage::getModel('ops/config'));
|
87 |
}
|
88 |
|
95 |
*
|
96 |
* @param array $responseArray
|
97 |
* @param Netresearch_OPS_Model_Payment_Abstract $paymentMethod
|
98 |
+
* @param bool $shouldRegisterFeedback
|
99 |
+
* determines if the Mage_Sales_Model_Order_Payments register*Feedback
|
100 |
+
* functions get called, defaults to true
|
101 |
*
|
102 |
* @return Netresearch_OPS_Model_Response_TypeInterface
|
103 |
*/
|
109 |
$this->setShouldRegisterFeedback($shouldRegisterFeedback);
|
110 |
|
111 |
if ($this->getStatus() == $this->getMethodInstance()->getInfoInstance()->getAdditionalInformation('status')
|
112 |
+
&& $this->getTransactionId() == $paymentMethod->getInfoInstance()->getLastTransId()
|
113 |
+
) {
|
114 |
return $this;
|
115 |
}
|
116 |
|
118 |
$this->_handleResponse();
|
119 |
$this->updateAdditionalInformation();
|
120 |
|
121 |
+
if ($this->getShouldRegisterFeedback() && $this->hasAlias()) {
|
122 |
+
Mage::helper('ops/alias')->saveAlias($responseArray);
|
123 |
+
}
|
124 |
+
|
125 |
return $this;
|
126 |
}
|
127 |
|
139 |
*/
|
140 |
protected function updateAdditionalInformation()
|
141 |
{
|
142 |
+
$this->getMethodInstance()->getInfoInstance()->setLastTransId($this->getTransactionId());
|
143 |
$this->updateDefaultInformation();
|
144 |
$this->setFraudDetectionParameters();
|
145 |
+
$this->setDeviceInformationParameters();
|
146 |
}
|
147 |
|
148 |
/**
|
155 |
$payment->setAdditionalInformation('paymentId', $this->getPayid())
|
156 |
->setAdditionalInformation('status', $this->getStatus());
|
157 |
|
158 |
+
if ($this->hasAlias()) {
|
159 |
+
$payment->setAdditionalInformation('alias', $this->getAlias());
|
160 |
+
}
|
161 |
+
|
162 |
if ($this->hasAcceptance()) {
|
163 |
$payment->setAdditionalInformation('acceptence', $this->getAcceptance());
|
164 |
}
|
168 |
}
|
169 |
}
|
170 |
|
171 |
+
protected function setDeviceInformationParameters()
|
172 |
+
{
|
173 |
+
if (!$this->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_Bancontact) {
|
174 |
+
return;
|
175 |
+
}
|
176 |
+
|
177 |
+
$payment = $this->getMethodInstance()->getInfoInstance();
|
178 |
+
if ($this->hasMobilemode()) {
|
179 |
+
$payment->setAdditionalInformation('MOBILEMODE', $this->getMobilemode());
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
/**
|
184 |
* Sets Transaction details (TransactionId etc.)
|
185 |
*/
|
188 |
$payment = $this->getMethodInstance()->getInfoInstance();
|
189 |
|
190 |
$payment->setTransactionParentId($this->getPayid());
|
|
|
191 |
|
192 |
+
if (!$this->hasPayidsub()) {
|
193 |
+
$transId = $payment->getLastTransId();
|
194 |
+
} else {
|
195 |
+
$transId = $this->getTransactionId();
|
196 |
+
}
|
197 |
+
|
198 |
$payment->setTransactionId($transId);
|
199 |
$payment->setIsTransactionClosed(false);
|
200 |
}
|
232 |
* @param string $orderComment
|
233 |
* @param string $additionalInfo
|
234 |
*
|
|
|
235 |
*/
|
236 |
protected function addOrderComment($orderComment, $additionalInfo = '')
|
237 |
{
|
|
|
238 |
$orderComment = $this->getOrderComment($orderComment, $additionalInfo);
|
239 |
$this->getMethodInstance()->getInfoInstance()->getOrder()->addStatusHistoryComment($orderComment);
|
240 |
}
|
290 |
$orderComment = Mage::helper('ops')->__(
|
291 |
'Received Acceptance feedback status update with final status %s.',
|
292 |
$this->getStatus()
|
|
|
293 |
);
|
294 |
+
|
295 |
return $this->getOrderComment($orderComment, $additionalInfo);
|
296 |
|
297 |
}
|
307 |
'Received Acceptance feedback status update with intermediate status %s.',
|
308 |
$this->getStatus()
|
309 |
);
|
310 |
+
|
311 |
return $this->getOrderComment($orderComment, $additionalInfo);
|
312 |
}
|
313 |
|
322 |
'Received Acceptance feedback status update with refused status %s.',
|
323 |
$this->getStatus()
|
324 |
);
|
325 |
+
|
326 |
return $this->getOrderComment($orderComment, $additionalInfo);
|
327 |
}
|
328 |
|
337 |
'Received Acceptance feedback status update with suspected fraud status %s.',
|
338 |
$this->getStatus()
|
339 |
);
|
340 |
+
|
341 |
return $this->getOrderComment($orderComment, $additionalInfo);
|