Пример #1
0
        public async Task <ApiResponse <NotificationModel> > MakeAVoiceCall(string identityID)
        {
            try
            {
                var notificationModel = new NotificationModel
                {
                    IsSuccessful = false
                };

                Customer customer;
                try
                {
                    customer = await accountMatcher.FindPairedCustomerForAgentAsync(identityID);
                }
                catch (Exception e)
                {
                    notificationModel.StatusMessage = e.Message;
                    return(new ApiResponse <NotificationModel>(notificationModel));
                }

                if (customer != null)
                {
                    notificationModel = await voiceManager.MakeVoiceCall(customer.PhoneNumber);
                }

                return(new ApiResponse <NotificationModel>(notificationModel));
            }
            catch (Exception e)
            {
                return(HandleErrorAndReturnStatus <ApiResponse <NotificationModel> >(e));
            }
        }
Пример #2
0
        public async Task <ApiResponse <CustomerModel> > GetAssociatedCustomerAsync(string identityID)
        {
            try
            {
                var customer = await accountMatcher.FindPairedCustomerForAgentAsync(identityID);

                var response = new CustomerModel
                {
                    FirstName  = customer.FirstName,
                    LastName   = customer.LastName,
                    Id         = customer.ID,
                    IdentityID = customer.IdentityID
                };

                return(new ApiResponse <CustomerModel>(response));
            }
            catch (Exception e)
            {
                return(null);
            }
        }