Administrator
2024-05-27 f5a7f6c30bc5fb13eb538b5856a663b1ba0667b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
package com.dy.pipIrrSell.wechatpay;
 
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefund;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrSell.client.ClientSv;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.util.AesUtil;
import com.dy.pipIrrSell.util.PayHelper;
import com.dy.pipIrrSell.util.RestTemplateUtil;
import com.dy.pipIrrSell.virtualCard.VirtualCardSv;
import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import com.dy.pipIrrSell.virtualCard.enums.RefundItemStateENUM;
import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM;
import com.dy.pipIrrSell.wechatpay.dto.Code2Session;
import com.dy.pipIrrSell.wechatpay.dto.DtoOrder;
import com.dy.pipIrrSell.wechatpay.dto.OrderNotify;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
 
import javax.crypto.NoSuchPaddingException;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
 
/**
 * @author ZhuBaoMin
 * @date 2024-03-06 13:49
 * @LastEditTime 2024-03-06 13:49
 * @Description
 */
 
@Slf4j
@Tag(name = "微信支付管理", description = "微信支付各种操作")
@RestController
@RequestMapping(path="payment")
@RequiredArgsConstructor
public class PaymentCtrl {
    private final PaymentSv paymentSv;
    private final RestTemplateUtil restTemplateUtil;
    private final PayHelper payHelper;
    private final VirtualCardSv virtualCardSv;
    private final ClientSv clientSv;
 
    private final String privateCertFileName = PayInfo.privateCertFileName;
    private final String appid = PayInfo.appid;
    private final String mchid = PayInfo.mchid;
    private final String schema = PayInfo.schema;
    private final String signType = PayInfo.signType;
    private final String description = PayInfo.description;
    private final String loginUrl = PayInfo.loginUrl;
    private final String notifyUrl = PayInfo.notifyUrl;
    private final String grantType = PayInfo.grantType;
 
    // 平台证书公钥
    private final Map CERTIFICATE_MAP = new HashMap();
 
