public static void customerDataType(customerDataType request) { if (null != request) { if (0 <= (int)request.type) { request.typeSpecified = true; } } }
public static void customerDataType(customerDataType argument) { if (null != argument) { if (0 <= (int)argument.type) { argument.typeSpecified = true; } driversLicenseType(argument.driversLicense); } }
private long GetTransactionId() { //Creates a credit card transaction and returns the transactions ID. //Common code to set for all requests ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = CustomMerchantAuthenticationType; ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment; //set up data based on transaction var transactionAmount = SetValidTransactionAmount(Counter); var creditCard = new creditCardType { cardNumber = "4111111111111111", expirationDate = "0622" }; var aCustomer = new customerDataType { email = string.Format( "{0}@b.bla", Counter)}; //standard api call to retrieve response var paymentType = new paymentType { Item = creditCard }; var transactionRequest = new transactionRequestType { transactionType = transactionTypeEnum.authOnlyTransaction.ToString(), payment = paymentType, amount = transactionAmount, customer = aCustomer, }; var request = new createTransactionRequest { transactionRequest = transactionRequest }; var controller = new createTransactionController(request); controller.Execute(); var response = controller.GetApiResponse(); //validate Assert.NotNull(response); Assert.NotNull(response.messages); Assert.NotNull(response.transactionResponse); Assert.AreEqual(messageTypeEnum.Ok, response.messages.resultCode); Assert.False(string.IsNullOrEmpty(response.transactionResponse.transId)); long transactionId; long.TryParse(response.transactionResponse.transId, out transactionId); Assert.AreNotEqual(0, transactionId); return transactionId; }