은생보 대납 및 게이트웨이 채널

34141 단어
1、Channels.java
은생보 결제 채널 증가UNSPAY(10018,"10018"," ");2、channel-unspay.peoperties
url 관련 설정 대납 및 스위치 증가MP\:CLOUD\:TRADE\:UNSPAY\:TRADE-ORDERQUERY\:TIME=120000,300000,600000,900000,1800000cloud.unspay.pay.url=http://180.166.114.155/unspay/ cloud.unspay.withdraw.url=http://180.166.114.155:7181/delegate-pay-front-dp/delegatePay/ cloud.unspay.withdraw.timeout=10000
은생보 조회 요청 주소cloud.unspay.gateway.qry.url = http://180.166.114.155/unspay/page/linkbank/netQueryTransStatus.action은생보 결제 요청 주소cloud.unspay.gateway.pay.url = http://180.166.114.155/unspay/page/linkbank/payRequest.do은생보 환불 요청 주소cloud.unspay.gateway.return.url = http://180.166.114.155/unspay/page/netreturn/netReturnRequest.action3、application-common-beans.xml
채널-unspay를 로드합니다.peoperties 파일classpath*:/production/channel-unspay.propertiesclasspath*:/development/channel-unspay.propertiesclasspath*:/test/channel-unspay.properties4、UnspayWithdrawService.java
은생보 현금인출(대납) 서비스
 @Override 
 public WithdrawResult widthraw(WithdrawParam req, MpWithdrawTradeOrder tradeOrder, JSONObject channelConfig) {
         String cpOrderNo = tradeOrder.getCpOrderNo();
         LogHelper.info(logger, "   -    ,     :{},    ( ):{}", cpOrderNo, req.getAmount());
         CommonThirdChannelConfig pinganpayChannelConfig = JSONObject.toJavaObject(channelConfig,
         CommonThirdChannelConfig.class);
         //  UnspayWithdrawHelper  requestWithdraw()  
         WithdrawResult result =  helper.requestWithdraw(tradeOrder, pinganpayChannelConfig);
         LogHelper.info(logger, "   -    ,     :{},    :{}", cpOrderNo, result);
         return result;
 }
@Override
public void updateResult(MpWithdrawTradeOrder tradeOrder, WithdrawResult result) {
}

5、UnspayWithdrawQueryService.java
은생보 대부 조회 서비스
@Override
public WithdrawResult query(MpWithdrawTradeOrder tradeOrder, JSONObject channelConfig) {
    logger.info("   -      -     :{},      :{}", tradeOrder.getOutOrderNo(), tradeOrder.getCpOrderNo());
    CommonThirdChannelConfig commonThirdChannelConfig = JSONObject.toJavaObject(channelConfig,CommonThirdChannelConfig.class);
    //  UnspayWithdrawHelper  requestWithdrawQuery()
    WithdrawResult result=helper.requestWithdrawQuery(tradeOrder.getCpOrderNo(), commonThirdChannelConfig);
    LogHelper.info(logger, "   -      ,     :{},    :{}", tradeOrder.getCpOrderNo(), result);
    return result;
}

6、UnspayWithdrawHelper.java
대체 요청 실행: requestWithdraw
public WithdrawResult requestWithdraw(MpWithdrawTradeOrder tradeOrder, CommonThirdChannelConfig channelConfig) {
    String respText = cloudPlatformHelper.request(withdrawUrl + "pay", linkText);}

대리 지불 질의 시작: requestWithdrawQuery
public WithdrawResult requestWithdrawQuery(String cpOrderNo, CommonThirdChannelConfig channelConfig) {}

