public void BusinessCheckPaymentTest_DeclinedNegativeData()
        {
            var request = new BusinessCheckPaymentRequest
            {
                Amount             = 10,
                BillingInformation = new BillingInformation
                {
                    BilingZipcode   = "12345",
                    BillingAddress  = "1234 Address Way",
                    BillingCity     = "HomeTown",
                    BillingState    = "CA",
                    BillToFirstName = "John",
                    BillToLastName  = "Smith",
                    Country         = "USA",
                    BillToEmail     = "*****@*****.**",
                    BillToPhone     = "9123214928"
                },
                RoutingNumber = "11111",
                AccountNumber = "11111",
                CheckNumber   = "1001",
                Comment       = "Test Transacction",
                IPAddress     = "127.0.0.1",
                EIN_SSN       = "123345678",
                InvoiceNumber = "Inv12433"
            };
            var response = businessChckProvider.BusinessCheckPayment(request);

            Assert.AreEqual(request.Amount, response.Amount);
            Assert.AreEqual("12", response.ResponseCode);
            Assert.IsFalse(response.Success);
        }
예제 #2
0
        public PaymentResponse BusinessCheckPayment(BusinessCheckPaymentRequest req)
        {
            var     resp      = new PaymentResponse();
            Invoice Inv       = new Invoice();
            var     RequestID = PayflowUtility.RequestId;
            PayflowConnectionData Connection = new PayflowConnectionData(Host, Port, Timeout, "", 0, "", "");
            int  trxCount = 1;
            bool RespRecd = false;

            Currency Amt = new Currency(req.Amount);

            Amt.NoOfDecimalDigits = 0;
            Inv.Amt      = Amt;
            Inv.InvNum   = req.InvoiceNumber;
            Inv.Comment1 = req.Comment;

            // Create the BillTo object.
            Inv.BillTo = CreateBillTo(req.BillingInformation);

            // Create Credit Card data object.
            var payment = new PayPal.Payments.DataObjects.CheckPayment(req.RoutingNumber + req.AccountNumber + req.CheckNumber);

            // Create Card Tender data object.
            var tender = new CheckTender(payment)
            {
                ChkType = "C",
                SS      = req.EIN_SSN,
                ChkNum  = req.CheckNumber
            };


            UserInfo TeleCheckUser = new UserInfo(User, Vendor, Partner, Password);

            // Notice we set the request id earlier in the application and outside our loop.  This way if a response was not received
            // but PayPal processed the original request, you'll receive the original response with DUPLICATE set.
            AuthorizationTransaction Trans = new AuthorizationTransaction(TeleCheckUser, Connection, Inv, tender, RequestID);

            Trans.AddToExtendData(new ExtendData("AUTHTYPE", "I"));
            Trans.AddToExtendData(new ExtendData("CUSTIP", req.IPAddress));

            Trans.Verbosity = String.IsNullOrEmpty(Verbosity)? "HIGH" : Verbosity;


            while (trxCount <= 3 && !RespRecd)
            {
                Response Resp = Trans.SubmitTransaction();
                if (Resp != null)
                {
                    RespRecd = true;  // Got a response.
                    TransactionResponse TrxnResponse = Resp.TransactionResponse;
                    if (TrxnResponse != null)
                    {
                        resp = ProcessTransaction(TrxnResponse);
                    }
                }
                else
                {
                    trxCount++;
                }
            }

            if (!RespRecd)
            {
                resp.Success = false;
                resp.Message = "Payment not processed.  Please contact Customer Service";
            }

            return(resp);
        }