Skip to content

Commit

Permalink
Release 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vttn committed Jun 30, 2020
1 parent 92d00c4 commit c483ff9
Show file tree
Hide file tree
Showing 37 changed files with 438 additions and 346 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.1.3
- [WAL-8526] Make line item consistency default
- [WAL-8526] Confirm transaction right away
- [WAL-8526] Update settings descriptions

# 1.1.2
- Prepare internal server side install for showcases and demos

Expand Down
11 changes: 0 additions & 11 deletions bin/server-side-install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@
"wallee/sdk": "2.1.*"
},
"type": "shopware-platform-plugin",
"version": "1.1.2"
"version": "1.1.3"
}
16 changes: 12 additions & 4 deletions src/Core/Api/Configuration/Controller/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,30 @@ class ConfigurationController extends AbstractController {
* @param \WalleePayment\Core\Util\PaymentMethodUtil $paymentMethodUtil
* @param \WalleePayment\Core\Api\PaymentMethodConfiguration\Service\PaymentMethodConfigurationService $paymentMethodConfigurationService
* @param \WalleePayment\Core\Api\WebHooks\Service\WebHooksService $webHooksService
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
PaymentMethodUtil $paymentMethodUtil,
PaymentMethodConfigurationService $paymentMethodConfigurationService,
WebHooksService $webHooksService,
LoggerInterface $logger
WebHooksService $webHooksService
)
{
$this->logger = $logger;
$this->webHooksService = $webHooksService;
$this->paymentMethodUtil = $paymentMethodUtil;

$this->paymentMethodConfigurationService = $paymentMethodConfigurationService;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}

/**
* Set WalleePayment as the default payment for a give sales channel
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,29 @@ class PaymentMethodConfigurationService {
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* @param \Shopware\Core\Content\ImportExport\DataAbstractionLayer\Serializer\Entity\MediaSerializer $mediaSerializer
* @param \Shopware\Core\Content\ImportExport\DataAbstractionLayer\Serializer\SerializerRegistry $serializerRegistry
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
SettingsService $settingsService,
ContainerInterface $container,
MediaSerializer $mediaSerializer,
SerializerRegistry $serializerRegistry,
LoggerInterface $logger
SerializerRegistry $serializerRegistry
)
{
$this->settingsService = $settingsService;
$this->container = $container;
$this->mediaSerializer = $mediaSerializer;
$this->serializerRegistry = $serializerRegistry;
$this->logger = $logger;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}

/**
Expand Down Expand Up @@ -375,41 +383,52 @@ function ($language) {
return $translations;
}

/**
* @param \Shopware\Core\Framework\Context $context
* @return \Shopware\Core\System\Language\LanguageCollection
*/
protected function getAvailableLanguages(Context $context): LanguageCollection
{
return $this->container->get('language.repository')->search((new Criteria())->addAssociations([
'locale',
]), $context)->getEntities();
}

