diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeParams.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeParams.java new file mode 100644 index 0000000..71880b0 --- /dev/null +++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeParams.java @@ -0,0 +1,85 @@ +/* + * Copyright 2017-2021 the original Egan. + * email egzosn@gmail.com + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package com.egzosn.pay.common.bean; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.Map; + +/** + * 通知参数 + * + * @author Egan + * email egzosn@gmail.com + * date 2021/8/8 + */ +public class NoticeParams { + + + /** + * 为了获取request里面传过来的动态参数 + */ + private Map body; + + /** + * 存放请求头信息 + */ + private Map> headers; + + + public NoticeParams(Map body) { + this.body = body; + } + + public NoticeParams(Map body, Map> headers) { + this.body = body; + this.headers = headers; + } + + public String getHeader(String name) { + List value = this.headers.get(name); + return (null == value || value.isEmpty()) ? null : value.get(0); + } + + public Enumeration getHeaders(String name) { + List value = this.headers.get(name); + return (Collections.enumeration(value != null ? value : Collections.emptySet())); + } + + public Enumeration getHeaderNames() { + return Collections.enumeration(this.headers.keySet()); + } + + + public Map getBody() { + return body; + } + + public void setBody(Map body) { + this.body = body; + } + + public Map> getHeaders() { + return headers; + } + + public void setHeaders(Map> headers) { + this.headers = headers; + } +} diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeRequest.java b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeRequest.java new file mode 100644 index 0000000..3ec9af7 --- /dev/null +++ b/pay-java-common/src/main/java/com/egzosn/pay/common/bean/NoticeRequest.java @@ -0,0 +1,47 @@ +package com.egzosn.pay.common.bean; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.Map; + +/** + * 通知请求 + * @author Egan + * email egzosn@gmail.com + * date 2021/8/8 + */ +public interface NoticeRequest { + + /** + * 根据请求头名称获取请求头信息 + * @param name 名称 + * @return 请求头值 + */ + String getHeader(String name); + /** + * 根据请求头名称获取请求头信息 + * @param name 名称 + * @return 请求头值 + */ + Enumeration getHeaders(String name); + + /** + * 获取所有的请求头名称 + * @return 请求头名称 + */ + Enumeration getHeaderNames(); + + /** + * 输入流 + * @return 输入流 + * @throws IOException IOException + */ + InputStream getInputStream() throws IOException; + + /** + * 获取所有的请求参数 + * @return 请求参数 + */ + Map getParameterMap(); +}