ahivert / tgtg-python

Unofficial client for TooGoodToGo API
GNU General Public License v3.0
372 stars 71 forks source link

Add basic order methods #217

Closed Jurrie closed 1 year ago

Jurrie commented 1 year ago
Jurrie commented 1 year ago

This will only allow you to create orders, not to pay them. For this, you'll need additional methods.

Leon-Sander commented 1 year ago

I tried the create_order method, and it reserved the bag for me. But it was not visible in the app, I could not pay since in the app is no state of reserved and not paid, only paid which then is reserved. Do you know how it is possible to pay at this point?

Jurrie commented 1 year ago

Indeed; the app uses the create_order method to reserve a bag. After that, additional methods are invoked to pay for the order. These methods are different for every payment method. I only use one payment method, and didn't bother yet to dissect all those methods.

I thought I'd put these methods in a PR first, and wait to see if these get merged. After that, and when I have time (and feel like it) I'll have a crack at the methods needed for payment of orders. But since my PR is stale for a month now, I doubt it will get merged any time soon.

But, after reserving the bag, did you check "my account" (I mean the bottom right button) → "Mag Bags & Parcels saved"? Maybe it's listed there? (I don't know for sure if it should be listed there, just guessing.)

Leon-Sander commented 1 year ago

Indeed; the app uses the create_order method to reserve a bag. After that, additional methods are invoked to pay for the order. These methods are different for every payment method. I only use one payment method, and didn't bother yet to dissect all those methods.

I thought I'd put these methods in a PR first, and wait to see if these get merged. After that, and when I have time (and feel like it) I'll have a crack at the methods needed for payment of orders. But since my PR is stale for a month now, I doubt it will get merged any time soon.

But, after reserving the bag, did you check "my account" (I mean the bottom right button) → "Mag Bags & Parcels saved"? Maybe it's listed there? (I don't know for sure if it should be listed there, just guessing.)

I Just tried it and unfortunately they are not listed in the app. Do you have a payment method implemented for yourself and could share it? It would be amazing to be able to use it. Great work so far.

Jurrie commented 1 year ago

Do you have a payment method implemented for yourself and could share it? It would be amazing to be able to use it. Great work so far.

I do have a payment method implemented. But it's very rough code. I really should clean it up, add some safety checks, add some documentation, make it tidy 😀 I can't give any promises on when that will be done.

In the mean time, you could try to figure out the API calls for yourself. It would be a more long-term solution anyway. Please check the reply I gave on the question of solve-fx. I think intercepting app traffic is a nice skill to have, and not all that hard. Quite fun actually! 😀

Vivalemuc commented 1 year ago

@Jurrie

Can you share the minimalist snipet to pay an order ? Just to see the mechanism !

Thanks :)