mirror of
https://github.com/vr-payment/shopware-6.git
synced 2026-06-04 19:03:01 +00:00
Release 7.1.6
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
# 7.1.6
|
||||||
|
- Improved rounding handling to force 2 decimal places
|
||||||
|
- Removed references to unused classes
|
||||||
|
- Fixed some type errors
|
||||||
|
- Further improved 0 amount transaction; state transitions
|
||||||
|
|
||||||
# 7.1.5
|
# 7.1.5
|
||||||
- Improved analytics
|
- Improved analytics
|
||||||
- Improved error handling for refunding amount 0 and too many items
|
- Improved error handling for refunding amount 0 and too many items
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
# 7.1.6
|
||||||
|
- Verbesserte Rundungsbehandlung für zwei Dezimalstellen
|
||||||
|
- Entfernte Verweise auf ungenutzte Klassen
|
||||||
|
- Behebung einiger Typfehler
|
||||||
|
- Weitere Verbesserung von Transaktionen mit dem Betrag 0 und Zustandsübergängen
|
||||||
|
|
||||||
# 7.1.5
|
# 7.1.5
|
||||||
- Verbesserte Analysefunktionen
|
- Verbesserte Analysefunktionen
|
||||||
- Verbesserte Fehlerbehandlung bei Rückerstattungen von 0 Beträgen und zu vielen Artikeln
|
- Verbesserte Fehlerbehandlung bei Rückerstattungen von 0 Beträgen und zu vielen Artikeln
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ Please note that this plugin is for versions 6.5, 6.6 or 6.7. For the 6.4 plugin
|
|||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.5/docs/en/documentation.html)
|
- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.6/docs/en/documentation.html)
|
||||||
- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.5/docs/de/documentation.html)
|
- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.6/docs/de/documentation.html)
|
||||||
- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.5/docs/fr/documentation.html)
|
- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.6/docs/fr/documentation.html)
|
||||||
- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.5/docs/it/documentation.html)
|
- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.6/docs/it/documentation.html)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -59,5 +59,5 @@
|
|||||||
"vrpayment/sdk": "^4.0.0"
|
"vrpayment/sdk": "^4.0.0"
|
||||||
},
|
},
|
||||||
"type": "shopware-platform-plugin",
|
"type": "shopware-platform-plugin",
|
||||||
"version": "7.1.5"
|
"version": "7.1.6"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.5/">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.6/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.5/">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.6/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.5/">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.6/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.5/">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.6/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ class TransactionService
|
|||||||
*
|
*
|
||||||
* @return \Shopware\Core\Checkout\Order\OrderEntity
|
* @return \Shopware\Core\Checkout\Order\OrderEntity
|
||||||
*/
|
*/
|
||||||
protected function getOrderEntity(string $orderId, Context $context): OrderEntity
|
public function getOrderEntity(string $orderId, Context $context): OrderEntity
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$criteria = (new Criteria([$orderId]))->addAssociations(['deliveries']);
|
$criteria = (new Criteria([$orderId]))->addAssociations(['deliveries']);
|
||||||
@@ -721,18 +721,20 @@ class TransactionService
|
|||||||
{
|
{
|
||||||
$lineItem = new LineItemCreate();
|
$lineItem = new LineItemCreate();
|
||||||
|
|
||||||
|
$roundedPrice = $this->round($productData->getPrice()->getUnitPrice());
|
||||||
|
|
||||||
if ($productData instanceof LineItem) {
|
if ($productData instanceof LineItem) {
|
||||||
$lineItem->setName($productData->getLabel());
|
$lineItem->setName($productData->getLabel());
|
||||||
$lineItem->setUniqueId($productData->getId());
|
$lineItem->setUniqueId($productData->getId());
|
||||||
$lineItem->setSku($productData->getReferencedId() ?? $productData->getId());
|
$lineItem->setSku($productData->getReferencedId() ?? $productData->getId());
|
||||||
$lineItem->setQuantity($productData->getQuantity());
|
$lineItem->setQuantity($productData->getQuantity());
|
||||||
$lineItem->setAmountIncludingTax($productData->getPrice()->getUnitPrice());
|
$lineItem->setAmountIncludingTax($roundedPrice);
|
||||||
} elseif ($productData instanceof OrderLineItemEntity) {
|
} elseif ($productData instanceof OrderLineItemEntity) {
|
||||||
$lineItem->setName($productData->getLabel());
|
$lineItem->setName($productData->getLabel());
|
||||||
$lineItem->setUniqueId($productData->getId());
|
$lineItem->setUniqueId($productData->getId());
|
||||||
$lineItem->setSku($productData->getProductId() ?? $productData->getIdentifier() ?? $productData->getId());
|
$lineItem->setSku($productData->getProductId() ?? $productData->getIdentifier() ?? $productData->getId());
|
||||||
$lineItem->setQuantity($productData->getQuantity());
|
$lineItem->setQuantity($productData->getQuantity());
|
||||||
$lineItem->setAmountIncludingTax($productData->getUnitPrice());
|
$lineItem->setAmountIncludingTax($roundedPrice);
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException('Unsupported line item type: ' . get_class($productData));
|
throw new \InvalidArgumentException('Unsupported line item type: ' . get_class($productData));
|
||||||
}
|
}
|
||||||
@@ -806,4 +808,14 @@ class TransactionService
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $amount
|
||||||
|
* @param int $precision
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
private function round($value, $precision = 2): float {
|
||||||
|
return \round($value, $precision);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,9 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler
|
|||||||
$orderTransactionId = $transaction->getOrderTransactionId();
|
$orderTransactionId = $transaction->getOrderTransactionId();
|
||||||
$orderTransaction = $this->orderTransactionRepository->search(
|
$orderTransaction = $this->orderTransactionRepository->search(
|
||||||
(new Criteria([$orderTransactionId]))
|
(new Criteria([$orderTransactionId]))
|
||||||
->addAssociation('order'), $context
|
->addAssociation('order')
|
||||||
|
->addAssociation('stateMachineState'),
|
||||||
|
$context
|
||||||
)->getEntities()->first();
|
)->getEntities()->first();
|
||||||
|
|
||||||
$contextSource = $context->getSource();
|
$contextSource = $context->getSource();
|
||||||
@@ -133,20 +135,9 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler
|
|||||||
$salesChannelContextId = $contextSource->getSalesChannelId();
|
$salesChannelContextId = $contextSource->getSalesChannelId();
|
||||||
}
|
}
|
||||||
|
|
||||||
$orderCustomer = $orderTransaction->getOrder()?->getOrderCustomer();
|
$contextToken = $this->getContextToken($request);
|
||||||
|
$parameters = new SalesChannelContextServiceParameters($salesChannelContextId, $contextToken, originalContext: $context);
|
||||||
|
|
||||||
if ($orderCustomer) {
|
|
||||||
$customerId = $orderCustomer->getCustomerId();
|
|
||||||
} else {
|
|
||||||
$customerId = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parameters = new SalesChannelContextServiceParameters(
|
|
||||||
$salesChannelContextId,
|
|
||||||
$request->getSession()->get("sw-context-token", Random::getAlphanumericString(32)),
|
|
||||||
originalContext: $context,
|
|
||||||
customerId: $customerId
|
|
||||||
);
|
|
||||||
$salesChannelContext = $this->salesChannelContextService->get($parameters);
|
$salesChannelContext = $this->salesChannelContextService->get($parameters);
|
||||||
$redirectUrl = $transaction->getReturnUrl();
|
$redirectUrl = $transaction->getReturnUrl();
|
||||||
|
|
||||||
@@ -162,7 +153,10 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler
|
|||||||
$request->getSession()->remove('transactionId');
|
$request->getSession()->remove('transactionId');
|
||||||
$errorMessage = 'An error occurred during the communication with external payment gateway : ' . $e->getMessage();
|
$errorMessage = 'An error occurred during the communication with external payment gateway : ' . $e->getMessage();
|
||||||
$this->logger->critical($errorMessage);
|
$this->logger->critical($errorMessage);
|
||||||
throw PaymentException::customerCanceled($orderTransactionId, $errorMessage);
|
if ($orderTransaction->getState()?->getTechnicalName() === OrderTransactionStates::STATE_CANCELLED) {
|
||||||
|
throw PaymentException::asyncFinalizeInterrupted($orderTransaction->getOrder()->getId(), $errorMessage);
|
||||||
|
}
|
||||||
|
throw PaymentException::customerCanceled($transaction->getOrderTransactionId(), $errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +180,9 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler
|
|||||||
$orderTransactionId = $transaction->getOrderTransactionId();
|
$orderTransactionId = $transaction->getOrderTransactionId();
|
||||||
$orderTransaction = $this->orderTransactionRepository->search(
|
$orderTransaction = $this->orderTransactionRepository->search(
|
||||||
(new Criteria([$orderTransactionId]))
|
(new Criteria([$orderTransactionId]))
|
||||||
->addAssociation('order'), $context
|
->addAssociation('order')
|
||||||
|
->addAssociation('stateMachineState'),
|
||||||
|
$context
|
||||||
)->getEntities()->first();
|
)->getEntities()->first();
|
||||||
|
|
||||||
if ($orderTransaction->getOrder()->getAmountTotal() > 0) {
|
if ($orderTransaction->getOrder()->getAmountTotal() > 0) {
|
||||||
@@ -215,7 +211,11 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler
|
|||||||
|
|
||||||
$token = $request->getSession()->get('sw-context-token');
|
$token = $request->getSession()->get('sw-context-token');
|
||||||
if ($token) {
|
if ($token) {
|
||||||
$salesChannelId = $transactionEntity->getSalesChannelId();
|
$orderEntity = $this->pluginTransactionService->getOrderEntity(
|
||||||
|
$orderTransaction->getOrder()->getId(),
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
$salesChannelId = $orderEntity->getSalesChannelId();
|
||||||
$parameters = new SalesChannelContextServiceParameters($salesChannelId, $token, originalContext: $context);
|
$parameters = new SalesChannelContextServiceParameters($salesChannelId, $token, originalContext: $context);
|
||||||
$salesChannelContext = $this->salesChannelContextService->get($parameters);
|
$salesChannelContext = $this->salesChannelContextService->get($parameters);
|
||||||
|
|
||||||
@@ -432,7 +432,9 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler
|
|||||||
{
|
{
|
||||||
$lineItemCreate = new \VRPayment\Sdk\Model\LineItemCreate();
|
$lineItemCreate = new \VRPayment\Sdk\Model\LineItemCreate();
|
||||||
|
|
||||||
$lineItemCreate->setAmountIncludingTax($lineItem->getAmountIncludingTax());
|
$roundedPrice = $this->round($lineItem->getAmountIncludingTax());
|
||||||
|
|
||||||
|
$lineItemCreate->setAmountIncludingTax($roundedPrice);
|
||||||
|
|
||||||
$attributes = $lineItem->getAttributes();
|
$attributes = $lineItem->getAttributes();
|
||||||
$attributesCreate = [];
|
$attributesCreate = [];
|
||||||
@@ -469,4 +471,28 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler
|
|||||||
|
|
||||||
return $lineItemCreate;
|
return $lineItemCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $amount
|
||||||
|
* @param int $precision
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
private function round($value, $precision = 2): float {
|
||||||
|
return \round($value, $precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getContextToken(Request $request): string
|
||||||
|
{
|
||||||
|
$headerContextToken = $request->headers->get('sw-context-token');
|
||||||
|
if ($headerContextToken) {
|
||||||
|
return $headerContextToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sessionContextToken = $request->getSession()->get("sw-context-token");
|
||||||
|
if (!$sessionContextToken) {
|
||||||
|
return $sessionContextToken;
|
||||||
|
}
|
||||||
|
return Random::getAlphanumericString(32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Analytics {
|
|||||||
self::SHOP_SYSTEM => 'shopware',
|
self::SHOP_SYSTEM => 'shopware',
|
||||||
self::SHOP_SYSTEM_VERSION => '6',
|
self::SHOP_SYSTEM_VERSION => '6',
|
||||||
self::SHOP_SYSTEM_AND_VERSION => 'shopware-6',
|
self::SHOP_SYSTEM_AND_VERSION => 'shopware-6',
|
||||||
self::PLUGIN_SYSTEM_VERSION => '7.1.5',
|
self::PLUGIN_SYSTEM_VERSION => '7.1.6',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -397,7 +397,9 @@ class TransactionPayload extends AbstractPayload
|
|||||||
$discountTitle = sprintf('DISCOUNT: %s', $discountName);
|
$discountTitle = sprintf('DISCOUNT: %s', $discountName);
|
||||||
}
|
}
|
||||||
|
|
||||||
$lineItem->setAmountIncludingTax($amount)
|
$roundedAmount = self::round($amount);
|
||||||
|
|
||||||
|
$lineItem->setAmountIncludingTax($roundedAmount)
|
||||||
->setName($discountTitle)
|
->setName($discountTitle)
|
||||||
->setQuantity(1)
|
->setQuantity(1)
|
||||||
->setShippingRequired(false)
|
->setShippingRequired(false)
|
||||||
@@ -520,12 +522,14 @@ class TransactionPayload extends AbstractPayload
|
|||||||
$amount = self::round($amount + $shopLineItem->getPrice()->getCalculatedTaxes()->getAmount());
|
$amount = self::round($amount + $shopLineItem->getPrice()->getCalculatedTaxes()->getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$roundedAmount = self::round($amount);
|
||||||
|
|
||||||
$lineItem = (new LineItemCreate())
|
$lineItem = (new LineItemCreate())
|
||||||
->setName($this->fixLength($shopLineItem->getLabel(), 150))
|
->setName($this->fixLength($shopLineItem->getLabel(), 150))
|
||||||
->setUniqueId($uniqueId)
|
->setUniqueId($uniqueId)
|
||||||
->setSku($sku)
|
->setSku($sku)
|
||||||
->setQuantity($shopLineItem->getQuantity() ?? 1)
|
->setQuantity($shopLineItem->getQuantity() ?? 1)
|
||||||
->setAmountIncludingTax($amount);
|
->setAmountIncludingTax($roundedAmount);
|
||||||
|
|
||||||
|
|
||||||
if (!empty($shopLineItem->getType()) && $shopLineItem->getType() == CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) {
|
if (!empty($shopLineItem->getType()) && $shopLineItem->getType() == CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) {
|
||||||
@@ -644,9 +648,10 @@ class TransactionPayload extends AbstractPayload
|
|||||||
$amount = self::round($amount + $this->order->getShippingCosts()->getCalculatedTaxes()->getAmount());
|
$amount = self::round($amount + $this->order->getShippingCosts()->getCalculatedTaxes()->getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$roundedAmount = self::round($amount);
|
||||||
|
|
||||||
$lineItem = (new LineItemCreate())
|
$lineItem = (new LineItemCreate())
|
||||||
->setAmountIncludingTax($amount)
|
->setAmountIncludingTax($roundedAmount)
|
||||||
->setName($this->fixLength($shippingName . ' ' . $this->translator->trans('vrpayment.payload.shipping.lineItem'), 150))
|
->setName($this->fixLength($shippingName . ' ' . $this->translator->trans('vrpayment.payload.shipping.lineItem'), 150))
|
||||||
->setQuantity($this->order->getShippingCosts()->getQuantity() ?? 1)
|
->setQuantity($this->order->getShippingCosts()->getQuantity() ?? 1)
|
||||||
->setSku($this->fixLength($shippingName . '-Shipping', 200))
|
->setSku($this->fixLength($shippingName . '-Shipping', 200))
|
||||||
@@ -694,9 +699,11 @@ class TransactionPayload extends AbstractPayload
|
|||||||
->setRate($taxRate)
|
->setRate($taxRate)
|
||||||
->setTitle('Tax rate: '.$taxRate);
|
->setTitle('Tax rate: '.$taxRate);
|
||||||
|
|
||||||
|
$roundedAmount = self::round($amount);
|
||||||
|
|
||||||
$name = $taxRate . '%-' . $shippingName;
|
$name = $taxRate . '%-' . $shippingName;
|
||||||
$lineItem = (new LineItemCreate())
|
$lineItem = (new LineItemCreate())
|
||||||
->setAmountIncludingTax($amount)
|
->setAmountIncludingTax($roundedAmount)
|
||||||
->setName($this->fixLength($name . ' ' . $this->translator->trans('vrpayment.payload.shipping.lineItem'), 150))
|
->setName($this->fixLength($name . ' ' . $this->translator->trans('vrpayment.payload.shipping.lineItem'), 150))
|
||||||
->setQuantity($this->order->getShippingCosts()->getQuantity() ?? 1)
|
->setQuantity($this->order->getShippingCosts()->getQuantity() ?? 1)
|
||||||
->setSku($this->fixLength($name . '-Shipping', 200))
|
->setSku($this->fixLength($name . '-Shipping', 200))
|
||||||
@@ -768,7 +775,8 @@ class TransactionPayload extends AbstractPayload
|
|||||||
->setSku('Adjustment-Line-Item')
|
->setSku('Adjustment-Line-Item')
|
||||||
->setQuantity(1);
|
->setQuantity(1);
|
||||||
/** @noinspection PhpParamsInspection */
|
/** @noinspection PhpParamsInspection */
|
||||||
$lineItem->setAmountIncludingTax($adjustmentPrice)
|
$roundedAdjustmentPrice = self::round($adjustmentPrice);
|
||||||
|
$lineItem->setAmountIncludingTax($roundedAdjustmentPrice)
|
||||||
->setType(($adjustmentPrice > 0) ? LineItemType::FEE : LineItemType::DISCOUNT);
|
->setType(($adjustmentPrice > 0) ? LineItemType::FEE : LineItemType::DISCOUNT);
|
||||||
|
|
||||||
if (!$lineItem->valid()) {
|
if (!$lineItem->valid()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user