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

Search for new payments #253

Open
Jorin71 opened this issue Oct 20, 2022 · 1 comment
Open

Search for new payments #253

Jorin71 opened this issue Oct 20, 2022 · 1 comment

Comments

@Jorin71
Copy link

Jorin71 commented Oct 20, 2022

I am in need of loading payments since I last loaded payments. Earlier I could set a Date filter (DateFrom) but that is not working anymore. I will do this for 100s of companies in Fortnox daily and the customers have 1000s of payments each, in some cases over 100,000 payments. It is very time consuming and load all payments and compare all payments for the once I already handled every day. Currently, the job takes 11 hours and this will of course keep increasing if I can't filter on something.
I then tried to reverse the sort order (the current order is date) to get the paints decending. That way I could just load 100 per round until I passed the last date I did the fetch, but the search ignored the sort order flag completely.

Is there a way (any way) to limit the search for payments (all invoices for a specific customer)? If not using the InvoicePaymentSearch, then perhaps by using BaseSearch, or another more general search class? If not, can I solve this by bypassing the .Net library and do it via direct API calls? I haven't found a way as of now.

@richardrandak
Copy link
Collaborator

richardrandak commented Oct 20, 2022

The InvoicePaymentSearch includes all the parameters of the BaseSearch. I can not guarantee they all work, that's up to the API server, but you can try it. I checked LastModified, which could be useful as a backup, it works.
FromDate seems to work only with some endpoints, but not with payments.

So, I would suggest to use LastModified parameter to give you only entries modified since you last time executed your program. You have to remember when the last execution was done, naturally. The only problem I see is that maybe some payments you do not want to process just yet so you skip them, but they won't be shown next time if not modified. You have to think whether this can a problem in your use-case.

Another note, you can use Limit (parameter in the search) up to 500, so that the pages will be larger. This way, it will take less number of requests, which will speed the execution a lot, since currently, only 4 requests can be executed per second.

Best way is to ask the Fortnox support, if there is any filter for the payment date available in the API. If yes, then let me know, so I can implement it in the SDK. I don't have the resources to investigate the API by myself, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants