public override void Connect(Communications.Irc.Configuration.Network network) { Network = network; Server = Network.ServerList.First(); Connect(); }
public void TestUnload() { unload unload = new unload(); unload.orderId = "2"; unload.orderSource = orderSourceType.ecommerce; unload.card = new giftCardCardType(); var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<unload.*?<orderId>2</orderId>.*?</unload>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><unloadResponse><cnpTxnId>123</cnpTxnId></unloadResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); unloadResponse unloadResponse = cnp.Unload(unload); Assert.AreEqual(123, unloadResponse.cnpTxnId); }
private void Initialize() { instance = this; floatSubscribers = new Dictionary <string, Action <float> >(); stringSubscribers = new Dictionary <string, Action <string> >(); sendQueue = new Queue <string>(); remoteEndPoint = new IPEndPoint(IPAddress.Parse(ip), port); receiveEndPoint = new IPEndPoint(IPAddress.Parse(ip), receivePort); sendClient = new UdpClient(); receiveClient = new UdpClient(receivePort); receiveThread = new Thread(new ThreadStart(ReceiveDataListener)); receiveThread.IsBackground = true; receiveThread.Start(); isInitialized = true; }
public void TestSurchargeAmount_Tied() { credit credit = new credit(); credit.amount = 2; credit.surchargeAmount = 1; credit.litleTxnId = 3; credit.processingInstructions = new processingInstructions(); credit.reportGroup = "Planets"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleTxnId>3</litleTxnId>\r\n<amount>2</amount>\r\n<surchargeAmount>1</surchargeAmount>\r\n<process.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><creditResponse><litleTxnId>123</litleTxnId></creditResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.Credit(credit); }
public void TestActionReasonOnOrphanedRefund() { credit credit = new credit(); credit.orderId = "12344"; credit.amount = 2; credit.orderSource = orderSourceType.ecommerce; credit.reportGroup = "Planets"; credit.actionReason = "SUSPECT_FRAUD"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<actionReason>SUSPECT_FRAUD</actionReason>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><creditResponse><litleTxnId>123</litleTxnId></creditResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.Credit(credit); }
public void testBalanceInquiry() { balanceInquiry balanceInquiry = new balanceInquiry(); balanceInquiry.orderId = "2"; balanceInquiry.orderSource = orderSourceType.ecommerce; balanceInquiry.card = new giftCardCardType(); var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<balanceInquiry.*?<orderId>2</orderId>.*?</balanceInquiry>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><balanceInquiryResponse><litleTxnId>123</litleTxnId></balanceInquiryResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); balanceInquiryResponse balanceInquiryResponse = litle.BalanceInquiry(balanceInquiry); Assert.AreEqual(123, balanceInquiryResponse.litleTxnId); }
public void testDeactivate() { deactivate deactivate = new deactivate(); deactivate.orderId = "2"; deactivate.orderSource = orderSourceType.ecommerce; deactivate.card = new giftCardCardType(); var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<deactivate.*?<orderId>2</orderId>.*?</deactivate>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><deactivateResponse><litleTxnId>123</litleTxnId></deactivateResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); deactivateResponse deactivateResponse = litle.Deactivate(deactivate); Assert.AreEqual(123, deactivateResponse.litleTxnId); }
public void TestFraudFilterOverride() { sale sale = new sale(); sale.orderId = "12344"; sale.amount = 2; sale.orderSource = orderSourceType.ecommerce; sale.reportGroup = "Planets"; sale.fraudFilterOverride = false; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<fraudFilterOverride>false</fraudFilterOverride>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><saleResponse><cnpTxnId>123</cnpTxnId></saleResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); cnp.Sale(sale); }
public void TestQueryTransactionResponse() { queryTransaction query = new queryTransaction(); query.id = "myId"; query.reportGroup = "myReportGroup"; query.origId = "12345"; query.origActionType = actionTypeEnum.D; query.origCnpTxnId = 54321; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<queryTransaction.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='10.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><queryTransactionResponse id='FindAuth' reportGroup='Mer5PM1' customerId='1'><response>000</response><responseTime>2015-12-03T10:30:02</responseTime><message>Original transaction found</message><results_max10><authorizationResponse id='1' reportGroup='defaultReportGroup'><cnpTxnId>756027696701750</cnpTxnId><orderId>GenericOrderId</orderId><response>000</response><responseTime>2015-04-14T12:04:59</responseTime><postDate>2015-04-14</postDate><message>Approved</message><authCode>055858</authCode></authorizationResponse><authorizationResponse id='1' reportGroup='defaultReportGroup'><cnpTxnId>756027696701751</cnpTxnId><orderId>GenericOrderId</orderId><response>000</response><responseTime>2015-04-14T12:04:59</responseTime><postDate>2015-04-14</postDate><message>Approved</message><authCode>055858</authCode></authorizationResponse><captureResponse><response>000</response><message>Deposit approved</message></captureResponse></results_max10><location>sandbox</location></queryTransactionResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); transactionTypeWithReportGroup response = (transactionTypeWithReportGroup)cnp.QueryTransaction(query); queryTransactionResponse queryTransactionResponse = (queryTransactionResponse)response; Assert.NotNull(queryTransactionResponse); Assert.AreEqual("sandbox", queryTransactionResponse.location); Assert.AreEqual("000", queryTransactionResponse.response); Assert.AreEqual(3, queryTransactionResponse.results_max10.Count); Assert.AreEqual("Original transaction found", queryTransactionResponse.message); Assert.AreEqual("000", ((authorizationResponse)queryTransactionResponse.results_max10[0]).response); Assert.AreEqual("Approved", ((authorizationResponse)queryTransactionResponse.results_max10[0]).message); Assert.AreEqual(756027696701750, ((authorizationResponse)queryTransactionResponse.results_max10[0]).cnpTxnId); Assert.AreEqual("000", ((authorizationResponse)queryTransactionResponse.results_max10[1]).response); Assert.AreEqual("Approved", ((authorizationResponse)queryTransactionResponse.results_max10[1]).message); Assert.AreEqual(756027696701751, ((authorizationResponse)queryTransactionResponse.results_max10[1]).cnpTxnId); Assert.AreEqual("000", ((authorizationResponse)queryTransactionResponse.results_max10[1]).response); Assert.AreEqual("Approved", ((authorizationResponse)queryTransactionResponse.results_max10[1]).message); Assert.AreEqual(756027696701751, ((authorizationResponse)queryTransactionResponse.results_max10[1]).cnpTxnId); Assert.AreEqual("000", ((captureResponse)queryTransactionResponse.results_max10[2]).response); Assert.AreEqual("Deposit approved", ((captureResponse)queryTransactionResponse.results_max10[2]).message); }
public void testEcheckVerification() { var echeckverification = new echeckVerification(); echeckverification.orderId = "12345"; echeckverification.amount = 123456; echeckverification.orderSource = orderSourceType.ecommerce; var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; echeckverification.echeck = echeck; var contact = new contact(); contact.name = "Bob"; contact.city = "lowell"; contact.state = "MA"; contact.email = "litle.com"; echeckverification.billToAddress = contact; var mock = new Mock <Communications>(_memoryStreams); mock.Setup( Communications => Communications.HttpPost( It.IsRegex( ".*?<litleOnlineRequest.*?<echeckVerification.*?<echeck>.*?<accNum>12345657890</accNum>.*?</echeck>.*?</echeckVerification>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >())) .Returns( "<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><echeckVerificationResponse><litleTxnId>123</litleTxnId></echeckVerificationResponse></litleOnlineResponse>"); var mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); var echeckverificaitonresponse = litle.EcheckVerification(echeckverification); Assert.AreEqual(123, echeckverificaitonresponse.litleTxnId); }
private async void OnClicked(object sender, EventArgs args) { await CrossMedia.Current.Initialize(); if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { await DisplayAlert("No Camera", ":( No camera available.", "OK"); return; } var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions { Directory = "Photos", Name = "thisphoto.jpg", CompressionQuality = 10 }); if (file != null) { var stream = file.GetStream(); string base64Image = ImageConvertors.ImageToBase64(stream); loadingPage = new LoadingPage(); await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync( loadingPage); int updateNo = await Communications.sendMyNewUpdate(task.taskid, base64Image); await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopAsync(); if (updateNo == -1) { await DisplayAlert("Update failed due to server error", "Please try again", "ok"); } else { await DisplayAlert("+。:.゚ヽ(*´∀`) ノ゚.:。+゚", "Your progress has b een sent to your friends. Update number: " + updateNo, "ok"); } } }
public void TestApplepayAndWallet() { var sale = new sale(); sale.applepay = new applepayType(); var applepayHeaderType = new applepayHeaderType(); applepayHeaderType.applicationData = "454657413164"; applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; applepayHeaderType.transactionId = "1234"; sale.applepay.header = applepayHeaderType; sale.applepay.data = "user"; sale.applepay.signature = "sign"; sale.applepay.version = "1"; sale.orderId = "12344"; sale.amount = 2; sale.orderSource = orderSourceType.ecommerce; var wallet = new wallet(); wallet.walletSourceTypeId = "123"; sale.wallet = wallet; var mock = new Mock <Communications>(_memoryStreams); ; mock.Setup( Communications => Communications.HttpPost( It.IsRegex( ".*?<litleOnlineRequest.*?<sale.*?<applepay>.*?<data>user</data>.*?</applepay>.*?<walletSourceTypeId>123</walletSourceTypeId>.*?</wallet>.*?</sale>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >())) .Returns( "<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><saleResponse><litleTxnId>123</litleTxnId></saleResponse></litleOnlineResponse>"); var mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.Sale(sale); }
public bool CreateSmsCode() { swi = new Communications(); swi.APIkey = APIkey; swi.APIUrl = APIUrl; swi.MakeAnSmsProfile(Utility.Truncate(SMSmessageText, 140), DefaultLanguage); bool rslt = swi.CreateCustomSmsMessage(SMScampaignName, SmsFromName); if (rslt) { SmsCode = swi.SmsCode; SmsJsonData = swi.JsonData; } else { isError = swi.isError; ErrorMessage = swi.errorMessage; } return(rslt); }
public bool CreateVoiceCode() { swi = new Communications(); swi.APIkey = APIkey; swi.APIUrl = APIUrl; swi.MakeAcontentProfile(TTSmessageText.Trim(), DefaultLanguage); bool rslt = swi.CreateCustomVoiceTTSmessage(TTScampaignName, CallerID, autoRetry, autoReplay, detectAnsweringMachine); if (rslt) { VoiceCode = swi.VoiceCode; VoiceJsonData = swi.JsonData; } else { isError = swi.isError; ErrorMessage = swi.errorMessage; } return(rslt); }
public void MergeFrom(Agent from, MemoryType type, float percent = 1) { switch (type) { case MemoryType.Obstacles: Obstacles.MergeFrom(from.Memory.Obstacles, percent); break; case MemoryType.Creatures: Creatures.MergeFrom(from.Memory.Creatures, percent); break; case MemoryType.Meals: Meals.MergeFrom(from.Memory.Meals, percent); break; case MemoryType.Foods: Foods.MergeFrom(from.Memory.Foods, percent); break; case MemoryType.FoodSources: FoodSources.MergeFrom(from.Memory.FoodSources, percent); break; case MemoryType.Nests: Nests.MergeFrom(from.Memory.Nests, percent); break; case MemoryType.Communications: Communications.MergeFrom(from.Memory.Communications, percent); break; case MemoryType.Species: Species.MergeFrom(from.Memory.Species, percent); break; } }
public void TestProcessingType() { captureGivenAuth capture = new captureGivenAuth(); capture.amount = 2; capture.orderSource = orderSourceType.ecommerce; capture.reportGroup = "Planets"; capture.processingType = processingTypeEnum.initialRecurring; capture.originalNetworkTransactionId = "abc123"; capture.originalTransactionAmount = 1234; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<orderSource>ecommerce</orderSource>\r\n<processingType>initialRecurring</processingType>\r\n<originalNetworkTransactionId>abc123</originalNetworkTransactionId>\r\n<originalTransactionAmount>1234</originalTransactionAmount>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><captureGivenAuthResponse><litleTxnId>123</litleTxnId></captureGivenAuthResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.CaptureGivenAuth(capture); }
public void TestToken() { registerTokenRequestType token = new registerTokenRequestType(); token.orderId = "12344"; token.accountNumber = "1233456789103801"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<registerTokenRequest.*?<accountNumber>1233456789103801</accountNumber>.*?</registerTokenRequest>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><registerTokenResponse><cnpTxnId>123</cnpTxnId></registerTokenResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); registerTokenResponse registertokenresponse = cnp.RegisterToken(token); Assert.AreEqual(123, registertokenresponse.cnpTxnId); Assert.IsNull(registertokenresponse.type); }
public void TestCapture() { capture caputure = new capture(); caputure.cnpTxnId = 123456000; caputure.amount = 106; caputure.payPalNotes = "Notes"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<capture.*?<cnpTxnId>123456000</cnpTxnId>.*?</capture>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><captureResponse><cnpTxnId>123</cnpTxnId></captureResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); captureResponse captureresponse = cnp.Capture(caputure); Assert.AreEqual(123, captureresponse.cnpTxnId); }
public void TestMerchantData() { echeckRedeposit echeckRedeposit = new echeckRedeposit(); echeckRedeposit.litleTxnId = 1; echeckRedeposit.merchantData = new merchantDataType(); echeckRedeposit.merchantData.campaign = "camp"; echeckRedeposit.merchantData.affiliate = "affil"; echeckRedeposit.merchantData.merchantGroupingId = "mgi"; echeckRedeposit.customIdentifier = "customIdent"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<echeckRedeposit.*<litleTxnId>1</litleTxnId>.*<merchantData>.*<campaign>camp</campaign>.*<affiliate>affil</affiliate>.*<merchantGroupingId>mgi</merchantGroupingId>.*</merchantData>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.13' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><echeckRedepositResponse><litleTxnId>123</litleTxnId></echeckRedepositResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.EcheckRedeposit(echeckRedeposit); }
public void TestPos_Tied() { credit credit = new credit(); credit.amount = 2; credit.pos = new pos(); credit.pos.terminalId = "abc123"; credit.cnpTxnId = 3; credit.reportGroup = "Planets"; credit.payPalNotes = "notes"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<cnpTxnId>3</cnpTxnId>\r\n<amount>2</amount>\r\n<pos>\r\n<terminalId>abc123</terminalId></pos>\r\n<payPalNotes>.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><creditResponse><cnpTxnId>123</cnpTxnId></creditResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); cnp.Credit(credit); }
public void TestAuthReversal() { authReversal authreversal = new authReversal(); authreversal.cnpTxnId = 12345678000; authreversal.amount = 106; authreversal.payPalNotes = "Notes"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<authReversal.*?<cnpTxnId>12345678000</cnpTxnId>.*?</authReversal>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authReversalResponse><cnpTxnId>123</cnpTxnId></authReversalResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); authReversalResponse authreversalresponse = cnp.AuthReversal(authreversal); Assert.AreEqual(123, authreversalresponse.cnpTxnId); }
public void TestOrderSource_Set() { credit credit = new credit(); credit.orderId = "12344"; credit.amount = 2; credit.orderSource = orderSourceType.ecommerce; credit.reportGroup = "Planets"; // credit.pin = "1234"; // .*<pin>1234</pin> var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<credit.*<amount>2</amount>.*<orderSource>ecommerce</orderSource>.*</credit>.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><creditResponse><cnpTxnId>123</cnpTxnId></creditResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); cnp.Credit(credit); }
public void TestNoCustomAttributes() { fraudCheck fraudCheck = new fraudCheck(); advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); fraudCheck.advancedFraudChecks = advancedFraudCheck; advancedFraudCheck.threatMetrixSessionId = "123"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<threatMetrixSessionId>123</threatMetrixSessionId>\r\n.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='10.1' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><fraudCheckResponse id='127' reportGroup='Planets' customerId=''><cnpTxnId>742802348034313000</cnpTxnId><response>000</response><message>Approved</message><advancedFraudResults><deviceReviewStatus>pass</deviceReviewStatus><deviceReputationScore>42</deviceReputationScore><triggeredRule>triggered_rule_default</triggeredRule></advancedFraudResults></fraudCheckResponse></cnpOnlineResponse >"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); fraudCheckResponse fraudCheckResponse = cnp.FraudCheck(fraudCheck); Assert.NotNull(fraudCheckResponse); Assert.AreEqual("pass", fraudCheckResponse.advancedFraudResults.deviceReviewStatus); }
public void TestFraudFilterOverride() { var echeckVoid = new echeckVoid(); echeckVoid.litleTxnId = 123456789; var mock = new Mock <Communications>(_memoryStreams); mock.Setup( Communications => Communications.HttpPost( It.IsRegex(".*<echeckVoid.*<litleTxnId>123456789.*", RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >())) .Returns( "<litleOnlineResponse version='8.13' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><echeckVoidResponse><litleTxnId>123</litleTxnId></echeckVoidResponse></litleOnlineResponse>"); var mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.EcheckVoid(echeckVoid); }
public void TestUndefinedProcessingType() { captureGivenAuth capture = new captureGivenAuth(); capture.amount = 2; capture.orderSource = orderSourceType.ecommerce; capture.reportGroup = "Planets"; capture.processingType = processingType.undefined; capture.originalNetworkTransactionId = "abc123"; capture.originalTransactionAmount = 1234; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<orderSource>ecommerce</orderSource>\r\n<originalNetworkTransactionId>abc123</originalNetworkTransactionId>\r\n<originalTransactionAmount>1234</originalTransactionAmount>.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><captureGivenAuthResponse><cnpTxnId>123</cnpTxnId></captureGivenAuthResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); cnp.CaptureGivenAuth(capture); }
public void TestDebtRepayment_Optional() { var captureGivenAuth = new captureGivenAuth(); captureGivenAuth.merchantData = new merchantDataType(); var mock = new Mock <Communications>(_memoryStreams); mock.Setup( Communications => Communications.HttpPost( It.IsRegex(".*</merchantData>\r\n</captureGivenAuth>.*", RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >())) .Returns( "<litleOnlineResponse version='8.19' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><captureGivenAuthResponse><litleTxnId>123</litleTxnId></captureGivenAuthResponse></litleOnlineResponse>"); var mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.CaptureGivenAuth(captureGivenAuth); }
public void TestCaptureGivenAuthWithLocation() { captureGivenAuth capture = new captureGivenAuth(); capture.amount = 2; capture.secondaryAmount = 1; capture.orderSource = orderSourceType.ecommerce; capture.reportGroup = "Planets"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<secondaryAmount>1</secondaryAmount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><captureGivenAuthResponse><cnpTxnId>123</cnpTxnId><location>sandbox</location></captureGivenAuthResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); var response = cnp.CaptureGivenAuth(capture); Assert.NotNull(response); Assert.AreEqual("sandbox", response.location); }
public void TestWithToken() { var update = new updateSubscription { billingDate = new DateTime(2002, 10, 9), billToAddress = new contact { name = "Greg Dake", city = "Lowell", state = "MA", email = "*****@*****.**" }, token = new cardTokenType { cnpToken = "987654321098765432", expDate = "0750", cardValidationNum = "798", type = methodOfPaymentTypeEnum.VI, checkoutId = "0123456789012345678" }, planCode = "abcdefg", subscriptionId = 12345 }; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<cnpOnlineRequest.*?<updateSubscription>\r\n<subscriptionId>12345</subscriptionId>\r\n<planCode>abcdefg</planCode>\r\n<billToAddress>\r\n<name>Greg Dake</name>.*?</billToAddress>\r\n<token>.*?<checkoutId>0123456789012345678</checkoutId>\r\n</token>\r\n<billingDate>2002-10-09</billingDate>\r\n</updateSubscription>\r\n</cnpOnlineRequest>.*?.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.20' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><updateSubscriptionResponse ><cnpTxnId>456</cnpTxnId><response>000</response><message>Approved</message><responseTime>2013-09-04</responseTime><subscriptionId>12345</subscriptionId></updateSubscriptionResponse></cnpOnlineResponse>"); var mockedCommunication = mock.Object; _cnp.SetCommunication(mockedCommunication); var response = _cnp.UpdateSubscription(update); Assert.AreEqual("12345", response.subscriptionId); Assert.AreEqual("456", response.cnpTxnId); Assert.AreEqual("000", response.response); Assert.NotNull(response.responseTime); }
private void InitConnectionInfo() { Communications wcfManager = ACRoot.SRoot.GetChildComponent("Communications") as Communications; if (wcfManager == null) { return; } if (wcfManager.WCFClientManager != null) { Binding bindingClientIcon = new Binding(); bindingClientIcon.Source = wcfManager.WCFClientManager; bindingClientIcon.Path = new PropertyPath("ConnectionQuality"); ClientConnIcon.SetBinding(VBConnectionState.ConnectionQualityProperty, bindingClientIcon); Binding bindingClientText = new Binding(); bindingClientText.Source = wcfManager.WCFClientManager; bindingClientText.Path = new PropertyPath("ConnectionShortInfo"); ClientConnText.SetBinding(VBTextBlock.TextProperty, bindingClientText); } if (wcfManager.WCFServiceManager != null) { Binding bindingServerIcon = new Binding(); bindingServerIcon.Source = wcfManager.WCFServiceManager; bindingServerIcon.Path = new PropertyPath("ConnectionQuality"); ServerConnIcon.SetBinding(VBConnectionState.ConnectionQualityProperty, bindingServerIcon); Binding bindingServerText = new Binding(); bindingServerText.Source = wcfManager.WCFServiceManager; bindingServerText.Path = new PropertyPath("ConnectionShortInfo"); ServerConnText.SetBinding(VBTextBlock.TextProperty, bindingServerText); } else { ServerConnIcon.Visibility = System.Windows.Visibility.Collapsed; ServerConnText.Visibility = System.Windows.Visibility.Collapsed; } }
public void TestSurchargeAmount_Optional() { var auth = new authorization(); auth.orderId = "12344"; auth.amount = 2; auth.orderSource = orderSourceType.ecommerce; auth.reportGroup = "Planets"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authorizationResponse><cnpTxnId>123</cnpTxnId></authorizationResponse></cnpOnlineResponse>"); var mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); var authorizationResponse = cnp.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.cnpTxnId); }
public void TestMethodOfPaymentApplepayAndWallet() { var auth = new authorization(); auth.orderId = "12344"; auth.amount = 2; auth.orderSource = orderSourceType.applepay; auth.reportGroup = "Planets"; var applepay = new applepayType(); var applepayHeaderType = new applepayHeaderType(); applepayHeaderType.applicationData = "454657413164"; applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; applepayHeaderType.transactionId = "1234"; applepay.header = applepayHeaderType; applepay.data = "user"; applepay.signature = "sign"; applepay.version = "1"; auth.applepay = applepay; var wallet = new wallet(); wallet.walletSourceTypeId = "123"; auth.wallet = wallet; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<authorization.*?<orderSource>applepay</orderSource>.*?<applepay>.*?<data>user</data>.*?</applepay>.*?<wallet>.*?<walletSourceTypeId>123</walletSourceTypeId>.*?</wallet>.*?</authorization>.*?", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authorizationResponse><cnpTxnId>123</cnpTxnId></authorizationResponse></cnpOnlineResponse>"); var mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); var authorizationResponse = cnp.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.cnpTxnId); }
void CanFrames_Recieved(object sender, Communications.Can.CanFramesReceiveEventArgs e) { var FrameModels = e.Frames.Select(f => new FrameModel(f) { PortName = (sender as CanPort).Name }).ToList(); Frames.PushFrames(FrameModels); }
public override void ProcessReceivedMessage(Communications.Messages.IMessage inputMessage) { //Do Nothing }
public void SetUpLitle() { memoryStreams = new Dictionary<string, StringBuilder>(); objectUnderTest = new Communications(memoryStreams); }
private void ValidateServerCertificate(object sender, Communications.Net.Ftp.ValidateServerCertificateEventArgs e) { e.IsCertificateValid = true; }
static void p_Recieved(object sender, Communications.Can.CanFramesReceiveEventArgs e) { ConsoleLogger.Print(() => { foreach (var f in e.Frames.Where(f => f.Descriptor == CanProg.FuDev || f.Descriptor == CanProg.FuInit || f.Descriptor == CanProg.FuProg)) { var hlc = f.IsLoopback ? ConsoleColor.Magenta : ConsoleColor.Green; Console.Write(" "); Console.ForegroundColor = Console.BackgroundColor; Console.BackgroundColor = hlc; Console.Write(f.Descriptor.ToString("X4")); Console.ResetColor(); Console.ForegroundColor = hlc; Console.WriteLine(" {0}", string.Join(" ", f.Data.Select(b => b.ToString("X2")))); Console.ResetColor(); } }); }
public void SetCommunication(Communications communication) { _communication = communication; }
private void InitializeRequest() { _communication = new Communications(); _authentication = new Authentication {User = _config["username"], Password = _config["password"]}; _requestDirectory = _config["requestDirectory"] + "\\Requests\\"; _responseDirectory = _config["responseDirectory"] + "\\Responses\\"; _litleXmlSerializer = new LitleXmlSerializer(); _litleTime = new LitleTime(); _litleFile = new LitleFile(); }
/// <summary> /// ��FC7002B�������ݣ���tcp�����ٹ��쵼��ճ�� /// </summary> /// <param name="s_command">���͵������ַ���</param> /// <returns>void</returns> private void OnDataReceived1(object sender, Communications.ChannelEventArgs e) { try { string retStr = HexBytesToString(e.Data, 0, e.Data.Length); MyInvoke mi = new MyInvoke(UpdateTextBox); MyInvoke1 mi1 = new MyInvoke1(UpdateDataGridView); pkt_num++; this.BeginInvoke(mi, new object[] { "����" + pkt_num.ToString(), retStr, true }); //���һ���ֻ��� if (dt.Rows.Count >= 40) { dt.Rows.Remove(dt.Rows[dt.Rows.Count - 1]); dataGridView1.DataSource = dt; } if (e.Data.Length < 3) { return; } int deal_len = 0; int pof = 0; while (deal_len < e.Data.Length) { int read_len = 0; if (e.Data[0 + pof] != 0x64 || e.Data[1 + pof] != 0x70 || e.Data[2 + pof] != 0x69) { return; } read_len += 3; UInt16 total_len = (UInt16)(((UInt16)e.Data[3 + pof] * 256) + (UInt16)(e.Data[4 + pof])); read_len += 2; DataRow dr = dt.NewRow(); while (total_len - read_len > 0) { if (checkBox_utf8.Checked) { parse_tlv_data(e.Data, pof, total_len, ref read_len, dr); } else { parse_tlv_data_gbk(e.Data, pof, total_len, ref read_len, dr); } } dr["���"] = ++rlt_num; dt.Rows.InsertAt(dr, 0); this.BeginInvoke(mi1, new object[] { }); deal_len += total_len; } return; } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } }
void p_Recieved(object sender, Communications.Can.CanFramesReceiveEventArgs e) { //foreach (var f in e.Frames) // Console.WriteLine(f); }
public void AssertBlobCopyPropertiesMatch(string containerName, string blobName, Communications.Common.CopyStatus? copyStatus, Basic.Azure.Storage.Communications.BlobService.BlobCopyProgress copyProgress, DateTime? copyCompletionTime, string copyStatusDescription, string copyId, string copySource) { var client = _storageAccount.CreateCloudBlobClient(); var container = client.GetContainerReference(containerName); if (!container.Exists()) Assert.Fail("AssertBlobCopyPropertiesMatch: The container '{0}' does not exist", containerName); var blob = container.GetBlobReferenceFromServer(blobName); if (!blob.Exists()) Assert.Fail("AssertBlobCopyPropertiesMatch: The blob '{0}' does not exist", blobName); var copyState = blob.CopyState; if (null == copyState) { Assert.IsNull(copyStatus); Assert.IsNull(copyProgress); Assert.IsNull(copyCompletionTime); Assert.IsNull(copyStatusDescription); Assert.IsNull(copyId); Assert.IsNull(copySource); } else { Assert.AreEqual(copyState.Status.ToString(), copyStatus.ToString()); Assert.AreEqual(copyState.BytesCopied, copyProgress.BytesCopied); Assert.AreEqual(copyState.TotalBytes, copyProgress.BytesTotal); Assert.AreEqual(copyState.CompletionTime.Value.LocalDateTime, copyCompletionTime.Value); Assert.AreEqual(copyState.StatusDescription, copyStatusDescription); Assert.AreEqual(copyState.CopyId, copyId); Assert.AreEqual(copyState.Source, copySource); } }
/// <summary> /// There are no comments for Communications in the schema. /// </summary> public void AddToCommunications(Communications communications) { base.AddObject("Communications", communications); }
/// <summary> /// Create a new Communications object. /// </summary> /// <param name="comId">Initial value of ComId.</param> public static Communications CreateCommunications(int comId) { Communications communications = new Communications(); communications.ComId = comId; return communications; }
public void SetUpLitle() { _objectUnderTest = new Communications(); }
public override void ProcessReceivedMessage(Communications.Messages.IMessage inputMessage) { OperationMessage message = (OperationMessage)inputMessage; if (message.OpCode == OperationMessage.OPCodes.ConfigWriteResponse) { if (this.currentWriteTransactions.ContainsKey(message.SourceAddress)) { //TODO: Check other params to avoid exceptions var currentTransactionVars = this.currentWriteTransactions[message.SourceAddress]; var nodeTransaction = currentTransactionVars.FragmentWriteTransaction; if (nodeTransaction.IsCompleted) { using (UnitOfWork repository = UnitOfWork.GetInstance()) { Node updatedNode = repository.NodeRespository.GetByNetworkAddress(nodeTransaction.DestinationAddress); if (updatedNode.LastChecksumUpdate == currentTransactionVars.TimeFlag) { updatedNode.ConfigChecksum = currentTransactionVars.Checksum; updatedNode.LastChecksumUpdate = currentTransactionVars.TimeFlag; repository.Commit(); PrintLog(false, string.Format("The node 0x{0:X4} has been updated successfully", updatedNode.Address)); } else { this.SendConfiguration(updatedNode, repository.HomeRespository.GetHome()); } } }else if (!nodeTransaction.ProcessResponse(message).Result) { //TODO: Check the problem } } } else if (message.OpCode == OperationMessage.OPCodes.ConfigChecksumResponse) { ushort checksum = (ushort)(((ushort)message.Args[1]) << 8 | (ushort)message.Args[0]); PrintLog(false, string.Format("CHECKSUM RECEIVED FROM 0x{0:X4}: 0x{1:X4}", message.SourceAddress, checksum)); if (this.waitingForChecksum.Contains(message.SourceAddress)) { this.waitingForChecksum.Remove(message.SourceAddress); Node node; Home home; using (UnitOfWork repository = UnitOfWork.GetInstance()) { node = repository.NodeRespository.GetByNetworkAddressWithConnectedHomeDevices(message.SourceAddress); home = repository.HomeRespository.GetHome(); } if (node == null) { PrintLog(true, "Node not present in the DB!"); } else if (!node.ConfigChecksum.HasValue || node.ConfigChecksum != checksum) { this.SendConfiguration(node, home); } else { PrintLog(false, string.Format("The node 0x{0:X4} is up to date", node.Address)); } } } }