Skip to content

Commit

Permalink
NTR: fix status
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Apr 26, 2024
1 parent 0a521a0 commit 442463f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/Components/RefundManager/Builder/RefundDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,18 @@ private function getRefundedQuantity(string $mollieLineItemId, \Mollie\Api\Resou

$meta = $refund['metadata'];

// refund initiated within mollie dashboard, so no metadata is set
if ($meta instanceof \stdClass) {
continue;
}

if (is_string($meta)) {
/** @var \stdClass $meta */
$meta = json_decode($meta, true);
}



$metadata = RefundMetadata::fromArray($meta);

# if we do have a FULL item refund then
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/Api/Order/ShippingControllerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ public function shipItemOperational(Request $request, Context $context): JsonRes

$orderNumber = (string)$jsonData['orderNumber'];
$itemProductNumber = (string)$jsonData['productNumber'];
$quantity = (int)$jsonData['quantity'];
$trackingCarrier = (string)$jsonData['trackingCarrier'];
$trackingCode = (string)$jsonData['trackingCode'];
$trackingUrl = (string)$jsonData['trackingUrl'];
$quantity = (int)($jsonData['quantity'] ?? 0);
$trackingCarrier = (string)($jsonData['trackingCarrier'] ?? '');
$trackingCode = (string)($jsonData['trackingCode'] ?? '');
$trackingUrl = (string)($jsonData['trackingUrl'] ?? '');

if ($orderNumber === '') {
throw new \InvalidArgumentException('Missing Argument for Order Number!');
Expand Down
1 change: 1 addition & 0 deletions src/Controller/Storefront/Webhook/NotificationFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ private function getTransaction(string $transactionId, Context $context): ?Order
$criteria->addAssociation('order.lineItems');
$criteria->addAssociation('order.currency');
$criteria->addAssociation('order.transactions');
$criteria->addAssociation('order.stateMachineState');
$criteria->addAssociation('paymentMethod');

return $this->repoOrderTransactions->search($criteria, $context)->first();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% sw_extends '@Storefront/storefront/component/buy-widget/buy-widget-form.html.twig' %}

{% block buy_widget_buy_button %}

{% if mollie_subscriptions_enabled and product.customFields.mollie_payments_product_subscription_enabled %}
<div class="d-grid">
<button class="btn btn-primary btn-block btn-buy" title="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}" aria-label="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}">
Expand Down
4 changes: 2 additions & 2 deletions src/Service/MollieApi/Builder/MollieLineItemBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ public function buildLineItems(string $taxStatus, ?OrderLineItemCollection $line
$price,
$item->getId(),
$extraData->getSku(),
urlencode((string)$extraData->getImageUrl()),
urlencode((string)$extraData->getProductUrl())
(string)$extraData->getImageUrl(),
(string)$extraData->getProductUrl()
);

$lines->add($mollieLineItem);
Expand Down
1 change: 1 addition & 0 deletions src/Service/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function getTransactionById($transactionId, $versionId = null, Context $c

$transactionCriteria->addAssociation('order.currency');
$transactionCriteria->addAssociation('order.lineItems');
$transactionCriteria->addAssociation('order.stateMachineState');

/** @var OrderTransactionCollection $transactions */
$transactions = $this->orderTransactionRepository->search(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public function testLineItemStructure(string $itemType, string $mollieLineType):
'value' => '0.78'
],
'sku' => 'product-123',
'imageUrl' => urlencode('https://phpunit.mollie.local/my-product-1.png'),
'productUrl' => urlencode('https://phpunit.mollie.local/my-product-1'),
'imageUrl' => 'https://phpunit.mollie.local/my-product-1.png',
'productUrl' => 'https://phpunit.mollie.local/my-product-1',
'metadata' => [
'orderLineItemId' => 'line-1'
]
Expand Down

0 comments on commit 442463f

Please sign in to comment.