public override bool Authorize(IPaymentData data)
        {
            //Pre Conditions
            Contract.Requires(data.Customer != null, "Customer required");
            Contract.Requires(data.CardData != null, "CardData Required");
            Contract.Requires(data.CardData.BillingAddress != null, "CardData billing address required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.BillingAddress.AddressLine1), "CardData Street Address Required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.BillingAddress.City), "CardData City Required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.BillingAddress.Country), "CardData country required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.BillingAddress.PostalCode), "CardData postal code required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.CardNumber), "CardData cardnumber required");
            Contract.Requires(data.CardData.ExpirationMonth > 0, "CardData expiration month required");
            Contract.Requires(data.CardData.ExpirationYear >= System.DateTime.Now.Year, "CardData expiration year must be greater than or equal current year.");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.CardHolderName), "CardData carholder name required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.Customer.FirstName), "PaymentData first name required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.Customer.LastName), "PaymentData last name required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.CardHolderFirstName), "PaymentData cardholder first name required");
            Contract.Requires(!String.IsNullOrWhiteSpace(data.CardData.CardHolderLastName), "PaymentData cardholder last name required");
            Contract.Requires(data.Transaction != null, "PaymentData transaction required");
            Contract.Requires(data.Transaction.Amount > 0, "PaymentData transaction amount must be greater than zero");
            //Post Conditions
            Contract.Ensures(data.Transaction.TransactionMessages.Count > 0, "A critical error was encountered left control of authorize without assigning  transaction result messages");

            if (!SupportsAuthorize)
                throw new System.NotSupportedException("Authorize not supported by gateway");
            //If profile exists then the profile id will be returned            
            IGatewayProfile profile = GetOrCreateCustomerProfile(data);
            var customerPaymentProfile = data.MapPaymentDataToCustomerPaymentProfileType();                   
            var paymentProfile = GetOrCreateCustomerPaymentProfile(profile, data);
            var transaction = data.MapPaymentDataToProfileTransAuthCaptureType(long.Parse(paymentProfile.Id), long.Parse(profile.Id));
            var transactionResult = GatewayHelper.CreateProfileTransaction(transaction);
            data.Transaction.TransactionMessages.AddRange(GetTransactionMessage(transactionResult.messages,"createCustomerProfileTransactionResponse"));
           

            
            return transactionResult.messages.resultCode == AuthorizeNet.APICore.messageTypeEnum.Ok;
        }