add Printful provider integration with HTTP client and order routing

Printful HTTP client (v2 + v1 for sync products), Provider behaviour
implementation with all callbacks (test_connection, fetch_products,
submit_order, get_order_status, fetch_shipping_rates), and multi-provider
order routing that looks up the provider connection from the order's
product instead of hardcoding "printify".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-15 09:01:05 +00:00
parent af207d7a35
commit 3c788bff78
12 changed files with 2034 additions and 16 deletions

View File

@@ -84,7 +84,9 @@ defmodule SimpleshopTheme.Orders.OrderSubmissionWorkerTest do
end
test "sets failed status when variant not found in local DB" do
# Create order with a variant_id that doesn't exist in product variants
# Create order with a variant_id that doesn't exist in product variants.
# Provider connection lookup now goes through the variant's product,
# so a missing variant causes :variant_not_found at routing time.
order =
order_fixture(%{
variant_id: Ecto.UUID.generate(),
@@ -98,10 +100,7 @@ defmodule SimpleshopTheme.Orders.OrderSubmissionWorkerTest do
}
})
# Need a printify connection for the lookup to proceed
SimpleshopTheme.ProductsFixtures.provider_connection_fixture(%{provider_type: "printify"})
assert {:error, {:variant_not_found, _, _}} =
assert {:error, :variant_not_found} =
OrderSubmissionWorker.perform(%Oban.Job{args: %{"order_id" => order.id}})
updated = Orders.get_order(order.id)