This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from heidelpay/develop
Release 17.4.16 - Secured Invoice and heidelpay Push notifications
- Loading branch information
Showing
45 changed files
with
1,955 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,247 @@ | ||
<?php | ||
|
||
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 | ||
* @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 | ||
*/ | ||
class InvoiceSecured extends \Magento\Payment\Block\Info | ||
{ | ||
/** @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 | ||
*/ | ||
public function toPdf() | ||
{ | ||
$this->setTemplate('Heidelpay_Gateway::info/pdf/invoice_secured.phtml'); | ||
return $this->toHtml(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.