internal bool CheckReceiverContact()
        {
            //****************************************************************************************
            // Check Chat message receiver contact. it should not be null.
            //*****************************************************************************************
            var receiver = string.Empty;

            if (ReceiverAddress != null)
            {
                receiver = ReceiverAddress.Trim();
            }

            if (ChatViewContact != null && receiver == ChatViewContact.Contact.RegistrationName)
            {
                return(true);
            }

            VATRPContact contact = _chatsManager.FindContact(new ContactID(receiver, IntPtr.Zero));

            if (contact == null)
            {
                string un, host, dn;
                int    port;
                if (!VATRPCall.ParseSipAddress(receiver, out un,
                                               out host, out port))
                {
                    un = "";
                }

                if (!un.NotBlank())
                {
                    return(false);
                }

                if (string.IsNullOrEmpty(host))
                {
                    host = App.CurrentAccount.ProxyHostname;
                }
                var contactAddress = string.Format("{0}@{1}", un, host);
                var contactID      = new ContactID(contactAddress, IntPtr.Zero);

                contact = new VATRPContact(contactID)
                {
                    DisplayName      = un,
                    Fullname         = un,
                    SipUsername      = un,
                    RegistrationName = contactAddress
                };
                _contactsManager.AddContact(contact, "");
            }

            SetActiveChatContact(contact, IntPtr.Zero);
            if (ReceiverAddress != contact.RegistrationName)
            {
                ReceiverAddress = contact.RegistrationName;
            }

            return(true);
        }
示例#2
0
        public void Payment_Create_ShouldBeOk()
        {
            var addInfPayerAdd = new Address
            {
                StreetName   = "aaa",
                StreetNumber = 5,
                ZipCode      = "54321"
            };

            var addInfPayerPhone = new Phone
            {
                AreaCode = "00",
                Number   = "5512345678"
            };

            DateTime fechaReg = new DateTime(2000, 01, 31);

            var addInfoPayer = new AdditionalInfoPayer
            {
                FirstName        = "Rubén",
                LastName         = "González",
                RegistrationDate = fechaReg,
                Address          = addInfPayerAdd,
                Phone            = addInfPayerPhone
            };

            var item = new Item
            {
                Id          = "producto123",
                Title       = "Celular blanco",
                Description = "4G, 32 GB",
                Quantity    = 1,
                PictureUrl  = "http://www.imagenes.com/celular.jpg",
                UnitPrice   = 1000
            };


            List <Item> items = new List <Item>();

            items.Add(item);

            ReceiverAddress receiverAddress = new ReceiverAddress
            {
                StreetName   = "insurgentes sur",
                StreetNumber = 1,
                Zip_code     = "12345"
            };

            Shipment shipment = new Shipment
            {
                ReceiverAddress = receiverAddress
            };

            var addInf = new AdditionalInfo
            {
                Payer     = addInfoPayer,
                Shipments = shipment,
                Items     = items
            };

            Payment payment = new Payment
            {
                TransactionAmount = (float)20.0,
                Token             = Helpers.CardHelper.SingleUseCardToken(PublicKey, "pending"), // 1 use card token
                Description       = "Pago de Prueba",
                PaymentMethodId   = "visa",
                ExternalReference = "INTEGRATION-TEST-PAYMENT",
                Installments      = 1,
                Payer             = new Payer {
                    Email = "*****@*****.**"
                },
                AdditionalInfo = addInf
            };

            payment.Save();

            LastPayment = payment;


            Assert.IsTrue(payment.Id.HasValue, "Failed: Payment could not be successfully created");
            Assert.IsTrue(payment.Id.Value > 0, "Failed: Payment has not a valid id");
        }
示例#3
0
 /// <summary>
 /// ToString() override
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/>
 /// </returns>
 public override string ToString()
 {
     return(string.Format("[CTSOrACKFrame RA {0}]",
                          ReceiverAddress.ToString()));
 }
示例#4
0
 /// <summary>
 /// ToString() override
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/>
 /// </returns>
 public override string ToString()
 {
     return(string.Format("[RTSFrame RA {0}, TA {1}]",
                          ReceiverAddress.ToString(),
                          TransmitterAddress.ToString()));
 }
