Esempio n. 1
0
 public static void transactionSummaryType(transactionSummaryType request)
 {
     if (null != request)
     {
         if (request.hasReturnedItems)
         {
             request.hasReturnedItemsSpecified = true;
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a Transaction directly from the API Response
        /// </summary>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        public static Transaction NewFromResponse(transactionSummaryType trans)
        {
            var result = new Transaction();

            result.TransactionID = trans.transId;
            result.DateSubmitted = trans.submitTimeUTC;
            result.Status        = trans.transactionStatus;
            result.LastName      = trans.lastName;
            result.InvoiceNumber = trans.invoiceNumber;
            result.FirstName     = trans.firstName;
            result.SettleAmount  = trans.settleAmount;
            result.CardNumber    = trans.accountNumber;

            return(result);
        }
Esempio n. 3
0
        public void MockgetTransactionListTest()
        {
            //define all mocked objects as final
            var mockController = GetMockController <getTransactionListRequest, getTransactionListResponse>();
            var mockRequest    = new getTransactionListRequest
            {
                merchantAuthentication = new merchantAuthenticationType {
                    name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey
                },
            };
            var transactionSummaryType = new transactionSummaryType[]
            {
                new transactionSummaryType
                {
                    accountNumber = "1234",
                }
            };
            var mockResponse = new getTransactionListResponse
            {
                refId        = "1234",
                sessionToken = "sessiontoken",
                transactions = transactionSummaryType,
            };

            var errorResponse = new ANetApiResponse();
            var results       = new List <String>();
            const messageTypeEnum messageTypeOk = messageTypeEnum.Ok;

            SetMockControllerExpectations <getTransactionListRequest, getTransactionListResponse, getTransactionListController>(
                mockController.MockObject, mockRequest, mockResponse, errorResponse, results, messageTypeOk);
            mockController.MockObject.Execute(AuthorizeNet.Environment.CUSTOM);
            //mockController.MockObject.Execute();
            // or var controllerResponse = mockController.MockObject.ExecuteWithApiResponse(AuthorizeNet.Environment.CUSTOM);
            var controllerResponse = mockController.MockObject.GetApiResponse();

            Assert.IsNotNull(controllerResponse);

            Assert.IsNotNull(controllerResponse.transactions);
            LogHelper.info(Logger, "getTransactionList: Details:{0}", controllerResponse.transactions);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a Transaction directly from the API Response
        /// </summary>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        public static Transaction NewFromResponse(transactionSummaryType trans)
        {
            var result = new Transaction();

            result.TransactionID = trans.transId;
            result.DateSubmitted = trans.submitTimeUTC;
            result.Status        = trans.transactionStatus;
            result.LastName      = trans.lastName;
            result.InvoiceNumber = trans.invoiceNumber;
            result.FirstName     = trans.firstName;
            result.SettleAmount  = trans.settleAmount;
            result.CardNumber    = trans.accountNumber;
            result.CardType      = trans.accountType;

            result.MarketType     = trans.marketType;
            result.Product        = trans.product;
            result.MobileDeviceID = trans.mobileDeviceId;

            if ((trans.subscription != null) && (trans.subscription.id > 0))
            {
                result.Subscription        = new SubscriptionPayment();
                result.Subscription.ID     = trans.subscription.id;
                result.Subscription.PayNum = trans.subscription.payNum;
            }

            if (trans.hasReturnedItemsSpecified)
            {
                result.HasReturnedItems = trans.hasReturnedItems ? NullableBooleanEnum.True : NullableBooleanEnum.False;
            }
            else
            {
                result.HasReturnedItems = NullableBooleanEnum.Null;
            }

            return(result);
        }