@param TdbPkgShopPaymentIpnMessage $oMessage

@return bool
549703
private function addTrigger(TdbPkgShopPaymentIpnMessage $oMessage)
    {
        $oGroup = $this->getPaymentHandlerGroup();
        $oStatus = $this->getIpnStatus();
        if (null === $oStatus) {
            return;
        }

        $query = "SELECT `pkg_shop_payment_ipn_trigger`.*
                    FROM `pkg_shop_payment_ipn_trigger`
              INNER JOIN `pkg_shop_payment_ipn_trigger_pkg_shop_payment_ipn_status_mlt` ON `pkg_shop_payment_ipn_trigger`.`id` = `pkg_shop_payment_ipn_trigger_pkg_shop_payment_ipn_status_mlt`.`source_id`
                   WHERE `pkg_shop_payment_ipn_trigger_pkg_shop_payment_ipn_status_mlt`.`target_id` = '".MySqlLegacySupport::getInstance()->real_escape_string(
                $oStatus->id
            )."'
                     AND `pkg_shop_payment_ipn_trigger`.`shop_payment_handler_group_id` = '".MySqlLegacySupport::getInstance()->real_escape_string(
                $oGroup->id
            )."'
        ";
        $oTriggerList = TdbPkgShopPaymentIpnTriggerList::GetList($query);
        if (0 === $oTriggerList->Length()) {
            return;
        }

        while ($oTrigger = $oTriggerList->Next()) {
            $oTriggerAction = TdbPkgShopPaymentIpnMessageTrigger::GetNewInstance();
            $aData = array(
                'pkg_shop_payment_ipn_trigger_id' => $oTrigger->id,
                'pkg_shop_payment_ipn_message_id' => $oMessage->id,
                'datecreated' => date('Y-m-d H:i:s'),
                'next_attempt' => date('Y-m-d H:i:s'),
            );
            $oTriggerAction->SaveFieldsFast($aData);
        }
    }
1143795
protected function askQuestionExecute($aData)
    {
        $oMailProfile = TdbDataMailProfile::GetProfile('product-info-request');
        $oMailProfile->AddDataArray($aData);
        // now add product info as well
        /** @var $oActiveProduct TdbShopArticle */
        $oActiveProduct = TdbShop::GetActiveItem();
        $aArticleData = $oActiveProduct->GetObjectPropertiesAsArray();
        $oMailProfile->AddDataArray($aArticleData);
        // add link to article

        $sLink = $oActiveProduct->getLink(true, null, array(TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY => null));
        $oMailProfile->AddData('sLink', $sLink);
        $oMailProfile->ChangeFromAddress($aData['email'], $aData['name']);
        $oMailProfile->SendUsingObjectView('emails', 'Customer');

        $oMsgManager = TCMSMessageManager::GetInstance();
        $oMsgManager->AddMessage($this->sModuleSpotName, 'QUESTION-SEND');

        $this->getRedirect()->redirect($this->getActivePageService()->getActivePage()->GetRealURLPlain());
    }
775484
private function validateBasketContentBuyable(TShopBasketArticle $oBasketArticle, $sMessageManager)
    {
        $bValid = true;
        if (false === $oBasketArticle->IsBuyable()) {
            $oMessage = TCMSMessageManager::GetInstance();
            $aErrorCodes = $oBasketArticle->GetSQLWithTablePrefix();
            $oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-ARTICLE-NOT-BUYABLE', $aErrorCodes);
            if ($this->IsInList($oBasketArticle)) {
                $this->RemoveArticle($oBasketArticle);
            }
            $bValid = false;
        }

        return $bValid;
    }
