Esempio n. 1
0
 public void ProcessTest()
 {
     string requestUrl = string.Empty; // TODO: Initialize to an appropriate value
     string loginId = string.Empty; // TODO: Initialize to an appropriate value
     string transactionKey = string.Empty; // TODO: Initialize to an appropriate value
     ICustomer customer = null; // TODO: Initialize to an appropriate value
     CreditCardInfo card = null; // TODO: Initialize to an appropriate value
     Decimal amount = new Decimal(); // TODO: Initialize to an appropriate value
     bool testTransaction = false; // TODO: Initialize to an appropriate value
     ProPayRequest target = new ProPayRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction); // TODO: Initialize to an appropriate value
     ProPayResponse expected = null; // TODO: Initialize to an appropriate value
     ProPayResponse actual;
     actual = target.Process();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public override TransactionInfo ProcessSubscription(ref SubscriptionInfo sub, GatewayInfo gateway, GatewayTypeInfo gatewayType, ICustomer customer, CreditCardInfo card, bool isTrial, bool testTransaction)
        {
            ProPayRequest request = null;
            ProPayResponse response = null;
            TransactionInfo transactionInfo = new TransactionInfo();

            string requestUrl = testTransaction == true ? gatewayType.TestUrl : gatewayType.LiveUrl;
            string loginId = testTransaction == true ? gatewayType.TestLoginId : gateway.LoginId;
            string transactionKey = testTransaction == true ? gatewayType.TestTransactionKey : gateway.TransactionKey;
            decimal amount = isTrial == true ? sub.TrialAmount : sub.Amount;

            request = new ProPayRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction);
            response = request.Process();


            sub.LastProcessedDate = DateTime.Now;

            transactionInfo.Id = Guid.NewGuid();
            transactionInfo.SubscriptionId = sub.Id;
            transactionInfo.GatewayId = sub.GatewayId;
            transactionInfo.CreateDate = DateTime.Now;
            transactionInfo.IsTrial = isTrial;
            transactionInfo.Type = TransactionType.Standard;
            transactionInfo.Amount = amount;
            transactionInfo.GatewayAmount = gateway.TransactionFee;
            transactionInfo.OrderId = sub.RefId;
            if (response == null)
            {
                sub.LastProcessingStatus = TransactionStatus.Error;
                transactionInfo.ResponseText = "";
                transactionInfo.Status = TransactionStatus.Error;
            }
            else if (response.Code == ProPayResponseCode.Success)
            {
                sub.LastProcessingStatus = TransactionStatus.Approved;
                if (isTrial)
                    sub.TrialOccurrencesDone += 1;
                else
                    sub.TotalOccurrencesDone += 1;
                transactionInfo.ResponseText = response.ResponseText;
                transactionInfo.Status = TransactionStatus.Approved;
            }
            else
            {
                sub.LastProcessingStatus = TransactionStatus.Error;
                transactionInfo.ResponseText = response.ResponseText;
                transactionInfo.Status = TransactionStatus.Error;
            }
            return transactionInfo;
        }
Esempio n. 3
0
 public void ProPayRequestConstructorTest()
 {
     string requestUrl = string.Empty; // TODO: Initialize to an appropriate value
     string loginId = string.Empty; // TODO: Initialize to an appropriate value
     string transactionKey = string.Empty; // TODO: Initialize to an appropriate value
     ICustomer customer = null; // TODO: Initialize to an appropriate value
     CreditCardInfo card = null; // TODO: Initialize to an appropriate value
     Decimal amount = new Decimal(); // TODO: Initialize to an appropriate value
     bool testTransaction = false; // TODO: Initialize to an appropriate value
     ProPayRequest target = new ProPayRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
        public override TransactionInfo ProcessPayment(GatewayInfo gateway, GatewayTypeInfo gatewayType, Guid orderId, ICustomer customer, CreditCardInfo card, decimal amount, bool testTransaction)
        {
            ProPayRequest request = null;
            ProPayResponse response = null;
            TransactionInfo transactionInfo = new TransactionInfo();

            string requestUrl = testTransaction == true ? gatewayType.TestUrl : gatewayType.LiveUrl;
            string loginId = testTransaction == true ? gatewayType.TestLoginId : gateway.LoginId;
            string transactionKey = testTransaction == true ? gatewayType.TestTransactionKey : gateway.TransactionKey;

            request = new ProPayRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction);
            response = request.Process();



            transactionInfo.Id = Guid.NewGuid();
            transactionInfo.SubscriptionId = Guid.Empty;
            transactionInfo.GatewayId = gateway.Id;
            transactionInfo.CreateDate = DateTime.Now;
            //transactionInfo.IsTrial = ??;
            transactionInfo.Type = TransactionType.Standard;
            transactionInfo.Amount = amount;
            transactionInfo.GatewayAmount = gateway.TransactionFee;
            transactionInfo.OrderId = orderId;
            if (response == null)
            {
                transactionInfo.ResponseText = "";
                transactionInfo.Status = TransactionStatus.Error;
            }
            else if (response.Code == ProPayResponseCode.Success)
            {
                transactionInfo.ResponseText = response.ResponseText;
                transactionInfo.Status = TransactionStatus.Approved;
            }
            else
            {
                transactionInfo.ResponseText = response.ResponseText;
                transactionInfo.Status = TransactionStatus.Error;
            }
            return transactionInfo;
        }