Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api version upgrade #181

Merged
merged 14 commits into from Aug 29, 2023
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -11,7 +11,7 @@
py_modules=["tap_stripe"],
install_requires=[
"singer-python==5.5.1",
"stripe==2.64.0",
"stripe==5.5.0",
],
extras_require={
'test': [
Expand Down
6 changes: 3 additions & 3 deletions tap_stripe/__init__.py
Expand Up @@ -98,7 +98,7 @@
STREAM_TO_EXPAND_FIELDS = {
# `tax_ids` field is not included in API response by default. To include it in the response, pass it in expand paramater.
# Reference: https://stripe.com/docs/api/customers/object#customer_object-tax_ids

'charges': ['data.refunds'],
'customers': ['data.sources', 'data.subscriptions', 'data.tax_ids'],
'plans': ['data.tiers'],
'invoice_items': ['data.plan.tiers'],
Expand Down Expand Up @@ -152,7 +152,7 @@ def new_list(self, api_key=None, stripe_version=None, stripe_account=None, **par
api_key=api_key,
stripe_version=stripe_version,
stripe_account=stripe_account,
**params
params=params
)
stripe_object._retrieve_params = params # pylint: disable=protected-access
return stripe_object
Expand Down Expand Up @@ -247,7 +247,7 @@ def configure_stripe_client():
# https://github.com/stripe/stripe-python/tree/a9a8d754b73ad47bdece6ac4b4850822fa19db4e#usage
stripe.api_key = Context.config.get('client_secret')
# Override the Stripe API Version for consistent access
stripe.api_version = '2020-08-27'
stripe.api_version = '2022-11-15'
# Allow ourselves to retry retryable network errors 15 times
# https://github.com/stripe/stripe-python/tree/a9a8d754b73ad47bdece6ac4b4850822fa19db4e#configuring-automatic-retries
stripe.max_network_retries = 15
Expand Down
14 changes: 14 additions & 0 deletions tap_stripe/schemas/invoices.json
Expand Up @@ -783,6 +783,20 @@
"string"
]
},
"subscription_details": {
"type": [
"null",
"object"
],
"properties": {
"metadata": {
"type": [
"null",
"string"
]
}
}
},
"status": {
"type": [
"null",
Expand Down
22 changes: 6 additions & 16 deletions tap_stripe/schemas/payment_intents.json
Expand Up @@ -46,22 +46,12 @@
"string"
]
},
"charges": {
"anyOf": [
{
"type": [
"null",
"array"
],
"items": {
"$ref": "shared/charge.json#/"
}
},
{
"$ref": "shared/charge.json#/"
}
]
},
"latest_charge": {
"type": [
"null",
"string"
]
},
"currency": {
"type": [
"null",
Expand Down
212 changes: 163 additions & 49 deletions tap_stripe/schemas/shared/charge.json
Expand Up @@ -366,7 +366,168 @@
"null",
"array"
],
"items": {}
"items": {
"type": [
"null",
"object"
],
"properties": {
"id": {
"type": [
"null",
"string"
]
},
"object": {
"type": [
"null",
"string"
]
},
"amount": {
"type": [
"null",
"integer"
]
},
"balance_transaction": {
"type": [
"null",
"string"
]
},
"charge": {
"type": [
"null",
"string"
]
},
"created": {
"type": [
"null",
"string"
],
"format": "date-time"
},
"currency": {
"type": [
"null",
"string"
]
},
"description": {
"type": [
"null",
"string"
]
},
"failure_reason": {
"type": [
"null",
"string"
]
},
"instructions_email": {
"type": [
"null",
"string"
]
},
"metadata": {
"type": [
"null",
"object"
],
"properties": {}
},
"next_action": {
"type": [
"null",
"object"
],
"properties": {
"display_details": {
"type": [
"null",
"object"
],
"properties": {
"email_sent": {
"type": [
"null",
"object"
],
"properties": {
"email_sent_at": {
"type": [
"null",
"string"
],
"format": "date-time"
},
"email_sent_to": {
"type": [
"null",
"string"
]
}
}
},
"expires_at": {
"type": [
"null",
"string"
],
"format": "date-time"
}
}
},
"type": {
"type": [
"null",
"string"
]
}
}
},
"payment_intent": {
"type": [
"null",
"string"
]
},
"reason": {
"type": [
"null",
"string"
]
},
"receipt_number": {
"type": [
"null",
"string"
]
},
"source_transfer_reversal": {
"type": [
"null",
"string"
]
},
"status": {
"type": [
"null",
"string"
]
},
"transfer_reversal": {
"type": [
"null",
"string"
]
}
}
}
},
"application_fee": {
"type": [
Expand Down Expand Up @@ -1567,12 +1728,6 @@
],
"properties": {}
},
"type": {
"type": [
"null",
"string"
]
},
"wechat": {
"type": [
"null",
Expand All @@ -1587,12 +1742,6 @@
],
"properties": {}
},
"exp_month": {
"type": [
"null",
"integer"
]
},
"address_state": {
"type": [
"null",
Expand Down Expand Up @@ -1623,12 +1772,6 @@
"string"
]
},
"exp_year": {
"type": [
"null",
"integer"
]
},
"tokenization_method": {
"type": [
"null",
Expand All @@ -1641,24 +1784,12 @@
"string"
]
},
"fingerprint": {
"type": [
"null",
"string"
]
},
"address_city": {
"type": [
"null",
"string"
]
},
"last4": {
"type": [
"null",
"string"
]
},
"address_line2": {
"type": [
"null",
Expand All @@ -1671,18 +1802,6 @@
"string"
]
},
"brand": {
"type": [
"null",
"string"
]
},
"country": {
"type": [
"null",
"string"
]
},
"dynamic_last4": {
"type": [
"null",
Expand All @@ -1695,12 +1814,6 @@
"string"
]
},
"funding": {
"type": [
"null",
"string"
]
},
"address_zip": {
"type": [
"null",
Expand Down Expand Up @@ -1780,3 +1893,4 @@
}
}
}

6 changes: 4 additions & 2 deletions tests/test_all_fields.py
Expand Up @@ -47,7 +47,6 @@
'latest_revision',
'shipping_cost',
'shipping_details',
'subscription_details',
},
'payment_intents': set()
}
Expand Down Expand Up @@ -194,7 +193,9 @@
# 'invoice_item' is id of invoice item associated wih this line if any. # So, due to uncertainty of this field, skipped it.
'invoice_item'
},
'payment_intents': set()
'payment_intents': {
'charges'
}
}

KNOWN_FAILING_FIELDS = {
Expand Down Expand Up @@ -276,6 +277,7 @@
'hosted_invoice_url', # expect https://invoice.stripe.com/i/acct_14zvmQDcBSxinnbL/test...zcy0200wBekbjGw?s=ap
'invoice_pdf', # get https://invoice.stripe.com/i/acct_14zvmQDcBSxinnbL/test...DE102006vZ98t5I?s=ap
'payment_settings', # 'default_mandate' subfield unexpectedly present
'subscription_details'
},
'plans': set(),
'invoice_line_items': set()
Expand Down