-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
229c1fc
commit 8e1b4fd
Showing
12 changed files
with
839 additions
and
40 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
if (! defined('_PS_VERSION_')){ | ||
exit(); | ||
} | ||
/** | ||
* Represents a mail attachment. | ||
* | ||
* @author Thomas Hunziker | ||
* | ||
*/ | ||
class MailMessageAttachment { | ||
|
||
private $content; | ||
|
||
private $name; | ||
|
||
private $mimeType; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* Either the input as defined by Mail::send() for mail attachment | ||
* or a mail attachment. In later case the attachment is copied. | ||
* | ||
* @param array|MailMessageAttachment $input | ||
*/ | ||
public function __construct($input = null) { | ||
if ($input instanceof MailMessageAttachment) { | ||
$this->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(), | ||
); | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
if (! defined('_PS_VERSION_')){ | ||
exit(); | ||
} | ||
/** | ||
* This class represents a mail message sending event. An object | ||
* of this class is propagated in case an e-mail is sent. | ||
* | ||
* @author Thomas Hunziker | ||
* | ||
*/ | ||
class MailMessageEvent { | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @var boolean | ||
*/ | ||
private $die = false; | ||
|
||
/** | ||
* @var MailMessage[] | ||
*/ | ||
private $messages = array(); | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* The name is used as identification of the event. It is normally | ||
* the name of the template. | ||
* | ||
* @param string $name | ||
*/ | ||
public function __construct($name) { | ||
$this->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: | ||
* | ||
* <code> | ||
* if ($event->getName() == 'order_conf') { | ||
* // Change messages | ||
* } | ||
* </code> | ||
* | ||
* @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; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
# 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 | ||
|
||
Support queries can be issued on the [wallee support site](https://app-wallee.com/space/select?target=/support). | ||
|
||
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.