Skip to content

Commit 03689c1

Browse files
committed
Fetch OpenPix transactions
1 parent 656d042 commit 03689c1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

thebook/webhooks/openpix/services.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import datetime
22
import decimal
33

4+
import jmespath
45
import requests
56

67
from django.conf import settings
@@ -30,7 +31,7 @@ def fetch_transactions(start_date: datetime.date, end_date: datetime.date):
3031
)
3132
data = response.json()
3233

33-
transactions = jmespath("transactions", data)
34+
transactions = jmespath.search("transactions", data)
3435
for transaction in transactions:
3536
transaction_type = jmespath.search("type", transaction)
3637
if transaction_type != "WITHDRAW":
@@ -42,10 +43,6 @@ def fetch_transactions(start_date: datetime.date, end_date: datetime.date):
4243
).date()
4344
transaction_amount = -1 * jmespath.search("value", transaction) / 100
4445

45-
utc_transaction_date = datetime.datetime.strptime(
46-
raw_date, "%Y-%m-%dT%H:%M:%SZ"
47-
)
48-
4946
Transaction.objects.create(
5047
reference=transaction_id,
5148
date=transaction_date,

0 commit comments

Comments
 (0)