private string NotifyOnlineDeposit(string transactionNumber) { var notifyRequest = new OnlineDepositPayNotifyRequest { OrderIdOfMerchant = transactionNumber, OrderIdOfRouter = "ROID" + DateTime.Now.ToString("yyyyMMddHHmmss"), OrderIdOfGateway = "GOID" + DateTime.Now.ToString("yyyyMMddHHmmss"), Language = "zh-CN", PayMethod = "XPAY" }; var sign = notifyRequest.OrderIdOfMerchant + notifyRequest.OrderIdOfRouter + notifyRequest.OrderIdOfGateway + notifyRequest.Language + OnlineDepositKey; notifyRequest.Signature = EncryptHelper.GetMD5HashInHexadecimalFormat(sign); var notifyResponse = _onlineDepositCommands.PayNotify(notifyRequest); return(notifyResponse); }
public string PayNotify(OnlineDepositPayNotifyRequest request) { var transNo = request.OrderIdOfMerchant; var response = "Failed"; var hashKey = GetDepositHashKey(); //validation var validationResult = new OnlineDepositPayNotifyRequestValidator(_repository, hashKey).Validate(request); if (!validationResult.IsValid) { throw new RegoValidationException(validationResult); } using (var scope = CustomTransactionScope.GetTransactionScope()) { _repository.LockOnlineDeposit(transNo);//lock data to prevent deposit multi times var onlineDeposit = _repository.OnlineDeposits.First(x => x.TransactionNumber == transNo); var onlineDepositEntity = new Entities.OnlineDeposit(onlineDeposit); if (onlineDepositEntity.IsApproved() == false) //prevent approve again { var now = _paymentQueries.GetBrandDateTimeOffset(onlineDeposit.BrandId); var depositCommand = onlineDepositEntity.Approve(request, now); _repository.SaveChanges(); _serviceBus.PublishMessage(depositCommand); scope.Complete(); } response = Acknowledge; } return(response); }
public Deposit Approve(OnlineDepositPayNotifyRequest notifyData, DateTimeOffset now, string approvedBy = "") { Data.Approved = now; Data.ApprovedBy = string.IsNullOrEmpty(approvedBy) ? Data.CreatedBy : approvedBy; Data.OrderIdOfGateway = notifyData.OrderIdOfGateway; Data.OrderIdOfRouter = notifyData.OrderIdOfRouter; ChangeState(OnlineDepositStatus.Approved); return(new Deposit { ActorName = "System", DepositId = Data.Id, PlayerId = Data.PlayerId, CurrencyCode = Data.Currency, ReferenceCode = Data.TransactionNumber, Amount = Data.Amount, Remarks = Data.Remarks, DepositType = DepositType.Online, Approved = Data.Approved.Value, ApprovedBy = Data.ApprovedBy }); }
public void Can_paynotify_online_deposit() { var request = new OnlineDepositPayNotifyRequest { OrderIdOfMerchant = "XP-0-20151202154756", OrderIdOfRouter = "ROID20151202154803", OrderIdOfGateway = "GOID20151202154803", Language = "zh-CN", PayMethod = "XPAY", Signature = "EB1DA0FA24C29F809885B5AC7A1233F4" }; var response = _depositCommands.PayNotify(request); response.Should().Be("SUCCESS", "Response should be 'SUCCESS'"); _processingOnlineDeposit.OrderIdOfGateway.Should().Be(request.OrderIdOfGateway, "OrderIdOfGateway"); _processingOnlineDeposit.OrderIdOfRouter.Should().Be(request.OrderIdOfRouter, "OrderIdOfRouter"); _processingOnlineDeposit.Status.Should().Be(OnlineDepositStatus.Approved, "Status"); _processingOnlineDeposit.ApprovedBy.Should().Be("TestPlayer", "ApprovedBy"); _processingOnlineDeposit.Approved.Should().HaveValue("Approved"); _paymentTestHelper.AssertBalance(_testPlayer.Id, total: 5000, playable: 5000, main: 5000, free: 5000); }
public ActionResult OnlineDepositPayReceive(OnlineDepositPayNotifyRequest request) { return(View("OnlineDepositCompleted")); }
public async Task <string> OnlineDepositPayNotify(OnlineDepositPayNotifyRequest request) { var response = await GetMemberApiProxy(Request).OnlineDepositPayNotifyAsync(request); return(response); }
public async Task <string> OnlineDepositPayNotifyAsync(OnlineDepositPayNotifyRequest request) { var result = await HttpClient.PostAsJsonAsync("api/Payment/OnlineDepositPayNotify", request); return(await EnsureApiResult <string>(result)); }