Skip to content

Commit

Permalink
Release 4.0.46
Browse files Browse the repository at this point in the history
  • Loading branch information
edgaraswallee committed Dec 13, 2022
1 parent 68fe1cb commit 18be705
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tail -f var/log/wallee_payment*.log

## Documentation

[Documentation](https://plugin-documentation.wallee.com/wallee-payment/shopware-6/4.0.45/docs/en/documentation.html)
[Documentation](https://plugin-documentation.wallee.com/wallee-payment/shopware-6/4.0.46/docs/en/documentation.html)

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
"wallee/sdk": "3.0.1"
},
"type": "shopware-platform-plugin",
"version": "4.0.45"
"version": "4.0.46"
}
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/shopware-6/releases/tag/4.0.45/">
<a href="https://github.com/wallee-payment/shopware-6/releases/tag/4.0.46/">
Source
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Psr\Log\LoggerInterface;
use Shopware\Core\{
Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStates,
Checkout\Order\Aggregate\OrderTransaction\OrderTransactionCollection,
Checkout\Order\OrderEntity,
Content\MailTemplate\Service\Event\MailBeforeValidateEvent};
use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent;
Expand Down Expand Up @@ -94,7 +95,11 @@ public function onMailBeforeValidate(MailBeforeValidateEvent $event): void
return;
}

$orderTransactionLast = $order->getTransactions()->last();
$orderTransactions = $order->getTransactions();
if (!($orderTransactions instanceof OrderTransactionCollection)) {
return;
}
$orderTransactionLast = $orderTransactions->last();
if (empty($orderTransactionLast) || empty($orderTransactionLast->getPaymentMethod())) { // no payment method available
return;
}
Expand Down
30 changes: 20 additions & 10 deletions src/Core/Util/Payload/TransactionPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,20 @@ public function get(): TransactionCreate
$transactionData['meta_data']['customer_comment'] = $this->transaction->getOrder()->getCustomerComment();
}

if (!empty($companyDepartment = $customer->getDefaultBillingAddress()->getDepartment())) {
$transactionData['meta_data']['companyDepartment'] = $companyDepartment;

$taxNumber = null;
$vatIds = $customer->getVatIds();
if (!empty($vatIds)) {
$taxNumber = $vatIds[0];
}

$vatIds = $customer->getVatIds();
if (!empty($vatIds)) {
$taxNumber = $vatIds[0];
$transactionData['meta_data']['taxNumber'] = $taxNumber;
}

if (!empty($companyDepartment = $customer->getDefaultBillingAddress()->getDepartment())) {
$transactionData['meta_data']['billingCompanyDepartment'] = $companyDepartment;
}

if (!empty($companyDepartment = $customer->getDefaultShippingAddress()->getDepartment())) {
$transactionData['meta_data']['shippingCompanyDepartment'] = $companyDepartment;
}

$transactionPayload = (new TransactionCreate())
->setAutoConfirmationEnabled(false)
->setBillingAddress($billingAddress)
Expand Down Expand Up @@ -465,7 +467,15 @@ protected function getAdjustmentLineItem(array &$lineItems): ?LineItemCreate
return $lineItem->getAmountIncludingTax();
}, $lineItems));

$adjustmentPrice = $this->transaction->getOrder()->getAmountTotal() - $lineItemPriceTotal;
// When tax_status is set to net (via Customer group), the amount is net instead of gross.
$tax_status = $this->transaction->getOrder()->getTaxStatus();
if ($tax_status == 'net') {
$transactionTotal = $this->transaction->getOrder()->getAmountNet();
}
else {
$transactionTotal = $this->transaction->getOrder()->getAmountTotal();
}
$adjustmentPrice = $transactionTotal - $lineItemPriceTotal;
$adjustmentPrice = self::round($adjustmentPrice);

if (abs($adjustmentPrice) != 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"sw-privileges": {
"permissions": {
"parents": {
"wallee": "Wallee plugin"
},
"wallee": {
"label": "Wallee berechtigungen"
}
}
},
"wallee-settings": {
"general": {
"descriptionTextModule": "Wallee-Einstellungen",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"sw-privileges": {
"permissions": {
"parents": {
"wallee": "Wallee plugin"
},
"wallee": {
"label": "Wallee permissions"
}
}
},
"wallee-settings": {
"general": {
"descriptionTextModule": "Wallee settings",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"sw-privileges": {
"permissions": {
"parents": {
"wallee": "Wallee brancher"
},
"wallee": {
"label": "Wallee autorisations"
}
}
},
"wallee-settings": {
"general": {
"descriptionTextModule": "Paramètres de Wallee",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"sw-privileges": {
"permissions": {
"parents": {
"wallee": "Wallee brancher"
},
"wallee": {
"label": "Wallee autorisations"
}
}
},
"wallee-settings": {
"general": {
"descriptionTextModule": "Impostazioni Wallee",
Expand Down

0 comments on commit 18be705

Please sign in to comment.