7、UnspaySignUtil.java
서명 도구 클래스
    /**
     *                  
     */
    public static String createLinkText(Map map) {
        String signText = "";
        for (Map.Entry entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            if (StringUtils.isNotBlank(value)) {
                signText += key + "=" + value + "&";
            }
        }
        if (StringUtils.isNotBlank(signText)) {
            signText = StringUtils.substringBeforeLast(signText, "&");
        }
        return signText;
    }

     /**
     *   
     */
    public static String sign(Map map, String key) {
        if (CollectionUtils.isEmpty(map) || StringUtils.isBlank(key)) throw new NullPointerException();
        String signText = createLinkText(map);
        return Md5SignUtils.createSignInfo(key, signText);
    }

    /**
     *   
     */
    public static Boolean verify(Map map, String signInfo, String key) {
        if (CollectionUtils.isEmpty(map) || StringUtils.isBlank(key)) throw new NullPointerException();
        String signText = createLinkText(map);
        return signInfo.equals(Md5SignUtils.createSignInfo(key, signText));
    }
    /**
    *  values        key-value   map  
   */
    public static HashMap parseLine(String line, String[] fields, char split)   {
        if (line != null && !"".endsWith(line)) {
            String[] values = line.replaceAll("\\" + split + "\\" + split, split + " " + split + " ").replaceAll("\\" + split + "$", split + " ").split("\\" + split);
            if (values.length != fields.length) {
                throw new NumberFormatException("      !");
            } else {
                HashMap map = new HashMap();
                for(int i = 0; i < fields.length; ++i) {
                    map.put(fields[i], values[i] != null ? values[i].trim() : null);
                }
                return map;
            }
        } else {
            return null;
        }
    }
    /**
     *         key
     */
    public static String sign2(Map map, String key) {
        if (CollectionUtils.isEmpty(map) || StringUtils.isBlank(key)) throw new NullPointerException();
        String signText = createLinkText2(map);
        return Md5SignUtils.createSignInfo2(key, signText);
    }

    /**
     *         map
     */
    public static Boolean verify2(Map map, String signInfo, String key) {
        if (CollectionUtils.isEmpty(map) || StringUtils.isBlank(key)) throw new NullPointerException();
        String signText = createLinkText2(map);
        String mac = SecurityUtils.md5(signText).toUpperCase();
        return signInfo.equals(mac)? true:false;
    }
    /**
     *         String
     */
    public static Boolean verify3(String signText ,String signInfo, String key) {
        if ( "null".equals(signText) || StringUtils.isBlank(key)) throw new NullPointerException();
        String mac = SecurityUtils.md5(signText).toUpperCase();
        return signInfo.equals(mac)? true:false;
    }
    /**
     *                   
     */
    public static String createLinkText2(Map map) {
        String signText = "";
        for (Map.Entry entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            signText += key + "=" + value + "&";
        }
        if (StringUtils.isNotBlank(signText)) {
            signText = StringUtils.substringBeforeLast(signText, "&");
        }
        return signText;
    }

8、UnspayWithdrawNotifyExecutor.java
증가 은생보 대부 결과 통지
@Override
   public String parseNotifyResult(String channelCode, String platformTradeNo, HttpServletRequest request) {
       Map resultMap = request.getParameterMap();
       if (resultMap == null || resultMap.isEmpty()) {
           throw new CloudApiException(CloudApiErrorCode.SYSTEM_ERROR, "     null");
       }

       LogHelper.info(logger, "   -      -    :{},  id:{},    :{}", resultMap, platformTradeNo, resultMap.get("orderId"));

       MpWithdrawTradeOrder tradeOrder = withdrawTradeOrderDao.queryMpWithdrawTradeOrderByCP(platformTradeNo);

       if (null == tradeOrder || !tradeOrder.getChannelPayId().equals(Channels.UNSPAY.value())) {
           throw new CloudApiException(CloudApiErrorCode.SYSTEM_ERROR, "      ");
       }

       //       
       if (!TradeStatus.DOING.name().equals(tradeOrder.getStatus())) {
           LogHelper.info(logger, "   -      ,   id:{},     ", platformTradeNo);
           return "SUCCESS";
       }

       JSONObject mchChannelConfig = sysPayChannelMchConfigService
               .findChannelMchConfigBySysMchId(tradeOrder.getSysMchId());
       CommonThirdChannelConfig channelConfig = JSON.toJavaObject(mchChannelConfig, CommonThirdChannelConfig.class);

       //      
       Map signMap=new LinkedHashMap<>();
       signMap.put("accountId", channelConfig.getMchNo());
       signMap.put("orderId",resultMap.get("orderId")[0]);
       signMap.put("amount",resultMap.get("amount")[0]);
       signMap.put("result_code",resultMap.get("result_code")[0]);
       signMap.put("result_msg",resultMap.get("result_msg")[0]);
       signMap.put("key",channelConfig.getSignKey());
       String mac = resultMap.get("mac")[0];

       if (!UnspaySignUtil.verify2(signMap, mac, channelConfig.getSignKey())) {
           LogHelper.info(logger, "   -      ,   id:{},    ", platformTradeNo);
           throw new CloudApiException(CloudApiErrorCode.SYSTEM_ERROR, "    ");
       }

       String status = CloudApiConstants.RESULT_CODE_FAIL;
       String resultCode = signMap.get("result_code");
       String resultMsg = signMap.get("result_msg");
       // 0000:    ;  :    
       if (UnspayWithdrawHelper.RESULT_CODE_SUCCESS.equals(resultCode)) {
           status = CloudApiConstants.RESULT_CODE_SUCCESS;
       }

       MpChannelInfoVO channelInfo = mpChannelInfoService.findById(tradeOrder.getChannelId());
       //     
       t0TradeHelpService.dealWithdrawResult(tradeOrder, channelInfo.getAccountNo(), status, resultMsg);

       return "SUCCESS";
   }

