Products are synced from Crystal to the integration providers. When the sync process runs, it looks for products marked for e_commerce that have been updated since the last sync, or beginning of time if no prior successful sync has been recorded.
Orders are synced from the integration providers to Crystal. The primary mechanism for syncing is the use of webhooks. When orders are created, typically with a paid or completed/fulfilled status the e-commerce middleware receives a webhook notification. The order is then duplicated in Crystal, and its id tracked. During normal sync, any orders completed since the prior sync are retrieved from the integration provider and their ids are compared against the tracked ids handled by the webhooks. This serves as a backup mechanism for capturing any orders that may have been missed due to a failed webhook.
Crystal E-commerce Product
This is the model returned from the Crystal api ecom/products endpoint that is used to sync products to our integration partners.
Crystal Ecom Product
Crystal DB table/column
queried (getAttachments) via products.ecom_images
calculated from sku_transactions
calculated => account.include_on_ecom & product_type.include_on_ecom.
Note: always true because the query only returns rows where both of these conditions are true.
id : accounts.uuid
name : accounts.ecom_name
code : accounts.code
id : product_types.uuid
name : product_types.name