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

🎉 New source: Chargebee (prepare connector for publishing) (#5067)

* Prepare Chargebee connector for publishing

* Update docs

Update `docs/SUMMARY.md` file.
Update `docs/integrations/README.md` file.

* Update changelog

* Implement change request

* Remove `name` field from streams

* Rename env var for Chargebee

Rename from `CHARGEBEE_TEST_CREDS` to `CHARGEBEE_INTEGRATION_TEST_CREDS`.

* Revert "Rename env var for Chargebee"

This reverts commit 7ddc6e0cb1.

* Revert "Revert "Rename env var for Chargebee""

This reverts commit 6df6751034.

* Add custom backoff handler

* Implement change request

* Add comment about why `order` is an empty stream

* Bump connector version
This commit is contained in:
oleh.zorenko
2021-07-30 23:09:18 +03:00
committed by GitHub
parent c48b92772e
commit 89ea3122db
35 changed files with 1397 additions and 4335 deletions

View File

@@ -81,6 +81,7 @@ jobs:
BIGQUERY_TEST_CREDS: ${{ secrets.BIGQUERY_TEST_CREDS }}
BRAINTREE_TEST_CREDS: ${{ secrets.BRAINTREE_TEST_CREDS }}
CART_TEST_CREDS: ${{ secrets.CART_TEST_CREDS }}
CHARGEBEE_INTEGRATION_TEST_CREDS: ${{ secrets.CHARGEBEE_INTEGRATION_TEST_CREDS }}
DESTINATION_PUBSUB_TEST_CREDS: ${{ secrets.DESTINATION_PUBSUB_TEST_CREDS }}
DESTINATION_KVDB_TEST_CREDS: ${{ secrets.DESTINATION_KVDB_TEST_CREDS }}
DRIFT_INTEGRATION_TEST_CREDS: ${{ secrets.DRIFT_INTEGRATION_TEST_CREDS }}

View File

@@ -79,6 +79,7 @@ jobs:
BIGQUERY_TEST_CREDS: ${{ secrets.BIGQUERY_TEST_CREDS }}
BRAINTREE_TEST_CREDS: ${{ secrets.BRAINTREE_TEST_CREDS }}
CART_TEST_CREDS: ${{ secrets.CART_TEST_CREDS }}
CHARGEBEE_INTEGRATION_TEST_CREDS: ${{ secrets.CHARGEBEE_INTEGRATION_TEST_CREDS }}
DESTINATION_PUBSUB_TEST_CREDS: ${{ secrets.DESTINATION_PUBSUB_TEST_CREDS }}
DESTINATION_KVDB_TEST_CREDS: ${{ secrets.DESTINATION_KVDB_TEST_CREDS }}
DRIFT_INTEGRATION_TEST_CREDS: ${{ secrets.DRIFT_INTEGRATION_TEST_CREDS }}

View File

@@ -0,0 +1,7 @@
{
"sourceDefinitionId": "686473f1-76d9-4994-9cc7-9b13da46147c",
"name": "Chargebee",
"dockerRepository": "airbyte/source-chargebee",
"dockerImageTag": "0.1.2",
"documentationUrl": "https://hub.docker.com/r/airbyte/source-chargebee"
}

View File

@@ -8,6 +8,11 @@
dockerRepository: airbyte/source-asana
dockerImageTag: 0.1.1
documentationUrl: https://hub.docker.com/r/airbyte/source-asana
- sourceDefinitionId: 686473f1-76d9-4994-9cc7-9b13da46147c
name: Chargebee
dockerRepository: airbyte/source-chargebee
dockerImageTag: 0.1.2
documentationUrl: https://hub.docker.com/r/airbyte/source-chargebee
- sourceDefinitionId: e2b40e36-aa0e-4bed-b41b-bcea6fa348b1
name: Exchange Rates Api
dockerRepository: airbyte/source-exchange-rates

View File

@@ -12,6 +12,7 @@
| AWS CloudTrail | [![source-aws-cloudtrail](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-aws-cloudtrail%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-aws-cloudtrail) |
| Braintree | [![source-braintree-singer](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-braintree-singer%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-braintree-singer) |
| BigQuery | [![source-bigquery](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-bigquery%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-bigquery/) |
| Chargebee | [![source-chargebee](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-chargebee%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-chargebee/) |
| Dixa | [![source-dixa](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-dixa%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-dixa) |
| Drift | [![source-drift](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-drift%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-drift) |
| Exchange Rates API | [![source-exchangeratesapi-singer](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-exchangeratesapi-singer%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-exchangeratesapi-singer) |

View File

@@ -1,6 +1,5 @@
*
!Dockerfile
!Dockerfile.test
!main.py
!source_chargebee
!setup.py

View File

@@ -1,2 +0,0 @@
NEW_SOURCE_CHECKLIST.md
secrets

View File

@@ -13,5 +13,5 @@ RUN pip install .
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
LABEL io.airbyte.version=0.1.1
LABEL io.airbyte.version=0.1.2
LABEL io.airbyte.name=airbyte/source-chargebee

View File

@@ -8,22 +8,20 @@ tests:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "excefailedption"
status: "failed"
discovery:
- config_path: "secrets/config.json"
basic_read:
- config_path: "secrets/config.json"
configured_catalog_path: "sample_files/configured_catalog.json"
# TODO uncomment this block to specify that the tests should assert the connector outputs the records provided in the input file a file
# expect_records:
# path: "integration_tests/expected_records.txt"
# extra_fields: no
# exact_order: no
# extra_records: yes
# incremental: # TODO if your connector does not implement incremental sync, remove this block
# - config_path: "secrets/config.json"
# configured_catalog_path: "integration_tests/configured_catalog.json"
# state_path: "integration_tests/abnormal_state.json"
configured_catalog_path: "integration_tests/product_catalog_v2_configured_catalog.json"
# I was unable to create orders using API and I didnt find a way to create orders
# through UI, so thats why `order` stream is empty.
empty_streams:
- order
incremental:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/product_catalog_v2_configured_catalog.json"
future_state_path: "integration_tests/future_state.json"
full_refresh:
- config_path: "secrets/config.json"
configured_catalog_path: "sample_files/configured_catalog.json"
configured_catalog_path: "integration_tests/product_catalog_v2_configured_catalog.json"

View File

@@ -1,23 +1,13 @@
plugins {
// id 'airbyte-source-acceptance-test'
id 'airbyte-python'
id 'airbyte-docker'
id 'airbyte-standard-source-test-file'
id 'airbyte-source-acceptance-test'
}
airbytePython {
moduleDirectory 'source-chargebee'
}
airbyteStandardSourceTestFile {
// All these input paths must live inside this connector's directory (or subdirectories)
configPath = "secrets/config.json"
configuredCatalogPath = "sample_files/configured_catalog.json"
specPath = "source_chargebee/spec.json"
}
dependencies {
// implementation files(project(':airbyte-integrations:bases:source-acceptance-test').airbyteDocker.outputs)
implementation files(project(':airbyte-integrations:bases:base-standard-source-test-file').airbyteDocker.outputs)
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs)
implementation files(project(':airbyte-integrations:bases:source-acceptance-test').airbyteDocker.outputs)
}

View File

@@ -1,5 +0,0 @@
{
"todo-stream-name": {
"todo-field-name": "todo-abnormal-value"
}
}

View File

@@ -1,39 +0,0 @@
{
"streams": [
{
"name": "TODO fix this file",
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": "column1",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"column1": {
"type": "string"
},
"column2": {
"type": "number"
}
}
}
},
{
"name": "table1",
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": false,
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"column1": {
"type": "string"
},
"column2": {
"type": "number"
}
}
}
}
]
}

View File

@@ -2,22 +2,63 @@
"streams": [
{
"stream": {
"name": "table_name",
"json_schema": {
"properties": {
"column_name": {
"type": "string"
}
},
"type": "object",
"additionalProperties": false
},
"supported_sync_modes": ["full_refresh"],
"source_defined_cursor": false,
"default_cursor_field": ["column_name"]
"name": "subscription",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": false
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "customer",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": false
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "invoice",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": false
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "order",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": false
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "plan",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": false
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "addon",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": false
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
}
]
}

View File

@@ -0,0 +1,20 @@
{
"subscription": {
"updated_at": 2147483647
},
"customer": {
"updated_at": 2147483647
},
"invoice": {
"updated_at": 2147483647
},
"order": {
"updated_at": 2147483647
},
"addon": {
"updated_at": 2147483647
},
"plan": {
"updated_at": 2147483647
}
}

View File

@@ -1,3 +1,6 @@
{
"todo-wrong-field": "this should be an incomplete config file, used in standard tests"
"site": "airbyte-test",
"site_api_key": "fake-api-key-1",
"start_date": "2021-06-22T06:57:44Z",
"product_catalog": "2.0"
}

View File

@@ -0,0 +1,56 @@
{
"streams": [
{
"stream": {
"name": "subscription",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["updated_at"]
},
{
"stream": {
"name": "customer",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["updated_at"]
},
{
"stream": {
"name": "invoice",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["updated_at"]
},
{
"stream": {
"name": "order",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["updated_at"]
}
]
}

View File

@@ -0,0 +1,30 @@
{
"streams": [
{
"stream": {
"name": "plan",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["updated_at"]
},
{
"stream": {
"name": "addon",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["updated_at"]
}
]
}

View File

@@ -1,3 +1,6 @@
{
"fix-me": "TODO"
"site": "airbyte-test",
"site_api_key": "<your_api_key>",
"start_date": "2021-06-22T06:57:44Z",
"product_catalog": "2.0"
}

View File

@@ -1,5 +1,20 @@
{
"todo-stream-name": {
"todo-field-name": "value"
"subscription": {
"updated_at": 1624345058
},
"customer": {
"updated_at": 1624345056
},
"invoice": {
"updated_at": 1624345059
},
"order": {
"updated_at": 1625596058
},
"addon": {
"updated_at": 1625596058
},
"plan": {
"updated_at": 1625596058
}
}

View File

@@ -27,8 +27,7 @@ from setuptools import find_packages, setup
MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
# Install chargebee
# according to API doc
# Install chargebee according to API doc.
# https://apidocs.chargebee.com/docs/api?lang=python&prod_cat_ver=2#client_library
"chargebee>=2,<3",
"backoff==1.10.0",
@@ -47,7 +46,7 @@ setup(
author_email="contact@airbyte.io",
packages=find_packages(),
install_requires=MAIN_REQUIREMENTS,
package_data={"": ["*.json"]},
package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]},
extras_require={
"tests": TEST_REQUIREMENTS,
},

View File

@@ -0,0 +1,64 @@
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
import sys
from typing import Union
import backoff
from airbyte_cdk.logger import AirbyteLogger
from chargebee.api_error import InvalidRequestError, OperationFailedError
from requests import codes
TRANSIENT_EXCEPTIONS = (
OperationFailedError,
InvalidRequestError,
)
logger = AirbyteLogger()
def default_backoff_handler(max_tries: int, factor: int, **kwargs):
def log_retry_attempt(details):
_, exc, _ = sys.exc_info()
logger.info(str(exc))
logger.info(f"Caught retryable error after {details['tries']} tries. Waiting {details['wait']} seconds then retrying...")
def should_give_up(exc: Union[OperationFailedError, InvalidRequestError]):
give_up = (exc.http_status_code != codes.too_many_requests and 400 <= exc.http_status_code < 500) or (
exc.http_status_code == codes.service_unavailable and exc.api_error_code == "site_not_ready"
)
if give_up:
logger.info(f"Giving up for returned HTTP status: `{exc.http_status_code}` and `api_error_code`: `{exc.api_error_code}`")
return give_up
return backoff.on_exception(
backoff.expo,
TRANSIENT_EXCEPTIONS,
jitter=None,
on_backoff=log_retry_attempt,
giveup=should_give_up,
max_tries=max_tries,
factor=factor,
**kwargs,
)

View File

@@ -4,11 +4,11 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
},
"name": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"invoice_name": {
@@ -20,25 +20,19 @@
"maxLength": 500
},
"pricing_model": {
"type": "array",
"enum": ["flat_fee", "per_unit", "tiered", "volume", "stairstep"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["flat_fee", "per_unit", "tiered", "volume", "stairstep"]
},
"charge_type": {
"type": "array",
"enum": ["recurring", "non_recurring"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["recurring", "non_recurring"]
},
"price": {
"type": ["integer", "null"],
"minimum": 0
},
"currency_code": {
"type": "string",
"type": ["string", "null"],
"maxLength": 3
},
"period": {
@@ -46,43 +40,34 @@
"minimum": 1
},
"period_unit": {
"type": "array",
"enum": ["day", "week", "month", "year", "not_applicable"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["day", "week", "month", "year", "not_applicable"]
},
"unit": {
"type": ["string", "null"],
"maxLength": 30
},
"status": {
"type": "array",
"enum": ["active", "archive"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["active", "archive"]
},
"archived_at": {
"type": ["integer", "null"]
},
"enabled_in_portal": {
"type": "boolean"
"type": ["boolean", "null"]
},
"tax_code": {
"type": ["string", "null"],
"maxLength": 59
"maxLength": 50
},
"taxjar_product_code": {
"type": ["string", "null"],
"maxLength": 59
"maxLength": 50
},
"avalara_sale_type": {
"type": ["array", "null"],
"enum": ["wholesale", "retail", "consumed", "vendor_use"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["wholesale", "retail", "consumed", "vendor_use"]
},
"avalara_transaction_type": {
"type": ["integer", "null"]
@@ -122,11 +107,8 @@
"minimum": 1
},
"shipping_frequency_period_unit": {
"type": ["array", "null"],
"enum": ["year", "month", "week", "day"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["year", "month", "week", "day"]
},
"resource_version": {
"type": ["integer", "null"]
@@ -153,7 +135,8 @@
"maxLength": 50
},
"meta_data": {
"type": ["object", "null"]
"type": ["object", "null"],
"properties": {}
},
"show_description_in_invoices": {
"type": ["boolean", "null"]
@@ -164,17 +147,17 @@
"tiers": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"starting_unit": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 1
},
"ending_unit": {
"type": "integer"
"type": ["integer", "null"]
},
"price": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"starting_unit_in_decimal": {

View File

@@ -4,7 +4,7 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"first_name": {
@@ -32,14 +32,11 @@
"maxLength": 20
},
"auto_collection": {
"type": ["array", "null"],
"enum": ["on", "off"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["on", "off"]
},
"offline_payment_method": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"no_preference",
"cash",
@@ -47,49 +44,44 @@
"bank_tranksfer",
"ach_credit",
"sepa_credit"
],
"items": {
"type": ["string"]
}
]
},
"net_term_days": {
"type": "integer"
"type": ["integer", "null"]
},
"vat_number_validated_time": {
"type": ["integer", "null"]
},
"vat_number_status": {
"type": ["array", "null"],
"enum": ["valid", "invalid", "not_validated", "undetermined"],
"items": {
"type": ["string"]
}
"type": ["string", "null"],
"enum": ["valid", "invalid", "not_validated", "undetermined"]
},
"allow_direct_debit": {
"type": "boolean"
"type": ["boolean", "null"]
},
"is_location_valid": {
"type": "boolean"
"type": ["boolean", "null"]
},
"created_at": {
"type": "integer"
"type": ["integer", "null"]
},
"created_from_ip": {
"type": ["string", "null"],
"maxLength": 50
},
"exemption_details": {
"type": "object"
},
"taxability": {
"type": ["array", "null"],
"enum": ["taxable", "exempt"],
"items": {
"type": ["string"]
"type": ["object", "null"],
"properties": {}
}
},
"taxability": {
"type": ["string", "null"],
"enum": ["taxable", "exempt"]
},
"entity_code": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"a",
"b",
@@ -110,17 +102,14 @@
"r",
"med1",
"med2"
],
"items": {
"type": ["string"]
}
]
},
"exempt_number": {
"type": ["string", "null"],
"maxLength": 100
},
"resource_version": {
"type": ["number", "null"]
"type": ["integer", "null"]
},
"updated_at": {
"type": ["integer", "null"]
@@ -135,14 +124,11 @@
"minimum": 1
},
"billing_date_mode": {
"type": ["array", "null"],
"enum": ["using_default", "manually_set"],
"items": {
"type": ["string"]
}
"type": ["string", "null"],
"enum": ["using_default", "manually_set"]
},
"billing_day_of_week": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"sunday",
"monday",
@@ -151,34 +137,22 @@
"thursday",
"friday",
"saturday"
],
"items": {
"type": ["string"]
}
]
},
"billing_day_of_week_mode": {
"type": ["array", "null"],
"enum": ["using_default", "manually_set"],
"items": {
"type": ["string"]
}
"type": ["string", "null"],
"enum": ["using_default", "manually_set"]
},
"pii_cleared": {
"type": ["array", "null"],
"enum": ["active", "scheduled_for_clear", "cleared"],
"items": {
"type": ["string"]
}
"type": ["string", "null"],
"enum": ["active", "scheduled_for_clear", "cleared"]
},
"auto_close_invoices": {
"type": ["boolean", "null"]
},
"fraud_flag": {
"type": ["array", "null"],
"enum": ["safe", "suspicious", "fraudulent"],
"items": {
"type": ["string"]
}
"type": ["string", "null"],
"enum": ["safe", "suspicious", "fraudulent"]
},
"primary_payment_source_id": {
"type": ["string", "null"],
@@ -197,23 +171,23 @@
"maxLength": 3
},
"promotional_credits": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"unbilled_charges": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"refundable_credits": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"excess_payments": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"deleted": {
"type": "boolean"
"type": ["boolean", "null"]
},
"registered_for_gst": {
"type": ["boolean", "null"]
@@ -222,11 +196,8 @@
"type": ["boolean", "null"]
},
"customer_type": {
"type": ["array", "null"],
"enum": ["residential", "business", "senior_citizen", "industrial"],
"items": {
"type": ["string"]
}
"type": ["string", "null"],
"enum": ["residential", "business", "senior_citizen", "industrial"]
},
"business_customer_without_vat_number": {
"type": ["boolean", "null"]
@@ -243,7 +214,7 @@
"maxLength": 10
},
"billing_address": {
"type": "object",
"type": ["object", "null"],
"properties": {
"first_name": {
"type": ["string", "null"],
@@ -268,7 +239,7 @@
},
"line1": {
"type": ["string", "null"],
"maxLength": 180
"maxLength": 150
},
"line2": {
"type": ["string", "null"],
@@ -299,27 +270,56 @@
"maxLength": 20
},
"validation_status": {
"type": "array",
"enum": ["not_validated", "valid", "partially_valid", "invalid"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["not_validated", "valid", "partially_valid", "invalid"]
}
}
},
"referral_urls": {
"type": "array",
"type": ["array", "null"],
"items": {
"type": "string"
"type": ["object", "null"],
"properties": {
"external_customer_id": {
"type": ["string", "null"],
"maxLength": 100
},
"referral_sharing_url": {
"type": ["string", "null"],
"maxLength": 50
},
"created_at": {
"type": ["integer", "null"]
},
"updated_at": {
"type": ["integer", "null"]
},
"referral_campaign_id": {
"type": ["string", "null"],
"maxLength": 50
},
"referral_account_id": {
"type": ["string", "null"],
"maxLength": 50
},
"referral_external_campaign_id": {
"type": ["string", "null"],
"maxLength": 50
},
"referral_system": {
"type": ["string", "null"],
"enum": ["referral_candy", "referral_saasquatch", "friendbuy"]
}
}
}
},
"contacts": {
"type": "array",
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 150
},
"first_name": {
@@ -332,7 +332,6 @@
},
"email": {
"type": ["string", "null"],
"format": "email",
"maxLength": 70
},
"phone": {
@@ -356,10 +355,10 @@
}
},
"payment_method": {
"type": "object",
"type": ["object", "null"],
"properties": {
"type": {
"type": "array",
"type": ["string", "null"],
"enum": [
"card",
"paypal_express_checkout",
@@ -376,13 +375,10 @@
"bancontact",
"giropay",
"dotpay"
],
"items": {
"type": "string"
}
]
},
"gateway": {
"type": "array",
"type": ["string", "null"],
"enum": [
"chargebee",
"stripe",
@@ -423,30 +419,24 @@
"ingenico_direct",
"exact",
"not_applicable"
],
"items": {
"type": "string"
}
]
},
"gateway_account_id": {
"type": ["string", "null"],
"maxLength": 50
},
"status": {
"type": "array",
"type": ["string", "null"],
"enum": [
"valid",
"expiring",
"expired",
"invalid",
"pending_verification"
],
"items": {
"type": "string"
}
]
},
"reference_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 200
}
}
@@ -454,26 +444,26 @@
"balances": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"promotional_credits": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"excess_payments": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"refundable_credits": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"unbilled_charges": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"currency_code": {
"type": "string",
"type": ["string", "null"],
"maxLength": 3
}
}
@@ -486,7 +476,7 @@
"type": ["string", "null"],
"maxLength": 50
},
"parent_owner_id": {
"payment_owner_id": {
"type": ["string", "null"],
"maxLength": 50
},
@@ -497,63 +487,56 @@
}
},
"parent_account_access": {
"type": "object",
"type": ["object", "null"],
"properties": {
"portal_edit_child_subscriptions": {
"type": ["array", "null"],
"enum": ["yes", "view_only", "no"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["yes", "view_only", "no"]
},
"portal_download_child_invoices": {
"type": ["array", "null"],
"enum": ["yes", "view_only", "no"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["yes", "view_only", "no"]
},
"send_subscription_emails": {
"type": "boolean"
"type": ["boolean", "null"]
},
"send_invoice_emails": {
"type": "boolean"
"type": ["boolean", "null"]
},
"send_payment_emails": {
"type": "boolean"
"type": ["boolean", "null"]
}
}
},
"child_account_access": {
"type": ["object", "null"],
"properties": {
"portal_edit_child_subscriptions": {
"type": ["string", "null"],
"enum": ["yes", "view_only"]
},
"portal_download_child_invoices": {
"type": ["string", "null"],
"enum": ["yes", "view_only", "no"]
},
"send_subscription_emails": {
"type": ["boolean", "null"]
},
"send_invoice_emails": {
"type": ["boolean", "null"]
},
"send_payment_emails": {
"type": ["boolean", "null"]
}
}
},
"card_status": {
"type": ["string", "null"]
},
"child_account_access": {
"type": "object",
"properties": {
"portal_edit_child_subscriptions": {
"type": ["array", "null"],
"enum": ["yes", "view_only", "no"],
"items": {
"type": "string"
}
},
"portal_download_child_invoices": {
"type": ["array", "null"],
"enum": ["yes", "view_only", "no"],
"items": {
"type": "string"
}
},
"send_subscription_emails": {
"type": "boolean"
},
"send_invoice_emails": {
"type": "boolean"
},
"send_payment_emails": {
"type": "boolean"
}
}
},
"card_status": { "type": "string" },
"meta_data": { "type": "string" }
"meta_data": {
"type": ["object", "null"],
"properties": {}
}
}
}

