Exemplo n.º 1
0
    protected void lbBasicAuth_Click(object sender, EventArgs e)
    {
        string merchantId   = ConfigurationManager.AppSettings["MerchantID"];
        string account      = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        Merchant merchant = new Merchant(merchantId, account, sharedSecret);
        Order    order    = new Order("GBP", 999);
        //working
        CreditCard card = new CreditCard("MC", "5425232820001308", "0118", "Phil McCracken", "123", 1);
        //invalid
        //CreditCard card = new CreditCard("MC", "1234123412341234", "0118", "Phil McCracken", "123", 1);
        Address      address = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
        Payer        payer   = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());

        string timestamp = Common.GenerateTimestamp();

        string autoSettle = "1";

        RealAuthTransactionResponse resp = RealAuthorisation.Auth(merchant, order, card, autoSettle, timestamp);

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text    = resp.ResultMessage;
    }
Exemplo n.º 2
0
 public override int CalculateVersion()
 {
     return(new
     {
         Base = base.CalculateVersion(),
         Active,
         //Locale,
         Name = Name == null ? 0 : Name.CalculateVersion(),
         //NickName,
         //DisplayName,
         Password,
         //PreferredLanguage,
         //ProfileUrl,
         //Timezone,
         //Title,
         UserName,
         //UserType,
         Addresses = Addresses.GetMultiValuedAttributeCollectionVersion(),
         Emails = Emails.GetMultiValuedAttributeCollectionVersion(),
         // Entitlements = Entitlements.GetMultiValuedAttributeCollectionVersion(),
         // Groups = Groups.GetMultiValuedAttributeCollectionVersion(),
         //Ims = Ims.GetMultiValuedAttributeCollectionVersion(),
         PhoneNumbers = PhoneNumbers.GetMultiValuedAttributeCollectionVersion(),
         // Photos = Photos.GetMultiValuedAttributeCollectionVersion(),
         // Roles = Roles.GetMultiValuedAttributeCollectionVersion(),
         // X509Certificates = X509Certificates.GetMultiValuedAttributeCollectionVersion()
     }.GetHashCode());
 }
 protected override bool OnSaveCanExecute()
 {
     return((Friend != null) &&
            (!Friend.HasErrors) &&
            PhoneNumbers.All(pn => !pn.HasErrors) &&
            HasChanges);
 }
Exemplo n.º 4
0
        public async Task <DialogTurnResult> SendTextAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var phone = PhoneNumbers.ContainsKey((stepContext.Result as FoundChoice)?.Value) ? PhoneNumbers[(stepContext.Result as FoundChoice)?.Value] : "6101234567";

            try
            {
                string accountSID = "AC039559141884d03c96a0f57f91357332";
                string authToken  = "1e15e552340d63875be0aecb475867b7";

                // Initialize the TwilioClient.
                TwilioClient.Init(accountSID, authToken);

                // Send message via Twilio
                var message = MessageResource.Create(
                    to: new PhoneNumber($"+1{phone}"),
                    from: new PhoneNumber("+12674777516"),
                    body: $"{PplLocations[LocationEntity]}");
            }
            catch (TwilioException ex)
            {
                await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Sorry, I unable to send the location to {phone}."));

                LocationEntity = null;
                return(await stepContext.ReplaceDialogAsync(RootWaterfallDialog.DialogId, null, cancellationToken));
            }

            await stepContext.Context.SendActivityAsync(MessageFactory.Text($"I have successfully sent the location to {phone}."));

            LocationEntity = null;
            return(await stepContext.ReplaceDialogAsync(RootWaterfallDialog.DialogId, null, cancellationToken));
        }
