public void MockcreateCustomerProfileTest() { //define all mocked objects as final var mockController = GetMockController<createCustomerProfileRequest, createCustomerProfileResponse>(); var mockRequest = new createCustomerProfileRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var mockResponse = new createCustomerProfileResponse { refId = "1234", sessionToken = "sessiontoken", customerProfileId = "1234", customerPaymentProfileIdList = new [] {"12345"}, customerShippingAddressIdList = new[] { "12345" }, validationDirectResponseList = new string[] {}, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<createCustomerProfileRequest, createCustomerProfileResponse, createCustomerProfileController>( 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.customerProfileId); LogHelper.info(Logger, "createCustomerProfile: Details:{0}", controllerResponse.customerProfileId); }
public void MockdecryptPaymentDataTest() { //define all mocked objects as final var mockController = GetMockController<decryptPaymentDataRequest, decryptPaymentDataResponse>(); var mockRequest = new decryptPaymentDataRequest { merchantAuthentication = new merchantAuthenticationType() {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var mockResponse = new decryptPaymentDataResponse { refId = "1234", sessionToken = "sessiontoken", paymentDetails = new paymentDetails() { amount = "15.50" } }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<decryptPaymentDataRequest, decryptPaymentDataResponse, decryptPaymentDataController>( 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.paymentDetails); LogHelper.info(Logger, "decryptPaymentData: PaymentDetailsAmount:{0}", controllerResponse.paymentDetails.amount); }
public void MockARBCancelSubscriptionTest() { //define all mocked objects as final var mockController = GetMockController<ARBCancelSubscriptionRequest, ARBCancelSubscriptionResponse>(); var mockRequest = new ARBCancelSubscriptionRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var mockResponse = new ARBCancelSubscriptionResponse { refId = "1234", sessionToken = "sessiontoken", }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<ARBCancelSubscriptionRequest, ARBCancelSubscriptionResponse, ARBCancelSubscriptionController>( 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); LogHelper.info(Logger, "ARBCancelSubscription: "); }
public void MockgetBatchStatisticsTest() { //define all mocked objects as final var mockController = GetMockController<getBatchStatisticsRequest, getBatchStatisticsResponse>(); var mockRequest = new getBatchStatisticsRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var batchDetaisType = new batchDetailsType { batchId = "1234", }; var mockResponse = new getBatchStatisticsResponse { refId = "1234", sessionToken = "sessiontoken", batch = batchDetaisType, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<getBatchStatisticsRequest, getBatchStatisticsResponse, getBatchStatisticsController>( 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.batch); LogHelper.info(Logger, "getBatchStatistics: Details:{0}", controllerResponse.batch); }
public void MockmobileDeviceLoginTest() { //define all mocked objects as final var mockController = GetMockController<mobileDeviceLoginRequest, mobileDeviceLoginResponse>(); var mockRequest = new mobileDeviceLoginRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var transRetailInfoType = new transRetailInfoType { deviceType = "android", marketType = "marketplace", }; var mockResponse = new mobileDeviceLoginResponse { refId = "1234", sessionToken = "sessiontoken", merchantAccount = transRetailInfoType, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<mobileDeviceLoginRequest, mobileDeviceLoginResponse, mobileDeviceLoginController>( 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.merchantAccount); LogHelper.info(Logger, "mobileDeviceLogin: Details:{0}", controllerResponse.merchantAccount); }
public void MockARBGetSubscriptionListTest() { //define all mocked objects as final var mockController = GetMockController<ARBGetSubscriptionListRequest, ARBGetSubscriptionListResponse>(); var mockRequest = new ARBGetSubscriptionListRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, refId = RefId, searchType = ARBGetSubscriptionListSearchTypeEnum.subscriptionActive, paging = new Paging { limit = 100, offset = 1 }, sorting = new ARBGetSubscriptionListSorting { orderBy = ARBGetSubscriptionListOrderFieldEnum.id, orderDescending = false }, }; var subscriptionDetail = new SubscriptionDetail { id = 1234, accountNumber = "1234", amount = SetValidTransactionAmount(Counter) / 100, }; var subscriptionDetails = new List<SubscriptionDetail> { subscriptionDetail }; var mockResponse = new ARBGetSubscriptionListResponse { refId = "1234", sessionToken = "sessiontoken", subscriptionDetails = subscriptionDetails.ToArray(), totalNumInResultSet = subscriptionDetails.Count, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<ARBGetSubscriptionListRequest, ARBGetSubscriptionListResponse, ARBGetSubscriptionListController>( 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.subscriptionDetails); LogHelper.info(Logger, "ARBGetSubscriptionList: Count:{0}, Details:{1}", controllerResponse.totalNumInResultSet, controllerResponse.subscriptionDetails); }
public void MockcreateFingerPrintTest() { var fingerPrintSupportInformation = new fingerPrintSupportInformationType { amount = SetValidTransactionAmount(Counter) / 100, currencyCode = "INR", sequence = CounterStr, timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), }; //define all mocked objects as final var mockController = GetMockController<createFingerPrintRequest, createFingerPrintResponse>(); var mockRequest = new createFingerPrintRequest { merchantAuthentication = new merchantAuthenticationType() {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, supportInformation = fingerPrintSupportInformation, }; var mockResponse = new createFingerPrintResponse { refId = "1234", sessionToken = "sessiontoken", supportInformation = fingerPrintSupportInformation, fingerPrint = new fingerPrintType { sequence = fingerPrintSupportInformation.sequence, timestamp = fingerPrintSupportInformation.timestamp, hashValue = CounterStr, }, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<createFingerPrintRequest, createFingerPrintResponse, createFingerPrintController>( 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.fingerPrint); LogHelper.info(Logger, "createFingerPrint: Details:{0}", controllerResponse.fingerPrint); }
public void MockcreateCustomerProfileTransactionTest() { //define all mocked objects as final var mockController = GetMockController<createCustomerProfileTransactionRequest, createCustomerProfileTransactionResponse>(); var mockRequest = new createCustomerProfileTransactionRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, transaction = new profileTransactionType { Item = new profileTransAuthCaptureType(), }, }; var transactionResponse = new transactionResponse() { accountNumber = "1234", }; var mockResponse = new createCustomerProfileTransactionResponse { refId = "1234", sessionToken = "sessiontoken", transactionResponse = transactionResponse, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<createCustomerProfileTransactionRequest, createCustomerProfileTransactionResponse, createCustomerProfileTransactionController>( 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.transactionResponse); LogHelper.info(Logger, "createCustomerProfileTransaction: Details:{0}", controllerResponse.transactionResponse); }
public void MockgetCustomerPaymentProfileListTest() { //define all mocked objects as final var mockController = GetMockController<getCustomerPaymentProfileListRequest, getCustomerPaymentProfileListResponse>(); var mockRequest = new getCustomerPaymentProfileListRequest { merchantAuthentication = new merchantAuthenticationType() {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, searchType = CustomerPaymentProfileSearchTypeEnum.cardsExpiringInMonth, month = "2020-12" }; var BankAccountMaskedType = new bankAccountMaskedType() { accountType = bankAccountTypeEnum.savings, accountTypeSpecified = true, routingNumber = "1234", accountNumber = "1234", nameOnAccount = "Test", echeckType = echeckTypeEnum.ARC }; var PaymentMaskedType = new paymentMaskedType() { Item = BankAccountMaskedType }; var CustomerAddress = new customerAddressType { firstName = GetRandomString("FName"), lastName = GetRandomString("LName"), company = GetRandomString("Company"), address = GetRandomString("StreetAdd"), city = "Bellevue", state = "WA", zip = "98000", country = "USA", phoneNumber = FormatToPhone(Counter), faxNumber = FormatToPhone(Counter + 1), }; var paymentProfile = new customerPaymentProfileListItemType() { customerPaymentProfileId = 1234, customerProfileId = 1234, billTo = CustomerAddress, payment = PaymentMaskedType }; var PaymentProfiles = new List<customerPaymentProfileListItemType> { paymentProfile }; var mockResponse = new getCustomerPaymentProfileListResponse { refId = "1234", sessionToken = "sessiontoken", totalNumInResultSet = PaymentProfiles.Count, paymentProfiles = PaymentProfiles.ToArray() }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<getCustomerPaymentProfileListRequest, getCustomerPaymentProfileListResponse, getCustomerPaymentProfileListController>( 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.totalNumInResultSet); Assert.IsNotNull(controllerResponse.paymentProfiles); LogHelper.info(Logger, "getCustomerPaymentProfileList: Details:{0}", controllerResponse.paymentProfiles); }
public static void ANetApiResponse(ANetApiResponse argument) { if (null != argument) { messagesType(argument.messages); } }
public void MockARBGetSubscriptionTest() { //define all mocked objects as final var mockController = GetMockController<ARBGetSubscriptionRequest, ARBGetSubscriptionResponse>(); var mockRequest = new ARBGetSubscriptionRequest { merchantAuthentication = new merchantAuthenticationType() {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, subscriptionId = "1234" }; var customerPaymentProfileMaskedType = new customerPaymentProfileMaskedType { customerPaymentProfileId = "1234", }; Random rnd = new Random(DateTime.Now.Millisecond); var SubscriptionMaskedType = new ARBSubscriptionMaskedType() { name = "Test", paymentSchedule = new paymentScheduleType { interval = new paymentScheduleTypeInterval { length = 1, unit = ARBSubscriptionUnitEnum.months, }, startDate = DateTime.UtcNow, totalOccurrences = 12 }, amount = 9.99M, amountSpecified = true, trialAmount = 100, trialAmountSpecified = true, status = ARBSubscriptionStatusEnum.active, statusSpecified = true, profile = new subscriptionCustomerProfileType() { paymentProfile = customerPaymentProfileMaskedType, }, order = new orderType { description = string.Format("member monthly {0}", rnd.Next(99999)) } }; var mockResponse = new ARBGetSubscriptionResponse { refId = "1234", sessionToken = "sessiontoken", subscription = SubscriptionMaskedType }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<ARBGetSubscriptionRequest, ARBGetSubscriptionResponse, ARBGetSubscriptionController>( 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.subscription); LogHelper.info(Logger, "ARBGetSubscription: Details:{0}", controllerResponse.subscription); }