/* Is User Admin*/ public RequestOutput GetIsUserAdmin(GeneralInput input) { var query = _roleManager.Roles; var roles = query.ToList(); var requestOutput = new RequestOutput(); foreach (var role in roles) { if (role.Name.ToLower() == "admin") { var userInputDto = new GetUsersInput(); userInputDto.Filter = input.UserName; userInputDto.Role = role.Id; var queryUser = UserManager.Users .Where(u => u.Roles.Any(r => r.RoleId == role.Id)) .WhereIf(!input.UserName.IsNullOrWhiteSpace(), u => u.UserName.Contains(input.UserName)); var userCount = queryUser.Count(); if (userCount > 0) { requestOutput.Status = true; } requestOutput.StatusMessage = "SUCCESS"; break; } } return(requestOutput); }
protected void submit_Click(object sender, EventArgs e) { PxPay ws = new PxPay("Magnetism_Dev", "c21aa727d509e3828e79a21ab4f7a4b609b758817d83e87b7f3c722d7a88cd3a"); RequestInput input = new RequestInput(); decimal amount = 0; if (decimal.TryParse(this.amount.Text, out amount) && amount > 0) { bool isRegularGift = this.isregulargift.Checked; DateTime startDate = ParseDateTime(this.startdate.Text); input.AmountInput = string.Format("{0:0.00}", amount); input.CurrencyInput = "NZD"; input.EmailAddress = this.emailaddress.Text; input.MerchantReference = Guid.NewGuid().ToString(); input.TxnType = isRegularGift ? "Auth" : "Purchase"; // for all regular gifts, authorize (hold) the card. for one-off donations, send a purchase message input.EnableAddBillCard = this.isregulargift.Checked ? "1" : "0"; input.TxnData1 = this.startdate.Text; input.TxnData2 = this.enddate.Text; input.UrlFail = string.Format("http://{0}/_test/fail.aspx", Request.Url.Authority); input.UrlSuccess = string.Format("http://{0}/_test/success.aspx", Request.Url.Authority); RequestOutput output = ws.GenerateRequest(input); if (output.valid == "1") { Response.Redirect(output.Url); } } }
public string Button1_Click() { string PxPayUserId = _configuration.GetSection("WindCave:PxPayUserId").Value;//.AppSettings["PxPayUserId"]; string PxPayKey = _configuration.GetSection("WindCave:PxPayKey").Value; //string PxPayKey = ConfigurationManager.AppSettings["PxPayKey"]; PxPay WS = new PxPay(PxPayUserId, PxPayKey); RequestInput input = new RequestInput(); input.AmountInput = "123"; input.CurrencyInput = "NZD"; input.MerchantReference = "My Reference"; input.TxnType = "Purchase"; input.UrlFail = "https://demo.windcave.com/SandboxSuccess.aspx"; input.UrlSuccess = "https://demo.windcave.com/SandboxSuccess.aspx"; //input.UrlFail = Request.Url.GetLeftPart(UriPartial.Path); //input.UrlSuccess = Request.Url.GetLeftPart(UriPartial.Path); // TODO: GUID representing unique identifier for the transaction within the shopping cart (normally would be an order ID or similar) Guid orderId = Guid.NewGuid(); input.TxnId = orderId.ToString().Substring(0, 16); //input.TxnId = "123456123123123"; RequestOutput output = WS.GenerateRequest(input); if (output.valid == "1") { // Redirect user to payment page //Response.Redirect(output.Url); return(output.Url); } return(output.Url); //PxPay WS = new PxPay(PxPayUserId, PxPayKey); //RequestInput input = new RequestInput(); //input.AmountInput = "123"; //input.CurrencyInput = "123"; //input.MerchantReference = "123"; //input.TxnType = "123"; //input.UrlFail = Request.Url.GetLeftPart(UriPartial.Path); //input.UrlSuccess = Request.Url.GetLeftPart(UriPartial.Path); //// TODO: GUID representing unique identifier for the transaction within the shopping cart (normally would be an order ID or similar) //Guid orderId = Guid.NewGuid(); //input.TxnId = orderId.ToString().Substring(0, 16); //RequestOutput output = WS.GenerateRequest(input); //if (output.valid == "1") //{ // // Redirect user to payment page // Response.Redirect(output.Url); //} }
private static string GeneratePxPayRequestURL(decimal amount, string reference, string transactionID, string txnData, string urlFail, string urlSuccess, bool enableAddBillCard = true, string dpsBillingId = null) { RequestInput reqInput = new RequestInput(); //if (!string.IsNullOrEmpty(dpsBillingId)) //{ // reqInput.DpsBillingId = dpsBillingId; //} //else if (enableAddBillCard) //{ // reqInput.EnableAddBillCard = "1"; //} reqInput.AmountInput = amount.ToString("F2"); reqInput.CurrencyInput = CurrencyType.NZD; reqInput.MerchantReference = reference; reqInput.TxnId = transactionID; reqInput.TxnData1 = txnData; reqInput.TxnType = "Purchase"; reqInput.UrlFail = urlFail; reqInput.UrlSuccess = urlSuccess; RequestOutput output = _pxPay.GenerateRequest(reqInput); if (output.valid == "1" && output.Url != null) { // Redirect user to payment page return(output.Url); } else { return(null); } }
public void PurchaseItem(ButtonEventArgs args) { if (!CoreUtility.Me.ShowInternetConnection()) { return; } #if (UNITY_IOS && !STOREKIT) || (UNITY_ANDROID && !GOOGLEIAB) PopupMessages.Me.InAppNotIntegratedMessage(); return; #endif string coststring; int index; int.TryParse(args.data, out index); pID = InAppInfo[index].ID; isRestore = false; isRestoreItemSuccess = false; coststring = isProductReceived && isLocalStoreCost ? InAppInfo[index].CostStringLocaleBase : "$" + InAppInfo[index].CostUSD; MyDebug.Log("InAppManager::PurchaseItem => " + pID + ", " + index + ", " + InAppInfo[index].DisplayName + ", " + coststring); PopupMessages.Me.InAppProcessMessage(InAppInfo[index].DisplayName, coststring); #if UNITY_EDITOR PurchaseSuccessful(pID, "UnityTest_" + System.DateTime.Now.ToOADate()); return; #endif #region iOS Methods #if UNITY_IOS && !UNITY_EDITOR && STOREKIT StoreKitBinding.purchaseProduct(pID, 1); #endif #endregion #region Android => Google Play Mathods #if UNITY_ANDROID && !UNITY_EDITOR && !AMAZONSTORE && GOOGLEIAB GoogleIAB.queryInventory(inappids); #endif #endregion #region Android => Amazon Store Methods #if UNITY_ANDROID && !UNITY_EDITOR && AMAZONSTORE #if UNDERGROUND pID = pID.Replace("supercell.", "supercell.underground."); #endif if (unavailableSkus.Contains(pID)) { ItemUnavailable(pID); return; } // Construct object passed to operation as input SkuInput request = new SkuInput(); request.Sku = pID; // Call synchronous operation with input object RequestOutput response = iapService.Purchase(request); #endif #endregion }
public void GetUserData() { #if AMAZON_BILLING_ENABLED // Call synchronous operation with no input RequestOutput response = iapService.GetUserData(); // Get return value string requestIdString = response.RequestId; Debug.Log("requestIdString " + requestIdString); #endif }
public RequestJson RequestPaymentUrl(int cartId) { string PxPayUserId = _configuration.GetSection("WindCave:PxPayUserId").Value;//.AppSettings["PxPayUserId"]; string PxPayKey = _configuration.GetSection("WindCave:PxPayKey").Value; PxPay WS = new PxPay(PxPayUserId, PxPayKey); RequestInput input = new RequestInput(); var card = _context.Cart.Find(cartId); decimal amount = ((decimal)card.Price - (decimal)card.SalePrice) * 0.50m + (decimal)card.SalePrice + (decimal)card.DeliveryFee; input.AmountInput = Math.Round(amount, 2).ToString(); input.CurrencyInput = "NZD"; input.MerchantReference = "My Reference"; input.TxnType = "Purchase"; input.Opt = "TO=" + DateTime.UtcNow.AddMinutes(10).ToString("yyMMddHHmm"); input.UrlFail = "http://luxedreameventhire.co.nz:80/paymentresult"; input.UrlSuccess = "http://luxedreameventhire.co.nz:80/paymentresult"; input.UrlCallback = "http://api.luxedreameventhire.co.nz/api/pxpay/ResponseOutput"; //input.UrlFail = "http://localhost:4200/paymentresult"; //input.UrlSuccess = "http://localhost:4200/paymentresult"; //input.UrlCallback = "http://localhost:5000/api/pxpay/ResponseOutput"; // TODO: GUID representing unique identifier for the transaction within the shopping cart (normally would be an order ID or similar) Guid orderId = Guid.NewGuid(); input.TxnId = orderId.ToString().Substring(0, 16); Payment payment = new Payment(); payment.TxnId = input.TxnId; payment.CardId = cartId; RequestOutput output = WS.GenerateRequest(input); if (output.valid == "1") { payment.url = output.Url; _context.Payment.AddAsync(payment); _context.SaveChangesAsync(); return(new RequestJson { Url = output.Url }); } return(new RequestJson { Url = output.Url }); }
//BUTTONS public void OnAmazonPurchasePress() { Status.GetComponent <Text>().text = "Processing Purchase...."; purchaseRequest = new SkuInput(); if (ItemToPurchaseField.GetComponent <InputField>().text.Length == 0) { purchaseRequest.Sku = _defaultSKU; } else { purchaseRequest.Sku = ItemToPurchaseField.GetComponent <InputField>().text; } purchaseRequestOutput = iapService.Purchase(purchaseRequest); }
protected void btnSubmit_Click(object sender, EventArgs e) { string pxPayUserId = SettingsHelper.Payment.UserId; string pxPayKey = SettingsHelper.Payment.Key; try { PaymentDetails paymentDetails = ReadAndValidateInput(); if (paymentDetails == null) { lblMessage.Text = "There was an error processing your request, please try again."; return; } PxPay wsPxPay = new PxPay(pxPayUserId, pxPayKey); RequestInput input = new RequestInput(); input.AmountInput = paymentDetails.Amount.ToString(CultureInfo.InvariantCulture); input.CurrencyInput = "NZD"; input.MerchantReference = paymentDetails.RefNumber; input.TxnData1 = paymentDetails.RefType; input.TxnData2 = paymentDetails.FullName; input.TxnData3 = paymentDetails.Phone; input.TxnType = "Purchase"; input.UrlFail = CMS.DocumentEngine.DocumentContext.CurrentDocument.AbsoluteURL; input.UrlSuccess = CMS.DocumentEngine.DocumentContext.CurrentDocument.AbsoluteURL; // TODO: GUID representing unique identifier for the transaction within the shopping cart (normally would be an order ID or similar) Guid orderId = Guid.NewGuid(); input.TxnId = orderId.ToString().Substring(0, 16); RequestOutput output = wsPxPay.GenerateRequest(input); if (output.valid == "1") { // Redirect user to payment page Response.Redirect(output.Url); } } catch (Exception ex) { //log exception to Kentico EventLogProvider.LogException("Payment", "POST", ex, 0, "Payment Express Control", null); lblMessage.Text = "There was an error processing your request, please contact Vector."; } }
public void GetProductUpdates() { #if AMAZON_BILLING_ENABLED // Construct object passed to operation as input ResetInput request = new ResetInput(); // Set input value request.Reset = true; // Call synchronous operation with input object RequestOutput response = iapService.GetPurchaseUpdates(request); // Get return value string requestIdString = response.RequestId; Debug.Log("requestIdString " + requestIdString); #endif }
public void Purchase(string SKU) { #if AMAZON_BILLING_ENABLED currentSKU = SKU; // Construct object passed to operation as input SkuInput request = new SkuInput(); // Set input value request.Sku = SKU; // Call synchronous operation with input object RequestOutput response = iapService.Purchase(request); // Get return value string requestIdString = response.RequestId; Debug.Log("requestIdString " + requestIdString); #endif }
//-------------------------------------- // PRIVATE API CALL METHODS //-------------------------------------- private void Init(List <AmazonProductTemplate> product_ids) { #if AMAZON_BILLING_ENABLED List <string> products = new List <string> (); foreach (AmazonProductTemplate tpl in product_ids) { products.Add(tpl.Sku); } SkusInput request = new SkusInput(); request.Skus = products; // Call synchronous operation with input object RequestOutput response = iapService.GetProductData(request); // Get return value string requestIdString = response.RequestId; Debug.Log("requestIdString " + requestIdString); #endif }
/// <summary> /// /// </summary> /// <param name="input"></param> /// <returns></returns> public RequestOutput GenerateRequest(RequestInput input) { RequestOutput result = new RequestOutput(SubmitXml(GenerateRequestXml(input))); return(result); }
public RequestOutput GenerateRequest(RequestInput input) { RequestOutput result = new RequestOutput(SubmitXml(GenerateRequestXml(input))); return result; }
public IActionResult CreateDpsUI([FromBody] DpsInputDto dpsInput) { if (!ModelState.IsValid) { return(BadRequest("Invalid input!")); } var orderId = dpsInput.OrderId; var returnUrl = dpsInput.ReturnUrl; var siteName = _config["CurrentSite"]; string host_url = "http://" + HttpContext.Request.Host + siteName; string host_url1 = _config["ApiUrl"] + siteName; // "http://api171.gpos.nz/dollaritems"; string sReturnUrlFail = host_url1 + "/api/dps/result?t=result&ret=fail&orderId=" + orderId; string sReturnUrlSuccess = host_url1 + "/api/dps/result?action=paymentSuccess&orderId=" + orderId; //PxPayUserId = _contextf.Settings.Where(s => s.Cat == "DPS" && s.Name == "PxPayUserId").FirstOrDefault().Value; //PxPayKey = _contextf.Settings.Where(s => s.Cat == "DPS" && s.Name == "PxPayKey").FirstOrDefault().Value; //sServiceUrl = _contextf.Settings.Where(s => s.Cat == "DPS" && s.Name == "sServiceUrl").FirstOrDefault().Value; //if (PxPayUserId == null || PxPayKey == null || sServiceUrl == null) //{ // PxPayUserId = Startup.Configuration["PxPayUserId"]; // PxPayKey = Startup.Configuration["PxPayKey"]; // sServiceUrl = Startup.Configuration["sServiceUrl"]; //} //get order total var order = _context.Orders.Where(o => o.Id == Convert.ToInt32(orderId)) .Join(_context.Invoice, o => o.InvoiceNumber, i => i.InvoiceNumber, (o, i) => new { o.InvoiceNumber, o.Id, Total = i.Total ?? 0 }).FirstOrDefault(); decimal orderAmount = 0; if (order != null) { orderAmount = order.Total; } else { return(BadRequest()); } PxPay WS = new PxPay(sServiceUrl, PxPayUserId, PxPayKey); RequestInput input = new RequestInput(); input.AmountInput = Math.Round(orderAmount, 2).ToString(); input.CurrencyInput = "NZD"; input.MerchantReference = orderId; input.TxnType = "Purchase"; input.UrlFail = sReturnUrlFail; input.UrlSuccess = sReturnUrlSuccess; input.TxnData1 = returnUrl; Guid newOrderId = Guid.NewGuid(); input.TxnId = newOrderId.ToString().Substring(0, 16); RequestOutput output = WS.GenerateRequest(input); if (output.valid == "1") { var result = output.Url; return(Ok(result)); } return(NotFound()); }
public async Task <RequestOutput> SubmitNewTeamForApproval(SubmitNewTeamForApprovalInput input) { //check if there is an approver for the team var queryteam = _lookup_teamRepository.GetAll() .Include(e => e.SysStatusFk) .Where(e => e.Id == input.TeamId); var teams = await queryteam .ToListAsync(); if (teams == null) { throw new Exception(L("RecordNotFound")); } else { //check the Team Status foreach (var team in teams) { if (team.SysStatusFk.Name.ToLower() != "new") { throw new Exception(L("InvalidSubmitApprovalStatus")); } else { var nextStatusDto = _sysStatuses.GetNextSysStatus(team.SysStatusFk.Code, "approval", ""); var inputTeam = ObjectMapper.Map <Team>(team); inputTeam.SysStatusId = nextStatusDto.SysStatus.Id; var teamUpdate = await _teamRepository.FirstOrDefaultAsync((int)inputTeam.Id); ObjectMapper.Map(inputTeam, teamUpdate); } } } var queryApproval = _approvalRepository.GetAll() .Include(e => e.SysRefFk) .Include(e => e.UserFk) .Where(e => e.SysRefFk.RefCode == "Team"); var approvalList = await queryApproval .OrderBy("RankNo, Amount asc") .ToListAsync(); var count = 0; var requestOutput = new RequestOutput(); /* get approval status reference Id */ var queryStatusRef = _lookup_sysRefRepository.GetAll() .Include(e => e.ReferenceTypeFk) .Where(e => e.ReferenceTypeFk != null && e.ReferenceTypeFk.Name == "Status") .Where(e => e.RefCode == "approval"); var statusRefList = await queryStatusRef.ToListAsync(); int statusRefId = 0; foreach (var statusRef in statusRefList) { statusRefId = statusRef.Id; } /* -----------------------**/ /* get approval status Id */ var queryStatus = _lookup_sysStatusRepository.GetAll() .Where(e => e.SysRefId == statusRefId); var statusList = await queryStatus.ToListAsync(); int newStatusId = 0; int approvalStatusId = 0; int statusCount = 0; foreach (var status in statusList) { if (statusCount == 1) { newStatusId = status.Id; } ; /* Require Approval*/ if (statusCount == 2) { approvalStatusId = status.Id; } ; /* Pending Approval*/ statusCount += 1; } /* -----------------------**/ if (newStatusId != 0 && approvalStatusId != 0) { foreach (var approval in approvalList) { var queryApprovalRequesUser = _approvalRequestRepository.GetAll() .Where(e => e.ReferenceId == input.TeamId && e.UserId == approval.UserId); var approvalRequestUserList = await queryApprovalRequesUser .ToListAsync(); if (approvalRequestUserList.Count == 0) { // insert into approvalRequest var approvalUserId = (approval.UserId == null) ? 0 : approval.UserId.Value; count += 1; int statusId = newStatusId; if (count == 1) { statusId = approvalStatusId; } ; var _approvalRequest = new ApprovalRequest { RankNo = approval.RankNo, Amount = approval.Amount, SysRefId = approval.SysRefId, ReferenceId = input.TeamId, UserId = approvalUserId, SysStatusId = statusId, OrderNo = count, }; var user = new User { Name = approval.UserFk.Name, Surname = approval.UserFk.Surname, EmailAddress = approval.UserFk.EmailAddress, IsActive = approval.UserFk.IsActive, UserName = approval.UserFk.UserName, IsEmailConfirmed = approval.UserFk.IsEmailConfirmed }; //create approval requestM var approvalRequest = ObjectMapper.Map <ApprovalRequest>(_approvalRequest); if (AbpSession.TenantId != null) { approvalRequest.TenantId = (int?)AbpSession.TenantId; } await _approvalRequestRepository.InsertAsync(approvalRequest); //send request for approval from first approver if (count == 1) { await _approvalEmailer.SendEmailApprovalAsync(approvalRequest, user, ""); requestOutput.Status = true; requestOutput.StatusMessage = "SUCCESS"; } } } } return(requestOutput); }
public GetCustomApprovalRequestsOutput(RequestOutput result, List <GetCustomApprovalRequestForViewDto> approvalRequests) { Result = result; ApprovalRequests = approvalRequests; }