Exemplo n.º 5
0
        public void FormatPhoneNumber_PhoneNumberInDresdenGermany_ReturnsFormattedNumber(
            [Values(DISTANCE_RULE.CANONICAL, DISTANCE_RULE.InternationalRule, DISTANCE_RULE.LongDistanceRule,
                DISTANCE_RULE.SameAreaRule)] DISTANCE_RULE distanceRule,
            [Values("+49 (351) 1234567", "00493511234567", "03511234567", "1234567")] string expected)
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string number = "+493511234567";

            using (mocks.Record())
            {
                registryDataProvider.GetUserCountryID();
                LastCall.Return("49");
                registryDataProvider.GetUserAreaCode();
                LastCall.Return("351");
                registryDataProvider.GetPhoneFormat(49, DISTANCE_RULE.InternationalRule);
                LastCall.Return("00EFG");
                registryDataProvider.GetPhoneFormat(49, DISTANCE_RULE.LongDistanceRule);
                LastCall.Return("0FG");
                registryDataProvider.GetPhoneFormat(49, DISTANCE_RULE.SameAreaRule);
                LastCall.Return("G");

                xmlDataProvider.GetCountryCode("4935");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+493511234567");
                LastCall.Return("+49351");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.FormatPhoneNumber(number, distanceRule);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
 private void AddNumber()
 {
     PhoneNumbers.Add(new PhoneNumberModel()
     {
         ID = 0, PhoneNumber = EditablePhoneNumber
     });
 }
Exemplo n.º 7
0
        public void GetCountryNameByNumber_PhoneNumberInDresdenGermany_ReturnsGermany()
        {
            MockRepository           mocks                = new MockRepository();
            IPhoneNumberDataXml      xmlDataProvider      = mocks.Stub <IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub <IPhoneNumberDataRegistry>();

            string number   = "+493511234567";
            string expected = "Deutschland";

            using (mocks.Record())
            {
                xmlDataProvider.GetCountryCode("4935");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+493511234567");
                LastCall.Return("+49351");
                xmlDataProvider.GetCountryID("+49351");
                LastCall.Return("49");

                registryDataProvider.GetCountryName(49);
                LastCall.Return(expected);
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string       actual = phoneNumberConverter.GetCountryNameByNumber(number);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 8
0
        public void FormatPhoneNumber_PhoneNumberInDresdenGermany_ReturnsFormattedNumber(
            [Values(DISTANCE_RULE.CANONICAL, DISTANCE_RULE.InternationalRule, DISTANCE_RULE.LongDistanceRule,
                    DISTANCE_RULE.SameAreaRule)] DISTANCE_RULE distanceRule,
            [Values("+49 (351) 1234567", "00493511234567", "03511234567", "1234567")] string expected)
        {
            MockRepository           mocks                = new MockRepository();
            IPhoneNumberDataXml      xmlDataProvider      = mocks.Stub <IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub <IPhoneNumberDataRegistry>();

            string number = "+493511234567";

            using (mocks.Record())
            {
                registryDataProvider.GetUserCountryID();
                LastCall.Return("49");
                registryDataProvider.GetUserAreaCode();
                LastCall.Return("351");
                registryDataProvider.GetPhoneFormat(49, DISTANCE_RULE.InternationalRule);
                LastCall.Return("00EFG");
                registryDataProvider.GetPhoneFormat(49, DISTANCE_RULE.LongDistanceRule);
                LastCall.Return("0FG");
                registryDataProvider.GetPhoneFormat(49, DISTANCE_RULE.SameAreaRule);
                LastCall.Return("G");

                xmlDataProvider.GetCountryCode("4935");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+493511234567");
                LastCall.Return("+49351");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string       actual = phoneNumberConverter.FormatPhoneNumber(number, distanceRule);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 9
0
        public void GetCountryNameByNumber_PhoneNumberInDresdenGermanyWithoutRegistryAccess_GetsCountryNameFromXML()
        {
            MockRepository           mocks                = new MockRepository();
            IPhoneNumberDataXml      xmlDataProvider      = mocks.StrictMock <IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub <IPhoneNumberDataRegistry>();

            string number = "+493511234567";

            using (mocks.Record())
            {
                xmlDataProvider.GetCountryCode("4935");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+493511234567");
                LastCall.Return("+49351");
                xmlDataProvider.GetCountryID("+49351");
                LastCall.Return("49");
                xmlDataProvider.GetCountryName(49);
                LastCall.Return("Germany");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);

            phoneNumberConverter.GetCountryNameByNumber(number);

            mocks.VerifyAll();
        }
Exemplo n.º 10
0
 //===================================================================================================
 //   PhoneNumbers
 //===================================================================================================
 public int PhoneNumberCreateOrUpdate(PhoneNumbers phoneNumber, int CustomerId)
 {
     if (CustomerId == 0)
     {
         return(-1);
     }
     if (phoneNumber.PhoneNumber == null || phoneNumber.PhoneNumber == "")
     {
         return(-1);
     }
     using (var connection = this.getConnection())
     {
         DynamicParameters ParamsForProc = new DynamicParameters();
         ParamsForProc.Add("@PhoneNumber", phoneNumber.PhoneNumber);
         ParamsForProc.Add("@FKCustomer", CustomerId);
         ParamsForProc.Add("@FKType", phoneNumber.FKType);
         if (phoneNumber.Id == 0)
         {
             ParamsForProc.Add("@newid", DbType.Int32, direction: ParameterDirection.ReturnValue);
             connection.Execute("PhoneNumber_Create", ParamsForProc, commandType: CommandType.StoredProcedure);
             phoneNumber.Id = ParamsForProc.Get <int>("@newid");
             return(phoneNumber.Id);
         }
         ParamsForProc.Add("@Id", phoneNumber.Id);
         connection.Execute("PhoneNumber_UpdateById", ParamsForProc, commandType: CommandType.StoredProcedure);
         return(phoneNumber.Id);
     }
 }
Exemplo n.º 11
0
 public override IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (DateOfBirth < DateTime.Now.AddYears(-Constants.MaxAgeInsuree) || DateOfBirth > DateTime.Now)
     {
         yield return
             (new ValidationResult(
                  $"Invalid range for date of birth; must be between {0} and {Constants.MaxAgeInsuree} years.",
                  new[] { "DateOfBirth" }));
     }
     foreach (var validationResult in Addresses.Validate())
     {
         yield return(validationResult);
     }
     foreach (var validationResult in EmailAddresses.Validate())
     {
         yield return(validationResult);
     }
     foreach (var validationResult in PhoneNumbers.Validate())
     {
         yield return(validationResult);
     }
     foreach (var validationResult in Insurances.Validate())
     {
         yield return(validationResult);
     }
 }
Exemplo n.º 12
0
    protected void lbBasicAuth_Click(object sender, EventArgs e)
    {
        string merchantId = ConfigurationManager.AppSettings["MerchantID"];
        string account = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        Merchant merchant = new Merchant(merchantId, account, sharedSecret);
        Order order = new Order("GBP", 999);
        //working
        CreditCard card = new CreditCard("MC", "5425232820001308", "0118", "Phil McCracken", "123", 1);
        //invalid
        //CreditCard card = new CreditCard("MC", "1234123412341234", "0118", "Phil McCracken", "123", 1);
        Address address = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
        Payer payer = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());

        string timestamp = Common.GenerateTimestamp();

        string autoSettle = "1";

        RealAuthTransactionResponse resp = RealAuthorisation.Auth(merchant, order, card, autoSettle, timestamp);

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text = resp.ResultMessage;
    }
Exemplo n.º 13
0
        protected override void deserialize(PowerPlannerSending.BaseItem item, List <PropertyNames> changedProperties)
        {
            Teacher from = item as Teacher;

            if (changedProperties != null)
            {
                if (!EmailAddresses.SequenceEqual(from.EmailAddresses))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.EmailAddresses);
                }

                if (!OfficeLocations.SequenceEqual(from.OfficeLocations))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.OfficeLocations);
                }

                if (!PhoneNumbers.SequenceEqual(from.PhoneNumbers))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.PhoneNumbers);
                }

                if (!PostalAddresses.SequenceEqual(from.PostalAddresses))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.PostalAddresses);
                }
            }

            this.EmailAddresses  = from.EmailAddresses;
            this.OfficeLocations = from.OfficeLocations;
            this.PhoneNumbers    = from.PhoneNumbers;
            this.PostalAddresses = from.PostalAddresses;

            //guaranteed that upper temp and perm will be -1
            base.deserialize(from, changedProperties);
        }
    public override bool Save()
    {
        if (string.IsNullOrEmpty(edtPhoneNumber.Text.Trim()))
        {
            _manager.Alert("Please enter a phone number.");
            return(false);
        }

        PhoneNumbers phoneNumbers = new PhoneNumbers(UserSession.LoginUser);

        if (_phoneID > -1)
        {
            phoneNumbers.LoadByPhoneID(_phoneID);
            if (!phoneNumbers.IsEmpty)
            {
                PhoneNumber phoneNumber = phoneNumbers[0];
                phoneNumber.Extension   = edtExtension.Text;
                phoneNumber.Number      = edtPhoneNumber.Text;
                phoneNumber.PhoneTypeID = int.Parse(cmbTypes.SelectedValue);
            }
        }
        else
        {
            PhoneNumber phoneNumber = phoneNumbers.AddNewPhoneNumber();
            phoneNumber.RefID       = _refID;
            phoneNumber.RefType     = _refType;
            phoneNumber.Extension   = edtExtension.Text;
            phoneNumber.Number      = edtPhoneNumber.Text;
            phoneNumber.PhoneTypeID = int.Parse(cmbTypes.SelectedValue);
        }

        phoneNumbers.Save();
        return(true);
    }
