package com.stylefeng.guns.modular.cloudPayment.example;
|
|
import com.stylefeng.guns.modular.system.model.TEnterpriseWithdrawal;
|
import com.stylefeng.guns.modular.system.util.UUIDUtil;
|
import com.unionpay.upyzt.Upyzt;
|
import com.unionpay.upyzt.exception.UpyztException;
|
import com.unionpay.upyzt.model.MchApplication;
|
import com.unionpay.upyzt.resp.MchApplicationResp;
|
import com.unionpay.upyzt.resp.MchApplicationStoreResp;
|
import com.unionpay.upyzt.util.StringUtils;
|
import lombok.extern.slf4j.Slf4j;
|
|
import java.io.Serializable;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
@Slf4j
|
public class MchApplicationExample implements Serializable {
|
|
|
/**
|
* 二级商户首次进件
|
*
|
* @return 返回参数
|
* @throws UpyztException 异常
|
*/
|
public static MchApplicationStoreResp create(TEnterpriseWithdrawal tEnterpriseWithdrawal) throws Exception {
|
|
System.out.println("------------------------"+tEnterpriseWithdrawal.getBusinessLicenseCompanyName());
|
System.out.println("------------------------"+tEnterpriseWithdrawal.getDepositName());
|
|
Map<String, Object> businessLicence = new HashMap<>();
|
businessLicence.put("number", tEnterpriseWithdrawal.getBusinessLicenseCode());
|
businessLicence.put("company_name", tEnterpriseWithdrawal.getBusinessLicenseCompanyName());
|
businessLicence.put("company_address", tEnterpriseWithdrawal.getBusinessLicenseAddress());
|
businessLicence.put("valid_time", tEnterpriseWithdrawal.getBusinessExpireTime());
|
businessLicence.put("copy", tEnterpriseWithdrawal.getCopy1());
|
|
Map<String, Object> legalPersonIdCard = new HashMap<>();
|
legalPersonIdCard.put("type", String.valueOf(tEnterpriseWithdrawal.getCorporateCertificateType()));
|
legalPersonIdCard.put("number", Upyzt.encryptField(tEnterpriseWithdrawal.getCertificateCode()));
|
legalPersonIdCard.put("name", Upyzt.encryptField(tEnterpriseWithdrawal.getCorporateName()));
|
legalPersonIdCard.put("valid_time", tEnterpriseWithdrawal.getCertificateExpireTime());
|
legalPersonIdCard.put("copy", tEnterpriseWithdrawal.getCopy2());
|
legalPersonIdCard.put("national", tEnterpriseWithdrawal.getCopy3());
|
|
Map<String, Object> settleAcct = new HashMap<>();
|
settleAcct.put("type", String.valueOf(tEnterpriseWithdrawal.getAccountType()));
|
settleAcct.put("bank_code", tEnterpriseWithdrawal.getBankCode());
|
settleAcct.put("name", Upyzt.encryptField(tEnterpriseWithdrawal.getDepositName()));
|
// settleAcct.put("bank_address_code", "110105");
|
settleAcct.put("bank_branch_code", tEnterpriseWithdrawal.getBankBranchCode());
|
settleAcct.put("bank_acct_no", Upyzt.encryptField(tEnterpriseWithdrawal.getBankAccount()));
|
|
Map<String, Object> params = new HashMap<>();
|
params.put("out_request_no", tEnterpriseWithdrawal.getOutRequestNo());
|
params.put("organization_type", String.valueOf(tEnterpriseWithdrawal.getEnterpriseType()));
|
params.put("short_name", tEnterpriseWithdrawal.getMerchantAbbreviation());
|
params.put("business_license", businessLicence);
|
params.put("settle_acct", settleAcct);
|
params.put("legal_person_id_card", legalPersonIdCard);
|
params.put("legal_person_mobile_number", Upyzt.encryptField(tEnterpriseWithdrawal.getCorporatePhone()));
|
// 通过[个人手机号验证码]接口获取的短信验证码,用于验证法人手机号; 是否必传取决于平台业务参数配置
|
params.put("sms_code", tEnterpriseWithdrawal.getCode());
|
params.put("contact_mobile_number", Upyzt.encryptField(tEnterpriseWithdrawal.getCorporatePhone()));
|
params.put("contact_email", Upyzt.encryptField(tEnterpriseWithdrawal.getContactsEmail()));
|
params.put("password", Upyzt.encryptField(tEnterpriseWithdrawal.getTransactionAuthorizationCode()));
|
log.info("----------------二级商户首次进件-----------------");
|
log.info("二级商户首次进件:{}",params);
|
log.info("---------------二级商户首次进件------------------");
|
return MchApplication.create(params);
|
}
|
|
/**
|
* 二级商户进件状态查询(系统订单号)
|
*
|
* @return 返回参数
|
* @throws UpyztException 异常
|
*/
|
public static MchApplicationResp retrieveById(String id) throws UpyztException {
|
return MchApplication.retrieveById(id);
|
}
|
|
/**
|
* 修改二级商户信息
|
*
|
* @return 返回参数
|
* @throws UpyztException 异常
|
*/
|
public static MchApplicationResp renew(TEnterpriseWithdrawal tEnterpriseWithdrawal) throws Exception {
|
|
Map<String, Object> businessLicence = new HashMap<>();
|
businessLicence.put("number", tEnterpriseWithdrawal.getBusinessLicenseCode());
|
businessLicence.put("company_name", tEnterpriseWithdrawal.getBusinessLicenseCompanyName());
|
businessLicence.put("company_address", tEnterpriseWithdrawal.getBusinessLicenseAddress());
|
businessLicence.put("valid_time", tEnterpriseWithdrawal.getBusinessExpireTime());
|
businessLicence.put("copy", tEnterpriseWithdrawal.getCopy1());
|
|
Map<String, Object> legalPersonIdCard = new HashMap<>();
|
legalPersonIdCard.put("type", String.valueOf(tEnterpriseWithdrawal.getCorporateCertificateType()));
|
legalPersonIdCard.put("number", Upyzt.encryptField(tEnterpriseWithdrawal.getCertificateCode()));
|
legalPersonIdCard.put("name", Upyzt.encryptField(tEnterpriseWithdrawal.getCorporateName()));
|
legalPersonIdCard.put("valid_time", tEnterpriseWithdrawal.getCertificateExpireTime());
|
legalPersonIdCard.put("copy", tEnterpriseWithdrawal.getCopy2());
|
legalPersonIdCard.put("national", tEnterpriseWithdrawal.getCopy3());
|
|
|
Map<String, Object> settleAcct = new HashMap<>();
|
settleAcct.put("type", String.valueOf(tEnterpriseWithdrawal.getAccountType()));
|
settleAcct.put("bank_code", tEnterpriseWithdrawal.getBankCode());
|
settleAcct.put("name", Upyzt.encryptField(tEnterpriseWithdrawal.getDepositName()));
|
// settleAcct.put("bank_address_code", "110105");
|
settleAcct.put("bank_branch_code", tEnterpriseWithdrawal.getBankBranchCode());
|
settleAcct.put("bank_acct_no", Upyzt.encryptField(tEnterpriseWithdrawal.getBankAccount()));
|
|
Map<String, Object> params = new HashMap<>();
|
params.put("mch_id",tEnterpriseWithdrawal.getMchId());
|
params.put("out_request_no", tEnterpriseWithdrawal.getOutRequestNo());
|
params.put("organization_type", String.valueOf(tEnterpriseWithdrawal.getEnterpriseType()));
|
params.put("short_name", tEnterpriseWithdrawal.getMerchantAbbreviation());
|
params.put("business_license", businessLicence);
|
params.put("settle_acct", settleAcct);
|
params.put("legal_person_id_card", legalPersonIdCard);
|
params.put("legal_person_mobile_number", Upyzt.encryptField(tEnterpriseWithdrawal.getCorporatePhone()));
|
// 通过[个人手机号验证码]接口获取的短信验证码,用于验证法人手机号; 是否必传取决于平台业务参数配置
|
params.put("sms_code", tEnterpriseWithdrawal.getCode());
|
params.put("contact_mobile_number", Upyzt.encryptField(tEnterpriseWithdrawal.getCorporatePhone()));
|
params.put("contact_email", Upyzt.encryptField(tEnterpriseWithdrawal.getContactsEmail()));
|
params.put("password", Upyzt.encryptField(tEnterpriseWithdrawal.getTransactionAuthorizationCode()));
|
return MchApplication.renew(params);
|
}
|
|
/**
|
* 二级商户进件状态查询(平台订单号)
|
*
|
* @return 返回参数
|
* @throws UpyztException 异常
|
*/
|
public static MchApplicationResp retrieveByOutRequestNo(String outRequestNo) throws UpyztException {
|
return MchApplication.retrieveByOutRequestNo(outRequestNo);
|
}
|
|
}
|