🎨 优化代码

This commit is contained in:
Binary Wang
2020-05-19 22:01:12 +08:00
parent 40ab5dd402
commit 4929e4e03e
4 changed files with 50 additions and 42 deletions

View File

@@ -12,18 +12,11 @@
<artifactId>weixin-java-pay</artifactId> <artifactId>weixin-java-pay</artifactId>
<name>WxJava - PAY Java SDK</name> <name>WxJava - PAY Java SDK</name>
<description>微信支付 Java SDK</description> <description>微信支付 Java SDK</description>
<build>
<plugins> <properties>
<plugin> <maven.compiler.source>1.8</maven.compiler.source>
<groupId>org.apache.maven.plugins</groupId> <maven.compiler.target>1.8</maven.compiler.target>
<artifactId>maven-compiler-plugin</artifactId> </properties>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -1,8 +1,11 @@
package com.github.binarywang.wxpay.bean.payscore; package com.github.binarywang.wxpay.bean.payscore;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@@ -11,8 +14,11 @@ import java.util.List;
* @author doger.wang * @author doger.wang
* @date 2020/5/12 16:36 * @date 2020/5/12 16:36
*/ */
@NoArgsConstructor
@Data @Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxPayScoreRequest implements Serializable { public class WxPayScoreRequest implements Serializable {
private static final long serialVersionUID = 364764508076146082L; private static final long serialVersionUID = 364764508076146082L;

View File

@@ -144,11 +144,11 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
} }
private CloseableHttpClient createApiV3HttpClient() throws WxPayException { private CloseableHttpClient createApiV3HttpClient() throws WxPayException {
CloseableHttpClient apiv3HttpClient = this.getConfig().getApiV3HttpClient(); CloseableHttpClient apiV3HttpClient = this.getConfig().getApiV3HttpClient();
if (null == apiv3HttpClient) { if (null == apiV3HttpClient) {
return this.getConfig().initApiV3HttpClient(); return this.getConfig().initApiV3HttpClient();
} }
return apiv3HttpClient; return apiV3HttpClient;
} }
private StringEntity createEntry(String requestStr) { private StringEntity createEntry(String requestStr) {

View File

@@ -1,19 +1,28 @@
package com.github.binarywang.wxpay.service.impl; package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.payscore.WxPayScoreRequest;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.testbase.ApiTestModule;
import com.google.inject.Inject;
import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.testng.Assert.*;
/** /**
* 测试代码,待补充完善. * 测试代码,待补充完善.
* *
* @author <a href="https://github.com/binarywang">Binary Wang</a> * @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2020-05-19 * @date 2020-05-19
*/ */
@Test
@Guice(modules = ApiTestModule.class)
public class PayScoreServiceImplTest { public class PayScoreServiceImplTest {
@Inject
private WxPayService payService;
@Test @Test
public void testCreateServiceOrder() { public void testCreateServiceOrder() throws WxPayException {
this.payService.getPayScoreService().createServiceOrder(WxPayScoreRequest.builder().build());
} }
@Test @Test