From e543f64245c0c88dfb47cc7e0a842c30080571e8 Mon Sep 17 00:00:00 2001 From: jeryldev Date: Tue, 13 Feb 2024 09:50:45 +0800 Subject: [PATCH] add print_invoices/1 for prepaid and postpaid to the server --- lib/telephony/server.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/telephony/server.ex b/lib/telephony/server.ex index 3c3d09c..d2b3d23 100644 --- a/lib/telephony/server.ex +++ b/lib/telephony/server.ex @@ -43,6 +43,14 @@ defmodule Telephony.Server do end end + @impl true + def handle_call({:print_invoices, year, month}, _from, subscribers) do + case Core.print_invoices(subscribers, year, month) do + {:error, _message} = err -> {:reply, err, subscribers} + invoices -> {:reply, invoices, subscribers} + end + end + @impl true def handle_cast({:make_recharge, phone, value, date}, subscribers) do case Core.make_recharge(subscribers, phone, value, date) do