Skip to content

Commit 270ecde

Browse files
candemiralpraoulritterMorericemichaelpaulAlexandrosMor
authored
[PW-6936] Implementing Adyen support section (#1953)
* [PW-7198] - Add example function for supportform (#1734) * [PW-7119] Add configuration to magento admin to setup the live domain file for Applepay. * [PW-6969] Add Adyen as External Platform Integrator for native Magento Plugin * Revert "[PW-7119] Add configuration to magento admin to setup the live domain file for Applepay." This reverts commit ede4081. * Update Helper/Data.php Change from double to single quotes and add a space for cleanliness. Co-authored-by: Jeantwan Teuma <[email protected]> * [PW-7198] Add draft function for the SupportForm. * [PW-7198] Add draft function for the SupportForm. Co-authored-by: Jeantwan Teuma <[email protected]> * PW-7194: Adyen Support Form UI (#1763) * PW-7194: Adyen Support Form * PW-7194: Remove form word * PW-7194: Client side validation * [PW-7202] Add the email template for the support section (#1777) * Add the generic template * Add the mail template * Add the template * Add a controler to link the template * Finalize the template * Recommended changes * Fix lgtm suggestions * Display a success page after the form submitted (#1829) * [PW-7331] Create support page links (#1842) * [PW-7331] add new pages for each support tab * [PW-7331] add new links for order processing and conf settings * [PW-7331] refactoring * [PW-7331] set active tab link dynamically * [PW-7509] add styling for dropdown view according to design * [PW-7509] add links for each topic * [PW-7509] add captions to topics table * Update Block/Adminhtml/Support/ConfigurationSettings.php Co-authored-by: Alexandros Moraitis <[email protected]> * [PW-7509] fix code smells Co-authored-by: Alexandros Moraitis <[email protected]> * [PW-7507] Add support forms (#1845) * Add the forms with links * Add the rest of the fields * Remove the logs functionality * [PW-7531] Send email with configuration and form values (#1874) * Add the fields in the controllers * Populate the template from the form * Add seprate templates * WIP * Update controller and blocks * WIP send mail * Mail sent on private test mail * Move common code to helper * Add config values and orderprocessing sent email * enable/disable the submit button * Remove test email address * Prefil sender email * Fix recommendations * Fix recommendations * [PW-7533] Add attachments to support email (#1880) * [PW-7533] submit form data to controllers * [PW-7533] prefill form topics, highlight section in menu * [PW-7533] prepend topic to email subject * [PW-7533] add adyen signature to new files * [PW-7533] use custom transport builder * [PW-7533] add attachment to email * [PW-7533] support multiple attachment uploads * Update Block/Adminhtml/Support/Form/Element/MultipleFileElement.php * [PW-7620] Form fields validation (#1879) * Add validation on submit frontend side * Add validation and topic preselect * Refactor naming * Fix suggestions * Update Controller/Adminhtml/Support/ConfigurationSettingsForm.php Co-authored-by: Peter Ojo <[email protected]> * Update Controller/Adminhtml/Support/OrderProcessingForm.php Co-authored-by: Peter Ojo <[email protected]> * Fix code style Co-authored-by: Peter Ojo <[email protected]> * [PW 7687] Add the tool tips (#1905) * Add tooltips and fix the titles for the support forms * Remove unused classes from fields * [PW-7695] Extend the configuration snapshot for support form (#1911) * [PW-7695] Add fields to the config getter * [PW-7695] Add configuration fields and update the templates * Update Helper/Config.php Co-authored-by: Peter Ojo <[email protected]> * [PW-7695] CS fix Co-authored-by: Peter Ojo <[email protected]> * [PW-7694] Support form corrections (#1917) * [PW-7694] Add placeholders * [PW-7694] Corrections * [PW-7694] Code formatting * [PW-7694] Code formatting * [PW-7694] Label updates * [PW-7694] Fix parent constructor * [PW-7694] Add type definitions & correct typos * [PW-7802] Support form corrections and release preparation (#1951) * [PW-7802] Form correction and release preparation * [PW-7802] Remove configuration field and move option to the support form * Tooltip update * [PW-7656] Fix SonarCloud suggestions * Update Block/Adminhtml/Support/OrderProcessingForm.php Co-authored-by: Jeantwan Teuma <[email protected]> * Update Block/Adminhtml/Support/OtherTopicsForm.php Co-authored-by: Jeantwan Teuma <[email protected]> * Update Block/Adminhtml/Support/OtherTopicsForm.php Co-authored-by: Jeantwan Teuma <[email protected]> * Remove whitespace * Support form fix (#1970) * Add missing configuration getter * Update email headers and add Adobe Commerce tag to the email body * Support PNG extension for form attachments --------- Co-authored-by: raoulritter <[email protected]> Co-authored-by: Jeantwan Teuma <[email protected]> Co-authored-by: michaelpa <[email protected]> Co-authored-by: Alexandros Moraitis <[email protected]> Co-authored-by: Peter Ojo <[email protected]>
1 parent 9ea8ecf commit 270ecde

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3794
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Adyen Payment Module
4+
*
5+
* Copyright (c) 2023 Adyen N.V.
6+
* This file is open source and available under the MIT license.
7+
* See the LICENSE file for more info.
8+
*
9+
* Author: Adyen <[email protected]>
10+
*/
11+
12+
namespace Adyen\Payment\Block\Adminhtml\Support;
13+
14+
use Adyen\Payment\Helper\SupportFormHelper;
15+
use Magento\Backend\Block\Page;
16+
use Magento\Backend\Block\Template\Context;
17+
use Magento\Framework\Locale\ResolverInterface;
18+
use Magento\Framework\Phrase;
19+
20+
class ConfigurationSettings extends Page implements SupportTabInterface
21+
{
22+
/**
23+
* @var SupportFormHelper
24+
*/
25+
private $supportFormHelper;
26+
27+
public function __construct(
28+
Context $context,
29+
ResolverInterface $localeResolver,
30+
SupportFormHelper $supportFormHelper,
31+
array $data = []
32+
) {
33+
parent::__construct($context, $localeResolver, $data);
34+
$this->supportFormHelper = $supportFormHelper;
35+
}
36+
37+
/**
38+
* @return string[]
39+
*/
40+
public function getSupportTopics(): array
41+
{
42+
return $this->supportFormHelper->getSupportTopicsByFormType(
43+
SupportFormHelper::CONFIGURATION_SETTINGS_FORM
44+
);
45+
}
46+
47+
/**
48+
* @return string
49+
*/
50+
public function supportFormUrl(): string
51+
{
52+
return $this->getUrl('adyen/support/configurationsettingsform');
53+
}
54+
55+
/**
56+
* @return Phrase
57+
*/
58+
public function getPageTitle()
59+
{
60+
return __("Configuration Settings");
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
<?php
2+
/**
3+
* Adyen Payment Module
4+
*
5+
* Copyright (c) 2023 Adyen N.V.
6+
* This file is open source and available under the MIT license.
7+
* See the LICENSE file for more info.
8+
*
9+
* Author: Adyen <[email protected]>
10+
*/
11+
12+
namespace Adyen\Payment\Block\Adminhtml\Support;
13+
14+
use Adyen\Payment\Helper\SupportFormHelper;
15+
use Magento\Backend\Block\Template\Context;
16+
use Magento\Backend\Block\Widget\Form\Generic;
17+
use Magento\Framework\Data\FormFactory;
18+
use Magento\Framework\Exception\LocalizedException;
19+
use Magento\Framework\Registry;
20+
21+
class ConfigurationSettingsForm extends Generic
22+
{
23+
/**
24+
* @var SupportFormHelper
25+
*/
26+
private $supportFormHelper;
27+
28+
/**
29+
* @param Context $context
30+
* @param Registry $registry
31+
* @param FormFactory $formFactory
32+
* @param SupportFormHelper $supportFormHelper
33+
*/
34+
public function __construct(
35+
Context $context,
36+
Registry $registry,
37+
FormFactory $formFactory,
38+
SupportFormHelper $supportFormHelper
39+
) {
40+
$this->supportFormHelper = $supportFormHelper;
41+
parent::__construct($context, $registry, $formFactory);
42+
$this->setActive(true);
43+
}
44+
45+
/**
46+
* Prepare form before rendering HTML
47+
*
48+
* @return $this
49+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
50+
* @throws LocalizedException
51+
*/
52+
protected function _prepareForm(): ConfigurationSettingsForm
53+
{
54+
$form = $this->_formFactory->create([
55+
'data' => [
56+
'id' => 'support_form',
57+
'action' => $this->getUrl('adyen/support/configurationsettingsform'),
58+
'method' => 'post',
59+
'enctype' => 'multipart/form-data',
60+
]
61+
]);
62+
63+
$fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Configuration settings')]);
64+
$this->_addElementTypes($fieldset);
65+
66+
$fieldset->addType(
67+
'textarea',
68+
'Adyen\Payment\Block\Adminhtml\Support\Form\Element\CustomTextareaElement'
69+
);
70+
71+
$fieldset->addField(
72+
'topic',
73+
'select',
74+
[
75+
'name' => 'topic',
76+
'label' => __('Topic'),
77+
'title' => __('Topic'),
78+
'class' => '',
79+
'options' => $this->getSupportTopics(),
80+
'required' => true,
81+
'value' => $this->getRequest()->getParam('topic'),
82+
]
83+
);
84+
$fieldset->addField(
85+
'issue',
86+
'select',
87+
[
88+
'name' => 'issue',
89+
'label' => __('Issue'),
90+
'title' => __('Issue'),
91+
'class' => '',
92+
'options' => $this->getIssuesTopics(),
93+
'required' => true
94+
]
95+
);
96+
$fieldset->addField(
97+
'subject',
98+
'text',
99+
[
100+
'name' => 'subject',
101+
'label' => __('Subject'),
102+
'title' => __('Subject'),
103+
'placeholder' => __('Type a subject for your issue'),
104+
'class' => 'adyen_support-form',
105+
'required' => true
106+
]
107+
);
108+
109+
$fieldset->addField(
110+
'email',
111+
'text',
112+
[
113+
'name' => 'email',
114+
'label' => __('Email'),
115+
'title' => __('Email'),
116+
'class' => 'validate-emails',
117+
'required' => true,
118+
'readonly' => true,
119+
'value' => $this->supportFormHelper->getAdminEmail(),
120+
]
121+
);
122+
123+
$fieldset->addField(
124+
'headless',
125+
'radios',
126+
[
127+
'name' => 'headless',
128+
'label' => __('Are you using headless integration?'),
129+
'title' => __('Are you using headless integration?'),
130+
'class' => '',
131+
'required' => false, 'values' => [
132+
['value' => 'Yes', 'label' => __('Yes')],
133+
['value' => 'No', 'label' => __('No')]],
134+
'value' => 'No'
135+
]
136+
)->setAfterElementHtml('
137+
<div class="tooltip">
138+
<span class="help">
139+
<span></span>
140+
</span>
141+
<div class="tooltip-content">
142+
Headless integration is when you use Adyen pre-configured backend but have a custom store frontend.
143+
</div>
144+
</div>');
145+
146+
$fieldset->addType('file', 'Adyen\Payment\Block\Adminhtml\Support\Form\Element\MultipleFileElement');
147+
$fieldset->addField(
148+
'attachments',
149+
'file',
150+
[
151+
'name' => 'attachments[]',
152+
'multiple' => 'multiple',
153+
'label' => __('Relevant logs & screenshots'),
154+
'title' => __('Relevant logs & screenshots'),
155+
'class' => 'adyen_support-form',
156+
'required' => false
157+
]
158+
)->setAfterElementHtml('
159+
<div class="tooltip">
160+
<span class="help">
161+
<span></span>
162+
</span>
163+
<div class="tooltip-content">Sending us a file often helps us to solve your issue.
164+
We accept files in PNG, JPG, ZIP, RAR, or SVG format, with a maximum size of 10 MB.
165+
</div>
166+
</div>');
167+
168+
$fieldset->addField(
169+
'sendConfigurationValues',
170+
'radios',
171+
[
172+
'name' => 'sendConfigurationValues',
173+
'label' => __('Do you want to include plugin configuration values?'),
174+
'title' => __('Do you want to include plugin configuration values?'),
175+
'class' => '',
176+
'required' => false,
177+
'values' => [
178+
['value' => 1, 'label' => __('Yes')],
179+
['value' => 0, 'label' => __('No')]
180+
],
181+
'value' => 1
182+
]
183+
)->setAfterElementHtml('
184+
<div class="tooltip">
185+
<span class="help">
186+
<span></span>
187+
</span>
188+
<div class="tooltip-content">Automatically includes the configuration values in support email.
189+
</div>
190+
</div>');
191+
192+
$fieldset->addField(
193+
'description',
194+
'textarea',
195+
[
196+
'name' => 'descriptionComments',
197+
'label' => __('Description'),
198+
'title' => __('Description'),
199+
'placeholder' => __('Tell us what is happening in detail'),
200+
'class' => '',
201+
'required' => false,
202+
]
203+
);
204+
205+
$fieldset->addField(
206+
'submit_support_configuration_settings',
207+
'submit',
208+
[
209+
'name' => 'submit',
210+
'title' => __('Submit'),
211+
'class' => 'primary',
212+
'value' => 'Submit'
213+
]
214+
);
215+
216+
$form->setUseContainer(true);
217+
218+
$this->setForm($form);
219+
return parent::_prepareForm();
220+
}
221+
222+
/**
223+
* @return string[]
224+
*/
225+
public function getSupportTopics(): array
226+
{
227+
return $this->supportFormHelper->getSupportTopicsByFormType(
228+
SupportFormHelper::CONFIGURATION_SETTINGS_FORM
229+
);
230+
}
231+
232+
/**
233+
* @return string[]
234+
*/
235+
public function getIssuesTopics(): array
236+
{
237+
return $this->supportFormHelper->getIssuesTopicsByFormType(
238+
SupportFormHelper::CONFIGURATION_SETTINGS_FORM
239+
);
240+
}
241+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Adyen Payment Module
4+
*
5+
* Copyright (c) 2023 Adyen N.V.
6+
* This file is open source and available under the MIT license.
7+
* See the LICENSE file for more info.
8+
*
9+
* Author: Adyen <[email protected]>
10+
*/
11+
12+
namespace Adyen\Payment\Block\Adminhtml\Support\Form\Element;
13+
14+
use Magento\Framework\Data\Form\Element\Textarea;
15+
16+
class CustomTextareaElement extends Textarea
17+
{
18+
public function getHtmlAttributes()
19+
{
20+
return array_merge(parent::getHtmlAttributes(), ['placeholder']);
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Adyen Payment Module
4+
*
5+
* Copyright (c) 2023 Adyen N.V.
6+
* This file is open source and available under the MIT license.
7+
* See the LICENSE file for more info.
8+
*
9+
* Author: Adyen <[email protected]>
10+
*/
11+
12+
namespace Adyen\Payment\Block\Adminhtml\Support\Form\Element;
13+
14+
use Magento\Framework\Data\Form\Element\File;
15+
16+
class MultipleFileElement extends File
17+
{
18+
public function getHtmlAttributes()
19+
{
20+
return array_merge(parent::getHtmlAttributes(), ['multiple']);
21+
}
22+
}

0 commit comments

Comments
 (0)