Menu

WordPress to ERP over REST: build the field mapper before the auth layer
πŸ“°

WordPress to ERP over REST: build the field mapper before the auth layer

DEV Community: phpΒ·AumCreateΒ·15 days ago
#vOhjngrv
#devto#dev#status#code#return
Reading 0:00
15s threshold

Two systems, one record, and a question nobody asked at kickoff: for each field, which side is allowed to write it. Answer that in a table and a surprising amount of the integration design falls out of it.

The first version of an ERP integration usually works. Three fields go out, a status comes back, everyone moves on. Two months later the ERP adds a status code the mapper has never seen, the code falls through to a default, and orders stop moving without a single error in the log. That failure is decided before any HTTP call exists.

Write the field contract before the endpoint

External (ERP) Local (WordPress) Type Transform Writes

order_no _erp_order_id (meta) string, unique trim, uppercase ERP

status post_status enum explicit code map ERP

grand_total _order_total (meta) decimal string stored verbatim ERP

placed_at post_date_gmt ISO 8601 with offset to UTC ERP

customer_note post_excerpt string, max 500 trim, strip control chars both β€” rule below

fulfilment_state _fulfilment (meta) enum none…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.