public static void Run(String ApiLoginID, String ApiTransactionKey) { Console.WriteLine("DeleteCustomerProfile Sample"); ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX; ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType() { name = ApiLoginID, ItemElementName = ItemChoiceType.transactionKey, Item = ApiTransactionKey, }; var request = new deleteCustomerProfileRequest { customerProfileId = "36537239" }; //Prepare Request var controller = new deleteCustomerProfileController(request); controller.Execute(); //Send Request to EndPoint deleteCustomerProfileResponse response = controller.GetApiResponse(); if (response != null && response.messages.resultCode == messageTypeEnum.Ok) { if (response != null && response.messages.message != null) { Console.WriteLine("Success, ResultCode : " + response.messages.resultCode.ToString()); } } else { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } }
public void MockdeleteCustomerProfileTest() { //define all mocked objects as final var mockController = GetMockController<deleteCustomerProfileRequest, deleteCustomerProfileResponse>(); var mockRequest = new deleteCustomerProfileRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var mockResponse = new deleteCustomerProfileResponse { refId = "1234", sessionToken = "sessiontoken", }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<deleteCustomerProfileRequest, deleteCustomerProfileResponse, deleteCustomerProfileController>( 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); }
public static void deleteCustomerProfileRequest(deleteCustomerProfileRequest argument) { if (null != argument) { } }
public static void deleteCustomerProfileRequest ( deleteCustomerProfileRequest request) { }
public void GetCustomerPaymentProfileListSampleTest() { LogHelper.info(Logger, "Sample getCustomerPaymentProfileList"); ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = CustomMerchantAuthenticationType; ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment; CustomerProfileType.paymentProfiles = new customerPaymentProfileType[] { getCustomerPaymentProfileObject() }; var createRequest = new createCustomerProfileRequest { refId = RefId, profile = CustomerProfileType }; //create a customer profile var createController = new createCustomerProfileController(createRequest); var createResponse = createController.ExecuteWithApiResponse(); Assert.NotNull(createResponse); LogHelper.info(Logger, "Created Customer profile : {0}", createResponse.customerProfileId); var getProfileListRequest = new getCustomerPaymentProfileListRequest { refId = RefId, searchType = CustomerPaymentProfileSearchTypeEnum.cardsExpiringInMonth, month = "2032-10" }; bool found = false; //setup retry loop to allow for delays in replication for (int counter = 0; counter < 5; counter++) { //get customer profile list var getProfileController = new getCustomerPaymentProfileListController(getProfileListRequest); var getProfileListResponse = getProfileController.ExecuteWithApiResponse(); for (int profile = 0; profile < getProfileListResponse.paymentProfiles.Length; profile++) { var profileId = Convert.ToString(getProfileListResponse.paymentProfiles[profile].customerPaymentProfileId); if (profileId.Equals(createResponse.customerPaymentProfileIdList[0])) { found = true; break; } } if (found) break; System.Threading.Thread.Sleep(10000); } Assert.IsTrue(found); //delete the created customer profile var deleteRequest = new deleteCustomerProfileRequest { refId = RefId, customerProfileId = createResponse.customerProfileId }; var deleteController = new deleteCustomerProfileController(deleteRequest); var deleteResponse = deleteController.ExecuteWithApiResponse(); Assert.IsNotNull(deleteResponse); }