protected function translate($translatedString, $locale)
{
if (isset($translatedString[$locale])) {
return $translatedString[$locale];
}
{
if (isset($translatedString[$locale])) {
return $translatedString[$locale];
}

$primaryLanguage = $this->findPrimaryLanguage($locale);
if ($primaryLanguage !== false && isset($translatedString[$primaryLanguage->getIetfCode()])) {
return $translatedString[$primaryLanguage->getIetfCode()];
}
$primaryLanguage = $this->findPrimaryLanguage($locale);
if ($primaryLanguage !== false && isset($translatedString[$primaryLanguage->getIetfCode()])) {
return $translatedString[$primaryLanguage->getIetfCode()];
}

if (isset($translatedString['en-US'])) {
return $translatedString['en-US'];
}
if (isset($translatedString['en-US'])) {
return $translatedString['en-US'];
}

return null;
return null;
}

/**
* Returns the primary language in the given group.
*
* @param string $code
* @return \Wallee\Sdk\Model\RestLanguage
*/
protected function findPrimaryLanguage($code)
{
$code = substr($code, 0, 2);
foreach ($this->getLanguages() as $language) {
if ($language->getIso2Code() == $code && $language->getPrimaryOfGroup()) {
return $language;
}
}
return false;
}
* Returns the primary language in the given group.
*
* @param string $code
* @return \Wallee\Sdk\Model\RestLanguage
*/
protected function findPrimaryLanguage($code)
{
$code = substr($code, 0, 2);
foreach ($this->getLanguages() as $language) {
if ($language->getIso2Code() == $code && $language->getPrimaryOfGroup()) {
return $language;
}
}
return false;
}

protected function getLanguages()
{
if ($this->languages == null) {
Expand All @@ -421,17 +440,6 @@ protected function getLanguages()
return $this->languages;
}

/**
* @param \Shopware\Core\Framework\Context $context
* @return \Shopware\Core\System\Language\LanguageCollection
*/
protected function getAvailableLanguages(Context $context): LanguageCollection
{
return $this->container->get('language.repository')->search((new Criteria())->addAssociations([
'locale',
]), $context)->getEntities();
}

/**
* Upload Payment Method icons
*
Expand Down
17 changes: 13 additions & 4 deletions src/Core/Api/Refund/Controller/RefundController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,24 @@ class RefundController extends AbstractController {
*
* @param \WalleePayment\Core\Api\Refund\Service\RefundService $refundService
* @param \WalleePayment\Core\Settings\Service\SettingsService $settingsService
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(RefundService $refundService, SettingsService $settingsService, LoggerInterface $logger)
public function __construct(RefundService $refundService, SettingsService $settingsService)
{
$this->settingsService = $settingsService;
$this->logger = $logger;
$this->refundService = $refundService;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}

/**
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Shopware\Core\Framework\Context $context
Expand All @@ -75,7 +84,7 @@ public function createRefund(Request $request, Context $context): Response
$settings = $this->settingsService->getSettings($salesChannelId);
$apiClient = $settings->getApiClient();

$transaction = $apiClient->getTransactionService()->read($settings->getSpaceId(), $transactionId);
$transaction = $apiClient->getTransactionService()->read($settings->getSpaceId(), $transactionId);
$this->refundService->create($transaction, $refundableAmount, $context);

return new Response(null, Response::HTTP_NO_CONTENT);
Expand Down
19 changes: 12 additions & 7 deletions src/Core/Api/Refund/Service/RefundService.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,22 @@ class RefundService {
*
* @param \Psr\Container\ContainerInterface $container
* @param \WalleePayment\Core\Settings\Service\SettingsService $settingsService
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
ContainerInterface $container,
SettingsService $settingsService,
LoggerInterface $logger
)
public function __construct(ContainerInterface $container, SettingsService $settingsService)
{
$this->container = $container;
$this->settingsService = $settingsService;
$this->logger = $logger;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ class TransactionCompletionController extends AbstractController {
* TransactionCompletionController constructor.
*
* @param \WalleePayment\Core\Settings\Service\SettingsService $settingsService
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(SettingsService $settingsService, LoggerInterface $logger)
public function __construct(SettingsService $settingsService)
{
$this->settingsService = $settingsService;
$this->logger = $logger;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}

/**
Expand Down
23 changes: 14 additions & 9 deletions src/Core/Api/Transaction/Controller/TransactionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,22 @@ class TransactionController extends AbstractController {
*
* @param \WalleePayment\Core\Settings\Service\SettingsService $settingsService
* @param \WalleePayment\Core\Api\Transaction\Service\TransactionService $transactionService
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
SettingsService $settingsService,
TransactionService $transactionService,
LoggerInterface $logger
)
public function __construct(SettingsService $settingsService, TransactionService $transactionService)
{
$this->settingsService = $settingsService;
$this->transactionService = $transactionService;
$this->logger = $logger;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}

/**
Expand All @@ -71,11 +76,11 @@ public function __construct(
*/
public function getTransactionData(Request $request, Context $context): JsonResponse
{
$transactionId = $request->request->get('transactionId');
$transactionId = $request->request->get('transactionId');

$transaction = $this->transactionService->getByTransactionId(intval($transactionId), $context);
$refundCollection = $this->transactionService->getRefundEntityCollectionByTransactionId(intval($transactionId), $context);

$refunds = [];
foreach ($refundCollection as $refundEntity) {
$refunds[] = $refundEntity->getData();
Expand Down
15 changes: 12 additions & 3 deletions src/Core/Api/Transaction/Controller/TransactionVoidController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@ class TransactionVoidController extends AbstractController {
* TransactionVoidController constructor.
*
* @param \WalleePayment\Core\Settings\Service\SettingsService $settingsService
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(SettingsService $settingsService, LoggerInterface $logger)
public function __construct(SettingsService $settingsService)
{
$this->settingsService = $settingsService;
$this->logger = $logger;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}

/**
Expand Down
15 changes: 12 additions & 3 deletions src/Core/Api/Transaction/Service/OrderMailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,24 @@ class OrderMailService {
*
* @param \Psr\Container\ContainerInterface $container
* @param \Shopware\Core\Content\MailTemplate\Service\MailServiceInterface $mailService
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(ContainerInterface $container, MailServiceInterface $mailService, LoggerInterface $logger)
public function __construct(ContainerInterface $container, MailServiceInterface $mailService)
{
$this->logger = $logger;
$this->container = $container;
$this->mailService = $mailService;
}

/**
* @param \Psr\Log\LoggerInterface $logger
* @internal
* @required
*
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}

/**
* @param string $orderId
* @param \Shopware\Core\Framework\Context $context
Expand Down

0 comments on commit c483ff9

Please sign in to comment.