Exemplo n.º 15
0
 public AppUser()
 {
     CellNo        = new PhoneNumbers();
     WorkNo        = new PhoneNumbers();
     HomeNo        = new PhoneNumbers();
     OfficeAddress = new Address();
 }
    //this doesnt work and I dont need it so tough
    protected void lb3DSecureReciept_Click(object sender, EventArgs e)
    {
        string merchantId   = ConfigurationManager.AppSettings["MerchantID"];
        string account      = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        Merchant     merchant = new Merchant(merchantId, account, sharedSecret);
        Order        order    = new Order("transaction01", "EUR", 9999);
        Address      address  = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers  = new PhoneNumbers("", "", "", "");
        Payer        payer    = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());

        string timestamp = Common.GenerateTimestamp();

        string cardRef    = "card1";
        string cvn        = "123";
        string autoSettle = "1";

        RealVaultTransactionResponse resp = RealVault.RealVault3DSVerifyEnrolled(merchant, order, payer, cardRef, autoSettle, timestamp, new ArrayList());

        //TODO: Run RealAuth verify signed
        //TODO: Run Reciept-In with 3d secure details

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text    = resp.Message;
    }
Exemplo n.º 17
0
 public PhoneNumbers UpdatePhoneNumbersData(int id, PhoneNumbers patientInfo)
 {
     try
     {
         if (id > 0)
         {
             var patientInsuranceDetails = _context.PhoneNumbers.Find(id);
             if (patientInsuranceDetails != null)
             {
                 patientInsuranceDetails.PatientID         = patientInfo.PatientID;
                 patientInsuranceDetails.PhoneNumber       = patientInfo.PhoneNumber;
                 patientInsuranceDetails.PhoneNumberTypeId = patientInfo.PhoneNumberTypeId;
                 patientInsuranceDetails.IsDeleted         = patientInfo.IsDeleted;
                 patientInsuranceDetails.DeletedBy         = patientInfo.DeletedBy;
                 patientInsuranceDetails.IsActive          = patientInfo.IsActive;
                 _context.SaveChanges();
             }
             return(patientInsuranceDetails);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemplo n.º 18
0
 /// <summary>
 /// Persons the phone numbers duplication check dal.
 /// </summary>
 /// <param name="_objPhoneNumbers">The object phone numbers.</param>
 /// <param name="PersonId">The person identifier.</param>
 /// <returns>System.Int32.</returns>
 public int PersonPhoneNumbers_DuplicationCheckDAL(PhoneNumbers _objPhoneNumbers, long PersonId)
 {
     return(ExecuteScalarSPInt32("TMS_PersonPhoneNumbers_DuplicationCheck",
                                 ParamBuilder.Par("ContactNumber", _objPhoneNumbers.ContactNumber),
                                 ParamBuilder.Par("ID", _objPhoneNumbers.ID),
                                 ParamBuilder.Par("PersonID", PersonId)));
 }
        public async Task <IActionResult> Edit(long id, [Bind("Id,PhoneNumber,IdcontactDetails")] PhoneNumbers phoneNumbers)
        {
            if (id != phoneNumbers.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(phoneNumbers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PhoneNumbersExists(phoneNumbers.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdcontactDetails"] = new SelectList(_context.ContactDetails, "Id", "Id", phoneNumbers.IdcontactDetails);
            return(View(phoneNumbers));
        }
Exemplo n.º 20
0
        public IHttpActionResult PostPhoneNumber(int id, PhoneNumbers phoneno)
        {
            logger.Info("This is the POST Request to API to update Phone Number");
            if (!ModelState.IsValid)
            {
                logger.Error(BadRequest(ModelState));
                return(BadRequest(ModelState));
            }

            db.numbers.Add(phoneno);

            try
            {
                db.SaveChanges();
                logger.Info("Database changes committed successfully");
            }
            catch (Exception e) {
                var ex = e.InnerException.InnerException.Message;

                if (ex.Contains(hardCodedObjects.duplicatePhone))
                {
                    return(BadRequest("Phone Number already exists. Please enter unique number."));
                }
                else
                {
                    return(BadRequest(ex.ToString()));
                }
            }

            logger.Info("POST request for phone numbers executed successfully");

            return(Ok());
        }
Exemplo n.º 21
0
 private void menuItemAdd_Click(object sender, EventArgs e)
 {
     if (FormOpenDental.CurPatNum == 0)
     {
         MsgBox.Show(this, "Please select a patient in the main window first.");
         return;
     }
     if (PhoneList[rowI].PatNum != 0)
     {
         if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "The current number is already attached to a patient. Attach it to this patient instead?"))
         {
             return;
         }
         PhoneNumber ph = PhoneNumbers.GetByVal(PhoneList[rowI].CustomerNumber);
         ph.PatNum = FormOpenDental.CurPatNum;
         PhoneNumbers.Update(ph);
     }
     else
     {
         string patName = Patients.GetLim(FormOpenDental.CurPatNum).GetNameLF();
         if (MessageBox.Show("Attach this phone number to " + patName + "?", "", MessageBoxButtons.OKCancel) != DialogResult.OK)
         {
             return;
         }
         PhoneNumber ph = new PhoneNumber();
         ph.PatNum         = FormOpenDental.CurPatNum;
         ph.PhoneNumberVal = PhoneList[rowI].CustomerNumber;
         PhoneNumbers.Insert(ph);
     }
     //tell the phone server to refresh this row with the patient name and patnum
     DataValid.SetInvalid(InvalidType.PhoneNumbers);
 }
Exemplo n.º 22
0
    void Handle(Input.AddPhoneNumber input)
    {
        var phoneNumber = new PhoneNumber();

        phoneNumber.Contact = (Contact)this.Data;
        PhoneNumbers.Add().Data = phoneNumber;
    }
Exemplo n.º 23
0
        public static PR SendSMS(string Number, string Message, string CountryCode = null, bool Force = false)
        {
            if (!Force && !Application.Configurations.SMSConfiguration.SMSEnabled)
            {
                return(new PR(PS.Success));
            }
            if (CountryCode == null)
            {
                CountryCode = Application.Configurations.SMSConfiguration.DefaultCountryCode;
            }

            Number  = PhoneNumbers.EnsureCountryCode(Number, CountryCode);
            Message = Unicode.ConvertToUnicode(Message);

            switch (Application.Configurations.SMSConfiguration.Provider)
            {
            case SMSProviders.PostToUrl:
                return(SendByPostToUrl(Number, Message));

            case SMSProviders.GetUrl:
                return(SendByGetUrl(Number, Message));

            case SMSProviders.GetUrl2:
                return(SendByGetUrl2(Number, Message));

            default:
                return(new PR(PS.Warning));
            }
        }
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the Person class.
 /// </summary>
 public Person()
 {
     EmailAddresses = new EmailAddresses();
     PhoneNumbers   = new PhoneNumbers();
     HomeAddress    = new Address(null, null, null, null, ContactType.Personal);
     WorkAddress    = new Address(null, null, null, null, ContactType.Business);
 }
Exemplo n.º 25
0
        /// <summary>
        /// Returns true if CommonPersonDetail instances are equal
        /// </summary>
        /// <param name="other">Instance of CommonPersonDetail to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CommonPersonDetail other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     PhoneNumbers == other.PhoneNumbers ||
                     PhoneNumbers != null &&
                     PhoneNumbers.SequenceEqual(other.PhoneNumbers)
                     ) &&
                 (
                     EmailAddresses == other.EmailAddresses ||
                     EmailAddresses != null &&
                     EmailAddresses.SequenceEqual(other.EmailAddresses)
                 ) &&
                 (
                     PhysicalAddresses == other.PhysicalAddresses ||
                     PhysicalAddresses != null &&
                     PhysicalAddresses.SequenceEqual(other.PhysicalAddresses)
                 ));
        }
Exemplo n.º 26
0
        public async Task <IHttpActionResult> PostPhoneNumbers(PhoneNumbers phoneNumbers)
        {
            var uow = new UnitOfWork <PhoneNumbers>(db);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            uow.Repository.Create(phoneNumbers);
            uow.Commit();

            PhoneDto dto = uow.Repository.ReadAll()
                           .Include(p => p.People)
                           .Select(p => new PhoneDto()
            {
                Id           = p.Id,
                PhoneCompany = p.PhoneCompany,
                PersonId     = p.Person_Id,
                PhoneType    = p.PhoneType,
                PersonName   = p.People.LastName + ", " + p.People.FirstName,
                Number       = p.Number
            }).SingleOrDefault(p => p.Id == phoneNumbers.Id);


            return(CreatedAtRoute("DefaultApi", new { id = phoneNumbers.Id }, dto));
        }
    //this doesnt work and I dont need it so tough
    protected void lb3DSecureReciept_Click(object sender, EventArgs e)
    {
        string merchantId = ConfigurationManager.AppSettings["MerchantID"];
        string account = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        Merchant merchant = new Merchant(merchantId, account, sharedSecret);
        Order order = new Order("transaction01", "EUR", 9999);
        Address address = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
        Payer payer = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());

        string timestamp = Common.GenerateTimestamp();

        string cardRef = "card1";
        string cvn = "123";
        string autoSettle = "1";

        RealVaultTransactionResponse resp = RealVault.RealVault3DSVerifyEnrolled(merchant, order, payer, cardRef, autoSettle, timestamp, new ArrayList());
        //TODO: Run RealAuth verify signed
        //TODO: Run Reciept-In with 3d secure details

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text = resp.Message;
    }
