public void GetSpecificPayment() { var nordeaApiManager = new NordeaAPIv3Manager(); var payments = nordeaApiManager.GetPayments(); if (payments.Count == 0) { Creditor afsender = new Creditor { Account = new Account { Currency = "DKK", Value = "20301544117544", Type = "BBAN_DK" }, Message = "Test2" }; Debtor modtager = new Debtor { Account = new Account { Currency = "DKK", Value = "20301544118028", Type = "BBAN_DK" }, Message = "Test" }; nordeaApiManager.InitiatePayment(afsender, modtager, 10.0M, "DKK"); } payments = nordeaApiManager.GetPayments(); Assert.IsTrue(payments.Count > 0); if (payments.Count > 0) { var payment = payments.ElementAt(0); var id = payment.Id; var _payment = nordeaApiManager.GetPayment(id); Assert.IsTrue(PaymentEqual(payment, _payment)); } }
public Payment InitiatePayment(Creditor creditor, Debtor debtor, decimal amount, string currency) { JsonSerializerSettings settings = new JsonSerializerSettings(); settings.NullValueHandling = NullValueHandling.Ignore; string JsonCreditor = JsonConvert.SerializeObject(creditor, settings); string JsonDebtor = JsonConvert.SerializeObject(debtor, settings); string strAmount = amount.ToString(); string bodyParams = $"{{\"amount\": {strAmount.Replace(',','.')},\"currency\": \"{currency}\"," + $"\"creditor\": {JsonCreditor},\"debtor\": {JsonDebtor}}}"; var client = new RestClient("https://api.nordeaopenbanking.com/v3/payments/domestic"); var request = new RestRequest(Method.POST); request.AddHeader("postman-token", "e7c673c0-caa0-8d4d-67bb-6c1e2bad70bb"); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/json"); request.AddHeader("x-ibm-client-secret", ClientSecret); request.AddHeader("x-ibm-client-id", ClientId); request.AddHeader("authorization", $"Bearer {AccessToken}"); request.AddParameter("application/json", bodyParams, ParameterType.RequestBody); IRestResponse serverResponse = client.Execute(request); if (serverResponse.IsSuccessful) { var response = JObject.Parse(serverResponse.Content)["response"].ToString(); var responseJsonModel = JsonConvert.DeserializeObject <Payment>(response); return(responseJsonModel); } return(null); }
public void InitiatePayment() { var nordeaApiManager = new NordeaAPIv3Manager(); Creditor afsender = new Creditor { Account = new Account { Currency = "DKK", Value = "20301544117544", Type = "BBAN_DK" }, Message = "Test2" }; Debtor modtager = new Debtor { Account = new Account { Currency = "DKK", Value = "20301544118028", Type = "BBAN_DK" }, Message = "Test" }; var apiResult = nordeaApiManager.InitiatePayment(afsender, modtager, 10.0M, "DKK"); Assert.IsNotNull(apiResult); var paymentId = apiResult.Id; var confirmResult = nordeaApiManager.ConfirmPayment(paymentId); Assert.IsNotNull(confirmResult); var payments = nordeaApiManager.GetPayments(); var paymentIds = payments.Select(p => p.Id); Assert.IsTrue(payments.Count > 0); Assert.IsTrue(paymentIds.Contains(paymentId)); }
public object getCreditorByID(int id) { db.Configuration.ProxyCreationEnabled = false; Creditor objectCreditor = new Creditor(); dynamic toReturn = new ExpandoObject(); try { objectCreditor = db.Creditors.Find(id); if (objectCreditor == null) { toReturn.Message = "Record Not Found"; } else { toReturn = objectCreditor; } } catch (Exception error) { toReturn = "Something Went Wrong: " + error.Message; } return(toReturn); }
/// <summary> /// Maps Creditor EF object to Creditor Model Object and /// returns the Creditor model object. /// </summary> /// <param name="result">EF Creditor object to be mapped.</param> /// <returns>Creditor Model Object.</returns> public Creditor MapEFToModel(EF.Models.Creditor data) { var accountName = string.Empty; if (data.CasualWorkerId != null) { accountName = (data.CasualWorker.FirstName + " " + data.CasualWorker.LastName); } else if (data.AspNetUserId != null) { accountName = _userService.GetUserFullName(data.AspNetUser); } var creditor = new Creditor() { BranchName = data.Branch != null? data.Branch.Name:"", SectorName = data.Sector != null ? data.Sector.Name : "", AccountName = accountName, BranchId = data.BranchId, AspNetUserId = data.AspNetUserId, CasualWorkerId = data.CasualWorkerId, Action = data.Action, SectorId = data.SectorId, Amount = data.Amount, CreditorId = data.CreditorId, CreatedOn = data.CreatedOn, TimeStamp = data.TimeStamp, Deleted = data.Deleted, CreatedBy = _userService.GetUserFullName(data.AspNetUser), UpdatedBy = _userService.GetUserFullName(data.AspNetUser1), }; return(creditor); }
public async Task <bool> UpdateAsync(Creditor creditor) { try { if (creditor == null) { throw new ArgumentNullException(); } CreditorEntity entity = await _context.Creditors .FindAsync(creditor.CreditorId) .ConfigureAwait(false); if (entity != null) { _mapper.Map(creditor, entity); await _context.SaveChangesAsync().ConfigureAwait(false); return(true); } } catch (Exception e) { _context.DetachAll(); _logger.LogError(e, "Exception: {e} // Internal Error while updating Creditor: {creditor}", e.Message, JsonSerializer.Serialize(creditor)); } return(false); }
public object updateCreditor(Creditor creditorUpdate) { db.Configuration.ProxyCreationEnabled = false; Creditor objectCreditor = new Creditor(); dynamic toReturn = new ExpandoObject(); var id = creditorUpdate.CreditorID; try { objectCreditor = db.Creditors.Where(x => x.CreditorID == id).FirstOrDefault(); if (objectCreditor != null) { objectCreditor.CredAccountBalance = creditorUpdate.CredAccountBalance; objectCreditor.CredBank = creditorUpdate.CredBank; objectCreditor.CredBranch = creditorUpdate.CredBranch; objectCreditor.CredAccount = creditorUpdate.CredAccount; objectCreditor.CredType = creditorUpdate.CredType; db.SaveChanges(); toReturn.Message = "Creditor has successfully been updated."; } else { toReturn.Message = "Creditor Not Found"; } } catch (Exception) { toReturn.Message = "Please check input fields. Update failed."; } return(toReturn); }
internal async Task <Mandate> CreateMandateFor( Creditor creditor, Customer customer, CustomerBankAccount customerBankAccount) { var request = new CreateMandateRequest { Links = new CreateMandateLinks { Creditor = creditor.Id, CustomerBankAccount = customerBankAccount.Id }, Metadata = new Dictionary <string, string> { ["Key1"] = "Value1", ["Key2"] = "Value2", ["Key3"] = "Value3", }, Scheme = Scheme.Bacs }; var mandatesClient = new MandatesClient(_clientConfiguration); return((await mandatesClient.CreateAsync(request)).Item); }
public ActionResult SearchCreditor(string creditorCode) { if (creditorCode != "") { Creditor creditor = null; creditor = new NetStock.BusinessFactory.CreditorBO().GetCreditor(new Creditor { CreditorCode = creditorCode }); if (creditor == null) { creditor = new Creditor(); } creditor.CountryList = Utility.GetCountryList(); creditor.CreditorAccountList = Utility.GetCreditorAccountList(); return(RedirectToAction("CreditorProfile", new { creditorCode = creditorCode })); } else { return(RedirectToAction("CreditorProfile")); } }
public object addCreditorPayment(Creditor_Payment newCreditorPayment) { db.Configuration.ProxyCreationEnabled = false; dynamic toReturn = new ExpandoObject(); try { db.Creditor_Payment.Add(newCreditorPayment); Creditor creditor = db.Creditors.Where(x => x.SupplierID == newCreditorPayment.SupplierID).FirstOrDefault(); creditor.CredAccountBalance = creditor.CredAccountBalance - newCreditorPayment.CredPaymentAmount; if (creditor.CredAccountBalance < newCreditorPayment.CredPaymentAmount) { float amount = (float)(creditor.CredAccountBalance + newCreditorPayment.CredPaymentAmount); toReturn.Message = "Payment is greater than the Creditor's Balance. Balance for this Creditor is R" + amount; } else { db.SaveChanges(); toReturn.Message = "Creditor payment has been added successfully. Balance = R" + creditor.CredAccountBalance; } } catch (Exception) { toReturn.Message = "Payment not added. The selected supplier is not a creditor for ORDRA."; } return(toReturn); }
/// <summary> /// Return a copy of this object /// </summary> /// <returns></returns> public object Clone() { var row = (SepaCreditTransferTransaction)MemberwiseClone(); row.Creditor = (SepaIbanData)Creditor.Clone(); return(row); }
public async Task OneTimeSetup() { _creditor = await _resourceFactory.Creditor(); _customer = await _resourceFactory.CreateLocalCustomer(); _customerBankAccount = await _resourceFactory.CreateCustomerBankAccountFor(_customer); }
public async Task OneTimeSetup() { _creditor = await _resourceFactory.Creditor(); var customer = await _resourceFactory.CreateLocalCustomer(); var customerBankAccount = await _resourceFactory.CreateCustomerBankAccountFor(customer); _mandate = await _resourceFactory.CreateMandateFor(_creditor, customer, customerBankAccount); }
public ActionResult newCreditor(Creditor c) { if (ModelState.IsValid) { c.DateRecorded = DateTime.Now; db.Creditors.Add(c); db.SaveChanges(); TempData["Success"] = "Success"; } return(View()); }
/// <summary> /// Validate Creditor address /// </summary> private void CreditorAddress(Creditor creditor) { string countryId = UnicontaCountryToISO(creditor._Country); if (string.IsNullOrEmpty(countryId)) { var string1 = fieldCannotBeEmpty("Country"); var string2 = string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("Creditor"), creditor._Account); checkErrors.Add(new CheckError(String.Format("{0}, {1}", string1, string2))); } }
/// <summary> /// Saves a new Creditor or updates an already existing Creditor. /// </summary> /// <param name="Creditor">Creditor to be saved or updated.</param> /// <param name="CreditorId">CreditorId of the Creditor creating or updating</param> /// <returns>CreditorId</returns> public long SaveCreditor(CreditorDTO creditorDTO, string userId) { long creditorId = 0; if (creditorDTO.CreditorId == 0) { var creditor = new Creditor() { AspNetUserId = creditorDTO.AspNetUserId, CasualWorkerId = creditorDTO.CasualWorkerId, BranchId = creditorDTO.BranchId, Amount = creditorDTO.Amount, Action = creditorDTO.Action, SectorId = creditorDTO.SectorId, CreatedOn = DateTime.Now, TimeStamp = DateTime.Now, CreatedBy = userId, Deleted = false, }; this.UnitOfWork.Get <Creditor>().AddNew(creditor); this.UnitOfWork.SaveChanges(); creditorId = creditor.CreditorId; return(creditorId); } else { var result = this.UnitOfWork.Get <Creditor>().AsQueryable() .FirstOrDefault(e => e.CreditorId == creditorDTO.CreditorId); if (result != null) { result.AspNetUserId = creditorDTO.AspNetUserId; result.CasualWorkerId = creditorDTO.CasualWorkerId; result.Amount = creditorDTO.Amount; result.Action = creditorDTO.Action; result.BranchId = creditorDTO.BranchId; result.SectorId = creditorDTO.SectorId; result.UpdatedBy = userId; result.TimeStamp = DateTime.Now; result.Deleted = creditorDTO.Deleted; result.DeletedBy = creditorDTO.DeletedBy; result.DeletedOn = creditorDTO.DeletedOn; this.UnitOfWork.Get <Creditor>().Update(result); this.UnitOfWork.SaveChanges(); } return(creditorDTO.CreditorId); } }
public Address GetCreditorAddress(Creditor creditorItem) { var contactitem = new NetStock.Contract.Address { AddressLinkID = creditorItem.CreditorCode, AddressType = "Creditor" }; var currentAddress = new AddressDAL().GetContactsByCustomer(contactitem).FirstOrDefault(); //companyItem.ContactItem = new ContactDAL().GetItem(contactItem); return(currentAddress); }
public static Result <BankPosting> Create( decimal amount, DateTime dueDate, DateTime?documentDate, string documentNumber, Creditor creditor, string description, BankAccount bankAccount, Category category, DateTime?paymentDate, BankPostingType type) { var totalAmountResult = Amount.Create(amount); var dueDateResult = DueDate.Create(dueDate); var documentDateResult = GetDocumentDate(documentDate); var documentNumberResult = GetDocumentNumber(documentNumber); var descriptionResult = Description.Create(description); var paymentDateResult = GetPaymentDate(paymentDate); var result = Result.Combine( totalAmountResult, dueDateResult, documentDateResult, documentNumberResult, descriptionResult, paymentDateResult); if (result.IsSuccess) { return(Result.Success <BankPosting>( new BankPosting( amount: totalAmountResult.Value, dueDate: dueDateResult.Value, creditor: creditor, description: descriptionResult.Value, documentDate: documentDateResult.Value, documentNumber: documentNumberResult.Value, bankAccount: bankAccount, catgory: category, paymentDate: paymentDateResult.Value, type: type))); } return(Result .Failure <BankPosting>(result.Error)); }
private void UpdateCreditorRecords(string aspNetUserId, double amount, string userId) { long? branchId = null; double creditBalance = 0, creditTotal = 0; long casualWorkerId = 0; var creditorRecords = _creditorService.GetAllCreditorRecordsForParticularAccount(aspNetUserId, casualWorkerId); if (creditorRecords.Any()) { foreach (var creditorRecord in creditorRecords) { branchId = Convert.ToInt64(creditorRecord.BranchId); creditTotal = creditorRecord.Amount + creditTotal; var creditor = new Creditor() { CreditorId = creditorRecord.CreditorId, AspNetUserId = creditorRecord.AspNetUserId, Action = true, Amount = creditorRecord.Amount, BranchId = creditorRecord.BranchId, SectorId = creditorRecord.SectorId, Deleted = creditorRecord.Deleted, CreatedBy = creditorRecord.CreatedBy, CreatedOn = creditorRecord.CreatedOn, TimeStamp = creditorRecord.TimeStamp, }; var creditorId = _creditorService.SaveCreditor(creditor, userId); } creditBalance = creditTotal - amount; if (creditBalance > 0) { var creditor = new Creditor() { AspNetUserId = aspNetUserId, Action = false, Amount = creditBalance, BranchId = branchId, SectorId = Convert.ToInt64(sectorId), Deleted = false, CreatedBy = userId, }; var creditorId = _creditorService.SaveCreditor(creditor, userId); } } }
public object addCreditor(Creditor newCreditor) { db.Configuration.ProxyCreationEnabled = false; dynamic toReturn = new ExpandoObject(); try { db.Creditors.Add(newCreditor); db.SaveChanges(); toReturn.Message = "Creditor added successfully."; } catch (Exception) { toReturn.Message = "Failed to add creditor"; } return(toReturn); }
public long SaveCreditor(Creditor creditor, string userId) { var creditorDTO = new DTO.CreditorDTO() { AspNetUserId = creditor.AspNetUserId, Action = creditor.Action, Amount = creditor.Amount, CasualWorkerId = creditor.CasualWorkerId, BranchId = creditor.BranchId, SectorId = creditor.SectorId, CreditorId = creditor.CreditorId, Deleted = creditor.Deleted, CreatedBy = creditor.CreatedBy, CreatedOn = creditor.CreatedOn }; var creditorId = this._dataService.SaveCreditor(creditorDTO, userId); return(creditorId); }
private void NewItem() { CompanyViewModel.Clear(); if (_SelectedCustomerType == CustomerType.Creditor) { SelectedCreditor = new Creditor { Client = CompanyViewModel.Client }; FilteredCreditors.Add(SelectedCreditor); CompanyViewModel.Client = SelectedCreditor.Client; } else { SelectedDebitor = new Debitor { Client = CompanyViewModel.Client }; FilteredDebitors.Add(SelectedDebitor); } }
public BankPosting( Amount amount, DueDate dueDate, Creditor creditor, Description description, Maybe <DocumentDate> documentDate, Maybe <DocumentNumber> documentNumber, BankAccount bankAccount, Category catgory, Maybe <PaymentDate> paymentDate, BankPostingType type) { Amount = amount; DueDate = dueDate; Description = description; DocumentDate = documentDate; DocumentNumber = documentNumber; BankAccount = bankAccount; Cateogry = catgory; PaymentDate = paymentDate; Creditor = creditor; Type = type; }
public object removeCreditor(int id) { db.Configuration.ProxyCreationEnabled = false; Creditor objectCreditor = new Creditor(); dynamic toReturn = new ExpandoObject(); try { objectCreditor = db.Creditors.Where(x => x.SupplierID == id).FirstOrDefault(); if (objectCreditor == null) { toReturn.Message = "Creditor Not Found"; } else { List <Creditor_Payment> payments = db.Creditor_Payment.Where(x => x.SupplierID == id).ToList(); if (payments.Count == 0) { db.Creditors.Remove(objectCreditor); db.SaveChanges(); toReturn.Message = "Creditor has successfully been removed."; } else { toReturn.Message = "Removing Creditor Restricted"; } } } catch { toReturn.Message = "Removing Creditor Unssucessful"; } return(toReturn); }
internal async Task <RedirectFlow> CreateRedirectFlowFor(Creditor creditor) { var request = new CreateRedirectFlowRequest { Description = "First redirect flow", Links = new CreateRedirectFlowLinks { Creditor = creditor.Id }, PrefilledCustomer = new PrefilledCustomer { AddressLine1 = "Address Line 1", AddressLine2 = "Address Line 2", AddressLine3 = "Address Line 3", City = "London", CompanyName = "Company Name", CountryCode = "GB", DanishIdentityNumber = "2205506218", Email = "*****@*****.**", FamilyName = "Family Name", GivenName = "Given Name", Language = "en", PostalCode = "SW1A 1AA", Region = "Essex", SwedishIdentityNumber = "5302256218", }, Scheme = Scheme.Bacs, SessionToken = Guid.NewGuid().ToString(), SuccessRedirectUrl = "https://localhost", }; // when var redirectFlowsClient = new RedirectFlowsClient(_clientConfiguration); return((await redirectFlowsClient.CreateAsync(request)).Item); }
public static List <Creditor> GetCreditorList() { try { _creditorList.Clear(); string query = GetQuery(1); // "select distinct cr.id, cr.name from suvd.creditors cr, suvd.creditor_dogovors cd where cr.id = cd.creditor_id and (trunc(cd.stop_date) > trunc(sysdate) or cd.stop_date is null)"; OracleDataReader reader = _con.GetReader(query); while (reader.Read()) { Creditor cr = new Creditor(); cr.Id = Convert.ToDecimal(reader[0]); cr.Name = reader[1].ToString(); _creditorList.Add(cr); } reader.Close(); } catch (Exception ex) { MessageBox.Show("Exception from MyLetterManager.LetterManager.GetCreditorList(). " + ex.Message); } GetListWithAliases(ref _creditorList); return(_creditorList); }
private static void Task6() { Console.WriteLine("Идет генерация рандомных данных..."); for (int i = 0; i < rnd.Next(100, 1500); i++) { switch (rnd.Next(0, 3)) { case 0: { Creditor c = new Creditor(); c.GenerateRandData(); clients.Add(c); break; } case 1: { Society org = new Society(); org.GenerateRandData(); clients.Add(org); break; } case 2: { Investor investor = new Investor(); investor.GenerateRandData(); clients.Add(investor); break; } } } start: int choice = 0; Console.WriteLine("1 - Вывести всех\n2 - Поиск по дате"); int.TryParse(Console.ReadLine(), out choice); switch (choice) { case 1: { foreach (Client item in clients) { item.PrintInfo(); } Console.WriteLine($"Всего : {phonebooks.Count} клиентов"); Console.WriteLine("Go to Beginning - w\nExit - any"); if (Console.ReadLine()?.ToLower() == "w") { goto start; } break; } case 2: { Console.WriteLine("Введите дату : "); DateTime date; DateTime.TryParse(Console.ReadLine(), out date); int counter = 0; foreach (Client item in clients) { if (item.Search(date)) { item.PrintInfo(); counter++; } } Console.WriteLine($"Всего : {counter} клиентов, подходящих по дате"); Console.WriteLine("Go to Beginning - w\nExit - any"); if (Console.ReadLine()?.ToLower() == "w") { goto start; } break; } } }
async public Task <bool> InstantiateFields() { try { var crudApi = this.crudApi; var Comp = crudApi.CompanyEntity; var creditorInvoiceLineUserType = ReportUtil.GetUserType(typeof(CreditorInvoiceLines), Comp); var creditorInvoiceUserType = ReportUtil.GetUserType(typeof(CreditorInvoiceClient), Comp); if (!isRePrint) { var invApi = new InvoiceAPI(crudApi); var invoiceLIneInstance = Activator.CreateInstance(creditorInvoiceLineUserType) as CreditorInvoiceLines; InvTransInvoiceLines = (CreditorInvoiceLines[])await invApi.GetInvoiceLines(CreditorInvoice, invoiceLIneInstance); } else { //for Gettting user firlds for Creditor Invoice var dcInvoice = (DCInvoiceClient)invoicePostingResult.Header; CreditorInvoice = new CreditorInvoiceClient(); StreamingManager.Copy(dcInvoice, CreditorInvoice); var linesCount = invoicePostingResult.Lines.Count(); if (linesCount > 0) { var lines = invoicePostingResult.Lines; InvTransInvoiceLines = Array.CreateInstance(creditorInvoiceLineUserType, linesCount) as CreditorInvoiceLines[]; int i = 0; foreach (var invtrans in invoicePostingResult.Lines) { CreditorInvoiceLines creditorInvoiceLines; if (invtrans.GetType() != creditorInvoiceLineUserType) { creditorInvoiceLines = Activator.CreateInstance(creditorInvoiceLineUserType) as CreditorInvoiceLines; StreamingManager.Copy(invtrans, creditorInvoiceLines); } else { creditorInvoiceLines = invtrans as CreditorInvoiceLines; } InvTransInvoiceLines[i++] = creditorInvoiceLines; } } } //For Getting User-Fields for CreditorInvoice CreditorInvoiceClient creditorInvoiceClientUser; if (CreditorInvoice.GetType() != creditorInvoiceUserType) { creditorInvoiceClientUser = Activator.CreateInstance(creditorInvoiceUserType) as CreditorInvoiceClient; StreamingManager.Copy(CreditorInvoice, creditorInvoiceClientUser); } else { creditorInvoiceClientUser = CreditorInvoice as CreditorInvoiceClient; } CreditorInvoice = creditorInvoiceClientUser; //for Gettting user fields for Creditor var dcCahce = Comp.GetCache(typeof(Uniconta.DataModel.Creditor)) ?? await crudApi.LoadCache(typeof(Uniconta.DataModel.Creditor)); var cred = dcCahce.Get(CreditorInvoice._DCAccount); var creditorUserType = ReportUtil.GetUserType(typeof(CreditorClient), Comp); if (creditorUserType != cred?.GetType()) { var creditorClientUser = Activator.CreateInstance(creditorUserType) as CreditorClient; if (cred != null) { StreamingManager.Copy((UnicontaBaseEntity)cred, creditorClientUser); } Creditor = creditorClientUser; } else { Creditor = cred as CreditorClient; } if (Comp.Contacts) { var contactCache = Comp.GetCache(typeof(Contact)) ?? await crudApi.LoadCache(typeof(Contact)); var contactCacheFilter = new ContactCacheFilter(contactCache, Creditor.__DCType(), Creditor._Account); if (contactCacheFilter.Any()) { try { Creditor.Contacts = contactCacheFilter.Cast <ContactClient>().ToArray(); } catch { } } } UnicontaClient.Pages.DebtorOrders.SetDeliveryAdress(creditorInvoiceClientUser, Creditor, crudApi); /*In case debtor order is null, fill from DCInvoice*/ if (CreditorOrder == null) { var creditorOrderUserType = ReportUtil.GetUserType(typeof(CreditorOrderClient), Comp); var creditorOrderUser = Activator.CreateInstance(creditorOrderUserType) as CreditorOrderClient; creditorOrderUser.CopyFrom(creditorInvoiceClientUser, Creditor); CreditorOrder = creditorOrderUser; } Company = Utility.GetCompanyClientUserInstance(Comp); var InvCache = Comp.GetCache(typeof(InvItem)) ?? await crudApi.LoadCache(typeof(InvItem)); CompanyLogo = await Uniconta.ClientTools.Util.UtilDisplay.GetLogo(crudApi); Language lang = ReportGenUtil.GetLanguage(Creditor, Comp); InvTransInvoiceLines = LayoutPrintReport.SetInvTransLines(CreditorInvoice, InvTransInvoiceLines, InvCache, crudApi, creditorInvoiceLineUserType, lang, false); var lineTotal = CreditorInvoice._LineTotal; IsCreditNote = CreditorInvoice._LineTotal < -0.0001d && layoutType == CompanyLayoutType.PurchaseInvoice; ReportName = IsCreditNote ? "CreditNote" : layoutType.ToString(); CreditorMessage = isMultiInvoice? LayoutPrintReport.GetDebtorMessageClient(debtorMessageLookup, lang, GetEmailTypeForCreditor())?._Text: await GetMessageClientText(lang); return(true); } catch (Exception ex) { crudApi.ReportException(ex, "Error Occured in CreditorPrintReport"); return(false); } }
/// <summary> /// Validate Payment method BBAN /// </summary> private void PaymentMethodBBAN(Creditor creditor, Company company, String bban) { //Norway: PaymentId can be used for Kid-No when PaymentType = VendorBankAccount //BBAN will be retrieved from Creditor if (exportFormat == ExportFormatType.ISO20022_NO) { var kidNo = bban ?? string.Empty; bban = glJournalGenerated ? string.Empty : creditor._PaymentId ?? string.Empty; //Validate Creditor BBAN >> if (bban == string.Empty) { checkErrors.Add(new CheckError(Uniconta.ClientTools.Localization.lookup("CredBBANMissing"))); } else { bban = Regex.Replace(bban, "[^0-9]", ""); if (bban.Length <= 4 || bban.Length > 11) { checkErrors.Add(new CheckError(Uniconta.ClientTools.Localization.lookup("PaymentIdInvalid"))); } } //Validate Creditor BBAN << //Validate KID-number >> if (kidNo != string.Empty) { if (kidNo.Length < 4 || kidNo.Length > 25) { checkErrors.Add(new CheckError(String.Format("The KID-number lenght is not valid."))); } else if (Mod10Check(kidNo) == false) { if (Mod11Check(kidNo) == false) { checkErrors.Add(new CheckError(String.Format("The KID-number failed the Modulus 10 and 11 check digit."))); } } } //Validate KID-number << } else { if (string.IsNullOrEmpty(bban)) { checkErrors.Add(new CheckError(fieldCannotBeEmpty("PaymentId"))); } else { bban = Regex.Replace(bban, "[^0-9]", ""); if (bban.Length <= 4) { checkErrors.Add(new CheckError(Uniconta.ClientTools.Localization.lookup("PaymentIdInvalid"))); } var countryId = glJournalGenerated ? UnicontaCountryToISO(company._CountryId) : UnicontaCountryToISO(creditor._Country); if (countryId == BaseDocument.COUNTRY_DK) { if (bban.Length > 14) { checkErrors.Add(new CheckError(Uniconta.ClientTools.Localization.lookup("PaymentIdInvalid"))); } } } } }
/// <summary> /// Validate Payment method IBAN /// </summary> private void PaymentMethodIBAN(Creditor creditor, Company company, String iban) { //ESTONIA: PaymentId can be used for Payment Reference when PaymentType = IBAN //IBAN will be retrieved from Creditor if (exportFormat == ExportFormatType.ISO20022_EE) { var paymRefNumber = iban ?? string.Empty; iban = glJournalGenerated ? string.Empty : creditor._PaymentId ?? string.Empty; //Validate Creditor IBAN >> if (iban == string.Empty) { checkErrors.Add(new CheckError(String.Format("The Creditor IBAN number has not been filled in"))); } else { creditorIBAN = Regex.Replace(iban, "[^\\w\\d]", ""); if (!StandardPaymentFunctions.ValidateIBAN(creditorIBAN)) { checkErrors.Add(new CheckError(Uniconta.ClientTools.Localization.lookup("PaymentIdInvalid"))); } else { string countryId = string.Empty; if (iban.Length >= 2) { countryId = iban.Substring(0, 2); } if (glJournalGenerated && countryId != BaseDocument.COUNTRY_DK) { checkErrors.Add(new CheckError(String.Format("Creditor information is required for foreign payments and they're not available."))); } } } //Validate Creditor BBAN << //Validate Estonia Payment Reference >> if (paymRefNumber != string.Empty) { //Need information from Estonia to implement } //Validate Estonia Payment Reference << } else { if (!string.IsNullOrEmpty(iban)) { creditorIBAN = Regex.Replace(iban, "[^\\w\\d]", ""); if (!StandardPaymentFunctions.ValidateIBAN(creditorIBAN)) { checkErrors.Add(new CheckError(Uniconta.ClientTools.Localization.lookup("PaymentIdInvalid"))); } else { string countryId = string.Empty; if (iban.Length >= 2) { countryId = iban.Substring(0, 2); } if (glJournalGenerated && countryId != BaseDocument.COUNTRY_DK) { checkErrors.Add(new CheckError(String.Format("Creditor information is required for foreign payments and they're not available."))); } } } else { checkErrors.Add(new CheckError(fieldCannotBeEmpty("PaymentId"))); } } }