diff --git a/config/prod.edn b/config/prod.edn index 8600899b..bbd84d22 100644 --- a/config/prod.edn +++ b/config/prod.edn @@ -18,8 +18,6 @@ :yodlee-proxy-port 8888 :run-background? false :run-web? true - - :yodlee2-admin-user "93398522-412b-470d-8400-3691392b12fb_ADMIN" :yodlee2-integreat-user "integreat-main" :yodlee2-client-id "3AATcwfPsWP1rP9oDoo4HvZhtaroGVcA" diff --git a/config/staging.edn b/config/staging.edn index add6dcbf..b2fa839f 100644 --- a/config/staging.edn +++ b/config/staging.edn @@ -3,6 +3,7 @@ :scheme "https" :jwt-secret "auto ap invoices are awesome" :invoice-import-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-mail-staging" + :requests-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-background-request-staging" :invoice-email "invoices-staging@mail.app.integreatconsult.com" :data-bucket "data.staging.app.integreatconsult.com" :yodlee-cobrand-name "qstartus12" @@ -15,14 +16,14 @@ :yodlee-fastlink "https://quickstartus2node.yodleeinteractive.com/authenticate/qstartus12/?channelAppName=quickstartus2" :yodlee-proxy-host "172.31.10.83" :yodlee-proxy-port 8888 - :run-background? true + :run-background? false :run-web? true - - :yodlee2-admin-user "e02b38f9-9865-4264-8e4f-6a5ac2c500b0_ADMIN" :yodlee2-integreat-user "integreat-main" :yodlee2-client-id "l6sUyK2NEq3mwopISHlFGWUcJ1U8OUQd" :yodlee2-client-secret "wZQHoGEkv5AGG2ZH" :yodlee2-base-url "https://development.api.yodlee.com/ysl" :yodlee2-fastlink "https://fl4.preprod.yodlee.com/authenticate/USDevexPreProd2-195/fastlink/?channelAppName=usdevexpreprod2" + :yodlee2-proxy-host "172.31.10.83" + :yodlee2-proxy-port 8888 } diff --git a/src/clj/auto_ap/import/yodlee.clj b/src/clj/auto_ap/import/yodlee.clj index d27bcc26..c711f840 100644 --- a/src/clj/auto_ap/import/yodlee.clj +++ b/src/clj/auto_ap/import/yodlee.clj @@ -67,7 +67,6 @@ (def import-yodlee (allow-once import-yodlee)) - (mount/defstate import-worker :start (scheduler/every (* 1000 60 60 8) import-yodlee) :stop (scheduler/stop import-worker)) diff --git a/src/clj/user.clj b/src/clj/user.clj index 4f94f0f9..83290748 100644 --- a/src/clj/user.clj +++ b/src/clj/user.clj @@ -650,7 +650,7 @@ ])) (into {}))] (->> - (for [[invoice-id invoice-expense-account-id target-account _ amount expense-account location] (drop 1 data) + (for [[invoice-id invoice-expense-account-id target-account target-date amount expense-account location] (drop 1 data) :let [ invoice-id (Long/parseLong invoice-id) @@ -668,6 +668,9 @@ (d/entity db invoice-expense-account-id)) current-account-id (:db/id (:invoice-expense-account/account invoice-expense-account)) target-account-id (Long/parseLong (str/trim target-account)) + + target-date (clj-time.coerce/to-date (auto-ap.time/parse target-date auto-ap.time/normal-date)) + current-date (:invoice/date invoice) current-expense-account-amount (:invoice-expense-account/amount invoice-expense-account) @@ -693,8 +696,13 @@ {:db/id invoice-id :invoice/total target-total}) - {:db/id invoice-id - :invoice/expense-accounts invoice-expense-account-id} + (when new-account? + {:db/id invoice-id + :invoice/expense-accounts invoice-expense-account-id}) + + (when (and target-date (not= current-date target-date)) + {:db/id invoice-id + :invoice/date target-date}) (when (and (not (auto-ap.utils/dollars= current-total target-total)) diff --git a/terraform/deploy.tf b/terraform/deploy.tf index 51f8d6a5..38f21b50 100644 --- a/terraform/deploy.tf +++ b/terraform/deploy.tf @@ -2,6 +2,7 @@ variable "task_role_arn" {} variable "execution_role_arn" {} variable "ecs_cluster" {} variable "local_namespace" {} +variable "desired_count" {} variable "http_listener_sg" { default = "sg-0024906e0e1f78048" @@ -39,7 +40,7 @@ resource "aws_ecs_service" "integreat_app" { name = "integreat_app_${var.stage}" cluster = var.ecs_cluster task_definition = aws_ecs_task_definition.integreat_app.arn - desired_count = 4 + desired_count = var.desired_count health_check_grace_period_seconds = 600 deployment_controller { type = "ECS" diff --git a/terraform/prod.tfvars b/terraform/prod.tfvars index 0a930b23..c1441e38 100644 --- a/terraform/prod.tfvars +++ b/terraform/prod.tfvars @@ -9,3 +9,4 @@ execution_role_arn="arn:aws:iam::679918342773:role/ecsTaskExecutionRole" ecs_cluster="arn:aws:ecs:us-east-1:679918342773:cluster/default" # service_registry="arn:aws:servicediscovery:us-east-1:679918342773:service/srv-6auj2wqsh55k2nuj" local_namespace="ns-gv2z744em7myo2jp" +desired_count=4 diff --git a/terraform/staging.tfvars b/terraform/staging.tfvars index a25870c4..92c29c26 100644 --- a/terraform/staging.tfvars +++ b/terraform/staging.tfvars @@ -9,3 +9,4 @@ execution_role_arn="arn:aws:iam::679918342773:role/ecsTaskExecutionRole" ecs_cluster="arn:aws:ecs:us-east-1:679918342773:cluster/default" # service_registry="arn:aws:servicediscovery:us-east-1:679918342773:service/srv-6auj2wqsh55k2nuj" local_namespace="ns-gv2z744em7myo2jp" +desired_count=1