xuhy
2025-01-09 712f70b2936079a131ecb1e63c6d337171618cad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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);
    }
 
}