示例#1
0
        private TransactionResponse ChargeCreditCardVault(Guid vaultGuid, Person person, PaymentInfo paymentInfo, decimal amount, int tranid)
        {
            var creditCardVaultSaleRequest = new CreditCardVaultSaleRequest(_id,
                                                                            _key,
                                                                            vaultGuid,
                                                                            $"{paymentInfo.FirstName ?? person.FirstName} {paymentInfo.LastName ?? person.LastName}",
                                                                            new BillingAddress
            {
                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
            },
                                                                            amount, tranid.ToString(CultureInfo.InvariantCulture),
                                                                            person.PeopleId.ToString(CultureInfo.InvariantCulture));

            var response = creditCardVaultSaleRequest.Execute();

            return(new TransactionResponse
            {
                Approved = response.ApprovalIndicator == ApprovalIndicator.Approved,
                AuthCode = response.Code,
                Message = response.Message,
                TransactionId = response.Reference
            });
        }
示例#2
0
        private TransactionResponse ChargeCreditCardVault(int vaultId, int peopleId, decimal amount, int tranid,
                                                          string description)
        {
            var creditCardVaultSaleRequest = new CreditCardVaultSaleRequest(
                _userName,
                _password,
                vaultId.ToString(CultureInfo.InvariantCulture),
                amount,
                tranid.ToString(CultureInfo.InvariantCulture),
                description,
                peopleId.ToString(CultureInfo.InvariantCulture));

            var response = creditCardVaultSaleRequest.Execute();

            return(new TransactionResponse
            {
                Approved = response.ResponseStatus == ResponseStatus.Approved,
                AuthCode = response.AuthCode,
                Message = response.ResponseText,
                TransactionId = response.TransactionId
            });
        }