diff --git a/MailMessage.php b/MailMessage.php
new file mode 100644
index 0000000..ffa0eb4
--- /dev/null
+++ b/MailMessage.php
@@ -0,0 +1,415 @@
+fileAttachment !== null) {
+ $this->fileAttachment = new MailMessageAttachment($input->fileAttachment);
+ }
+ $this->fromEmailAddress = $input->fromEmailAddress;
+ $this->fromName = $input->fromName;
+ $this->langId = $input->langId;
+ $this->shopId = $input->shopId;
+ $this->subject = $input->subject;
+ $this->templateFolderPath = $input->templateFolderPath;
+ $this->modeSmtp = $input->modeSmtp;
+ $this->templateName = $input->templateName;
+ $this->templateVariables = $input->templateVariables;
+ $this->toEmailAddress = $input->toEmailAddress;
+ $this->toName = $input->toName;
+ $this->bcc = $input->bcc;
+ $this->replyTo = $input->replyTo;
+ $this->replyToName = $input->replyToName;
+ }
+ }
+
+ /**
+ * Returns the id of the language of the mail message.
+ *
+ * @return string
+ */
+ public function getLangId(){
+ return $this->langId;
+ }
+
+ /**
+ * Sets the language id for the message.
+ *
+ * @param int $langId
+ * @return MailMessage
+ */
+ public function setLangId($langId){
+ $this->langId = $langId;
+ return $this;
+ }
+
+ /**
+ * Returns the name of the template to use for this message.
+ *
+ * @return string
+ */
+ public function getTemplateName(){
+ return $this->templateName;
+ }
+
+ /**
+ * Sets the template to be used for this message.
+ *
+ * @param string $templateName
+ * @return MailMessage
+ */
+ public function setTemplateName($templateName){
+ $this->templateName = $templateName;
+ return $this;
+ }
+
+ /**
+ * Returns the message subject.
+ *
+ * @return string
+ */
+ public function getSubject(){
+ return $this->subject;
+ }
+
+ /**
+ * Sets the subject of the message. The subject will be modified
+ * by the sending method by prepending the following string:
+ * [Shop Name]
+ *
+ * The prefix can not be removed.
+ *
+ * @param string $subject
+ * @return MailMessage
+ */
+ public function setSubject($subject){
+ $this->subject = $subject;
+ return $this;
+ }
+
+ /**
+ * Returns the variables for the template. The variables
+ * will be replaced in the template. The result is the
+ * body of the message.
+ *
+ * e.g. array (
+ * '{delivery_company}',
+ * '{carrier}',
+ * )
+ *
+ * @return array
+ */
+ public function getTemplateVariables(){
+ return $this->templateVariables;
+ }
+
+ /**
+ * Sets the variables for the template. The variables are replaced
+ * in the body of the message.
+ *
+ * e.g. array (
+ * '{delivery_company}',
+ * '{carrier}',
+ * )
+ *
+ * @param array $templateVariables
+ * @return MailMessage
+ */
+ public function setTemplateVariables(array $templateVariables){
+ $this->templateVariables = $templateVariables;
+ return $this;
+ }
+
+ /**
+ * Adds the given template variable.
+ *
+ * Sample Name: {delivery_company}
+ * Sample Value: Some Name of a Company
+ *
+ * The value should be also a string.
+ *
+ * @param string $name
+ * @param string $value
+ * @return MailMessage
+ */
+ public function addTemplateVariable($name, $value) {
+ $this->templateVariables[$name] = $value;
+ return $this;
+ }
+
+ /**
+ * Returns the mail address to which the mail is
+ * sent to.
+ *
+ * @return string
+ */
+ public function getToEmailAddress(){
+ return $this->toEmailAddress;
+ }
+
+ /**
+ * Sets the mail address to which the mail is sent to.
+ *
+ * @param string $toEmailAddress
+ * @return MailMessage
+ */
+ public function setToEmailAddress($toEmailAddress){
+ $this->toEmailAddress = $toEmailAddress;
+ return $this;
+ }
+
+ /**
+ * Returns the name to which the mail is sent to. E.g. the
+ * customer name in case of the order confirmation.
+ *
+ * @return string
+ */
+ public function getToName(){
+ return $this->toName;
+ }
+
+ /**
+ * Sets the name to which the mail is sent to. E.g. the customer
+ * name in case of the order confirmation.
+ *
+ * @param string $toName
+ * @return MailMessage
+ */
+ public function setToName($toName){
+ $this->toName = $toName;
+ return $this;
+ }
+
+ /**
+ * Returns the e-mail address of the sender. In most cases
+ * this is the store e-mail address.
+ *
+ * @return string
+ */
+ public function getFromEmailAddress(){
+ return $this->fromEmailAddress;
+ }
+
+ /**
+ * Sets the e-mail address of the sender. In most cases
+ * this is the store e-mail address.
+ *
+ * @param string $fromEmailAddress
+ * @return MailMessage
+ */
+ public function setFromEmailAddress($fromEmailAddress){
+ $this->fromEmailAddress = $fromEmailAddress;
+ return $this;
+ }
+
+ /**
+ * Returns the name of the sender.
+ *
+ * @return string
+ */
+ public function getFromName(){
+ return $this->fromName;
+ }
+
+ /**
+ * Sets the name of the sender.
+ *
+ * @param string $fromName
+ * @return MailMessage
+ */
+ public function setFromName($fromName){
+ $this->fromName = $fromName;
+ return $this;
+ }
+
+ /**
+ * Returns the file attachment of the mail. See MailMessageAttachment for more
+ * information about the format etc.
+ *
+ * @return MailMessageAttachment
+ */
+ public function getFileAttachment(){
+ return $this->fileAttachment;
+ }
+
+ /**
+ * Sets the mail attachment.
+ *
+ * @param MailMessageAttachment $fileAttachment
+ * @return MailMessage
+ */
+ public function setFileAttachment(MailMessageAttachment $fileAttachment){
+ $this->fileAttachment = $fileAttachment;
+ return $this;
+ }
+
+ /**
+ * Sets the path in which the mail template is searched. By default it points
+ * to _PS_MAIL_DIR_.
+ *
+ * @return string
+ */
+ public function getTemplateFolderPath(){
+ return $this->templateFolderPath;
+ }
+
+ /**
+ * Sets the path in which the mail template is searched. By default it points
+ * to _PS_MAIL_DIR_.
+ *
+ * @param string $templateFolderPath
+ * @return MailMessage
+ */
+ public function setTemplateFolderPath($templateFolderPath){
+ $this->templateFolderPath = $templateFolderPath;
+ return $this;
+ }
+
+
+ /**
+ * Gets the SMTP mode.
+ *
+ * @return string
+ */
+ public function getModeSMTP(){
+ return $this->modeSmtp;
+ }
+
+ /**
+ * Sets the SMTP mode.
+ *
+ * @param string $modeSmtp
+ * @return MailMessage
+ */
+ public function setModeSMTP($modeSmtp){
+ $this->modeSmtp = $modeSmtp;
+ return $this;
+ }
+
+
+ /**
+ * Returns the shop id.
+ *
+ * @return int
+ */
+ public function getShopId(){
+ return $this->shopId;
+ }
+
+ /**
+ * Sets the shop id.
+ *
+ * @param int $shopId
+ * @return MailMessage
+ */
+ public function setShopId($shopId){
+ $this->shopId = $shopId;
+ return $this;
+ }
+
+ /**
+ * Returns the BCC of the message.
+ *
+ * @return string
+ */
+ public function getBcc() {
+ return $this->bcc;
+ }
+
+ /**
+ * Sets the BCC of the message.
+ *
+ * @param string $bcc
+ * @return MailMessage
+ */
+ public function setBcc($bcc) {
+ $this->bcc = $bcc;
+ return $this;
+ }
+
+ /**
+ * Returns the reply to header of the e-mail message.
+ *
+ * @return the reply to header of the e-mail message.
+ */
+ public function getReplyTo() {
+ return $this->replyTo;
+ }
+
+ /**
+ * Sets the reply to header of the e-mail message.
+ *
+ * @param string $replyTo the reply to header of the e-mail message.
+ * @return MailMessage this message object.
+ */
+ public function setReplyTo($replyTo) {
+ $this->replyTo = $replyTo;
+ return $this;
+ }
+
+ /**
+ * Returns the name of the reply to receipient.
+ *
+ * @return string
+ */
+ public function getReplyToName() {
+ return $this->replyToName;
+ }
+
+ /**
+ * Sets the name of the reply to recipient.
+ *
+ * @param string $replyToName the name of the reply to receipient.
+ * @return MailMessage this message object.
+ */
+ public function setReplyToName($replyToName) {
+ $this->replyToName = $replyToName;
+ return $this;
+ }
+
+}
\ No newline at end of file
diff --git a/MailMessageAttachment.php b/MailMessageAttachment.php
new file mode 100644
index 0000000..7fdcee2
--- /dev/null
+++ b/MailMessageAttachment.php
@@ -0,0 +1,122 @@
+content = $input->content;
+ $this->name = $input->name;
+ $this->mimeType = $input->mimeType;
+ }
+ else if (is_array($input)) {
+ if (isset($input['content'])) {
+ $this->setContent($input['content']);
+ }
+ if (isset($input['name'])) {
+ $this->setName($input['name']);
+ }
+ if (isset($input['mime'])) {
+ $this->setMimeType($input['mime']);
+ }
+ }
+ }
+
+ /**
+ * Returns the attachment content.
+ *
+ * @return string
+ */
+ public function getContent(){
+ return $this->content;
+ }
+
+ /**
+ * Sets the attachment content. This may be binary data.
+ *
+ * @param string $content
+ * @return MailMessageAttachment
+ */
+ public function setContent($content){
+ $this->content = $content;
+ return $this;
+ }
+
+ /**
+ * Returns the name shown to the customer in the mail message.
+ *
+ * @return string
+ */
+ public function getName(){
+ return $this->name;
+ }
+
+ /**
+ * Sets the name shown to the customer in the mail message.
+ *
+ * @param string $name
+ * @return MailMessageAttachment
+ */
+ public function setName($name){
+ $this->name = $name;
+ return $this;
+ }
+
+ /**
+ * Returns the mime type of the attachment. E.g. application/pdf, text/html.
+ *
+ * @return string
+ */
+ public function getMimeType(){
+ return $this->mimeType;
+ }
+
+ /**
+ * Sets the mime type of the mail attachment. E.g. application/pdf, text/html.
+ *
+ * @param string $mimeType
+ * @return MailMessageAttachment
+ */
+ public function setMimeType($mimeType){
+ $this->mimeType = $mimeType;
+ return $this;
+ }
+
+ /**
+ * Returns the attachment as an array. This method is
+ * need to provide the correct input for Mail::send().
+ *
+ * @return array
+ */
+ public function toArray() {
+ return array(
+ 'content' => $this->getContent(),
+ 'name' => $this->getName(),
+ 'mime' => $this->getMimeType(),
+ );
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/MailMessageEvent.php b/MailMessageEvent.php
new file mode 100644
index 0000000..f0df7ef
--- /dev/null
+++ b/MailMessageEvent.php
@@ -0,0 +1,124 @@
+name = (string)$name;
+ }
+
+ /**
+ * In case this method returns true, any error will stop the PHP
+ * process. Otherwise in case of an error the mail is not sent and
+ * the error is logged. But the process continues.
+ *
+ * By default this method returns false.
+ *
+ * @return boolean
+ */
+ public function isDie(){
+ return $this->die;
+ }
+
+ /**
+ * Sets the behaviour in case of an error. See MailMessageEvent::isDie() for
+ * more information.
+ *
+ * By default it is set to false. In most cases this should not be changed.
+ *
+ * @param string $die
+ * @return MailMessageEvent
+ */
+ public function setDie($die = true){
+ $this->die = $die;
+ return $this;
+ }
+
+ /**
+ * Returns the name of the e-mail event. This is the original template name of the
+ * e-mail. E.g. order_conf in case of the order confirmation. The name
+ * should be used to identify the event. For example if something should be changed
+ * in case of order confirmation the hook should filter with the expression:
+ *
+ *
+ * if ($event->getName() == 'order_conf') {
+ * // Change messages
+ * }
+ *
+ *
+ * @return string
+ */
+ public function getName(){
+ return $this->name;
+ }
+
+ /**
+ * Returns a list of MailMessage send by this event. By default the list contains
+ * exaclty one message. In case the hook whats to suppress the sending of the message,
+ * the list should be set to an empty array. In case more than one message should be send
+ * more messages can be added.
+ *
+ * @return MailMessage[]
+ */
+ public function getMessages(){
+ return $this->messages;
+ }
+
+ /**
+ * Returns the list of messages sent by the event. By default the list contains
+ * one message. Listeners of the event may add more messages or remove all message, which
+ * does prevent sending any mail message.
+ *
+ * @param MailMessage[] $messages
+ * @return MailMessageEvent
+ */
+ public function setMessages(array $messages){
+ $this->messages = $messages;
+ return $this;
+ }
+
+ /**
+ * Adds the given message to the event. See MailMessageEvent::setMessages() for more information
+ * about the behaviour of multiple messages.
+ *
+ * @param MailMessage $message
+ * @return MailMessageEvent
+ */
+ public function addMessage(MailMessage $message) {
+ $this->messages[] = $message;
+ return $this;
+ }
+
+
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 2937a42..837a042 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,18 @@
# PrestaShop 8 wallee Integration
This repository contains the PrestaShop wallee payment module that enables the shop to process payments with [wallee](https://www.wallee.com).
+## To install module manually by dragging up zip file, please download [.zip archive](https://plugin-documentation.wallee.com/wallee-payment/prestashop-8/1.0.1/wallee.zip) of module with correct structure required by Prestashop installation
+
##### To use this extension, a [wallee](https://app-wallee.com/user/signup) account is required.
## Requirements
* [PrestaShop](https://www.prestashop.com/) 8
* [PHP](http://php.net/) 8.1 or later
-* [Mailhook](https://github.com/wallee-payment/prestashop-mailhook/releases) to modify PrestaShop email behavior.
## Documentation
-* [English](https://plugin-documentation.wallee.com/wallee-payment/prestashop-8/1.0.0/docs/en/documentation.html)
+* [English](https://plugin-documentation.wallee.com/wallee-payment/prestashop-8/1.0.1/docs/en/documentation.html)
## Support
@@ -19,10 +20,8 @@ Support queries can be issued on the [wallee support site](https://app-wallee.co
## License
-Please see the [license file](https://github.com/wallee-payment/prestashop-8/blob/1.0.0/LICENSE) for more information.
+Please see the [license file](https://github.com/wallee-payment/prestashop-8/blob/1.0.1/LICENSE) for more information.
## Other PrestaShop Versions
Find the module for different PrestaShop versions [here](../../../prestashop).
-
-## To install module manually by dragging up zip file, please download [.zip archive](https://plugin-documentation.wallee.com/wallee-payment/prestashop-8/1.0.0/wallee.zip) of module with correct structure required by Prestashop installation
diff --git a/docs/en/documentation.html b/docs/en/documentation.html
index ee6f1fc..97e00f0 100644
--- a/docs/en/documentation.html
+++ b/docs/en/documentation.html
@@ -22,7 +22,7 @@
Download the module.
+Download the module.
Login to the backend of your PrestsShop store.
diff --git a/inc/Basemodule.php b/inc/Basemodule.php index 9a46a05..4b1d69f 100644 --- a/inc/Basemodule.php +++ b/inc/Basemodule.php @@ -133,14 +133,6 @@ private static function getOrder(array $params) public static function checkRequirements(Wallee $module) { - if (!Module::isInstalled('mailhook')) { - $module->addError( - Tools::displayError( - 'The module mailhook is required.' - ) - ); - return false; - } try { \Wallee\Sdk\Http\HttpClientFactory::getClient(); } catch (Exception $e) { @@ -255,27 +247,6 @@ public static function displayHelpButtons(Wallee $module) return $module->display(dirname(dirname(__FILE__)), 'views/templates/admin/admin_help_buttons.tpl'); } - public static function getMailHookActiveWarning(Wallee $module) - { - $output = ""; - if (! Module::isInstalled('mailhook') || ! Module::isEnabled('mailhook')) { - $error = "" . $module->l('The module "Mail Hook" is not active.', 'basemodule') . ""; - $error .= "{l s='This module requires an %s account.' sprintf='wallee' mod='wallee'}
-{l s='Sign Up' mod='wallee'} {l s='Documentation' mod='wallee'}
+{l s='Sign Up' mod='wallee'} {l s='Documentation' mod='wallee'}