Skip to content

feat(gateways): SMS gateway foundation + 20 new gateways - #145

Draft
kzamanbd wants to merge 28 commits into
developfrom
feat/sms-gateways
Draft

kzamanbd wants to merge 28 commits into
developfrom
feat/sms-gateways

Conversation

@kzamanbd

Copy link
Copy Markdown

What

Integration branch for getdokan/texty-pro#36 (foundation) and getdokan/texty-pro#37 (20 new gateways).

Commits already on this branch:

  • Gateway foundation (Bump moment-timezone from 0.5.32 to 0.5.37 #36): shared HTTP client (Texty\Http\Client/Response), normalized Result, per-message SendOptions (passed as an extra send() argument so 2-arg third-party gateways keep working), gateway Metadata (status, docs/signup URLs, regions, features), AbstractGateway, secret masking in the settings UI and redaction in SMS logs, Beta badge in the gateway list, PHPUnit harness with fixtures. Twilio, Vonage, Plivo and Clickatell are ported to it.
  • Settings fields: gateway settings can declare type => select with options, required => false, and alphanumeric => true on a from field.
  • Fix: browser password managers no longer autofill saved logins into the gateway search box.

Each gateway (all Beta) merges in through its own PR (#125–#144): Bird, Telnyx, Infobip, ClickSend, Sinch, Textmagic, D7 Networks, Africa's Talking, SMSGlobal, BulkSMS, BulkGate, SMSAPI, Octopush, Brevo, Bandwidth, MSG91, Fast2SMS, Unifonic, Taqnyat, AWS End User Messaging.

How tested

  • PHPUnit suite added; not yet run — npx @wordpress/env start && npm run test:php.
  • npm run build passes.

Backward compatibility

  • GatewayInterface::send() signature is unchanged; options arrive as an optional third argument.
  • Send hooks only gain a trailing $options argument.
  • Built-in gateways' send() still returns array|WP_Error.
  • Saved secrets are masked in REST responses (••••••••); saving an unchanged mask keeps the stored value.

Known gaps

  • MSG91 needs per-notification DLT template support (follow-up) before it can send.
  • readme/changelog and per-gateway wiki setup pages to follow.

Keep as draft until the gateway PRs are merged and tests are green.

- Shared HTTP client with 15s filterable timeout, enforced HTTPS/TLS,
  JSON/form/query bodies and a normalized Response
- Result object: success requires a provider message ID; gateways keep
  returning array|WP_Error from send(), typed result via send_result()
- Per-message options (from, unicode, template_id, variables) passed to
  gateways and appended to all send hooks
- Gateway metadata (status, docs/signup URLs, regions, features,
  validation, template_required, sandbox) and a Beta badge in the UI
- Mask saved secrets in both settings endpoints; unchanged mask keeps the
  stored value on save; scrub secrets from SMS log responses
- Migrate Twilio, Vonage, Plivo and Clickatell to the shared client
- PHPUnit harness faking HTTP via pre_http_request, fixtures and tests,
  npm run test:php (wp-env) and a PHPUnit CI workflow
Gateway get_settings() entries may now declare 'options' with
'type' => 'select', 'required' => false, and 'alphanumeric' => true
on a 'from' field so sender names render as text instead of a phone
input. All additive; existing gateways render as before.
The password manager paired the sidebar search with the gateway's
password field. Give the search its own form so they are not grouped.
Adds Texty\Gateways\Bird (registry key 'bird') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Telnyx (registry key 'telnyx') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Infobip (registry key 'infobip') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\ClickSend (registry key 'clicksend') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Sinch (registry key 'sinch') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Textmagic (registry key 'textmagic') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\D7Networks (registry key 'd7networks') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\AfricasTalking (registry key 'africastalking') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\SMSGlobal (registry key 'smsglobal') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\BulkSMS (registry key 'bulksms') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\BulkGate (registry key 'bulkgate') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\SMSAPI (registry key 'smsapi') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Octopush (registry key 'octopush') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Brevo (registry key 'brevo') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Bandwidth (registry key 'bandwidth') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\MSG91 (registry key 'msg91') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Fast2SMS (registry key 'fast2sms') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Unifonic (registry key 'unifonic') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\Taqnyat (registry key 'taqnyat') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
Adds Texty\Gateways\AwsSms (registry key 'aws_sms') on the shared
gateway foundation: normalized Result, live or format-only validate(),
password-masked secrets, metadata, logo, PHPUnit tests and fixtures.

Refs getdokan/texty-pro#37
composer.lock was resolved on PHP 8.4, pulling doctrine/instantiator
2.1.0 (php ^8.4) and failing the PHPUnit job on PHP 8.1. Pin
config.platform.php to 7.4.33 (the plugin minimum) and re-resolve:
doctrine/instantiator 1.5.0, myclabs/deep-copy 1.13.4.
…e asserts

- AwsSms: tighten E.164 check to 7-15 digits so '+12' fails before any
  request instead of reaching the API.
- Tests: WP_Error stores codes as array keys, so numeric string codes
  come back as ints; compare as strings.
base-ui's ScrollArea content is min-width: fit-content, so the longest
gateway name plus its Beta badge set the width of every row and the
sidebar clipped the badges. Contain the list's inline size and let
labels truncate (full name on hover).
npm overrides (all transitive, build/dev tooling):
adm-zip 0.6.1, brace-expansion@1 1.1.21, colord 2.9.4+, fast-uri 3.1.6+,
follow-redirects 1.16.1, ip-address 10.5.1+, js-yaml 3.15.2 / 4.3.2 /
5.4.1+, postcss-selector-parser 7.1.6+, svgo@3 3.3.5.

composer: phpcsstandards/phpcsutils 1.2.2 -> 1.2.3.

Not fixable here: extract-zip (no patched release; dev-only via
Playwright -> Lighthouse -> Puppeteer) and league/flysystem (only via
Mozart, which requires flysystem ^1.0; dev-only, never shipped).
Keeps rows to the gateway name and connected check. The badge still
shows in the gateway page header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant