public void Can_approve_online_deposit() { //Arrange var deposit = _paymentTestHelper.CreateOnlineDeposit(_testPlayer.Id, 300); _paymentTestHelper.VerifyOnlineDeposit(deposit.Id); var request = new ApproveOnlineDepositRequest { Id = deposit.Id, Remarks = "remark" }; //Act _depositCommands.Approve(request); //Assert var settings = _paymentRepositoryMock.OnlineDeposits.Single(x => x.Id == deposit.Id); settings.Status.Should().Be(OnlineDepositStatus.Approved); settings.Remarks.Should().Be(request.Remarks); settings.ApprovedBy.ShouldBeEquivalentTo(_actorInfoProvider.Actor.UserName); settings.Approved.Should().BeCloseTo(DateTimeOffset.Now, 5000); _paymentTestHelper.AssertBalance(_testPlayer.Id, total: 300, playable: 300, main: 300, free: 300); }
public void Approve(ApproveOnlineDepositRequest request) { using (var scope = CustomTransactionScope.GetTransactionScope()) { //lock data to prevent deposit multi times _repository.LockOnlineDeposit(request.Id); var onlineDeposit = _repository.OnlineDeposits.First(x => x.Id == request.Id); if (onlineDeposit == null) { throw new RegoException(DepositErrors.NotFound.ToString()); } if (onlineDeposit.Status != OnlineDepositStatus.Verified) { throw new RegoException(string.Format("The deposit has '{0}' status, so it can't be Approved", onlineDeposit.Status)); } var onlineDepositEntity = new Entities.OnlineDeposit(onlineDeposit); var now = _paymentQueries.GetBrandDateTimeOffset(onlineDeposit.BrandId); var depositCommand = onlineDepositEntity.Approve(_actorInfoProvider.Actor.UserName, request.Remarks, now); _repository.SaveChanges(); _serviceBus.PublishMessage(depositCommand); scope.Complete(); } }
public void Can_not_approve_unverified_online_deposit() { //Arrange var deposit = _paymentTestHelper.CreateOnlineDeposit(_testPlayer.Id, 300); var request = new ApproveOnlineDepositRequest { Id = deposit.Id, Remarks = "remark" }; //Act //Assert Assert.Throws <RegoException>(() => _depositCommands.Approve(request)) .Message.Should().Be("The deposit has 'Processing' status, so it can't be Approved"); }
public ApproveOnlineDepositResponse Approve(ApproveOnlineDepositRequest request) { VerifyPermission(Permissions.Approve, Modules.DepositApproval); var data = _onlineDepositQueries.GetOnlineDepositById(request.Id); CheckBrand(data.BrandId); var model = Mapper.Map <Core.Payment.Interface.Data.ApproveOnlineDepositRequest>(request); _onlineDepositCommands.Approve(model); return(new ApproveOnlineDepositResponse { Success = true }); }
public ApproveOnlineDepositResponse ApproveOnlineDeposit(ApproveOnlineDepositRequest request) { return(WebClient.SecurePostAsJson <ApproveOnlineDepositRequest, ApproveOnlineDepositResponse>(Token, _url + AdminApiRoutes.ApproveOnlineDeposit, request)); }