public static void Run(string apiLoginId, string apiTransactionKey) { Console.WriteLine("Get Customer Shipping Address 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, }; var request = new getCustomerShippingAddressRequest(); request.customerProfileId = "36594444"; request.customerAddressId = "34743195"; // instantiate the controller that will call the service var controller = new getCustomerShippingAddressController(request); controller.Execute(); // get the response from the service (errors contained if any) var response = controller.GetApiResponse(); if (response.messages.resultCode == messageTypeEnum.Ok) { Console.WriteLine(response.messages.message[0].text); } else { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } }
public void MockgetCustomerShippingAddressTest() { //define all mocked objects as final var mockController = GetMockController<getCustomerShippingAddressRequest, getCustomerShippingAddressResponse>(); var mockRequest = new getCustomerShippingAddressRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var customerAddressExType = new customerAddressExType { customerAddressId = "1234", }; var mockResponse = new getCustomerShippingAddressResponse { refId = "1234", sessionToken = "sessiontoken", address = customerAddressExType, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<getCustomerShippingAddressRequest, getCustomerShippingAddressResponse, getCustomerShippingAddressController>( 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.address); LogHelper.info(Logger, "getCustomerShippingAddress: Details:{0}", controllerResponse.address); }
public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, string customerProfileId, string customerAddressId) { Console.WriteLine("Get Customer Shipping Address 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, }; var request = new getCustomerShippingAddressRequest(); request.customerProfileId = customerProfileId; request.customerAddressId = customerAddressId; // instantiate the controller that will call the service var controller = new getCustomerShippingAddressController(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) { Console.WriteLine(response.messages.message[0].text); if (response.subscriptionIds != null && response.subscriptionIds.Length > 0) { Console.WriteLine("List of subscriptions : "); for (int i = 0; i < response.subscriptionIds.Length; i++) Console.WriteLine(response.subscriptionIds[i]); } } else if(response != null) { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } return response; }
public static void getCustomerShippingAddressRequest(getCustomerShippingAddressRequest argument) { if (null != argument) { } }
public static void getCustomerShippingAddressRequest ( getCustomerShippingAddressRequest request) { }