Skip to content

Commit

Permalink
Add support for draft orders, closes singer-io#105
Browse files Browse the repository at this point in the history
  • Loading branch information
rparrapy committed Jun 14, 2021
1 parent 2f57e65 commit 84befd0
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 0 deletions.
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

0 comments on commit 84befd0

Please sign in to comment.