Compare commits
1 Commits
master
...
features/a
| Author | SHA1 | Date | |
|---|---|---|---|
| 4772d0d462 |
@ -3696,6 +3696,19 @@ namespace gehGassi.Core.Interfaces
|
|||||||
/// <param name="appUserId">Id des AppUsers</param>
|
/// <param name="appUserId">Id des AppUsers</param>
|
||||||
/// <returns>Liste von Wallets</returns>
|
/// <returns>Liste von Wallets</returns>
|
||||||
Task<List<Wallet>> GetAllAsync(string appUserId);
|
Task<List<Wallet>> GetAllAsync(string appUserId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt eine Liste aller Wallets mit positivem Kontostand zurück
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">Wallet typ</param>
|
||||||
|
/// <returns>Liste von Wallets</returns>
|
||||||
|
Task<List<Wallet>> GetAllWithPositiveBalanceAsync(WalletType type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt eine Liste aller Wallets mit positivem Kontostand zurück
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Liste von Wallets</returns>
|
||||||
|
Task<List<Wallet>> GetAllWithPositiveBalanceAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
using System;
|
using gehGassi.Core.Interfaces;
|
||||||
|
using gehGassi.Domain.Common;
|
||||||
|
using gehGassi.Domain.Dogs;
|
||||||
|
using gehGassi.Domain.Payment;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using gehGassi.Core.Interfaces;
|
|
||||||
using gehGassi.Domain.Common;
|
|
||||||
using gehGassi.Domain.Payment;
|
|
||||||
|
|
||||||
namespace gehGassi.Core.Services
|
namespace gehGassi.Core.Services
|
||||||
{
|
{
|
||||||
@ -70,5 +71,24 @@ namespace gehGassi.Core.Services
|
|||||||
{
|
{
|
||||||
return (await Repository.FindAsync(c => c.AppUserId == appUserId).ConfigureAwait(false)).ToList();
|
return (await Repository.FindAsync(c => c.AppUserId == appUserId).ConfigureAwait(false)).ToList();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt eine Liste aller Wallets mit positivem Kontostand zurück
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">Wallet typ</param>
|
||||||
|
/// <returns>Liste von Wallets</returns>
|
||||||
|
public async Task<List<Wallet>> GetAllWithPositiveBalanceAsync(WalletType type)
|
||||||
|
{
|
||||||
|
return (await Repository.FindAsync(c => c.Type == type && c.Balance > 0).ConfigureAwait(false)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt eine Liste aller Wallets mit positivem Kontostand zurück
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Liste von Wallets</returns>
|
||||||
|
public async Task<List<Wallet>> GetAllWithPositiveBalanceAsync()
|
||||||
|
{
|
||||||
|
return (await Repository.FindAsync(c => c.Balance > 0).ConfigureAwait(false)).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -820,10 +820,11 @@ namespace gehGassi.Web.Controllers.Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Wenn der erfolgreiche KYC-Check eines AppUsers nicht mindestens 48 Stunden zurückliegt, dann keine Auszahlung
|
//Wenn der erfolgreiche KYC-Check eines AppUsers nicht mindestens 48 Stunden zurückliegt, dann keine Auszahlung
|
||||||
if (appUser.KycPassedDate.HasValue && appUser.KycPassedDate.Value > DateTimeOffset.UtcNow.AddHours(-48))
|
//TODO: Prüfen ob nicht wieder aktiviert werden soll!
|
||||||
{
|
//if (appUser.KycPassedDate.HasValue && appUser.KycPassedDate.Value > DateTimeOffset.UtcNow.AddHours(-48))
|
||||||
return BadRequest(CommunicationErrors.PayOut_Failed);
|
//{
|
||||||
}
|
// return BadRequest(CommunicationErrors.PayOut_Failed);
|
||||||
|
//}
|
||||||
|
|
||||||
//Wenn mmehr als 200 Euro, dann blockieren
|
//Wenn mmehr als 200 Euro, dann blockieren
|
||||||
//TODO: Überprüfen ob das für die App-User passt.
|
//TODO: Überprüfen ob das für die App-User passt.
|
||||||
|
|||||||
@ -1,26 +1,20 @@
|
|||||||
using System;
|
using AutoMapper;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Dynamic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AutoMapper;
|
|
||||||
using gehGassi.Core.Interfaces;
|
using gehGassi.Core.Interfaces;
|
||||||
using gehGassi.Core.Services;
|
using gehGassi.Core.Services;
|
||||||
using gehGassi.Domain.Common;
|
using gehGassi.Domain.Common;
|
||||||
using gehGassi.Domain.Dogs;
|
using gehGassi.Domain.Dogs;
|
||||||
using gehGassi.Domain.Users;
|
|
||||||
using gehGassi.Web.Auth;
|
using gehGassi.Web.Auth;
|
||||||
using gehGassi.Web.Helper;
|
using gehGassi.Web.Models;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using SixLabors.ImageSharp;
|
using System;
|
||||||
using SixLabors.ImageSharp.Advanced;
|
using System.Collections.Generic;
|
||||||
using SixLabors.ImageSharp.Processing;
|
using System.Dynamic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using gehGassi.Dto.Payment;
|
||||||
|
|
||||||
namespace gehGassi.Web.Controllers
|
namespace gehGassi.Web.Controllers
|
||||||
{
|
{
|
||||||
@ -48,6 +42,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
private readonly IDeviceService _deviceService;
|
private readonly IDeviceService _deviceService;
|
||||||
private readonly IMessageService _messageService;
|
private readonly IMessageService _messageService;
|
||||||
private readonly IAppUserReportService _appUserReportService;
|
private readonly IAppUserReportService _appUserReportService;
|
||||||
|
private readonly IPayoutService _payoutService;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Erstellt eine Instanz
|
/// Erstellt eine Instanz
|
||||||
@ -70,9 +65,11 @@ namespace gehGassi.Web.Controllers
|
|||||||
/// <param name="deviceService">Instanz eines IDeviceService</param>
|
/// <param name="deviceService">Instanz eines IDeviceService</param>
|
||||||
/// <param name="messageService">Instanz eines IMessageService</param>
|
/// <param name="messageService">Instanz eines IMessageService</param>
|
||||||
/// <param name="appUserReportService">Instanz eines IAppUserReportService</param>
|
/// <param name="appUserReportService">Instanz eines IAppUserReportService</param>
|
||||||
|
/// <param name="payoutService">Instanz eines IPayoutService</param>
|
||||||
public ToolsController(IMapper mapper, IStringLocalizer<ToolsController> localizer, IFileService fileService, IFileShareService fileShareService, IMangoPayService mangoPayService, IPushNotificationService pushNotificationService,
|
public ToolsController(IMapper mapper, IStringLocalizer<ToolsController> localizer, IFileService fileService, IFileShareService fileShareService, IMangoPayService mangoPayService, IPushNotificationService pushNotificationService,
|
||||||
IAppUserService appUserService, IWalletService walletService, IWalkService walkService, IRatingService ratingService, ITransactionFeeService transactionFeeService, IRefreshTokenService refreshTokenService,
|
IAppUserService appUserService, IWalletService walletService, IWalkService walkService, IRatingService ratingService, ITransactionFeeService transactionFeeService, IRefreshTokenService refreshTokenService,
|
||||||
IUserService userService, IFavouriteService favouriteService, ISystemMessageService systemMessageService, IDeviceService deviceService, IMessageService messageService, IAppUserReportService appUserReportService)
|
IUserService userService, IFavouriteService favouriteService, ISystemMessageService systemMessageService, IDeviceService deviceService, IMessageService messageService, IAppUserReportService appUserReportService,
|
||||||
|
IPayoutService payoutService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_localizer = localizer;
|
_localizer = localizer;
|
||||||
@ -92,6 +89,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
_deviceService = deviceService;
|
_deviceService = deviceService;
|
||||||
_messageService = messageService;
|
_messageService = messageService;
|
||||||
_appUserReportService = appUserReportService;
|
_appUserReportService = appUserReportService;
|
||||||
|
_payoutService = payoutService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> TestMango()
|
public async Task<IActionResult> TestMango()
|
||||||
@ -119,9 +117,9 @@ namespace gehGassi.Web.Controllers
|
|||||||
|
|
||||||
public async Task<IActionResult> Hub()
|
public async Task<IActionResult> Hub()
|
||||||
{
|
{
|
||||||
await _pushNotificationService.ListRegistrationsAsync();
|
await _pushNotificationService.ListRegistrationsAsync();
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -168,6 +166,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
else
|
else
|
||||||
walk.PaymentStatus = PaymentStatus.Voided;
|
walk.PaymentStatus = PaymentStatus.Voided;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _walkService.CommitAsync("System");
|
await _walkService.CommitAsync("System");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +242,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
feeDecimal += gehGassiFee.Fixed;
|
feeDecimal += gehGassiFee.Fixed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feeDecimal > 0)
|
if (feeDecimal > 0)
|
||||||
{
|
{
|
||||||
fee = (long)(feeDecimal * 100);
|
fee = (long)(feeDecimal * 100);
|
||||||
@ -303,6 +303,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
{
|
{
|
||||||
_walletService.Remove(wallet);
|
_walletService.Remove(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _walletService.CommitAsync("System");
|
await _walletService.CommitAsync("System");
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
@ -329,7 +330,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
//Es gibt noch keinen MangopayUser für DogWalker oder BOTH!!!
|
//Es gibt noch keinen MangopayUser für DogWalker oder BOTH!!!
|
||||||
if (string.IsNullOrWhiteSpace(appUser.NationalityCode))
|
if (string.IsNullOrWhiteSpace(appUser.NationalityCode))
|
||||||
appUser.NationalityCode = appUser.Address.CountryCode;
|
appUser.NationalityCode = appUser.Address.CountryCode;
|
||||||
if(string.IsNullOrEmpty(appUser.MainResidenceCode))
|
if (string.IsNullOrEmpty(appUser.MainResidenceCode))
|
||||||
appUser.MainResidenceCode = appUser.Address.CountryCode;
|
appUser.MainResidenceCode = appUser.Address.CountryCode;
|
||||||
if (!appUser.PaymentTermsAccepted || appUser.PaymentTermsAcceptedDate == null)
|
if (!appUser.PaymentTermsAccepted || appUser.PaymentTermsAcceptedDate == null)
|
||||||
{
|
{
|
||||||
@ -348,18 +349,18 @@ namespace gehGassi.Web.Controllers
|
|||||||
|
|
||||||
//Wallets anlegen
|
//Wallets anlegen
|
||||||
var walletFees = await _mangoPayService.CreateWalletAsync(appUser.Id, WalletType.Fees);
|
var walletFees = await _mangoPayService.CreateWalletAsync(appUser.Id, WalletType.Fees);
|
||||||
if(walletFees.Success)
|
if (walletFees.Success)
|
||||||
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es wurde ein neues Fee-Wallet angelegt");
|
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es wurde ein neues Fee-Wallet angelegt");
|
||||||
var walletCredits = await _mangoPayService.CreateWalletAsync(appUser.Id, WalletType.Credits);
|
var walletCredits = await _mangoPayService.CreateWalletAsync(appUser.Id, WalletType.Credits);
|
||||||
if(walletCredits.Success)
|
if (walletCredits.Success)
|
||||||
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es wurde ein neues Credit-Wallet angelegt");
|
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es wurde ein neues Credit-Wallet angelegt");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName} es konnte kein MangoPay-User angelegt werden.");
|
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName} es konnte kein MangoPay-User angelegt werden.");
|
||||||
if(!string.IsNullOrWhiteSpace(createResult.ErrorMessage))
|
if (!string.IsNullOrWhiteSpace(createResult.ErrorMessage))
|
||||||
System.Diagnostics.Debug.WriteLine(createResult.ErrorMessage);
|
System.Diagnostics.Debug.WriteLine(createResult.ErrorMessage);
|
||||||
if(createResult.ErrorMessages != null)
|
if (createResult.ErrorMessages != null)
|
||||||
foreach (var error in createResult.ErrorMessages)
|
foreach (var error in createResult.ErrorMessages)
|
||||||
System.Diagnostics.Debug.WriteLine($"{error.Key} --> {error.Value}");
|
System.Diagnostics.Debug.WriteLine($"{error.Key} --> {error.Value}");
|
||||||
}
|
}
|
||||||
@ -429,7 +430,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
{
|
{
|
||||||
//Wallet anlegen
|
//Wallet anlegen
|
||||||
var walletCredits = await _mangoPayService.CreateWalletAsync(appUser.Id, WalletType.Credits);
|
var walletCredits = await _mangoPayService.CreateWalletAsync(appUser.Id, WalletType.Credits);
|
||||||
if(walletCredits.Success)
|
if (walletCredits.Success)
|
||||||
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es wurde ein neues Credit-Wallet angelegt");
|
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es wurde ein neues Credit-Wallet angelegt");
|
||||||
else
|
else
|
||||||
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es konnte kein neues Credit-Wallet angelegt werde");
|
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es konnte kein neues Credit-Wallet angelegt werde");
|
||||||
@ -452,6 +453,7 @@ namespace gehGassi.Web.Controllers
|
|||||||
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es konnte kein neues Credit-Wallet angelegt werde");
|
System.Diagnostics.Debug.WriteLine($"{appUser.FirstName} {appUser.LastName}: Es konnte kein neues Credit-Wallet angelegt werde");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var feeWallet = wallets.FirstOrDefault(c => c.Type == WalletType.Fees);
|
var feeWallet = wallets.FirstOrDefault(c => c.Type == WalletType.Fees);
|
||||||
if (feeWallet == null)
|
if (feeWallet == null)
|
||||||
{
|
{
|
||||||
@ -592,10 +594,151 @@ namespace gehGassi.Web.Controllers
|
|||||||
{
|
{
|
||||||
await _ratingService.UpdateRatingStatisticsAsync(ratingTargetToUpdate.Item1, ratingTargetToUpdate.Item2);
|
await _ratingService.UpdateRatingStatisticsAsync(ratingTargetToUpdate.Item1, ratingTargetToUpdate.Item2);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _ratingService.CommitAsync(User.Identity.Name);
|
await _ratingService.CommitAsync(User.Identity.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tool zum automatischen Auszahlen von Guthaben wenn dies möglich ist
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Task</returns>
|
||||||
|
public async Task<IActionResult> AutoPayout()
|
||||||
|
{
|
||||||
|
var model = new List<AutoPayoutVm>();
|
||||||
|
|
||||||
|
//1. alle Wallets mit Guthaben holen
|
||||||
|
var wallets = await _walletService.GetAllWithPositiveBalanceAsync();
|
||||||
|
|
||||||
|
//2. nun prüfen ob der wallet status mit dem bei mangoPay übereinstimmt
|
||||||
|
foreach (var wallet in wallets)
|
||||||
|
{
|
||||||
|
var balanceResponse = await _mangoPayService.GetWalletBalanceAsync(wallet.WalletId);
|
||||||
|
if (balanceResponse.Success)
|
||||||
|
{
|
||||||
|
wallet.Balance = balanceResponse.Value;
|
||||||
|
wallet.UpdatedAt = DateTimeOffset.UtcNow;
|
||||||
|
await _walletService.CommitAsync("System", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Nun die wallets erneut holen
|
||||||
|
wallets = await _walletService.GetAllWithPositiveBalanceAsync();
|
||||||
|
|
||||||
|
foreach (var wallet in wallets)
|
||||||
|
{
|
||||||
|
//App user zum Wallet holen
|
||||||
|
var appUser = await _appUserService.GetAsync(wallet.AppUserId);
|
||||||
|
if (appUser != null)
|
||||||
|
{
|
||||||
|
//Nun prüfen ob berechtig für eine Auszahlung
|
||||||
|
if (appUser.Locked)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!appUser.KycPassed)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var getBankAccountResult = await _mangoPayService.GetBankAccountAsync(appUser.Id, appUser.PaymentId, appUser.BankId);
|
||||||
|
if (getBankAccountResult.Success)
|
||||||
|
{
|
||||||
|
var viewModel = new AutoPayoutVm
|
||||||
|
{
|
||||||
|
AppUser = appUser,
|
||||||
|
Wallet = wallet
|
||||||
|
};
|
||||||
|
model.Add(viewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run Auto Payout
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IActionResult> RunAutoPayout()
|
||||||
|
{
|
||||||
|
var model = new List<RunAutoPayoutVm>();
|
||||||
|
|
||||||
|
//1. alle Wallets mit Guthaben holen
|
||||||
|
var wallets = await _walletService.GetAllWithPositiveBalanceAsync();
|
||||||
|
foreach (var wallet in wallets)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//App user zum Wallet holen
|
||||||
|
var appUser = await _appUserService.GetAsync(wallet.AppUserId);
|
||||||
|
if (appUser != null)
|
||||||
|
{
|
||||||
|
//Nun prüfen ob berechtig für eine Auszahlung
|
||||||
|
if (appUser.Locked)
|
||||||
|
continue;
|
||||||
|
if (!appUser.KycPassed)
|
||||||
|
continue;
|
||||||
|
var getBankAccountResult = await _mangoPayService.GetBankAccountAsync(appUser.Id, appUser.PaymentId, appUser.BankId);
|
||||||
|
if (getBankAccountResult.Success)
|
||||||
|
{
|
||||||
|
var iban = string.Empty;
|
||||||
|
if (!string.IsNullOrWhiteSpace(getBankAccountResult.Value.Iban))
|
||||||
|
iban = getBankAccountResult.Value.Iban;
|
||||||
|
|
||||||
|
var bic = string.Empty;
|
||||||
|
if (!string.IsNullOrWhiteSpace(getBankAccountResult.Value.Bic))
|
||||||
|
bic = getBankAccountResult.Value.Bic;
|
||||||
|
|
||||||
|
if (iban.Length >= 4)
|
||||||
|
{
|
||||||
|
iban = iban.Substring(iban.Length - 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bic.Length >= 4)
|
||||||
|
{
|
||||||
|
bic = bic.Substring(bic.Length - 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Auszahlen
|
||||||
|
var ammount = wallet.Balance;
|
||||||
|
|
||||||
|
var payout = _payoutService.Create(appUser.Id, appUser.PaymentId, "", wallet.Id, wallet.WalletId, appUser.BankId, iban, bic, ammount, "EUR");
|
||||||
|
|
||||||
|
var payoutResult = await _mangoPayService.CreatePayoutAsync(appUser.PaymentId, wallet.WalletId, appUser.BankId, ammount, $"Payout_{payout.Id}");
|
||||||
|
if (payoutResult.Success)
|
||||||
|
{
|
||||||
|
payout.MangoPayId = payoutResult.Value.PayoutId;
|
||||||
|
payout.Status = payoutResult.Value.Status;
|
||||||
|
payout.ResultCode = payoutResult.Value.ResultCode;
|
||||||
|
payout.ResultMessage = payoutResult.Value.ResultMessage;
|
||||||
|
payout.ExecutionDate = payoutResult.Value.ExecutionDate;
|
||||||
|
payout.UpdatedAt = DateTimeOffset.UtcNow;
|
||||||
|
|
||||||
|
_payoutService.Add(payout);
|
||||||
|
await _payoutService.CommitAsync(User.Identity.Name);
|
||||||
|
|
||||||
|
var dto = _mapper.Map<PayoutDto>(payout);
|
||||||
|
var item = new RunAutoPayoutVm()
|
||||||
|
{
|
||||||
|
Wallet = wallet,
|
||||||
|
AppUser = appUser,
|
||||||
|
PayoutDto = dto
|
||||||
|
};
|
||||||
|
|
||||||
|
model.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
gehGassi.Web/Models/AutoPayoutVm.cs
Normal file
22
gehGassi.Web/Models/AutoPayoutVm.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using gehGassi.Domain.Dogs;
|
||||||
|
using gehGassi.Domain.Payment;
|
||||||
|
using gehGassi.Dto.Payment;
|
||||||
|
|
||||||
|
namespace gehGassi.Web.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Viewmodel für das Autopayout tool
|
||||||
|
/// </summary>
|
||||||
|
public class AutoPayoutVm
|
||||||
|
{
|
||||||
|
public Wallet Wallet { get; set; }
|
||||||
|
public AppUser AppUser { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RunAutoPayoutVm
|
||||||
|
{
|
||||||
|
public Wallet Wallet { get; set; }
|
||||||
|
public AppUser AppUser { get; set; }
|
||||||
|
public PayoutDto PayoutDto { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
38
gehGassi.Web/Views/Tools/AutoPayout.cshtml
Normal file
38
gehGassi.Web/Views/Tools/AutoPayout.cshtml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
@using gehGassi.Permissions
|
||||||
|
@using gehGassi.Web.Helper
|
||||||
|
@using Microsoft.AspNetCore.Mvc.Localization
|
||||||
|
@model List<gehGassi.Web.Models.AutoPayoutVm>;
|
||||||
|
@inject IViewLocalizer Localizer
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = Localizer["Menu_Tools"];
|
||||||
|
}
|
||||||
|
@section pageTitle {
|
||||||
|
<a href="@Url.Action("Index", "Home")">@Localizer["Menu_Tools"]</a>
|
||||||
|
}
|
||||||
|
|
||||||
|
<section id="autoPayoutListContainer">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>App user</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Balance</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@item.AppUser.FirstName @item.AppUser.LastName</td>
|
||||||
|
<td>@item.Wallet.Type.ToString()</td>
|
||||||
|
<td>€ @((item.Wallet.Balance / 100).ToString("N2"))</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="text-center mt-5">
|
||||||
|
<a href="@Url.Action("RunAutoPayout", "Tools")" class="btn btn-primary">Run Auto Payout</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
46
gehGassi.Web/Views/Tools/RunAutoPayout.cshtml
Normal file
46
gehGassi.Web/Views/Tools/RunAutoPayout.cshtml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
@using gehGassi.Permissions
|
||||||
|
@using gehGassi.Web.Helper
|
||||||
|
@using Microsoft.AspNetCore.Mvc.Localization
|
||||||
|
@model List<gehGassi.Web.Models.RunAutoPayoutVm>;
|
||||||
|
@inject IViewLocalizer Localizer
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = Localizer["Menu_Tools"];
|
||||||
|
}
|
||||||
|
@section pageTitle {
|
||||||
|
<a href="@Url.Action("Index", "Home")">@Localizer["Menu_Tools"]</a>
|
||||||
|
}
|
||||||
|
|
||||||
|
<section id="autoPayoutListContainer">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>App user</th>
|
||||||
|
<th>Balance before</th>
|
||||||
|
<th>IBAN</th>
|
||||||
|
<th>BIC</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Ammount</th>
|
||||||
|
<th>Result code</th>
|
||||||
|
<th>Result message</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@item.AppUser.FirstName @item.AppUser.LastName</td>
|
||||||
|
<td>€ @((item.Wallet.Balance / 100).ToString("N2"))</td>
|
||||||
|
<td>@item.PayoutDto.Iban</td>
|
||||||
|
<td>@item.PayoutDto.Bic</td>
|
||||||
|
<td>@item.PayoutDto.Status.ToString()</td>
|
||||||
|
<td>€ @((item.PayoutDto.Ammount / 100).ToString("N2"))</td>
|
||||||
|
<td>@item.PayoutDto.ResultCode</td>
|
||||||
|
<td>@item.PayoutDto.ResultMessage</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</section>
|
||||||
@ -107,7 +107,7 @@
|
|||||||
"AutoConfirm": true,
|
"AutoConfirm": true,
|
||||||
"ConfirmationMinutes": 10080,
|
"ConfirmationMinutes": 10080,
|
||||||
"ConfirmationReminderMinutes": 1440,
|
"ConfirmationReminderMinutes": 1440,
|
||||||
"MinPayoutAmmount": 1000
|
"MinPayoutAmmount": 1
|
||||||
},
|
},
|
||||||
"GeoLocationOptions": {
|
"GeoLocationOptions": {
|
||||||
"BaseUri": "https://nominatim.openstreetmap.org/",
|
"BaseUri": "https://nominatim.openstreetmap.org/",
|
||||||
|
|||||||
@ -108,7 +108,7 @@
|
|||||||
"AutoConfirm": true,
|
"AutoConfirm": true,
|
||||||
"ConfirmationMinutes": 10080,
|
"ConfirmationMinutes": 10080,
|
||||||
"ConfirmationReminderMinutes": 1440,
|
"ConfirmationReminderMinutes": 1440,
|
||||||
"MinPayoutAmmount": 1000
|
"MinPayoutAmmount": 1
|
||||||
},
|
},
|
||||||
"GeoLocationOptions": {
|
"GeoLocationOptions": {
|
||||||
"BaseUri": "https://nominatim.openstreetmap.org/",
|
"BaseUri": "https://nominatim.openstreetmap.org/",
|
||||||
|
|||||||
@ -107,7 +107,7 @@
|
|||||||
"AutoConfirm": true,
|
"AutoConfirm": true,
|
||||||
"ConfirmationMinutes": 10080,
|
"ConfirmationMinutes": 10080,
|
||||||
"ConfirmationReminderMinutes": 1440,
|
"ConfirmationReminderMinutes": 1440,
|
||||||
"MinPayoutAmmount": 1000
|
"MinPayoutAmmount": 1
|
||||||
},
|
},
|
||||||
"GeoLocationOptions": {
|
"GeoLocationOptions": {
|
||||||
"BaseUri": "https://nominatim.openstreetmap.org/",
|
"BaseUri": "https://nominatim.openstreetmap.org/",
|
||||||
|
|||||||
@ -108,7 +108,7 @@
|
|||||||
"AutoConfirm": true,
|
"AutoConfirm": true,
|
||||||
"ConfirmationMinutes": 10080,
|
"ConfirmationMinutes": 10080,
|
||||||
"ConfirmationReminderMinutes": 1440,
|
"ConfirmationReminderMinutes": 1440,
|
||||||
"MinPayoutAmmount": 1000
|
"MinPayoutAmmount": 1
|
||||||
},
|
},
|
||||||
"GeoLocationOptions": {
|
"GeoLocationOptions": {
|
||||||
"BaseUri": "https://nominatim.openstreetmap.org/",
|
"BaseUri": "https://nominatim.openstreetmap.org/",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user