diff --git a/Block/Info/AbstractBlock.php b/Block/Info/AbstractBlock.php new file mode 100644 index 00000000000..750674741c3 --- /dev/null +++ b/Block/Info/AbstractBlock.php @@ -0,0 +1,247 @@ +transactionCollectionFactory = $collectionFactory; + $this->paymentHelper = $paymentHelper; + + parent::__construct($context, $data); + } + + /** + * Returns the Connector Account Holder Name. + * + * @return string + */ + public function getAccountHolder() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_HOLDER'])) { + return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_HOLDER']; + } + + return '-'; + } + + /** + * Returns the Connector Account IBAN. + * + * @return string + */ + public function getAccountIban() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_IBAN'])) { + return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_IBAN']; + } + + return '-'; + } + + /** + * Returns the Connector Account BIC. + * + * @return string + */ + public function getAccountBic() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_BIC'])) { + return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_BIC']; + } + + return '-'; + } + + /** + * Returns the Customer Birthdate (provided in this order). + * + * @return string + */ + public function getCustomerBirthdate() + { + if (!$this->getIsSecureMode()) { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['NAME_BIRTHDATE'])) { + return $this->transactionInfo->getJsonResponse()['NAME_BIRTHDATE']; + } + } + + return '-'; + } + /** + * Returns the Customer Salutation (provided in this order). + * + * @return string + */ + public function getCustomerSalutation() + { + if (!$this->getIsSecureMode()) { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['NAME_SALUTATION'])) { + return $this->transactionInfo->getJsonResponse()['NAME_SALUTATION']; + } + } + + return '-'; + } + + /** + * @return mixed + */ + public function printAdditionalInformationHtml() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (! empty($this->transactionInfo->getJsonResponse())) { + return $this->getMethod()->additionalPaymentInformation($this->transactionInfo->getJsonResponse()); + } + + return ''; + } + + /** + * Returns the Short ID for this order/transaction. + * + * @return string + */ + public function getIdentificationNumber() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['IDENTIFICATION_SHORTID'])) { + return $this->transactionInfo->getJsonResponse()['IDENTIFICATION_SHORTID']; + } + + return '-'; + } + + /** + * Returns the Amount to be paid. + * + * @return string + */ + public function getPresentationAmount() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['PRESENTATION_AMOUNT'])) { + return $this->paymentHelper->format($this->transactionInfo->getJsonResponse()['PRESENTATION_AMOUNT']); + } + + return '-'; + } + + /** + * Returns the Currency of the Amount to be paid. + * + * @return string + */ + public function getPresentationCurrency() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + if (isset($this->transactionInfo->getJsonResponse()['PRESENTATION_CURRENCY'])) { + return $this->transactionInfo->getJsonResponse()['PRESENTATION_CURRENCY']; + } + + return '-'; + } + + /** + * Returns Transaction information, if a transaction ID is set. + * + * @return Transaction|null + */ + public function getTransactionInfo() + { + if ($this->transactionInfo === null) { + $this->loadTransactionInfo(); + } + + return $this->transactionInfo; + } + + /** + * Loads heidelpay transaction details by the last_trans_id of this order. + */ + private function loadTransactionInfo() + { + if ($this->getInfo()->getLastTransId() !== null) { + $factory = $this->transactionCollectionFactory->create(); + $this->transactionInfo = $factory->loadByTransactionId($this->getInfo()->getLastTransId()); + } + } +} diff --git a/Block/Info/Invoice.php b/Block/Info/Invoice.php index 7d6ca420465..7e622b2bd49 100644 --- a/Block/Info/Invoice.php +++ b/Block/Info/Invoice.php @@ -2,200 +2,24 @@ namespace Heidelpay\Gateway\Block\Info; -use Heidelpay\Gateway\Model\ResourceModel\Transaction\CollectionFactory as HeidelpayTransactionCollectionFactory; -use Heidelpay\Gateway\Model\Transaction; -use Magento\Framework\View\Element\Template; - /** - * Summary + * Heidelpay Invoice Info Block + * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. + * * @link https://dev.heidelpay.de/magento2 * @author Stephano Vogel - * @package heidelpay - * @subpackage magento2 - * @category magento2 + * + * @package heidelpay\magento2\block\info\invoice */ -class Invoice extends \Magento\Payment\Block\Info +class Invoice extends \Heidelpay\Gateway\Block\Info\AbstractBlock { - /** @var HeidelpayTransactionCollectionFactory */ - protected $transactionCollectionFactory; - - /** @var Transaction */ - protected $transactionInfo; - - /** - * @var \Heidelpay\Gateway\Helper\Payment - */ - protected $paymentHelper = null; - /** * @var string */ protected $_template = 'Heidelpay_Gateway::info/invoice.phtml'; - /** - * InvoiceSecured constructor. - * - * @param Template\Context $context - * @param HeidelpayTransactionCollectionFactory $collectionFactory - * @param \Heidelpay\Gateway\Helper\Payment $paymentHelper - * @param array $data - */ - public function __construct( - Template\Context $context, - HeidelpayTransactionCollectionFactory $collectionFactory, - \Heidelpay\Gateway\Helper\Payment $paymentHelper, - array $data = [] - ) { - $this->transactionCollectionFactory = $collectionFactory; - $this->paymentHelper = $paymentHelper; - - parent::__construct($context, $data); - } - - /** - * Returns the Connector Account Holder Name. - * - * @return string - */ - public function getAccountHolder() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_HOLDER'])) { - return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_HOLDER']; - } - - return '-'; - } - - /** - * Returns the Connector Account IBAN. - * - * @return string - */ - public function getAccountIban() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_IBAN'])) { - return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_IBAN']; - } - - return '-'; - } - - /** - * Returns the Connector Account BIC. - * - * @return string - */ - public function getAccountBic() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_BIC'])) { - return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_BIC']; - } - - return '-'; - } - - public function printAdditionalInformationHtml() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - return $this->getMethod()->additionalPaymentInformation($this->transactionInfo->getJsonResponse()); - } - - /** - * Returns the Short ID for this order/transaction. - * - * @return string - */ - public function getIdentificationNumber() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['IDENTIFICATION_SHORTID'])) { - return $this->transactionInfo->getJsonResponse()['IDENTIFICATION_SHORTID']; - } - - return '-'; - } - - /** - * Returns the Amount to be paid. - * - * @return string - */ - public function getPresentationAmount() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['PRESENTATION_AMOUNT'])) { - return $this->paymentHelper->format($this->transactionInfo->getJsonResponse()['PRESENTATION_AMOUNT']); - } - - return '-'; - } - - /** - * Returns the Currency of the Amount to be paid. - * - * @return string - */ - public function getPresentationCurrency() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['PRESENTATION_CURRENCY'])) { - return $this->transactionInfo->getJsonResponse()['PRESENTATION_CURRENCY']; - } - - return '-'; - } - - /** - * Returns Transaction information, if a transaction ID is set. - * - * @return Transaction|null - */ - public function getTransactionInfo() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - return $this->transactionInfo; - } - - /** - * Loads heidelpay transaction details by the last_trans_id of this order. - */ - private function loadTransactionInfo() - { - if ($this->getInfo()->getLastTransId() !== null) { - $factory = $this->transactionCollectionFactory->create(); - $this->transactionInfo = $factory->loadByTransactionId($this->getInfo()->getLastTransId()); - } - } - /** * @return string */ diff --git a/Block/Info/InvoiceSecured.php b/Block/Info/InvoiceSecured.php index aa4832c0a8c..7e8500c491b 100644 --- a/Block/Info/InvoiceSecured.php +++ b/Block/Info/InvoiceSecured.php @@ -2,240 +2,24 @@ namespace Heidelpay\Gateway\Block\Info; -use Heidelpay\Gateway\Model\ResourceModel\Transaction\CollectionFactory as HeidelpayTransactionCollectionFactory; -use Heidelpay\Gateway\Model\Transaction; -use Magento\Framework\View\Element\Template; - /** - * Summary + * Heidelpay InvoiceSecured Info Block Class + * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. + * * @link https://dev.heidelpay.de/magento2 * @author Stephano Vogel - * @package heidelpay - * @subpackage magento2 - * @category magento2 + * + * @package heidelpay\magento2\block\info\invoicesecured */ -class InvoiceSecured extends \Magento\Payment\Block\Info +class InvoiceSecured extends \Heidelpay\Gateway\Block\Info\AbstractBlock { - /** @var HeidelpayTransactionCollectionFactory */ - protected $transactionCollectionFactory; - - /** @var Transaction */ - protected $transactionInfo; - - /** - * @var \Heidelpay\Gateway\Helper\Payment - */ - protected $paymentHelper = null; - /** * @var string */ protected $_template = 'Heidelpay_Gateway::info/invoice_secured.phtml'; - /** - * InvoiceSecured constructor. - * - * @param Template\Context $context - * @param HeidelpayTransactionCollectionFactory $collectionFactory - * @param \Heidelpay\Gateway\Helper\Payment $paymentHelper - * @param array $data - */ - public function __construct( - Template\Context $context, - HeidelpayTransactionCollectionFactory $collectionFactory, - \Heidelpay\Gateway\Helper\Payment $paymentHelper, - array $data = [] - ) { - $this->transactionCollectionFactory = $collectionFactory; - $this->paymentHelper = $paymentHelper; - - parent::__construct($context, $data); - } - - /** - * Returns the Connector Account Holder Name. - * - * @return string - */ - public function getAccountHolder() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_HOLDER'])) { - return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_HOLDER']; - } - - return '-'; - } - - /** - * Returns the Connector Account IBAN. - * - * @return string - */ - public function getAccountIban() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_IBAN'])) { - return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_IBAN']; - } - - return '-'; - } - - /** - * Returns the Connector Account BIC. - * - * @return string - */ - public function getAccountBic() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_BIC'])) { - return $this->transactionInfo->getJsonResponse()['CONNECTOR_ACCOUNT_BIC']; - } - - return '-'; - } - - public function printAdditionalInformationHtml() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - return $this->getMethod()->additionalPaymentInformation($this->transactionInfo->getJsonResponse()); - } - - /** - * Returns the Customer Birthdate (provided in this order). - * - * @return string - */ - public function getCustomerBirthdate() - { - if (!$this->getIsSecureMode()) { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['NAME_BIRTHDATE'])) { - return $this->transactionInfo->getJsonResponse()['NAME_BIRTHDATE']; - } - } - - return '-'; - } - - /** - * Returns the Customer Salutation (provided in this order). - * - * @return string - */ - public function getCustomerSalutation() - { - if (!$this->getIsSecureMode()) { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['NAME_SALUTATION'])) { - return $this->transactionInfo->getJsonResponse()['NAME_SALUTATION']; - } - } - - return '-'; - } - - /** - * Returns the Short ID for this order/transaction. - * - * @return string - */ - public function getIdentificationNumber() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['IDENTIFICATION_SHORTID'])) { - return $this->transactionInfo->getJsonResponse()['IDENTIFICATION_SHORTID']; - } - - return '-'; - } - - /** - * Returns the Amount to be paid. - * - * @return string - */ - public function getPresentationAmount() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['PRESENTATION_AMOUNT'])) { - return $this->paymentHelper->format($this->transactionInfo->getJsonResponse()['PRESENTATION_AMOUNT']); - } - - return '-'; - } - - /** - * Returns the Currency of the Amount to be paid. - * - * @return string - */ - public function getPresentationCurrency() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - if (isset($this->transactionInfo->getJsonResponse()['PRESENTATION_CURRENCY'])) { - return $this->transactionInfo->getJsonResponse()['PRESENTATION_CURRENCY']; - } - - return '-'; - } - - /** - * Returns Transaction information, if a transaction ID is set. - * - * @return Transaction|null - */ - public function getTransactionInfo() - { - if ($this->transactionInfo === null) { - $this->loadTransactionInfo(); - } - - return $this->transactionInfo; - } - - /** - * Loads heidelpay transaction details by the last_trans_id of this order. - */ - private function loadTransactionInfo() - { - if ($this->getInfo()->getLastTransId() !== null) { - $factory = $this->transactionCollectionFactory->create(); - $this->transactionInfo = $factory->loadByTransactionId($this->getInfo()->getLastTransId()); - } - } - /** * @return string */ diff --git a/Block/Info/Prepayment.php b/Block/Info/Prepayment.php new file mode 100644 index 00000000000..ce0bf151b98 --- /dev/null +++ b/Block/Info/Prepayment.php @@ -0,0 +1,32 @@ +setTemplate('Heidelpay_Gateway::info/pdf/prepayment.phtml'); + return $this->toHtml(); + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 16768e1952f..2722bbb8d6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Release Notes - heidelpay Payment Gateway for Magento 2 +## 17.7.25 + +### Added +- Prepayment Invoice details in backend, e-mail and pdf invoices +- Customer's ip address will now be added to the payment api request + +### Fixed +- Fixed a missing redirect back to cart on nok transaction (error) responses +- Re-added the name input field in Secured Invoice +- Pre-filled 'undefined undefined undefined' in secured payment methods +- Removed readonly attribute in full name input (Secured Invoice) + +### Changed +- Changed 'Security Sender' to 'Sender-ID' in heidelpay backend configuration +- Reversed the order of the year selection in the secured payment method input forms + ## 17.7.14 ### Fixed diff --git a/Controller/Index/Response.php b/Controller/Index/Response.php index e339cfc8780..52ad3dffb62 100644 --- a/Controller/Index/Response.php +++ b/Controller/Index/Response.php @@ -201,6 +201,49 @@ public function execute() $data = $this->getRequest()->getParams(); + // save the heidelpay transaction data + list($paymentMethod, $paymentType) = $this->_paymentHelper->splitPaymentCode( + $this->heidelpayResponse->getPayment()->getCode() + ); + + try { + // save the response details into the heidelpay Transactions table. + $transaction = $this->transactionFactory->create(); + $transaction->setPaymentMethod($paymentMethod) + ->setPaymentType($paymentType) + ->setTransactionId($this->heidelpayResponse->getIdentification()->getTransactionId()) + ->setUniqueId($this->heidelpayResponse->getIdentification()->getUniqueId()) + ->setShortId($this->heidelpayResponse->getIdentification()->getShortId()) + ->setStatusCode($this->heidelpayResponse->getProcessing()->getStatusCode()) + ->setResult($this->heidelpayResponse->getProcessing()->getResult()) + ->setReturnMessage($this->heidelpayResponse->getProcessing()->getReturn()) + ->setReturnCode($this->heidelpayResponse->getProcessing()->getReturnCode()) + ->setJsonResponse(json_encode($data)) + ->setSource('RESPONSE') + ->save(); + } catch (\Exception $e) { + $this->_logger->error('Heidelpay - Response: Save transaction error. ' . $e->getMessage()); + } + + // if something went wrong, return the redirect url without processing the order. + if ($this->heidelpayResponse->isError()) { + $message = sprintf( + 'Heidelpay - Response is NOK. Message: [%s], Reason: [%s] (%d), Code: [%s], Status: [%s] (%d)', + $this->heidelpayResponse->getError()['message'], + $this->heidelpayResponse->getProcessing()->reason, + $this->heidelpayResponse->getProcessing()->reason_code, + $this->heidelpayResponse->getError()['code'], + $this->heidelpayResponse->getProcessing()->status, + $this->heidelpayResponse->getProcessing()->getStatusCode() + ); + + $this->_logger->debug($message); + + // return the heidelpay response url as raw response instead of echoing it out. + $result->setContents($redirectUrl); + return $result; + } + if ($this->heidelpayResponse->isSuccess()) { try { // get the quote by transactionid from the heidelpay response @@ -255,23 +298,6 @@ public function execute() $this->_logger->debug('Heidelpay - Response: redirectUrl is ' . $redirectUrl); - list($paymentMethod, $paymentType) = $this->_paymentHelper->splitPaymentCode( - $this->heidelpayResponse->getPayment()->getCode() - ); - - try { - // save the response details into the heidelpay Transactions table. - $order->getPayment()->getMethodInstance()->saveHeidelpayTransaction( - $this->heidelpayResponse, - $paymentMethod, - $paymentType, - 'RESPONSE', - $data - ); - } catch (\Exception $e) { - $this->_logger->error('Heidelpay - Response: Save transaction error. ' . $e->getMessage()); - } - // return the heidelpay response url as raw response instead of echoing it out. $result->setContents($redirectUrl); return $result; diff --git a/PaymentMethods/HeidelpayAbstractPaymentMethod.php b/PaymentMethods/HeidelpayAbstractPaymentMethod.php index 0fffd85cadc..faca49824b0 100644 --- a/PaymentMethods/HeidelpayAbstractPaymentMethod.php +++ b/PaymentMethods/HeidelpayAbstractPaymentMethod.php @@ -498,6 +498,9 @@ public function getHeidelpayUrl($quote) $this->_encryptor->exportKeys() // A secret passphrase from your application ); + // add the customer ip address + $this->_heidelpayPaymentMethod->getRequest()->getContact()->set('ip', $quote->getRemoteIp()); + // add the Magento Version to the heidelpay request $this->_heidelpayPaymentMethod->getRequest()->getCriterion()->set( 'SHOP.TYPE', diff --git a/PaymentMethods/HeidelpayPrepaymentPaymentMethod.php b/PaymentMethods/HeidelpayPrepaymentPaymentMethod.php index 218d7bc11f1..3c684a643c9 100644 --- a/PaymentMethods/HeidelpayPrepaymentPaymentMethod.php +++ b/PaymentMethods/HeidelpayPrepaymentPaymentMethod.php @@ -33,6 +33,12 @@ class HeidelpayPrepaymentPaymentMethod extends HeidelpayAbstractPaymentMethod */ protected $_code = 'hgwpp'; + /** + * Info Block Class (used for Order/Invoice details) + * @var string + */ + protected $_infoBlockType = 'Heidelpay\Gateway\Block\Info\Prepayment'; + /** * isGateway * @var boolean diff --git a/README.md b/README.md index 76801d7b36e..f5e56473603 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ All versions greater than 16.10.17 are based on the heidelpay php-api. (https:// ### Install the heidelpay Magento 2 composer package -```composer require "heidelpay/magento2:17.6.16"``` +```composer require "heidelpay/magento2:17.7.25"``` ### Enable the extension in Magento 2 diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 86c72d28bc6..5108e286f1b 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -9,7 +9,7 @@ - + payment/hgwmain/security_sender @@ -51,7 +51,7 @@ Heidelpay\Gateway\Model\Config\Source\BookingMode payment/hgwcc/bookingmode - If 'Debit' is enabled, the card will be charged immediately. Otherwise the amount will just be authorised. + If 'Debit' is enabled the card will be charged immediately. Otherwise the amount will first be authorised and charged at order creation. @@ -96,7 +96,7 @@ Heidelpay\Gateway\Model\Config\Source\BookingMode payment/hgwdc/bookingmode - If 'Debit' is enabled, the card will be charged immediately. Otherwise the amount will just be authorised. + If 'Debit' is enabled the card will be charged immediately. Otherwise the amount will first be authorised and charged at order creation. diff --git a/etc/module.xml b/etc/module.xml index 7e42c702e8d..6ceb6b7c9b6 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,5 +1,5 @@ - + diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 5ca9f8a2fc4..48cf556fc04 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -21,7 +21,7 @@ "Enabled","Aktiviert" "Channel","Kanal-ID" "Insert 0 to disable limit.","Tragen Sie 0 ein um das Limit zu deaktivieren." -"If this is enabled the card will be charged immediately. Otherwise the amount will just be authorised.","Wenn diese Einstellung auf Ja steht, wird die Karte sofort belastet. Ansonsten wird der Betrag nur reserviert." +"If 'Debit' is enabled the card will be charged immediately. Otherwise the amount will first be authorised and charged at order creation.","Wenn diese Einstellung auf Ja steht, wird die Karte sofort belastet. Ansonsten wird der Betrag nur reserviert und bei erstellter Bestellung abgebucht." "An unexpected error occurred. Please contact us to get further information.","Es ist ein Fehler aufgetreten. Bitte kontaktieren Sie uns für weitere Informationen." "Never","Nie" diff --git a/view/adminhtml/templates/info/invoice.phtml b/view/adminhtml/templates/info/invoice.phtml new file mode 100644 index 00000000000..1d02004ff79 --- /dev/null +++ b/view/adminhtml/templates/info/invoice.phtml @@ -0,0 +1,39 @@ + +
+ escapeHtml($block->getMethod()->getTitle()); ?> +
+ + getTransactionInfo() !== null) : ?> + + + + + + + + + + + + + + + + + + + + +
+ escapeHtml(__('Heidelpay Payment Information')); ?> +
escapeHtml(__('Account Holder')); ?>:escapeHtml($block->getAccountHolder()); ?>
escapeHtml(__('IBAN')); ?>:escapeHtml($block->getAccountIban()); ?>
escapeHtml(__('BIC')); ?>:escapeHtml($block->getAccountBic()); ?>
escapeHtml(__('Identification Number')); ?>:escapeHtml($block->getIdentificationNumber()); ?>
diff --git a/view/adminhtml/templates/info/pdf/invoice.phtml b/view/adminhtml/templates/info/pdf/invoice.phtml new file mode 100644 index 00000000000..da74458ab72 --- /dev/null +++ b/view/adminhtml/templates/info/pdf/invoice.phtml @@ -0,0 +1,21 @@ + +escapeHtml($block->getMethod()->getTitle()); ?> + {{pdf_row_separator}} +escapeHtml($block->getAccountHolder()); ?> + {{pdf_row_separator}} +escapeHtml($block->getAccountIban()); ?> + {{pdf_row_separator}} +escapeHtml($block->getAccountBic()); ?> + {{pdf_row_separator}} +escapeHtml($block->getIdentificationNumber()); ?> + {{pdf_row_separator}} diff --git a/view/adminhtml/templates/info/pdf/invoice_secured.phtml b/view/adminhtml/templates/info/pdf/invoice_secured.phtml index 892fceca5f2..56f71fd2c36 100644 --- a/view/adminhtml/templates/info/pdf/invoice_secured.phtml +++ b/view/adminhtml/templates/info/pdf/invoice_secured.phtml @@ -17,5 +17,5 @@ {{pdf_row_separator}} escapeHtml($block->getAccountBic()); ?> {{pdf_row_separator}} -escapeHtml($block->getIdentificationNumber()); ?> +escapeHtml($block->getIdentificationNumber()); ?> {{pdf_row_separator}} \ No newline at end of file diff --git a/view/adminhtml/templates/info/pdf/prepayment.phtml b/view/adminhtml/templates/info/pdf/prepayment.phtml new file mode 100644 index 00000000000..2d32c8af8a4 --- /dev/null +++ b/view/adminhtml/templates/info/pdf/prepayment.phtml @@ -0,0 +1,21 @@ + +escapeHtml($block->getMethod()->getTitle()); ?> + {{pdf_row_separator}} +escapeHtml($block->getAccountHolder()); ?> + {{pdf_row_separator}} +escapeHtml($block->getAccountIban()); ?> + {{pdf_row_separator}} +escapeHtml($block->getAccountBic()); ?> + {{pdf_row_separator}} +escapeHtml($block->getIdentificationNumber()); ?> + {{pdf_row_separator}} \ No newline at end of file diff --git a/view/adminhtml/templates/info/prepayment.phtml b/view/adminhtml/templates/info/prepayment.phtml new file mode 100644 index 00000000000..1ccfae724cf --- /dev/null +++ b/view/adminhtml/templates/info/prepayment.phtml @@ -0,0 +1,39 @@ + +
+ escapeHtml($block->getMethod()->getTitle()); ?> +
+ + getTransactionInfo() !== null) : ?> + + + + + + + + + + + + + + + + + + + + +
+ escapeHtml(__('Heidelpay Payment Information')); ?> +
escapeHtml(__('Account Holder')); ?>:escapeHtml($block->getAccountHolder()); ?>
escapeHtml(__('IBAN')); ?>:escapeHtml($block->getAccountIban()); ?>
escapeHtml(__('BIC')); ?>:escapeHtml($block->getAccountBic()); ?>
escapeHtml(__('Identification Number')); ?>:escapeHtml($block->getIdentificationNumber()); ?>
diff --git a/view/frontend/templates/info/invoice.phtml b/view/frontend/templates/info/invoice.phtml index 3cd33a7aa77..43e88bfa2c5 100644 --- a/view/frontend/templates/info/invoice.phtml +++ b/view/frontend/templates/info/invoice.phtml @@ -11,7 +11,7 @@ ?>
escapeHtml($block->getMethod()->getTitle()) ?>
- getTransactionInfo() !== null) : ?> + getTransactionInfo() !== null && ! empty($block->printAdditionalInformationHtml())) : ?>
escapeHtml(__('Payment information')) ?>
printAdditionalInformationHtml() ?> diff --git a/view/frontend/templates/info/invoice_secured.phtml b/view/frontend/templates/info/invoice_secured.phtml index a43719fde6f..189198a4e93 100644 --- a/view/frontend/templates/info/invoice_secured.phtml +++ b/view/frontend/templates/info/invoice_secured.phtml @@ -11,7 +11,7 @@ ?>
escapeHtml($block->getMethod()->getTitle()) ?>
- getTransactionInfo() !== null) : ?> + getTransactionInfo() !== null && ! empty($block->printAdditionalInformationHtml())) : ?>
escapeHtml(__('Payment information')) ?>
printAdditionalInformationHtml() ?> diff --git a/view/frontend/templates/info/prepayment.phtml b/view/frontend/templates/info/prepayment.phtml new file mode 100644 index 00000000000..9f45099b532 --- /dev/null +++ b/view/frontend/templates/info/prepayment.phtml @@ -0,0 +1,20 @@ + +
+
escapeHtml($block->getMethod()->getTitle()) ?>
+ getTransactionInfo() !== null && ! empty($block->printAdditionalInformationHtml())) : ?> +
+ escapeHtml(__('Payment information')) ?>
+ printAdditionalInformationHtml() ?> +
+ +
\ No newline at end of file diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js b/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js index 60de570b72b..8e12fefcfd4 100644 --- a/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js +++ b/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js @@ -6,9 +6,10 @@ define( 'Magento_Checkout/js/model/payment/additional-validators', 'Magento_Checkout/js/action/select-payment-method', 'Magento_Checkout/js/checkout-data', + 'Magento_Checkout/js/model/quote', 'moment' ], - function ($, Component, placeOrderAction, additionalValidators, selectPaymentMethodAction, checkoutData) { + function ($, Component, placeOrderAction, additionalValidators, selectPaymentMethodAction, checkoutData, quote) { 'use strict'; // add IBAN validator @@ -60,13 +61,38 @@ define( * Function to receive the customer's full name. */ getFullName: function() { - var name = ''; + var name = '', billingAddress = quote.billingAddress(); - name += window.customerData.firstname; - if (window.customerData.middlename !== null) { - name += ' ' + window.customerData.middlename; + if (typeof billingAddress !== 'undefined') { + if (typeof billingAddress.firstname !== 'undefined' && billingAddress.firstname !== null) { + name += billingAddress.firstname; + } + + if (typeof billingAddress.middlename !== 'undefined' && billingAddress.middlename !== null) { + name += ' ' + billingAddress.middlename; + } + + if (typeof billingAddress.lastname !== 'undefined' && billingAddress.lastname !== null) { + name += ' ' + billingAddress.lastname; + } + } + + // fallback, if name isn't set yet. + if (name === '') { + var tmpName = window.customerData; + + if (typeof tmpName.firstname !== 'undefined' && tmpName.firstname !== null) { + name += tmpName.firstname; + } + + if (typeof tmpName.middlename !== 'undefined' && tmpName.middlename !== null) { + name += ' ' + tmpName.middlename; + } + + if (typeof tmpName.lastname !== 'undefined' && tmpName.lastname !== null) { + name += ' ' + tmpName.lastname; + } } - name += ' ' + window.customerData.lastname; return name; }, diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-directdebit.js b/view/frontend/web/js/view/payment/method-renderer/hgw-directdebit.js index 68ce19732ab..b7a063fd8d5 100644 --- a/view/frontend/web/js/view/payment/method-renderer/hgw-directdebit.js +++ b/view/frontend/web/js/view/payment/method-renderer/hgw-directdebit.js @@ -30,6 +30,10 @@ define( this._super(); this.getAdditionalPaymentInformation(); + if (! this.hgwHolder()) { + this.hgwHolder(this.getFullName()); + } + return this; }, diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js b/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js index c5c06b004b4..14abd5df1ba 100644 --- a/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js +++ b/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js @@ -37,10 +37,15 @@ define( this.getAdditionalPaymentInformation(); // init years select menu - for (var i = new Date().getFullYear() - 100; i <= (new Date().getFullYear() - 17); i++) { + for (var i = (new Date().getFullYear() - 17); i >= new Date().getFullYear() - 120; i--) { this.years.push(i); } + // pre-fill the holder with the billing name, if it does not exist yet. + if (! this.hgwHolder()) { + this.hgwHolder(this.getFullName()); + } + return this; }, diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js b/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js index 5aaeadf0fa9..910186ff541 100644 --- a/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js +++ b/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js @@ -35,7 +35,7 @@ define( this.getAdditionalPaymentInformation(); // init years select menu - for (var i = new Date().getFullYear() - 100; i <= (new Date().getFullYear() - 17); i++) { + for (var i = (new Date().getFullYear() - 17); i >= new Date().getFullYear() - 120; i--) { this.years.push(i); } diff --git a/view/frontend/web/template/payment/heidelpay-invoice-secured-form.html b/view/frontend/web/template/payment/heidelpay-invoice-secured-form.html index a3375192343..a964eab8963 100644 --- a/view/frontend/web/template/payment/heidelpay-invoice-secured-form.html +++ b/view/frontend/web/template/payment/heidelpay-invoice-secured-form.html @@ -46,9 +46,10 @@
- + data-validate="{required: true}" + data-bind='value: getFullName()' />