Exemplo n.º 28
0
        public async Task <IHttpActionResult> PutPhoneNumbers(int id, PhoneNumbers phoneNumbers)
        {
            var uow    = new UnitOfWork <PhoneNumbers>(db);
            var number = uow.Repository.Read(id);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != phoneNumbers.Id || number == null)
            {
                return(BadRequest());
            }

            if (phoneNumbers.Person_Id != null)
            {
                number.Person_Id = phoneNumbers.Person_Id;
            }

            number.Number       = phoneNumbers.Number;
            number.PhoneCompany = phoneNumbers.PhoneCompany;
            number.PhoneType    = phoneNumbers.PhoneType;

            uow.Commit();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 29
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                PhoneNumbers.ToBytes(),
                Message.ToBytes()));
 }
Exemplo n.º 30
0
        public void IsValidPhone_ShouldNotWork()
        {
            var controller = new ContactController();

            PhoneNumbers phoneExample1 = new PhoneNumbers();
            PhoneNumbers phoneExample2 = new PhoneNumbers();
            PhoneNumbers phoneExample3 = new PhoneNumbers();
            PhoneNumbers phoneExample4 = new PhoneNumbers();

            phoneExample1.PhoneNumber = "2743852";
            phoneExample2.PhoneNumber = "27l38542";
            phoneExample3.PhoneNumber = "77438542";
            phoneExample4.PhoneNumber = "274f852";

            var expected1 = controller.IsValidPhone(phoneExample1);

            Assert.IsTrue(expected1 == false);
            var expected2 = controller.IsValidPhone(phoneExample2);

            Assert.IsTrue(expected2 == false);
            var expected3 = controller.IsValidPhone(phoneExample3);

            Assert.IsTrue(expected3 == false);
            var expected4 = controller.IsValidPhone(phoneExample4);

            Assert.IsTrue(expected4 == false);
        }
 protected override bool OnSaveCanExecute()
 {
     return(Friend != null &&
            PhoneNumbers.All(p => !p.HasErrors) &&
            !Friend.HasErrors &&
            HasChange);
 }
Exemplo n.º 32
0
        public void FormatPhoneNumber_EmptyNumber_ReturnsEmptyString()
        {
            string       number = String.Empty;
            PhoneNumbers phoneNumberConverter = new PhoneNumbers();
            string       actual = phoneNumberConverter.FormatPhoneNumber(number, DISTANCE_RULE.CANONICAL);

            Assert.IsEmpty(actual);
        }
Exemplo n.º 33
0
        public void FormatPhoneNumber_InvalidNumber_ReturnsEmptyString()
        {
            string number = "abcd";
            PhoneNumbers phoneNumberConverter = new PhoneNumbers();
            string actual = phoneNumberConverter.FormatPhoneNumber(number, DISTANCE_RULE.CANONICAL);

            Assert.IsEmpty(actual);
        }
Exemplo n.º 34
0
        public Insuree()
        {
            Addresses      = new Addresses();
            EmailAddresses = new EmailAddresses();
            PhoneNumbers   = new PhoneNumbers();

            Insurances = new Insurances();
        }
		private static PhoneNumbers.PhoneNumber ParseFromString(PhoneNumbers.PhoneNumberUtil phoneUtil, string numberString, string regionCode)
		{
			try
			{
				return phoneUtil.Parse(numberString, regionCode);
			}
			catch (NumberParseException)
			{
				return null;
			}
		}
		public static bool TryGetValidMobileNumber(this PhoneNumbers.PhoneNumberUtil phoneUtil, string numberString, string[] regionCodes, out PhoneNumbers.PhoneNumber phoneNumber)
		{
			phoneNumber = null;

			var number = phoneUtil.GetValidNumber(numberString, regionCodes);

			if (number == null)
				return false;

			return phoneUtil.GetNumberType(number) == PhoneNumberType.MOBILE;
		}
		public static bool TryGetValidNumber(this PhoneNumbers.PhoneNumberUtil phoneUtil, string numberString, string[] regionCodes, out PhoneNumbers.PhoneNumber phoneNumber)
		{
			phoneNumber = null;

			foreach (var regionCode in regionCodes)
			{
				phoneNumber = ParseFromString(phoneUtil, numberString, regionCode);

				if (phoneNumber == null)
					continue;

				if (phoneUtil.IsValidNumberForRegion(phoneNumber, regionCode))
					return true;
			}

			return false;
		}
Exemplo n.º 38
0
    protected void lb3DSecureAuth_Click(object sender, EventArgs e)
    {
        string merchantId = ConfigurationManager.AppSettings["MerchantID"];
        string account = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        Merchant merchant = new Merchant(merchantId, account, sharedSecret);
        Order order = new Order("GBP", 999);
        CreditCard card = new CreditCard("MC", "5425232820001308", "0118", "Phil McCracken", "123", 1);
        Address address = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
        Payer payer = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());

        string timestamp = Common.GenerateTimestamp();

        string autoSettle = "1";

        RealAuthTransactionResponse resp = RealAuthorisation.RealAuth3DSecureVerifyEnrolled(merchant, order, card, timestamp);

        //00 is enrolled
        //110 is not enrolled, should be sent to Attempt ACS server is available
        if (resp.ResultCode == 00 || resp.ResultCode == 110)
        {
            string paReq = resp.PaReq;
            string url = resp.URL;

            if(paReq != "" && url != "")
            {
                _3DSecure tdSecure = new _3DSecure("", "", "", paReq, url);
                //resp = RealAuthorisation.RealAuth3DSecureVerifySig(merchant, order, card, tdSecure, timestamp);
            }

        }

        string termUrlPrefix = Request.ServerVariables["HTTPS"] == "ON" ? "https://" : "http://";
        string termUrl = string.Format("{0}{1}",
        termUrlPrefix,
        Request.Url.Authority + "/3DSResponse.aspx");

        pnlACS.Visible = true;

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text = resp.ResultMessage;
    }
Exemplo n.º 39
0
    protected void lbEditPayer_Click(object sender, EventArgs e)
    {
        string merchantId = ConfigurationManager.AppSettings["MerchantID"];
        string account = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        string timestamp = Common.GenerateTimestamp();

        Merchant merchant = new Merchant(merchantId, account, sharedSecret);
        Order order = new Order("123123wdfsdf", "GBP", 00);
        Address address = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
        Payer payer = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());
        CreditCard card = new CreditCard("MC", "5425232820001308", "0118", "Phil McCracken", "123", 1);

        RealVaultTransactionResponse resp = RealVault.PayerEdit(timestamp, merchant, order, payer, new ArrayList());

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text = resp.Message;
    }
    protected void lbCancelCard_Click(object sender, EventArgs e)
    {
        string merchantId = ConfigurationManager.AppSettings["MerchantID"];
        string account = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        Merchant merchant = new Merchant(merchantId, account, sharedSecret);
        Address address = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
        Payer payer = new Payer("Business", "test", "", "First", "Second", "", address, numbers, "", new ArrayList());

        string cardRef = "card1";

        string timestamp = Common.GenerateTimestamp();

        RealVaultTransactionResponse resp = RealVault.CardCancelCard(timestamp, cardRef, merchant, payer);

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text = resp.Message;
    }
    protected void lblbRecieptIn_Click(object sender, EventArgs e)
    {
        string merchantId = ConfigurationManager.AppSettings["MerchantID"];
        string account = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        Merchant merchant = new Merchant(merchantId, account, sharedSecret);
        Order order = new Order("GBP", 9999);
        Address address = new Address("", "", "", "", "", "", "", "");
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
        Payer payer = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());

        string timestamp = Common.GenerateTimestamp();

        //only needed if
        //string cvn = "123";
        string cardRef = "card1";
        string autoSettle = "1";

        //not needed if not a recurring payment, use reciept in overload without recurring
        bool recurring = true;

        //fixed or variable
        //fixed - order amount is the same every transaction
        //variable - order amount is different in every transaction
        string recurringType = "variable";

        //first - first payment in a sequence
        //subsequent - any subsequent payments after the initial
        //final - no more payments in sequence will follow
        string recurringSequence = "first";

        RealVaultTransactionResponse resp = RealVault.RecieptIn(merchant, order, payer, cardRef, autoSettle, timestamp, new ArrayList(), recurring, recurringType, recurringSequence);

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text = resp.Message;
    }
Exemplo n.º 42
0
        public void GetAreaName_EmptyAreaCode_ReturnsEmptyString()
        {
            string areaCode = String.Empty;
            PhoneNumbers phoneNumberConverter = new PhoneNumbers();
            string actual = phoneNumberConverter.GetAreaName(areaCode);

            Assert.IsEmpty(actual);
        }
Exemplo n.º 43
0
        public void GetAreaName_InvalidAreaCode_ReturnsEmptyString()
        {
            string areaCode = "123456";
            PhoneNumbers phoneNumberConverter = new PhoneNumbers();
            string actual = phoneNumberConverter.GetAreaName(areaCode);

            Assert.IsEmpty(actual);
        }
Exemplo n.º 44
0
    protected void lbNewPayer_Click(object sender, EventArgs e)
    {
        string merchantId = ConfigurationManager.AppSettings["MerchantID"];
        string account = ConfigurationManager.AppSettings["Account"];
        string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];

        //You need to generate the following to complete any process, the following order might be helpful as well.
        //Timestamp ==> Merchant ==> Order ==> Address ==> PhoneNumbers ==> Payer ==> CreditCard ==> SHA1Hash

        //Current timestamp
        string timestamp = Common.GenerateTimestamp();

        //New Merchant
        //merchant id
        //account
        //shared secret
        Merchant merchant = new Merchant(merchantId, account, sharedSecret);

        //New Order
        //order id (optional)
        //currency code
        //order amount
        Order order = new Order("123123wdfsdf", "GBP", 1099);

        //New Address (optional)
        //Line 1 (optional)
        //Line 2 (optional)
        //Line 3 (optional)
        //City (optional)
        //County (optional)
        //Postcode (optional)
        //Country Code (optional)
        //Country Name (optional)
        Address address = new Address("", "", "", "", "", "", "", "");

        //New Phone Numbers (optional)
        //home (optional)
        //work (optional)
        //fax (optional)
        //mobile (optional)
        PhoneNumbers numbers = new PhoneNumbers("", "", "", "");

        //New Payer
        //Payer type (default to 'Business')
        //Payer ref
        //Title (optional)
        //First Name
        //Surname
        //Company (optional)
        //Address (optional)
        //Numbers (optional)
        //email (optional)
        //comments (optional)
        Payer payer = new Payer("Business", "test", "", "First", "Second", "", address, numbers, "", new ArrayList());

        //New Credit Card
        //Card type
        //Card number
        //Expiry date
        //Cardholder name
        //cvn
        //Is cvn present
        //Issue number (optional)
        CreditCard card = new CreditCard("MC", "5425232820001308", "0118", "Phil McCracken", "123", 1);

        //Create new payer
        //timestamp
        //SHA1Hash
        //merchant
        //order
        //payer
        //comments
        RealVaultTransactionResponse resp = RealVault.PayerNew(timestamp, merchant, order, payer, new ArrayList());

        lblErrorCode.Text = resp.ResultCode.ToString();
        lblResult.Text = resp.Message;
    }
Exemplo n.º 45
0
        public void GetCountryNameByNumber_InvalidNumber_ReturnsEmptyString()
        {
            string number = "abcd";
            PhoneNumbers phoneNumberConverter = new PhoneNumbers();
            string actual = phoneNumberConverter.GetCountryNameByNumber(number);

            Assert.IsEmpty(actual);
        }
