Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for draft orders, closes #105 #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 242 additions & 0 deletions tap_shopify/schemas/draft_orders.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
{
"properties": {
"id": {
"type": ["null", "integer"]
},
"order_id": {
"type": ["null", "integer"]
},
"name": {
"type": ["null", "string"]
},
"customer": {
"$ref": "definitions.json#/customer"
},
"shipping_address": {
"properties": {
"phone": {
"type": ["null", "string"]
},
"country": {
"type": ["null", "string"]
},
"name": {
"type": ["null", "string"]
},
"address1": {
"type": ["null", "string"]
},
"longitude": {
"type": ["null", "number"]
},
"address2": {
"type": ["null", "string"]
},
"last_name": {
"type": ["null", "string"]
},
"first_name": {
"type": ["null", "string"]
},
"province": {
"type": ["null", "string"]
},
"city": {
"type": ["null", "string"]
},
"company": {
"type": ["null", "string"]
},
"latitude": {
"type": ["null", "number"]
},
"country_code": {
"type": ["null", "string"]
},
"province_code": {
"type": ["null", "string"]
},
"zip": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"billing_address": {
"properties": {
"phone": {
"type": ["null", "string"]
},
"country": {
"type": ["null", "string"]
},
"name": {
"type": ["null", "string"]
},
"address1": {
"type": ["null", "string"]
},
"longitude": {
"type": ["null", "number"]
},
"address2": {
"type": ["null", "string"]
},
"last_name": {
"type": ["null", "string"]
},
"first_name": {
"type": ["null", "string"]
},
"province": {
"type": ["null", "string"]
},
"city": {
"type": ["null", "string"]
},
"company": {
"type": ["null", "string"]
},
"latitude": {
"type": ["null", "number"]
},
"country_code": {
"type": ["null", "string"]
},
"province_code": {
"type": ["null", "string"]
},
"zip": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"note": {
"type": ["null", "string"]
},
"note_attributes": {
"items": {
"properties": {
"name": {
"type": ["null", "string"]
},
"value": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"type": ["null", "array"]
},
"email": {
"type": ["null", "string"]
},
"currency": {
"type": ["null", "string"]
},
"invoice_sent_at": {
"type": ["null", "string"],
"format": "date-time"
},
"invoice_url": {
"type": ["null", "string"]
},
"line_items": {
"$ref": "definitions.json#/line_items"
},
"shipping_line": {
"properties": {
"tax_lines": {
"$ref": "definitions.json#/tax_lines"
},
"phone": {
"type": ["null", "string"]
},
"discounted_price_set": {},
"price_set": {},
"price": {
"type": ["null", "string"],
"format": "singer.decimal"
},
"title": {
"type": ["null", "string"]
},
"discount_allocations": {
"items": {
"properties": {
"discount_application_index": {
"type": ["null", "integer"]
},
"amount": {
"type": ["null", "number"]
}
},
"type": ["null", "object"]
},
"type": ["null", "array"]
},
"delivery_category": {
"type": ["null", "string"]
},
"discounted_price": {
"type": ["null", "number"]
},
"code": {
"type": ["null", "string"]
},
"requested_fulfillment_service_id": {
"type": ["null", "string"]
},
"carrier_identifier": {
"type": ["null", "string"]
},
"id": {
"type": ["null", "integer"]
},
"source": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"tags": {
"type": ["null", "string"]
},
"tax_exempt": {
"type": ["null", "boolean"]
},
"tax_lines": {
"$ref": "definitions.json#/tax_lines"
},
"applied_discounts": {
"items": {
"type": ["null", "object"]
},
"type": ["null", "array"]
},
"taxes_included": {
"type": ["null", "boolean"]
},
"total_price": {
"type": ["null", "string"],
"format": "singer.decimal"
},
"completed_at": {
"type": ["null", "string"],
"format": "date-time"
},
"created_at": {
"type": ["null", "string"],
"format": "date-time"
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
},
"status": {
"type": ["null", "string"]
}
},
"type": "object"
}
1 change: 1 addition & 0 deletions tap_shopify/streams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
import tap_shopify.streams.products
import tap_shopify.streams.collects
import tap_shopify.streams.custom_collections
import tap_shopify.streams.draft_orders
14 changes: 14 additions & 0 deletions tap_shopify/streams/draft_orders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import shopify
from tap_shopify.context import Context
from tap_shopify.streams.base import Stream


class DraftOrders(Stream):
name = "draft_orders"
replication_object = shopify.DraftOrder
# needed because filter="any" does not work as expected
# https://community.shopify.com/c/Shopify-APIs-SDKs/Draft-Order-API-status-any-stopped-working/td-p/557365
status_key = "_"


Context.stream_objects["draft_orders"] = DraftOrders