mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-12 07:02:14 +08:00
5.0
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.gitee.sop.payment;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDubbo
|
||||
public class ExamplePaymentApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ExamplePaymentApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,25 @@
|
||||
package com.gitee.sop.payment.open;
|
||||
|
||||
import com.gitee.sop.payment.open.req.AlipayTradeWapPayRequest;
|
||||
import com.gitee.sop.payment.open.resp.AlipayTradeWapPayResponse;
|
||||
import com.gitee.sop.support.annotation.Open;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 支付接口
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
public interface OpenPayment {
|
||||
|
||||
@ApiOperation(
|
||||
value = "alipay.trade.wap.pay(手机网站支付接口2.0)",
|
||||
notes = "该接口是页面跳转接口,用于生成用户访问支付宝的跳转链接。" +
|
||||
"请在服务端执行支付宝SDK中pageExecute方法,读取响应中的body()结果。" +
|
||||
"该结果用于跳转到支付宝页面,返回到用户浏览器渲染或重定向跳转到支付宝页面。" +
|
||||
"具体使用方法请参考 <a href=\"https://torna.cn\" target=\"_blank\">接入指南</a>"
|
||||
)
|
||||
@Open(value = "alipay.trade.wap.pay", version = "2.0")
|
||||
AlipayTradeWapPayResponse tradeWapPay(AlipayTradeWapPayRequest request);
|
||||
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.gitee.sop.payment.open.impl;
|
||||
|
||||
import com.gitee.sop.payment.open.OpenPayment;
|
||||
import com.gitee.sop.payment.open.req.AlipayTradeWapPayRequest;
|
||||
import com.gitee.sop.payment.open.resp.AlipayTradeWapPayResponse;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
* 开放接口实现
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@DubboService(validation = "true")
|
||||
public class OpenPaymentImpl implements OpenPayment {
|
||||
|
||||
@Override
|
||||
public AlipayTradeWapPayResponse tradeWapPay(AlipayTradeWapPayRequest request) {
|
||||
AlipayTradeWapPayResponse alipayTradeWapPayResponse = new AlipayTradeWapPayResponse();
|
||||
alipayTradeWapPayResponse.setPageRedirectionData(UUID.randomUUID().toString());
|
||||
return alipayTradeWapPayResponse;
|
||||
}
|
||||
}
|
@@ -0,0 +1,177 @@
|
||||
package com.gitee.sop.payment.open.req;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* alipay.trade.wap.pay(手机网站支付接口2.0)
|
||||
*
|
||||
* @author 六如
|
||||
* https://opendocs.alipay.com/open/29ae8cb6_alipay.trade.wap.pay?pathHash=1ef587fd&ref=api&scene=21
|
||||
*/
|
||||
@Data
|
||||
public class AlipayTradeWapPayRequest {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "商户网站唯一订单号", required = true, example = "70501111111S001111119")
|
||||
@Length(max = 64)
|
||||
@NotBlank
|
||||
private String out_trade_no;
|
||||
|
||||
@ApiModelProperty(value = "订单总金额.单位为元,精确到小数点后两位,取值范围:[0.01,100000000] ",
|
||||
required = true, example = "9.00")
|
||||
@NotNull
|
||||
private BigDecimal total_amount;
|
||||
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "订单标题。注意:不可使用特殊字符,如 /,=,& 等。",
|
||||
required = true,
|
||||
example = "大乐透"
|
||||
)
|
||||
@Length(max = 256)
|
||||
@NotBlank
|
||||
private String subject;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "销售产品码,商家和支付宝签约的产品码。手机网站支付为:QUICK_WAP_WAY",
|
||||
required = true,
|
||||
example = "QUICK_WAP_WAY"
|
||||
)
|
||||
@NotBlank
|
||||
@Length(max = 64)
|
||||
private String product_code;
|
||||
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "针对用户授权接口,获取用户相关数据时,用于标识用户授权关系",
|
||||
example = "appopenBb64d181d0146481ab6a762c00714cC27"
|
||||
)
|
||||
@Length(max = 40)
|
||||
private String auth_token;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "用户付款中途退出返回商户网站的地址",
|
||||
example = "http://www.taobao.com/product/113714.html"
|
||||
)
|
||||
@Length(max = 400)
|
||||
private String quit_url;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "订单包含的商品列表信息,json格式,其它说明详见商品明细说明"
|
||||
)
|
||||
private List<GoodsDetail> goods_detail;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "绝对超时时间,格式为yyyy-MM-dd HH:mm:ss。超时时间范围:1m~15d。",
|
||||
example = "2016-12-31 10:05:00"
|
||||
)
|
||||
@Length(max = 32)
|
||||
private String time_expire;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商户传入业务信息,具体值要和支付宝约定,应用于安全,营销等参数直传场景,格式为json格式",
|
||||
example = "{\"mc_create_trade_ip\":\"127.0.0.1\"}"
|
||||
)
|
||||
@Length(max = 512)
|
||||
private String business_params;
|
||||
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "公用回传参数,如果请求时传递了该参数,则返回给商户时会回传该参数。支付宝只会在同步返回(包括跳转回商户网站)和异步通知时将该参数原样返回。本参数必须进行UrlEncode之后才可以发送给支付宝。",
|
||||
example = "merchantBizType%3d3C%26merchantBizNo%3d2016010101111"
|
||||
)
|
||||
@Length(max = 512)
|
||||
private String passback_params;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商户原始订单号,最大长度限制32位",
|
||||
example = "{\"mc_create_trade_ip\":\"127.0.0.1\"}"
|
||||
)
|
||||
@Length(max = 32)
|
||||
private String merchant_order_no;
|
||||
|
||||
// ---
|
||||
|
||||
@Data
|
||||
public static class GoodsDetail {
|
||||
@ApiModelProperty(
|
||||
value = "商品的编号",
|
||||
required = true,
|
||||
example = "apple-01"
|
||||
)
|
||||
@NotBlank
|
||||
@Length(max = 64)
|
||||
private String goods_id;
|
||||
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商品名称",
|
||||
required = true,
|
||||
example = "ipad"
|
||||
)
|
||||
@NotBlank
|
||||
@Length(max = 256)
|
||||
private String goods_name;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商品数量",
|
||||
required = true,
|
||||
example = "1"
|
||||
)
|
||||
@NotNull
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商品单价,单位为元",
|
||||
required = true,
|
||||
example = "2000"
|
||||
)
|
||||
@NotNull
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "支付宝定义的统一商品编号",
|
||||
example = "20010001"
|
||||
)
|
||||
@Length(max = 32)
|
||||
private String alipay_goods_id;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商品类目",
|
||||
example = "34543238"
|
||||
)
|
||||
@Length(max = 24)
|
||||
private String goods_category;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商品类目树,从商品类目根节点到叶子节点的类目id组成,类目id值使用|分割",
|
||||
example = "124868003|126232002|126252004"
|
||||
)
|
||||
@Length(max = 128)
|
||||
private String categories_tree;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商品描述信息",
|
||||
example = "特价手机"
|
||||
)
|
||||
@Length(max = 1000)
|
||||
private String body;
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "商品的展示地址",
|
||||
example = "http://www.alipay.com/xxx.jpg"
|
||||
)
|
||||
@Length(max = 400)
|
||||
private String show_url;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.gitee.sop.payment.open.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class AlipayTradeWapPayResponse {
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "用于跳转支付宝页面的信息,POST和GET方法生成内容不同:使用POST方法执行,结果为html form表单,在浏览器渲染即可;使用GET方法会得到支付宝URL,需要打开或重定向到该URL。建议使用POST方式。具体使用方法请参考",
|
||||
required = true,
|
||||
example = "请参考响应示例"
|
||||
)
|
||||
private String pageRedirectionData;
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
dubbo.registry.address=zookeeper://localhost:2181
|
@@ -0,0 +1,2 @@
|
||||
|
||||
dubbo.registry.address=nacos://localhost:8848
|
@@ -0,0 +1,9 @@
|
||||
spring.profiles.active=dev
|
||||
|
||||
server.port=7072
|
||||
spring.application.name=example-payment
|
||||
|
||||
dubbo.protocol.name=dubbo
|
||||
dubbo.protocol.port=-1
|
||||
dubbo.application.qos-enable=false
|
||||
dubbo.registry.address=zookeeper://localhost:2181
|
@@ -0,0 +1 @@
|
||||
abc,你好~!@#
|
@@ -0,0 +1,10 @@
|
||||
# 错误配置
|
||||
|
||||
# 系统配置
|
||||
isp.error_isv.common-error=The system is busy.
|
||||
isp.error_isv.invalid-parameter=Invalid parameter, {0}
|
||||
|
||||
# ==== 参数配置 ====
|
||||
|
||||
goods.remark.notNull=The goods_remark can not be null
|
||||
goods.comment.length=The goods_comment length must >= {0} and <= {1}
|
@@ -0,0 +1,14 @@
|
||||
# 错误配置
|
||||
|
||||
# 系统繁忙
|
||||
isp.error_isv.common-error=\u7cfb\u7edf\u7e41\u5fd9
|
||||
# 参数无效
|
||||
isp.error_isv.invalid-parameter=\u53c2\u6570\u65e0\u6548, {0}
|
||||
|
||||
# ==== 参数配置 ====
|
||||
|
||||
# 商品备注不能为空
|
||||
goods.remark.notNull=\u5546\u54c1\u5907\u6ce8\u4e0d\u80fd\u4e3a\u7a7a
|
||||
# 商品评论长度必须在{0}和{1}之间
|
||||
goods.comment.length=\u5546\u54c1\u8bc4\u8bba\u957f\u5ea6\u5fc5\u987b\u5728{0}\u548c{1}\u4e4b\u95f4
|
||||
|
@@ -0,0 +1,2 @@
|
||||
isp.goods_error_100=the goods_name can NOT be null
|
||||
isp.goods_error_101=the goods_name must bigger than {0}
|
@@ -0,0 +1,5 @@
|
||||
# 商品名字不能为空
|
||||
isp.goods_error_100=\u5546\u54C1\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A
|
||||
|
||||
# 商品名称太短,不能小于{0}个字
|
||||
isp.goods_error_101=\u5546\u54C1\u540D\u79F0\u592A\u77ED\uFF0C\u4E0D\u80FD\u5C0F\u4E8E{0}\u4E2A\u5B57
|
Reference in New Issue
Block a user