View File

@@ -4,7 +4,7 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"po_number": {
@@ -12,7 +12,7 @@
"maxLength": 100
},
"customer_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"subscription_id": {
@@ -20,28 +20,22 @@
"maxLength": 50
},
"recurring": {
"type": "boolean"
"type": ["boolean", "null"]
},
"status": {
"type": "array",
"enum": ["paid", "posted", "payment_due", "not_paid", "void", "pending"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["paid", "posted", "payment_due", "not_paid", "void", "pending"]
},
"vat_number": {
"type": ["string", "null"],
"maxLength": 20
},
"price_type": {
"type": "array",
"enum": ["tax_exclusive", "tax_inclusive"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["tax_exclusive", "tax_inclusive"]
},
"date": {
"type": "integer"
"type": ["integer", "null"]
},
"due_date": {
"type": ["integer", "null"]
@@ -49,6 +43,11 @@
"net_term_days": {
"type": ["integer", "null"]
},
"exchange_rate": {
"type": ["number", "null"],
"minimum": 0.000000001,
"maximum": 999999999.999999999
},
"currency_code": {
"type": ["string", "null"],
"maxLength": 3
@@ -81,11 +80,8 @@
"type": ["integer", "null"]
},
"dunning_status": {
"type": ["array", "null"],
"enum": ["in_progress", "exhausted", "stopped", "success"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["in_progress", "exhausted", "stopped", "success"]
},
"next_retry_at": {
"type": ["integer", "null"]
@@ -100,7 +96,7 @@
"type": ["integer", "null"]
},
"sub_total": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"sub_total_in_local_currency": {
@@ -112,24 +108,30 @@
"minimum": 0
},
"local_currency_code": {
"type": "string",
"maxLength": 3
"type": ["string", "null"]
},
"tax": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"first_invoice": {
"type": ["boolean", "null"]
},
"new_sales_amount": {
"type": ["integer", "null"],
"minimum": 0
},
"has_advance_charges": {
"type": ["boolean", "null"]
},
"term_finalized": {
"type": "boolean"
"type": ["boolean", "null"]
},
"is_gifted": {
"type": "boolean"
"type": ["boolean", "null"]
},
"generated_at": {
"type": ["integer", "null"]
},
"expected_payment_date": {
"type": ["integer", "null"]
@@ -145,12 +147,13 @@
"payment_owner": {
"type": ["string", "null"]
},
"void_reason_code": {
"type": ["string", "null"],
"maxLength": 100
},
"deleted": {
"type": "boolean"
"type": ["boolean", "null"]
},
"vat_number_prefix": {
"type": ["string", "null"],
@@ -159,7 +162,7 @@
"line_items": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": ["string", "null"],
@@ -167,13 +170,16 @@
},
"subscription_id": {
"type": ["string", "null"],
"maxLength": 3
"maxLength": 50
},
"date_from": {
"type": "integer"
"type": ["integer", "null"]
},
"date_to": {
"type": "integer"
"type": ["integer", "null"]
},
"unit_amount": {
"type": ["integer", "null"]
},
"quantity": {
"type": ["integer", "null"]
@@ -182,14 +188,11 @@
"type": ["integer", "null"]
},
"pricing_model": {
"type": "array",
"enum": ["flat_fee", "per_unit", "tiered", "volume", "stairstep"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["flat_fee", "per_unit", "tiered", "volume", "stairstep"]
},
"is_taxed": {
"type": "boolean"
"type": ["boolean", "null"]
},
"tax_amount": {
"type": ["integer", "null"],
@@ -221,27 +224,29 @@
"minimum": 0
},
"description": {
"type": "string",
"type": ["string", "null"],
"maxLength": 250
},
"entity_description": {
"type": "string",
"type": ["string", "null"],
"maxLength": 500
},
"entity_type": {
"type": "array",
"type": ["string", "null"],
"enum": [
"adhoc",
"plan_setup",
"plan",
"addon",
"plan_item_price",
"addon_item_price",
"charge_item_price"
],
"items": {
"type": "string"
}
]
},
"tax_exempt_reason": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"tax_not_configured",
"region_non_taxable",
@@ -251,10 +256,7 @@
"zero_rated",
"reverse_charge",
"high_value_physical_goods"
],
"items": {
"type": "string"
}
]
},
"entity_id": {
"type": ["string", "null"],
@@ -270,10 +272,10 @@
"discounts": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"amount": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"description": {
@@ -281,16 +283,13 @@
"maxLength": 250
},
"entity_type": {
"type": "array",
"type": ["string", "null"],
"enum": [
"item_level_coupon",
"document_level_coupon",
"promotional_credits",
"prorated_credits"
],
"items": {
"type": "string"
}
]
},
"entity_id": {
"type": ["string", "null"],
@@ -302,31 +301,29 @@
"line_item_discounts": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"line_item_id": {
"type": "string",
"maxLength": 40
"type": ["string", "null"],
"maxLength": 50
},
"discount_type": {
"type": "array",
"type": ["string", "null"],
"enum": [
"item_level_coupon",
"document_level_coupon",
"promotional_credits",
"prorated_credits"
],
"items": {
"type": "string"
}
]
},
"discount_amount": {
"type": ["integer", "null"],
"minimum": 0
},
"entity_id": {
"type": ["string", "null"],
"maxLength": 100
},
"discount_amount": {
"type": "integer",
"minumum": 0
}
}
}
@@ -334,15 +331,15 @@
"taxes": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"name": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
},
"amount": {
"type": "integer",
"minumum": 0
"type": ["integer", "null"],
"minimum": 0
},
"description": {
"type": ["string", "null"],
@@ -354,14 +351,14 @@
"line_item_taxes": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"line_item_id": {
"type": ["string", "null"],
"maxLength": 40
},
"tax_name": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
},
"tax_rate": {
@@ -376,11 +373,15 @@
"type": ["boolean", "null"]
},
"taxable_amount": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"tax_amount": {
"type": ["integer", "null"],
"minimum": 0
},
"tax_juris_type": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"country",
"federal",
@@ -390,10 +391,7 @@
"special",
"unincorporated",
"other"
],
"items": {
"type": "string"
}
]
},
"tax_juris_name": {
"type": ["string", "null"],
@@ -405,11 +403,10 @@
},
"tax_amount_in_local_currency": {
"type": ["integer", "null"],
"minumum": 0
"minimum": 0
},
"local_currency-code": {
"type": ["string", "null"],
"maxLength": 3
"type": ["string", "null"]
}
}
}
@@ -417,25 +414,25 @@
"line_item_tiers": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"line_item_id": {
"type": ["string", "null"],
"maxLength": 40
},
"starting_unit": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"ending_unit": {
"type": "integer"
"type": ["integer", "null"]
},
"quantity_used": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"unit_amount": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"starting_unit_in_decimal": {
@@ -460,21 +457,21 @@
"linked_payments": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"txn_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 40
},
"applied_amount": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"applied_at": {
"type": "integer"
"type": ["integer", "null"]
},
"txn_status": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"in_progress",
"success",
@@ -482,10 +479,7 @@
"failure",
"timeout",
"needs_attention"
],
"items": {
"type": "string"
}
]
},
"txn_date": {
"type": ["integer", "null"]
@@ -500,27 +494,24 @@
"dunning_attempts": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"attempt": {
"type": "integer"
"type": ["integer", "null"]
},
"transaction_id": {
"type": ["string", "null"],
"maxLength": 40
},
"dunning_type": {
"type": "array",
"enum": ["auto_collect", "offline", "direct_debit"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["auto_collect", "offline", "direct_debit"]
},
"created_at": {
"type": ["integer", "null"]
},
"txn_status": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"in_progress",
"success",
@@ -528,10 +519,7 @@
"failure",
"timeout",
"needs_attention"
],
"items": {
"type": "string"
}
]
},
"txn_amount": {
"type": ["integer", "null"],
@@ -543,30 +531,35 @@
"applied_credits": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"cn_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"applied_amount": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"applied_at": {
"type": "integer"
"type": ["integer", "null"]
},
"cn_reason_code": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"write_off",
"subscription_change",
"subscription_cancellation",
"subscription_pause"
],
"items": {
"type": "string"
}
"subscription_pause",
"chargeback",
"product_unsatisfactory",
"service_unsatisfactory",
"order_change",
"order_cancellation",
"waiver",
"other",
"fraudulent"
]
},
"cn_create_reason_code": {
"type": ["string", "null"],
@@ -576,11 +569,8 @@
"type": ["integer", "null"]
},
"cn_status": {
"type": ["array", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"]
}
}
}
@@ -588,23 +578,28 @@
"adjustment_credit_notes": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"cn_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"cn_reason_code": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"write_off",
"subscription_change",
"subscription_cancellation",
"subscription_pause"
],
"items": {
"type": "string"
}
"subscription_pause",
"chargeback",
"product_unsatisfactory",
"service_unsatisfactory",
"order_change",
"order_cancellation",
"waiver",
"other",
"fraudulent"
]
},
"cn_create_reason_code": {
"type": ["string", "null"],
@@ -618,11 +613,8 @@
"minimum": 0
},
"cn_status": {
"type": ["array", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"]
}
}
}
@@ -630,23 +622,28 @@
"issued_credit_notes": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"cn_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"cn_reason_code": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"write_off",
"subscription_change",
"subscription_cancellation",
"subscription_pause"
],
"items": {
"type": "string"
}
"subscription_pause",
"chargeback",
"product_unsatisfactory",
"service_unsatisfactory",
"order_change",
"order_cancellation",
"waiver",
"other",
"fraudulent"
]
},
"cn_create_reason_code": {
"type": ["string", "null"],
@@ -660,11 +657,8 @@
"minimum": 0
},
"cn_status": {
"type": ["array", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"]
}
}
}
@@ -672,18 +666,18 @@
"linked_orders": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 40
},
"document_number": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"status": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"new",
"processing",
@@ -697,21 +691,15 @@
"shipped",
"partially_delivered",
"returned"
],
"items": {
"type": "string"
}
]
},
"order_type": {
"type": ["array", "null"],
"enum": ["manual", "system_generated"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["manual", "system_generated"]
},
"reference_id": {
"type": ["string", "null"],
"maxLength": 40
"maxLength": 50
},
"fulfillment_status": {
"type": ["string", "null"],
@@ -722,7 +710,7 @@
"maxLength": 50
},
"created_at": {
"type": "integer"
"type": ["integer", "null"]
}
}
}
@@ -730,35 +718,36 @@
"notes": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"entity_type": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"coupon",
"subscription",
"customer",
"plan",
"addon",
"plan_item_price",
"addon_item_price",
"charge_item_price"
],
"items": {
"type": "string"
}
]
},
"note": {
"type": ["string", "null"],
"maxLength": 2000
},
"entity_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
}
}
}
},
"shipping_address": {
"type": "object",
"type": ["object", "null"],
"properties": {
"first_name": {
"type": ["string", "null"],
@@ -770,7 +759,6 @@
},
"email": {
"type": ["string", "null"],
"format": "email",
"maxLength": 70
},
"company": {
@@ -814,16 +802,13 @@
"maxLength": 20
},
"validation_status": {
"type": "array",
"enum": ["not_validated", "valid", "partially_valid", "invalid"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["not_validated", "valid", "partially_valid", "invalid"]
}
}
},
"billing_address": {
"type": "object",
"type": ["object", "null"],
"properties": {
"first_name": {
"type": ["string", "null"],
@@ -835,7 +820,6 @@
},
"email": {
"type": ["string", "null"],
"format": "email",
"maxLength": 70
},
"company": {
@@ -848,7 +832,7 @@
},
"line1": {
"type": ["string", "null"],
"maxLength": 180
"maxLength": 150
},
"line2": {
"type": ["string", "null"],
@@ -879,11 +863,8 @@
"maxLength": 20
},
"validation_status": {
"type": "array",
"enum": ["not_validated", "valid", "partially_valid", "invalid"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["not_validated", "valid", "partially_valid", "invalid"]
}
}
}

View File

@@ -4,7 +4,7 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 40
},
"document_number": {
@@ -24,7 +24,7 @@
"maxLength": 50
},
"status": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"new",
"processing",
@@ -38,13 +38,10 @@
"shipped",
"partially_delivered",
"returned"
],
"items": {
"property": "string"
}
]
},
"cancellation_reason": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"shipping_cut_off_passed",
"product_unsatisfactory",
@@ -60,31 +57,19 @@
"product_not_available",
"others",
"order_resent"
],
"items": {
"property": "string"
}
]
},
"payment_status": {
"type": ["array", "null"],
"enum": ["not_paid", "paid"],
"items": {
"property": "string"
}
"type": ["string", "null"],
"enum": ["not_paid", "paid"]
},
"order_type": {
"type": ["array", "null"],
"enum": ["manual", "system_generated"],
"items": {
"property": "string"
}
"type": ["string", "null"],
"enum": ["manual", "system_generated"]
},
"price_type": {
"type": ["array", "null"],
"enum": ["tax_inclusive", "tax_exclusive"],
"items": {
"property": "string"
}
"type": ["string", "null"],
"enum": ["tax_inclusive", "tax_exclusive"]
},
"reference_id": {
"type": ["string", "null"],
@@ -108,10 +93,14 @@
"type": ["string", "null"],
"maxLength": 50
},
"batch_id": {
"tracking_url": {
"type": ["string", "null"],
"maxLength": 255
},
"batch_id": {
"type": ["string", "null"],
"maxLength": 50
},
"created_by": {
"type": ["string", "null"],
"maxLength": 50
@@ -120,6 +109,7 @@
"type": ["string", "null"],
"maxLength": 50
},
"invoice_round_off_amount": {
"type": ["integer", "null"],
"minimum": 0
@@ -154,7 +144,7 @@
"type": ["integer", "null"]
},
"created_at": {
"type": "integer"
"type": ["integer", "null"]
},
"status_update_at": {
"type": ["integer", "null"]
@@ -175,14 +165,11 @@
"type": ["integer", "null"]
},
"resent_status": {
"type": ["array", "null"],
"enum": ["fully_resent", "partially_resent"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["fully_resent", "partially_resent"]
},
"is_resent": {
"type": "boolean"
"type": ["boolean", "null"]
},
"original_order_id": {
"type": ["string", "null"],
@@ -201,7 +188,7 @@
"minimum": 0
},
"deleted": {
"type": "boolean"
"type": ["boolean", "null"]
},
"currency_code": {
"type": ["string", "null"],
@@ -225,18 +212,18 @@
"order_line_items": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 40
},
"invoice_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"invoice_line_item_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 40
},
"unit_price": {
@@ -244,7 +231,7 @@
"minimum": 0
},
"description": {
"type": "string",
"type": ["string", "null"],
"maxLength": 250
},
"amount": {
@@ -284,10 +271,11 @@
},
"sku": {
"type": ["string", "null"],
"maxLength": 100
"maxLength": 250
},
"status": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"queued",
"awaiting_shipment",
@@ -297,17 +285,21 @@
"partially_delivered",
"returned",
"cancelled"
],
"items": {
"type": "string"
}
]
},
"entity_type": {
"type": "array",
"enum": ["adhoc"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": [
"adhoc",
"plan_setup",
"plan",
"addon",
"plan_item_price",
"addon_item_price",
"charge_item_price"
]
},
"item_level_discount_amount": {
"type": ["integer", "null"],
@@ -319,13 +311,13 @@
},
"entity_id": {
"type": ["string", "null"],
"maxLength": 100
"maxLength": 50
}
}
}
},
"shipping_address": {
"type": "object",
"type": ["object", "null"],
"properties": {
"first_name": {
"type": ["string", "null"],
@@ -381,16 +373,13 @@
"maxLength": 20
},
"validation_status": {
"type": "array",
"enum": ["not_validated", "valid", "partially_valid", "invalid"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["not_validated", "valid", "partially_valid", "invalid"]
}
}
},
"billing_address": {
"type": "object",
"type": ["object", "null"],
"properties": {
"first_name": {
"type": ["string", "null"],
@@ -415,7 +404,7 @@
},
"line1": {
"type": ["string", "null"],
"maxLength": 180
"maxLength": 150
},
"line2": {
"type": ["string", "null"],
@@ -446,25 +435,22 @@
"maxLength": 20
},
"validation_status": {
"type": "array",
"enum": ["not_validated", "valid", "partially_valid", "invalid"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["not_validated", "valid", "partially_valid", "invalid"]
}
}
},
"line_item_taxes": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"line_item_id": {
"type": ["string", "null"],
"maxLength": 40
},
"tax_name": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
},
"tax_rate": {
@@ -479,15 +465,15 @@
"type": ["boolean", "null"]
},
"taxable_amount": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"tax_amount": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"tax_juris_type": {
"type": ["array", "null"],
"type": ["string", "null"],
"enum": [
"country",
"federal",
@@ -497,10 +483,7 @@
"special",
"unincorporated",
"other"
],
"items": {
"type": "string"
}
]
},
"tax_juris_name": {
"type": ["string", "null"],
@@ -512,11 +495,10 @@
},
"tax_amount_in_local_currency": {
"type": ["integer", "null"],
"minumum": 0
"minimum": 0
},
"local_currency-code": {
"type": ["string", "null"],
"maxLength": 3
"type": ["string", "null"]
}
}
}
@@ -524,31 +506,29 @@
"line_item_discounts": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"line_item_id": {
"type": "string",
"maxLength": 40
"type": ["string", "null"],
"maxLength": 50
},
"discount_type": {
"type": "array",
"type": ["string", "null"],
"enum": [
"item_level_coupon",
"document_level_coupon",
"promotional_credits",
"prorated_credits"
],
"items": {
"type": "string"
}
"prorated_credits",
"custom_discount"
]
},
"coupon_id": {
"type": ["string", "null"],
"maxLength": 50
},
"discount_amount": {
"type": "integer",
"minumum": 0
"type": ["integer", "null"],
"minimum": 0
}
}
}
@@ -556,29 +536,23 @@
"linked_credit_notes": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"amount": {
"type": ["integer", "null"],
"minimum": 0
},
"type": {
"type": "array",
"enum": ["adjustment", "refundable"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["adjustment", "refundable"]
},
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"status": {
"type": ["array", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["adjusted", "refunded", "refund_due", "voided"]
},
"amount_adjusted": {
"type": ["integer", "null"],
@@ -594,10 +568,10 @@
"resent_orders": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"order_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 40
},
"reason": {

View File

@@ -4,11 +4,11 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
},
"name": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"invoice_name": {
@@ -17,7 +17,7 @@
},
"description": {
"type": ["string", "null"],
"maxLength": 100
"maxLength": 500
},
"price": {
"type": ["integer", "null"],
@@ -28,52 +28,43 @@
"maxLength": 3
},
"period": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 1
},
"period_unit": {
"type": "array",
"enum": ["day", "week", "month", "year"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["day", "week", "month", "year"]
},
"trial_period": {
"type": ["integer", "null"],
"minimum": 0
"minimum": 1
},
"trial_period_unit": {
"type": ["array", "null"],
"enum": ["day", "month"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["day", "month"]
},
"trial_end_action": {
"type": ["string", "null"],
"enum": ["site_default", "activate_subscription", "cancel_subscription"]
},
"pricing_model": {
"type": "array",
"enum": ["flat_fee", "per_unit", "tiered", "volume", "stairstep"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["flat_fee", "per_unit", "tiered", "volume", "stairstep"]
},
"free_quantity": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"setup_cost": {
"type": ["integer", "null"],
"minimum": 0
"minimum": 1
},
"status": {
"type": "array",
"enum": ["active", "archived"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["active", "archived"]
},
"archived_at": {
"type": ["string", "null"],
"format": "date-time"
"type": ["integer", "null"]
},
"billing_cycles": {
"type": ["integer", "null"],
@@ -84,32 +75,26 @@
"maxLength": 500
},
"enabled_in_hosted_pages": {
"type": "boolean"
"type": ["boolean", "null"]
},
"enabled_in_portal": {
"type": "boolean"
"type": ["boolean", "null"]
},
"addon_applicability": {
"type": "array",
"enum": ["all", "restricted"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["all", "restricted"]
},
"tax_code": {
"type": ["string", "null"],
"maxLength": 59
"maxLength": 50
},
"taxjar_product_code": {
"type": ["string", "null"],
"maxLength": 59
"maxLength": 50
},
"avalara_sale_type": {
"type": ["array", "null"],
"enum": ["wholesale", "retail", "consumed", "vendor_use"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["wholesale", "retail", "consumed", "vendor_use"]
},
"avalara_transaction_type": {
"type": ["integer", "null"]
@@ -149,11 +134,8 @@
"minimum": 1
},
"shipping_frequency_period_unit": {
"type": ["array", "null"],
"enum": ["year", "month", "week", "day"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["year", "month", "week", "day"]
},
"resource_version": {
"type": ["integer", "null"]
@@ -162,7 +144,7 @@
"type": ["integer", "null"]
},
"giftable": {
"type": "boolean"
"type": ["boolean", "null"]
},
"claim_url": {
"type": ["string", "null"],
@@ -188,9 +170,9 @@
"maxLength": 50
},
"meta_data": {
"type": ["object", "null"]
"type": ["object", "null"],
"properties": {}
},
"show_description_in_invoices": {
"type": ["boolean", "null"]
},
@@ -200,17 +182,17 @@
"tiers": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"starting_unit": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 1
},
"ending_unit": {
"type": "integer"
"type": ["integer", "null"]
},
"price": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"starting_unit_in_decimal": {
@@ -231,10 +213,10 @@
"applicable_addons": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
}
}
@@ -243,14 +225,14 @@
"attached_addons": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
},
"quantity": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 1
},
"billing_cycles": {
@@ -258,11 +240,8 @@
"minimum": 1
},
"type": {
"type": "array",
"enum": ["recommended", "mandatory"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["recommended", "mandatory"]
},
"quantity_in_decimal": {
"type": ["string", "null"],
@@ -274,31 +253,28 @@
"event_based_addons": {
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 100
},
"quantity": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 1
},
"on_event": {
"type": "array",
"type": ["string", "null"],
"enum": [
"subscription_creation",
"subscription_trial_start",
"plan_activation",
"subscription_activation",
"contract_termination"
],
"items": {
"type": "string"
}
]
},
"charge_once": {
"type": "boolean"
"type": ["boolean", "null"]
},
"quantity_in_decimal": {
"type": ["string", "null"],

View File

@@ -4,12 +4,12 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"currency_code": {
"type": "string",
"maxLength": 50
"type": ["string", "null"],
"maxLength": 3
},
"start_date": {
"type": ["integer", "null"]
@@ -25,12 +25,20 @@
"type": ["string", "null"],
"maxLength": 100
},
"plan_quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"plan_unit_price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"customer_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"status": {
"type": "array",
"type": ["string", "null"],
"enum": [
"future",
"in_trial",
@@ -38,14 +46,20 @@
"non_renewing",
"paused",
"cancelled"
],
"items": {
"type": "string"
}
]
},
"trial_start": {
"type": ["integer", "null"]
},
"trial_end_action": {
"type": ["string", "null"],
"enum": [
"site_default",
"plan_default",
"activate_subscription",
"cancel_subscription"
]
},
"current_term_start": {
"type": ["integer", "null"]
},
@@ -65,7 +79,7 @@
"type": ["integer", "null"]
},
"contract_term_billing_cycle_on_renewal": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0,
"maximum": 100
},
@@ -82,7 +96,7 @@
"type": ["integer", "null"]
},
"cancel_reason": {
"type": "array",
"type": ["string", "null"],
"enum": [
"not_paid",
"no_card",
@@ -91,10 +105,7 @@
"tax_calculation_failed",
"currency_incompatible_with_gateway",
"non_compliant_customer"
],
"items": {
"type": "string"
}
]
},
"created_from_ip": {
"type": ["string", "null"],
@@ -107,10 +118,10 @@
"type": ["integer", "null"]
},
"has_scheduled_advance_invoices": {
"type": "boolean"
"type": ["boolean", "null"]
},
"has_scheduled_changes": {
"type": "boolean"
"type": ["boolean", "null"]
},
"payment_source_id": {
"type": ["string", "null"],
@@ -120,14 +131,6 @@
"type": ["string", "null"],
"maxLength": 33
},
"plan_quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"plan_unit_price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"plan_amount_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
@@ -150,7 +153,7 @@
"minimum": 0
},
"exchange_rate": {
"type": ["number"],
"type": ["number", "null"],
"minimum": 0.000000001,
"maximum": 999999999.999999999
},
@@ -163,10 +166,11 @@
"maxLength": 2000
},
"metadata": {
"type": ["object", "null"]
"type": ["object", "null"],
"properties": {}
},
"deleted": {
"type": "boolean"
"type": ["boolean", "null"]
},
"cancel_reason_code": {
"type": ["string", "null"],
@@ -176,11 +180,8 @@
"type": ["integer", "null"]
},
"free_period_unit": {
"type": ["array", "null"],
"enum": ["day", "week", "month", "year"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["day", "week", "month", "year"]
},
"create_pending_invoices": {
"type": ["boolean", "null"]
@@ -188,146 +189,10 @@
"auto_close_invoices": {
"type": ["boolean", "null"]
},
"subscription_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"item_price_id": {
"type": "string",
"maxLength": 100
},
"item_type": {
"type": "array",
"enum": ["plan", "addon", "charge"],
"items": {
"type": "string"
}
},
"quantity": {
"type": ["integer", "null"],
"minimum": 1
},
"quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"unit_price": {
"type": ["integer", "null"],
"minimum": 0
},
"unit_price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"amount": {
"type": ["integer", "null"],
"minimum": 0
},
"amount_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"free_quantity": {
"type": ["integer", "null"],
"minimum": 0
},
"free_quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"trial_end": {
"type": ["integer", "null"]
},
"billing_cycles": {
"type": ["integer", "null"],
"minimum": 0
},
"service_period_days": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 730
},
"charge_on_event": {
"type": ["array", "null"],
"enum": [
"subscription_creation",
"subscription_trial_start",
"plan_activation",
"subscription_activation",
"contract_termination"
],
"items": {
"type": "string"
}
},
"charge_once": {
"type": ["boolean", "null"]
},
"charge_on_option": {
"type": ["array", "null"],
"enum": ["immediately", "on_event"],
"items": {
"type": "string"
}
}
}
}
},
"item_tiers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"item_price_id": {
"type": "string",
"maxLength": 100
},
"starting_unit": {
"type": ["integer", "null"],
"minimum": 1
},
"ending_unit": {
"type": ["integer", "null"]
},
"price": {
"type": ["integer", "null"],
"minimum": 0
},
"starting_unit_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"ending_unit_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
}
}
}
},
"charged_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"item_price_id": {
"type": "string",
"maxLength": 100
},
"last_charged_at": {
"type": "integer"
}
}
}
},
"coupons": {
"type": "array",
"type": ["array", "null"],
"items": {
"type": "object",
"type": ["object", "null"],
"properties": {
"coupon_id": {
"type": "string",
@@ -337,7 +202,7 @@
"type": ["integer", "null"]
},
"apply_count": {
"type": "integer"
"type": ["integer", "null"]
},
"coupon_code": {
"type": ["string", "null"],
@@ -347,7 +212,7 @@
}
},
"shipping_address": {
"type": "object",
"type": ["object", "null"],
"properties": {
"first_name": {
"type": ["string", "null"],
@@ -403,16 +268,13 @@
"maxLength": 20
},
"validation_status": {
"type": "array",
"enum": ["not_validated", "valid", "partially_valid", "invalid"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["not_validated", "valid", "partially_valid", "invalid"]
}
}
},
"referral_info": {
"type": "object",
"type": ["object", "null"],
"properties": {
"referral_code": {
"type": ["string", "null"],
@@ -431,18 +293,12 @@
"maxLength": 50
},
"reward_status": {
"type": "array",
"enum": ["pending", "paid", "invalid"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["pending", "paid", "invalid"]
},
"referral_system": {
"type": "array",
"enum": ["referral_candy", "referral_saasquatch", "friendbuy"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["referral_candy", "referral_saasquatch", "friendbuy"]
},
"account_id": {
"type": ["string", "null"],
@@ -457,84 +313,68 @@
"maxLength": 100
},
"friend_offer_type": {
"type": "array",
"enum": ["none", "coupon", "coupon_code"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["none", "coupon", "coupon_code"]
},
"referrer_reward_type": {
"type": "array",
"type": ["string", "null"],
"enum": [
"none",
"referral_direct_reward",
"custom_promotional_credit",
"custom_revenue_percent_based"
],
"items": {
"type": "string"
}
]
},
"notify_referral_system": {
"type": "array",
"enum": ["none", "first_paid_conversion", "all_invoices"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["none", "first_paid_conversion", "all_invoices"]
},
"destination_url": {
"type": ["string", "null"],
"format": "email",
"maxLength": 250
},
"post_purchase_widget_enabled": {
"type": "boolean"
"type": ["boolean", "null"]
}
}
},
"contract_term": {
"type": "object",
"type": ["object", "null"],
"properties": {
"id": {
"type": ["string", "null"],
"maxLength": 50
},
"status": {
"type": ["string", "null"],
"enum": ["active", "completed", "cancelled", "terminated"]
},
"contract_start": {
"type": "integer"
"type": ["integer", "null"]
},
"contract_end": {
"type": "integer"
"type": ["integer", "null"]
},
"billing_cycle": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"action_at_term_end": {
"type": "array",
"enum": ["renew", "rgreen", "cancel", "renew_once"],
"items": {
"type": "string"
}
"type": ["string", "null"],
"enum": ["renew", "rgreen", "cancel", "renew_once"]
},
"total_contract_value": {
"type": "integer",
"type": ["integer", "null"],
"minimum": 0
},
"cancellation_cutoff_period": {
"type": ["integer", "null"]
},
"id": {
"type": "string",
"maxLength": 50
},
"status": {
"type": "array",
"enum": ["active", "completed", "cancelled", "terminated"],
"items": {
"type": "string"
}
},
"created_at": {
"type": "integer"
"type": ["integer", "null"]
},
"subscription_id": {
"type": "string",
"type": ["string", "null"],
"maxLength": 50
},
"remaining_billing_cycles": {
@@ -544,28 +384,291 @@
}
},
"plan_id": { "type": "string" },
"plan_quantity": { "type": "integer" },
"plan_unit_price": { "type": "string" },
"plan_amount": { "type": "integer" },
"plan_free_quantity": { "type": "string" },
"setup_fee": { "type": "string" },
"billing_period": { "type": "integer" },
"billing_period_unit": {
"subscription_items": {
"type": ["array", "null"],
"enum": ["day", "week", "month", "year"],
"items": {
"type": "string"
"type": ["object", "null"],
"properties": {
"item_price_id": {
"type": ["string", "null"],
"maxLength": 100
},
"item_type": {
"type": ["string", "null"],
"enum": ["plan", "addon", "charge"]
},
"quantity": {
"type": ["integer", "null"],
"minimum": 1
},
"quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"unit_price": {
"type": ["integer", "null"],
"minimum": 0
},
"unit_price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"amount": {
"type": ["integer", "null"],
"minimum": 0
},
"amount_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"free_quantity": {
"type": ["integer", "null"],
"minimum": 0
},
"free_quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"trial_end": {
"type": ["integer", "null"]
},
"billing_cycles": {
"type": ["integer", "null"],
"minimum": 0
},
"service_period_days": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 730
},
"charge_on_event": {
"type": ["string", "null"],
"enum": [
"subscription_creation",
"subscription_trial_start",
"plan_activation",
"subscription_activation",
"contract_termination"
]
},
"charge_once": {
"type": ["boolean", "null"]
},
"charge_on_option": {
"type": ["string", "null"],
"enum": ["immediately", "on_event"]
}
}
}
},
"item_tiers": {
"type": ["array", "null"],
"items": {
"type": ["object", "null"],
"properties": {
"item_price_id": {
"type": ["string", "null"],
"maxLength": 100
},
"starting_unit": {
"type": ["integer", "null"],
"minimum": 1
},
"ending_unit": {
"type": ["integer", "null"]
},
"price": {
"type": ["integer", "null"],
"minimum": 0
},
"starting_unit_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"ending_unit_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
}
}
}
},
"charged_items": {
"type": ["array", "null"],
"items": {
"type": ["object", "null"],
"properties": {
"item_price_id": {
"type": ["string", "null"],
"maxLength": 100
},
"last_charged_at": {
"type": ["integer", "null"]
}
}
}
},
"auto_collection": { "type": "string" },
"gift_id": { "type": "string" },
"affiliate_token": { "type": "string" },
"offline_payment_method": { "type": "string" },
"addons": { "type": "string" },
"event_based_addons": { "type": "string" },
"charged_event_based_addons": { "type": "string" }
"plan_id": {
"type": ["string", "null"],
"maxLength": 100
},
"plan_quantity": {
"type": ["integer", "null"],
"minimum": 1
},
"plan_unit_price": {
"type": ["integer", "null"],
"minimum": 1
},
"setup_fee": {
"type": ["integer", "null"],
"minimum": 0
},
"billing_period": {
"type": ["integer", "null"],
"minimum": 1
},
"billing_period_unit": {
"type": ["string", "null"],
"enum": ["day", "week", "month", "year"]
},
"auto_collection": {
"type": ["string", "null"],
"enum": ["on", "off"]
},
"plan_amount": {
"type": ["integer", "null"],
"minimum": 0
},
"plan_free_quantity": {
"type": ["integer", "null"],
"minimum": 0
},
"gift_id": {
"type": ["string", "null"],
"maxLength": 150
},
"affiliate_token": {
"type": ["string", "null"],
"maxLength": 250
},
"offline_payment_method": {
"type": ["string", "null"],
"enum": [
"no_preference",
"cash",
"check",
"bank_transfer",
"ach_credit",
"sepa_credit"
]
},
"meta_data": {
"type": ["object", "null"],
"properties": {}
},
"addons": {
"type": ["array", "null"],
"items": {
"type": ["object", "null"],
"properties": {
"id": {
"type": ["string", "null"],
"maxLength": 100
},
"quantity": {
"type": ["integer", "null"],
"minimum": 1
},
"unit_price": {
"type": ["integer", "null"],
"minimum": 0
},
"amount": {
"type": ["integer", "null"],
"minimum": 0
},
"trial_end": {
"type": ["integer", "null"]
},
"remaining_billing_cycles": {
"type": ["integer", "null"],
"minimum": 0
},
"quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"unit_price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"amount_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
}
}
}
},
"event_based_addons": {
"type": ["array", "null"],
"items": {
"type": ["object", "null"],
"properties": {
"id": {
"type": ["string", "null"],
"maxLength": 100
},
"quantity": {
"type": ["integer", "null"],
"minimum": 0
},
"unit_price": {
"type": ["integer", "null"],
"minimum": 0
},
"on_event": {
"type": ["string", "null"],
"enum": [
"subscription_creation",
"subscription_trial_start",
"plan_activation",
"subscription_activation",
"contract_termination"
]
},
"charge_once": {
"type": ["boolean", "null"]
},
"quantity_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
},
"unit_price_in_decimal": {
"type": ["string", "null"],
"maxLength": 33
}
}
}
},
"charged_event_based_addons": {
"type": ["array", "null"],
"items": {
"type": ["object", "null"],
"properties": {
"id": {
"type": ["string", "null"],
"maxLength": 100
},
"last_charged_at": {
"type": ["integer", "null"]
}
}
}
}
}
}

