WeChat payment code


After the payment is successful, go to verify the payment status again
try {
							   // Go to WeChat to check the payment status
							   Map<String, String> accountParamsMap =accountsMap.get(SalesOrder.PAY_ACCOUNT_KEY_WECHAT);
							   
							   OrderQueryResponseCommand queryResult = wechatPaymentService.orderQuery(accountParamsMap.get(PaymentAccountCommand.Wechat.appid.name()),
									   accountParamsMap.get(PaymentAccountCommand.Wechat.partnerId.name()),
									   accountParamsMap.get(PaymentAccountCommand.Wechat.paySignKey.name()), paymentInfo.getSerialNumber());
							   if(queryResult != null) {
							       if(OrderQueryResponseCommand.TRADE_STATE_SUCCESS.equals(queryResult.getTrade_state()) ||
								       OrderQueryResponseCommand.TRADE_STATE_USERPAYING.equals(queryResult.getTrade_state())) {
								      // Payment is successful and cancellation is not allowed during payment
							       throw new OrderException("Orders canceled Exception : order code : "
							      		   + orderCommand.getCode() + " , order payment status: "
								   		   + queryResult.getTrade_state() + " ; reason: already paid! ",
								   		       OrderExceptionType.ALREADY_PAY_BY_THIRDPART, orderCommand);
								    }else if(OrderQueryResponseCommand.TRADE_STATE_CLOSED.equals(queryResult.getTrade_state()))
								    	isNotNeedClose =true;
						        }
							} catch (WechatException e) {
								// The exception of the order query is not processed additionally, only the log is recorded
								LOGGER.error("warn: validateCancel exception: orderCode:" + orderCommand.getCode() + "," + e.getMessage(), e);
							}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326572623&siteId=291194637