Esempio n. 1
0
        public async Task <string> InsertAsync(IForwardWithdrawal forwardWithdrawal)
        {
            var entity = ForwardWithdrawalEntity.Create(forwardWithdrawal);
            await _tableStorage.InsertAsync(entity);

            return(entity.Id);
        }
Esempio n. 2
0
        public static ForwardWithdrawalEntity Create(IForwardWithdrawal forwardWithdrawal)
        {
            var id = Guid.NewGuid().ToString();

            return(new ForwardWithdrawalEntity
            {
                Amount = forwardWithdrawal.Amount,
                AssetId = forwardWithdrawal.AssetId,
                ClientId = forwardWithdrawal.ClientId,
                CashInId = forwardWithdrawal.CashInId,
                DateTime = DateTime.UtcNow,
                Id = id,
                PartitionKey = GeneratePartitionKey(forwardWithdrawal.ClientId),
                RowKey = GenerateRowKey(id)
            });
        }
Esempio n. 3
0
 public static bool IsDue(this IForwardWithdrawal withdrawal, TimeSpan triggerSpan)
 {
     return(DateTime.UtcNow - withdrawal.DateTime > triggerSpan);
 }
Esempio n. 4
0
 //This method is used to raise awareness in case difference between DateTime and Timestamp is too big
 public static bool DateTimeTimestampDifferenceTooBig(this IForwardWithdrawal withdrawal, TimeSpan critical)
 {
     return(withdrawal.Timestamp.UtcDateTime >= withdrawal.DateTime
         ? withdrawal.Timestamp.UtcDateTime - withdrawal.DateTime > critical
         : withdrawal.DateTime - withdrawal.Timestamp.UtcDateTime > critical);
 }