public void ShouldDeleteSenderId() { IRestRequest savedRequest = null; mockClient.Setup(trc => trc.Execute <DeleteResult>(It.IsAny <IRestRequest>())) .Callback <IRestRequest>(request => savedRequest = request) .Returns(new DeleteResult()); var client = mockClient.Object; var senderIdToDelete = new SenderId { Id = senderId }; client.DeleteSenderId(senderIdToDelete); mockClient.Verify(trc => trc.Execute <DeleteResult>(It.IsAny <IRestRequest>()), Times.Once); Assert.IsNotNull(savedRequest); Assert.AreEqual("senderids/{id}", savedRequest.Resource); Assert.AreEqual(Method.DELETE, savedRequest.Method); Assert.AreEqual(1, savedRequest.Parameters.Count); Assert.AreEqual(senderId.ToString(), savedRequest.Parameters.Find(x => x.Name == "id").Value); var content = "{}"; var testClient = Common.CreateClient <DeleteResult>(content, null, null); client = new Client(testClient); var result = client.DeleteSenderId(senderIdToDelete); Assert.IsTrue(result.Success); }
public override string ToString() { string sourcesMessage = _eventsSources != null?_eventsSources.Count.ToString() : string.Empty; return(base.ToString() + ", senderId[" + SenderId.ToString() + "], sources count [" + sourcesMessage + "]"); }
/// <summary> /// Used to Edit an existing user account /// </summary> public static UserConfiguration EditUser(EditUserInfo info, string note = "") { string json = JSON.FromObject(info); if (!string.IsNullOrEmpty(json)) { UserConfiguration result = null; string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/edit/index.php").ToString(); var postDatas = new NameValueCollection(); postDatas["user"] = json; postDatas["token"] = info.SessionToken; postDatas["sender_id"] = SenderId.Get(); postDatas["note"] = note; string response = HTTP.POST(url, postDatas); if (response != null) { var success = ApiError.ProcessResponse(response, "Edit User"); if (success) { result = UserConfiguration.Get(response); return(result); } } } return(null); }
protected virtual void WriteMessageInternal(BinaryWriter writer) { writer.Write(SenderId.ToByteArray()); writer.Write(ConversationId.ToByteArray()); writer.Write(Created.ToBinary()); WriteString(writer, QueueName); }
public override string ToString() { var result = new StringBuilder(); var currentSender = Sender is null ? $"SenderId: {SenderId.ToString()}" : Sender.ToString(); result.AppendLine($"{currentSender}:"); if (!(ReplyMessage is null)) { var sender = ReplyMessage.Sender is null ? $"SenderId: {ReplyMessage.SenderId.ToString()}" : ReplyMessage.Sender.ToString(); result.AppendLine($"| {sender}:"); foreach (var row in ReplyMessage.Text.Split('\n')) { result.AppendLine($"| {row}"); } result.AppendLine($"| {ReplyMessage.Date} Mark: {ReplyMessage.Mark}"); } result.AppendLine(Text); result.AppendLine($"{Date} Mark: {Mark}"); return(result.ToString()); }
public override bool IsValid() { if (SenderId.IsNullOrEmpty()) { Errors.Add("SenderId is empty"); return(false); } if (PhoneNumber.IsNullOrEmpty()) { Errors.Add("Phone number is empty"); return(false); } if (!PhoneNumber.IsNumber()) { Errors.Add("Phone number is not a number"); return(false); } if (TextMessage.IsNullOrEmpty()) { Errors.Add("The message is empty"); return(false); } if (TextMessage.Length > 160) { Errors.Add("The message exceeded 160 characters"); return(false); } return(true); }
/// <summary> /// Basic User login using (Username or Email Address) and Plain Text Password /// </summary> public static UserConfiguration BasicLogin(string id, string password, string note = "") { UserConfiguration result = null; if (id != null && id.Length > 0) { string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/login/index.php").ToString(); var postDatas = new NameValueCollection(); postDatas["id"] = id; postDatas["password"] = password; postDatas["sender_id"] = SenderId.Get(); postDatas["note"] = note; string response = HTTP.POST(url, postDatas); if (response != null) { var success = ApiError.ProcessResponse(response, "User Basic Login"); if (success) { result = UserConfiguration.Get(response); } } } return(result); }
public override string ToString() { return(String.Format( "{0}[{1}]:S{{0x{2}}}|R{{0x{3}}}{4}", CommandId, CommandStatus, SenderId.ToString("X"), ReceiverId.ToString("X"), _packetBytes == null ? "" : string.Format("[Len:{0}]", _packetBytes.Length))); }
public override int GetHashCode() { unchecked { int hash = GetType().GetHashCode(); hash = (hash * 31) ^ SenderId.GetHashCode(); hash = (hash * 31) ^ ReceiverId.GetHashCode(); return(hash); } }
public override int GetHashCode() { int hash = 1; if (ReceiverId.Length != 0) { hash ^= ReceiverId.GetHashCode(); } if (TechnicalMessageType.Length != 0) { hash ^= TechnicalMessageType.GetHashCode(); } if (TeamSetContextId.Length != 0) { hash ^= TeamSetContextId.GetHashCode(); } if (chunkContext_ != null) { hash ^= ChunkContext.GetHashCode(); } if (PayloadSize != 0L) { hash ^= PayloadSize.GetHashCode(); } if (sentTimestamp_ != null) { hash ^= SentTimestamp.GetHashCode(); } if (SequenceNumber != 0L) { hash ^= SequenceNumber.GetHashCode(); } if (SenderId.Length != 0) { hash ^= SenderId.GetHashCode(); } if (createdAt_ != null) { hash ^= CreatedAt.GetHashCode(); } if (MessageId.Length != 0) { hash ^= MessageId.GetHashCode(); } if (metadata_ != null) { hash ^= Metadata.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public async Task LoadCertificatesAsync(OstcListeListe certList) { var sender = new OstcSender(SenderId.FromBnr("99300006"), "Test"); var cred = new NetworkCredential("dataline", "a5pY_4cm"); var client = new OstcClient(sender, Network.Base.Test, cred, new OstcClientInfo("Dataline", "Dataline Office", 21412)) { OstcExtraValidatorFactory = OstcExtraValidator.Factory }; var certs = await client.DownloadCertificateListAsync(certList); Assert.NotNull(certs); Assert.NotEqual(0, certs.Count); }
public static UserConfiguration Set(string token, string path) { UserConfiguration result = null; if (!string.IsNullOrEmpty(token)) { string url = "https://www.feenux.com/trakhound/api/profile_image/set/index.php"; string senderId = SenderId.Get(); var postDatas = new NameValueCollection(); postDatas["token"] = token; postDatas["sender_id"] = SenderId.Get(); } return(result); }
public override int GetHashCode() { int hash = 1; if (HasSenderId) { hash ^= SenderId.GetHashCode(); } if (HasTargetId) { hash ^= TargetId.GetHashCode(); } if (HasType) { hash ^= Type.GetHashCode(); } hash ^= attribute_.GetHashCode(); if (HasSenderAccountId) { hash ^= SenderAccountId.GetHashCode(); } if (HasTargetAccountId) { hash ^= TargetAccountId.GetHashCode(); } if (HasSenderBattleTag) { hash ^= SenderBattleTag.GetHashCode(); } if (HasTargetBattleTag) { hash ^= TargetBattleTag.GetHashCode(); } if (HasPeer) { hash ^= Peer.GetHashCode(); } if (HasForwardingIdentity) { hash ^= ForwardingIdentity.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (ConfirmationId != 0L) { hash ^= ConfirmationId.GetHashCode(); } if (SenderId.Length != 0) { hash ^= SenderId.GetHashCode(); } if (msg_ != null) { hash ^= Msg.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (SenderId != 0UL) { hash ^= SenderId.GetHashCode(); } hash ^= receiverId_.GetHashCode(); if (MessageData.Length != 0) { hash ^= MessageData.GetHashCode(); } if (IsBoard != false) { hash ^= IsBoard.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (senderId_ != null) { hash ^= SenderId.GetHashCode(); } if (targetId_ != null) { hash ^= TargetId.GetHashCode(); } if (Type.Length != 0) { hash ^= Type.GetHashCode(); } hash ^= attribute_.GetHashCode(); if (senderAccountId_ != null) { hash ^= SenderAccountId.GetHashCode(); } if (targetAccountId_ != null) { hash ^= TargetAccountId.GetHashCode(); } if (SenderBattleTag.Length != 0) { hash ^= SenderBattleTag.GetHashCode(); } if (TargetBattleTag.Length != 0) { hash ^= TargetBattleTag.GetHashCode(); } if (peer_ != null) { hash ^= Peer.GetHashCode(); } if (forwardingIdentity_ != null) { hash ^= ForwardingIdentity.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (Title.Length != 0) { hash ^= Title.GetHashCode(); } if (Content.Length != 0) { hash ^= Content.GetHashCode(); } hash ^= awards_.GetHashCode(); if (SenderId != 0) { hash ^= SenderId.GetHashCode(); } if (Sender.Length != 0) { hash ^= Sender.GetHashCode(); } if (CreateTime != 0L) { hash ^= CreateTime.GetHashCode(); } if (OutDateTime != 0L) { hash ^= OutDateTime.GetHashCode(); } if (HasAttachment != 0) { hash ^= HasAttachment.GetHashCode(); } if (MailStatus != 0) { hash ^= MailStatus.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (GiftboxId != 0UL) { hash ^= GiftboxId.GetHashCode(); } if (SenderId.Length != 0) { hash ^= SenderId.GetHashCode(); } if (ReceiverId.Length != 0) { hash ^= ReceiverId.GetHashCode(); } if (FortId.Length != 0) { hash ^= FortId.GetHashCode(); } if (FortLat != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(FortLat); } if (FortLng != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(FortLng); } if (CreationTimestamp != 0L) { hash ^= CreationTimestamp.GetHashCode(); } if (SentTimestamp != 0L) { hash ^= SentTimestamp.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (ReceiverId.Length != 0) { hash ^= ReceiverId.GetHashCode(); } if (SenderId.Length != 0) { hash ^= SenderId.GetHashCode(); } if (Text.Length != 0) { hash ^= Text.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (GiftboxId != 0UL) { hash ^= GiftboxId.GetHashCode(); } if (SenderId.Length != 0) { hash ^= SenderId.GetHashCode(); } if (SenderCodename.Length != 0) { hash ^= SenderCodename.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (Type != 0) { hash ^= Type.GetHashCode(); } if (Topic.Length != 0) { hash ^= Topic.GetHashCode(); } if (SenderId.Length != 0) { hash ^= SenderId.GetHashCode(); } if (TargetId.Length != 0) { hash ^= TargetId.GetHashCode(); } hash ^= data_.GetHashCode(); return(hash); }
/// <summary> /// Antragsstatus erfragen /// </summary> /// <param name="sender">Absender-ID</param> /// <param name="orderId">Auftrags-ID</param> /// <returns>Status des Auftrags</returns> /// <remarks>Die Auftrags-ID wird von der Funktion <see cref="SendApplicationAsync(OstcAntrag,Pkcs10Data,IOstcCertificateStore,Pkcs12Store)"/> zurückgeliefert</remarks> public async Task <OstcOrderResult> QueryOrderStatusAsync(SenderId sender, string orderId) { var request = new HttpRequestMessage(HttpMethod.Get, $"{Network.Requests.Order}?ik_bn={sender.Id}&id={orderId}"); var response = await _client.SendAsync(request); response.EnsureSuccessStatusCode(); var responseHtml = DecodeResponse(await response.Content.ReadAsStreamAsync()); var responseUri = response.Headers.Location ?? request.RequestUri; OstcOrderResult result = (from parser in OrderStatusParsers where parser.IsApplicable(responseHtml) select parser.ExtractResult(responseUri, responseHtml)) .FirstOrDefault() ?? new OstcOrderResult() { Status = OstcOrderStatus.NotFound }; return(result); }
/// <summary> /// User Login using Remember Token /// </summary> public static UserConfiguration TokenLogin(string token, string note = "") { UserConfiguration result = null; if (token != null && token.Length > 0) { string senderId = SenderId.Get(); string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/login/?token=" + token + "&sender_id=" + senderId + "¬e=" + note).ToString(); string response = HTTP.GET(url); if (response != null) { var success = ApiError.ProcessResponse(response, "User Token Login"); if (success) { result = UserConfiguration.Get(response); } } } return(result); }
/// <summary> /// Used to Logout a currently logged in user /// </summary> public static bool Logout(string token = null) { bool result = false; string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/logout/index.php").ToString(); string senderId = SenderId.Get(); url += "?sender_id=" + SenderId.Get(); if (token != null) { url += "&token=" + token; } string response = HTTP.GET(url); if (!string.IsNullOrEmpty(response)) { result = ApiError.ProcessResponse(response, "User Logout"); } return(result); }
/// <summary> /// Erstellung des OSTC-Client-Nutzers (Absender) anhand der Absender-ID und des Firmen-Namens /// </summary> /// <param name="sender">Absender-ID</param> /// <param name="companyName">Name der Firma</param> public OstcSender(SenderId sender, string companyName) { SenderId = sender; CompanyName = companyName; }
public void MergeFrom(Notification other) { if (other == null) { return; } if (other.senderId_ != null) { if (senderId_ == null) { senderId_ = new Bgs.Protocol.EntityId(); } SenderId.MergeFrom(other.SenderId); } if (other.targetId_ != null) { if (targetId_ == null) { targetId_ = new Bgs.Protocol.EntityId(); } TargetId.MergeFrom(other.TargetId); } if (other.Type.Length != 0) { Type = other.Type; } attribute_.Add(other.attribute_); if (other.senderAccountId_ != null) { if (senderAccountId_ == null) { senderAccountId_ = new Bgs.Protocol.EntityId(); } SenderAccountId.MergeFrom(other.SenderAccountId); } if (other.targetAccountId_ != null) { if (targetAccountId_ == null) { targetAccountId_ = new Bgs.Protocol.EntityId(); } TargetAccountId.MergeFrom(other.TargetAccountId); } if (other.SenderBattleTag.Length != 0) { SenderBattleTag = other.SenderBattleTag; } if (other.TargetBattleTag.Length != 0) { TargetBattleTag = other.TargetBattleTag; } if (other.peer_ != null) { if (peer_ == null) { peer_ = new Bgs.Protocol.ProcessId(); } Peer.MergeFrom(other.Peer); } if (other.forwardingIdentity_ != null) { if (forwardingIdentity_ == null) { forwardingIdentity_ = new Bgs.Protocol.Account.V1.Identity(); } ForwardingIdentity.MergeFrom(other.ForwardingIdentity); } }
/// <summary> /// Delete a single Sender ID. /// </summary> /// <param name="senderId">SenderID object</param> /// <returns></returns> public DeleteResult DeleteSenderId(SenderId senderId) { return(DeleteSenderId(senderId.Id)); }
} //kwota przelewu public override string ToString() //przeciazenie metody do string { return("\n##OD: " + SenderId.ToString() + " DLA: " + RecipientId.ToString() + " KWOTA: " + Amount.ToString() + "##"); }
public void List() { var res = SenderId.Resource(Session); Assert.True(GetNumItems(res.List()) > 0); }
public byte[] ToByteArray() { string stringresult = SenderId.ToString() + " " + Message + " " + ReceiverId.ToString(); return(Encoding.ASCII.GetBytes(stringresult)); }
/// <summary> /// Antragsstatus erfragen /// </summary> /// <param name="sender">Absender-ID</param> /// <param name="orderId">Auftrags-ID</param> /// <returns>Status des Auftrags</returns> /// <remarks>Die Auftrags-ID wird von der Funktion <see cref="SendApplicationAsync(OstcAntrag,Pkcs10Data,IOstcCertificateStore,Pkcs12Store)"/> zurückgeliefert</remarks> public async Task<OstcOrderResult> QueryOrderStatusAsync(SenderId sender, string orderId) { var request = new RestRequest(Network.Requests.Order); request.AddParameter("ik_bn", sender.Id); request.AddParameter("id", orderId); var response = await Client.Execute(request); var responseHtml = DecodeResponse(new MemoryStream(response.RawBytes)); OstcOrderResult result = (from parser in OrderStatusParsers where parser.IsApplicable(responseHtml) select parser.ExtractResult(response.ResponseUri, responseHtml)) .FirstOrDefault() ?? new OstcOrderResult() { Status = OstcOrderStatus.NotFound }; return result; }
public override int GetHashCode() { return(SenderId.GetHashCode() + SenderCounter.GetHashCode()); }