Sends a confirmation email to the shop-owner.

@param null|string $recipient
@param ApiOrderInterface $apiOrder
@param ContactInterface $customerContact

@return bool
500360
public function sendShopownerConfirmation(
        $recipient,
        ApiOrderInterface $apiOrder,
        ContactInterface $customerContact = null
    ) {
        if (!$this->sendEmailConfirmationToShopowner) {
            return false;
        }

        if (empty($recipient)) {
            // fallback address for shop-owner order confirmations
            $recipient = $this->confirmationRecipientEmailAddress;
        }

        return $this->sendConfirmationEmail(
            $recipient,
            $apiOrder,
            $this->templateShopownerConfirmationPath,
            $customerContact
        );
    }
771914
protected function getContentForPdf(ApiOrderInterface $apiOrder)
    {
        $order = $apiOrder->getEntity();

        $customerNumber = null;

        if ($order->getCustomerAccount()) {
            $customerNumber = $order->getCustomerAccount()->getNumber();
        } else {
            $customerNumber = sprintf('%05d', $order->getCustomerContact()->getId());
        }

        $data = [
            'recipient' => $order->getDeliveryAddress(),
            'responsibleContact' => $order->getResponsibleContact(),
            'deliveryAddress' => $order->getDeliveryAddress(),
            'customerContact' => $order->getCustomerContact(),
            'billingAddress' => $order->getInvoiceAddress(),
            'order' => $order,
            'customerNumber' => $customerNumber,
            'orderApiEntity' => $apiOrder,
            'itemApiEntities' => $apiOrder->getItems(),
            'templateBasePath' => $this->templateBasePath,
            'templateMacrosPath' => $this->templateMacrosPath,
            'website_locale' => $this->websiteLocale,
        ];

        return $data;
    }
293105
public function confirmTransaction($iSequenceNumber, $iConfirmedDate)
    {
        $oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance();
        $loadData = array('shop_order_id' => $this->order->id, 'sequence_number' => $iSequenceNumber);
        if (true === $oTransaction->LoadFromFields($loadData)) {
            $oTransaction = $this->confirmTransactionObject($oTransaction, $iConfirmedDate);
        } else {
            $oTransaction = null;
        }

        return $oTransaction;
    }
469252
public function sendContactReply(bool $quoteOriginal = false): SendContact
	{
		$m = $this->bot->sendContact();
		$this->setReplyMarkup($m, $quoteOriginal);
		return $m;
	}
836228
public function verifyPayment($paymentToken) {
        $transfer = $this->transferFactory->create([]);

        try {
            $response = $this->getHttpClient('charges/' . $paymentToken, $transfer)->request();
            $result   = (array) json_decode($response->getBody(), true);

            if( array_key_exists('errorCode', $result) ) {
                throw new ApiClientException($result['message'], $result['errorCode'], $result['eventId']);
            }

            $this->putGatewayResponseToHolder($result);

            return $result;
        }
        catch (Zend_Http_Client_Exception $e) {
            throw new ClientException(__($e->getMessage()));
        }
    }
436875
private function sendTokenEmail(UserInterface $user, $from, $to)
    {
        if (null === $user->getPasswordResetToken()) {
            throw new NoTokenFoundException($user);
        }

        $maxNumberEmails = $this->getParameter('sulu_security.reset_password.mail.token_send_limit');

        if ($user->getPasswordResetTokenEmailsSent() === $maxNumberEmails) {
            throw new TokenEmailsLimitReachedException($maxNumberEmails, $user);
        }
        $mailer = $this->get('mailer');
        $em = $this->getDoctrine()->getManager();
        $message = $mailer->createMessage()->setSubject(
                $this->getSubject()
            )->setFrom($from)->setTo($to)->setBody(
                $this->getMessage($user)
            );
        $mailer->send($message);
        $user->setPasswordResetTokenEmailsSent($user->getPasswordResetTokenEmailsSent() + 1);
        $em->persist($user);
        $em->flush();
    }
1173923
private function processEmail(UserInterface $user, $email, $contact = null)
    {
        if ($contact) {
            // if no email passed try to use the contact's first email
            if (null === $email &&
                array_key_exists('emails', $contact) && count($contact['emails']) > 0 &&
                $this->isEmailUnique($contact['emails'][0]['email'])
            ) {
                $email = $contact['emails'][0]['email'];
            }
            if (null !== $email) {
                if (!$this->isEmailUnique($email)) {
                    throw new EmailNotUniqueException($email);
                }
                $user->setEmail($email);
            }
        } else {
            if (null !== $email) {
                if ($email !== $user->getEmail() &&
                    !$this->isEmailUnique($email)
                ) {
                    throw new EmailNotUniqueException($email);
                }
                $user->setEmail($email);
            } else {
                $user->setEmail(null);
            }
        }
    }
