Skip to content

Commit dcd9309

Browse files
committed
update: cr
1 parent 096fc49 commit dcd9309

File tree

6 files changed

+29
-28
lines changed

6 files changed

+29
-28
lines changed

pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
<version>1.18.30</version>
7777
<scope>provided</scope>
7878
</dependency>
79+
<dependency>
80+
<groupId>javax.validation</groupId>
81+
<artifactId>validation-api</artifactId>
82+
<version>2.0.1.Final</version>
83+
</dependency>
7984
</dependencies>
8085

8186
<build>
@@ -85,8 +90,8 @@
8590
<artifactId>maven-compiler-plugin</artifactId>
8691
<version>2.3.2</version>
8792
<configuration>
88-
<source>1.6</source>
89-
<target>1.6</target>
93+
<source>8</source>
94+
<target>8</target>
9095
<encoding>UTF-8</encoding>
9196
</configuration>
9297
</plugin>

src/main/java/com/alipay/global/api/example/RiskDecideTeeDemoCode.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
public class RiskDecideTeeDemoCode {
4545
private static final String CLIENT_ID = "";
46-
private static final String GATE_WAY_URL = "https://open-id-pre.alipay.com";
46+
private static final String GATE_WAY_URL = "";
4747
private static final String merchantPrivateKey = "";
4848
private static final String alipayPublicKey = "";
4949
private static final AlipayClient defaultAlipayClient = new DefaultAlipayClient(GATE_WAY_URL, merchantPrivateKey, alipayPublicKey);
@@ -68,7 +68,6 @@ public static RiskDecideResponse preAuthDecide() {
6868
response = defaultAlipayClient.execute(request);
6969
} catch (AlipayApiException e) {
7070
// TODO Handle AlipayApiException and log
71-
e.printStackTrace();
7271
}
7372
return response;
7473
}
@@ -112,8 +111,8 @@ public static void encryptRequest(RiskDecideRequest request) {
112111
EncryptKeyEnum.BUYER_PHONE_NO,
113112
EncryptKeyEnum.BUYER_REGISTRATION_TIME,
114113
EncryptKeyEnum.BILL_TO_NAME,
115-
EncryptKeyEnum.SHIPPING_ADDR1,
116-
EncryptKeyEnum.SHIPPING_ADDR2,
114+
EncryptKeyEnum.SHIPPING_ADDRESS1,
115+
EncryptKeyEnum.SHIPPING_ADDRESS2,
117116
EncryptKeyEnum.SHIPPING_NAME,
118117
EncryptKeyEnum.SHIPPING_EMAIL,
119118
EncryptKeyEnum.SHIPPING_PHONE_NO
@@ -146,7 +145,6 @@ public static SendPaymentResultResponse sendPaymentResult() {
146145
response = defaultAlipayClient.execute(request);
147146
} catch (AlipayApiException e) {
148147
// TODO Handle AlipayApiException and log
149-
e.printStackTrace();
150148
}
151149
return response;
152150
}
@@ -162,7 +160,6 @@ public static SendRefundResultResponse sendPaymentRefund() {
162160
response = defaultAlipayClient.execute(request);
163161
} catch (AlipayApiException e) {
164162
// TODO Handle AlipayApiException and log
165-
e.printStackTrace();
166163
}
167164
return response;
168165
}
@@ -181,7 +178,6 @@ public static RiskReportResponse reportRisk() {
181178
response = defaultAlipayClient.execute(request);
182179
} catch (AlipayApiException e) {
183180
// TODO Handle AlipayApiException and log
184-
e.printStackTrace();
185181
}
186182
return response;
187183
}
@@ -234,7 +230,7 @@ private static void buildRiskDecideRequest(RiskDecideRequest request) {
234230
buyer.setReferenceBuyerId("test12345678");
235231
buyer.setBuyerPhoneNo("12345678912");
236232
buyer.setBuyerEmail("[email protected]");
237-
buyer.setAccountVerified(true);
233+
buyer.setIsAccountVerified(true);
238234
buyer.setSuccessfulOrderCount(100);
239235
UserName buyerName = new UserName();
240236
buyerName.setFirstName("Dehua");

src/main/java/com/alipay/global/api/model/risk/PaymentMethodMetaData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class PaymentMethodMetaData {
5959
* The cardholder's name.
6060
* 持卡人姓名。
6161
*/
62-
private UserName cardholderName;
62+
private UserName cardHolderName;
6363
/**
6464
* The sender's email address.
6565
* 付款人的邮箱

src/main/java/com/alipay/global/api/request/ams/risk/tee/constants/CryptoSdkConstant.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import java.nio.charset.StandardCharsets;
88

99
/**
10-
* necessary constants for encrypt sdk
11-
* ¼ÓÃÜ SDK µÄ±ØÐë³£Á¿
10+
* necessary constants for encrypt SDK
11+
* 加密 SDK 必要常量
1212
*/
1313
public class CryptoSdkConstant {
1414
public static final int TAG_LENGTH = 96;

src/main/java/com/alipay/global/api/request/ams/risk/tee/encryptstrategy/RiskDecideEncryptStrategy.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private void doEncrypt(byte[] data_key, RiskDecideRequest request, List<EncryptK
8888
encryptName(data_key, paymentDetail.getPaymentMethod().getPaymentMethodMetaData().getCardHolderName(), crypto);
8989
}
9090
break;
91-
case SHIPPING_ADDR1:
91+
case SHIPPING_ADDRESS1:
9292
for (Order order : orders) {
9393
String address1 = order.getShipping().getShippingAddress().getAddress1();
9494
if (address1 == null || address1.isEmpty()) {
@@ -98,7 +98,7 @@ private void doEncrypt(byte[] data_key, RiskDecideRequest request, List<EncryptK
9898
order.getShipping().getShippingAddress().setAddress1(Base64.getEncoder().encodeToString(encrypt));
9999
}
100100
break;
101-
case SHIPPING_ADDR2:
101+
case SHIPPING_ADDRESS2:
102102
for (Order order : orders) {
103103
String address2 = order.getShipping().getShippingAddress().getAddress2();
104104
if (address2 == null || address2.isEmpty()) {
@@ -150,19 +150,19 @@ private void encryptName(byte[] data_key, UserName userName, AESCrypto crypto) {
150150
if (userName == null) {
151151
return;
152152
}
153-
if (userName.getFirstName() != null) {
153+
if (userName.getFirstName() != null && !userName.getFirstName().isEmpty()) {
154154
userName.setFirstName(Base64.getEncoder().encodeToString(
155155
crypto.encrypt(data_key, userName.getFirstName().getBytes(StandardCharsets.UTF_8))));
156156
}
157-
if (userName.getMiddleName() != null) {
157+
if (userName.getMiddleName() != null && !userName.getMiddleName().isEmpty()) {
158158
userName.setMiddleName(Base64.getEncoder().encodeToString(
159159
crypto.encrypt(data_key, userName.getMiddleName().getBytes(StandardCharsets.UTF_8))));
160160
}
161-
if (userName.getLastName() != null) {
161+
if (userName.getLastName() != null && !userName.getLastName().isEmpty()) {
162162
userName.setLastName(Base64.getEncoder().encodeToString(
163163
crypto.encrypt(data_key, userName.getLastName().getBytes(StandardCharsets.UTF_8))));
164164
}
165-
if (userName.getFullName() != null) {
165+
if (userName.getFullName() != null && !userName.getFullName().isEmpty()) {
166166
userName.setFullName(Base64.getEncoder().encodeToString(
167167
crypto.encrypt(data_key, userName.getFullName().getBytes(StandardCharsets.UTF_8))));
168168
}

src/main/java/com/alipay/global/api/request/ams/risk/tee/enums/EncryptKeyEnum.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
* 商户可选择的加密字段枚举类
1010
*/
1111
public enum EncryptKeyEnum {
12-
BUYER_EMAIL("BUYER_EMAIL", "buyer.buyerEmail"),
13-
BUYER_PHONE_NO("BUYER_PHONE_NO", "buyer.buyerPhoneNo"),
14-
BUYER_REGISTRATION_TIME("BUYER_REGISTRATION_TIME", "buyer.buyerRegistrationTime"),
15-
BILL_TO_NAME("BILL_TO_NAME", "paymentDetails.paymentMethod.paymentMethodMetaData.cardholderName"),
16-
SHIPPING_ADDR1("SHIPPING_ADDR1", "orders.shipping.shippingAddress.address1"),
17-
SHIPPING_ADDR2("SHIPPING_ADDR2", "orders.shipping.shippingAddress.address2"),
18-
SHIPPING_NAME("SHIPPING_NAME", "orders.shipping.shippingName"),
19-
SHIPPING_EMAIL("SHIPPING_EMAIL", "orders.shipping.shipToEmail"),
20-
SHIPPING_PHONE_NO("SHIPPING_PHONE_NO", "orders.shipping.shippingPhoneNo")
12+
BUYER_EMAIL("buyerEmail", "buyer.buyerEmail"),
13+
BUYER_PHONE_NO("buyerPhoneNo", "buyer.buyerPhoneNo"),
14+
BUYER_REGISTRATION_TIME("buyerRegistrationTime", "buyer.buyerRegistrationTime"),
15+
BILL_TO_NAME("cardHolderName", "paymentDetails.paymentMethod.paymentMethodMetaData.cardHolderName"),
16+
SHIPPING_ADDRESS1("address1", "orders.shipping.shippingAddress.address1"),
17+
SHIPPING_ADDRESS2("address2", "orders.shipping.shippingAddress.address2"),
18+
SHIPPING_NAME("shippingName", "orders.shipping.shippingName"),
19+
SHIPPING_EMAIL("shipToEmail", "orders.shipping.shipToEmail"),
20+
SHIPPING_PHONE_NO("shippingPhoneNo", "orders.shipping.shippingPhoneNo")
2121

2222
;
2323
private final String code;

0 commit comments

Comments
 (0)