コード例 #1
0
        public static PaymentTransactionEntity Create(IPaymentTransaction src)
        {
            var result = new PaymentTransactionEntity
            {
                Created                 = src.Created,
                TransactionId           = src.Id,
                Info                    = src.Info,
                ClientId                = src.ClientId,
                AssetId                 = src.AssetId,
                Amount                  = src.Amount,
                AggregatorTransactionId = src.AggregatorTransactionId,
                DepositedAssetId        = src.DepositedAssetId
            };

            result.SetPaymentStatus(src.Status);

            result.SetPaymentSystem(src.PaymentSystem);

            return(result);
        }
コード例 #2
0
        public async Task CreateAsync(IPaymentTransaction src)
        {
            var commonEntity = PaymentTransactionEntity.Create(src);

            commonEntity.PartitionKey = PaymentTransactionEntity.IndexCommon.GeneratePartitionKey();
            await _tableStorage.InsertAndGenerateRowKeyAsDateTimeAsync(commonEntity, src.Created);

            var entityByClient = PaymentTransactionEntity.Create(src);

            entityByClient.PartitionKey = PaymentTransactionEntity.IndexByClient.GeneratePartitionKey(src.ClientId);
            entityByClient.RowKey       = PaymentTransactionEntity.IndexByClient.GenerateRowKey(src.Id);


            var index = AzureMultiIndex.Create(IndexPartitinKey, src.Id, commonEntity, entityByClient);


            await Task.WhenAll(
                _tableStorage.InsertAsync(entityByClient),
                _tableStorageIndices.InsertAsync(index)
                );
        }