if ("MD5".equalsIgnoreCase(signType)) {
calcSign = md5(signdata + key); //默认MD5
}
-
if (sign.equalsIgnoreCase(calcSign)) {
return true;
}
return false;
}
-
- public boolean checkSign(String key) {
+ private Map getParam(){
Class clazz = this.getClass();
Map<String, String> paramMap = new HashMap<>();
Method[] allGetter = clazz.getMethods();
}
}
}
- return calcSignAndCheck(paramMap, key);
+ return paramMap;
+ }
+
+ public boolean checkSign(String key) {
+ return calcSignAndCheck(getParam(), key);
+ }
+ public void generalSign(String key){
+ String signdata = createLinkString(paraFilter(getParam()));
+ String sign = md5(signdata + key);
+ this.sign = sign;
}
public abstract boolean checkParam() throws RequestParamCheckException;
import com.supwisdom.dlpay.api.bean.*;
import com.supwisdom.dlpay.paysdk.ApiLoginHelper;
-import com.supwisdom.dlpay.paysdk.proxy.ApiCommonProxy;
-import com.supwisdom.dlpay.paysdk.proxy.ApiLoginProxy;
-import com.supwisdom.dlpay.paysdk.proxy.CitizenCardPayProxy;
-import com.supwisdom.dlpay.paysdk.proxy.ShopProxy;
+import com.supwisdom.dlpay.paysdk.proxy.*;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@Autowired
private ShopProxy shopProxy;
+ @Autowired
+ private UserProxy userProxy;
@org.junit.Test
public void citizencardPayinit() {
assertThat("shop open " + response.getRetmsg() + response.getException(),
response.getRetcode(), equalTo(0));
}
+ @Test
+ public void openUserAccount(){
+
+ ApiLoginHelper helper = new ApiLoginHelper(apiLoginProxy);
+ helper.login(appid, secret);
+ ApiVersionResponse version = apiCommonProxy.apiVersion();
+
+ assertThat("get version error " + version.getException(),
+ version.getVersion(), notNullValue());
+ OpenUserParam param = new OpenUserParam();
+ param.setUid("testuid1");
+ param.setIdtype("student_idcard");
+ param.setIdno("100016");
+ param.setName("100016");
+ param.setTenantid("default");
+ param.generalSign(secret);
+ System.out.println(param.getSign());
+ UserResponse response = userProxy.openAccount(param);
+ assertThat("user open " + response.getRetmsg() + response.getException(),
+ response.getRetcode(), equalTo(0));
+ }
public static void main(String[] args) {