-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 77105ae
Showing
60 changed files
with
4,321 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/vendor/ | ||
*.zip | ||
/.idea |
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,35 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__ . '/src') | ||
; | ||
|
||
$header = <<<EOF | ||
@copyright 2019 Crehler Sp. z o. o. | ||
https://crehler.com/ | ||
[email protected] | ||
This file is part of the PayU plugin for Shopware 6. | ||
All rights reserved. | ||
EOF; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setUsingCache(false) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'@Symfony' => true, | ||
'header_comment' => ['header' => $header, 'separate' => 'bottom', 'commentType' => 'PHPDoc'], | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_imports' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_summary' => false, | ||
'blank_line_after_opening_tag' => false, | ||
'concat_space' => ['spacing' => 'one'], | ||
'array_syntax' => ['syntax' => 'short'], | ||
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], | ||
]) | ||
->setFinder($finder) | ||
; |
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,83 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo -e "\e[92m######################################################################" | ||
echo -e "\e[92m# #" | ||
echo -e "\e[92m# Start PayU Builder #" | ||
echo -e "\e[92m# #" | ||
echo -e "\e[92m######################################################################" | ||
|
||
echo -e "Release" | ||
echo -e "\e[39m " | ||
echo -e "\e[39m======================================================================" | ||
echo -e "\e[39m " | ||
echo -e "Step 1 of 7 \e[33mRemove old release\e[39m" | ||
# Remove old release | ||
rm -rf CrehlerPayU CrehlerPayU-*.zip | ||
echo -e "\e[32mOK" | ||
|
||
echo -e "\e[39m " | ||
echo -e "\e[39m======================================================================" | ||
echo -e "\e[39m " | ||
echo -e "Step 2 of 7 \e[33mBuild\e[39m" | ||
cd ../../../ | ||
./bin/build-storefront.sh | ||
./bin/build-administration.sh | ||
cd custom/plugins/PayU/ | ||
echo -e "\e[32mOK" | ||
|
||
echo -e "\e[39m " | ||
echo -e "\e[39m======================================================================" | ||
echo -e "\e[39m " | ||
echo -e "Step 3 of 7 \e[33mCopy files\e[39m" | ||
rsync -av --progress . CrehlerPayU --exclude CrehlerPayU | ||
echo -e "\e[32mOK" | ||
|
||
|
||
echo -e "\e[39m " | ||
echo -e "\e[39m======================================================================" | ||
echo -e "\e[39m " | ||
echo -e "Step 4 of 7 \e[33mGo to directory\e[39m" | ||
cd CrehlerPayU | ||
echo -e "\e[32mOK" | ||
|
||
echo -e "\e[39m " | ||
echo -e "\e[39m======================================================================" | ||
echo -e "\e[39m " | ||
echo -e "Step 5 of 7 \e[33mDeleting unnecessary files\e[39m" | ||
cd .. | ||
( find ./CrehlerPayU -type d -name ".git" && find ./CrehlerPayU -name ".gitignore" && find ./CrehlerPayU -name "yarn.lock" && find ./CrehlerPayU -name ".php_cs.dist" && find ./CrehlerPayU -name ".gitmodules" && find ./CrehlerPayU -name "build.sh" ) | xargs rm -r | ||
cd CrehlerPayU/src/Resources | ||
rm -rf administration | ||
cd ../../../ | ||
echo -e "\e[32mOK" | ||
|
||
|
||
echo -e "\e[39m " | ||
echo -e "\e[39m======================================================================" | ||
echo -e "\e[39m " | ||
echo -e "Step 6 of 7 \e[33mCreate ZIP\e[39m" | ||
zip -rq CrehlerPayU-master.zip CrehlerPayU | ||
echo -e "\e[32mOK" | ||
|
||
echo -e "\e[39m " | ||
echo -e "\e[39m======================================================================" | ||
echo -e "\e[39m " | ||
echo -e "Step 7 of 7 \e[33mClear build directory\e[39m" | ||
rm -rf CrehlerPayU | ||
echo -e "\e[32mOK" | ||
|
||
|
||
echo -e "\e[92m######################################################################" | ||
echo -e "\e[92m# #" | ||
echo -e "\e[92m# Build Complete #" | ||
echo -e "\e[92m# #" | ||
echo -e "\e[92m######################################################################" | ||
echo -e "\e[39m " | ||
echo " _____ _ _ "; | ||
echo " / ____| | | | | "; | ||
echo " | | _ __ ___| |__ | | ___ _ __ "; | ||
echo " | | | '__/ _ \ '_ \| |/ _ \ '__|"; | ||
echo " | |____| | | __/ | | | | __/ | "; | ||
echo " \_____|_| \___|_| |_|_|\___|_| "; | ||
echo " "; | ||
echo " "; |
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,48 @@ | ||
{ | ||
"name": "crehler/payu", | ||
"description": "PayU integration for Shopware 6", | ||
"type": "shopware-platform-plugin", | ||
"license": "proprietary", | ||
"version": "1.1.0", | ||
"authors": [ | ||
{ | ||
"name": "Crehler Sp. z o. o.", | ||
"email": "[email protected]", | ||
"homepage": "https://crehler.com", | ||
"role": "Owner" | ||
} | ||
], | ||
"support": { | ||
"email": "[email protected]" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Crehler\\PayU\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"shopware-plugin-class": "Crehler\\PayU\\CrehlerPayU", | ||
"plugin-icon": "src/Resources/config/plugin.png", | ||
"copyright": "(c) by Crehler Sp. z o. o.", | ||
"label": { | ||
"de-DE": "PayU von CREHLER", | ||
"en-GB": "PayU by CREHLER", | ||
"pl-PL": "PayU od CREHLER" | ||
}, | ||
"description": { | ||
"de-DE": "Dank unseres kostenlosen Plugins, können Sie schnell und einfach mit PayU bezahlen. Auf diese Weise, bieten Sie Ihren Kunden aus Polen die Option, über den nationalen Zahlungsdienst PayU zu bestellen.", | ||
"en-GB": "Thanks to our free plugin, you can make payments via PayU quickly and easily. This way, you offer your customers from Poland the opportunity to make orders via the national payment service provider PayU.", | ||
"pl-PL": "Dzięki tej darmowej wtyczce, Twoi klienci będą wstanie dokonać płatności za pomocą najbardziej popularnych i wygodnych metod, które dostarcza platforma PayU." | ||
}, | ||
"manufacturerLink": { | ||
"de-DE": "https://store.shopware.com/crehler.html", | ||
"en-GB": "https://store.shopware.com/en/crehler.html" | ||
} | ||
}, | ||
"require": { | ||
"shopware/core": "^6.4", | ||
"shopware/storefront": "^6.4", | ||
"openpayu/openpayu": "^2.2" | ||
}, | ||
"minimum-stability": "RC" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* @copyright 2019 Crehler Sp. z o. o. | ||
* | ||
* https://crehler.com/ | ||
* [email protected] | ||
* | ||
* This file is part of the PayU plugin for Shopware 6. | ||
* All rights reserved. | ||
*/ | ||
|
||
namespace Crehler\PayU\Controller\Api; | ||
|
||
use Crehler\PayU\Service\PayU\ConfigurationService; | ||
use Crehler\PayU\Util\PayuMethodFinder; | ||
use Psr\Log\LoggerInterface; | ||
use Shopware\Core\Framework\Context; | ||
use Shopware\Core\Framework\Routing\Annotation\RouteScope; | ||
use Shopware\Core\System\SystemConfig\SystemConfigService; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
/** | ||
* @RouteScope(scopes={"api"}) | ||
*/ | ||
class ConfigurationController extends AbstractController | ||
{ | ||
/** @var LoggerInterface */ | ||
private $logger; | ||
|
||
/** @var ConfigurationService */ | ||
private $settingsService; | ||
|
||
/** @var PayuMethodFinder */ | ||
private $methodFinder; | ||
|
||
private SystemConfigService $systemConfigService; | ||
|
||
public function __construct( | ||
LoggerInterface $logger, | ||
ConfigurationService $settingsService, | ||
PayuMethodFinder $methodFinder, | ||
SystemConfigService $systemConfigService | ||
) { | ||
$this->logger = $logger; | ||
$this->settingsService = $settingsService; | ||
$this->methodFinder = $methodFinder; | ||
$this->systemConfigService = $systemConfigService; | ||
} | ||
|
||
/** | ||
* @Route( | ||
* "/api/crehler/payu/sales-channel-payment-configuration-notification", | ||
* name="api.crehler.payu.sales-channel-payment-configuration-notification", | ||
* methods={"POST"} | ||
* ) | ||
* | ||
* @param Request $request | ||
* @param Context $context | ||
* @return JsonResponse | ||
*/ | ||
public function salesChannelPaymentConfigurationNotification(Request $request, Context $context): JsonResponse | ||
{ | ||
$paymentMethodIds = $request->get('paymentMethodIds'); | ||
|
||
if (!in_array($this->methodFinder->getPayUPaymentMethodId($context), $paymentMethodIds)) { | ||
return new JsonResponse(['error' => false]); | ||
} | ||
|
||
if (!$this->settingsService->isCompleteConfiguration()) { | ||
return new JsonResponse(['error' => true]); | ||
} | ||
|
||
return new JsonResponse(['error' => false, 'sandbox' => $this->settingsService->isSadBox(), 'credentials' => $this->settingsService->checkSavedCredentials($request)]); | ||
} | ||
|
||
/** | ||
* @Route( | ||
* "/api/crehler/payu/check-credentials", | ||
* name="api.crehler.payu.check-credentials", | ||
* methods={"POST"} | ||
* ) | ||
* | ||
* @param Request $request | ||
* | ||
* @return JsonResponse | ||
*/ | ||
public function checkCredentials(Request $request): JsonResponse | ||
{ | ||
try { | ||
$result = $this->settingsService->checkRequestCredentials($request); | ||
} catch (\Exception $e) { | ||
$result = false; | ||
} | ||
|
||
return $this->json($result); | ||
} | ||
} |
Oops, something went wrong.