+++ /dev/null
-package com.supwisdom.dlpay.api.domain;
-
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-
-@Entity
-@Table(name = "TB_REVERSEDTL", indexes = {@Index(name = "TB_REVERSEDTL_UK", unique = true, columnList = "originRefno, billno")})
-public class TReverseDtl {
- @Id
- @GenericGenerator(name = "idGenerator", strategy = "uuid")
- @GeneratedValue(generator = "idGenerator")
- @Column(name = "ID", nullable = false, length = 32)
- private String id;
-
- @Column(name = "ORIGIN_REFNO", length = 20)
- @NotNull
- private String originRefno; //原始流水号
-
- @Column(name = "BILLNO", length = 20)
- @NotNull
- private String billno; //业务系统请求流水号
-
- @Column(name = "TRANSDATE", length = 8)
- @NotNull
- private String transdate;
-
- @Column(name = "TRANSTIME", length = 6)
- @NotNull
- private String transtime;
-
- @Column(name = "REFUND_AMOUNT", precision = 9)
- private Integer refundAmount; //退款金额
-
- @Column(name = "REVERSE_FLAG", nullable = false, length = 10)
- @NotNull
- private String reverseFlag; //refund, cancel
-
- @Column(name = "STATUS", nullable = false, length = 20)
- @NotNull
- private String status;
-
- @Column(name = "REMARK", length = 600)
- private String remark;
-
- @Column(name = "CREATETIME", length = 14)
- private String createtime;
-
- @Column(name = "tenantid", length = 20)
- private String tenantid = "";
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getOriginRefno() {
- return originRefno;
- }
-
- public void setOriginRefno(String originRefno) {
- this.originRefno = originRefno;
- }
-
- public String getBillno() {
- return billno;
- }
-
- public void setBillno(String billno) {
- this.billno = billno;
- }
-
- public String getTransdate() {
- return transdate;
- }
-
- public void setTransdate(String transdate) {
- this.transdate = transdate;
- }
-
- public String getTranstime() {
- return transtime;
- }
-
- public void setTranstime(String transtime) {
- this.transtime = transtime;
- }
-
- public Integer getRefundAmount() {
- return refundAmount;
- }
-
- public void setRefundAmount(Integer refundAmount) {
- this.refundAmount = refundAmount;
- }
-
- public String getReverseFlag() {
- return reverseFlag;
- }
-
- public void setReverseFlag(String reverseFlag) {
- this.reverseFlag = reverseFlag;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-
- public String getCreatetime() {
- return createtime;
- }
-
- public void setCreatetime(String createtime) {
- this.createtime = createtime;
- }
-
- public String getTenantid() {
- return tenantid;
- }
-
- public void setTenantid(String tenantid) {
- this.tenantid = tenantid;
- }
-}
return result;
}
+ @Override
+ public boolean checkCanReverse(String sourcetype) throws Exception {
+ //step1: 判断系统支付能力是否启用
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourcetype);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]");
+ } else if (!tSourceType.getReversable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]的流水冲正或退款");
+ }
+ return true;
+ }
+
+ @Override
+ public boolean checkShopCanReverse(String sourcetype, String shopaccno) throws Exception {
+ TSourceType tSourceType = sourceTypeDao.getBySourceType(sourcetype);
+ if (null == tSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]");
+ } else if (!tSourceType.getReversable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "系统不支持支付方式[" + sourcetype + "]的流水冲正或退款功能");
+ }
+
+ TShopSourceType tShopSourceType = shopSourceTypeDao.getById(sourcetype, shopaccno);
+ if (null == tShopSourceType) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourcetype + "]");
+ } else if (!tShopSourceType.getReverseEnable()) {
+ throw new TransactionProcessException(TradeErrorCode.INPUT_DATA_ERROR, "该商户[" + shopaccno + "]未启用支付方式[" + sourcetype + "]的流水冲正或退款功能");
+ }
+ return true;
+ }
+
}