@param \Generated\Shared\Transfer\PayonePaymentTransfer $paymentTransfer

@return \Orm\Zed\Payone\Persistence\SpyPaymentPayone
323515
protected function savePayment(PayonePaymentTransfer $paymentTransfer)
    {
        $payment = new SpyPaymentPayone();
        $payment->fromArray(($paymentTransfer->toArray()));

        if ($payment->getReference() === null) {
            $orderEntity = $payment->getSpySalesOrder();
            $payment->setReference($this->config->generatePayoneReference($paymentTransfer, $orderEntity));
        }

        $payment->save();

        return $payment;
    }
96931
public function verifyMac(PaymentResponseInterface $paymentResponse)
    {
        $mac = strtr('codTrans={transactionCode}esito={result}importo={amount}divisa={currency}data={date}orario={time}codAut={authCode}{secret}', array(
            '{transactionCode}' => $paymentResponse->get('codTrans'),
            '{result}'          => $paymentResponse->get('esito'),
            '{amount}'          => $paymentResponse->get('importo'),
            '{currency}'        => $paymentResponse->get('divisa'),
            '{date}'            => $paymentResponse->get('data'),
            '{time}'            => $paymentResponse->get('orario'),
            '{authCode}'        => $paymentResponse->get('codAut'),
            '{secret}'          => $this->secret
        ));

        $generated = sha1($mac);
        $given     = $paymentResponse->get('mac');

        return $generated === $given;
    }
714449
public function getFirstBrandByProductAbstractId(ProductAbstractTransfer $productAbstractTransfer): ?BrandTransfer
    {
        $productAbstractTransfer->requireIdProductAbstract();

        return $this->brandProductRepository->getFirstBrandByProductAbstractId($productAbstractTransfer->getIdProductAbstract());
    }
73810
public function getData(AbstractTransfer $quoteTransfer): QuoteTransfer
    {
        if ($quoteTransfer->getPayment() === null) {
            $paymentTransfer = new PaymentTransfer();
            $paymentTransfer->setPayone(new PayonePaymentTransfer());
            $quoteTransfer->setPayment($paymentTransfer);
        }

        return $quoteTransfer;
    }
161967
private function transferSoap(Transfer $transfer, VendorInterface $vendor = null)
    {
        if (!$transfer->getEntity()) {
            $transfer->setEntity($this->entity);
        }
        $parameters = $transfer->mergeIntoParameters();
        if ($vendor) {
            $parameters = $this->mergeSubAccountParameters($vendor);
        }
        $result = $this->callSoap('direct', $parameters);

        return $result['transactionId'];
    }
168608
public function manageMandate(PayoneManageMandateTransfer $manageMandateTransfer)
    {
        /** @var \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebit $paymentMethodMapper */
        $paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(PayoneApiConstants::PAYMENT_METHOD_DIRECT_DEBIT);
        $requestContainer = $paymentMethodMapper->mapManageMandate($manageMandateTransfer);
        $this->setStandardParameter($requestContainer);

        $rawResponse = $this->executionAdapter->sendRequest($requestContainer);
        $responseContainer = new ManageMandateResponseContainer($rawResponse);

        $manageMandateTransfer->setErrorCode($responseContainer->getErrorcode());
        $manageMandateTransfer->setCustomerErrorMessage($responseContainer->getCustomermessage());
        $manageMandateTransfer->setStatus($responseContainer->getStatus());
        $manageMandateTransfer->setInternalErrorMessage($responseContainer->getErrormessage());
        $manageMandateTransfer->setMandateIdentification($responseContainer->getMandateIdentification());
        $manageMandateTransfer->setMandateText($responseContainer->getMandateText());
        $manageMandateTransfer->setIban($responseContainer->getIban());
        $manageMandateTransfer->setBic($responseContainer->getBic());

        return $manageMandateTransfer;
    }
994639
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity): CashOnDeliveryContainer
    {
        $shippingProviderName = $paymentEntity->getSpyPaymentPayoneDetail()->getShippingProvider();

        $translatedShippingProviderName = $shippingProviderName ? $this->translate($shippingProviderName) : $shippingProviderName;

        $paymentMethodContainer = new CashOnDeliveryContainer();
        $paymentMethodContainer->setShippingProvider($translatedShippingProviderName);

        return $paymentMethodContainer;
    }
1039521
public function authorizePayment(OrderTransfer $orderTransfer)
    {
        $paymentEntity = $this->getPaymentEntity($orderTransfer->getIdSalesOrder());
        $paymentMethodMapper = $this->getPaymentMethodMapper($paymentEntity);
        $requestContainer = $paymentMethodMapper->mapPaymentToAuthorization($paymentEntity, $orderTransfer);
        $requestContainer = $this->prepareOrderItems($orderTransfer, $requestContainer);
        $requestContainer = $this->prepareOrderShipment($orderTransfer, $requestContainer);
        $requestContainer = $this->prepareOrderDiscount($orderTransfer, $requestContainer);
        $responseContainer = $this->performAuthorizationRequest($paymentEntity, $requestContainer);

        $responseMapper = new AuthorizationResponseMapper();
        $responseTransfer = $responseMapper->getAuthorizationResponseTransfer($responseContainer);

        return $responseTransfer;
    }
447992
protected function updatePaymentTransaction(PaymentTransaction $paymentTransaction, CallbackResponse $callbackResponse)
    {
        $paymentTransaction->setStatus($callbackResponse->getStatus());
        $paymentTransaction->getPayment()->setPaynetId($callbackResponse->getPaymentPaynetId());

        if ($callbackResponse->isError() || $callbackResponse->isDeclined())
        {
            $paymentTransaction->addError($callbackResponse->getError());
        }
    }
