- Add /admin/providers LiveView for connecting and managing POD providers - Implement pagination for Printify API (handles all products, not just first page) - Add parallel processing (5 concurrent) for faster product sync - Add slug-based fallback matching when provider_product_id changes - Add error recovery with try/rescue to prevent stuck sync status - Add checksum-based change detection to skip unchanged products - Add upsert tests covering race conditions and slug matching - Add Printify provider tests - Document Printify integration research (product identity, order risks, open source vs managed hosting implications) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
28 lines
765 B
Elixir
28 lines
765 B
Elixir
defmodule SimpleshopTheme.Providers do
|
|
@moduledoc """
|
|
Convenience functions for working with POD providers.
|
|
"""
|
|
|
|
alias SimpleshopTheme.Products.ProviderConnection
|
|
alias SimpleshopTheme.Providers.Provider
|
|
|
|
@doc """
|
|
Tests a provider connection.
|
|
|
|
Returns `{:ok, info}` with provider-specific info (e.g., shop name, shop_id)
|
|
or `{:error, reason}` if the connection fails.
|
|
"""
|
|
def test_connection(%ProviderConnection{} = conn) do
|
|
case Provider.for_connection(conn) do
|
|
{:ok, provider} -> provider.test_connection(conn)
|
|
{:error, :not_implemented} -> {:error, :provider_not_implemented}
|
|
error -> error
|
|
end
|
|
end
|
|
|
|
@doc """
|
|
Returns the provider module for a given type.
|
|
"""
|
|
defdelegate for_type(type), to: Provider
|
|
end
|