private int CreateCreditCardVault(Person person, PaymentInfo paymentInfo, string cardNumber, string expiration)
        {
            var createCreditCardVaultRequest = new CreateCreditCardVaultRequest(
                _userName,
                _password,
                new CreditCard
            {
                CardNumber     = cardNumber,
                Expiration     = expiration,
                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 = createCreditCardVaultRequest.Execute();

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

            return(response.VaultId.ToInt());
        }
Beispiel #2
0
        private Guid CreateCreditCardVault(Person person, string cardNumber, string expiration)
        {
            var createCreditCardVaultRequest = new CreateCreditCardVaultRequest(_id, _key, expiration, cardNumber);

            var response = createCreditCardVaultRequest.Execute();

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

            return(response.VaultGuid);
        }