create transaction during selfie success
This commit is contained in:
parent
256839489a
commit
400b819794
@ -40,12 +40,26 @@ namespace EnotaryoPH.Web.Pages
|
|||||||
signatory.Status = nameof(SignatoryStatus.FaceMatch);
|
signatory.Status = nameof(SignatoryStatus.FaceMatch);
|
||||||
_notaryoDBContext.Update(signatory);
|
_notaryoDBContext.Update(signatory);
|
||||||
}
|
}
|
||||||
else if (!_user.Role.IsInList(nameof(UserType.Principal), nameof(UserType.SuperUser), nameof(UserType.Administrator)))
|
else if (!CurrentUser.Role.IsInList(nameof(UserType.Principal), nameof(UserType.SuperUser), nameof(UserType.Administrator)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CurrentTransaction.TransactionID == 0)
|
||||||
|
{
|
||||||
|
var newTransaction = new Transaction
|
||||||
|
{
|
||||||
|
Transaction_UID = Guid.CreateVersion7(DateTime.UtcNow),
|
||||||
|
CreatedOn = DateTime.UtcNow,
|
||||||
|
TransactionDate = DateTime.UtcNow,
|
||||||
|
Status = nameof(TransactionState.New),
|
||||||
|
PrincipalID = CurrentUser.UserID
|
||||||
|
};
|
||||||
|
_notaryoDBContext.Add(CurrentTransaction);
|
||||||
|
}
|
||||||
|
|
||||||
var selfieEntity = CreateOrUpdateSelfie(selfieImage);
|
var selfieEntity = CreateOrUpdateSelfie(selfieImage);
|
||||||
|
selfieEntity.Transaction = CurrentTransaction;
|
||||||
if (_notaryoDBContext.Entry(selfieEntity).State == EntityState.Detached)
|
if (_notaryoDBContext.Entry(selfieEntity).State == EntityState.Detached)
|
||||||
{
|
{
|
||||||
_notaryoDBContext.Add(selfieEntity);
|
_notaryoDBContext.Add(selfieEntity);
|
||||||
@ -69,7 +83,7 @@ namespace EnotaryoPH.Web.Pages
|
|||||||
CreatedOn = DateTime.UtcNow,
|
CreatedOn = DateTime.UtcNow,
|
||||||
TransactionSelfie_UID = Guid.CreateVersion7(DateTime.UtcNow),
|
TransactionSelfie_UID = Guid.CreateVersion7(DateTime.UtcNow),
|
||||||
UserID = CurrentUser.UserID,
|
UserID = CurrentUser.UserID,
|
||||||
TransactionID = TransactionID
|
TransactionID = CurrentTransaction.TransactionID,
|
||||||
};
|
};
|
||||||
TransactionSelfie_UID = selfieEntity.TransactionSelfie_UID.Value;
|
TransactionSelfie_UID = selfieEntity.TransactionSelfie_UID.Value;
|
||||||
}
|
}
|
||||||
@ -115,28 +129,17 @@ namespace EnotaryoPH.Web.Pages
|
|||||||
[BindProperty(SupportsGet = true)]
|
[BindProperty(SupportsGet = true)]
|
||||||
public Guid TransactionSelfie_UID { get; set; }
|
public Guid TransactionSelfie_UID { get; set; }
|
||||||
|
|
||||||
private User CurrentUser
|
protected User CurrentUser => _user ??= _notaryoDBContext.Users.AsNoTracking().First(x => x.User_UID == _currentUserService.GetUser_UID());
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_user == null)
|
|
||||||
{
|
|
||||||
_user = _notaryoDBContext.Users.AsNoTracking().First(x => x.User_UID == _currentUserService.GetUser_UID());
|
|
||||||
}
|
|
||||||
return _user ?? new();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int TransactionID
|
protected Transaction CurrentTransaction => _transactionEntity
|
||||||
{
|
??= _notaryoDBContext.Transactions.AsNoTracking().FirstOrDefault(x => x.Transaction_UID == Transaction_UID)
|
||||||
get
|
?? new Transaction
|
||||||
{
|
{
|
||||||
if (_transactionEntity == null)
|
Transaction_UID = Guid.CreateVersion7(DateTime.UtcNow),
|
||||||
{
|
CreatedOn = DateTime.UtcNow,
|
||||||
_transactionEntity = _notaryoDBContext.Transactions.AsNoTracking().First(x => x.Transaction_UID == Transaction_UID);
|
TransactionDate = DateTime.UtcNow,
|
||||||
}
|
Status = nameof(TransactionState.New),
|
||||||
return _transactionEntity?.TransactionID ?? 0;
|
PrincipalID = CurrentUser.UserID
|
||||||
}
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,7 +24,7 @@ namespace EnotaryoPH.Web.Pages.Principal.NotaryoSteps
|
|||||||
var isMatchSuccess = await PostAsync();
|
var isMatchSuccess = await PostAsync();
|
||||||
if (isMatchSuccess)
|
if (isMatchSuccess)
|
||||||
{
|
{
|
||||||
return Redirect($"/Principal/NotaryoSteps/UploadDocument/{Transaction_UID}");
|
return Redirect($"/Principal/NotaryoSteps/UploadDocument/{CurrentTransaction.Transaction_UID}");
|
||||||
}
|
}
|
||||||
ModelState.AddModelError("", "Face Verification Failed");
|
ModelState.AddModelError("", "Face Verification Failed");
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@
|
|||||||
|
|
||||||
const data = control_canvas.toDataURL('image/jpg');
|
const data = control_canvas.toDataURL('image/jpg');
|
||||||
control_photo.setAttribute('src', data);
|
control_photo.setAttribute('src', data);
|
||||||
debugger;
|
|
||||||
control_selfieBase64Image.value = data;
|
control_selfieBase64Image.value = data;
|
||||||
|
|
||||||
_showPhoto();
|
_showPhoto();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user