public void When_I_update_an_AHC_bank_account_Then_it_should_be_updated_sync()
        {
            _profile = _service.Create(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);

            AchBankAccounts account = SampleFactory.CreatSampleAchBankAccount(_profile, address);

            account = _service.Create(account);

            var newAccountHolderName = "Foo";

            account.AccountHolderName(newAccountHolderName);

            _service.Update(account);

            var returnedAccount = _service.Get(AchBankAccounts.Builder()
                                               .Id(account.Id())
                                               .ProfileId(_profile.Id())
                                               .Build());

            Assert.That(returnedAccount.AccountHolderName(), Is.EqualTo(newAccountHolderName));

            _service.Delete(account);
        }
        public async Task When_I_update_an_EFT_bank_account_Then_it_should_be_updated_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            EftBankAccounts account = SampleFactory.CreatSampleEftBankAccount(_profile, address);

            account = await _service.CreateAsync(account);

            var newAccountHolderName = "Foo";

            account.AccountHolderName(newAccountHolderName);

            await _service.UpdateAsync(account);

            var returnedAccount = await _service.GetAsync(EftBankAccounts.Builder()
                                                          .Id(account.Id())
                                                          .ProfileId(_profile.Id())
                                                          .BillingAddressId(address.Id())
                                                          .Build());

            Assert.That(returnedAccount.AccountHolderName(), Is.EqualTo(newAccountHolderName));

            await _service.DeleteAsync(account);
        }
        public async Task When_I_delete_a_profile_Then_it_should_return_a_valid_response_async()
        {
            _profile = await _service.CreateAsync(_profile);

            bool response = await _service.DeleteAsync(_profile);

            Assert.That(response, Is.True);
        }
        public void When_I_delete_a_profile_Then_it_should_return_a_valid_response_sync()
        {
            _profile = _service.Create(_profile);

            bool response = _service.Delete(_profile);

            Assert.That(response, Is.True);
        }
        public void When_I_create_an_address_Then_it_should_return_a_valid_response_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            var response = _service.Create(address);

            Assert.That(response.Status(), Is.EqualTo("ACTIVE"));
        }
        public void When_I_create_a_card_Then_it_should_return_a_valid_response_sync()
        {
            _profile = _service.Create(_profile);
            var card = SampleFactory.CreateSampleCard(_profile);

            var response = _service.Create(card);

            Assert.That(response.Status(), Is.EqualTo("ACTIVE"));
        }
        public void When_I_delete_a_profile_Then_it_should_be_deleted_sync()
        {
            _profile = _service.Create(_profile);

            _service.Delete(_profile);

            Assert.Throws <Paysafe.Common.EntityNotFoundException>(() => _service.Get(Profile.Builder()
                                                                                      .Id(_profile.Id())
                                                                                      .Build()));
        }
        public async Task When_I_lookup_a_profile_using_a_profile_id_Then_it_should_return_a_valid_profile_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var returnedProfile = await _service.GetAsync(Profile.Builder()
                                                          .Id(_profile.Id())
                                                          .Build());

            Assert.That(ProfilesAreEquivalent(_profile, returnedProfile));
        }
        public async Task When_I_delete_a_profile_Then_it_should_be_deleted_async()
        {
            _profile = await _service.CreateAsync(_profile);

            await _service.DeleteAsync(_profile);

            Assert.ThrowsAsync <Paysafe.Common.EntityNotFoundException>(async() => await _service.GetAsync(Profile.Builder()
                                                                                                           .Id(_profile.Id())
                                                                                                           .Build()));
        }
        public void When_I_update_a_profile_Then_the_profile_should_be_updated_sync()
        {
            var newFirstName = "Toto";

            _profile = _service.Create(_profile);
            _profile.FirstName(newFirstName);

            var updatedProfile = _service.Update(_profile);

            Assert.That(updatedProfile.FirstName(), Is.EqualTo(newFirstName));
        }
        public void When_I_delete_an_address_Then_it_should_return_a_valid_response_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);

            bool response = _service.Delete(address);

            Assert.That(response, Is.True);
        }
