diff --git a/bin/billing_monthly_cronjob b/bin/billing_monthly_cronjob index 129644b0070779b8a889201caa07e0667820ff03..09a4fc28abceef8b10562675596e0551901271e9 100755 --- a/bin/billing_monthly_cronjob +++ b/bin/billing_monthly_cronjob @@ -6,7 +6,8 @@ # notify_using = { # jid = "", # password = "", -# target = \(tel: Text) -> "${tel}@cheogram.com" +# target = \(jid: Text) -> "+12266669977@cheogram.com", +# body = \(jid: Text) -> \(body: Text) -> "/msg ${jid} ${body}", # }, # plans = ./plans.dhall # }' @@ -137,8 +138,10 @@ class ExpiredCustomer jid = REDIS.get("jmp_customer_jid-#{@row['customer_id']}") tel = REDIS.lindex("catapult_cred-#{jid}", 3) BlatherNotify.say( - CONFIG[:notify_using][:target].call(tel.to_s), - format_renewal_notification(tel) + CONFIG[:notify_using][:target].call(jid), + CONFIG[:notify_using][:body].call( + jid, format_renewal_notification(tel) + ) ) stats.add(:not_renewed, 1) diff --git a/bin/process_pending_btc_transactions b/bin/process_pending_btc_transactions index d82927c9906674e039d8e21c0bc08290263da9cb..0c39f44f1e88a93e1f658efea8f623a47b62cfeb 100755 --- a/bin/process_pending_btc_transactions +++ b/bin/process_pending_btc_transactions @@ -8,7 +8,8 @@ # notify_using = { # jid = "", # password = "", -# target = \(tel: Text) -> "${tel}@cheogram.com" +# target = \(jid: Text) -> "+12266669977@cheogram.com", +# body = \(jid: Text) -> \(body: Text) -> "/msg ${jid} ${body}", # }, # electrum = env:ELECTRUM_CONFIG, # plans = ./plans.dhall, @@ -156,7 +157,7 @@ class Plan ) insert(start: Date.today, expire: @go_until) REDIS.del("pending_plan_for-#{@customer.id}") - # TODO: @customer.notify("Your account has been activated") + @customer.notify("Your account has been activated") end end end @@ -173,11 +174,9 @@ class Customer def notify(body) jid = REDIS.get("jmp_customer_jid-#{@customer_id}") raise "No JID for #{customer_id}" unless jid - tel = REDIS.lindex("catapult_cred-#{jid}", 3) - return unless tel BlatherNotify.say( - CONFIG[:notify_using][:target].call(tel.to_s), - body + CONFIG[:notify_using][:target].call(jid), + CONFIG[:notify_using][:body].call(jid, body) ) end