1

主题

2

帖子

10

积分

新手上路

Rank: 1

积分
10
==========支付请求
//支付请求对象
ServiceRequestPay pay = new ServiceRequestPay{}
//调用组件业务
BaseServiceResponse res_pay = SingleWeChatService.OnTransfer(pay);
//失败处理
if (res_pay.state != ServiceState.SUCCESS) return new ResponseError { code = SwapState.T_CHAT_PAY_REQUEST_RETURN_FAIL, error = string.Concat(res_pay.state, "|", res_pay.returnMessage) };
//成功处理
ServiceResponsePay pay_response = (ServiceResponsePay)res_pay;
//系统存储此次交易的请求数据

//返回
return new ResponseObject
{
        code = SwapState.SUCCESS,
        result = new
        {
                package = pay_response.package,
                paySign = pay_response.paySign,
                nonceStr = pay_response.nonceStr,
                timeStamp = pay_response.timeStamp,
                prepayId = pay_response.prepayId,
                id = tranId,
                signType = "MD5"
        }
};     

==========支付异步通知
//交易处理
BaseServiceResponse res_notify = SingleWeChatService.OnTransfer(new ServiceRequestPayNotice { body = "通知返回的原文" });
//
if (res_notify.state != ServiceState.SUCCESS)
{
        //失败处理
}
//转换成功对象
ServiceResponsePayNotice notice = (ServiceResponsePayNotice)res_notify;
//成功处理




===========退款处理
//退款请求对象
ServiceRequestRefund serviceRefund = new ServiceRequestRefund{};
//调用退款接口
BaseServiceResponse apiBussess = SingleWeChatService.OnTransfer(serviceRefund);
//构建退款记录
//失败处理
if (apiBussess.state != ServiceState.SUCCESS)
{
        //
}
//转换成功对象
ServiceResponseRefund resRefund = (ServiceResponseRefund)apiBussess;
//成功业务处理

SAAS.Business.WeChat.Service.zip

490.69 KB, 下载次数: 0

分享至 : QQ空间
0 人收藏
发新帖
您需要登录后才可以回帖 登录 | 立即注册