From a470355466146e1cab0915b72572a6cdc297bdbf Mon Sep 17 00:00:00 2001 From: Daryna Ishchenko <80129833+darynaishchenko@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:43:23 +0300 Subject: [PATCH] :bug: Source Recharge: added old api version for orders stream (#29992) Co-authored-by: darynaishchenko --- .../connectors/source-recharge/Dockerfile | 2 +- .../connectors/source-recharge/metadata.yaml | 2 +- .../source-recharge/source_recharge/api.py | 16 +++++++++++----- docs/integrations/sources/recharge.md | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/airbyte-integrations/connectors/source-recharge/Dockerfile b/airbyte-integrations/connectors/source-recharge/Dockerfile index bbc8964f4f60..460d9a306298 100644 --- a/airbyte-integrations/connectors/source-recharge/Dockerfile +++ b/airbyte-integrations/connectors/source-recharge/Dockerfile @@ -12,5 +12,5 @@ RUN pip install . ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=1.0.0 +LABEL io.airbyte.version=1.0.1 LABEL io.airbyte.name=airbyte/source-recharge diff --git a/airbyte-integrations/connectors/source-recharge/metadata.yaml b/airbyte-integrations/connectors/source-recharge/metadata.yaml index b4a498ec5a26..121d4f086f3c 100644 --- a/airbyte-integrations/connectors/source-recharge/metadata.yaml +++ b/airbyte-integrations/connectors/source-recharge/metadata.yaml @@ -5,7 +5,7 @@ data: connectorSubtype: api connectorType: source definitionId: 45d2e135-2ede-49e1-939f-3e3ec357a65e - dockerImageTag: 1.0.0 + dockerImageTag: 1.0.1 dockerRepository: airbyte/source-recharge githubIssueLabel: source-recharge icon: recharge.svg diff --git a/airbyte-integrations/connectors/source-recharge/source_recharge/api.py b/airbyte-integrations/connectors/source-recharge/source_recharge/api.py index c2c9d3e85f8c..fd21d51b218c 100644 --- a/airbyte-integrations/connectors/source-recharge/source_recharge/api.py +++ b/airbyte-integrations/connectors/source-recharge/source_recharge/api.py @@ -11,8 +11,8 @@ from airbyte_cdk.sources.streams.http import HttpStream from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer -API_VERSION = "2021-11" -OLD_API_VERSION = "2021-01" +API_VERSION_2021_11 = "2021-11" +API_VERSION_2021_01 = "2021-01" class RechargeStream(HttpStream, ABC): @@ -38,7 +38,7 @@ def data_path(self): def request_headers( self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None ) -> Mapping[str, Any]: - return {"x-recharge-version": API_VERSION} + return {"x-recharge-version": API_VERSION_2021_11} def path( self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None @@ -174,8 +174,14 @@ class Onetimes(IncrementalRechargeStream): class Orders(IncrementalRechargeStream): """ Orders Stream: https://developer.rechargepayments.com/v1-shopify?python#list-orders + Using old API version to avoid schema changes and loosing email, first_name, last_name columns, because in new version it not present """ + def request_headers( + self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None + ) -> Mapping[str, Any]: + return {"x-recharge-version": API_VERSION_2021_01} + class Products(RechargeStream): """ @@ -186,7 +192,7 @@ class Products(RechargeStream): def request_headers( self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None ) -> Mapping[str, Any]: - return {"x-recharge-version": OLD_API_VERSION} + return {"x-recharge-version": API_VERSION_2021_01} class Shop(RechargeStream): @@ -201,7 +207,7 @@ class Shop(RechargeStream): def request_headers( self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None ) -> Mapping[str, Any]: - return {"x-recharge-version": OLD_API_VERSION} + return {"x-recharge-version": API_VERSION_2021_01} class Subscriptions(IncrementalRechargeStream): diff --git a/docs/integrations/sources/recharge.md b/docs/integrations/sources/recharge.md index ce15a8559e2a..35b5a57d6c51 100644 --- a/docs/integrations/sources/recharge.md +++ b/docs/integrations/sources/recharge.md @@ -76,6 +76,7 @@ The Recharge connector should gracefully handle Recharge API limitations under n | Version | Date | Pull Request | Subject | |:--------|:-----------|:---------------------------------------------------------|:------------------------------------------------------------------------------------------| +| 1.0.1 | 2023-08-30 | [29992](https://github.com/airbytehq/airbyte/pull/29992) | Revert for orders stream to use old API version 2021-01 | | 1.0.0 | 2023-06-22 | [27612](https://github.com/airbytehq/airbyte/pull/27612) | Change data type of the `shopify_variant_id_not_found` field of the `Charges` stream | | 0.2.10 | 2023-06-20 | [27503](https://github.com/airbytehq/airbyte/pull/27503) | Update API version to 2021-11 | | 0.2.9 | 2023-04-10 | [25009](https://github.com/airbytehq/airbyte/pull/25009) | Fix owner slicing for `Metafields` stream |