Exemplo n.º 12
0
 public static Profile CreateSampleProfile()
 {
     return(Profile.Builder()
            .MerchantCustomerId(Guid.NewGuid().ToString())
            .Locale("en_US")
            .FirstName("John")
            .LastName("Smith")
            .Email("*****@*****.**")
            .Phone("713-444-5555")
            .Build());
 }
        public async Task When_I_delete_a_card_Then_it_should_return_a_valid_response_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var card = SampleFactory.CreateSampleCard(_profile);

            card = await _service.CreateAsync(card);

            bool response = await _service.DeleteAsync(card);

            Assert.That(response, Is.True);
        }
        public async Task When_I_update_a_profile_Then_the_profile_should_be_updated_async()
        {
            var newFirstName = "Toto";

            _profile = await _service.CreateAsync(_profile);

            _profile.FirstName(newFirstName);

            var updatedProfile = await _service.UpdateAsync(_profile);

            Assert.AreEqual(updatedProfile.FirstName(), newFirstName);
        }
Exemplo n.º 15
0
 public static Card CreateSampleCard(Profile profile, Address address)
 {
     return(Card.Builder()
            .ProfileId(profile.Id())
            .CardNum("4111111111111111")
            .CardExpiry()
            .Month(DateTime.Now.Month)
            .Year(DateTime.Now.AddYears(1).Year)
            .Done()
            .BillingAddressId(address.Id())
            .Build());
 }
        /*
         * Helpers
         */

        private bool ProfilesAreEquivalent(Profile profile1, Profile profile2)
        {
            if (!profile1.Id().Equals(profile2.Id()) ||
                !profile1.Phone().Equals(profile2.Phone()) ||
                !profile1.FirstName().Equals(profile2.FirstName()) ||
                !profile1.LastName().Equals(profile2.LastName()) ||
                !profile1.Email().Equals(profile2.Email()))
            {
                return(false);
            }

            return(true);
        }
        public void When_I_lookup_an_address_Then_it_should_return_a_valid_address_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);

            var returnedAddress = _service.Get(Address.Builder()
                                               .Id(address.Id())
                                               .ProfileId(_profile.Id())
                                               .Build());

            Assert.That(AddressesAreEquivalent(address, returnedAddress));
        }
        public void When_I_create_an_EFT_bank_account_Then_it_should_return_a_valid_response_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);
            EftBankAccounts account = SampleFactory.CreatSampleEftBankAccount(_profile, address);

            account = _service.Create(account);

            Assert.That(account.Status(), Is.EqualTo("ACTIVE"));

            _service.Delete(account);
        }
        public void When_I_lookup_a_card_Then_it_should_return_a_valid_card_sync()
        {
            _profile = _service.Create(_profile);
            var card = SampleFactory.CreateSampleCard(_profile);

            card = _service.Create(card);

            var returnedCard = _service.Get(Card.Builder()
                                            .Id(card.Id())
                                            .ProfileId(_profile.Id())
                                            .Build());

            Assert.That(CardsAreEquivalent(card, returnedCard));
        }
        public void When_I_update_a_card_Then_the_address_should_be_updated_sync()
        {
            _profile = _service.Create(_profile);
            var card = SampleFactory.CreateSampleCard(_profile);

            card = _service.Create(card);
            var newNickname = "New card name";

            card.NickName(newNickname);

            var updatedCard = _service.Update(card);

            Assert.That(updatedCard.NickName(), Is.EqualTo(newNickname));
        }
        public void When_I_delete_an_address_Then_it_should_be_deleted_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);

            _service.Delete(address);

            Assert.Throws <Paysafe.Common.EntityNotFoundException>(() => _service.Get(Address.Builder()
                                                                                      .Id(address.Id())
                                                                                      .ProfileId(_profile.Id())
                                                                                      .Build()));
        }
        public void When_I_update_an_address_Then_the_address_should_be_updated_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);
            var newNickname = "New home";

            address.NickName(newNickname);

            var updatedAddress = _service.Update(address);

            Assert.That(updatedAddress.NickName(), Is.EqualTo(newNickname));
        }
