Exemple #1
0
        public async Task <IPaymentRequestTransaction> GetByIdAsync(BlockchainType blockchain, TransactionIdentityType identityType, string identity, string walletAddress)
        {
            AzureIndex index = await _indexByIdentityStorage.GetDataAsync(
                PaymentRequestTransactionEntity.IndexByIdentity.GeneratePartitionKey(blockchain, identityType, identity),
                PaymentRequestTransactionEntity.IndexByIdentity.GenerateRowKey(walletAddress));

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

            PaymentRequestTransactionEntity entity = await _storage.GetDataAsync(index);

            return(Mapper.Map <PaymentRequestTransaction>(entity));
        }
Exemple #2
0
        public async Task <IPaymentRequestTransaction> AddAsync(IPaymentRequestTransaction transaction)
        {
            PaymentRequestTransactionEntity
                entity = PaymentRequestTransactionEntity.ByWalletAddress.Create(transaction);

            await _storage.InsertOrMergeAsync(entity);

            AzureIndex indexByIdentity = PaymentRequestTransactionEntity.IndexByIdentity.Create(entity);

            await _indexByIdentityStorage.InsertOrMergeAsync(indexByIdentity);

            AzureIndex indexByDueDate = PaymentRequestTransactionEntity.IndexByDueDate.Create(entity);

            await _indexByDueDateStorage.InsertOrMergeAsync(indexByDueDate);

            return(Mapper.Map <PaymentRequestTransaction>(entity));
        }
Exemple #3
0
        public async Task <IPaymentRequestTransaction> UpdateAsync(IPaymentRequestTransaction transaction)
        {
            PaymentRequestTransactionEntity entity = await _storage.MergeAsync(
                PaymentRequestTransactionEntity.ByWalletAddress.GeneratePartitionKey(transaction.WalletAddress),
                PaymentRequestTransactionEntity.ByWalletAddress.GenerateRowKey(transaction.Blockchain, transaction.IdentityType, transaction.Identity),
                e =>
            {
                e.TransactionId    = transaction.TransactionId;
                e.Amount           = transaction.Amount;
                e.BlockId          = transaction.BlockId;
                e.Confirmations    = transaction.Confirmations;
                e.FirstSeen        = transaction.FirstSeen;
                e.PaymentRequestId = transaction.PaymentRequestId;

                return(e);
            });

            return(Mapper.Map <PaymentRequestTransaction>(entity));
        }