예제 #1
0
        public List <RecurringBatchTransactionDataViewModel> GetTransactionListForExport(TransactionFilter filter)
        {
            try
            {
                var transactionData    = new List <RecurringBatchTransactionDataViewModel>();
                var transactionReports = transactionReportRepository.GetPagedTransactionList(filter);
                foreach (var transactionReport in transactionReports.Transactions)
                {
                    var transactionDataViewModel = new RecurringBatchTransactionDataViewModel
                    {
                        ReferenceNumber   = transactionReport.ReferenceNumber,
                        TransId           = transactionReport.TransId,
                        AuthorizationCode = transactionReport.AuthCode,
                        CardNumber        = transactionReport.AuxiliaryField05
                    };
                    if (transactionReport.UpdatedVirtualAccount != guid.Empty)
                    {
                        transactionDataViewModel.NewCardNumber =
                            virtualNumberApiAccess.Get6Plus4CardForVirtualNumber(transactionReport.UpdatedVirtualAccount);
                    }

                    transactionData.Add(transactionDataViewModel);
                }
                return(transactionData);
            }
            catch (Exception exception)
            {
                //logger.LogError("Unexpected error occurred when filtering and mapping RecurringBatch", exception);
                return(null);
            }
        }
예제 #2
0
        public RecurringBatchTransactionViewModel GetTransactionViewWithPaging(TransactionFilter filter)
        {
            try
            {
                var batchReport = batchReportRepository.GetSingle(filter.BatchId);

                var transactionViewModel = new RecurringBatchTransactionViewModel
                {
                    AgreementNumber             = batchReport.MerchantAgreementNumber,
                    BatchStatus                 = batchReport.BatchStatus,
                    DbaName                     = batchReport.DbaName,
                    MerchantAssignedBatchNumber = batchReport.MerchantAssignedBatchNumber,
                    MerchantName                = batchReport.MerchantName,
                    MerchantNationalId          = batchReport.AuxiliaryField02,
                    ProcessingEndTime           = batchReport.ProcessingEndTime,
                    ProcessingStartTime         = batchReport.ProcessingStartTime,
                    BatchId                     = filter.BatchId
                };

                var transactionReports = transactionReportRepository.GetPagedTransactionList(filter);
                foreach (var transactionReport in transactionReports.Transactions)
                {
                    var transactionDataViewModel = new RecurringBatchTransactionDataViewModel
                    {
                        ReferenceNumber             = transactionReport.ReferenceNumber,
                        TransId                     = transactionReport.TransId,
                        AuthorizationCode           = transactionReport.AuthCode,
                        CardNumber                  = transactionReport.AuxiliaryField05,
                        Amount                      = transactionReport.Amount,
                        TransactionId               = transactionReport.Id,
                        VirtualAccountNumber        = transactionReport.ReceivedVirtualAccount,
                        UpdatedVirtualAccountNumber = transactionReport.UpdatedVirtualAccount
                    };
                    if (transactionReport.UpdatedVirtualAccount != guid.Empty)
                    {
                        transactionDataViewModel.NewCardNumber =
                            virtualNumberApiAccess.Get6Plus4CardForVirtualNumber(transactionReport.UpdatedVirtualAccount);
                    }

                    transactionViewModel.Transactions.Add(transactionDataViewModel);
                }
                transactionViewModel.TransactionFilter = filter;
                transactionViewModel.Pagination        = new PaginationViewModel
                {
                    CurrentPage           = transactionReports.CurrentPage,
                    IsNextPage            = transactionReports.IsNextPage,
                    IsPreviousPage        = transactionReports.IsPreviousPage,
                    TotalCount            = transactionReports.TotalCount,
                    TotalPages            = transactionReports.TotalPages,
                    PaginationFunctionUrl = "RecurringBatchTransaction/GetPage"
                };
                return(transactionViewModel);
            }
            catch (Exception exception)
            {
                //logger.LogError("Unexpected error occurred when filtering and mapping RecurringBatch", exception);
                return(null);
            }
        }
예제 #3
0
 private static string[] Map(RecurringBatchTransactionDataViewModel recurringBatch)
 {
     return(new[]
     {
         recurringBatch.ReferenceNumber,
         recurringBatch.AuthorizationCode,
         recurringBatch.TransId,
         recurringBatch.Amount.ToString(CultureInfo.InvariantCulture),
         recurringBatch.CardNumber,
         recurringBatch.NewCardNumber
     });
 }