module WolfCore::Integrations::OrdersApiOperations
def create_order(wolf_token:, order:, tenant:, wolf_platform_url:)
def create_order(wolf_token:, order:, tenant:, wolf_platform_url:) http_post( headers: { "Authorization" => "Bearer #{wolf_token}" }, url: "#{wolf_platform_url}/api/v2/orders", query: { tenant: tenant }, body: order ) end
def create_order!(wolf_token:, order:, tenant:, wolf_platform_url:, error_message:)
def create_order!(wolf_token:, order:, tenant:, wolf_platform_url:, error_message:) safe_http_post( headers: { "Authorization" => "Bearer #{wolf_token}" }, url: "#{wolf_platform_url}/api/v2/orders", query: { tenant: tenant }, body: order, error_message: error_message ) end
def fetch_order(wolf_token:, order_id:, tenant:, wolf_platform_url:)
def fetch_order(wolf_token:, order_id:, tenant:, wolf_platform_url:) http_get( headers: { "Authorization" => "Bearer #{wolf_token}" }, url: "#{wolf_platform_url}/api/v2/orders/#{order_id}", query: { tenant: tenant } ) end
def fetch_order!(wolf_token:, order_id:, tenant:, wolf_platform_url:, error_message:)
def fetch_order!(wolf_token:, order_id:, tenant:, wolf_platform_url:, error_message:) response = safe_http_get( headers: { "Authorization" => "Bearer #{wolf_token}" }, url: "#{wolf_platform_url}/api/v2/orders/#{order_id}", query: { tenant: tenant }, error_message: error_message ) response_body = response.body response_body.dig("data", "table", "order") end