电商收付通系列⑤,商户进件之二级商户进件申请

举报
悟空码字 发表于 2023/06/10 09:29:55 2023/06/10
【摘要】 用户提交商家进件资料后,电商平台可使用该接口,帮助其二级商户进件成为微信支付商户。

大家好,我是小悟

1、介绍

用户提交商家进件资料后,电商平台可使用该接口,帮助其二级商户进件成为微信支付商户。

2、敏感信息加密

有些字段需要先加密处理再传入,否则调用接口会报错。

商户需先在【商户平台】->【API安全】的页面设置该密钥,请求才能通过微信支

付的签名校验。密钥的长度为32个字节。APIv3密钥属于敏感信息,请妥善保管不

要泄露,如果怀疑信息泄露,请重设密钥。

3、创建参数实体

按文档创建参数实体类。

参数实体ApplyParam:

@Data
public class ApplyParam {

    /**
     * 业务申请编号 必填
     */
    private String out_request_no;
    /**
     * 主体类型 必填
     */
    private String organization_type;
    /**
     * 营业执照/登记证书信息 条件选填
     */
    private BusinessLicenseInfo business_license_info;
    /**
     * 组织机构代码证信息 条件选填
     */
    private OrganizationCertInfo organization_cert_info;
    /**
     * 经营者/法人证件类型 非必填
     */
    private String id_doc_type;
    /**
     * 经营者/法人身份证信息 条件选填
     */
    private IdCardInfo id_card_info;
    /**
     * 经营者/法人其他类型证件信息 条件选填
     */
    private IdDocInfo id_doc_info;
    /**
     * 是否填写结算账户信息 必填
     */
    private Boolean need_account_info;
    /**
     * 结算账户信息 条件选填
     */
    private AccountInfo account_info;
    /**
     * 超级管理员信息 必填
     */
    private ContactInfo contact_info;
    /**
     * 店铺信息 必填
     */
    private SalesSceneInfo sales_scene_info;
    /**
     * 商户简称 必填
     */
    private String merchant_shortname;
    /**
     * 特殊资质 非必填
     */
    private String qualifications;
    /**
     * 补充材料 非必填
     */
    private String business_addition_pics;
    /**
     * 补充说明 非必填
     */
    private String business_addition_desc;

}
参数实体AccountInfo:
@Data
public class AccountInfo {

    private String bank_account_type;
    private String account_bank;
    private String account_name;
    private String bank_address_code;
    private String bank_branch_id;
    private String bank_name;
    private String account_number;
}
参数实体BusinessLicenseInfo:
@Data
public class BusinessLicenseInfo {

    private String business_license_copy;
    private String business_license_number;
    private String merchant_name;
    private String legal_person;
    private String company_address;
    private String business_time;
}
参数实体ContactInfo:
@Data
public class ContactInfo {

    private String contact_type;
    private String contact_name;
    private String contact_id_card_number;
    private String mobile_phone;
    private String contact_email;
}
参数实体IdCardInfo:
@Data
public class IdCardInfo {

    private String id_card_copy;
    private String id_card_national;
    private String id_card_name;
    private String id_card_number;
    private String id_card_valid_time;
}
参数实体IdDocInfo:
@Data
public class IdDocInfo {

    private String id_doc_name;
    private String id_doc_number;
    private String id_doc_copy;
    private String doc_period_end;
    private String need_account_info;
}
参数实体OrganizationCertInfo:
@Data
public class OrganizationCertInfo {

    private String organization_copy;
    private String organization_number;
    private String organization_time;
    private String id_doc_type  ;
}
参数实体SalesSceneInfo:
@Data
public class SalesSceneInfo {

    private String store_name;
    private String store_url;
    private String store_qr_code;
}

4、发起请求

public static JSONObject applyments(ApplyParam param) {

  String requestParam = JSON.toJSONString(param);

  logger.info("applyments param:{}",requestParam);

  HttpResponse response = HttpUtils.v3HttpExecute("POST",EcommerceUrl.APPLYMENTS,
          "自己系统的应用名称","服务商商户号","商户API证书序列号","平台证书序列号",requestParam,"商户API证书位置.pem",null);
          
  JSONObject body = JSONObject.parseObject(response.body());

  logger.info("applyments heads result:{}",response.headers());

  logger.info("applyments body result:{}",body);

  return body;
}

5、测试

敏感信息要使用微信支付平台证书加密,否则会报“平台私钥解密失败”的错

