Exemplo n.º 1
0
        public async Task <string> CreateUser(User user)
        {
            UserNaturalPostDTO naturalUser = new UserNaturalPostDTO(user.Email, user.FirstName, user.LastName, new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);
            var createdUser = await _mangoPayApi.Users.Create(naturalUser);

            return(await CreateWallet(createdUser.Id));
        }
        public void WhenCreatingValidNaturalUser_ItShouldReturnNaturalUserDto()
        {
            // Arrange:
            var user = new UserNaturalPostDTO(
                "*****@*****.**",
                "John",
                "Doe",
                new DateTime(1975, 12, 21, 0, 0, 0),
                CountryIso.FR,
                CountryIso.FR)
            {
                Occupation  = "programmer",
                IncomeRange = 3,
                Address     = new Address
                {
                    AddressLine1 = "Address line 1",
                    AddressLine2 = "Address line 2",
                    City         = "City",
                    Country      = CountryIso.PL,
                    PostalCode   = "11222",
                    Region       = "Region"
                },
                Capacity = CapacityType.DECLARATIVE
            };

            // Act:
            var result = _objectToTest.Create(user).Result;

            // Assert:
            Assert.NotNull(result);
            Assert.IsType <UserNaturalDTO>(result);
            Assert.True(!string.IsNullOrEmpty(result.Id));
        }
Exemplo n.º 3
0
        public async Task Test_Idempotency_UsersCreateNaturals()
        {
            string             key  = DateTime.Now.Ticks.ToString();
            UserNaturalPostDTO user = new UserNaturalPostDTO("*****@*****.**", "John", "Doe",
                                                             new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);

            user.Occupation  = "programmer";
            user.IncomeRange = 3;
            user.Address     = new Address
            {
                AddressLine1 = "Address line 1",
                AddressLine2 = "Address line 2",
                City         = "City",
                Country      = CountryIso.PL,
                PostalCode   = "11222",
                Region       = "Region"
            };
            user.Capacity = CapacityType.NORMAL;

            await Api.Users.Create(key, user);

            var result = await Api.Idempotency.Get(key);

            Assert.IsInstanceOf <UserNaturalDTO>(result.Resource);
        }
Exemplo n.º 4
0
        protected UserNaturalDTO GetNewJohn()
        {
            UserNaturalPostDTO user = new UserNaturalPostDTO("*****@*****.**", "John", "Doe", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);

            user.Occupation  = "programmer";
            user.IncomeRange = 3;
            user.Address     = "Some Address";

            return(this.Api.Users.Create(user));
        }
Exemplo n.º 5
0
        protected UserNaturalDTO GetNewJohn()
        {
            UserNaturalPostDTO user = new UserNaturalPostDTO("*****@*****.**", "John", "Doe", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);

            user.Occupation  = "programmer";
            user.IncomeRange = 3;
            user.Address     = new Address {
                AddressLine1 = "Address line 1", AddressLine2 = "Address line 2", City = "City", Country = CountryIso.PL, PostalCode = "11222", Region = "Region"
            };

            return(this.Api.Users.Create(user));
        }
Exemplo n.º 6
0
        protected async Task <UserNaturalDTO> GetNewJohn()
        {
            UserNaturalPostDTO user = new UserNaturalPostDTO("*****@*****.**", "John", "Doe", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR)
            {
                Occupation  = "programmer",
                IncomeRange = 3,
                Address     = new Address {
                    AddressLine1 = "Address line 1", AddressLine2 = "Address line 2", City = "City", Country = CountryIso.PL, PostalCode = "11222", Region = "Region"
                },
                Capacity = CapacityType.DECLARATIVE
            };

            return(await this.Api.Users.CreateAsync(user));
        }
Exemplo n.º 7
0
        protected UserNaturalDTO GetJohn(bool recreate = false)
        {
            if (BaseTest._john == null || recreate)
            {
                UserNaturalPostDTO user = new UserNaturalPostDTO("*****@*****.**", "John", "Doe", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);
                user.Occupation  = "programmer";
                user.IncomeRange = 3;
                user.Address     = new Address {
                    AddressLine1 = "Address line 1", AddressLine2 = "Address line 2", City = "City", Country = CountryIso.PL, PostalCode = "11222", Region = "Region"
                };
                user.Capacity = CapacityType.DECLARATIVE;

                BaseTest._john = this.Api.Users.Create(user);

                BaseTest._johnsWallet = null;
            }
            return(BaseTest._john);
        }
Exemplo n.º 8
0
 /// <summary>Creates new user.</summary>
 /// <param name="idempotencyKey">Idempotency key for this request.</param>
 /// <param name="user">UserNatural object to be created.</param>
 /// <returns>UserNatural instance returned from API.</returns>
 public UserNaturalDTO Create(String idempotencyKey, UserNaturalPostDTO user)
 {
     return(this.CreateObject <UserNaturalDTO, UserNaturalPostDTO>(idempotencyKey, MethodKey.UsersCreateNaturals, user));
 }
Exemplo n.º 9
0
 /// <summary>Creates new user.</summary>
 /// <param name="user">UserNatural object to be created.</param>
 /// <returns>UserNatural instance returned from API.</returns>
 public UserNaturalDTO Create(UserNaturalPostDTO user)
 {
     return(Create(null, user));
 }
Exemplo n.º 10
0
 /// <summary>Creates new user.</summary>
 /// <param name="user">UserNatural object to be created.</param>
 /// <returns>UserNatural instance returned from API.</returns>
 public async Task <UserNaturalDTO> Create(UserNaturalPostDTO user)
 {
     return(await Create(null, user));
 }
        public async Task <UserNaturalDTO> Create(UserNaturalPostDTO user)
        {
            var targetUrl = $"{_baseUrl}/users/natural/";

            return(await CreateEntity <UserNaturalDTO, UserNaturalPostDTO>(targetUrl, user));
        }
Exemplo n.º 12
0
 /// <summary>Creates new user.</summary>
 /// <param name="user">UserNatural object to be created.</param>
 /// <returns>UserNatural instance returned from API.</returns>
 public UserNaturalDTO Create(UserNaturalPostDTO user)
 {
     return(this.CreateObject <UserNaturalDTO, UserNaturalPostDTO>(MethodKey.UsersCreateNaturals, user));
 }