-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from paynl/feature/PLUG-2353
PLUG-2353 - Feature Request Form
- Loading branch information
Showing
13 changed files
with
489 additions
and
3 deletions.
There are no files selected for viewing
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,89 @@ | ||
<?php | ||
|
||
namespace Paynl\Payment\Block\Adminhtml\Render; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Paynl\Payment\Model\Config; | ||
|
||
class FeatureRequest extends Field | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $_template = 'Paynl_Payment::system/config/featurerequest.phtml'; | ||
|
||
/** | ||
* @var Config | ||
*/ | ||
protected $paynlConfig; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Config $paynlConfig | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Config $paynlConfig, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->paynlConfig = $paynlConfig; | ||
} | ||
|
||
/** | ||
* Render block: extension version | ||
* | ||
* @param AbstractElement $element | ||
* @return mixed | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); | ||
return parent::render($element); | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return mixed | ||
*/ | ||
public function _getElementHtml(AbstractElement $element) // phpcs:ignore | ||
{ | ||
return $this->_toHtml(); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getAjaxUrl() | ||
{ | ||
return $this->getUrl('paynl/action/featurerequest'); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getButtonHtml() | ||
{ | ||
$button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData(['id' => 'paynl_submit_email_feature_request', 'label' => __('Submit')]); | ||
return $button->toHtml(); | ||
} | ||
|
||
/** | ||
* @return mixed|string | ||
*/ | ||
public function getVersion() | ||
{ | ||
return $this->paynlConfig->getVersion(); | ||
} | ||
|
||
/** | ||
* @return mixed|string | ||
*/ | ||
public function getMagentoVersion() | ||
{ | ||
return $this->paynlConfig->getMagentoVersion(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<?php | ||
|
||
namespace Paynl\Payment\Controller\Adminhtml\Action; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\Controller\Result\JsonFactory; | ||
use Magento\Framework\Filesystem\Driver\File; | ||
use Magento\Framework\HTTP\Header; | ||
use Magento\Framework\Mail\Template\TransportBuilder; | ||
use Magento\Framework\Url\EncoderInterface; | ||
use Paynl\Payment\Helper\PayHelper; | ||
|
||
class FeatureRequest extends Action | ||
{ | ||
/** | ||
* @var JsonFactory | ||
*/ | ||
private $resultJsonFactory; | ||
|
||
/** | ||
* @var File | ||
*/ | ||
private $file; | ||
|
||
/** | ||
* @var EncoderInterface | ||
*/ | ||
private $encoder; | ||
|
||
/** | ||
* @var Header | ||
*/ | ||
private $httpHeader; | ||
|
||
/** | ||
* @var TransportBuilder | ||
*/ | ||
private $transportBuilder; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $scopeConfig; | ||
|
||
/** | ||
* @var PayHelper | ||
*/ | ||
private $payHelper; | ||
|
||
/** | ||
* FeatureRequest construct | ||
* | ||
* @param Context $context | ||
* @param JsonFactory $resultJsonFactory | ||
* @param File $file | ||
* @param EncoderInterface $encoder | ||
* @param Header $httpHeader | ||
* @param TransportBuilder $transportBuilder | ||
* @param ScopeConfigInterface $scopeConfig | ||
* @param PayHelper $payHelper | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
JsonFactory $resultJsonFactory, | ||
File $file, | ||
EncoderInterface $encoder, | ||
Header $httpHeader, | ||
TransportBuilder $transportBuilder, | ||
ScopeConfigInterface $scopeConfig, | ||
PayHelper $payHelper | ||
) { | ||
$this->httpHeader = $httpHeader; | ||
$this->encoder = $encoder; | ||
$this->file = $file; | ||
$this->resultJsonFactory = $resultJsonFactory; | ||
$this->transportBuilder = $transportBuilder; | ||
$this->scopeConfig = $scopeConfig; | ||
$this->payHelper = $payHelper; | ||
return parent::__construct($context); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function execute() | ||
{ | ||
$result = $this->resultJsonFactory->create(); | ||
$emailResult = $this->sendEmail(); | ||
return $result->setData(['result' => $emailResult]); | ||
} | ||
|
||
/** | ||
* @return boolean | ||
*/ | ||
private function sendEmail() | ||
{ | ||
try { | ||
$senderName = $this->scopeConfig->getValue('trans_email/ident_sales/name', 'store', 'default'); | ||
$senderEmail = $this->scopeConfig->getValue('trans_email/ident_sales/email', 'store', 'default'); | ||
|
||
$sender = [ | ||
'name' => $senderName, | ||
'email' => $senderEmail, | ||
]; | ||
|
||
$postParams = $this->getRequest()->getPostValue(); | ||
|
||
$email = !empty($postParams['feature_request_email']) ? strip_tags($postParams['feature_request_email']) : ''; | ||
$subject = 'Magento2 Suggestion'; | ||
$message = !empty($postParams['feature_request_message']) ? strip_tags($postParams['feature_request_message']) : ''; | ||
$version = !empty($postParams['pay_version']) ? strip_tags($postParams['pay_version']) : ''; | ||
$magento_version = !empty($postParams['magento_version']) ? strip_tags($postParams['magento_version']) : ''; | ||
|
||
$body = $message; | ||
$body = nl2br($body); | ||
|
||
$templateVars = [ | ||
'subject' => $subject, | ||
'body' => $body, | ||
'email' => $email, | ||
'version' => $version, | ||
'magento_version' => $magento_version, | ||
]; | ||
|
||
$this->payHelper->logDebug( | ||
'Sending Feature Request E-mail with the following user data: ', | ||
array("sender" => $sender, "customer_email" => $email) | ||
); | ||
|
||
$template = 'feature_request_email'; | ||
|
||
$transport = $this->transportBuilder->setTemplateIdentifier($template) | ||
->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 'default']) | ||
->setTemplateVars($templateVars) | ||
->setFrom($sender) | ||
->addTo("[email protected]") | ||
->setReplyTo($email) | ||
->getTransport(); | ||
$transport->sendMessage(); | ||
return true; | ||
} catch (\Exception $e) { | ||
$this->payHelper->logDebug('Feature Request E-mail exception: ' . $e->getMessage()); | ||
return false; | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -118,4 +118,20 @@ | |
"Invalid COC number","Ungültige Handelsregisternummer" | ||
"Enter a valid COC number","Geben Sie eine gültige Handelsregisternummer ein." | ||
"Payment terms","Zahlungsbedingungen" | ||
"You must first agree to the payment terms.","Sie müssen zuerst den Zahlungsbedingungen zustimmen." | ||
"You must first agree to the payment terms.","Sie müssen zuerst den Zahlungsbedingungen zustimmen." | ||
"If you have a feature request or other ideas, let us know!","Wenn Sie einen Funktionswunsch oder andere Ideen haben, lassen Sie es uns wissen!" | ||
"Your submission will be reviewed by our development team.","Ihr Beitrag wird von unserem Entwicklungsteam geprüft." | ||
"If needed, we will contact you for further information via the e-mail address provided.","Falls wir weitere Informationen benötigen, werden wir Sie für weitere Informationen über die angegebene E-Mail-Adresse kontaktieren." | ||
"Please note: this form is not for Support requests, please contact [email protected] for this.","Bitte beachten Sie: Dieses Formular ist nicht für Support-Anfragen. Bitte wenden Sie sich dafür an [email protected]." | ||
"Email","Email" | ||
"Message","Nachricht" | ||
"Leave your suggestions here...","Hinterlassen Sie hier Ihre Vorschläge..." | ||
"Sent! Thank you for your contribution.",Gesendet! Vielen Dank für Ihren Beitrag." | ||
"Email could not be sent, please try again later.","E-Mail kann nicht gelöscht werden. Probieren Sie es später aus." | ||
"Suggestions?","Vorschläge?" | ||
"Pay. - Suggestions?","Pay. - Vorschläge?" | ||
"Submit","Absenden" | ||
"Please fill in your message.","Bitte füllen Sie Ihre Nachricht aus." | ||
"Please fill in a valid email.","Bitte geben Sie eine gültige E-Mail-Adresse ein." | ||
"Success","Erfolg" | ||
"Error", "Fehler" |
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 |
---|---|---|
|
@@ -139,3 +139,19 @@ | |
"Select whether you want to use the PAY. thank you page when transaction is pending.","Select whether you want to use the PAY. thank you page when transaction is pending." | ||
"Automatically void authorisation-transactions when cancelling an order.","Automatically void authorisation-transactions when cancelling an order." | ||
"Use your own exchange-handler. Example: https://www.yourdomain.nl/exchange_handler?action=#action#&order_id=#order_id#","Use your own exchange-handler. Example: https://www.yourdomain.nl/exchange_handler?action=#action#&order_id=#order_id#" | ||
"If you have a feature request or other ideas, let us know!","If you have a feature request or other ideas, let us know!" | ||
"Your submission will be reviewed by our development team.","Your submission will be reviewed by our development team." | ||
"If needed, we will contact you for further information via the e-mail address provided.","If needed, we will contact you for further information via the e-mail address provided." | ||
"Please note: this form is not for Support requests, please contact [email protected] for this.","Please note: this form is not for Support requests, please contact [email protected] for this." | ||
"Email","Email" | ||
"Message","Message" | ||
"Leave your suggestions here...","Leave your suggestions here..." | ||
"Sent! Thank you for your contribution.","Sent! Thank you for your contribution." | ||
"Email could not be sent, please try again later.","Email could not be sent, please try again later." | ||
"Suggestions?","Suggestions?" | ||
"Pay. - Suggestions?","Pay. - Suggestions?" | ||
"Submit","Submit" | ||
"Please fill in your message.","Please fill in your message." | ||
"Please fill in a valid email.","Please fill in a valid email." | ||
"Success","Success" | ||
"Error", "Error" |
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 |
---|---|---|
|
@@ -117,4 +117,20 @@ | |
"Invalid COC number","Numéro de Chambre de Commerce invalide" | ||
"Enter a valid COC number","Veuillez entrer un numéro de Chambre de Commerce valide." | ||
"Payment terms","Conditions de paiement" | ||
"You must first agree to the payment terms.","Vous devez d'abord accepter les conditions de paiement." | ||
"You must first agree to the payment terms.","Vous devez d'abord accepter les conditions de paiement." | ||
"If you have a feature request or other ideas, let us know!","Si vous avez une demande de fonctionnalité ou d'autres idées, faites-le nous savoir !" | ||
"Your submission will be reviewed by our development team.","Votre demande sera examinée par notre équipe de développement." | ||
"If needed, we will contact you for further information via the e-mail address provided.","Si nécessaire, nous vous contacterons pour de plus amples informations via l'adresse électronique fournie." | ||
"Please note: this form is not for Support requests, please contact [email protected] for this.","Remarque: ce formulaire n'est pas destiné aux demandes d'assistance. Pour les questions d'assistance, veuillez contacter [email protected]." | ||
"Email","E-mail" | ||
"Message","Message" | ||
"Leave your suggestions here...","Laissez nous vos remarques et/ou suggestions…..." | ||
"Sent! Thank you for your contribution.",Envoyé ! Merci pour votre contribution." | ||
"Email could not be sent, please try again later.","E-mail sans mot de passe. Il sera examiné plus tard." | ||
"Suggestions?","Suggestions?" | ||
"Pay. - Suggestions?","Pay. - Suggestions?" | ||
"Submit", "Soumettre" | ||
"Please fill in your message.","Veuillez remplir votre message." | ||
"Please fill in a valid email.","Veuillez remplir un email valide." | ||
"Success", "Succès" | ||
"Error", "Erreur" |
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 |
---|---|---|
|
@@ -187,3 +187,19 @@ | |
"Select whether you want to use the PAY. thank you page when transaction is pending.","Selecteer of u gebruik wilt maken van de PAY. bedankpagina wanneer de transactie in behandeling is." | ||
"Automatically void authorisation-transactions when cancelling an order.","Authorize-transacties automatisch vrijgeven bij het annuleren van een bestelling." | ||
"Use your own exchange-handler. Example: https://www.yourdomain.nl/exchange_handler?action=#action#&order_id=#order_id#","Gebruik je eigen exchange-handler. Voorbeeld: https://www.yourdomain.nl/exchange_handler?action=#action#&order_id=#order_id#" | ||
"If you have a feature request or other ideas, let us know!","Als je een idee hebt voor een functie die je graag terugziet, laat het ons weten!" | ||
"Your submission will be reviewed by our development team.","Na het indienen, wordt deze intern beoordeeld door ons ontwikkelteam." | ||
"If needed, we will contact you for further information via the e-mail address provided.","Zo nodig, nemen wij contact op voor nadere informatie via het opgegeven mailadres" | ||
"Please note: this form is not for Support requests, please contact [email protected] for this.","Let op: dit formulier is niet voor Support aanvragen, neem hiervoor contact op met [email protected]." | ||
"Email","E-mail" | ||
"Message","Bericht" | ||
"Leave your suggestions here...","Laat hier jouw wens of idee achter..." | ||
"Sent! Thank you for your contribution.","Verstuurd! Bedankt voor het delen van jouw input." | ||
"Email could not be sent, please try again later.","E-mail kon niet worden verzonden. Probeer het later opnieuw." | ||
"Suggestions?","Suggesties?" | ||
"Pay. - Suggestions?","Pay. - Suggesties?" | ||
"Submit","Versturen" | ||
"Please fill in your message.","Vul uw bericht in." | ||
"Please fill in a valid email.","Vul een valide E-mail in." | ||
"Success","Succes" | ||
"Error", "Fout" |
Oops, something went wrong.