From a7c9c2a5fd099e6f342b8fa26701c79a90af51e6 Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Mon, 13 Feb 2017 15:09:19 +0100 Subject: [PATCH] Initial commit --- Block/Adminhtml/Buttons.php | 74 + Block/Adminhtml/Fundtransfer/Edit/Form.php | 288 ++++ Block/Adminhtml/Fundtransfer/Transfer.php | 84 + Block/Adminhtml/Support/Contact.php | 84 + Block/Adminhtml/Support/Edit/Form.php | 145 ++ .../Adminhtml/Transactions/Detail/Plugin.php | 116 ++ Block/Checkout/Onepage/Success/Messages.php | 42 + Block/Checkout/Script.php | 66 + Controller/Adminhtml/Fundtransfer/Index.php | 43 + Controller/Adminhtml/Fundtransfer/Submit.php | 118 ++ .../Adminhtml/Fundtransfer/Transfer.php | 78 + Controller/Adminhtml/Support/Contact.php | 78 + Controller/Adminhtml/Support/Index.php | 43 + Controller/Adminhtml/Support/Sendrequest.php | 96 ++ Controller/Adminhtml/Test/Config.php | 89 + .../Adminhtml/Transactions/RefundReversal.php | 74 + Controller/Checkout/Back.php | 260 +++ Controller/Checkout/Confirm.php | 126 ++ Controller/Checkout/Failed.php | 81 + Controller/Checkout/Start.php | 181 +++ Controller/Storage/Read.php | 125 ++ Controller/Storage/ReturnFallback.php | 72 + Helper/Data.php | 462 ++++++ Helper/DataStorage.php | 180 ++ LICENSE | 339 ++++ Model/AbstractPayment.php | 1056 ++++++++++++ Model/CcardConfigProvider.php | 100 ++ Model/Config/Backend/CustomerId.php | 81 + Model/Config/Backend/Secret.php | 71 + Model/Config/Source/Configurations.php | 58 + Model/Config/Source/DisplayModes.php | 58 + Model/Config/Source/InstallmentProviders.php | 56 + Model/Config/Source/InvoiceProviders.php | 57 + Model/Config/Source/Layouts.php | 59 + Model/Config/Source/OrderCreation.php | 56 + Model/Config/Source/Txident.php | 56 + Model/ConfigProvider.php | 262 +++ Model/FundTransfer.php | 118 ++ Model/OrderManagement.php | 455 ++++++ Model/Payment/Bmc.php | 46 + Model/Payment/Ccard.php | 47 + Model/Payment/Ccardmoto.php | 71 + Model/Payment/Ekonto.php | 45 + Model/Payment/Epaybg.php | 45 + Model/Payment/Eps.php | 67 + Model/Payment/Giropay.php | 45 + Model/Payment/Ideal.php | 67 + Model/Payment/Installment.php | 110 ++ Model/Payment/Invoice.php | 114 ++ Model/Payment/Invoiceb2b.php | 109 ++ Model/Payment/Maestro.php | 45 + Model/Payment/Moneta.php | 45 + Model/Payment/Mpass.php | 45 + Model/Payment/P24.php | 45 + Model/Payment/Paybox.php | 45 + Model/Payment/Paypal.php | 56 + Model/Payment/Paysafecard.php | 45 + Model/Payment/Poli.php | 45 + Model/Payment/Quick.php | 45 + Model/Payment/Sepa.php | 57 + Model/Payment/Skrilldirect.php | 45 + Model/Payment/Skrillwallet.php | 45 + Model/Payment/Sofortbanking.php | 58 + Model/Payment/Tatrapay.php | 46 + Model/Payment/Trustly.php | 45 + Model/Payment/Trustpay.php | 68 + Model/Payment/Voucher.php | 45 + Model/Support.php | 292 ++++ Model/Test.php | 116 ++ README.md | 26 + composer.json | 25 + etc/adminhtml/di.xml | 38 + etc/adminhtml/routes.xml | 40 + etc/adminhtml/system.xml | 1448 +++++++++++++++++ etc/config.xml | 320 ++++ etc/email_templates.xml | 37 + etc/frontend/di.xml | 53 + etc/frontend/routes.xml | 40 + etc/module.xml | 37 + i18n/de_AT.csv | 110 ++ i18n/en_US.csv | 111 ++ registration.php | 37 + .../email/contact_support_email.html | 24 + .../layout/adminhtml_system_config_edit.xml | 38 + ...checkoutseamless_fundtransfer_transfer.xml | 48 + ...recardcheckoutseamless_support_contact.xml | 45 + .../templates/email/support_modules.phtml | 35 + .../email/support_paymentmethods.phtml | 43 + view/adminhtml/web/images/wirecard-logo.png | Bin 0 -> 4881 bytes view/adminhtml/web/js/fundtransfer-loader.js | 34 + view/adminhtml/web/js/fundtransfer.js | 69 + view/adminhtml/web/styles.css | 37 + view/frontend/layout/checkout_index_index.xml | 146 ++ .../layout/checkout_onepage_success.xml | 40 + ...wirecardcheckoutseamless_checkout_back.xml | 57 + ...recardcheckoutseamless_checkout_failed.xml | 57 + ...heckoutseamless_storage_returnfallback.xml | 46 + view/frontend/templates/back.phtml | 59 + view/frontend/templates/script.phtml | 37 + view/frontend/templates/storagereturn.phtml | 55 + view/frontend/web/css/pci3iframe.css | 64 + view/frontend/web/images/bmc.png | Bin 0 -> 4464 bytes view/frontend/web/images/cc.png | Bin 0 -> 21077 bytes view/frontend/web/images/ccMoto.png | Bin 0 -> 21077 bytes view/frontend/web/images/ekonto.png | Bin 0 -> 4503 bytes view/frontend/web/images/epaybg.png | Bin 0 -> 2334 bytes view/frontend/web/images/eps.png | Bin 0 -> 4562 bytes view/frontend/web/images/giropay.png | Bin 0 -> 3086 bytes view/frontend/web/images/ideal.png | Bin 0 -> 4985 bytes view/frontend/web/images/installment.png | Bin 0 -> 28241 bytes view/frontend/web/images/invoice.png | Bin 0 -> 34321 bytes view/frontend/web/images/invoiceb2b.png | Bin 0 -> 34321 bytes view/frontend/web/images/moneta.png | Bin 0 -> 2087 bytes view/frontend/web/images/mpass.png | Bin 0 -> 3930 bytes view/frontend/web/images/p24.png | Bin 0 -> 3358 bytes view/frontend/web/images/paybox.png | Bin 0 -> 3413 bytes view/frontend/web/images/paypal.png | Bin 0 -> 2310 bytes view/frontend/web/images/paysafecard.png | Bin 0 -> 3518 bytes view/frontend/web/images/poli.png | Bin 0 -> 1964 bytes view/frontend/web/images/quick.png | Bin 0 -> 26016 bytes view/frontend/web/images/sepadd.png | Bin 0 -> 3791 bytes view/frontend/web/images/skrilldirect.png | Bin 0 -> 1345 bytes view/frontend/web/images/skrillwallet.png | Bin 0 -> 1994 bytes view/frontend/web/images/sofortbanking-de.png | Bin 0 -> 4173 bytes view/frontend/web/images/sofortbanking-en.png | Bin 0 -> 3412 bytes view/frontend/web/images/tatrapay.png | Bin 0 -> 2235 bytes view/frontend/web/images/trustly.png | Bin 0 -> 2217 bytes view/frontend/web/images/trustpay.png | Bin 0 -> 2194 bytes view/frontend/web/images/voucher.png | Bin 0 -> 19714 bytes .../web/js/action/set-payment-method.js | 123 ++ .../web/js/action/store-paymentdata.js | 99 ++ .../web/js/model/min-age-validator.js | 68 + .../web/js/view/payment/method-renderer.js | 161 ++ .../js/view/payment/method-renderer/ccard.js | 240 +++ .../js/view/payment/method-renderer/eps.js | 70 + .../view/payment/method-renderer/giropay.js | 102 ++ .../js/view/payment/method-renderer/ideal.js | 67 + .../method-renderer/invoiceinstallment.js | 103 ++ .../js/view/payment/method-renderer/paybox.js | 96 ++ .../js/view/payment/method-renderer/sepa.js | 105 ++ .../view/payment/method-renderer/standard.js | 84 + .../view/payment/method-renderer/trustpay.js | 71 + .../view/payment/method-renderer/voucher.js | 96 ++ .../web/template/payment/method-ccard.html | 264 +++ .../web/template/payment/method-eps.html | 100 ++ .../web/template/payment/method-giropay.html | 136 ++ .../web/template/payment/method-ideal.html | 100 ++ .../payment/method-invoiceinstallment.html | 120 ++ .../web/template/payment/method-paybox.html | 104 ++ .../web/template/payment/method-sepa.html | 149 ++ .../web/template/payment/method-standard.html | 82 + .../web/template/payment/method-trustpay.html | 104 ++ .../web/template/payment/method-voucher.html | 104 ++ 153 files changed, 13890 insertions(+) create mode 100644 Block/Adminhtml/Buttons.php create mode 100644 Block/Adminhtml/Fundtransfer/Edit/Form.php create mode 100644 Block/Adminhtml/Fundtransfer/Transfer.php create mode 100644 Block/Adminhtml/Support/Contact.php create mode 100644 Block/Adminhtml/Support/Edit/Form.php create mode 100644 Block/Adminhtml/Transactions/Detail/Plugin.php create mode 100644 Block/Checkout/Onepage/Success/Messages.php create mode 100644 Block/Checkout/Script.php create mode 100644 Controller/Adminhtml/Fundtransfer/Index.php create mode 100644 Controller/Adminhtml/Fundtransfer/Submit.php create mode 100644 Controller/Adminhtml/Fundtransfer/Transfer.php create mode 100644 Controller/Adminhtml/Support/Contact.php create mode 100644 Controller/Adminhtml/Support/Index.php create mode 100644 Controller/Adminhtml/Support/Sendrequest.php create mode 100644 Controller/Adminhtml/Test/Config.php create mode 100644 Controller/Adminhtml/Transactions/RefundReversal.php create mode 100644 Controller/Checkout/Back.php create mode 100644 Controller/Checkout/Confirm.php create mode 100644 Controller/Checkout/Failed.php create mode 100644 Controller/Checkout/Start.php create mode 100644 Controller/Storage/Read.php create mode 100644 Controller/Storage/ReturnFallback.php create mode 100644 Helper/Data.php create mode 100644 Helper/DataStorage.php create mode 100644 LICENSE create mode 100644 Model/AbstractPayment.php create mode 100644 Model/CcardConfigProvider.php create mode 100644 Model/Config/Backend/CustomerId.php create mode 100644 Model/Config/Backend/Secret.php create mode 100644 Model/Config/Source/Configurations.php create mode 100644 Model/Config/Source/DisplayModes.php create mode 100644 Model/Config/Source/InstallmentProviders.php create mode 100644 Model/Config/Source/InvoiceProviders.php create mode 100644 Model/Config/Source/Layouts.php create mode 100644 Model/Config/Source/OrderCreation.php create mode 100644 Model/Config/Source/Txident.php create mode 100644 Model/ConfigProvider.php create mode 100644 Model/FundTransfer.php create mode 100644 Model/OrderManagement.php create mode 100644 Model/Payment/Bmc.php create mode 100644 Model/Payment/Ccard.php create mode 100644 Model/Payment/Ccardmoto.php create mode 100644 Model/Payment/Ekonto.php create mode 100644 Model/Payment/Epaybg.php create mode 100644 Model/Payment/Eps.php create mode 100644 Model/Payment/Giropay.php create mode 100644 Model/Payment/Ideal.php create mode 100644 Model/Payment/Installment.php create mode 100644 Model/Payment/Invoice.php create mode 100644 Model/Payment/Invoiceb2b.php create mode 100644 Model/Payment/Maestro.php create mode 100644 Model/Payment/Moneta.php create mode 100644 Model/Payment/Mpass.php create mode 100644 Model/Payment/P24.php create mode 100644 Model/Payment/Paybox.php create mode 100644 Model/Payment/Paypal.php create mode 100644 Model/Payment/Paysafecard.php create mode 100644 Model/Payment/Poli.php create mode 100644 Model/Payment/Quick.php create mode 100644 Model/Payment/Sepa.php create mode 100644 Model/Payment/Skrilldirect.php create mode 100644 Model/Payment/Skrillwallet.php create mode 100644 Model/Payment/Sofortbanking.php create mode 100644 Model/Payment/Tatrapay.php create mode 100644 Model/Payment/Trustly.php create mode 100644 Model/Payment/Trustpay.php create mode 100644 Model/Payment/Voucher.php create mode 100644 Model/Support.php create mode 100644 Model/Test.php create mode 100644 README.md create mode 100644 composer.json create mode 100644 etc/adminhtml/di.xml create mode 100644 etc/adminhtml/routes.xml create mode 100644 etc/adminhtml/system.xml create mode 100644 etc/config.xml create mode 100644 etc/email_templates.xml create mode 100644 etc/frontend/di.xml create mode 100644 etc/frontend/routes.xml create mode 100644 etc/module.xml create mode 100644 i18n/de_AT.csv create mode 100644 i18n/en_US.csv create mode 100644 registration.php create mode 100644 view/adminhtml/email/contact_support_email.html create mode 100644 view/adminhtml/layout/adminhtml_system_config_edit.xml create mode 100644 view/adminhtml/layout/wirecardcheckoutseamless_fundtransfer_transfer.xml create mode 100644 view/adminhtml/layout/wirecardcheckoutseamless_support_contact.xml create mode 100644 view/adminhtml/templates/email/support_modules.phtml create mode 100644 view/adminhtml/templates/email/support_paymentmethods.phtml create mode 100644 view/adminhtml/web/images/wirecard-logo.png create mode 100644 view/adminhtml/web/js/fundtransfer-loader.js create mode 100644 view/adminhtml/web/js/fundtransfer.js create mode 100644 view/adminhtml/web/styles.css create mode 100644 view/frontend/layout/checkout_index_index.xml create mode 100644 view/frontend/layout/checkout_onepage_success.xml create mode 100644 view/frontend/layout/wirecardcheckoutseamless_checkout_back.xml create mode 100644 view/frontend/layout/wirecardcheckoutseamless_checkout_failed.xml create mode 100644 view/frontend/layout/wirecardcheckoutseamless_storage_returnfallback.xml create mode 100644 view/frontend/templates/back.phtml create mode 100644 view/frontend/templates/script.phtml create mode 100644 view/frontend/templates/storagereturn.phtml create mode 100644 view/frontend/web/css/pci3iframe.css create mode 100644 view/frontend/web/images/bmc.png create mode 100644 view/frontend/web/images/cc.png create mode 100644 view/frontend/web/images/ccMoto.png create mode 100644 view/frontend/web/images/ekonto.png create mode 100644 view/frontend/web/images/epaybg.png create mode 100644 view/frontend/web/images/eps.png create mode 100644 view/frontend/web/images/giropay.png create mode 100644 view/frontend/web/images/ideal.png create mode 100644 view/frontend/web/images/installment.png create mode 100644 view/frontend/web/images/invoice.png create mode 100644 view/frontend/web/images/invoiceb2b.png create mode 100644 view/frontend/web/images/moneta.png create mode 100644 view/frontend/web/images/mpass.png create mode 100644 view/frontend/web/images/p24.png create mode 100644 view/frontend/web/images/paybox.png create mode 100644 view/frontend/web/images/paypal.png create mode 100644 view/frontend/web/images/paysafecard.png create mode 100644 view/frontend/web/images/poli.png create mode 100644 view/frontend/web/images/quick.png create mode 100644 view/frontend/web/images/sepadd.png create mode 100644 view/frontend/web/images/skrilldirect.png create mode 100644 view/frontend/web/images/skrillwallet.png create mode 100644 view/frontend/web/images/sofortbanking-de.png create mode 100644 view/frontend/web/images/sofortbanking-en.png create mode 100644 view/frontend/web/images/tatrapay.png create mode 100644 view/frontend/web/images/trustly.png create mode 100644 view/frontend/web/images/trustpay.png create mode 100644 view/frontend/web/images/voucher.png create mode 100644 view/frontend/web/js/action/set-payment-method.js create mode 100644 view/frontend/web/js/action/store-paymentdata.js create mode 100644 view/frontend/web/js/model/min-age-validator.js create mode 100644 view/frontend/web/js/view/payment/method-renderer.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/ccard.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/eps.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/giropay.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/ideal.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/invoiceinstallment.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/paybox.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/sepa.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/standard.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/trustpay.js create mode 100644 view/frontend/web/js/view/payment/method-renderer/voucher.js create mode 100644 view/frontend/web/template/payment/method-ccard.html create mode 100644 view/frontend/web/template/payment/method-eps.html create mode 100644 view/frontend/web/template/payment/method-giropay.html create mode 100644 view/frontend/web/template/payment/method-ideal.html create mode 100644 view/frontend/web/template/payment/method-invoiceinstallment.html create mode 100644 view/frontend/web/template/payment/method-paybox.html create mode 100644 view/frontend/web/template/payment/method-sepa.html create mode 100644 view/frontend/web/template/payment/method-standard.html create mode 100644 view/frontend/web/template/payment/method-trustpay.html create mode 100644 view/frontend/web/template/payment/method-voucher.html diff --git a/Block/Adminhtml/Buttons.php b/Block/Adminhtml/Buttons.php new file mode 100644 index 0000000..b569e37 --- /dev/null +++ b/Block/Adminhtml/Buttons.php @@ -0,0 +1,74 @@ +setElement($element); + + $url = $this->getUrl('wirecardcheckoutseamless/test/config'); + + $html = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') + ->setType('button') + ->setClass('scalable') + ->setLabel('Test configuration') + ->setOnClick("setLocation('$url')") + ->toHtml(); + + $html .= ' '; + + $url = $this->getUrl('wirecardcheckoutseamless/support/contact'); + $html .= $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') + ->setType('button') + ->setClass('scalable') + ->setLabel('Contact support') + ->setOnClick("setLocation('$url')") + ->toHtml(); + + $html .= ' '; + + $url = $this->getUrl('wirecardcheckoutseamless/fundtransfer/transfer'); + $html .= $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') + ->setType('button') + ->setClass('scalable') + ->setLabel('Fund Transfer') + ->setOnClick("setLocation('$url')") + ->toHtml(); + + + return $html; + } +} diff --git a/Block/Adminhtml/Fundtransfer/Edit/Form.php b/Block/Adminhtml/Fundtransfer/Edit/Form.php new file mode 100644 index 0000000..39890a8 --- /dev/null +++ b/Block/Adminhtml/Fundtransfer/Edit/Form.php @@ -0,0 +1,288 @@ +_dataHelper = $dataHelper; + $this->_localeLists = $localeLists; + } + + protected function _prepareForm() + { + /** @var \Magento\Framework\Data\Form $form */ + $form = $this->_formFactory->create([ + 'data' => [ + 'id' => 'edit_form', + 'action' => $this->getUrl('*/*/submit', array('id' => $this->getRequest()->getParam('id'))), + 'method' => 'post' + ] + ] + ); + + $form->setUseContainer(true); + + $fieldset = $form->addFieldset('form_form', array('legend' => $this->_dataHelper->__('Fund Transfer'))); + $fieldset->addField('transferType', 'select', [ + 'name' => 'transferType', + 'label' => $this->_dataHelper->__('Fund transfer type'), + 'class' => 'required-entry', + 'required' => true, + 'options' => array( + '' => $this->_dataHelper->__('Please select the fund transfer type'), + 'existingorder' => $this->_dataHelper->__('Existing order'), + 'moneta' => 'moneta.ru', + 'sepa-ct' => 'SEPA-CT', + 'skrillwallet' => 'Skrill Digital Wallet' + ), + ]); + + $fieldNoteFmt = sprintf('%s', + $this->_dataHelper->__('See documentation')); + + $fieldset->addField('currency', 'select', [ + 'name' => 'currency', + 'label' => $this->_dataHelper->__('Currency'), + 'class' => 'required-entry', + 'required' => true, + 'values' => $this->_localeLists->getOptionCurrencies(), + 'note' => sprintf($fieldNoteFmt, '/request_parameters#currency') + ]); + + $fieldset->addField('amount', 'text', array( + 'name' => 'amount', + 'label' => $this->_dataHelper->__('Amount'), + 'class' => 'validate-greater-than-zero required-entry', + 'required' => true, + 'style' => 'width: 100px', + 'note' => sprintf($fieldNoteFmt, '/request_parameters#amount') + )); + + $fieldset->addField('orderDescription', 'text', array( + 'name' => 'orderDescription', + 'label' => $this->_dataHelper->__('Order description'), + 'class' => 'required-entry', + 'required' => true, + 'note' => sprintf($fieldNoteFmt, '/request_parameters#orderdescription') + )); + + $fieldset->addField('customerStatement', 'text', array( + 'name' => 'customerStatement', + 'label' => $this->_dataHelper->__('Customer statement'), + 'note' => sprintf($fieldNoteFmt, '/request_parameters#customerstatement') + )); + + $fieldset->addField('creditNumber', 'text', array( + 'name' => 'creditNumber', + 'label' => $this->_dataHelper->__('Credit number'), + 'class' => 'validate-greater-than-zero', + 'style' => 'width: 200px' + )); + + $fieldset->addField('orderNumber', 'text', array( + 'name' => 'orderNumber', + 'label' => $this->_dataHelper->__('Order number'), + 'class' => 'validate-greater-than-zero', + 'style' => 'width: 200px', + 'note' => sprintf($fieldNoteFmt, '/request_parameters#ordernumber') + )); + + $fieldset->addField('orderReference', 'text', array( + 'name' => 'orderReference', + 'label' => $this->_dataHelper->__('Order reference'), + 'style' => 'width: 200px', + 'note' => sprintf($fieldNoteFmt, '/request_parameters#orderreference') + )); + + /* existing order fields */ + $fieldsetExistingOrder = $form->addFieldset('fields-existingorder', + array( + 'legend' => $this->_dataHelper->__('Existing order data'), + 'class' => 'transferfund-fieldset' + )); + $fieldsetExistingOrder->addField('sourceOrderNumber', 'text', array( + 'name' => 'sourceOrderNumber', + 'label' => $this->_dataHelper->__('Source order number'), + 'class' => 'validate-greater-than-zero required-entry fundtransfer-required', + 'required' => true, + 'style' => 'width: 200px', + 'note' => sprintf($fieldNoteFmt, '/request_parameters#ordernumber') + )); + + + /* sepa-ct fields */ + $fieldsetExistingOrder = $form->addFieldset('fields-sepa-ct', + array( + 'legend' => $this->_dataHelper->__('SEPA-CT data'), + 'class' => 'transferfund-fieldset' + )); + $fieldsetExistingOrder->addField('bankAccountOwner', 'text', array( + 'name' => 'bankAccountOwner', + 'label' => $this->_dataHelper->__('Bank account owner'), + 'class' => 'required-entry fundtransfer-required', + 'required' => true, + 'style' => 'width: 400px', + 'note' => sprintf($fieldNoteFmt, '/back-end_operations:functional_wcp_wcs:transaction-based_operations:transferfund#fund_transfer_typesepa-ct') + )); + + $fieldsetExistingOrder->addField('bankBic', 'text', array( + 'name' => 'bankBic', + 'label' => $this->_dataHelper->__('BIC'), + 'class' => 'required-entry fundtransfer-required', + 'required' => true, + 'style' => 'width: 400px', + 'note' => sprintf($fieldNoteFmt, '/back-end_operations:functional_wcp_wcs:transaction-based_operations:transferfund#fund_transfer_typesepa-ct') + )); + + $fieldsetExistingOrder->addField('bankAccountIban', 'text', array( + 'name' => 'bankAccountIban', + 'label' => $this->_dataHelper->__('IBAN'), + 'class' => 'required-entry fundtransfer-required', + 'required' => true, + 'style' => 'width: 400px', + 'note' => sprintf($fieldNoteFmt, '/back-end_operations:functional_wcp_wcs:transaction-based_operations:transferfund#fund_transfer_typesepa-ct') + )); + + + /* skrillwallet fields */ + $fieldsetExistingOrder = $form->addFieldset('fields-skrillwallet', + array( + 'legend' => $this->_dataHelper->__('Skrill Digital Wallet data'), + 'class' => 'transferfund-fieldset' + )); + $fieldsetExistingOrder->addField('consumerEmail', 'text', array( + 'name' => 'consumerEmail', + 'label' => $this->_dataHelper->__('Consumer e-mail address'), + 'class' => 'required-entry validate-email fundtransfer-required', + 'required' => true, + 'style' => 'width: 400px', + 'note' => sprintf($fieldNoteFmt, '/request_parameters#consumer_billing_data') + )); + + + /* moneta.ru fields */ + $fieldsetExistingOrder = $form->addFieldset('fields-moneta', + array( + 'legend' => $this->_dataHelper->__('moneta.ru data'), + 'class' => 'transferfund-fieldset' + )); + $fieldsetExistingOrder->addField('consumerWalletId', 'text', array( + 'name' => 'consumerWalletId', + 'label' => $this->_dataHelper->__('Consumer wallet ID'), + 'class' => 'required-entry fundtransfer-required', + 'required' => true, + 'style' => 'width: 400px', + 'note' => sprintf($fieldNoteFmt, '/back-end_operations:functional_wcp_wcs:transaction-based_operations:transferfund#fund_transfer_typemoneta') + )); + + $form->setValues(['currency' => 'EUR']); + + /** @var \Magento\Framework\DataObject $dataObject */ + $dataObject = $this->_backendSession->getWirecardCheckoutSeamlessFundTrandsferFormData(); + + if (is_object($dataObject)) { + $form->setValues($dataObject->getData()); + } + + $this->setForm($form); + + return parent::_prepareForm(); + } + + /** + * Prepare label for tab + * + * @return string + */ + public function getTabLabel() + { + return $this->_dataHelper->__('Fund Transfer'); + } + + /** + * Prepare title for tab + * + * @return string + */ + public function getTabTitle() + { + return $this->_dataHelper->__('Fund Transfer'); + } + + /** + * {@inheritdoc} + */ + public function canShowTab() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function isHidden() + { + return false; + } +} diff --git a/Block/Adminhtml/Fundtransfer/Transfer.php b/Block/Adminhtml/Fundtransfer/Transfer.php new file mode 100644 index 0000000..d9555b3 --- /dev/null +++ b/Block/Adminhtml/Fundtransfer/Transfer.php @@ -0,0 +1,84 @@ +_coreRegistry = $registry; + $this->_dataHelper = $dataHelper; + + $this->_objectId = 'id'; + $this->_controller = 'adminhtml_fundtransfer'; + $this->_blockGroup = 'Wirecard_CheckoutSeamless'; + $this->buttonList->remove('save'); + $this->buttonList->add( + 'sendrequest', + [ + 'label' => $this->_dataHelper->__('Submit Transfer'), + 'class' => 'save', + 'onclick' => 'jQuery("#edit_form").submit();', + ], + -100, 0, 'footer' + ); + } + + +} \ No newline at end of file diff --git a/Block/Adminhtml/Support/Contact.php b/Block/Adminhtml/Support/Contact.php new file mode 100644 index 0000000..6ced309 --- /dev/null +++ b/Block/Adminhtml/Support/Contact.php @@ -0,0 +1,84 @@ +_coreRegistry = $registry; + $this->_dataHelper = $dataHelper; + + $this->_objectId = 'id'; + $this->_controller = 'adminhtml_support'; + $this->_blockGroup = 'Wirecard_CheckoutSeamless'; + $this->buttonList->remove('save'); + $this->buttonList->add( + 'sendrequest', + [ + 'label' => $this->_dataHelper->__('Send support request'), + 'class' => 'save', + 'onclick' => 'jQuery("#edit_form").submit();', + ], + -100, 0, 'footer' + ); + } + + +} \ No newline at end of file diff --git a/Block/Adminhtml/Support/Edit/Form.php b/Block/Adminhtml/Support/Edit/Form.php new file mode 100644 index 0000000..9e03242 --- /dev/null +++ b/Block/Adminhtml/Support/Edit/Form.php @@ -0,0 +1,145 @@ +_dataHelper = $dataHelper; + } + + protected function _prepareForm() + { + /** @var \Magento\Framework\Data\Form $form */ + $form = $this->_formFactory->create([ + 'data' => [ + 'id' => 'edit_form', + //'action' => $this->getData('action'), + 'action' => $this->getUrl('*/*/sendrequest', array('id' => $this->getRequest()->getParam('id'))), + 'method' => 'post' + ] + ] + ); + + $form->setUseContainer(true); + + $fieldset = $form->addFieldset('form_form', array('legend' => $this->_dataHelper->__('Contact Form'))); + $fieldset->addField('to', 'select', [ + 'label' => $this->_dataHelper->__('To'), + 'class' => 'required-entry', + 'required' => true, + 'name' => 'to', + 'options' => array( + 'support.at@wirecard.com' => 'Support Team Wirecard CEE, Austria', + 'support@wirecard.com' => 'Support Team Wirecard AG, Germany', + 'support.sg@wirecard.com' => 'Support Team Wirecard Singapore' + ) + ]); + + $fieldset->addField('replyto', 'text', array( + 'label' => $this->_dataHelper->__('Your e-mail address'), + 'class' => 'validate-email', + 'name' => 'replyto' + )); + + $fieldset->addField('description', 'textarea', array( + 'label' => $this->_dataHelper->__('Your message'), + 'class' => 'required-entry', + 'required' => true, + 'name' => 'description', + 'style' => 'height:30em;width:50em' + )); + + + $this->setForm($form); + + return parent::_prepareForm(); + } + + /** + * Prepare label for tab + * + * @return string + */ + public function getTabLabel() + { + return $this->_dataHelper->__('Support Request'); + } + + /** + * Prepare title for tab + * + * @return string + */ + public function getTabTitle() + { + return $this->_dataHelper->__('Support Request'); + } + + /** + * {@inheritdoc} + */ + public function canShowTab() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function isHidden() + { + return false; + } +} diff --git a/Block/Adminhtml/Transactions/Detail/Plugin.php b/Block/Adminhtml/Transactions/Detail/Plugin.php new file mode 100644 index 0000000..0a4b6de --- /dev/null +++ b/Block/Adminhtml/Transactions/Detail/Plugin.php @@ -0,0 +1,116 @@ +_coreRegistry = $registry; + $this->adminHelper = $adminHelper; + $this->_urlBuilder = $context->getUrlBuilder(); + $this->orderPaymentRepository = $orderPaymentRepository; + } + + public function beforeGetLayout(\Magento\Sales\Block\Adminhtml\Transactions\Detail $subject) + { + $this->_txn = $this->_coreRegistry->registry('current_transaction'); + if (!$this->_txn) { + return; + } + + if ($this->_txn->getTxnType() != Transaction::TYPE_REFUND) + return; + + /** @var \Magento\Sales\Model\Order\Payment\Interceptor $payment */ + $payment = $this->orderPaymentRepository->get($this->_txn->getPaymentId()); + + $methodInstance = $payment->getMethodInstance(); + + if ($methodInstance instanceof \Wirecard\CheckoutSeamless\Model\AbstractPayment) { + $addInfo = $this->_txn->getAdditionalInformation('raw_details_info'); + + if (isset($addInfo['orderNumber']) && isset($addInfo['creditNumber'])) { + $fetchUrl = $this->_urlBuilder->getUrl('wirecardcheckoutseamless/transactions/refundreversal', ['_current' => true]); + $subject->addButton('refundreversal', ['label' => __('Refund Reversal'), 'onclick' => "setLocation('{$fetchUrl}')", 'class' => 'button']); + } + } + + } +} diff --git a/Block/Checkout/Onepage/Success/Messages.php b/Block/Checkout/Onepage/Success/Messages.php new file mode 100644 index 0000000..7f72429 --- /dev/null +++ b/Block/Checkout/Onepage/Success/Messages.php @@ -0,0 +1,42 @@ +setMessages($this->messageManager->getMessages(true)); + return parent::_toHtml(); + } +} diff --git a/Block/Checkout/Script.php b/Block/Checkout/Script.php new file mode 100644 index 0000000..5589c75 --- /dev/null +++ b/Block/Checkout/Script.php @@ -0,0 +1,66 @@ +_dataStorageHelper = $helper; + } + + public function getDataStorageUrl() + { + return $this->_dataStorageHelper->init(); + } +} diff --git a/Controller/Adminhtml/Fundtransfer/Index.php b/Controller/Adminhtml/Fundtransfer/Index.php new file mode 100644 index 0000000..ffa9a73 --- /dev/null +++ b/Controller/Adminhtml/Fundtransfer/Index.php @@ -0,0 +1,43 @@ +_redirect('adminhtml/system_config/edit/section/wirecard_checkoutseamless'); + } + +} diff --git a/Controller/Adminhtml/Fundtransfer/Submit.php b/Controller/Adminhtml/Fundtransfer/Submit.php new file mode 100644 index 0000000..ca84871 --- /dev/null +++ b/Controller/Adminhtml/Fundtransfer/Submit.php @@ -0,0 +1,118 @@ +_fundTransferModel = $fundTransferModel; + $this->_dataHelper = $dataHelper; + $this->_resultPageFactory = $resultPageFactory; + $this->_logger = $logger; + } + + public function execute() + { + $redirectUrl = $this->getUrl('wirecardcheckoutseamless/fundtransfer/transfer'); + + if (!( $data = $this->getRequest()->getPostValue() )) { + $this->_redirect($redirectUrl); + + return; + } + + $postObject = new \Magento\Framework\DataObject(); + $postObject->setData($data); + + + $this->_session->setWirecardCheckoutSeamlessFundTrandsferFormData($postObject); + + try { + $return = $this->_fundTransferModel->sendrequest($postObject); + if ($return->hasFailed() && $return->getNumberOfErrors() > 0) { + foreach ($return->getErrors() as $error) { + $this->messageManager->addErrorMessage($error->getMessage()); + } + } else { + $this->_logger->debug(__METHOD__ . ':' . print_r($postObject->getData(), true)); + $this->_session->unsWirecardCheckoutSeamlessFundTrandsferFormData(); + $this->messageManager->addNoticeMessage($this->_dataHelper->__('Fund transfer submitted successfully!')); + $this->messageManager->addNoticeMessage($this->_dataHelper->__('Credit number' . ':' . $return->getCreditNumber())); + } + + } catch (\Exception $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + } + + $this->_redirect($redirectUrl); + } + + /** + * Check currently called action by permissions for current user + * + * @return bool + */ + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Magento_Payment::payment'); + } +} + diff --git a/Controller/Adminhtml/Fundtransfer/Transfer.php b/Controller/Adminhtml/Fundtransfer/Transfer.php new file mode 100644 index 0000000..0d64036 --- /dev/null +++ b/Controller/Adminhtml/Fundtransfer/Transfer.php @@ -0,0 +1,78 @@ +_dataHelper = $dataHelper; + $this->_resultPageFactory = $resultPageFactory; + } + + public function execute() + { + /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ + $resultPage = $this->_resultPageFactory->create(); + $resultPage->setActiveMenu('Magento_Backend::system_store'); + $resultPage->getConfig()->getTitle()->prepend($this->_dataHelper->__('Wirecard Checkout Seamless Fund Transfer')); + + return $resultPage; + } + + /** + * Check currently called action by permissions for current user + * + * @return bool + */ + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Magento_Payment::payment'); + } +} diff --git a/Controller/Adminhtml/Support/Contact.php b/Controller/Adminhtml/Support/Contact.php new file mode 100644 index 0000000..bdeb1c1 --- /dev/null +++ b/Controller/Adminhtml/Support/Contact.php @@ -0,0 +1,78 @@ +_dataHelper = $dataHelper; + $this->_resultPageFactory = $resultPageFactory; + } + + public function execute() + { + /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ + $resultPage = $this->_resultPageFactory->create(); + $resultPage->setActiveMenu('Magento_Backend::system_store'); + $resultPage->getConfig()->getTitle()->prepend($this->_dataHelper->__('Wirecard Checkout Seamless Support Request')); + + return $resultPage; + } + + /** + * Check currently called action by permissions for current user + * + * @return bool + */ + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Magento_Payment::payment'); + } +} diff --git a/Controller/Adminhtml/Support/Index.php b/Controller/Adminhtml/Support/Index.php new file mode 100644 index 0000000..4874451 --- /dev/null +++ b/Controller/Adminhtml/Support/Index.php @@ -0,0 +1,43 @@ +_redirect('adminhtml/system_config/edit/section/wirecard_checkoutseamless'); + } + +} diff --git a/Controller/Adminhtml/Support/Sendrequest.php b/Controller/Adminhtml/Support/Sendrequest.php new file mode 100644 index 0000000..e3b9049 --- /dev/null +++ b/Controller/Adminhtml/Support/Sendrequest.php @@ -0,0 +1,96 @@ +_supportModel = $supportModel; + $this->_dataHelper = $dataHelper; + $this->_resultPageFactory = $resultPageFactory; + } + + public function execute() + { + $redirectUrl = $this->getUrl('wirecardcheckoutseamless/support/contact'); + + if (!($data = $this->getRequest()->getPostValue())) { + $this->_redirect($redirectUrl); + return; + } + + $postObject = new \Magento\Framework\DataObject(); + $postObject->setData($data); + + try { + $this->_supportModel->sendrequest($postObject); + $this->messageManager->addNoticeMessage($this->_dataHelper->__('Support request sent successfully!')); + } catch (\Exception $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + } + + $this->_redirect($redirectUrl); + } + + /** + * Check currently called action by permissions for current user + * + * @return bool + */ + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Magento_Payment::payment'); + } +} diff --git a/Controller/Adminhtml/Test/Config.php b/Controller/Adminhtml/Test/Config.php new file mode 100644 index 0000000..273e6bd --- /dev/null +++ b/Controller/Adminhtml/Test/Config.php @@ -0,0 +1,89 @@ +_testModel = $testModel; + $this->_dataHelper = $dataHelper; + } + + public function execute() + { + + $redirectUrl = $this->getUrl('adminhtml/system_config/edit/section/wirecard_checkoutseamless'); + $urls = [ + 'confirm' => $this->_url->getUrl('wirecardcheckoutseamless/checkout/confirm', + ['_secure' => true, '_nosid' => true]), + 'return' => $this->_url->getUrl('wirecardcheckoutseamless/checkout/back', + ['_secure' => true, '_nosid' => true]) + ]; + + try { + $this->_testModel->config($urls); + $this->messageManager->addNoticeMessage($this->_dataHelper->__('Configuration test ok')); + } catch (\Exception $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + } + + $this->_redirect($redirectUrl); + } + + /** + * Check currently called action by permissions for current user + * + * @return bool + */ + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Magento_Payment::payment'); + } +} diff --git a/Controller/Adminhtml/Transactions/RefundReversal.php b/Controller/Adminhtml/Transactions/RefundReversal.php new file mode 100644 index 0000000..0fb3c7b --- /dev/null +++ b/Controller/Adminhtml/Transactions/RefundReversal.php @@ -0,0 +1,74 @@ +_initTransaction(); + /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ + $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); + if (!$txn) { + return $resultRedirect->setPath('sales/*/'); + } + + /** @var \Magento\Sales\Model\Order\Payment\Interceptor $payment */ + $payment = $this->orderPaymentRepository->get($txn->getPaymentId()); + + /** @var \Wirecard\CheckoutSeamless\Model\AbstractPayment $methodInstance */ + $methodInstance = $payment->getMethodInstance(); + if ($methodInstance instanceof \Wirecard\CheckoutSeamless\Model\AbstractPayment) { + try { + $methodInstance->refundReversal($payment, $txn); + $this->messageManager->addSuccess(__('The refund has been reverted.')); + } catch (\Magento\Framework\Exception\LocalizedException $e) { + $this->messageManager->addError($e->getMessage()); + } catch (\Exception $e) { + $this->messageManager->addError(__('We can\'t revert the refund.')); + $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e); + } + } + + return $resultRedirect->setPath('sales/transactions/view', ['_current' => true]); + } + +} diff --git a/Controller/Checkout/Back.php b/Controller/Checkout/Back.php new file mode 100644 index 0000000..bc3c156 --- /dev/null +++ b/Controller/Checkout/Back.php @@ -0,0 +1,260 @@ +_resultPageFactory = $resultPageFactory; + $this->_dataHelper = $helper; + $this->_cart = $cart; + $this->_url = $context->getUrl(); + $this->_orderSender = $orderSender; + $this->_logger = $logger; + $this->_checkoutSession = $checkoutSession; + $this->_quoteManagement = $quoteManagement; + $this->_orderManagement = $orderManagement; + $this->_order = $order; + } + + public function execute() + { + $redirectTo = 'checkout/cart'; + $defaultErrorMessage = $this->_dataHelper->__('An error occurred during the payment process'); + + try { + + if (!$this->_request->isGet()) { + throw new \Exception('Not a GET request'); + } + + $orderId = (string) $this->_request->getQuery('mage_orderId'); + + if (!strlen($this->_request->getQuery('mage_orderId'))) { + throw new \Exception('Magento OrderId is missing'); + } + + $this->_order->loadByIncrementId($orderId); + $orderExists = (bool) $this->_order->getId(); + + $paymentInfo = new \Magento\Framework\DataObject(); + /* if we have no order fetch info from cart */ + if ($orderExists) { + $paymentInfo->setData($this->_order->getPayment()->getAdditionalInformation()); + } else { + $paymentInfo->setData($this->_cart->getQuote()->getPayment()->getAdditionalInformation()); + } + + $this->_logger->debug(__METHOD__ . ':' . print_r($paymentInfo->getData(), true)); + + $orderCreation = $paymentInfo['mage_orderCreation']; + $quoteId = $paymentInfo['mage_quoteId']; + + if (!strlen($paymentInfo['mage_orderCreation'])) { + throw new \Exception('Magento orderCreation is missing'); + } + + if (!strlen($paymentInfo['mage_quoteId'])) { + throw new \Exception('Magento QuoteId is missing'); + } + + if ($orderCreation == 'before' && !$orderExists) { + throw new \Exception('Order not found'); + } + + if ($paymentInfo['paymentState'] === null) + { + $this->_logger->debug(__METHOD__ . ':order not processed via confirm server2server request, check your packetfilter!'); + $this->messageManager->addErrorMessage($this->_dataHelper->__('An internal error occurred during the payment process!')); + } else { + + switch ($paymentInfo['paymentState']) { + case \WirecardCEE_QMore_ReturnFactory::STATE_SUCCESS: + case \WirecardCEE_QMore_ReturnFactory::STATE_PENDING: + if ($paymentInfo['paymentState'] == \WirecardCEE_QMore_ReturnFactory::STATE_PENDING) { + $this->messageManager->addNoticeMessage($this->_dataHelper->__('Your order will be processed as soon as we receive the payment confirmation from your bank.')); + } + + /* needed for success page otherwise magento redirects to cart */ + $this->_checkoutSession->setLastQuoteId($this->_order->getQuoteId()); + $this->_checkoutSession->setLastSuccessQuoteId($this->_order->getQuoteId()); + $this->_checkoutSession->setLastOrderId($this->_order->getId()); + $this->_checkoutSession->setLastRealOrderId($this->_order->getIncrementId()); + $this->_checkoutSession->setLastOrderStatus($this->_order->getStatus()); + + $redirectTo = 'checkout/onepage/success'; + break; + + case \WirecardCEE_QMore_ReturnFactory::STATE_CANCEL: + $this->messageManager->addNoticeMessage($this->_dataHelper->__('You have canceled the payment process!')); + if ($orderCreation == 'before') { + $quote = $this->_orderManagement->reOrder($quoteId); + $this->_checkoutSession->replaceQuote($quote)->unsLastRealOrderId(); + } + break; + + case \WirecardCEE_QMore_ReturnFactory::STATE_FAILURE: + $returnedData = $paymentInfo->getData(); + $consumerMessage = ""; + for ($i = 0; $i < $returnedData['errors']; $i++) { + if ($returnedData['errors'] != 1) { + $consumerMessage .= $i + 1; + } + $consumerMessage .= $returnedData['error_' . ($i + 1) . '_consumerMessage']; + if ($returnedData['errors'] != 1) { + $consumerMessage .= "
"; + } + } + + if (!strlen($consumerMessage)) { + $consumerMessage = $this->_dataHelper->__('An error occurred during the payment process'); + } + + $this->messageManager->addErrorMessage($consumerMessage); + if ($orderCreation == 'before') { + $quote = $this->_orderManagement->reOrder($quoteId); + $this->_checkoutSession->replaceQuote($quote)->unsLastRealOrderId(); + } + + break; + + default: + throw new \Exception('Unhandled Wirecard Checkout Seamless payment state:' . $paymentInfo['consumerMessage']); + } + } + + if ($this->_request->getQuery('iframeUsed')) { + $redirectUrl = $this->_url->getUrl($redirectTo); + $page = $this->_resultPageFactory->create(); + $page->getLayout()->getBlock('checkout.back')->addData(['redirectUrl' => $redirectUrl]); + + return $page; + + } else { + + $this->_redirect($redirectTo); + } + } catch (\Exception $e) { + if (!$this->messageManager->getMessages()->getCount()) { + $this->messageManager->addErrorMessage($defaultErrorMessage); + } + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + $this->_redirect($redirectTo); + } + } + + +} \ No newline at end of file diff --git a/Controller/Checkout/Confirm.php b/Controller/Checkout/Confirm.php new file mode 100644 index 0000000..35b4ee5 --- /dev/null +++ b/Controller/Checkout/Confirm.php @@ -0,0 +1,126 @@ +_dataHelper = $dataHelper; + $this->_url = $context->getUrl(); + $this->_logger = $logger; + $this->_quoteManagement = $quoteManagement; + $this->_orderManagement = $orderManagement; + } + + public function execute() + { + $this->_logger->debug(__METHOD__ . ':' . print_r($this->_request->getPost()->toArray(), true)); + + try { + $this->_logger->debug(__METHOD__ . $this->_request->getContent()); + $return = \WirecardCEE_QMore_ReturnFactory::getInstance($this->_request->getPost()->toArray(), + $this->_dataHelper->getConfigData('basicdata/secret')); + + if (!$return->validate()) { + throw new \Exception('Validation error: invalid response'); + } + + if (!strlen($return->mage_orderId)) { + throw new \Exception('Magento OrderId is missing'); + } + + if (!strlen($return->mage_quoteId)) { + throw new \Exception('Magento QuoteId is missing'); + } + + $this->_orderManagement->processOrder($return); + + die( \WirecardCEE_QMore_ReturnFactory::generateConfirmResponseString() ); + } catch (\Exception $e) { + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + $this->_logger->debug(__METHOD__ . ':' . $e->getTraceAsString()); + + die( \WirecardCEE_QMore_ReturnFactory::generateConfirmResponseString($e->getMessage()) ); + } + } +} \ No newline at end of file diff --git a/Controller/Checkout/Failed.php b/Controller/Checkout/Failed.php new file mode 100644 index 0000000..f4f9962 --- /dev/null +++ b/Controller/Checkout/Failed.php @@ -0,0 +1,81 @@ +_resultPageFactory = $resultPageFactory; + $this->_url = $context->getUrl(); + } + + public function execute() + { + $redirectTo = 'checkout/cart'; + if ($this->_request->getParam('iframeused')) { + $redirectUrl = $this->_url->getUrl($redirectTo); + + $page = $this->_resultPageFactory->create(); + $page->getLayout()->getBlock('checkout.failed')->addData(['redirectUrl' => $redirectUrl]); + return $page; + + } else { + + $this->_redirect($redirectTo); + } + } + + +} \ No newline at end of file diff --git a/Controller/Checkout/Start.php b/Controller/Checkout/Start.php new file mode 100644 index 0000000..20afb77 --- /dev/null +++ b/Controller/Checkout/Start.php @@ -0,0 +1,181 @@ +_dataHelper = $dataHelper; + $this->_cart = $cart; + $this->_url = $context->getUrl(); + $this->_logger = $logger; + $this->_checkoutData = $checkoutData; + $this->_orderManagement = $orderManagement; + } + + public function execute() + { + $urls = [ + 'confirm' => $this->_url->getUrl('wirecardcheckoutseamless/checkout/confirm', + ['_secure' => true, '_nosid' => true]), + 'return' => $this->_url->getUrl('wirecardcheckoutseamless/checkout/back', + ['_secure' => true, '_nosid' => true]) + ]; + + + $payment = null; + try { + if ($this->getCheckoutMethod() == \Magento\Checkout\Model\Type\Onepage::METHOD_GUEST) { + $this->prepareGuestQuote(); + } + + /** @var \Wirecard\CheckoutSeamless\Model\AbstractPayment $payment */ + $payment = $this->_cart->getQuote()->getPayment()->getMethodInstance(); + + $init = $payment->initPaymentByCart($this->_cart, $urls, + new \Magento\Framework\DataObject($payment->getInfoInstance()->getAdditionalInformation())); + + if ($this->_dataHelper->getConfigData('options/order_creation') == 'before') { + $this->_orderManagement->submitOrder($this->_cart->getQuote()); + } + + $this->getResponse()->setRedirect($init->getRedirectUrl()); + + } catch (\Exception $e) { + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + $this->messageManager->addErrorMessage($this->_dataHelper->__('An error occurred during the payment process')); + if ($payment === null) { + $this->_redirect('/'); + } else { + $this->getResponse()->setRedirect($this->_url->getUrl('wirecardcheckoutseamless/checkout/failed', + [ + '_secure' => true, + '_query' => ['iframeused' => (int) ( $payment->getDisplayMode() != 'redirect' )] + ])); + } + } + + } + + + /** + * Prepare quote for guest checkout order submit + * + * @return $this + */ + protected function prepareGuestQuote() + { + $quote = $this->_cart->getQuote(); + $quote->setCustomerId(null) + ->setCustomerEmail($quote->getBillingAddress()->getEmail()) + ->setCustomerFirstname($quote->getBillingAddress()->getFirstname()) + ->setCustomerLastname($quote->getBillingAddress()->getLastname()) + ->setCustomerIsGuest(true) + ->setCustomerGroupId(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID); + + return $this; + } + + /** + * Get checkout method + * + * @return string + */ + public function getCheckoutMethod() + { + if ($this->_cart->getCustomerSession()->isLoggedIn()) { + return \Magento\Checkout\Model\Type\Onepage::METHOD_CUSTOMER; + } + if (!$this->_cart->getQuote()->getCheckoutMethod()) { + if ($this->_checkoutData->isAllowedGuestCheckout($this->_cart->getQuote())) { + $this->_cart->getQuote()->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_GUEST); + } else { + $this->_cart->getQuote()->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER); + } + } + + return $this->_cart->getQuote()->getCheckoutMethod(); + } +} \ No newline at end of file diff --git a/Controller/Storage/Read.php b/Controller/Storage/Read.php new file mode 100644 index 0000000..ede9b42 --- /dev/null +++ b/Controller/Storage/Read.php @@ -0,0 +1,125 @@ +_url = $context->getUrl(); + $this->_dataHelper = $dataHelper; + $this->_logger = $logger; + $this->_cart = $cart; + $this->_dataStorageHelper = $dataStorageHelper; + $this->_resultJsonFactory = $resultJsonFactory; + } + + public function execute() + { + $result = $this->_resultJsonFactory->create(); + + $data = new \Magento\Framework\DataObject(); + $data->setData(json_decode($this->_request->getContent(), true)); + + $this->_logger->debug(__METHOD__ . ':' . print_r($data->getData(), true)); + + $paymentType = $data['paymentType']; + if ($paymentType === null) { + return $result->setData(false); + } + + $ret = $this->_dataStorageHelper->read(); + if ($ret === false) { + return $result->setData(false); + } + + $this->_logger->debug(__METHOD__ . ':' . print_r($ret->getPaymentInformation(), true)); + + /* return data in the same format as it were posted with a js store operation */ + return $result->setData(['storageId' => $ret->getStorageId(), + 'paymentInformation' => $ret->getPaymentInformation($paymentType) + ]); + } + +} \ No newline at end of file diff --git a/Controller/Storage/ReturnFallback.php b/Controller/Storage/ReturnFallback.php new file mode 100644 index 0000000..9cdaed6 --- /dev/null +++ b/Controller/Storage/ReturnFallback.php @@ -0,0 +1,72 @@ +_resultPageFactory = $resultPageFactory; + $this->_url = $context->getUrl(); + } + + public function execute() + { + $page = $this->_resultPageFactory->create(); + $page->getLayout()->getBlock('datastorage.return'); + return $page; + } + + +} \ No newline at end of file diff --git a/Helper/Data.php b/Helper/Data.php new file mode 100644 index 0000000..54cac30 --- /dev/null +++ b/Helper/Data.php @@ -0,0 +1,462 @@ + array( + 'basicdata/customer_id' => 'D200001', + 'basicdata/shop_id' => 'seamless', + 'basicdata/secret' => 'B8AKTPWBRMNBV455FG6M2DANE99WU2', + 'basicdata/backendpw' => 'jcv45z' + ), + 'test_no3d' => array( + 'basicdata/customer_id' => 'D200411', + 'basicdata/shop_id' => 'seamless', + 'basicdata/secret' => 'CHCSH7UGHVVX2P7EHDHSY4T2S4CGYK4QBE4M5YUUG2ND5BEZWNRZW5EJYVJQ', + 'basicdata/backendpw' => '2g4f9q2m' + ), + 'test_3d' => array( + 'basicdata/customer_id' => 'D200411', + 'basicdata/shop_id' => 'seamless3D', + 'basicdata/secret' => 'DP4TMTPQQWFJW34647RM798E9A5X7E8ATP462Z4VGZK53YEJ3JWXS98B9P4F', + 'basicdata/backendpw' => '2g4f9q2m' + ) + ); + + /** + * @param \Magento\Framework\App\Helper\Context $context + * @param \Magento\Framework\Locale\ResolverInterface $localeResolver + * @param \Magento\Framework\App\ProductMetadataInterface $productMetadata + */ + public function __construct( + \Magento\Framework\App\Helper\Context $context, + \Magento\Framework\Locale\ResolverInterface $localeResolver, + \Magento\Framework\App\ProductMetadataInterface $productMetadata + ) { + $this->_localeResolver = $localeResolver; + $this->_productMetadata = $productMetadata; + $this->_request = $context->getRequest(); + parent::__construct($context); + } + + + /** + * return wirecard related config data + * + * @param null $field + * + * @return mixed + */ + public function getConfigData($field = null) + { + $type = $this->scopeConfig->getValue('wirecard_checkoutseamless/basicdata/configuration', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + + if (isset( $this->_presets[$type] ) && isset( $this->_presets[$type][$field] )) { + return $this->_presets[$type][$field]; + } + + $path = 'wirecard_checkoutseamless'; + if ($field !== null) { + $path .= '/' . $field; + } + + return $this->scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + } + + /** + * return store related config data + * + * @param $field + * + * @return mixed + */ + public function getStoreConfigData($field) + { + return $this->scopeConfig->getValue($field, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + } + + /** + * return config data as needed by the client library + * + * @return array + */ + public function getConfigArray() + { + $cfg = Array('LANGUAGE' => $this->getLanguage()); + $cfg['CUSTOMER_ID'] = $this->getConfigData('basicdata/customer_id'); + $cfg['SHOP_ID'] = $this->getConfigData('basicdata/shop_id'); + $cfg['SECRET'] = $this->getConfigData('basicdata/secret'); + + return $cfg; + } + + /** + * return config data for backend client + * + * @return array + */ + protected function getBackendConfigArray() + { + $cfg = $this->getConfigArray(); + $cfg['PASSWORD'] = $this->getConfigData('basicdata/backendpw'); + + return $cfg; + } + + /** + * returns config preformated as string, used in support email + * without security sensitive data + * + * @return string + */ + public function getConfigString() + { + $ret = ''; + $exclude = array('secret', 'backendpw'); + foreach ($this->getConfigData() as $group => $fields) { + foreach ($fields as $field => $value) { + if (in_array($field, $exclude)) { + continue; + } + if (strlen($ret)) { + $ret .= "\n"; + } + $ret .= sprintf("%s: %s", $field, $value); + } + } + + return $ret; + } + + /** + * check if toolkit is available for backend operations + * + * @return bool + */ + public function isBackendAvailable() + { + return strlen($this->getConfigData('basicdata/backendpw')) > 0; + } + + /** + * return client for sending backend operations + * + * @return \WirecardCEE_QMore_BackendClient + */ + public function getBackendClient() + { + return new \WirecardCEE_QMore_BackendClient($this->getBackendConfigArray()); + } + + /** + * return plugin information + * + * @return string + */ + public function getPluginVersion() + { + $versionInfo = $this->getVersionInfo(); + + return \WirecardCEE_QMore_FrontendClient::generatePluginVersion($versionInfo['product'], + $versionInfo['productVersion'], $versionInfo['pluginName'], $versionInfo['pluginVersion']); + } + + /** + * version information + * + * @return array + */ + public function getVersionInfo() + { + return [ + 'product' => 'Magento2', + 'productVersion' => $this->_productMetadata->getVersion(), + 'pluginName' => $this->_pluginName, + 'pluginVersion' => $this->_pluginVersion + ]; + } + + /** + * get current language + * + * @return string + */ + public function getLanguage() + { + $locale = explode('_', $this->_localeResolver->getLocale()); + if (is_array($locale) && !empty( $locale )) { + $locale = $locale[0]; + } else { + $locale = 'en'; + } + + return $locale; + } + + /** + * @return bool|\Zend\Http\Header\HeaderInterface + */ + public function getUserAgent() + { + return $this->_request->getHeader('USER_AGENT'); + } + + /** + * @return string + */ + public function getClientIp() + { + return $this->_request->getClientIp(); + } + + /** + * translate strings + * + * @param $txt + * + * @return \Magento\Framework\Phrase + */ + public function __($txt) + { + return __($txt); + } + + /** + * return link to payolution privacy consent + * + * @return \Magento\Framework\Phrase|string + */ + public function getPayolutionLink($mId) + { + $mId = urlencode(base64_encode($mId)); + + if (strlen($mId)) { + return sprintf('%s', + $mId, $this->__('consent')); + } else { + return $this->__('consent'); + } + } + + /** + * calculate quote checksum, it's verified after the return from the payment page + * detect fraud attempts (cart modifications during checkout) + * + * @param \Magento\Quote\Model\Quote $quote + * + * @return string + */ + public function calculateQuoteChecksum($quote) + { + $data = round($quote->getGrandTotal(), 2) . + $quote->getBaseCurrencyCode() . + $quote->getCustomerEmail(); + + foreach ($quote->getAllVisibleItems() as $item) { + /** @var \Magento\Quote\Model\Quote\Item $item */ + $data .= $item->getSku(); + $data .= round($item->getRowTotal(), 2); + $data .= round($item->getTaxAmount(), 2); + } + + $address = $quote->getBillingAddress(); + $data .= $address->getName() . + $address->getCompany() . + $address->getCity() . + $address->getPostcode() . + $address->getCountryId() . + $address->getCountry() . + $address->getRegion() . + $address->getStreetLine(1) . + $address->getStreetLine(2); + + $address = $quote->getShippingAddress(); + $data .= $address->getName() . + $address->getCompany() . + $address->getCity() . + $address->getPostcode() . + $address->getCountryId() . + $address->getCountry() . + $address->getRegion() . + $address->getStreetLine(1) . + $address->getStreetLine(2); + + return hash_hmac('sha512', $data, $this->getConfigData('basicdata/secret')); + } + + /** + * @param \Magento\Quote\Model\Quote $quote + * @param string $his + * + * @return bool + */ + public function compareQuoteChecksum($quote, $his) + { + $mine = $this->calculateQuoteChecksum($quote); + if ($mine != $his) { + $this->_logger->debug(__METHOD__ . ':quote checksum mismatch'); + + return false; + } + + return true; + } + + + /** + * return financial institutions from wirecard (backend operation) + * + * @param string $paymentType + * + * @return array + */ + public function getFinancialInstitutions($paymentType) + { + if (!$this->isBackendAvailable()) + return []; + + $backendClient = $this->getBackendClient(); + + try { + $response = $backendClient->getFinancialInstitutions($paymentType); + } catch (\Exception $e) { + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + return []; + } + + if (!$response->hasFailed()) { + $ret = $response->getFinancialInstitutions(); + $c = null; + if (class_exists('Collator')) { + $c = new \Collator('root'); + } + + uasort($ret, function ($a, $b) use ($c) { + if ($c === null) { + return strcmp($a['id'], $b['id']); + } else { + return $c->compare($a['name'], $b['name']); + } + }); + + return $ret; + } else { + $this->_logger->debug(__METHOD__ . ':' . print_r($response->getErrors(), true)); + return []; + } + } + + public function initDataStorage() + { + $dataStorageInit = new \WirecardCEE_QMore_DataStorageClient($this->getConfigArray()); + + $dataStorageInit->setReturnUrl(Mage::getUrl('wirecard_checkoutseamless/processing/storereturn', + array('_secure' => true))); + $dataStorageInit->setOrderIdent(Mage::getSingleton('checkout/session')->getQuote()->getId()); + + $response = null; + if ($this->getConfigData('ccard/pci3_dss_saq_a_enable')) { + $dataStorageInit->setJavascriptScriptVersion('pci3'); + + if (strlen(trim($this->getConfigData('ccard/iframe_css_url')))) { + $dataStorageInit->setIframeCssUrl(trim($this->getConfigData('ccard/iframe_css_url'))); + } + + $dataStorageInit->setCreditCardCardholderNameField($this->getConfigData('ccard/showcardholder')); + $dataStorageInit->setCreditCardShowCvcField($this->getConfigData('ccard/showcvc')); + $dataStorageInit->setCreditCardShowIssueDateField($this->getConfigData('ccard/showissuedate')); + $dataStorageInit->setCreditCardShowIssueNumberField($this->getConfigData('ccard/showissuenumber')); + } + + $this->_logger->debug(__METHOD__ . ':' . print_r($dataStorageInit->getRequestData(), true)); + + try { + $response = $dataStorageInit->initiate(); + + if (!$response->hasFailed()) { + + Mage::getSingleton('checkout/session')->setWirecardCheckoutSeamlessStorageId($response->getStorageId()); + $this->log(__METHOD__ . ':storageid:' . $response->getStorageId(), Zend_Log::DEBUG); + + return $response; + + } else { + + $dsErrors = $response->getErrors(); + + foreach ($dsErrors as $error) { + $this->log(__METHOD__ . ':' . $error->getMessage()); + } + + return false; + } + } catch (\Exception $e) { + + //communication with dataStorage failed. we choose a none dataStorage fallback + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + + return false; + } + } +} diff --git a/Helper/DataStorage.php b/Helper/DataStorage.php new file mode 100644 index 0000000..224a63f --- /dev/null +++ b/Helper/DataStorage.php @@ -0,0 +1,180 @@ +_url = $context->getUrlBuilder(); + $this->_dataHelper = $dataHelper; + $this->_cart = $cart; + $this->_assetRepo = $assetRepo; + } + + public function init() + { + $dataStorageInit = new \WirecardCEE_QMore_DataStorageClient($this->_dataHelper->getConfigArray()); + + $returnUrl = $this->_url->getUrl('wirecardcheckoutseamless/storage/returnfallback', ['_secure' => true]); + + $dataStorageInit->setReturnUrl($returnUrl); + $dataStorageInit->setOrderIdent($this->_cart->getQuote()->getId()); + + $response = null; + if ($this->_dataHelper->getConfigData('ccard/pci3_dss_saq_a_enable')) { + $dataStorageInit->setJavascriptScriptVersion('pci3'); + + if (strlen(trim($this->_dataHelper->getConfigData('ccard/iframe_css_url')))) { + $url = $this->_assetRepo->getUrlWithParams('Wirecard_CheckoutSeamless::css/' . trim($this->_dataHelper->getConfigData('ccard/iframe_css_url')), ['_secure' => true]); + $dataStorageInit->setIframeCssUrl($url); + } + + $dataStorageInit->setCreditCardPanPlaceholder($this->_dataHelper->__($this->_dataHelper->getConfigData('ccard/pan_placeholder'))); + $dataStorageInit->setCreditCardShowExpirationDatePlaceholder($this->_dataHelper->getConfigData('ccard/displayexpirationdate_placeholder')); + $dataStorageInit->setCreditCardCardholderNamePlaceholder($this->_dataHelper->__($this->_dataHelper->getConfigData('ccard/cardholder_placeholder'))); + $dataStorageInit->setCreditCardCvcPlaceholder($this->_dataHelper->__($this->_dataHelper->getConfigData('ccard/cvc_placeholder'))); + $dataStorageInit->setCreditCardShowIssueDatePlaceholder($this->_dataHelper->getConfigData('ccard/displayissuedate_placeholder')); + $dataStorageInit->setCreditCardCardIssueNumberPlaceholder($this->_dataHelper->__($this->_dataHelper->getConfigData('ccard/issuenumber_placeholder'))); + + $dataStorageInit->setCreditCardShowCardholderNameField($this->_dataHelper->getConfigData('ccard/displaycardholder')); + $dataStorageInit->setCreditCardShowCvcField($this->_dataHelper->getConfigData('ccard/displaycvc')); + $dataStorageInit->setCreditCardShowIssueDateField($this->_dataHelper->getConfigData('ccard/displayissuedate')); + $dataStorageInit->setCreditCardShowIssueNumberField($this->_dataHelper->getConfigData('ccard/displayissuenumber')); + } + + $this->_logger->debug(__METHOD__ . ':' . print_r($dataStorageInit->getRequestData(), true)); + + try { + $response = $dataStorageInit->initiate(); + + if (!$response->hasFailed()) { + + $this->_cart->getCheckoutSession()->setWirecardCheckoutSeamlessStorageId($response->getStorageId()); + $this->_logger->debug(__METHOD__ . ':storageid:' . $response->getStorageId()); + + return $response->getJavascriptUrl(); + + } else { + + $dsErrors = $response->getErrors(); + + $this->_logger->debug(__METHOD__ . ':storage init failed:' . array_map(function ($e) { + return $e->getMessage(); + }, $dsErrors)); + + return false; + } + } catch (\Exception $e) { + + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + + return false; + } + } + + /** + * @return bool|\WirecardCEE_QMore_DataStorage_Response_Read + */ + public function read() + { + $dataStorageRead = new \WirecardCEE_QMore_DataStorageClient($this->_dataHelper->getConfigArray()); + $dataStorageRead->setStorageId($this->getStorageId()); + $dataStorageRead->read(); + + try { + + $response = $dataStorageRead->read(); + + if ($response->getStatus() != \WirecardCEE_QMore_DataStorage_Response_Read::STATE_FAILURE) { + + return $response; + + } else { + + $dsErrors = $response->getErrors(); + + foreach ($dsErrors as $error) { + $this->_logger->debug(__METHOD__ . ':' . $error->getMessage()); + } + + return false; + } + } catch (\Exception $e) { + + //communication with dataStorage failed. we choose a none dataStorage fallback + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + + return false; + } + } + + public function getStorageId() + { + return $this->_cart->getCheckoutSession()->getWirecardCheckoutSeamlessStorageId(); + } +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..23cb790 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Model/AbstractPayment.php b/Model/AbstractPayment.php new file mode 100644 index 0000000..0129a18 --- /dev/null +++ b/Model/AbstractPayment.php @@ -0,0 +1,1056 @@ +_orderSender = $orderSender; + $this->_transactionBuilder = $transactionBuilder; + $this->_dataHelper = $helper; + $this->_minAmount = $this->getConfigData('min_order_total'); + $this->_maxAmount = $this->getConfigData('max_order_total'); + $this->_transactionRepository = $transactionRepository; + $this->_dataStorageHelper = $storageHelper; + + if (!$this->_dataHelper->isBackendAvailable()) { + $this->_canCapture = false; + $this->_canCapturePartial = false; + $this->_canVoid = false; + $this->_canRefund = false; + $this->_canRefundInvoicePartial = false; + $this->_canCancelInvoice = false; + } + } + + /** + * Init payment, server2server + * + * @param CheckoutCart $cart + * @param $urls + * @param \Magento\Framework\DataObject $data + * + * @return \WirecardCEE_QMore_Response_Initiation + * @throws \Exception + */ + public function initPaymentByCart(CheckoutCart $cart, $urls, \Magento\Framework\DataObject $data) + { + $quote = $cart->getQuote(); + + $init = new \WirecardCEE_QMore_FrontendClient($this->_dataHelper->getConfigArray()); + $init->setPluginVersion($this->_dataHelper->getPluginVersion()); + $init->setConfirmUrl($urls['confirm']); + + $quote->reserveOrderId(); + $quote->save(); + + $orderId = $quote->getReservedOrderId(); + $init->setOrderReference(sprintf('%010d', $orderId)); + + $returnUrl = $urls['return']; + $returnUrl .= strpos($urls['return'], '?') ? '&' : '?'; + $returnUrl .= sprintf('mage_orderId=%s&iframeUsed=%d', urlencode($orderId), + (int) ( $this->getDisplayMode() != 'redirect' )); + + $precision = 2; + $init->setAmount(round($cart->getQuote()->getBaseGrandTotal(), $precision)) + ->setCurrency($quote->getCurrency()->getBaseCurrencyCode()) + ->setPaymentType($this->_paymentMethod) + ->setOrderDescription($this->getUserDescription($quote)) + ->setSuccessUrl($returnUrl) + ->setPendingUrl($returnUrl) + ->setCancelUrl($returnUrl) + ->setFailureUrl($returnUrl) + ->setServiceUrl($this->_dataHelper->getConfigData('options/service_url')) + ->setConsumerData($this->_getConsumerData($quote)) + ->setStorageid($this->_dataStorageHelper->getStorageId()) + ->setOrderIdent($quote->getId()); + + $init->mage_orderId = $orderId; + $init->mage_quoteId = $quote->getId(); + $init->mage_orderCreation = $this->_dataHelper->getConfigData('options/order_creation'); + + $init->generateCustomerStatement($this->_dataHelper->getConfigData('options/shopname'), sprintf('%010d', $orderId)); + + $_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); + $storeManager = $_objectManager->get('Magento\Store\Model\StoreManagerInterface'); + $baseUrl = $storeManager->getStore()->getBaseUrl(); + + + + if ($this->_dataHelper->getConfigData('options/sendbasketinformation') || $this->forceSendingBasket()) { + $basket = new \WirecardCEE_Stdlib_Basket(); + + foreach ($quote->getAllVisibleItems() as $item) { + /** @var \Magento\Quote\Model\Quote\Item $item */ + + $bitem = new \WirecardCEE_Stdlib_Basket_Item(); + $bitem->setArticleNumber($item->getSku()); + $bitem->setDescription($item->getProduct()->getName()); + $bitem->setImageUrl($baseUrl . "pub/media/catalog/product" . $item->getProduct()->getImage()); + $bitem->setName($item->getProduct()->getName()); + $bitem->setUnitGrossAmount(number_format($item->getPrice(), $precision, '.', '')); + $bitem->setUnitNetAmount( + number_format( + number_format($item->getPrice(), $precision, '.', '') - number_format( + $item->getTaxAmount(), $precision, '.', '' + ), $precision, '.', '' + ) + ); + $bitem->setUnitTaxAmount(number_format($item->getTaxAmount(), $precision, '.', '')); + $bitem->setUnitTaxRate(number_format($item->getTaxPercent(), $precision, '.', '')); + $basket->addItem($bitem, (int)$item->getQty()); + } + + // add shipping as basket item + if (number_format($quote->getShippingAddress()->getShippingAmount(), $precision, '.', '') != 0) { + $bitem = new \WirecardCEE_Stdlib_Basket_Item(); + $bitem->setArticleNumber('shipping'); + $bitem->setName('shipping'); + $bitem->setDescription($quote->getShippingAddress()->getShippingDescription()); + $bitem->setUnitGrossAmount( + number_format($quote->getShippingAddress()->getShippingAmount(), $precision, '.', '') + ); + $bitem->setUnitNetAmount( + number_format( + number_format( + $quote->getShippingAddress()->getShippingAmount(), $precision, '.', '' + ) - number_format( + $quote->getShippingAddress()->getShippingTaxAmount(), $precision, '.', '' + ), $precision, '.', '' + ) + ); + $bitem->setUnitTaxAmount( + number_format($quote->getShippingAddress()->getShippingTaxAmount(), $precision, '.', '') + ); + + + $bitem->setUnitTaxRate( + number_format( + number_format( + $quote->getShippingAddress()->getShippingTaxAmount(), $precision, '.', '' + ) * 100 / number_format($quote->getShippingAddress()->getShippingAmount(), $precision, '.', ''), + $precision, '.', '' + ) + ); + $basket->addItem($bitem); + } + + + foreach ($basket->getData() as $k => $v) { + $init->$k = $v; + } + } + + if ($this->_dataHelper->getConfigData('options/sendconfirmationemail')) { + $init->setConfirmMail($this->_dataHelper->getStoreConfigData('trans_email/ident_general/email')); + } + + if ($this->_dataHelper->getConfigData('options/autodeposit') && $this->_autoDepositAllowed) { + $init->setAutoDeposit(true); + } + + if (strlen($data->getData('financialInstitution'))) { + $init->setFinancialInstitution($data->getData('financialInstitution')); + } + + if ($this->_dataHelper->getConfigData('options/duplicaterequestcheck')) { + $init->setDuplicateRequestCheck($this->_dataHelper->getConfigData('options/duplicaterequestcheck')); + } + + $init->quoteHash = $this->_dataHelper->calculateQuoteChecksum($quote); + + $this->setAdditionalRequestData($init, $cart); + + $this->_logger->debug(__METHOD__ . ':' . print_r($init->getRequestData(), true)); + + try { + $initResponse = $init->initiate(); + } catch (\Exception $e) { + $this->_logger->debug(__METHOD__ . ':' . $e->getMessage()); + throw new $e; + } + + if ($initResponse->getStatus() == \WirecardCEE_QMore_Response_Initiation::STATE_FAILURE) { + $message = $this->_dataHelper->__('An error occurred during the payment process'); + if ($initResponse->getNumberOfErrors() > 0) { + + $msg = implode(',', + array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $initResponse->getErrors())); + + if (strlen($msg)) { + $message = $msg; + } + + $this->_logger->debug(__METHOD__ . ':' . $msg); + } + + throw new \Exception($message); + } + + return $initResponse; + } + + + /** + * return display mode, iframe, popup, redirect + * + * @return mixed|string + */ + public function getDisplayMode() + { + return 'popup'; + } + + + /** + * set payment specific request data + * + * @param \WirecardCEE_QMore_FrontendClient $init + * @param CheckoutCart $cart + */ + protected function setAdditionalRequestData($init, $cart) + { + } + + /** + * Returns desription of customer - will be displayed in Wirecard backend + * + * @param Quote $quote + * + * @return string + */ + protected function getUserDescription($quote) + { + + return sprintf('%s %s %s', $quote->getCustomerEmail(), $quote->getCustomerFirstname(), + $quote->getCustomerLastname()); + } + + /** + * @param Quote $quote + * + * @return \WirecardCEE_Stdlib_ConsumerData + */ + protected function _getConsumerData($quote) + { + + $consumerData = new \WirecardCEE_Stdlib_ConsumerData(); + $consumerData->setIpAddress($this->_dataHelper->getClientIp()); + $consumerData->setUserAgent($this->_dataHelper->getUserAgent()); + + $deliveryAddress = $quote->getShippingAddress(); + $billingAddress = $quote->getBillingAddress(); + $dob = $this->getCustomerDob($quote); + + $consumerData->setEmail($quote->getCustomerEmail()); + if ($dob !== false) { + $consumerData->setBirthDate($dob); + } + if (strlen($billingAddress->getCompany())) { + $consumerData->setCompanyName($billingAddress->getCompany()); + } + + if (strlen($billingAddress->getVatId())) { + $consumerData->setCompanyVatId($billingAddress->getVatId()); + } + + if ($this->_forceSendAdditionalData || $this->_dataHelper->getConfigData('options/sendbillingdata')) { + $consumerData->addAddressInformation($this->_getAddress($billingAddress, 'billing')); + } + + if ($this->_forceSendAdditionalData || $this->_dataHelper->getConfigData('options/sendshippingdata')) { + $consumerData->addAddressInformation($this->_getAddress($deliveryAddress, 'shipping')); + } + + return $consumerData; + } + + /** + * @param \Magento\Quote\Model\Quote\Address $source + * @param string $type + * + * @return \WirecardCEE_Stdlib_ConsumerData_Address + */ + protected function _getAddress($source, $type = 'billing') + { + switch ($type) { + case 'shipping': + $address = new \WirecardCEE_Stdlib_ConsumerData_Address(\WirecardCEE_Stdlib_ConsumerData_Address::TYPE_SHIPPING); + break; + + default: + $address = new \WirecardCEE_Stdlib_ConsumerData_Address(\WirecardCEE_Stdlib_ConsumerData_Address::TYPE_BILLING); + break; + } + + $address->setFirstname($source->getFirstname()); + $address->setLastname($source->getLastname()); + $address->setAddress1($source->getStreetLine(1)); + $address->setAddress2($source->getStreetLine(2)); + $address->setZipCode($source->getPostcode()); + $address->setCity($source->getCity()); + $address->setCountry($source->getCountry()); + $address->setState($source->getRegionCode()); + $address->setPhone($source->getTelephone()); + $address->setFax($source->getFax()); + + return $address; + } + + + /** + * getter for customers birthDate + * + * @param Quote $quote + * + * @return bool|\DateTime + */ + public function getCustomerDob($quote) + { + $dob = $quote->getCustomer()->getDob(); + if ($dob) { + return new \DateTime($dob); + } + + return false; + } + + + /** + * Assign data to info model instance + * + * @param array|\Magento\Framework\DataObject $data + * + * @return $this + * @throws \Magento\Framework\Exception\LocalizedException + * @api + */ + public function assignData(\Magento\Framework\DataObject $data) + { + parent::assignData($data); + + /** @var \Magento\Quote\Model\Quote\Payment $infoInstance */ + $infoInstance = $this->getInfoInstance(); + + /* unset data wich is used for dedicated payment methods only */ + $infoInstance->unsAdditionalInformation('financialInstitution'); + $infoInstance->unsAdditionalInformation('customerDob'); + + return $this; + } + + /** + * @param Quote|\Magento\Quote\Api\Data\CartInterface $quote + * + * @return bool + */ + protected function _isAvailablePayolution($quote) + { + $dob = $quote->getCustomer()->getDob(); + + //we only need to check the dob if it's set. Else we ask for dob on payment selection page. + if ($dob) { + $dobObject = new \DateTime($dob); + $currentYear = date('Y'); + $currentMonth = date('m'); + $currentDay = date('d'); + $ageCheckDate = ( $currentYear - 17 ) . '-' . $currentMonth . '-' . $currentDay; + $ageCheckObject = new \DateTime($ageCheckDate); + if ($ageCheckObject < $dobObject) { + return false; + } + } + + if ($quote->hasVirtualItems()) { + return false; + } + + if ($this->getConfigData('billing_shipping_address_identical') && !$this->compareAddresses($quote)) { + return false; + } + + $currencies = explode(',', $this->getConfigData('currency')); + if (!in_array($quote->getQuoteCurrencyCode(), $currencies)) { + return false; + } + + if (strlen($this->getConfigData('shippingcountry'))) { + $countries = explode(',', $this->getConfigData('shippingcountry')); + if (!in_array($quote->getShippingAddress()->getCountry(), $countries)) { + return false; + } + } + + if (strlen($this->getConfigData('max_basket_size'))) { + if ($quote->getItemsQty() > $this->getConfigData('max_basket_size')) { + return false; + } + } + + if (strlen($this->getConfigData('min_basket_size'))) { + if ($quote->getItemsQty() < $this->getConfigData('min_basket_size')) { + return false; + } + } + + return parent::isAvailable($quote); + } + + /** + * @param Quote|\Magento\Quote\Api\Data\CartInterface $quote + * + * @return bool + */ + protected function _isAvailableRatePay($quote) + { + $dob = $quote->getCustomer()->getDob(); + $minAge = (int) $this->getConfigData('min_age'); + + if ($minAge <= 0) { + $this->_logger->debug(__METHOD__ . ':warning min-age not set for ratepay'); + return false; + } + + //we only need to check the dob if it's set. Else we ask for dob on payment selection page. + if ($dob) { + $dobObject = new \DateTime($dob); + $currentYear = date('Y'); + $currentMonth = date('m'); + $currentDay = date('d'); + $ageCheckDate = ( $currentYear - $minAge ) . '-' . $currentMonth . '-' . $currentDay; + $ageCheckObject = new \DateTime($ageCheckDate); + if ($ageCheckObject < $dobObject) { + return false; + } + } + + if ($quote->hasVirtualItems()) { + return false; + } + + if ($this->getConfigData('billing_shipping_address_identical') && !$this->compareAddresses($quote)) { + return false; + } + + $currencies = explode(',', $this->getConfigData('currency')); + if (!in_array($quote->getQuoteCurrencyCode(), $currencies)) { + return false; + } + + if (strlen($this->getConfigData('shippingcountry'))) { + $countries = explode(',', $this->getConfigData('shippingcountry')); + if (!in_array($quote->getShippingAddress()->getCountry(), $countries)) { + return false; + } + } + + if (strlen($this->getConfigData('max_basket_size'))) { + if ($quote->getItemsQty() > $this->getConfigData('max_basket_size')) { + return false; + } + } + + if (strlen($this->getConfigData('min_basket_size'))) { + if ($quote->getItemsQty() < $this->getConfigData('min_basket_size')) { + return false; + } + } + + return parent::isAvailable($quote); + } + + + /** + * @param Quote|\Magento\Quote\Api\Data\CartInterface $quote + * + * @return bool + */ + protected function _isAvailableWirecard($quote) + { + return $this->_isAvailableRatePay($quote); + } + + /** + * force transmitting the basket data + * + * @return bool + */ + protected function forceSendingBasket() + { + return false; + } + + + /* + * helper functions, needed by config provider + */ + + /** + * return instruction string + * + * @return string + */ + public function getInstructions() + { + return trim($this->getConfigData('instructions')); + } + + /** + * return logo (png) + * + * @return bool + */ + public function getLogo() + { + return $this->_logo; + } + + /** + * return wirecard payment method + * + * @return string + */ + public function getMethod() + { + return $this->_paymentMethod; + } + + + /** + * compare billing shipping address + * + * @param Quote $quote + * + * @return bool + */ + protected function compareAddresses($quote) + { + $billingAddress = $quote->getBillingAddress(); + + $shippingAddress = $quote->getShippingAddress(); + + if (!$shippingAddress->getSameAsBilling()) { + if ($billingAddress->getCustomerAddressId() == null || $billingAddress->getCustomerAddressId() != $shippingAddress->getCustomerAddressId()) { + if ( //new line because it's easier to remove this way + // dont compare emails, shippingAddress E-Mail is empty in guest checkouts + $billingAddress->getName() != $shippingAddress->getName() || + $billingAddress->getCompany() != $shippingAddress->getCompany() || + $billingAddress->getCity() != $shippingAddress->getCity() || + $billingAddress->getPostcode() != $shippingAddress->getPostcode() || + $billingAddress->getCountryId() != $shippingAddress->getCountryId() || + $billingAddress->getTelephone() != $shippingAddress->getTelephone() || + $billingAddress->getFax() != $shippingAddress->getFax() || + $billingAddress->getCountry() != $shippingAddress->getCountry() || + $billingAddress->getRegion() != $shippingAddress->getRegion() || + $billingAddress->getStreetLine(1) != $shippingAddress->getStreetLine(1) || + $billingAddress->getStreetLine(2) != $shippingAddress->getStreetLine(2) + ) { + return false; + } + } + } + + return true; + } + + /** + * return provider for invoice/installment + * + * @return string + */ + public function getProvider() + { + return $this->getConfigData('provider'); + } + + /* + * backend operations + */ + + /** + * return order details from backend + * + * @param $orderNumber + * + * @return \WirecardCEE_QMore_Response_Backend_GetOrderDetails + */ + public function getOrderDetails($orderNumber) + { + $client = $this->_dataHelper->getBackendClient(); + + $ret = $client->getOrderDetails($orderNumber); + if ($ret->hasFailed()) { + $msg = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $ret->getErrors())); + $this->_logger->debug(__METHOD__ . ':' . $msg); + } + + return $ret; + } + + /* + * payment operations + */ + + /** + * Capture payment abstract method + * + * be aware of: https://github.com/magento/magento2/issues/2655 + * + * @see \Magento\Sales\Model\Order\Payment\Operations\CaptureOperation::capture + * + * @param \Magento\Framework\DataObject|InfoInterface|\Magento\Sales\Model\Order\Payment $payment + * @param float $amount + * + * @return $this + * @throws \Exception + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount) + { + $order = $payment->getOrder(); + + if ($this->_dataHelper->isBackendAvailable()) { + + $orderNumber = $payment->getAdditionalInformation('orderNumber'); + if (!strlen($orderNumber)) { + /* dont throw an exception here, might be a pending payment */ + $this->_logger->debug(__METHOD__ . ':No order number found.'); + + return $this; + } + + $backendClient = $this->_dataHelper->getBackendClient(); + + $orderDetails = $this->getOrderDetails($orderNumber); + $this->_logger->debug(__METHOD__ . ':operations allowed:' . implode(',', + $orderDetails->getOrder()->getOperationsAllowed())); + + foreach ($orderDetails->getOrder()->getPayments() as $wdPayment) { + /** @var \WirecardCEE_QMore_Response_Backend_Order_Payment $wdPayment */ + + $this->_logger->debug(__METHOD__ . ':operations allowed:' . implode(',', + $wdPayment->getOperationsAllowed())); + + if (in_array('DEPOSIT', $wdPayment->getOperationsAllowed())) { + $ret = $backendClient->deposit($orderNumber, $amount, $order->getBaseCurrencyCode()); + if ($ret->hasFailed()) { + $msg = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $ret->getErrors())); + throw new \Exception($msg); + } + + $this->_logger->debug(__METHOD__ . ':deposited:' . $amount . ' ' . $order->getBaseCurrencyCode()); + + $gwRefId = $payment->getAdditionalInformation('gatewayReferenceNumber'); + + $payment->setTransactionId($ret->getPaymentNumber()); + $payment->setParentTransactionId($gwRefId); + /** @var \Magento\Sales\Model\Order\Payment\Transaction $transaction */ + $transaction = $this->_transactionBuilder->setPayment($payment) + ->setOrder($order) + ->setTransactionId($payment->getTransactionId()) + ->build(Transaction::TYPE_CAPTURE); + $transaction->setParentId($gwRefId); + $transaction->setAdditionalInformation(Transaction::RAW_DETAILS, + [ + 'amount' => $amount, + 'currency' => $payment->getOrder()->getBaseCurrencyCode(), + 'orderNumber' => $orderNumber + ]); + $transaction->save(); + $payment->addTransactionCommentsToOrder($transaction, + 'deposited:' . $amount . ' ' . $order->getBaseCurrencyCode()); + } + } + + } + + return $this; + } + + + /** + * Refund specified amount for payment + * + * @param \Magento\Framework\DataObject|InfoInterface|\Magento\Sales\Model\Order\Payment $payment + * @param float $amount + * + * @return $this + * @throws \Exception + * @throws \Magento\Framework\Exception\LocalizedException + * @api + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount) + { + $order = $payment->getOrder(); + $this->_logger->debug(__METHOD__ . ':' . $amount . ' ' . $order->getBaseCurrencyCode()); + if (!$this->_dataHelper->isBackendAvailable()) { + return $this; + } + + $orderNumber = $payment->getAdditionalInformation('orderNumber'); + if (!strlen($orderNumber)) { + throw new \Magento\Framework\Exception\LocalizedException(__('No order number found.')); + } + + $backendClient = $this->_dataHelper->getBackendClient(); + $ret = $backendClient->refund($orderNumber, $amount, $payment->getOrder()->getBaseCurrencyCode()); + if ($ret->hasFailed()) { + $msg = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $ret->getErrors())); + $this->_logger->debug(__METHOD__ . ':' . $msg); + throw new \Exception($msg); + } + + $transactionId = $ret->getCreditNumber(); + $gwRefId = $payment->getAdditionalInformation('gatewayReferenceNumber'); + + $payment->setTransactionId($transactionId); + + /** @var \Magento\Sales\Model\Order\Payment\Transaction $transaction */ + $transaction = $this->_transactionBuilder->setPayment($payment) + ->setOrder($order) + ->setTransactionId($transactionId) + ->build(\Magento\Sales\Model\Order\Payment\Transaction::TYPE_REFUND); + + $transaction->setParentId($gwRefId); + $transaction->setAdditionalInformation(Transaction::RAW_DETAILS, [ + 'amount' => $amount, + 'currency' => $payment->getOrder()->getBaseCurrencyCode(), + 'orderNumber' => $orderNumber, + 'creditNumber' => $ret->getCreditNumber() + ]); + $transaction->save(); + + $payment->addTransactionCommentsToOrder($transaction, 'refund:' . $amount . ' ' . $order->getBaseCurrencyCode()); + + return $this; + } + + /** + * Revert refund + * + * @param \Magento\Framework\DataObject|InfoInterface|\Magento\Sales\Model\Order\Payment $payment + * @param Transaction $transaction + * + * @return $this + * @throws \Exception + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function refundReversal(\Magento\Payment\Model\InfoInterface $payment, Transaction $transaction) + { + $order = $payment->getOrder(); + + $this->_logger->debug(__METHOD__); + + $addInfo = $transaction->getAdditionalInformation('raw_details_info'); + if (!isset( $addInfo['orderNumber'] ) || !isset( $addInfo['creditNumber'] )) { + throw new LocalizedException($this->_dataHelper->__('Unable to revert refund, creditNumber and/or orderNumber not found!')); + } + + if (!$this->_dataHelper->isBackendAvailable()) { + return $this; + } + + $backendClient = $this->_dataHelper->getBackendClient(); + $ret = $backendClient->refundReversal($addInfo['orderNumber'], $addInfo['creditNumber']); + if ($ret->hasFailed()) { + $msg = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $ret->getErrors())); + $this->_logger->debug(__METHOD__ . ':' . $msg); + throw new \Exception($msg); + } + + $transactionId = $transaction->getTxnId() . '-reversal'; + + $payment->setTransactionId($transactionId); + + /** @var \Magento\Sales\Model\Order\Payment\Transaction $transaction */ + $transaction = $this->_transactionBuilder->setPayment($payment) + ->setOrder($order) + ->setTransactionId($transactionId) + ->build(Transaction::TYPE_VOID); + + $transaction->setParentId($transaction->getTransactionId()); + $transaction->save(); + + $payment->addTransactionCommentsToOrder($transaction, 'refund reversal: orderNumber:' . $addInfo['orderNumber'] . ' creditNumber:' . $addInfo['creditNumber']); + + $order->save(); + return $this; + } + + + /** + * Void payment + * Void is in regards to the payment on the order invoice - to void the authorization, for instance - so that + * the funds aren't subsequently captured. Payments have to be refunded after capture and cannot be voided. + * + * map this operation to APPROVEREVERSAL + * + * @param \Magento\Framework\DataObject|InfoInterface|\Magento\Sales\Model\Order\Payment $payment + * + * @return $this + * @throws \Exception + * @api + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function void(\Magento\Payment\Model\InfoInterface $payment) + { + + if (!$this->_dataHelper->isBackendAvailable()) { + return $this; + } + + $orderNumber = $payment->getAdditionalInformation('orderNumber'); + if (!strlen($orderNumber)) { + /* dont throw an exception here, might be a pending payment */ + $this->_logger->debug(__METHOD__ . ':No order number found.'); + + return $this; + } + + $orderDetails = $this->getOrderDetails($orderNumber); + + $backendClient = $this->_dataHelper->getBackendClient(); + + $approveDone = false; + foreach ($orderDetails->getOrder()->getPayments() as $wdPayment) { + /** @var \WirecardCEE_QMore_Response_Backend_Order_Payment $wdPayment */ + + $this->_logger->debug(__METHOD__ . ':operations allowed:' . implode(',', + $wdPayment->getOperationsAllowed())); + if (in_array('APPROVEREVERSAL', $wdPayment->getOperationsAllowed())) { + $this->_logger->debug(__METHOD__ . ":$orderNumber"); + $ret = $backendClient->approveReversal($orderNumber); + if ($ret->hasFailed()) { + $msg = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $ret->getErrors())); + $this->_logger->debug(__METHOD__ . ':' . $msg); + throw new \Exception($msg); + } + + $approveDone = true; + + $orderTransaction = $this->_transactionRepository->getByTransactionType( + Transaction::TYPE_ORDER, + $payment->getId(), + $payment->getOrder()->getId() + ); + + if ($orderTransaction) { + $payment->setParentTransactionId($orderTransaction->getTxnId()); + $payment->setTransactionId($orderTransaction->getTxnId() . '-void'); + } + + $payment->addTransactionCommentsToOrder($orderTransaction, 'approveReversal'); + } + + } + + if (!$approveDone) { + throw new \Exception($this->_dataHelper->__('Void not possible anymore for this payment, please try cancel instead!')); + } + + + return $this; + } + + /** + * Cancel payment + * Cancelaltion, is when the order can no longer be modified. While an order payment might be voided a new + * invoice can always be generated. Cancellation of an order prevents any future change from being made to it. + * + * If REFUND is available do a refund, otherwise do a DEPOSITREVERSAL + * Dont make APPROVEREVERSAL (decision by PM) + * + * @param \Magento\Framework\DataObject|InfoInterface|\Magento\Sales\Model\Order\Payment $payment + * + * @return $this + * @throws \Exception + * @api + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function cancel(\Magento\Payment\Model\InfoInterface $payment) + { + if (!$this->_dataHelper->isBackendAvailable()) { + return $this; + } + + $orderNumber = $payment->getAdditionalInformation('orderNumber'); + if (!strlen($orderNumber)) { + /* dont throw an exception here, might be a pending payment */ + $this->_logger->debug(__METHOD__ . ':No order number found.'); + + return $this; + } + + $orderDetails = $this->getOrderDetails($orderNumber); + + $backendClient = $this->_dataHelper->getBackendClient(); + + $log = sprintf("%s", $orderNumber); + + /* if refund op is available order already has been closed */ + /* otherwise revert each single payment */ + if (in_array('REFUND', $orderDetails->getOrder()->getOperationsAllowed())) { + $log .= sprintf(" action:REFUND %s", $orderDetails->getOrder()->getAmount()); + $ret = $backendClient->refund($orderNumber, $orderDetails->getOrder()->getAmount(), + $orderDetails->getOrder()->getCurrency()); + if ($ret->hasFailed()) { + $msg = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $ret->getErrors())); + $this->_logger->debug(__METHOD__ . ':' . $msg); + throw new \Exception($msg); + } + + } else { + foreach ($orderDetails->getOrder()->getPayments() as $payment) { + /** @var \WirecardCEE_QMore_Response_Backend_Order_Payment $payment */ + + if (in_array('DEPOSITREVERSAL', $payment->getOperationsAllowed())) { + $log .= " action:DEPOSITREVERSAL APPROVEREVERSAL"; + $ret = $backendClient->depositReversal($orderNumber, $payment->getPaymentNumber()); + if ($ret->hasFailed()) { + $msg = implode(',', + array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $ret->getErrors())); + throw new \Exception($msg); + } + + } + } + } + + $this->_logger->debug(__METHOD__ . ":$log"); + + return $this; + } +} \ No newline at end of file diff --git a/Model/CcardConfigProvider.php b/Model/CcardConfigProvider.php new file mode 100644 index 0000000..f2fd790 --- /dev/null +++ b/Model/CcardConfigProvider.php @@ -0,0 +1,100 @@ +_dataHelper = $helper; + $this->escaper = $escaper; + $this->assetRepo = $assetRepo; + $this->_cart = $cart; + } + + /** + * {@inheritdoc} + */ + public function getConfig() + { + $config = []; + + foreach ($this->_dataHelper->getConfigData('ccard') as $field => $value) { + if (is_numeric($value)) { + $value = (int) $value; + } + $config['payment'][Payment\Ccard::CODE][$field] = $value; + $config['payment'][Payment\Ccardmoto::CODE][$field] = $value; + $config['payment'][Payment\Maestro::CODE][$field] = $value; + } + + return $config; + } + +} + diff --git a/Model/Config/Backend/CustomerId.php b/Model/Config/Backend/CustomerId.php new file mode 100644 index 0000000..f9cf02b --- /dev/null +++ b/Model/Config/Backend/CustomerId.php @@ -0,0 +1,81 @@ +getValue()); + + if (!strlen($value)) + return $this; + + if (strlen($value) != 7) + throw new \Magento\Framework\Exception\LocalizedException(__('The Customer ID has a fixed length of 7.')); + + $this->setValue(trim($value)); + + + return $this; + } + +} diff --git a/Model/Config/Backend/Secret.php b/Model/Config/Backend/Secret.php new file mode 100644 index 0000000..86bae2b --- /dev/null +++ b/Model/Config/Backend/Secret.php @@ -0,0 +1,71 @@ +setValue(trim(trim($this->getValue()))); + + return $this; + } + +} diff --git a/Model/Config/Source/Configurations.php b/Model/Config/Source/Configurations.php new file mode 100644 index 0000000..34bd6f1 --- /dev/null +++ b/Model/Config/Source/Configurations.php @@ -0,0 +1,58 @@ +_dataHelper = $helper; + } + + public function toOptionArray() + { + $configs = array( + array('value' => 'prod', 'label' => $this->_dataHelper->__('Production')), + array('value' => 'demo', 'label' => $this->_dataHelper->__('Demo')), + array('value' => 'test_no3d', 'label' => $this->_dataHelper->__('Test without 3-D Secure')), + array('value' => 'test_3d', 'label' => $this->_dataHelper->__('Test with 3-D Secure')) + ); + + return $configs; + } +} \ No newline at end of file diff --git a/Model/Config/Source/DisplayModes.php b/Model/Config/Source/DisplayModes.php new file mode 100644 index 0000000..f3e2ec8 --- /dev/null +++ b/Model/Config/Source/DisplayModes.php @@ -0,0 +1,58 @@ +_dataHelper = $helper; + } + + public function toOptionArray() + { + $themes = array( + array('value' => 'iframe', 'label' => $this->_dataHelper->__('Iframe')), + array('value' => 'popup', 'label' => $this->_dataHelper->__('Popup')), + array('value' => 'redirect', 'label' => $this->_dataHelper->__('Redirect')), + ); + + return $themes; + } +} \ No newline at end of file diff --git a/Model/Config/Source/InstallmentProviders.php b/Model/Config/Source/InstallmentProviders.php new file mode 100644 index 0000000..6065413 --- /dev/null +++ b/Model/Config/Source/InstallmentProviders.php @@ -0,0 +1,56 @@ +_dataHelper = $helper; + } + + public function toOptionArray() + { + $list = array( + array('value' => 'payolution', 'label' => 'payolution'), + array('value' => 'ratepay', 'label' => 'RatePay'), + ); + + return $list; + } +} \ No newline at end of file diff --git a/Model/Config/Source/InvoiceProviders.php b/Model/Config/Source/InvoiceProviders.php new file mode 100644 index 0000000..ec989ab --- /dev/null +++ b/Model/Config/Source/InvoiceProviders.php @@ -0,0 +1,57 @@ +_dataHelper = $helper; + } + + public function toOptionArray() + { + $list = array( + array('value' => 'payolution', 'label' => 'payolution'), + array('value' => 'ratepay', 'label' => 'RatePay'), + array('value' => 'wirecard', 'label' => 'Wirecard'), + ); + + return $list; + } +} \ No newline at end of file diff --git a/Model/Config/Source/Layouts.php b/Model/Config/Source/Layouts.php new file mode 100644 index 0000000..436d581 --- /dev/null +++ b/Model/Config/Source/Layouts.php @@ -0,0 +1,59 @@ +_dataHelper = $helper; + } + + public function toOptionArray() + { + $themes = array( + array('value' => '', 'label' => __('No')), + array('value' => 'desktop', 'label' => $this->_dataHelper->__('Desktop')), + array('value' => 'tablet', 'label' => $this->_dataHelper->__('Tablet')), + array('value' => 'smartphone', 'label' => $this->_dataHelper->__('Smartphone')), + ); + + + return $themes; + } +} diff --git a/Model/Config/Source/OrderCreation.php b/Model/Config/Source/OrderCreation.php new file mode 100644 index 0000000..59654fc --- /dev/null +++ b/Model/Config/Source/OrderCreation.php @@ -0,0 +1,56 @@ +_dataHelper = $helper; + } + + public function toOptionArray() + { + $themes = array( + array('value' => 'before', 'label' => $this->_dataHelper->__('Create order before payment')), + array('value' => 'after', 'label' => $this->_dataHelper->__('Create order after payment')), + ); + + return $themes; + } +} diff --git a/Model/Config/Source/Txident.php b/Model/Config/Source/Txident.php new file mode 100644 index 0000000..0ec2e3f --- /dev/null +++ b/Model/Config/Source/Txident.php @@ -0,0 +1,56 @@ +_dataHelper = $helper; + } + + public function toOptionArray() + { + $themes = array( + array('value' => 'SINGLE', 'label' => $this->_dataHelper->__('Single')), + array('value' => 'INITIAL', 'label' => $this->_dataHelper->__('Initial')), + ); + + return $themes; + } +} diff --git a/Model/ConfigProvider.php b/Model/ConfigProvider.php new file mode 100644 index 0000000..3a0c585 --- /dev/null +++ b/Model/ConfigProvider.php @@ -0,0 +1,262 @@ +_dataHelper = $helper; + $this->paymentHelper = $paymentHelper; + $this->escaper = $escaper; + $this->assetRepo = $assetRepo; + + foreach ($this->methodCodes as $code) { + $this->methods[$code] = $this->paymentHelper->getMethodInstance($code); + } + } + + /** + * {@inheritdoc} + */ + public function getConfig() + { + $config = []; + + /* + * common config data + */ + + foreach ($this->methodCodes as $code) { + $config['payment'][$code]['paymentMethod'] = $this->getPaymentMethod($code); + $config['payment'][$code]['instructions'] = $this->getInstructions($code); + $config['payment'][$code]['displaymode'] = 'popup'; // always popup for seamless + $config['payment'][$code]['logo_url'] = $this->getLogoUrl($code); + } + + /* + * EPS financial institutions + */ + $fis = \WirecardCEE_QMore_PaymentType::getFinancialInstitutions(\WirecardCEE_QMore_PaymentType::EPS); + + $epsFinancialInstitutions = []; + foreach ($fis as $k => $v) { + $epsFinancialInstitutions[] = ['value' => $k, 'label' => html_entity_decode($v)]; + } + $c = new \Collator('root'); + usort($epsFinancialInstitutions, function ($a, $b) use ($c) { + return $c->compare($a['label'], $b['label']); + }); + array_unshift($epsFinancialInstitutions, + ['value' => '', 'label' => $this->_dataHelper->__('Choose your bank...')]); + + $config['payment'][Payment\Eps::CODE]['financialinstitutions'] = $epsFinancialInstitutions; + + /* + * IDEAL financial institutions + */ + + $fis = \WirecardCEE_QMore_PaymentType::getFinancialInstitutions(\WirecardCEE_QMore_PaymentType::IDL); + + $idealFinancialInstitutions = []; + foreach ($fis as $k => $v) { + $idealFinancialInstitutions[] = ['value' => $k, 'label' => htmlspecialchars_decode($v)]; + } + array_unshift($idealFinancialInstitutions, + ['value' => '', 'label' => $this->_dataHelper->__('Choose your bank...')]); + + $config['payment'][Payment\Ideal::CODE]['financialinstitutions'] = $idealFinancialInstitutions; + + /* + * Trustpay financial institutions + */ + + $fis = $this->_dataHelper->getFinancialInstitutions(\WirecardCEE_QMore_PaymentType::TRUSTPAY); + + $trustpayFinancialInstitutions = []; + foreach ($fis as $fi) { + $trustpayFinancialInstitutions[] = ['value' => $fi['id'], 'label' => $fi['name']]; + } + array_unshift($trustpayFinancialInstitutions, + ['value' => '', 'label' => $this->_dataHelper->__('Choose your bank...')]); + + $config['payment'][Payment\Trustpay::CODE]['financialinstitutions'] = $trustpayFinancialInstitutions; + + /* + * Invoice/installment + */ + + $config['payment'][Payment\Invoice::CODE]['provider'] = $this->methods[Payment\Invoice::CODE]->getProvider(); + $config['payment'][Payment\Invoiceb2b::CODE]['provider'] = $this->methods[Payment\Invoiceb2b::CODE]->getProvider(); + $config['payment'][Payment\Installment::CODE]['provider'] = $this->methods[Payment\Installment::CODE]->getProvider(); + + $txt = + $this->_dataHelper->__('I agree that the data which are necessary for the liquidation of purchase on account and which are used to complete the identy and credit check are transmitted to payolution. My %s can be revoked at any time with effect for the future.'); + + $payolutionLink = $this->_dataHelper->getPayolutionLink($this->methods[Payment\Invoice::CODE]->getConfigData('payolution_mid')); + if ($this->methods[Payment\Invoice::CODE]->getProvider() == 'payolution' && $this->methods[Payment\Invoice::CODE]->getConfigData('payolution_terms')) { + $config['payment'][Payment\Invoice::CODE]['consenttxt'] = sprintf($txt, $payolutionLink); + $config['payment'][Payment\Invoiceb2b::CODE]['consenttxt'] = sprintf($txt, $payolutionLink); + } + + $config['payment'][Payment\Invoice::CODE]['min_age'] = $this->methods[Payment\Invoice::CODE]->getConfigData('min_age'); + $config['payment'][Payment\Installment::CODE]['min_age'] = $this->methods[Payment\Installment::CODE]->getConfigData('min_age'); + + if ($this->methods[Payment\Invoice::CODE]->getProvider() == 'payolution') { + $config['payment'][Payment\Invoice::CODE]['min_age'] = 18; + } + + if ($this->methods[Payment\Installment::CODE]->getProvider() == 'payolution') { + $config['payment'][Payment\Installment::CODE]['min_age'] = 18; + } + + $payolutionLink = $this->_dataHelper->getPayolutionLink($this->methods[Payment\Installment::CODE]->getConfigData('payolution_mid')); + if ($this->methods[Payment\Installment::CODE]->getProvider() == 'payolution' && $this->methods[Payment\Installment::CODE]->getConfigData('payolution_terms')) { + $config['payment'][Payment\Installment::CODE]['consenttxt'] = sprintf($txt, $payolutionLink); + } + + return $config; + } + + /** + * Get instructions text from config + * + * @param string $code + * + * @return string + */ + protected function getInstructions($code) + { + return nl2br($this->escaper->escapeHtml($this->methods[$code]->getInstructions())); + } + + + /** + * Get wirecard payment type + * + * @param string $code + * + * @return string + */ + protected function getPaymentMethod($code) + { + return $this->methods[$code]->getMethod(); + } + + protected function getLogoUrl($code) + { + //$params = array_merge(['_secure' => $this->getRequest()->isSecure()], $params); + $logo = $this->methods[$code]->getLogo(); + if ($logo === false) { + return false; + } + + return $this->assetRepo->getUrlWithParams('Wirecard_CheckoutSeamless::images/' . $logo, ['_secure' => true]); + } +} + diff --git a/Model/FundTransfer.php b/Model/FundTransfer.php new file mode 100644 index 0000000..c391184 --- /dev/null +++ b/Model/FundTransfer.php @@ -0,0 +1,118 @@ +_dataHelper = $dataHelper; + } + + /** + * @param \Magento\Framework\DataObject $postObject + * + * @return \WirecardCEE_QMore_Response_Backend_TransferFund + * @throws \Exception + */ + public function sendrequest($postObject) + { + $backendClient = $this->_dataHelper->getBackendClient(); + + $type = strtoupper($postObject['transferType']); + + $client = $backendClient->transferfund($type); + + if (strlen($postObject['orderNumber'])) { + $client->setOrderNumber($postObject['orderNumber']); + } + if (strlen($postObject['orderReference'])) { + $client->setOrderReference($postObject['orderReference']); + } + if (strlen($postObject['creditNumber'])) { + $client->setCreditNumber($postObject['creditNumber']); + } + + switch ($type) { + case \WirecardCEE_QMore_BackendClient::$TRANSFER_FUND_TYPE_EXISTING: + /** @var \WirecardCEE_QMore_Request_Backend_TransferFund_Existing $client */ + if (strlen($postObject['customerStatement'])) { + $client->setCustomerStatement($postObject['customerStatement']); + } + + $ret = $client->send($postObject['amount'], $postObject['currency'], $postObject['orderDescription'], + $postObject['sourceOrderNumber']); + break; + + case \WirecardCEE_QMore_BackendClient::$TRANSFER_FUND_TYPE_SKIRLLWALLET: + /** @var \WirecardCEE_QMore_Request_Backend_TransferFund_SkrillWallet $client */ + $ret = $client->send($postObject['amount'], $postObject['currency'], $postObject['orderDescription'], + $postObject['customerStatement'], $postObject['consumerEmail']); + break; + + case \WirecardCEE_QMore_BackendClient::$TRANSFER_FUND_TYPE_MONETA: + /** @var \WirecardCEE_QMore_Request_Backend_TransferFund_Moneta $client */ + $ret = $client->send($postObject['amount'], $postObject['currency'], $postObject['orderDescription'], + $postObject['customerStatement'], $postObject['consumerWalletId']); + break; + + case \WirecardCEE_QMore_BackendClient::$TRANSFER_FUND_TYPE_SEPACT: + /** @var \WirecardCEE_QMore_Request_Backend_TransferFund_SepaCT $client */ + $ret = $client->send($postObject['amount'], $postObject['currency'], $postObject['orderDescription'], + $postObject['bankAccountOwner'], + $postObject['bankBic'], $postObject['bankAccountIban']); + break; + + default: + throw new \Exception($this->_dataHelper->__('Invalid fund transfer type')); + } + + return $ret; + } +} diff --git a/Model/OrderManagement.php b/Model/OrderManagement.php new file mode 100644 index 0000000..ec26a92 --- /dev/null +++ b/Model/OrderManagement.php @@ -0,0 +1,455 @@ +_logger = $logger; + $this->_dataHelper = $helper; + $this->_transactionRepository = $transactionRepository; + $this->_orderSender = $orderSender; + $this->_transactionBuilder = $transactionBuilder; + $this->_quoteManagement = $quoteManagement; + $this->_quoteRepository = $quoteRepository; + $this->_registry = $registry; + $this->_order = $order; + } + + /** + * @param Quote $quote + * + * @return Order + */ + public function submitOrder($quote) + { + /* ev. use placeOrder? */ + /* $this->_quoteManagement->placeOrder() */ + + /** @var Order $order */ + $order = $this->_quoteManagement->submit($quote); + $order->save(); + + return $order; + } + + /** + * Process order, create/update/cancel/delete order depending on config and order state + * + * @param \WirecardCEE_Stdlib_Return_ReturnAbstract $return + * + * @return Order|null + * @throws \Exception + */ + public function processOrder(\WirecardCEE_Stdlib_Return_ReturnAbstract $return) + { + $quoteId = $return->mage_quoteId; + + $quote = $this->_quoteRepository->get($quoteId); + + if (!$quote->getId()) { + throw new \Exception('Quote not found'); + } + + $orderIncrementId = $return->mage_orderId; + + $order = $this->_order; + $order->loadByIncrementId($orderIncrementId); + $orderExists = (bool) $order->getId(); + + if ($return->mage_orderCreation == 'before') { + if (!$orderExists) { + throw new \Exception('Order not found'); + } + + switch ($return->getPaymentState()) { + case \WirecardCEE_QMore_ReturnFactory::STATE_SUCCESS: + case \WirecardCEE_QMore_ReturnFactory::STATE_PENDING: + /* after a pending payment, order might have been processed manually */ + /* just save transaction but dont update order */ + if ($this->isOrderProcessed($order)) { + $this->saveTransaction(Transaction::TYPE_PAYMENT, '', $order, $return); + } else { + $this->confirmOrder($order, $return, false); + } + break; + + case \WirecardCEE_QMore_ReturnFactory::STATE_CANCEL: + case \WirecardCEE_QMore_ReturnFactory::STATE_FAILURE: + // ev. set review state + //$order->setState(\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW); + if (!$this->isOrderProcessed($order)) { + $this->failedOrder($order, $return); + } + break; + } + + } else if ($return->mage_orderCreation == 'after') { + switch ($return->getPaymentState()) { + + case \WirecardCEE_QMore_ReturnFactory::STATE_SUCCESS: + case \WirecardCEE_QMore_ReturnFactory::STATE_PENDING: + $fraudDetected = false; + if (!$orderExists) { + $order = $this->submitOrder($quote); + $fraudDetected = !$this->_dataHelper->compareQuoteChecksum($quote, $return->quoteHash); + $orderExists = true; + } + + /* after a pending payment, order might have been processed manually */ + /* just save transaction but dont update order */ + if ($this->isOrderProcessed($order)) { + $this->saveTransaction(Transaction::TYPE_PAYMENT, '', $order, $return); + } else { + $this->confirmOrder($order, $return, $fraudDetected); + } + break; + + case \WirecardCEE_QMore_ReturnFactory::STATE_CANCEL: + case \WirecardCEE_QMore_ReturnFactory::STATE_FAILURE: + /* save some data to additional info because within the return request we have no */ + /* information about the payment */ + $quote->getPayment()->setAdditionalInformation($return->getReturned()); + $quote->save(); + + if ($orderExists && !$this->isOrderProcessed($order)) { + $this->deleteOrder($order); + } + break; + } + } else { + throw new \Exception('Unknown order creation type'); + } + + if ($orderExists) { + $order->save(); + + return $order; + } + + return null; + } + + /** + * check if order already has been successfully processed. + * check status history, beacause order could be in shipping or closed state too. + * + * @param $order \Magento\Sales\Model\Order + * + * @return bool + */ + public function isOrderProcessed($order) + { + $history = $order->getAllStatusHistory(); + $paymentInst = $order->getPayment()->getMethodInstance(); + if ($paymentInst) { + foreach ($history AS $entry) { + if ($entry->getStatus() == \Magento\Sales\Model\Order::STATE_PROCESSING) { + return true; + } + } + } + + return false; + } + + /** + * @param $quoteId + * + * @return Quote + */ + public function reOrder($quoteId) + { + $quote = $this->_quoteRepository->get($quoteId); + $quote->setIsActive(1)->setReservedOrderId(null); + $this->_quoteRepository->save($quote); + + return $quote; + } + + /** + * Keep the failed order + * + * @param \Magento\Sales\Model\Order $order + * @param \WirecardCEE_Stdlib_Return_ReturnAbstract $return + * + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function failedOrder($order, $return) + { + /** @var \Magento\Sales\Model\Order\Payment $payment */ + $payment = $order->getPayment(); + + $additionalInformation = Array(); + foreach ($return->getReturned() as $fieldName => $fieldValue) { + $additionalInformation[htmlentities($fieldName)] = htmlentities($fieldValue); + } + $payment->setAdditionalInformation($additionalInformation); + + if ($order->canUnhold()) { + $order->unhold(); + } + + $order->cancel(); + $order->save(); + } + + /** + * delete failed order + * + * @param \Magento\Sales\Model\Order $order + * + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function deleteOrder($order) + { + if ($order->canUnhold()) { + $order->unhold(); + } + + $order->cancel(); + /* hack isSecureArea flag, otherwise actionValidator fails */ + $this->_registry->unregister('isSecureArea'); + $this->_registry->register('isSecureArea', true); + $order->delete(); + } + + + /** + * Confirm the payment of an order + * + * @param \Magento\Sales\Model\Order $order + * @param \WirecardCEE_Stdlib_Return_ReturnAbstract $return + * @param bool $fraudDetected + * + * @return Order + * + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function confirmOrder($order, $return, $fraudDetected) + { + /** @var \Magento\Sales\Model\Order\Payment $payment */ + $payment = $order->getPayment(); + + /** @var \Wirecard\CheckoutSeamless\Model\AbstractPayment $paymentInstance */ + $paymentInstance = $payment->getMethodInstance(); + + $additionalInformation = Array(); + foreach ($return->getReturned() as $fieldName => $fieldValue) { + $additionalInformation[htmlentities($fieldName)] = htmlentities($fieldValue); + } + $payment->setAdditionalInformation($additionalInformation); + + if ($fraudDetected) { + $order->setStatus(\Magento\Sales\Model\Order::STATUS_FRAUD); + $message = $this->_dataHelper->__('fraud attemmpt detected, cart has been modified during checkout!'); + $this->_logger->debug(__METHOD__ . ':' . $message); + $order->addStatusHistoryComment($message); + } + + $doCapture = false; + if (!$this->isOrderProcessed($order)) { + if ($return->getPaymentState() == \WirecardCEE_QMore_ReturnFactory::STATE_PENDING) { + /** @var \WirecardCEE_QMore_Return_Pending $return */ + $order->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT); + $message = $this->_dataHelper->__('The payment authorization is pending.'); + } else { + /** @var \WirecardCEE_QMore_Return_Success $return */ + $order->setState(\Magento\Sales\Model\Order::STATE_PROCESSING); + $order->setStatus(\Magento\Sales\Model\Order::STATE_PROCESSING); + $message = $this->_dataHelper->__('The payment has been successfully completed.'); + + // invoice payment + if ($order->canInvoice()) { + + $invoice = $order->prepareInvoice(); + + $invoice->register(); + + /* capture invoice if toolkit is not availble */ + if (!$this->_dataHelper->isBackendAvailable()) { + $doCapture = true; + } else { + $hasBackedOps = false; + + $orderDetails = $paymentInstance->getOrderDetails($payment->getAdditionalInformation('orderNumber')); + foreach ($orderDetails->getOrder()->getPayments() as $wdPayment) { + /** @var \WirecardCEE_QMore_Response_Backend_Order_Payment $wdPayment */ + + $this->_logger->debug( + __METHOD__ . ':payment-state:' . $wdPayment->getState( + ) . ' allowed operations:' . implode( + ',', + $wdPayment->getOperationsAllowed() + ) + ); + + if (count($wdPayment->getOperationsAllowed())) { + $hasBackedOps = true; + break; + } + } + + if (count($orderDetails->getOrder()->getOperationsAllowed())) { + $this->_logger->debug(__METHOD__ . ':order allowed operations: ' . implode(',', + $orderDetails->getOrder()->getOperationsAllowed())); + $hasBackedOps = true; + } + + /* no backend ops allowed anymore, assume final state of payment, capture invoice */ + if (!$hasBackedOps) { + $doCapture = true; + } + + } + + if ($doCapture && !$fraudDetected) { + $invoice->capture(); + } + + $order->addRelatedObject($invoice); + } + + $this->_orderSender->send($order); + } + + $type = $doCapture ? Transaction::TYPE_CAPTURE : Transaction::TYPE_AUTH; + $this->saveTransaction($type, $message, $order, $return); + } + + $order->save(); + + return $order; + } + + /** + * @param $type + * @param $message + * @param Order $order + * @param \WirecardCEE_Stdlib_Return_ReturnAbstract $return + * + * @return \Magento\Sales\Api\Data\TransactionInterface|null + */ + public function saveTransaction($type, $message, $order, $return) + { + $additionalInformation = Array(); + + foreach ($return->getReturned() as $fieldName => $fieldValue) { + $additionalInformation[htmlentities($fieldName)] = htmlentities($fieldValue); + } + + $payment = $order->getPayment(); + + $tid = ''; + if ($return instanceof \WirecardCEE_Stdlib_Return_Success) { + $tid = $return->getGatewayReferenceNumber(); + } + /* generate dummy GwRef for pending payments */ + if (!strlen($tid)) { + $tid = uniqid('tmp_'); + } + + $transaction = $this->_transactionBuilder->setPayment($payment) + ->setOrder($order) + ->setTransactionId($tid) + ->build($type); + $transaction->setIsClosed(0); + + /* must be set as RAW_DETAILS, otherwise they are not displayed in the admin area */ + $transaction->setAdditionalInformation(Transaction::RAW_DETAILS, + $additionalInformation); + + $payment->addTransactionCommentsToOrder($transaction, $message); + + return $transaction; + } + +} \ No newline at end of file diff --git a/Model/Payment/Bmc.php b/Model/Payment/Bmc.php new file mode 100644 index 0000000..a7f4ff6 --- /dev/null +++ b/Model/Payment/Bmc.php @@ -0,0 +1,46 @@ +getConfigData('allowed_group'); + if (!strlen($allowedGroup)) + return false; + + return $this->getConfigData('allowed_group') == $quote->getCustomer()->getGroupId(); + } +} \ No newline at end of file diff --git a/Model/Payment/Ekonto.php b/Model/Payment/Ekonto.php new file mode 100644 index 0000000..09aaaa0 --- /dev/null +++ b/Model/Payment/Ekonto.php @@ -0,0 +1,45 @@ +getInfoInstance(); + $infoInstance->setAdditionalInformation('financialInstitution', $data->getData('financialInstitution')); + + return $this; + } +} \ No newline at end of file diff --git a/Model/Payment/Giropay.php b/Model/Payment/Giropay.php new file mode 100644 index 0000000..aee3c45 --- /dev/null +++ b/Model/Payment/Giropay.php @@ -0,0 +1,45 @@ +getInfoInstance(); + $infoInstance->setAdditionalInformation('financialInstitution', $data->getData('financialInstitution')); + + return $this; + } +} \ No newline at end of file diff --git a/Model/Payment/Installment.php b/Model/Payment/Installment.php new file mode 100644 index 0000000..66f289f --- /dev/null +++ b/Model/Payment/Installment.php @@ -0,0 +1,110 @@ +_logger->debug(__METHOD__ . ':' . $data->getData('customerDob')); + + /** @var \Magento\Quote\Model\Quote\Payment $infoInstance */ + $infoInstance = $this->getInfoInstance(); + $infoInstance->setAdditionalInformation('customerDob', $data->getData('customerDob')); + + return $this; + } + + /** + * Determine method availability based on quote amount and config data + * + * @param \Magento\Quote\Api\Data\CartInterface|null $quote + * + * @return bool + */ + public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) + { + $avail = parent::isAvailable($quote); + if ($avail === false) { + return false; + } + + if ($quote === null) + return false; + + if ($this->getConfigData('provider') == 'ratepay') { + return $this->_isAvailableRatePay($quote); + } + elseif ($this->getConfigData('provider') == 'payolution') { + return $this->_isAvailablePayolution($quote); + } + + return true; + } + + /** + * force transmitting the basket data + * @return bool + */ + protected function forceSendingBasket() + { + return $this->getConfigData('provider') == 'ratepay'; + } + +} \ No newline at end of file diff --git a/Model/Payment/Invoice.php b/Model/Payment/Invoice.php new file mode 100644 index 0000000..7d5bd6c --- /dev/null +++ b/Model/Payment/Invoice.php @@ -0,0 +1,114 @@ +getInfoInstance(); + $infoInstance->setAdditionalInformation('customerDob', $data->getData('customerDob')); + + return $this; + } + + /** + * Determine method availability based on quote amount and config data + * + * @param \Magento\Quote\Api\Data\CartInterface|null $quote + * + * @return bool + */ + public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) + { + $avail = parent::isAvailable($quote); + if ($avail === false) { + return false; + } + + if ($quote === null) { + return false; + } + + if ($this->getConfigData('provider') == 'ratepay') { + return $this->_isAvailableRatePay($quote); + } elseif ($this->getConfigData('provider') == 'payolution') { + return $this->_isAvailablePayolution($quote); + } elseif ($this->getConfigData('provider') == 'wirecard') { + return $this->_isAvailableWirecard($quote); + } + + return true; + } + + /** + * force transmitting the basket data + * + * @return bool + */ + protected function forceSendingBasket() + { + return $this->getConfigData('provider') == 'ratepay' || $this->getConfigData('provider') == 'wirecard'; + } + + +} \ No newline at end of file diff --git a/Model/Payment/Invoiceb2b.php b/Model/Payment/Invoiceb2b.php new file mode 100644 index 0000000..d985f46 --- /dev/null +++ b/Model/Payment/Invoiceb2b.php @@ -0,0 +1,109 @@ +hasVirtualItems()) { + return false; + } + + if ($this->getConfigData('billing_shipping_address_identical') && !$this->compareAddresses($quote)) { + return false; + } + + $currencies = explode(',', $this->getConfigData('currency')); + if (!in_array($quote->getQuoteCurrencyCode(), $currencies)) { + return false; + } + + if (strlen($this->getConfigData('shippingcountry'))) { + $countries = explode(',', $this->getConfigData('shippingcountry')); + if (!in_array($quote->getShippingAddress()->getCountry(), $countries)) { + return false; + } + } + + $billingAddress = $quote->getBillingAddress(); + if (strlen($billingAddress->getCompany())) { + return true; + } + + if (!strlen($billingAddress->getVatId())) { + return false; + } + + return true; + } + +} \ No newline at end of file diff --git a/Model/Payment/Maestro.php b/Model/Payment/Maestro.php new file mode 100644 index 0000000..9c11f1f --- /dev/null +++ b/Model/Payment/Maestro.php @@ -0,0 +1,45 @@ +setTransactionIdentifier($this->getConfigData('txident')); + } +} \ No newline at end of file diff --git a/Model/Payment/Paysafecard.php b/Model/Payment/Paysafecard.php new file mode 100644 index 0000000..053333f --- /dev/null +++ b/Model/Payment/Paysafecard.php @@ -0,0 +1,45 @@ +setTransactionIdentifier($this->getConfigData('txident')); + } + +} \ No newline at end of file diff --git a/Model/Payment/Skrilldirect.php b/Model/Payment/Skrilldirect.php new file mode 100644 index 0000000..f99df57 --- /dev/null +++ b/Model/Payment/Skrilldirect.php @@ -0,0 +1,45 @@ +_dataHelper->getLanguage(); + if (!in_array($lang, ['de', 'en'])) + $lang = 'en'; + + return sprintf($this->_logo, $lang); + } +} \ No newline at end of file diff --git a/Model/Payment/Tatrapay.php b/Model/Payment/Tatrapay.php new file mode 100644 index 0000000..f48f096 --- /dev/null +++ b/Model/Payment/Tatrapay.php @@ -0,0 +1,46 @@ +getInfoInstance(); + $infoInstance->setAdditionalInformation('financialInstitution', $data->getData('financialInstitution')); + + return $this; + } +} \ No newline at end of file diff --git a/Model/Payment/Voucher.php b/Model/Payment/Voucher.php new file mode 100644 index 0000000..83f7ebc --- /dev/null +++ b/Model/Payment/Voucher.php @@ -0,0 +1,45 @@ +_dataHelper = $dataHelper; + $this->_scopePool = $scopePool; + $this->_transportBuilder = $transportBuilder; + $this->_moduleLoader = $moduleLoader; + $this->_paymentConfig = $paymentConfig; + } + + /** + * @param \Magento\Framework\DataObject $postObject + * + * @return bool + * @throws \Exception + */ + public function sendrequest($postObject) + { + if (!filter_var($postObject->getData('to'), FILTER_VALIDATE_EMAIL)) { + throw new \Exception($this->_dataHelper->__('Please enter a valid e-mail address.')); + } + + if (strlen(trim($postObject->getData('replyto')))) { + if (!filter_var($postObject->getData('replyto'), FILTER_VALIDATE_EMAIL)) { + throw new \Exception($this->_dataHelper->__('Please enter a valid e-mail address (reply to).')); + } + $this->_transportBuilder->setReplyTo(trim($postObject->getData('replyto'))); + } + + $sender = [ + 'name' => $this->_dataHelper->getStoreConfigData('trans_email/ident_general/name'), + 'email' => $this->_dataHelper->getStoreConfigData('trans_email/ident_general/email'), + ]; + + if (!strlen($sender['email'])) { + throw new \Exception('Please set your shop e-mail address!'); + } + + $modules = []; + foreach ($this->_moduleLoader->load() as $module) { + if (!in_array($module['name'], $this->_moduleBlacklist)) + $modules[] = $module['name']; + } + natsort($modules); + + $payments = $this->_paymentConfig->getActiveMethods(); + /** @var \Magento\Framework\App\Config\Data $cfg */ + $cfg = $this->_scopePool->getScope(\Magento\Store\Model\ScopeInterface::SCOPE_STORE); + + $foreign = array(); + $mine = array(); + foreach ($payments as $paymentCode => $paymentModel) { + + /** @var AbstractPayment $paymentModel */ + $method = array( + 'label' => $paymentModel->getTitle(), + 'value' => $paymentCode, + 'config' => [] + ); + + if (preg_match('/^wirecard_/i', $paymentCode)) { + $method['config'] = $cfg->getValue('payment/' . $paymentCode); + $mine[$paymentCode] = $method; + } else { + $foreign[$paymentCode] = $method; + } + } + + $versioninfo = new \Magento\Framework\DataObject(); + $versioninfo->setData($this->_dataHelper->getVersionInfo()); + + $transport = $this->_transportBuilder + ->setTemplateIdentifier('contact_support_email') + ->setTemplateOptions( + [ + 'area' => \Magento\Framework\App\Area::AREA_ADMINHTML, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, + ] + ) + ->setTemplateVars([ + 'data' => $postObject, + 'modules' => $modules, + 'foreign' => $foreign, + 'mine' => $mine, + 'configstr' => $this->_dataHelper->getConfigString(), + 'versioninfo' => $versioninfo + ]) + ->setFrom($sender) + ->addTo($postObject->getData('to')) + ->getTransport(); + + $transport->sendMessage(); + + return true; + } +} diff --git a/Model/Test.php b/Model/Test.php new file mode 100644 index 0000000..e7f2ef7 --- /dev/null +++ b/Model/Test.php @@ -0,0 +1,116 @@ +_dataHelper = $dataHelper; + $this->_logger = $logger; + } + + public function config($urls) + { + $returnUrl = $urls['return']; + + $init = new \WirecardCEE_QMore_FrontendClient($this->_dataHelper->getConfigArray()); + $init->setPluginVersion($this->_dataHelper->getPluginVersion()); + + $init->setOrderReference('Configtest #' . uniqid()); + + if ($this->_dataHelper->getConfigData('options/sendconfirmemail')) { + $init->setConfirmMail($this->_dataHelper->getStoreConfigData('trans_email/ident_general/email')); + } + + $consumerData = new \WirecardCEE_Stdlib_ConsumerData(); + $consumerData->setIpAddress($this->_dataHelper->getClientIp()); + $consumerData->setUserAgent($this->_dataHelper->getUserAgent()); + + $init->setAmount(10) + ->setCurrency('EUR') + ->setPaymentType(\WirecardCEE_QMore_PaymentType::CCARD) + ->setOrderDescription('Configtest #' . uniqid()) + ->setSuccessUrl($returnUrl) + ->setPendingUrl($returnUrl) + ->setCancelUrl($returnUrl) + ->setFailureUrl($returnUrl) + ->setConfirmUrl($urls['confirm']) + ->setServiceUrl($this->_dataHelper->getConfigData('options/service_url')) + ->setConsumerData($consumerData); + + $initResponse = $init->initiate(); + + if ($initResponse->getStatus() == \WirecardCEE_QMore_Response_Initiation::STATE_FAILURE) { + + $msg = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getConsumerMessage(); + }, $initResponse->getErrors())); + if (!strlen($msg)) { + $msg = $initResponse = implode(',', array_map(function ($e) { + /** @var \WirecardCEE_QMore_Error $e */ + return $e->getPaySysMessage(); + }, $initResponse->getErrors()));; + } + + throw new \Exception($msg); + } + + return true; + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9c0f11 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Wirecard Checkout Seamless extension for Magento 2 + +[![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/Magento2-WCP/master/LICENSE) +[![PHP v5.5](https://img.shields.io/badge/php-v5.5-yellow.svg)](http://www.php.net) +[![Magento v2.1.4](https://img.shields.io/badge/magento-v2.1.4-green.svg)](https://magento.com/) + +Wirecard Checkout Seamless extension for Magento 2. + +Our [Online Guides](https://guides.wirecard.at/) provide further information on payment methods and additional features. Please observe our [terms of use](https://guides.wirecard.at/shop_plugins:info#terms_of_use) regarding plugins. + +## Wirecard Checkout Seamless +Wirecard Checkout Seamless is designed to meet the ambitious demands of merchants offering a wide range of payment methods while at the same time fulfilling PCI DSS compliance. + +Wirecard Checkout Seamless offers: +- National and international payment methods: credit cards, debit cards, online banking payments, mobile payment solutions and other alternative payment methods. +- One interface for all payment methods. +- Intuitive user interface in more than 25 languages and 120 currencies. +- Layout and design customizable to meet the needs of our merchants (customized look-and-feel). +- Payment page compatible with mobile devices. +- Comprehensive range of effective fraud prevention tools. +- PCI DSS 3 compliant, no PCI certification necessary for merchants. +- Easy to add new payment methods, additional features, languages and currencies, etc. +- Web interface for managing payments (approvals, cancelations, credits, etc.). +- Benefit from Wirecard Bank´s license to conclude credit card acceptance contracts (acquiring) and issue credit cards. +- With Wirecard Collecting only a single contract is required for payouts within various payment methods. +- Support of recurring payments (subscriptions, one-click checkout). diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4cc19dc --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "wirecard/magento2-wcs", + "description": "Wirecard Checkout Seamless", + "type": "magento2-module", + "version": "1.0.0", + "license": [ + "MIT" + ], + "require": { + "php": "~5.5.0|~5.6.0|~7.0", + "magento/magento-composer-installer": "*", + "magento/module-sales": "*", + "magento/module-payment": "*", + "magento/module-quote": "*", + "wirecard/checkout-client-library": "3.3.2" + }, + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Wirecard\\CheckoutSeamless\\": "" + } + } +} diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml new file mode 100644 index 0000000..a786b73 --- /dev/null +++ b/etc/adminhtml/di.xml @@ -0,0 +1,38 @@ + + + + + + + \ No newline at end of file diff --git a/etc/adminhtml/routes.xml b/etc/adminhtml/routes.xml new file mode 100644 index 0000000..0b8356a --- /dev/null +++ b/etc/adminhtml/routes.xml @@ -0,0 +1,40 @@ + + + + + + + + + \ No newline at end of file diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml new file mode 100644 index 0000000..80db3ce --- /dev/null +++ b/etc/adminhtml/system.xml @@ -0,0 +1,1448 @@ + + + + + + +
+ separator-top + + sales + Magento_Sales::config_sales + + + + +
+

Wirecard CEE - Your Full Service Payment Provider - Comprehensive solutions from one single source

Wirecard AG is one of the world´s leading providers of outsourcing and white label solutions for electronic payment transactions.

As independent provider of payment solutions, we accompany our customers along the entire business development. Our payment solutions are perfectly tailored to suit e-Commerce requirements and have made us Austria´s leading payment service provider. Customization, competence, and commitment.
+
+

General information regarding Wirecard Shop Plugins

+ +
+ ]]> +
+ + + + For integration, select predefined configuration settings or "production" for live + systems + + Wirecard\CheckoutSeamless\Model\Config\Source\Configurations + + + + More information. + ]]> + Wirecard\CheckoutSeamless\Model\Config\Backend\CustomerId + + + + More information. + ]]> + + + + More information. + ]]> + Wirecard\CheckoutSeamless\Model\Config\Backend\Secret + + + + More information. + If this password is not set, online operations on the payment are deactivated and the invoice is automatically captured when the order ist created. + ]]> + + + + Wirecard\CheckoutSeamless\Block\Adminhtml\Buttons + + +
+ + + + + + Wirecard\CheckoutSeamless\Model\Config\Source\OrderCreation + + + + + More information. + ]]> + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + Magento\Config\Model\Config\Source\Yesno + More information. Please contact our sales teams to activate this feature. + ]]> + + + + + Magento\Config\Model\Config\Source\Yesno + More information. Please contact our sales teams to activate this feature. + ]]> + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + Magento\Config\Model\Config\Source\Yesno + More information. + ]]> + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + More information + ]]> + + + + + More information
+ The filename has to be placed under the view/frontend/web/css folder of the plugin. + ]]>
+
+ + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + + +
+
+ +
+ + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Customer\Model\Config\Source\Group + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Wirecard\CheckoutSeamless\Model\Config\Source\InvoiceProviders + + + + Magento\Config\Model\Config\Source\Yesno + More information. + ]]> + + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + Magento\Config\Model\Config\Source\Locale\Currency + 1 + + + + validate-greater-than-zero + 1 + Only applicable for RatePay. + + + + Magento\Config\Model\Config\Source\Yesno + Billing and Shipping address must be identical. + + + + + + + validate-number + + + + + + + + + + validate-greater-than-zero + + + + validate-greater-than-zero + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Config\Model\Config\Source\Yesno + More information. + ]]> + + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + Magento\Config\Model\Config\Source\Locale\Currency + 1 + + + + Magento\Config\Model\Config\Source\Yesno + Billing and Shipping address must be identical. + + + + + + + validate-number + + + + + + + + + + validate-greater-than-zero + + + + validate-greater-than-zero + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Wirecard\CheckoutSeamless\Model\Config\Source\InstallmentProviders + + + + Magento\Config\Model\Config\Source\Yesno + More information. + ]]> + + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + Magento\Config\Model\Config\Source\Locale\Currency + 1 + + + + validate-greater-than-zero + 1 + Only applicable for RatePay. + + + + Magento\Config\Model\Config\Source\Yesno + Billing and Shipping address must be identical. + + + + + + + validate-number + + + + + + + + + + validate-greater-than-zero + + + + validate-greater-than-zero + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + Wirecard\CheckoutSeamless\Model\Config\Source\Txident + More information. + ]]> + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + Wirecard\CheckoutSeamless\Model\Config\Source\Txident + More information. + ]]> + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + + + + + + Magento\Shipping\Model\Config\Source\Allmethods + + + + Magento\Payment\Model\Config\Source\Allspecificcountries + + + + Magento\Directory\Model\Config\Source\Country + 1 + + + + + + + validate-number + + + + + + + + + +
+
+
diff --git a/etc/config.xml b/etc/config.xml new file mode 100644 index 0000000..b366ab2 --- /dev/null +++ b/etc/config.xml @@ -0,0 +1,320 @@ + + + + + + + + production + D200001 + seamless + jcv45z + B8AKTPWBRMNBV455FG6M2DANE99WU2 + + + after + 1 + 1 + 1 + + + 1 + 1 + 0 + 0 + 0 + 0 + pci3iframe.css + + + + + + 1 + Wirecard Checkout Seamless Credit Card + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Ccard + 110 + + + + 0 + Wirecard Checkout Seamless Credit Card - Mail Order / Telephone Order + You will be redirected to Wirecard Checkout Seamless when you place an order. + iframe + Wirecard\CheckoutSeamless\Model\Payment\Ccardmoto + 120 + + + + 0 + Wirecard Checkout Seamless Maestro SecureCode + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Maestro + 125 + + + + 0 + Wirecard Checkout Seamless Bancontact/Mister Cash + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Bmc + 130 + + + + 0 + Wirecard Checkout Seamless eKonto + You will be redirected to Wirecard Checkout Seamless when you place an order. + iframe + Wirecard\CheckoutSeamless\Model\Payment\Ekonto + 140 + + + + 0 + Wirecard Checkout Seamless eps Online-Ãœberweisung + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Eps + 150 + + + + 0 + Wirecard Checkout Seamless giropay + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Giropay + 160 + + + + 0 + Wirecard Checkout Seamless iDEAL + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Ideal + 170 + + + + 0 + Wirecard Checkout Seamless POLi + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Poli + 180 + + + + 0 + Wirecard Checkout Seamless Przelewy24 + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\P24 + 190 + + + + 0 + Wirecard Checkout Seamless Skrill Direct + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Skrilldirect + 200 + + + + 1 + Wirecard Checkout Seamless SOFORT Banking + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Sofortbanking + 210 + + + + 0 + Wirecard Checkout Seamless TatraPay + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Tatrapay + 220 + + + + 0 + Wirecard Checkout Seamless Trustly + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Trustly + 230 + + + + 0 + Wirecard Checkout Seamless Trustpay + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Trustpay + 240 + + + + 0 + Wirecard Checkout Seamless ePay.bg + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Epaybg + 250 + + + + 0 + Wirecard Checkout Seamless moneta.ru + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Moneta + 260 + + + + 1 + Wirecard Checkout Seamless Invoice + You will be redirected to Wirecard Checkout Seamless when you place an order. + 1 + EUR + wirecard + 1 + AT,DE,CH + AT,DE,CH + 1 + 10 + 3500 + Wirecard\CheckoutSeamless\Model\Payment\Invoice + 270 + + + + 0 + Wirecard Checkout Seamless Invoice B2B + You will be redirected to Wirecard Checkout Seamless when you place an order. + 1 + EUR + 1 + AT,DE,CH + AT,DE,CH + 1 + 25 + 3500 + Wirecard\CheckoutSeamless\Model\Payment\Invoiceb2b + 280 + + + + 0 + Wirecard Checkout Seamless Installment + You will be redirected to Wirecard Checkout Seamless when you place an order. + 1 + EUR + payolution + 1 + AT,DE,CH + AT,DE,CH + 1 + 150 + 3500 + Wirecard\CheckoutSeamless\Model\Payment\Installment + 290 + + + + 1 + Wirecard Checkout Seamless PayPal + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Paypal + 300 + SINGLE + + + + 0 + Wirecard Checkout Seamless paysafecard + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Paysafecard + 310 + + + + 0 + Wirecard Checkout Seamless @Quick + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Quick + 320 + + + + 0 + Wirecard Checkout Seamless Skrill Digital Wallet + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Skrillwallet + 330 + + + + 1 + Wirecard Checkout Seamless SEPA Direct Debit + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Sepa + 340 + SINGLE + + + + 0 + Wirecard Checkout Seamless mpass + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Mpass + 350 + + + + 0 + Wirecard Checkout Seamless paybox + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Paybox + 360 + + + + 0 + Wirecard Checkout Seamless My Voucher + You will be redirected to Wirecard Checkout Seamless when you place an order. + Wirecard\CheckoutSeamless\Model\Payment\Voucher + 370 + + + + + + diff --git a/etc/email_templates.xml b/etc/email_templates.xml new file mode 100644 index 0000000..82ed7af --- /dev/null +++ b/etc/email_templates.xml @@ -0,0 +1,37 @@ + + + + +