public IssuingDisputeServiceTest() { this.service = new DisputeService(); this.createOptions = new DisputeCreateOptions() { DisputedTransactionId = "ipi_123", Evidence = new EvidenceOptions { Fraudulent = new EvidenceDetailsOptions { DisputeExplanation = "Explanation", UncategorizedFile = "file_123", } }, Reason = "fraudulent", }; this.updateOptions = new DisputeUpdateOptions() { Metadata = new Dictionary <string, string>() { { "key", "value" }, }, }; this.listOptions = new DisputeListOptions() { Limit = 1, }; }
public IssuingDisputeServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new DisputeService(this.StripeClient); this.createOptions = new DisputeCreateOptions { DisputedTransaction = "ipi_123", Evidence = new EvidenceOptions { Fraudulent = new EvidenceDetailsOptions { DisputeExplanation = "Explanation", UncategorizedFile = "file_123", }, }, Reason = "fraudulent", }; this.updateOptions = new DisputeUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new DisputeListOptions { Limit = 1, }; }
public IssuingDisputeServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new DisputeService(this.StripeClient); this.createOptions = new DisputeCreateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.updateOptions = new DisputeUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new DisputeListOptions { Limit = 1, }; }
// // POST || GET: /DashBoard/NumberOfDisputes public ActionResult NumberOfDisputes(CustomSearchModel csm, bool givedata = false) { DateTime fromDate = csm.FromDate ?? new DateTime(DateTime.Now.AddMonths(-2).Year, DateTime.Now.AddMonths(-2).Month, 1); DateTime toDate = csm.ToDate ?? new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)); using (DisputeService service = new DisputeService()) { if (givedata) { csm.ToDate = toDate; csm.FromDate = fromDate; List <DisputeCustomModel> authCodes = service.List1(new PagingModel() { Take = int.MaxValue }, csm); return(PartialView("_NumberOfDisputesData", authCodes)); } List <NumberOfDisputes> disputes = new List <NumberOfDisputes>(); int months = ((toDate.Year - fromDate.Year) * 12) + toDate.Month - fromDate.Month; months = months <= 0 ? 1 : months + 1; NumberOfDisputes dispute; for (int i = 0; i < months; i++) { csm.FromDate = new DateTime(DateTime.Now.AddMonths(-i).Year, DateTime.Now.AddMonths(-i).Month, 1); csm.ToDate = new DateTime(csm.FromDate.Value.Year, csm.FromDate.Value.Month, DateTime.DaysInMonth(csm.FromDate.Value.Year, csm.FromDate.Value.Month)); dispute = service.NumberOfDisputes(csm); dispute.MonthYear = csm.FromDate.Value.Year; dispute.MonthNumber = csm.FromDate.Value.Month; dispute.MonthName = $"{csm.FromDate.Value:MMMM} {csm.FromDate.Value:yyyy}"; disputes.Add(dispute); } //Yearly cumulative csm.FromDate = new DateTime(DateTime.Now.Year, 1, 1); csm.ToDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)); dispute = service.NumberOfDisputes(csm); dispute.MonthYear = int.MaxValue; dispute.MonthNumber = int.MaxValue; dispute.MonthName = csm.FromDate.Value.ToString("yyyy"); disputes.Add(dispute); disputes = disputes.OrderBy(o => o.MonthYear).ThenBy(o => o.MonthNumber).ToList(); return(PartialView("_NumberOfDisputes", disputes)); } }
public DisputeServiceTest() { this.service = new DisputeService(); this.updateOptions = new DisputeUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new DisputeListOptions { Limit = 1, }; }
public IssuingDisputeServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new DisputeService(this.StripeClient); this.createOptions = new DisputeCreateOptions { Evidence = new DisputeEvidenceOptions { NotReceived = new DisputeEvidenceNotReceivedOptions { AdditionalDocumentation = "file_123", ExpectedAt = DateTime.Now, Explanation = "Dispute explanation", ProductDescription = "Product description", ProductType = "merchandise", }, Reason = "not_received", }, Transaction = "ipi_123", }; this.submitOptions = new DisputeSubmitOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.updateOptions = new DisputeUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new DisputeListOptions { Limit = 1, }; }
public DisputeServiceTest(MockHttpClientFixture mockHttpClientFixture) : base(mockHttpClientFixture) { this.service = new DisputeService(); this.updateOptions = new DisputeUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new DisputeListOptions { Limit = 1, }; }
public IssuingDisputeServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new DisputeService(this.StripeClient); this.createOptions = new DisputeCreateOptions { }; this.updateOptions = new DisputeUpdateOptions { }; this.listOptions = new DisputeListOptions { Limit = 1, }; }
/// <summary> /// Creates a Dispute using the specified TDN and Docket number if it does not already exists /// </summary> /// <param name="writer"></param> /// <param name="message"></param> /// <param name="count"></param> private static void CreateDispute(StreamWriter writer, MimeMessage message, int count) { try { // Skip if this dispute has already been read/processed if (message.Date.Date <= ConfigSettings.SystemRules.LastDisputeMonitorRun?.Date) { return; } // Skip if this email is not a dispute if (!message.Subject.ToLower().Contains("chep transaction in dispute")) { return; } string text = message.TextBody ?? message.HtmlBody; if (string.IsNullOrWhiteSpace(text)) { Info(writer, $" x EMPTY Email Body FOUND for email #{count}! SKIPPING MessageId {message.MessageId} @{DateTime.Now}"); return; } if (!text.ToLower().Contains("tdn number:") || !text.ToLower().Contains("docket number:")) { Info(writer, $" x Email Body for email #{count} does not contain TDN or DOCKET number! SKIPPING MessageId {message.MessageId} @{DateTime.Now}"); return; } List <string> lines = text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries) .Where(l => l.ToLower().Contains("tdn number:") || l.ToLower().Contains("docket number:") || l.ToLower().Contains("sender:") || l.ToLower().Contains("receiver:") || l.ToLower().Contains("declarer:") || l.ToLower().Contains("effect date:") || l.ToLower().Contains("product:") || l.ToLower().Contains("quantity:") || l.ToLower().Contains("actioned by:") || l.ToLower().Contains("status changed from") ) .ToList(); if (!lines.NullableAny()) { Info(writer, $" x Email Body for email #{count} does not contain ALL required information! SKIPPING MessageId {message.MessageId} @{DateTime.Now}"); return; } using (UserService uservice = new UserService()) using (DisputeService dservice = new DisputeService()) using (ChepLoadService clservice = new ChepLoadService()) { string docketNumber = lines.FirstOrDefault(l => l.Contains("docket number:")).Split(':')[1].Trim(); // Try and locate a ChepLoad using the email's DocketNumber ChepLoad cl = clservice.GetByDocketNumber(docketNumber); Dispute dispute = dservice.GetByDocketNumber(docketNumber); if (dispute != null) { Info(writer, $" x Dispute email #{count} with Docket Number {docketNumber} ALREADY EXISTS on the system! SKIPPING MessageId {message.MessageId} @{DateTime.Now}"); return; } string[] disputeReason = lines.FirstOrDefault(l => l.Contains("status changed from")).Split(':'); int.TryParse(lines.FirstOrDefault(l => l.Contains("quantity:")).Split(':')[1].Trim(), out int quantity); string actionBy = lines.FirstOrDefault(l => l.Contains("actioned by:")).Split(':')[1].Trim(); User user = uservice.GetByNameAndSurname(actionBy.Split(' ')[0].Trim(), actionBy.Split(' ')[1].Trim()); dispute = new Dispute() { Imported = true, ChepLoadId = cl?.Id, Quantity = quantity, ActionBy = actionBy, ActionedById = user?.Id, Status = ( int )Status.Active, DisputeEmail = string.Join(";", message.From), //DisputeReason = disputeReason[ disputeReason.Length - 1 ], Sender = lines.FirstOrDefault(l => l.Contains("sender:")).Split(':')[1].Trim(), Product = lines.FirstOrDefault(l => l.Contains("product:")).Split(':')[1].Trim(), Declarer = lines.FirstOrDefault(l => l.Contains("declarer:")).Split(':')[1].Trim(), Receiver = lines.FirstOrDefault(l => l.Contains("receiver:")).Split(':')[1].Trim(), Equipment = lines.FirstOrDefault(l => l.Contains("product:")).Split(':')[1].Trim(), TDNNumber = lines.FirstOrDefault(l => l.Contains("tdn number:")).Split(':')[1].Trim(), Reference = lines.FirstOrDefault(l => l.Contains("docket number:")).Split(':')[1].Trim(), DocketNumber = lines.FirstOrDefault(l => l.Contains("docket number:")).Split(':')[1].Trim(), }; dispute = dservice.Create(dispute); Info(writer, $" - SUCCESSFULLY CREATED Dispute for Docket Number {docketNumber} ({dispute.Id}) @{DateTime.Now}"); } } catch (Exception ex) { Error(writer, ex, "CreateDispute"); } }