示例#5
0
        public static Payment GetPaymentData(string publicKey, string status)
        {
            Address addInfPayerAdd = new Address
            {
                StreetName   = "Street",
                StreetNumber = 5,
                ZipCode      = "54321"
            };

            Phone addInfPayerPhone = new Phone
            {
                AreaCode = "00",
                Number   = "5512345678"
            };

            DateTime date = new DateTime(2000, 01, 31);

            AdditionalInfoPayer addInfoPayer = new AdditionalInfoPayer
            {
                FirstName        = "Manolo",
                LastName         = "Perez",
                RegistrationDate = date,
                Address          = addInfPayerAdd,
                Phone            = addInfPayerPhone
            };

            Item item = new Item
            {
                Id          = "123",
                Title       = "Celular blanco",
                Description = "4G, 32GB",
                Quantity    = 1,
                PictureUrl  = "http://www.imagenes.com/celular.jpg",
                UnitPrice   = 100.4m
            };
            List <Item> items = new List <Item>
            {
                item
            };

            ReceiverAddress receiverAddress = new ReceiverAddress
            {
                StreetName   = "Insurgentes sur",
                StreetNumber = 1,
                Zip_code     = "12345"
            };

            Shipment shipment = new Shipment
            {
                ReceiverAddress = receiverAddress
            };

            AdditionalInfo addInf = new AdditionalInfo
            {
                Payer     = addInfoPayer,
                Shipments = shipment,
                Items     = items
            };

            Payment payment = new Payment
            {
                TransactionAmount = 50000f,
                Token             = CardHelper.SingleUseCardToken(publicKey, status),
                Description       = "Pago de prueba",
                PaymentMethodId   = "master",
                ExternalReference = "INTEGRATION-TEST-PAYMENT",
                Installments      = 1,
                Payer             = new Payer
                {
                    Email = "*****@*****.**"
                },
                AdditionalInfo = addInf
            };

            return(payment);
        }
示例#6
0
        public static Payment getPaymenData(string PublicKey, string Status)
        {
            var addInfPayerAdd = new Address
            {
                StreetName   = "aaa",
                StreetNumber = 5,
                ZipCode      = "54321"
            };

            var addInfPayerPhone = new Phone
            {
                AreaCode = "00",
                Number   = "5512345678"
            };

            DateTime fechaReg = new DateTime(2000, 01, 31);

            var addInfoPayer = new AdditionalInfoPayer
            {
                FirstName        = "Rubén",
                LastName         = "González",
                RegistrationDate = fechaReg,
                Address          = addInfPayerAdd,
                Phone            = addInfPayerPhone
            };

            var item = new Item
            {
                Id          = "producto123",
                Title       = "Celular blanco",
                Description = "4G, 32 GB",
                Quantity    = 1,
                PictureUrl  = "http://www.imagenes.com/celular.jpg",
                UnitPrice   = 100.4m
            };


            List <Item> items = new List <Item>();

            items.Add(item);

            ReceiverAddress receiverAddress = new ReceiverAddress
            {
                StreetName   = "insurgentes sur",
                StreetNumber = 1,
                Zip_code     = "12345"
            };

            Shipment shipment = new Shipment
            {
                ReceiverAddress = receiverAddress
            };

            var addInf = new AdditionalInfo
            {
                Payer     = addInfoPayer,
                Shipments = shipment,
                Items     = items
            };

            Payment payment = new Payment
            {
                TransactionAmount = (float)20.0,
                Token             = CardHelper.SingleUseCardToken(PublicKey, Status), // 1 use card token
                Description       = "Pago de Prueba",
                PaymentMethodId   = "visa",
                ExternalReference = "INTEGRATION-TEST-PAYMENT",
                Installments      = 1,
                Payer             = new Payer
                {
                    Email = Environment.GetEnvironmentVariable("EMAIL")
                },
                AdditionalInfo = addInf
            };

            return(payment);
        }