Skip to content

Commit

Permalink
提交转账,退款接口;重构商户通知;修复已知Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdhappy committed Nov 15, 2017
1 parent d5333a0 commit deee24e
Show file tree
Hide file tree
Showing 77 changed files with 10,436 additions and 1,001 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public class PayConstant {
public final static String PAY_CHANNEL_ALIPAY_MOBILE = "ALIPAY_MOBILE"; // 支付宝移动支付
public final static String PAY_CHANNEL_ALIPAY_PC = "ALIPAY_PC"; // 支付宝PC支付
public final static String PAY_CHANNEL_ALIPAY_WAP = "ALIPAY_WAP"; // 支付宝WAP支付
public final static String PAY_CHANNEL_ALIPAY_QR = "ALIPAY_QR"; // 支付宝当面付之扫码支付
public final static String PAY_CHANNEL_ALIPAY_QR = "ALIPAY_QR"; // 支付宝当面付之扫码支付

public final static String TRANS_CHANNEL_WX_APP = "TRANS_WX_APP"; // 微信APP转账
public final static String TRANS_CHANNEL_WX_JSAPI = "TRANS_WX_JSAPI"; // 微信公众号转账
public final static String CHANNEL_NAME_WX = "WX"; // 渠道名称:微信
public final static String CHANNEL_NAME_ALIPAY = "ALIPAY"; // 渠道名称:支付宝



Expand All @@ -41,6 +41,30 @@ public class PayConstant {
public final static byte TRANS_STATUS_FAIL = 3; // 失败
public final static byte TRANS_STATUS_COMPLETE = 4; // 业务完成

public final static byte TRANS_RESULT_INIT = 0; // 不确认结果
public final static byte TRANS_RESULT_REFUNDING = 1; // 等待手动处理
public final static byte TRANS_RESULT_SUCCESS = 2; // 确认成功
public final static byte TRANS_RESULT_FAIL = 3; // 确认失败

public final static byte REFUND_STATUS_INIT = 0; // 初始态
public final static byte REFUND_STATUS_REFUNDING = 1; // 转账中
public final static byte REFUND_STATUS_SUCCESS = 2; // 成功
public final static byte REFUND_STATUS_FAIL = 3; // 失败
public final static byte REFUND_STATUS_COMPLETE = 4; // 业务完成

public final static byte REFUND_RESULT_INIT = 0; // 不确认结果
public final static byte REFUND_RESULT_REFUNDING = 1; // 等待手动处理
public final static byte REFUND_RESULT_SUCCESS = 2; // 确认成功
public final static byte REFUND_RESULT_FAIL = 3; // 确认失败

public final static String MCH_NOTIFY_TYPE_PAY = "1"; // 商户通知类型:支付订单
public final static String MCH_NOTIFY_TYPE_TRANS = "2"; // 商户通知类型:转账订单
public final static String MCH_NOTIFY_TYPE_REFUND = "3"; // 商户通知类型:退款订单

public final static byte MCH_NOTIFY_STATUS_NOTIFYING = 1; // 通知中
public final static byte MCH_NOTIFY_STATUS_SUCCESS = 2; // 通知成功
public final static byte MCH_NOTIFY_STATUS_FAIL = 3; // 通知失败


public final static String RESP_UTF8 = "UTF-8"; // 通知业务系统使用的编码

Expand Down
6 changes: 6 additions & 0 deletions xxpay-common/src/main/java/org/xxpay/common/util/MySeq.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class MySeq {
private static String pay_seq_prefix = "P";
private static AtomicLong trans_seq = new AtomicLong(0L);
private static String trans_seq_prefix = "T";
private static AtomicLong refund_seq = new AtomicLong(0L);
private static String refund_seq_prefix = "R";

private static String node = "00";
static {
Expand All @@ -37,6 +39,9 @@ public static String getTrans() {
return getSeq(trans_seq_prefix, trans_seq);
}

public static String getRefund() {
return getSeq(refund_seq_prefix, refund_seq);
}

private static String getSeq(String prefix, AtomicLong seq) {
prefix += node;
Expand All @@ -47,6 +52,7 @@ public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
System.out.println("pay=" + getPay());
System.out.println("trans=" + getTrans());
System.out.println("refund=" + getRefund());
}

}
Expand Down
7 changes: 7 additions & 0 deletions xxpay-common/src/main/java/org/xxpay/common/util/RpcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,11 @@ public static String mkRet(Map<String, Object> result) {
return null;
}

public static Boolean isSuccess(Map<String, Object> result) {
if(result == null) return false;
String retCode = (String) result.get("rpcRetCode");
if("0000".equals(retCode) && result.get("bizResult") != null) return true;
return false;
}

}
18 changes: 18 additions & 0 deletions xxpay-common/src/main/java/org/xxpay/common/util/StrUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.xxpay.common.util;

/**
* @author: dingzhiwei
* @date: 17/11/1
* @description:
*/
public class StrUtil {

public static String toString(Object obj) {
return obj == null?"":obj.toString();
}

public static String toString(Object obj, String nullStr) {
return obj == null?nullStr:obj.toString();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.xxpay.dal.dao.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.xxpay.dal.dao.model.MchNotify;
import org.xxpay.dal.dao.model.MchNotifyExample;

public interface MchNotifyMapper {
int countByExample(MchNotifyExample example);

int deleteByExample(MchNotifyExample example);

int deleteByPrimaryKey(String orderId);

int insert(MchNotify record);

int insertSelective(MchNotify record);

List<MchNotify> selectByExample(MchNotifyExample example);

MchNotify selectByPrimaryKey(String orderId);

int updateByExampleSelective(@Param("record") MchNotify record, @Param("example") MchNotifyExample example);

int updateByExample(@Param("record") MchNotify record, @Param("example") MchNotifyExample example);

int updateByPrimaryKeySelective(MchNotify record);

int updateByPrimaryKey(MchNotify record);

int insertSelectiveOnDuplicateKeyUpdate(MchNotify record);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.xxpay.dal.dao.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.xxpay.dal.dao.model.RefundOrder;
import org.xxpay.dal.dao.model.RefundOrderExample;

public interface RefundOrderMapper {
int countByExample(RefundOrderExample example);

int deleteByExample(RefundOrderExample example);

int deleteByPrimaryKey(String refundOrderId);

int insert(RefundOrder record);

int insertSelective(RefundOrder record);

List<RefundOrder> selectByExample(RefundOrderExample example);

RefundOrder selectByPrimaryKey(String refundOrderId);

int updateByExampleSelective(@Param("record") RefundOrder record, @Param("example") RefundOrderExample example);

int updateByExample(@Param("record") RefundOrder record, @Param("example") RefundOrderExample example);

int updateByPrimaryKeySelective(RefundOrder record);

int updateByPrimaryKey(RefundOrder record);
}
Loading

0 comments on commit deee24e

Please sign in to comment.