Esempio n. 1
0
        public async Task <Result <object> > DisarmDeviceAsync(Device device)
        {
            if (string.IsNullOrEmpty(_userId))
            {
                throw new NullReferenceException("You did not provide a UserId to the ArloClient constructor, so disarming a device is not possible.");
            }

            var notifyRequest = new NotifyRequest(device, $"{_userId}_web", Mode.Disarm);
            //        {
            //            "from":    "3AB3-210-6687469_web",
            //"to":    "48E46573A0B8B",
            //"action":    "set",
            //"resource":    "modes",
            //"transId":    "web!3975ac7b.ebb3a8!1504266382584",
            //"publishResponse":    true,
            //"properties": {
            //                "active":    "mode0"
            //}
            //        }

            var headers = new Dictionary <string, string>();

            headers.Add("xcloudId", device.XCloudId);

            var result = await _requestHandler.PostAsync <object>($"hmsweb/users/devices/notify/{device.DeviceId}", notifyRequest, headers);

            return(result);
        }
Esempio n. 2
0
        public async Task <IActionResult> NotifyAllUsers([FromBody] NotifyRequest notification)
        {
            if (notification == null)
            {
                ModelState.AddModelError(ErrorResponses.MissingBody, string.Empty);
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var requestedNotification = new Notification()
            {
                Status         = notification.Status,
                Type           = notification.Type,
                Priority       = notification.Priority,
                StartDate      = notification.StartDate,
                EndDate        = notification.EndDate,
                Subject        = notification.Subject,
                Message        = notification.Message,
                AllowDismissal = notification.AllowDismissal
            };
            var currentUser = await CurrentUserRetriever.GetCurrentUserAsync();

            var notifyCommand = new Jibberwock.Persistence.DataAccess.Commands.Notifications.Notify(Logger, currentUser, HttpContext.TraceIdentifier, WebApiConfiguration.Authorization.DefaultServiceId, null,
                                                                                                    requestedNotification, notification.SendAsEmail, _queueDataSource, WebApiConfiguration.ServiceBus.Queues.Notifications);
            var resultantCommand = await notifyCommand.Execute(SqlServerDataSource);

            return(Ok(resultantCommand.Result));
        }
Esempio n. 3
0
        public NotifyResponse Notify(NotifyType type, NotifyRequest request)
        {
            NotifyResponse result = null;

            switch (type)
            {
            case NotifyType.Email:
                result = NotifyMail(request as EmailNotifyRequest);
                break;

            case NotifyType.SMS:
                result = NotifySms(request as SmsNotifyRequest);
                break;

            case NotifyType.WebMessage:
                result = NotifyWebMessage(request as WebMessageNotifyRequest);
                break;

            case NotifyType.AppMessage:
                result = NotifyAppMessage(request as AppMessageNotifyRequest);
                break;

            case NotifyType.AppNotify:
                result = NotifyApp(request as AppNotifyRequest);
                break;

            default:
                // for other notification types we do nothing and deliver this to sub-classses to do it at their will
                break;
            }

            return(result);
        }
 private static void NotifyEngine_AfterTransferRequest(NotifyEngine sender, NotifyRequest request)
 {
     if ((request.Properties.Contains("Tenant") ? request.Properties["Tenant"] : null) is Tenant tenant)
     {
         CoreContext.TenantManager.SetCurrentTenant(tenant);
     }
 }
Esempio n. 5
0
        public override Task <NotifyResponse> GetFrame(
            NotifyRequest request, ServerCallContext context)
        {
            byte[] frame = null;
            lock (Program.Frames)
            {
                if (Program.Frames.Any())
                {
                    frame = Program.Frames.Pop();
                    Program.JobsInQueue.Set(Program.Frames.Count);
                }

                if (frame == null)
                {
                    Console.WriteLine("No frame available for {0}", Program.RtspUrl);
                }
                else
                {
                    Console.WriteLine("Sending frame for {0}, Q size: {1}", Program.RtspUrl, Program.Frames.Count);
                }
            }

            return(Task.FromResult(new NotifyResponse
            {
                Camera = Program.RtspUrl,
                Frame = (frame == null ? Google.Protobuf.ByteString.Empty : Google.Protobuf.ByteString.CopyFrom(frame))
            }));
        }
        private NotifyRequest CreateRequest(INotifyAction action, string objectID, IRecipient recipient, SendNoticeCallback sendCallback, ITagValue[] args, string[] senders, bool checkSubsciption)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }
            if (sendCallback != null)
            {
                throw new NotImplementedException("sendCallback");
            }

            var request = new NotifyRequest(notifySource, action, objectID, recipient);

            request.SenderNames = senders;
            request.IsNeedCheckSubscriptions = checkSubsciption;
            if (args != null)
            {
                request.Arguments.AddRange(args);
            }
            return(request);
        }