View File

@@ -22,205 +22,51 @@
# SOFTWARE.
#
from typing import Any, Iterable, List, Mapping, MutableMapping, Tuple
from typing import Any, List, Mapping, Tuple
import backoff
# Chargebee
import chargebee
import pendulum
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.models import SyncMode
# Airbyte
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from chargebee.api_error import OperationFailedError
from chargebee.list_result import ListResult # stores next_offset
from chargebee.models import Addon, Customer, Invoice, Order, Plan, Subscription
# Backoff params below
# according to Chargebee's guidance on rate limit
# https://apidocs.chargebee.com/docs/api?prod_cat_ver=2#api_rate_limits
MAX_TRIES = 10 # arbitrary max_tries
MAX_TIME = 90 # because Chargebee API enforce a per-minute limit
class ChargebeeStream(Stream):
supports_incremental = True
primary_key = "id"
default_cursor_field = "updated_at"
logger = AirbyteLogger()
def __init__(self):
self.next_offset = None
# Request params below
# according to Chargebee's guidance on pagination
# https://apidocs.chargebee.com/docs/api/#pagination_and_filtering
self.params = {
"limit": 100, # Limit at 100
"sort_by[asc]": self.default_cursor_field, # Sort ascending by updated_at
}
super().__init__()
@backoff.on_exception(
backoff.expo, # Exponential back-off
OperationFailedError, # Only on Chargebee's OperationFailedError
max_tries=MAX_TRIES,
max_time=MAX_TIME,
)
def _send_request(self) -> ListResult:
"""
Just a wrapper to allow @backoff decorator
Reference: https://apidocs.chargebee.com/docs/api/#error_codes_list
"""
# From Chargebee
# Link: https://apidocs.chargebee.com/docs/api/#api_rate_limits
list_result = self.api.list(self.params)
return list_result
def read_records(
self,
sync_mode: SyncMode,
cursor_field: List[str] = None,
stream_slice: Mapping[str, Any] = None,
stream_state: Mapping[str, Any] = None,
) -> Iterable[Mapping[str, Any]]:
"""
Override airbyte_cdk Stream's read_records method
"""
# Add offset to params if found
# Reference for Chargebee's pagination strategy below:
# https://apidocs.chargebee.com/docs/api/#pagination_and_filtering
pagination_completed = False
if stream_state:
self.params.update(stream_state)
# Loop until pagination is completed
while not pagination_completed:
# Request the ListResult object from Chargebee
# with back-off implemented through self._send_request()
list_result = self._send_request()
# Read message from results
for message in list_result:
yield message._response[self.name]
# Get next page token
self.next_offset = list_result.next_offset
if self.next_offset:
self.params.update({"offset": self.next_offset})
else:
pagination_completed = True
# Always return an empty generator just in case no records were ever yielded
yield from []
def get_updated_state(
self,
current_stream_state: MutableMapping[str, Any],
latest_record: Mapping[str, Any],
):
"""
Override airbyte_cdk Stream's get_updated_state method
to get the latest Chargebee stream state
"""
# Init the current_stream_state
current_stream_state = current_stream_state or {}
# Get current timestamp
# so Stream will sync all records
# that have been updated before now
now = pendulum.now().int_timestamp
current_stream_state.update(
{
"update_at[before]": now,
}
)
# Get the updated_at field from the latest record
# using Chargebee's Model class
# so Stream will sync all records
# that have been updated since then
print(latest_record)
latest_updated_at = latest_record.get("updated_at")
if latest_updated_at:
current_stream_state.update(
{
"update_at[after]": latest_updated_at,
}
)
return current_stream_state
class SubscriptionStream(ChargebeeStream):
name = "subscription"
api = Subscription
class CustomerStream(ChargebeeStream):
name = "customer"
api = Customer
class InvoiceStream(ChargebeeStream):
name = "invoice"
api = Invoice
class OrderStream(ChargebeeStream):
name = "order"
api = Order
class PlanStream(ChargebeeStream):
name = "plan"
api = Plan
class AddonStream(ChargebeeStream):
name = "addon"
api = Addon
from .streams import Addon, Customer, Invoice, Order, Plan, Subscription
class SourceChargebee(AbstractSource):
# Class variables
LIMIT = 100
def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, any]:
# Configure the Chargebee Python SDK
chargebee.configure(
api_key=config["site_api_token"],
site=config["site"],
)
chargebee.configure(api_key=config["site_api_key"], site=config["site"])
try:
# Get one subscription to test connection
Subscription.list(
# Set limit
# to test on a small dataset
params={
"limit": 1,
},
)
subscription_stream = Subscription(start_date=config["start_date"])
next(subscription_stream.read_records(sync_mode=SyncMode.full_refresh))
return True, None
except Exception as err:
# Should catch all exceptions
# which are already handled by
# Chargebee Python wrapper
# Should catch all exceptions which are already handled by Chargebee Python wrapper.
# https://github.com/chargebee/chargebee-python/blob/5346d833781de78a9eedbf9d12502f52c617c2d2/chargebee/http_request.py
return False, str(err)
return False, repr(err)
def streams(self, config) -> List[Stream]:
# Configure the Chargebee Python SDK
chargebee.configure(
api_key=config["site_api_token"],
site=config["site"],
)
# Add the streams
streams = [
SubscriptionStream(),
CustomerStream(),
InvoiceStream(),
OrderStream(),
PlanStream(),
AddonStream(),
chargebee.configure(api_key=config["site_api_key"], site=config["site"])
kwargs = {"start_date": config["start_date"]}
product_catalog_version = config["product_catalog"]
# Below streams are suitable for both `Product Catalog 1.0` and `Product Catalog 2.0`.
common_streams = [
Customer(**kwargs),
Invoice(**kwargs),
Order(**kwargs),
Subscription(**kwargs),
]
return streams
if product_catalog_version == "1.0":
# Below streams are suitable only for `Product Catalog 1.0`.
product_catalog_v1_streams = [
Addon(**kwargs),
Plan(**kwargs),
]
return common_streams + product_catalog_v1_streams
# Below streams are suitable only for `Product Catalog 2.0`.
return common_streams

View File

@@ -4,21 +4,34 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Chargebee Spec",
"type": "object",
"required": ["site", "site_api_token"],
"required": ["site", "site_api_key", "start_date", "product_catalog"],
"additionalProperties": false,
"properties": {
"site": {
"type": "string",
"title": "Site",
"description": "The site prefix for your Chargebee instance",
"examples": "kabo-test"
"description": "The site prefix for your Chargebee instance.",
"examples": "airbyte-test"
},
"site_api_token": {
"site_api_key": {
"type": "string",
"title": "API Key",
"description": "The API key from your Chargebee instance",
"examples": "test_3yzfanAXFcmUSdWC9wQcM9OCDQJkSYoppu",
"description": "The API key from your Chargebee instance.",
"examples": "test_3yzfanAXF66USdWC9wQcM555DQJkSYoppu",
"airbyte_secret": true
},
"start_date": {
"type": "string",
"title": "Start Date",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$",
"description": "UTC date and time in the format 2021-01-25T00:00:00Z. Any data before this date will not be replicated.",
"examples": ["2021-01-25T00:00:00Z"]
},
"product_catalog": {
"title": "Product Catalog",
"type": "string",
"description": "Product Catalog version of your Chargebee site. Instructions on how to find your version you may find <a href=\"https://apidocs.chargebee.com/docs/api?prod_cat_ver=2\">here</a> under `API Version` section.",
"enum": ["1.0", "2.0"]
}
}
}

View File

@@ -0,0 +1,194 @@
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional
import pendulum
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.streams import Stream
from chargebee import APIError
from chargebee.list_result import ListResult
from chargebee.model import Model
from chargebee.models import Addon as AddonModel
from chargebee.models import Customer as CustomerModel
from chargebee.models import Invoice as InvoiceModel
from chargebee.models import Order as OrderModel
from chargebee.models import Plan as PlanModel
from chargebee.models import Subscription as SubscriptionModel
from .rate_limiting import default_backoff_handler
# Backoff params below according to Chargebee's guidance on rate limit.
# https://apidocs.chargebee.com/docs/api?prod_cat_ver=2#api_rate_limits
MAX_TRIES = 10 # arbitrary max_tries
MAX_TIME = 90 # because Chargebee API enforce a per-minute limit
class ChargebeeStream(Stream):
primary_key = "id"
cursor_field = "updated_at"
page_size = 100
include_deleted = "true"
api: Model = None
def __init__(self, start_date: str):
# Convert `start_date` to timestamp(UTC).
self._start_date = pendulum.parse(start_date).int_timestamp
@property
def state_checkpoint_interval(self) -> int:
return self.page_size
def next_page_token(self, list_result: ListResult) -> Optional[Mapping[str, Any]]:
# Reference for Chargebee's pagination strategy below:
# https://apidocs.chargebee.com/docs/api/#pagination_and_filtering
if list_result:
next_offset = list_result.next_offset
if next_offset:
return {"offset": next_offset}
def request_params(
self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None
) -> MutableMapping[str, Any]:
params = {
"limit": self.page_size,
"include_deleted": self.include_deleted,
"sort_by[asc]": self.cursor_field,
}
if next_page_token:
params.update(next_page_token)
start_point = self._start_date
if stream_state:
start_point = max(start_point, stream_state[self.cursor_field])
params[f"{self.cursor_field}[after]"] = start_point
return params
def parse_response(self, list_result: ListResult, **kwargs) -> Iterable[Mapping]:
for message in list_result:
yield message._response[self.name]
@default_backoff_handler(max_tries=MAX_TRIES, factor=MAX_TIME)
def _send_request(self, **kwargs) -> ListResult:
"""
Just a wrapper to allow @backoff decorator
Reference: https://apidocs.chargebee.com/docs/api/#error_codes_list
"""
params = self.request_params(**kwargs)
return self.api.list(params)
def read_records(
self,
sync_mode: SyncMode,
cursor_field: List[str] = None,
stream_slice: Mapping[str, Any] = None,
stream_state: Mapping[str, Any] = None,
) -> Iterable[Mapping[str, Any]]:
"""
Override airbyte_cdk Stream's `read_records` method.
"""
stream_state = stream_state or {}
pagination_completed = False
next_page_token = None
while not pagination_completed:
try:
# Request the ListResult object from Chargebee with back-off implemented through self._send_request().
list_result = self._send_request(stream_state=stream_state, stream_slice=stream_slice, next_page_token=next_page_token)
except APIError as e:
self.logger.warn(str(e))
break
yield from self.parse_response(list_result, stream_state=stream_state, stream_slice=stream_slice)
next_page_token = self.next_page_token(list_result)
if not next_page_token:
pagination_completed = True
# Always return an empty generator just in case no records were ever yielded
yield from []
def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]):
"""
Override airbyte_cdk Stream's `get_updated_state` method to get the latest Chargebee stream state.
"""
state_value = current_stream_state or {}
latest_cursor_value = latest_record.get(self.cursor_field)
if latest_cursor_value:
state_value = {"updated_at": latest_cursor_value}
return state_value
class Subscription(ChargebeeStream):
"""
API docs: https://apidocs.chargebee.com/docs/api/subscriptions?prod_cat_ver=2#list_subscriptions
"""
api = SubscriptionModel
class Customer(ChargebeeStream):
"""
API docs: https://apidocs.chargebee.com/docs/api/customers?prod_cat_ver=2#list_customers
"""
api = CustomerModel
class Invoice(ChargebeeStream):
"""
API docs: https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2#list_invoices
"""
api = InvoiceModel
class Order(ChargebeeStream):
"""
API docs: https://apidocs.chargebee.com/docs/api/orders?prod_cat_ver=2#list_orders
"""
api = OrderModel
class Plan(ChargebeeStream):
"""
API docs: https://apidocs.chargebee.com/docs/api/plans?prod_cat_ver=1&lang=curl#list_plans
"""
api = PlanModel
class Addon(ChargebeeStream):
"""
API docs: https://apidocs.chargebee.com/docs/api/addons?prod_cat_ver=1&lang=curl#list_addons
"""
api = AddonModel