829244
public function setStockTransfer(\Flowcode\ShopBundle\Entity\StockTransfer $stockTransfer = null)
    {
        $this->stockTransfer = $stockTransfer;

        return $this;
    }
736057
public function updatePaymentDetail(PaymentDetailTransfer $paymentDataTransfer, $idOrder)
    {
        $paymentEntity = $this->queryContainer->createPaymentByOrderId($idOrder)->findOne();
        $paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail();

        $paymentDetailEntity->fromArray($paymentDataTransfer->toArray());

        $paymentDetailEntity->save();
    }
14230
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity)
    {
        $paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail();

        $paymentMethodContainer = new OnlineBankTransferContainer();

        $paymentMethodContainer->setOnlineBankTransferType($paymentDetailEntity->getType());
        $paymentMethodContainer->setRedirect($this->createRedirectContainer($paymentEntity->getSpySalesOrder()->getOrderReference()));
        $paymentMethodContainer->setBankCountry($paymentDetailEntity->getBankCountry());
        $paymentMethodContainer->setBankAccount($paymentDetailEntity->getBankAccount());
        $paymentMethodContainer->setBankCode($paymentDetailEntity->getBankCode());
        $paymentMethodContainer->setBankGroupType($paymentDetailEntity->getBankGroupType());
        $paymentMethodContainer->setIban($paymentDetailEntity->getIban());
        $paymentMethodContainer->setBic($paymentDetailEntity->getBic());

        return $paymentMethodContainer;
    }
42670
public function getPaypalExpressCheckoutDetails(QuoteTransfer $quoteTransfer)
    {
        $paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(
            PayoneApiConstants::PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT
        );

        $baseGenericPaymentContainer = $paymentMethodMapper->createBaseGenericPaymentContainer();
        $baseGenericPaymentContainer->getPaydata()->setAction(
            PayoneApiConstants::PAYONE_EXPRESS_CHECKOUT_GET_DETAILS_ACTION
        );
        $requestContainer = $paymentMethodMapper->mapQuoteTransferToGenericPayment(
            $baseGenericPaymentContainer,
            $quoteTransfer
        );
        $responseTransfer = $this->performGenericRequest($requestContainer);

        return $responseTransfer;
    }
642582
protected function triggerEventsOnSuccess(PayoneTransactionStatusUpdateTransfer $transactionStatusUpdateTransfer)
    {
        if (!$transactionStatusUpdateTransfer->getIsSuccess()) {
            return;
        }

        $orderItems = SpySalesOrderItemQuery::create()
            ->useOrderQuery()
            ->useSpyPaymentPayoneQuery()
            ->filterByTransactionId($transactionStatusUpdateTransfer->getTxid())
            ->endUse()
            ->endUse()
            ->find();
        $this->getFactory()->getOmsFacade()->triggerEvent('PaymentNotificationReceived', $orderItems, []);

        if ($transactionStatusUpdateTransfer->getTxaction() === PayoneConstants::PAYONE_TXACTION_APPOINTED) {
            $this->getFactory()->getOmsFacade()->triggerEvent('RedirectResponseAppointed', $orderItems, []);
        }
    }
495439
public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer
    {
        $availableMethods = $this->getAvailablePaymentMethods($quoteTransfer);

        $result = new ArrayObject();

        foreach ($paymentMethodsTransfer->getMethods() as $paymentMethod) {
            if ($this->isPaymentMethodPayone($paymentMethod) && !$this->isAvailable($paymentMethod, $availableMethods)) {
                continue;
            }
            $result->append($paymentMethod);
        }
        $paymentMethodsTransfer->setMethods($result);

        return $paymentMethodsTransfer;
    }
531675
protected function initializeApiLog(SpyPaymentPayone $paymentEntity, AbstractRequestContainer $container)
    {
        $entity = new SpyPaymentPayoneApiLog();
        $entity->setSpyPaymentPayone($paymentEntity);
        $entity->setRequest($container->getRequest());
        $entity->setMode($container->getMode());
        $entity->setMerchantId($container->getMid());
        $entity->setPortalId($container->getPortalid());
        if ($container instanceof CaptureContainer || $container instanceof RefundContainer || $container instanceof DebitContainer) {
            $entity->setSequenceNumber($container->getSequenceNumber());
        }
        // Logging request data for debug
        $entity->setRawRequest(json_encode($container->toArray()));
        $entity->save();

        return $entity;
    }
391684
public function manageMandate(QuoteTransfer $quoteTransfer)
    {
        $manageMandateTransfer = new PayoneManageMandateTransfer();
        $manageMandateTransfer->setBankCountry($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBankcountry());
        $manageMandateTransfer->setBankAccount($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBankaccount());
        $manageMandateTransfer->setBankCode($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBankcode());
        $manageMandateTransfer->setIban($quoteTransfer->getPayment()->getPayoneDirectDebit()->getIban());
        $manageMandateTransfer->setBic($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBic());
        $personalData = new PayonePersonalDataTransfer();
        $customer = $quoteTransfer->getCustomer();
        $billingAddress = $quoteTransfer->getBillingAddress();
        $personalData->setCustomerId($customer->getIdCustomer());
        $personalData->setLastName($billingAddress->getLastName());
        $personalData->setFirstName($billingAddress->getFirstName());
        $personalData->setCompany($billingAddress->getCompany());
        $personalData->setCountry($billingAddress->getIso2Code());
        $personalData->setCity($billingAddress->getCity());
        $personalData->setStreet($billingAddress->getAddress1());
        $personalData->setZip($billingAddress->getZipCode());
        $personalData->setEmail($billingAddress->getEmail() ?? $customer->getEmail());
        $manageMandateTransfer->setPersonalData($personalData);

        return $this->getFactory()->createZedStub()->manageMandate($manageMandateTransfer);
    }