Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinder committed Apr 23, 2020
2 parents b2f4755 + d924fda commit f1e5f2d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Components/MollieApiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function create()

// add plugin name and version
$this->apiClient->addVersionString(
'MollieShopware/1.5.9'
'MollieShopware/1.5.10'
);
}
catch (\Exception $ex) {
Expand Down
41 changes: 24 additions & 17 deletions Components/Services/BasketService.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ public function restoreBasket($orderId)
}

// reset ordered quantity
if ($this->config->autoResetStock())
if ($this->config->autoResetStock()) {
$this->resetOrderDetailQuantity($orderDetail);
}
}

// append internal comment
Expand Down Expand Up @@ -157,11 +158,19 @@ function getBasketLines($userData = array())
$totalAmount = $unitPrice * $basketItem->getQuantity();
$vatAmount = 0;

if (isset($userData['additional']['charge_vat'], $userData['additional']['show_net']) &&
$userData['additional']['charge_vat'] &&
false === $userData['additional']['show_net']) {
if (
isset($userData['additional']['charge_vat'], $userData['additional']['show_net'])
&& $userData['additional']['charge_vat'] === true
&& $userData['additional']['show_net'] === false
) {
$unitPrice *= ($basketItem->getTaxRate() + 100) / 100;
$totalAmount = $unitPrice * $basketItem->getQuantity();
}

if (
isset($userData['additional']['charge_vat'])
&& $userData['additional']['charge_vat'] === true
) {
$vatAmount = $totalAmount * ($basketItem->getTaxRate() / ($basketItem->getTaxRate() + 100));
}

Expand Down Expand Up @@ -307,36 +316,34 @@ public function removeOrderDetail($orderDetailId)
* @throws \Exception
*/
public function resetOrderDetailQuantity(\Shopware\Models\Order\Detail $orderDetail) {
// variables
$article = null;
$orderedQuantity = $orderDetail->getQuantity();

// reset quantity
$orderDetail->setQuantity(0);

try {
$this->modelManager->persist($orderDetail);
$this->modelManager->flush($orderDetail);
} catch (\Exception $e) {
//
}

// build order detail repository
$orderDetailRepo = Shopware()->Models()->getRepository(
$articleDetailRepository = Shopware()->Models()->getRepository(
\Shopware\Models\Article\Detail::class
);

try {
/** @var Detail $article */
$article = $orderDetailRepo->findOneBy([
$article = $articleDetailRepository->findOneBy([
'number' => $orderDetail->getArticleNumber()
]);
}
catch (\Exception $ex) {
// write exception to log
Logger::log(
'error',
$ex->getMessage(),
$ex
);
//
}

// restore stock
if ($article !== null) {
$article->setInStock($article->getInStock() + $orderedQuantity);
$article->setInStock($article->getInStock());

try {
$this->modelManager->persist($article);
Expand Down
8 changes: 4 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<label lang="de">Mollie</label>
<label lang="nl">Mollie</label>

<version>1.5.9</version>
<version>1.5.10</version>
<copyright>(c) Mollie B.V.</copyright>
<author>Kiener E-commerce</author>
<link>https://www.kiener.nl</link>

<description lang="en">Plugin to allow iDeal payments using the Mollie API (1.5.9)</description>
<description lang="nl">Plugin die iDealbetalingen via de Mollie API doorgeeft (1.5.9)</description>
<description lang="de">Plugin um Zahlungen mit der Mollie API zu ermöglichen (1.5.9)</description>
<description lang="en">Plugin to allow iDeal payments using the Mollie API (1.5.10)</description>
<description lang="nl">Plugin die iDealbetalingen via de Mollie API doorgeeft (1.5.10)</description>
<description lang="de">Plugin um Zahlungen mit der Mollie API zu ermöglichen (1.5.10)</description>

<compatibility minVersion="5.3.0"/>
</plugin>
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ Maintenance of our official plugin is performed by our [Shopware development par
There are two ways of installing this plugin manually: You can either checkout this repository on your machine (in the plugins folder of your Shopware installation) or you can download the zip file above (most recent version can be found here: [master](https://github.com/mollie/Shopware/archive/master.zip)) and extract this on your machine (in the very same plugins folder).
## Finalizing steps
To finalize the installation you need to enter your API key in the corresponding box. You can find yours in the [Mollie Dashboard](https://www.mollie.com/dashboard/payments). Click save and then enable the plugin. Your payment methods are now being installed.
## Wiki
Read more about the plugin configuration on [our Wiki](https://github.com/mollie/Shopware/wiki).

0 comments on commit f1e5f2d

Please sign in to comment.