427707
public function AddVoucher(TdbShopVoucher &$oVoucher, $sMessageHandler)
    {
        $bVoucherAdded = false;
        $oMessageManager = TCMSMessageManager::GetInstance();

        $oVoucherSeries = $oVoucher->GetFieldShopVoucherSeries();
        $aMessageData = $oVoucherSeries->GetObjectPropertiesAsArray();
        $aVoucherData = $oVoucher->GetObjectPropertiesAsArray();
        $aMessageData = array_merge($aMessageData, $aVoucherData);

        $cAllowUseOfVoucherResult = $oVoucher->AllowUseOfVoucher();
        if (TdbShopVoucher::ALLOW_USE != $cAllowUseOfVoucherResult) {
            if (TdbShopVoucher::USE_ERROR_NOT_VALID_FOR_CUSTOMER_GROUP_MISSING_LOGIN == $cAllowUseOfVoucherResult ||
               TdbShopVoucher::USE_ERROR_NOT_VALID_FOR_CUSTOMER_MISSING_LOGIN == $cAllowUseOfVoucherResult) {
                $oExtranet = TdbDataExtranet::GetInstance();
                if (!is_null($oExtranet)) {
                    $aMessageData['sLinkLoginStart'] = '<a href="'.$oExtranet->GetLinkLoginPage().'">';
                    $aMessageData['sLinkLoginEnd'] = '</a>';
                }
            }
            $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ERROR-'.$cAllowUseOfVoucherResult, $aMessageData);
        } else {
            $this->GetActiveVouchers()->AddItem($oVoucher);
            $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ADDED', $aMessageData);
            $bVoucherAdded = true;
            $this->SetBasketRecalculationFlag();
        }

        return $bVoucherAdded;
    }
489932
function addMessage(oMessage) {
			var oReportMessage = {
					code : oMessage.code,
					message : oMessage.message,
					technical : oMessage.technical
				};

			Object.keys(oMessage).forEach(function (sProperty) {
				if (sProperty[0] === '@') {
					if (sProperty.endsWith(".numericSeverity")) {
						oReportMessage.numericSeverity = oMessage[sProperty];
					} else if (sProperty.endsWith(".longtextUrl") && oError.requestUrl
							&& sResourcePath) {
						oReportMessage.longtextUrl =
							_Helper.makeAbsolute(oMessage[sProperty], oError.requestUrl);
					}
				}
			});

			if (typeof oMessage.target !== "string") {
				aUnboundMessages.push(oReportMessage);
			} else if (oMessage.target[0] === "$" || !sResourcePath) {
				// target for the bound message cannot be resolved -> report as unbound message
				oReportMessage.message = oMessage.target + ": " + oReportMessage.message;
				aUnboundMessages.push(oReportMessage);
			} else {
				oReportMessage.target = oMessage.target;
				oReportMessage.transition = true;
				aBoundMessages.push(oReportMessage);
			}
		}
1137333
protected function setBodyWithAttachments(Mail\Message $oMessage, array $aAttachments, $sHtml, $sPlain)
    {
        $oContent = $this->getContentMessage($sHtml, $sPlain);

        $oContentPart = new Mime\Part($oContent->generateMessage());
        $oContentPart->setType(Mime\Mime::MULTIPART_ALTERNATIVE);
        $oContentPart->setBoundary($oContent->getMime()->boundary());

        $oBody = new Mime\Message();
        $oBody->addPart($oContentPart);

        foreach ($aAttachments as $aAttachmentData) {
            if (isset($aAttachmentData['file_path']) && is_readable($aAttachmentData['file_path'])) {
                $aAttachmentData['file_data'] = file_get_contents($aAttachmentData['file_path']);
            }

            if (isset($aAttachmentData['file_data']) && $aAttachmentData['file_data'] != '') {
                $oAttachment = new Mime\Part();
                $oAttachment
                    ->setContent($aAttachmentData['file_data'])
                    ->setType(Mime\Mime::TYPE_OCTETSTREAM)
                    ->setFileName($aAttachmentData['name'])
                    ->setDisposition(Mime\Mime::DISPOSITION_ATTACHMENT)
                    ->setEncoding(Mime\Mime::ENCODING_BASE64);

                $oBody->addPart($oAttachment);
            }
        }

        $oMessage->setBody($oBody);

        return $this;
    }
1216967
public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
    {
        $bPaymentOk = parent::ExecutePayment($oOrder);

        if ($bPaymentOk && $this->TransactionMatchesCurrentBasketState()) {
            $bPaymentOk = $this->UpdateTransaction('SAS'); //capture
        } else {
            $bPaymentOk = false;
        }

        return $bPaymentOk;
    }
609671
public function sendCustomerConfirmation(
        $recipient,
        ApiOrderInterface $apiOrder,
        ContactInterface $customerContact = null
    ) {
        if (!$this->sendEmailConfirmationToCustomer) {
            return false;
        }

        return $this->sendConfirmationEmail(
            $recipient,
            $apiOrder,
            $this->templateCustomerConfirmationPath,
            $customerContact
        );
    }
