Skip to content

ranjeet867/shopify-connector

Repository files navigation

Shopify Connector (Everstox Coding Challenge)

This project fetches Shopify orders via Shopify Admin GraphQL API, applies filtering + tag rules, transforms them into an Everstox-style order payload, and builds a dry-run HTTP request (it does not send the request).

What it does

  • Fetch orders from the last 14 days
  • Filter: paid and not fully fulfilled
  • Supports GraphQL pagination
  • Logs GraphQL cost/throttle status and uses a simple backoff retry on throttling
  • Tag processing:
    • Whitelist / Blacklist (case-insensitive substring match)
    • Priority parsed from tags into order_priority (1..99)
  • Partial fulfillment policy:
    • Imports only remaining quantities per line item: remaining = quantity - fulfilledQuantity
  • Outputs:
    • Summary counts
    • Prints a sample dry-run request payload for inspection

Project layout

src/shopify_connector/   # application code
tests/                  # unit tests

Configuration

Create a .env file (or copy .env.example):

cp .env.example .env  #please replace SHOPIFY_API_TOKEN with correct token

Set at least:

  • SHOPIFY_SHOP_URL
  • SHOPIFY_API_TOKEN
  • EVERSTOX_SHOP_ID

Optional:

  • ORDER_TAG_WHITELIST (comma-separated)
  • ORDER_TAG_BLACKLIST (comma-separated)
  • SHOPIFY_API_VERSION
  • LOG_LEVEL

Note on secrets: Keep .env out of git.

Run locally (recommended for speed)

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

PYTHONPATH=src python -m shopify_connector.cli

Run tests locally

PYTHONPATH=src pytest -q

Run with Docker

This repo includes Dockerfile and compose.yaml.

1) Create .env

cp .env.example .env
# edit values

2) Run connector

docker compose run --rm shopify-connector

3) Run tests in Docker

docker compose run --rm tests

Makefile shortcuts

make test
make run
make docker-run
make docker-test

Decisions / Assumptions (time-boxed)

  • CLI output provides the “visual feedback”.
  • Uses shopMoney currency amounts; tax/discount handling is simplified and documented in code.
  • Uses conservative throttling backoff using restoreRate and available points.
  • Payload fields that cannot be derived reliably are set as explicit placeholders (e.g., shop_instance_id).

What I would improve with more time

  • More complete mapping (payment methods, attachments, shipment options)
  • Better tax breakdown per line (and shipping tax)
  • Stronger throttling logic based on required query cost vs currentlyAvailable
  • Optional small web UI

About

shopify-connector

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors