diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index 0a8e8bdac57a..92746b09a109 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -937,7 +937,7 @@ - name: Stripe sourceDefinitionId: e094cb9a-26de-4645-8761-65c0c425d1de dockerRepository: airbyte/source-stripe - dockerImageTag: 0.1.34 + dockerImageTag: 0.1.35 documentationUrl: https://docs.airbyte.io/integrations/sources/stripe icon: stripe.svg sourceType: api diff --git a/airbyte-config/init/src/main/resources/seed/source_specs.yaml b/airbyte-config/init/src/main/resources/seed/source_specs.yaml index 5ac83f89b70c..706ea22da4d0 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -9291,7 +9291,7 @@ type: "string" path_in_connector_config: - "client_secret" -- dockerImage: "airbyte/source-stripe:0.1.34" +- dockerImage: "airbyte/source-stripe:0.1.35" spec: documentationUrl: "https://docs.airbyte.io/integrations/sources/stripe" connectionSpecification: diff --git a/airbyte-integrations/connectors/source-stripe/Dockerfile b/airbyte-integrations/connectors/source-stripe/Dockerfile index 2dea15a2efd5..0dcc64e056e4 100644 --- a/airbyte-integrations/connectors/source-stripe/Dockerfile +++ b/airbyte-integrations/connectors/source-stripe/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=0.1.34 +LABEL io.airbyte.version=0.1.35 LABEL io.airbyte.name=airbyte/source-stripe diff --git a/airbyte-integrations/connectors/source-stripe/source_stripe/schemas/external_account_bank_accounts.json b/airbyte-integrations/connectors/source-stripe/source_stripe/schemas/external_account_bank_accounts.json new file mode 100644 index 000000000000..330c37645db0 --- /dev/null +++ b/airbyte-integrations/connectors/source-stripe/source_stripe/schemas/external_account_bank_accounts.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": ["string", "null"] + }, + "account_holder_name": { + "type": ["string", "null"] + }, + "account_holder_type": { + "type": ["string", "null"] + }, + "account_type": { + "type": ["string", "null"] + }, + "bank_name": { + "type": ["string", "null"] + }, + "country": { + "type": ["string", "null"] + }, + "currency": { + "type": ["string", "null"] + }, + "fingerprint": { + "type": ["string", "null"] + }, + "last4": { + "type": ["string", "null"] + }, + "metadata": { + "type": ["object", "null"] + }, + "routing_number": { + "type": ["string", "null"] + }, + "status": { + "type": ["string", "null"] + }, + "account": { + "type": ["string", "null"] + } + } +} diff --git a/airbyte-integrations/connectors/source-stripe/source_stripe/schemas/external_account_cards.json b/airbyte-integrations/connectors/source-stripe/source_stripe/schemas/external_account_cards.json new file mode 100644 index 000000000000..00c1203e15e7 --- /dev/null +++ b/airbyte-integrations/connectors/source-stripe/source_stripe/schemas/external_account_cards.json @@ -0,0 +1,78 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": ["string", "null"] + }, + "address_city": { + "type": ["string", "null"] + }, + "address_country": { + "type": ["string", "null"] + }, + "address_line1": { + "type": ["string", "null"] + }, + "address_line1_check": { + "type": ["string", "null"] + }, + "address_line2": { + "type": ["string", "null"] + }, + "address_state": { + "type": ["string", "null"] + }, + "address_zip": { + "type": ["string", "null"] + }, + "address_zip_check": { + "type": ["string", "null"] + }, + "brand": { + "type": ["string", "null"] + }, + "country": { + "type": ["string", "null"] + }, + "cvc_check": { + "type": ["string", "null"] + }, + "dynamic_last4": { + "type": ["string", "null"] + }, + "exp_month": { + "type": ["integer", "null"] + }, + "exp_year": { + "type": ["integer", "null"] + }, + "fingerprint": { + "type": ["string", "null"] + }, + "funding": { + "type": ["string", "null"] + }, + "last4": { + "type": ["string", "null"] + }, + "metadata": { + "type": ["object", "null"] + }, + "name": { + "type": ["string", "null"] + }, + "redaction": { + "type": ["string", "null"] + }, + "tokenization_method": { + "type": ["string", "null"] + }, + "account": { + "type": ["string", "null"] + } + } +} diff --git a/airbyte-integrations/connectors/source-stripe/source_stripe/source.py b/airbyte-integrations/connectors/source-stripe/source_stripe/source.py index 94a7efeb57ea..a3a8835627a4 100644 --- a/airbyte-integrations/connectors/source-stripe/source_stripe/source.py +++ b/airbyte-integrations/connectors/source-stripe/source_stripe/source.py @@ -22,6 +22,8 @@ Customers, Disputes, Events, + ExternalAccountBankAccounts, + ExternalAccountCards, InvoiceItems, InvoiceLineItems, Invoices, @@ -74,4 +76,6 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: SubscriptionItems(**args), Subscriptions(**incremental_args), Transfers(**incremental_args), + ExternalAccountBankAccounts(**args), + ExternalAccountCards(**args), ] diff --git a/airbyte-integrations/connectors/source-stripe/source_stripe/streams.py b/airbyte-integrations/connectors/source-stripe/source_stripe/streams.py index f611d1c70a8f..5fc5e1efd2c3 100644 --- a/airbyte-integrations/connectors/source-stripe/source_stripe/streams.py +++ b/airbyte-integrations/connectors/source-stripe/source_stripe/streams.py @@ -563,3 +563,34 @@ class PromotionCodes(IncrementalStripeStream): def path(self, **kwargs): return "promotion_codes" + + +class ExternalAccount(StripeStream, ABC): + """ + Bank Accounts and Cards are separate streams because they have different schemas + """ + + object = "" + + def path(self, **kwargs): + return f"accounts/{self.account_id}/external_accounts" + + def request_params(self, **kwargs): + params = super().request_params(**kwargs) + return {**params, **{"object": self.object}} + + +class ExternalAccountBankAccounts(ExternalAccount): + """ + https://stripe.com/docs/api/external_account_bank_accounts/list + """ + + object = "bank_account" + + +class ExternalAccountCards(ExternalAccount): + """ + https://stripe.com/docs/api/external_account_cards/list + """ + + object = "card" diff --git a/airbyte-integrations/connectors/source-stripe/unit_tests/test_source.py b/airbyte-integrations/connectors/source-stripe/unit_tests/test_source.py index 5f340f70082a..b0cd7f73a571 100644 --- a/airbyte-integrations/connectors/source-stripe/unit_tests/test_source.py +++ b/airbyte-integrations/connectors/source-stripe/unit_tests/test_source.py @@ -36,7 +36,7 @@ def test_source_streams(): with open("sample_files/config.json") as f: config = json.load(f) streams = SourceStripe().streams(config=config) - assert len(streams) == 22 + assert len(streams) == 24 @pytest.fixture(name="config") diff --git a/airbyte-integrations/connectors/source-stripe/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-stripe/unit_tests/test_streams.py index dee0460d46c6..dfc6bacd71b8 100644 --- a/airbyte-integrations/connectors/source-stripe/unit_tests/test_streams.py +++ b/airbyte-integrations/connectors/source-stripe/unit_tests/test_streams.py @@ -15,6 +15,9 @@ Customers, Disputes, Events, + ExternalAccount, + ExternalAccountBankAccounts, + ExternalAccountCards, InvoiceItems, InvoiceLineItems, Invoices, @@ -166,6 +169,7 @@ def config_fixture(): (CheckoutSessions, {}, "checkout/sessions"), (CheckoutSessionsLineItems, {"stream_slice": {"checkout_session_id": "CS1"}}, "checkout/sessions/CS1/line_items"), (PromotionCodes, {}, "promotion_codes"), + (ExternalAccount, {}, "accounts//external_accounts"), ], ) def test_path( @@ -188,6 +192,8 @@ def test_path( (BankAccounts, {"stream_state": {}, "stream_slice": {"subscription_id": "SI"}}, {"limit": 100, "object": "bank_account"}), (CheckoutSessions, {"stream_state": None}, {"limit": 100}), (CheckoutSessionsLineItems, {"stream_state": None}, {"limit": 100, "expand[]": ["data.discounts", "data.taxes"]}), + (ExternalAccountBankAccounts, {"stream_state": None}, {"limit": 100, "object": "bank_account"}), + (ExternalAccountCards, {"stream_state": None}, {"limit": 100, "object": "card"}), ], ) def test_request_params( diff --git a/docs/integrations/sources/stripe.md b/docs/integrations/sources/stripe.md index 431670ed55b4..c10eab38df34 100644 --- a/docs/integrations/sources/stripe.md +++ b/docs/integrations/sources/stripe.md @@ -61,6 +61,8 @@ The Stripe source connector supports the following streams: * [Subscription Items](https://stripe.com/docs/api/subscription_items/list) * [Subscriptions](https://stripe.com/docs/api/subscriptions/list) \(Incremental\) * [Transfers](https://stripe.com/docs/api/transfers/list) \(Incremental\) +* [ExternalAccountBankAccounts](https://stripe.com/docs/api/external_account_bank_accounts/list)\(Full Refresh\) +* [ExternalAccountCards](https://stripe.com/docs/api/external_account_cards/list)\(Full Refresh\) ### Data type mapping @@ -74,7 +76,8 @@ The Stripe connector should not run into Stripe API limitations under normal usa | Version | Date | Pull Request | Subject | |:--------|:-----------| :--- |:-------------------------------------------------------------------------------------------------------------------------------------------------------| -| 0.1.34 | 2022-07-21 | [14924](https://github.com/airbytehq/airbyte/pull/14924) | Remove `additionalProperties` field from spec and schema | +| 0.1.35 | 2022-07-21 | [14924](https://github.com/airbytehq/airbyte/pull/14924) | Remove `additionalProperties` field from spec and schema | +| 0.1.34 | 2022-07-01 | [14357](https://github.com/airbytehq/airbyte/pull/14357) | added external account streams | | 0.1.33 | 2022-06-06 | [13449](https://github.com/airbytehq/airbyte/pull/13449) | added semi-incremental support for CheckoutSessions and CheckoutSessionsLineItems streams, fixed big in StripeSubStream, added unittests, updated docs | | 0.1.32 | 2022-04-30 | [12500](https://github.com/airbytehq/airbyte/pull/12500) | Improve input configuration copy | | 0.1.31 | 2022-04-20 | [12230](https://github.com/airbytehq/airbyte/pull/12230) | Update connector to use a `spec.yaml` |