add job invoice
This commit is contained in:
@@ -136,4 +136,16 @@ RecurringJob.AddOrUpdate<ProductSyncJob>(
|
|||||||
: MisfireHandlingMode.Strict
|
: MisfireHandlingMode.Strict
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RecurringJob.AddOrUpdate<InvoiceSyncJob>(
|
||||||
|
"invoice-sync",
|
||||||
|
job => job.ExecuteAsync(),
|
||||||
|
Cron.Daily(2, 30), // Every day at 2:30 AM
|
||||||
|
new RecurringJobOptions
|
||||||
|
{
|
||||||
|
TimeZone = TimeZoneInfo.Local,
|
||||||
|
MisfireHandling = app.Environment.IsDevelopment()
|
||||||
|
? MisfireHandlingMode.Relaxed
|
||||||
|
: MisfireHandlingMode.Strict
|
||||||
|
});
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
@@ -6,6 +6,9 @@
|
|||||||
"E5_CRM": {
|
"E5_CRM": {
|
||||||
"ApiKey": "7e50a8a5-f01f-4fbc-8c1b-59f3fc474bb5"
|
"ApiKey": "7e50a8a5-f01f-4fbc-8c1b-59f3fc474bb5"
|
||||||
},
|
},
|
||||||
|
"TWINPOL_CRM": {
|
||||||
|
"ApiKey": "d68dac4c-f784-4e1b-8267-9ffcfa0eda4c"
|
||||||
|
},
|
||||||
"GoogleAuth": {
|
"GoogleAuth": {
|
||||||
"ClientId": "896226687615-rhmqk06t1hvll1hh2gtje2u6nbadtras.apps.googleusercontent.com"
|
"ClientId": "896226687615-rhmqk06t1hvll1hh2gtje2u6nbadtras.apps.googleusercontent.com"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class InvoiceSyncService(HttpClient httpClient, BimAIDbContext db, IConfi
|
|||||||
|
|
||||||
public async Task RunAsync()
|
public async Task RunAsync()
|
||||||
{
|
{
|
||||||
var apiKey = configuration["E5_CRM:ApiKey"];
|
var apiKey = configuration["TWINPOL_CRM:ApiKey"];
|
||||||
var syncState = db.SyncStates.FirstOrDefault(x => x.Entity == "Invoice") ?? new SyncState { Entity = "Invoice", LastSynced = 0 };
|
var syncState = db.SyncStates.FirstOrDefault(x => x.Entity == "Invoice") ?? new SyncState { Entity = "Invoice", LastSynced = 0 };
|
||||||
|
|
||||||
var url = $"https://crm.twinpol.com/REST/index.php?key={apiKey}&action=bimai.export.ecommerce&since=0";
|
var url = $"https://crm.twinpol.com/REST/index.php?key={apiKey}&action=bimai.export.ecommerce&since=0";
|
||||||
|
|||||||
Reference in New Issue
Block a user