123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package com.ym.mec.thirdparty.yeepay;
- import java.io.IOException;
- import java.util.HashMap;
- import java.util.Map;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.stereotype.Service;
- import com.alibaba.fastjson.JSONObject;
- import com.yeepay.g3.sdk.yop.client.YopRequest;
- import com.yeepay.g3.sdk.yop.client.YopResponse;
- import com.yeepay.g3.sdk.yop.client.YopRsaClient;
- import com.yeepay.g3.sdk.yop.exception.YopClientException;
- import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
- import com.ym.mec.thirdparty.yeepay.entity.MerchantInfo;
- @Service
- public class YeepayMerchantService {
- private static final Logger LOGGER = LoggerFactory.getLogger(YeepayMerchantService.class);
- public JSONObject registerQueryV2(HfMerchantConfig hfMerchantConfig, String requestNo) throws IOException {
- YopRequest request = new YopRequest(hfMerchantConfig.getAppId(), hfMerchantConfig.getRsaPrivateKey());
- request.addParam("requestNo", requestNo);
- YopResponse response = YopRsaClient.get("/rest/v2.0/mer/register/query", request);
- LOGGER.info("易宝[商户入网查询][{}] resp:{}", requestNo, response.getStringResult());
- JSONObject jsonObject = JSONObject.parseObject(response.getStringResult());
- return jsonObject;
- }
- public Map<String, Object> registerSaasMerchantV2(HfMerchantConfig hfMerchantConfig, MerchantInfo merchantInfo, String notifyURL) throws IOException {
- YopRequest request = new YopRequest(hfMerchantConfig.getAppId(), hfMerchantConfig.getRsaPrivateKey());
- request.addParam("requestNo", System.currentTimeMillis() + "");
- request.addParam("businessRole", "SHARE_MERCHANT");
- request.addParam("parentMerchantNo", hfMerchantConfig.getPlatformPayeeMemberId());
- Map<String, String> merchantSubjectInfoMap = new HashMap<String, String>();
- merchantSubjectInfoMap.put("licenceUrl", merchantInfo.getLicenceUrl());
- merchantSubjectInfoMap.put("signName", merchantInfo.getMerchantName());
- merchantSubjectInfoMap.put("signType", merchantInfo.getMerchantType());
- merchantSubjectInfoMap.put("licenceNo", merchantInfo.getLicenceNo());
- merchantSubjectInfoMap.put("shortName", merchantInfo.getMerchantName());
- merchantSubjectInfoMap.put("openAccountLicenceUrl", merchantInfo.getOpenAccountLicenceUrl());
- request.addParam("merchantSubjectInfo", JSONObject.toJSONString(merchantSubjectInfoMap));
- Map<String, String> merchantCorporationInfoMap = new HashMap<String, String>();
- merchantCorporationInfoMap.put("legalName", merchantInfo.getLegalName());
- merchantCorporationInfoMap.put("legalLicenceType", merchantInfo.getLegalLicenceType());
- merchantCorporationInfoMap.put("legalLicenceNo", merchantInfo.getLegalLicenceNo());
- merchantCorporationInfoMap.put("legalLicenceFrontUrl", merchantInfo.getLegalLicenceFrontUrl());
- merchantCorporationInfoMap.put("legalLicenceBackUrl", merchantInfo.getLegalLicenceBackUrl());
- request.addParam("merchantCorporationInfo", JSONObject.toJSONString(merchantCorporationInfoMap));
- Map<String, String> merchantContactInfoMap = new HashMap<String, String>();
- merchantContactInfoMap.put("contactName", merchantInfo.getContactName());
- merchantContactInfoMap.put("contactLicenceNo", merchantInfo.getContactLicenceNo());
- merchantContactInfoMap.put("contactMobile", merchantInfo.getContactMobile());
- merchantContactInfoMap.put("contactEmail", merchantInfo.getContactEmail());
- request.addParam("merchantContactInfo", JSONObject.toJSONString(merchantContactInfoMap));
- request.addParam("industryCategoryInfo", "{ \"primaryIndustryCategory\":\"120\", \"secondaryIndustryCategory\":\"120004\" }");
- Map<String, String> businessAddressInfoMap = new HashMap<String, String>();
- businessAddressInfoMap.put("province", merchantInfo.getProvinceCode());
- businessAddressInfoMap.put("city", merchantInfo.getCityCode());
- businessAddressInfoMap.put("district", merchantInfo.getDistrictCode());
- businessAddressInfoMap.put("address", merchantInfo.getAddress());
- request.addParam("businessAddressInfo", JSONObject.toJSONString(businessAddressInfoMap));
- Map<String, String> settlementAccountInfoMap = new HashMap<String, String>();
- settlementAccountInfoMap.put("settlementDirection", "BANKCARD");
- settlementAccountInfoMap.put("bankCode", merchantInfo.getBankCode());
- settlementAccountInfoMap.put("bankAccountType", merchantInfo.getBankAccountType());
- settlementAccountInfoMap.put("bankCardNo", merchantInfo.getBankCardNo());
- request.addParam("settlementAccountInfo", JSONObject.toJSONString(settlementAccountInfoMap));
- // request.addParam("notifyUrl", notifyURL + "/" + request.getParamValue("requestNo"));
- request.addParam("productInfo", "[{\"productCode\":\"D1\",\"rateType\":\"SINGLE_FIXED\",\"fixedRate\":\"0\",\"paymentMethod\":\"REAL_TIME\"}]");
- //request.addParam("functionService", "[\"SHARE\"]");
- //request.addParam("functionServiceQualificationInfo", "{\"shareScene\":\"FZ_ALL001\"}");
- LOGGER.info("易宝[商户入网] req:{}", request);
-
- YopResponse response = YopRsaClient.post("/rest/v2.0/mer/register/saas/merchant", request);
- LOGGER.info("易宝[商户入网] resp:{}", response.getStringResult());
- JSONObject jsonObject = JSONObject.parseObject(response.getStringResult());
- return jsonObject;
- }
- public void merchantInfoModify(String merchantNo, MerchantInfo merchantInfo, String notifyURL) throws YopClientException {
- }
- }
|