Closed leondu closed 11 years ago
Hi,
for one: thanks for report. I will look into the issue as the transactions should actually be sorted by ID.
for the other point: the T1 denotes the transactions on your first account, T2 the ones on your second account and so forth, so you can assume that they are static for a given account.
Hi,
following up on the issue: the transactions are actually returned in booking order and not transaction ID order as the booking order is the more natural sorting. For querying the API, you can so simply go for the max transaction ID, as new entries will always have a higher ID then all pre-existing ones.
For many users the transactions will also be returned in ID order, but this actually depends on your banks server and in which cadence it lists transactions.
Thanks
@02strich
Sorry but I found something different with your description, with my demo account in figo I got 2 accounts back as below
[#<Figo::Account:0x007fadcbeaae40
@account_id="A1.1",
@account_number="4711951500",
@auto_sync=false,
@bank_code="90090042",
@bank_id="B1.1",
@bank_name="Demobank",
@bic="DEMODE01",
@currency="EUR",
@iban="DE67900900424711951500",
@icon="https://api.leanbank.com/assets/images/accounts/demokonto.png",
@in_total_balance=true,
@name="Girokonto",
@owner="figo",
@preferred_tan_scheme=nil,
@preview=false,
@save_pin=false,
@supported_payments={},
@supported_tan_schemes=[],
@type="Unknown">,
#<Figo::Account:0x007fadcbeb96e8
@account_id="A1.2",
@account_number="4711951501",
@auto_sync=false,
@bank_code="90090042",
@bank_id="B1.1",
@bank_name="Demobank",
@bic="DEMODE01",
@currency="EUR",
@iban="DE05900900424711951501",
@icon="https://api.leanbank.com/assets/images/accounts/demokonto.png",
@in_total_balance=true,
@name="Sparkonto",
@owner="figo",
@preferred_tan_scheme=nil,
@preview=false,
@save_pin=false,
]
but transactions I fetched from these 2 accounts are all starts with "T1", is this normal?
# first account
external_account.transactions.map(&:transaction_id)
["T1.5", "T1.6", "T1.7", "T1.8", "T1.9", "T1.10", "T1.11", "T1.12", "T1.13", "T1.14", "T1.15", "T1.16", "T1.17", "T1.18", "T1.19", "T1.20", "T1.21", "T1.22", "T1.23", "T1.24", "T1.25", "T1.26", "T1.27", "T1.28", "T1.29", "T1.30", "T1.31", "T1.32", "T1.33", "T1.34", "T1.35", "T1.36", "T1.37", "T1.38", "T1.39", "T1.40", "T1.41", "T1.42", "T1.43", "T1.44", "T1.45", "T1.46", "T1.47", "T1.48", "T1.49", "T1.50", "T1.51", "T1.52", "T1.53", "T1.54", "T1.55", "T1.56", "T1.57", "T1.58", "T1.59", "T1.60", "T1.61", "T1.62", "T1.63"]
# second account
external_account.transactions.map(&:transaction_id)
["T1.72", "T1.73", "T1.74", "T1.75", "T1.76", "T1.77", "T1.78", "T1.79", "T1.64", "T1.65", "T1.66", "T1.67", "T1.68", "T1.69", "T1.70", "T1.71", "T1.3", "T1.2", "T1.1"]
Hi,
could you please post a complete demo script for me to reproduce this?
Thanks
hi
just use a figo account has 2 or more accounts, then you can iterate each account and do
external_account.transactions.map(&:transaction_id)
you'll see the result
Hi,
I am very sorry for my mistake, but you are absolutely right. The first number in the Transaction ID is constant for all transactions of one user (which had been different in earlier versions). Albeit giving this assertion, the structure of the transaction ID should be opaque to your app, albeit they are asserted to be suitable for sorting the transactions.
Or provide a way to order transactions by transaction id.
According to the API doc, we can get all transactions back, and also we can provide a
transaction_id
so we can get transactions after the transaction_id.Problem is when I get transactions back, they are not ordered by transaction id, like bellow:
And I am not sure how could I get the last transaction and how this transaction_id is generated, am I safe to order it by numbers after the
T1.
part? Will it change to something likeT2.
?