public async Task ShouldCreateEntity()
        {
            var onboardEntityResponse = new OnboardEntityResponse {
                Id = "Id"
            };

            _apiClient.Setup(x => x.Post <OnboardEntityResponse>("accounts/entities", It.IsAny <SdkAuthorization>(),
                                                                 It.IsAny <object>(), It.IsAny <CancellationToken>(), It.IsAny <string>()))
            .ReturnsAsync(onboardEntityResponse);

            var response = await _accountsClient.CreateEntity(new OnboardEntityRequest());

            response.ShouldNotBeNull();
            response.ShouldBe(onboardEntityResponse);
        }
        private async Task ShouldUpdateEntity()
        {
            var responseObject = new OnboardEntityResponse {
                Id = "entity_id", Reference = "A"
            };
            var request = new OnboardEntityRequest
            {
                Reference      = "123",
                ContactDetails = new ContactDetails {
                    Phone = new AccountPhone()
                },
                Profile = new Profile(),
                Company = new Company
                {
                    BusinessRegistrationNumber = "123",
                    BusinessType      = BusinessType.UnincorporatedAssociation,
                    LegalName         = "LEGAL",
                    TradingName       = "TRADING",
                    PrincipalAddress  = new Address(),
                    RegisteredAddress = new Address(),
                    Representatives   = new List <Representative>
                    {
                        new Representative
                        {
                            Id             = "1203",
                            FirstName      = "first",
                            LastName       = "last",
                            Address        = new Address(),
                            Identification = new Identification(),
                            Phone          = new AccountPhone(),
                            DateOfBirth    = new DateOfBirth {
                                Day = 1, Month = 1, Year = 2000
                            },
                            PlaceOfBirth = new PlaceOfBirth {
                                Country = CountryCode.AF
                            },
                            Roles = new List <EntityRoles> {
                                EntityRoles.Ubo
                            }
                        }
                    },
                    Document         = new EntityDocument(),
                    FinancialDetails = new EntityFinancialDetails
                    {
                        AnnualProcessingVolume  = 1,
                        AverageTransactionValue = 1,
                        HighestTransactionValue = 1,
                        Documents = new EntityFinancialDocuments
                        {
                            BankStatement      = new EntityDocument(),
                            FinancialStatement = new EntityDocument()
                        }
                    }
                },
                Individual = null
            };

            _apiClient
            .Setup(x =>
                   x.Put <OnboardEntityResponse>(
                       "accounts/entities/entity_id",
                       It.IsAny <SdkAuthorization>(),
                       It.IsAny <object>(),
                       It.IsAny <CancellationToken>(),
                       It.IsAny <string>()))
            .ReturnsAsync(responseObject);

            var response = await _accountsClient.UpdateEntity(
                responseObject.Id,
                request);

            response.ShouldNotBeNull();
            response.Id.ShouldBe(responseObject.Id);
            response.Reference.ShouldBe(responseObject.Reference);
        }
Ejemplo n.º 3
0
        public async Task ShouldCreateGetAndUpdateOnboardEntity()
        {
            string randomReference = RandomString(15);
            OnboardEntityRequest onboardEntityRequest = new OnboardEntityRequest
            {
                Reference      = randomReference,
                ContactDetails = new ContactDetails {
                    Phone = new AccountPhone {
                        Number = "2345678910"
                    }
                },
                Profile =
                    new Profile
                {
                    Urls = new List <string> {
                        "https://www.superheroexample.com"
                    },
                    Mccs = new List <string> {
                        "0742"
                    }
                },
                Individual = new Individual
                {
                    FirstName         = "Bruce",
                    LastName          = "Wayne",
                    TradingName       = "Batman's Super Hero Masks",
                    RegisteredAddress = new Address
                    {
                        AddressLine1 = "Checkout.com",
                        AddressLine2 = "90 Tottenham Court Road",
                        City         = "London",
                        State        = "London",
                        Zip          = "WIT 4TJ",
                        Country      = CountryCode.GB
                    },
                    NationalTaxId = "TAX123456",
                    DateOfBirth   = new DateOfBirth {
                        Day = 5, Month = 6, Year = 1996
                    },
                    Identification = new Identification {
                        NationalIdNumber = "AB123456C"
                    },
                },
            };

            OnboardEntityResponse entityResponse = await DefaultApi.AccountsClient().CreateEntity(onboardEntityRequest);

            entityResponse.ShouldNotBeNull();

            string entityId = entityResponse.Id;

            entityId.ShouldNotBeNullOrEmpty();
            entityResponse.Reference.ShouldBe(randomReference);

            OnboardEntityDetailsResponse entityDetailsResponse = await DefaultApi.AccountsClient().GetEntity(entityId);

            entityDetailsResponse.ShouldNotBeNull();
            entityDetailsResponse.Id.ShouldBe(entityId);
            entityDetailsResponse.Reference.ShouldBe(randomReference);
            entityDetailsResponse.ContactDetails.ShouldNotBeNull();
            entityDetailsResponse.ContactDetails.Phone.ShouldNotBeNull();
            entityDetailsResponse.ContactDetails.Phone.Number.ShouldBe(onboardEntityRequest.ContactDetails.Phone
                                                                       .Number);
            entityDetailsResponse.Individual.ShouldNotBeNull();
            entityDetailsResponse.Individual.FirstName.ShouldBe(onboardEntityRequest.Individual.FirstName);
            entityDetailsResponse.Individual.LastName.ShouldBe(onboardEntityRequest.Individual.LastName);
            entityDetailsResponse.Individual.TradingName.ShouldBe(onboardEntityRequest.Individual.TradingName);
            entityDetailsResponse.Individual.NationalTaxId.ShouldBe(onboardEntityRequest.Individual.NationalTaxId);

            onboardEntityRequest.Individual.FirstName = "John";

            OnboardEntityResponse updatedEntityResponse =
                await DefaultApi.AccountsClient().UpdateEntity(entityId, onboardEntityRequest);

            updatedEntityResponse.ShouldNotBeNull();
            updatedEntityResponse.HttpStatusCode.ShouldNotBeNull();
            updatedEntityResponse.ResponseHeaders.ShouldNotBeNull();

            OnboardEntityDetailsResponse verifyUpdated = await DefaultApi.AccountsClient().GetEntity(entityId);

            verifyUpdated.ShouldNotBeNull();
            onboardEntityRequest.Individual.FirstName.ShouldBe(verifyUpdated.Individual.FirstName);
        }