719696
public function getIPNStatus(TPkgShopPaymentIPNRequest $oRequest)
    {
        $aPayload = $oRequest->getRequestPayload();
        $sStatusCode = null;
        if (false === isset($aPayload['ret_status'])) {
            return null;
        }

        $sCode = trim($aPayload['ret_status']);
        $oStatus = TdbPkgShopPaymentIpnStatus::GetNewInstance();
        if (false === $oStatus->LoadFromFields(array('code' => $sCode, 'shop_payment_handler_group_id' => $this->id))) {
            return null;
        }

        return $oStatus;
    }
62256
public function addTransaction(TPkgShopPaymentTransactionData $transactionData)
    {
        $transactionData->checkRequirements();

        $sTransactionType = $transactionData->getType();
        $amount = $transactionData->getTotalValue();
        $oContext = $transactionData->getContext();
        $iSequenceNumber = $transactionData->getSequenceNumber();

        $oTransactionType = $this->getTransactionTypeObject($sTransactionType);

        if (null === $iSequenceNumber) {
            $iSequenceNumber = $this->getNextTransactionSequenceNumber();
        }
        if (self::TRANSACTION_TYPE_CREDIT == $sTransactionType || self::TRANSACTION_TYPE_PAYMENT_REVERSAL === $sTransactionType) {
            $amount = -1 * $amount;
        }
        $aData = array(
            'shop_order_id' => $this->order->id,
            'data_extranet_user_id' => (null !== $oContext->getExtranetUser()) ? ($oContext->getExtranetUser(
            )->id) : (''),
            'cms_user_id' => (null !== $oContext->getCmsUser()) ? ($oContext->getCmsUser()->id) : (''),
            'datecreated' => date('Y-m-d H:i:s'),
            'ip' => $oContext->getIp(),
            'amount' => $amount,
            'context' => $oContext->getContext(),
            'pkg_shop_payment_transaction_type_id' => $oTransactionType->id,
            'sequence_number' => $iSequenceNumber,
            'confirmed' => '0',
        );

        $oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance($aData);

        $oTransaction->AllowEditByAll(true);
        $oTransaction->SaveFieldsFast($aData);
        $oTransaction->AllowEditByAll(false);

        // add items
        $aItems = $transactionData->getItems();
        /** @var TPkgShopPaymentTransactionItemData $oItem */
        $itemAmountMultiplier = 1;
        if (self::TRANSACTION_TYPE_CREDIT == $sTransactionType || self::TRANSACTION_TYPE_PAYMENT_REVERSAL === $sTransactionType) {
            $itemAmountMultiplier = -1;
        }

        foreach ($aItems as $oItem) {
            $aData = array(
                'pkg_shop_payment_transaction_id' => $oTransaction->id,
                'amount' => ($itemAmountMultiplier * $oItem->getAmount()),
                'value' => $oItem->getValue(),
                'shop_order_item_id' => $oItem->getOrderItemId(),
                'type' => $oItem->getType(),
            );
            $oTransactionPosition = TdbPkgShopPaymentTransactionPosition::GetNewInstance($aData);
            $oTransactionPosition->AllowEditByAll(true);
            $oTransactionPosition->SaveFieldsFast($aData);
        }

        if (true === $transactionData->getConfirmed()) {
            $this->confirmTransaction($iSequenceNumber, $transactionData->getConfirmedTimestamp());
        }

        return $oTransaction;
    }
248182
private function convertApiToLogMessageException($request, \OffAmazonPaymentsService_Exception $e, $methodName)
    {
        return new TPkgCmsException_LogAndMessage(AmazonPayment::ERROR_CODE_API_ERROR, array(
            'message' => $e->getMessage(),
            'responseCode' => $e->getStatusCode(),
            'errorCode' => $e->getErrorCode(),
            'errorType' => $e->getErrorType(),
        ), "amazon api error when trying to {$methodName} on order ref {$this->amazonOrderReferenceId}", array(
            'api exception' => (string) $e,
            'request' => $request,
        ));
    }
