1
0
mirror of synced 2025-12-25 02:09:19 -05:00

Source Square: Replace custom multiple authenticators with Selective Authenticator (#37800)

This commit is contained in:
Anatolii Yatsuk
2024-05-07 10:35:38 +03:00
committed by GitHub
parent a683c74358
commit 2712115cbe
13 changed files with 1239 additions and 432 deletions

View File

@@ -1,38 +0,0 @@
FROM python:3.9.11-alpine3.15 as base
# build and load all requirements
FROM base as builder
WORKDIR /airbyte/integration_code
# upgrade pip to the latest version
RUN apk --no-cache upgrade \
&& pip install --upgrade pip \
&& apk --no-cache add tzdata build-base
COPY setup.py ./
# install necessary packages to a temporary folder
RUN pip install --prefix=/install .
# build a clean environment
FROM base
WORKDIR /airbyte/integration_code
# copy all loaded and built libraries to a pure basic image
COPY --from=builder /install /usr/local
# add default timezone settings
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN echo "Etc/UTC" > /etc/timezone
# bash is installed for more convenient debugging.
RUN apk --no-cache add bash
# copy payload code only
COPY main.py ./
COPY source_square ./source_square
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
LABEL io.airbyte.version=1.6.1
LABEL io.airbyte.name=airbyte/source-square

View File

@@ -1,36 +1,55 @@
# Square Source
# Square source connector
This is the repository for the Square configuration based source connector.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/square).
This is the repository for the Square source connector, written in Python.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/square).
## Local development
#### Create credentials
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/square)
### Prerequisites
* Python (~=3.9)
* Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
### Installing the connector
From this connector directory, run:
```bash
poetry install --with dev
```
### Create credentials
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/square)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_square/spec.yaml` file.
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
See `integration_tests/sample_config.json` for a sample config file.
**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source square test creds`
and place them into `secrets/config.json`.
### Locally running the connector docker image
See `sample_files/sample_config.json` for a sample config file.
#### Build
**Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
### Locally running the connector
```
poetry run source-square spec
poetry run source-square check --config secrets/config.json
poetry run source-square discover --config secrets/config.json
poetry run source-square read --config secrets/config.json --catalog sample_files/configured_catalog.json
```
### Running unit tests
To run unit tests locally, from the connector directory run:
```
poetry run pytest unit_tests
```
### Building the docker image
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
2. Run the following command to build the docker image:
```bash
airbyte-ci connectors --name=source-square build
```
An image will be built with the tag `airbyte/source-square:dev`.
An image will be available on your host with the tag `airbyte/source-square:dev`.
**Via `docker build`:**
```bash
docker build -t airbyte/source-square:dev .
```
#### Run
### Running as a docker container
Then run any of the connector commands as follows:
```
docker run --rm airbyte/source-square:dev spec
@@ -39,29 +58,34 @@ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-square:dev discover --
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-square:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
```
## Testing
### Running our CI test suite
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
```bash
airbyte-ci connectors --name=source-square test
```
### Customizing acceptance Tests
Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
Customize `acceptance-test-config.yml` file to configure acceptance tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
## Dependency Management
All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
We split dependencies between two groups, dependencies that are:
* required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
* required for the testing need to go to `TEST_REQUIREMENTS` list
### Dependency Management
All of your dependencies should be managed via Poetry.
To add a new dependency, run:
```bash
poetry add <package-name>
```
### Publishing a new version of the connector
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
## Publishing a new version of the connector
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-square test`
2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
2. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
- bump the `dockerImageTag` value in in `metadata.yaml`
- bump the `version` value in `pyproject.toml`
3. Make sure the `metadata.yaml` content is up to date.
4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/square.md`).
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/square.md`).
5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
6. Pat yourself on the back for being an awesome contributor.
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
8. Once your PR is merged, the new version of the connector will be automatically published to Docker Hub and our connector registry.

View File

@@ -1,38 +1,40 @@
{"stream": "team_member_wages", "data": {"id": "XGC1R9wiiymBJ4M1K8puuJGZ", "team_member_id": "TMA-T96eUCnR9DkX", "title": "Owner"}, "emitted_at": 1697217912786}
{"stream": "team_member_wages", "data": {"id": "hFDaXrhWZ1BhnZLbrJTqqCfm", "team_member_id": "TMcnrxWIJPlmU4c5", "title": "Barista", "hourly_rate": {"amount": 2000, "currency": "USD"}}, "emitted_at": 1697217912790}
{"stream": "team_member_wages", "data": {"id": "pC3birEsVhGyF58XjPvQ6BhD", "team_member_id": "TMx95KdTStPnIxgp", "title": "Cashier", "hourly_rate": {"amount": 2404, "currency": "USD"}}, "emitted_at": 1697217912793}
{"stream": "refunds", "data": {"id": "NWO7kC96bJDUNKLovcUnapxGeOWZY_0um3GHK0AHt273xEe6I3u1y96Lnm018b0WAtyyOYRrP", "status": "COMPLETED", "amount_money": {"amount": 1485, "currency": "USD"}, "payment_id": "NWO7kC96bJDUNKLovcUnapxGeOWZY", "order_id": "NpZRjYMGKOKeTe0BTp7N5r8kM0LZY", "created_at": "2021-06-18T13:37:34.471Z", "updated_at": "2021-06-18T13:37:37.319Z", "processing_fee": [{"effective_at": "2021-06-18T15:31:43.000Z", "type": "INITIAL", "amount_money": {"amount": -51, "currency": "USD"}}], "location_id": "LH2XR7AMG39HX", "reason": "Broken item", "destination_type": "CARD"}, "emitted_at": 1697217913234}
{"stream": "refunds", "data": {"id": "NWO7kC96bJDUNKLovcUnapxGeOWZY_BH7uyAXe6SqRc99uEExljMwERWZPci10Og6zIyfynAB", "status": "COMPLETED", "amount_money": {"amount": 500, "currency": "USD"}, "payment_id": "NWO7kC96bJDUNKLovcUnapxGeOWZY", "order_id": "BFkIiV4W7baTDDx2CGGhdEzvTOCZY", "created_at": "2021-06-22T19:35:20.612Z", "updated_at": "2021-06-22T19:35:23.683Z", "processing_fee": [{"effective_at": "2021-06-18T15:31:43.000Z", "type": "INITIAL", "amount_money": {"amount": -18, "currency": "USD"}}], "location_id": "LH2XR7AMG39HX", "reason": "Overpayment", "destination_type": "CARD"}, "emitted_at": 1697217913243}
{"stream": "customers", "data": {"id": "WYP9CC9M156J71DMQF41Q8VMWW", "created_at": "2021-06-18T14:02:43.476Z", "updated_at": "2021-06-18T14:03:25Z", "cards": [{"id": "ccof:k0ZuyEJ7sQGFsgfA4GB", "card_brand": "VISA", "last_4": "1111", "exp_month": 6, "exp_year": 2026, "cardholder_name": "Test Customer", "billing_address": {"postal_code": "12345"}}], "given_name": "Test", "family_name": "Customer_1", "email_address": "test_customer_1@airbyte.io", "address": {"address_line_1": "street", "address_line_2": "apt", "locality": "city", "administrative_district_level_1": "AL", "postal_code": "35242"}, "phone_number": "+18009090909", "reference_id": "12345", "company_name": "Company", "preferences": {"email_unsubscribed": false}, "creation_source": "DIRECTORY", "birthday": "1990-08-09T00:00:00-00:00", "segment_ids": ["ML7SCCR7EMAK4.CARDS_ON_FILE", "ML7SCCR7EMAK4.REACHABLE"], "version": 1}, "emitted_at": 1697217931447}
{"stream": "taxes", "data": {"type": "TAX", "id": "CWU3GDBRZJ4TPNCVTX7AL6Q7", "updated_at": "2021-06-14T13:12:47.779Z", "created_at": "2021-06-10T22:13:33.029Z", "version": 1623676367779, "is_deleted": false, "present_at_all_locations": true, "tax_data": {"name": "20_p", "calculation_phase": "TAX_SUBTOTAL_PHASE", "inclusion_type": "ADDITIVE", "percentage": "20.0", "applies_to_custom_amounts": false, "enabled": true, "tax_type_id": "us_sales_tax", "tax_type_name": "Sales Tax"}}, "emitted_at": 1697217904696}
{"stream": "taxes", "data": {"type": "TAX", "id": "C3EB6HITDFUUSQJIHM7KGFRU", "updated_at": "2021-06-15T13:17:49.723Z", "created_at": "2021-06-10T22:13:47.037Z", "version": 1623763069723, "is_deleted": false, "present_at_all_locations": true, "absent_at_location_ids": ["LH2XR7AMG39HX"], "tax_data": {"name": "5_p", "calculation_phase": "TAX_SUBTOTAL_PHASE", "inclusion_type": "INCLUSIVE", "percentage": "5.0", "applies_to_custom_amounts": true, "enabled": true, "tax_type_id": "us_sales_tax", "tax_type_name": "Sales Tax"}}, "emitted_at": 1697217904702}
{"stream": "taxes", "data": {"type": "TAX", "id": "5X7QCTRTQ7MEUFFWF2ESR3IA", "updated_at": "2021-06-15T13:18:45.628Z", "created_at": "2021-06-15T13:18:45.628Z", "version": 1623763125628, "is_deleted": false, "present_at_all_locations": true, "absent_at_location_ids": ["L9A5Y0JR014G1"], "tax_data": {"name": "15_p", "calculation_phase": "TAX_SUBTOTAL_PHASE", "inclusion_type": "ADDITIVE", "percentage": "15.0", "applies_to_custom_amounts": true, "enabled": true, "tax_type_id": "us_sales_tax", "tax_type_name": "Sales Tax"}}, "emitted_at": 1697217904706}
{"stream": "payments", "data": {"id": "9m4YvEyzLRUvwUeBf2DNtVOh6cIZY", "created_at": "2021-06-08T20:21:39.212Z", "updated_at": "2021-06-08T20:21:41.165Z", "amount_money": {"amount": 100, "currency": "USD"}, "status": "COMPLETED", "delay_duration": "PT168H", "source_type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "MASTERCARD", "last_4": "9029", "exp_month": 6, "exp_year": 2023, "fingerprint": "sq-1-MTQOLCjEOIzHvJvKX4yxf6qBvj6DAFuB8wlWoKW4NI1BAFV5cdlJmge8ehPFGUSeuw", "card_type": "CREDIT", "prepaid_type": "NOT_PREPAID", "bin": "540988"}, "entry_method": "KEYED", "cvv_status": "CVV_ACCEPTED", "avs_status": "AVS_ACCEPTED", "statement_description": "SQ *DEFAULT TEST ACCOUNT", "card_payment_timeline": {"authorized_at": "2021-06-08T20:21:39.320Z", "captured_at": "2021-06-08T20:21:39.395Z"}}, "location_id": "LH2XR7AMG39HX", "order_id": "jqYrf6arFpUo7zElfWu9GRF5lAWZY", "risk_evaluation": {"created_at": "2021-06-08T20:21:39.321Z", "risk_level": "NORMAL"}, "processing_fee": [{"effective_at": "2021-06-08T22:21:41.000Z", "type": "INITIAL", "amount_money": {"amount": 33, "currency": "USD"}}], "total_money": {"amount": 100, "currency": "USD"}, "approved_money": {"amount": 100, "currency": "USD"}, "receipt_number": "9m4Y", "receipt_url": "https://squareupsandbox.com/receipt/preview/9m4YvEyzLRUvwUeBf2DNtVOh6cIZY", "delay_action": "CANCEL", "delayed_until": "2021-06-15T20:21:39.212Z", "application_details": {"square_product": "ECOMMERCE_API", "application_id": "sandbox-sq0idb-Nd7U5HfhPMxxK3f1Me-yKw"}, "version_token": "d4BjlOwbOUGifHe9BMhuSCRTDGvKA1MYm3aaTzOjbCT6o"}, "emitted_at": 1697217922482}
{"stream": "payments", "data": {"id": "rLBl9k8kKVV8uXNymUEct6S2ebIZY", "created_at": "2021-06-18T13:30:27.850Z", "updated_at": "2021-06-18T13:30:28.721Z", "amount_money": {"amount": 2056, "currency": "USD"}, "status": "COMPLETED", "delay_duration": "PT168H", "source_type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "VISA", "last_4": "1111", "exp_month": 6, "exp_year": 2026, "fingerprint": "sq-1-mqW9yIk2eKV4LdXhGzf-FYu1knqb1IT7lXybOaFbMwIH2-9d1qdVOGNUMA8TDALoqg", "card_type": "CREDIT", "bin": "411111"}, "entry_method": "KEYED", "cvv_status": "CVV_ACCEPTED", "avs_status": "AVS_ACCEPTED", "statement_description": "SQ *DEFAULT TEST ACCOUNT", "card_payment_timeline": {"authorized_at": "2021-06-18T13:30:27.959Z", "captured_at": "2021-06-18T13:30:28.030Z"}}, "location_id": "LH2XR7AMG39HX", "order_id": "hD1xqUBBHQ3ejMBQiSSmncrYg7OZY", "processing_fee": [{"effective_at": "2021-06-18T15:30:28.000Z", "type": "INITIAL", "amount_money": {"amount": 87, "currency": "USD"}}], "note": "20$ money payment", "total_money": {"amount": 2056, "currency": "USD"}, "approved_money": {"amount": 2056, "currency": "USD"}, "employee_id": "TMA-T96eUCnR9DkX", "receipt_number": "rLBl", "receipt_url": "https://squareupsandbox.com/receipt/preview/rLBl9k8kKVV8uXNymUEct6S2ebIZY", "delay_action": "CANCEL", "delayed_until": "2021-06-25T13:30:27.850Z", "team_member_id": "TMA-T96eUCnR9DkX", "application_details": {"square_product": "VIRTUAL_TERMINAL", "application_id": "sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg"}, "version_token": "KcdXvgWNGUYOUmWdF4K0Cmi5bhfxSLMIc12PwLSAG9e6o"}, "emitted_at": 1697217922488}
{"stream": "payments", "data": {"id": "NWO7kC96bJDUNKLovcUnapxGeOWZY", "created_at": "2021-06-18T13:31:43.040Z", "updated_at": "2021-06-22T19:35:23.683Z", "amount_money": {"amount": 11385, "currency": "USD"}, "refunded_money": {"amount": 1985, "currency": "USD"}, "status": "COMPLETED", "delay_duration": "PT168H", "source_type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "VISA", "last_4": "1111", "exp_month": 6, "exp_year": 2026, "fingerprint": "sq-1-mqW9yIk2eKV4LdXhGzf-FYu1knqb1IT7lXybOaFbMwIH2-9d1qdVOGNUMA8TDALoqg", "card_type": "CREDIT", "bin": "411111"}, "entry_method": "KEYED", "cvv_status": "CVV_ACCEPTED", "avs_status": "AVS_ACCEPTED", "statement_description": "SQ *DEFAULT TEST ACCOUNT", "card_payment_timeline": {"authorized_at": "2021-06-18T13:31:43.148Z", "captured_at": "2021-06-18T13:31:43.258Z"}}, "location_id": "LH2XR7AMG39HX", "order_id": "BxCc4Y2KBt10BUWQheazcgRUR7bZY", "refund_ids": ["NWO7kC96bJDUNKLovcUnapxGeOWZY_0um3GHK0AHt273xEe6I3u1y96Lnm018b0WAtyyOYRrP", "NWO7kC96bJDUNKLovcUnapxGeOWZY_BH7uyAXe6SqRc99uEExljMwERWZPci10Og6zIyfynAB"], "processing_fee": [{"effective_at": "2021-06-18T15:31:43.000Z", "type": "INITIAL", "amount_money": {"amount": 413, "currency": "USD"}}], "note": "113,85$ payment", "total_money": {"amount": 11385, "currency": "USD"}, "approved_money": {"amount": 11385, "currency": "USD"}, "employee_id": "TMA-T96eUCnR9DkX", "receipt_number": "NWO7", "receipt_url": "https://squareupsandbox.com/receipt/preview/NWO7kC96bJDUNKLovcUnapxGeOWZY", "delay_action": "CANCEL", "delayed_until": "2021-06-25T13:31:43.040Z", "team_member_id": "TMA-T96eUCnR9DkX", "application_details": {"square_product": "VIRTUAL_TERMINAL", "application_id": "sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg"}, "version_token": "JuGNurRABx1mNvkMlYLtu8LI05JpiYOupyZwZtoQELk6o"}, "emitted_at": 1697217922492}
{"stream": "categories", "data": {"type": "CATEGORY", "id": "WBVNPPUWI2YCVI2XJZNHPSQC", "updated_at": "2022-10-19T19:33:30.646Z", "created_at": "2021-06-10T09:58:41.311Z", "version": 1666208010646, "is_deleted": false, "present_at_all_locations": true, "category_data": {"name": "Drinks", "is_top_level": true}}, "emitted_at": 1697217887093}
{"stream": "categories", "data": {"type": "CATEGORY", "id": "FIMYVNYAQ3JS337TP6YBQBBQ", "updated_at": "2022-10-19T19:33:30.646Z", "created_at": "2021-06-10T21:56:26.794Z", "version": 1666208010646, "is_deleted": false, "present_at_all_locations": true, "category_data": {"name": "Sign", "is_top_level": true}}, "emitted_at": 1697217887096}
{"stream": "categories", "data": {"type": "CATEGORY", "id": "NC7RMZ5L7KR262JLJVJTWBDY", "updated_at": "2022-10-19T19:33:30.646Z", "created_at": "2021-06-10T21:56:26.794Z", "version": 1666208010646, "is_deleted": false, "present_at_all_locations": true, "category_data": {"name": "Quality", "is_top_level": true}}, "emitted_at": 1697217887099}
{"stream": "team_members", "data": {"id": "TMA-T96eUCnR9DkX", "is_owner": true, "status": "ACTIVE", "given_name": "Sandbox", "family_name": "Seller", "email_address": "sandbox-merchant+ryeggsjovidbpszhnwkskzvma10qzjcb@squareup.com", "created_at": "2021-04-30T05:16:05Z", "updated_at": "2023-07-07T17:07:41Z", "assigned_locations": {"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"}}, "emitted_at": 1697217912327}
{"stream": "team_members", "data": {"id": "TMcnrxWIJPlmU4c5", "reference_id": "2", "is_owner": false, "status": "ACTIVE", "given_name": "Team", "family_name": "Member_2", "email_address": "team_member_2@airbyte.com", "phone_number": "+19008080808", "created_at": "2021-06-18T13:17:37Z", "updated_at": "2021-06-18T13:17:37Z", "assigned_locations": {"assignment_type": "EXPLICIT_LOCATIONS"}}, "emitted_at": 1697217912332}
{"stream": "team_members", "data": {"id": "TMx95KdTStPnIxgp", "reference_id": "1", "is_owner": false, "status": "ACTIVE", "given_name": "Team", "family_name": "Member_1", "email_address": "team_member_1@airbyte.com", "phone_number": "+18008080808", "created_at": "2021-06-18T13:15:49Z", "updated_at": "2021-06-18T13:17:06Z", "assigned_locations": {"assignment_type": "EXPLICIT_LOCATIONS"}}, "emitted_at": 1697217912335}
{"stream": "shifts", "data": {"id": "M60G9R7E1H52J", "employee_id": "TMA-T96eUCnR9DkX", "location_id": "L9A5Y0JR014G1", "timezone": "UTC", "start_at": "2021-06-17T08:00:00Z", "end_at": "2021-06-17T20:00:00Z", "wage": {"title": "Owner", "hourly_rate": {"amount": 4050, "currency": "USD"}}, "breaks": [{"id": "ZXR4CMNAEGXW6", "start_at": "2021-06-17T10:00:00Z", "end_at": "2021-06-17T11:00:00Z", "break_type_id": "HDY9769K81MN7", "name": "Lunch Break", "expected_duration": "PT1H", "is_paid": true}, {"id": "2N4RYD910S698", "start_at": "2021-06-17T17:00:00Z", "end_at": "2021-06-17T17:30:00Z", "break_type_id": "NEHDKJ0V03XP2", "name": "Tea Break", "expected_duration": "PT30M", "is_paid": true}], "status": "CLOSED", "version": 1, "created_at": "2021-06-18T20:46:59Z", "updated_at": "2021-06-18T20:46:59Z", "team_member_id": "TMA-T96eUCnR9DkX"}, "emitted_at": 1697217938884}
{"stream": "shifts", "data": {"id": "WET1AZXN164BB", "employee_id": "TMA-T96eUCnR9DkX", "location_id": "L9A5Y0JR014G1", "timezone": "UTC", "start_at": "2019-01-25T08:11:00Z", "end_at": "2019-01-25T18:11:00Z", "wage": {"hourly_rate": {"amount": 1100, "currency": "USD"}}, "breaks": [{"id": "Q00NYDFJ36K9Y", "start_at": "2019-01-25T11:11:00Z", "end_at": "2019-01-25T11:41:00Z", "break_type_id": "NEHDKJ0V03XP2", "name": "Tea Break", "expected_duration": "PT30M", "is_paid": true}], "status": "CLOSED", "version": 1, "created_at": "2021-06-18T20:37:39Z", "updated_at": "2021-06-18T20:37:39Z", "team_member_id": "TMA-T96eUCnR9DkX"}, "emitted_at": 1697217938888}
{"stream": "locations", "data": {"id": "L9A5Y0JR014G1", "name": "Coffe_shop", "address": {"address_line_1": "1600 Pennsylvania Ave NW", "locality": "Washington", "administrative_district_level_1": "DC", "postal_code": "20500", "country": "US"}, "timezone": "UTC", "capabilities": ["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS"], "status": "ACTIVE", "created_at": "2021-06-14T13:40:57.441Z", "merchant_id": "ML7SCCR7EMAK4", "country": "US", "language_code": "en-US", "currency": "USD", "phone_number": "+1 800-444-4444", "business_name": "Second_Test_Location", "type": "PHYSICAL", "website_url": "example.com", "business_hours": {}, "business_email": "some_email@coffee.com", "description": "a brief bio", "twitter_username": "test", "instagram_username": "test", "facebook_url": "facebook.com/example", "mcc": "7299"}, "emitted_at": 1697217911705}
{"stream": "locations", "data": {"id": "LH2XR7AMG39HX", "name": "Default Test Account", "address": {"address_line_1": "1600 Pennsylvania Ave NW", "locality": "Washington", "administrative_district_level_1": "DC", "postal_code": "20500", "country": "US"}, "timezone": "UTC", "capabilities": ["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS"], "status": "ACTIVE", "created_at": "2021-04-30T05:16:05.977Z", "merchant_id": "ML7SCCR7EMAK4", "country": "US", "language_code": "en-US", "currency": "USD", "business_name": "Default Test Account", "type": "PHYSICAL", "business_hours": {}, "mcc": "7299"}, "emitted_at": 1697217911713}
{"stream": "locations", "data": {"id": "LGTMGD6Y4MH5R", "name": "test", "address": {"address_line_1": "1600 Pennsylvania Ave NW", "locality": "Washington", "administrative_district_level_1": "DC", "postal_code": "20500", "country": "US"}, "timezone": "UTC", "capabilities": ["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS"], "status": "ACTIVE", "created_at": "2023-01-04T15:20:43.345Z", "merchant_id": "ML7SCCR7EMAK4", "country": "US", "language_code": "en-US", "currency": "USD", "business_name": "Default Test Account", "type": "PHYSICAL", "business_hours": {}, "business_email": "test@test.com", "mcc": "7299"}, "emitted_at": 1697217911717}
{"stream": "items", "data": {"type": "ITEM", "id": "K7CL577FVTGEGWEHZUU3NA6P", "updated_at": "2023-02-28T17:03:10.233Z", "created_at": "2021-06-10T09:58:41.311Z", "version": 1677603790233, "is_deleted": false, "custom_attribute_values": {"Square:eca67bfb-68a4-4218-950a-09eec906143d": {"name": "With coffee cup", "string_value": "Yes", "custom_attribute_definition_id": "VR43EHV5M3Z4P4CWA7K3ZXPA", "type": "STRING", "key": "Square:eca67bfb-68a4-4218-950a-09eec906143d"}}, "present_at_all_locations": true, "item_data": {"name": "Coffee", "description": "Some coffee drink", "is_taxable": true, "visibility": "PRIVATE", "category_id": "WBVNPPUWI2YCVI2XJZNHPSQC", "modifier_list_info": [{"modifier_list_id": "ZYESF2MGAMVORYB66VVXFW6V", "visibility": "PUBLIC", "min_selected_modifiers": -1, "max_selected_modifiers": -1, "enabled": true}], "variations": [{"type": "ITEM_VARIATION", "id": "DT52FVGPUEJ7KL5WYPIK5TTP", "updated_at": "2021-06-10T09:58:41.311Z", "created_at": "2021-06-10T09:58:41.311Z", "version": 1623319121311, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "K7CL577FVTGEGWEHZUU3NA6P", "name": "Black", "sku": "1", "ordinal": 0, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 900, "currency": "USD"}, "location_overrides": [{"location_id": "LH2XR7AMG39HX", "track_inventory": true}], "item_option_values": [{"item_option_id": "QTE3WP7JI64XLUD7AX5ER2ZI", "item_option_value_id": "KRNNA4P57TDNVBJLWIBW5D47"}], "sellable": true, "stockable": true}}, {"type": "ITEM_VARIATION", "id": "SZTS6NG7OGC25KGTRXJEUAKK", "updated_at": "2021-06-10T09:58:41.311Z", "created_at": "2021-06-10T09:58:41.311Z", "version": 1623319121311, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "K7CL577FVTGEGWEHZUU3NA6P", "name": "White", "sku": "2", "ordinal": 1, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 1000, "currency": "USD"}, "location_overrides": [{"location_id": "LH2XR7AMG39HX", "track_inventory": true}], "item_option_values": [{"item_option_id": "QTE3WP7JI64XLUD7AX5ER2ZI", "item_option_value_id": "LIB3NSHGZUXFM3NFDHTUM4CJ"}], "sellable": true, "stockable": true}}], "product_type": "REGULAR", "skip_modifier_screen": false, "item_options": [{"item_option_id": "QTE3WP7JI64XLUD7AX5ER2ZI"}], "ecom_visibility": "UNINDEXED"}}, "emitted_at": 1697217792587}
{"stream": "items", "data": {"type": "ITEM", "id": "SY3I7GJTCYIJTOD6PKLO6VKI", "updated_at": "2023-02-28T17:03:10.233Z", "created_at": "2021-06-10T21:07:19.929Z", "version": 1677603790233, "is_deleted": false, "present_at_all_locations": true, "item_data": {"name": "Tea", "description": "Just the tea example", "is_taxable": true, "visibility": "PRIVATE", "category_id": "WBVNPPUWI2YCVI2XJZNHPSQC", "variations": [{"type": "ITEM_VARIATION", "id": "PGOQKJWR6ALTCFPVGV54LHA6", "updated_at": "2021-06-10T21:07:19.929Z", "created_at": "2021-06-10T21:07:19.929Z", "version": 1623359239929, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "SY3I7GJTCYIJTOD6PKLO6VKI", "name": "Regular", "sku": "3", "ordinal": 1, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 500, "currency": "USD"}, "location_overrides": [{"location_id": "LH2XR7AMG39HX", "track_inventory": true}], "sellable": true, "stockable": true}}], "product_type": "REGULAR", "skip_modifier_screen": false, "ecom_visibility": "UNINDEXED"}}, "emitted_at": 1697217792588}
{"stream": "items", "data": {"type": "ITEM", "id": "UCYFEEPFPQFTWAGMH6T56L4U", "updated_at": "2023-02-28T17:03:10.233Z", "created_at": "2021-06-10T21:16:07.366Z", "version": 1677603790233, "is_deleted": false, "present_at_all_locations": true, "image_id": "7JPVLNMPVEBNXPQT5JXYCNF2", "item_data": {"name": "Beer", "description": "Unfiltered", "is_taxable": true, "visibility": "PRIVATE", "category_id": "WBVNPPUWI2YCVI2XJZNHPSQC", "variations": [{"type": "ITEM_VARIATION", "id": "AVZZR4PLYHND3GQU5KD25GYD", "updated_at": "2021-06-10T21:16:07.366Z", "created_at": "2021-06-10T21:16:07.366Z", "version": 1623359767366, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "UCYFEEPFPQFTWAGMH6T56L4U", "name": "Light", "sku": "4", "ordinal": 1, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 1100, "currency": "USD"}, "location_overrides": [{"location_id": "LH2XR7AMG39HX", "track_inventory": true}], "sellable": true, "stockable": true}}, {"type": "ITEM_VARIATION", "id": "QR3GL6QNSGG7TPGX3W6F72BK", "updated_at": "2021-06-10T21:46:15.762Z", "created_at": "2021-06-10T21:46:15.762Z", "version": 1623361575762, "is_deleted": false, "present_at_all_locations": false, "present_at_location_ids": ["LH2XR7AMG39HX"], "item_variation_data": {"item_id": "UCYFEEPFPQFTWAGMH6T56L4U", "name": "Unfiltered", "sku": "6", "ordinal": 1, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 1300, "currency": "USD"}, "location_overrides": [{"location_id": "LH2XR7AMG39HX", "track_inventory": true}], "sellable": true, "stockable": true}}, {"type": "ITEM_VARIATION", "id": "DJQ5F7NPJZCO7CMCPAU4GMTN", "updated_at": "2021-06-10T21:16:07.366Z", "created_at": "2021-06-10T21:16:07.366Z", "version": 1623359767366, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "UCYFEEPFPQFTWAGMH6T56L4U", "name": "Dark", "sku": "5", "ordinal": 2, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 1200, "currency": "USD"}, "location_overrides": [{"location_id": "LH2XR7AMG39HX", "track_inventory": true}], "sellable": true, "stockable": true}}], "product_type": "REGULAR", "skip_modifier_screen": false, "ecom_visibility": "UNINDEXED"}}, "emitted_at": 1697217792590}
{"stream": "discounts", "data": {"type": "DISCOUNT", "id": "Q7AQZ6WPGAWPFAIYBTYT7XXP", "updated_at": "2021-06-14T13:47:48.539Z", "created_at": "2021-06-10T22:15:06.693Z", "version": 1623678468539, "is_deleted": false, "present_at_all_locations": false, "present_at_location_ids": ["L9A5Y0JR014G1"], "discount_data": {"name": "discount_20_p", "discount_type": "FIXED_PERCENTAGE", "percentage": "20.0", "application_method": "MANUALLY_APPLIED", "modify_tax_basis": "MODIFY_TAX_BASIS"}}, "emitted_at": 1697217897637}
{"stream": "discounts", "data": {"type": "DISCOUNT", "id": "HKYNSSNT2XWGYGPQNPVWFEAG", "updated_at": "2021-06-14T13:48:20.638Z", "created_at": "2021-06-10T22:15:45.239Z", "version": 1623678500638, "is_deleted": false, "present_at_all_locations": false, "present_at_location_ids": ["LH2XR7AMG39HX"], "discount_data": {"name": "discount_5_p", "discount_type": "FIXED_PERCENTAGE", "percentage": "5.0", "application_method": "MANUALLY_APPLIED", "modify_tax_basis": "MODIFY_TAX_BASIS"}}, "emitted_at": 1697217897646}
{"stream": "discounts", "data": {"type": "DISCOUNT", "id": "TN6YCTI5DDYJTDQUW3VQ733L", "updated_at": "2021-06-10T22:16:29.308Z", "created_at": "2021-06-10T22:16:29.308Z", "version": 1623363389308, "is_deleted": false, "present_at_all_locations": true, "discount_data": {"name": "discount_1_usd", "discount_type": "FIXED_AMOUNT", "amount_money": {"amount": 100, "currency": "USD"}, "application_method": "MANUALLY_APPLIED", "modify_tax_basis": "MODIFY_TAX_BASIS"}}, "emitted_at": 1697217897651}
{"stream": "modifier_list", "data": {"type": "MODIFIER_LIST", "id": "ZYESF2MGAMVORYB66VVXFW6V", "updated_at": "2021-06-10T22:17:15.317Z", "created_at": "2021-06-10T22:17:15.317Z", "version": 1623363435317, "is_deleted": false, "present_at_all_locations": true, "modifier_list_data": {"name": "With_accessory", "selection_type": "MULTIPLE", "modifiers": [{"type": "MODIFIER", "id": "EW5DQKRKJH5LF2O5OM3TLT32", "updated_at": "2021-06-10T22:17:15.317Z", "created_at": "2021-06-10T22:17:15.317Z", "version": 1623363435317, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "1_accessory", "price_money": {"amount": 100, "currency": "USD"}, "on_by_default": false, "ordinal": 1, "modifier_list_id": "ZYESF2MGAMVORYB66VVXFW6V"}}, {"type": "MODIFIER", "id": "APBZ4WD5P3FPUYSLG4U7MEJF", "updated_at": "2021-06-10T22:17:15.317Z", "created_at": "2021-06-10T22:17:15.317Z", "version": 1623363435317, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "2_accessory", "price_money": {"amount": 200, "currency": "USD"}, "on_by_default": false, "ordinal": 2, "modifier_list_id": "ZYESF2MGAMVORYB66VVXFW6V"}}]}}, "emitted_at": 1697217931779}
{"stream": "modifier_list", "data": {"type": "MODIFIER_LIST", "id": "MKW7LLF4IRUX773KBHH4XQZA", "updated_at": "2021-06-14T13:10:54.797Z", "created_at": "2021-06-14T13:10:54.797Z", "version": 1623676254797, "is_deleted": false, "present_at_all_locations": true, "modifier_list_data": {"name": "With_something_else", "selection_type": "MULTIPLE", "modifiers": [{"type": "MODIFIER", "id": "IA66H4C4C6JNXMHXQI3LDWFP", "updated_at": "2021-06-14T13:10:54.797Z", "created_at": "2021-06-14T13:10:54.797Z", "version": 1623676254797, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "something_else", "price_money": {"amount": 1000, "currency": "USD"}, "on_by_default": false, "ordinal": 1, "modifier_list_id": "MKW7LLF4IRUX773KBHH4XQZA"}}, {"type": "MODIFIER", "id": "CS5VQADEB4GZXEL3TWHQDRER", "updated_at": "2021-06-14T13:10:54.797Z", "created_at": "2021-06-14T13:10:54.797Z", "version": 1623676254797, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "something_else_2", "price_money": {"amount": 1500, "currency": "USD"}, "on_by_default": false, "ordinal": 2, "modifier_list_id": "MKW7LLF4IRUX773KBHH4XQZA"}}]}}, "emitted_at": 1697217931785}
{"stream": "inventory", "data": {"catalog_object_id": "ARZ6U6FLKCLA6EOIKBYK3DZ7", "catalog_object_type": "ITEM_VARIATION", "state": "IN_STOCK", "location_id": "LH2XR7AMG39HX", "quantity": "124", "calculated_at": "2023-01-06T21:08:23.095Z"}, "emitted_at": 1697217897015}
{"stream": "inventory", "data": {"catalog_object_id": "ARZ6U6FLKCLA6EOIKBYK3DZ7", "catalog_object_type": "ITEM_VARIATION", "state": "IN_STOCK", "location_id": "L9A5Y0JR014G1", "quantity": "124", "calculated_at": "2023-01-06T21:06:55.36Z"}, "emitted_at": 1697217897017}
{"stream": "inventory", "data": {"catalog_object_id": "YUDRKASZGJ3AFJGOQUMPP3EJ", "catalog_object_type": "ITEM_VARIATION", "state": "IN_STOCK", "location_id": "LH2XR7AMG39HX", "quantity": "500", "calculated_at": "2023-01-06T20:00:26.338Z"}, "emitted_at": 1697217897019}
{"stream": "orders", "data": {"id": "jqYrf6arFpUo7zElfWu9GRF5lAWZY", "location_id": "LH2XR7AMG39HX", "line_items": [{"uid": "JYEv3BLPY5FmSaVXDdbESD", "quantity": "1", "base_price_money": {"amount": 100, "currency": "USD"}, "gross_sales_money": {"amount": 100, "currency": "USD"}, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 100, "currency": "USD"}, "variation_total_price_money": {"amount": 100, "currency": "USD"}, "item_type": "CUSTOM_AMOUNT"}], "created_at": "2021-06-08T20:21:39.163Z", "updated_at": "2021-06-08T20:21:41.000Z", "state": "COMPLETED", "version": 4, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_tip_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 100, "currency": "USD"}, "closed_at": "2021-06-08T20:21:39.406Z", "tenders": [{"id": "9m4YvEyzLRUvwUeBf2DNtVOh6cIZY", "location_id": "LH2XR7AMG39HX", "transaction_id": "jqYrf6arFpUo7zElfWu9GRF5lAWZY", "created_at": "2021-06-08T20:21:39Z", "amount_money": {"amount": 100, "currency": "USD"}, "type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "MASTERCARD", "last_4": "9029", "fingerprint": "sq-1-MTQOLCjEOIzHvJvKX4yxf6qBvj6DAFuB8wlWoKW4NI1BAFV5cdlJmge8ehPFGUSeuw"}, "entry_method": "KEYED"}, "payment_id": "9m4YvEyzLRUvwUeBf2DNtVOh6cIZY"}], "total_service_charge_money": {"amount": 0, "currency": "USD"}, "net_amounts": {"total_money": {"amount": 100, "currency": "USD"}, "tax_money": {"amount": 0, "currency": "USD"}, "discount_money": {"amount": 0, "currency": "USD"}, "tip_money": {"amount": 0, "currency": "USD"}, "service_charge_money": {"amount": 0, "currency": "USD"}}, "source": {"name": "Sandbox for sq0idp-7KVC6qHcSDMXsm40SAA9TA"}}, "emitted_at": 1697217939855}
{"stream": "orders", "data": {"id": "hD1xqUBBHQ3ejMBQiSSmncrYg7OZY", "location_id": "LH2XR7AMG39HX", "line_items": [{"uid": "v6KbyuUoPvjZ6hHLVLpvi", "quantity": "1", "base_price_money": {"amount": 2056, "currency": "USD"}, "note": "20$ money payment", "gross_sales_money": {"amount": 2056, "currency": "USD"}, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 2056, "currency": "USD"}, "variation_total_price_money": {"amount": 2056, "currency": "USD"}, "item_type": "CUSTOM_AMOUNT"}], "created_at": "2021-06-18T13:30:27.796Z", "updated_at": "2021-06-18T13:30:30.000Z", "state": "COMPLETED", "version": 4, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_tip_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 2056, "currency": "USD"}, "closed_at": "2021-06-18T13:30:28.042Z", "tenders": [{"id": "rLBl9k8kKVV8uXNymUEct6S2ebIZY", "location_id": "LH2XR7AMG39HX", "transaction_id": "hD1xqUBBHQ3ejMBQiSSmncrYg7OZY", "created_at": "2021-06-18T13:30:27Z", "note": "20$ money payment", "amount_money": {"amount": 2056, "currency": "USD"}, "type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "VISA", "last_4": "1111", "fingerprint": "sq-1-mqW9yIk2eKV4LdXhGzf-FYu1knqb1IT7lXybOaFbMwIH2-9d1qdVOGNUMA8TDALoqg"}, "entry_method": "KEYED"}, "payment_id": "rLBl9k8kKVV8uXNymUEct6S2ebIZY"}], "total_service_charge_money": {"amount": 0, "currency": "USD"}, "net_amounts": {"total_money": {"amount": 2056, "currency": "USD"}, "tax_money": {"amount": 0, "currency": "USD"}, "discount_money": {"amount": 0, "currency": "USD"}, "tip_money": {"amount": 0, "currency": "USD"}, "service_charge_money": {"amount": 0, "currency": "USD"}}, "source": {"name": "Sandbox for sq0idp-4Uw2-7Sy15Umdnct7FTeuQ"}}, "emitted_at": 1697217939866}
{"stream": "orders", "data": {"id": "NpZRjYMGKOKeTe0BTp7N5r8kM0LZY", "location_id": "LH2XR7AMG39HX", "created_at": "2021-06-18T13:37:33.422Z", "updated_at": "2021-06-18T13:37:37.000Z", "state": "COMPLETED", "version": 4, "closed_at": "2021-06-18T13:37:34.544Z", "returns": [{"uid": "utVo8VtdQxlKZdVh1n6jaD", "source_order_id": "BxCc4Y2KBt10BUWQheazcgRUR7bZY", "return_line_items": [{"uid": "Ck0UkAjcVHe6guD1HNWub", "quantity": "1", "item_type": "CUSTOM_AMOUNT", "base_price_money": {"amount": 1485, "currency": "USD"}, "variation_total_price_money": {"amount": 1485, "currency": "USD"}, "gross_return_money": {"amount": 1485, "currency": "USD"}, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 1485, "currency": "USD"}}]}], "return_amounts": {"total_money": {"amount": 1485, "currency": "USD"}, "tax_money": {"amount": 0, "currency": "USD"}, "discount_money": {"amount": 0, "currency": "USD"}, "tip_money": {"amount": 0, "currency": "USD"}, "service_charge_money": {"amount": 0, "currency": "USD"}}, "refunds": [{"id": "0um3GHK0AHt273xEe6I3u1y96Lnm018b0WAtyyOYRrP", "location_id": "LH2XR7AMG39HX", "transaction_id": "BxCc4Y2KBt10BUWQheazcgRUR7bZY", "tender_id": "NWO7kC96bJDUNKLovcUnapxGeOWZY", "created_at": "2021-06-18T13:37:33Z", "reason": "Broken item", "amount_money": {"amount": 1485, "currency": "USD"}, "status": "APPROVED"}], "source": {}}, "emitted_at": 1697217939875}
{"stream": "loyalty", "data": {"id": "ce21ddea-e73c-4d32-aa51-b50312ac7422", "program_id": "b7517cdb-8ab4-4d22-8b44-38bb2405087d", "balance": 0, "lifetime_points": 0, "customer_id": "WYP9CC9M156J71DMQF41Q8VMWW", "enrolled_at": "2023-10-16T17:31:24Z", "created_at": "2023-10-16T17:33:20Z", "updated_at": "2023-10-16T17:33:20Z", "mapping": {"id": "9909bd55-6e5a-4b43-b47d-8ac845ab3795", "created_at": "2023-10-16T17:33:20Z", "phone_number": "+15035551234"}}, "emitted_at": 1697478038492}
{"stream": "categories", "data": {"type": "CATEGORY", "id": "2GBTQT76RJMAS6E4SSZLRWBJ", "updated_at": "2022-10-19T19:33:30.646Z", "created_at": "2021-06-11T10:40:37.932Z", "version": 1666208010646, "is_deleted": false, "present_at_all_locations": true, "category_data": {"name": "Voice", "is_top_level": true}}, "emitted_at": 1714754095969}
{"stream": "categories", "data": {"type": "CATEGORY", "id": "OH7JPHFUZ6TCWUG76XIY5SQX", "updated_at": "2022-10-19T19:33:30.646Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1666208010646, "is_deleted": false, "present_at_all_locations": true, "category_data": {"name": "Breakfast", "is_top_level": true}}, "emitted_at": 1714754095973}
{"stream": "categories", "data": {"type": "CATEGORY", "id": "CKTPCS3HCLZRGTPZ7SSYHSRL", "updated_at": "2022-10-19T19:33:30.646Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1666208010646, "is_deleted": false, "present_at_all_locations": true, "category_data": {"name": "Entree", "is_top_level": true}}, "emitted_at": 1714754095976}
{"stream": "customers", "data": {"id": "4GK6V7P4QRETGVDN1N2T08Q0PW", "created_at": "2023-11-20T16:53:44.72Z", "updated_at": "2023-11-20T16:53:44Z", "email_address": "customer-2@test.io", "company_name": "Another Company 2", "preferences": {"email_unsubscribed": false}, "creation_source": "THIRD_PARTY", "segment_ids": ["ML7SCCR7EMAK4.REACHABLE", "ML7SCCR7EMAK4.REACHABLE"], "version": 0}, "emitted_at": 1714754196841}
{"stream": "customers", "data": {"id": "YX3W3VMDM5RC1X8M74FW3WTZP8", "created_at": "2023-11-20T16:53:50.334Z", "updated_at": "2023-11-20T16:53:50Z", "email_address": "customer-3@test.io", "company_name": "Another Company 3", "preferences": {"email_unsubscribed": false}, "creation_source": "THIRD_PARTY", "segment_ids": ["ML7SCCR7EMAK4.REACHABLE", "ML7SCCR7EMAK4.REACHABLE"], "version": 0}, "emitted_at": 1714754196842}
{"stream": "customers", "data": {"id": "YKP4QCD0P84XBF9MBC2PWHPFA4", "created_at": "2023-11-20T16:54:05.525Z", "updated_at": "2023-11-20T16:54:05Z", "nickname": "Test Customer", "email_address": "customer-4@test.io", "company_name": "Another Company 4", "preferences": {"email_unsubscribed": false}, "creation_source": "THIRD_PARTY", "segment_ids": ["ML7SCCR7EMAK4.REACHABLE", "ML7SCCR7EMAK4.REACHABLE"], "version": 0}, "emitted_at": 1714754196844}
{"stream": "discounts", "data": {"type": "DISCOUNT", "id": "7NB64IW3PDL66PF6CB3WRGVZ", "updated_at": "2021-06-14T13:47:56.799Z", "created_at": "2021-06-14T13:06:38.495Z", "version": 1623678476799, "is_deleted": false, "present_at_all_locations": false, "present_at_location_ids": ["L9A5Y0JR014G1"], "discount_data": {"name": "Quantity_discount_2", "discount_type": "FIXED_AMOUNT", "amount_money": {"amount": 200, "currency": "USD"}, "pin_required": true, "application_method": "MANUALLY_APPLIED", "modify_tax_basis": "DO_NOT_MODIFY_TAX_BASIS"}}, "emitted_at": 1714754108376}
{"stream": "discounts", "data": {"type": "DISCOUNT", "id": "QKPMMV3O6WTTWH54GLF7KRKQ", "updated_at": "2021-06-14T13:48:09.959Z", "created_at": "2021-06-14T13:07:44.261Z", "version": 1623678489959, "is_deleted": false, "present_at_all_locations": false, "present_at_location_ids": ["LH2XR7AMG39HX"], "discount_data": {"name": "Quantity_discount_3", "discount_type": "FIXED_AMOUNT", "amount_money": {"amount": 300, "currency": "USD"}, "application_method": "MANUALLY_APPLIED", "modify_tax_basis": "MODIFY_TAX_BASIS"}}, "emitted_at": 1714754108379}
{"stream": "discounts", "data": {"type": "DISCOUNT", "id": "KSYNCLRDNMN63PQ7XGJXI72P", "updated_at": "2023-10-16T15:54:42.609Z", "created_at": "2023-10-16T15:54:42.609Z", "version": 1697471682609, "is_deleted": false, "present_at_all_locations": true, "discount_data": {"name": "A free Art investment", "discount_type": "FIXED_PERCENTAGE", "percentage": "100.0", "application_method": "MANUALLY_APPLIED"}}, "emitted_at": 1714754122816}
{"stream": "inventory", "data": {"catalog_object_id": "DTZLAR2RKUINQ5WU2SZYI56M", "catalog_object_type": "ITEM_VARIATION", "state": "IN_STOCK", "location_id": "LH2XR7AMG39HX", "quantity": "100", "calculated_at": "2021-06-10T22:26:04.803Z"}, "emitted_at": 1714754107398}
{"stream": "inventory", "data": {"catalog_object_id": "DVGNVNZ7YFL3O3SDC7ONJG5A", "catalog_object_type": "ITEM_VARIATION", "state": "IN_STOCK", "location_id": "LH2XR7AMG39HX", "quantity": "100", "calculated_at": "2021-06-10T21:56:31.442Z"}, "emitted_at": 1714754107400}
{"stream": "inventory", "data": {"catalog_object_id": "DVH34OKXPRV2DHTOHSGQDDQM", "catalog_object_type": "ITEM_VARIATION", "state": "IN_STOCK", "location_id": "LH2XR7AMG39HX", "quantity": "100", "calculated_at": "2021-06-10T22:26:26.553Z"}, "emitted_at": 1714754107402}
{"stream": "items", "data": {"type": "ITEM", "id": "J2N73GA3WSIYVES52K3LT5CQ", "updated_at": "2023-02-28T17:03:10.233Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1677603790233, "is_deleted": false, "present_at_all_locations": true, "item_data": {"name": "Salmon with Zucchini", "description": "Fresh caught Alaskan king salmon served on a bed of braised spinach and diced zucchini.", "abbreviation": "SZ", "is_taxable": true, "category_id": "CKTPCS3HCLZRGTPZ7SSYHSRL", "tax_ids": ["ZSUDRGZMZ4OT6NP4DRWT2E3S"], "variations": [{"type": "ITEM_VARIATION", "id": "JGM5T77FNI3NKWMYHUBCANVG", "updated_at": "2021-06-18T20:06:02.883Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1624046762883, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "J2N73GA3WSIYVES52K3LT5CQ", "name": "Regular", "ordinal": 0, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 1495, "currency": "USD"}, "sellable": true, "stockable": true}}], "product_type": "REGULAR", "image_ids": ["W5RWCX4NE2BZO63PCXHIFF5X"], "description_html": "<p>Fresh caught Alaskan king salmon served on a bed of braised spinach and diced zucchini.</p>", "description_plaintext": "Fresh caught Alaskan king salmon served on a bed of braised spinach and diced zucchini."}}, "emitted_at": 1714754071872}
{"stream": "items", "data": {"type": "ITEM", "id": "SYITYUC2QWSVI7U6HK3V6HRP", "updated_at": "2023-02-28T17:03:10.233Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1677603790233, "is_deleted": false, "present_at_all_locations": true, "item_data": {"name": "Steak Tacos", "description": "Two tacos with flank steak marinated for a minimum of 24 hours in our award-winning marinade. Topped with a mix of fresh cilantro and cooling cucumber.", "abbreviation": "ST", "is_taxable": true, "category_id": "CKTPCS3HCLZRGTPZ7SSYHSRL", "tax_ids": ["ZSUDRGZMZ4OT6NP4DRWT2E3S"], "variations": [{"type": "ITEM_VARIATION", "id": "5Z2AJ4LC6TYQEQFERTPO2V6C", "updated_at": "2021-06-18T20:06:02.883Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1624046762883, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "SYITYUC2QWSVI7U6HK3V6HRP", "name": "Regular", "ordinal": 0, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 695, "currency": "USD"}, "sellable": true, "stockable": true}}], "product_type": "REGULAR", "image_ids": ["IZLJZG5NHEPRE6Y6WWTG2STG"], "description_html": "<p>Two tacos with flank steak marinated for a minimum of 24 hours in our award-winning marinade. Topped with a mix of fresh cilantro and cooling cucumber.</p>", "description_plaintext": "Two tacos with flank steak marinated for a minimum of 24 hours in our award-winning marinade. Topped with a mix of fresh cilantro and cooling cucumber."}}, "emitted_at": 1714754071880}
{"stream": "items", "data": {"type": "ITEM", "id": "VPNWPUHJRVERDXPQVMFUDDVW", "updated_at": "2023-02-28T17:03:10.233Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1677603790233, "is_deleted": false, "present_at_all_locations": true, "item_data": {"name": "Autumn Soup", "description": "The smoothest butternut squash soup you've ever had served with locally made goat cheese and toasted nuts.", "abbreviation": "AS", "is_taxable": true, "tax_ids": ["ZSUDRGZMZ4OT6NP4DRWT2E3S"], "variations": [{"type": "ITEM_VARIATION", "id": "7NIQ7N6HLKHBDGXWOHEGNO7D", "updated_at": "2021-06-18T20:06:02.883Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1624046762883, "is_deleted": false, "present_at_all_locations": true, "item_variation_data": {"item_id": "VPNWPUHJRVERDXPQVMFUDDVW", "name": "Regular", "ordinal": 0, "pricing_type": "FIXED_PRICING", "price_money": {"amount": 695, "currency": "USD"}, "sellable": true, "stockable": true}}], "product_type": "REGULAR", "image_ids": ["CAPX5T4RZKEZLZ6IJVDZTMNT"], "description_html": "<p>The smoothest butternut squash soup you&#39;ve ever had served with locally made goat cheese and toasted nuts.</p>", "description_plaintext": "The smoothest butternut squash soup you've ever had served with locally made goat cheese and toasted nuts."}}, "emitted_at": 1714754071885}
{"stream": "locations", "data": {"id": "L9A5Y0JR014G1", "name": "Coffe_shop", "address": {"address_line_1": "1600 Pennsylvania Ave NW", "locality": "Washington", "administrative_district_level_1": "DC", "postal_code": "20500", "country": "US"}, "timezone": "UTC", "capabilities": ["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS"], "status": "ACTIVE", "created_at": "2021-06-14T13:40:57.441Z", "merchant_id": "ML7SCCR7EMAK4", "country": "US", "language_code": "en-US", "currency": "USD", "phone_number": "+1 800-444-4444", "business_name": "Second_Test_Location", "type": "PHYSICAL", "website_url": "example.com", "business_hours": {}, "business_email": "some_email@coffee.com", "description": "a brief bio", "twitter_username": "test", "instagram_username": "test", "facebook_url": "facebook.com/example", "mcc": "7299"}, "emitted_at": 1714754146241}
{"stream": "locations", "data": {"id": "LH2XR7AMG39HX", "name": "Default Test Account", "address": {"address_line_1": "1600 Pennsylvania Ave NW", "locality": "Washington", "administrative_district_level_1": "DC", "postal_code": "20500", "country": "US"}, "timezone": "UTC", "capabilities": ["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS"], "status": "ACTIVE", "created_at": "2021-04-30T05:16:05.977Z", "merchant_id": "ML7SCCR7EMAK4", "country": "US", "language_code": "en-US", "currency": "USD", "business_name": "Default Test Account", "type": "PHYSICAL", "business_hours": {}, "mcc": "7299"}, "emitted_at": 1714754146243}
{"stream": "locations", "data": {"id": "LGTMGD6Y4MH5R", "name": "test", "address": {"address_line_1": "1600 Pennsylvania Ave NW", "locality": "Washington", "administrative_district_level_1": "DC", "postal_code": "20500", "country": "US"}, "timezone": "UTC", "capabilities": ["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS"], "status": "ACTIVE", "created_at": "2023-01-04T15:20:43.345Z", "merchant_id": "ML7SCCR7EMAK4", "country": "US", "language_code": "en-US", "currency": "USD", "business_name": "Default Test Account", "type": "PHYSICAL", "business_hours": {}, "business_email": "test@test.com", "mcc": "7299"}, "emitted_at": 1714754146246}
{"stream": "loyalty", "data": {"id": "ce21ddea-e73c-4d32-aa51-b50312ac7422", "program_id": "b7517cdb-8ab4-4d22-8b44-38bb2405087d", "balance": 0, "lifetime_points": 0, "customer_id": "WYP9CC9M156J71DMQF41Q8VMWW", "enrolled_at": "2023-10-16T17:31:24Z", "created_at": "2023-10-16T17:33:20Z", "updated_at": "2023-10-16T17:33:20Z", "mapping": {"id": "9909bd55-6e5a-4b43-b47d-8ac845ab3795", "created_at": "2023-10-16T17:33:20Z", "phone_number": "+15035551234"}}, "emitted_at": 1714753876338}
{"stream": "modifier_list", "data": {"type": "MODIFIER_LIST", "id": "ZYESF2MGAMVORYB66VVXFW6V", "updated_at": "2021-06-10T22:17:15.317Z", "created_at": "2021-06-10T22:17:15.317Z", "version": 1623363435317, "is_deleted": false, "present_at_all_locations": true, "modifier_list_data": {"name": "With_accessory", "selection_type": "MULTIPLE", "modifiers": [{"type": "MODIFIER", "id": "EW5DQKRKJH5LF2O5OM3TLT32", "updated_at": "2021-06-10T22:17:15.317Z", "created_at": "2021-06-10T22:17:15.317Z", "version": 1623363435317, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "1_accessory", "price_money": {"amount": 100, "currency": "USD"}, "on_by_default": false, "ordinal": 1, "modifier_list_id": "ZYESF2MGAMVORYB66VVXFW6V"}}, {"type": "MODIFIER", "id": "APBZ4WD5P3FPUYSLG4U7MEJF", "updated_at": "2021-06-10T22:17:15.317Z", "created_at": "2021-06-10T22:17:15.317Z", "version": 1623363435317, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "2_accessory", "price_money": {"amount": 200, "currency": "USD"}, "on_by_default": false, "ordinal": 2, "modifier_list_id": "ZYESF2MGAMVORYB66VVXFW6V"}}]}}, "emitted_at": 1714754197694}
{"stream": "modifier_list", "data": {"type": "MODIFIER_LIST", "id": "MKW7LLF4IRUX773KBHH4XQZA", "updated_at": "2021-06-14T13:10:54.797Z", "created_at": "2021-06-14T13:10:54.797Z", "version": 1623676254797, "is_deleted": false, "present_at_all_locations": true, "modifier_list_data": {"name": "With_something_else", "selection_type": "MULTIPLE", "modifiers": [{"type": "MODIFIER", "id": "IA66H4C4C6JNXMHXQI3LDWFP", "updated_at": "2021-06-14T13:10:54.797Z", "created_at": "2021-06-14T13:10:54.797Z", "version": 1623676254797, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "something_else", "price_money": {"amount": 1000, "currency": "USD"}, "on_by_default": false, "ordinal": 1, "modifier_list_id": "MKW7LLF4IRUX773KBHH4XQZA"}}, {"type": "MODIFIER", "id": "CS5VQADEB4GZXEL3TWHQDRER", "updated_at": "2021-06-14T13:10:54.797Z", "created_at": "2021-06-14T13:10:54.797Z", "version": 1623676254797, "is_deleted": false, "present_at_all_locations": true, "modifier_data": {"name": "something_else_2", "price_money": {"amount": 1500, "currency": "USD"}, "on_by_default": false, "ordinal": 2, "modifier_list_id": "MKW7LLF4IRUX773KBHH4XQZA"}}]}}, "emitted_at": 1714754197698}
{"stream": "orders", "data": {"id": "BxCc4Y2KBt10BUWQheazcgRUR7bZY", "location_id": "LH2XR7AMG39HX", "line_items": [{"uid": "4ffd68dd-ba56-4c4f-c5f6-a9cff014183e", "catalog_object_id": "TLL2QDA3U5P7AAA2A4SGK52S", "catalog_version": 1623781508092, "quantity": "1", "name": "Able bit", "variation_name": "Analysis", "base_price_money": {"amount": 9900, "currency": "USD"}, "gross_sales_money": {"amount": 9900, "currency": "USD"}, "total_tax_money": {"amount": 1485, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 11385, "currency": "USD"}, "variation_total_price_money": {"amount": 9900, "currency": "USD"}, "applied_taxes": [{"uid": "ce8eee9c-a03c-da96-b84b-c7dc5ddc6c0f", "tax_uid": "894b8da4-44f0-2f8d-b376-de0e2b0f7220", "applied_money": {"amount": 1485, "currency": "USD"}}], "item_type": "ITEM"}], "taxes": [{"uid": "894b8da4-44f0-2f8d-b376-de0e2b0f7220", "catalog_object_id": "5X7QCTRTQ7MEUFFWF2ESR3IA", "catalog_version": 1623781508092, "name": "15_p", "percentage": "15.0", "type": "ADDITIVE", "applied_money": {"amount": 1485, "currency": "USD"}, "scope": "LINE_ITEM"}], "created_at": "2021-06-18T13:31:42.611Z", "updated_at": "2021-06-22T19:35:25.230Z", "state": "COMPLETED", "version": 13, "total_tax_money": {"amount": 1485, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_tip_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 11385, "currency": "USD"}, "closed_at": "2021-06-18T13:31:43.267Z", "tenders": [{"id": "NWO7kC96bJDUNKLovcUnapxGeOWZY", "location_id": "LH2XR7AMG39HX", "transaction_id": "BxCc4Y2KBt10BUWQheazcgRUR7bZY", "created_at": "2021-06-18T13:31:43Z", "note": "113,85$ payment", "amount_money": {"amount": 11385, "currency": "USD"}, "type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "VISA", "last_4": "1111", "fingerprint": "sq-1-mqW9yIk2eKV4LdXhGzf-FYu1knqb1IT7lXybOaFbMwIH2-9d1qdVOGNUMA8TDALoqg"}, "entry_method": "KEYED"}, "payment_id": "NWO7kC96bJDUNKLovcUnapxGeOWZY"}], "total_service_charge_money": {"amount": 0, "currency": "USD"}, "net_amounts": {"total_money": {"amount": 11385, "currency": "USD"}, "tax_money": {"amount": 1485, "currency": "USD"}, "discount_money": {"amount": 0, "currency": "USD"}, "tip_money": {"amount": 0, "currency": "USD"}, "service_charge_money": {"amount": 0, "currency": "USD"}}, "source": {"name": "Sandbox for sq0idp-4Uw2-7Sy15Umdnct7FTeuQ"}}, "emitted_at": 1714754269361}
{"stream": "orders", "data": {"id": "hD1xqUBBHQ3ejMBQiSSmncrYg7OZY", "location_id": "LH2XR7AMG39HX", "line_items": [{"uid": "v6KbyuUoPvjZ6hHLVLpvi", "quantity": "1", "base_price_money": {"amount": 2056, "currency": "USD"}, "note": "20$ money payment", "gross_sales_money": {"amount": 2056, "currency": "USD"}, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 2056, "currency": "USD"}, "variation_total_price_money": {"amount": 2056, "currency": "USD"}, "item_type": "CUSTOM_AMOUNT"}], "created_at": "2021-06-18T13:30:27.796Z", "updated_at": "2021-06-18T13:30:30.000Z", "state": "COMPLETED", "version": 4, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_tip_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 2056, "currency": "USD"}, "closed_at": "2021-06-18T13:30:28.042Z", "tenders": [{"id": "rLBl9k8kKVV8uXNymUEct6S2ebIZY", "location_id": "LH2XR7AMG39HX", "transaction_id": "hD1xqUBBHQ3ejMBQiSSmncrYg7OZY", "created_at": "2021-06-18T13:30:27Z", "note": "20$ money payment", "amount_money": {"amount": 2056, "currency": "USD"}, "type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "VISA", "last_4": "1111", "fingerprint": "sq-1-mqW9yIk2eKV4LdXhGzf-FYu1knqb1IT7lXybOaFbMwIH2-9d1qdVOGNUMA8TDALoqg"}, "entry_method": "KEYED"}, "payment_id": "rLBl9k8kKVV8uXNymUEct6S2ebIZY"}], "total_service_charge_money": {"amount": 0, "currency": "USD"}, "net_amounts": {"total_money": {"amount": 2056, "currency": "USD"}, "tax_money": {"amount": 0, "currency": "USD"}, "discount_money": {"amount": 0, "currency": "USD"}, "tip_money": {"amount": 0, "currency": "USD"}, "service_charge_money": {"amount": 0, "currency": "USD"}}, "source": {"name": "Sandbox for sq0idp-4Uw2-7Sy15Umdnct7FTeuQ"}}, "emitted_at": 1714754269369}
{"stream": "orders", "data": {"id": "jqYrf6arFpUo7zElfWu9GRF5lAWZY", "location_id": "LH2XR7AMG39HX", "line_items": [{"uid": "JYEv3BLPY5FmSaVXDdbESD", "quantity": "1", "base_price_money": {"amount": 100, "currency": "USD"}, "gross_sales_money": {"amount": 100, "currency": "USD"}, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 100, "currency": "USD"}, "variation_total_price_money": {"amount": 100, "currency": "USD"}, "item_type": "CUSTOM_AMOUNT"}], "created_at": "2021-06-08T20:21:39.163Z", "updated_at": "2021-06-08T20:21:41.000Z", "state": "COMPLETED", "version": 4, "total_tax_money": {"amount": 0, "currency": "USD"}, "total_discount_money": {"amount": 0, "currency": "USD"}, "total_tip_money": {"amount": 0, "currency": "USD"}, "total_money": {"amount": 100, "currency": "USD"}, "closed_at": "2021-06-08T20:21:39.406Z", "tenders": [{"id": "9m4YvEyzLRUvwUeBf2DNtVOh6cIZY", "location_id": "LH2XR7AMG39HX", "transaction_id": "jqYrf6arFpUo7zElfWu9GRF5lAWZY", "created_at": "2021-06-08T20:21:39Z", "amount_money": {"amount": 100, "currency": "USD"}, "type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "MASTERCARD", "last_4": "9029", "fingerprint": "sq-1-MTQOLCjEOIzHvJvKX4yxf6qBvj6DAFuB8wlWoKW4NI1BAFV5cdlJmge8ehPFGUSeuw"}, "entry_method": "KEYED"}, "payment_id": "9m4YvEyzLRUvwUeBf2DNtVOh6cIZY"}], "total_service_charge_money": {"amount": 0, "currency": "USD"}, "net_amounts": {"total_money": {"amount": 100, "currency": "USD"}, "tax_money": {"amount": 0, "currency": "USD"}, "discount_money": {"amount": 0, "currency": "USD"}, "tip_money": {"amount": 0, "currency": "USD"}, "service_charge_money": {"amount": 0, "currency": "USD"}}, "source": {"name": "Sandbox for sq0idp-7KVC6qHcSDMXsm40SAA9TA"}}, "emitted_at": 1714754269377}
{"stream": "payments", "data": {"id": "loPWmSQLvpSMgfvHH1ims8VUTDaZY", "created_at": "2021-06-29T21:38:44.903Z", "updated_at": "2021-06-29T21:38:45.730Z", "amount_money": {"amount": 500, "currency": "USD"}, "status": "CANCELED", "delay_duration": "PT168H", "source_type": "CARD", "card_details": {"status": "VOIDED", "card": {"card_brand": "MASTERCARD", "last_4": "9029", "exp_month": 6, "exp_year": 2023, "fingerprint": "sq-1-MTQOLCjEOIzHvJvKX4yxf6qBvj6DAFuB8wlWoKW4NI1BAFV5cdlJmge8ehPFGUSeuw", "card_type": "CREDIT", "prepaid_type": "NOT_PREPAID", "bin": "540988"}, "entry_method": "KEYED", "cvv_status": "CVV_ACCEPTED", "avs_status": "AVS_ACCEPTED", "statement_description": "SQ *DEFAULT TEST ACCOUNT", "card_payment_timeline": {"authorized_at": "2021-06-29T21:38:45.013Z", "voided_at": "2021-06-29T21:38:45.730Z"}}, "location_id": "LH2XR7AMG39HX", "order_id": "BFkIiV4W7baTDDx2CGGhdEzvTOCZY", "reference_id": "12349", "risk_evaluation": {"created_at": "2021-06-29T21:38:45.014Z", "risk_level": "NORMAL"}, "total_money": {"amount": 500, "currency": "USD"}, "approved_money": {"amount": 500, "currency": "USD"}, "delay_action": "CANCEL", "delayed_until": "2021-07-06T21:38:44.903Z", "application_details": {"square_product": "ECOMMERCE_API", "application_id": "sandbox-sq0idb-Nd7U5HfhPMxxK3f1Me-yKw"}, "version_token": "f5iPBxJj2srWGSC8W4n36zfxKDtRZpnd2ULlUfCSWE16o"}, "emitted_at": 1714754171483}
{"stream": "payments", "data": {"id": "FOQ5GqSxmT9jNRniOAtnVO4jsEeZY", "created_at": "2023-01-04T17:19:35.248Z", "updated_at": "2023-01-04T17:19:35.968Z", "amount_money": {"amount": 100, "currency": "USD"}, "status": "COMPLETED", "delay_duration": "PT168H", "source_type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "VISA", "last_4": "5858", "exp_month": 1, "exp_year": 2025, "fingerprint": "sq-1-ebU3Ci-dcOxf-pVya9fDChHVLpXmNo73UaTsGbKLjBVtdqie8txHwuAY1SxA2F3c0g", "card_type": "CREDIT", "prepaid_type": "NOT_PREPAID", "bin": "453275"}, "entry_method": "KEYED", "cvv_status": "CVV_ACCEPTED", "avs_status": "AVS_ACCEPTED", "statement_description": "SQ *DEFAULT TEST ACCOUNT", "card_payment_timeline": {"authorized_at": "2023-01-04T17:19:35.357Z", "captured_at": "2023-01-04T17:19:35.508Z"}}, "location_id": "LH2XR7AMG39HX", "order_id": "jyopZ3JZqETa2DVeYRJ0Q2aL7aSZY", "processing_fee": [{"effective_at": "2023-01-04T19:19:35.000Z", "type": "INITIAL", "amount_money": {"amount": 33, "currency": "USD"}}], "total_money": {"amount": 100, "currency": "USD"}, "approved_money": {"amount": 100, "currency": "USD"}, "receipt_number": "FOQ5", "receipt_url": "https://squareupsandbox.com/receipt/preview/FOQ5GqSxmT9jNRniOAtnVO4jsEeZY", "delay_action": "CANCEL", "delayed_until": "2023-01-11T17:19:35.248Z", "application_details": {"square_product": "ECOMMERCE_API", "application_id": "sandbox-sq0idb-ngrW_B21kFLrPGOWYcdTpA"}, "version_token": "0710kSIYgA6m7XBzxRGFdn8azNVuG3dgXlyBFkAc0CR6o"}, "emitted_at": 1714754185384}
{"stream": "payments", "data": {"id": "nneK6BjIQRXh32F97v8JOXfm9oAZY", "created_at": "2023-01-04T17:30:17.374Z", "updated_at": "2023-01-04T17:30:18.773Z", "amount_money": {"amount": 8803, "currency": "USD"}, "status": "COMPLETED", "delay_duration": "PT168H", "source_type": "CARD", "card_details": {"status": "CAPTURED", "card": {"card_brand": "VISA", "last_4": "5858", "exp_month": 1, "exp_year": 2025, "fingerprint": "sq-1-ebU3Ci-dcOxf-pVya9fDChHVLpXmNo73UaTsGbKLjBVtdqie8txHwuAY1SxA2F3c0g", "card_type": "CREDIT", "prepaid_type": "NOT_PREPAID", "bin": "453275"}, "entry_method": "KEYED", "cvv_status": "CVV_ACCEPTED", "avs_status": "AVS_ACCEPTED", "statement_description": "SQ *DEFAULT TEST ACCOUNT", "card_payment_timeline": {"authorized_at": "2023-01-04T17:30:17.483Z", "captured_at": "2023-01-04T17:30:17.626Z"}}, "location_id": "LH2XR7AMG39HX", "order_id": "1L6QiJjgk1gEfpBDEpipJI3Ks3QZY", "processing_fee": [{"effective_at": "2023-01-04T19:30:18.000Z", "type": "INITIAL", "amount_money": {"amount": 285, "currency": "USD"}}], "total_money": {"amount": 8803, "currency": "USD"}, "approved_money": {"amount": 8803, "currency": "USD"}, "receipt_number": "nneK", "receipt_url": "https://squareupsandbox.com/receipt/preview/nneK6BjIQRXh32F97v8JOXfm9oAZY", "delay_action": "CANCEL", "delayed_until": "2023-01-11T17:30:17.374Z", "application_details": {"square_product": "ECOMMERCE_API", "application_id": "sandbox-sq0idb-ngrW_B21kFLrPGOWYcdTpA"}, "version_token": "gffCTXV8NxT9Zwhep7oHz2hqhxlKq2pcgU5nwkSipBq6o"}, "emitted_at": 1714754185389}
{"stream": "refunds", "data": {"id": "NWO7kC96bJDUNKLovcUnapxGeOWZY_0um3GHK0AHt273xEe6I3u1y96Lnm018b0WAtyyOYRrP", "status": "COMPLETED", "amount_money": {"amount": 1485, "currency": "USD"}, "payment_id": "NWO7kC96bJDUNKLovcUnapxGeOWZY", "order_id": "NpZRjYMGKOKeTe0BTp7N5r8kM0LZY", "created_at": "2021-06-18T13:37:34.471Z", "updated_at": "2021-06-18T13:37:37.319Z", "processing_fee": [{"effective_at": "2021-06-18T15:31:43.000Z", "type": "INITIAL", "amount_money": {"amount": -51, "currency": "USD"}}], "location_id": "LH2XR7AMG39HX", "destination_type": "CARD"}, "emitted_at": 1714754149618}
{"stream": "refunds", "data": {"id": "NWO7kC96bJDUNKLovcUnapxGeOWZY_BH7uyAXe6SqRc99uEExljMwERWZPci10Og6zIyfynAB", "status": "COMPLETED", "amount_money": {"amount": 500, "currency": "USD"}, "payment_id": "NWO7kC96bJDUNKLovcUnapxGeOWZY", "order_id": "BFkIiV4W7baTDDx2CGGhdEzvTOCZY", "created_at": "2021-06-22T19:35:20.612Z", "updated_at": "2021-06-22T19:35:23.683Z", "processing_fee": [{"effective_at": "2021-06-18T15:31:43.000Z", "type": "INITIAL", "amount_money": {"amount": -18, "currency": "USD"}}], "location_id": "LH2XR7AMG39HX", "destination_type": "CARD"}, "emitted_at": 1714754149624}
{"stream": "shifts", "data": {"id": "M60G9R7E1H52J", "employee_id": "TMA-T96eUCnR9DkX", "location_id": "L9A5Y0JR014G1", "timezone": "UTC", "start_at": "2021-06-17T08:00:00Z", "end_at": "2021-06-17T20:00:00Z", "wage": {"title": "Owner", "hourly_rate": {"amount": 4050, "currency": "USD"}}, "breaks": [{"id": "ZXR4CMNAEGXW6", "start_at": "2021-06-17T10:00:00Z", "end_at": "2021-06-17T11:00:00Z", "break_type_id": "HDY9769K81MN7", "name": "Lunch Break", "expected_duration": "PT1H", "is_paid": true}, {"id": "2N4RYD910S698", "start_at": "2021-06-17T17:00:00Z", "end_at": "2021-06-17T17:30:00Z", "break_type_id": "NEHDKJ0V03XP2", "name": "Tea Break", "expected_duration": "PT30M", "is_paid": true}], "status": "CLOSED", "version": 1, "created_at": "2021-06-18T20:46:59Z", "updated_at": "2021-06-18T20:46:59Z", "team_member_id": "TMA-T96eUCnR9DkX"}, "emitted_at": 1714754217581}
{"stream": "shifts", "data": {"id": "WET1AZXN164BB", "employee_id": "TMA-T96eUCnR9DkX", "location_id": "L9A5Y0JR014G1", "timezone": "UTC", "start_at": "2019-01-25T08:11:00Z", "end_at": "2019-01-25T18:11:00Z", "wage": {"hourly_rate": {"amount": 1100, "currency": "USD"}}, "breaks": [{"id": "Q00NYDFJ36K9Y", "start_at": "2019-01-25T11:11:00Z", "end_at": "2019-01-25T11:41:00Z", "break_type_id": "NEHDKJ0V03XP2", "name": "Tea Break", "expected_duration": "PT30M", "is_paid": true}], "status": "CLOSED", "version": 1, "created_at": "2021-06-18T20:37:39Z", "updated_at": "2021-06-18T20:37:39Z", "team_member_id": "TMA-T96eUCnR9DkX"}, "emitted_at": 1714754217584}
{"stream": "taxes", "data": {"type": "TAX", "id": "C3EB6HITDFUUSQJIHM7KGFRU", "updated_at": "2021-06-15T13:17:49.723Z", "created_at": "2021-06-10T22:13:47.037Z", "version": 1623763069723, "is_deleted": false, "present_at_all_locations": true, "absent_at_location_ids": ["LH2XR7AMG39HX"], "tax_data": {"name": "5_p", "calculation_phase": "TAX_SUBTOTAL_PHASE", "inclusion_type": "INCLUSIVE", "percentage": "5.0", "applies_to_custom_amounts": true, "enabled": true, "tax_type_id": "us_sales_tax", "tax_type_name": "Sales Tax"}}, "emitted_at": 1714754126703}
{"stream": "taxes", "data": {"type": "TAX", "id": "5X7QCTRTQ7MEUFFWF2ESR3IA", "updated_at": "2021-06-15T13:18:45.628Z", "created_at": "2021-06-15T13:18:45.628Z", "version": 1623763125628, "is_deleted": false, "present_at_all_locations": true, "absent_at_location_ids": ["L9A5Y0JR014G1"], "tax_data": {"name": "15_p", "calculation_phase": "TAX_SUBTOTAL_PHASE", "inclusion_type": "ADDITIVE", "percentage": "15.0", "applies_to_custom_amounts": true, "enabled": true, "tax_type_id": "us_sales_tax", "tax_type_name": "Sales Tax"}}, "emitted_at": 1714754126706}
{"stream": "taxes", "data": {"type": "TAX", "id": "ZSUDRGZMZ4OT6NP4DRWT2E3S", "updated_at": "2021-06-18T20:06:02.883Z", "created_at": "2021-06-18T20:06:02.883Z", "version": 1624046762883, "is_deleted": false, "present_at_all_locations": true, "tax_data": {"name": "Sales Tax", "calculation_phase": "TAX_TOTAL_PHASE", "inclusion_type": "ADDITIVE", "percentage": "8.5", "applies_to_custom_amounts": true, "enabled": true}}, "emitted_at": 1714754126709}
{"stream": "team_member_wages", "data": {"id": "XGC1R9wiiymBJ4M1K8puuJGZ", "team_member_id": "TMA-T96eUCnR9DkX", "title": "Owner"}, "emitted_at": 1714754148418}
{"stream": "team_member_wages", "data": {"id": "hFDaXrhWZ1BhnZLbrJTqqCfm", "team_member_id": "TMcnrxWIJPlmU4c5", "title": "Barista", "hourly_rate": {"amount": 2000, "currency": "USD"}}, "emitted_at": 1714754148422}
{"stream": "team_member_wages", "data": {"id": "pC3birEsVhGyF58XjPvQ6BhD", "team_member_id": "TMx95KdTStPnIxgp", "title": "Cashier", "hourly_rate": {"amount": 2404, "currency": "USD"}}, "emitted_at": 1714754148425}
{"stream": "team_members", "data": {"id": "TMA-T96eUCnR9DkX", "is_owner": true, "status": "ACTIVE", "given_name": "Sandbox", "family_name": "Seller", "email_address": "sandbox-merchant+ryeggsjovidbpszhnwkskzvma10qzjcb@squareup.com", "created_at": "2021-04-30T05:16:05Z", "updated_at": "2023-07-07T17:07:41Z", "assigned_locations": {"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"}}, "emitted_at": 1714754147343}
{"stream": "team_members", "data": {"id": "TMcnrxWIJPlmU4c5", "reference_id": "2", "is_owner": false, "status": "ACTIVE", "given_name": "Team", "family_name": "Member_2", "email_address": "team_member_2@airbyte.com", "phone_number": "+19008080808", "created_at": "2021-06-18T13:17:37Z", "updated_at": "2021-06-18T13:17:37Z", "assigned_locations": {"assignment_type": "EXPLICIT_LOCATIONS"}}, "emitted_at": 1714754147345}
{"stream": "team_members", "data": {"id": "TMx95KdTStPnIxgp", "reference_id": "1", "is_owner": false, "status": "ACTIVE", "given_name": "Team", "family_name": "Member_1", "email_address": "team_member_1@airbyte.com", "phone_number": "+18008080808", "created_at": "2021-06-18T13:15:49Z", "updated_at": "2021-06-18T13:17:06Z", "assigned_locations": {"assignment_type": "EXPLICIT_LOCATIONS"}}, "emitted_at": 1714754147347}

View File

@@ -1,5 +1,8 @@
{
"api_key": "API_KEY",
"credentials": {
"auth_type": "API Key",
"api_key": "API_KEY"
},
"is_sandbox": true,
"start_date": "2200-01-01",
"include_deleted_objects": false

View File

@@ -6,26 +6,28 @@ data:
hosts:
- connect.squareupsandbox.com
- connect.squareup.com
connectorBuildOptions:
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
connectorSubtype: api
connectorType: source
definitionId: 77225a51-cd15-4a13-af02-65816bd0ecf4
dockerImageTag: 1.6.1
dockerImageTag: 1.6.2
dockerRepository: airbyte/source-square
documentationUrl: https://docs.airbyte.com/integrations/sources/square
githubIssueLabel: source-square
icon: square.svg
license: MIT
name: Square
remoteRegistries:
pypi:
enabled: true
packageName: airbyte-source-square
registries:
cloud:
enabled: true
oss:
enabled: true
releaseStage: beta
remoteRegistries:
pypi:
enabled: true
packageName: airbyte-source-square
supportLevel: community
tags:
- language:python

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
[build-system]
requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
version = "1.6.2"
name = "source-square"
description = "Source implementation for Square."
authors = [ "Airbyte <contact@airbyte.io>",]
license = "MIT"
readme = "README.md"
documentation = "https://docs.airbyte.com/integrations/sources/square"
homepage = "https://airbyte.com"
repository = "https://github.com/airbytehq/airbyte"
[[tool.poetry.packages]]
include = "source_square"
[tool.poetry.dependencies]
python = "^3.9,<3.12"
airbyte-cdk = "^0"
[tool.poetry.scripts]
source-square = "source_square.run:run"
[tool.poetry.group.dev.dependencies]
pytest = "^6.1"
pytest-mock = "^3.6.1"
freezegun = "^1.5.0"
requests-mock = "^1.9.3"

View File

@@ -1,47 +0,0 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = [
"airbyte-cdk>=0.51.31",
]
TEST_REQUIREMENTS = [
"requests-mock~=1.9.3",
"freezegun",
"pytest~=6.1",
"pytest-mock~=3.6.1",
]
setup(
entry_points={
"console_scripts": [
"source-square=source_square.run:run",
],
},
name="source_square",
description="Source implementation for Square.",
author="Airbyte",
author_email="contact@airbyte.io",
packages=find_packages(),
install_requires=MAIN_REQUIREMENTS,
package_data={
"": [
# Include yaml files in the package (if any)
"*.yml",
"*.yaml",
# Include all json files in the package, up to 4 levels deep
"*.json",
"*/*.json",
"*/*/*.json",
"*/*/*/*.json",
"*/*/*/*/*.json",
]
},
extras_require={
"tests": TEST_REQUIREMENTS,
},
)

View File

@@ -1,91 +0,0 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
from dataclasses import dataclass
from datetime import datetime, timezone
from typing import Any, Iterable, Mapping, Optional
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.declarative.auth import DeclarativeOauth2Authenticator
from airbyte_cdk.sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator
from airbyte_cdk.sources.declarative.auth.token import BearerAuthenticator
from airbyte_cdk.sources.declarative.incremental import DatetimeBasedCursor
from airbyte_cdk.sources.declarative.types import StreamSlice, StreamState
from airbyte_cdk.sources.streams.core import Stream
@dataclass
class AuthenticatorSquare(DeclarativeAuthenticator):
config: Mapping[str, Any]
bearer: BearerAuthenticator
oauth: DeclarativeOauth2Authenticator
def __new__(cls, bearer, oauth, config, *args, **kwargs):
if config.get("credentials", {}).get("api_key"):
return bearer
else:
return oauth
@dataclass
class SquareSubstreamIncrementalSync(DatetimeBasedCursor):
parent_stream: Stream = None
parent_key: str = None
parent_records_per_request: int = 10
@property
def logger(self):
return logging.getLogger(f"airbyte.streams.{self.parent_stream.name}")
def get_request_body_json(
self,
*,
stream_state: Optional[StreamState] = {},
stream_slice: Optional[StreamSlice] = None,
next_page_token: Optional[Mapping[str, Any]] = None,
) -> Optional[Mapping]:
json_payload = {"cursor": next_page_token["cursor"]} if next_page_token else {}
if stream_slice:
json_payload.update(stream_slice)
initial_start_time = self._format_datetime(self.start_datetime.get_datetime(self.config, stream_state={}))
json_payload["query"] = {
"filter": {
"date_time_filter": {
"updated_at": {
"start_at": stream_slice.get(self.cursor_field.eval(self.config), initial_start_time),
}
}
},
"sort": {"sort_field": "UPDATED_AT", "sort_order": "ASC"},
}
return json_payload
def stream_slices(self) -> Iterable[StreamSlice]:
locations_records = self.parent_stream.read_records(sync_mode=SyncMode.full_refresh)
location_ids = [location[self.parent_key] for location in locations_records]
if not location_ids:
self.logger.error(
"No locations found. Orders cannot be extracted without locations. "
"Check https://developer.squareup.com/explorer/square/locations-api/list-locations"
)
yield from []
separated_locations = [
location_ids[i : i + self.parent_records_per_request] for i in range(0, len(location_ids), self.parent_records_per_request)
]
for location in separated_locations:
stream_slice = {"location_ids": location}
cursor_field = self.cursor_field.eval(self.config)
if self._cursor:
# The Square API throws an error if when a datetime is greater than the current time
current_datetime = datetime.now(timezone.utc)
cursor_datetime = self.parse_date(self._cursor)
slice_datetime = (
current_datetime.strftime(self.datetime_format)
if cursor_datetime > current_datetime
else cursor_datetime.strftime(self.datetime_format)
)
stream_slice[cursor_field] = slice_datetime
yield stream_slice

View File

@@ -1,4 +1,4 @@
version: "0.29.0"
version: "0.81.4"
definitions:
schema_loader:
@@ -23,16 +23,14 @@ definitions:
url_base: "{{ 'https://connect.squareupsandbox.com/v2' if config['is_sandbox'] else 'https://connect.squareup.com/v2' }}"
http_method: "GET"
authenticator:
class_name: source_square.components.AuthenticatorSquare
bearer: "#/definitions/bearer_authenticator"
oauth: "#/definitions/oauth_authenticator"
# Uncomment this block later. request_headers used to accidentally get overridden but this was fixed in beta release
# However, because expected_records were originally generated with the buggy flow missing these, we need to
# regenerate the expected records. Temporarily commenting it out to retain the old behavior until we do it.
# request_headers:
# Square-Version: "2022-10-19"
# Content-Type: "application/json"
type: SelectiveAuthenticator
authenticator_selection_path: ["credentials", "auth_type"]
authenticators:
API Key: "#/definitions/bearer_authenticator"
OAuth: "#/definitions/oauth_authenticator"
request_headers:
Square-Version: "2022-10-19"
Content-Type: "application/json"
retriever:
record_selector:
$ref: "#/definitions/selector"
@@ -329,26 +327,21 @@ definitions:
field_path: ["loyalty_accounts"]
orders_stream:
# ToDo: Improve the efficiency of this stream by grouping location IDs into batches of 10.
$ref: "#/definitions/base_stream_page_json_limit"
$parameters:
name: "orders"
primary_key: "id"
path: "/orders/search"
incremental_sync:
type: CustomIncrementalSync
class_name: source_square.components.SquareSubstreamIncrementalSync
type: DatetimeBasedCursor
start_datetime:
datetime: "{{ format_datetime(config['start_date'], '%Y-%m-%dT%H:%M:%S.%fZ') }}"
datetime_format: "%Y-%m-%dT%H:%M:%S.%fZ"
end_datetime:
datetime: "{{ now_utc().strftime('%Y-%m-%dT%H:%M:%S.%fZ') }}"
datetime_format: "%Y-%m-%dT%H:%M:%S.%fZ"
step: P30D
datetime_format: "%Y-%m-%dT%H:%M:%S.%fZ"
cursor_granularity: "PT0.000001S"
parent_stream: "#/definitions/locations_stream"
cursor_field: "updated_at"
parent_key: "id"
retriever:
$ref: "#/definitions/base_stream_page_json_limit/retriever"
requester:
@@ -356,6 +349,20 @@ definitions:
http_method: "POST"
request_body_json:
limit: "{{ 500 }}"
filter:
date_time_filter:
updated_at:
start_at: "{{ stream_slice.start_time }}"
sort:
sort_field: "UPDATED_AT"
sort_order: "ASC"
location_ids: "{{ [ stream_slice.location_ids ] }}"
partition_router:
type: "SubstreamPartitionRouter"
parent_stream_configs:
- stream: "#/definitions/locations_stream"
parent_key: "id"
partition_field: "location_ids"
bank_accounts_stream:
$ref: "#/definitions/base_stream"

View File

@@ -1,162 +0,0 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
from datetime import datetime
from unittest.mock import MagicMock
import freezegun
import pendulum
import pytest
import requests_mock
from airbyte_cdk.sources.declarative.auth import DeclarativeOauth2Authenticator
from airbyte_cdk.sources.declarative.datetime import MinMaxDatetime
from source_square.components import SquareSubstreamIncrementalSync
from source_square.source import SourceSquare
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
CURSOR_GRANULARITY = "PT0.000001S"
@pytest.fixture
def req_mock():
with requests_mock.Mocker() as mock:
yield mock
def test_source_wrong_credentials():
source = SourceSquare()
config = {
"credentials": {"auth_type": "Apikey", "api_key": "bla"},
"is_sandbox": True,
"start_date": "2021-06-01",
"include_deleted_objects": False,
}
status, error = source.check_connection(logger=logging.getLogger("airbyte"), config=config)
assert not status
@freezegun.freeze_time("2020-01-01")
def test_refresh_access_token(req_mock):
URL = "https://example.com"
TOKEN = "test_token"
next_day = "2020-01-02T00:00:00Z"
config = {
"refresh_endpoint": URL,
"client_id": "some_client_id",
"client_secret": "some_client_secret",
"token_expiry_date": pendulum.now().subtract(days=2).to_rfc3339_string(),
}
parameters = {"refresh_token": "some_refresh_token"}
req_mock.post(URL, json={"access_token": TOKEN, "expires_in": next_day})
authenticator = DeclarativeOauth2Authenticator(
token_refresh_endpoint=URL,
client_secret="client_secret",
client_id="client_id",
refresh_token="refresh_token",
token_expiry_date_format="YYYY-MM-DDTHH:mm:ss[Z]",
token_expiry_is_time_of_expiration=True,
config=config,
parameters=parameters,
)
token = authenticator.get_access_token()
assert token == TOKEN
assert authenticator.get_token_expiry_date() == pendulum.parse(next_day)
@pytest.mark.parametrize(
"state, last_record, expected, expected_stream_slice, records",
[
(
{},
{"updated_at": "2022-09-05T10:10:10.000000Z"},
{"updated_at": "2022-09-05T10:10:10.000000Z"},
{"location_ids": ["some_id"]},
[{"id": "some_id"}],
),
(
{"updated_at": "2023-01-01T00:00:00.000000Z"},
{"updated_at": "2022-09-05T10:10:10.000000Z"},
{"updated_at": "2023-01-01T00:00:00.000000Z"},
{"location_ids": ["some_id"], "updated_at": "2023-01-01T00:00:00.000000Z"},
[{"id": "some_id"}],
),
(
{"updated_at": "2200-01-01T00:00:00.000000Z"},
{"updated_at": "2022-09-05T10:10:10.000000Z"},
{"updated_at": "2022-09-05T10:10:10.000000Z"},
{"location_ids": ["some_id"], "updated_at": "expects_current_time_when_state_is_greater"},
[{"id": "some_id"}],
),
({}, None, {}, {}, []),
],
)
def test_substream_incremental_sync(state, last_record, expected, expected_stream_slice, records):
parent_stream = MagicMock()
parent_stream.read_records = MagicMock(return_value=records)
slicer = SquareSubstreamIncrementalSync(
start_datetime=MinMaxDatetime(datetime="2021-01-01T00:00:00.000000+0000", parameters={}),
end_datetime=MinMaxDatetime(datetime="2021-01-10T00:00:00.000000+0000", parameters={}),
step="P1D",
cursor_field="updated_at",
datetime_format=DATETIME_FORMAT,
cursor_granularity=CURSOR_GRANULARITY,
parameters=None,
config={"start_date": "2021-01-01T00:00:00.000000+0000"},
parent_key="id",
parent_stream=parent_stream,
)
slicer.set_initial_state(state)
actual_stream_slice = next(slicer.stream_slices()) if records else {}
# Covers the test case for abnormal state that is greater than the current time
if "updated_at" in state and state["updated_at"] > datetime.now().strftime(DATETIME_FORMAT):
assert actual_stream_slice["updated_at"] != state["updated_at"]
else:
assert actual_stream_slice == expected_stream_slice
slicer.close_slice(actual_stream_slice, last_record)
assert slicer.get_stream_state() == expected
@pytest.mark.parametrize(
"last_record, records, expected_data",
[
(
{"updated_at": "2022-09-05T10:10:10.000000Z"},
[{"id": "some_id1"}],
{"location_ids": ["some_id1"], "start_date": "2021-01-01T00:00:00.000000Z"},
),
(
{"updated_at": "2022-09-05T10:10:10.000000Z"},
[{"id": f"some_id{x}"} for x in range(11)],
{"location_ids": [f"some_id{x}" for x in range(10)], "start_date": "2021-01-01T00:00:00.000000Z"},
),
],
)
def test_sub_slicer_request_body(last_record, records, expected_data):
parent_stream = MagicMock
parent_stream.read_records = MagicMock(return_value=records)
slicer = SquareSubstreamIncrementalSync(
start_datetime=MinMaxDatetime(datetime="2021-01-01T00:00:00.000000Z", parameters={}),
end_datetime=MinMaxDatetime(datetime="2021-01-10T00:00:00.000000Z", parameters={}),
step="P1D",
cursor_field="updated_at",
datetime_format=DATETIME_FORMAT,
cursor_granularity=CURSOR_GRANULARITY,
parameters=None,
config={"start_date": "2021-01-01T00:00:00.000000Z"},
parent_key="id",
parent_stream=parent_stream,
)
stream_slice = next(slicer.stream_slices()) if records else {}
expected_request_body = {
"location_ids": expected_data.get("location_ids"),
"query": {
"filter": {"date_time_filter": {"updated_at": {"start_at": expected_data.get("start_date")}}},
"sort": {"sort_field": "UPDATED_AT", "sort_order": "ASC"},
},
}
assert slicer.get_request_body_json(stream_state=slicer.get_stream_state(), stream_slice=stream_slice) == expected_request_body

View File

@@ -0,0 +1,32 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
import pytest
import requests_mock
from source_square.source import SourceSquare
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
CURSOR_GRANULARITY = "PT0.000001S"
@pytest.fixture
def req_mock():
with requests_mock.Mocker() as mock:
yield mock
def test_source_wrong_credentials():
source = SourceSquare()
config = {
"credentials": {"auth_type": "Apikey", "api_key": "bla"},
"is_sandbox": True,
"start_date": "2021-06-01",
"include_deleted_objects": False,
}
with pytest.raises(ValueError) as key_error:
status, error = source.check_connection(logger=logging.getLogger("airbyte"), config=config)
assert str(key_error.value) == "The authenticator `Apikey` is not found."

View File

@@ -99,8 +99,9 @@ Exponential [Backoff](https://developer.squareup.com/forums/t/current-square-api
## Changelog
| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :------------------------------------------------------------------------ |
| 1.6.1 | 2023-11-07 | [31481](https://github.com/airbytehq/airbyte/pull/31481) | Fix duplicate records for `Payments` and `Refunds` stream|
|:--------|:-----------|:---------------------------------------------------------|:--------------------------------------------------------------------------|
| 1.6.2 | 2024-05-03 | [37800](https://github.com/airbytehq/airbyte/pull/37800) | Migrate to Poetry. Replace custom components with default classes |
| 1.6.1 | 2023-11-07 | [31481](https://github.com/airbytehq/airbyte/pull/31481) | Fix duplicate records for `Payments` and `Refunds` stream |
| 1.6.0 | 2023-10-18 | [31115](https://github.com/airbytehq/airbyte/pull/31115) | Add `customer_id` field to `Payments` and `Orders` streams |
| 1.5.0 | 2023-10-16 | [31045](https://github.com/airbytehq/airbyte/pull/31045) | Added New Stream bank_accounts |
| 1.4.0 | 2023-10-13 | [31106](https://github.com/airbytehq/airbyte/pull/31106) | Add new stream Loyalty |