ecomplus / app-tiny-erp

E-Com Plus app to integrate Tiny ERP
GNU General Public License v3.0
0 stars 4 forks source link

Scheduled function to actively export paid orders daily #80

Open leomp12 opened 3 years ago

leomp12 commented 3 years ago

Is your feature request related to a problem? Please describe. Persistent errors with big orders queue and tons of events in short time, some orders (especially those that are created already paid) are not being properly exported, this commit will help but we may need a fallback solution.

Describe the solution you'd like

  1. Successful order exports should be saved to local Firestore database such as done with imported ones here;
  2. A daily scheduled function such as https://github.com/ecomplus/app-tiny-erp/blob/master/functions/index.js#L150-L154 to perform:
    1. Fetch Store API orders filtering by paid financial status updated on current day;
    2. Check each order (by number or ID) on Firestore and export the not found (not exported yet) ones.

Describe alternatives you've considered Refactor adding parsing all events to Pub/Sub and queuing properly (painful).

Additional context N/A

leomp12 commented 2 years ago

@wisley7l pra um dia desses se pá? 😬