    /**
     * 登录凭证校验
     * @param code2Session 登录凭证校验传入对象
     * @param bindingResult
     * @return
     * @throws Exception
     */
    @Operation(summary = "登录凭证校验", description = "登录凭证校验")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "getSessionId")
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> getSessionId(@RequestBody @Valid Code2Session code2Session, BindingResult bindingResult) throws Exception {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
 
        Map<String, Object> queryParams = new HashMap<>();
        queryParams.put("appid", appid);
        queryParams.put("secret", code2Session.getSecret());
        queryParams.put("js_code", code2Session.getJs_code());
        queryParams.put("grant_type", grantType);
        Map<String, String> headerParams = new HashMap<>();
        JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams);
 
        if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) {
            return BaseResponseUtils.buildFail("登录凭证校验失败");
        }
 
        String openid = job.getString("openid");
        String sessionKey = job.getString("session_key");
 
        // 检验登录态
        //JSONObject checkSessionKey = payHelper.checkSessionKey(appid, secret, openid, sessionKey);
        //if(checkSessionKey != null) {
        //    Integer errcode = checkSessionKey.getInteger("errcode");
        //    String errmsg = checkSessionKey.getString("errmsg");
        //}
 
        // 重置登录态
        //JSONObject resetUserSessionKey = payHelper.resetUserSessionKey(appid, secret, openid, sessionKey);
        //if(resetUserSessionKey != null) {
        //    Integer errcode = checkSessionKey.getInteger("errcode");
        //    String errmsg = checkSessionKey.getString("errmsg");
        //    String openid_New = checkSessionKey.getString("openid");
        //    String sessionKey_New = checkSessionKey.getString("session_key");
        //}
 
        // 添加登录态记录
        SeWebchatLogonState po = new SeWebchatLogonState();
        po.setOpenId(openid);
        po.setSessionKey(sessionKey);
        Date createTime = new Date();
        po.setCreateTime(createTime);
        Long id = paymentSv.insert(po);
        if(id == null || id <= 0) {
            return BaseResponseUtils.buildFail("登录态记录添加失败");
        }
        String SessionId = String.valueOf(id);
 
        return BaseResponseUtils.buildSuccess(SessionId) ;
    }
 
    /**
     * 下载微信支付平台证书 测试完废除
     * @return
     * @throws Exception
     */
    @Operation(summary = "下载平台证书", description = "下载平台证书")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "certificates")
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> certificates() throws Exception {
        String method = "GET";
        String httpUrl = "/v3/certificates";
        String nonceStr = payHelper.generateRandomString();
        Long timestamp = System.currentTimeMillis() / 1000;
 
        String header = schema + " " + payHelper.getToken(method, httpUrl, "", nonceStr, timestamp, privateCertFileName);
 
        Map<String, String> headers = new HashMap<>();
        headers.put("Authorization", header);
        headers.put("Accept", "application/json");
        JSONObject job_result = restTemplateUtil.getHeaders(PayInfo.certificates,null, headers);
        JSONObject job_headers = job_result.getJSONObject("headers");
        String wechatpayNonce = job_headers.getJSONArray("Wechatpay-Nonce").getString(0);
        String wechatpaySerial = job_headers.getJSONArray("Wechatpay-Serial").getString(0);
        String wechatpaySignature = job_headers.getJSONArray("Wechatpay-Signature").getString(0);
        String wechatpaySignatureType = job_headers.getJSONArray("Wechatpay-Signature-Type").getString(0);
        String wechatpayTimestamp = job_headers.getJSONArray("Wechatpay-Timestamp").getString(0);
 
        JSONObject job_body = job_result.getJSONObject("body");
 
        // 构造验签名串
        String signatureStr = payHelper.responseSign(wechatpayTimestamp, wechatpayNonce, job_body.toJSONString());
        // 验证签名
        Boolean valid = payHelper.responseSignVerify(wechatpaySerial, signatureStr, wechatpaySignature);
 
        return BaseResponseUtils.buildSuccess();
    }
 
    /**
     * JSAPI下单
     * @param order 下单请求对象,包含需要传入的参数
     * @param bindingResult
     * @return
     */
    @Operation(summary = "JSAPI下单", description = "JSAPI下单")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "placeOrder")
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> placeOrder(@RequestBody @Valid DtoOrder order, BindingResult bindingResult) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        // 接收参数:登录态ID、农户ID、虚拟卡ID、充值金额
        String sessionId = order.getSessionId();
        Long virtualId = order.getVirtualId();
        Integer rechargeAmount = order.getRechargeAmount();
 
        String prepayId = "";
        SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId));
        String openid = po.getOpenId();
 
        SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(virtualId);
        Long clientId = seVirtualCard.getClientId();
 
        VoClient voClient = clientSv.getOneClient(clientId);
        String clientNum = voClient.getClientNum();
 
        // 生成订单号并添加充值记录
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String orderNumber = clientNum + dateFormat.format(new Date());
 
        // 生成虚拟卡充值记录(部分字段)
        DtoVirtualCard virtualCard = new DtoVirtualCard();
        virtualCard.setOrderNumber(orderNumber);
        virtualCard.setClientId(clientId);
        virtualCard.setVirtualId(virtualId);
        virtualCard.setRechargeAmount(rechargeAmount);
        BaseResponse result = virtualCardSv.insertVCRecharge(virtualCard);
        if(!result.getCode().equals("0001")) {
            return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_ADD_FAIL.getMessage());
        }
 
        JSONObject job_body = new JSONObject();
        job_body.put("appid", appid);
        job_body.put("mchid", mchid);
        job_body.put("description", description);
        job_body.put("out_trade_no", orderNumber);
        job_body.put("notify_url", notifyUrl);
 
        //订单金额
        JSONObject job_amount = new JSONObject();
        job_amount.put("total", 1);
        job_amount.put("currency", "CNY");
        job_body.put("amount", job_amount);
 
        //支付者
        JSONObject job_payer = new JSONObject();
        job_payer.put("openid", openid);
        job_body.put("payer", job_payer);
 
        // 获取随机串和时间戳,放在此处以保证
        String nonceStr = payHelper.generateRandomString();
        Long timestamp = System.currentTimeMillis() / 1000;
 
        String method = "POST";
        String httpUrl = "/v3/pay/transactions/jsapi";
 
        String body = job_body.toJSONString();
        String header = schema + " " + payHelper.getToken(method, httpUrl, body, nonceStr, timestamp, privateCertFileName);
 
        Map<String, String> headers = new HashMap<>();
        headers.put("Authorization", header);
        headers.put("Accept", "application/json");
        headers.put("Content-Type", "application/json");
 
        // 暂时注释掉,认证通过后再放开
        //JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers);
        //if(job_result != null) {
        //    System.out.println(job_result.toString());
        //    prepayId = job_result.getString("prepay_id");
        //}
 
        return BaseResponseUtils.buildSuccess(prepayId) ;
    }
 
    /**
     * 支付通知/退款结果通知
     * @param headers
     * @param orderNotify
     * @param response
     * @return
     * @throws IOException
     * @throws GeneralSecurityException
     */
    @Operation(summary = "支付通知", description = "支付通知")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "orderNotify", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public JSONObject orderNotify(@RequestHeader HttpHeaders headers, @RequestBody OrderNotify orderNotify, HttpServletResponse response) throws IOException, GeneralSecurityException {
        JSONObject result = new JSONObject();
 
        /**
         * 1.验签处理
         *      从header中取出4个子参数,同时取出body
         *      验时间差,超过5分钟的不处理
         *      验证签名
         *      验证书序列号,必须与某一个证书的序列号一致
         */
        String wechatpayNonce = String.valueOf(headers.get("Wechatpay-Nonce").get(0));
        String wechatpaySerial = String.valueOf(headers.get("Wechatpay-Serial").get(0));
        String wechatpaySignature = String.valueOf(headers.get("Wechatpay-Signature").get(0));
        String wechatpayTimestamp = String.valueOf(headers.get("Wechatpay-Timestamp").get(0));
        String bodyStr = JSONObject.toJSONString(orderNotify);
 
        // 验时间戳,时间差大于5分钟的拒绝
        Long timeDiff = (System.currentTimeMillis() / 1000 - Long.parseLong(wechatpayTimestamp))/60;
        if(timeDiff > 5) {
            response.setStatus(500);
            result.put("code", "FAIL");
            result.put("message", "失败");
            return result;
        }
 
        // 构造验签名串
        String signatureStr = payHelper.responseSign(wechatpayTimestamp, wechatpayNonce, bodyStr);
        // 验证签名
        Boolean valid = payHelper.responseSignVerify(wechatpaySerial, signatureStr, wechatpaySignature);
        if(!valid) {
            response.setStatus(500);
            result.put("code", "FAIL");
            result.put("message", "失败");
            return result;
        }
 
        // 序列号验证要放在验签后,因为验签时可能会下载新的证书
        boolean SerialIsValid = false;
        for (String key : payHelper.CERTIFICATE_MAP.keySet()) {
            if(key.equals(wechatpaySerial)) {
                SerialIsValid = true;
            }
        }
        if(!SerialIsValid) {
            response.setStatus(500);
            result.put("code", "FAIL");
            result.put("message", "失败");
            return result;
        }
 
        /**
         * 解密处理
         *      1
         */
        String eventType = orderNotify.getEvent_type();
 
        if(eventType != null && eventType.equals("TRANSACTION.SUCCESS")) {
            // 支付成功回调
            /**
             * 支付成功的回调
             * 取出通知数据对象,继而取出解密所需的associatedData和nonce,以及密文ciphertext
             * 解密ciphertext得到
             */
            OrderNotify.NotifyResource notifyResource = orderNotify.getResource();
            String associatedData = notifyResource.getAssociated_data();
            String nonce = notifyResource.getNonce();
            String ciphertext = notifyResource.getCiphertext();
 
            String resource = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associatedData.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext);
            JSONObject job_resource = JSONObject.parseObject(resource);
 
            // 解密后取出:商户订单员、微信支付订单号、交易状态、支付完成时间
            String out_trade_no = job_resource.getString("out_trade_no");
            String transaction_id = job_resource.getString("transaction_id");
            String trade_state = job_resource.getString("trade_state");
            Date success_time = job_resource.getDate("success_time");
 
            // 更新虚拟卡表及充值表响应字段
            BaseResponse result_ = virtualCardSv.updateVCRecharge(out_trade_no, success_time);
            if(!result_.getCode().equals("0001")) {
                response.setStatus(500);
                result.put("code", "FAIL");
                result.put("message", "失败");
                return result;
            }
        } else if(eventType != null && eventType.equals("REFUND.SUCCESS")) {
            // 退款成功后回调
            /**
             * 退款成功的回调
             * 取出通知数据对象,继而取出解密所需的associatedData和nonce,以及密文ciphertext
             * 解密ciphertext得到
             */
            OrderNotify.NotifyResource notifyResource = orderNotify.getResource();
            String associatedData = notifyResource.getAssociated_data();
            String nonce = notifyResource.getNonce();
            String ciphertext = notifyResource.getCiphertext();
 
            String resource = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associatedData.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext);
            JSONObject job_resource = JSONObject.parseObject(resource);
 
            // 解密后取出:商户订单员、微信支付订单号、交易状态、支付完成时间
            String out_trade_no = job_resource.getString("out_trade_no");
            String transaction_id = job_resource.getString("transaction_id");
            String out_refund_no = job_resource.getString("out_refund_no");
            String refund_status = job_resource.getString("refund_status");
            Date success_time = job_resource.getDate("success_time");
            if(!refund_status.equals("SUCCESS")) {
                response.setStatus(500);
                result.put("code", "FAIL");
                result.put("message", "失败");
                return result;
            }
 
            // 更新虚拟卡表及充值表响应字段
            SeVcRefundItem seVcRefundItem = new SeVcRefundItem();
            seVcRefundItem.setRefundTime(success_time);
            seVcRefundItem.setRefundStatus(RefundItemStateENUM.REFUNDED.getCode());
            Integer rec = virtualCardSv.updateRefundItem(seVcRefundItem);
            if(rec == null && rec <= 0) {
                response.setStatus(500);
                result.put("code", "FAIL");
                result.put("message", "失败");
                return result;
            }
 
            // 根据退款单号反查退款ID,根据退款ID获取退款状态是未退款的记录数量,如果是0则说明全部退款完成,更新退款表状态为已退款,将退款后金额更新到虚拟卡表
            /**
             * 根据退款通知接口返回的退款单号反查退款ID,查询该退款ID下未退款记录数量
             *      如果结果为0,则该退款已经完成
             *      1. 更新退款表状态为已退款
             *      2. 将退款后余额更新到虚拟卡表中
             */
            Integer noRefundedCount = virtualCardSv.getNoRefundedCount(out_refund_no);
            if(noRefundedCount != null && noRefundedCount == 0) {
                // 获取退款对象并修改退款状态
                Long refundId = virtualCardSv.getRefundIdByRefundNumber(out_refund_no);
                SeVcRefund seVcRefund = virtualCardSv.selectRefundByRefundId(refundId);
                seVcRefund.setRefundStatus(RefundStatusENUM.REFUNDED.getCode());
                virtualCardSv.updateRefund(seVcRefund);
 
                // 获取虚拟卡对象并修改余额、最后操作、最后操作时间
                Long vcId = seVcRefund.getVcId();
                Double afterRefund = seVcRefund.getAfterRefund();
                SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(vcId);
                seVirtualCard.setMoney(afterRefund);
                seVirtualCard.setLastOperate(LastOperateENUM.REFUND.getCode());
                seVirtualCard.setLastOperateTime(new Date());
                virtualCardSv.updateVirtualCard(seVirtualCard);
            }
        }
 
        // 通知应答
        response.setStatus(200);
        result.put("code", "SUCCESS");
        result.put("message", "成功");
        return  result;
    }
 
    /**
     * 再次签名
     * @param prepayId 预支付交易会话标识
     * @return 小程序调起支付参数
     * @throws Exception
     */
    @Operation(summary = "再次签名", description = "再次签名")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "/signAgain")
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId")  String prepayId) throws Exception {
 
        // 获取随机串和时间戳,放在此处以保证
        String appid = PayInfo.appid;
        String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
        String nonceStr = payHelper.generateRandomString();
        String pkg = "prepay_id=" + prepayId;
        String message = payHelper.buildMessage_signAgain(appid, timestamp, nonceStr, pkg);
        String paySign = payHelper.sign(message.getBytes("utf-8"), privateCertFileName);
 
        JSONObject job_result = new JSONObject();
        job_result.put("timestamp", timestamp);
        job_result.put("nonceStr", nonceStr);
        job_result.put("package", pkg);
        job_result.put("signType", signType);
        job_result.put("paySign", paySign);
 
        return BaseResponseUtils.buildSuccess(job_result) ;
    }
}