Skip to content

Commit 31b0fdb

Browse files
committed
[DOCS] Updated documentation
Refs #1409
1 parent efb204e commit 31b0fdb

3 files changed

Lines changed: 26 additions & 40 deletions

File tree

Documentation/ForDevelopers/CurrencyUtility/Index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ API
2828

2929
.. php:class:: \DERHANSEN\SfEventMgt\Utility\CurrencyUtility
3030
31-
.. php:method:: getByIsoCode(string $isoCode): ?array
31+
.. php:method:: getByIsoCode(string $isoCode)
3232
3333
Returns the currency data array for the given ISO 4217 alphabetic code (case-insensitive),
3434
or :php:`null` if the code is not found.
@@ -40,11 +40,11 @@ API
4040
* :php:`name` — Human-readable currency name (e.g. :php:`'Euro'`)
4141
* :php:`symbol` — Currency symbol (e.g. :php:`'€'`)
4242

43-
.. php:method:: getBySymbol(string $symbol): ?array
43+
.. php:method:: getBySymbol(string $symbol)
4444
4545
Returns the first currency data array matching the given symbol, or :php:`null` if not found.
4646

47-
.. php:method:: getAllIsoCodes(): array
47+
.. php:method:: getAllIsoCodes()
4848
4949
Returns an array of all available ISO 4217 alphabetic codes.
5050

Documentation/ForDevelopers/Index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ For Developers
2020
Extending/Index
2121
Events/Index
2222
Payment/Index
23+
CurrencyUtility/Index

Documentation/ForDevelopers/Payment/Index.rst

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -101,44 +101,29 @@ to enable the actions in sf_event_mgt
101101

102102
Please also refer to the :php:`PaymentController` in sf_event_mgt to see all available PSR-14 Events.
103103

104-
In this example I create the class :php:`DERHANSEN\SfEventMgtMypaymentmethod\Payment\Mypaymentmethod` and add
105-
the following method.::
106-
107-
/**
108-
* Adds required HTML (for redirection) to the given values-array
109-
*
110-
* @param array $values
111-
* @param bool $updateRegistration
112-
* @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration
113-
* @param ActionController $pObj
114-
* @return void
115-
*/
116-
public function renderRedirectView(&$values, &$updateRegistration, $registration, $pObj)
104+
In this example I create the class :php:`DERHANSEN\SfEventMgtMypaymentmethod\EventListener\MyPaymentRedirectResponse`
105+
and as following::
106+
107+
class MyPaymentRedirectResponse
117108
{
118-
$pluginSettings = $this->getPluginSettings();
119-
120-
$view = GeneralUtility::makeInstance(StandaloneView::class);
121-
$view->setFormat('html');
122-
$view->setLayoutRootPaths($pluginSettings['view']['layoutRootPaths']);
123-
$view->setPartialRootPaths($pluginSettings['view']['partialRootPaths']);
124-
$view->setTemplateRootPaths($pluginSettings['view']['templateRootPaths']);
125-
126-
// @todo - e.g. call payment providers API to initialize payment
127-
//
128-
// Make sure to multiply the price with the given amount of depending registrations
129-
//
130-
// Depending on the payment provider you may receive a redirection URL or a token
131-
// which can be passed to the standalone view.
132-
133-
$view->assignMultiple([
134-
'settings' => $pluginSettings['settings'],
135-
]);
136-
$values['html'] = $view->render();
109+
#[AsEventListener('sf-event-mgt-mypaymentmethod/payment-redirect-response')]
110+
public function __invoke(ModifyPaymentRedirectResponseEvent $processPaymentInitializeEvent): void
111+
{
112+
if ($processPaymentInitializeEvent->getRegistration()->getPaymentmethod() !== 'mypaymentmethod') {
113+
return;
114+
}
115+
116+
// @todo Initial payment provider and determine redirect URL
117+
$redirectUrl = 'https://paymentprovider.tld/foo/bar'
118+
119+
$redirectResponse = new RedirectResponse($redirectUrl, 303);
120+
$processPaymentInitializeEvent->setResponse($redirectResponse);
121+
}
137122
}
138123

139-
Replace the @todo section with your own code. The returned view should include some text
140-
and at least the link for the redirection. In order process automatic redirection, the
141-
view could include a JavaScript redirect to the payment providers payment page.
124+
The event listener shows how to use the PSR-14 event :php:`ModifyPaymentRedirectResponseEvent` to
125+
set a redirect response, which is handled by the extensions internal redirect process and redirects
126+
the user to the given redirect URL.
142127

143128
5. Implement methods
144129
--------------------
@@ -165,10 +150,10 @@ using a HMAC, the cHash can manually be removed from generated URLs by implement
165150
the :php:`ProcessPaymentInitializeEvent` PSR-14 event.
166151

167152

168-
7. Security conciderations
153+
7. Security considerations
169154
--------------------------
170155

171-
Make sure that your rendered Fluid standlone views do not contain sensitive data or possibilities
156+
Make sure that rendered Fluid views do not contain sensitive data or possibilities
172157
for Cross Site Scripting (XSS) (:php:`values['html']` is rendered with :php:`f:format.raw`).
173158

174159

0 commit comments

Comments
 (0)