Skip to content

Commit

Permalink
🐛 Source Recharge: added old api version for orders stream (#29992)
Browse files Browse the repository at this point in the history
Co-authored-by: darynaishchenko <darynaishchenko@users.noreply.github.com>
  • Loading branch information
darynaishchenko and darynaishchenko committed Sep 11, 2023
1 parent 723a523 commit a470355
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-recharge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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):
"""
Expand All @@ -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):
Expand All @@ -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):
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/recharge.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit a470355

Please sign in to comment.