diff --git a/tap_stripe/__init__.py b/tap_stripe/__init__.py index daa488e3..c4f75897 100755 --- a/tap_stripe/__init__.py +++ b/tap_stripe/__init__.py @@ -27,7 +27,7 @@ 'customers': {'sdk_object': stripe.Customer, 'key_properties': ['id']}, 'plans': {'sdk_object': stripe.Plan, 'key_properties': ['id']}, 'payment_intents': {'sdk_object': stripe.PaymentIntent, 'key_properties': ['id']}, - 'invoices': {'sdk_object': stripe.Invoice, 'key_properties': ['id']}, + 'invoices': {'sdk_object': stripe.Invoice, 'key_properties': ['id', 'billing_reason']}, 'invoice_items': {'sdk_object': stripe.InvoiceItem, 'key_properties': ['id']}, 'invoice_line_items': {'sdk_object': stripe.InvoiceLineItem, 'key_properties': ['id', 'invoice']}, @@ -1055,8 +1055,7 @@ def sync_event_updates(stream_name, is_sub_stream): sync_sub_stream(sub_stream_name, event_resource_obj, updates=True) - if events_obj.created > max_created: - max_created = events_obj.created + max_created = max(events_obj.created, max_created) # The events stream returns results in descending order, so we # cannot bookmark until the entire page is processed diff --git a/tests/base.py b/tests/base.py index c229dc9d..b4a6a23e 100644 --- a/tests/base.py +++ b/tests/base.py @@ -85,7 +85,12 @@ def expected_metadata(self): 'customers': default, 'plans': default, 'payment_intents': default, - 'invoices': default, + 'invoices': { + self.AUTOMATIC_FIELDS: {"updated"}, + self.REPLICATION_KEYS: {"created"}, + self.PRIMARY_KEYS: {"id", "billing_reason"}, + self.REPLICATION_METHOD: self.INCREMENTAL, + }, 'invoice_items': { self.AUTOMATIC_FIELDS: {"updated"}, self.REPLICATION_KEYS: {"date"},