/// <summary> /// Post /createAccountHolder API call /// </summary> /// <param name="createAccountHolderRequest"></param> /// <returns>CloseAccountHolderResponse</returns> public CreateAccountHolderResponse CreateAccountHolder(CreateAccountHolderRequest createAccountHolderRequest) { var jsonRequest = Util.JsonOperation.SerializeRequest(createAccountHolderRequest); var jsonResponse = _createAccountHolder.Request(jsonRequest); return(JsonConvert.DeserializeObject <CreateAccountHolderResponse>(jsonResponse)); }
public void TestCreateAccountHolderError() { var client = CreateMockTestClientNullRequiredFieldsRequest("Mocks/marketpay/account/create-account-holder-error-invalid-fields.json"); var account = new Account(client); var createAccountHolderRequest = new CreateAccountHolderRequest(accountHolderCode: "123456", accountHolderDetails: new AccountHolderDetails(email: "*****@*****.**", fullPhoneNumber: "123456789", webAddress: "webaddress")); var createAccountHolderResponse = account.CreateAccountHolder(createAccountHolderRequest); Assert.AreEqual(createAccountHolderResponse.PspReference, "8815813233102537"); Assert.IsNotNull(createAccountHolderResponse.InvalidFields); Assert.AreEqual(createAccountHolderResponse.InvalidFields[0].ErrorCode, 28); Assert.AreEqual(createAccountHolderResponse.InvalidFields[0].FieldType.Field, "accountHolderCode"); Assert.AreEqual(createAccountHolderResponse.InvalidFields[0].FieldType.FieldName, FieldType.FieldNameEnum.AccountHolderCode); }
public void TestCreateAccountHolderSuccess() { var client = CreateMockTestClientNullRequiredFieldsRequest("Mocks/marketpay/account/create-account-holder-success.json"); var account = new Account(client); var createAccountHolderRequest = new CreateAccountHolderRequest(accountHolderCode: "123456", accountHolderDetails: new AccountHolderDetails(email: "*****@*****.**", fullPhoneNumber: "123456789", webAddress: "webaddress")); var createAccountHolderResponse = account.CreateAccountHolder(createAccountHolderRequest); Assert.AreEqual(createAccountHolderResponse.PspReference, "8815810875863517"); Assert.AreEqual(createAccountHolderResponse.AccountCode, "8815810875863525"); Assert.AreEqual(createAccountHolderResponse.AccountHolderCode, "97112729718522222"); Assert.AreEqual(createAccountHolderResponse.AccountHolderDetails.Address.Country, "US"); Assert.AreEqual(createAccountHolderResponse.AccountHolderDetails.IndividualDetails.Name.FirstName, "John"); Assert.AreEqual(createAccountHolderResponse.AccountHolderDetails.IndividualDetails.Name.Gender, ViasName.GenderEnum.MALE); Assert.AreEqual(createAccountHolderResponse.AccountHolderDetails.IndividualDetails.Name.LastName, "Smith"); Assert.AreEqual(createAccountHolderResponse.AccountHolderStatus.Status, AccountHolderStatus.StatusEnum.Active); Assert.AreEqual(createAccountHolderResponse.LegalEntity, CreateAccountHolderResponse.LegalEntityEnum.Individual); Assert.AreEqual(createAccountHolderResponse.AccountHolderStatus.Status, AccountHolderStatus.StatusEnum.Active); Assert.AreEqual(createAccountHolderResponse.AccountHolderStatus.PayoutState.AllowPayout, false); Assert.AreEqual(createAccountHolderResponse.AccountHolderStatus.PayoutState.Disabled, false); Assert.AreEqual(createAccountHolderResponse.AccountHolderStatus.PayoutState.Disabled, false); Assert.IsNotNull(createAccountHolderResponse.Verification.AccountHolder.Checks); }