public static void main(String[] args) {
  ApplyParam param = new ApplyParam();
  param.setOut_request_no(System.currentTimeMillis()+"");
  param.setOrganization_type("2401");

  param.setId_doc_type("IDENTIFICATION_TYPE_MAINLAND_IDCARD");

  IdCardInfo idCardInfo = new IdCardInfo();
  idCardInfo.setId_card_copy("SisPNr_iXhGsRplvdY57L15mng49LodEpUJe8ou3o22g_aOIs9Mni3QR7K-3SC67eoOKbemPCQHqruckzq3MEWDdx9tnqNqIgV1uwuSNtDo");
  idCardInfo.setId_card_national("RXjKrNBlqMxFx0jSD_noRzgHLOUeoOKbemPCQHqrSisPC4GItlsQ9xRUP-8TfFLw7VUcC8VdyxJEVlHMNr_o1Rc5AHe5iskLiSZDlPcruKM");
  //该字段需进行加密处理
  idCardInfo.setId_card_name("g3i0pmX96QjI8qkNdFFkLSaOr0z5QWsAKGGMAPqqxG9fXnh81sZinQRNXliZnwiWh2DLQpoo9azM89x9fg+epq1HpbaBaz3K7x5XtVw91Sl1ovoyb3GaNVVH2pHphOo3wO1ob6Vq4dXkXfC0xs7Vn/vyZu67xBBiuMl7FwuAwqxaZ0mba72aknPYZVyiiWauBbc3VZ4nID4q8y5WwmHK4f9G7Fy3xjFemndg5wsOg3qOONmSsMwaj35LlfqHJoQXRXIGotTek5xwof0JVbBqg4PZfAf6uZCdy0H6g8MyKXBuC7CnEZdYidcJBkUI/JWXToDwfUHR0Lk7PPmmGKt3ag==");
  //该字段需进行加密处理
  idCardInfo.setId_card_number("8GaO0szMfe/dGeeTgUxbnSnIguEMZPAKdfzbnjUnNrx+KmFgqnIYWcmNQL+OSUgc3L5sCB87WPBBe6Xn1ff79BhLa8osu6e2QjUz++TuSff3AuXU694v340+3riVwDS8I8ebvCMXNNXT/LJ+9cvXNkik+1dedBv5oebs5hytYEbxBeJZjOZrPDIvd6p5YGfY3hZI9xPrZGGAteCdH516no2GtDkdgPOBi6RZT8mZ9dgP6y4ANTPrjtO8rWA+tpuhO3I+UTr1JQSrQpSHYNl8Pooz7FyaJpNOF1Zr7pyWD2kgWB2VMDbHFFiaPN5WoLpettVuayNPyk2rzLjTBsvDCg==");
  idCardInfo.setId_card_valid_time("2099-09-04");

  param.setId_card_info(idCardInfo);

  param.setNeed_account_info(true);

  AccountInfo accountInfo = new AccountInfo();
  accountInfo.setBank_account_type("75");
  accountInfo.setAccount_bank("工商银行");
  //该字段需进行加密处理
  accountInfo.setAccount_name("2pHphOo3wO1ob6Vq4dXkXfC0xs7VKGGMAPqqxG9fXnh81sZinQRNXliZ+g3i0pmX96QjI8Sl1ovonwiWh2DLQpoo9azM89x9fgyb3GaNVVHn/vyZu67xBBiuMl7FwuAwqxaZ0qkNdFFkLSaOr0z5QWsAepq1HpbaBaz3K7x5XtVw91mba72aknPYZVyiiWauBbc3VZ4nID4q8y5WwmHK4f9G7Fy3xjFemndg5wsOg3qOONmSsMwaj35LlfqHJoQXRXIGotTek5xwof0JVbBqg4PZfAf6uZCdy0H6g8MyKXBuC7CnEZdYidcJBkUI/JWXToDwfUHR0Lk7PPmmGKt3ag==");
  accountInfo.setBank_address_code("350200");
  //该字段需进行加密处理
  accountInfo.setAccount_number("yrcL/3arXHVGc82cRJ1TvRkFoXuqEvndW3KcXpqIg+1h2g1KOEw5hZFZ2UNKryOUUwrybrlaBy/PZe4w3aZMHoYG0zsSczQD5zUb2ZOcnqZoTV88BVm4boGFkDFdHNG0Jvc9c1Twnv98HPoTJPkIUBJCO1oc3SptNjofRQsdjBm1CNSFkK/isdgr5r0kgcAWk+hecc28YTsCJEUB7jM52bWf8zp3xxorp3niZ5CzzPi/J2d8Ug2qqJehf7FBvRyR3IXVc3I2LrqdXqs7DT5KVZEvGa+mnR0YapIkJfyDJPv6KbzUWfncphEJrF3cl0jyoosbeOZ6jSgK8OzMIPyuYA==");

  param.setAccount_info(accountInfo);

  ContactInfo contactInfo = new ContactInfo();
  contactInfo.setContact_type("65");
  //该字段需进行加密处理
  contactInfo.setContact_name("i0pmX96QjI8qkNdFFkLSaOr0z5QWsAKGGMAPqqxG9fXnh81sZinQRNXliZ+g3epq1HpbaBaz3K7x5XtVw91Sl1ovonwiWh2DLQpoo9azM89x9fgyb3GaNV7xBBiuMl7FwuAwqxaZ0mba72aknPYVH2pHphOo3wO1ob6Vq4dXkXfC0xs7Vn/vyZu6ZVyiiWauBbcZdYidcJBkUI/JWXToDwfUHR0Lk7PPmmG3VZ4nID4q8y5WwmHK4f9G7Fy3xjFemndg5wsOg3qOONmSsMwaj35LlfqHJoQXRXIGotTek5xwof0JVbBqg4PZfAf6uZCdy0H6g8MyKXBuC7CnEKt3ag==");
  //该字段需进行加密处理
  contactInfo.setContact_id_card_number("PBBe6Xn1ff79BuSff3AuXU694v340+3riVwSnIguEMZPAUgc3L5sCB87WebvCMXNNXT/LJ+9cvXNkik+1dedBv5oebs5hytYEbxBeJZjOhLa8osu6e2QOBi6RZT8mZ9dgP6y4ANTPrjtO8rWA+tpuhO3I+UTr1JQSrQpSHYNl8Pooz7FyaJpNOF1Zr7pyWD2kgWB2VMDbHFFiaPN5WoLpeDS8I8KdfzbnjUnNrx+KmFgqnIYWcmNQL+jUz++TZrPDIvd6p5YGfY3hZI9xPrZGGAteCdH516no2GtDkdgPOS8GaO0szMfe/dGeeTgUxbnttVuayNPyk2rzLjTBsvDCg==");
  //该字段需进行加密处理
  contactInfo.setMobile_phone("7mnr/TT5Ge5HqGttlhIgVCjQoxsHQZQy/YpjSP1pvCSf87L0wFkRjNcATNmAlY2NhD/rw34YE3A0K2S0Ujy5f+DB7C+2ZcLTA1gl8zZm3rKr6AaSf5Jgqdy9RhoFyMgPCmV4g5qg2bKlIjXbCG7qfU+6U1r+OlzG+gR0ertF70u/JWd1gqn3QbXkKoqvr/cVpwAEjE4eIjH7IotCjWZIFZ5HNUz2tkNaC1ma234z3R0JrzEDf9hb8Vs7UUKwJrwsel5RksQCvDZvpPKmOxsF9F5Cuh1XgVaqBRSUSYzs7l6WouvsUA+cEb1xOeJSipIxC8tU0t57pIiAQVBn8Z1yLw==");
  //该字段需进行加密处理
  contactInfo.setContact_email("TT++JXKKwFLscUIfpSFniSP5uc3ITGcmV0oP1RnFZNdrYm42C8tXIw3RinsFwfEsvTdM1fc7TrKXVJK7w7eZ8fbAdkUHwhJ9DyLxwxtGz21mSiOpIgaoRqrOuQ623jx4myGXK4O02ejmUVgSuuSGTCXcebtS+12m5MaC6PGqYjbVfExz/83CEifmu57HNnde/YfQCSB4gbmFi2cILNF5Eoa4oVVwYlvbYW4ZHCq7cdZVKx2yREu5qwWUnQWChT5EFtR5Q+CCmbBZyX64g8VHtZPMOjbbj6d4sl/bn6NjKsBKIfroFuH1W/8aofKPZkqVG/A0thXkhDGsHFX6aKFUuQ==");

  param.setContact_info(contactInfo);

  SalesSceneInfo salesSceneInfo = new SalesSceneInfo();
  salesSceneInfo.setStore_name("收付通");
  salesSceneInfo.setStore_qr_code("gCVSq6j0dKRaup7VRA3aCfDX5pxgObgXhlOlmUdpskWnlXBmdLyOUNSRzFK1HT1y_9tPWGTr_mxBiD8ICwUvNVr2Pq-JdH6UsZ4Ayo7eVDo");

  param.setSales_scene_info(salesSceneInfo);

  param.setMerchant_shortname("收付通");

  applyments(param);
}

6、结果

image.png

您的一键三连,是我更新的最大动力,谢谢

山水有相逢,来日皆可期,谢谢阅读,我们再会

我手中的金箍棒,上能通天,下能探海

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。