1359488
public function send(Recipient $user, MessageContract $message, Closure $callback = null): ReceiptContract
    {
        $view = $message->getView();
        $data = $message->getData();
        $subject = $message->getSubject();

        $this->mailer->send($view, $data, $this->createMessageCallback($user, $subject, $callback));

        return new Receipt($this->mailer, false);
    }
90381
private function createContact($apiClient, $customerEmail, $website, $contactFromTable)
    {
        $consentModel = $this->consentFactory->create();
        $consentData = $consentModel->getFormattedConsentDataByContactForApi(
            $website->getId(),
            $customerEmail
        );

        if (empty(! $consentData)) {
            $needToConfirm = $this->helper->getWebsiteConfig(
                \Magento\Newsletter\Model\Subscriber::XML_PATH_CONFIRMATION_FLAG,
                $website->getId()
            );
            $optInType = ($needToConfirm)? 'Double' : 'Single';
            $contactData = [
                'Email' => $customerEmail,
                'EmailType' => 'Html',
                'OptInType' => $optInType,
            ];

            $contact = $apiClient->postContactWithConsent(
                $contactData,
                $consentData
            );

        } else {
            $contact = $apiClient->postContacts(
                $customerEmail
            );
        }

        if (isset($contact->id)) {
            $contactFromTable->setContactId($contact->id);
            $this->helper->saveContact($contactFromTable);
        }

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

        $aParams = array();
        // payment preauthorization values
        if (isset($_SESSION['3ds_payment'])) {
            $aParams = $_SESSION['3ds_payment'];
            unset($_SESSION['3ds_payment']);
        }

        // execute preauthorization
        $aResponse = $this->PayOnePreauthorization($aParams, $oOrder);
        if ($aResponse['success']) {
            $bPaymentOk = true;
            // reset payOne session
            if (isset($_SESSION['PayOneResponse'])) {
                unset($_SESSION['PayOneResponse']);
            }
        } else {
            $bPaymentOk = false;
        }

        if (!$bPaymentOk) {
            $oMsgManager = TCMSMessageManager::GetInstance();
            $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => $aResponse['errormessage']));
        }

        return $bPaymentOk;
    }
1149267
public function send( $to, $subject, $body )
	{
		// Debug advice:
		if ( \Sifo\Domains::getInstance()->getDebugMode() )
		{
			$this->_dispatchMailController( $to, $subject, $body );
		}
		return parent::send( $to, $subject, $body );
	}
396130
public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
    {
        $bPaymentOk = parent::ExecutePayment($oOrder);

        $aCommand = array('trefnum' => $this->sMontradaTransactionId, 'amount' => round($oOrder->fieldValueTotal * 100));
        $aAnswer = $this->ExecuteRequestCall('capture', $aCommand);
        if (array_key_exists('rc', $aAnswer) && '000' == $aAnswer['rc']) {
            $bPaymentOk = true;
            // add the response data to the order
            foreach ($aAnswer as $sKey => $sVal) {
                if (!array_key_exists($sKey, $this->aPaymentUserData)) {
                    $this->aPaymentUserData[$sKey] = $sVal;
                }
            }
            $this->SaveUserPaymentDataToOrder($oOrder->id);
            $oOrder->SetStatusPaid();
        } else {
            $bPaymentOk = false;
        }

        if (!$bPaymentOk) {
            // error!
            $sMsg = 'unbekannt';
            if (array_key_exists('rmsg', $aAnswer)) {
                $sMsg = $aAnswer['rmsg'];
            }
            $oMsgManager = TCMSMessageManager::GetInstance();
            $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => $sMsg));
        }

        return $bPaymentOk;
    }
833022
public function submitCartDirectly(
        ApiOrderInterface $cart,
        UserInterface $user,
        $locale
    ) {
        $orderWasSubmitted = true;

        try {
            $this->checkIfCartIsValid($user, $cart, $locale);

            // set order-date to current date
            $cart->setOrderDate(new \DateTime());

            // change status of order to confirmed
            $this->orderManager->convertStatus($cart, OrderStatus::STATUS_CONFIRMED);

            // order-addresses have to be set to the current contact-addresses
            $this->reApplyOrderAddresses($cart, $user);

            $customer = $user->getContact();

            // send confirmation email to customer
            $this->orderEmailManager->sendCustomerConfirmation(
                $customer->getMainEmail(),
                $cart,
                $customer
            );

            $shopOwnerEmail = null;

            // get responsible person of contacts account
            if ($customer->getMainAccount() &&
                $customer->getMainAccount()->getResponsiblePerson() &&
                $customer->getMainAccount()->getResponsiblePerson()->getMainEmail()
            ) {
                $shopOwnerEmail = $customer->getMainAccount()->getResponsiblePerson()->getMainEmail();
            }

            // send confirmation email to shop owner
            $this->orderEmailManager->sendShopOwnerConfirmation(
                $shopOwnerEmail,
                $cart,
                $customer
            );

            // flush on success
            $this->em->flush();
        } catch (CartSubmissionException $cse) {
            $orderWasSubmitted = false;
        }

        return $orderWasSubmitted;
    }
