diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/Dockerfile b/airbyte-integrations/connectors/source-amazon-seller-partner/Dockerfile index 54a6e8ed5ce0..3ebd3a0faca0 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/Dockerfile +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/Dockerfile @@ -13,5 +13,5 @@ ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=1.4.1 +LABEL io.airbyte.version=1.5.0 LABEL io.airbyte.name=airbyte/source-amazon-seller-partner diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/acceptance-test-config.yml b/airbyte-integrations/connectors/source-amazon-seller-partner/acceptance-test-config.yml index 7ecf7175a2ef..5b753c0a5ac1 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/acceptance-test-config.yml +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/acceptance-test-config.yml @@ -128,7 +128,7 @@ acceptance_tests: bypass_reason: "no records" incremental: tests: - - config_path: "secrets/config_old_data.json" + - config_path: "secrets/config.json" configured_catalog_path: "integration_tests/configured_catalog_incremental.json" timeout_seconds: 3600 future_state: diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/configured_catalog_incremental.json b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/configured_catalog_incremental.json index 9f2a3465ecde..55c7437a3fc0 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/configured_catalog_incremental.json +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/configured_catalog_incremental.json @@ -1,5 +1,17 @@ { "streams": [ + { + "stream": { + "name": "OrderItems", + "json_schema": {}, + "supported_sync_modes": ["full_refresh", "incremental"], + "source_defined_cursor": true, + "default_cursor_field": ["LastUpdateDate"] + }, + "sync_mode": "incremental", + "destination_sync_mode": "append", + "cursor_field": ["LastUpdateDate"] + }, { "stream": { "name": "Orders", diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/expected_records.jsonl b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/expected_records.jsonl index 1c251e78e47e..d3778d0803cc 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/expected_records.jsonl +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/expected_records.jsonl @@ -13,3 +13,5 @@ {"stream": "GET_MERCHANT_LISTINGS_INACTIVE_DATA", "data": {"item-name": "GiftBox", "item-description": "", "listing-id": "0711ZJWAW1J", "seller-sku": "G3-8N7Y-L93I", "price": "6", "quantity": "1000", "open-date": "2022-07-11 01:48:47 PDT", "image-url": "", "item-is-marketplace": "y", "product-id-type": "1", "zshop-shipping-fee": "", "item-note": "", "item-condition": "11", "zshop-category1": "", "zshop-browse-path": "", "zshop-storefront-feature": "", "asin1": "B0B68NBQ1Y", "asin2": "", "asin3": "", "will-ship-internationally": "", "expedited-shipping": "", "zshop-boldface": "", "product-id": "B0B68NBQ1Y", "bid-for-featured-placement": "", "add-delete": "", "pending-quantity": "0", "fulfillment-channel": "DEFAULT", "merchant-shipping-group": "Migrated Template"}, "emitted_at": 1690223127429} {"stream": "GET_MERCHANT_LISTINGS_INACTIVE_DATA", "data": {"item-name": "Beyond Meat, Plant-Based Patties, Vegan, 8 Oz, 2 Patties", "item-description": "", "listing-id": "0711ZJW1CW7", "seller-sku": "M6-KYAA-V7O7", "price": "10", "quantity": "999999", "open-date": "2022-07-11 01:16:54 PDT", "image-url": "", "item-is-marketplace": "y", "product-id-type": "1", "zshop-shipping-fee": "", "item-note": "", "item-condition": "11", "zshop-category1": "", "zshop-browse-path": "", "zshop-storefront-feature": "", "asin1": "B074K5MDLW", "asin2": "", "asin3": "", "will-ship-internationally": "", "expedited-shipping": "", "zshop-boldface": "", "product-id": "B074K5MDLW", "bid-for-featured-placement": "", "add-delete": "", "pending-quantity": "0", "fulfillment-channel": "DEFAULT", "merchant-shipping-group": "Migrated Template"}, "emitted_at": 1690223127429} {"stream": "GET_MERCHANT_LISTINGS_INACTIVE_DATA", "data": {"item-name": "House Foods, Organic Firm Tofu, 14 oz", "item-description": "", "listing-id": "0705Z8HWWAY", "seller-sku": "MP-V4RG-EDEY", "price": "5", "quantity": "1518", "open-date": "2022-07-05 08:00:10 PDT", "image-url": "", "item-is-marketplace": "y", "product-id-type": "1", "zshop-shipping-fee": "", "item-note": "", "item-condition": "1", "zshop-category1": "", "zshop-browse-path": "", "zshop-storefront-feature": "", "asin1": "B000VHRNUW", "asin2": "", "asin3": "", "will-ship-internationally": "", "expedited-shipping": "", "zshop-boldface": "", "product-id": "B000VHRNUW", "bid-for-featured-placement": "", "add-delete": "", "pending-quantity": "0", "fulfillment-channel": "DEFAULT", "merchant-shipping-group": "Migrated Template"}, "emitted_at": 1690223127429} +{"stream": "Orders", "data": {"BuyerInfo": {}, "AmazonOrderId": "112-4052057-4266618", "EarliestShipDate": "2022-07-25T07:00:00Z", "SalesChannel": "Amazon.com", "AutomatedShippingSettings": {"HasAutomatedShippingSettings": false}, "OrderStatus": "Canceled", "NumberOfItemsShipped": 0, "OrderType": "StandardOrder", "IsPremiumOrder": false, "IsPrime": false, "FulfillmentChannel": "MFN", "NumberOfItemsUnshipped": 0, "HasRegulatedItems": false, "IsReplacementOrder": "false", "IsSoldByAB": false, "LatestShipDate": "2022-07-26T06:59:59Z", "ShipServiceLevel": "Std US D2D Dom", "IsISPU": false, "MarketplaceId": "ATVPDKIKX0DER", "PurchaseDate": "2022-07-22T20:25:05Z", "IsAccessPointOrder": false, "IsBusinessOrder": false, "OrderTotal": {"CurrencyCode": "USD", "Amount": "7.00"}, "PaymentMethodDetails": ["Standard"], "IsGlobalExpressEnabled": false, "LastUpdateDate": "2022-09-01T13:16:42Z", "ShipmentServiceLevelCategory": "Standard"}, "emitted_at": 1691499338977} +{"stream": "OrderItems", "data": {"ProductInfo": {"NumberOfItems": "1"}, "BuyerInfo": {}, "ItemTax": {"CurrencyCode": "USD", "Amount": "0.00"}, "QuantityShipped": 0, "BuyerRequestedCancel": {"IsBuyerRequestedCancel": "false", "BuyerCancelReason": ""}, "ItemPrice": {"CurrencyCode": "USD", "Amount": "7.00"}, "ASIN": "B074K5MDLW", "SellerSKU": "2J-D6V7-C8XI", "Title": "Beyond Meat Beyond Burger Plant-Based Patties 2 pk, 8 oz (Frozen)", "IsGift": "false", "ConditionSubtypeId": "New", "IsTransparency": false, "QuantityOrdered": 0, "PromotionDiscountTax": {"CurrencyCode": "USD", "Amount": "0.00"}, "ConditionId": "New", "PromotionDiscount": {"CurrencyCode": "USD", "Amount": "0.00"}, "OrderItemId": "00860509139506", "LastUpdateDate": "2022-09-01T13:16:42Z", "AmazonOrderId": "112-4052057-4266618"}, "emitted_at": 1691499343416} diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/future_state.json b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/future_state.json index f7a73ecd7d11..7b295ecf757e 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/future_state.json +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/integration_tests/future_state.json @@ -1,13 +1,24 @@ [ - { - "type": "STREAM", - "stream": { - "stream_state": { - "LastUpdateDate": "2121-07-01T00:00:00Z" - }, - "stream_descriptor": { - "name": "Orders" - } - } - } - ] \ No newline at end of file + { + "type": "STREAM", + "stream": { + "stream_state": { + "LastUpdateDate": "2121-07-01T00:00:00Z" + }, + "stream_descriptor": { + "name": "OrderItems" + } + } + }, + { + "type": "STREAM", + "stream": { + "stream_state": { + "LastUpdateDate": "2121-07-01T00:00:00Z" + }, + "stream_descriptor": { + "name": "Orders" + } + } + } +] diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml b/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml index a970f76b1b28..c0dcd1486102 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/metadata.yaml @@ -2,7 +2,7 @@ data: connectorSubtype: api connectorType: source definitionId: e55879a8-0ef8-4557-abcf-ab34c53ec460 - dockerImageTag: 1.4.1 + dockerImageTag: 1.5.0 dockerRepository: airbyte/source-amazon-seller-partner githubIssueLabel: source-amazon-seller-partner icon: amazonsellerpartner.svg diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/schemas/OrderItems.json b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/schemas/OrderItems.json new file mode 100644 index 000000000000..e8fa6b726250 --- /dev/null +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/schemas/OrderItems.json @@ -0,0 +1,290 @@ +{ + "title": "Order Items", + "description": "All order items that were updated after a specified date", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": true, + "properties": { + "AmazonOrderId": { + "type": ["null", "string"] + }, + "ASIN": { + "type": ["null", "string"] + }, + "OrderItemId": { + "type": ["null", "string"] + }, + "SellerSKU": { + "type": ["null", "string"] + }, + "Title": { + "type": ["null", "string"] + }, + "QuantityOrdered": { + "type": ["null", "integer"] + }, + "ProductInfo": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "NumberOfItems": { + "type": ["null", "string"] + } + } + }, + "QuantityShipped": { + "type": ["null", "integer"] + }, + "PointsGranted": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "PointsNumber": { + "type": ["null", "integer"] + }, + "PointsMonetaryValue": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + } + } + }, + "ItemPrice": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "PromotionIds": { + "type": ["null", "array"], + "items": { + "type": ["null", "string"] + } + }, + "ItemTax": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "ShippingPrice": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "ShippingTax": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "ShippingDiscount": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "ShippingDiscountTax": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "PromotionDiscount": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "PromotionDiscountTax": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "ScheduledDeliveryEndDate": { + "type": ["null", "string"], + "format": "date-time" + }, + "ScheduledDeliveryStartDate": { + "type": ["null", "string"], + "format": "date-time" + }, + "CODFee": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "IsGift": { + "type": ["null", "string"] + }, + "ConditionNote": { + "type": ["null", "string"] + }, + "ConditionId": { + "type": ["null", "string"] + }, + "ConditionSubtypeId": { + "type": ["null", "string"] + }, + "CODFeeDiscount": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "TaxCollection": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "Model": { + "type": ["null", "string"] + }, + "ResponsibleParty": { + "type": ["null", "string"] + } + } + }, + "IsTransparency": { + "type": ["null", "boolean"] + }, + "IossNumber": { + "type": ["null", "string"] + }, + "SerialNumberRequired": { + "type": ["null", "boolean"] + }, + "StoreChainStoreId": { + "type": ["null", "string"] + }, + "DeemedResellerCategory": { + "type": ["null", "string"] + }, + "PriceDesignation": { + "type": ["null", "string"] + }, + "BuyerInfo": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "BuyerCustomizedInfo": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CustomizedURL": { + "type": ["null", "string"] + } + } + }, + "GiftMessageText": { + "type": ["null", "string"] + }, + "GiftWrapPrice": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "CurrencyCode": { + "type": ["null", "string"] + }, + "Amount": { + "type": ["null", "string"] + } + } + }, + "GiftWrapLevel": { + "type": ["null", "string"] + } + } + }, + "BuyerRequestedCancel": { + "type": ["null", "object"], + "additionalProperties": true, + "properties": { + "IsBuyerRequestedCancel": { + "type": ["null", "string"] + }, + "BuyerCancelReason": { + "type": ["null", "string"] + } + } + }, + "SerialNumbers": { + "type": ["null", "array"], + "items": { + "type": ["null", "string"] + } + }, + "LastUpdateDate": { + "type": ["null", "string"] + } + } +} diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py index 1570ca2489ff..02ed7e039e8d 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/source.py @@ -55,6 +55,7 @@ MerchantListingsReport, MerchantListingsReportBackCompat, MerchantListingsReports, + OrderItems, OrderReportDataShipping, Orders, RestockInventoryReports, @@ -179,6 +180,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: VendorInventoryReports(**stream_kwargs), VendorSalesReports(**stream_kwargs), Orders(**stream_kwargs), + OrderItems(**stream_kwargs), OrderReportDataShipping(**stream_kwargs), SellerAnalyticsSalesAndTrafficReports(**stream_kwargs), SellerFeedbackReports(**stream_kwargs), diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py index bfd0b38cd24e..d347fa185d87 100644 --- a/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/source_amazon_seller_partner/streams.py @@ -797,6 +797,7 @@ class Orders(IncrementalAmazonSPStream): next_page_token_field = "NextToken" page_size_field = "MaxResultsPerPage" default_backoff_time = 60 + use_cache = True def path(self, **kwargs) -> str: return f"orders/{ORDERS_API_VERSION}/orders" @@ -821,6 +822,80 @@ def backoff_time(self, response: requests.Response) -> Optional[float]: return self.default_backoff_time +class OrderItems(AmazonSPStream, ABC): + """ + API docs: https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#getorderitems + API model: https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#orderitemslist + """ + + name = "OrderItems" + primary_key = "OrderItemId" + cursor_field = "LastUpdateDate" + parent_cursor_field = "LastUpdateDate" + next_page_token_field = "NextToken" + stream_slice_cursor_field = "AmazonOrderId" + page_size_field = None + default_backoff_time = 10 + default_stream_slice_delay_time = 1 + cached_state: Dict = {} + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.stream_kwargs = kwargs + + def path(self, stream_slice: Optional[Mapping[str, Any]] = None, **kwargs) -> str: + return f"orders/{ORDERS_API_VERSION}/orders/{stream_slice[self.stream_slice_cursor_field]}/orderItems" + + def request_params( + self, stream_state: Mapping[str, Any], next_page_token: Mapping[str, Any] = None, **kwargs + ) -> MutableMapping[str, Any]: + if next_page_token: + return dict(next_page_token) + return {} + + def stream_slices(self, stream_state: Mapping[str, Any] = None, **kwargs) -> Iterable[Optional[Mapping[str, any]]]: + orders = Orders(**self.stream_kwargs) + for order_record in orders.read_records(sync_mode=SyncMode.incremental, stream_state=stream_state): + self.cached_state[self.parent_cursor_field] = order_record[self.parent_cursor_field] + self.logger.info(f"OrderItems stream slice for order {order_record[self.stream_slice_cursor_field]}") + time.sleep(self.default_stream_slice_delay_time) + yield { + self.stream_slice_cursor_field: order_record[self.stream_slice_cursor_field], + self.parent_cursor_field: order_record[self.parent_cursor_field], + } + + def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]: + latest_benchmark = self.cached_state[self.parent_cursor_field] + if current_stream_state.get(self.parent_cursor_field): + return {self.parent_cursor_field: max(latest_benchmark, current_stream_state[self.parent_cursor_field])} + return {self.parent_cursor_field: latest_benchmark} + + def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: + stream_data = response.json() + next_page_token = stream_data.get("payload").get(self.next_page_token_field) + if next_page_token: + return {self.next_page_token_field: next_page_token} + + def backoff_time(self, response: requests.Response) -> Optional[float]: + rate_limit = response.headers.get("x-amzn-RateLimit-Limit", 0) + if rate_limit: + return 1 / float(rate_limit) + else: + return self.default_backoff_time + + def parse_response( + self, response: requests.Response, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, **kwargs + ) -> Iterable[Mapping]: + order_items_list = response.json().get(self.data_field, {}) + self.logger.info(f"order_items_list efim {order_items_list}") + if order_items_list.get(self.next_page_token_field) is None: + self.cached_state[self.parent_cursor_field] = stream_slice[self.parent_cursor_field] + for order_item in order_items_list.get(self.name, []): + order_item[self.cursor_field] = stream_slice.get(self.parent_cursor_field) + order_item[self.stream_slice_cursor_field] = order_items_list.get(self.stream_slice_cursor_field) + yield order_item + + class LedgerDetailedViewReports(IncrementalReportsAmazonSPStream): """ API docs: https://developer-docs.amazon.com/sp-api/docs/report-type-values diff --git a/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_order_items_stream.py b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_order_items_stream.py new file mode 100644 index 000000000000..4e5d1364ed99 --- /dev/null +++ b/airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/test_order_items_stream.py @@ -0,0 +1,99 @@ +# +# Copyright (c) 2023 Airbyte, Inc., all rights reserved. +# + +import pytest +import requests +from source_amazon_seller_partner.auth import AWSSignature +from source_amazon_seller_partner.streams import OrderItems + +list_order_items_payload_data = { + "payload": { + "OrderItems": [ + { + "ProductInfo": { + "NumberOfItems": "1" + }, + "IsGift": "false", + "BuyerInfo": {}, + "QuantityShipped": 0, + "IsTransparency": False, + "QuantityOrdered": 1, + "ASIN": "AKDDKDKD", + "SellerSKU": "AAA-VPx3-AMZ", + "Title": "Example product", + "OrderItemId": "88888888888" + } + ], + "AmazonOrderId": "111-0000000-2222222" + } +} + + +@pytest.fixture +def order_items_stream(): + def _internal(): + aws_signature = AWSSignature( + service="execute-api", + aws_access_key_id="AccessKeyId", + aws_secret_access_key="SecretAccessKey", + aws_session_token="SessionToken", + region="US", + ) + stream = OrderItems( + url_base="https://test.url", + aws_signature=aws_signature, + replication_start_date="2023-08-08T00:00:00Z", + replication_end_date=None, + marketplace_id="id", + authenticator=None, + period_in_days=0, + report_options=None, + advanced_stream_options=None, + max_wait_seconds=500, + ) + return stream + + return _internal + + +def test_order_items_stream_initialization(order_items_stream): + stream = order_items_stream() + assert stream._replication_start_date == "2023-08-08T00:00:00Z" + assert stream._replication_end_date is None + assert stream.marketplace_id == "id" + + +def test_order_items_stream_next_token(mocker, order_items_stream): + response = requests.Response() + token = "111111111" + expected = {"NextToken": token} + mocker.patch.object(response, "json", return_value={"payload": expected}) + assert expected == order_items_stream().next_page_token(response) + + mocker.patch.object(response, "json", return_value={"payload": {}}) + if order_items_stream().next_page_token(response) is not None: + assert False + + +def test_order_items_stream_parse_response(mocker, order_items_stream): + response = requests.Response() + mocker.patch.object(response, "json", return_value=list_order_items_payload_data) + + stream = order_items_stream() + stream.cached_state["LastUpdateDate"] = "2023-08-07T00:00:00Z" + parsed = stream.parse_response(response, stream_slice={"AmazonOrderId": "111-0000000-2222222", "LastUpdateDate": "2023-08-08T00:00:00Z"}) + + for record in parsed: + assert record["AmazonOrderId"] == "111-0000000-2222222" + assert record["OrderItemId"] == "88888888888" + assert record["SellerSKU"] == "AAA-VPx3-AMZ" + assert record["ASIN"] == "AKDDKDKD" + assert record["Title"] == "Example product" + assert record["QuantityOrdered"] == 1 + assert record["QuantityShipped"] == 0 + assert record["BuyerInfo"] == {} + assert record["IsGift"] == "false" + assert record["ProductInfo"] == {"NumberOfItems": "1"} + + assert stream.cached_state["LastUpdateDate"] == "2023-08-08T00:00:00Z" diff --git a/docs/integrations/sources/amazon-seller-partner.md b/docs/integrations/sources/amazon-seller-partner.md index deaf5abb4d3d..13157ffb9fb0 100644 --- a/docs/integrations/sources/amazon-seller-partner.md +++ b/docs/integrations/sources/amazon-seller-partner.md @@ -71,6 +71,7 @@ This source is capable of syncing the following tables and their data: - [Vendor Direct Fulfillment Shipping](https://developer-docs.amazon.com/sp-api/docs/vendor-direct-fulfillment-shipping-api-v1-reference) - [Vendor Inventory Health Reports](https://developer-docs.amazon.com/sp-api/docs/reports-api-v2021-06-30-reference) - [Orders](https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference) \(incremental\) +- [Orders Items](https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#getorderitems) \(incremental\) - [Seller Feedback Report](https://developer-docs.amazon.com/sp-api/docs/reports-api-v2021-06-30-reference) \(incremental\) - [Brand Analytics Alternate Purchase Report](https://developer-docs.amazon.com/sp-api/docs/report-type-values#brand-analytics-reports) - [Brand Analytics Item Comparison Report](https://developer-docs.amazon.com/sp-api/docs/report-type-values#brand-analytics-reports) @@ -128,6 +129,7 @@ So, for any value that exceeds the limit, the `period_in_days` will be automatic | Version | Date | Pull Request | Subject | |:---------|:-----------|:-----------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `1.5.0` | 2023-08-08 | [\#29054](https://github.com/airbytehq/airbyte/pull/29054) | Add new stream `OrderItems` | | `1.4.1` | 2023-07-25 | [\#27050](https://github.com/airbytehq/airbyte/pull/27050) | Fix - non vendor accounts connector create/check issue | | `1.4.0` | 2023-07-21 | [\#27110](https://github.com/airbytehq/airbyte/pull/27110) | Add `GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING` and `GET_ORDER_REPORT_DATA_SHIPPING` streams | | `1.3.0` | 2023-06-09 | [\#27110](https://github.com/airbytehq/airbyte/pull/27110) | Removed `app_id` from `InputConfiguration`, refactored `spec` |