添加网站文件
This commit is contained in:
235
vendor/alipaysdk/easysdk/java/README.md
vendored
Normal file
235
vendor/alipaysdk/easysdk/java/README.md
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
[](https://mvnrepository.com/artifact/com.alipay.sdk/alipay-easysdk)
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Falipay%2Falipay-easysdk?ref=badge_shield)
|
||||
|
||||
欢迎使用 Alipay **Easy** SDK for Java 。
|
||||
|
||||
Alipay Esay SDK for Java让您不用复杂编程即可访支付宝开放平台开放的各项常用能力,SDK可以自动帮您满足能力调用过程中所需的证书校验、加签、验签、发送HTTP请求等非功能性要求。
|
||||
|
||||
下面向您介绍Alipay Easy SDK for Java 的基本设计理念和使用方法。
|
||||
|
||||
## 设计理念
|
||||
不同于原有的[Alipay SDK](https://github.com/alipay/alipay-sdk-java-all)通用而全面的设计理念,Alipay Easy SDK对开放能力的API进行了更加贴近高频场景的精心设计与裁剪,简化了服务端调用方式,让调用API像使用语言内置的函数一样简便。
|
||||
|
||||
同时,您也不必担心面向高频场景提炼的API可能无法完全契合自己的个性化场景,Alipay Easy SDK支持灵活的动态扩展方式,同样可以满足低频参数、低频API的使用需求。
|
||||
|
||||
Alipay Easy SDK提供了与[能力地图](https://opendocs.alipay.com/mini/00am3f)相对应的代码组织结构,让开发者可以快速找到不同能力对应的API。
|
||||
|
||||
Alipay Easy SDK主要目标是提升开发者在**服务端**集成支付宝开放平台开放的各类核心能力的效率。
|
||||
|
||||
## 环境要求
|
||||
1. Alipay Easy SDK for Java 需要配合`JDK 1.8`或其以上版本。
|
||||
|
||||
2. 使用 Alipay Easy SDK for Java 之前 ,您需要先前往[支付宝开发平台-开发者中心](https://openhome.alipay.com/platform/developerIndex.htm)完成开发者接入的一些准备工作,包括创建应用、为应用添加功能包、设置应用的接口加签方式等。
|
||||
|
||||
3. 准备工作完成后,注意保存如下信息,后续将作为使用SDK的输入。
|
||||
|
||||
* 加签模式为公钥证书模式时(推荐)
|
||||
|
||||
`AppId`、`应用的私钥`、`应用公钥证书文件`、`支付宝公钥证书文件`、`支付宝根证书文件`
|
||||
|
||||
* 加签模式为公钥模式时
|
||||
|
||||
`AppId`、`应用的私钥`、`支付宝公钥`
|
||||
|
||||
## 安装依赖
|
||||
### 通过[Maven](https://mvnrepository.com/artifact/com.alipay.sdk/alipay-easysdk)来管理项目依赖
|
||||
推荐通过Maven来管理项目依赖,您只需在项目的`pom.xml`文件中声明如下依赖
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-easysdk</artifactId>
|
||||
<version>Use the version shown in the maven badge</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
### 普通调用
|
||||
以下这段代码示例向您展示了使用Alipay Easy SDK for Java调用一个API的3个主要步骤:
|
||||
|
||||
1. 设置参数(全局只需设置一次)。
|
||||
2. 发起API调用。
|
||||
3. 处理响应或异常。
|
||||
|
||||
```java
|
||||
import com.alipay.easysdk.factory.Factory;
|
||||
import com.alipay.easysdk.factory.Factory.Payment;
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
import com.alipay.easysdk.kernel.util.ResponseChecker;
|
||||
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// 1. 设置参数(全局只需设置一次)
|
||||
Factory.setOptions(getOptions());
|
||||
try {
|
||||
// 2. 发起API调用(以创建当面付收款二维码为例)
|
||||
AlipayTradePrecreateResponse response = Payment.FaceToFace()
|
||||
.preCreate("Apple iPhone11 128G", "2234567890", "5799.00");
|
||||
// 3. 处理响应或异常
|
||||
if (ResponseChecker.success(response)) {
|
||||
System.out.println("调用成功");
|
||||
} else {
|
||||
System.err.println("调用失败,原因:" + response.msg + "," + response.subMsg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("调用遭遇异常,原因:" + e.getMessage());
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Config getOptions() {
|
||||
Config config = new Config();
|
||||
config.protocol = "https";
|
||||
config.gatewayHost = "openapi.alipay.com";
|
||||
config.signType = "RSA2";
|
||||
|
||||
config.appId = "<-- 请填写您的AppId,例如:2019091767145019 -->";
|
||||
|
||||
// 为避免私钥随源码泄露,推荐从文件中读取私钥字符串而不是写入源码中
|
||||
config.merchantPrivateKey = "<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->";
|
||||
|
||||
//注:证书文件路径支持设置为文件系统中的路径或CLASS_PATH中的路径,优先从文件系统中加载,加载失败后会继续尝试从CLASS_PATH中加载
|
||||
config.merchantCertPath = "<-- 请填写您的应用公钥证书文件路径,例如:/foo/appCertPublicKey_2019051064521003.crt -->";
|
||||
config.alipayCertPath = "<-- 请填写您的支付宝公钥证书文件路径,例如:/foo/alipayCertPublicKey_RSA2.crt -->";
|
||||
config.alipayRootCertPath = "<-- 请填写您的支付宝根证书文件路径,例如:/foo/alipayRootCert.crt -->";
|
||||
|
||||
//注:如果采用非证书模式,则无需赋值上面的三个证书路径,改为赋值如下的支付宝公钥字符串即可
|
||||
// config.alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->";
|
||||
|
||||
//可设置异步通知接收服务地址(可选)
|
||||
config.notifyUrl = "<-- 请填写您的支付类接口异步通知接收服务地址,例如:https://www.test.com/callback -->";
|
||||
|
||||
//可设置AES密钥,调用AES加解密相关接口时需要(可选)
|
||||
config.encryptKey = "<-- 请填写您的AES密钥,例如:aa4BtZ4tspm2wnXLb1ThQA== -->";
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 扩展调用
|
||||
#### ISV代调用
|
||||
|
||||
```java
|
||||
Factory.Payment.FaceToFace()
|
||||
// 调用agent扩展方法,设置app_auth_token,完成ISV代调用
|
||||
.agent("ca34ea491e7146cc87d25fca24c4cD11")
|
||||
.preCreate("Apple iPhone11 128G", "2234567890", "5799.00");
|
||||
```
|
||||
|
||||
#### 设置独立的异步通知地址
|
||||
|
||||
```java
|
||||
Factory.Payment.FaceToFace()
|
||||
// 调用asyncNotify扩展方法,可以为每此API调用,设置独立的异步通知地址
|
||||
// 此处设置的异步通知地址的优先级高于全局Config中配置的异步通知地址
|
||||
.asyncNotify("https://www.test.com/callback")
|
||||
.preCreate("Apple iPhone11 128G", "2234567890", "5799.00");
|
||||
```
|
||||
|
||||
#### 设置可选业务参数
|
||||
|
||||
```java
|
||||
List<Object> goodsDetailList = new ArrayList<>();
|
||||
Map<String, Object> goodsDetail = new HashMap<>();
|
||||
goodsDetail.put("goods_id", "apple-01");
|
||||
goodsDetail.put("goods_name", "Apple iPhone11 128G");
|
||||
goodsDetail.put("quantity", 1);
|
||||
goodsDetail.put("price", "5799.00");
|
||||
goodsDetailList.add(goodsDetail);
|
||||
|
||||
Factory.Payment.FaceToFace()
|
||||
// 调用optional扩展方法,完成可选业务参数(biz_content下的可选字段)的设置
|
||||
.optional("seller_id", "2088102146225135")
|
||||
.optional("discountable_amount", "8.88")
|
||||
.optional("goods_detail", goodsDetailList)
|
||||
.preCreate("Apple iPhone11 128G", "2234567890", "5799.00");
|
||||
|
||||
|
||||
Map<String, Object> optionalArgs = new HashMap<>();
|
||||
optionalArgs.put("seller_id", "2088102146225135");
|
||||
optionalArgs.put("discountable_amount", "8.88");
|
||||
optionalArgs.put("goods_detail", goodsDetailList);
|
||||
|
||||
Factory.Payment.FaceToFace()
|
||||
// 也可以调用batchOptional扩展方法,批量设置可选业务参数(biz_content下的可选字段)
|
||||
.batchOptional(optionalArgs)
|
||||
.preCreate("Apple iPhone11 128G", "2234567890", "5799.00");
|
||||
```
|
||||
#### 多种扩展灵活组合
|
||||
|
||||
```java
|
||||
// 多种扩展方式可灵活组装(对扩展方法的调用顺序没有要求)
|
||||
Factory.Payment.FaceToFace()
|
||||
.agent("ca34ea491e7146cc87d25fca24c4cD11")
|
||||
.asyncNotify("https://www.test.com/callback")
|
||||
.optional("seller_id", "2088102146225135")
|
||||
.preCreate("Apple iPhone11 128G", "2234567890", "5799.00");
|
||||
```
|
||||
|
||||
## API组织规范
|
||||
在Alipay Easy SDK中,API的引用路径与能力地图的组织层次一致,遵循如下规范
|
||||
|
||||
> Factory.能力名称.场景名称().接口方法名称( ... )
|
||||
|
||||
比如,如果您想要使用[能力地图](https://opendocs.alipay.com/mini/00am3f)中`营销能力`下的`模板消息`场景中的`小程序发送模板消息`,只需按如下形式编写调用代码即可。
|
||||
|
||||
`Factory.Marketing.TemplateMessage().send( ... )`
|
||||
|
||||
其中,接口方法名称通常是对其依赖的OpenAPI功能的一个最简概况,接口方法的出入参与OpenAPI中同名参数含义一致,可参照OpenAPI相关参数的使用说明。
|
||||
|
||||
Alipay Easy SDK将致力于保持良好的API命名,以符合开发者的编程直觉。
|
||||
|
||||
## 已支持的API列表
|
||||
|
||||
| 能力类别 | 场景类别 | 接口方法名称 | 调用的OpenAPI名称 |
|
||||
|-----------|-----------------|------------------------|-----------------------------------------------------------|
|
||||
| Base | OAuth | getToken | alipay\.system\.oauth\.token |
|
||||
| Base | OAuth | refreshToken | alipay\.system\.oauth\.token |
|
||||
| Base | Qrcode | create | alipay\.open\.app\.qrcode\.create |
|
||||
| Base | Image | upload | alipay\.offline\.material\.image\.upload |
|
||||
| Base | Video | upload | alipay\.offline\.material\.image\.upload |
|
||||
| Member | Identification | init | alipay\.user\.certify\.open\.initialize |
|
||||
| Member | Identification | certify | alipay\.user\.certify\.open\.certify |
|
||||
| Member | Identification | query | alipay\.user\.certify\.open\.query |
|
||||
| Payment | Common | create | alipay\.trade\.create |
|
||||
| Payment | Common | query | alipay\.trade\.query |
|
||||
| Payment | Common | refund | alipay\.trade\.refund |
|
||||
| Payment | Common | close | alipay\.trade\.close |
|
||||
| Payment | Common | cancel | alipay\.trade\.cancel |
|
||||
| Payment | Common | queryRefund | alipay\.trade\.fastpay\.refund\.query |
|
||||
| Payment | Common | downloadBill | alipay\.data\.dataservice\.bill\.downloadurl\.query |
|
||||
| Payment | Common | verifyNotify | - |
|
||||
| Payment | Huabei | create | alipay\.trade\.create |
|
||||
| Payment | FaceToFace | pay | alipay\.trade\.pay |
|
||||
| Payment | FaceToFace | precreate | alipay\.trade\.precreate |
|
||||
| Payment | App | pay | alipay\.trade\.app\.pay |
|
||||
| Payment | Page | pay | alipay\.trade\.page\.pay |
|
||||
| Payment | Wap | pay | alipay\.trade\.wap\.pay |
|
||||
| Security | TextRisk | detect | alipay\.security\.risk\.content\.detect |
|
||||
| Marketing | Pass | createTemplate | alipay\.pass\.template\.add |
|
||||
| Marketing | Pass | updateTemplate | alipay\.pass\.template\.update |
|
||||
| Marketing | Pass | addInstance | alipay\.pass\.instance\.add |
|
||||
| Marketing | Pass | updateInstance | alipay\.pass\.instance\.update |
|
||||
| Marketing | TemplateMessage | send | alipay\.open\.app\.mini\.templatemessage\.send |
|
||||
| Marketing | OpenLife | createImageTextContent | alipay\.open\.public\.message\.content\.create |
|
||||
| Marketing | OpenLife | modifyImageTextContent | alipay\.open\.public\.message\.content\.modify |
|
||||
| Marketing | OpenLife | sendText | alipay\.open\.public\.message\.total\.send |
|
||||
| Marketing | OpenLife | sendImageText | alipay\.open\.public\.message\.total\.send |
|
||||
| Marketing | OpenLife | sendSingleMessage | alipay\.open\.public\.message\.single\.send |
|
||||
| Marketing | OpenLife | recallMessage | alipay\.open\.public\.life\.msg\.recall |
|
||||
| Marketing | OpenLife | setIndustry | alipay\.open\.public\.template\.message\.industry\.modify |
|
||||
| Marketing | OpenLife | getIndustry | alipay\.open\.public\.setting\.category\.query |
|
||||
| Util | AES | decrypt | - |
|
||||
| Util | AES | encrypt | - |
|
||||
| Util | Generic | execute | - |
|
||||
| Util | Generic | sdkExecute | - |
|
||||
| Util | Generic | fileExecute | - |
|
||||
|
||||
> 注:更多高频场景的API持续更新中,敬请期待。
|
||||
|
||||
## 文档
|
||||
[API Doc](./../APIDoc.md)
|
||||
|
||||
[Alipay Easy SDK](./../README.md)
|
||||
195
vendor/alipaysdk/easysdk/java/pom.xml
vendored
Normal file
195
vendor/alipaysdk/easysdk/java/pom.xml
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-easysdk</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<name>Alipay Easy SDK</name>
|
||||
<url>https://open.alipay.com</url>
|
||||
<description>Alipay Easy SDK for Java
|
||||
allows you to enjoy a minimalist programming experience
|
||||
and quickly access the various high-frequency capabilities of the Alipay Open Platform.
|
||||
</description>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mvnrepository</id>
|
||||
<name>mvnrepository</name>
|
||||
<url>http://www.mvnrepository.com/</url>
|
||||
<layout>default</layout>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-access</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>easysdk-kernel</artifactId>
|
||||
<version>1.0.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>sonatype-nexus-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>MIT License</name>
|
||||
<url>http://www.opensource.org/licenses/mit-license.php</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:alipay/alipay-easysdk.git</connection>
|
||||
<developerConnection>scm:git:ssh://github.com:alipay/alipay-easysdk.git</developerConnection>
|
||||
<url>http://github.com/alipay/alipay-easysdk/tree/master/java</url>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>antopen</id>
|
||||
<name>antopen</name>
|
||||
<email>antopen@aliyun.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>deploy</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-scm-plugin</artifactId>
|
||||
<version>1.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<configuration>
|
||||
<aggregate>true</aggregate>
|
||||
<charset>UTF-8</charset>
|
||||
<encoding>UTF-8</encoding>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
178
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/image/Client.java
vendored
Normal file
178
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/image/Client.java
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.image;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.base.image.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse upload(String imageName, String imageFilePath) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 100000),
|
||||
new TeaPair("readTimeout", 100000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.offline.material.image.upload"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = new java.util.HashMap<>();
|
||||
java.util.Map<String, String> textParams = TeaConverter.buildMap(
|
||||
new TeaPair("image_type", "jpg"),
|
||||
new TeaPair("image_name", imageName)
|
||||
);
|
||||
java.util.Map<String, String> fileParams = TeaConverter.buildMap(
|
||||
new TeaPair("image_content", imageFilePath)
|
||||
);
|
||||
String boundary = _kernel.getRandomBoundary();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", _kernel.concatStr("multipart/form-data;charset=utf-8;boundary=", boundary))
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams
|
||||
));
|
||||
request_.body = _kernel.toMultipartRequestBody(textParams, fileParams, boundary);
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.offline.material.image.upload");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOfflineMaterialImageUploadResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOfflineMaterialImageUploadResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.image.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOfflineMaterialImageUploadResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("image_id")
|
||||
@Validation(required = true)
|
||||
public String imageId;
|
||||
|
||||
@NameInMap("image_url")
|
||||
@Validation(required = true)
|
||||
public String imageUrl;
|
||||
|
||||
public static AlipayOfflineMaterialImageUploadResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOfflineMaterialImageUploadResponse self = new AlipayOfflineMaterialImageUploadResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setImageId(String imageId) {
|
||||
this.imageId = imageId;
|
||||
return this;
|
||||
}
|
||||
public String getImageId() {
|
||||
return this.imageId;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
return this;
|
||||
}
|
||||
public String getImageUrl() {
|
||||
return this.imageUrl;
|
||||
}
|
||||
|
||||
}
|
||||
261
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/oauth/Client.java
vendored
Normal file
261
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/oauth/Client.java
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.oauth;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.base.oauth.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse getToken(String code) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.system.oauth.token"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = new java.util.HashMap<>();
|
||||
java.util.Map<String, String> textParams = TeaConverter.buildMap(
|
||||
new TeaPair("grant_type", "authorization_code"),
|
||||
new TeaPair("code", code)
|
||||
);
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.system.oauth.token");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipaySystemOauthTokenResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipaySystemOauthTokenResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse refreshToken(String refreshToken) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.system.oauth.token"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = new java.util.HashMap<>();
|
||||
java.util.Map<String, String> textParams = TeaConverter.buildMap(
|
||||
new TeaPair("grant_type", "refresh_token"),
|
||||
new TeaPair("refresh_token", refreshToken)
|
||||
);
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.system.oauth.token");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipaySystemOauthTokenResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipaySystemOauthTokenResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.oauth.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipaySystemOauthTokenResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("user_id")
|
||||
@Validation(required = true)
|
||||
public String userId;
|
||||
|
||||
@NameInMap("access_token")
|
||||
@Validation(required = true)
|
||||
public String accessToken;
|
||||
|
||||
@NameInMap("expires_in")
|
||||
@Validation(required = true)
|
||||
public Long expiresIn;
|
||||
|
||||
@NameInMap("refresh_token")
|
||||
@Validation(required = true)
|
||||
public String refreshToken;
|
||||
|
||||
@NameInMap("re_expires_in")
|
||||
@Validation(required = true)
|
||||
public Long reExpiresIn;
|
||||
|
||||
public static AlipaySystemOauthTokenResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipaySystemOauthTokenResponse self = new AlipaySystemOauthTokenResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
return this;
|
||||
}
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
return this;
|
||||
}
|
||||
public String getAccessToken() {
|
||||
return this.accessToken;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setExpiresIn(Long expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
return this;
|
||||
}
|
||||
public Long getExpiresIn() {
|
||||
return this.expiresIn;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
return this;
|
||||
}
|
||||
public String getRefreshToken() {
|
||||
return this.refreshToken;
|
||||
}
|
||||
|
||||
public AlipaySystemOauthTokenResponse setReExpiresIn(Long reExpiresIn) {
|
||||
this.reExpiresIn = reExpiresIn;
|
||||
return this;
|
||||
}
|
||||
public Long getReExpiresIn() {
|
||||
return this.reExpiresIn;
|
||||
}
|
||||
|
||||
}
|
||||
176
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/qrcode/Client.java
vendored
Normal file
176
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/qrcode/Client.java
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.qrcode;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.base.qrcode.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayOpenAppQrcodeCreateResponse create(String urlParam, String queryParam, String describe) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.app.qrcode.create"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("url_param", urlParam),
|
||||
new TeaPair("query_param", queryParam),
|
||||
new TeaPair("describe", describe)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.app.qrcode.create");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenAppQrcodeCreateResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenAppQrcodeCreateResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.qrcode.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenAppQrcodeCreateResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("qr_code_url")
|
||||
@Validation(required = true)
|
||||
public String qrCodeUrl;
|
||||
|
||||
public static AlipayOpenAppQrcodeCreateResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenAppQrcodeCreateResponse self = new AlipayOpenAppQrcodeCreateResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenAppQrcodeCreateResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenAppQrcodeCreateResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenAppQrcodeCreateResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenAppQrcodeCreateResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenAppQrcodeCreateResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayOpenAppQrcodeCreateResponse setQrCodeUrl(String qrCodeUrl) {
|
||||
this.qrCodeUrl = qrCodeUrl;
|
||||
return this;
|
||||
}
|
||||
public String getQrCodeUrl() {
|
||||
return this.qrCodeUrl;
|
||||
}
|
||||
|
||||
}
|
||||
178
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/video/Client.java
vendored
Normal file
178
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/base/video/Client.java
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.video;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.base.video.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse upload(String videoName, String videoFilePath) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 100000),
|
||||
new TeaPair("readTimeout", 100000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.offline.material.image.upload"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = new java.util.HashMap<>();
|
||||
java.util.Map<String, String> textParams = TeaConverter.buildMap(
|
||||
new TeaPair("image_type", "mp4"),
|
||||
new TeaPair("image_name", videoName)
|
||||
);
|
||||
java.util.Map<String, String> fileParams = TeaConverter.buildMap(
|
||||
new TeaPair("image_content", videoFilePath)
|
||||
);
|
||||
String boundary = _kernel.getRandomBoundary();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", _kernel.concatStr("multipart/form-data;charset=utf-8;boundary=", boundary))
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams
|
||||
));
|
||||
request_.body = _kernel.toMultipartRequestBody(textParams, fileParams, boundary);
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.offline.material.image.upload");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOfflineMaterialImageUploadResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOfflineMaterialImageUploadResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.base.video.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOfflineMaterialImageUploadResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("image_id")
|
||||
@Validation(required = true)
|
||||
public String imageId;
|
||||
|
||||
@NameInMap("image_url")
|
||||
@Validation(required = true)
|
||||
public String imageUrl;
|
||||
|
||||
public static AlipayOfflineMaterialImageUploadResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOfflineMaterialImageUploadResponse self = new AlipayOfflineMaterialImageUploadResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setImageId(String imageId) {
|
||||
this.imageId = imageId;
|
||||
return this;
|
||||
}
|
||||
public String getImageId() {
|
||||
return this.imageId;
|
||||
}
|
||||
|
||||
public AlipayOfflineMaterialImageUploadResponse setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
return this;
|
||||
}
|
||||
public String getImageUrl() {
|
||||
return this.imageUrl;
|
||||
}
|
||||
|
||||
}
|
||||
259
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/factory/Factory.java
vendored
Normal file
259
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/factory/Factory.java
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
/**
|
||||
* Alipay.com Inc. Copyright (c) 2004-2020 All Rights Reserved.
|
||||
*/
|
||||
package com.alipay.easysdk.factory;
|
||||
|
||||
import com.alipay.easysdk.kernel.AlipayConstants;
|
||||
import com.alipay.easysdk.kernel.Client;
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
import com.alipay.easysdk.kernel.Context;
|
||||
import com.alipay.easysdk.kms.aliyun.AliyunKMSClient;
|
||||
import com.alipay.easysdk.kms.aliyun.AliyunKMSSigner;
|
||||
import com.aliyun.tea.TeaModel;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
/**
|
||||
* 客户端工厂,用于快速配置和访问各种场景下的API Client
|
||||
*
|
||||
* 注:该Factory获取的Client不可储存重复使用,请每次均通过Factory完成调用
|
||||
*
|
||||
* @author zhongyu
|
||||
* @version $Id: Factory.java, v 0.1 2020年01月18日 11:26 AM zhongyu Exp $
|
||||
*/
|
||||
public class Factory {
|
||||
|
||||
public static final String SDK_VERSION = "alipay-easysdk-java-2.1.2";
|
||||
|
||||
/**
|
||||
* 将一些初始化耗时较多的信息缓存在上下文中
|
||||
*/
|
||||
private static Context context;
|
||||
|
||||
/**
|
||||
* 设置客户端参数,只需设置一次,即可反复使用各种场景下的API Client
|
||||
*
|
||||
* @param options 客户端参数对象
|
||||
*/
|
||||
public static void setOptions(Config options) {
|
||||
try {
|
||||
context = new Context(options, SDK_VERSION);
|
||||
|
||||
if (AlipayConstants.AliyunKMS.equals(context.getConfig(AlipayConstants.SIGN_PROVIDER_CONFIG_KEY))) {
|
||||
context.setSigner(new AliyunKMSSigner(new AliyunKMSClient(TeaModel.buildMap(options))));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取调用OpenAPI所需的客户端实例
|
||||
* 本方法用于调用SDK扩展包中的API Client下的方法
|
||||
*
|
||||
* 注:返回的实例不可重复使用,只可用于单次调用
|
||||
*
|
||||
* @param client API Client的类型对象
|
||||
* @return client实例,用于发起单次调用
|
||||
*/
|
||||
public static <T> T getClient(Class<T> client) {
|
||||
try {
|
||||
Constructor<T> constructor = client.getConstructor(Client.class);
|
||||
context.setSdkVersion(getSdkVersion(client));
|
||||
return constructor.newInstance(new Client(context));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> String getSdkVersion(Class<T> client) {
|
||||
return context.getSdkVersion() + "-" + client.getCanonicalName()
|
||||
.replace("com.alipay.easysdk.", "")
|
||||
.replace(".Client", "")
|
||||
.replace(".", "-");
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付能力相关
|
||||
*/
|
||||
public static class Payment {
|
||||
/**
|
||||
* 获取支付通用API Client
|
||||
*
|
||||
* @return 支付通用API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.payment.common.Client Common() throws Exception {
|
||||
return new com.alipay.easysdk.payment.common.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取花呗相关API Client
|
||||
*
|
||||
* @return 花呗相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.payment.huabei.Client Huabei() throws Exception {
|
||||
return new com.alipay.easysdk.payment.huabei.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当面付相关API Client
|
||||
*
|
||||
* @return 当面付相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.payment.facetoface.Client FaceToFace() throws Exception {
|
||||
return new com.alipay.easysdk.payment.facetoface.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电脑网站支付相关API Client
|
||||
*
|
||||
* @return 电脑网站支付相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.payment.page.Client Page() throws Exception {
|
||||
return new com.alipay.easysdk.payment.page.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机网站支付相关API Client
|
||||
*
|
||||
* @return 手机网站支付相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.payment.wap.Client Wap() throws Exception {
|
||||
return new com.alipay.easysdk.payment.wap.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机APP支付相关API Client
|
||||
*
|
||||
* @return 手机APP支付相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.payment.app.Client App() throws Exception {
|
||||
return new com.alipay.easysdk.payment.app.Client(new Client(context));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础能力相关
|
||||
*/
|
||||
public static class Base {
|
||||
/**
|
||||
* 获取图片相关API Client
|
||||
*
|
||||
* @return 图片相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.base.image.Client Image() throws Exception {
|
||||
return new com.alipay.easysdk.base.image.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频相关API Client
|
||||
*
|
||||
* @return 视频相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.base.video.Client Video() throws Exception {
|
||||
return new com.alipay.easysdk.base.video.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取OAuth认证相关API Client
|
||||
*
|
||||
* @return OAuth认证相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.base.oauth.Client OAuth() throws Exception {
|
||||
return new com.alipay.easysdk.base.oauth.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序二维码相关API Client
|
||||
*
|
||||
* @return 小程序二维码相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.base.qrcode.Client Qrcode() throws Exception {
|
||||
return new com.alipay.easysdk.base.qrcode.Client(new Client(context));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 营销能力相关
|
||||
*/
|
||||
public static class Marketing {
|
||||
/**
|
||||
* 获取生活号相关API Client
|
||||
*
|
||||
* @return 生活号相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.marketing.openlife.Client OpenLife() throws Exception {
|
||||
return new com.alipay.easysdk.marketing.openlife.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付宝卡包相关API Client
|
||||
*
|
||||
* @return 支付宝卡包相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.marketing.pass.Client Pass() throws Exception {
|
||||
return new com.alipay.easysdk.marketing.pass.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序模板消息相关API Client
|
||||
*
|
||||
* @return 小程序模板消息相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.marketing.templatemessage.Client TemplateMessage() throws Exception {
|
||||
return new com.alipay.easysdk.marketing.templatemessage.Client(new Client(context));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员能力相关
|
||||
*/
|
||||
public static class Member {
|
||||
/**
|
||||
* 获取支付宝身份认证相关API Client
|
||||
*
|
||||
* @return 支付宝身份认证相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.member.identification.Client Identification() throws Exception {
|
||||
return new com.alipay.easysdk.member.identification.Client(new Client(context));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全能力相关
|
||||
*/
|
||||
public static class Security {
|
||||
/**
|
||||
* 获取文本风险识别相关API Client
|
||||
*
|
||||
* @return 文本风险识别相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.security.textrisk.Client TextRisk() throws Exception {
|
||||
return new com.alipay.easysdk.security.textrisk.Client(new Client(context));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助工具
|
||||
*/
|
||||
public static class Util {
|
||||
/**
|
||||
* 获取OpenAPI通用接口,可通过自行拼装参数,调用几乎所有OpenAPI
|
||||
*
|
||||
* @return OpenAPI通用接口
|
||||
*/
|
||||
public static com.alipay.easysdk.util.generic.Client Generic() throws Exception {
|
||||
return new com.alipay.easysdk.util.generic.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取AES128加解密相关API Client,常用于会员手机号的解密
|
||||
*
|
||||
* @return AES128加解密相关API Client
|
||||
*/
|
||||
public static com.alipay.easysdk.util.aes.Client AES() throws Exception {
|
||||
return new com.alipay.easysdk.util.aes.Client(new Client(context));
|
||||
}
|
||||
}
|
||||
}
|
||||
229
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/factory/MultipleFactory.java
vendored
Normal file
229
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/factory/MultipleFactory.java
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
* Alipay.com Inc.
|
||||
* Copyright (c) 2004-2020 All Rights Reserved.
|
||||
*/
|
||||
package com.alipay.easysdk.factory;
|
||||
|
||||
import com.alipay.easysdk.kernel.AlipayConstants;
|
||||
import com.alipay.easysdk.kernel.Client;
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
import com.alipay.easysdk.kernel.Context;
|
||||
import com.alipay.easysdk.kms.aliyun.AliyunKMSClient;
|
||||
import com.alipay.easysdk.kms.aliyun.AliyunKMSSigner;
|
||||
import com.aliyun.tea.TeaModel;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
/**
|
||||
* @author junying
|
||||
* @version : MultipleFactory.java, v 0.1 2020年12月23日 2:14 下午 junying Exp $
|
||||
*/
|
||||
public class MultipleFactory {
|
||||
|
||||
public final String SDK_VERSION = "alipay-easysdk-java-2.1.2";
|
||||
|
||||
/**
|
||||
* 将一些初始化耗时较多的信息缓存在上下文中
|
||||
*/
|
||||
public Context context;
|
||||
|
||||
/**
|
||||
* 设置客户端参数,只需设置一次,即可反复使用各种场景下的API Client
|
||||
*
|
||||
* @param options 客户端参数对象
|
||||
*/
|
||||
public void setOptions(Config options) {
|
||||
try {
|
||||
context = new Context(options, SDK_VERSION);
|
||||
|
||||
if (AlipayConstants.AliyunKMS.equals(context.getConfig(AlipayConstants.SIGN_PROVIDER_CONFIG_KEY))) {
|
||||
context.setSigner(new AliyunKMSSigner(new AliyunKMSClient(TeaModel.buildMap(options))));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取调用OpenAPI所需的客户端实例
|
||||
* 本方法用于调用SDK扩展包中的API Client下的方法
|
||||
* <p>
|
||||
* 注:返回的实例不可重复使用,只可用于单次调用
|
||||
*
|
||||
* @param client API Client的类型对象
|
||||
* @return client实例,用于发起单次调用
|
||||
*/
|
||||
public <T> T getClient(Class<T> client) {
|
||||
try {
|
||||
Constructor<T> constructor = client.getConstructor(Client.class);
|
||||
context.setSdkVersion(getSdkVersion(client));
|
||||
return constructor.newInstance(new Client(context));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> String getSdkVersion(Class<T> client) {
|
||||
return context.getSdkVersion() + "-" + client.getCanonicalName()
|
||||
.replace("com.alipay.easysdk.", "")
|
||||
.replace(".Client", "")
|
||||
.replace(".", "-");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付通用API Client
|
||||
*
|
||||
* @return 支付通用API Client
|
||||
*/
|
||||
public com.alipay.easysdk.payment.common.Client Common() throws Exception {
|
||||
return new com.alipay.easysdk.payment.common.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取花呗相关API Client
|
||||
*
|
||||
* @return 花呗相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.payment.huabei.Client Huabei() throws Exception {
|
||||
return new com.alipay.easysdk.payment.huabei.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当面付相关API Client
|
||||
*
|
||||
* @return 当面付相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.payment.facetoface.Client FaceToFace() throws Exception {
|
||||
return new com.alipay.easysdk.payment.facetoface.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电脑网站支付相关API Client
|
||||
*
|
||||
* @return 电脑网站支付相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.payment.page.Client Page() throws Exception {
|
||||
return new com.alipay.easysdk.payment.page.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机网站支付相关API Client
|
||||
*
|
||||
* @return 手机网站支付相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.payment.wap.Client Wap() throws Exception {
|
||||
return new com.alipay.easysdk.payment.wap.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机APP支付相关API Client
|
||||
*
|
||||
* @return 手机APP支付相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.payment.app.Client App() throws Exception {
|
||||
return new com.alipay.easysdk.payment.app.Client(new Client(context));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取图片相关API Client
|
||||
*
|
||||
* @return 图片相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.base.image.Client Image() throws Exception {
|
||||
return new com.alipay.easysdk.base.image.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频相关API Client
|
||||
*
|
||||
* @return 视频相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.base.video.Client Video() throws Exception {
|
||||
return new com.alipay.easysdk.base.video.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取OAuth认证相关API Client
|
||||
*
|
||||
* @return OAuth认证相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.base.oauth.Client OAuth() throws Exception {
|
||||
return new com.alipay.easysdk.base.oauth.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序二维码相关API Client
|
||||
*
|
||||
* @return 小程序二维码相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.base.qrcode.Client Qrcode() throws Exception {
|
||||
return new com.alipay.easysdk.base.qrcode.Client(new Client(context));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取生活号相关API Client
|
||||
*
|
||||
* @return 生活号相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.marketing.openlife.Client OpenLife() throws Exception {
|
||||
return new com.alipay.easysdk.marketing.openlife.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付宝卡包相关API Client
|
||||
*
|
||||
* @return 支付宝卡包相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.marketing.pass.Client Pass() throws Exception {
|
||||
return new com.alipay.easysdk.marketing.pass.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序模板消息相关API Client
|
||||
*
|
||||
* @return 小程序模板消息相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.marketing.templatemessage.Client TemplateMessage() throws Exception {
|
||||
return new com.alipay.easysdk.marketing.templatemessage.Client(new Client(context));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取支付宝身份认证相关API Client
|
||||
*
|
||||
* @return 支付宝身份认证相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.member.identification.Client Identification() throws Exception {
|
||||
return new com.alipay.easysdk.member.identification.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文本风险识别相关API Client
|
||||
*
|
||||
* @return 文本风险识别相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.security.textrisk.Client TextRisk() throws Exception {
|
||||
return new com.alipay.easysdk.security.textrisk.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取OpenAPI通用接口,可通过自行拼装参数,调用几乎所有OpenAPI
|
||||
*
|
||||
* @return OpenAPI通用接口
|
||||
*/
|
||||
public com.alipay.easysdk.util.generic.Client Generic() throws Exception {
|
||||
return new com.alipay.easysdk.util.generic.Client(new Client(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取AES128加解密相关API Client,常用于会员手机号的解密
|
||||
*
|
||||
* @return AES128加解密相关API Client
|
||||
*/
|
||||
public com.alipay.easysdk.util.aes.Client AES() throws Exception {
|
||||
return new com.alipay.easysdk.util.aes.Client(new Client(context));
|
||||
}
|
||||
}
|
||||
286
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunKMSClient.java
vendored
Normal file
286
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunKMSClient.java
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
package com.alipay.easysdk.kms.aliyun;
|
||||
|
||||
import com.alipay.easysdk.kernel.AlipayConstants;
|
||||
import com.alipay.easysdk.kms.aliyun.models.AsymmetricSignRequest;
|
||||
import com.alipay.easysdk.kms.aliyun.models.AsymmetricSignResponse;
|
||||
import com.alipay.easysdk.kms.aliyun.models.GetPublicKeyRequest;
|
||||
import com.alipay.easysdk.kms.aliyun.models.GetPublicKeyResponse;
|
||||
import com.alipay.easysdk.kms.aliyun.models.RuntimeOptions;
|
||||
import com.aliyun.tea.TeaConverter;
|
||||
import com.aliyun.tea.TeaModel;
|
||||
import com.aliyun.tea.TeaPair;
|
||||
import org.bouncycastle.asn1.gm.GMNamedCurves;
|
||||
import org.bouncycastle.asn1.x9.X9ECParameters;
|
||||
import org.bouncycastle.crypto.Digest;
|
||||
import org.bouncycastle.crypto.digests.SM3Digest;
|
||||
import org.bouncycastle.crypto.params.ECDomainParameters;
|
||||
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
|
||||
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.math.ec.ECFieldElement;
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
|
||||
import java.security.KeyFactory;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Security;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 实现KMS的Client
|
||||
*
|
||||
* @author aliyunkms
|
||||
* @version $Id: AliyunKMSClient.java, v 0.1 2020年05月08日 10:53 PM aliyunkms Exp $
|
||||
*/
|
||||
public class AliyunKMSClient extends AliyunRpcClient {
|
||||
//支付宝signType与KMS签名算法映射表
|
||||
private static final Map<String, String> signAlgs = new HashMap<>();
|
||||
private static final Map<String, String> digestAlgs = new HashMap<>();
|
||||
private static final Map<String, String> namedCurves = new HashMap<>();
|
||||
|
||||
static {
|
||||
digestAlgs.put("RSA_PKCS1_SHA_256", "SHA-256");
|
||||
digestAlgs.put("RSA_PSS_SHA_256", "SHA-256");
|
||||
digestAlgs.put("ECDSA_SHA_256", "SHA-256");
|
||||
|
||||
namedCurves.put("SM2DSA", "sm2p256v1");
|
||||
|
||||
signAlgs.put("RSA2", "RSA_PKCS1_SHA_256");
|
||||
}
|
||||
|
||||
private String keyId;
|
||||
private String keyVersionId;
|
||||
private String algorithm;
|
||||
private PublicKey publicKey;
|
||||
private String protocol;
|
||||
private String method;
|
||||
private String version;
|
||||
private Integer connectTimeout;
|
||||
private Integer readTimeout;
|
||||
private Integer maxAttempts;
|
||||
private boolean ignoreSSL;
|
||||
|
||||
public AliyunKMSClient(Map<String, Object> config) throws Exception {
|
||||
super(config);
|
||||
this.keyId = (String) config.get("kmsKeyId");
|
||||
this.keyVersionId = (String) config.get("kmsKeyVersionId");
|
||||
this.algorithm = signAlgs.get((String) config.get(AlipayConstants.SIGN_TYPE_CONFIG_KEY));
|
||||
this.publicKey = null;
|
||||
this.protocol = "HTTPS";
|
||||
this.method = "POST";
|
||||
this.version = "2016-01-20";
|
||||
this.connectTimeout = 15000;
|
||||
this.readTimeout = 15000;
|
||||
this.maxAttempts = 3;
|
||||
this.ignoreSSL = false;
|
||||
}
|
||||
|
||||
private GetPublicKeyResponse _getPublicKey(GetPublicKeyRequest request) throws Exception {
|
||||
validateModel(request);
|
||||
RuntimeOptions runtime = RuntimeOptions.build(TeaConverter.buildMap(
|
||||
new TeaPair("connectTimeout", this.connectTimeout),
|
||||
new TeaPair("readTimeout", this.readTimeout),
|
||||
new TeaPair("maxAttempts", this.maxAttempts),
|
||||
new TeaPair("ignoreSSL", this.ignoreSSL)
|
||||
));
|
||||
return TeaModel.toModel(
|
||||
this.doRequest("GetPublicKey", this.protocol, this.method, this.version, TeaModel.buildMap(request), null, runtime),
|
||||
new GetPublicKeyResponse());
|
||||
}
|
||||
|
||||
private PublicKey getPublicKey(String keyId, String keyVersionId) throws Exception {
|
||||
GetPublicKeyRequest request = GetPublicKeyRequest.build(TeaConverter.buildMap(
|
||||
new TeaPair("KeyId", keyId),
|
||||
new TeaPair("KeyVersionId", keyVersionId)
|
||||
));
|
||||
GetPublicKeyResponse response = _getPublicKey(request);
|
||||
String pemKey = response.publicKey;
|
||||
pemKey = pemKey.replaceFirst("-----BEGIN PUBLIC KEY-----", "");
|
||||
pemKey = pemKey.replaceFirst("-----END PUBLIC KEY-----", "");
|
||||
pemKey = pemKey.replaceAll("\\s", "");
|
||||
byte[] derKey = Base64.decode(pemKey);
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(derKey);
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
return KeyFactory.getInstance("EC", "BC").generatePublic(keySpec);
|
||||
}
|
||||
|
||||
private byte[] getZ(ECPublicKeyParameters ecPublicKeyParameters, ECDomainParameters ecDomainParameters) {
|
||||
Digest digest = new SM3Digest();
|
||||
digest.reset();
|
||||
|
||||
String userID = "1234567812345678";
|
||||
addUserID(digest, userID.getBytes());
|
||||
|
||||
addFieldElement(digest, ecDomainParameters.getCurve().getA());
|
||||
addFieldElement(digest, ecDomainParameters.getCurve().getB());
|
||||
addFieldElement(digest, ecDomainParameters.getG().getAffineXCoord());
|
||||
addFieldElement(digest, ecDomainParameters.getG().getAffineYCoord());
|
||||
addFieldElement(digest, ecPublicKeyParameters.getQ().getAffineXCoord());
|
||||
addFieldElement(digest, ecPublicKeyParameters.getQ().getAffineYCoord());
|
||||
|
||||
byte[] result = new byte[digest.getDigestSize()];
|
||||
digest.doFinal(result, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addUserID(Digest digest, byte[] userID) {
|
||||
int len = userID.length * 8;
|
||||
digest.update((byte) (len >> 8 & 0xFF));
|
||||
digest.update((byte) (len & 0xFF));
|
||||
digest.update(userID, 0, userID.length);
|
||||
}
|
||||
|
||||
private void addFieldElement(Digest digest, ECFieldElement v) {
|
||||
byte[] p = v.getEncoded();
|
||||
digest.update(p, 0, p.length);
|
||||
}
|
||||
|
||||
private byte[] calcSM3Digest(PublicKey pubKey, byte[] message) {
|
||||
X9ECParameters x9ECParameters = GMNamedCurves.getByName(namedCurves.get(this.algorithm));
|
||||
ECDomainParameters ecDomainParameters = new ECDomainParameters(x9ECParameters.getCurve(), x9ECParameters.getG(),
|
||||
x9ECParameters.getN());
|
||||
BCECPublicKey localECPublicKey = (BCECPublicKey) pubKey;
|
||||
ECPublicKeyParameters ecPublicKeyParameters = new ECPublicKeyParameters(localECPublicKey.getQ(), ecDomainParameters);
|
||||
byte[] z = getZ(ecPublicKeyParameters, ecDomainParameters);
|
||||
Digest digest = new SM3Digest();
|
||||
digest.update(z, 0, z.length);
|
||||
digest.update(message, 0, message.length);
|
||||
byte[] result = new byte[digest.getDigestSize()];
|
||||
digest.doFinal(result, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
private AsymmetricSignResponse _asymmetricSign(AsymmetricSignRequest request) throws Exception {
|
||||
validateModel(request);
|
||||
RuntimeOptions runtime = RuntimeOptions.build(TeaConverter.buildMap(
|
||||
new TeaPair("connectTimeout", this.connectTimeout),
|
||||
new TeaPair("readTimeout", this.readTimeout),
|
||||
new TeaPair("maxAttempts", this.maxAttempts),
|
||||
new TeaPair("ignoreSSL", this.ignoreSSL)
|
||||
));
|
||||
return TeaModel.toModel(
|
||||
this.doRequest("AsymmetricSign", this.protocol, this.method, this.version, TeaModel.buildMap(request), null, runtime),
|
||||
new AsymmetricSignResponse());
|
||||
}
|
||||
|
||||
private String asymmetricSign(String keyId, String keyVersionId, String algorithm, byte[] message) throws Exception {
|
||||
byte[] digest;
|
||||
if (algorithm.equals("SM2DSA")) {
|
||||
if (this.publicKey == null) {
|
||||
this.publicKey = getPublicKey(keyId, keyVersionId);
|
||||
}
|
||||
digest = calcSM3Digest(this.publicKey, message);
|
||||
} else {
|
||||
digest = MessageDigest.getInstance(digestAlgs.get(algorithm)).digest(message);
|
||||
}
|
||||
|
||||
AsymmetricSignRequest request = AsymmetricSignRequest.build(TeaConverter.buildMap(
|
||||
new TeaPair("keyId", keyId),
|
||||
new TeaPair("keyVersionId", keyVersionId),
|
||||
new TeaPair("algorithm", algorithm),
|
||||
new TeaPair("digest", Base64.toBase64String(digest))
|
||||
));
|
||||
AsymmetricSignResponse response = _asymmetricSign(request);
|
||||
return response.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算签名
|
||||
*
|
||||
* @param content 待签名的内容
|
||||
* @return 签名值的Base64串
|
||||
*/
|
||||
public String sign(String content) throws Exception {
|
||||
return asymmetricSign(this.keyId, this.keyVersionId, this.algorithm, content.getBytes(AlipayConstants.DEFAULT_CHARSET));
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
return this.algorithm;
|
||||
}
|
||||
|
||||
public void setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
public String getKeyId() {
|
||||
return this.keyId;
|
||||
}
|
||||
|
||||
public void setKeyId(String keyId) {
|
||||
this.keyId = keyId;
|
||||
}
|
||||
|
||||
public String getKeyVersionId() {
|
||||
return this.keyVersionId;
|
||||
}
|
||||
|
||||
public void setKeyVersionId(String keyVersionId) {
|
||||
this.keyVersionId = keyVersionId;
|
||||
}
|
||||
|
||||
public PublicKey getPublicKey() {
|
||||
return this.publicKey;
|
||||
}
|
||||
|
||||
public void setPublicKey(PublicKey publicKey) {
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return this.protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Integer getConnectTimeout() {
|
||||
return this.connectTimeout;
|
||||
}
|
||||
|
||||
public void setConnectTimeout(Integer connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
}
|
||||
|
||||
public Integer getReadTimeout() {
|
||||
return this.readTimeout;
|
||||
}
|
||||
|
||||
public void setReadTimeout(Integer readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
|
||||
public Integer getMaxAttempts() {
|
||||
return this.maxAttempts;
|
||||
}
|
||||
|
||||
public void setMaxAttempts(Integer maxAttempts) {
|
||||
this.maxAttempts = maxAttempts;
|
||||
}
|
||||
|
||||
public boolean getIgnoreSSL() {
|
||||
return this.ignoreSSL;
|
||||
}
|
||||
|
||||
public void setIgnoreSSL(boolean ignoreSSL) {
|
||||
this.ignoreSSL = ignoreSSL;
|
||||
}
|
||||
}
|
||||
72
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunKMSConfig.java
vendored
Normal file
72
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunKMSConfig.java
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.alipay.easysdk.kms.aliyun;
|
||||
|
||||
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
/**
|
||||
* KMS配置参数模型
|
||||
*/
|
||||
public class AliyunKMSConfig extends Config {
|
||||
/**
|
||||
* 阿里云官方申请的AccessKey Id
|
||||
*/
|
||||
@NameInMap("aliyunAccessKeyId")
|
||||
public String aliyunAccessKeyId;
|
||||
|
||||
/**
|
||||
* 阿里云官方申请的AccessKey Secret
|
||||
*/
|
||||
@NameInMap("aliyunAccessKeySecret")
|
||||
public String aliyunAccessKeySecret;
|
||||
|
||||
/**
|
||||
* 从阿里云官方获取的临时安全令牌Security Token
|
||||
*/
|
||||
@NameInMap("aliyunSecurityToken")
|
||||
public String aliyunSecurityToken;
|
||||
|
||||
/**
|
||||
* 阿里云RAM角色全局资源描述符
|
||||
*/
|
||||
@NameInMap("aliyunRoleArn")
|
||||
public String aliyunRoleArn;
|
||||
|
||||
/**
|
||||
* 阿里云RAM角色自定义策略
|
||||
*/
|
||||
@NameInMap("aliyunRolePolicy")
|
||||
public String aliyunRolePolicy;
|
||||
|
||||
/**
|
||||
* 阿里云ECS实例RAM角色名称
|
||||
*/
|
||||
@NameInMap("aliyunRoleName")
|
||||
public String aliyunRoleName;
|
||||
|
||||
/**
|
||||
* KMS主密钥ID
|
||||
*/
|
||||
@NameInMap("kmsKeyId")
|
||||
public String kmsKeyId;
|
||||
|
||||
/**
|
||||
* KMS主密钥版本ID
|
||||
*/
|
||||
@NameInMap("kmsKeyVersionId")
|
||||
public String kmsKeyVersionId;
|
||||
|
||||
/**
|
||||
* KMS服务地址
|
||||
* KMS服务地址列表详情,请参考:
|
||||
* https://help.aliyun.com/document_detail/69006.html?spm=a2c4g.11186623.2.9.783f77cfAoNhY6#concept-69006-zh
|
||||
*/
|
||||
@NameInMap("kmsEndpoint")
|
||||
public String kmsEndpoint;
|
||||
|
||||
/**
|
||||
* 凭据类型,支持的类型有"access_key","sts","ecs_ram_role","ram_role_arn"
|
||||
*/
|
||||
@NameInMap("credentialType")
|
||||
public String credentialType;
|
||||
}
|
||||
45
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunKMSSigner.java
vendored
Normal file
45
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunKMSSigner.java
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.alipay.easysdk.kms.aliyun;
|
||||
|
||||
import com.alipay.easysdk.kernel.util.Signer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* KMS签名器
|
||||
*
|
||||
* @author aliyunkms
|
||||
* @version $Id: AliyunKMSSigner.java, v 0.1 2020年05月08日 9:10 PM aliyunkms Exp $
|
||||
*/
|
||||
public class AliyunKMSSigner extends Signer {
|
||||
private AliyunKMSClient client;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Signer.class);
|
||||
|
||||
public AliyunKMSSigner(AliyunKMSClient aliyunKmsClient) {
|
||||
this.client = aliyunKmsClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算签名
|
||||
*
|
||||
* @param content 待签名的内容
|
||||
* @param privateKeyPem 私钥,使用KMS签名不使用此参数
|
||||
* @return 签名值的Base64串
|
||||
*/
|
||||
public String sign(String content, String privateKeyPem) {
|
||||
try {
|
||||
return this.client.sign(content);
|
||||
} catch (Exception e) {
|
||||
String errorMessage = "签名遭遇异常,content=" + content + " reason=" + e.getMessage();
|
||||
LOGGER.error(errorMessage, e);
|
||||
throw new RuntimeException(errorMessage, e);
|
||||
}
|
||||
}
|
||||
|
||||
public AliyunKMSClient getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public void setClient(AliyunKMSClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
}
|
||||
353
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunRpcClient.java
vendored
Normal file
353
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/kms/aliyun/AliyunRpcClient.java
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
package com.alipay.easysdk.kms.aliyun;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.AccessKeyCredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.BasicSessionCredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.ICredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.provider.CredentialsProviderFactory;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.provider.EcsRamRoleCredentialsProvider;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.provider.ICredentialsProvider;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.provider.RamRoleArnCredentialsProvider;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.provider.StaticCredentialsProvider;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.utils.CredentialType;
|
||||
import com.alipay.easysdk.kms.aliyun.models.RuntimeOptions;
|
||||
import com.aliyun.tea.Tea;
|
||||
import com.aliyun.tea.TeaConverter;
|
||||
import com.aliyun.tea.TeaException;
|
||||
import com.aliyun.tea.TeaModel;
|
||||
import com.aliyun.tea.TeaPair;
|
||||
import com.aliyun.tea.TeaRequest;
|
||||
import com.aliyun.tea.TeaResponse;
|
||||
import com.aliyun.tea.TeaRetryableException;
|
||||
import com.aliyun.tea.TeaUnretryableException;
|
||||
import com.aliyun.tea.ValidateException;
|
||||
import com.aliyun.tea.utils.StringUtils;
|
||||
import com.google.gson.Gson;
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.SimpleTimeZone;
|
||||
import java.util.UUID;
|
||||
|
||||
public class AliyunRpcClient {
|
||||
private final String accessKeyId;
|
||||
private final String accessKeySecret;
|
||||
private final String securityToken;
|
||||
private final String roleArn;
|
||||
private final String roleName;
|
||||
private final String credentialType;
|
||||
private final String policy;
|
||||
private final String endpoint;
|
||||
private final String format;
|
||||
private final String signatureMethod;
|
||||
private final String signatureVersion;
|
||||
private final ICredentialsProvider credentialsProvider;
|
||||
|
||||
public AliyunRpcClient(Map<String, Object> config) {
|
||||
this.accessKeyId = (String) config.get("aliyunAccessKeyId");
|
||||
this.accessKeySecret = (String) config.get("aliyunAccessKeySecret");
|
||||
this.securityToken = (String) config.get("aliyunSecurityToken");
|
||||
this.roleArn = (String) config.get("aliyunRoleArn");
|
||||
this.roleName = (String) config.get("aliyunRoleName");
|
||||
this.credentialType = (String) config.get("credentialType");
|
||||
this.policy = (String) config.get("aliyunRolePolicy");
|
||||
this.endpoint = (String) config.get("kmsEndpoint");
|
||||
this.format = "json";
|
||||
this.signatureMethod = "HMAC-SHA1";
|
||||
this.signatureVersion = "1.0";
|
||||
this.credentialsProvider = getCredentialsProvider();
|
||||
}
|
||||
|
||||
public static String percentEncode(String value) throws UnsupportedEncodingException {
|
||||
return value != null ? URLEncoder.encode(value, "UTF-8").replace("+", "%20")
|
||||
.replace("*", "%2A").replace("%7E", "~") : null;
|
||||
}
|
||||
|
||||
private static String getSignature(Map<String, String> signedParams, String method, String secret) throws Exception {
|
||||
String[] sortedKeys = signedParams.keySet().toArray(new String[0]);
|
||||
Arrays.sort(sortedKeys);
|
||||
StringBuilder canonicalizedQueryString = new StringBuilder();
|
||||
|
||||
for (String key : sortedKeys) {
|
||||
if (!StringUtils.isEmpty(signedParams.get(key))) {
|
||||
canonicalizedQueryString.append("&").append(percentEncode(key)).append("=").append(
|
||||
percentEncode((String) signedParams.get(key)));
|
||||
}
|
||||
}
|
||||
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
mac.init(new SecretKeySpec((secret + "&").getBytes(StandardCharsets.UTF_8), "HmacSHA1"));
|
||||
String stringToSign = method +
|
||||
"&" +
|
||||
percentEncode("/") +
|
||||
"&" +
|
||||
percentEncode(canonicalizedQueryString.toString().substring(1));
|
||||
byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64.toBase64String(signData);
|
||||
}
|
||||
|
||||
public static Object parseJSON(String json) {
|
||||
return (new Gson()).fromJson(json, Map.class);
|
||||
}
|
||||
|
||||
public static Map<String, Object> assertAsMap(Object object) {
|
||||
if (null != object && Map.class.isAssignableFrom(object.getClass())) {
|
||||
return (Map) object;
|
||||
} else {
|
||||
throw new RuntimeException("The value is not a object");
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] readAsBytes(InputStream stream) throws IOException {
|
||||
if (null == stream) {
|
||||
return new byte[0];
|
||||
} else {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
byte[] buff = new byte[1024];
|
||||
|
||||
while (true) {
|
||||
int read = stream.read(buff);
|
||||
if (read == -1) {
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
os.write(buff, 0, read);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String readAsString(InputStream stream) throws IOException {
|
||||
return new String(readAsBytes(stream), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static Object readAsJSON(InputStream stream) throws IOException {
|
||||
String body = readAsString(stream);
|
||||
return parseJSON(body);
|
||||
}
|
||||
|
||||
public static String getTimestamp() {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
df.setTimeZone(new SimpleTimeZone(0, "UTC"));
|
||||
return df.format(new Date());
|
||||
}
|
||||
|
||||
public static String getNonce() {
|
||||
StringBuilder uniqueNonce = new StringBuilder();
|
||||
UUID uuid = UUID.randomUUID();
|
||||
uniqueNonce.append(uuid.toString());
|
||||
uniqueNonce.append(System.currentTimeMillis());
|
||||
uniqueNonce.append(Thread.currentThread().getId());
|
||||
return uniqueNonce.toString();
|
||||
}
|
||||
|
||||
public static String toFormString(Map<String, ?> map) throws UnsupportedEncodingException {
|
||||
if (null == map) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder result = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
||||
if (StringUtils.isEmpty(entry.getValue())) {
|
||||
continue;
|
||||
}
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
result.append("&");
|
||||
}
|
||||
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
|
||||
result.append("=");
|
||||
result.append(URLEncoder.encode(String.valueOf(entry.getValue()), "UTF-8"));
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static void validateModel(TeaModel m) throws Exception {
|
||||
if (null == m) {
|
||||
throw new ValidateException("parameter is not allowed as null");
|
||||
} else {
|
||||
m.validate();
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, Object> anyifyMapValue(Map<String, ?> map) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (null == map) {
|
||||
return null;
|
||||
}
|
||||
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
||||
result.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean is4xx(Number code) {
|
||||
if (null == code) {
|
||||
return false;
|
||||
} else {
|
||||
return code.intValue() >= 400 && code.intValue() < 500;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean is5xx(Number code) {
|
||||
if (null == code) {
|
||||
return false;
|
||||
} else {
|
||||
return code.intValue() >= 500 && code.intValue() < 600;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isUnset(Object object) {
|
||||
return null == object;
|
||||
}
|
||||
|
||||
private ICredentialsProvider getCredentialsProvider() {
|
||||
CredentialsProviderFactory factory = new CredentialsProviderFactory();
|
||||
if (StringUtils.isEmpty(this.credentialType)) {
|
||||
return getAccessKeyCredentialsProvider(this.accessKeyId, this.accessKeySecret, factory);
|
||||
}
|
||||
switch (this.credentialType) {
|
||||
case CredentialType.ACCESS_KEY:
|
||||
return getAccessKeyCredentialsProvider(this.accessKeyId, this.accessKeySecret, factory);
|
||||
case CredentialType.STS:
|
||||
return getStsTokenCredentialsProvider(this.accessKeyId, this.accessKeySecret, this.securityToken, factory);
|
||||
case CredentialType.ECS_RAM_ROLE:
|
||||
return getEcsRamRoleCredentialsProvider(this.roleName, factory);
|
||||
case CredentialType.RAM_ROLE_ARN:
|
||||
return getRamRoleArnCredentialsProvider(this.accessKeyId, this.accessKeySecret, this.roleArn, this.policy, factory);
|
||||
}
|
||||
throw new IllegalArgumentException("The credentialType is not supported");
|
||||
}
|
||||
|
||||
private ICredentialsProvider getAccessKeyCredentialsProvider(String accessKeyId, String accessKeySecret,
|
||||
CredentialsProviderFactory factory) {
|
||||
return factory.createCredentialsProvider(new StaticCredentialsProvider(new AccessKeyCredentials(accessKeyId, accessKeySecret)));
|
||||
}
|
||||
|
||||
private ICredentialsProvider getStsTokenCredentialsProvider(String accessKeyId, String accessKeySecret, String securityToken,
|
||||
CredentialsProviderFactory factory) {
|
||||
return factory.createCredentialsProvider(new StaticCredentialsProvider(new BasicSessionCredentials(accessKeyId,
|
||||
accessKeySecret, securityToken)));
|
||||
}
|
||||
|
||||
private ICredentialsProvider getEcsRamRoleCredentialsProvider(String roleName, CredentialsProviderFactory factory) {
|
||||
if (StringUtils.isEmpty(roleName)) {
|
||||
throw new IllegalArgumentException("The roleName is empty");
|
||||
}
|
||||
return factory.createCredentialsProvider(new EcsRamRoleCredentialsProvider(roleName));
|
||||
}
|
||||
|
||||
private ICredentialsProvider getRamRoleArnCredentialsProvider(String accessKeyId, String accessKeySecret, String roleArn,
|
||||
String policy, CredentialsProviderFactory factory) {
|
||||
if (StringUtils.isEmpty(accessKeyId) || StringUtils.isEmpty(accessKeySecret)) {
|
||||
throw new IllegalArgumentException("The accessKeyId or accessKeySecret is empty");
|
||||
}
|
||||
if (StringUtils.isEmpty(roleArn)) {
|
||||
throw new IllegalArgumentException("The roleArn is empty");
|
||||
}
|
||||
return factory.createCredentialsProvider(new RamRoleArnCredentialsProvider(accessKeyId, accessKeySecret, roleArn, policy));
|
||||
}
|
||||
|
||||
public Map<String, Object> doRequest(String action, String protocol, String method, String version, Map<String, Object> query,
|
||||
Map<String, Object> body, RuntimeOptions runtime) throws Exception {
|
||||
Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("readTimeout", runtime.readTimeout),
|
||||
new TeaPair("connectTimeout", runtime.connectTimeout),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", runtime.maxAttempts)
|
||||
)),
|
||||
new TeaPair("backoff", TeaConverter.buildMap(
|
||||
new TeaPair("policy", runtime.backoffPolicy),
|
||||
new TeaPair("period", runtime.backoffPeriod)
|
||||
)),
|
||||
new TeaPair("ignoreSSL", runtime.ignoreSSL)
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
request_.protocol = protocol;
|
||||
request_.method = method;
|
||||
request_.pathname = "/";
|
||||
request_.query = TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("Action", action),
|
||||
new TeaPair("Format", this.format),
|
||||
new TeaPair("Timestamp", getTimestamp()),
|
||||
new TeaPair("Version", version),
|
||||
new TeaPair("SignatureNonce", getNonce())
|
||||
),
|
||||
query
|
||||
);
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", this.endpoint)
|
||||
);
|
||||
if (!isUnset(body)) {
|
||||
java.util.Map<String, Object> tmp = anyifyMapValue(body);
|
||||
request_.body = Tea.toReadable(toFormString(tmp));
|
||||
request_.headers.put("content-type", "application/x-www-form-urlencoded");
|
||||
}
|
||||
|
||||
ICredentials credentials = this.credentialsProvider.getCredentials();
|
||||
if (credentials == null) {
|
||||
throw new TeaRetryableException();
|
||||
}
|
||||
|
||||
request_.query.put("SignatureMethod", this.signatureMethod);
|
||||
request_.query.put("SignatureVersion", this.signatureVersion);
|
||||
request_.query.put("AccessKeyId", credentials.getAccessKeyId());
|
||||
if (!StringUtils.isEmpty(credentials.getSecurityToken())) {
|
||||
request_.query.put("SecurityToken", credentials.getSecurityToken());
|
||||
}
|
||||
java.util.Map<String, String> signedParam = TeaConverter.merge(String.class,
|
||||
request_.query,
|
||||
body
|
||||
);
|
||||
request_.query.put("Signature", getSignature(signedParam, request_.method, credentials.getAccessKeySecret()));
|
||||
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
Object obj = readAsJSON(response_.body);
|
||||
java.util.Map<String, Object> res = assertAsMap(obj);
|
||||
if (is4xx(response_.statusCode) || is5xx(response_.statusCode)) {
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", res.get("Message")),
|
||||
new TeaPair("data", res),
|
||||
new TeaPair("code", res.get("Code"))
|
||||
));
|
||||
}
|
||||
|
||||
return res;
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.utils.StringUtils;
|
||||
|
||||
public class AccessKeyCredentials implements ICredentials {
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
|
||||
public AccessKeyCredentials(String accessKeyId, String accessKeySecret) {
|
||||
if (StringUtils.isEmpty(accessKeyId)) {
|
||||
throw new IllegalArgumentException("Access key ID cannot be empty");
|
||||
}
|
||||
if (StringUtils.isEmpty(accessKeySecret)) {
|
||||
throw new IllegalArgumentException("Access key secret cannot be empty");
|
||||
}
|
||||
this.accessKeyId = accessKeyId;
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
public void setAccessKeyId(String accessKeyId) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
}
|
||||
|
||||
public void setAccessKeySecret(String accessKeySecret) {
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessKeyId() {
|
||||
return accessKeyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessKeySecret() {
|
||||
return accessKeySecret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSecurityToken() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials;
|
||||
|
||||
public class BasicSessionCredentials implements ICredentials {
|
||||
protected final Long roleSessionDurationSeconds;
|
||||
private final String accessKeyId;
|
||||
private final String accessKeySecret;
|
||||
private final String securityToken;
|
||||
private Long sessionStartedTimeInMilliSeconds = 0L;
|
||||
|
||||
public BasicSessionCredentials(String accessKeyId, String accessKeySecret, String securityToken) {
|
||||
this(accessKeyId, accessKeySecret, securityToken, 0L);
|
||||
}
|
||||
|
||||
public BasicSessionCredentials(String accessKeyId, String accessKeySecret, String securityToken, Long roleSessionDurationSeconds) {
|
||||
if (accessKeyId == null) {
|
||||
throw new IllegalArgumentException("Access key ID cannot be null.");
|
||||
}
|
||||
if (accessKeySecret == null) {
|
||||
throw new IllegalArgumentException("Access key secret cannot be null.");
|
||||
}
|
||||
this.accessKeyId = accessKeyId;
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
this.securityToken = securityToken;
|
||||
this.roleSessionDurationSeconds = roleSessionDurationSeconds;
|
||||
this.sessionStartedTimeInMilliSeconds = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessKeyId() {
|
||||
return accessKeyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessKeySecret() {
|
||||
return accessKeySecret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSecurityToken() {
|
||||
return securityToken;
|
||||
}
|
||||
|
||||
public boolean willSoonExpire() {
|
||||
if (roleSessionDurationSeconds == 0) {
|
||||
return false;
|
||||
}
|
||||
long now = System.currentTimeMillis();
|
||||
double expireFact = 0.95;
|
||||
return roleSessionDurationSeconds * expireFact < (now - sessionStartedTimeInMilliSeconds) / 1000.0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class EcsRamRoleCredentials extends BasicSessionCredentials {
|
||||
private final Long expiration;
|
||||
private final Double expireFact = 0.95;
|
||||
private final Long refreshIntervalInMillSeconds = 180000L;
|
||||
private long lastFailedRefreshTime = 0;
|
||||
|
||||
public EcsRamRoleCredentials(String accessKeyId, String accessKeySecret, String sessionToken,
|
||||
String expiration, long roleSessionDurationSeconds) {
|
||||
super(accessKeyId, accessKeySecret, sessionToken, roleSessionDurationSeconds);
|
||||
|
||||
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
parser.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
try {
|
||||
Date date = parser.parse(expiration.replace('T', ' ').replace('Z', ' '));
|
||||
this.expiration = date.getTime();
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException("Failed to get valid expiration time from ECS Metadata service.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean willSoonExpire() {
|
||||
long now = System.currentTimeMillis();
|
||||
return this.roleSessionDurationSeconds * (1 - expireFact) > (expiration - now) / 1000;
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
long now = System.currentTimeMillis();
|
||||
return now >= expiration - refreshIntervalInMillSeconds;
|
||||
}
|
||||
|
||||
public boolean shouldRefresh() {
|
||||
long now = System.currentTimeMillis();
|
||||
return now - lastFailedRefreshTime > refreshIntervalInMillSeconds;
|
||||
}
|
||||
|
||||
public void setLastFailedRefreshTime() {
|
||||
lastFailedRefreshTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials;
|
||||
|
||||
public interface ICredentials {
|
||||
public String getAccessKeyId();
|
||||
public String getAccessKeySecret();
|
||||
public String getSecurityToken();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.exceptions;
|
||||
|
||||
public class CredentialException extends Exception {
|
||||
public CredentialException(String message) {
|
||||
super(message);
|
||||
}
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return super.getMessage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CompatibleUrlConnClient implements Closeable {
|
||||
protected static final String ACCEPT_ENCODING = "Accept-Encoding";
|
||||
|
||||
public static HttpResponse compatibleGetResponse(HttpRequest request)
|
||||
throws IOException, NoSuchAlgorithmException, KeyManagementException {
|
||||
CompatibleUrlConnClient client = new CompatibleUrlConnClient();
|
||||
HttpResponse response = client.syncInvoke(request);
|
||||
client.close();
|
||||
return response;
|
||||
}
|
||||
|
||||
public HttpResponse syncInvoke(HttpRequest request) throws IOException, NoSuchAlgorithmException, KeyManagementException {
|
||||
InputStream content = null;
|
||||
HttpResponse response = null;
|
||||
HttpURLConnection httpConn = buildHttpConnection(request);
|
||||
|
||||
try {
|
||||
httpConn.connect();
|
||||
content = httpConn.getInputStream();
|
||||
response = new HttpResponse(httpConn.getURL().toString());
|
||||
parseHttpConn(response, httpConn, content);
|
||||
return response;
|
||||
} catch (IOException e) {
|
||||
content = httpConn.getErrorStream();
|
||||
response = new HttpResponse(httpConn.getURL().toString());
|
||||
parseHttpConn(response, httpConn, content);
|
||||
return response;
|
||||
} finally {
|
||||
if (content != null) {
|
||||
content.close();
|
||||
}
|
||||
httpConn.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public SSLSocketFactory createSSLSocketFactory() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
X509TrustManager compositeX509TrustManager = new CompositeX509TrustManager();
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null, new TrustManager[] {compositeX509TrustManager}, new java.security.SecureRandom());
|
||||
return sslContext.getSocketFactory();
|
||||
}
|
||||
|
||||
public void checkHttpRequest(HttpRequest request) {
|
||||
String strUrl = request.getUrl();
|
||||
if (null == strUrl) {
|
||||
throw new IllegalArgumentException("URL is null for HttpRequest.");
|
||||
}
|
||||
if (null == request.getMethod()) {
|
||||
throw new IllegalArgumentException("Method is not set for HttpRequest.");
|
||||
}
|
||||
}
|
||||
|
||||
public HttpURLConnection initHttpConnection(URL url, HttpRequest request)
|
||||
throws IOException, KeyManagementException, NoSuchAlgorithmException {
|
||||
HttpURLConnection httpConn;
|
||||
if ("https".equalsIgnoreCase(url.getProtocol())) {
|
||||
HttpsURLConnection httpsConn = (HttpsURLConnection) url.openConnection();
|
||||
SSLSocketFactory sslSocketFactory = createSSLSocketFactory();
|
||||
httpsConn.setSSLSocketFactory(sslSocketFactory);
|
||||
httpsConn.setHostnameVerifier(new TrueHostnameVerifier());
|
||||
httpConn = httpsConn;
|
||||
} else {
|
||||
httpConn = (HttpURLConnection) url.openConnection();
|
||||
}
|
||||
httpConn.setRequestMethod(request.getMethod().toString());
|
||||
httpConn.setInstanceFollowRedirects(false);
|
||||
httpConn.setDoOutput(true);
|
||||
httpConn.setDoInput(true);
|
||||
httpConn.setUseCaches(false);
|
||||
httpConn.setConnectTimeout(request.getConnectTimeout());
|
||||
httpConn.setReadTimeout(request.getReadTimeout());
|
||||
httpConn.setRequestProperty(ACCEPT_ENCODING, "identity");
|
||||
return httpConn;
|
||||
}
|
||||
|
||||
public HttpURLConnection buildHttpConnection(HttpRequest request) throws IOException, NoSuchAlgorithmException, KeyManagementException {
|
||||
checkHttpRequest(request);
|
||||
String strUrl = request.getUrl();
|
||||
URL url = new URL(strUrl);
|
||||
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
|
||||
HttpURLConnection httpConn = initHttpConnection(url, request);
|
||||
return httpConn;
|
||||
}
|
||||
|
||||
public void parseHttpConn(HttpResponse response, HttpURLConnection httpConn, InputStream content)
|
||||
throws IOException, NoSuchAlgorithmException {
|
||||
byte[] buff = readContent(content);
|
||||
response.setStatus(httpConn.getResponseCode());
|
||||
response.setResponseMessage(httpConn.getResponseMessage());
|
||||
Map<String, List<String>> headers = httpConn.getHeaderFields();
|
||||
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (null == key) {
|
||||
continue;
|
||||
}
|
||||
List<String> values = entry.getValue();
|
||||
StringBuilder builder = new StringBuilder(values.get(0));
|
||||
for (int i = 1; i < values.size(); i++) {
|
||||
builder.append(",");
|
||||
builder.append(values.get(i));
|
||||
}
|
||||
response.putHeaderParameter(key, builder.toString());
|
||||
}
|
||||
String type = response.getHeaderValue("Content-Type");
|
||||
if (buff != null && type != null) {
|
||||
response.setEncoding("UTF-8");
|
||||
String[] split = type.split(";");
|
||||
response.setHttpContentType(FormatType.mapAcceptToFormat(split[0].trim()));
|
||||
if (split.length > 1 && split[1].contains("=")) {
|
||||
String[] codings = split[1].split("=");
|
||||
response.setEncoding(codings[1].trim().toUpperCase());
|
||||
}
|
||||
}
|
||||
response.setHttpContent(buff, response.getEncoding(), response.getHttpContentType());
|
||||
}
|
||||
|
||||
private byte[] readContent(InputStream content) throws IOException {
|
||||
if (content == null) {
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
byte[] buff = new byte[1024];
|
||||
while (true) {
|
||||
final int read = content.read(buff);
|
||||
if (read == -1) {
|
||||
break;
|
||||
}
|
||||
outputStream.write(buff, 0, read);
|
||||
}
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
public class CompositeX509TrustManager implements X509TrustManager {
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return new X509Certificate[0];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum FormatType {
|
||||
XML("application/xml", "text/xml"),
|
||||
JSON("application/json", "text/json"),
|
||||
RAW("application/octet-stream"),
|
||||
FORM("application/x-www-form-urlencoded");
|
||||
|
||||
private final String[] formats;
|
||||
|
||||
FormatType(String... formats) {
|
||||
this.formats = formats;
|
||||
}
|
||||
|
||||
public static String mapFormatToAccept(FormatType format) {
|
||||
return format.formats[0];
|
||||
}
|
||||
|
||||
public static FormatType mapAcceptToFormat(String accept) {
|
||||
for (FormatType value : values()) {
|
||||
if (Arrays.asList(value.formats).contains(accept)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return FormatType.RAW;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.exceptions.CredentialException;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.utils.Base64Utils;
|
||||
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpMessage {
|
||||
protected static final String CONTENT_TYPE = "Content-Type";
|
||||
protected static final String CONTENT_MD5 = "Content-MD5";
|
||||
protected static final String CONTENT_LENGTH = "Content-Length";
|
||||
protected FormatType httpContentType = null;
|
||||
protected byte[] httpContent = null;
|
||||
protected String encoding = null;
|
||||
protected Map<String, String> headers = new HashMap<String, String>();
|
||||
protected Integer connectTimeout = null;
|
||||
protected Integer readTimeout = null;
|
||||
private String url = null;
|
||||
private MethodType method = null;
|
||||
protected boolean ignoreSSLCerts = false;
|
||||
private KeyManager[] keyManagers = null;
|
||||
private X509TrustManager[] x509TrustManagers = null;
|
||||
|
||||
public HttpMessage(String strUrl) {
|
||||
this.url = strUrl;
|
||||
}
|
||||
|
||||
public HttpMessage() {
|
||||
}
|
||||
|
||||
public FormatType getHttpContentType() {
|
||||
return httpContentType;
|
||||
}
|
||||
|
||||
public void setHttpContentType(FormatType httpContentType) {
|
||||
this.httpContentType = httpContentType;
|
||||
}
|
||||
|
||||
public byte[] getHttpContent() {
|
||||
return httpContent;
|
||||
}
|
||||
|
||||
public String getHttpContentString() throws CredentialException {
|
||||
String stringContent = "";
|
||||
if (this.httpContent != null) {
|
||||
try {
|
||||
if (this.encoding == null) {
|
||||
stringContent = new String(this.httpContent);
|
||||
} else {
|
||||
stringContent = new String(this.httpContent, this.encoding);
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new CredentialException("UnsupportedEncoding: Can not parse response due to unsupported encoding.");
|
||||
}
|
||||
}
|
||||
return stringContent;
|
||||
}
|
||||
|
||||
public void setHttpContent(byte[] httpContent, String encoding, FormatType format) throws NoSuchAlgorithmException {
|
||||
this.httpContent = httpContent;
|
||||
if (null == httpContent) {
|
||||
this.headers.remove(CONTENT_MD5);
|
||||
this.headers.put(CONTENT_LENGTH, "0");
|
||||
this.headers.remove(CONTENT_TYPE);
|
||||
this.httpContentType = null;
|
||||
this.httpContent = null;
|
||||
this.encoding = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// for GET HEADER DELETE OPTION method, sdk should ignore the content
|
||||
if (getMethod() != null && !getMethod().hasContent()) {
|
||||
httpContent = new byte[0];
|
||||
}
|
||||
|
||||
this.httpContent = httpContent;
|
||||
this.encoding = encoding;
|
||||
String contentLen = String.valueOf(httpContent.length);
|
||||
String strMd5 = md5Sum(httpContent);
|
||||
this.headers.put(CONTENT_MD5, strMd5);
|
||||
this.headers.put(CONTENT_LENGTH, contentLen);
|
||||
if (null != format) {
|
||||
this.headers.put(CONTENT_TYPE, FormatType.mapFormatToAccept(format));
|
||||
}
|
||||
}
|
||||
|
||||
public static String md5Sum(byte[] buff) throws NoSuchAlgorithmException {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
byte[] messageDigest = md.digest(buff);
|
||||
return Base64Utils.encode(messageDigest);
|
||||
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public void setEncoding(String encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public Map<String, String> getHeaders() {
|
||||
return Collections.unmodifiableMap(headers);
|
||||
}
|
||||
|
||||
public String getHeaderValue(String name) {
|
||||
return this.headers.get(name);
|
||||
}
|
||||
|
||||
public void putHeaderParameter(String name, String value) {
|
||||
if (null != name && null != value) {
|
||||
this.headers.put(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHeaders(Map<String, String> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
public Integer getConnectTimeout() {
|
||||
return connectTimeout;
|
||||
}
|
||||
|
||||
public void setConnectTimeout(Integer connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
}
|
||||
|
||||
public Integer getReadTimeout() {
|
||||
return readTimeout;
|
||||
}
|
||||
|
||||
public void setReadTimeout(Integer readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public MethodType getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(MethodType method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public boolean isIgnoreSSLCerts() {
|
||||
return ignoreSSLCerts;
|
||||
}
|
||||
|
||||
public void setIgnoreSSLCerts(boolean ignoreSSLCerts) {
|
||||
this.ignoreSSLCerts = ignoreSSLCerts;
|
||||
}
|
||||
|
||||
public KeyManager[] getKeyManagers() {
|
||||
return keyManagers;
|
||||
}
|
||||
|
||||
public void setKeyManagers(KeyManager[] keyManagers) {
|
||||
this.keyManagers = keyManagers;
|
||||
}
|
||||
|
||||
public X509TrustManager[] getX509TrustManagers() {
|
||||
return x509TrustManagers;
|
||||
}
|
||||
|
||||
public void setX509TrustManagers(X509TrustManager[] x509TrustManagers) {
|
||||
this.x509TrustManagers = x509TrustManagers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.utils.ParameterUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpRequest extends HttpMessage {
|
||||
private final Map<String, String> immutableMap = new HashMap<String, String>();
|
||||
|
||||
public HttpRequest() {
|
||||
setCommonParameter();
|
||||
}
|
||||
|
||||
public HttpRequest(String url) {
|
||||
super(url);
|
||||
setCommonParameter();
|
||||
}
|
||||
|
||||
private void setCommonParameter() {
|
||||
this.immutableMap.put("Timestamp", ParameterUtils.getISO8601Time(new Date()));
|
||||
this.immutableMap.put("SignatureNonce", ParameterUtils.getUniqueNonce());
|
||||
this.immutableMap.put("SignatureMethod", "HMAC-SHA1");
|
||||
this.immutableMap.put("SignatureVersion", "1.0");
|
||||
}
|
||||
|
||||
public void setUrlParameter(String key, String value) {
|
||||
this.immutableMap.put(key, value);
|
||||
}
|
||||
|
||||
public String getUrlParameter(String key) {
|
||||
return this.immutableMap.get(key);
|
||||
}
|
||||
|
||||
public Map<String, String> getUrlParameters() {
|
||||
return Collections.unmodifiableMap(immutableMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
public class HttpResponse extends HttpMessage {
|
||||
private int status;
|
||||
private String responseMessage;
|
||||
|
||||
public HttpResponse(String strUrl) {
|
||||
super(strUrl);
|
||||
}
|
||||
|
||||
public HttpResponse() {
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return 200 <= this.status && this.status < 300;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getResponseMessage() {
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
public void setResponseMessage(String responseMessage) {
|
||||
this.responseMessage = responseMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
public enum MethodType {
|
||||
GET(false),
|
||||
PUT(true),
|
||||
POST(true);
|
||||
|
||||
private final boolean hasContent;
|
||||
|
||||
MethodType(boolean hasContent) {
|
||||
this.hasContent = hasContent;
|
||||
}
|
||||
|
||||
public boolean hasContent() {
|
||||
return hasContent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.http;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
public class TrueHostnameVerifier implements HostnameVerifier {
|
||||
@Override
|
||||
public boolean verify(String s, SSLSession sslSession) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.provider;
|
||||
|
||||
public class CredentialsProviderFactory {
|
||||
public <T extends ICredentialsProvider> T createCredentialsProvider(T classInstance) {
|
||||
return classInstance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.provider;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.EcsRamRoleCredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.exceptions.CredentialException;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.CompatibleUrlConnClient;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.HttpRequest;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.HttpResponse;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.MethodType;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class ECSMetadataServiceCredentialsFetcher {
|
||||
private static final String URL_IN_ECS_METADATA = "/latest/meta-data/ram/security-credentials/";
|
||||
private static final int DEFAULT_TIMEOUT_IN_MILLISECONDS = 1000;
|
||||
private static final String ECS_METADAT_FETCH_ERROR_MSG = "Failed to get RAM session credentials from ECS metadata service.";
|
||||
private static final int DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS = 3600 * 6;
|
||||
private URL credentialUrl;
|
||||
private String roleName;
|
||||
private String metadataServiceHost = "100.100.100.200";
|
||||
private int connectionTimeoutInMilliseconds;
|
||||
|
||||
public ECSMetadataServiceCredentialsFetcher() {
|
||||
this.connectionTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
if (null == roleName) {
|
||||
throw new NullPointerException("You must specifiy a valid role name.");
|
||||
}
|
||||
this.roleName = roleName;
|
||||
setCredentialUrl();
|
||||
}
|
||||
|
||||
private void setCredentialUrl() {
|
||||
try {
|
||||
this.credentialUrl = new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new IllegalArgumentException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public ECSMetadataServiceCredentialsFetcher withECSMetadataServiceHost(String host) {
|
||||
System.err.println("withECSMetadataServiceHost() method is only for testing, please don't use it");
|
||||
this.metadataServiceHost = host;
|
||||
setCredentialUrl();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ECSMetadataServiceCredentialsFetcher withConnectionTimeout(int milliseconds) {
|
||||
this.connectionTimeoutInMilliseconds = milliseconds;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMetadata() throws CredentialException {
|
||||
HttpRequest request = new HttpRequest(credentialUrl.toString());
|
||||
request.setMethod(MethodType.GET);
|
||||
request.setConnectTimeout(connectionTimeoutInMilliseconds);
|
||||
request.setReadTimeout(connectionTimeoutInMilliseconds);
|
||||
HttpResponse response;
|
||||
|
||||
try {
|
||||
response = CompatibleUrlConnClient.compatibleGetResponse(request);
|
||||
} catch (Exception e) {
|
||||
throw new CredentialException("Failed to connect ECS Metadata Service: " + e.toString());
|
||||
}
|
||||
|
||||
if (response.getStatus() != HttpURLConnection.HTTP_OK) {
|
||||
throw new CredentialException(ECS_METADAT_FETCH_ERROR_MSG + " HttpCode=" + response.getStatus());
|
||||
}
|
||||
|
||||
return new String(response.getHttpContent());
|
||||
}
|
||||
|
||||
public EcsRamRoleCredentials fetch() throws CredentialException {
|
||||
String jsonContent = getMetadata();
|
||||
JsonObject jsonObject = null;
|
||||
jsonObject = new JsonParser().parse(jsonContent).getAsJsonObject();
|
||||
|
||||
if (jsonObject.has("Code") && jsonObject.has("AccessKeyId") && jsonObject.has("AccessKeySecret") && jsonObject
|
||||
.has("SecurityToken") && jsonObject.has("Expiration")) {
|
||||
|
||||
} else {
|
||||
throw new CredentialException("Invalid json got from ECS Metadata service.");
|
||||
}
|
||||
|
||||
if (!"Success".equals(jsonObject.get("Code").getAsString())) {
|
||||
throw new CredentialException(ECS_METADAT_FETCH_ERROR_MSG);
|
||||
}
|
||||
return new EcsRamRoleCredentials(jsonObject.get("AccessKeyId").getAsString(), jsonObject.get(
|
||||
"AccessKeySecret").getAsString(), jsonObject.get("SecurityToken").getAsString(), jsonObject.get(
|
||||
"Expiration").getAsString(), DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS);
|
||||
}
|
||||
|
||||
public EcsRamRoleCredentials fetch(int retryTimes) throws CredentialException {
|
||||
for (int i = 0; i <= retryTimes; i++) {
|
||||
try {
|
||||
return fetch();
|
||||
} catch (CredentialException e) {
|
||||
if (i == retryTimes) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new CredentialException("Failed to connect ECS Metadata Service: Max retry times exceeded.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.provider;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.EcsRamRoleCredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.ICredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.exceptions.CredentialException;
|
||||
|
||||
public class EcsRamRoleCredentialsProvider implements ICredentialsProvider {
|
||||
private static final int MAX_ECS_METADATA_FETCH_RETRY_TIMES = 3;
|
||||
private final String roleName;
|
||||
private EcsRamRoleCredentials credentials = null;
|
||||
private ECSMetadataServiceCredentialsFetcher fetcher;
|
||||
|
||||
public EcsRamRoleCredentialsProvider(String roleName) {
|
||||
if (null == roleName) {
|
||||
throw new NullPointerException("You must specifiy a valid role name.");
|
||||
}
|
||||
this.roleName = roleName;
|
||||
this.fetcher = new ECSMetadataServiceCredentialsFetcher();
|
||||
this.fetcher.setRoleName(this.roleName);
|
||||
}
|
||||
|
||||
public EcsRamRoleCredentialsProvider withFetcher(ECSMetadataServiceCredentialsFetcher fetcher) {
|
||||
this.fetcher = fetcher;
|
||||
this.fetcher.setRoleName(roleName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICredentials getCredentials() throws CredentialException {
|
||||
if (credentials == null || credentials.isExpired()) {
|
||||
credentials = fetcher.fetch(MAX_ECS_METADATA_FETCH_RETRY_TIMES);
|
||||
} else if (credentials.willSoonExpire() && credentials.shouldRefresh()) {
|
||||
try {
|
||||
credentials = fetcher.fetch();
|
||||
} catch (CredentialException e) {
|
||||
// Use the current expiring session token and wait for next round
|
||||
credentials.setLastFailedRefreshTime();
|
||||
}
|
||||
}
|
||||
return credentials;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.provider;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.ICredentials;
|
||||
|
||||
public interface ICredentialsProvider {
|
||||
public ICredentials getCredentials() throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.provider;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.BasicSessionCredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.ICredentials;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.exceptions.CredentialException;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.CompatibleUrlConnClient;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.HttpRequest;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.HttpResponse;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.MethodType;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.utils.HmacSHA1Signer;
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.utils.ParameterUtils;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RamRoleArnCredentialsProvider implements ICredentialsProvider {
|
||||
public static final int DEFAULT_DURATION_SECONDS = 3600;
|
||||
private static final int DEFAULT_TIMEOUT_IN_MILLISECONDS = 5000;
|
||||
private static final String DEFAULT_STS_ENDPOINT = "sts.aliyuncs.com";
|
||||
private final String roleArn;
|
||||
private final String roleSessionName;
|
||||
private final String accessKeyId;
|
||||
private final String accessKeySecret;
|
||||
private final String stsEndpoint;
|
||||
private String policy;
|
||||
private Integer connectTimeout;
|
||||
private Integer readTimeout;
|
||||
private BasicSessionCredentials credential = null;
|
||||
|
||||
public RamRoleArnCredentialsProvider(String accessKeyId, String accessKeySecret, String roleArn) {
|
||||
this.roleArn = roleArn;
|
||||
this.accessKeyId = accessKeyId;
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
this.roleSessionName = getNewRoleSessionName();
|
||||
this.stsEndpoint = DEFAULT_STS_ENDPOINT;
|
||||
this.connectTimeout = DEFAULT_TIMEOUT_IN_MILLISECONDS;
|
||||
this.readTimeout = DEFAULT_TIMEOUT_IN_MILLISECONDS * 2;
|
||||
}
|
||||
|
||||
public RamRoleArnCredentialsProvider(String accessKeyId, String accessKeySecret, String roleArn, String policy) {
|
||||
this(accessKeyId, accessKeySecret, roleArn);
|
||||
this.policy = policy;
|
||||
}
|
||||
|
||||
public RamRoleArnCredentialsProvider withConnectionTimeout(int milliseconds) {
|
||||
this.connectTimeout = milliseconds;
|
||||
this.readTimeout = milliseconds * 2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static String getNewRoleSessionName() {
|
||||
return "kms-credentials-" + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICredentials getCredentials() throws Exception {
|
||||
if (credential == null || credential.willSoonExpire()) {
|
||||
CompatibleUrlConnClient client = new CompatibleUrlConnClient();
|
||||
credential = getNewSessionCredential(client);
|
||||
}
|
||||
return credential;
|
||||
}
|
||||
|
||||
public BasicSessionCredentials getNewSessionCredential(CompatibleUrlConnClient client) throws Exception {
|
||||
ParameterUtils parameterUtils = new ParameterUtils();
|
||||
HttpRequest httpRequest = new HttpRequest();
|
||||
httpRequest.setUrlParameter("Action", "AssumeRole");
|
||||
httpRequest.setUrlParameter("Format", "JSON");
|
||||
httpRequest.setUrlParameter("Version", "2015-04-01");
|
||||
httpRequest.setUrlParameter("DurationSeconds", String.valueOf(DEFAULT_DURATION_SECONDS));
|
||||
httpRequest.setUrlParameter("RoleArn", this.roleArn);
|
||||
httpRequest.setUrlParameter("AccessKeyId", this.accessKeyId);
|
||||
httpRequest.setUrlParameter("RoleSessionName", this.roleSessionName);
|
||||
if (this.policy != null) {
|
||||
httpRequest.setUrlParameter("Policy", this.policy);
|
||||
}
|
||||
httpRequest.setMethod(MethodType.GET);
|
||||
httpRequest.setConnectTimeout(this.connectTimeout);
|
||||
httpRequest.setReadTimeout(this.readTimeout);
|
||||
String strToSign = parameterUtils.composeStringToSign(MethodType.GET, httpRequest.getUrlParameters());
|
||||
String signature = HmacSHA1Signer.signString(strToSign, this.accessKeySecret + "&");
|
||||
httpRequest.setUrlParameter("Signature", signature);
|
||||
httpRequest.setUrl(parameterUtils.composeUrl(this.stsEndpoint, httpRequest.getUrlParameters(), "https"));
|
||||
HttpResponse httpResponse = client.syncInvoke(httpRequest);
|
||||
Gson gson = new Gson();
|
||||
Map<String, Object> map = gson.fromJson(httpResponse.getHttpContentString(), Map.class);
|
||||
if (map.containsKey("Credentials")) {
|
||||
Map<String, String> credential = (Map<String, String>) map.get("Credentials");
|
||||
Long expiration = ParameterUtils.getUTCDate(credential.get("Expiration")).getTime();
|
||||
return new BasicSessionCredentials(credential.get("AccessKeyId"), credential.get("AccessKeySecret"),
|
||||
credential.get("SecurityToken"), expiration);
|
||||
} else {
|
||||
throw new CredentialException(gson.toJson(map));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.provider;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.ICredentials;
|
||||
|
||||
public class StaticCredentialsProvider implements ICredentialsProvider{
|
||||
private final ICredentials credentials;
|
||||
|
||||
public StaticCredentialsProvider(ICredentials credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICredentials getCredentials() throws Exception {
|
||||
return this.credentials;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class AcsURLEncoder {
|
||||
public final static String URL_ENCODING = "UTF-8";
|
||||
|
||||
public static String encode(String value) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(value, URL_ENCODING);
|
||||
}
|
||||
|
||||
public static String percentEncode(String value) throws UnsupportedEncodingException {
|
||||
return value != null ? URLEncoder.encode(value, URL_ENCODING).replace("+", "%20")
|
||||
.replace("*", "%2A").replace("%7E", "~") : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.utils;
|
||||
|
||||
public class Base64Utils {
|
||||
private static final String BASE64_CODE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
+ "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/";
|
||||
|
||||
private static byte[] zeroPad(int length, byte[] bytes) {
|
||||
byte[] padded = new byte[length];
|
||||
System.arraycopy(bytes, 0, padded, 0, bytes.length);
|
||||
return padded;
|
||||
}
|
||||
|
||||
public synchronized static String encode(byte[] buff) {
|
||||
StringBuilder strBuilder = new StringBuilder("");
|
||||
int paddingCount = (3 - (buff.length % 3)) % 3;
|
||||
byte[] stringArray = zeroPad(buff.length + paddingCount, buff);
|
||||
for (int i = 0; i < stringArray.length; i += 3) {
|
||||
int j = ((stringArray[i] & 0xff) << 16) +
|
||||
((stringArray[i + 1] & 0xff) << 8) +
|
||||
(stringArray[i + 2] & 0xff);
|
||||
strBuilder.append(BASE64_CODE.charAt((j >> 18) & 0x3f));
|
||||
strBuilder.append(BASE64_CODE.charAt((j >> 12) & 0x3f));
|
||||
strBuilder.append(BASE64_CODE.charAt((j >> 6) & 0x3f));
|
||||
strBuilder.append(BASE64_CODE.charAt(j & 0x3f));
|
||||
}
|
||||
int intPos = strBuilder.length();
|
||||
for (int i = paddingCount; i > 0; i--) {
|
||||
strBuilder.setCharAt(intPos - i, '=');
|
||||
}
|
||||
|
||||
return strBuilder.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.utils;
|
||||
|
||||
public class CredentialType {
|
||||
public static final String ACCESS_KEY = "access_key";
|
||||
public static final String STS = "sts";
|
||||
public static final String ECS_RAM_ROLE = "ecs_ram_role";
|
||||
public static final String RAM_ROLE_ARN = "ram_role_arn";
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.utils;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.ICredentials;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class HmacSHA1Signer {
|
||||
public static final String ENCODING = "UTF-8";
|
||||
private static final String ALGORITHM_NAME = "HmacSHA1";
|
||||
|
||||
public static String signString(String stringToSign, ICredentials credential) {
|
||||
return signString(stringToSign, credential.getAccessKeySecret());
|
||||
}
|
||||
|
||||
public static String signString(String stringToSign, String accessKeySecret) {
|
||||
try {
|
||||
Mac mac = Mac.getInstance(ALGORITHM_NAME);
|
||||
mac.init(new SecretKeySpec(accessKeySecret.getBytes(ENCODING), ALGORITHM_NAME));
|
||||
byte[] signData = mac.doFinal(stringToSign.getBytes(ENCODING));
|
||||
return Base64Utils.encode(signData);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new IllegalArgumentException(e.toString());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new IllegalArgumentException(e.toString());
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new IllegalArgumentException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSignerName() {
|
||||
return "HMAC-SHA1";
|
||||
}
|
||||
|
||||
public static String getSignerVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.utils;
|
||||
|
||||
import com.alipay.easysdk.kms.aliyun.credentials.http.MethodType;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class ParameterUtils {
|
||||
private final static String TIME_ZONE = "UTC";
|
||||
private final static String FORMAT_ISO8601 = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||
private final static String SEPARATOR = "&";
|
||||
public static final String ENCODING = "UTF-8";
|
||||
private static final String ALGORITHM_NAME = "HmacSHA1";
|
||||
|
||||
public static String getUniqueNonce() {
|
||||
StringBuilder uniqueNonce = new StringBuilder();
|
||||
UUID uuid = UUID.randomUUID();
|
||||
uniqueNonce.append(uuid.toString());
|
||||
uniqueNonce.append(System.currentTimeMillis());
|
||||
uniqueNonce.append(Thread.currentThread().getId());
|
||||
return uniqueNonce.toString();
|
||||
}
|
||||
|
||||
public static String getISO8601Time(Date date) {
|
||||
SimpleDateFormat df = new SimpleDateFormat(FORMAT_ISO8601);
|
||||
df.setTimeZone(new SimpleTimeZone(0, TIME_ZONE));
|
||||
return df.format(date);
|
||||
}
|
||||
|
||||
public static Date getUTCDate(String date) throws ParseException {
|
||||
SimpleDateFormat df = new SimpleDateFormat(FORMAT_ISO8601);
|
||||
df.setTimeZone(new SimpleTimeZone(0, TIME_ZONE));
|
||||
return df.parse(date);
|
||||
}
|
||||
|
||||
public String composeStringToSign(MethodType method, Map<String, String> queries) throws UnsupportedEncodingException {
|
||||
String[] sortedKeys = queries.keySet().toArray(new String[]{});
|
||||
Arrays.sort(sortedKeys);
|
||||
StringBuilder canonicalizedQueryString = new StringBuilder();
|
||||
|
||||
for (String key : sortedKeys) {
|
||||
if (!StringUtils.isEmpty(queries.get(key))) {
|
||||
canonicalizedQueryString.append("&")
|
||||
.append(AcsURLEncoder.percentEncode(key)).append("=")
|
||||
.append(AcsURLEncoder.percentEncode(queries.get(key)));
|
||||
}
|
||||
}
|
||||
|
||||
return method.toString() +
|
||||
SEPARATOR +
|
||||
AcsURLEncoder.percentEncode("/") +
|
||||
SEPARATOR +
|
||||
AcsURLEncoder.percentEncode(canonicalizedQueryString.toString().substring(1));
|
||||
}
|
||||
|
||||
public String composeUrl(String endpoint, Map<String, String> queries, String protocol) throws UnsupportedEncodingException {
|
||||
StringBuilder urlBuilder = new StringBuilder("");
|
||||
urlBuilder.append(protocol);
|
||||
urlBuilder.append("://").append(endpoint);
|
||||
urlBuilder.append("/?");
|
||||
StringBuilder builder = new StringBuilder("");
|
||||
|
||||
for (Map.Entry<String, String> entry : queries.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String val = entry.getValue();
|
||||
if (val == null) {
|
||||
continue;
|
||||
}
|
||||
builder.append(AcsURLEncoder.encode(key));
|
||||
builder.append("=").append(AcsURLEncoder.encode(val));
|
||||
builder.append("&");
|
||||
}
|
||||
|
||||
int strIndex = builder.length();
|
||||
builder.deleteCharAt(strIndex - 1);
|
||||
String query = builder.toString();
|
||||
return urlBuilder.append(query).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.alipay.easysdk.kms.aliyun.credentials.utils;
|
||||
|
||||
public class StringUtils {
|
||||
public static boolean isEmpty(final CharSequence cs) {
|
||||
return cs == null || cs.length() == 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.alipay.easysdk.kms.aliyun.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AsymmetricSignRequest extends TeaModel {
|
||||
@NameInMap("KeyId")
|
||||
@Validation(required = true)
|
||||
public String keyId;
|
||||
|
||||
@NameInMap("KeyVersionId")
|
||||
@Validation(required = true)
|
||||
public String keyVersionId;
|
||||
|
||||
@NameInMap("Algorithm")
|
||||
@Validation(required = true)
|
||||
public String algorithm;
|
||||
|
||||
@NameInMap("Digest")
|
||||
@Validation(required = true)
|
||||
public String digest;
|
||||
|
||||
public static AsymmetricSignRequest build(java.util.Map<String, ?> map) throws Exception {
|
||||
AsymmetricSignRequest self = new AsymmetricSignRequest();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.alipay.easysdk.kms.aliyun.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AsymmetricSignResponse extends TeaModel {
|
||||
@NameInMap("Value")
|
||||
@Validation(required = true)
|
||||
public String value;
|
||||
|
||||
@NameInMap("KeyId")
|
||||
@Validation(required = true)
|
||||
public String keyId;
|
||||
|
||||
@NameInMap("RequestId")
|
||||
@Validation(required = true)
|
||||
public String requestId;
|
||||
|
||||
@NameInMap("KeyVersionId")
|
||||
@Validation(required = true)
|
||||
public String keyVersionId;
|
||||
|
||||
public static AsymmetricSignResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AsymmetricSignResponse self = new AsymmetricSignResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alipay.easysdk.kms.aliyun.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class GetPublicKeyRequest extends TeaModel {
|
||||
@NameInMap("KeyId")
|
||||
@Validation(required = true)
|
||||
public String keyId;
|
||||
|
||||
@NameInMap("KeyVersionId")
|
||||
@Validation(required = true)
|
||||
public String keyVersionId;
|
||||
|
||||
public static GetPublicKeyRequest build(java.util.Map<String, ?> map) throws Exception {
|
||||
GetPublicKeyRequest self = new GetPublicKeyRequest();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.alipay.easysdk.kms.aliyun.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class GetPublicKeyResponse extends TeaModel {
|
||||
@NameInMap("PublicKey")
|
||||
@Validation(required = true)
|
||||
public String publicKey;
|
||||
|
||||
@NameInMap("KeyId")
|
||||
@Validation(required = true)
|
||||
public String keyId;
|
||||
|
||||
@NameInMap("RequestId")
|
||||
@Validation(required = true)
|
||||
public String requestId;
|
||||
|
||||
@NameInMap("KeyVersionId")
|
||||
@Validation(required = true)
|
||||
public String keyVersionId;
|
||||
|
||||
public static GetPublicKeyResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
GetPublicKeyResponse self = new GetPublicKeyResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.alipay.easysdk.kms.aliyun.models;
|
||||
|
||||
import com.aliyun.tea.NameInMap;
|
||||
import com.aliyun.tea.TeaModel;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RuntimeOptions extends TeaModel {
|
||||
@NameInMap("ignoreSSL")
|
||||
public Boolean ignoreSSL;
|
||||
@NameInMap("maxAttempts")
|
||||
public Integer maxAttempts;
|
||||
@NameInMap("backoffPolicy")
|
||||
public String backoffPolicy;
|
||||
@NameInMap("backoffPeriod")
|
||||
public Integer backoffPeriod;
|
||||
@NameInMap("readTimeout")
|
||||
public Integer readTimeout;
|
||||
@NameInMap("connectTimeout")
|
||||
public Integer connectTimeout;
|
||||
|
||||
public static RuntimeOptions build(Map<String, ?> map) throws Exception {
|
||||
RuntimeOptions self = new RuntimeOptions();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
}
|
||||
793
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/marketing/openlife/Client.java
vendored
Normal file
793
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/marketing/openlife/Client.java
vendored
Normal file
@@ -0,0 +1,793 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.marketing.openlife.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse createImageTextContent(String title, String cover, String content, String contentComment, String ctype, String benefit, String extTags, String loginIds) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.message.content.create"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("title", title),
|
||||
new TeaPair("cover", cover),
|
||||
new TeaPair("content", content),
|
||||
new TeaPair("could_comment", contentComment),
|
||||
new TeaPair("ctype", ctype),
|
||||
new TeaPair("benefit", benefit),
|
||||
new TeaPair("ext_tags", extTags),
|
||||
new TeaPair("login_ids", loginIds)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.message.content.create");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageContentCreateResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageContentCreateResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse modifyImageTextContent(String contentId, String title, String cover, String content, String couldComment, String ctype, String benefit, String extTags, String loginIds) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.message.content.modify"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("content_id", contentId),
|
||||
new TeaPair("title", title),
|
||||
new TeaPair("cover", cover),
|
||||
new TeaPair("content", content),
|
||||
new TeaPair("could_comment", couldComment),
|
||||
new TeaPair("ctype", ctype),
|
||||
new TeaPair("benefit", benefit),
|
||||
new TeaPair("ext_tags", extTags),
|
||||
new TeaPair("login_ids", loginIds)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.message.content.modify");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageContentModifyResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageContentModifyResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse sendText(String text) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.message.total.send"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
Text textObj = Text.build(TeaConverter.buildMap(
|
||||
new TeaPair("title", ""),
|
||||
new TeaPair("content", text)
|
||||
));
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("msg_type", "text"),
|
||||
new TeaPair("text", textObj)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.message.total.send");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageTotalSendResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageTotalSendResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse sendImageText(java.util.List<Article> articles) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.message.total.send"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("msg_type", "image-text"),
|
||||
new TeaPair("articles", articles)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.message.total.send");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageTotalSendResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageTotalSendResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageSingleSendResponse sendSingleMessage(String toUserId, Template template) throws Exception {
|
||||
TeaModel.validateParams(template, "template");
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.message.single.send"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("to_user_id", toUserId),
|
||||
new TeaPair("template", template)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.message.single.send");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageSingleSendResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicMessageSingleSendResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicLifeMsgRecallResponse recallMessage(String messageId) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.life.msg.recall"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("message_id", messageId)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.life.msg.recall");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicLifeMsgRecallResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicLifeMsgRecallResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicTemplateMessageIndustryModifyResponse setIndustry(String primaryIndustryCode, String primaryIndustryName, String secondaryIndustryCode, String secondaryIndustryName) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.template.message.industry.modify"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("primary_industry_code", primaryIndustryCode),
|
||||
new TeaPair("primary_industry_name", primaryIndustryName),
|
||||
new TeaPair("secondary_industry_code", secondaryIndustryCode),
|
||||
new TeaPair("secondary_industry_name", secondaryIndustryName)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.template.message.industry.modify");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicTemplateMessageIndustryModifyResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicTemplateMessageIndustryModifyResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse getIndustry() throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.public.setting.category.query"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = new java.util.HashMap<>();
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.public.setting.category.query");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicSettingCategoryQueryResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenPublicSettingCategoryQueryResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenPublicLifeMsgRecallResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
public static AlipayOpenPublicLifeMsgRecallResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenPublicLifeMsgRecallResponse self = new AlipayOpenPublicLifeMsgRecallResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicLifeMsgRecallResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicLifeMsgRecallResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicLifeMsgRecallResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicLifeMsgRecallResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicLifeMsgRecallResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenPublicMessageContentCreateResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("content_id")
|
||||
@Validation(required = true)
|
||||
public String contentId;
|
||||
|
||||
@NameInMap("content_url")
|
||||
@Validation(required = true)
|
||||
public String contentUrl;
|
||||
|
||||
public static AlipayOpenPublicMessageContentCreateResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenPublicMessageContentCreateResponse self = new AlipayOpenPublicMessageContentCreateResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse setContentId(String contentId) {
|
||||
this.contentId = contentId;
|
||||
return this;
|
||||
}
|
||||
public String getContentId() {
|
||||
return this.contentId;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentCreateResponse setContentUrl(String contentUrl) {
|
||||
this.contentUrl = contentUrl;
|
||||
return this;
|
||||
}
|
||||
public String getContentUrl() {
|
||||
return this.contentUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenPublicMessageContentModifyResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("content_id")
|
||||
@Validation(required = true)
|
||||
public String contentId;
|
||||
|
||||
@NameInMap("content_url")
|
||||
@Validation(required = true)
|
||||
public String contentUrl;
|
||||
|
||||
public static AlipayOpenPublicMessageContentModifyResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenPublicMessageContentModifyResponse self = new AlipayOpenPublicMessageContentModifyResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse setContentId(String contentId) {
|
||||
this.contentId = contentId;
|
||||
return this;
|
||||
}
|
||||
public String getContentId() {
|
||||
return this.contentId;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageContentModifyResponse setContentUrl(String contentUrl) {
|
||||
this.contentUrl = contentUrl;
|
||||
return this;
|
||||
}
|
||||
public String getContentUrl() {
|
||||
return this.contentUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenPublicMessageSingleSendResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
public static AlipayOpenPublicMessageSingleSendResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenPublicMessageSingleSendResponse self = new AlipayOpenPublicMessageSingleSendResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageSingleSendResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageSingleSendResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageSingleSendResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageSingleSendResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageSingleSendResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenPublicMessageTotalSendResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("message_id")
|
||||
@Validation(required = true)
|
||||
public String messageId;
|
||||
|
||||
public static AlipayOpenPublicMessageTotalSendResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenPublicMessageTotalSendResponse self = new AlipayOpenPublicMessageTotalSendResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicMessageTotalSendResponse setMessageId(String messageId) {
|
||||
this.messageId = messageId;
|
||||
return this;
|
||||
}
|
||||
public String getMessageId() {
|
||||
return this.messageId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenPublicSettingCategoryQueryResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("primary_category")
|
||||
@Validation(required = true)
|
||||
public String primaryCategory;
|
||||
|
||||
@NameInMap("secondary_category")
|
||||
@Validation(required = true)
|
||||
public String secondaryCategory;
|
||||
|
||||
public static AlipayOpenPublicSettingCategoryQueryResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenPublicSettingCategoryQueryResponse self = new AlipayOpenPublicSettingCategoryQueryResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse setPrimaryCategory(String primaryCategory) {
|
||||
this.primaryCategory = primaryCategory;
|
||||
return this;
|
||||
}
|
||||
public String getPrimaryCategory() {
|
||||
return this.primaryCategory;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicSettingCategoryQueryResponse setSecondaryCategory(String secondaryCategory) {
|
||||
this.secondaryCategory = secondaryCategory;
|
||||
return this;
|
||||
}
|
||||
public String getSecondaryCategory() {
|
||||
return this.secondaryCategory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenPublicTemplateMessageIndustryModifyResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
public static AlipayOpenPublicTemplateMessageIndustryModifyResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenPublicTemplateMessageIndustryModifyResponse self = new AlipayOpenPublicTemplateMessageIndustryModifyResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenPublicTemplateMessageIndustryModifyResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicTemplateMessageIndustryModifyResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicTemplateMessageIndustryModifyResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicTemplateMessageIndustryModifyResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenPublicTemplateMessageIndustryModifyResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class Article extends TeaModel {
|
||||
@NameInMap("title")
|
||||
public String title;
|
||||
|
||||
@NameInMap("desc")
|
||||
@Validation(required = true)
|
||||
public String desc;
|
||||
|
||||
@NameInMap("image_url")
|
||||
public String imageUrl;
|
||||
|
||||
@NameInMap("url")
|
||||
@Validation(required = true)
|
||||
public String url;
|
||||
|
||||
@NameInMap("action_name")
|
||||
public String actionName;
|
||||
|
||||
public static Article build(java.util.Map<String, ?> map) throws Exception {
|
||||
Article self = new Article();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public Article setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public Article setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
return this;
|
||||
}
|
||||
public String getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
public Article setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
return this;
|
||||
}
|
||||
public String getImageUrl() {
|
||||
return this.imageUrl;
|
||||
}
|
||||
|
||||
public Article setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public Article setActionName(String actionName) {
|
||||
this.actionName = actionName;
|
||||
return this;
|
||||
}
|
||||
public String getActionName() {
|
||||
return this.actionName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class Context extends TeaModel {
|
||||
@NameInMap("head_color")
|
||||
@Validation(required = true)
|
||||
public String headColor;
|
||||
|
||||
@NameInMap("url")
|
||||
@Validation(required = true)
|
||||
public String url;
|
||||
|
||||
@NameInMap("action_name")
|
||||
@Validation(required = true)
|
||||
public String actionName;
|
||||
|
||||
@NameInMap("keyword1")
|
||||
public Keyword keyword1;
|
||||
|
||||
@NameInMap("keyword2")
|
||||
public Keyword keyword2;
|
||||
|
||||
@NameInMap("first")
|
||||
public Keyword first;
|
||||
|
||||
@NameInMap("remark")
|
||||
public Keyword remark;
|
||||
|
||||
public static Context build(java.util.Map<String, ?> map) throws Exception {
|
||||
Context self = new Context();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public Context setHeadColor(String headColor) {
|
||||
this.headColor = headColor;
|
||||
return this;
|
||||
}
|
||||
public String getHeadColor() {
|
||||
return this.headColor;
|
||||
}
|
||||
|
||||
public Context setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public Context setActionName(String actionName) {
|
||||
this.actionName = actionName;
|
||||
return this;
|
||||
}
|
||||
public String getActionName() {
|
||||
return this.actionName;
|
||||
}
|
||||
|
||||
public Context setKeyword1(Keyword keyword1) {
|
||||
this.keyword1 = keyword1;
|
||||
return this;
|
||||
}
|
||||
public Keyword getKeyword1() {
|
||||
return this.keyword1;
|
||||
}
|
||||
|
||||
public Context setKeyword2(Keyword keyword2) {
|
||||
this.keyword2 = keyword2;
|
||||
return this;
|
||||
}
|
||||
public Keyword getKeyword2() {
|
||||
return this.keyword2;
|
||||
}
|
||||
|
||||
public Context setFirst(Keyword first) {
|
||||
this.first = first;
|
||||
return this;
|
||||
}
|
||||
public Keyword getFirst() {
|
||||
return this.first;
|
||||
}
|
||||
|
||||
public Context setRemark(Keyword remark) {
|
||||
this.remark = remark;
|
||||
return this;
|
||||
}
|
||||
public Keyword getRemark() {
|
||||
return this.remark;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class Keyword extends TeaModel {
|
||||
@NameInMap("color")
|
||||
@Validation(required = true)
|
||||
public String color;
|
||||
|
||||
@NameInMap("value")
|
||||
@Validation(required = true)
|
||||
public String value;
|
||||
|
||||
public static Keyword build(java.util.Map<String, ?> map) throws Exception {
|
||||
Keyword self = new Keyword();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public Keyword setColor(String color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
public String getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public Keyword setValue(String value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class Template extends TeaModel {
|
||||
@NameInMap("template_id")
|
||||
@Validation(required = true)
|
||||
public String templateId;
|
||||
|
||||
@NameInMap("context")
|
||||
@Validation(required = true)
|
||||
public Context context;
|
||||
|
||||
public static Template build(java.util.Map<String, ?> map) throws Exception {
|
||||
Template self = new Template();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public Template setTemplateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
return this;
|
||||
}
|
||||
public String getTemplateId() {
|
||||
return this.templateId;
|
||||
}
|
||||
|
||||
public Template setContext(Context context) {
|
||||
this.context = context;
|
||||
return this;
|
||||
}
|
||||
public Context getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.openlife.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class Text extends TeaModel {
|
||||
@NameInMap("title")
|
||||
@Validation(required = true)
|
||||
public String title;
|
||||
|
||||
@NameInMap("content")
|
||||
@Validation(required = true)
|
||||
public String content;
|
||||
|
||||
public static Text build(java.util.Map<String, ?> map) throws Exception {
|
||||
Text self = new Text();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public Text setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public Text setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
}
|
||||
439
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/marketing/pass/Client.java
vendored
Normal file
439
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/marketing/pass/Client.java
vendored
Normal file
@@ -0,0 +1,439 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.pass;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.marketing.pass.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse createTemplate(String uniqueId, String tplContent) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.pass.template.add"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("unique_id", uniqueId),
|
||||
new TeaPair("tpl_content", tplContent)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.pass.template.add");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassTemplateAddResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassTemplateAddResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse updateTemplate(String tplId, String tplContent) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.pass.template.update"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("tpl_id", tplId),
|
||||
new TeaPair("tpl_content", tplContent)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.pass.template.update");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassTemplateUpdateResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassTemplateUpdateResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse addInstance(String tplId, String tplParams, String recognitionType, String recognitionInfo) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.pass.instance.add"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("tpl_id", tplId),
|
||||
new TeaPair("tpl_params", tplParams),
|
||||
new TeaPair("recognition_type", recognitionType),
|
||||
new TeaPair("recognition_info", recognitionInfo)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.pass.instance.add");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassInstanceAddResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassInstanceAddResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse updateInstance(String serialNumber, String channelId, String tplParams, String status, String verifyCode, String verifyType) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.pass.instance.update"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("serial_number", serialNumber),
|
||||
new TeaPair("channel_id", channelId),
|
||||
new TeaPair("tpl_params", tplParams),
|
||||
new TeaPair("status", status),
|
||||
new TeaPair("verify_code", verifyCode),
|
||||
new TeaPair("verify_type", verifyType)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.pass.instance.update");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassInstanceUpdateResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayPassInstanceUpdateResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.pass.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayPassInstanceAddResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("success")
|
||||
@Validation(required = true)
|
||||
public Boolean success;
|
||||
|
||||
@NameInMap("result")
|
||||
@Validation(required = true)
|
||||
public String result;
|
||||
|
||||
public static AlipayPassInstanceAddResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayPassInstanceAddResponse self = new AlipayPassInstanceAddResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
public Boolean getSuccess() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceAddResponse setResult(String result) {
|
||||
this.result = result;
|
||||
return this;
|
||||
}
|
||||
public String getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.pass.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayPassInstanceUpdateResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("success")
|
||||
@Validation(required = true)
|
||||
public Boolean success;
|
||||
|
||||
@NameInMap("result")
|
||||
@Validation(required = true)
|
||||
public String result;
|
||||
|
||||
public static AlipayPassInstanceUpdateResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayPassInstanceUpdateResponse self = new AlipayPassInstanceUpdateResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
public Boolean getSuccess() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
public AlipayPassInstanceUpdateResponse setResult(String result) {
|
||||
this.result = result;
|
||||
return this;
|
||||
}
|
||||
public String getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.pass.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayPassTemplateAddResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("success")
|
||||
@Validation(required = true)
|
||||
public Boolean success;
|
||||
|
||||
@NameInMap("result")
|
||||
@Validation(required = true)
|
||||
public String result;
|
||||
|
||||
public static AlipayPassTemplateAddResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayPassTemplateAddResponse self = new AlipayPassTemplateAddResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
public Boolean getSuccess() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateAddResponse setResult(String result) {
|
||||
this.result = result;
|
||||
return this;
|
||||
}
|
||||
public String getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.pass.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayPassTemplateUpdateResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("success")
|
||||
@Validation(required = true)
|
||||
public Boolean success;
|
||||
|
||||
@NameInMap("result")
|
||||
@Validation(required = true)
|
||||
public String result;
|
||||
|
||||
public static AlipayPassTemplateUpdateResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayPassTemplateUpdateResponse self = new AlipayPassTemplateUpdateResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
public Boolean getSuccess() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
public AlipayPassTemplateUpdateResponse setResult(String result) {
|
||||
this.result = result;
|
||||
return this;
|
||||
}
|
||||
public String getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
}
|
||||
178
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/marketing/templatemessage/Client.java
vendored
Normal file
178
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/marketing/templatemessage/Client.java
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.templatemessage;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.marketing.templatemessage.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayOpenAppMiniTemplatemessageSendResponse send(String toUserId, String formId, String userTemplateId, String page, String data) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.open.app.mini.templatemessage.send"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("to_user_id", toUserId),
|
||||
new TeaPair("form_id", formId),
|
||||
new TeaPair("user_template_id", userTemplateId),
|
||||
new TeaPair("page", page),
|
||||
new TeaPair("data", data)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.open.app.mini.templatemessage.send");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenAppMiniTemplatemessageSendResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayOpenAppMiniTemplatemessageSendResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.marketing.templatemessage.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayOpenAppMiniTemplatemessageSendResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
public static AlipayOpenAppMiniTemplatemessageSendResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayOpenAppMiniTemplatemessageSendResponse self = new AlipayOpenAppMiniTemplatemessageSendResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayOpenAppMiniTemplatemessageSendResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayOpenAppMiniTemplatemessageSendResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayOpenAppMiniTemplatemessageSendResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayOpenAppMiniTemplatemessageSendResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayOpenAppMiniTemplatemessageSendResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
}
|
||||
287
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/member/identification/Client.java
vendored
Normal file
287
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/member/identification/Client.java
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.member.identification;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.member.identification.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenInitializeResponse init(String outerOrderNo, String bizCode, IdentityParam identityParam, MerchantConfig merchantConfig) throws Exception {
|
||||
TeaModel.validateParams(identityParam, "identityParam");
|
||||
TeaModel.validateParams(merchantConfig, "merchantConfig");
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.user.certify.open.initialize"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("outer_order_no", outerOrderNo),
|
||||
new TeaPair("biz_code", bizCode),
|
||||
new TeaPair("identity_param", identityParam),
|
||||
new TeaPair("merchant_config", merchantConfig)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.user.certify.open.initialize");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayUserCertifyOpenInitializeResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayUserCertifyOpenInitializeResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse query(String certifyId) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.user.certify.open.query"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("certify_id", certifyId)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.user.certify.open.query");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayUserCertifyOpenQueryResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayUserCertifyOpenQueryResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenCertifyResponse certify(String certifyId) throws Exception {
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.user.certify.open.certify"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("certify_id", certifyId)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
String sign = _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey"));
|
||||
java.util.Map<String, String> response = TeaConverter.buildMap(
|
||||
new TeaPair("body", _kernel.generatePage("GET", systemParams, bizParams, textParams, sign))
|
||||
);
|
||||
return TeaModel.toModel(response, new AlipayUserCertifyOpenCertifyResponse());
|
||||
}
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.member.identification.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayUserCertifyOpenCertifyResponse extends TeaModel {
|
||||
// 认证服务请求地址
|
||||
@NameInMap("body")
|
||||
@Validation(required = true)
|
||||
public String body;
|
||||
|
||||
public static AlipayUserCertifyOpenCertifyResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayUserCertifyOpenCertifyResponse self = new AlipayUserCertifyOpenCertifyResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenCertifyResponse setBody(String body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.member.identification.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayUserCertifyOpenInitializeResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("certify_id")
|
||||
@Validation(required = true)
|
||||
public String certifyId;
|
||||
|
||||
public static AlipayUserCertifyOpenInitializeResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayUserCertifyOpenInitializeResponse self = new AlipayUserCertifyOpenInitializeResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenInitializeResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenInitializeResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenInitializeResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenInitializeResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenInitializeResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenInitializeResponse setCertifyId(String certifyId) {
|
||||
this.certifyId = certifyId;
|
||||
return this;
|
||||
}
|
||||
public String getCertifyId() {
|
||||
return this.certifyId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.member.identification.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayUserCertifyOpenQueryResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("passed")
|
||||
@Validation(required = true)
|
||||
public String passed;
|
||||
|
||||
@NameInMap("identity_info")
|
||||
@Validation(required = true)
|
||||
public String identityInfo;
|
||||
|
||||
@NameInMap("material_info")
|
||||
@Validation(required = true)
|
||||
public String materialInfo;
|
||||
|
||||
public static AlipayUserCertifyOpenQueryResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayUserCertifyOpenQueryResponse self = new AlipayUserCertifyOpenQueryResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setPassed(String passed) {
|
||||
this.passed = passed;
|
||||
return this;
|
||||
}
|
||||
public String getPassed() {
|
||||
return this.passed;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setIdentityInfo(String identityInfo) {
|
||||
this.identityInfo = identityInfo;
|
||||
return this;
|
||||
}
|
||||
public String getIdentityInfo() {
|
||||
return this.identityInfo;
|
||||
}
|
||||
|
||||
public AlipayUserCertifyOpenQueryResponse setMaterialInfo(String materialInfo) {
|
||||
this.materialInfo = materialInfo;
|
||||
return this;
|
||||
}
|
||||
public String getMaterialInfo() {
|
||||
return this.materialInfo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.member.identification.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class IdentityParam extends TeaModel {
|
||||
@NameInMap("identity_type")
|
||||
@Validation(required = true)
|
||||
public String identityType;
|
||||
|
||||
@NameInMap("cert_type")
|
||||
@Validation(required = true)
|
||||
public String certType;
|
||||
|
||||
@NameInMap("cert_name")
|
||||
@Validation(required = true)
|
||||
public String certName;
|
||||
|
||||
@NameInMap("cert_no")
|
||||
@Validation(required = true)
|
||||
public String certNo;
|
||||
|
||||
public static IdentityParam build(java.util.Map<String, ?> map) throws Exception {
|
||||
IdentityParam self = new IdentityParam();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public IdentityParam setIdentityType(String identityType) {
|
||||
this.identityType = identityType;
|
||||
return this;
|
||||
}
|
||||
public String getIdentityType() {
|
||||
return this.identityType;
|
||||
}
|
||||
|
||||
public IdentityParam setCertType(String certType) {
|
||||
this.certType = certType;
|
||||
return this;
|
||||
}
|
||||
public String getCertType() {
|
||||
return this.certType;
|
||||
}
|
||||
|
||||
public IdentityParam setCertName(String certName) {
|
||||
this.certName = certName;
|
||||
return this;
|
||||
}
|
||||
public String getCertName() {
|
||||
return this.certName;
|
||||
}
|
||||
|
||||
public IdentityParam setCertNo(String certNo) {
|
||||
this.certNo = certNo;
|
||||
return this;
|
||||
}
|
||||
public String getCertNo() {
|
||||
return this.certNo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.member.identification.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class MerchantConfig extends TeaModel {
|
||||
@NameInMap("return_url")
|
||||
@Validation(required = true)
|
||||
public String returnUrl;
|
||||
|
||||
public static MerchantConfig build(java.util.Map<String, ?> map) throws Exception {
|
||||
MerchantConfig self = new MerchantConfig();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public MerchantConfig setReturnUrl(String returnUrl) {
|
||||
this.returnUrl = returnUrl;
|
||||
return this;
|
||||
}
|
||||
public String getReturnUrl() {
|
||||
return this.returnUrl;
|
||||
}
|
||||
|
||||
}
|
||||
115
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/app/Client.java
vendored
Normal file
115
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/app/Client.java
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.app;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.payment.app.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
|
||||
public AlipayTradeAppPayResponse pay(String subject, String outTradeNo, String totalAmount) throws Exception {
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.app.pay"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("subject", subject),
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("total_amount", totalAmount)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
String sign = _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey"));
|
||||
java.util.Map<String, String> response = TeaConverter.buildMap(
|
||||
new TeaPair("body", _kernel.generateOrderString(systemParams, bizParams, textParams, sign))
|
||||
);
|
||||
return TeaModel.toModel(response, new AlipayTradeAppPayResponse());
|
||||
}
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.app.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeAppPayResponse extends TeaModel {
|
||||
// 订单信息,字符串形式
|
||||
@NameInMap("body")
|
||||
@Validation(required = true)
|
||||
public String body;
|
||||
|
||||
public static AlipayTradeAppPayResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeAppPayResponse self = new AlipayTradeAppPayResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeAppPayResponse setBody(String body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
}
|
||||
698
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/common/Client.java
vendored
Normal file
698
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/common/Client.java
vendored
Normal file
@@ -0,0 +1,698 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.payment.common.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse create(String subject, String outTradeNo, String totalAmount, String buyerId) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.create"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("subject", subject),
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("total_amount", totalAmount),
|
||||
new TeaPair("buyer_id", buyerId)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.create");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCreateResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCreateResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse query(String outTradeNo) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.query"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("out_trade_no", outTradeNo)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.query");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeQueryResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeQueryResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse refund(String outTradeNo, String refundAmount) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.refund"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("refund_amount", refundAmount)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.refund");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeRefundResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeRefundResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse close(String outTradeNo) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.close"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("out_trade_no", outTradeNo)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.close");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCloseResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCloseResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse cancel(String outTradeNo) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.cancel"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("out_trade_no", outTradeNo)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.cancel");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCancelResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCancelResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse queryRefund(String outTradeNo, String outRequestNo) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.fastpay.refund.query"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("out_request_no", outRequestNo)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.fastpay.refund.query");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeFastpayRefundQueryResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeFastpayRefundQueryResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayDataDataserviceBillDownloadurlQueryResponse downloadBill(String billType, String billDate) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.data.dataservice.bill.downloadurl.query"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("bill_type", billType),
|
||||
new TeaPair("bill_date", billDate)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.data.dataservice.bill.downloadurl.query");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayDataDataserviceBillDownloadurlQueryResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayDataDataserviceBillDownloadurlQueryResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public Boolean verifyNotify(java.util.Map<String, String> parameters) throws Exception {
|
||||
if (_kernel.isCertMode()) {
|
||||
return _kernel.verifyParams(parameters, _kernel.extractAlipayPublicKey(""));
|
||||
} else {
|
||||
return _kernel.verifyParams(parameters, _kernel.getConfig("alipayPublicKey"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayDataDataserviceBillDownloadurlQueryResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("bill_download_url")
|
||||
@Validation(required = true)
|
||||
public String billDownloadUrl;
|
||||
|
||||
public static AlipayDataDataserviceBillDownloadurlQueryResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayDataDataserviceBillDownloadurlQueryResponse self = new AlipayDataDataserviceBillDownloadurlQueryResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayDataDataserviceBillDownloadurlQueryResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayDataDataserviceBillDownloadurlQueryResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayDataDataserviceBillDownloadurlQueryResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayDataDataserviceBillDownloadurlQueryResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayDataDataserviceBillDownloadurlQueryResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayDataDataserviceBillDownloadurlQueryResponse setBillDownloadUrl(String billDownloadUrl) {
|
||||
this.billDownloadUrl = billDownloadUrl;
|
||||
return this;
|
||||
}
|
||||
public String getBillDownloadUrl() {
|
||||
return this.billDownloadUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeCancelResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("retry_flag")
|
||||
@Validation(required = true)
|
||||
public String retryFlag;
|
||||
|
||||
@NameInMap("action")
|
||||
@Validation(required = true)
|
||||
public String action;
|
||||
|
||||
@NameInMap("gmt_refund_pay")
|
||||
@Validation(required = true)
|
||||
public String gmtRefundPay;
|
||||
|
||||
@NameInMap("refund_settlement_id")
|
||||
@Validation(required = true)
|
||||
public String refundSettlementId;
|
||||
|
||||
public static AlipayTradeCancelResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeCancelResponse self = new AlipayTradeCancelResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setRetryFlag(String retryFlag) {
|
||||
this.retryFlag = retryFlag;
|
||||
return this;
|
||||
}
|
||||
public String getRetryFlag() {
|
||||
return this.retryFlag;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setAction(String action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
public String getAction() {
|
||||
return this.action;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setGmtRefundPay(String gmtRefundPay) {
|
||||
this.gmtRefundPay = gmtRefundPay;
|
||||
return this;
|
||||
}
|
||||
public String getGmtRefundPay() {
|
||||
return this.gmtRefundPay;
|
||||
}
|
||||
|
||||
public AlipayTradeCancelResponse setRefundSettlementId(String refundSettlementId) {
|
||||
this.refundSettlementId = refundSettlementId;
|
||||
return this;
|
||||
}
|
||||
public String getRefundSettlementId() {
|
||||
return this.refundSettlementId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeCloseResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
public static AlipayTradeCloseResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeCloseResponse self = new AlipayTradeCloseResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeCloseResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeCreateResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
public static AlipayTradeCreateResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeCreateResponse self = new AlipayTradeCreateResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeFastpayRefundQueryResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("error_code")
|
||||
@Validation(required = true)
|
||||
public String errorCode;
|
||||
|
||||
@NameInMap("gmt_refund_pay")
|
||||
@Validation(required = true)
|
||||
public String gmtRefundPay;
|
||||
|
||||
@NameInMap("industry_sepc_detail")
|
||||
@Validation(required = true)
|
||||
public String industrySepcDetail;
|
||||
|
||||
@NameInMap("out_request_no")
|
||||
@Validation(required = true)
|
||||
public String outRequestNo;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("present_refund_buyer_amount")
|
||||
@Validation(required = true)
|
||||
public String presentRefundBuyerAmount;
|
||||
|
||||
@NameInMap("present_refund_discount_amount")
|
||||
@Validation(required = true)
|
||||
public String presentRefundDiscountAmount;
|
||||
|
||||
@NameInMap("present_refund_mdiscount_amount")
|
||||
@Validation(required = true)
|
||||
public String presentRefundMdiscountAmount;
|
||||
|
||||
@NameInMap("refund_amount")
|
||||
@Validation(required = true)
|
||||
public String refundAmount;
|
||||
|
||||
@NameInMap("refund_charge_amount")
|
||||
@Validation(required = true)
|
||||
public String refundChargeAmount;
|
||||
|
||||
@NameInMap("refund_detail_item_list")
|
||||
@Validation(required = true)
|
||||
public java.util.List<TradeFundBill> refundDetailItemList;
|
||||
|
||||
@NameInMap("refund_reason")
|
||||
@Validation(required = true)
|
||||
public String refundReason;
|
||||
|
||||
@NameInMap("refund_royaltys")
|
||||
@Validation(required = true)
|
||||
public java.util.List<RefundRoyaltyResult> refundRoyaltys;
|
||||
|
||||
@NameInMap("refund_settlement_id")
|
||||
@Validation(required = true)
|
||||
public String refundSettlementId;
|
||||
|
||||
@NameInMap("refund_status")
|
||||
@Validation(required = true)
|
||||
public String refundStatus;
|
||||
|
||||
@NameInMap("send_back_fee")
|
||||
@Validation(required = true)
|
||||
public String sendBackFee;
|
||||
|
||||
@NameInMap("total_amount")
|
||||
@Validation(required = true)
|
||||
public String totalAmount;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
public static AlipayTradeFastpayRefundQueryResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeFastpayRefundQueryResponse self = new AlipayTradeFastpayRefundQueryResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setErrorCode(String errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
return this;
|
||||
}
|
||||
public String getErrorCode() {
|
||||
return this.errorCode;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setGmtRefundPay(String gmtRefundPay) {
|
||||
this.gmtRefundPay = gmtRefundPay;
|
||||
return this;
|
||||
}
|
||||
public String getGmtRefundPay() {
|
||||
return this.gmtRefundPay;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setIndustrySepcDetail(String industrySepcDetail) {
|
||||
this.industrySepcDetail = industrySepcDetail;
|
||||
return this;
|
||||
}
|
||||
public String getIndustrySepcDetail() {
|
||||
return this.industrySepcDetail;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setOutRequestNo(String outRequestNo) {
|
||||
this.outRequestNo = outRequestNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutRequestNo() {
|
||||
return this.outRequestNo;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setPresentRefundBuyerAmount(String presentRefundBuyerAmount) {
|
||||
this.presentRefundBuyerAmount = presentRefundBuyerAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPresentRefundBuyerAmount() {
|
||||
return this.presentRefundBuyerAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setPresentRefundDiscountAmount(String presentRefundDiscountAmount) {
|
||||
this.presentRefundDiscountAmount = presentRefundDiscountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPresentRefundDiscountAmount() {
|
||||
return this.presentRefundDiscountAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setPresentRefundMdiscountAmount(String presentRefundMdiscountAmount) {
|
||||
this.presentRefundMdiscountAmount = presentRefundMdiscountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPresentRefundMdiscountAmount() {
|
||||
return this.presentRefundMdiscountAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setRefundAmount(String refundAmount) {
|
||||
this.refundAmount = refundAmount;
|
||||
return this;
|
||||
}
|
||||
public String getRefundAmount() {
|
||||
return this.refundAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setRefundChargeAmount(String refundChargeAmount) {
|
||||
this.refundChargeAmount = refundChargeAmount;
|
||||
return this;
|
||||
}
|
||||
public String getRefundChargeAmount() {
|
||||
return this.refundChargeAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setRefundDetailItemList(java.util.List<TradeFundBill> refundDetailItemList) {
|
||||
this.refundDetailItemList = refundDetailItemList;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<TradeFundBill> getRefundDetailItemList() {
|
||||
return this.refundDetailItemList;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setRefundReason(String refundReason) {
|
||||
this.refundReason = refundReason;
|
||||
return this;
|
||||
}
|
||||
public String getRefundReason() {
|
||||
return this.refundReason;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setRefundRoyaltys(java.util.List<RefundRoyaltyResult> refundRoyaltys) {
|
||||
this.refundRoyaltys = refundRoyaltys;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<RefundRoyaltyResult> getRefundRoyaltys() {
|
||||
return this.refundRoyaltys;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setRefundSettlementId(String refundSettlementId) {
|
||||
this.refundSettlementId = refundSettlementId;
|
||||
return this;
|
||||
}
|
||||
public String getRefundSettlementId() {
|
||||
return this.refundSettlementId;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setRefundStatus(String refundStatus) {
|
||||
this.refundStatus = refundStatus;
|
||||
return this;
|
||||
}
|
||||
public String getRefundStatus() {
|
||||
return this.refundStatus;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setSendBackFee(String sendBackFee) {
|
||||
this.sendBackFee = sendBackFee;
|
||||
return this;
|
||||
}
|
||||
public String getSendBackFee() {
|
||||
return this.sendBackFee;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setTotalAmount(String totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
return this;
|
||||
}
|
||||
public String getTotalAmount() {
|
||||
return this.totalAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeFastpayRefundQueryResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,493 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeQueryResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("buyer_logon_id")
|
||||
@Validation(required = true)
|
||||
public String buyerLogonId;
|
||||
|
||||
@NameInMap("trade_status")
|
||||
@Validation(required = true)
|
||||
public String tradeStatus;
|
||||
|
||||
@NameInMap("total_amount")
|
||||
@Validation(required = true)
|
||||
public String totalAmount;
|
||||
|
||||
@NameInMap("trans_currency")
|
||||
@Validation(required = true)
|
||||
public String transCurrency;
|
||||
|
||||
@NameInMap("settle_currency")
|
||||
@Validation(required = true)
|
||||
public String settleCurrency;
|
||||
|
||||
@NameInMap("settle_amount")
|
||||
@Validation(required = true)
|
||||
public String settleAmount;
|
||||
|
||||
@NameInMap("pay_currency")
|
||||
@Validation(required = true)
|
||||
public String payCurrency;
|
||||
|
||||
@NameInMap("pay_amount")
|
||||
@Validation(required = true)
|
||||
public String payAmount;
|
||||
|
||||
@NameInMap("settle_trans_rate")
|
||||
@Validation(required = true)
|
||||
public String settleTransRate;
|
||||
|
||||
@NameInMap("trans_pay_rate")
|
||||
@Validation(required = true)
|
||||
public String transPayRate;
|
||||
|
||||
@NameInMap("buyer_pay_amount")
|
||||
@Validation(required = true)
|
||||
public String buyerPayAmount;
|
||||
|
||||
@NameInMap("point_amount")
|
||||
@Validation(required = true)
|
||||
public String pointAmount;
|
||||
|
||||
@NameInMap("invoice_amount")
|
||||
@Validation(required = true)
|
||||
public String invoiceAmount;
|
||||
|
||||
@NameInMap("send_pay_date")
|
||||
@Validation(required = true)
|
||||
public String sendPayDate;
|
||||
|
||||
@NameInMap("receipt_amount")
|
||||
@Validation(required = true)
|
||||
public String receiptAmount;
|
||||
|
||||
@NameInMap("store_id")
|
||||
@Validation(required = true)
|
||||
public String storeId;
|
||||
|
||||
@NameInMap("terminal_id")
|
||||
@Validation(required = true)
|
||||
public String terminalId;
|
||||
|
||||
@NameInMap("fund_bill_list")
|
||||
@Validation(required = true)
|
||||
public java.util.List<TradeFundBill> fundBillList;
|
||||
|
||||
@NameInMap("store_name")
|
||||
@Validation(required = true)
|
||||
public String storeName;
|
||||
|
||||
@NameInMap("buyer_user_id")
|
||||
@Validation(required = true)
|
||||
public String buyerUserId;
|
||||
|
||||
@NameInMap("charge_amount")
|
||||
@Validation(required = true)
|
||||
public String chargeAmount;
|
||||
|
||||
@NameInMap("charge_flags")
|
||||
@Validation(required = true)
|
||||
public String chargeFlags;
|
||||
|
||||
@NameInMap("settlement_id")
|
||||
@Validation(required = true)
|
||||
public String settlementId;
|
||||
|
||||
@NameInMap("trade_settle_info")
|
||||
@Validation(required = true)
|
||||
public java.util.List<TradeSettleInfo> tradeSettleInfo;
|
||||
|
||||
@NameInMap("auth_trade_pay_mode")
|
||||
@Validation(required = true)
|
||||
public String authTradePayMode;
|
||||
|
||||
@NameInMap("buyer_user_type")
|
||||
@Validation(required = true)
|
||||
public String buyerUserType;
|
||||
|
||||
@NameInMap("mdiscount_amount")
|
||||
@Validation(required = true)
|
||||
public String mdiscountAmount;
|
||||
|
||||
@NameInMap("discount_amount")
|
||||
@Validation(required = true)
|
||||
public String discountAmount;
|
||||
|
||||
@NameInMap("buyer_user_name")
|
||||
@Validation(required = true)
|
||||
public String buyerUserName;
|
||||
|
||||
@NameInMap("subject")
|
||||
@Validation(required = true)
|
||||
public String subject;
|
||||
|
||||
@NameInMap("body")
|
||||
@Validation(required = true)
|
||||
public String body;
|
||||
|
||||
@NameInMap("alipay_sub_merchant_id")
|
||||
@Validation(required = true)
|
||||
public String alipaySubMerchantId;
|
||||
|
||||
@NameInMap("ext_infos")
|
||||
@Validation(required = true)
|
||||
public String extInfos;
|
||||
|
||||
public static AlipayTradeQueryResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeQueryResponse self = new AlipayTradeQueryResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setBuyerLogonId(String buyerLogonId) {
|
||||
this.buyerLogonId = buyerLogonId;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerLogonId() {
|
||||
return this.buyerLogonId;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setTradeStatus(String tradeStatus) {
|
||||
this.tradeStatus = tradeStatus;
|
||||
return this;
|
||||
}
|
||||
public String getTradeStatus() {
|
||||
return this.tradeStatus;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setTotalAmount(String totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
return this;
|
||||
}
|
||||
public String getTotalAmount() {
|
||||
return this.totalAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setTransCurrency(String transCurrency) {
|
||||
this.transCurrency = transCurrency;
|
||||
return this;
|
||||
}
|
||||
public String getTransCurrency() {
|
||||
return this.transCurrency;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSettleCurrency(String settleCurrency) {
|
||||
this.settleCurrency = settleCurrency;
|
||||
return this;
|
||||
}
|
||||
public String getSettleCurrency() {
|
||||
return this.settleCurrency;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSettleAmount(String settleAmount) {
|
||||
this.settleAmount = settleAmount;
|
||||
return this;
|
||||
}
|
||||
public String getSettleAmount() {
|
||||
return this.settleAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setPayCurrency(String payCurrency) {
|
||||
this.payCurrency = payCurrency;
|
||||
return this;
|
||||
}
|
||||
public String getPayCurrency() {
|
||||
return this.payCurrency;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setPayAmount(String payAmount) {
|
||||
this.payAmount = payAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPayAmount() {
|
||||
return this.payAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSettleTransRate(String settleTransRate) {
|
||||
this.settleTransRate = settleTransRate;
|
||||
return this;
|
||||
}
|
||||
public String getSettleTransRate() {
|
||||
return this.settleTransRate;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setTransPayRate(String transPayRate) {
|
||||
this.transPayRate = transPayRate;
|
||||
return this;
|
||||
}
|
||||
public String getTransPayRate() {
|
||||
return this.transPayRate;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setBuyerPayAmount(String buyerPayAmount) {
|
||||
this.buyerPayAmount = buyerPayAmount;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerPayAmount() {
|
||||
return this.buyerPayAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setPointAmount(String pointAmount) {
|
||||
this.pointAmount = pointAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPointAmount() {
|
||||
return this.pointAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setInvoiceAmount(String invoiceAmount) {
|
||||
this.invoiceAmount = invoiceAmount;
|
||||
return this;
|
||||
}
|
||||
public String getInvoiceAmount() {
|
||||
return this.invoiceAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSendPayDate(String sendPayDate) {
|
||||
this.sendPayDate = sendPayDate;
|
||||
return this;
|
||||
}
|
||||
public String getSendPayDate() {
|
||||
return this.sendPayDate;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setReceiptAmount(String receiptAmount) {
|
||||
this.receiptAmount = receiptAmount;
|
||||
return this;
|
||||
}
|
||||
public String getReceiptAmount() {
|
||||
return this.receiptAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setStoreId(String storeId) {
|
||||
this.storeId = storeId;
|
||||
return this;
|
||||
}
|
||||
public String getStoreId() {
|
||||
return this.storeId;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setTerminalId(String terminalId) {
|
||||
this.terminalId = terminalId;
|
||||
return this;
|
||||
}
|
||||
public String getTerminalId() {
|
||||
return this.terminalId;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setFundBillList(java.util.List<TradeFundBill> fundBillList) {
|
||||
this.fundBillList = fundBillList;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<TradeFundBill> getFundBillList() {
|
||||
return this.fundBillList;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setStoreName(String storeName) {
|
||||
this.storeName = storeName;
|
||||
return this;
|
||||
}
|
||||
public String getStoreName() {
|
||||
return this.storeName;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setBuyerUserId(String buyerUserId) {
|
||||
this.buyerUserId = buyerUserId;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerUserId() {
|
||||
return this.buyerUserId;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setChargeAmount(String chargeAmount) {
|
||||
this.chargeAmount = chargeAmount;
|
||||
return this;
|
||||
}
|
||||
public String getChargeAmount() {
|
||||
return this.chargeAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setChargeFlags(String chargeFlags) {
|
||||
this.chargeFlags = chargeFlags;
|
||||
return this;
|
||||
}
|
||||
public String getChargeFlags() {
|
||||
return this.chargeFlags;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSettlementId(String settlementId) {
|
||||
this.settlementId = settlementId;
|
||||
return this;
|
||||
}
|
||||
public String getSettlementId() {
|
||||
return this.settlementId;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setTradeSettleInfo(java.util.List<TradeSettleInfo> tradeSettleInfo) {
|
||||
this.tradeSettleInfo = tradeSettleInfo;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<TradeSettleInfo> getTradeSettleInfo() {
|
||||
return this.tradeSettleInfo;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setAuthTradePayMode(String authTradePayMode) {
|
||||
this.authTradePayMode = authTradePayMode;
|
||||
return this;
|
||||
}
|
||||
public String getAuthTradePayMode() {
|
||||
return this.authTradePayMode;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setBuyerUserType(String buyerUserType) {
|
||||
this.buyerUserType = buyerUserType;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerUserType() {
|
||||
return this.buyerUserType;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setMdiscountAmount(String mdiscountAmount) {
|
||||
this.mdiscountAmount = mdiscountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getMdiscountAmount() {
|
||||
return this.mdiscountAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setDiscountAmount(String discountAmount) {
|
||||
this.discountAmount = discountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getDiscountAmount() {
|
||||
return this.discountAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setBuyerUserName(String buyerUserName) {
|
||||
this.buyerUserName = buyerUserName;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerUserName() {
|
||||
return this.buyerUserName;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
return this;
|
||||
}
|
||||
public String getSubject() {
|
||||
return this.subject;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setBody(String body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setAlipaySubMerchantId(String alipaySubMerchantId) {
|
||||
this.alipaySubMerchantId = alipaySubMerchantId;
|
||||
return this;
|
||||
}
|
||||
public String getAlipaySubMerchantId() {
|
||||
return this.alipaySubMerchantId;
|
||||
}
|
||||
|
||||
public AlipayTradeQueryResponse setExtInfos(String extInfos) {
|
||||
this.extInfos = extInfos;
|
||||
return this;
|
||||
}
|
||||
public String getExtInfos() {
|
||||
return this.extInfos;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeRefundResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("buyer_logon_id")
|
||||
@Validation(required = true)
|
||||
public String buyerLogonId;
|
||||
|
||||
@NameInMap("fund_change")
|
||||
@Validation(required = true)
|
||||
public String fundChange;
|
||||
|
||||
@NameInMap("refund_fee")
|
||||
@Validation(required = true)
|
||||
public String refundFee;
|
||||
|
||||
@NameInMap("refund_currency")
|
||||
@Validation(required = true)
|
||||
public String refundCurrency;
|
||||
|
||||
@NameInMap("gmt_refund_pay")
|
||||
@Validation(required = true)
|
||||
public String gmtRefundPay;
|
||||
|
||||
@NameInMap("refund_detail_item_list")
|
||||
@Validation(required = true)
|
||||
public java.util.List<TradeFundBill> refundDetailItemList;
|
||||
|
||||
@NameInMap("store_name")
|
||||
@Validation(required = true)
|
||||
public String storeName;
|
||||
|
||||
@NameInMap("buyer_user_id")
|
||||
@Validation(required = true)
|
||||
public String buyerUserId;
|
||||
|
||||
@NameInMap("refund_preset_paytool_list")
|
||||
@Validation(required = true)
|
||||
public java.util.List<PresetPayToolInfo> refundPresetPaytoolList;
|
||||
|
||||
@NameInMap("refund_settlement_id")
|
||||
@Validation(required = true)
|
||||
public String refundSettlementId;
|
||||
|
||||
@NameInMap("present_refund_buyer_amount")
|
||||
@Validation(required = true)
|
||||
public String presentRefundBuyerAmount;
|
||||
|
||||
@NameInMap("present_refund_discount_amount")
|
||||
@Validation(required = true)
|
||||
public String presentRefundDiscountAmount;
|
||||
|
||||
@NameInMap("present_refund_mdiscount_amount")
|
||||
@Validation(required = true)
|
||||
public String presentRefundMdiscountAmount;
|
||||
|
||||
public static AlipayTradeRefundResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeRefundResponse self = new AlipayTradeRefundResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setBuyerLogonId(String buyerLogonId) {
|
||||
this.buyerLogonId = buyerLogonId;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerLogonId() {
|
||||
return this.buyerLogonId;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setFundChange(String fundChange) {
|
||||
this.fundChange = fundChange;
|
||||
return this;
|
||||
}
|
||||
public String getFundChange() {
|
||||
return this.fundChange;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setRefundFee(String refundFee) {
|
||||
this.refundFee = refundFee;
|
||||
return this;
|
||||
}
|
||||
public String getRefundFee() {
|
||||
return this.refundFee;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setRefundCurrency(String refundCurrency) {
|
||||
this.refundCurrency = refundCurrency;
|
||||
return this;
|
||||
}
|
||||
public String getRefundCurrency() {
|
||||
return this.refundCurrency;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setGmtRefundPay(String gmtRefundPay) {
|
||||
this.gmtRefundPay = gmtRefundPay;
|
||||
return this;
|
||||
}
|
||||
public String getGmtRefundPay() {
|
||||
return this.gmtRefundPay;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setRefundDetailItemList(java.util.List<TradeFundBill> refundDetailItemList) {
|
||||
this.refundDetailItemList = refundDetailItemList;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<TradeFundBill> getRefundDetailItemList() {
|
||||
return this.refundDetailItemList;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setStoreName(String storeName) {
|
||||
this.storeName = storeName;
|
||||
return this;
|
||||
}
|
||||
public String getStoreName() {
|
||||
return this.storeName;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setBuyerUserId(String buyerUserId) {
|
||||
this.buyerUserId = buyerUserId;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerUserId() {
|
||||
return this.buyerUserId;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setRefundPresetPaytoolList(java.util.List<PresetPayToolInfo> refundPresetPaytoolList) {
|
||||
this.refundPresetPaytoolList = refundPresetPaytoolList;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<PresetPayToolInfo> getRefundPresetPaytoolList() {
|
||||
return this.refundPresetPaytoolList;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setRefundSettlementId(String refundSettlementId) {
|
||||
this.refundSettlementId = refundSettlementId;
|
||||
return this;
|
||||
}
|
||||
public String getRefundSettlementId() {
|
||||
return this.refundSettlementId;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setPresentRefundBuyerAmount(String presentRefundBuyerAmount) {
|
||||
this.presentRefundBuyerAmount = presentRefundBuyerAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPresentRefundBuyerAmount() {
|
||||
return this.presentRefundBuyerAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setPresentRefundDiscountAmount(String presentRefundDiscountAmount) {
|
||||
this.presentRefundDiscountAmount = presentRefundDiscountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPresentRefundDiscountAmount() {
|
||||
return this.presentRefundDiscountAmount;
|
||||
}
|
||||
|
||||
public AlipayTradeRefundResponse setPresentRefundMdiscountAmount(String presentRefundMdiscountAmount) {
|
||||
this.presentRefundMdiscountAmount = presentRefundMdiscountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPresentRefundMdiscountAmount() {
|
||||
return this.presentRefundMdiscountAmount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class PresetPayToolInfo extends TeaModel {
|
||||
@NameInMap("amount")
|
||||
@Validation(required = true)
|
||||
public java.util.List<String> amount;
|
||||
|
||||
@NameInMap("assert_type_code")
|
||||
@Validation(required = true)
|
||||
public String assertTypeCode;
|
||||
|
||||
public static PresetPayToolInfo build(java.util.Map<String, ?> map) throws Exception {
|
||||
PresetPayToolInfo self = new PresetPayToolInfo();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public PresetPayToolInfo setAmount(java.util.List<String> amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<String> getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public PresetPayToolInfo setAssertTypeCode(String assertTypeCode) {
|
||||
this.assertTypeCode = assertTypeCode;
|
||||
return this;
|
||||
}
|
||||
public String getAssertTypeCode() {
|
||||
return this.assertTypeCode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class RefundRoyaltyResult extends TeaModel {
|
||||
@NameInMap("refund_amount")
|
||||
@Validation(required = true)
|
||||
public String refundAmount;
|
||||
|
||||
@NameInMap("royalty_type")
|
||||
@Validation(required = true)
|
||||
public String royaltyType;
|
||||
|
||||
@NameInMap("result_code")
|
||||
@Validation(required = true)
|
||||
public String resultCode;
|
||||
|
||||
@NameInMap("trans_out")
|
||||
@Validation(required = true)
|
||||
public String transOut;
|
||||
|
||||
@NameInMap("trans_out_email")
|
||||
@Validation(required = true)
|
||||
public String transOutEmail;
|
||||
|
||||
@NameInMap("trans_in")
|
||||
@Validation(required = true)
|
||||
public String transIn;
|
||||
|
||||
@NameInMap("trans_in_email")
|
||||
@Validation(required = true)
|
||||
public String transInEmail;
|
||||
|
||||
public static RefundRoyaltyResult build(java.util.Map<String, ?> map) throws Exception {
|
||||
RefundRoyaltyResult self = new RefundRoyaltyResult();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public RefundRoyaltyResult setRefundAmount(String refundAmount) {
|
||||
this.refundAmount = refundAmount;
|
||||
return this;
|
||||
}
|
||||
public String getRefundAmount() {
|
||||
return this.refundAmount;
|
||||
}
|
||||
|
||||
public RefundRoyaltyResult setRoyaltyType(String royaltyType) {
|
||||
this.royaltyType = royaltyType;
|
||||
return this;
|
||||
}
|
||||
public String getRoyaltyType() {
|
||||
return this.royaltyType;
|
||||
}
|
||||
|
||||
public RefundRoyaltyResult setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
return this;
|
||||
}
|
||||
public String getResultCode() {
|
||||
return this.resultCode;
|
||||
}
|
||||
|
||||
public RefundRoyaltyResult setTransOut(String transOut) {
|
||||
this.transOut = transOut;
|
||||
return this;
|
||||
}
|
||||
public String getTransOut() {
|
||||
return this.transOut;
|
||||
}
|
||||
|
||||
public RefundRoyaltyResult setTransOutEmail(String transOutEmail) {
|
||||
this.transOutEmail = transOutEmail;
|
||||
return this;
|
||||
}
|
||||
public String getTransOutEmail() {
|
||||
return this.transOutEmail;
|
||||
}
|
||||
|
||||
public RefundRoyaltyResult setTransIn(String transIn) {
|
||||
this.transIn = transIn;
|
||||
return this;
|
||||
}
|
||||
public String getTransIn() {
|
||||
return this.transIn;
|
||||
}
|
||||
|
||||
public RefundRoyaltyResult setTransInEmail(String transInEmail) {
|
||||
this.transInEmail = transInEmail;
|
||||
return this;
|
||||
}
|
||||
public String getTransInEmail() {
|
||||
return this.transInEmail;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class TradeFundBill extends TeaModel {
|
||||
@NameInMap("fund_channel")
|
||||
@Validation(required = true)
|
||||
public String fundChannel;
|
||||
|
||||
@NameInMap("bank_code")
|
||||
@Validation(required = true)
|
||||
public String bankCode;
|
||||
|
||||
@NameInMap("amount")
|
||||
@Validation(required = true)
|
||||
public String amount;
|
||||
|
||||
@NameInMap("real_amount")
|
||||
@Validation(required = true)
|
||||
public String realAmount;
|
||||
|
||||
@NameInMap("fund_type")
|
||||
@Validation(required = true)
|
||||
public String fundType;
|
||||
|
||||
public static TradeFundBill build(java.util.Map<String, ?> map) throws Exception {
|
||||
TradeFundBill self = new TradeFundBill();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public TradeFundBill setFundChannel(String fundChannel) {
|
||||
this.fundChannel = fundChannel;
|
||||
return this;
|
||||
}
|
||||
public String getFundChannel() {
|
||||
return this.fundChannel;
|
||||
}
|
||||
|
||||
public TradeFundBill setBankCode(String bankCode) {
|
||||
this.bankCode = bankCode;
|
||||
return this;
|
||||
}
|
||||
public String getBankCode() {
|
||||
return this.bankCode;
|
||||
}
|
||||
|
||||
public TradeFundBill setAmount(String amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
public String getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public TradeFundBill setRealAmount(String realAmount) {
|
||||
this.realAmount = realAmount;
|
||||
return this;
|
||||
}
|
||||
public String getRealAmount() {
|
||||
return this.realAmount;
|
||||
}
|
||||
|
||||
public TradeFundBill setFundType(String fundType) {
|
||||
this.fundType = fundType;
|
||||
return this;
|
||||
}
|
||||
public String getFundType() {
|
||||
return this.fundType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class TradeSettleDetail extends TeaModel {
|
||||
@NameInMap("operation_type")
|
||||
@Validation(required = true)
|
||||
public String operationType;
|
||||
|
||||
@NameInMap("operation_serial_no")
|
||||
@Validation(required = true)
|
||||
public String operationSerial_no;
|
||||
|
||||
@NameInMap("operation_dt")
|
||||
@Validation(required = true)
|
||||
public String operationDt;
|
||||
|
||||
@NameInMap("trans_out")
|
||||
@Validation(required = true)
|
||||
public String transOut;
|
||||
|
||||
@NameInMap("trans_in")
|
||||
@Validation(required = true)
|
||||
public String transIn;
|
||||
|
||||
@NameInMap("amount")
|
||||
@Validation(required = true)
|
||||
public String amount;
|
||||
|
||||
public static TradeSettleDetail build(java.util.Map<String, ?> map) throws Exception {
|
||||
TradeSettleDetail self = new TradeSettleDetail();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public TradeSettleDetail setOperationType(String operationType) {
|
||||
this.operationType = operationType;
|
||||
return this;
|
||||
}
|
||||
public String getOperationType() {
|
||||
return this.operationType;
|
||||
}
|
||||
|
||||
public TradeSettleDetail setOperationSerial_no(String operationSerial_no) {
|
||||
this.operationSerial_no = operationSerial_no;
|
||||
return this;
|
||||
}
|
||||
public String getOperationSerial_no() {
|
||||
return this.operationSerial_no;
|
||||
}
|
||||
|
||||
public TradeSettleDetail setOperationDt(String operationDt) {
|
||||
this.operationDt = operationDt;
|
||||
return this;
|
||||
}
|
||||
public String getOperationDt() {
|
||||
return this.operationDt;
|
||||
}
|
||||
|
||||
public TradeSettleDetail setTransOut(String transOut) {
|
||||
this.transOut = transOut;
|
||||
return this;
|
||||
}
|
||||
public String getTransOut() {
|
||||
return this.transOut;
|
||||
}
|
||||
|
||||
public TradeSettleDetail setTransIn(String transIn) {
|
||||
this.transIn = transIn;
|
||||
return this;
|
||||
}
|
||||
public String getTransIn() {
|
||||
return this.transIn;
|
||||
}
|
||||
|
||||
public TradeSettleDetail setAmount(String amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
public String getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.common.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class TradeSettleInfo extends TeaModel {
|
||||
@NameInMap("trade_settle_detail_list")
|
||||
@Validation(required = true)
|
||||
public java.util.List<TradeSettleDetail> tradeSettleDetailList;
|
||||
|
||||
public static TradeSettleInfo build(java.util.Map<String, ?> map) throws Exception {
|
||||
TradeSettleInfo self = new TradeSettleInfo();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public TradeSettleInfo setTradeSettleDetailList(java.util.List<TradeSettleDetail> tradeSettleDetailList) {
|
||||
this.tradeSettleDetailList = tradeSettleDetailList;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<TradeSettleDetail> getTradeSettleDetailList() {
|
||||
return this.tradeSettleDetailList;
|
||||
}
|
||||
|
||||
}
|
||||
265
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/facetoface/Client.java
vendored
Normal file
265
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/facetoface/Client.java
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.facetoface;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.payment.facetoface.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse pay(String subject, String outTradeNo, String totalAmount, String authCode) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.pay"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("subject", subject),
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("total_amount", totalAmount),
|
||||
new TeaPair("auth_code", authCode),
|
||||
new TeaPair("scene", "bar_code")
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.pay");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradePayResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradePayResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse preCreate(String subject, String outTradeNo, String totalAmount) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.precreate"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("subject", subject),
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("total_amount", totalAmount)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.precreate");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradePrecreateResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradePrecreateResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,457 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.facetoface.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradePayResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("buyer_logon_id")
|
||||
@Validation(required = true)
|
||||
public String buyerLogonId;
|
||||
|
||||
@NameInMap("settle_amount")
|
||||
@Validation(required = true)
|
||||
public String settleAmount;
|
||||
|
||||
@NameInMap("pay_currency")
|
||||
@Validation(required = true)
|
||||
public String payCurrency;
|
||||
|
||||
@NameInMap("pay_amount")
|
||||
@Validation(required = true)
|
||||
public String payAmount;
|
||||
|
||||
@NameInMap("settle_trans_rate")
|
||||
@Validation(required = true)
|
||||
public String settleTransRate;
|
||||
|
||||
@NameInMap("trans_pay_rate")
|
||||
@Validation(required = true)
|
||||
public String transPayRate;
|
||||
|
||||
@NameInMap("total_amount")
|
||||
@Validation(required = true)
|
||||
public String totalAmount;
|
||||
|
||||
@NameInMap("trans_currency")
|
||||
@Validation(required = true)
|
||||
public String transCurrency;
|
||||
|
||||
@NameInMap("settle_currency")
|
||||
@Validation(required = true)
|
||||
public String settleCurrency;
|
||||
|
||||
@NameInMap("receipt_amount")
|
||||
@Validation(required = true)
|
||||
public String receiptAmount;
|
||||
|
||||
@NameInMap("buyer_pay_amount")
|
||||
@Validation(required = true)
|
||||
public String buyerPayAmount;
|
||||
|
||||
@NameInMap("point_amount")
|
||||
@Validation(required = true)
|
||||
public String pointAmount;
|
||||
|
||||
@NameInMap("invoice_amount")
|
||||
@Validation(required = true)
|
||||
public String invoiceAmount;
|
||||
|
||||
@NameInMap("gmt_payment")
|
||||
@Validation(required = true)
|
||||
public String gmtPayment;
|
||||
|
||||
@NameInMap("fund_bill_list")
|
||||
@Validation(required = true)
|
||||
public java.util.List<TradeFundBill> fundBillList;
|
||||
|
||||
@NameInMap("card_balance")
|
||||
@Validation(required = true)
|
||||
public String cardBalance;
|
||||
|
||||
@NameInMap("store_name")
|
||||
@Validation(required = true)
|
||||
public String storeName;
|
||||
|
||||
@NameInMap("buyer_user_id")
|
||||
@Validation(required = true)
|
||||
public String buyerUserId;
|
||||
|
||||
@NameInMap("discount_goods_detail")
|
||||
@Validation(required = true)
|
||||
public String discountGoodsDetail;
|
||||
|
||||
@NameInMap("voucher_detail_list")
|
||||
@Validation(required = true)
|
||||
public java.util.List<VoucherDetail> voucherDetailList;
|
||||
|
||||
@NameInMap("advance_amount")
|
||||
@Validation(required = true)
|
||||
public String advanceAmount;
|
||||
|
||||
@NameInMap("auth_trade_pay_mode")
|
||||
@Validation(required = true)
|
||||
public String authTradePayMode;
|
||||
|
||||
@NameInMap("charge_amount")
|
||||
@Validation(required = true)
|
||||
public String chargeAmount;
|
||||
|
||||
@NameInMap("charge_flags")
|
||||
@Validation(required = true)
|
||||
public String chargeFlags;
|
||||
|
||||
@NameInMap("settlement_id")
|
||||
@Validation(required = true)
|
||||
public String settlementId;
|
||||
|
||||
@NameInMap("business_params")
|
||||
@Validation(required = true)
|
||||
public String businessParams;
|
||||
|
||||
@NameInMap("buyer_user_type")
|
||||
@Validation(required = true)
|
||||
public String buyerUserType;
|
||||
|
||||
@NameInMap("mdiscount_amount")
|
||||
@Validation(required = true)
|
||||
public String mdiscountAmount;
|
||||
|
||||
@NameInMap("discount_amount")
|
||||
@Validation(required = true)
|
||||
public String discountAmount;
|
||||
|
||||
@NameInMap("buyer_user_name")
|
||||
@Validation(required = true)
|
||||
public String buyerUserName;
|
||||
|
||||
public static AlipayTradePayResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradePayResponse self = new AlipayTradePayResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setBuyerLogonId(String buyerLogonId) {
|
||||
this.buyerLogonId = buyerLogonId;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerLogonId() {
|
||||
return this.buyerLogonId;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setSettleAmount(String settleAmount) {
|
||||
this.settleAmount = settleAmount;
|
||||
return this;
|
||||
}
|
||||
public String getSettleAmount() {
|
||||
return this.settleAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setPayCurrency(String payCurrency) {
|
||||
this.payCurrency = payCurrency;
|
||||
return this;
|
||||
}
|
||||
public String getPayCurrency() {
|
||||
return this.payCurrency;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setPayAmount(String payAmount) {
|
||||
this.payAmount = payAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPayAmount() {
|
||||
return this.payAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setSettleTransRate(String settleTransRate) {
|
||||
this.settleTransRate = settleTransRate;
|
||||
return this;
|
||||
}
|
||||
public String getSettleTransRate() {
|
||||
return this.settleTransRate;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setTransPayRate(String transPayRate) {
|
||||
this.transPayRate = transPayRate;
|
||||
return this;
|
||||
}
|
||||
public String getTransPayRate() {
|
||||
return this.transPayRate;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setTotalAmount(String totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
return this;
|
||||
}
|
||||
public String getTotalAmount() {
|
||||
return this.totalAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setTransCurrency(String transCurrency) {
|
||||
this.transCurrency = transCurrency;
|
||||
return this;
|
||||
}
|
||||
public String getTransCurrency() {
|
||||
return this.transCurrency;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setSettleCurrency(String settleCurrency) {
|
||||
this.settleCurrency = settleCurrency;
|
||||
return this;
|
||||
}
|
||||
public String getSettleCurrency() {
|
||||
return this.settleCurrency;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setReceiptAmount(String receiptAmount) {
|
||||
this.receiptAmount = receiptAmount;
|
||||
return this;
|
||||
}
|
||||
public String getReceiptAmount() {
|
||||
return this.receiptAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setBuyerPayAmount(String buyerPayAmount) {
|
||||
this.buyerPayAmount = buyerPayAmount;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerPayAmount() {
|
||||
return this.buyerPayAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setPointAmount(String pointAmount) {
|
||||
this.pointAmount = pointAmount;
|
||||
return this;
|
||||
}
|
||||
public String getPointAmount() {
|
||||
return this.pointAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setInvoiceAmount(String invoiceAmount) {
|
||||
this.invoiceAmount = invoiceAmount;
|
||||
return this;
|
||||
}
|
||||
public String getInvoiceAmount() {
|
||||
return this.invoiceAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setGmtPayment(String gmtPayment) {
|
||||
this.gmtPayment = gmtPayment;
|
||||
return this;
|
||||
}
|
||||
public String getGmtPayment() {
|
||||
return this.gmtPayment;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setFundBillList(java.util.List<TradeFundBill> fundBillList) {
|
||||
this.fundBillList = fundBillList;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<TradeFundBill> getFundBillList() {
|
||||
return this.fundBillList;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setCardBalance(String cardBalance) {
|
||||
this.cardBalance = cardBalance;
|
||||
return this;
|
||||
}
|
||||
public String getCardBalance() {
|
||||
return this.cardBalance;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setStoreName(String storeName) {
|
||||
this.storeName = storeName;
|
||||
return this;
|
||||
}
|
||||
public String getStoreName() {
|
||||
return this.storeName;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setBuyerUserId(String buyerUserId) {
|
||||
this.buyerUserId = buyerUserId;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerUserId() {
|
||||
return this.buyerUserId;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setDiscountGoodsDetail(String discountGoodsDetail) {
|
||||
this.discountGoodsDetail = discountGoodsDetail;
|
||||
return this;
|
||||
}
|
||||
public String getDiscountGoodsDetail() {
|
||||
return this.discountGoodsDetail;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setVoucherDetailList(java.util.List<VoucherDetail> voucherDetailList) {
|
||||
this.voucherDetailList = voucherDetailList;
|
||||
return this;
|
||||
}
|
||||
public java.util.List<VoucherDetail> getVoucherDetailList() {
|
||||
return this.voucherDetailList;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setAdvanceAmount(String advanceAmount) {
|
||||
this.advanceAmount = advanceAmount;
|
||||
return this;
|
||||
}
|
||||
public String getAdvanceAmount() {
|
||||
return this.advanceAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setAuthTradePayMode(String authTradePayMode) {
|
||||
this.authTradePayMode = authTradePayMode;
|
||||
return this;
|
||||
}
|
||||
public String getAuthTradePayMode() {
|
||||
return this.authTradePayMode;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setChargeAmount(String chargeAmount) {
|
||||
this.chargeAmount = chargeAmount;
|
||||
return this;
|
||||
}
|
||||
public String getChargeAmount() {
|
||||
return this.chargeAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setChargeFlags(String chargeFlags) {
|
||||
this.chargeFlags = chargeFlags;
|
||||
return this;
|
||||
}
|
||||
public String getChargeFlags() {
|
||||
return this.chargeFlags;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setSettlementId(String settlementId) {
|
||||
this.settlementId = settlementId;
|
||||
return this;
|
||||
}
|
||||
public String getSettlementId() {
|
||||
return this.settlementId;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setBusinessParams(String businessParams) {
|
||||
this.businessParams = businessParams;
|
||||
return this;
|
||||
}
|
||||
public String getBusinessParams() {
|
||||
return this.businessParams;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setBuyerUserType(String buyerUserType) {
|
||||
this.buyerUserType = buyerUserType;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerUserType() {
|
||||
return this.buyerUserType;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setMdiscountAmount(String mdiscountAmount) {
|
||||
this.mdiscountAmount = mdiscountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getMdiscountAmount() {
|
||||
return this.mdiscountAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setDiscountAmount(String discountAmount) {
|
||||
this.discountAmount = discountAmount;
|
||||
return this;
|
||||
}
|
||||
public String getDiscountAmount() {
|
||||
return this.discountAmount;
|
||||
}
|
||||
|
||||
public AlipayTradePayResponse setBuyerUserName(String buyerUserName) {
|
||||
this.buyerUserName = buyerUserName;
|
||||
return this;
|
||||
}
|
||||
public String getBuyerUserName() {
|
||||
return this.buyerUserName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.facetoface.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradePrecreateResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("qr_code")
|
||||
@Validation(required = true)
|
||||
public String qrCode;
|
||||
|
||||
public static AlipayTradePrecreateResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradePrecreateResponse self = new AlipayTradePrecreateResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradePrecreateResponse setQrCode(String qrCode) {
|
||||
this.qrCode = qrCode;
|
||||
return this;
|
||||
}
|
||||
public String getQrCode() {
|
||||
return this.qrCode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.facetoface.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class TradeFundBill extends TeaModel {
|
||||
@NameInMap("fund_channel")
|
||||
@Validation(required = true)
|
||||
public String fundChannel;
|
||||
|
||||
@NameInMap("bank_code")
|
||||
@Validation(required = true)
|
||||
public String bankCode;
|
||||
|
||||
@NameInMap("amount")
|
||||
@Validation(required = true)
|
||||
public String amount;
|
||||
|
||||
@NameInMap("real_amount")
|
||||
@Validation(required = true)
|
||||
public String realAmount;
|
||||
|
||||
public static TradeFundBill build(java.util.Map<String, ?> map) throws Exception {
|
||||
TradeFundBill self = new TradeFundBill();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public TradeFundBill setFundChannel(String fundChannel) {
|
||||
this.fundChannel = fundChannel;
|
||||
return this;
|
||||
}
|
||||
public String getFundChannel() {
|
||||
return this.fundChannel;
|
||||
}
|
||||
|
||||
public TradeFundBill setBankCode(String bankCode) {
|
||||
this.bankCode = bankCode;
|
||||
return this;
|
||||
}
|
||||
public String getBankCode() {
|
||||
return this.bankCode;
|
||||
}
|
||||
|
||||
public TradeFundBill setAmount(String amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
public String getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public TradeFundBill setRealAmount(String realAmount) {
|
||||
this.realAmount = realAmount;
|
||||
return this;
|
||||
}
|
||||
public String getRealAmount() {
|
||||
return this.realAmount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.facetoface.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class VoucherDetail extends TeaModel {
|
||||
@NameInMap("id")
|
||||
@Validation(required = true)
|
||||
public String id;
|
||||
|
||||
@NameInMap("name")
|
||||
@Validation(required = true)
|
||||
public String name;
|
||||
|
||||
@NameInMap("type")
|
||||
@Validation(required = true)
|
||||
public String type;
|
||||
|
||||
@NameInMap("amount")
|
||||
@Validation(required = true)
|
||||
public String amount;
|
||||
|
||||
@NameInMap("merchant_contribute")
|
||||
@Validation(required = true)
|
||||
public String merchantContribute;
|
||||
|
||||
@NameInMap("other_contribute")
|
||||
@Validation(required = true)
|
||||
public String otherContribute;
|
||||
|
||||
@NameInMap("memo")
|
||||
@Validation(required = true)
|
||||
public String memo;
|
||||
|
||||
@NameInMap("template_id")
|
||||
@Validation(required = true)
|
||||
public String templateId;
|
||||
|
||||
@NameInMap("purchase_buyer_contribute")
|
||||
@Validation(required = true)
|
||||
public String purchaseBuyerContribute;
|
||||
|
||||
@NameInMap("purchase_merchant_contribute")
|
||||
@Validation(required = true)
|
||||
public String purchaseMerchantContribute;
|
||||
|
||||
@NameInMap("purchase_ant_contribute")
|
||||
@Validation(required = true)
|
||||
public String purchaseAntContribute;
|
||||
|
||||
public static VoucherDetail build(java.util.Map<String, ?> map) throws Exception {
|
||||
VoucherDetail self = new VoucherDetail();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public VoucherDetail setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public VoucherDetail setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public VoucherDetail setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public VoucherDetail setAmount(String amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
public String getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public VoucherDetail setMerchantContribute(String merchantContribute) {
|
||||
this.merchantContribute = merchantContribute;
|
||||
return this;
|
||||
}
|
||||
public String getMerchantContribute() {
|
||||
return this.merchantContribute;
|
||||
}
|
||||
|
||||
public VoucherDetail setOtherContribute(String otherContribute) {
|
||||
this.otherContribute = otherContribute;
|
||||
return this;
|
||||
}
|
||||
public String getOtherContribute() {
|
||||
return this.otherContribute;
|
||||
}
|
||||
|
||||
public VoucherDetail setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
public String getMemo() {
|
||||
return this.memo;
|
||||
}
|
||||
|
||||
public VoucherDetail setTemplateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
return this;
|
||||
}
|
||||
public String getTemplateId() {
|
||||
return this.templateId;
|
||||
}
|
||||
|
||||
public VoucherDetail setPurchaseBuyerContribute(String purchaseBuyerContribute) {
|
||||
this.purchaseBuyerContribute = purchaseBuyerContribute;
|
||||
return this;
|
||||
}
|
||||
public String getPurchaseBuyerContribute() {
|
||||
return this.purchaseBuyerContribute;
|
||||
}
|
||||
|
||||
public VoucherDetail setPurchaseMerchantContribute(String purchaseMerchantContribute) {
|
||||
this.purchaseMerchantContribute = purchaseMerchantContribute;
|
||||
return this;
|
||||
}
|
||||
public String getPurchaseMerchantContribute() {
|
||||
return this.purchaseMerchantContribute;
|
||||
}
|
||||
|
||||
public VoucherDetail setPurchaseAntContribute(String purchaseAntContribute) {
|
||||
this.purchaseAntContribute = purchaseAntContribute;
|
||||
return this;
|
||||
}
|
||||
public String getPurchaseAntContribute() {
|
||||
return this.purchaseAntContribute;
|
||||
}
|
||||
|
||||
}
|
||||
179
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/huabei/Client.java
vendored
Normal file
179
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/huabei/Client.java
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.huabei;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.payment.huabei.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse create(String subject, String outTradeNo, String totalAmount, String buyerId, HuabeiConfig extendParams) throws Exception {
|
||||
TeaModel.validateParams(extendParams, "extendParams");
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.create"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("subject", subject),
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("total_amount", totalAmount),
|
||||
new TeaPair("buyer_id", buyerId),
|
||||
new TeaPair("extend_params", extendParams)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.trade.create");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCreateResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipayTradeCreateResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.huabei.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeCreateResponse extends TeaModel {
|
||||
// 响应原始字符串
|
||||
@NameInMap("http_body")
|
||||
@Validation(required = true)
|
||||
public String httpBody;
|
||||
|
||||
@NameInMap("code")
|
||||
@Validation(required = true)
|
||||
public String code;
|
||||
|
||||
@NameInMap("msg")
|
||||
@Validation(required = true)
|
||||
public String msg;
|
||||
|
||||
@NameInMap("sub_code")
|
||||
@Validation(required = true)
|
||||
public String subCode;
|
||||
|
||||
@NameInMap("sub_msg")
|
||||
@Validation(required = true)
|
||||
public String subMsg;
|
||||
|
||||
@NameInMap("out_trade_no")
|
||||
@Validation(required = true)
|
||||
public String outTradeNo;
|
||||
|
||||
@NameInMap("trade_no")
|
||||
@Validation(required = true)
|
||||
public String tradeNo;
|
||||
|
||||
public static AlipayTradeCreateResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeCreateResponse self = new AlipayTradeCreateResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setHttpBody(String httpBody) {
|
||||
this.httpBody = httpBody;
|
||||
return this;
|
||||
}
|
||||
public String getHttpBody() {
|
||||
return this.httpBody;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setSubCode(String subCode) {
|
||||
this.subCode = subCode;
|
||||
return this;
|
||||
}
|
||||
public String getSubCode() {
|
||||
return this.subCode;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setSubMsg(String subMsg) {
|
||||
this.subMsg = subMsg;
|
||||
return this;
|
||||
}
|
||||
public String getSubMsg() {
|
||||
return this.subMsg;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getOutTradeNo() {
|
||||
return this.outTradeNo;
|
||||
}
|
||||
|
||||
public AlipayTradeCreateResponse setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
return this;
|
||||
}
|
||||
public String getTradeNo() {
|
||||
return this.tradeNo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.huabei.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class HuabeiConfig extends TeaModel {
|
||||
@NameInMap("hb_fq_num")
|
||||
@Validation(required = true)
|
||||
public String hbFqNum;
|
||||
|
||||
@NameInMap("hb_fq_seller_percent")
|
||||
@Validation(required = true)
|
||||
public String hbFqSellerPercent;
|
||||
|
||||
public static HuabeiConfig build(java.util.Map<String, ?> map) throws Exception {
|
||||
HuabeiConfig self = new HuabeiConfig();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public HuabeiConfig setHbFqNum(String hbFqNum) {
|
||||
this.hbFqNum = hbFqNum;
|
||||
return this;
|
||||
}
|
||||
public String getHbFqNum() {
|
||||
return this.hbFqNum;
|
||||
}
|
||||
|
||||
public HuabeiConfig setHbFqSellerPercent(String hbFqSellerPercent) {
|
||||
this.hbFqSellerPercent = hbFqSellerPercent;
|
||||
return this;
|
||||
}
|
||||
public String getHbFqSellerPercent() {
|
||||
return this.hbFqSellerPercent;
|
||||
}
|
||||
|
||||
}
|
||||
118
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/page/Client.java
vendored
Normal file
118
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/page/Client.java
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.page;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.payment.page.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
|
||||
public AlipayTradePagePayResponse pay(String subject, String outTradeNo, String totalAmount, String returnUrl) throws Exception {
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.page.pay"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("subject", subject),
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("total_amount", totalAmount),
|
||||
new TeaPair("product_code", "FAST_INSTANT_TRADE_PAY")
|
||||
);
|
||||
java.util.Map<String, String> textParams = TeaConverter.buildMap(
|
||||
new TeaPair("return_url", returnUrl)
|
||||
);
|
||||
String sign = _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey"));
|
||||
java.util.Map<String, String> response = TeaConverter.buildMap(
|
||||
new TeaPair("body", _kernel.generatePage("POST", systemParams, bizParams, textParams, sign))
|
||||
);
|
||||
return TeaModel.toModel(response, new AlipayTradePagePayResponse());
|
||||
}
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.page.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradePagePayResponse extends TeaModel {
|
||||
// 订单信息,Form表单形式
|
||||
@NameInMap("body")
|
||||
@Validation(required = true)
|
||||
public String body;
|
||||
|
||||
public static AlipayTradePagePayResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradePagePayResponse self = new AlipayTradePagePayResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradePagePayResponse setBody(String body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
}
|
||||
119
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/wap/Client.java
vendored
Normal file
119
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/payment/wap/Client.java
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.wap;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.payment.wap.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
|
||||
public AlipayTradeWapPayResponse pay(String subject, String outTradeNo, String totalAmount, String quitUrl, String returnUrl) throws Exception {
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.trade.wap.pay"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("subject", subject),
|
||||
new TeaPair("out_trade_no", outTradeNo),
|
||||
new TeaPair("total_amount", totalAmount),
|
||||
new TeaPair("quit_url", quitUrl),
|
||||
new TeaPair("product_code", "QUICK_WAP_WAY")
|
||||
);
|
||||
java.util.Map<String, String> textParams = TeaConverter.buildMap(
|
||||
new TeaPair("return_url", returnUrl)
|
||||
);
|
||||
String sign = _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey"));
|
||||
java.util.Map<String, String> response = TeaConverter.buildMap(
|
||||
new TeaPair("body", _kernel.generatePage("POST", systemParams, bizParams, textParams, sign))
|
||||
);
|
||||
return TeaModel.toModel(response, new AlipayTradeWapPayResponse());
|
||||
}
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.payment.wap.models;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
public class AlipayTradeWapPayResponse extends TeaModel {
|
||||
// 订单信息,Form表单形式
|
||||
@NameInMap("body")
|
||||
@Validation(required = true)
|
||||
public String body;
|
||||
|
||||
public static AlipayTradeWapPayResponse build(java.util.Map<String, ?> map) throws Exception {
|
||||
AlipayTradeWapPayResponse self = new AlipayTradeWapPayResponse();
|
||||
return TeaModel.build(map, self);
|
||||
}
|
||||
|
||||
public AlipayTradeWapPayResponse setBody(String body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
}
|
||||
174
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/security/textrisk/Client.java
vendored
Normal file
174
vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/security/textrisk/Client.java
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
package com.alipay.easysdk.security.textrisk;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
import com.alipay.easysdk.security.textrisk.models.*;
|
||||
|
||||
public class Client {
|
||||
|
||||
public com.alipay.easysdk.kernel.Client _kernel;
|
||||
public Client(com.alipay.easysdk.kernel.Client kernel) throws Exception {
|
||||
this._kernel = kernel;
|
||||
}
|
||||
|
||||
public AlipaySecurityRiskContentDetectResponse detect(String content) throws Exception {
|
||||
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
|
||||
new TeaPair("ignoreSSL", _kernel.getConfig("ignoreSSL")),
|
||||
new TeaPair("httpProxy", _kernel.getConfig("httpProxy")),
|
||||
new TeaPair("connectTimeout", 15000),
|
||||
new TeaPair("readTimeout", 15000),
|
||||
new TeaPair("retry", TeaConverter.buildMap(
|
||||
new TeaPair("maxAttempts", 0)
|
||||
))
|
||||
);
|
||||
|
||||
TeaRequest _lastRequest = null;
|
||||
long _now = System.currentTimeMillis();
|
||||
int _retryTimes = 0;
|
||||
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
|
||||
if (_retryTimes > 0) {
|
||||
int backoffTime = Tea.getBackoffTime(runtime_.get("backoff"), _retryTimes);
|
||||
if (backoffTime > 0) {
|
||||
Tea.sleep(backoffTime);
|
||||
}
|
||||
}
|
||||
_retryTimes = _retryTimes + 1;
|
||||
try {
|
||||
TeaRequest request_ = new TeaRequest();
|
||||
java.util.Map<String, String> systemParams = TeaConverter.buildMap(
|
||||
new TeaPair("method", "alipay.security.risk.content.detect"),
|
||||
new TeaPair("app_id", _kernel.getConfig("appId")),
|
||||
new TeaPair("timestamp", _kernel.getTimestamp()),
|
||||
new TeaPair("format", "json"),
|
||||
new TeaPair("version", "1.0"),
|
||||
new TeaPair("alipay_sdk", _kernel.getSdkVersion()),
|
||||
new TeaPair("charset", "UTF-8"),
|
||||
new TeaPair("sign_type", _kernel.getConfig("signType")),
|
||||
new TeaPair("app_cert_sn", _kernel.getMerchantCertSN()),
|
||||
new TeaPair("alipay_root_cert_sn", _kernel.getAlipayRootCertSN())
|
||||
);
|
||||
java.util.Map<String, Object> bizParams = TeaConverter.buildMap(
|
||||
new TeaPair("content", content)
|
||||
);
|
||||
java.util.Map<String, String> textParams = new java.util.HashMap<>();
|
||||
request_.protocol = _kernel.getConfig("protocol");
|
||||
request_.method = "POST";
|
||||
request_.pathname = "/gateway.do";
|
||||
request_.headers = TeaConverter.buildMap(
|
||||
new TeaPair("host", _kernel.getConfig("gatewayHost")),
|
||||
new TeaPair("content-type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||
);
|
||||
request_.query = _kernel.sortMap(TeaConverter.merge(String.class,
|
||||
TeaConverter.buildMap(
|
||||
new TeaPair("sign", _kernel.sign(systemParams, bizParams, textParams, _kernel.getConfig("merchantPrivateKey")))
|
||||
),
|
||||
systemParams,
|
||||
textParams
|
||||
));
|
||||
request_.body = Tea.toReadable(_kernel.toUrlEncodedRequestBody(bizParams));
|
||||
_lastRequest = request_;
|
||||
TeaResponse response_ = Tea.doAction(request_, runtime_);
|
||||
|
||||
java.util.Map<String, Object> respMap = _kernel.readAsJson(response_, "alipay.security.risk.content.detect");
|
||||
if (_kernel.isCertMode()) {
|
||||
if (_kernel.verify(respMap, _kernel.extractAlipayPublicKey(_kernel.getAlipayCertSN(respMap)))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipaySecurityRiskContentDetectResponse());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_kernel.verify(respMap, _kernel.getConfig("alipayPublicKey"))) {
|
||||
return TeaModel.toModel(_kernel.toRespModel(respMap), new AlipaySecurityRiskContentDetectResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new TeaException(TeaConverter.buildMap(
|
||||
new TeaPair("message", "验签失败,请检查支付宝公钥设置是否正确。")
|
||||
));
|
||||
} catch (Exception e) {
|
||||
if (Tea.isRetryable(e)) {
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TeaUnretryableException(_lastRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ISV代商户代用,指定appAuthToken
|
||||
*
|
||||
* @param appAuthToken 代调用token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client agent(String appAuthToken) {
|
||||
_kernel.injectTextParam("app_auth_token", appAuthToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权调用,指定authToken
|
||||
*
|
||||
* @param authToken 用户授权token
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client auth(String authToken) {
|
||||
_kernel.injectTextParam("auth_token", authToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
|
||||
*
|
||||
* @param url 异步通知回调地址,例如:https://www.test.com/callback
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client asyncNotify(String url) {
|
||||
_kernel.injectTextParam("notify_url", url);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
|
||||
*
|
||||
* @param testUrl 后端系统测试地址
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client route(String testUrl) {
|
||||
_kernel.injectTextParam("ws_service_url", testUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
*
|
||||
* @param key 业务请求参数名称(biz_content下的字段名,比如timeout_express)
|
||||
* @param value 业务请求参数的值,一个可以序列化成JSON的对象
|
||||
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
|
||||
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
|
||||
* 如果该字段是一个复杂类型,请使用嵌套的Map指定各下级字段的值
|
||||
* 如果该字段是一个数组,请使用List储存各个值
|
||||
* 对于更复杂的情况,也支持Map和List的各种组合嵌套,比如参数是值是个List,List中的每种类型是一个复杂对象
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client optional(String key, Object value) {
|
||||
_kernel.injectBizParam(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
|
||||
* optional方法的批量版本
|
||||
*
|
||||
* @param optionalArgs 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
|
||||
* @return 本客户端,便于链式调用
|
||||
*/
|
||||
public Client batchOptional(java.util.Map<String, Object> optionalArgs) {
|
||||
for (java.util.Map.Entry<String, Object> pair : optionalArgs.entrySet()) {
|
||||
_kernel.injectBizParam(pair.getKey(), pair.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user