| @@ -0,0 +1,87 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment; | |||
| import com.github.binarywang.wxpay.bean.applyment.enums.ApplymentStateEnum; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import lombok.experimental.Accessors; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 查询申请单状态返回对象信息 | |||
| */ | |||
| @Data | |||
| @Builder | |||
| @NoArgsConstructor | |||
| @AllArgsConstructor | |||
| @Accessors(chain = true) | |||
| public class ApplymentStateQueryResult implements Serializable { | |||
| private static final long serialVersionUID = 6539090917423486409L; | |||
| /** | |||
| * 业务申请编号 | |||
| */ | |||
| @SerializedName("business_code") | |||
| private String businessCode; | |||
| /** | |||
| * 微信支付申请单号 | |||
| */ | |||
| @SerializedName("applyment_id") | |||
| private String applymentId; | |||
| /** | |||
| * 特约商户号 | |||
| */ | |||
| @SerializedName("sub_mchid") | |||
| private String subMchid; | |||
| /** | |||
| * 超级管理员签约链接 | |||
| */ | |||
| @SerializedName("sign_url") | |||
| private String signUrl; | |||
| /** | |||
| * 申请单状态 | |||
| */ | |||
| @SerializedName("applyment_state") | |||
| private ApplymentStateEnum applymentState; | |||
| /** | |||
| * 申请状态描述 | |||
| */ | |||
| @SerializedName("applyment_state_msg") | |||
| private String applymentStateMsg; | |||
| /** | |||
| * 驳回原因详情 | |||
| */ | |||
| @SerializedName("audit_detail") | |||
| private List<AuditDetail> auditDetail; | |||
| /** | |||
| * 驳回原因详情 | |||
| */ | |||
| @Data | |||
| @Builder | |||
| @NoArgsConstructor | |||
| @AllArgsConstructor | |||
| @Accessors(chain = true) | |||
| public static class AuditDetail { | |||
| /** | |||
| * 字段名 | |||
| */ | |||
| @SerializedName("field") | |||
| private String field; | |||
| /** | |||
| * 字段名称 | |||
| */ | |||
| @SerializedName("field_name") | |||
| private String fieldName; | |||
| /** | |||
| * 驳回原因 | |||
| */ | |||
| @SerializedName("reject_reason") | |||
| private String rejectReason; | |||
| } | |||
| } | |||
| @@ -0,0 +1,62 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment; | |||
| import com.github.binarywang.wxpay.bean.applyment.enums.AccountTypeEnum; | |||
| import com.github.binarywang.wxpay.v3.SpecEncrypt; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import lombok.experimental.Accessors; | |||
| import java.io.Serializable; | |||
| /** | |||
| * 修改结算账户请求对象 | |||
| */ | |||
| @Data | |||
| @Builder | |||
| @NoArgsConstructor | |||
| @AllArgsConstructor | |||
| @Accessors(chain = true) | |||
| public class ModifySettlementRequest implements Serializable { | |||
| private static final long serialVersionUID = 4568552340365230872L; | |||
| /** | |||
| * 账户类型 | |||
| */ | |||
| @SerializedName("account_type") | |||
| private AccountTypeEnum accountType; | |||
| /** | |||
| * 开户名称 | |||
| */ | |||
| @SpecEncrypt | |||
| @SerializedName("account_name") | |||
| private String accountName; | |||
| /** | |||
| * 开户银行 | |||
| */ | |||
| @SerializedName("account_bank") | |||
| private String accountBank; | |||
| /** | |||
| * 开户银行省市编码 | |||
| */ | |||
| @SerializedName("bank_address_code") | |||
| private String bankAddressCode; | |||
| /** | |||
| * 开户银行全称(含支行) | |||
| */ | |||
| @SerializedName("bank_name") | |||
| private String bankName; | |||
| /** | |||
| * 开户银行联行号 | |||
| */ | |||
| @SerializedName("bank_branch_id") | |||
| private String bankBranchId; | |||
| /** | |||
| * 银行账号 | |||
| */ | |||
| @SpecEncrypt | |||
| @SerializedName("account_number") | |||
| private String accountNumber; | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import lombok.experimental.Accessors; | |||
| import java.io.Serializable; | |||
| /** | |||
| * 查询结算账户返回对象信息 | |||
| */ | |||
| @Data | |||
| @Builder | |||
| @NoArgsConstructor | |||
| @AllArgsConstructor | |||
| @Accessors(chain = true) | |||
| public class SettlementInfoResult implements Serializable { | |||
| private static final long serialVersionUID = 4568552340365230872L; | |||
| /** | |||
| * 账户类型 | |||
| */ | |||
| @SerializedName("account_type") | |||
| private String accountType; | |||
| /** | |||
| * 开户银行 | |||
| */ | |||
| @SerializedName("account_bank") | |||
| private String accountBank; | |||
| /** | |||
| * 开户银行全称(含支行] | |||
| */ | |||
| @SerializedName("bank_name") | |||
| private String bankName; | |||
| /** | |||
| * 开户银行联行号 | |||
| */ | |||
| @SerializedName("bank_branch_id") | |||
| private String bankBranchId; | |||
| /** | |||
| * 银行账号 | |||
| */ | |||
| @SerializedName("account_number") | |||
| private String accountNumber; | |||
| /** | |||
| * 汇款验证结果 | |||
| * | |||
| * @see com.github.binarywang.wxpay.bean.applyment.enums.SettlementVerifyResultEnum | |||
| */ | |||
| @SerializedName("verify_result") | |||
| private String verifyResult; | |||
| } | |||
| @@ -0,0 +1,31 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import lombok.experimental.Accessors; | |||
| import java.io.Serializable; | |||
| /** | |||
| * 特约商户进件 提交申请结果响应 | |||
| * | |||
| * @author zhouyongshen | |||
| */ | |||
| @Data | |||
| @Builder | |||
| @NoArgsConstructor | |||
| @AllArgsConstructor | |||
| @Accessors(chain = true) | |||
| public class WxPayApplymentCreateResult implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /** | |||
| * 微信支付申请单号 | |||
| */ | |||
| @SerializedName("applyment_id") | |||
| private String applymentId; | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 银行结算账户枚举类 | |||
| */ | |||
| public enum AccountTypeEnum { | |||
| /** | |||
| * 对公银行账户 | |||
| */ | |||
| ACCOUNT_TYPE_BUSINESS, | |||
| /** | |||
| * 经营者个人银行卡 | |||
| */ | |||
| ACCOUNT_TYPE_PRIVATE, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 申请单状态枚举类 | |||
| * | |||
| * @author zhouyongshen | |||
| */ | |||
| public enum ApplymentStateEnum { | |||
| /** | |||
| * (编辑中):提交申请发生错误导致,请尝试重新提交。 | |||
| */ | |||
| APPLYMENT_STATE_EDITTING, | |||
| /** | |||
| * (审核中):申请单正在审核中,超级管理员用微信打开“签约链接”,完成绑定微信号后,申请单进度将通过微信公众号通知超级管理员,引导完成后续步骤。 | |||
| */ | |||
| APPLYMENT_STATE_AUDITING, | |||
| /** | |||
| * (已驳回):请按照驳回原因修改申请资料,超级管理员用微信打开“签约链接”,完成绑定微信号,后续申请单进度将通过微信公众号通知超级管理员。 | |||
| */ | |||
| APPLYMENT_STATE_REJECTED, | |||
| /** | |||
| * (待账户验证):请超级管理员使用微信打开返回的“签约链接”,根据页面指引完成账户验证。 | |||
| */ | |||
| APPLYMENT_STATE_TO_BE_CONFIRMED, | |||
| /** | |||
| * (待签约):请超级管理员使用微信打开返回的“签约链接”,根据页面指引完成签约。 | |||
| */ | |||
| APPLYMENT_STATE_TO_BE_SIGNED, | |||
| /** | |||
| * (开通权限中):系统开通相关权限中,请耐心等待。 | |||
| */ | |||
| APPLYMENT_STATE_SIGNING, | |||
| /** | |||
| * (已完成):商户入驻申请已完成。 | |||
| */ | |||
| APPLYMENT_STATE_FINISHED, | |||
| /** | |||
| * (已作废):申请单已被撤销。 | |||
| */ | |||
| APPLYMENT_STATE_CANCELED | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 银行结算账户枚举类 | |||
| */ | |||
| public enum BankAccountTypeEnum { | |||
| /** | |||
| * 对公银行账户 | |||
| */ | |||
| BANK_ACCOUNT_TYPE_CORPORATE, | |||
| /** | |||
| * 经营者个人银行卡 | |||
| */ | |||
| BANK_ACCOUNT_TYPE_PERSONAL, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,64 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 登记证书的类型枚举 | |||
| */ | |||
| public enum CertTypeEnum { | |||
| /** | |||
| * 事业单位法人证书 | |||
| */ | |||
| CERTIFICATE_TYPE_2388, | |||
| /** | |||
| * 统一社会信用代码证书 | |||
| */ | |||
| CERTIFICATE_TYPE_2389, | |||
| /** | |||
| * 有偿服务许可证(军队医院适用) | |||
| */ | |||
| CERTIFICATE_TYPE_2390, | |||
| /** | |||
| * 医疗机构执业许可证(军队医院适用) | |||
| */ | |||
| CERTIFICATE_TYPE_2391, | |||
| /** | |||
| * 企业营业执照(挂靠企业的党组织适用) | |||
| */ | |||
| CERTIFICATE_TYPE_2392, | |||
| /** | |||
| * 组织机构代码证(政府机关适用) | |||
| */ | |||
| CERTIFICATE_TYPE_2393, | |||
| /** | |||
| * 社会团体法人登记证书 | |||
| */ | |||
| CERTIFICATE_TYPE_2394, | |||
| /** | |||
| * 民办非企业单位登记证书 | |||
| */ | |||
| CERTIFICATE_TYPE_2395, | |||
| /** | |||
| * 基金会法人登记证书 | |||
| */ | |||
| CERTIFICATE_TYPE_2396, | |||
| /** | |||
| * 宗教活动场所登记证 | |||
| */ | |||
| CERTIFICATE_TYPE_2399, | |||
| /** | |||
| * 其他证书/批文/证明 | |||
| */ | |||
| CERTIFICATE_TYPE_2400, | |||
| /** | |||
| * 执业许可证/执业证 | |||
| */ | |||
| CERTIFICATE_TYPE_2520, | |||
| /** | |||
| * 基层群众性自治组织特别法人统一社会信用代码证 | |||
| */ | |||
| CERTIFICATE_TYPE_2521, | |||
| /** | |||
| * 农村集体经济组织登记证 | |||
| */ | |||
| CERTIFICATE_TYPE_2522, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,41 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 个体户/企业/党政、机关及事业单位/其他组织:可选择任一证件类型。 | |||
| * 枚举值 | |||
| */ | |||
| public enum IdTypeEnum { | |||
| /** | |||
| * 中国大陆居民-身份证 | |||
| */ | |||
| IDENTIFICATION_TYPE_IDCARD, | |||
| /** | |||
| * 其他国家或地区居民-护照 | |||
| */ | |||
| IDENTIFICATION_TYPE_OVERSEA_PASSPORT, | |||
| /** | |||
| * 中国香港居民-来往内地通行证 | |||
| */ | |||
| IDENTIFICATION_TYPE_HONGKONG_PASSPORT, | |||
| /** | |||
| * 中国澳门居民-来往内地通行证 | |||
| */ | |||
| IDENTIFICATION_TYPE_MACAO_PASSPORT, | |||
| /** | |||
| * 中国台湾居民-来往大陆通行证 | |||
| */ | |||
| IDENTIFICATION_TYPE_TAIWAN_PASSPORT, | |||
| /** | |||
| * 外国人居留证 | |||
| */ | |||
| IDENTIFICATION_TYPE_FOREIGN_RESIDENT, | |||
| /** | |||
| * 港澳居民证 | |||
| */ | |||
| IDENTIFICATION_TYPE_HONGKONG_MACAO_RESIDENT, | |||
| /** | |||
| * 台湾居民证 | |||
| */ | |||
| IDENTIFICATION_TYPE_TAIWAN_RESIDENT, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 小微经营类型 | |||
| */ | |||
| public enum MicroBizTypeEnum { | |||
| /** | |||
| * 门店场所 | |||
| */ | |||
| MICRO_TYPE_STORE, | |||
| /** | |||
| * 流动经营/便民服务 | |||
| */ | |||
| MICRO_TYPE_MOBILE, | |||
| /** | |||
| * 线上商品/服务交易 | |||
| */ | |||
| MICRO_TYPE_ONLINE, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 经营场景类型枚举值 | |||
| */ | |||
| public enum SalesScenesTypeEnum { | |||
| /** | |||
| * 线下门店 | |||
| */ | |||
| SALES_SCENES_STORE, | |||
| /** | |||
| * 公众号 | |||
| */ | |||
| SALES_SCENES_MP, | |||
| /** | |||
| * 小程序 | |||
| */ | |||
| SALES_SCENES_MINI_PROGRAM, | |||
| /** | |||
| * 互联网 | |||
| */ | |||
| SALES_SCENES_WEB, | |||
| /** | |||
| * APP | |||
| */ | |||
| SALES_SCENES_APP, | |||
| /** | |||
| * 企业微信 | |||
| */ | |||
| SALES_SCENES_WEWORK, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 返回特约商户的结算账户-汇款验证结果枚举类 | |||
| * | |||
| * @author zhouyognshen | |||
| */ | |||
| public enum SettlementVerifyResultEnum { | |||
| /** | |||
| * 系统汇款验证中,商户可发起提现尝试。 | |||
| */ | |||
| VERIFYING, | |||
| /** | |||
| * 系统成功汇款,该账户可正常发起提现。 | |||
| */ | |||
| VERIFY_SUCCESS, | |||
| /** | |||
| * 系统汇款失败,该账户无法发起提现,请检查修改。 | |||
| */ | |||
| VERIFY_FAIL, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,34 @@ | |||
| package com.github.binarywang.wxpay.bean.applyment.enums; | |||
| /** | |||
| * 主体类型枚举类 | |||
| * <pre> | |||
| * 商户申请接入时如何选择主体类型? https://kf.qq.com/faq/180910IBZVnQ180910naQ77b.html | |||
| * </pre> | |||
| * | |||
| * @author zhouyongshen | |||
| */ | |||
| public enum SubjectTypeEnum { | |||
| /** | |||
| * (个体户):营业执照上的主体类型一般为个体户、个体工商户、个体经营; | |||
| */ | |||
| SUBJECT_TYPE_INDIVIDUAL, | |||
| /** | |||
| * (企业):营业执照上的主体类型一般为有限公司、有限责任公司; | |||
| */ | |||
| SUBJECT_TYPE_ENTERPRISE, | |||
| /** | |||
| * (党政、机关及事业单位):包括国内各级、各类政府机构、事业单位等(如:公安、党团、司法、交通、旅游、工商税务、市政、医疗、教育、学校等机构); | |||
| */ | |||
| SUBJECT_TYPE_INSTITUTIONS, | |||
| /** | |||
| * (其他组织):不属于企业、政府/事业单位的组织机构(如社会团体、民办非企业、基金会),要求机构已办理组织机构代码证。 | |||
| */ | |||
| SUBJECT_TYPE_OTHERS, | |||
| /** | |||
| * (小微):无营业执照、免办理工商注册登记的实体商户 | |||
| */ | |||
| SUBJECT_TYPE_MICRO, | |||
| ; | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.github.binarywang.wxpay.bean.bank; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 对私银行卡号开户银行信息 | |||
| * | |||
| * @author zhongjun | |||
| **/ | |||
| @Data | |||
| public class BankAccountResult implements Serializable { | |||
| private static final long serialVersionUID = -8226859146533243501L; | |||
| /** | |||
| * 根据卡号查询到的银行列表数据的总条数,未查询到对应银行列表时默认返回0,最大不超过两百条。 | |||
| */ | |||
| @SerializedName("total_count") | |||
| private Integer totalCount; | |||
| @SerializedName("data") | |||
| private List<BankInfo> data; | |||
| } | |||
| @@ -0,0 +1,176 @@ | |||
| package com.github.binarywang.wxpay.bean.bank; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.Getter; | |||
| import lombok.Setter; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 支行列表 | |||
| * | |||
| * @author hupeng | |||
| **/ | |||
| @Data | |||
| public class BankBranchesResult implements Serializable { | |||
| private static final long serialVersionUID = -3500020131951579476L; | |||
| /** | |||
| * <pre> | |||
| * 字段名:查询数据总条数 | |||
| * 变量名:total_count | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 经过条件筛选,查询到的支行总数 | |||
| * 示例值:10 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("total_count") | |||
| private Integer totalCount; | |||
| /** | |||
| * <pre> | |||
| * 字段名:本次查询条数 | |||
| * 变量名:count | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 本次查询到的支行数据条数 | |||
| * 示例值:10 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("count") | |||
| private Integer count; | |||
| /** | |||
| * <pre> | |||
| * 字段名:支行列表 | |||
| * 变量名:data | |||
| * 是否必填:否 | |||
| * 类型:array | |||
| * 描述: | |||
| * 单次查询返回的支行列表结果数组 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("data") | |||
| private List<BankBranch> data; | |||
| /** | |||
| * <pre> | |||
| * 字段名:本次查询偏移量 | |||
| * 变量名:offset | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 该次请求资源的起始位置,请求中包含偏移量时应答消息返回相同偏移量,否则返回默认值0 | |||
| * 示例值:0 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("offset") | |||
| private Integer offset; | |||
| /** | |||
| * <pre> | |||
| * 字段名:分页链接 | |||
| * 变量名:offset | |||
| * 是否必填:是 | |||
| * 类型:object | |||
| * 描述: | |||
| * 返回前后页和当前页面的访问链接 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("links") | |||
| private PageLink links; | |||
| /** | |||
| * <pre> | |||
| * 字段名:开户银行 | |||
| * 变量名:account_bank | |||
| * 是否必填:是 | |||
| * 类型:string[1, 128] | |||
| * 描述: | |||
| * 查询到的支行所属开户银行的名称,非直连银行统一为其他银行 | |||
| * 示例值:招商银行其他银行 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("account_bank") | |||
| private String accountBank; | |||
| /** | |||
| * <pre> | |||
| * 字段名:开户银行编码 | |||
| * 变量名:account_bank_code | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 查询到的支行所属开户银行的开户银行编码,可用于付款到银行卡等场景中指定银行卡的开户银行 | |||
| * 示例值:1001 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("account_bank_code") | |||
| private Integer accountBankCode; | |||
| /** | |||
| * <pre> | |||
| * 字段名:银行别名 | |||
| * 变量名:bank_alias | |||
| * 是否必填:是 | |||
| * 类型:string[1, 128] | |||
| * 描述: | |||
| * 查询到的支行所属银行的银行别名 | |||
| * 示例值:工商银行深圳前海微众银行 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("bank_alias") | |||
| private String bankAlias; | |||
| /** | |||
| * <pre> | |||
| * 字段名:银行别名编码 | |||
| * 变量名:bank_alias_code | |||
| * 是否必填:是 | |||
| * 类型:string[1, 32] | |||
| * 描述: | |||
| * 查询到的支行所属银行的银行别名编码,用于校验回包 | |||
| * 示例值:1000006247 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("bank_alias_code") | |||
| private String bankAliasCode; | |||
| @Getter | |||
| @Setter | |||
| public static class BankBranch { | |||
| /** | |||
| * <pre> | |||
| * 字段名:开户银行支行名称 | |||
| * 变量名:bank_branch_name | |||
| * 是否必填:是 | |||
| * 类型:string[1, 128] | |||
| * 描述: | |||
| * 开户银行支行名称,用于开户银行为其他银行的情况下,在入驻、修改结算银行卡、企业付款等场景下填写结算银行卡信息。 | |||
| * 示例值:中国工商银行上海市周浦支行 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("bank_branch_name") | |||
| private String bankBranchName; | |||
| /** | |||
| * <pre> | |||
| * 字段名:开户银行支行联行号 | |||
| * 变量名:bank_branch_id | |||
| * 是否必填:是 | |||
| * 类型:string[1, 64] | |||
| * 描述: | |||
| * 开户银行支行的联行号,用于开户银行为其他银行的情况下,在入驻、修改结算银行卡、企业付款等场景下填写结算银行卡信息。 | |||
| * 示例值:102290072311 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("bank_branch_id") | |||
| private String bankBranchId; | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.github.binarywang.wxpay.bean.bank; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| /** | |||
| * 银行信息 | |||
| * | |||
| * @author zhongjun | |||
| * @date 2022/5/12 | |||
| **/ | |||
| @Data | |||
| public class BankInfo { | |||
| /** | |||
| * 银行别名 | |||
| */ | |||
| @SerializedName("bank_alias") | |||
| private String bankAlias; | |||
| /** | |||
| * 银行别名编码 | |||
| */ | |||
| @SerializedName("bank_alias_code") | |||
| private String bankAliasCode; | |||
| /** | |||
| * 开户银行 | |||
| */ | |||
| @SerializedName("account_bank") | |||
| private String accountBank; | |||
| /** | |||
| * 开户银行编码 | |||
| */ | |||
| @SerializedName("account_bank_code") | |||
| private Integer accountBankCode; | |||
| /** | |||
| * 是否需要填写支行 | |||
| */ | |||
| @SerializedName("need_bank_branch") | |||
| private Boolean needBankBranch; | |||
| } | |||
| @@ -0,0 +1,64 @@ | |||
| package com.github.binarywang.wxpay.bean.bank; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.Getter; | |||
| import lombok.Setter; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 个人业务的银行列表 | |||
| * | |||
| * @author zhongjun | |||
| **/ | |||
| @Data | |||
| public class BankingResult implements Serializable { | |||
| private static final long serialVersionUID = -8372812998971715894L; | |||
| /** | |||
| * 银行列表数据的总条数,调用方需要根据总条数分页查询 | |||
| */ | |||
| @SerializedName("total_count") | |||
| private Integer totalCount; | |||
| /** | |||
| * 本次查询银行列表返回的数据条数 | |||
| */ | |||
| @SerializedName("count") | |||
| private Integer count; | |||
| /** | |||
| * 该次请求资源的起始位置,请求中包含偏移量时应答消息返回相同偏移量,否则返回默认值0。 | |||
| */ | |||
| @SerializedName("offset") | |||
| private Integer offset; | |||
| @SerializedName("data") | |||
| private List<BankInfo> data; | |||
| @SerializedName("links") | |||
| private Link links; | |||
| @Getter | |||
| @Setter | |||
| public static class Link { | |||
| /** | |||
| * 下一页链接 | |||
| */ | |||
| @SerializedName("next") | |||
| private String next; | |||
| /** | |||
| * 上一页链接 | |||
| */ | |||
| @SerializedName("prev") | |||
| private String prev; | |||
| /** | |||
| * 当前链接 | |||
| */ | |||
| @SerializedName("self") | |||
| private String self; | |||
| } | |||
| } | |||
| @@ -0,0 +1,80 @@ | |||
| package com.github.binarywang.wxpay.bean.bank; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.Getter; | |||
| import lombok.Setter; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 城市列表 | |||
| * | |||
| * @author hupeng | |||
| **/ | |||
| @Data | |||
| public class CitiesResult implements Serializable { | |||
| private static final long serialVersionUID = -6089905695087974693L; | |||
| /** | |||
| * <pre> | |||
| * 字段名:查询数据总条数 | |||
| * 变量名:total_count | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 查询到的省份数据总条数 | |||
| * 示例值:10 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("total_count") | |||
| private Integer totalCount; | |||
| /** | |||
| * <pre> | |||
| * 字段名:城市列表 | |||
| * 变量名:data | |||
| * 是否必填:否 | |||
| * 类型:array | |||
| * 描述: | |||
| * 查询返回的城市列表结果 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("data") | |||
| private List<CityInfo> data; | |||
| @Getter | |||
| @Setter | |||
| public static class CityInfo { | |||
| /** | |||
| * <pre> | |||
| * 字段名:城市名称 | |||
| * 变量名:city_name | |||
| * 是否必填:是 | |||
| * 类型:string[1, 256] | |||
| * 描述: | |||
| * 城市名称 | |||
| * 示例值:北京市 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("city_name") | |||
| private String cityName; | |||
| /** | |||
| * <pre> | |||
| * 字段名:城市编码 | |||
| * 变量名:city_code | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 城市编码,唯一标识一座城市,用于结合银行别名编码查询支行列表 | |||
| * 示例值:10 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("city_code") | |||
| private Integer cityCode; | |||
| } | |||
| } | |||
| @@ -0,0 +1,59 @@ | |||
| package com.github.binarywang.wxpay.bean.bank; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| /** | |||
| * 支行列表 | |||
| * | |||
| * @author hupeng | |||
| **/ | |||
| @Data | |||
| public class PageLink implements Serializable { | |||
| private static final long serialVersionUID = -2624233403271204837L; | |||
| /** | |||
| * <pre> | |||
| * 字段名:下一页链接 | |||
| * 变量名:next | |||
| * 是否必填:否 | |||
| * 类型:string[1, 2048] | |||
| * 描述: | |||
| * 使用同样的limit进行下一页查询时的相对请求链接,使用方需要自行根据当前域名进行拼接。如果已经到最后时,为空 | |||
| * 示例值:/v3/capital/capitallhh/banks/1001/branches?offset=10&limit=5 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("next") | |||
| private String next; | |||
| /** | |||
| * <pre> | |||
| * 字段名:上一页链接 | |||
| * 变量名:prev | |||
| * 是否必填:否 | |||
| * 类型:string[1, 2048] | |||
| * 描述: | |||
| * 使用同样的limit进行上一页查询时的相对请求链接,使用方需要自行根据当前域名进行拼接。如果是第一页,为空 | |||
| * 示例值:/v3/capital/capitallhh/banks/1001/branchesoffset=0&limit=5 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("prev") | |||
| private String prev; | |||
| /** | |||
| * <pre> | |||
| * 字段名:当前链接 | |||
| * 变量名:self | |||
| * 是否必填:否 | |||
| * 类型:string[1, 2048] | |||
| * 描述: | |||
| * 当前的相对请求链接,使用方需要自行根据当前域名进行拼接 | |||
| * 示例值:/v3/capital/capitallhh/banks/1001/branches?offset=5&limit=5 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("self") | |||
| private String self; | |||
| } | |||
| @@ -0,0 +1,81 @@ | |||
| package com.github.binarywang.wxpay.bean.bank; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.Getter; | |||
| import lombok.Setter; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 省份列表 | |||
| * | |||
| * @author hupeng | |||
| **/ | |||
| @Data | |||
| public class ProvincesResult implements Serializable { | |||
| private static final long serialVersionUID = -4118613374545722650L; | |||
| /** | |||
| * <pre> | |||
| * 字段名:查询数据总条数 | |||
| * 变量名:total_count | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 查询到的省份数据总条数 | |||
| * 示例值:10 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("total_count") | |||
| private Integer totalCount; | |||
| /** | |||
| * <pre> | |||
| * 字段名:省份列表 | |||
| * 变量名:data | |||
| * 是否必填:否 | |||
| * 类型:array | |||
| * 描述: | |||
| * 查询到的省份列表数组 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("data") | |||
| private List<ProvinceInfo> data; | |||
| @Getter | |||
| @Setter | |||
| public static class ProvinceInfo { | |||
| /** | |||
| * <pre> | |||
| * 字段名:省份名称 | |||
| * 变量名:province_name | |||
| * 是否必填:是 | |||
| * 类型:string[1, 256] | |||
| * 描述: | |||
| * 省份名称 | |||
| * 示例值:广东省 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("province_name") | |||
| private String provinceName; | |||
| /** | |||
| * <pre> | |||
| * 字段名:省份编码 | |||
| * 变量名:province_code | |||
| * 是否必填:是 | |||
| * 类型:int | |||
| * 描述: | |||
| * 省份编码,唯一标识一个省份,用于根据省份编码查询省份下的城市列表数据 | |||
| * 示例值:22 | |||
| * </pre> | |||
| */ | |||
| @SerializedName("province_code") | |||
| private Integer provinceCode; | |||
| } | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.github.binarywang.wxpay.bean.media; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| /** | |||
| * 媒体文件上传返回结果对象 | |||
| * @author zhouyongshen | |||
| */ | |||
| @NoArgsConstructor | |||
| @Data | |||
| public class ImageUploadResult { | |||
| public static ImageUploadResult fromJson(String json) { | |||
| return WxGsonBuilder.create().fromJson(json, ImageUploadResult.class); | |||
| } | |||
| /** | |||
| * 媒体文件标识 Id | |||
| * | |||
| * 微信返回的媒体文件标识Id。 | |||
| * 示例值:6uqyGjGrCf2GtyXP8bxrbuH9-aAoTjH-rKeSl3Lf4_So6kdkQu4w8BYVP3bzLtvR38lxt4PjtCDXsQpzqge_hQEovHzOhsLleGFQVRF-U_0 | |||
| * | |||
| */ | |||
| @SerializedName("media_id") | |||
| private String mediaId; | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| package com.github.binarywang.wxpay.bean.media; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| /** | |||
| * 媒体文件上传返回结果对象 | |||
| * | |||
| * @author thinsstar | |||
| */ | |||
| @NoArgsConstructor | |||
| @Data | |||
| public class MarketingImageUploadResult { | |||
| public static MarketingImageUploadResult fromJson(String json) { | |||
| return WxGsonBuilder.create().fromJson(json, MarketingImageUploadResult.class); | |||
| } | |||
| /** | |||
| * 媒体文件URL地址 | |||
| * <p> | |||
| * 微信返回的媒体文件标识url。有效期为永久 | |||
| * 示例值:https://qpic.cn/xxx | |||
| */ | |||
| @SerializedName("media_url") | |||
| private String mediaUrl; | |||
| } | |||
| @@ -0,0 +1,74 @@ | |||
| package com.github.binarywang.wxpay.service; | |||
| import com.github.binarywang.wxpay.bean.applyment.*; | |||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||
| /** | |||
| * 特约商户进件 | |||
| * 产品介绍:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter1_1.shtml | |||
| * | |||
| * @author zhouyongshen | |||
| */ | |||
| public interface Applyment4SubService { | |||
| /** | |||
| * 提交申请单API | |||
| * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_1.shtml | |||
| * 接口链接:https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/ | |||
| * | |||
| * @param request 请求对象 | |||
| * @return WxPayApplymentCreateResult 响应结果 | |||
| * @throws WxPayException the wx pay exception | |||
| */ | |||
| WxPayApplymentCreateResult createApply(WxPayApplyment4SubCreateRequest request) throws WxPayException; | |||
| /** | |||
| * 通过业务申请编号查询申请状态 | |||
| * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_2.shtml | |||
| * 接口链接:https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/business_code/{business_code} | |||
| * | |||
| * @param businessCode 业务申请编号 | |||
| * 1、只能由数字、字母或下划线组成,建议前缀为服务商商户号。 | |||
| * 2、服务商自定义的唯一编号。 | |||
| * 3、每个编号对应一个申请单,每个申请单审核通过后生成一个微信支付商户号。 | |||
| * 4、若申请单被驳回,可填写相同的“业务申请编号”,即可覆盖修改原申请单信息。 | |||
| * 示例值:1900013511_10000 | |||
| * @return the applyment state query result | |||
| * @throws WxPayException the wx pay exception | |||
| */ | |||
| ApplymentStateQueryResult queryApplyStatusByBusinessCode(String businessCode) throws WxPayException; | |||
| /** | |||
| * 通过申请单号查询申请状态 | |||
| * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_2.shtml | |||
| * 接口链接:https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/applyment_id/{applyment_id} | |||
| * | |||
| * @param applymentId 微信支付分的申请单号。示例值:2000001234567890 | |||
| * @return the applyment state query result | |||
| * @throws WxPayException the wx pay exception | |||
| */ | |||
| ApplymentStateQueryResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException; | |||
| /** | |||
| * 通过申请单号查询申请状态 | |||
| * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_4.shtml | |||
| * 接口链接:https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/settlement | |||
| * | |||
| * @param subMchid 本服务商进件、已签约的特约商户号。 | |||
| * @return the settlement info result | |||
| * @throws WxPayException the wx pay exception | |||
| */ | |||
| SettlementInfoResult querySettlementBySubMchid(String subMchid) throws WxPayException; | |||
| /** | |||
| * 修改结算帐号 | |||
| * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_3.shtml | |||
| * 接口链接:https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/modify-settlement | |||
| * | |||
| * @param subMchid 特约商户号 | |||
| * @param request 修改结算账户请求对象信息 | |||
| * @throws WxPayException the wx pay exception | |||
| * @return | |||
| */ | |||
| String modifySettlement(String subMchid, ModifySettlementRequest request) throws WxPayException; | |||
| } | |||
| @@ -0,0 +1,121 @@ | |||
| package com.github.binarywang.wxpay.service; | |||
| import com.github.binarywang.wxpay.bean.bank.*; | |||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||
| /** | |||
| * <pre> | |||
| * 微信支付-银行组件 | |||
| * </pre> | |||
| * | |||
| * @author zhongjun | |||
| **/ | |||
| public interface BankService { | |||
| /** | |||
| * <pre> | |||
| * | |||
| * 获取对私银行卡号开户银行 | |||
| * | |||
| * 请求方式:GET(HTTPS) | |||
| * 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/search-banks-by-bank-account">https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/search-banks-by-bank-account</a> | |||
| * | |||
| * 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_1.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_1.shtml</a> | |||
| * </pre> | |||
| * | |||
| * @param accountNumber 银行卡号 该字段需进行加密处理,加密方法详见敏感信息加密说明。(提醒:必须在HTTP头中上送Wechatpay-Serial) | |||
| * @return BankAccountResult 对私银行卡号开户银行信息 | |||
| * @throws WxPayException . | |||
| */ | |||
| BankAccountResult searchBanksByBankAccount(String accountNumber) throws WxPayException; | |||
| /** | |||
| * <pre> | |||
| * | |||
| * 查询支持个人业务的银行列表 | |||
| * | |||
| * 请求方式:GET(HTTPS) | |||
| * 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/personal-banking">https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/personal-banking</a> | |||
| * | |||
| * 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_2.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_2.shtml</a> | |||
| * </pre> | |||
| * | |||
| * @param offset 本次查询偏移量 | |||
| * @param limit 本次请求最大查询条数,最大值为200 | |||
| * @return PersonalBankingResult 支持个人业务的银行列表信息 | |||
| * @throws WxPayException . | |||
| */ | |||
| BankingResult personalBanking(Integer offset, Integer limit) throws WxPayException; | |||
| /** | |||
| * <pre> | |||
| * | |||
| * 支持对公业务的银行列表 | |||
| * | |||
| * 请求方式:GET(HTTPS) | |||
| * 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/corporate-banking">https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/corporate-banking</a> | |||
| * | |||
| * 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_3.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_3.shtml</a> | |||
| * </pre> | |||
| * | |||
| * @param offset 本次查询偏移量 | |||
| * @param limit 本次请求最大查询条数,最大值为200 | |||
| * @return BankingResult 支持对公业务的银行列表信息 | |||
| * @throws WxPayException . | |||
| */ | |||
| BankingResult corporateBanking(Integer offset, Integer limit) throws WxPayException; | |||
| /** | |||
| * <pre> | |||
| * | |||
| * 查询省份列表API | |||
| * 通过本接口获取省份列表数据(不包含中国港澳台地区),可用于省份下的城市数据查询 | |||
| * | |||
| * 请求方式:GET(HTTPS) | |||
| * 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces">https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces</a> | |||
| * | |||
| * 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_4.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_4.shtml</a> | |||
| * </pre> | |||
| * | |||
| * @return ProvincesResult 省份列表信息 | |||
| * @throws WxPayException . | |||
| */ | |||
| ProvincesResult areasProvinces() throws WxPayException; | |||
| /** | |||
| * <pre> | |||
| * | |||
| * 查询城市列表API | |||
| * 通过本接口根据省份编码获取省份下的城市列表信息,不包含中国港澳台地区城市信息,可用于支行数据过滤查询 | |||
| * | |||
| * 请求方式:GET(HTTPS) | |||
| * 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces/{province_code}/cities">https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces/{province_code}/cities</a> | |||
| * | |||
| * 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml</a> | |||
| * </pre> | |||
| * | |||
| * @return CitiesResult 城市列表信息 | |||
| * @throws WxPayException . | |||
| */ | |||
| CitiesResult areasCities(Integer provinceCode) throws WxPayException; | |||
| /** | |||
| * <pre> | |||
| * | |||
| * 查询支行列表API | |||
| * 本接口可以用于根据银行别名编码(仅支持需要填写支行的银行别名编码)和城市编码过滤查询支行列表数据 | |||
| * | |||
| * 请求方式:GET(HTTPS) | |||
| * 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/{bank_alias_code}/branches">https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/{bank_alias_code}/branches</a> | |||
| * | |||
| * 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml</a> | |||
| * </pre> | |||
| * | |||
| * @param bankAliasCode 银行别名的编码,查询支行接口仅支持需要填写支行的银行别名编码。示例值:1000006247 | |||
| * @param cityCode 城市编码,唯一标识一座城市,用于结合银行别名编码查询支行列表。示例值:536 | |||
| * @param offset 非负整数,表示该次请求资源的起始位置,从0开始计数。调用方选填,默认为0。offset为20,limit为100时,查询第21-120条数据 | |||
| * @param limit 非0非负的整数,该次请求可返回的最大资源条数。示例值:200 | |||
| * @return BankBranchesResult 城市列表信息 | |||
| * @throws WxPayException . | |||
| */ | |||
| BankBranchesResult bankBranches(String bankAliasCode, Integer cityCode, Integer offset, Integer limit) throws WxPayException; | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.github.binarywang.wxpay.service; | |||
| import com.github.binarywang.wxpay.bean.media.ImageUploadResult; | |||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| /** | |||
| * <pre> | |||
| * 微信支付通用媒体接口. | |||
| * </pre> | |||
| * | |||
| * @author zhouyongshen | |||
| */ | |||
| public interface MerchantMediaService { | |||
| /** | |||
| * <pre> | |||
| * 通用接口-图片上传API | |||
| * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/chapter3_1.shtml | |||
| * 接口链接:https://api.mch.weixin.qq.com/v3/merchant/media/upload | |||
| * </pre> | |||
| * | |||
| * @param imageFile 需要上传的图片文件 | |||
| * @return ImageUploadResult 微信返回的媒体文件标识Id。示例值:6uqyGjGrCf2GtyXP8bxrbuH9-aAoTjH-rKeSl3Lf4_So6kdkQu4w8BYVP3bzLtvR38lxt4PjtCDXsQpzqge_hQEovHzOhsLleGFQVRF-U_0 | |||
| * @throws WxPayException the wx pay exception | |||
| */ | |||
| ImageUploadResult imageUploadV3(File imageFile) throws WxPayException, IOException; | |||
| /** | |||
| * <pre> | |||
| * 通用接口-图片上传API | |||
| * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/chapter3_1.shtml | |||
| * 接口链接:https://api.mch.weixin.qq.com/v3/merchant/media/upload | |||
| * </pre> | |||
| * | |||
| * @param inputStream 需要上传的图片文件流 | |||
| * @param fileName 需要上传的图片文件名 | |||
| * @return ImageUploadResult 微信返回的媒体文件标识Id。示例值:6uqyGjGrCf2GtyXP8bxrbuH9-aAoTjH-rKeSl3Lf4_So6kdkQu4w8BYVP3bzLtvR38lxt4PjtCDXsQpzqge_hQEovHzOhsLleGFQVRF-U_0 | |||
| * @throws WxPayException the wx pay exception | |||
| */ | |||
| ImageUploadResult imageUploadV3(InputStream inputStream, String fileName) throws WxPayException, IOException; | |||
| } | |||
| @@ -107,6 +107,17 @@ public interface WxPayService { | |||
| */ | |||
| String getV3(String url) throws WxPayException; | |||
| /** | |||
| * 发送get请求,得到响应字符串. | |||
| * <p> | |||
| * 部分字段会包含敏感信息,所以在提交前需要在请求头中会包含"Wechatpay-Serial"信息 | |||
| * | |||
| * @param url 请求地址 | |||
| * @return 返回请求结果字符串 string | |||
| * @throws WxPayException the wx pay exception | |||
| */ | |||
| String getV3WithWechatPaySerial(String url) throws WxPayException; | |||
| /** | |||
| * 发送下载 V3请求,得到响应流. | |||
| * | |||
| @@ -144,6 +155,27 @@ public interface WxPayService { | |||
| */ | |||
| BusinessCircleService getBusinessCircleService(); | |||
| /** | |||
| * 特约商户进件服务 | |||
| * | |||
| * @return | |||
| */ | |||
| Applyment4SubService getApplyment4SubService(); | |||
| /** | |||
| * 媒体上传服务 | |||
| * | |||
| * @return | |||
| */ | |||
| MerchantMediaService getMerchantMediaService(); | |||
| /** | |||
| * 获取银行组件服务 | |||
| * | |||
| * @return 银行组件服务 | |||
| */ | |||
| BankService getBankService(); | |||
| /** | |||
| * 设置企业付款服务类,允许开发者自定义实现类. | |||
| * | |||
| @@ -151,6 +183,7 @@ public interface WxPayService { | |||
| */ | |||
| void setEntPayService(EntPayService entPayService); | |||
| /** | |||
| * <pre> | |||
| * 查询订单. | |||
| @@ -0,0 +1,66 @@ | |||
| package com.github.binarywang.wxpay.service.impl; | |||
| import com.github.binarywang.wxpay.bean.applyment.*; | |||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||
| import com.github.binarywang.wxpay.service.Applyment4SubService; | |||
| import com.github.binarywang.wxpay.service.WxPayService; | |||
| import com.github.binarywang.wxpay.v3.util.RsaCryptoUtil; | |||
| import com.google.gson.Gson; | |||
| import com.google.gson.GsonBuilder; | |||
| import lombok.RequiredArgsConstructor; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import java.security.cert.X509Certificate; | |||
| @Slf4j | |||
| @RequiredArgsConstructor | |||
| public class Applyment4SubServiceImpl implements Applyment4SubService { | |||
| private static final Gson GSON = new GsonBuilder().create(); | |||
| private final WxPayService payService; | |||
| private void encryptFiled(Object request) throws WxPayException { | |||
| X509Certificate validCertificate = payService.getConfig().getVerifier().getValidCertificate(); | |||
| RsaCryptoUtil.encryptFields(request, validCertificate); | |||
| } | |||
| @Override | |||
| public WxPayApplymentCreateResult createApply(WxPayApplyment4SubCreateRequest request) throws WxPayException { | |||
| String url = String.format("%s/v3/applyment4sub/applyment/", this.payService.getPayBaseUrl()); | |||
| encryptFiled(request); | |||
| String result = payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); | |||
| return GSON.fromJson(result, WxPayApplymentCreateResult.class); | |||
| } | |||
| @Override | |||
| public ApplymentStateQueryResult queryApplyStatusByBusinessCode(String businessCode) throws WxPayException { | |||
| String url = String.format("%s/v3/applyment4sub/applyment/business_code/%s", this.payService.getPayBaseUrl(), businessCode); | |||
| String result = payService.getV3(url); | |||
| return GSON.fromJson(result, ApplymentStateQueryResult.class); | |||
| } | |||
| @Override | |||
| public ApplymentStateQueryResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException { | |||
| String url = String.format("%s/v3/applyment4sub/applyment/applyment_id/%s", this.payService.getPayBaseUrl(), applymentId); | |||
| String result = payService.getV3(url); | |||
| return GSON.fromJson(result, ApplymentStateQueryResult.class); | |||
| } | |||
| @Override | |||
| public SettlementInfoResult querySettlementBySubMchid(String subMchid) throws WxPayException { | |||
| String url = String.format("%s/v3/apply4sub/sub_merchants/%s/settlement", this.payService.getPayBaseUrl(), subMchid); | |||
| String result = payService.getV3(url); | |||
| return GSON.fromJson(result, SettlementInfoResult.class); | |||
| } | |||
| @Override | |||
| public String modifySettlement(String subMchid, ModifySettlementRequest request) throws WxPayException { | |||
| String url = String.format("%s/v3/apply4sub/sub_merchants/%s/modify-settlement", this.payService.getPayBaseUrl(), subMchid); | |||
| encryptFiled(request); | |||
| return payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,68 @@ | |||
| package com.github.binarywang.wxpay.service.impl; | |||
| import com.github.binarywang.wxpay.bean.bank.*; | |||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||
| import com.github.binarywang.wxpay.service.BankService; | |||
| import com.github.binarywang.wxpay.service.WxPayService; | |||
| import com.google.gson.Gson; | |||
| import com.google.gson.GsonBuilder; | |||
| import lombok.RequiredArgsConstructor; | |||
| /** | |||
| * 微信支付-银行组件 | |||
| * | |||
| * @author zhongjun | |||
| **/ | |||
| @RequiredArgsConstructor | |||
| public class BankServiceImpl implements BankService { | |||
| private final WxPayService payService; | |||
| private static final Gson GSON = new GsonBuilder().create(); | |||
| @Override | |||
| public BankAccountResult searchBanksByBankAccount(String accountNumber) throws WxPayException { | |||
| String url = String.format("%s/v3/capital/capitallhh/banks/search-banks-by-bank-account?account_number=%s", this.payService.getPayBaseUrl(), accountNumber); | |||
| String response = payService.getV3WithWechatPaySerial(url); | |||
| return GSON.fromJson(response, BankAccountResult.class); | |||
| } | |||
| @Override | |||
| public BankingResult personalBanking(Integer offset, Integer limit) throws WxPayException { | |||
| offset = offset == null ? 0 : offset; | |||
| limit = limit == null ? 200 : limit; | |||
| String url = String.format("%s/v3/capital/capitallhh/banks/personal-banking?offset=%s&limit=%s", this.payService.getPayBaseUrl(), offset, limit); | |||
| String response = payService.getV3(url); | |||
| return GSON.fromJson(response, BankingResult.class); | |||
| } | |||
| @Override | |||
| public BankingResult corporateBanking(Integer offset, Integer limit) throws WxPayException { | |||
| offset = offset == null ? 0 : offset; | |||
| limit = limit == null ? 200 : limit; | |||
| String url = String.format("%s/v3/capital/capitallhh/banks/corporate-banking?offset=%s&limit=%s", this.payService.getPayBaseUrl(), offset, limit); | |||
| String response = payService.getV3(url); | |||
| return GSON.fromJson(response, BankingResult.class); | |||
| } | |||
| @Override | |||
| public ProvincesResult areasProvinces() throws WxPayException { | |||
| String url = String.format("%s/v3/capital/capitallhh/areas/provinces", this.payService.getPayBaseUrl()); | |||
| String response = payService.getV3WithWechatPaySerial(url); | |||
| return GSON.fromJson(response, ProvincesResult.class); | |||
| } | |||
| @Override | |||
| public CitiesResult areasCities(Integer provinceCode) throws WxPayException { | |||
| String url = String.format("%s/v3/capital/capitallhh/areas/provinces/%s/cities", this.payService.getPayBaseUrl(), provinceCode); | |||
| String response = payService.getV3WithWechatPaySerial(url); | |||
| return GSON.fromJson(response, CitiesResult.class); | |||
| } | |||
| @Override | |||
| public BankBranchesResult bankBranches(String bankAliasCode, Integer cityCode, Integer offset, Integer limit) throws WxPayException { | |||
| offset = offset == null ? 0 : offset; | |||
| limit = limit == null ? 200 : limit; | |||
| String url = String.format("%s/v3/capital/capitallhh/banks/%s/branches?city_code=%s&offset=%s&limit=%s", this.payService.getPayBaseUrl(), bankAliasCode, cityCode, offset, limit); | |||
| String response = payService.getV3(url); | |||
| return GSON.fromJson(response, BankBranchesResult.class); | |||
| } | |||
| } | |||
| @@ -61,6 +61,9 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { | |||
| private ProfitSharingService profitSharingService = new ProfitSharingServiceImpl(this); | |||
| private RedpackService redpackService = new RedpackServiceImpl(this); | |||
| private BusinessCircleService businessCircleService = new BusinessCircleServiceImpl(this); | |||
| private Applyment4SubService applyment4SubService = new Applyment4SubServiceImpl(this); | |||
| private MerchantMediaService merchantMediaService = new MerchantMediaServiceImpl(this); | |||
| private BankService bankService = new BankServiceImpl(this); | |||
| /** | |||
| * The Config. | |||
| @@ -87,6 +90,21 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { | |||
| return this.redpackService; | |||
| } | |||
| @Override | |||
| public Applyment4SubService getApplyment4SubService() { | |||
| return applyment4SubService; | |||
| } | |||
| @Override | |||
| public MerchantMediaService getMerchantMediaService() { | |||
| return merchantMediaService; | |||
| } | |||
| @Override | |||
| public BankService getBankService() { | |||
| return bankService; | |||
| } | |||
| @Override | |||
| public void setEntPayService(EntPayService entPayService) { | |||
| this.entPayService = entPayService; | |||
| @@ -0,0 +1,60 @@ | |||
| package com.github.binarywang.wxpay.service.impl; | |||
| import com.github.binarywang.wxpay.bean.media.ImageUploadResult; | |||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||
| import com.github.binarywang.wxpay.service.MerchantMediaService; | |||
| import com.github.binarywang.wxpay.service.WxPayService; | |||
| import com.github.binarywang.wxpay.v3.WechatPayUploadHttpPost; | |||
| import lombok.RequiredArgsConstructor; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.codec.digest.DigestUtils; | |||
| import java.io.*; | |||
| import java.net.URI; | |||
| /** | |||
| * 微信支付-媒体文件上传service | |||
| * @author zhouyongshen | |||
| */ | |||
| @Slf4j | |||
| @RequiredArgsConstructor | |||
| public class MerchantMediaServiceImpl implements MerchantMediaService { | |||
| private final WxPayService payService; | |||
| @Override | |||
| public ImageUploadResult imageUploadV3(File imageFile) throws WxPayException,IOException { | |||
| String url = String.format("%s/v3/merchant/media/upload", this.payService.getPayBaseUrl()); | |||
| try (FileInputStream s1 = new FileInputStream(imageFile)) { | |||
| String sha256 = DigestUtils.sha256Hex(s1); | |||
| try (InputStream s2 = new FileInputStream(imageFile)) { | |||
| WechatPayUploadHttpPost request = new WechatPayUploadHttpPost.Builder(URI.create(url)) | |||
| .withImage(imageFile.getName(), sha256, s2) | |||
| .build(); | |||
| String result = this.payService.postV3(url, request); | |||
| return ImageUploadResult.fromJson(result); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public ImageUploadResult imageUploadV3(InputStream inputStream, String fileName) throws WxPayException, IOException { | |||
| String url = String.format("%s/v3/merchant/media/upload", this.payService.getPayBaseUrl()); | |||
| try(ByteArrayOutputStream bos = new ByteArrayOutputStream()) { | |||
| byte[] buffer = new byte[2048]; | |||
| int len; | |||
| while ((len = inputStream.read(buffer)) > -1) { | |||
| bos.write(buffer, 0, len); | |||
| } | |||
| bos.flush(); | |||
| byte[] data = bos.toByteArray(); | |||
| String sha256 = DigestUtils.sha256Hex(data); | |||
| WechatPayUploadHttpPost request = new WechatPayUploadHttpPost.Builder(URI.create(url)) | |||
| .withImage(fileName, sha256, new ByteArrayInputStream(data)) | |||
| .build(); | |||
| String result = this.payService.postV3(url, request); | |||
| return ImageUploadResult.fromJson(result); | |||
| } | |||
| } | |||
| } | |||
| @@ -208,6 +208,16 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl { | |||
| return this.requestV3(url.toString(), httpGet); | |||
| } | |||
| @Override | |||
| public String getV3WithWechatPaySerial(String url) throws WxPayException { | |||
| HttpGet httpGet = new HttpGet(url); | |||
| httpGet.addHeader("Accept", "application/json"); | |||
| httpGet.addHeader("Content-Type", "application/json"); | |||
| String serialNumber = getConfig().getVerifier().getValidCertificate().getSerialNumber().toString(16).toUpperCase(); | |||
| httpGet.addHeader("Wechatpay-Serial", serialNumber); | |||
| return this.requestV3(url, httpGet); | |||
| } | |||
| @Override | |||
| public InputStream downloadV3(String url) throws WxPayException { | |||
| CloseableHttpClient httpClient = this.createApiV3HttpClient(); | |||
| @@ -95,6 +95,11 @@ public class WxPayServiceJoddHttpImpl extends BaseWxPayServiceImpl { | |||
| return null; | |||
| } | |||
| @Override | |||
| public String getV3WithWechatPaySerial(String url) throws WxPayException { | |||
| return null; | |||
| } | |||
| @Override | |||
| public InputStream downloadV3(String url) throws WxPayException { | |||
| return null; | |||