public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey) { Console.WriteLine("Get transaction list sample"); ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX; // define the merchant information (authentication / transaction id) ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType() { name = ApiLoginID, ItemElementName = ItemChoiceType.transactionKey, Item = ApiTransactionKey, }; // unique batch id string batchId = "12345"; var request = new getTransactionListRequest(); request.batchId = batchId; // instantiate the controller that will call the service var controller = new getTransactionListController(request); controller.Execute(); // get the response from the service (errors contained if any) var response = controller.GetApiResponse(); if (response != null && response.messages.resultCode == messageTypeEnum.Ok) { if (response.transactions == null) return response; foreach (var transaction in response.transactions) { Console.WriteLine("Transaction Id: {0}", transaction.transId); Console.WriteLine("Submitted on (Local): {0}", transaction.submitTimeLocal); Console.WriteLine("Status: {0}", transaction.transactionStatus); Console.WriteLine("Settle amount: {0}", transaction.settleAmount); } } else if(response != null) { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } return response; }
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); }
public static void getTransactionListRequest(getTransactionListRequest argument) { if (null != argument) { } }
public static void getTransactionListRequest(getTransactionListRequest request) { }