private object Service_ApiPost(object sender, ApiEventArgs args) { var request = args.Request; if (Utils.EqualsIgnoreCase(args.Action, nameof(StlPayment.ApiGet))) { return(StlPayment.ApiGet(request)); } if (Utils.EqualsIgnoreCase(args.Action, nameof(StlPayment.ApiPay))) { return(StlPayment.ApiPay(request)); } if (Utils.EqualsIgnoreCase(args.Action, nameof(StlPayment.ApiPaySuccess))) { return(StlPayment.ApiPaySuccess(request)); } if (Utils.EqualsIgnoreCase(args.Action, nameof(StlPayment.ApiWeixinInterval))) { return(StlPayment.ApiWeixinInterval(request)); } if (Utils.EqualsIgnoreCase(args.Action, nameof(StlPayment.ApiWeixinNotify))) { return(StlPayment.ApiWeixinNotify(request, args.Id)); } if (Utils.EqualsIgnoreCase(args.Action, nameof(StlPayment.ApiRedirect))) { var successUrl = request.GetPostString("successUrl"); StlPayment.ApiRedirect(successUrl); } return(new HttpResponseMessage(HttpStatusCode.NotFound)); }
private object Service_ApiGet(object sender, ApiEventArgs args) { var request = args.Request; if (Utils.EqualsIgnoreCase(args.Action, nameof(StlPayment.ApiQrCode))) { return(StlPayment.ApiQrCode(request)); } return(new HttpResponseMessage(HttpStatusCode.NotFound)); }
public void Startup(IContext context, IService service) { DatabaseType = context.Environment.DatabaseType; ConnectionString = context.Environment.ConnectionString; DataApi = context.DataApi; ConfigApi = context.ConfigApi; ParseApi = context.ParseApi; FilesApi = context.FilesApi; AdminApi = context.AdminApi; Dao = new Dao(ConnectionString, DataApi); RecordDao = new RecordDao(ConnectionString, DataApi); service .AddSiteMenu(siteId => new Menu { Text = "在线支付", IconClass = "ion-card", Menus = new List <Menu> { new Menu { Text = "在线支付记录", Href = $"{nameof(PageRecords)}.aspx" }, new Menu { Text = "支付集成设置", Href = $"{nameof(PageIntegrationPay)}.aspx" } } }) .AddDatabaseTable(RecordDao.TableName, RecordDao.Columns) .AddStlElementParser(StlPayment.ElementName, StlPayment.Parse) .AddJsonPost((request, name) => { if (Utils.EqualsIgnoreCase(name, nameof(StlPayment.ApiGet))) { return(StlPayment.ApiGet(request)); } if (Utils.EqualsIgnoreCase(name, nameof(StlPayment.ApiPay))) { return(StlPayment.ApiPay(request)); } if (Utils.EqualsIgnoreCase(name, nameof(StlPayment.ApiPaySuccess))) { return(StlPayment.ApiPaySuccess(request)); } if (Utils.EqualsIgnoreCase(name, nameof(StlPayment.ApiWeixinInterval))) { return(StlPayment.ApiWeixinInterval(request)); } return(null); }) .AddHttpGet((request, name) => { if (Utils.EqualsIgnoreCase(name, nameof(StlPayment.ApiQrCode))) { return(StlPayment.ApiQrCode(request)); } return(new HttpResponseMessage(HttpStatusCode.NotFound)); }) .AddHttpPost((request, name) => { if (Utils.EqualsIgnoreCase(name, nameof(StlPayment.ApiRedirect))) { var successUrl = request.GetPostString("successUrl"); StlPayment.ApiRedirect(successUrl); } return(new HttpResponseMessage(HttpStatusCode.NotFound)); }) .AddHttpPost((request, name, id) => { if (Utils.EqualsIgnoreCase(name, nameof(StlPayment.ApiWeixinNotify))) { return(StlPayment.ApiWeixinNotify(request, id)); } return(new HttpResponseMessage(HttpStatusCode.NotFound)); }); }