支付通知请求

This commit is contained in:
egan
2021-08-08 23:04:34 +08:00
parent 44c72fa710
commit 18654a399d
2 changed files with 132 additions and 0 deletions

View File

@@ -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<String, Object> body;
/**
* 存放请求头信息
*/
private Map<String, List<String>> headers;
public NoticeParams(Map<String, Object> body) {
this.body = body;
}
public NoticeParams(Map<String, Object> body, Map<String, List<String>> headers) {
this.body = body;
this.headers = headers;
}
public String getHeader(String name) {
List<String> value = this.headers.get(name);
return (null == value || value.isEmpty()) ? null : value.get(0);
}
public Enumeration<String> getHeaders(String name) {
List<String> value = this.headers.get(name);
return (Collections.enumeration(value != null ? value : Collections.<String>emptySet()));
}
public Enumeration<String> getHeaderNames() {
return Collections.enumeration(this.headers.keySet());
}
public Map<String, Object> getBody() {
return body;
}
public void setBody(Map<String, Object> body) {
this.body = body;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public void setHeaders(Map<String, List<String>> headers) {
this.headers = headers;
}
}

View File

@@ -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<String> getHeaders(String name);
/**
* 获取所有的请求头名称
* @return 请求头名称
*/
Enumeration<String> getHeaderNames();
/**
* 输入流
* @return 输入流
* @throws IOException IOException
*/
InputStream getInputStream() throws IOException;
/**
* 获取所有的请求参数
* @return 请求参数
*/
Map<String, String[]> getParameterMap();
}