public ProcessorResponse RefundRequestOnOtherCreditCard(CreditCardProcessorProcessingInfo creditCardProcessorProcessingInfo)
        {
            creditCardProcessorProcessingInfo.RequestType = ProcessorRequestType.Refund;
            var rawResponse = PostRequest(BuildPostRequest(creditCardProcessorProcessingInfo));

            return(new ProcessorResponse(rawResponse));
        }
        private ProcessorResponse CheckCreditCard(ChargeCard chargeCard)
        {
            var creditCardProcessingInfo = new CreditCardProcessorProcessingInfo
            {
                CreditCardNo = chargeCard.Number,
                SecurityCode = chargeCard.CVV,
                ExpiryMonth  = chargeCard.ExpirationDate.Month,
                ExpiryYear   = chargeCard.ExpirationDate.Year,
                CardType     = chargeCard.TypeId.ToString(),
                Price        = "1",
                Currency     = "USD"
            };

            return(_paymentProcessor.AuthorizeOnly(creditCardProcessingInfo));
        }
Exemple #3
0
        public AuthorizeNetCreditCardPaymentGatewayTester()
        {
            _fakeSettings = new Fakes.FakeSettings();
            VAILD_TEST_CC = new CreditCardProcessorProcessingInfo()
            {
                CreditCardNo      = "4111111111111111",
                SecurityCode      = "458",
                ExpiryMonth       = 12,
                ExpiryYear        = 2012,
                CardType          = "Visa",
                Price             = "100",
                FirstName         = "Tester",
                LastName          = "Tester",
                BillingAddress    = "Address1",
                BillingCity       = "Austin",
                BillingState      = "Texas",
                BillingPostalCode = "78705",
                BillingCountry    = "US",
                Email             = "*****@*****.**",
                IpAddress         = "192.168.1.2",
                Currency          = "USD",
                OrderId           = "Cus005"
            };

            VALID_REAL_CC = new CreditCardProcessorProcessingInfo()
            {
                CreditCardNo      = "4111111111111111",
                SecurityCode      = "458",
                ExpiryMonth       = 12,
                ExpiryYear        = 2012,
                CardType          = "Visa",
                Price             = "100",
                FirstName         = "Tester",
                LastName          = "Tester",
                BillingAddress    = "Address1",
                BillingCity       = "Austin",
                BillingState      = "Texas",
                BillingPostalCode = "78705",
                BillingCountry    = "US",
                Email             = "*****@*****.**",
                IpAddress         = "192.168.1.2",
                Currency          = "USD",
                OrderId           = "Cus005"
            };

            _authorizeNetCreditCardPaymentGateway = new AuthorizeNetCreditCardPaymentGateway(_fakeSettings);
        }
        private string BuildPostRequest(CreditCardProcessorProcessingInfo processingInfo)
        {
            var strPost = new StringBuilder();

            //billing
            strPost.Append(String.Format("x_login={0}&", _settings.ProcessorLogin));
            strPost.Append(String.Format("x_tran_key={0}&", _settings.ProcessorTransactionKey));
            strPost.Append(String.Format("x_method={0}&", "CC"));
            strPost.Append(String.Format("x_type={0}&", (processingInfo.RequestType == ProcessorRequestType.Refund ? "CREDIT" : "AUTH_CAPTURE")));
            strPost.Append(String.Format("x_amount={0}&", Math.Round(decimal.Parse(processingInfo.Price), 2)));


            strPost.Append(String.Format("x_card_num={0}&", processingInfo.CreditCardNo));
            strPost.Append(String.Format("x_exp_date={0}&", processingInfo.ExpiryMonth.ToString().PadLeft(2, '0') + processingInfo.ExpiryYear));


            strPost.Append(String.Format("x_first_name={0}&", processingInfo.FirstName));
            strPost.Append(String.Format("x_last_name={0}&", processingInfo.LastName));
            strPost.Append(String.Format("x_address={0}&", processingInfo.BillingAddress));
            strPost.Append(String.Format("x_city={0}&", processingInfo.BillingCity));
            strPost.Append(String.Format("x_state={0}&", processingInfo.BillingState));
            strPost.Append(String.Format("x_zip={0}&", processingInfo.BillingPostalCode));
            strPost.Append(String.Format("x_country={0}&", processingInfo.BillingCountry));
            strPost.Append(String.Format("x_email={0}&", processingInfo.Email ?? ""));
            strPost.Append(String.Format("x_customer_ip={0}&", processingInfo.IpAddress ?? ""));


            //transaction addtional information
            strPost.Append(String.Format("x_description={0}&", processingInfo.Description));
            strPost.Append(String.Format("x_invoice_num={0}&", processingInfo.OrderId));

            strPost.Append(String.Format("x_test_request={0}&", (_settings.ProcessorUseTestTransaction ? "TRUE" : "FALSE")));
            strPost.Append("x_delim_data=TRUE&");
            strPost.Append("x_delim_char=|&");
            strPost.Append("x_relay_response=FALSE&");
            strPost.Append("x_version=3.1");

            return(strPost.ToString());
        }
        public ProcessorResponse AuthorizeOnly(CreditCardProcessorProcessingInfo processingInfo)
        {
            var strPost = new StringBuilder();

            strPost.Append(String.Format("x_login={0}&", _settings.ProcessorLogin));
            strPost.Append(String.Format("x_tran_key={0}&", _settings.ProcessorTransactionKey));
            strPost.Append(String.Format("x_method={0}&", "CC"));
            strPost.Append(String.Format("x_type={0}&", "AUTH_ONLY"));

            strPost.Append(String.Format("x_amount={0}&", Math.Round(decimal.Parse(processingInfo.Price), 2)));
            strPost.Append(String.Format("x_card_num={0}&", processingInfo.CreditCardNo));
            strPost.Append(String.Format("x_exp_date={0}&", processingInfo.ExpiryMonth.ToString().PadLeft(2, '0') + processingInfo.ExpiryYear));


            strPost.Append(String.Format("x_test_request={0}&", (_settings.ProcessorUseTestTransaction ? "TRUE" : "FALSE")));
            strPost.Append("x_delim_data=TRUE&");
            strPost.Append("x_delim_char=|&");
            strPost.Append("x_relay_response=FALSE&");
            strPost.Append("x_version=3.1");

            var rawResponse = PostRequest(strPost.ToString());

            return(new ProcessorResponse(rawResponse));
        }
 public ProcessorResponse ChargeCreditCard(CreditCardProcessorProcessingInfo creditCardProcessorProcessingInfo)
 {
     throw new NotImplementedException();
 }
 public ProcessorResponse AuthorizeOnly(CreditCardProcessorProcessingInfo processingInfo)
 {
     throw new NotImplementedException();
 }
 public ProcessorResponse RefundRequestOnOtherCreditCard(CreditCardProcessorProcessingInfo creditCardProcessorProcessingInfo)
 {
     throw new NotImplementedException();
 }
        public ProcessorResponse ChargeCreditCard(CreditCardProcessorProcessingInfo creditCardProcessorProcessingInfo)
        {
            var rawResponse = PostRequest(BuildPostRequest(creditCardProcessorProcessingInfo));

            return(new ProcessorResponse(rawResponse));
        }