private static void Main(string[] args) { var apiKey = ""; var stripe = new StripeClient(apiKey); var chargeService = new ChargeService(stripe); var chargeId = ""; var charge = chargeService.Get(chargeId); Console.WriteLine("Charge"); Console.WriteLine($"Amount: ${charge.Amount}"); var payoutService = new PayoutService(stripe); var payoutId = ""; var payout = payoutService.Get(payoutId); Console.WriteLine($"Payout: {payoutId}"); Console.WriteLine($"Date Paid: {payout.ArrivalDate.ToString()}"); var balanceTransactionService = new BalanceTransactionService(stripe); var requestOptions = new BalanceTransactionListOptions { Payout = payoutId, Limit = 100 }; var transactionList = balanceTransactionService.List(requestOptions); Console.WriteLine($"Transactions: {transactionList.Count()}"); }
public PayoutServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new PayoutService(this.StripeClient); this.createOptions = new PayoutCreateOptions { Amount = 123, Currency = "usd", }; this.updateOptions = new PayoutUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new PayoutListOptions { Limit = 1, }; }
private void LoadAccountDataButton_Click(object sender, RoutedEventArgs e) { GridPayout.IsEnabled = false; if (String.IsNullOrWhiteSpace(PassPhraseTextBox.Password)) { MessageBox.Show("You must enter a passphrase"); return; } using (new WaitCursor()) { _passPhrase = PassPhraseTextBox.Password; ArkClientsListView.ItemsSource = new List <ArkClientModel>(); ArkClientsListView.Tag = null; try { var account = PayoutService.GetAccount(_passPhrase); AmountPayoutTextBox.Text = (Double.Parse(account.Balance) / StaticProperties.ARK_DIVISOR).ToString(); GridPayout.IsEnabled = true; } catch (Exception ex) { MessageBox.Show(String.Format("Error loading account data. {0}. Check log for additional details.", ex.Message)); _log.Error("Error loading account data", ex); } } Refresh(); }
public Payout(Client client) : base(client) { _storeDetailAndSubmitThirdParty = new StoreDetailAndSubmitThirdParty(this); _confirmThirdParty = new ConfirmThirdParty(this); _declineThirdParty = new DeclineThirdParty(this); _storeDetail = new StoreDetail(this); _submitThirdParty = new SubmitThirdParty(this); _payoutService = new PayoutService(this); }
public ActionResult DaylyUpdate(PayoutDatePost model) { using (var unitOfWork = new UnitOfWork(new BankModuleFactory())) { var PayoutService = new PayoutService(unitOfWork); PayoutService.DaylyCreditUpdate(model.currentTime); unitOfWork.Commit(); } return RedirectToAction("Index"); }
private async void GeneratePayoutListButton_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(PassPhraseTextBox.Password)) { MessageBox.Show("You must enter a passphrase"); return; } var percent = Double.Parse(PercentPayoutTextBox.Text); if (percent <= 0 || percent > 100) { MessageBox.Show("Percent must be > 0 and <= 100"); return; } var amount = Double.Parse(AmountPayoutTextBox.Text); if (amount / StaticProperties.ARK_DIVISOR > 1) { MessageBox.Show("Invalid Amount"); return; } using (new WaitCursor()) { _passPhrase = PassPhraseTextBox.Password; ArkClientsListView.ItemsSource = new List <ArkClientModel>(); ArkClientsListView.Tag = null; try { var clientsToPay = await PayoutService.GetClientsToPay(_passPhrase, Double.Parse(PercentPayoutTextBox.Text), Convert.ToInt64(amount *StaticProperties.ARK_DIVISOR)); ArkClientsListView.Tag = clientsToPay; foreach (var clientToPay in clientsToPay.ArkClients) { (ArkClientsListView.ItemsSource as List <ArkClientModel>).Add(clientToPay); } } catch (Exception ex) { MessageBox.Show(String.Format("Error generating payout list. {0}. Check log for additional details.", ex.Message)); _log.Error("Error generating payout list", ex); } } Refresh(); }
public OpenpayAPI( string api_key, string merchant_id,bool production = false) { this.httpClient = new OpenpayHttpClient(api_key, merchant_id, production); CustomerService = new CustomerService(this.httpClient); CardService = new CardService(this.httpClient); BankAccountService = new BankAccountService(this.httpClient); ChargeService = new ChargeService(this.httpClient); PayoutService = new PayoutService(this.httpClient); TransferService = new TransferService(this.httpClient); FeeService = new FeeService(this.httpClient); PlanService = new PlanService(this.httpClient); SubscriptionService = new SubscriptionService(this.httpClient); OpenpayFeesService = new OpenpayFeesService(this.httpClient); WebhooksService = new WebhookService (this.httpClient); }
public void Create_Instant_Payout() { var options = new PayoutCreateOptions { Amount = 1000, Currency = "usd", Method = "instant", }; var requestOptions = new RequestOptions(); requestOptions.StripeAccount = "{{CONNECTED_STRIPE_ACCOUNT_ID}}"; var service = new PayoutService(); var payout = service.Create(options, requestOptions); }
public OpenpayAPI(string api_key, string merchant_id, bool production = false) { this.httpClient = new OpenpayHttpClient(api_key, merchant_id, production); CustomerService = new CustomerService(this.httpClient); CardService = new CardService(this.httpClient); BankAccountService = new BankAccountService(this.httpClient); ChargeService = new ChargeService(this.httpClient); PayoutService = new PayoutService(this.httpClient); TransferService = new TransferService(this.httpClient); FeeService = new FeeService(this.httpClient); PlanService = new PlanService(this.httpClient); SubscriptionService = new SubscriptionService(this.httpClient); OpenpayFeesService = new OpenpayFeesService(this.httpClient); WebhooksService = new WebhookService(this.httpClient); PayoutReportService = new PayoutReportService(this.httpClient); MerchantService = new MerchantService(this.httpClient); }
private async void PayNowButton_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Pay Confirmation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { using (new WaitCursor()) { var arkClientsToPay = (ArkClientsListView.ItemsSource as List <ArkClientModel>); if (!arkClientsToPay.Any()) { MessageBox.Show("No clients to pay"); } else { var payClientTasks = new List <Task <ErrorIndexModel> >(); foreach (var clientToPay in arkClientsToPay) { _log.Info(String.Format("Attempting to pay {0}({1}) to address {2}", (clientToPay.AmountToBePaid / StaticProperties.ARK_DIVISOR), (long)clientToPay.AmountToBePaid, clientToPay.Address)); payClientTasks.Add(PayoutService.PayClient(clientToPay, _passPhrase, PaymentDescriptionTextBox.Text)); } var errors = await Task.WhenAll(payClientTasks); if (errors.SelectMany(x => x.ErrorClients).Any()) { MessageBox.Show("Error paying some clients. Check log for details"); } else { MessageBox.Show("Finished paying clients without errors. Check log for details"); ArkClientsListView.ItemsSource = new List <ArkClientModel>(); ArkClientsListView.Tag = null; Refresh(); } } } } }
public async Task <IActionResult> StartWithdraw([FromBody] WithdrawCreationDto withdrawCreationDto) { if (!ModelState.IsValid) { return(BadRequest(new { message = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage) })); } try { StripeConfiguration.ApiKey = ServiceKey; var user = await _accountsRepository.GetByUserId(withdrawCreationDto.UserId); var service = new PayoutService(); var options = new PayoutCreateOptions { Amount = withdrawCreationDto.Amount, Currency = "usd", Metadata = new Dictionary <string, string>() { { "UserId", User.FindFirstValue(ClaimTypes.Name) } }, }; var payout = service.Create(options, new RequestOptions { StripeAccount = user.StripeUserId }); return(Ok(new PayoutCreatedDto { PayoutId = payout.Id })); throw new InvalidPayment("Couldn't process withdraw"); } catch (Exception e) { return(BadRequest(new MessageObj(e.Message))); } }
public PayoutServiceTest() { this.service = new PayoutService(); this.createOptions = new PayoutCreateOptions { Amount = 123, Currency = "usd", }; this.updateOptions = new PayoutUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new PayoutListOptions { Limit = 1, }; }
private static async Task <ApiResult <ApiCardPayoutResponse> > BecauseAsync() { await PayoutService.InitiatePayoutAsync(PayoutRequest); return(await PayoutService.InitiatePayoutAsync(PayoutRequest)); }
/// <summary> /// Initializes <see cref="PayoutController"/> /// </summary> public PayoutController(PayoutService payoutService) { this.PayoutService = payoutService; }
static void Main(string[] args) { bool useAutoGeneration = false; bool useTests = false; bool useInitializers = true; if(useAutoGeneration) { using (var unitOfWork = new UnitOfWork(new BankModuleFactory(useInitializers))) { var LoanApplicationService = new LoanApplicationService(unitOfWork); var LoanAgreementService = new LoanAgreementService(unitOfWork); Console.WriteLine("Автогенерация для заявок:"); foreach (var loanApplication in LoanApplicationService.Get()) { if (loanApplication.Goal == "Смена гардероба" || loanApplication.Goal == "Пластическая операция" || loanApplication.Additional == "Car loan test" || loanApplication.Additional == "Grad loan test 1" || loanApplication.Additional == "Grad loan test 2") { Console.WriteLine(string.Format("{0} {1} {2}", loanApplication.Client.FirstName, loanApplication.Goal, loanApplication.Term)); loanApplication.Status.Stage = ApplicationConsiderationStages.ApplicationConfirmationQueue; LoanApplicationService.ApproveApplication(loanApplication); loanApplication.Status.Stage = ApplicationConsiderationStages.Providing; LoanAgreementService.CompleteAgreement(loanApplication.LoanAgreements.First()); unitOfWork.Commit(); } } Console.WriteLine("\nРезультаты:\n"); foreach (var loanApplication in LoanApplicationService.Get()) { if (loanApplication.Goal == "Смена гардероба" || loanApplication.Goal == "Пластическая операция" || loanApplication.Additional == "Car loan test" || loanApplication.Additional == "Grad loan test 1" || loanApplication.Additional == "Grad loan test 2") { Console.WriteLine(string.Format("{0} {1} {2}", loanApplication.Client.FirstName, loanApplication.Goal, loanApplication.Term)); Console.WriteLine("Создан кредитный договор:"); var loanAgreement = loanApplication.LoanAgreements.First(); Console.WriteLine(string.Format("Номер:{0} Кредитный аккаунт:{1} Аккаунт для оплаты:{2}", loanAgreement.Id, loanAgreement.LoanAccount.IBAN, loanAgreement.RepaymentAccount.IBAN)); foreach(var bailAgreement in loanApplication.BailAgreements) { Console.WriteLine("Создан договор залога:"); Console.WriteLine(string.Format("Номер:{0} Объект:{1} Владелец:{2}", bailAgreement.Id, bailAgreement.BailObject, bailAgreement.BailObjectHolder)); } foreach (var suretyAgreement in loanApplication.SuretyAgreements) { Console.WriteLine("Создан договор поручительства:"); Console.WriteLine(string.Format("Номер:{0} Поручитель:{1} Должник:{2}", suretyAgreement.Id, suretyAgreement.Guarantor.FirstName + " " + suretyAgreement.Guarantor.LastName, suretyAgreement.Client.FirstName)); } Console.WriteLine(); } } } System.Console.ReadKey(true); return; } if(useTests) { Console.WriteLine(new LoanTest().RunTest()); Console.WriteLine(new UserTest().RunTest()); System.Console.ReadKey(true); return; } List<LoanApplication> archiveApplications; using (var unitOfWork = new UnitOfWork(new BankModuleFactory(useInitializers))) { var AccountService = new AccountService(unitOfWork); Console.WriteLine("Accounts:"); foreach(var account in AccountService.Get()) { System.Console.WriteLine(string.Format("{0} {1} {2} {3} Transfers From: {4} Transfers To:{5}", account.IBAN, account.AccountType, account.MoneyAmount, account.Currency, account.BankTransfersFrom.Count, account.BankTransfersTo.Count)); } var BankTransferService = new BankTransferService(unitOfWork); Console.WriteLine("Transfers:"); foreach (var transfer in BankTransferService.Get(includeProperties: "AccountFrom,AccountTo")) Console.WriteLine(string.Format("From: {0} To: {1} {2} {3} {4}", transfer.AccountFrom.IBAN, transfer.AccountTo.IBAN, transfer.Amount, transfer.Currency, transfer.TransferDate.ToShortDateString())); var LoanAgreementService = new LoanAgreementService(unitOfWork); Console.WriteLine("Loan Agreements:"); foreach (var loanAgreement in LoanAgreementService.Get(includeProperties: "PayoutStatus")) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5} {6}", loanAgreement.Client.FirstName, loanAgreement.LoanType, loanAgreement.LoanProviding, loanAgreement.LoanRepayment, loanAgreement.Term, loanAgreement.Amount, loanAgreement.Currency)); var PayoutService = new PayoutService(unitOfWork); Console.WriteLine("Payouts:"); foreach (var payout in PayoutService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", payout.PayoutWay, payout.LoanAmount, payout.ProcessingFee, payout.InterestAmount, payout.TotalAmount, payout.Currency)); var FineService = new FineService(unitOfWork); Console.WriteLine("Fines:"); foreach (var fine in FineService.Get(includeProperties: "LoanAgreement")) Console.WriteLine(string.Format("{0} {1} {2} {3}", fine.LoanAgreement.Id, fine.DeadLineDate.ToShortDateString(), fine.FineRateOfInterest, fine.IsClosed)); var WithdrawalService = new WithdrawalService(unitOfWork); Console.WriteLine("Withdrawals:"); foreach (var withdrawal in WithdrawalService.Get(includeProperties: "ClientAccount,LoanAgreement")) Console.WriteLine(string.Format("{0} {1} {2} {3} {4}", withdrawal.ClientAccount.Id, withdrawal.MoneyAmount, withdrawal.Currency, withdrawal.WithdrawalWay, withdrawal.Date.ToShortDateString())); var PersonService = new PersonService(unitOfWork); Console.WriteLine("Persons:"); foreach (var person in PersonService.Get()) Console.WriteLine(string.Format("{0} {1} {2} Documents: {3} Records: {4}", person.FirstName, person.IdentificationNumber, person.MonthlyIncome, person.Documents.Count, person.CreditHistoryRecords.Count)); var HistoryService = new CreditHistoryRecordService(unitOfWork); Console.WriteLine("Records:"); foreach (var record in HistoryService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4}", record.Person.FirstName, record.BankConstants.BIC, record.Amount, record.Currency, record.Interest)); var LoanService = new LoanService(unitOfWork); Console.WriteLine("Loan programs:"); foreach (var program in LoanService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", program.Name, program.LoanProviding, program.LoanGuarantee, program.LoanRepayment, program.LoanType, program.MaxAmount)); var LoanApplicationService = new LoanApplicationService(unitOfWork); Console.WriteLine("Loan applications:"); foreach (var loanApplication in LoanApplicationService.Get()) { Console.WriteLine(string.Format("{0} {1} {2} {3} Time: {4}", loanApplication.Client.FirstName, loanApplication.Loan.Name, loanApplication.Amount, loanApplication.Term, loanApplication.Status.ChangedDate.TimeOfDay.ToString())); } unitOfWork.Commit(); var SuretyAgreementService = new SuretyAgreementService(unitOfWork); Console.WriteLine("Surety agreements:"); foreach (var suretyAgreement in SuretyAgreementService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", suretyAgreement.Client.FirstName, suretyAgreement.Guarantor.FirstName, suretyAgreement.Amount, suretyAgreement.Currency, suretyAgreement.LoanTerm, suretyAgreement.SuretyTerm)); var BailAgreementService = new BailAgreementService(unitOfWork); Console.WriteLine("Bail agreements:"); foreach (var bailAgreement in BailAgreementService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", bailAgreement.Client.FirstName, bailAgreement.BailObject, bailAgreement.Amount, bailAgreement.Currency, bailAgreement.LoanTerm, bailAgreement.BailTerm)); var BailObjectService = new BailObjectsService(unitOfWork); Console.WriteLine("Bail objects:"); foreach (var bailObject in BailObjectService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3}", bailObject.Object, bailObject.ClientIdentificationNumber, bailObject.BailObjectEstimate, bailObject.Currency)); var SystemService = new SystemResolutionService(unitOfWork); Console.WriteLine("System resolutions:"); foreach (var resolution in SystemService.Get()) Console.WriteLine(string.Format("Application: {0} {1} {2}", resolution.LoanApplication.Id, resolution.MaxLoanAmount, resolution.ScoringPoint)); var SecurityService = new SecurityResolutionService(unitOfWork); Console.WriteLine("Security resolutions:"); foreach (var resolution in SecurityService.Get()) Console.WriteLine(string.Format("Application: {0} {1} {2}{3}", resolution.LoanApplication.Id, resolution.Income, Environment.NewLine, resolution.IncomeEstimate)); var ExpertService = new ExpertResolutionService(unitOfWork); Console.WriteLine("Expert resolutions:"); foreach (var resolution in ExpertService.Get()) Console.WriteLine(string.Format("Application: {0} {1} {2}", resolution.LoanApplication.Id, resolution.Social, resolution.SocialEstimate)); var CommitteeService = new CommitteeResolutionService(unitOfWork); Console.WriteLine("Committee resolutions:"); foreach (var resolution in CommitteeService.Get()) Console.WriteLine(string.Format("Link: {0} {1}", resolution.ProtocolDocument.Link, resolution.Resolution)); archiveApplications = LoanApplicationService.Get (app => app.Id < 5, app => app.OrderBy(p => p.Id), app => app.Client, app => app.LoanAgreements, app => app.LoanAgreements.Select(l => l.BankConstants), app => app.LoanAgreements.Select(l => l.Payouts), app => app.LoanAgreements.Select(l => l.ClientWithdrawals), app => app.BailAgreements.Select(b => b.AgreementDocument), app => app.BailAgreements.Select(b => b.EstimationDocument), app => app.BailAgreements.Select(b => b.InsuranceDocument), app => app.SuretyAgreements.Select(s => s.AgreementDocument), app => app.SuretyAgreements.Select(s => s.Client), app => app.SuretyAgreements.Select(s => s.Guarantor), app => app.SuretyAgreements.Select(s => s.BankConstants) ).ToList(); } using (var archiveUnit = new UnitOfWork(new ArchiveModuleFactory(useInitializers))) { var ApplicationService = new ArchiveLoanApplicationService(archiveUnit); foreach(var arch in archiveApplications) ApplicationService.ArchiveApplication(arch); archiveUnit.Commit(); } using (var archiveUnit = new UnitOfWork(new ArchiveModuleFactory(false))) { var ApplicationService = new ArchiveLoanApplicationService(archiveUnit); Console.WriteLine("\nArchived applications:"); foreach (var loanApplication in ApplicationService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} Time: {4}", loanApplication.ClientIdentificationNumber, loanApplication.LoanAgreements.Count, loanApplication.Amount, loanApplication.Term, loanApplication.ArchivedDate.TimeOfDay.ToString())); } Console.WriteLine("\nAuthentification: "); using (var unitOfWork = new UnitOfWork(new AuthorizationModuleFactory(useInitializers))) { var userService = new UserService(unitOfWork); foreach (var user in userService.Get(includeProperties: "Roles")) { System.Console.WriteLine(string.Format("{0} {1} {2} {3}", user.FirstName, user.MiddleName, user.LastName, user.Roles.First().Name)); var newUser = userService.GetLoggedUser(user.Login, "ivan_peresvetov_pass"); if(newUser != null) Console.WriteLine("Found ivan!"); } } System.Console.ReadKey(true); }
static void Main(string[] args) { using (var studContext = new StudBankContext(true)) { var AccountService = new AccountService(studContext); Console.WriteLine("Accounts:"); foreach(var account in AccountService.Get()) { System.Console.WriteLine(string.Format("{0} {1} {2} {3} Transfers From: {4} Transfers To:{5}", account.IBAN, account.AccountType, account.MoneyAmount, account.Currency, account.BankTransfersFrom.Count, account.BankTransfersTo.Count)); } var BankTransferService = new BankTransferService(studContext); Console.WriteLine("Transfers:"); foreach (var transfer in BankTransferService.Get(includeProperties: "AccountFrom,AccountTo")) Console.WriteLine(string.Format("From: {0} To: {1} {2} {3} {4}", transfer.AccountFrom.IBAN, transfer.AccountTo.IBAN, transfer.Amount, transfer.Currency, transfer.TransferDate.ToShortDateString())); var LoanAgreementService = new LoanAgreementService(studContext); Console.WriteLine("Loan Agreements:"); foreach (var loanAgreement in LoanAgreementService.Get(includeProperties: "PayoutStatus")) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5} {6}", loanAgreement.Client.FirstName, loanAgreement.LoanType, loanAgreement.LoanProviding, loanAgreement.LoanRepayment, loanAgreement.Term, loanAgreement.Amount, loanAgreement.Currency)); var PayoutService = new PayoutService(studContext); Console.WriteLine("Payouts:"); foreach (var payout in PayoutService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", payout.PayoutWay, payout.LoanAmount, payout.ProcessingFee, payout.InterestAmount, payout.TotalAmount, payout.Currency)); var FineService = new FineService(studContext); Console.WriteLine("Fines:"); foreach (var fine in FineService.Get(includeProperties: "LoanAgreement")) Console.WriteLine(string.Format("{0} {1} {2} {3}", fine.LoanAgreement.Id, fine.DeadLineDate.ToShortDateString(), fine.FineRateOfInterest, fine.IsClosed)); var WithdrawalService = new WithdrawalService(studContext); Console.WriteLine("Withdrawals:"); foreach (var withdrawal in WithdrawalService.Get(includeProperties: "ClientAccount,LoanAgreement")) Console.WriteLine(string.Format("{0} {1} {2} {3} {4}", withdrawal.ClientAccount.Id, withdrawal.MoneyAmount, withdrawal.Currency, withdrawal.WithdrawalWay, withdrawal.Date.ToShortDateString())); var PersonService = new PersonService(studContext); Console.WriteLine("Persons:"); foreach (var person in PersonService.Get()) Console.WriteLine(string.Format("{0} {1} {2} Documents: {3} Records: {4}", person.FirstName, person.IdentificationNumber, person.MonthlyIncome, person.Documents.Count, person.CreditHistoryRecords.Count)); var HistoryService = new CreditHistoryRecordService(studContext); Console.WriteLine("Records:"); foreach (var record in HistoryService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4}", record.Person.FirstName, record.BankConstants.BIC, record.Amount, record.Currency, record.Interest)); var LoanService = new LoanService(studContext); Console.WriteLine("Loan programs:"); foreach (var program in LoanService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", program.Name, program.LoanProviding, program.LoanGuarantee, program.LoanRepayment, program.LoanType, program.MaxAmount)); var LoanApplicationService = new LoanApplicationService(studContext); Console.WriteLine("Loan applications:"); foreach (var loanApplication in LoanApplicationService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} First surety:{5}", loanApplication.Client.FirstName, loanApplication.Loan.Name, loanApplication.Amount, loanApplication.Currency, loanApplication.Term, loanApplication.Sureties.FirstOrDefault().FirstName)); var SuretyAgreementService = new SuretyAgreementService(studContext); Console.WriteLine("Surety agreements:"); foreach (var suretyAgreement in SuretyAgreementService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", suretyAgreement.Client.FirstName, suretyAgreement.Guarantor.FirstName, suretyAgreement.Amount, suretyAgreement.Currency, suretyAgreement.LoanTerm, suretyAgreement.SuretyTerm)); var BailAgreementService = new BailAgreementService(studContext); Console.WriteLine("Bail agreements:"); foreach (var bailAgreement in BailAgreementService.Get()) Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5}", bailAgreement.Client.FirstName, bailAgreement.BailObject, bailAgreement.Amount, bailAgreement.Currency, bailAgreement.LoanTerm, bailAgreement.BailTerm)); var SystemService = new SystemResolutionService(studContext); Console.WriteLine("System resolutions:"); foreach (var resolution in SystemService.Get()) Console.WriteLine(string.Format("Application: {0} {1} {2}", resolution.LoanApplication.Id, resolution.MaxLoanAmount, resolution.ScoringPoint)); var SecurityService = new SecurityResolutionService(studContext); Console.WriteLine("Security resolutions:"); foreach (var resolution in SecurityService.Get()) Console.WriteLine(string.Format("Application: {0} {1} {2}", resolution.LoanApplication.Id, resolution.Property, resolution.PropertyEstimate)); var ExpertService = new ExpertResolutionService(studContext); Console.WriteLine("Expert resolutions:"); foreach (var resolution in ExpertService.Get()) Console.WriteLine(string.Format("Application: {0} {1} {2}", resolution.LoanApplication.Id, resolution.Property, resolution.PropertyEstimate)); var CommitteeService = new CommitteeResolutionService(studContext); Console.WriteLine("Committee resolutions:"); foreach (var resolution in CommitteeService.Get()) Console.WriteLine(string.Format("Link: {0} {1}", resolution.ProtocolDocument.Link, resolution.Resolution)); } Console.WriteLine("\nAuthentification: "); using (var authContext = new StudAuthorizeContext(true)) { var userService = new EntityService<User>(authContext); var roleService = new EntityService<Role>(authContext); foreach (var user in userService.Get(includeProperties: "Roles")) { System.Console.WriteLine(string.Format("{0} {1} {2} {3}", user.FirstName, user.MiddleName, user.LastName, user.Roles.First().Name)); } System.Console.WriteLine(); userService.Get(user => user.FirstName == "Ivan").First().FirstName = "Vano"; authContext.SaveChanges(); foreach (var user in userService.Get(includeProperties: "Roles")) { System.Console.WriteLine(string.Format("{0} {1} {2} {3}", user.FirstName, user.MiddleName, user.LastName, user.Roles.First().Name)); } } System.Console.ReadKey(true); }
public async Task <StripeList <Payout> > GetPayoutsAsync(string accountId) { var payoutService = new PayoutService(); return(await payoutService.ListAsync(new PayoutListOptions { Limit = 100 }, new RequestOptions { StripeAccount = accountId })); }
public async Task <int> PaymentCredit(string token, int amount, string bank_account, string routing_number, string account_name) { try { long userId = (long)Session["USER_ID"]; user residentUser = entities.users.Find(userId); // Charge using Credit Card StripeConfiguration.SetApiKey(ep.GetStripeSecretKey()); var chargeOptions = new ChargeCreateOptions { Amount = amount + 20000, Currency = "usd", Description = "Charge for [email protected]", SourceId = token // obtained with Stripe.js, }; var chargeService = new ChargeService(); Charge charge = chargeService.Create(chargeOptions); // Payout to coamdin bank // Get Bank Info string bankAccountStr = bank_account; //"000123456789";// string bankRoutingStr = routing_number; // "110000000";// // Get self account var accountOptions = new AccountCreateOptions { Email = "*****@*****.**", Type = AccountType.Custom, Country = "US", ExternalBankAccount = new AccountBankAccountOptions() { Country = "US", Currency = "usd", AccountHolderName = "John Brown",//account_name AccountHolderType = "individual", RoutingNumber = bankRoutingStr, AccountNumber = bankAccountStr }, PayoutSchedule = new AccountPayoutScheduleOptions() { Interval = "daily" }, TosAcceptance = new AccountTosAcceptanceOptions() { Date = DateTime.Now.AddDays(-10), Ip = "202.47.115.80", UserAgent = "Chrome" }, LegalEntity = new AccountLegalEntityOptions() { Dob = new AccountDobOptions() { Day = 1, Month = 4, Year = 1991 }, FirstName = "John", LastName = "Brown", Type = "individual" } }; var accountService = new AccountService(); Account account = await accountService.CreateAsync(accountOptions); StripeConfiguration.SetApiKey(ep.GetStripeSecretKey()); var service = new BalanceService(); Balance balance = await service.GetAsync(); var transOptions = new TransferCreateOptions { Amount = amount, Currency = "usd", Destination = account.Id }; var transferService = new TransferService(); Transfer Transfer = transferService.Create(transOptions); var payoutOptions = new PayoutCreateOptions { Amount = amount, Currency = "usd", Destination = account.ExternalAccounts.First().Id, SourceType = "card", StatementDescriptor = "PAYOUT", //Method = "instant" }; var requestOptions = new RequestOptions(); requestOptions.ApiKey = ep.GetStripeSecretKey(); requestOptions.StripeConnectAccountId = account.Id; var payoutService = new PayoutService(); var payout = await payoutService.CreateAsync(payoutOptions, requestOptions); return(1); } catch (Exception ex) { return(0); } }
public async Task <int> PaymentAch(string bankToken, int amount, string account_number, string rounting_number) { try { // Create an ACH charge StripeConfiguration.SetApiKey(ep.GetStripeSecretKey()); CustomerService customerService = new CustomerService(); var customerOptions = new CustomerCreateOptions { }; Customer achCustomer = customerService.Create(customerOptions); // Create Bank Account var bankAccountOptions = new BankAccountCreateOptions { SourceToken = bankToken }; var bankService = new BankAccountService(); BankAccount bankAccount = bankService.Create(achCustomer.Id, bankAccountOptions); // Verify BankAccount List <long> Amounts = new List <long>(); Amounts.Add(32); Amounts.Add(45); var verifyOptions = new BankAccountVerifyOptions { Amounts = Amounts }; bankAccount = bankService.Verify(achCustomer.Id, bankAccount.Id, verifyOptions); var chargeOptions = new ChargeCreateOptions { Amount = amount, Currency = "usd", Description = "Charge for [email protected]", CustomerId = achCustomer.Id }; var chargeService = new ChargeService(); Charge charge = chargeService.Create(chargeOptions); // Payout from Stripe to Bank Account string bankAccountStr = account_number; // "000123456789"; string bankRoutingStr = rounting_number; // "110000000"; // Get self account var accountOptions = new AccountCreateOptions { Email = "*****@*****.**", Type = AccountType.Custom, Country = "US", ExternalBankAccount = new AccountBankAccountOptions() { Country = "US", Currency = "usd", AccountHolderName = "John Brown",//account_name AccountHolderType = "individual", RoutingNumber = bankRoutingStr, AccountNumber = bankAccountStr }, PayoutSchedule = new AccountPayoutScheduleOptions() { Interval = "daily" }, TosAcceptance = new AccountTosAcceptanceOptions() { Date = DateTime.Now.AddDays(-10), Ip = "202.47.115.80", UserAgent = "Chrome" }, LegalEntity = new AccountLegalEntityOptions() { Dob = new AccountDobOptions() { Day = 1, Month = 4, Year = 1991 }, FirstName = "John", LastName = "Brown", Type = "individual" } }; var accountService = new AccountService(); Account account = await accountService.CreateAsync(accountOptions); StripeConfiguration.SetApiKey(ep.GetStripeSecretKey()); var service = new BalanceService(); Balance balance = await service.GetAsync(); var transOptions = new TransferCreateOptions { Amount = amount, Currency = "usd", Destination = account.Id }; var transferService = new TransferService(); Transfer Transfer = transferService.Create(transOptions); var payoutOptions = new PayoutCreateOptions { Amount = amount, Currency = "usd", Destination = account.ExternalAccounts.First().Id, SourceType = "card", StatementDescriptor = "PAYOUT", //Method = "instant" }; var requestOptions = new RequestOptions(); requestOptions.ApiKey = ep.GetStripeSecretKey(); requestOptions.StripeConnectAccountId = account.Id; var payoutService = new PayoutService(); var payout = await payoutService.CreateAsync(payoutOptions, requestOptions); return(1); } catch (Exception) { return(0); } }