Exemplo n.º 23
0
        public static AchBankAccounts CreatSampleAchBankAccount(Profile profile, Address address)
        {
            long accountNumber = LongRandom(1000, 99999999999999999);

            return(AchBankAccounts.Builder()
                   .MerchantRefNum(Guid.NewGuid().ToString())
                   .NickName("Sally Barclays Account")
                   .AccountType("CHECKING")
                   .AccountNumber(accountNumber.ToString())
                   .AccountHolderName("XYZ Business")
                   .RoutingNumber("122000661")
                   .BillingAddressId(address.Id())
                   .ProfileId(profile.Id())
                   .Build());
        }
        public async Task When_I_delete_a_card_Then_it_should_be_deleted_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var card = SampleFactory.CreateSampleCard(_profile);

            card = await _service.CreateAsync(card);

            await _service.DeleteAsync(card);

            Assert.ThrowsAsync <Paysafe.Common.EntityNotFoundException>(async() => await _service.GetAsync(Card.Builder()
                                                                                                           .Id(card.Id())
                                                                                                           .ProfileId(_profile.Id())
                                                                                                           .Build()));
        }
        public void When_I_delete_a_card_Then_it_should_be_deleted_sync()
        {
            _profile = _service.Create(_profile);

            var card = SampleFactory.CreateSampleCard(_profile);

            card = _service.Create(card);

            _service.Delete(card);

            Assert.Throws <Paysafe.Common.EntityNotFoundException>(() => _service.Get(Card.Builder()
                                                                                      .Id(card.Id())
                                                                                      .ProfileId(_profile.Id())
                                                                                      .Build()));
        }
Exemplo n.º 26
0
        public static EftBankAccounts CreatSampleEftBankAccount(Profile profile, Address address)
        {
            long accountNumber = LongRandom(1000, 999999999999);

            return(EftBankAccounts.Builder()
                   .MerchantRefNum(Guid.NewGuid().ToString())
                   .NickName("Sally Barclays Account")
                   .AccountNumber(accountNumber.ToString())
                   .AccountHolderName("XYZ Business")
                   .BillingAddressId(address.Id())
                   .ProfileId(profile.Id())
                   .TransitNumber("00000")
                   .InstitutionId("123")
                   .Build());
        }
        public async Task When_I_delete_an_address_Then_it_should_be_deleted_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            await _service.DeleteAsync(address);

            Assert.ThrowsAsync <Paysafe.Common.EntityNotFoundException>(async() => await _service.GetAsync(Address.Builder()
                                                                                                           .Id(address.Id())
                                                                                                           .ProfileId(_profile.Id())
                                                                                                           .Build()));
        }
Exemplo n.º 28
0
 public static Address CreateSampleAddress(Profile profile)
 {
     return(Address.Builder()
            .ProfileId(profile.Id())
            .NickName("home")
            .Street("100 Queen Street West")
            .Street2("Unit 201")
            .City("Toronto")
            .Country("CA")
            .State("ON")
            .Zip("M5H 2N2")
            .RecipientName("Jane Doe")
            .Phone("647-788-3901")
            .Build());
 }
        public async Task When_I_create_an_AHC_bank_account_Then_it_should_return_a_valid_response_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            AchBankAccounts account = SampleFactory.CreatSampleAchBankAccount(_profile, address);

            account = await _service.CreateAsync(account);

            Assert.That(account.Status(), Is.EqualTo("ACTIVE"));

            await _service.DeleteAsync(account);
        }
Exemplo n.º 30
0
 public static Card CreateSampleCard(Profile profile)
 {
     return(Card.Builder()
            .ProfileId(profile.Id())
            .CardNum("4111111111111111")
            .CardExpiry()
            .Month(DateTime.Now.Month)
            .Year(DateTime.Now.AddYears(1).Year)
            .Done()
            .BillingAddress()
            .Street("100 Queen Street West")
            .City("Toronto")
            .State("ON")
            .Country("CA")
            .Zip("M5H2N2")
            .Done()
            .Build());
 }