Exemplo n.º 46
0
        public void GetUserCountryID_LocationSetToDresdenGermany_Returns49()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string expected = "49";

            using (mocks.Record())
            {
                registryDataProvider.GetUserCountryID();
                LastCall.Return("49");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.GetUserCountryID();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 47
0
        public void GetCountryName_InvalidCountryID_ReturnsEmptyString()
        {
            int countryID = 0;
            PhoneNumbers phoneNumberConverter = new PhoneNumbers();
            string actual = phoneNumberConverter.GetCountryName(countryID);

            Assert.IsEmpty(actual);
        }
Exemplo n.º 48
0
        public void GetCountryName_GermanCountryID_ReturnsGermany()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            int countryID = 49;
            string expected = "Deutschland";

            using (mocks.Record())
            {
                registryDataProvider.GetCountryName(countryID);
                LastCall.Return(expected);
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(registryDataProvider);
            string actual = phoneNumberConverter.GetCountryName(countryID);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 49
0
        public void GetCountryName_GermanCountryIDWithoutRegistryAccess_GetsCountryNameFromXML()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.StrictMock<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            int countryID = 49;

            using (mocks.Record())
            {
                // expect that GetCountryName is called
                xmlDataProvider.GetCountryName(countryID);
                LastCall.Return("Germany");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            phoneNumberConverter.GetCountryName(countryID);

            mocks.VerifyAll();
        }
Exemplo n.º 50
0
        public void GetCountryID_EmptyNumber_ReturnsEmptyString()
        {
            string number = String.Empty;
            PhoneNumbers phoneNumberConverter = new PhoneNumbers();
            string actual = phoneNumberConverter.GetCountryID(number);

            Assert.IsEmpty(actual);
        }
Exemplo n.º 51
0
        public void GetCountryNameByNumber_PhoneNumberInDresdenGermany_ReturnsGermany()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string number = "+493511234567";
            string expected = "Deutschland";

            using (mocks.Record())
            {
                xmlDataProvider.GetCountryCode("4935");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+493511234567");
                LastCall.Return("+49351");
                xmlDataProvider.GetCountryID("+49351");
                LastCall.Return("49");

                registryDataProvider.GetCountryName(49);
                LastCall.Return(expected);
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.GetCountryNameByNumber(number);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 52
0
        public void GetCountryNameByNumber_PhoneNumberInDresdenGermanyWithoutRegistryAccess_GetsCountryNameFromXML()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.StrictMock<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string number = "+493511234567";

            using (mocks.Record())
            {
                xmlDataProvider.GetCountryCode("4935");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+493511234567");
                LastCall.Return("+49351");
                xmlDataProvider.GetCountryID("+49351");
                LastCall.Return("49");
                xmlDataProvider.GetCountryName(49);
                LastCall.Return("Germany");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            phoneNumberConverter.GetCountryNameByNumber(number);

            mocks.VerifyAll();
        }
Exemplo n.º 53
0
        public void GetAreaName_AreaCodeOfTMobileGermany_ReturnsTMobile()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string areaCode = "+491511";
            string expected = "T-Mobile (D1)";

            using (mocks.Record())
            {
                xmlDataProvider.GetCarrierName("+491511");
                LastCall.Return("T-Mobile (D1)");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.GetAreaName(areaCode);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 54
0
        public void GetAreaName_AreaCodeOfDresdenGermany_ReturnsDresden()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string areaCode = "+49351";
            string expected = "Dresden";

            using (mocks.Record())
            {
                xmlDataProvider.GetCityName("+49351");
                LastCall.Return("Dresden");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.GetAreaName(areaCode);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 55
0
        public void GetUserCountryID_WithoutRegistryAccess_ReturnsEmptyString()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.GetUserCountryID();

            Assert.IsNullOrEmpty(actual); ;
        }
Exemplo n.º 56
0
        public void FormatPhoneNumber_PhoneNumberInGermanInternationalFormatToCanonical_ReturnsCanonicalNumber()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string number = "00493511234567";
            string expected = "+49 (351) 1234567";

            using (mocks.Record())
            {
                xmlDataProvider.GetCountryCode("4935");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+493511234567");
                LastCall.Return("+49351");
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.FormatPhoneNumber(number, DISTANCE_RULE.CANONICAL);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 57
0
        public void GetCountryID_PhoneNumberOfTMobileGermany_Returns49()
        {
            MockRepository mocks = new MockRepository();
            IPhoneNumberDataXml xmlDataProvider = mocks.Stub<IPhoneNumberDataXml>();
            IPhoneNumberDataRegistry registryDataProvider = mocks.Stub<IPhoneNumberDataRegistry>();

            string number = "+491511123456";
            string expected = "49";

            using (mocks.Record())
            {
                xmlDataProvider.GetCountryCode("4915");
                LastCall.Return("49");
                xmlDataProvider.GetAreaCode("+491511123456");
                LastCall.Return("+491511");
                xmlDataProvider.GetCountryID("+491511");
                LastCall.Return(expected);
            }

            PhoneNumbers phoneNumberConverter = new PhoneNumbers(xmlDataProvider, registryDataProvider);
            string actual = phoneNumberConverter.GetCountryID(number);

            Assert.AreEqual(expected, actual);
        }