Esempio n. 7
0
 private static void NotifyEngine_AfterTransferRequest(NotifyEngine sender, NotifyRequest request, IServiceScope scope)
 {
     if ((request.Properties.Contains("Tenant") ? request.Properties["Tenant"] : null) is Tenant tenant)
     {
         var tenantManager = scope.ServiceProvider.GetService <TenantManager>();
         tenantManager.SetCurrentTenant(tenant);
     }
 }
Esempio n. 8
0
 public override Task <NotifyReply> Notify(NotifyRequest request, ServerCallContext context)
 {
     _logger.LogInformation($"Sending notification to user: "******"Ok"
     }));
 }
Esempio n. 9
0
        public async Task ItPassesATemplateToTheNotifyApi()
        {
            await _classUnderTest.SendOneTimeLinkAsync(StubNotification(), CancellationToken.None);

            NotifyRequest notifyRequest = _simulator.ReceivedRequests[0].BodyAs <NotifyRequest>();

            notifyRequest.template_id.Should().NotBeNullOrEmpty();
            notifyRequest.template_id.Should().NotBeNullOrWhiteSpace();
        }
Esempio n. 10
0
        private static void BeforeTransferRequest(NotifyEngine sender, NotifyRequest request, IServiceScope scope)
        {
            var aid         = Guid.Empty;
            var aname       = string.Empty;
            var tenant      = scope.ServiceProvider.GetService <TenantManager>().GetCurrentTenant();
            var authContext = scope.ServiceProvider.GetService <AuthContext>();
            var userManager = scope.ServiceProvider.GetService <UserManager>();
            var displayUserSettingsHelper = scope.ServiceProvider.GetService <DisplayUserSettingsHelper>();

            if (authContext.IsAuthenticated)
            {
                aid = authContext.CurrentAccount.ID;
                var user = userManager.GetUsers(aid);
                if (userManager.UserExists(user))
                {
                    aname = user.DisplayUserName(false, displayUserSettingsHelper)
                            .Replace(">", "&#62")
                            .Replace("<", "&#60");
                }
            }
            var scopeClass = scope.ServiceProvider.GetService <NotifyConfigurationScope>();

            var(_, _, _, options, tenantExtra, _, webItemManager, configuration, tenantLogoManager, additionalWhiteLabelSettingsHelper, tenantUtil, coreBaseSettings, commonLinkUtility, settingsManager, studioNotifyHelper) = scopeClass;
            var log = options.CurrentValue;

            commonLinkUtility.GetLocationByRequest(out var product, out var module);
            if (product == null && CallContext.GetData("asc.web.product_id") != null)
            {
                product = webItemManager[(Guid)CallContext.GetData("asc.web.product_id")] as IProduct;
            }

            var logoText = TenantWhiteLabelSettings.DefaultLogoText;

            if ((tenantExtra.Enterprise || coreBaseSettings.CustomMode) && !MailWhiteLabelSettings.IsDefault(settingsManager, configuration))
            {
                logoText = tenantLogoManager.GetLogoText();
            }

            request.Arguments.Add(new TagValue(CommonTags.AuthorID, aid));
            request.Arguments.Add(new TagValue(CommonTags.AuthorName, aname));
            request.Arguments.Add(new TagValue(CommonTags.AuthorUrl, commonLinkUtility.GetFullAbsolutePath(commonLinkUtility.GetUserProfile(aid))));
            request.Arguments.Add(new TagValue(CommonTags.VirtualRootPath, commonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/')));
            request.Arguments.Add(new TagValue(CommonTags.ProductID, product != null ? product.ID : Guid.Empty));
            request.Arguments.Add(new TagValue(CommonTags.ModuleID, module != null ? module.ID : Guid.Empty));
            request.Arguments.Add(new TagValue(CommonTags.ProductUrl, commonLinkUtility.GetFullAbsolutePath(product != null ? product.StartURL : "~")));
            request.Arguments.Add(new TagValue(CommonTags.DateTime, tenantUtil.DateTimeNow()));
            request.Arguments.Add(new TagValue(CommonTags.RecipientID, Context.SYS_RECIPIENT_ID));
            request.Arguments.Add(new TagValue(CommonTags.ProfileUrl, commonLinkUtility.GetFullAbsolutePath(commonLinkUtility.GetMyStaff())));
            request.Arguments.Add(new TagValue(CommonTags.RecipientSubscriptionConfigURL, commonLinkUtility.GetMyStaff()));
            request.Arguments.Add(new TagValue(CommonTags.HelpLink, commonLinkUtility.GetHelpLink(settingsManager, additionalWhiteLabelSettingsHelper, false)));
            request.Arguments.Add(new TagValue(CommonTags.LetterLogoText, logoText));
            request.Arguments.Add(new TagValue(CommonTags.MailWhiteLabelSettings, MailWhiteLabelSettings.Instance(settingsManager)));
            request.Arguments.Add(new TagValue(CommonTags.SendFrom, tenant.Name));
            request.Arguments.Add(new TagValue(CommonTags.ImagePath, studioNotifyHelper.GetNotificationImageUrl("").TrimEnd('/')));

            AddLetterLogo(request, tenantExtra, tenantLogoManager, coreBaseSettings, commonLinkUtility, log);
        }
Esempio n. 11
0
        public void Notify(NotifyRequest request)
        {
            var authentication = this.Authentication;

            this.userContext.Dispatcher.Invoke(() =>
            {
                this.userContext.NotifyMessage2(authentication, request.Message, request.Type);
            });
        }
Esempio n. 12
0
        public override Task <NotifyReply> Notify(NotifyRequest request, ServerCallContext context)
        {
            Console.WriteLine($"Recieved: {request.Content}");

            return(Task.FromResult(new NotifyReply()
            {
                IsSuccess = true
            }));
        }
        private static void BeforeTransferRequest(NotifyEngine sender, NotifyRequest request)
        {
            var aid   = Guid.Empty;
            var aname = string.Empty;

            if (SecurityContext.IsAuthenticated)
            {
                aid = SecurityContext.CurrentAccount.ID;
                if (CoreContext.UserManager.UserExists(aid))
                {
                    aname = CoreContext.UserManager.GetUsers(aid).DisplayUserName(false)
                            .Replace(">", "&#62")
                            .Replace("<", "&#60");
                }
            }

            IProduct product;
            IModule  module;

            CommonLinkUtility.GetLocationByRequest(out product, out module);
            if (product == null && CallContext.GetData("asc.web.product_id") != null)
            {
                product = WebItemManager.Instance[(Guid)CallContext.GetData("asc.web.product_id")] as IProduct;
            }

            var logoText = TenantWhiteLabelSettings.DefaultLogoText;

            if ((TenantExtra.Enterprise || TenantExtra.Hosted || (CoreContext.Configuration.Personal && CoreContext.Configuration.CustomMode)) && !MailWhiteLabelSettings.Instance.IsDefault)
            {
                logoText = TenantLogoManager.GetLogoText();
            }

            request.Arguments.Add(new TagValue(CommonTags.AuthorID, aid));
            request.Arguments.Add(new TagValue(CommonTags.AuthorName, aname));
            request.Arguments.Add(new TagValue(CommonTags.AuthorUrl, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(aid))));
            request.Arguments.Add(new TagValue(CommonTags.VirtualRootPath, CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/')));
            request.Arguments.Add(new TagValue(CommonTags.ProductID, product != null ? product.ID : Guid.Empty));
            request.Arguments.Add(new TagValue(CommonTags.ModuleID, module != null ? module.ID : Guid.Empty));
            request.Arguments.Add(new TagValue(CommonTags.ProductUrl, CommonLinkUtility.GetFullAbsolutePath(product != null ? product.StartURL : "~")));
            request.Arguments.Add(new TagValue(CommonTags.DateTime, TenantUtil.DateTimeNow()));
            request.Arguments.Add(new TagValue(CommonTags.Helper, new PatternHelper()));
            request.Arguments.Add(new TagValue(CommonTags.RecipientID, Context.SYS_RECIPIENT_ID));
            request.Arguments.Add(new TagValue(CommonTags.RecipientSubscriptionConfigURL, CommonLinkUtility.GetMyStaff()));
            request.Arguments.Add(new TagValue(CommonTags.HelpLink, CommonLinkUtility.GetHelpLink(false)));
            request.Arguments.Add(new TagValue(Constants.LetterLogoText, logoText));
            request.Arguments.Add(new TagValue(Constants.LetterLogoTextTM, logoText));
            request.Arguments.Add(new TagValue(Constants.MailWhiteLabelSettings, MailWhiteLabelSettings.Instance));

            if (!request.Arguments.Any(x => CommonTags.SendFrom.Equals(x.Tag)))
            {
                request.Arguments.Add(new TagValue(CommonTags.SendFrom, CoreContext.TenantManager.GetCurrentTenant().Name));
            }

            AddLetterLogo(request);
        }
 private async Task <NotifyResponse> NotifyAsync(NotifyRequest request)
 {
     _service.Notify(
         request.ClientGuid,
         request.Domain,
         request.PivotTree,
         request.PivotId,
         request.Text1,
         request.Text2);
     return(new NotifyResponse());
 }
Esempio n. 15
0
        public async Task <IActionResult> Notify(int companyId, [FromBody] NotifyRequest request)
        {
            var users = await db.CompanyUsers
                        .Where(x => x.CompanyId == companyId)
                        .ToArrayAsync();

            foreach (var user in users)
            {
                await notificationsClient.NotifyAsync(user.UserId, request);
            }
            return(NoContent());
        }
 private void SlushMiningPoolClient_OnEnqueMessage(object sender, string e)
 {
     Task.Factory.StartNew(() =>
     {
         var str = "";
         lock (this.synObject)
         {
             str = this._queue.Dequeue();
         }
         var jObject = JObject.Parse(str);
         var id      = jObject["id"];
         if (id != null && this._requestTable.ContainsKey(id.ToString()))
         {
             var request = this._requestTable[id.ToString()];
             var reponse = JsonConvert.DeserializeObject <JsonRpcResponse>(str);
             if (request is AuthorizeRequest)
             {
                 var authResponse = AuthorizeResponse.BuildFrom(reponse);
                 this.RaiseOnAuthorizeResponse(new ReceiveMessageEventArgs <AuthorizeResponse>(authResponse));
             }
             if (request is SubscribeRequest)
             {
                 var subScribeResponse = SubscribeResponse.BuildFrom(reponse);
                 this.RaiseOnSubscribeResponse(new ReceiveMessageEventArgs <SubscribeResponse>(subScribeResponse));
             }
             if (request is ShareRequest)
             {
                 var shareResponse = ShareResponse.BuildFrom(reponse);
                 this.RaiseOnShareResponse(new ReceiveMessageEventArgs <ShareResponse>(shareResponse));
             }
         }
         else
         {
             var method = jObject["method"].ToString();
             if (!string.IsNullOrWhiteSpace(method))
             {
                 if (method == "mining.notify")
                 {
                     var jsonRequest = JsonConvert.DeserializeObject <JsonRpcRequest>(str);
                     var request     = NotifyRequest.BuildFrom(jsonRequest);
                     this.RaiseOnNotifyRequest(new ReceiveMessageEventArgs <NotifyRequest>(request));
                 }
                 if (method == "mining.set_difficulty")
                 {
                     var jsonRequest = JsonConvert.DeserializeObject <JsonRpcRequest>(str);
                     var request     = SetDifficultyRequest.BuildFrom(jsonRequest);
                     this.RaiseOnSetDifficultyRequest(new ReceiveMessageEventArgs <SetDifficultyRequest>(request));
                 }
             }
         }
     });
 }
Esempio n. 17
0
        private void DoSendWork(object state)
        {
            Message message = _messageStorage.GetNext();

            while (message != null)
            {
                if (message != null)
                {
                    var connections = _connectionStorage.GetConnectionsByTopic(message.Topic);

                    foreach (var connection in connections)
                    {
                        var client  = new Notifier.NotifierClient(connection.GrpcChannel);
                        var request = new NotifyRequest()
                        {
                            Content = message.Content
                        };

                        try
                        {
                            if (connection.Limit <= 0)
                            {
                                client.Notify(new NotifyRequest()
                                {
                                    Content = "Message limit is out. You are disconnected."
                                });
                                _connectionStorage.Remove(connection.Address);
                                continue;
                            }

                            var reply = client.Notify(request);
                            _connectionStorage.UpdateLimit(connection.Address);
                            Console.WriteLine($"Notified subscriber {connection.Address} with {message.Content}. Response: {reply}");
                        }
                        catch (RpcException re)
                        {
                            if (re.StatusCode == StatusCode.Internal)
                            {
                                _connectionStorage.Remove(connection.Address);
                            }
                            Console.WriteLine(re.Message);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine($"Error notifying subscriber {connection.Address}. {e.Message}");
                        }
                    }
                }

                message = _messageStorage.GetNext();
            }
        }
Esempio n. 18
0
        public async Task ItPassesTheEmailsToTheNotifyApi(string email)
        {
            UploadProcessedNotification notification = new UploadProcessedNotification
            {
                Email = email
            };

            await _classUnderTest.SendUploadProcessedNotification(notification, CancellationToken.None);

            NotifyRequest notifyRequest = _simulator.ReceivedRequests[0].BodyAs <NotifyRequest>();

            notifyRequest.email_address.Should().Be(email);
        }
Esempio n. 19
0
 private void AddStaticTags(NotifyRequest request)
 {
     lock (tags)
     {
         foreach (var t in tags)
         {
             if (t != null && !request.Arguments.Exists(a => a.Tag.Name == t.Tag.Name))
             {
                 request.Arguments.Add(t);
             }
         }
     }
 }
        /// <summary>
        /// Notifies subscribed devices that a key should be added.
        /// </summary>
        /// <param name="alias">alias of the member</param>
        /// <param name="addKey">AddKey payload to be sent</param>
        /// <returns></returns>
        public Task <NotifyStatus> NotifyAddKey(Alias alias, AddKey addKey)
        {
            var request = new NotifyRequest
            {
                Alias = alias,
                Body  = new NotifyBody
                {
                    AddKey = addKey
                }
            };

            return(gateway.NotifyAsync(request)
                   .ToTask(response => response.Status));
        }
Esempio n. 21
0
        public override Task <NotifyReply> Notify(NotifyRequest request, ServerCallContext context)
        {
            var rates = JsonConvert.DeserializeObject <Dictionary <Currency, double> >(request.Content);

            Console.WriteLine($"\nNew rates update at {request.Bank}");
            foreach (var rate in rates)
            {
                Console.WriteLine($" # {rate.Key}: {rate.Value}");
            }

            return(Task.FromResult(new NotifyReply {
                IsSuccess = true
            }));
        }
Esempio n. 22
0
        public async Task GivenSuccessful_SendsUploadSuccessfulEmail(string email)
        {
            UploadProcessedNotification notification = new UploadProcessedNotification
            {
                Email = email,
                UploadSuccessfullyProcessed = true
            };

            await _classUnderTest.SendUploadProcessedNotification(notification, CancellationToken.None);

            NotifyRequest notifyRequest = _simulator.ReceivedRequests[0].BodyAs <NotifyRequest>();

            notifyRequest.template_id.Should().Be("434e8133-b995-4363-a177-2bad0ea70773");
        }
Esempio n. 23
0
        public async Task GivenNotSuccessful_SendsUploadFailureEmail(string email)
        {
            UploadProcessedNotification notification = new UploadProcessedNotification
            {
                Email = email,
                UploadSuccessfullyProcessed = false
            };

            await _classUnderTest.SendUploadProcessedNotification(notification, CancellationToken.None);

            NotifyRequest notifyRequest = _simulator.ReceivedRequests[0].BodyAs <NotifyRequest>();

            notifyRequest.template_id.Should().Be("3e4d2aea-4305-461f-84f8-584361169c36");
        }
Esempio n. 24
0
        public async Task ItPassesTheEmailsToTheNotifyApi(string email)
        {
            OneTimeLinkNotification notification = new OneTimeLinkNotification
            {
                Email = email,
                Url   = "stub",
                Token = "stub"
            };

            await _classUnderTest.SendOneTimeLinkAsync(notification, CancellationToken.None);

            NotifyRequest notifyRequest = _simulator.ReceivedRequests[0].BodyAs <NotifyRequest>();

            notifyRequest.email_address.Should().Be(email);
        }
Esempio n. 25
0
        private IPattern SelectPattern(INotifyAction action, string sender, NotifyRequest request)
        {
            if (action != Constants.ActionAdminNotify)
            {
                return(null);                                       //after that pattern will be selected by xml
            }
            var tagvalue = request.Arguments.Find(tag => tag.Tag.Name == "UNDERLYING_ACTION");

            if (tagvalue == null)
            {
                return(null);
            }

            return(ActionPatternProvider.GetPattern(new NotifyAction(Convert.ToString(tagvalue.Value), ""), sender));
        }
Esempio n. 26
0
        public async Task BadRequest()
        {
            var usersClientMock = new Mock <IUsersClient>();

            usersClientMock.Setup(x => x.DoesUserExistAsync(It.IsAny <int>())).ReturnsAsync(false);
            Services.AddSingleton(usersClientMock.Object);
            AddDbContext();
            var request    = new NotifyRequest().SetStringProperties();
            var controller = GetController(1);
            var result     = await controller.Notify(2, request);

            var badRequest = Assert.IsType <BadRequestObjectResult>(result);

            Assert.Equal(string.Format(NotificationsController.UserDoesNotExist, 2), badRequest.Value);
        }
Esempio n. 27
0
        private async Task DoSendWork(CancellationToken cancellationToken)
        {
            var isEmptyMessages = await _messageRepository.IsEmpty(cancellationToken);

            if (isEmptyMessages)
            {
                return;
            }

            var message = await _messageRepository.GetNext(cancellationToken);

            if (message != null)
            {
                var connections = await _connectionRepository.GetConnectionsByBank(message.Bank, cancellationToken);

                if (connections.Count == 0)
                {
                    await _messageRepository.Add(message, cancellationToken);
                }

                foreach (var connection in connections)
                {
                    var channel = GrpcChannel.ForAddress(connection.Address, new GrpcChannelOptions {
                        HttpHandler = _httpHandler
                    });
                    var client  = new Notifier.NotifierClient(channel);
                    var request = new NotifyRequest {
                        Bank = message.Bank, Content = message.Rates
                    };

                    try
                    {
                        var reply = client.Notify(request);
                        Console.WriteLine($"Notified subscriber {connection.Address} with {message.Rates}. Response: {reply.IsSuccess}");
                    }
                    catch (RpcException e)
                    {
                        if (e.StatusCode == StatusCode.Internal)
                        {
                            await _connectionRepository.Remove(connection.Address, cancellationToken);
                        }

                        Console.WriteLine($"Details: {e.Status.Detail}");
                        Console.WriteLine($"Status code: {e.Status.StatusCode}");
                    }
                }
            }
        }
Esempio n. 28
0
        public async Task NotifyAsync(string message, string channel)
        {
            var accessToken = this.channelStore.Get(channel).AccessToken;
            var client      = new RestClient(ApiUrl);

            var request = new RestRequest(NotifyApi);

            var requestObject = new NotifyRequest()
            {
                message = message
            };

            request.AddObject(requestObject);
            request.AddParameter("Authorization", $"Bearer {accessToken}", ParameterType.HttpHeader);
            await client.PostAsync <NotifyResponse>(request);
        }
Esempio n. 29
0
        public static Job CreateFromRequest(NotifyRequest request)
        {
            var instance = new Job(request.JobId);

            instance.MerkleBranch = request.MerkleBranch;
            instance.NBits        = request.NBits;
            instance.NTime        = request.NTime;
            instance.PreviousHash = request.PreviousHash;
            instance.Version      = request.Version;
            instance.Coinbase1    = request.Coinbase1;
            instance.Coinbase2    = request.Coinbase2;

            instance.TargetDiff = UInt256.Parse(instance.NBits);

            return(instance);
        }
Esempio n. 30
0
        public async Task ItPassesTheAccessUrlToTheNotifyApi(string assetRegisterUrl, string token)
        {
            OneTimeLinkNotification notification = new OneTimeLinkNotification
            {
                Email = "*****@*****.**",
                Url   = assetRegisterUrl,
                Token = token
            };

            await _classUnderTest.SendOneTimeLinkAsync(notification, CancellationToken.None);

            NotifyRequest notifyRequest = _simulator.ReceivedRequests[0].BodyAs <NotifyRequest>();

            var expectedUrl = $"{assetRegisterUrl}?token={token}";

            notifyRequest.personalisation.access_url.Should().Be(expectedUrl);
        }