알림 결과를 처리한 후, 동결해제 금액을 실행하려면 T0TradeHelp 서비스를 호출하십시오.dealWithdrawResult(), 인출 한도 업데이트
9. 관련 프로필
1.api.properties
관련 url 설정
2.redis.properties
캐시 구성
#------------------Cache  Service config---------------------------------
CacheService=redisCacheService
#------------------redis start---------------------------------
redis.host=127.0.0.1
redis.port=6379
redis.pass=
redis.default.db=6  
redis.timeout=10000
redis.maxTotal=1024
redis.maxIdle=100
redis.maxWaitMillis=1000
redis.testOnBorrow=true
#------------------redis end-----------------------------------

3.jdbc.properties
데이터베이스 구성
#dev      sft-sx-bank   
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.1.10:3306/sft-sx-bank?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&autoReconnect=true
jdbc.username=root
jdbc.password=ENC(0qhNBFW3zM3zrK3V+bWf8URWtl1+ULE8)

4.web.xml
시스템 프로필spring.profiles.default의 값은 서비스-lts-jobclient-beans에 대응합니다.xml
    
    
        spring.profiles.default
            
        development,trade,task
    

5.task-trade.properties task-lts.properties
lts 폴링 구성 파일
task-trade.properties:    ip
lts.tasktracker.cluster-name=test_cluster
lts.tasktracker.registry-address=zookeeper://192.168.1.99:2181
lts.tasktracker.work-threads=12
lts.tasktracker.node-group=cloud_trade_TaskTracker
#lts.tasktracker.dispatch-runner.enable=true
#lts.tasktracker.dispatch-runner.shard-value=taskId
lts.tasktracker.configs.job.fail.store=mapdb

#task setting
cloudTrackerNodeGroup=cloud_trade_TaskTracker
task-lts.properties:    ip,          
lts.jobclient.cluster-name=test_cluster
lts.jobclient.registry-address=zookeeper://192.168.1.99:2181
lts.jobclient.node-group=test_jobClient
lts.jobclient.use-retry-client=true
lts.jobclient.configs.job.fail.store=mapdb

lts.tasktracker.cluster-name=test_cluster
lts.tasktracker.registry-address=zookeeper://192.168.1.99:2181
lts.tasktracker.work-threads=18
lts.tasktracker.node-group=test_trade_TaskTracker
#lts.tasktracker.dispatch-runner.enable=true
#lts.tasktracker.dispatch-runner.shard-value=taskId
lts.tasktracker.configs.job.fail.store=mapdb

#         
cron.task.jobs.enabled=false
cron.task.apjobs.enabled=false

#task setting
taskTrackerNodeGroup=test_trade_TaskTracker

