/** 更新 */ @RequestMapping(value = "/update", method = RequestMethod.POST) public String update( String paymentName, String partner, Currency currency, FeeType feeType, BigDecimal fee, String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order, RedirectAttributes redirectAttributes) { PluginConfig pluginConfig = paypalPlugin.getPluginConfig(); pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName); pluginConfig.setAttribute("partner", partner); pluginConfig.setAttribute("currency", currency.toString()); pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString()); pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString()); pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo); pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description); pluginConfig.setIsEnabled(isEnabled); pluginConfig.setOrder(order); pluginConfigService.update(pluginConfig); addFlashMessage(redirectAttributes, SUCCESS_MESSAGE); return "redirect:/admin/payment_plugin/list.jhtml"; }
/** 卸载 */ @RequestMapping(value = "/uninstall", method = RequestMethod.POST) public @ResponseBody Message uninstall() { if (paypalPlugin.getIsInstalled()) { PluginConfig pluginConfig = paypalPlugin.getPluginConfig(); pluginConfigService.delete(pluginConfig); } return SUCCESS_MESSAGE; }
/** 安装 */ @RequestMapping(value = "/install", method = RequestMethod.POST) public @ResponseBody Message install() { if (!paypalPlugin.getIsInstalled()) { PluginConfig pluginConfig = new PluginConfig(); pluginConfig.setPluginId(paypalPlugin.getId()); pluginConfig.setIsEnabled(false); pluginConfigService.save(pluginConfig); } return SUCCESS_MESSAGE; }