901972
protected function ExecuteDataTransPaymentCall(TdbShopOrder &$oOrder)
    {
        $sXMLSettlement = $this->GetXMLSettlement();
        $ch = curl_init();
        $settlementurl = trim($this->GetTestLiveModeParameter('settlementurl'));
        curl_setopt($ch, CURLOPT_URL, $settlementurl);
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, 'xmlRequest='.$sXMLSettlement);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        $sResponse = curl_exec($ch);
        $sCurlError = curl_error($ch);
        $bPaymentOk = $this->SettlementResponseSuccess($sResponse);
        if (!$bPaymentOk) {
            if (!empty($sCurlError)) {
                TTools::WriteLogEntrySimple('Payment DataTrans: curl failed to ['.$this->GetConfigParameter('settlementurl')."] using xml [{$sXMLSettlement}] with error: ".$sCurlError, 1, __FILE__, __LINE__);
            }
            $iFailure = $this->GetConfigParameter('failure_settlement');
            if ('1' === $iFailure) {
                if ($this->SendFailureSettlementMail($oOrder)) {
                    $bPaymentOk = true;
                } else {
                    TTools::WriteLogEntrySimple('Payment DataTrans: Es konnte keine Abbuchungsfehlere-mail versand werden', 1, __FILE__, __LINE__);
                }
            }
        }
        curl_close($ch);

        return $bPaymentOk;
    }
590826
public function Message($msg = '', $append = false)
    {
        if (is_null($msg)) {
            $this->_msg = array();
        } elseif (is_array($msg)) {
            if ($append) {
                $this->_msg = array_merge($this->_msg, $msg);
            } else {
                $this->_msg = $msg;
            }
            return $this->_msg;
        }
        return $this->_msg;
    }
159149
public function isSuccessful()
    {
        // As per appendix F, 000 means the message was processed correctly
        if ((string) $this->data->Status->statusCode !== '000'
            || ($this->hasTransaction()
                && (string) $this->data->Payment->TxnList->Txn->approved !== 'Yes')) {
            return false;
        }

        return true;
    }
1005104
protected function checkUserShippingCountry(TdbDataExtranetUser $oUser)
    {
        $bIsValidShippingCountry = false;
        $aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getShippingCountryIds($this->id);
        if (count($aShippingCountryRestriction) > 0) {
            $oShippingAddress = $oUser->GetShippingAddress();
            if (in_array($oShippingAddress->fieldDataCountryId, $aShippingCountryRestriction)) {
                $bIsValidShippingCountry = true;
            }
        } else {
            $bIsValidShippingCountry = true;
        }

        return $bIsValidShippingCountry;
    }
861282
protected function handleTransactionHook(IPkgShopPaymentIPNHandler $oHandler, TPkgShopPaymentIPNRequest $oRequest)
    {
        $oOrder = $oRequest->getOrder();
        if (null === $oOrder) {
            return;
        }

        $oTransactionDetails = $oHandler->getIPNTransactionDetails($oRequest);
        if (null === $oTransactionDetails) {
            return;
        }

        $oTransactionManager = new TPkgShopPaymentTransactionManager($oOrder);

        $sStatus = '';
        $oStatus = $oRequest->getIpnStatus();
        if (null !== $oStatus) {
            $sStatus = $oStatus->fieldCode;
        }

        $oTransaction = null;
        // try to update the corresponding transaction first
        if (null !== $oTransactionDetails->getSequenceNumber()) {
            $oTransaction = $oTransactionManager->confirmTransaction(
                $oTransactionDetails->getSequenceNumber(),
                $oTransactionDetails->getTransactionTimestamp()
            );
        }

        if (null === $oTransaction) {
            \ChameleonSystem\CoreBundle\ServiceLocator::get('monolog.logger.order_payment_ipn')->warning(
                "IPN had transaction data but no matching transaction was found. order-id: {$oOrder->id}, ordernumber: {$oOrder->fieldOrdernumber}",
                array('request' => $oRequest->getRequestPayload())
            );
        }
    }
49114
public function pass(CommitMessage $msg) : bool
    {
        $subjectLength = strlen($msg->getSubject());
        if ($subjectLength > $this->maxLength) {
            $this->hint .= ' (' . $subjectLength . ')';
            return false;
        }
        return true;
    }