1012661
protected static function can_contact_user(int $recipientid, int $senderid) : bool {
        if (has_capability('moodle/site:messageanyuser', \context_system::instance(), $senderid) ||
            $recipientid == $senderid) {
            // The sender has the ability to contact any user across the entire site or themselves.
            return true;
        }

        // The initial value of $cancontact is null to indicate that a value has not been determined.
        $cancontact = null;

        if (self::is_blocked($recipientid, $senderid)) {
            // The recipient has specifically blocked this sender.
            $cancontact = false;
        }

        $sharedcourses = null;
        if (null === $cancontact) {
            // There are three user preference options:
            // - Site: Allow anyone not explicitly blocked to contact me;
            // - Course members: Allow anyone I am in a course with to contact me; and
            // - Contacts: Only allow my contacts to contact me.
            //
            // The Site option is only possible when the messagingallusers site setting is also enabled.

            $privacypreference = self::get_user_privacy_messaging_preference($recipientid);
            if (self::MESSAGE_PRIVACY_SITE === $privacypreference) {
                // The user preference is to allow any user to contact them.
                // No need to check anything else.
                $cancontact = true;
            } else {
                // This user only allows their own contacts, and possibly course peers, to contact them.
                // If the users are contacts then we can avoid the more expensive shared courses check.
                $cancontact = self::is_contact($senderid, $recipientid);

                if (!$cancontact && self::MESSAGE_PRIVACY_COURSEMEMBER === $privacypreference) {
                    // The users are not contacts and the user allows course member messaging.
                    // Check whether these two users share any course together.
                    $sharedcourses = enrol_get_shared_courses($recipientid, $senderid, true);
                    $cancontact = (!empty($sharedcourses));
                }
            }
        }

        if (false === $cancontact) {
            // At the moment the users cannot contact one another.
            // Check whether the messageanyuser capability applies in any of the shared courses.
            // This is intended to allow teachers to message students regardless of message settings.

            // Note: You cannot use empty($sharedcourses) here because this may be an empty array.
            if (null === $sharedcourses) {
                $sharedcourses = enrol_get_shared_courses($recipientid, $senderid, true);
            }

            foreach ($sharedcourses as $course) {
                // Note: enrol_get_shared_courses will preload any shared context.
                if (has_capability('moodle/site:messageanyuser', \context_course::instance($course->id), $senderid)) {
                    $cancontact = true;
                    break;
                }
            }
        }

        return $cancontact;
    }
440050
protected function SendFailureSettlementMail(TdbShopOrder &$oOrder)
    {
        $bSendMail = false;
        $oMail = TdbDataMailProfile::GetProfile('payment_datatrans_error_settlement');
        if (!is_null($oMail)) {
            $sInfo = TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.payment_data_trans.settlement_failure_mail_info',
                    array(
                        '%ordernumber%' => $oOrder->fieldOrdernumber,
                        '%ref%' => $this->GetRefNoParameter(false),
                    )
                ));
            $oMail->AddData('sInfo', $sInfo);
            $bSendMail = $oMail->SendUsingObjectView('emails', 'Customer');
        }

        return $bSendMail;
    }
157540
public function sendContactMail($emailAddress = null, $subject = null, $message = null)
    {

        // shop info
        $shop = $this->_getShop();

        //set mail params (from, fromName, smtp)
        $this->_setMailParams($shop);

        $this->setBody($message);
        $this->setSubject($subject);

        $this->setRecipient($shop->oxshops__oxinfoemail->value, "");
        $this->setFrom($shop->oxshops__oxowneremail->value, $shop->oxshops__oxname->getRawValue());
        $this->setReplyTo($emailAddress, "");

        return $this->send();
    }
822647
public function send($message, $recipient, $mustInit = true)
    {
        if ($mustInit) $this->_init();

        $message_id = $this->_generateMessageId();
        $params = array(
            'message_type' => MESSAGE_TYPE_3,
            'mobile_number' => $recipient,
            'shortcode' => $this->short_code,
            'message_id' => $message_id,
            'message' => $message,
            'client_id' => $this->client_id,
            'secret_key' => $this->secret_key,
        );

        $query = http_build_query($params);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->url);
        curl_setopt($ch, CURLOPT_POST, count($params));
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);

        // Add the message_id in the response.
        $response = json_decode($response, true);
        $response['message_id'] = $message_id;
        $response = json_encode($response);

        return $response;
    }