-
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 remote-tracking branch 'origin/master' into MAG2-283-BNPL-categ…
…ory-url
- Loading branch information
Showing
74 changed files
with
1,789 additions
and
867 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build and Test with PHP 8.2 and Magento 2.6 | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 15 | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: ['8.2'] | ||
magento-versions: ['2.4.6'] | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.0.20 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@master | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, gd, bcmath, ctype, curl, dom, hash, iconv, intl, openssl, simplexml, soap, xsl, zip | ||
tools: composer:v2.1 | ||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Configure sysctl limits | ||
run: | | ||
sudo swapoff -a | ||
sudo sysctl -w vm.swappiness=1 | ||
sudo sysctl -w fs.file-max=262144 | ||
sudo sysctl -w vm.max_map_count=262144 | ||
- name: PHP Syntax Checker | ||
run: find . -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) | ||
|
||
- name: Setup Magento 2 and run tests | ||
run: | | ||
mysql -u root --password=root -h 127.0.0.1 -e 'CREATE DATABASE IF NOT EXISTS magento;' | ||
git clone --depth=1 -b ${{ matrix.magento-versions }} https://github.com/magento/magento2 /tmp/build | ||
cd /tmp/build | ||
composer update | ||
php bin/magento setup:install --base-url=http://magebuild.integrations.p1-test.de/build/ \ | ||
--db-host=127.0.0.1 --db-name=magento --db-user=root --db-password=root --admin-firstname=Dieter \ | ||
--admin-lastname=Demo [email protected] --admin-user=DieterDemo \ | ||
--admin-password=72q980hdfq2378ga9w87dg6 --language=de_DE --currency=EUR --timezone=Europe/Berlin \ | ||
--disable-modules=Magento_Elasticsearch7,Magento_Elasticsearch,Magento_OpenSearch | ||
composer require --ignore-platform-reqs payone-gmbh/magento-2 dev-master | ||
rm -rf /tmp/build/vendor/payone-gmbh/magento-2/* | ||
cp -R $GITHUB_WORKSPACE/* /tmp/build/vendor/payone-gmbh/magento-2 | ||
php bin/magento setup:upgrade | ||
php bin/magento setup:di:compile | ||
php bin/magento cache:clean | ||
sed -i 's+>allure/allure.config.php<+>dev/tests/unit/allure/allure.config.php<+g' dev/tests/unit/phpunit.xml.dist | ||
./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist vendor/payone-gmbh/magento-2/Test/Unit | ||
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ jobs: | |
steps: | ||
- 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
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.