コード例 #1
0
ファイル: ANetRequestTest.cs プロジェクト: IdeaFortune/Monaco
 public void ProcessAuthOnlyTest()
 {
     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
     ANetRequest target = new ANetRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction); // TODO: Initialize to an appropriate value
     ANetResponse expected = null; // TODO: Initialize to an appropriate value
     ANetResponse actual;
     actual = target.ProcessAuthOnly();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #2
0
        public override TransactionInfo PreAuthorize(GatewayInfo gateway, GatewayTypeInfo gatewayType, Guid orderId, ICustomer customer, CreditCardInfo card, decimal amount, bool testTransaction)
        {
            ANetRequest request = null;
            ANetResponse 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 ANetRequest(requestUrl, loginId, transactionKey, customer, card, amount, testTransaction);
            response = request.ProcessAuthOnly();

            transactionInfo.Id = Guid.NewGuid();
            //transactionInfo.CustomerName = System.Web.Security.Membership.GetUser(customer.ID).UserName;
            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 == ANetResponseCode.Approved)
            {
                transactionInfo.ResponseText = response.ResponseText;
                transactionInfo.Status = TransactionStatus.Approved;
            }
            else
            {
                transactionInfo.ResponseText = response.ResponseText;
                transactionInfo.Status = TransactionStatus.Error;
            }
            return transactionInfo;
        }