Introduce a way to automatically create an incoming route for the plugin, similar to how it was done for the delivery reports route (#2542790: Implement API for delivery reports for SMS Gateways, #2798171: Improve route access control of delivery report URL).
Add a gateway annotation property which triggers automatic creation of a route.
Should have the same features as delivery report route generator:
- Route
- Callback is an optional method on gateway plugin.
- Random unique url, url definition via gateway entity form.
Route callback
I want to investigate using the Symfony argument resolver, so that the callback method can have different parameters. The argument resolver is the service that magically gets a controllers argument values via PHP' reflection. This implementation means that we cannot use an interface, because implementors will have variable parameters.
Instead of using an interface to define a standard incoming route method, allow the gateway to define its route callbacks.
Comment | File | Size | Author |
---|---|---|---|
#13 | incoming-route-2832862-13-698b069.patch | 34.19 KB | dpi |
#9 | incoming-route-2832862-9-949d62c.patch | 31.43 KB | dpi |
| |||
#5 | incoming-route-2832862-5-dc55dd7.patch | 64.71 KB | dpi |
| |||
#3 | incoming-route-2832862.patch | 62.61 KB | dpi |
Comments
Comment #2
dpiadded release-8.x-1.0-beta2 tag.
Comment #3
dpiThe PR is ready for this issue, however the branch is based on #2832601: Incoming message handling tweaks. If you want an easy review then its best to get that issue out of the way first.
https://github.com/dpi/smsframework/pull/63
There is a good example in tests/modules/sms_test_gateway/src/Plugin/SmsGateway/Incoming.php for how plugins handle incoming requests.
Comment #5
dpiFixed some failing tests due to recent merges: incoming messages require populated result object.
Comment #6
dpiI have updated documentation with information on how to implement routes using the functionality from this PR: https://www.drupal.org/node/2829020
Comment #7
dpiSome of the ideas from this PR could be applied to the incoming reports endpoint as well:
\Drupal\sms\Plugin\SmsGatewayPluginInterface::parseDeliveryReports
to\Drupal\sms\Plugin\SmsGateway\SmsGatewayPluginInterface::processReports
\Drupal\sms\SmsProcessingResponse
object from this issue, adding a newg/setReports
method to that object.\Drupal\sms\Provider\DefaultSmsProvider::processDeliveryReport
can be reworked to just take report objects, instead of needing to handle a HTTP request.Would be done in a separate issue. Edit: #2837546: Modify callback for delivery reports to match incoming messages
Comment #8
dpiRebased PR onto mainline
Comment #9
dpiComment #10
almaudoh CreditAttribution: almaudoh commentedMade some comments on the PR
Comment #11
dpiReponded to
Comment #12
dpiA real example can be found in the Telstra gateway plugin.
I plan to do Clickatell, but I am waiting on their response to grant dev access.
Comment #13
dpiComment #15
dpi