public void Run(string[] args) { var environmentType = ShareLib.DetermineEnvironmentType(args); ShareLib.PrintHeader(); var bunq = new BunqLib(environmentType); var amount = ShareLib.GetAmountFromArgsOrStdIn(args); var recipient = ShareLib.GetRecipientFromArgsOrStdIn(args); var description = ShareLib.GetDescriptionFromArgsOrStdIn(args); Console.Out.WriteLine(); Console.Out.WriteLine($" | Requesting: € {amount}"); Console.Out.WriteLine($" | From: {recipient}"); Console.Out.WriteLine($" | Description: {description}"); Console.Out.WriteLine(); Console.Out.WriteLine(" ..."); Console.Out.WriteLine(); RequestInquiry.Create(new Amount(amount, "EUR"), new Pointer("EMAIL", recipient), description, true); Console.Out.WriteLine(); Console.Out.WriteLine(" | Request sent"); Console.Out.WriteLine(); Console.Out.WriteLine(" | Check your changed overview"); Console.Out.WriteLine(); Console.Out.WriteLine(); bunq.UpdateContext(); }
public void Run(string[] args) { var environmentType = ShareLib.DetermineEnvironmentType(args); ShareLib.PrintHeader(); var bunq = new BunqLib(environmentType); var accountId = ShareLib.GetAccountIdFromArgsOrStdIn(args); var name = ShareLib.GetNameFromArgsOrStdIn(args); Console.Out.WriteLine(); Console.Out.WriteLine($" | Updating Name: {name}"); Console.Out.WriteLine($" | of Account: {accountId}"); Console.Out.WriteLine(); Console.Out.WriteLine(" ..."); Console.Out.WriteLine(); MonetaryAccountBank.Update(int.Parse(accountId), name); Console.Out.WriteLine(); Console.Out.WriteLine(" | Account updated"); Console.Out.WriteLine(); Console.Out.WriteLine(" | Check your changed overview"); Console.Out.WriteLine(); Console.Out.WriteLine(); bunq.UpdateContext(); }
public void Run(string[] args) { var environmentType = ShareLib.DetermineEnvironmentType(args); ShareLib.PrintHeader(); var bunq = new BunqLib(environmentType); ShareLib.PrintUser(BunqContext.UserContext.UserId, bunq.GetCurrentUserDisplayName()); var allMonetaryAccountBankActive = bunq.GetAllMonetaryAccountBankActive(1); ShareLib.PrintAllMonetaryAccountBank(allMonetaryAccountBankActive); var allPayment = bunq.GetAllPayment(1); ShareLib.PrintAllPayment(allPayment); var allRequest = bunq.GetAllRequest(1); ShareLib.PrintAllRequest(allRequest); var allCard = bunq.GetAllCard(1); ShareLib.PrintAllCard(allCard, allMonetaryAccountBankActive); if (environmentType.Equals(ApiEnvironmentType.SANDBOX)) { var allUserAlias = bunq.GetAllUserAlias(); ShareLib.PrintAllUserAlias(allUserAlias); } bunq.UpdateContext(); }
public void Run(string[] args) { var environmentType = ShareLib.DetermineEnvironmentType(args); ShareLib.PrintHeader(); var bunq = new BunqLib(environmentType); var cardId = ShareLib.GetCardIdFromArgsOrStdIn(args); var accountId = ShareLib.GetAccountIdFromArgsOrStdIn(args); Console.Out.WriteLine(); Console.Out.WriteLine($" | Link Card: {cardId}"); Console.Out.WriteLine($" | To Account: {accountId}"); Console.Out.WriteLine(); Console.Out.WriteLine(" ..."); Console.Out.WriteLine(); Card.Update(int.Parse(cardId), monetaryAccountCurrentId: int.Parse(accountId)); Console.Out.WriteLine(); Console.Out.WriteLine(" | Account switched"); Console.Out.WriteLine(); Console.Out.WriteLine(" | Check your changed overview"); Console.Out.WriteLine(); Console.Out.WriteLine(); bunq.UpdateContext(); }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="codeInfo"></param> public void DrawBarCode(Graphics g, RptBarCode codeInfo) { BarcodeLib.Barcode bar = new BarcodeLib.Barcode(); bar.IncludeLabel = codeInfo.ShowFooter; try { var barCode = bar.Encode(ShareLib.Convert(codeInfo.CodeType), codeInfo.BarCode, (int)codeInfo.Rect.Width, codeInfo.InnerRect.Height - 2); g.DrawImage(barCode, new Point((int)codeInfo.LeftMargin - 3, (int)codeInfo.TopMargin - 1)); } catch { } }
public void DrawBarCodeWithLib(DevExpress.XtraPrinting.BrickGraphics g, RptBarCode codeInfo, string barCode, Rectangle realDrawRect) { BarcodeLib.Barcode bar = new BarcodeLib.Barcode(); //bar.BackColor = Color.White;\ bar.ImageFormat = ImageFormat.Gif; bar.IncludeLabel = codeInfo.ShowFooter; try { var rect = new RectangleF(realDrawRect.X, realDrawRect.Y + 1, realDrawRect.Width, realDrawRect.Height - 1); g.DrawImage(bar.Encode(ShareLib.Convert(codeInfo.CodeType), barCode, (int)rect.Width, (int)rect.Height), rect, DevExpress.XtraPrinting.BorderSide.None, Color.White); } catch { } }
public void Run(string[] args) { var environmentType = ShareLib.DetermineEnvironmentType(args); ShareLib.PrintHeader(); var bunq = new BunqLib(environmentType); var callbackUrl = ShareLib.GetCallbackUrlFromArgsOrStdIn(args); Console.Out.WriteLine(); Console.Out.WriteLine($" | Adding Callback URL: {callbackUrl}"); Console.Out.WriteLine(); Console.Out.WriteLine(" ..."); Console.Out.WriteLine(); if (BunqContext.UserContext.isOnlyUserCompanySet()) { UserCompany.Update( notificationFilters: UpdateAllNotificationFilter( BunqContext.UserContext.UserCompany.NotificationFilters, callbackUrl ) ); } else if (BunqContext.UserContext.IsOnlyUserPersonSet()) { UserPerson.Update( notificationFilters: UpdateAllNotificationFilter( BunqContext.UserContext.UserPerson.NotificationFilters, callbackUrl ) ); } else { throw new BunqException("Unexpected user type found."); } Console.Out.WriteLine(); Console.Out.WriteLine(" | Callback URL added"); Console.Out.WriteLine(); Console.Out.WriteLine(" | Check your changed overview"); Console.Out.WriteLine(); Console.Out.WriteLine(); bunq.UpdateContext(); }
public void Run(string[] args) { Dictionary <string, string> allOption = AssertMandatoryOptions(args); ApiContext apiContext = ApiContext.CreateForPsd2( ShareLib.DetermineEnvironmentType(args), SecurityUtils.GetCertificateFromFile(allOption[OPTION_CREDENTIALS], allOption[OPTION_PASSPHRASE]), new X509CertificateCollection() { SecurityUtils.GetCertificateFromFile(allOption[OPTION_CERTIFICATE_CHAIN]) }, API_DEVICE_DESCRIPTION, new List <string>() ); apiContext.Save(FILE_CONTEXT); }
public void Run(string[] args) { Dictionary <string, string> allOption = AssertMandatoryOptions(args); ApiContext apiContext = ApiContext.Restore(allOption[OPTION_CONTEXT]); BunqContext.LoadApiContext(apiContext); OauthAccessToken accessToken = OauthAccessToken.Create( OauthGrantType.AUTHORIZATION_CODE, allOption[OPTION_AUTH_CODE], allOption[OPTION_REDIRECT], CreateOauthClientFromFile(allOption[OPTION_CLIENT_CONFIGURATION]) ); apiContext = CreateApiContextByOauthToken( accessToken, ShareLib.DetermineEnvironmentType(args) ); BunqContext.LoadApiContext(apiContext); (new UserOverview()).Run(new String[] {}); }
public void Run(string[] args) { var environmentType = ShareLib.DetermineEnvironmentType(args); ShareLib.PrintHeader(); var bunq = new BunqLib(environmentType); var callbackUrl = ShareLib.GetCallbackUrlFromArgsOrStdIn(args); Console.Out.WriteLine(); Console.Out.WriteLine($" | Adding Callback URL: {callbackUrl}"); Console.Out.WriteLine(); Console.Out.WriteLine(" ..."); Console.Out.WriteLine(); var allNotificationFilter = NotificationFilterUrlUserInternal.List().Value; var allNotificationFilterUrl = new List <NotificationFilterUrl>(); foreach (var notificationFilterUser in allNotificationFilter) { allNotificationFilterUrl.AddRange(notificationFilterUser.NotificationFilters); } allNotificationFilterUrl = UpdateAllNotificationFilter(allNotificationFilterUrl, callbackUrl); NotificationFilterUrlUserInternal.CreateWithListResponse(allNotificationFilterUrl); Console.Out.WriteLine(); Console.Out.WriteLine(" | Callback URL added"); Console.Out.WriteLine(); Console.Out.WriteLine(" | Check your changed overview"); Console.Out.WriteLine(); Console.Out.WriteLine(); bunq.UpdateContext(); }
public ActionResult UploadFile(IFormFile psgc) { var tempreglist = new List <Region>(); var temprovlist = new List <ProvinceDistrict>(); var tempcitylist = new List <CityMunicipality>(); var tempbara = new List <Barangay>(); using (var reader = new StreamReader(psgc.OpenReadStream())) { while (reader.Peek() >= 0) { var psgcrow = reader.ReadLine().Split(","); if (psgcrow.Length != 3) { return(BadRequest()); } if (psgcrow[0].Length != 9) { return(BadRequest()); } var regcode = psgcrow[0].Substring(0, 2) + "0000000"; var provdistcode = psgcrow[0].Substring(0, 4) + "00000"; var citymunisubmunicode = psgcrow[0].Substring(0, 6) + "000"; if (ShareLib.CheckIfRegion(psgcrow[0])) { Region newreg = new Region { RegionId = Guid.NewGuid(), RegionCode = psgcrow[0], RegionName = psgcrow[1] }; tempreglist.Add(newreg); } if (ShareLib.CheckIfProviceDistrict(psgcrow[0])) { ProvinceDistrict newprov = new ProvinceDistrict { ProvinceDistrictId = Guid.NewGuid(), ProvinceDistrictCode = psgcrow[0], ProvinceDistrictName = psgcrow[1], ProvinceDistrictOldName = psgcrow[2], Region = tempreglist.Where(w => w.RegionCode == regcode).First() }; temprovlist.Add(newprov); } if (ShareLib.CheckIfCityMunicipalitySub(psgcrow[0])) { CityMunicipality newcitmun = new CityMunicipality { CityMunicipalityId = Guid.NewGuid(), CityMunicipalityCode = psgcrow[0], CityMunicipalityName = psgcrow[1], CityMunicipalityOldname = psgcrow[2], ProvinceDistrict = temprovlist.Where(w => w.ProvinceDistrictCode == provdistcode).First() }; tempcitylist.Add(newcitmun); } if (ShareLib.CheckIfBarangay(psgcrow[0])) { Barangay newbrg = new Barangay { BarangayId = Guid.NewGuid(), BarangayCode = psgcrow[0], BarangayName = psgcrow[1], BarangayOldname = psgcrow[2], CityMunicipality = tempcitylist.Where(w => w.CityMunicipalityCode == citymunisubmunicode).First(), CityMunicipalityId = tempcitylist.Where(w => w.CityMunicipalityCode == citymunisubmunicode).First().CityMunicipalityId }; tempbara.Add(newbrg); } } } _repo.Import(tempreglist, temprovlist, tempcitylist, tempbara); _repo.SaveChanges(); return(Ok()); }
public static void Initialize(ApiContext context) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); if (context.Barangays.Any()) { return; } var tempreglist = new List <Region>(); var temprovlist = new List <ProvinceDistrict>(); var tempcitylist = new List <CityMunicipality>(); var tempbara = new List <Barangay>(); using (var reader = new StreamReader("PSGC_3Q_2020_Publication.csv")) { while (reader.Peek() >= 0) { var psgcrow = reader.ReadLine().Split(","); var regcode = psgcrow[0].Substring(0, 2) + "0000000"; var provdistcode = psgcrow[0].Substring(0, 4) + "00000"; var citymunisubmunicode = psgcrow[0].Substring(0, 6) + "000"; if (ShareLib.CheckIfRegion(psgcrow[0])) { Region newreg = new Region { RegionId = Guid.NewGuid(), RegionCode = psgcrow[0], RegionName = psgcrow[1] }; tempreglist.Add(newreg); } if (ShareLib.CheckIfProviceDistrict(psgcrow[0])) { ProvinceDistrict newprov = new ProvinceDistrict { ProvinceDistrictId = Guid.NewGuid(), ProvinceDistrictCode = psgcrow[0], ProvinceDistrictName = psgcrow[1], ProvinceDistrictOldName = psgcrow[2], Region = tempreglist.Where(w => w.RegionCode == regcode).First() }; temprovlist.Add(newprov); } if (ShareLib.CheckIfCityMunicipalitySub(psgcrow[0])) { CityMunicipality newcitmun = new CityMunicipality { CityMunicipalityId = Guid.NewGuid(), CityMunicipalityCode = psgcrow[0], CityMunicipalityName = psgcrow[1], CityMunicipalityOldname = psgcrow[2], ProvinceDistrict = temprovlist.Where(w => w.ProvinceDistrictCode == provdistcode).First() }; tempcitylist.Add(newcitmun); } if (ShareLib.CheckIfBarangay(psgcrow[0])) { Barangay newbrg = new Barangay { BarangayId = Guid.NewGuid(), BarangayCode = psgcrow[0], BarangayName = psgcrow[1], BarangayOldname = psgcrow[2], CityMunicipality = tempcitylist.Where(w => w.CityMunicipalityCode == citymunisubmunicode).First() }; tempbara.Add(newbrg); } } } context.Regions.AddRange(tempreglist); context.ProvincesDistricts.AddRange(temprovlist); context.CitiesMunicipalities.AddRange(tempcitylist); context.Barangays.AddRange(tempbara); Console.WriteLine("CSV Imported"); context.SaveChanges(); }