-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of ssh://github.com/PAYONE-GmbH/magento-2
- Loading branch information
Showing
74 changed files
with
1,608 additions
and
254 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 |
---|---|---|
|
@@ -6,6 +6,6 @@ jobs: | |
gitleaks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/checkout@v3 | ||
- name: gitleaks-action | ||
uses: gitleaks/[email protected].0 | ||
uses: FatchipRobert/[email protected].1 |
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,44 @@ | ||
<?php | ||
|
||
/** | ||
* PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PAYONE Magento 2 Connector 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 Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* PHP version 8 | ||
* | ||
* @category Payone | ||
* @package Payone_Magento2_Plugin | ||
* @author FATCHIP GmbH <[email protected]> | ||
* @copyright 2003 - 2023 Payone GmbH | ||
* @license <http://www.gnu.org/licenses/> GNU Lesser General Public License | ||
* @link http://www.payone.de | ||
*/ | ||
|
||
namespace Payone\Core\Api\Data; | ||
|
||
interface RatepayConfigResponseInterface | ||
{ | ||
/** | ||
* Returns if editing the address was a success | ||
* | ||
* @return bool | ||
*/ | ||
public function getSuccess(); | ||
|
||
/** | ||
* Returns config json array | ||
* | ||
* @return string | ||
*/ | ||
public function getConfig(); | ||
} |
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,40 @@ | ||
<?php | ||
|
||
/** | ||
* PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PAYONE Magento 2 Connector 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 Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* PHP version 8 | ||
* | ||
* @category Payone | ||
* @package Payone_Magento2_Plugin | ||
* @author FATCHIP GmbH <[email protected]> | ||
* @copyright 2003 - 2023 Payone GmbH | ||
* @license <http://www.gnu.org/licenses/> GNU Lesser General Public License | ||
* @link http://www.payone.de | ||
*/ | ||
|
||
namespace Payone\Core\Api; | ||
|
||
interface RatepayConfigInterface | ||
{ | ||
/** | ||
* PAYONE editAddress script | ||
* The full class-paths must be given here otherwise the Magento 2 WebApi | ||
* cant handle this with its fake type system! | ||
* | ||
* @param string $cartId | ||
* @return \Payone\Core\Service\V1\Data\RatepayConfigResponse | ||
*/ | ||
public function getConfig($cartId); | ||
} |
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,188 @@ | ||
<?php | ||
|
||
namespace Payone\Core\Block\Form; | ||
|
||
use Payone\Core\Model\PayoneConfig; | ||
|
||
class RatepayInvoice extends Base | ||
{ | ||
/** | ||
* @var \Magento\Sales\Model\AdminOrder\Create | ||
*/ | ||
protected $orderCreate; | ||
|
||
/** | ||
* @var \Payone\Core\Helper\Ratepay | ||
*/ | ||
protected $ratepayHelper; | ||
|
||
/** | ||
* @var array|null | ||
*/ | ||
protected $ratepayConfig = null; | ||
|
||
/** | ||
* @param \Magento\Framework\View\Element\Template\Context $context | ||
* @param \Magento\Sales\Model\AdminOrder\Create $orderCreate | ||
* @param \Payone\Core\Helper\Ratepay $ratepayHelper | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\View\Element\Template\Context $context, | ||
\Magento\Sales\Model\AdminOrder\Create $orderCreate, | ||
\Payone\Core\Helper\Ratepay $ratepayHelper, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->orderCreate = $orderCreate; | ||
$this->ratepayHelper = $ratepayHelper; | ||
} | ||
|
||
/** | ||
* Retrieve create order model object | ||
* | ||
* @return \Magento\Quote\Model\Quote | ||
*/ | ||
public function getQuote() | ||
{ | ||
return $this->orderCreate->getQuote(); | ||
} | ||
|
||
/** | ||
* Tries to determine a matching ratepay configuration | ||
* | ||
* @return array | ||
*/ | ||
public function getRatepayConfig() | ||
{ | ||
if ($this->ratepayConfig === null) { | ||
$this->ratepayConfig = $this->ratepayHelper->getRatepaySingleConfig(PayoneConfig::METHOD_RATEPAY_INVOICE, $this->getQuote()); | ||
} | ||
return $this->ratepayConfig; | ||
} | ||
|
||
/** | ||
* Returns snippet id from config | ||
* | ||
* @return string | ||
*/ | ||
public function getDevicefingerprintSnippetId() | ||
{ | ||
return $this->ratepayHelper->getConfigParam('devicefingerprint_snippet_id', 'ratepay', 'payone_misc'); | ||
} | ||
|
||
/** | ||
* Returns token generated by Ratepay helper | ||
* | ||
* @return string | ||
*/ | ||
public function getDevicefingerprintToken() | ||
{ | ||
return $this->ratepayHelper->getRatepayDeviceFingerprintToken(); | ||
} | ||
|
||
/** | ||
* Returns if birthday has to be entered | ||
* | ||
* @return bool | ||
*/ | ||
public function isBirthdayNeeded() | ||
{ | ||
if ($this->isB2BMode() === true) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* Return if customer has entered a company name in his billing address | ||
* | ||
* @return bool | ||
*/ | ||
public function isB2BMode() | ||
{ | ||
$billingAddress = $this->getQuote()->getBillingAddress(); | ||
if ($billingAddress && !empty($billingAddress->getCompany())) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Return if ratepay config allows B2B mode | ||
* | ||
* @return bool | ||
*/ | ||
public function isB2BModeAllowed() | ||
{ | ||
$aConfig = $this->getRatepayConfig(); | ||
if (isset($aConfig['b2bAllowed'])) { | ||
return (bool)$aConfig['b2bAllowed']; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Return if ratepay config allows differing delivery addresses | ||
* | ||
* @return bool | ||
*/ | ||
public function isDifferingDeliveryAddressAllowed() | ||
{ | ||
$aConfig = $this->getRatepayConfig(); | ||
if (isset($aConfig['differentAddressAllowed'])) { | ||
return (bool)$aConfig['differentAddressAllowed']; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Returns if billing address is different as shipping address | ||
* | ||
* @return true | ||
*/ | ||
public function hasDifferingDeliveryAddress() | ||
{ | ||
return !$this->getQuote()->getShippingAddress()->getSameAsBilling(); | ||
} | ||
|
||
/** | ||
* Returns the customers birthday if known | ||
* | ||
* @return string | ||
*/ | ||
public function getBirthday() | ||
{ | ||
return $this->getQuote()->getCustomer()->getDob(); | ||
} | ||
|
||
/** | ||
* Returns a part of the birthday (day, month or year) | ||
* | ||
* @param string $sPart | ||
* @return string | ||
*/ | ||
public function getBirthdayPart($sPart) | ||
{ | ||
$sBirthday = $this->getBirthday(); | ||
if (!empty($sBirthday)) { | ||
$timestamp = strtotime($sBirthday); | ||
return date($sPart, $timestamp); | ||
} | ||
return ''; | ||
} | ||
|
||
/** | ||
* Returns if the telephone number has to be entered | ||
* | ||
* @return bool | ||
*/ | ||
public function isTelephoneNeeded() | ||
{ | ||
$billingAddress = $this->getQuote()->getBillingAddress(); | ||
if ($billingAddress && !empty($billingAddress->getTelephone())) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
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
Oops, something went wrong.