Skip to content

Commit

Permalink
Fix getOrder being null for paypal express (#65)
Browse files Browse the repository at this point in the history
* Fix getOrder being null for paypal express

* fix issue #62

* fix phpstan
  • Loading branch information
JustinElst authored Nov 4, 2024
1 parent 927ed7d commit 9f9c63c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Model/SendPurchaseEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,13 @@ protected function collectProducts(Order $order): array

/**
* Get the actual price the customer also saw in it's cart.
* @phpstan-ignore-next-line
*/
private function getPaidProductPrice(Item $orderItem): float
private function getPaidProductPrice(Item $orderItem): float|string
{
return $this->moduleConfiguration
->getTaxDisplayType($orderItem->getOrder()->getStoreId()) === Config::DISPLAY_TYPE_EXCLUDING_TAX
/** @phpstan-ignore-next-line */
->getTaxDisplayType($orderItem->getOrder()?->getStoreId()) === Config::DISPLAY_TYPE_EXCLUDING_TAX
? $orderItem->getBasePrice()
: $orderItem->getBasePriceInclTax();
}
Expand Down Expand Up @@ -218,7 +220,10 @@ public function getTransactionDataObject(Order $order, $elgentosSalesOrder): Dat
return $transactionDataObject;
}

private function getPaidShippingCosts(Order $order): ?float
/**
* @phpstan-ignore-next-line
*/
private function getPaidShippingCosts(Order $order): null|float|string
{
return $this->moduleConfiguration->getTaxDisplayType($order->getStoreId()) == Config::DISPLAY_TYPE_EXCLUDING_TAX
? $order->getBaseShippingAmount()
Expand Down

0 comments on commit 9f9c63c

Please sign in to comment.