Exemplo n.º 1
0
 /// <summary>
 /// Constructor for CheckTender
 /// </summary>
 /// <param name="Check">Check Payment object.</param>
 /// <remarks>This constructor is used to create a CheckTender
 ///  with CheckPayment as the payment device</remarks>
 ///  <example>
 ///  <code lang="C#" escaped="false">
 ///		.............
 ///		//Check is the CheckPayment object.
 ///		.............
 ///
 ///		CheckTender Tender = new CheckTender(Check);
 ///
 ///		..............
 ///  </code>
 ///  <code lang="C#" escaped="false">
 ///		.............
 ///		'Check is the CheckPayment object.
 ///		.............
 ///
 ///		Dim Tender As CheckTender = new CheckTender(Check)
 ///
 ///		..............
 ///  </code>
 ///  </example>
 /// <seealso cref="CheckPayment"/>
 public CheckTender(CheckPayment Check) : base(PayflowConstants.TENDERTYPE_TELECHECK, Check)
 {
 }
Exemplo n.º 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);
        }