2
0

add: logic for stripe credit payment & rename pay module name to payment

This commit is contained in:
2024-11-27 18:39:54 +08:00
parent dd62a85f51
commit fd0a93dff8
23 changed files with 163 additions and 39 deletions

View File

@@ -0,0 +1,35 @@
package org.wfc.payment;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.wfc.common.security.annotation.EnableCustomConfig;
import org.wfc.common.security.annotation.EnableRyFeignClients;
import org.wfc.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
/**
* Pay module
*
* @author wfc
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class WfcPayApplication
{
// @Autowired
// private LocaleMessageUtil localeMessageUtil;
// @GetMapping("/greeting")
// public String greeting() {
// return localeMessageUtil.getMessage("greeting.message");
// }
public static void main(String[] args)
{
SpringApplication.run(WfcPayApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ Pay module startup ლ(´ڡ`ლ)゙ \n");
}
}

View File

@@ -0,0 +1,91 @@
package org.wfc.payment.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.payment.domain.CreditCard;
import org.wfc.payment.domain.PaymentRequest;
import org.wfc.payment.service.ICreditCardService;
import org.springframework.http.ResponseEntity;
import org.wfc.common.core.constant.HttpStatus;
/**
* Credit card pay controller
*
* @author simon
*/
@RestController
@RequestMapping("/payments")
public class CreditCardController extends BaseController
{
@Autowired
private ICreditCardService ccPayService;
@PostMapping("/creditCard")
public ResponseEntity<String> processPayment(@RequestBody PaymentRequest paymentRequest) {
// 调用支付服务处理支付请求
boolean paymentResult = ccPayService.processPayment(paymentRequest);
if (paymentResult) {
return ResponseEntity.ok("Payment successful");
} else {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Payment failed");
}
}
/**
* 根据参数编号获取详细信息
*/
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable Long userId)
{
return success(ccPayService.selectCreditCardInfoByUserId(userId));
}
/**
* 新增参数配置
*/
@RequiresPermissions("pay:creditCard:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody CreditCard creditCardInfo)
{
return toAjax(ccPayService.insertCreditCardInfo(creditCardInfo));
}
/**
* 修改参数配置
*/
@RequiresPermissions("pay:creditCard:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody CreditCard creditCardInfo)
{
return toAjax(ccPayService.updateCreditCardInfo(creditCardInfo));
}
/**
* 删除参数配置
*/
@RequiresPermissions("pay:creditCard:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
{
ccPayService.deleteCreditCardInfoById(id);
return success();
}
}

View File

@@ -0,0 +1,73 @@
package org.wfc.payment.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.payment.domain.PayPal;
import org.wfc.payment.service.IPayPalService;
/**
* Paypal controller
*
* @author wfc
*/
@RestController
@RequestMapping("/paypal")
public class PayPalController extends BaseController
{
@Autowired
private IPayPalService paypalService;
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:query")
@Log(title = "paypal info management", businessType = BusinessType.OTHER)
@GetMapping("/{userId}")
public AjaxResult query(@PathVariable Long userId) {
return success(paypalService.selectPayPalInfoByUserId(userId));
}
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:add")
@Log(title = "paypal info management", businessType = BusinessType.INSERT)
@PostMapping("/{paypal}")
public AjaxResult add(@PathVariable PayPal paypal)
{
return toAjax(paypalService.insertPayPalInfo(paypal));
}
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:edit")
@Log(title = "paypal info management", businessType = BusinessType.UPDATE)
@PutMapping("/{id}")
public AjaxResult edit(@PathVariable Long id) {
return toAjax(paypalService.updatePayPalInfoById(id));
}
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:remove")
@Log(title = "paypal info management", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
paypalService.deletePayPalInfoById(id);
return success();
}
}

View File

@@ -0,0 +1,111 @@
package org.wfc.payment.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.wfc.common.core.annotation.Excel;
import org.wfc.common.core.annotation.Excel.ColumnType;
import org.wfc.common.core.web.domain.BaseEntity;
/**
* 参数配置表 sys_config
*
* @author wfc
*/
public class CreditCard extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 参数主键 */
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
private Long configId;
/** 参数名称 */
@Excel(name = "参数名称")
private String configName;
/** 参数键名 */
@Excel(name = "参数键名")
private String configKey;
/** 参数键值 */
@Excel(name = "参数键值")
private String configValue;
/** 系统内置Y是 N否 */
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
private String configType;
public Long getConfigId()
{
return configId;
}
public void setConfigId(Long configId)
{
this.configId = configId;
}
@NotBlank(message = "参数名称不能为空")
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
public String getConfigName()
{
return configName;
}
public void setConfigName(String configName)
{
this.configName = configName;
}
@NotBlank(message = "参数键名长度不能为空")
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
public String getConfigKey()
{
return configKey;
}
public void setConfigKey(String configKey)
{
this.configKey = configKey;
}
@NotBlank(message = "参数键值不能为空")
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
public String getConfigValue()
{
return configValue;
}
public void setConfigValue(String configValue)
{
this.configValue = configValue;
}
public String getConfigType()
{
return configType;
}
public void setConfigType(String configType)
{
this.configType = configType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configName", getConfigName())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,256 @@
package org.wfc.payment.domain;
import org.wfc.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 菜单权限表 sys_menu
*
* @author wfc
*/
public class PayPal extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private Integer orderNum;
/** 路由地址 */
private String path;
/** 组件路径 */
private String component;
/** 路由参数 */
private String query;
/** 是否为外链0是 1否 */
private String isFrame;
/** 是否缓存0缓存 1不缓存 */
private String isCache;
/** 类型M目录 C菜单 F按钮 */
private String menuType;
/** 显示状态0显示 1隐藏 */
private String visible;
/** 菜单状态0正常 1停用 */
private String status;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
private String icon;
/** 菜单key */
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
{
return menuName;
}
public void setMenuName(String menuName)
{
this.menuName = menuName;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public String getIsFrame()
{
return isFrame;
}
public void setIsFrame(String isFrame)
{
this.isFrame = isFrame;
}
public String getIsCache()
{
return isCache;
}
public void setIsCache(String isCache)
{
this.isCache = isCache;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType()
{
return menuType;
}
public void setMenuType(String menuType)
{
this.menuType = menuType;
}
public String getVisible()
{
return visible;
}
public void setVisible(String visible)
{
this.visible = visible;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
{
return perms;
}
public void setPerms(String perms)
{
this.perms = perms;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("name", getName())
.toString();
}
}

View File

@@ -0,0 +1,65 @@
package org.wfc.payment.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.wfc.common.core.annotation.Excel;
import org.wfc.common.core.annotation.Excel.ColumnType;
import org.wfc.common.core.web.domain.BaseEntity;
/**
* 参数配置表 sys_config
*
* @author wfc
*/
public class PaymentRequest extends BaseEntity {
private String cardNumber;
private String cardHolderName;
private String expirationDate;
private String cvv;
private int amount; // 以分为单位
// Getters and Setters
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
public String getCardHolderName() {
return cardHolderName;
}
public void setCardHolderName(String cardHolderName) {
this.cardHolderName = cardHolderName;
}
public String getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(String expirationDate) {
this.expirationDate = expirationDate;
}
public String getCvv() {
return cvv;
}
public void setCvv(String cvv) {
this.cvv = cvv;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
}

View File

@@ -0,0 +1,106 @@
package org.wfc.payment.domain.vo;
import org.wfc.common.core.utils.StringUtils;
/**
* 路由显示信息
*
* @author wfc
*/
public class MetaVo
{
/**
* 设置该路由在侧边栏和面包屑中展示的名字
*/
private String title;
/**
* 设置该路由的图标对应路径src/assets/icons/svg
*/
private String icon;
/**
* 设置为true则不会被 <keep-alive>缓存
*/
private boolean noCache;
/**
* 内链地址http(s)://开头)
*/
private String link;
public MetaVo()
{
}
public MetaVo(String title, String icon)
{
this.title = title;
this.icon = icon;
}
public MetaVo(String title, String icon, boolean noCache)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
}
public MetaVo(String title, String icon, String link)
{
this.title = title;
this.icon = icon;
this.link = link;
}
public MetaVo(String title, String icon, boolean noCache, String link)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
if (StringUtils.ishttp(link))
{
this.link = link;
}
}
public boolean isNoCache()
{
return noCache;
}
public void setNoCache(boolean noCache)
{
this.noCache = noCache;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public String getLink()
{
return link;
}
public void setLink(String link)
{
this.link = link;
}
}

View File

@@ -0,0 +1,148 @@
package org.wfc.payment.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
/**
* 路由配置信息
*
* @author wfc
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo
{
/**
* 路由名字
*/
private String name;
/**
* 路由地址
*/
private String path;
/**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/
private boolean hideInMenu;
/**
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
*/
private String redirect;
/**
* 组件地址
*/
private String component;
/**
* 路由参数:如 {"id": 1, "name": "ry"}
*/
private String query;
/**
* 当你一个路由下面的 children 声明的路由大于1个时自动会变成嵌套的模式--如组件页面
*/
private Boolean alwaysShow;
/**
* 其他元素
*/
private MetaVo meta;
/**
* 子路由
*/
private List<RouterVo> children;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
public boolean getHideInMenu()
{
return hideInMenu;
}
public void setHideInMenu(boolean hideInMenu)
{
this.hideInMenu = hideInMenu;
}
public String getRedirect()
{
return redirect;
}
public void setRedirect(String redirect)
{
this.redirect = redirect;
}
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public Boolean getAlwaysShow()
{
return alwaysShow;
}
public void setAlwaysShow(Boolean alwaysShow)
{
this.alwaysShow = alwaysShow;
}
public MetaVo getMeta()
{
return meta;
}
public void setMeta(MetaVo meta)
{
this.meta = meta;
}
public List<RouterVo> getChildren()
{
return children;
}
public void setChildren(List<RouterVo> children)
{
this.children = children;
}
}

View File

@@ -0,0 +1,60 @@
package org.wfc.payment.domain.vo;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* Treeselect树结构实体类
*
* @author wfc
*/
public class TreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect()
{
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<TreeSelect> getChildren()
{
return children;
}
public void setChildren(List<TreeSelect> children)
{
this.children = children;
}
}

View File

@@ -0,0 +1,44 @@
package org.wfc.payment.mapper;
import java.util.List;
import org.wfc.payment.domain.CreditCard;
/**
* 参数配置 数据层
*
* @author simon
*/
public interface CreditCardMapper
{
/**
* 通过ID查询配置
*
* @param id 参数ID
* @return 参数配置信息
*/
public CreditCard selectCreditCardInfoByUserId(Long id);
/**
* 新增参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int insertCreditCardInfo(CreditCard creditCard);
/**
* 修改参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int updateCreditCardInfo(CreditCard creditCard);
/**
* 删除参数配置
*
* @param id 参数ID
* @return 结果
*/
public void deleteCreditCardInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.payment.mapper;
import org.wfc.payment.domain.PayPal;
/**
* Paypal mapper
*
* @author wfc
*/
public interface PayPalMapper
{
/**
* select paypal info by user id
*
* @param userId user id
* @return paypal information
*/
public PayPal selectPayPalInfoByUserId(Long userId);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int insertPayPalInfo(PayPal paypal);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int updatePayPalInfoById(Long id);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public void deletePayPalInfoById(Long id);
}

View File

@@ -0,0 +1,46 @@
package org.wfc.payment.service;
import org.wfc.payment.domain.CreditCard;
import org.wfc.payment.domain.PaymentRequest;
/**
* Credit card pay service layer
*
* @author wfc
*/
public interface ICreditCardService
{
public boolean processPayment(PaymentRequest paymentRequest);
/**
* select credit card information
*
* @param userId User ID
* @return Credit card info
*/
public CreditCard selectCreditCardInfoByUserId(Long userId);
/**
* insert credit card
*
* @param creditCard User ID
* @return Credit card info
*/
public int insertCreditCardInfo(CreditCard creditCard);
/**
* update credit card
*
* @param creditCard User ID
* @return Credit card info
*/
public int updateCreditCardInfo(CreditCard creditCard);
/**
* update credit card
*
* @param creditCard User ID
* @return void
*/
public void deleteCreditCardInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.payment.service;
import org.wfc.payment.domain.PayPal;
/**
* Paypal pay service layer
*
* @author wfc
*/
public interface IPayPalService
{
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public PayPal selectPayPalInfoByUserId(Long userId);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int insertPayPalInfo(PayPal paypal);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int updatePayPalInfoById(Long id);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public void deletePayPalInfoById(Long id);
}

View File

@@ -0,0 +1,103 @@
package org.wfc.payment.service.impl;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.text.Convert;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.redis.service.RedisService;
import org.wfc.payment.domain.CreditCard;
import org.wfc.payment.domain.PaymentRequest;
import org.wfc.payment.mapper.CreditCardMapper;
import org.wfc.payment.service.ICreditCardService;
import java.util.HashMap;
import java.util.Map;
import com.stripe.Stripe;
import com.stripe.model.Charge;
import com.stripe.exception.StripeException;
import com.stripe.param.ChargeCreateParams;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 参数配置 服务层实现
*
* @author wfc
*/
@Service
public class CreditCardServiceImpl implements ICreditCardService
{
@Autowired
private CreditCardMapper creditCardMapper;
public void SetStripeApiKey(String apiKey) {
Stripe.apiKey = apiKey;
}
@Override
public boolean processPayment(PaymentRequest paymentRequest) {
ChargeCreateParams params = ChargeCreateParams.builder()
.setAmount((long) paymentRequest.getAmount())
.setCurrency("usd")
.setSource(paymentRequest.getCardNumber()) // 这里假设前端传递的是支付令牌
.setDescription("Charge for " + paymentRequest.getCardHolderName())
.build();
try {
Charge charge = Charge.create(params);
return charge.getPaid();
} catch (StripeException e) {
e.printStackTrace();
return false;
}
}
/**
* 查询参数置信息
*
* @param creditCardId 参数配置ID
* @return 参数配置信息
*/
public CreditCard selectCreditCardInfoByUserId(Long userId)
{
//CreditCard creditCardInfo = new CreditCard();
return creditCardMapper.selectCreditCardInfoByUserId(userId);
}
/**
* 新增参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int insertCreditCardInfo(CreditCard creditCard)
{
int row = creditCardMapper.insertCreditCardInfo(creditCard);
return row;
}
/**
* 修改参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int updateCreditCardInfo(CreditCard creditCard)
{
int row = creditCardMapper.updateCreditCardInfo(creditCard);
return row;
}
/**
* 删除参数信息
*
* @param id 需要删除的参数ID
*/
public void deleteCreditCardInfoById(Long id)
{
creditCardMapper.deleteCreditCardInfoById(id);
}
}

View File

@@ -0,0 +1,63 @@
package org.wfc.payment.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.payment.mapper.PayPalMapper;
import org.wfc.payment.service.IPayPalService;
import org.wfc.payment.domain.PayPal;
/**
* PayPal service implementation
*
* @author wfc
*/
@Service
public class PayPalServiceImpl implements IPayPalService
{
@Autowired
private PayPalMapper paypalMapper;
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public PayPal selectPayPalInfoByUserId(Long userId) {
return paypalMapper.selectPayPalInfoByUserId(userId);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int insertPayPalInfo(PayPal paypal) {
return paypalMapper.insertPayPalInfo(paypal);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int updatePayPalInfoById(Long id) {
return paypalMapper.updatePayPalInfoById(id);
}
/**
* update credit card
*
* @param creditCard User ID
* @return void
*/
@Override
public void deletePayPalInfoById(Long id) {
paypalMapper.deletePayPalInfoById(id);
}
}