public static void Run(String ApiLoginID, String ApiTransactionKey) { Console.WriteLine("Get Customer Payment Profile 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 getCustomerPaymentProfileRequest(); request.customerProfileId = "36594444"; request.customerPaymentProfileId = "33084787"; // instantiate the controller that will call the service var controller = new getCustomerPaymentProfileController(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); Console.WriteLine("Customer Payment Profile Id: " + response.paymentProfile.customerPaymentProfileId); } else { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } }
public void MockgetCustomerPaymentProfileTest() { //define all mocked objects as final var mockController = GetMockController<getCustomerPaymentProfileRequest, getCustomerPaymentProfileResponse>(); var mockRequest = new getCustomerPaymentProfileRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var customerPaymentProfileMaskedType = new customerPaymentProfileMaskedType { customerPaymentProfileId = "1234", }; var mockResponse = new getCustomerPaymentProfileResponse { refId = "1234", sessionToken = "sessiontoken", paymentProfile = customerPaymentProfileMaskedType, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<getCustomerPaymentProfileRequest, getCustomerPaymentProfileResponse, getCustomerPaymentProfileController>( 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.paymentProfile); LogHelper.info(Logger, "getCustomerPaymentProfile: Details:{0}", controllerResponse.paymentProfile); }
public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, string customerProfileId, string customerPaymentProfileId) { Console.WriteLine("Get Customer Payment Profile 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 getCustomerPaymentProfileRequest(); request.customerProfileId = customerProfileId; request.customerPaymentProfileId = customerPaymentProfileId; // Set this optional property to true to return an unmasked expiration date //request.unmaskExpirationDateSpecified = true; //request.unmaskExpirationDate = true; // instantiate the controller that will call the service var controller = new getCustomerPaymentProfileController(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); Console.WriteLine("Customer Payment Profile Id: " + response.paymentProfile.customerPaymentProfileId); if (response.paymentProfile.payment.Item is creditCardMaskedType) { Console.WriteLine("Customer Payment Profile Last 4: " + (response.paymentProfile.payment.Item as creditCardMaskedType).cardNumber); Console.WriteLine("Customer Payment Profile Expiration Date: " + (response.paymentProfile.payment.Item as creditCardMaskedType).expirationDate); if (response.paymentProfile.subscriptionIds != null && response.paymentProfile.subscriptionIds.Length > 0) { Console.WriteLine("List of subscriptions : "); for (int i = 0; i < response.paymentProfile.subscriptionIds.Length; i++) Console.WriteLine(response.paymentProfile.subscriptionIds[i]); } } } else if(response != null) { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } return response; }
public static void getCustomerPaymentProfileRequest(getCustomerPaymentProfileRequest argument) { if (null != argument) { } }
public static void getCustomerPaymentProfileRequest ( getCustomerPaymentProfileRequest request) { }