10. 은생보 게이트웨이 관련 코드
1.UnspayTradeOrder.java
상점->은생보망 인터페이스에서 Bean을 주문합니다.BaseTradeOrder가 주문 정보를 만들 때 인삼으로createTradeOrder에 전송하여 주문 주 정보를 생성합니다.
 /**
     *                
     *    :1-    ,2-    ,3-    
     */
    private String responseMode = null;
    /**
     *           
     * false:     true:     [    ]:               v3.0.0   (  )     false   
     *      true,                ,             
     */
    private String assuredPay = null;

    /**
     *                     。   merchantUrl   。
     */
    private String frontURL = null;

    /**
     *    B2B       
     */
    private String b2b = null;

2.IMpTradeOrderExtraUnspayDAO.java
Dao층, 인터페이스, 계승된 IBase Entity DAO는 하위 클래스가 인터페이스를 바꾸지 않고 주로 MpTrade Order Extra Unspay Mapper에 사용된다.xml
 /**
     *   cpTradeNo    
     *
     * @param cpTradeOrder
     * @return
     */
    UnspayTradeOrder findTradeOrderByCpOrderNo(String cpTradeOrder);

3.IMpTradeOrderExtraUnspayService.java
서비스 층, 인터페이스, IbaseBus 서비스, ITrade OrderDtl 서비스 계승
/**
     *         
     *
     * @param tradeOrder
     */
    void createTradeOrder(UnspayTradeOrder tradeOrder);

    /**
     *   cpTradeNo    
     *
     * @param cpTradeNo
     * @return
     */
    UnspayTradeOrder findTradeOrderByCpOrderNo(String cpTradeNo);

4.MpTradeOrderExtraUnspayService.java
BaseBus 서비스를 계승하여 ImpTradeOrderExtraUnspay 서비스 인터페이스를 실현하였다

    @Autowired
    private IMpTradeOrderExtraUnspayDAO dao;
    @Autowired
    private IMpTradeOrderService tradeOrderService;

    @Override
    public void createTradeOrder(UnspayTradeOrder tradeOrder) {
        MpTradeOrderVO baseTradeOrder = BeanMapper.map(tradeOrder, MpTradeOrderVO.class);
        MpTradeOrderExtraUnspay tradeOrderExtraUnspay = BeanMapper.map(tradeOrder, MpTradeOrderExtraUnspay.class);
        //        
        tradeOrderService.createTradeOrder(baseTradeOrder);
        //           
        dao.insert(tradeOrderExtraUnspay);
    }

    /**
     *   cpTradeNo    
     *
     * @param cpTradeNo
     * @return
     */
    public UnspayTradeOrder findTradeOrderByCpOrderNo(String cpTradeNo) {
        return dao.findTradeOrderByCpOrderNo(cpTradeNo);
    }

5.MpTradeOrderExtraUnspay.java
확장표 실체류, 위에서 호출
/**
     * id db_column: ID
     */
    private String id;

    /**
     *     
     */
    private String accessType;

    private String callbackUrl;
    private String notifyUrl;

6.MpTradeOrderExtraUnspayVO.java
은생보 결제 확대 정보
 private Integer mchId;
    private String mchNo;
    private String mchName;
    private String mchOrderNo;
    private String cpOrderNo;
    private Integer paymentTypeId;
    private Date tradeTime;
    private String cur;
    private BigDecimal amt;
    private String status;
    private String chmRefundNo;
    private BigDecimal refundAmt;
    private String refundStatus;
    private String sysMchNo;
    private String cpRefundNo;
    private Integer refundTimes;
    private String rmk;
    private String postscript;
    private String summary;
    /**
     *      
     */
    private String chargeRateType;
    /**
     *   
     */
    private BigDecimal chargeRate;
    /**
     *    
     */
    private BigDecimal chargeAmt;
    /**
     *       
     */
    private BigDecimal refundChargeAmt;
    private Date channelRefundTime;
    private String handCheckSign;
    private Date channelPayTime;

7.CloudApiUnspayPayParam.java
은생보 인터페이스 결제 요청 내용, 주문 방법 구축build에서 주문 기초 정보 구축과 주문 확대 정보 구축에 사용
 private static final long serialVersionUID = 1L;
    /**
     *    
     */
    private String version;
    /**
     *            
     */
    private String responseMode;
    /**
     *           
     */
    private String assuredPay;
    /**
     * MAC 
     */
    private String mac;
    /**
     *     
     */
    private String merchantKey  ;

