public IActionResult Create(string creditCardToken) { try { var options = new ChargeCreateOptions { Amount = 15 * 100,// 15 UAH Currency = "uah", Source = creditCardToken, Description = "My First Test Charge (created for API docs)", }; var service = new ChargeService(); Charge resultCharge = service.Create(options); var res = new PaymentResultViewModel { Amount = resultCharge.Amount, PaymentId = resultCharge.Id, Detaills = JsonConvert.SerializeObject(resultCharge, Formatting.Indented) }; return(View("PaymentStatus", res)); } catch (Exception ex) { ViewData["ErrorMessage"] = ex.Message; return(View("Payment")); } }
public async Task <IActionResult> OnlinePayment(int id) { var model = new PaymentResultViewModel() { Status = false, PaymentCode = null }; if (HttpContext.Request.Query["Status"] == "OK" && HttpContext.Request.Query["Authority"] != "") { string authority = HttpContext.Request.Query["Authority"]; int price = await _walletRepo.GetTransactionPrice(id); if (price == -1) { model.ErrorMessage = "تراکنش مورد نظر یافت نشد."; return(View(model)); } var payment = new Payment(price); var response = await payment.Verification(authority); if (response.Status == 100) { await _walletRepo.UpdateTransaction(id); model.Status = true; model.PaymentCode = response.RefId.ToString(); } } return(View(model)); }
public IActionResult PaymentResult(PaymentResultViewModel model) { if (model.IsSuccessful) { return(View("SuccessfulPayment")); } return(View("FailedPayment")); }
public async Task <ActionResult> PaymentResult(PaymentResultViewModel model) { var data = Request.Form.ToDictionary(q => q.Key, q => string.Join(",", q.Value)); var executePaymentDto = ObjectMapper.Map <ExecutePaymentDto>(model); executePaymentDto.AdditionalData = data; await _paymentAppService.ExecutePayment(executePaymentDto); return(RedirectToAction("Index")); }
public ActionResult Result() { PaymentResultViewModel viewModel = (PaymentResultViewModel)TempData["PaymentResultViewModel"]; if (viewModel == null) { RedirectToAction("Index", "Home"); } return(View(viewModel)); }
public RedirectToRouteResult RedirectToResult(string message, bool isSuccess) { PaymentResultViewModel model = new PaymentResultViewModel { IsSuccess = isSuccess, Message = message }; TempData.Clear(); TempData["PaymentResultViewModel"] = model; return(RedirectToAction("Result")); }
public ActionResult Index() { string status = Request.QueryString["STATUS"]; var paymentService = new PaymentService(); var result = new PaymentResultViewModel { Status = status, StatusName = paymentService.GetStatusName(status) }; return(View(result)); }
public IActionResult Charge(string customerId) { var options = new ChargeCreateOptions { Amount = 17 * 100,// 17 UAH Currency = "uah", Customer = customerId, }; var service = new ChargeService(); var resultCharge = service.Create(options); var res = new PaymentResultViewModel { Amount = resultCharge.Amount, PaymentId = resultCharge.Id, Detaills = JsonConvert.SerializeObject(resultCharge, Formatting.Indented) }; return(View("../Payment/PaymentStatus", res)); }
public ActionResult Index() { //ACCEPTANCE Acceptance code returned by the acquirer //AMOUNT Order amount(not multiplied by 100) //BRAND Card brand(our system derives this from the card number) //CARDNO Masked card number //CN Cardholder/ customer name //CURRENCY Order currency //ED Expiry date //NCERROR Error code //ORDERID Your order reference //PAYID Payment reference in our system //PM Payment method //SHASIGN SHA signature calculated by our system(if SHA - OUT configured) //STATUS Transaction status(see Status overview) //TRXDATE Transaction date string status = Request.QueryString["STATUS"]; string alias = Request.QueryString["ALIAS"]; string cardNumber = Request.QueryString["CARDNO"]; string expiryDate = Request.QueryString["ED"]; string cardholderName = Request.QueryString["CN"]; var paymentService = new PaymentService(); var result = new PaymentResultViewModel { Status = status, StatusName = paymentService.GetStatusName(status), Alias = alias, CardNumber = cardNumber, ExpiryDate = expiryDate, CardholderName = cardholderName }; return(View(result)); }
public async Task <PaymentResultViewModel> CreateAgencyPayment(int agencyId, CreateCampaignPaymentViewModel model, string username) { var payment = await _campaignRepository.GetCampaignPaymentByAgency(agencyId, model.CampaignId); if (payment == null) { return(new PaymentResultViewModel(PaymentResultErrorCode.ThongTinThanhToanKhongChinhXac)); } long amount = 0; long amountOriginal = 0; var senderId = 0; var receiverId = 0; var transactionType = TransactionType.Undefined; var refId = payment.CampaignId; var refData = string.Empty; if (payment.IsValid) { //service charge --> tru tien cho agency ; + tien cho he thong receiverId = await _walletRepository.GetSystemId(); senderId = await _walletRepository.GetWalletId(Core.Entities.EntityType.Agency, agencyId); amount = payment.TotalChargeValue; amountOriginal = payment.TotalOriginalChargeAmount; transactionType = amount > 0 ? TransactionType.CampaignServiceCharge : TransactionType.CampaignServiceCashBack; if (transactionType == TransactionType.CampaignServiceCharge) { //############# a Long sửa ############################################################# PaymentResultViewModel _PaymentResultViewModel = await Pay(senderId, receiverId, amount, amountOriginal, transactionType, model.Note, username, refId, refData); if (_PaymentResultViewModel.Status == TransactionStatus.Completed && _PaymentResultViewModel.Amount > 0) { foreach (var campaignAccount in payment.CampaignAccounts) { //update campaign account mark as agency had paid var arrIgnoreStatus = new List <CampaignAccountStatus>() { CampaignAccountStatus.Canceled, CampaignAccountStatus.Unfinished, CampaignAccountStatus.AccountRequest, CampaignAccountStatus.AgencyRequest, CampaignAccountStatus.WaitToPay, CampaignAccountStatus.All, CampaignAccountStatus.NeedToCheckExcecuteCampaign, CampaignAccountStatus.AgencyCanceled }; if (!arrIgnoreStatus.Contains(campaignAccount.Status) && campaignAccount.MerchantPaidToSystem == false) { await _campaignAccountRepository.UpdateMerchantPaidToSystem(campaignAccount.Id, true); } } } //##################################################################################### return(_PaymentResultViewModel); } // nếu là yêu cầu rút tiền -- Đổi sender - recivert -> số tiền dương var transactionid = await _transactionRepository.CreateTransaction(receiverId, senderId, 0 - amount, transactionType, model.Note, string.Empty, username, refId, refData); return(new PaymentResultViewModel(PaymentResultErrorCode.ChoHeThongDuyetRutTien, transactionid, 0 - amount)); // anh Longhk bổ sung } return(new PaymentResultViewModel(PaymentResultErrorCode.ThongTinThanhToanKhongChinhXac)); }