Beispiel #1
0
 public SendNumberBase(ServiceSendNumberMap map)
 {
     this._map = map;
 }
Beispiel #2
0
 public DefaultSendNumberManager(ServiceSendNumberMap map)
     : base(map)
 {
 }
Beispiel #3
0
 public CzechSendNumberManager(ServiceSendNumberMap map)
     : base(map)
 {
 }
 public AustriaSendNumberManager(ServiceSendNumberMap map)
     : base(map)
 {
 }
Beispiel #5
0
 public SlovakiaSendNumberManager(ServiceSendNumberMap map)
     : base(map)
 {
 }
Beispiel #6
0
 public SwitzerlandSendNumberManager(ServiceSendNumberMap map)
     : base(map)
 {
 }
Beispiel #7
0
        // SUMMARY: Send Welcome message from ISendMessage manager for specific Service
        public void SendWelcomeMessage(Message message)
        {
            ServiceSendNumberMap serviceSendNumberMap = ServiceSendNumberMap.CreateManager().Load(message.Service).FirstOrDefault();

            if (serviceSendNumberMap == null)
            {
                Log.Error("NOTIFICATION_MOMT:: ServiceSendNumberMap could not be loaded by ServiceID:" + message.Service.ID);
                return;
            }

            if (message.MobileOperator == null)
            {
                Log.Error("NOTIFICATION_MOMT:: MobileOperator is null for number:" + message.Customer.Msisdn);
                return;
            }

            try
            {
                string smsMessage = serviceSendNumberMap.SmsMessages.FirstOrDefault();

                SendSmsResponse response         = null;
                Guid            messageReference = Guid.NewGuid();

                #region # Get cashflow SendSmsResponse #

                SendSmsRequest smsRequest = new SendSmsRequest(RequestMode.Default,
                                                               messageReference.ToString(),
                                                               message.Service.ServiceConfiguration.PaymentConfiguration.PaymentCredentials.Username,                       // username
                                                               message.Service.ServiceConfiguration.PaymentConfiguration.PaymentCredentials.Password,                       // password
                                                               message.Service.ServiceConfiguration.PaymentConfiguration.BehaviorModel.Guid,                                //bm
                                                               message.Service.Product.ExternalProductGuid,                                                                 //product
                                                               message.Service.ServiceConfiguration.PaymentConfiguration.PaymentInterface.ExternalPaymentInterfaceGuid,     //interface
                                                               message.Service.FallbackCountry.TwoLetterIsoCode,
                                                               message.Service.ServiceConfiguration.PaymentConfiguration.PaymentProvider.ExternalPaymentProviderGuid.Value, //provider
                                                               message.MobileOperator.ExternalMobileOperatorID.ToString(),
                                                               message.Customer.Msisdn,
                                                               smsMessage,
                                                               messageReference.ToString(), // "send sms ref."
                                                               string.Empty,
                                                               null);
                response = (new Cashflow.Client.MobileExtensionClient("http://v10.api.cashflow-payment.com/mobile.svc/soap12")).SendSms(smsRequest);

                #endregion

                if (response.Status.Code == MessageStatusCode.Success)
                {
                    Log.Info(string.Format("NOTIFICATION_MOMT::SendNumber:: Message successfuly sent. (message='{0} to number='{1}'", smsMessage, message.Customer.Msisdn));
                    #region # Insert messages in database #
                    MobiChat.Web.Data.Message dataMessage = new Message(-1,
                                                                        messageReference,
                                                                        null, /// externalID
                                                                        message.Service,
                                                                        message.Customer,
                                                                        message.MobileOperator.Name,
                                                                        message.Customer.MobileOperator,
                                                                        MessageDirection.Outgoing,
                                                                        Web.Data.MessageType.MT_Free,
                                                                        Web.Data.MessageStatus.Sent,
                                                                        smsMessage,
                                                                        null,               // shorcode
                                                                        string.Empty,       // keyword
                                                                        message.TrackingID, // pxid
                                                                        DateTime.Now, DateTime.Now);
                    dataMessage.Insert();

                    MTMessage mtMessage = new MTMessage(-1,
                                                        dataMessage,
                                                        message.Service.ServiceConfiguration.ExternalID,
                                                        message.Customer.Msisdn,
                                                        string.Empty, // msgID
                                                        DateTime.Now.ToString(),
                                                        "MOBICHAT_NOTIFICATION",
                                                        string.Empty, //error
                                                        string.Empty, //reasonCode
                                                        string.Empty, //retry
                                                        string.Empty, //appMsgID
                                                        DateTime.Now, DateTime.Now);
                    mtMessage.Insert();
                    #endregion
                }
                else
                {
                    Log.Error(string.Format("NOTIFICATION_MOMT::SendWelcomeMessage - Cashlfow returned us error (SubCode='{0}', Message='{1}'",
                                            response.Status.SubCode.ToString(),
                                            response.Status.Message));
                }
            }
            catch (Exception e)
            {
                Log.Error(string.Format("NOTIFICATION_MOMT::SendWelcomeMessage - FATAL", e));
            }
        }