Exemplo n.º 1
0
        public string FormatAmountToDisplayString(Money18 money18)
        {
            var formatInfo =
                new CultureInfo(_tokenFormatCultureInfo).NumberFormat;

            return(money18.ToString(_tokenIntegerPartFormat, _tokenNumberDecimalPlaces, formatInfo));
        }
Exemplo n.º 2
0
 public Task PublishTransferToInternalFailedAsync(string customerId, Money18 amount)
 {
     return(PublishAsync(new PushNotificationEvent
     {
         CustomerId = customerId,
         Source = $"{AppEnvironment.Name} - {AppEnvironment.Version}",
         MessageTemplateId = _pushNotificationsSettingsService.CrossChainDepositUnsuccessfulTemplateId,
         TemplateParameters = new Dictionary <string, string> {
             { "Amount", amount.ToString() }
         },
         CustomPayload = new Dictionary <string, string> {
             { "route", "wallet" }
         }
     }));
 }
 private async Task SetCacheValueAsync(string walletAddress, Money18 value)
 {
     await _distributedCache.SetStringAsync(GetCacheKey(walletAddress),
                                            value.ToString(),
                                            new DistributedCacheEntryOptions { AbsoluteExpiration = DateTime.UtcNow.Add(_cacheExpirationPeriod) });
 }
Exemplo n.º 4
0
        public async Task Publishes_BalanceUpdate()
        {
            // Arrange
            var fixture = new BalanceUpdatePublisherTestsFixture();
            var balance = new Money18(new BigInteger(234), 0);

            // Act
            await fixture.Service.PublishAsync(fixture.CustomerId, null, balance, DateTime.UtcNow);

            // Assert
            fixture.BlockchainFacadeClientMock.Verify(x => x.CustomersApi.GetBalanceAsync(It.IsAny <Guid>()),
                                                      Times.Never);

            fixture.WampSubjectMock.Verify(x => x.OnNext(It.Is <IWampEvent>(
                                                             c =>
                                                             c.Options.Eligible.Contains(fixture.SessionId) &&
                                                             (c.Arguments[0] as BalanceUpdate).Balance == balance.ToString("N0", 2, new CultureInfo("en-US").NumberFormat))),
                                           Times.Once);
        }