Riverty Payments: Extensibility
Extending Riverty Payments for Sylius - replaceable interfaces via service aliases, service tags, events the plugin listens to and the lack of a formal backward compatibility promise
Riverty Payments: Extensibility
This documentation always describes the latest published version.
The plugin makes no formal backward compatibility promise. Form types, Twig extensions and event listeners are explicitly marked @internal in the code: constructors and internals may change in a minor release. For your own extensions, rely on the points on this page.
Check after every update that your extension points still fit, because there is no compatibility promise.
Replaceable interfaces
These interfaces are set up as service aliases. You replace an implementation by pointing the alias in your application's services.yaml at your own service.
| Interface | Purpose |
|---|---|
RivertyClientInterface |
Talks to the Riverty API |
RivertyCredentialsProviderInterface |
Provides the API keys per country |
RivertyAvailabilityInterface |
Asks Riverty which payment methods apply to a cart |
ApiCallRecorderInterface |
Writes the API log |
CredentialCipherInterface |
Encrypts and decrypts API keys and identification numbers |
RivertySettingsRepositoryInterface |
Access to the channel settings |
CustomerOrderHistoryInterface |
Reads the earlier order history of the customer for the order history option |
RivertyTransactionRepositoryInterface |
Access to the Riverty transactions |
services:
App\Riverty\MyClient: ~
Mmd\SyliusRivertyPaymentsPlugin\Api\RivertyClientInterface:
alias: App\Riverty\MyClient
Service tags
The plugin hooks into Sylius through standard tags. You can decorate or replace the services:
| Tag | Value | Purpose |
|---|---|---|
sylius.gateway_configuration_type |
type: riverty |
Gateway form with the Riverty payment type field |
sylius.payment_request.command_provider |
gateway_factory: riverty |
Picks the command for authorization and status |
sylius.payment_request.provider.http_response |
gateway_factory: riverty |
Redirects to Riverty or back to the order in the storefront |
form.type_extension |
Payment step | Field for the identification number |
messenger.message_handler |
Bus sylius.payment_request.command_bus |
Handlers for authorization and status |
The gateway factory name is riverty. The resolution of the payment methods decorates the service sylius.resolver.payment_methods, so the plugin itself is an example of a decorator. You add further decorators the same way.
Events
The plugin listens to these events. You can add your own listeners on the same events with a higher or lower priority.
| Event | Purpose in the plugin |
|---|---|
workflow.sylius_order_shipping.completed.ship |
Queues an order for capture on shipment when its last shipment has shipped |
workflow.sylius_payment.guard.complete |
Blocks the Sylius Complete transition for Riverty payments |
workflow.sylius_payment.guard.refund |
Blocks the Sylius Refund transition for Riverty payments |
kernel.terminate and console.terminate |
Run the queued capture after the response |
Messenger WorkerMessageHandledEvent and WorkerMessageFailedEvent |
Run the queued capture in a worker after each message |
sylius.menu.admin.main |
Adds the menu entry under MMKreativ Plugins |
Capture on shipment and blocking the Sylius buttons require the state machine adapter
symfony_workflow, the Sylius default. Withwinzou_state_machineboth features are not available.