8.UnspayGatewayNotifyResult.java
TradeChannelResult 상속 Enhance 게이트웨이 비동기 알림 내용
    /**
     *     -    
     */
    public final static String TRADE_STATUS_SUCCESS = "0000";
    /**
     *     
     */
    private String merchantId;
    /**
     *          
     */
    private String responseMode;
    /**
     *      
     */
    private String orderId;
    /**
     *     
     */
    private String currencyType;
    /**
     *       
     */
    private BigDecimal amount;
    /**
     *    
     */
    private String returnCode;
    /**
     *     
     */
    private String returnMessage;
    /**
     *     
     */
    private String bankCode ;

9.UnspayTradeContextInfo.java
은생보
public UnspayTradeContextInfo() {
        super();
        this.title = "   ";
    }

    public UnspayTradeContextInfo(String title) {
        super();
        this.title = title;
    }

10.UnspayGatewayOrderExecutor.java
은생보 인터페이스 결제 처리 서비스
  protected Logger logger = LoggerFactory.getLogger(UnspayGatewayOrderExecutor.class);

    @Value("${cloud.pay.callback.unencoding.url}")
    private String callbackUrl; //     
    @Value("${cloud.pay.notify.unencoding.url}")
    private String notifyUrl; //       
    @Value("${cloud.unspay.gateway.pay.url}")
    private String payUrl;

    @Autowired
    private ISysPayChannelMchConfigService sysPayChannelMchConfigService;

    @Override
    protected CloudApiPayResult handleOrder(TradeContextInfo tradeContextInfo) {
        UnspayTradeOrder tradeOrder = (UnspayTradeOrder) tradeContextInfo.getTradeOrder();
        String platformTradeInfoText = cacheService.get(CloudApiConstants.CACHE_KEY_CLOUD_TRADE_PLATFORM_TRADE_INFO_PREFIX + tradeOrder.getId());
        ................
        String responeBody = CommonHelper.createAutoFormHtml(payUrl, paramsMap); //        Html  
        logger.info("       -    form    :{}", responeBody);
        CloudApiPayResult cloudApiPayResult = new CloudApiPayResult(CloudApiConstants.RESULT_CODE_SUCCESS);
        cloudApiPayResult.setResponseBody(responeBody);
        return cloudApiPayResult;
    }

    @Override
    protected String getTradeType() {
        return "unspayGateway";
    }

    @Override
    protected TradeContextInfo getTradeContextInfo() {
        return new UnspayTradeContextInfo("     ");
    }

    @Override
    protected Class getTradeOrderClazz() {
        return UnspayTradeOrder.class;
    }

