Skip to content

Commit

Permalink
Set begin date for payments to be fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
amakarudze committed Aug 5, 2024
1 parent e14d094 commit 26d4b81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stripe_payments/management/commands/fetch_payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# and store them in the database as StripeCharge objects.

import logging
from datetime import datetime

import stripe
from django.conf import settings
Expand Down Expand Up @@ -35,10 +36,11 @@ def handle(self, *args, **options):
# stripe.api_version = settings.STRIPE_API_VERSION

# Fetch the Stripe charges.
begin = datetime(2024, 8, 1)

stripe_charges = stripe.Charge.list(
limit=100,
created={"gt": int(last_fetched.timestamp())} if last_fetched else None,
created={"gt": int(last_fetched.timestamp())} if last_fetched else {"gt": int(begin.timestamp())},
expand=[
"data.customer",
],
Expand Down

0 comments on commit 26d4b81

Please sign in to comment.