예제 #1
0
        private int CreateAchVault(Person person, PaymentInfo paymentInfo, string accountNumber, string routingNumber)
        {
            var createAchVaultRequest = new CreateAchVaultRequest(
                _userName,
                _password,
                new Ach
            {
                NameOnAccount =
                    $"{paymentInfo.FirstName ?? person.FirstName} {paymentInfo.LastName ?? person.LastName}",
                AccountNumber  = accountNumber,
                RoutingNumber  = routingNumber,
                Type           = AchType(person.PeopleId),
                BillingAddress = new BillingAddress
                {
                    FirstName = paymentInfo.FirstName ?? person.FirstName,
                    LastName  = paymentInfo.LastName ?? person.LastName,
                    Address1  = paymentInfo.Address ?? person.PrimaryAddress,
                    City      = paymentInfo.City ?? person.PrimaryCity,
                    State     = paymentInfo.State ?? person.PrimaryState,
                    Zip       = paymentInfo.Zip ?? person.PrimaryZip,
                    Email     = person.EmailAddress,
                    Phone     = paymentInfo.Phone ?? person.HomePhone ?? person.CellPhone
                }
            });

            var response = createAchVaultRequest.Execute();

            if (response.ResponseStatus != ResponseStatus.Approved)
            {
                throw new Exception(
                          $"TransNational failed to create the ach account for people id: {person.PeopleId}, responseCode: {response.ResponseCode}, responseText: {response.ResponseText}");
            }

            return(response.VaultId.ToInt());
        }
예제 #2
0
        private Guid CreateAchVault(Person person, string accountNumber, string routingNumber)
        {
            var createAchVaultRequest = new CreateAchVaultRequest(_id, _key, accountNumber, routingNumber);

            var response = createAchVaultRequest.Execute();

            if (!response.Success)
            {
                throw new Exception(
                          $"Sage failed to create the ach account for people id: {person.PeopleId}, message: {response.Message}");
            }

            return(response.VaultGuid);
        }