diff --git a/src/Provider/DefaultSmsProvider.php b/src/Provider/DefaultSmsProvider.php index 04917bf..cc049a5 100644 --- a/src/Provider/DefaultSmsProvider.php +++ b/src/Provider/DefaultSmsProvider.php @@ -146,6 +146,17 @@ class DefaultSmsProvider implements SmsProviderInterface { /** * {@inheritdoc} */ + public function receipt(array $reports, array $options = []) { + // @todo Implement rules event integration here delivery report receipts. + // Execute three phases. + $this->moduleHandler->invokeAll('sms_receipt', array('pre process', $reports, $options)); + $this->moduleHandler->invokeAll('sms_receipt', array('process', $reports, $options)); + $this->moduleHandler->invokeAll('sms_receipt', array('post process', $reports, $options)); + } + + /** + * {@inheritdoc} + */ public function processDeliveryReport(Request $request, SmsGatewayInterface $sms_gateway, array $options = []) { // The response that will be sent back to the server API. The gateway plugin // can alter this response as needed. diff --git a/src/Provider/SmsProviderInterface.php b/src/Provider/SmsProviderInterface.php index 6929812..a3ed4f2 100644 --- a/src/Provider/SmsProviderInterface.php +++ b/src/Provider/SmsProviderInterface.php @@ -47,6 +47,26 @@ interface SmsProviderInterface { public function incoming(SmsMessageInterface $sms, array $options); /** + * Handles responses to the SMS provider from gateways. + * + * Allows gateways modules to pass message receipts and other responses to + * messages in a standard format for processing, and provides a basic set of + * status codes for common code handling. + * + * Allowed message status codes are defined as constants in + * @link \Drupal\sms\Plugin\SmsGatewayPluginInterface @endlink + * + * The original gateway code and string will often be provided in the $options + * array as 'gateway_message_status' and 'gateway_message_status_text'. + * + * @param \Drupal\sms\Message\SmsDeliveryReportInterface[] $reports + * An array of the delivery reports that have been received. + * @param array $options + * (optional) Extended options passed by the receipt receiver. + */ + public function receipt(array $reports, array $options = []); + + /** * Handles delivery reports returning to the SMS provider from gateways. * * Allows gateways plugins to correctly parse delivery reports and return a