private static MpGPExportDatum AdjustGPExportDatumAmount(MpGPExportDatum datum, int indx) { if (datum.ProcessorFeeAmount < 0) { //always a refund that is initated by Crossroads datum.DocumentType = "RETURNS"; datum.DonationAmount = (datum.DonationAmount * -1); datum.Amount = (datum.Amount - datum.ProcessorFeeAmount) * -1; } else if (datum.Amount < 0) { //always a refund due to processing problems: nsf, etc datum.DocumentType = "RETURNS"; datum.DonationAmount = (datum.DonationAmount * -1) + datum.ProcessorFeeAmount; datum.Amount = (datum.Amount * -1); } else { //not a refund datum.Amount = datum.Amount - datum.ProcessorFeeAmount; } datum.DistributionReference = datum.TransactionType == TransactionType.Payment ? $"Payment {datum.DonationDate}" : $"Contribution {datum.DonationDate}"; datum.DocumentNumber = string.Format("{0}000{1}", datum.DepositId, indx); return(datum); }
private MpGPExportDatum CreateProcessorFee(MpGPExportDatum datum, MPGLAccountMapping processingFeeGLMapping) { var processorFeeAmount = datum.ProcessorFeeAmount < 0 ? -1 * datum.ProcessorFeeAmount : datum.ProcessorFeeAmount; return(new MpGPExportDatum { DocumentNumber = datum.DocumentNumber, ProgramId = processingFeeGLMapping.ProgramId, DocumentType = datum.DocumentType, DepositId = datum.DepositId, DonationId = datum.DonationId, BatchName = datum.BatchName, DonationDate = datum.DonationDate, DepositDate = datum.DepositDate, CustomerId = processingFeeGLMapping.CustomerId, DepositAmount = datum.DepositAmount, DonationAmount = datum.DonationAmount, CheckbookId = processingFeeGLMapping.CheckbookId, CashAccount = (datum.DocumentType == "SALES" || datum.ProcessorFeeAmount < 0) ? processingFeeGLMapping.DistributionAccount : processingFeeGLMapping.CashAccount, ReceivableAccount = datum.ReceivableAccount, DistributionAccount = (datum.DocumentType == "SALES" || datum.ProcessorFeeAmount < 0) ? datum.DistributionAccount : processingFeeGLMapping.DistributionAccount, ScholarshipExpenseAccount = datum.ScholarshipExpenseAccount, Amount = processorFeeAmount, ScholarshipPaymentTypeId = datum.ScholarshipPaymentTypeId, PaymentTypeId = datum.PaymentTypeId, ProcessorFeeAmount = datum.ProcessorFeeAmount, TransactionType = datum.TransactionType, DistributionReference = $"Processor Fees {datum.DonationDate}" }); }
private void GenerateGLLevelGpExport(List <MpGPExportDatum> gpExportGLLevel, MpGPExportDatum gpExportDistLevel, MPGLAccountMapping processingFeeGLMapping, int indx) { gpExportGLLevel.Add(AdjustGPExportDatumAmount(gpExportDistLevel, indx)); if (gpExportDistLevel.ProcessorFeeAmount != 0) { gpExportGLLevel.Add(CreateProcessorFee(gpExportDistLevel, processingFeeGLMapping)); } }