11.CloudUnspayNotifyListener.java
은생보 게이트웨이 결제 백엔드 알림
 @Autowired
    IMpMchPayChannelConfigService mchPayChannelConfigService;

    @Override
    protected CloudApiPayResult getDefaultNotifyResult(String payTypeCode, String platformTradeNo, HttpServletRequest request) {
        CloudApiPayResult cloudApiPayResult = new CloudApiPayResult();
        cloudApiPayResult.setResponseBody("success");
        return cloudApiPayResult;
    }

    @Override
    protected UnspayGatewayNotifyResult parseResult(String notifyType, PlatformTradeNoInfo platformTradeNoInfo, HttpServletRequest request) {
        UnspayGatewayNotifyResult notifyResult = new UnspayGatewayNotifyResult();
        CommonThirdChannelConfig channelConfig = mchPayChannelConfigService.findCommonThirdMchPayChannelConfig(platformTradeNoInfo.getSysMchNo());

        try {

            //            
            try {
                request.setCharacterEncoding("UTF-8");
            } catch (UnsupportedEncodingException e) {
                LogHelper.info(logger, "  Request    :{}", e.getMessage());
            }
            Map params = request.getParameterMap();
            String data = null;
                data = JSON.toJSONString(RequestUtils.getRequestMapValue(params));
            JSONObject jsonObject = JSONObject.parseObject(data);
            //  json  

            String retCode = jsonObject.getString("returnCode");
            String retMsg = jsonObject.getString("returnMessage");
            String mac = jsonObject.getString("mac");

      
        return notifyResult;
    }

12.UnspayGatewayNotifyExecutor.java
은생보 게이트웨이 결제 결과 백엔드 알림, CloudUnspay Notify Listener 호출

    private Logger logger = LoggerFactory.getLogger(UnspayGatewayNotifyExecutor.class);

    @Override
    public CloudApiPayResult execute(PlatformTradeNoInfo platformTradeNoInfo, UnspayGatewayNotifyResult channelResult) {
        logger.info("     -      -  ,      :{},     :{}", platformTradeNoInfo.getCpOrderNo(), channelResult);
        UnspayTradeContextInfo tradeContextInfo = new UnspayTradeContextInfo();
        //        
        TradePlatformResult tradePlatformResult = parsePayResult(tradeContextInfo, platformTradeNoInfo, channelResult);
        logger.info("     -      ,      :{},       :{}", platformTradeNoInfo.getCpOrderNo(), tradePlatformResult);

        tradeContextInfo.setTradePlatformResult(tradePlatformResult);
        //     
        TradeFinishState tradeFinishState = ApplicationContextHolder.getBean(TradeOrderFinisher.class).execute(tradeContextInfo, UnspayTradeOrder.class);

        CloudApiPayResult cloudApiPayResult = new CloudApiPayResult();
        if (tradeFinishState == TradeFinishState.LOCKED) {
            cloudApiPayResult.setResponseBody("error");
        } else { //   
            cloudApiPayResult.setResponseBody("00");
        }
        logger.info("     -      -  ,      :{},     :{}", platformTradeNoInfo.getCpOrderNo(), cloudApiPayResult);
        return cloudApiPayResult;
    }

    /**
     *       
     * @param tradeContextInfo
     * @param platformTradeNoInfo
     * @param channelResult
     * @return
     */
    private TradePlatformResult parsePayResult(UnspayTradeContextInfo tradeContextInfo, PlatformTradeNoInfo platformTradeNoInfo, UnspayGatewayNotifyResult channelResult) {
      .....
    }

13.UnspayGatewayCallbackExecutor.java
은생보 게이트웨이 전단 알림 처리
@Autowired
    private IMpTradeOrderExtraUnspayService mpTradeOrderExtraUnspayService;

    @Override
    public CloudApiPayResult execute(PlatformTradeNoInfo platformTradeNoInfo, UnspayGatewayNotifyResult channelResult) {
        logger.info("     -      -  ,      :{},     :{}", platformTradeNoInfo.getCpOrderNo(), channelResult);
        
        UnspayTradeOrder tradeOrder = mpTradeOrderExtraUnspayService.findTradeOrderByCpOrderNo(platformTradeNoInfo.getCpOrderNo());
        return renderCallback(tradeOrder);
    }

14.UnspaySubmerchantCreateHanlder.java
opp 상점 입주 처리류
    @Override
    public SubmerchantCreateResult execute(SubmerchantCreateParam param) {
        return null;
    }
    @Override
    protected SubmerchantCreateResult parseMerchantResponse(MpMerchantInfoVO merchantInfo,
    }
    @Override
    protected SubmerchantCreateResult parsePollMerchantResponse(MpUpMerchantInfoRecordVO merchantInfo,
            BasePayChannelConfig basePayChannelConfig, String reponseBody) {
    }
    @Override
    protected Map createMerchantRequestParam(MpMerchantInfoVO merchantInfo, String payTypes,
            BasePayChannelConfig basePayChannelConfig, String subMchId) {
        return null;
    }
    @Override
    protected Map createPollMerchantRequestParam(MpUpMerchantInfoRecordVO upMerchantInfoRecordVO,
            String payTypes, BasePayChannelConfig basePayChannelConfig, String subMchId) {
        return null;
    }
    @Override
    protected String execute(String merchantNo, Map param, BasePayChannelConfig channelConfig) {
        return null;
    }
    @Override
    protected String getTitle() {
        return "   -  ";
    }
    @Override
    protected BasePayChannelConfig getPayChannelConfig(Integer sysMchId, Integer channelPayId) {
        return null;
    }

15.UnspayTradePreOrderExecutor.java
주문 사전 처리, 주문 조회 작업 생성
  @Override
    //         
    protected void createTradeQueryTask(UnspayTradeContextInfo tradeContextInfo) {
        BaseTradeOrder tradeOrder = tradeContextInfo.getTradeOrder();
        String cpOrderNo = tradeOrder.getCpOrderNo(); //   
        LogHelper.info(logger, "{}-        -     :{}", tradeContextInfo.getTitle(), cpOrderNo);
        //       
        NotifyInfo notifyInfo = new NotifyInfo();
        notifyInfo.setNotifyContent(tradeOrder.getCpOrderNo());
        notifyInfo.setBusType(CloudApiConstants.TASK_BUS_TYPE_CLOUD_CHANNEL_TRADE_QUERY);
        notifyInfo.setBusKey(tradeOrder.getId());
   notifyInfo.setNotifyQueuePrefix(CloudApiConstants.CLOUD_TRADE_ORDER_UNSPAY_QUERY_QUEUE_PREFIX);
        notifyInfo.setNotifyHookName("tradePreOrderExecutor_10018_gateway");
        supportFacade.submitContinueRepeatJob(notifyInfo);
    }
    @Override
    protected void handlePayment(UnspayTradeContextInfo tradeContextInfo) {
        //      db
        tradeOrderExtraUnspayService.createTradeOrder((UnspayTradeOrder) tradeContextInfo.getTradeOrder());
    }

16.UnspayTradeOrderBuilder.java
주문 작성 시 호출됨
@Override
    public void buildExtraData(CloudApiUnspayPayParam reqParam, UnspayTradeOrder tradeOrder, TradeContextInfo tradeContextInfo) {
       //  responseMode                 
        // assuredPay            
        // mac  
    }
    @Override
    protected UnspayTradeOrder newTradeOrder(CloudApiUnspayPayParam reqParam, TradeContextInfo tradeContextInfo) {
        return new UnspayTradeOrder();
    }

17.UnspayGatewayRequest.java
은생보 인터페이스 조회 상위 지불 결과 서비스
        /**
     *     
     */
    private static final String STATUS_SUCCESS = "3";
    /**
     *     -   
     */
    private static final String STATUS_PROCCESS = "0";
    /**
     *     -    
     */
    private static final String STATUS_FAIL = "4";
    @Value("${cloud.unspay.gateway.qry.url}")
    private String qryUrl;
    @Autowired
    private ISysPayChannelMchConfigService sysPayChannelMchConfigService;
    @Autowired
    private CloudPlatformHelper cloudPlatformHelper;
    @Override
    public TradePlatformResult requestRefundOrder(TradeContextInfo tradeContextInfo) {
        // TODO     ,   
        return null;
    }
    @Override
      //    
    public TradePlatformResult requestQueryOrder(TradeContextInfo tradeContextInfo) {
        BaseTradeOrder tradeOrder = tradeContextInfo.getTradeOrder();
        JSONObject mchChannelConfig = sysPayChannelMchConfigService
                .findChannelMchConfigBySysMchId(tradeOrder.getSysMchId());
        CommonThirdChannelConfig channelConfig = JSON.toJa
    }
    /**
     *         
     */
    private Map doRequest(UnspayTradeOrder tradeOrder, Map paramsMap,
            CommonThirdChannelConfig channelConfig) {
    }
    /**
     *         
     */
    private TradePlatformResult parse2platformResult(Map respMap) {
    }

18.MpTradeOrderExtraUnspayMapper.xml
mybatis 파일




    
        
        
        
        
    
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    

11. 공통 구성
1.CloudPlatformHelper.java
클라우드 플랫폼 도구 유형
        //       
        tradeTypeNoMapper.put(Channels.UNSPAY.code(), "16");
        logger.info("         ");
        executor = new ThreadPoolExecutor(notifyPoolCorePoolSize, notifyPoolMaximumPoolSize, notifyPoolKeepAliveTime, TimeUnit.MINUTES, workQueue);

2.UnPaidTradeOrderCleaner.java
        //       
        queryQueueMapper.put(Channels.UNSPAY.code(), CloudApiConstants.CLOUD_TRADE_ORDER_UNSPAY_QUERY_QUEUE_PREFIX);
         //       
        queryNotifyHookNameMapper.put(Channels.UNSPAY.code(), "tradePreOrderExecutor_10018_gateway");

3.TradeOrderDtlSupport.java
 @Autowired
        private IMpTradeOrderExtraUnspayService mpTradeOrderExtraUnspayService;
        //       
        mapper.put(Channels.UNSPAY.code(), mpTradeOrderExtraUnspayService);

4.CloudApiConstants.java
     /**
     *              key  
     */
    String CLOUD_TRADE_ORDER_UNSPAY_QUERY_QUEUE_PREFIX = "MP:CLOUD:TRADE:UNSPAY:TRADE-ORDER-QUERY:TIME";

5.TradePayTypeHandlerFactory.java
       //       
        payTypePreOrderMapper.put(Channels.UNSPAY.code(), "unspayTradePreOrderExecutor"); //      
        payTypeOrderMapper.put(Channels.UNSPAY.code(), "unspayGatewayOrderExecutor");   //            
        payTypeNotifyMapper.put(Channels.UNSPAY.code(), "unspayGatewayNotifyExecutor"); //    
        payTypeCallbackMapper.put(Channels.UNSPAY.code(), "unspayGatewayCallbackExecutor"); //           
        reqParamTypeMapper.put(Channels.UNSPAY.code(), CloudApiUnspayPayParam.class);
        payTypeRefundMapper.put(Channels.UNSPAY.code(),"tfbGatewayTradeRefundExecutor"); //    

12.은생보 환불
환불이 일시적으로 지원되지 않음
1.UnspayGatewayTradeRefundExecutor.java
@Autowired
    private ISysPayChannelMchConfigService sysPayChannelMchConfigService;
    @Override
    protected TradeContextInfo createTradeContextInfo() {
        return new UnspayTradeContextInfo();
    }
    @Override
    protected ITradeRefundRequest getTradeRefundRequest(TradeContextInfo tradeContextInfo) {
       return ApplicationContextHolder.getBean(UnspayGatewayTradeRefundRequest.class);
    }
    @Override
    protected CommonThirdChannelConfig getPayChannelConfig(TradeContextInfo tradeContextInfo) {
        JSONObject mchChannelConfig = sysPayChannelMchConfigService.findChannelMchConfigBySysMchId(tradeContextInfo.getSysMchInfoVO().getId());
        return JSON.toJavaObject(mchChannelConfig, CommonThirdChannelConfig.class);
    }
    @Override
    protected String getTaskNotifyQueuePrefix() {
        return CloudApiConstants.CLOUD_REFUND_ORDER_QUERY_QUEUE_PREFIX;
    }
    @Override
    protected String getTaskNotifyHookName() {
        return "UnspayGatewayTradeRefundExecutor";
    }

2.UnspayGatewayTradeRefundRequest.java
은생보 게이트웨이 환불 요청 서비스
  private Logger logger = LoggerFactory.getLogger(UnspayGatewayTradeRefundRequest.class);
    private static final String charset = "GBK";
    @Value("${cloud.unspay.gateway.refund.url}")
    private String refundUrl;
    @Value("${cloud.unspay.gateway.qry.url}")
    private String refundQryUrl;
    @Autowired
    private CloudPlatformHelper cloudPlatformHelper;
    @Autowired
    private SysPayChannelMchConfigService sysPayChannelMchConfigService;
    /**
     *          
     */
    @Override
    public TradePlatformResult requestRefundOrder(TradeContextInfo tradeContextInfo) {
     .............
    }
    /**
     *            
     */
    @Override
    public TradePlatformResult requestQueryOrder(TradeContextInfo tradeContextInfo) {
       return null;
    }

좋은 웹페이지 즐겨찾기