com.ctrip.infosec.rule.resource.TongDun.java Source code

Java tutorial

Introduction

Here is the source code for com.ctrip.infosec.rule.resource.TongDun.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ctrip.infosec.rule.resource;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;

/**
 * ?
 *
 * @author zhengby
 */
public class TongDun {

    static final String serviceName = "ThirdServiceClient";
    static final String operationName_reg = "api.fraudmetrix.cn_RiskServiceRegister";
    static final String operationName_trade = "api.fraudmetrix.cn_RiskServiceTrade";

    /**
     * ?ip??
     *
     * @param ip
     * @param mobile
     * @return
     * {"reason_code":null,"final_decision":"Accept","seq_id":"1442309654522-72705995","final_score":0,"success":true}
     */
    public static Map<String, Object> queryRegEvent(String ip, String mobile) {
        if (StringUtils.isBlank(ip) && StringUtils.isBlank(mobile)) {
            return Collections.EMPTY_MAP;
        }
        Map<String, Object> params = new HashMap<>();
        params.put("account_mobile", mobile);
        params.put("ip_address", ip);
        return DataProxy.queryForMap(serviceName, operationName_reg, params);
    }

    /**
     * ?ip??
     *
     * @param ip
     * @param mobile
     * @return
     * {"reason_code":null,"final_decision":"Accept","seq_id":"1442309654522-72705995","final_score":0,"success":true}
     */
    public static Map<String, Object> queryTradeEvent(String ip, String mobile) {
        if (StringUtils.isBlank(ip) && StringUtils.isBlank(mobile)) {
            return Collections.EMPTY_MAP;
        }
        Map<String, Object> params = new HashMap<>();
        params.put("account_mobile", mobile);
        params.put("ip_address", ip);
        return DataProxy.queryForMap(serviceName, operationName_trade, params);
    }
}