diff --git a/Adapter/PlentymarketsAdapter/DependencyInjection/services.xml b/Adapter/PlentymarketsAdapter/DependencyInjection/services.xml index 97aa79f22..bc559346a 100644 --- a/Adapter/PlentymarketsAdapter/DependencyInjection/services.xml +++ b/Adapter/PlentymarketsAdapter/DependencyInjection/services.xml @@ -90,7 +90,7 @@ - + @@ -119,6 +119,8 @@ + + diff --git a/Adapter/PlentymarketsAdapter/RequestGenerator/Payment/PaymentRequestGenerator.php b/Adapter/PlentymarketsAdapter/RequestGenerator/Payment/PaymentRequestGenerator.php index c25609da1..c14047d9d 100644 --- a/Adapter/PlentymarketsAdapter/RequestGenerator/Payment/PaymentRequestGenerator.php +++ b/Adapter/PlentymarketsAdapter/RequestGenerator/Payment/PaymentRequestGenerator.php @@ -3,6 +3,7 @@ namespace PlentymarketsAdapter\RequestGenerator\Payment; use PlentymarketsAdapter\PlentymarketsAdapter; +use SystemConnector\ConfigService\ConfigServiceInterface; use SystemConnector\IdentityService\Exception\NotFoundException; use SystemConnector\IdentityService\IdentityServiceInterface; use SystemConnector\TransferObject\Currency\Currency; @@ -16,9 +17,15 @@ class PaymentRequestGenerator implements PaymentRequestGeneratorInterface */ private $identityService; - public function __construct(IdentityServiceInterface $identityService) + /** + * @var ConfigServiceInterface + */ + private $configService; + + public function __construct(IdentityServiceInterface $identityService, ConfigServiceInterface $configService) { $this->identityService = $identityService; + $this->configService = $configService; } /** @@ -49,6 +56,12 @@ public function generate(Payment $payment): array throw new NotFoundException('currency not mapped'); } + $isSystemCurrency = true; + + if ($this->configService->get('system_currency') !== $currencyIdentity->getAdapterIdentifier()) { + $isSystemCurrency = false; + } + $paymentParams = [ 'amount' => $payment->getAmount(), 'exchangeRatio' => 1, @@ -57,6 +70,7 @@ public function generate(Payment $payment): array 'type' => 'credit', 'transactionType' => 2, 'status' => 2, + 'isSystemCurrency' => $isSystemCurrency, ]; $paymentParams['properties'] = [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c7129b96..27a598855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [## [unreleased]] ### Added - additional manufacturer information as attributes (@Pfabeck & @ugurkankya) +- set plentymarkets system currency for payments ## [## [5.3.2]] ### Fixed diff --git a/Resources/Views/backend/plenty_connector/model/settings.js b/Resources/Views/backend/plenty_connector/model/settings.js index b358fe0eb..051fae2b8 100644 --- a/Resources/Views/backend/plenty_connector/model/settings.js +++ b/Resources/Views/backend/plenty_connector/model/settings.js @@ -50,8 +50,11 @@ Ext.define('Shopware.apps.PlentyConnector.model.Settings', { { name: 'import_variations_without_stock', type: 'boolean' - } - , + }, + { + name: 'system_currency', + type: 'string' + }, { name: 'amazon_pay_key', type: 'string' diff --git a/Resources/Views/backend/plenty_connector/view/settings.js b/Resources/Views/backend/plenty_connector/view/settings.js index e9b1bc18b..f37ce9abe 100644 --- a/Resources/Views/backend/plenty_connector/view/settings.js +++ b/Resources/Views/backend/plenty_connector/view/settings.js @@ -236,6 +236,17 @@ Ext.define('Shopware.apps.PlentyConnector.view.Settings', { anchor: '100%', name: 'surcharge_as_product' }, + { + xtype: 'combobox', + fieldLabel: '{s name=plentyconnector/view/settings/system_currency/label}{/s}', + name: 'system_currency', + editable: false, + triggerAction: 'all', + selectOnFocus: true, + displayField: 'currency', + valueField: 'currency', + store: Ext.create('Shopware.apps.Base.store.Currency').load() + }, { xtype: 'textfield', fieldLabel: '{s name=plentyconnector/view/settings/amazon_pay_key}{/s}', diff --git a/Resources/snippets/backend/plentyconnector/main.ini b/Resources/snippets/backend/plentyconnector/main.ini index 75f8ce3ce..cd8931cdf 100644 --- a/Resources/snippets/backend/plentyconnector/main.ini +++ b/Resources/snippets/backend/plentyconnector/main.ini @@ -49,6 +49,7 @@ plentyconnector/view/actions/title = "Aktionen" plentyconnector/view/actions/item_import = "Artikelabgleich" plentyconnector/view/actions/item_import/item_id = "Plentymarkets Artikel-ID" plentyconnector/view/settings/amazon_pay_key = "AmazonPay Key" +plentyconnector/view/settings/system_currency/label = "System Währung" [en_GB] plentyconnector/controller/mapping/loading = "Loading... (this may take some time)" @@ -98,4 +99,5 @@ plentyconnector/view/settings/helperLink/text = "Find more options at the" plentyconnector/view/actions/title = "Actions" plentyconnector/view/actions/item_import = "Article Sync" plentyconnector/view/actions/item_import/item_id = "Plentymarkets Article-ID" -plentyconnector/view/settings/amazon_pay_key = "AmazonPay Key" \ No newline at end of file +plentyconnector/view/settings/amazon_pay_key = "AmazonPay Key" +plentyconnector/view/settings/system_currency/label = "System Currency"