Skip to content

Allow AP phone number as alternative to AP email (#17)#100

Draft
gutobenn wants to merge 3 commits into
mainfrom
investigate-issue-17
Draft

Allow AP phone number as alternative to AP email (#17)#100
gutobenn wants to merge 3 commits into
mainfrom
investigate-issue-17

Conversation

@gutobenn
Copy link
Copy Markdown
Member

Which issue does this close?

Closes #17

Write a short description of code change.

Adds phone-number support to accounts-payable contacts across prospects, distributor customers, and active Fulfil customers. AP rows now satisfy the "AP contact required" rule with an email, a phone (stored as E.164 via propaganistas/laravel-phone), or both — the legacy {name, value} shape (email or AP Portal URL) continues to work. FulfilService reads and writes phone-typed party.contact_mechanism rows alongside email, deduping by contact name on read. When AR automation fires for a customer that has no AP email but does have a phone, it swaps the customer-facing template for a new internal ap_phone_followup_required template routed to accountsreceivable@universalyums.com so the AR team can call instead.

How should these changes be tested?

  • Active customer: open an AP contact, add a phone in E.164 format, save — confirm it round-trips to Fulfil as a phone-typed contact mechanism.
  • Active customer: create an AP contact with phone only (no email) — confirm validation passes and the phone appears on reload.
  • Distributor customer: add a contact via the inline form with only a phone — confirm it saves.
  • Prospect: add an AP contact with phone only — confirm save, then promote the prospect and verify the phone reaches Fulfil.
  • AR automation dry-run on a phone-only customer — confirm the "AP Phone Follow-up Required" template is sent to the AR inbox with the phone surfaced in the body, instead of going to the customer.
  • Existing AP contacts (legacy {name, value: email}) still render and save unchanged.

Steps taken before assigning the PR.

  • Reviewed the changeset in this PR.
  • Initial code review by Claude.

Adds phone-number support to accounts-payable contacts across prospects,
distributor customers, and active Fulfil customers. AP contact rows can
satisfy the "AP contact required" rule with an email, a phone (E.164),
or both. When an active customer has no AP email and AR automation
fires, the customer-facing template is swapped for a new internal
"call this customer" template routed to accountsreceivable@.
@gutobenn gutobenn self-assigned this May 21, 2026
@gutobenn gutobenn marked this pull request as draft May 21, 2026 17:32
gutobenn added 2 commits May 21, 2026 14:52
- Restore loose email detection in FulfilService::parseContactMechanism
  so legacy contact_mechanism rows with empty/missing `type` still parse
  (phone routing stays strict).
- Log AR template reroutes to the internal phone-followup template so
  ops can audit why a customer-facing send was swapped.
- Add unit tests for FulfilService AP/phone parsing, ArEmailService
  reroute behavior + logging, CompanyFields after-validation and
  E.164 normalization, and PhoneHelper.
# Conflicts:
#	app/Http/Controllers/ProspectController.php
#	resources/js/Pages/Prospects/Show.tsx
#	tests/Unit/Services/FulfilServiceTest.php
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.

Allow AP phone number as alternative to AP email for customers

1 participant