View File

@@ -9,7 +9,7 @@
* [Deploying Airbyte](deploying-airbyte/README.md)
* [Local Deployment](deploying-airbyte/local-deployment.md)
* [On AWS \(EC2\)](deploying-airbyte/on-aws-ec2.md)
* [On AWS ECS \(Coming Soon\)](deploying-airbyte/on-aws-ecs.md)
* [On AWS ECS \(Coming Soon\)](deploying-airbyte/on-aws-ecs.md)
* [On Azure\(VM\)](deploying-airbyte/on-azure-vm-cloud-shell.md)
* [On GCP \(Compute Engine\)](deploying-airbyte/on-gcp-compute-engine.md)
* [On Kubernetes \(Beta\)](deploying-airbyte/on-kubernetes.md)
@@ -35,6 +35,7 @@
* [Braintree](integrations/sources/braintree.md)
* [BigQuery](integrations/sources/bigquery.md)
* [Cart](integrations/sources/cart.md)
* [Chargebee](integrations/sources/chargebee.md)
* [ClickHouse](integrations/sources/clickhouse.md)
* [CockroachDB](integrations/sources/cockroachdb.md)
* [Db2](integrations/sources/db2.md)

View File

@@ -20,6 +20,7 @@ Airbyte uses a grading system for connectors to help users understand what to ex
|[Braintree](./sources/braintree.md)| Alpha |
|[BigQuery](./sources/bigquery.md)| Beta |
|[Cart](./sources/cart.md)| Beta |
|[Chargebee](./sources/chargebee.md)| Alpha |
|[ClickHouse](./sources/clickhouse.md)| Beta |
|[CockroachDB](./sources/cockroachdb.md)| Beta |
|[Db2](./sources/db2.md)| Beta |

