-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathllms.txt
More file actions
832 lines (599 loc) · 38 KB
/
Copy pathllms.txt
File metadata and controls
832 lines (599 loc) · 38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
TITLE: Maven Dependency Configuration
DESCRIPTION: Adds the YOP Java SDK dependency to a Maven project. Include this in your pom.xml to use the SDK. Replace the version with the latest stable release.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_0
LANGUAGE: xml
CODE:
```
<dependency>
<groupId>com.yeepay.yop.sdk</groupId>
<artifactId>yop-java-sdk</artifactId>
<version>4.4.15</version> <!-- Please replace with the latest stable version -->
</dependency>
```
----------------------------------------
TITLE: Making API Requests with YOP in Java
DESCRIPTION: This code snippet demonstrates how to make a basic API request using the YOP Java SDK. It includes setting up the request with the endpoint and method, configuring application and authentication information, building a JSON request body, sending the request, and processing the response. The appKey variable should be replaced with the actual application AppKey.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_5
LANGUAGE: Java
CODE:
```
YopRequest request = new YopRequest("/rest/v1.0/test-wdc/test/http-json", "POST");
// Set application information
String appKey = "app_10085525305"; // Replace with your application AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
// Set authentication information
//request.getRequestConfig().setCredentials(new YopPKICredentials(
// appKey, new PKICredentialsItem(getPrivateKey(
// "YOUR_PRIVATE_KEY_STRING", // Replace with your private key
// CertTypeEnum.RSA2048),
// CertTypeEnum.RSA2048)));
// Build JSON request body
Map<String, Object> obj = new HashMap<>();
Map<String, Object> arg0 = new HashMap<>();
arg0.put("string", "hello");
obj.put("arg0", arg0);
request.setContent(JsonUtils.toJsonString(obj));
// Send request
YopClient yopClient = YopClientBuilder.builder().build();
YopResponse response = yopClient.request(request);
// Process response
if (response != null && response.getResult() != null) {
LOGGER.info("API call successful: {}", response.getResult());
// Parse response.getResult() according to API documentation
} else {
LOGGER.warn("API call failed: {}", response.getResult());
}
} catch (Exception e) {
LOGGER.error("API call exception", e);
}
```
----------------------------------------
TITLE: Making API Request with JSON Payload
DESCRIPTION: This code snippet demonstrates how to make a YOP API request with a JSON payload. It constructs a JSON request body, sets it as the content of the YopRequest, and then sends the request using YopClient. The response is then processed to check for success or failure.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_6
LANGUAGE: java
CODE:
```
// 构建JSON请求体
Map<String, Object> obj = new HashMap<>();
Map<String, Object> arg0 = new HashMap<>();
arg0.put("string", "你好");
obj.put("arg0", arg0);
request.setContent(JsonUtils.toJsonString(obj));
// 发送请求
YopClient yopClient = YopClientBuilder.builder().build();
YopResponse response = yopClient.request(request);
// 处理响应
if (response != null && response.getResult() != null) {
LOGGER.info("API调用成功: {}", response.getResult());
// 根据API文档解析 response.getResult()
} else {
LOGGER.warn("API调用失败: {}", response.getResult());
}
```
----------------------------------------
TITLE: YOP SDK Configuration File
DESCRIPTION: Example configuration file for the YOP SDK. This file should be placed in the classpath at `config/yop_sdk_config_default.json`. Replace `YOUR_APP_KEY` and `YOUR_PRIVATE_KEY_STRING` with your actual credentials.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_2
LANGUAGE: json
CODE:
```
{
"app_key": "YOUR_APP_KEY", // Replace with your application AppKey
"isv_private_key": { // Application private key configuration
"value": "YOUR_PRIVATE_KEY_STRING" // Replace with your application private key string
},
"yos_server_root": "https://yos.yeepay.com/yop-center", // YOP service address
"preferred_server_roots": [
"https://openapi.yeepay.com/yop-center"
],
"yop_cert_store": {
"enable": false,
"valid_after_expire_period": 1674727773000
},
"yop_report": {
"enable": true,
"enable_success_report": true,
"send_interval_ms": 3000,
"stat_interval_ms": 5000,
"max_queue_size": 500,
"max_fail_count": 10,
"max_fail_count_per_exception": 5,
"max_elapsed_ms": 15000,
"max_packet_size": 50
},
"http_client": {
"connect_timeout": 10000, // Connection timeout (milliseconds)
"connect_request_timeout": 5000,
"read_timeout": 30000 // Read timeout (milliseconds)
}
}
```
----------------------------------------
TITLE: Initializing POST Form Request with YOP SDK in Java
DESCRIPTION: This code snippet demonstrates how to create and send a POST request with form data using the YOP SDK. It initializes a YopRequest object with the API endpoint and method, sets the application key and security requirements, adds a form parameter, and then sends the request using a YopClient. The response is then processed to check for success or failure.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_4
LANGUAGE: Java
CODE:
```
YopRequest request = new YopRequest("/rest/v1.0/test-wdc/test/http-json", "POST");
// 设置应用信息
String appKey = "app_10085525305"; // 替换为您的应用AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
// 添加表单参数
request.addParameter("string", "你好");
// 发送请求
YopClient yopClient = YopClientBuilder.builder().build();
YopResponse response = yopClient.request(request);
// 处理响应
if (response != null && response.getResult() != null) {
LOGGER.info("API调用成功: {}", response.getResult());
// 根据API文档解析 response.getResult()
} else {
LOGGER.warn("API调用失败: {}", response.getResult());
}
```
----------------------------------------
TITLE: GET Standard Request with YOP SDK
DESCRIPTION: This code snippet demonstrates how to make a GET request using the YOP SDK. It initializes a YopRequest object with the API endpoint and method, adds a parameter, sets the application key and security requirements, and then sends the request using a YopClient. The response is then processed to check for success or failure.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_3
LANGUAGE: java
CODE:
```
private static void getCommonExample() {
try {
// Create request object
YopRequest request = new YopRequest("/rest/v1.0/test/product-query/query-for-doc", "GET");
request.addParameter("string0", "dsbzb");
// Set application information
String appKey = "app_10085525305"; // Replace with your application AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
// Set authentication information
// request.getRequestConfig().setCredentials(new YopPKICredentials(
// appKey, new PKICredentialsItem(getPrivateKey(
// "YOUR_PRIVATE_KEY_STRING", // Replace with your private key
// CertTypeEnum.RSA2048),
// CertTypeEnum.RSA2048)));
// Send request
YopClient yopClient = YopClientBuilder.builder().build();
YopResponse response = yopClient.request(request);
// Process response
if (response != null && response.getResult() != null) {
LOGGER.info("API call successful: {}", response.getResult());
// Parse response.getResult() according to API documentation
} else {
LOGGER.warn("API call failed: {}", response.getResult());
}
} catch (Exception e) {
LOGGER.error("API call exception", e);
}
}
```
----------------------------------------
TITLE: Initializing GET Request with YOP SDK in Java
DESCRIPTION: This code snippet demonstrates how to create and send a GET request using the YOP SDK. It initializes a YopRequest object with the API endpoint and method, sets the application key and security requirements, adds a parameter, and then sends the request using a YopClient. The response is then processed to check for success or failure.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_3
LANGUAGE: Java
CODE:
```
YopRequest request = new YopRequest("/rest/v1.0/test/product-query/query-for-doc", "GET");
request.addParameter("string0", "dsbzb");
// 设置应用信息
String appKey = "app_10085525305"; // 替换为您的应用AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
// 发送请求
YopClient yopClient = YopClientBuilder.builder().build();
YopResponse response = yopClient.request(request);
// 处理响应
if (response != null && response.getResult() != null) {
LOGGER.info("API调用成功: {}", response.getResult());
// 根据API文档解析 response.getResult()
} else {
LOGGER.warn("API调用失败: {}", response.getResult());
}
```
----------------------------------------
TITLE: File Download from YOP in Java
DESCRIPTION: This code snippet demonstrates how to download a file from YOP using the YOP Java SDK. It includes creating a request object, setting the file name as a parameter, setting application and authentication information, sending the request, and processing the response. The appKey variable should be replaced with the actual application AppKey. The downloaded file content is read into a string.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_7
LANGUAGE: Java
CODE:
```
YopRequest request = new YopRequest("/yos/v1.0/test/test/ceph-download", "GET");
request.addParameter("fileName", "example.txt");
// Set application information
String appKey = "app_10085525305"; // Replace with your application AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
// Set authentication information
//request.getRequestConfig().setCredentials(new YopPKICredentials(
// appKey, new PKICredentialsItem(getPrivateKey(
// "YOUR_PRIVATE_KEY_STRING", // Replace with your private key
// CertTypeEnum.RSA2048),
// CertTypeEnum.RSA2048)));
// Send request
YopClient yopClient = YopClientBuilder.builder().build();
YosDownloadResponse response = yopClient.download(request);
// Process response
if (response != null && response.getResult() != null) {
downloadInputStream = response.getResult();
// Read downloaded file content
String fileContent = IOUtils.toString(downloadInputStream, "UTF-8");
LOGGER.info("File download successful, content length: {}", fileContent.length());
```
----------------------------------------
TITLE: File Download from YOP
DESCRIPTION: This code snippet demonstrates how to download a file from the YOP platform using the YOP Java SDK. It creates a YopRequest, sets the application key and security requirements, adds the filename as a parameter, and then sends the download request using YopClient. The downloaded file content is then read from the YosDownloadInputStream and logged.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_8
LANGUAGE: java
CODE:
```
// 发送请求
YopClient yopClient = YopClientBuilder.builder().build();
YosDownloadResponse response = yopClient.download(request);
// 处理响应
if (response != null && response.getResult() != null) {
downloadInputStream = response.getResult();
// 读取下载的文件内容
String fileContent = IOUtils.toString(downloadInputStream, "UTF-8");
LOGGER.info("文件下载成功,内容长度: {}", fileContent.length());
// 实际使用时,可以将文件内容保存到本地文件
// Files.write(Paths.get("downloaded-file.txt"), fileContent.getBytes());
} else {
LOGGER.warn("文件下载失败: {}", response.getResult());
}
```
----------------------------------------
TITLE: File Download Handling in YOP SDK
DESCRIPTION: This code snippet demonstrates how to handle file downloads using the YOP SDK. It includes logging success or failure, exception handling, and closing the input stream. It uses `StreamUtils.closeQuietly` to ensure the stream is closed even if an exception occurs.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_8
LANGUAGE: Java
CODE:
```
try {
if (response.isSuccess()) {
InputStream downloadInputStream = response.getInputStream();
String fileContent = IOUtils.toString(downloadInputStream, StandardCharsets.UTF_8);
// In actual use, you can save the file content to a local file
// Files.write(Paths.get("downloaded-file.txt"), fileContent.getBytes());
} else {
LOGGER.warn("File download failed: {}", response.getResult());
}
} catch (Exception e) {
LOGGER.error("File download exception", e);
} finally {
// Close stream
StreamUtils.closeQuietly(downloadInputStream);
}
```
----------------------------------------
TITLE: Get Private Key from String in YOP SDK
DESCRIPTION: This code snippet shows how to retrieve a private key from a string using the YOP SDK. It configures a `YopCertConfig` object with the private key string, certificate type, and store type, then uses a `YopCertParser` to parse the configuration and return the `PrivateKey` object. It uses `YopCertParserFactory` to get the appropriate parser based on the certificate category and type.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_9
LANGUAGE: Java
CODE:
```
private static PrivateKey getPrivateKey(String priKey, CertTypeEnum certType) {
final YopCertConfig yopCertConfig = new YopCertConfig();
yopCertConfig.setCertType(certType);
yopCertConfig.setValue(priKey);
yopCertConfig.setStoreType(CertStoreType.STRING);
return (PrivateKey) YopCertParserFactory.getCertParser(YopCertCategory.PRIVATE, certType).parse(yopCertConfig);
}
```
----------------------------------------
TITLE: POST Form Request with YOP SDK
DESCRIPTION: This code snippet demonstrates how to make a POST form request using the YOP SDK. It initializes a YopRequest object with the API endpoint and method, sets the application key and security requirements, adds a form parameter, and then sends the request using a YopClient. The response is then processed to check for success or failure.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_4
LANGUAGE: java
CODE:
```
private static void postFormExample() {
try {
// Create request object
YopRequest request = new YopRequest("/rest/v1.0/test-wdc/test/http-json", "POST");
// Set application information
String appKey = "app_10085525305"; // Replace with your application AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
// Set authentication information
// request.getRequestConfig().setCredentials(new YopPKICredentials(
// appKey, new PKICredentialsItem(getPrivateKey(
// "YOUR_PRIVATE_KEY_STRING", // Replace with your private key
// CertTypeEnum.RSA2048),
// CertTypeEnum.RSA2048)));
// Add form parameters
request.addParameter("string", "hello");
// Send request
YopClient yopClient = YopClientBuilder.builder().build();
YopResponse response = yopClient.request(request);
// Process response
if (response != null && response.getResult() != null) {
LOGGER.info("API call successful: {}", response.getResult());
// Parse response.getResult() according to API documentation
} else {
LOGGER.warn("API call failed: {}", response.getResult());
}
} catch (Exception e) {
LOGGER.error("API call exception", e);
}
}
```
----------------------------------------
TITLE: Implementing YopHttpClient Interface for Custom HTTP Client in Java
DESCRIPTION: This snippet describes how to implement a custom HTTP client. Merchants can implement the com.yeepay.yop.sdk.http.YopHttpClient interface to use their own HTTP client implementation with the SDK.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_13
----------------------------------------
TITLE: File Upload to YOP
DESCRIPTION: This code snippet demonstrates how to upload a file to the YOP platform using the YOP Java SDK. It creates a YopRequest, sets the application key and security requirements, adds the file to be uploaded as a multipart file, and then sends the upload request using YopClient. The response is then processed to check for success or failure.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_7
LANGUAGE: java
CODE:
```
// 添加上传文件
// 这里使用ClassLoader获取资源文件,实际使用时可以是本地文件路径
InputStream fileStream = YopApiDemo.class.getResourceAsStream("/your-file.txt");
request.addMultiPartFile("_file", fileStream);
// 发送请求
YopClient yopClient = YopClientBuilder.builder().build();
YosUploadResponse response = yopClient.upload(request);
// 处理响应
if (response != null && response.getResult() != null) {
LOGGER.info("文件上传成功: {}", response.getResult());
// 根据API文档解析 response.getResult()
} else {
LOGGER.warn("文件上传失败: {}", response.getResult());
}
```
----------------------------------------
TITLE: Implementing Encrypter Interface for HSM Integration in Java
DESCRIPTION: This snippet describes how to integrate with a Hardware Security Module (HSM). Merchants can implement the com.yeepay.yop.sdk.security.Encrypter interface to delegate encryption operations to their HSM device.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_11
----------------------------------------
TITLE: File Upload to YOP in Java
DESCRIPTION: This code snippet demonstrates how to upload a file to YOP using the YOP Java SDK. It includes creating a request object, setting application and authentication information, adding the file to the request, sending the request, and processing the response. The appKey variable should be replaced with the actual application AppKey. The fileStream is obtained using ClassLoader, but in actual use, it can be a local file path.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_6
LANGUAGE: Java
CODE:
```
YopRequest request = new YopRequest("/rest/v1.0/file/upload", "POST");
// Set application information
String appKey = "app_10085525305"; // Replace with your application AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
// Set authentication information
//request.getRequestConfig().setCredentials(new YopPKICredentials(
// appKey, new PKICredentialsItem(getPrivateKey(
// "YOUR_PRIVATE_KEY_STRING", // Replace with your private key
// CertTypeEnum.RSA2048),
// CertTypeEnum.RSA2048)));
// Add upload file
// Here using ClassLoader to get resource file, in actual use it can be a local file path
InputStream fileStream = YopApiDemo.class.getResourceAsStream("/your-file.txt");
request.addMultiPartFile("_file", fileStream);
// Send request
YopClient yopClient = YopClientBuilder.builder().build();
YosUploadResponse response = yopClient.upload(request);
// Process response
if (response != null && response.getResult() != null) {
LOGGER.info("File upload successful: {}", response.getResult());
// Parse response.getResult() according to API documentation
} else {
LOGGER.warn("File upload failed: {}", response.getResult());
}
} catch (Exception e) {
LOGGER.error("File upload exception", e);
}
```
----------------------------------------
TITLE: Implementing Signer Interface for HSM Integration in Java
DESCRIPTION: This snippet describes how to integrate with a Hardware Security Module (HSM). Merchants can implement the com.yeepay.yop.sdk.security.Signer interface to delegate signing operations to their HSM device.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_12
----------------------------------------
TITLE: Configuring Domain Weight - Java
DESCRIPTION: Version 4.4.15 introduces support for configuring domain weights, allowing for more granular control over traffic distribution across multiple domains. This feature enables developers to fine-tune the routing of requests based on domain performance or other criteria.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_0
----------------------------------------
TITLE: Custom Filename Support for YOS Uploads - Java
DESCRIPTION: Version 4.4.10 enables support for custom filenames when uploading files to YOS (YOP Object Storage). This feature allows developers to specify the desired filename for uploaded files, providing greater control over file management.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_5
----------------------------------------
TITLE: JSON Decimal Deserialization Precision Fix - Java
DESCRIPTION: Version 4.3.2 fixes an issue with JSON decimal deserialization that caused loss of precision for small numbers. The default is now BigDecimal, ensuring that decimal values are accurately represented and processed.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_18
----------------------------------------
TITLE: Implementing HSM Integration with Signer Interface in Java
DESCRIPTION: To integrate with a Hardware Security Module (HSM), implement the `com.yeepay.yop.sdk.security.Signer` interface. This enables delegating signing operations to the HSM device. Refer to the SDK documentation for detailed guidance.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_11
LANGUAGE: Java
CODE:
```
com.yeepay.yop.sdk.security.Signer
```
----------------------------------------
TITLE: Fixing Custom Header Issues - Java
DESCRIPTION: Version 4.4.14 addresses and resolves issues related to custom headers, ensuring that custom headers are correctly processed and included in requests. This fix improves the flexibility and compatibility of the SDK when dealing with APIs that require specific custom headers.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_1
----------------------------------------
TITLE: Customizing Credentials with YopCredentialsProvider in Java
DESCRIPTION: This snippet describes how to customize credential providing for multi-tenant scenarios. Merchants can implement their own logic for loading appKey and private key by extending YopCachedCredentialsProvider or YopFixedCredentialsProvider.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_10
----------------------------------------
TITLE: Merchant Notification Decryption Tool Fix - Java
DESCRIPTION: Version 4.4.12 resolves issues with the merchant notification decryption tool, ensuring compatibility across different environments. This fix allows for seamless decryption of notifications, even when calls are made across different environments.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_3
----------------------------------------
TITLE: Implementing HSM Integration with Encrypter Interface in Java
DESCRIPTION: To integrate with a Hardware Security Module (HSM), implement the `com.yeepay.yop.sdk.security.Encrypter` interface. This allows delegating encryption operations to the HSM device. Refer to the SDK documentation for detailed guidance.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_10
LANGUAGE: Java
CODE:
```
com.yeepay.yop.sdk.security.Encrypter
```
----------------------------------------
TITLE: Filename Correction for Uploads - Java
DESCRIPTION: Version 4.4.4 corrects the filename handling during uploads, ensuring that filenames are properly processed and stored. This fix prevents potential issues with filename encoding or formatting.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_11
----------------------------------------
TITLE: Multi-Environment Call Support - Java
DESCRIPTION: Version 4.4.9 introduces support for mixed multi-environment calls, allowing the SDK to seamlessly interact with different environments. This feature simplifies the integration process when dealing with multiple environments.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_6
----------------------------------------
TITLE: Getting Private Key for YOP Authentication
DESCRIPTION: This code snippet shows how to retrieve a private key for YOP authentication. It takes the private key string and certificate type as input, configures a YopCertConfig object, and then uses YopCertParserFactory to parse the certificate and return the PrivateKey object.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_9
LANGUAGE: java
CODE:
```
/**
* 获取私钥
*/
private static PrivateKey getPrivateKey(String priKey, CertTypeEnum certType) {
final YopCertConfig yopCertConfig = new YopCertConfig();
yopCertConfig.setCertType(certType);
yopCertConfig.setValue(priKey);
yopCertConfig.setStoreType(CertStoreType.STRING);
return (PrivateKey) YopCertParserFactory.getCertParser(YopCertCategory.PRIVATE, certType).parse(yopCertConfig);
}
```
----------------------------------------
TITLE: Message Encryption and Decryption Support - Java
DESCRIPTION: Version 4.3.0 introduces support for message encryption and decryption, providing developers with the ability to protect sensitive data during transmission. This feature enhances the security of the SDK and its applications.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_20
----------------------------------------
TITLE: Client Reporting Support - Java
DESCRIPTION: Version 4.4.2 introduces support for client-side reporting, allowing the SDK to collect and report client-side metrics. This feature provides valuable insights into client-side performance and usage patterns.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_13
----------------------------------------
TITLE: Implementing Custom HTTP Client with YopHttpClient Interface in Java
DESCRIPTION: To use a custom HTTP client, implement the `com.yeepay.yop.sdk.http.YopHttpClient` interface. This is useful when the default Apache HttpClient or optional OkHttp client does not meet specific needs, such as detailed connection pool management or proxy configuration.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_12
LANGUAGE: Java
CODE:
```
com.yeepay.yop.sdk.http.YopHttpClient
```
----------------------------------------
TITLE: Multi-Domain Routing and Error Reporting - Java
DESCRIPTION: Version 4.2.5 introduces support for multi-domain routing and error reporting, allowing the SDK to dynamically route requests across multiple domains and report errors to a central location. This feature enhances the resilience and observability of the SDK.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_23
----------------------------------------
TITLE: Multi-Domain Routing and Error Reporting (3.3.10) - Java
DESCRIPTION: Version 3.3.10 introduces support for multi-domain routing and error reporting, allowing the SDK to dynamically route requests across multiple domains and report errors to a central location. This feature enhances the resilience and observability of the SDK.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_45
----------------------------------------
TITLE: Timestamp Acquisition Inconsistency Fix - Java
DESCRIPTION: Version 4.1.11 fixes an issue in 4.1.10 where inconsistent timestamp acquisition could lead to gateway signature verification failures. This fix ensures that timestamps are consistently generated and used for signature verification.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_30
----------------------------------------
TITLE: File Integrity Check Optimization - Java
DESCRIPTION: Version 3.1.5 optimizes file integrity checks by moving server-side checks to the client-side, improving performance. This optimization reduces the load on the server and improves the overall efficiency of file integrity checks.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_68
----------------------------------------
TITLE: setValidateAfterInactivity Configuration - Java
DESCRIPTION: Version 4.1.1 sets setValidateAfterInactivity(3000), configuring the validation interval for inactive connections. This configuration helps to maintain the health of connections and prevent issues caused by long-lived inactive connections.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_38
----------------------------------------
TITLE: Domain Switching Logic Optimization (4.1.15) - Java
DESCRIPTION: Version 4.1.15 extracts and optimizes the domain switching logic, making it easier to reuse and extend. This enhancement improves the agility of domain switching, allowing for more responsive adaptation to changing network conditions.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_27
----------------------------------------
TITLE: YopError and Parameter Handling Improvements - Java
DESCRIPTION: Version 3.3.1 adds support for docUrl in YopError and ignores unconfigured parameters. These improvements enhance the error reporting capabilities of the SDK and simplify parameter handling.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_51
----------------------------------------
TITLE: Error Stack Optimization and Time Handling - Java
DESCRIPTION: Version 3.2.5-RC1 optimizes the error stack, time handling classes, and removes unnecessary parameters from the protocol. These optimizations improve the clarity and efficiency of error reporting and data transmission.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_62
----------------------------------------
TITLE: YOS Support Fix and Request Address Handling Optimization - Java
DESCRIPTION: Version 3.1.1 fixes support for YOS and optimizes request address handling. This fix ensures that the SDK properly supports YOS and that request addresses are correctly constructed.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_70
----------------------------------------
TITLE: SM2 Signature Verification Fix - Java
DESCRIPTION: Version 4.4.13 includes a fix for SM2 notification signature verification, ensuring the integrity and authenticity of notifications. This version also upgrades Jackson, Tika, and JSON-path to address security vulnerabilities, enhancing the overall security posture of the SDK.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_2
----------------------------------------
TITLE: SSLContext Re-initialization Fix - Java
DESCRIPTION: Version 4.0.1 fixes an SSLContext re-initialization issue that was triggered in JDK11. This fix ensures that the SSLContext is properly initialized and maintained, preventing potential SSL connection issues.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_43
----------------------------------------
TITLE: YopJsonResponseAnalyzer Response Body Validation Fix - Java
DESCRIPTION: Version 4.2.1 fixes an issue with YopJsonResponseAnalyzer's validation of the response body. This fix ensures that response bodies are correctly validated, preventing potential errors in data processing.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_25
----------------------------------------
TITLE: Adding Maven Dependency
DESCRIPTION: Adds the Yop Java SDK dependency to a Maven project. Include this in your pom.xml to use the SDK.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_0
LANGUAGE: xml
CODE:
```
<dependency>
<groupId>com.yeepay.yop.sdk</groupId>
<artifactId>yop-java-sdk</artifactId>
<version>4.4.15</version> <!-- 请替换为最新的稳定版本 -->
</dependency>
```
----------------------------------------
TITLE: Sub-Merchant ID Header Addition - Java
DESCRIPTION: Version 3.2.5-RC1 adds a sub-merchant ID header (x-yop-sub-customer-id). This addition allows for better identification and management of sub-merchants.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_61
----------------------------------------
TITLE: Sandbox and Client Routing Support - Java
DESCRIPTION: Version 3.2.3 introduces support for sandbox and client routing. This enhancement allows the SDK to be used in sandbox environments and to route requests to specific clients.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_66
----------------------------------------
TITLE: Gradle Dependency Configuration
DESCRIPTION: Adds the YOP Java SDK dependency to a Gradle project. Include this in your build.gradle file to use the SDK. Replace the version with the latest stable release.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README.md#_snippet_1
LANGUAGE: groovy
CODE:
```
implementation 'com.yeepay.yop.sdk:yop-java-sdk:4.4.15' // Please replace with the latest stable version
```
----------------------------------------
TITLE: Multiple Configuration File Support - Java
DESCRIPTION: Version 4.0.3 introduces support for multiple configuration files, although it has some defects. This feature allows developers to split their configuration across multiple files, but may require additional attention to ensure proper functionality.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_41
----------------------------------------
TITLE: Scheme Setting Support for Proxy - Java
DESCRIPTION: Version 3.2.1 introduces support for setting the scheme for proxies. This enhancement allows developers to specify the scheme (e.g., HTTP or HTTPS) to be used when connecting to a proxy server.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_67
----------------------------------------
TITLE: NPE Fix - Java
DESCRIPTION: Version 4.0.2 fixes a NullPointerException (NPE) issue. This fix improves the stability and reliability of the SDK by preventing potential null pointer exceptions.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_42
----------------------------------------
TITLE: HTTP Support Restoration - Java
DESCRIPTION: Version 4.1.4 restores HTTP support, allowing the SDK to make requests over HTTP. This restoration provides compatibility with environments that do not support HTTPS.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_36
----------------------------------------
TITLE: 204 and 502 Return Code Handling - Java
DESCRIPTION: Version 3.2.5 handles 204 and 502 return codes. This handling ensures that these return codes are properly processed and reported.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_65
----------------------------------------
TITLE: Gradle Dependency Management Support - Java
DESCRIPTION: Version 3.3.3 introduces support for the Gradle dependency management tool and no longer packages the lib directory. This enhancement simplifies dependency management and reduces the size of the SDK.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_50
----------------------------------------
TITLE: Initializing POST JSON Request with YOP SDK in Java
DESCRIPTION: This code snippet demonstrates how to create and send a POST request with JSON data using the YOP SDK. It initializes a YopRequest object with the API endpoint and method, sets the application key and security requirements. The snippet shows the initial setup for a JSON request, but the actual JSON payload and sending of the request are not included in the provided extract.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/README_zh-CN.md#_snippet_5
LANGUAGE: Java
CODE:
```
YopRequest request = new YopRequest("/rest/v1.0/test-wdc/test/http-json", "POST");
// 设置应用信息
String appKey = "app_10085525305"; // 替换为您的应用AppKey
request.getRequestConfig().setAppKey(appKey);
request.getRequestConfig().setSecurityReq("YOP-RSA2048-SHA256");
```
----------------------------------------
TITLE: Jackson Issue Fix (Cross-border Merchants) - Java
DESCRIPTION: Version 4.2.6 is based on 4.2.1 and fixes a Jackson issue specifically for cross-border merchants. This fix ensures that Jackson is properly configured and functioning correctly in cross-border scenarios.
SOURCE: https://github.com/yop-platform/yop-java-sdk/blob/develop/CHANGELOG.md#_snippet_22