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); }
private async void button1_Click(object sender, EventArgs e) { var koszt = textBox1.Text; var dataWyplaty = dateTimePicker1.Value.Date + dateTimePicker2.Value.TimeOfDay; if (string.IsNullOrEmpty(koszt)) { MessageBox.Show("Pole kwota nie może być puste."); return; } var opis = textBox2.Text; if (string.IsNullOrEmpty(opis)) { MessageBox.Show("Pole opis nie może być puste."); return; } if (!decimal.TryParse(koszt, out var cenaResult)) { MessageBox.Show("Kwota ma niewłaściwy format."); return; } if (dataWyplaty.Date != DateTime.Today.Date) { var dialogResult = MessageBox.Show("Data wypłaty nie jest datą dzisiejszą. Czy na pewno chcesz dodać wypłatę w tej dacie?", "Dodaj", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { return; } } var payout = new Payout { CreatedOn = dataWyplaty, Amount = cenaResult, Lokalizacja = _lokalizacja, Description = opis }; await _payoutService.Create(payout); Close(); }
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))); } }