View File

@@ -0,0 +1,72 @@
# Chargebee
## Overview
The Chargebee source supports both Full Refresh and Incremental syncs. You can choose if this connector will copy only the new or updated data, or all rows in the tables and columns you set up for replication, every time a sync is run.
This Chargebee source uses the [Chargebee Python Client Library](https://github.com/chargebee/chargebee-python/).
### Output schema
This connector outputs the following streams:
* [Subscriptions](https://apidocs.chargebee.com/docs/api/subscriptions?prod_cat_ver=2#list_subscriptions)
* [Customers](https://apidocs.chargebee.com/docs/api/customers?prod_cat_ver=2#list_customers)
* [Invoices](https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2#list_invoices)
* [Orders](https://apidocs.chargebee.com/docs/api/orders?prod_cat_ver=2#list_orders)
* [Plans](https://apidocs.chargebee.com/docs/api/plans?prod_cat_ver=1&lang=curl#list_plans)
* [Addons](https://apidocs.chargebee.com/docs/api/addons?prod_cat_ver=1&lang=curl#list_addons)
### Notes
Some streams may depend on Product Catalog version and be accessible only on sites with specific Product Catalog version. This means that we have following streams:
1. presented in both `Product Catalog 1.0` and `Product Catalog 2.0`:
- Subscriptions
- Customers
- Invoices
- Orders
2. presented only in `Product Catalog 1.0`:
- Plans
- Addons
3. presented only in `Product Catalog 2.0` will be added soon.
### Features
| Feature | Supported? |
| :--- | :--- |
| Full Refresh Sync | Yes |
| Incremental - Append Sync | Yes |
| Replicate Incremental Deletes | No |
| SSL connection | Yes |
| Namespaces | No |
### Performance considerations
The Chargebee connector should not run into [Chargebee API](https://apidocs.chargebee.com/docs/api?prod_cat_ver=2#api_rate_limits) limitations under normal usage. Please [create an issue](https://github.com/airbytehq/airbyte/issues) if you see any rate limit issues that are not automatically retried successfully.
## Getting started
### Requirements
* Chargebee Account;
* `site_api_key` - Chargebee API Key wih the necessary permissions \(described below\);
* `site` - Chargebee site prefix for your instance;
* `start_date` - start date for incremental streams;
* `product_catalog` - Product Catalog version of your Chargebee site \(described below\).
### Setup guide
Log into Chargebee and then generate an [API Key](https://apidocs.chargebee.com/docs/api?prod_cat_ver=2#api_authentication).
Then follow [these](https://apidocs.chargebee.com/docs/api?prod_cat_ver=2) instructions, under `API Version` section, on how to find your Product Catalog version.
## Changelog
| Version | Date | Pull Request | Subject |
| :------ | :-------- | :----- | :------ |
| 0.1.2 | 2021-07-30 | [5067](https://github.com/airbytehq/airbyte/pull/5067) | Prepare connector for publishing |
| 0.1.1 | 2021-07-07 | [4539](https://github.com/airbytehq/airbyte/pull/4539) | Add entrypoint and bump version for connector |
| 0.1.0 | 2021-06-30 | [3410](https://github.com/airbytehq/airbyte/pull/3410) | New Source: Chargebee |

View File

@@ -43,6 +43,7 @@ write_standard_creds source-aws-cloudtrail "$SOURCE_AWS_CLOUDTRAIL_CREDS"
write_standard_creds source-bigquery "$BIGQUERY_TEST_CREDS" "credentials.json"
write_standard_creds source-braintree-singer "$BRAINTREE_TEST_CREDS"
write_standard_creds source-cart "$CART_TEST_CREDS"
write_standard_creds source-chargebee "$CHARGEBEE_INTEGRATION_TEST_CREDS"
write_standard_creds source-drift "$DRIFT_INTEGRATION_TEST_CREDS"
write_standard_creds source-exchange-rates "$EXCHANGE_RATES_TEST_CREDS"
write_standard_creds source-file "$GOOGLE_CLOUD_STORAGE_TEST_CREDS" "gcs.json"