XUP,GСXU`,HСXUp,HСXU,HСXU,HСXU,HXU`,t9XU,<XU,>RXU`->NNhl}A0|ANDNP|AXDHDNXXUP?XU qXU PA9XU<PXU`PXU6@XU`7@vXU8IXUIXU XUpXUPpqpXUpPuXUPGhXU`A5XU<RXU>K7OI7OPI ۍAIp|APMxEJ 8O|A|AXXUP?@XUE`XUPPBЮXU`t9XUp<PXU`pXU`{5XU/@XU@E`XUPPB9XU< XUXU`7XU4rXU>RXU> N Nn}A0|AP N N|AQ}ANȭNS}AX|A0 N` NSXU p XUPp0XUP/XU+ XU`0XU D@XU E`XU`P B@XU E9XU <XU` 29XU <XUP 25XU <RXU$>A0~Ap~AOJ(}A@LL|AEurns true if the site doesn't have raw data. XUq9XUp<PXUPpXUP+XUqXUPA9XU<PXU`XU`{/XU@+@XU`>HXU q9XU<XU>RXU>OOOOI(Iج~Aج~A`NOOE if ($value === $name . ' + 1') { //$name = 'visit_total_events' /** * Add an origin hint to the query to identify the main parameters and segment for debugging * * @param string $sql SQL query string * @param string $origin Origin string to describe the source of the query * @param Date|null $dateStart Start date used in the query, optional * @param Date|null $dateEnd End date used in the query, optional * @param array|null $sites Sites list used in the query, optionaestException $exception * @return void */ protected function handleOvercharge(Order $ppOrder, PPCRequestException $exception): void { $detail = $exception->getDetail(); if ($detail === null || $detail->getIssue() !== OrderStatus::STATUS_PAYER_ACTION_REQUIRED) { return; } $this->resetPPOrder($ppOrder->getId()); $localization = $this->plugin->getLocalization(); Shop::Container()->getAlertService()->addAlert( Alert::TYPE_ERROR, $localization->getTranslation('jtl_paypal_commerce_payer_action_required'), 'handleOvercharge', [ 'saveInSession' => true, 'linkText' => $localization->getTranslation('jtl_paypal_commerce_psd2overcharge'), ] ); Helper::redirectAndExit( Shop::Container()->getLinkService()->getStaticRoute('bestellvorgang.php') ); exit(); } /** * @inheritDoc */ public function isValidIntern(array $args_arr = []): bool { if (!parent::isValidIntern($args_arr)) { return false; } try { return $this->method->getDuringOrder() && Token::getInstance()->getToken() !== null; } catch (AuthorizationException $e) { $this->logger->write(\LOGLEVEL_ERROR, 'AuthorizationException:' . $e->getMessage()); return false; } } /** * @inheritDoc */ public function isValid(object $customer, Cart $cart): bool { if (Request::postInt('resetPayment') === 1) { $this->resetPPOrder(); unset($_POST['resetPayment']); return false; } return parent::isValid($customer, $cart); } /** * @inheritDoc */ public function isValidExpressPayment(object $customer, Cart $cart): bool { if (!$this->isValid($customer, $cart)) { return false; } foreach ($cart->PositionenArr as $cartItem) { if ((int)($cartItem->Artikel->FunktionsAttribute['no_paypalexpress'] ?? 0) === 1) { return false; } } return $this->isAssigned( ShippingMethod::getShippingClasses($cart), (int)($customer->kKundengruppe ?? 0) > 0 ? (int)$customer->kKundengruppe : CustomerGroup::getDefaultGroupID() ); } /** * @inheritDoc */ public function isValidExpressProduct(object $customer, ?Artikel $product): bool { if (!$this->isValidIntern()) { return false; } if ($product === null || $product->bHasKonfig || $product->inWarenkorbLegbar <= 0) { return false; } /** @var Cart $cart */ $cart = GeneralObject::deepCopy(Frontend::getCart()); $dispatcher = $this->helper->revokeHookDispatcher(); $cart->fuegeEin($product->getID(), \max($product->fMindestbestellmenge, 1), $product->Attribute); $this->helper->restoreHookDispatcher($dispatcher); return $this->isValidExpressPayment($customer, $cart); } /** * @inheritDoc */ public function isValidBannerPayment(object $customer, Cart $cart): bool { return $this->isValid($customer, $cart) && $this->isAssigned( ShippingMethod::getShippingClasses($cart), (int)($customer->kKundengruppe ?? 0) > 0 ? (int)$customer->kKundengruppe : CustomerGroup::getDefaultGroupID() ); } /** * @inheritDoc */ public function isValidBannerProduct(object $customer, ?Artikel $product): bool { if (!$this->isValidIntern()) { return false; } if ($product === null || $product->bHasKonfig) { return false; } /** @var Cart $cart */ $cart = GeneralObject::deepCopy(Frontend::getCart()); if ($product->inWarenkorbLegbar > 0) { $dispatcher = $this->helper->revokeHookDispatcher(); $cart->fuegeEin($product->getID(), \max($product->fMindestbestellmenge, 1), $product->Attribute); $this->helper->restoreHookDispatcher($dispatcher); } return $this->isValidBannerPayment($customer, $cart); } /** * @inheritDoc */ protected function constructOrder( Customer $customer, Cart $cart, string $shippingContext, string $payAction, string $orderHash ): Order { $ppOrder = parent::constructOrder($customer, $cart, $shippingContext, $payAction, $orderHash); if ($this->isAutoCapture()) { $ppOrder->setProcessingInstruction(Order::PI_AUTO_COMPLETE); } return $ppOrder; } /** * @inheritDoc */ public function getFrontendInterface(Configuration $config, JTLSmarty $smarty): PaymentFrontendInterface { return new PPCPFrontend($this->plugin, $this, $smarty); } /** * @inheritDoc */ public function getFundingSource(): string { return $this->sessionCache->getFundingSource() ?? ''; } /** * @inheritDoc */ public function getDefaultFundingSource(): string { return 'paypal'; } /** * @inheritDoc */ public function preparePaymentProcess(Bestellung $order): void { parent::preparePaymentProcess($order); $ppOrder = $this->getPPOrder(); if ($ppOrder === null || empty($ppOrder->getId())) { $this->getLogger()->write( \LOGLEVEL_NOTICE, 'preparePaymentProcess: payment can not be processed, order does not exists' ); $this->raisePaymentError('jtl_paypal_commerce_payment_error', $this->getPaymentRetryURL($ppOrder)); exit(); } try { $ppOrder = $this->verifyPPOrder($ppOrder->getId()); } catch (PPCRequestException $e) { $this->showErrorResponse($e->getResponse(), new Alert( Alert::TYPE_ERROR, $this->plugin->getLocalization()->getTranslation('jtl_paypal_commerce_payment_error'), 'preparePaymentProcess', ['saveInSession' => true] )); Helper::redirectAndExit($this->getPaymentRetryURL($ppOrder)); } catch (OrderNotFoundException) { $this->raisePaymentError('jtl_paypal_commerce_payment_error', $this->getPaymentRetryURL($ppOrder)); } $this->getLogger()->write(\LOGLEVEL_DEBUG, 'preparePaymentProcess: verifyOrder', $ppOrder); if (!$this->isAutoCapture() && !$this->isValidOrderState($ppOrder, OrderStatus::STATUS_APPROVED)) { $this->getLogger()->write(\LOGLEVEL_NOTICE, 'preparePaymentProcess: UnexpectedOrderState get ' . $ppOrder->getStatus() . ' expected ' . OrderStatus::STATUS_APPROVED); $this->handleOrder($ppOrder, $order); return; } $orderNumber = $ppOrder->getPurchase()->getInvoiceId() ?? LegacyHelper::baueBestellnummer(); $ppOrder->getPurchase()->setInvoiceId($orderNumber); if ($this->config->getPrefixedConfigItem( BackendUIsettings::BACKEND_SETTINGS_SECTION_GENERAL . '_purchaseDescription' ) === 'N') { $ppOrder->getPurchase()->setDescription( $this->helper->getSimpleDescription($orderNumber, $this->getShopTitle()) ); } try { (new TCPayerActionRequired())->execute($this, $ppOrder, Frontend::getCustomer(), Frontend::getCart()); $ppOrder = $this->ppcpOrder->callPatch(new Order($ppOrder->getData())); } catch (PPCRequestException | OrderNotFoundException $e) { $this->handleOvercharge($ppOrder, $e); $this->getLogger()->write( \LOGLEVEL_NOTICE, 'preparePaymentProcess: OrderPatchFailed - ' . $e->getMessage() ); $this->raisePaymentError('jtl_paypal_commerce_payment_error', $this->getPaymentRetryURL($ppOrder)); } if ($this->isAutoCapture()) { /* third party with auto capture - order before payment */ $this->helper->persistOrder($order, $ppOrder, $this, [ 'invoiceId' => $orderNumber ]); $this->handleOrder($ppOrder, $order); $this->sessionCache->clear(PaymentSession::ORDERID); return; } try { (new TCServerError())->execute($this, $ppOrder, Frontend::getCustomer(), Frontend::getCart()); $ppOrder = $this->ppcpOrder->callCapture($orderNumber, $this->getBNCode()); (new TCServerError())->execute($this, $ppOrder, Frontend::getCustomer(), Frontend::getCart()); } catch (PPCRequestException $e) { $this->handleOvercharge($ppOrder, $e); $this->getLogger()->write( \LOGLEVEL_NOTICE, 'preparePaymentProcess: OrderCaptureFailed - ' . $e->getMessage() ); // The API-Call failed - try to get the state in case of payment was still succesfully captured try { (new TCServerError(true))->execute($this, $ppOrder, Frontend::getCustomer(), Frontend::getCart()); $ppOrder = $this->verifyPPOrder($ppOrder->getId()); if (!$this->isValidOrderState($ppOrder, OrderStatus::STATUS_COMPLETED)) { Shop::Container()->getAlertService()->addAlert( Alert::TYPE_ERROR, $this->plugin->getLocalization() ->getTranslation('jtl_paypal_commerce_payment_error'), 'orderCaptureFailed', [ 'saveInSession' => true, ] ); } } catch (PPCRequestException | OrderNotFoundException) { // at this point the payment state is realy unknown - persist order to prevent payments without order $this->getLogger()->write( \LOGLEVEL_ERROR, 'preparePaymentProcess: OrderCaptureFailed twice - persist order', $order ); $this->helper->persistOrder($order, $ppOrder, $this, [ 'invoiceId' => $orderNumber ]); } } catch (OrderNotFoundException) { $this->raisePaymentError('jtl_paypal_commerce_payment_error', $this->getPaymentRetryURL($ppOrder)); } $ppOrder = (new TCCaptureDecline())->execute( $this, (new TCCapturePending())->execute($this, $ppOrder, Frontend::getCustomer(), Frontend::getCart()), Frontend::getCustomer(), Frontend::getCart() ); if ($this->isValidOrderState($ppOrder, OrderStatus::STATUS_PENDING) || $this->isValidOrderState($ppOrder, OrderStatus::STATUS_COMPLETED) ) { $this->helper->persistOrder($order, $ppOrder, $this, [ 'invoiceId' => $orderNumber ]); } $this->handleOrder($ppOrder, $order); } }