Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
e00c1ddd
提交
e00c1ddd
authored
12月 29, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
paypal token
上级
43c33a49
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
73 行删除
+75
-73
PaypalContoller.java
.../com/example/afrishop_v3/controllers/PaypalContoller.java
+2
-13
AfrishopV3ApplicationTests.java
...a/com/example/afrishop_v3/AfrishopV3ApplicationTests.java
+73
-60
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/PaypalContoller.java
浏览文件 @
e00c1ddd
...
@@ -172,19 +172,8 @@ public class PaypalContoller extends Controller {
...
@@ -172,19 +172,8 @@ public class PaypalContoller extends Controller {
public
APIContext
getToken
()
throws
IOException
{
public
APIContext
getToken
()
throws
IOException
{
//获取paypal的最新token
//获取paypal的最新token
Optional
<
Token
>
tokenOptional
=
tokenRepository
.
findFirstToken
();
Optional
<
Token
>
tokenOptional
=
tokenRepository
.
findFirstToken
();
Optional
<
String
>
token
=
Optional
.
empty
();
String
token
=
PayPalUtil
.
getToken
(
tokenOptional
.
get
().
getToken
(),
mode
);
//第一次执行时,token表都为空
APIContext
apiContext
=
new
APIContext
(
token
);
if
(
tokenOptional
.
isPresent
())
{
token
=
Optional
.
ofNullable
(
tokenOptional
.
get
().
getToken
());
}
if
(!
token
.
isPresent
())
{
String
oldToken
=
oldApiContext
.
getAccessToken
();
String
token1
=
PayPalUtil
.
getToken
(
oldToken
,
mode
);
token
=
Optional
.
ofNullable
(
token1
);
}
APIContext
apiContext
=
new
APIContext
(
token
.
get
());
Map
<
String
,
String
>
sdkConfig
=
new
HashMap
<>();
Map
<
String
,
String
>
sdkConfig
=
new
HashMap
<>();
sdkConfig
.
put
(
"mode"
,
mode
);
sdkConfig
.
put
(
"mode"
,
mode
);
apiContext
.
setConfigurationMap
(
sdkConfig
);
apiContext
.
setConfigurationMap
(
sdkConfig
);
...
...
src/test/java/com/example/afrishop_v3/AfrishopV3ApplicationTests.java
浏览文件 @
e00c1ddd
//package com.example.afrishop_v3;
package
com
.
example
.
afrishop_v3
;
//
//import com.example.afrishop_v3.models.JsonTag;
import
com.example.afrishop_v3.models.JsonTag
;
//import com.example.afrishop_v3.models.TbCfOrder;
import
com.example.afrishop_v3.models.TbCfOrder
;
//import com.example.afrishop_v3.repository.TbCfOrderRepository;
import
com.example.afrishop_v3.models.Token
;
//import com.google.gson.JsonObject;
import
com.example.afrishop_v3.repository.TbCfOrderRepository
;
//import net.sf.json.JSONObject;
import
com.example.afrishop_v3.repository.TokenRepository
;
//import org.junit.jupiter.api.Test;
import
com.google.gson.JsonObject
;
//import org.junit.runner.Result;
import
net.sf.json.JSONObject
;
//import org.junit.runner.RunWith;
import
org.junit.jupiter.api.Test
;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.junit.runner.Result
;
//import org.springframework.boot.test.context.SpringBootTest;
import
org.junit.runner.RunWith
;
//import org.springframework.http.ResponseEntity;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.test.context.junit4.SpringRunner;
import
org.springframework.boot.test.context.SpringBootTest
;
//import org.springframework.web.client.RestTemplate;
import
org.springframework.http.ResponseEntity
;
//
import
org.springframework.test.context.junit4.SpringRunner
;
//import java.text.SimpleDateFormat;
import
org.springframework.web.client.RestTemplate
;
//import java.time.LocalDateTime;
//import java.util.Date;
import
java.text.SimpleDateFormat
;
//import java.util.HashMap;
import
java.time.LocalDateTime
;
//import java.util.Map;
import
java.util.Date
;
//import java.util.Optional;
import
java.util.HashMap
;
//
import
java.util.Map
;
//@RunWith(SpringRunner.class)
import
java.util.Optional
;
//@SpringBootTest
//public class AfrishopV3ApplicationTests {
@RunWith
(
SpringRunner
.
class
)
//
@SpringBootTest
// RestTemplate restTemplate = new RestTemplate();
public
class
AfrishopV3ApplicationTests
{
//
// @Test
RestTemplate
restTemplate
=
new
RestTemplate
();
// void contextLoads() {
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@Test
// String now = format.format(new Date());
void
contextLoads
()
{
// System.out.println(now);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
// }
String
now
=
format
.
format
(
new
Date
());
//
System
.
out
.
println
(
now
);
// private String url = "http://localhost:8099/afrishop/discover/bonus/saveNetworkMarketing";
}
// @Autowired
// private TbCfOrderRepository orderRepository;
private
String
url
=
"http://localhost:8099/afrishop/discover/bonus/saveNetworkMarketing"
;
//
@Autowired
//// post35789572fbf643cdab55901d1dc511a6
private
TbCfOrderRepository
orderRepository
;
//// userInfo00297bf300ed45e092a5182dececad21
//// productSharervv32GmG4q
// post35789572fbf643cdab55901d1dc511a6
//// amount0.9
// userInfo00297bf300ed45e092a5182dececad21
//// orderId008272b1fb994aef9b199449f46d5aa5
// productSharervv32GmG4q
//
// amount0.9
// @Test
// orderId008272b1fb994aef9b199449f46d5aa5
// public void test1() {
//
@Test
// Optional<TbCfOrder> byId = orderRepository.findById("12a9d7d1042348278c97980a00fc67c4");
public
void
test1
()
{
// JSONObject json=new JSONObject();
// json.put("userInfo", "32dcda5a709c4265a6f01686ae9b1c1c");
Optional
<
TbCfOrder
>
byId
=
orderRepository
.
findById
(
"12a9d7d1042348278c97980a00fc67c4"
);
// json.put("amount", byId.get().getItemsPrice());
JSONObject
json
=
new
JSONObject
();
// json.put("orderId","12a9d7d1042348278c97980a00fc67c4");
json
.
put
(
"userInfo"
,
"32dcda5a709c4265a6f01686ae9b1c1c"
);
// System.out.println(json);
json
.
put
(
"amount"
,
byId
.
get
().
getItemsPrice
());
// ResponseEntity<Result> resultResponseEntity = restTemplate.postForEntity(url, json, Result.class);
json
.
put
(
"orderId"
,
"12a9d7d1042348278c97980a00fc67c4"
);
// System.err.println(resultResponseEntity);
System
.
out
.
println
(
json
);
// }
ResponseEntity
<
Result
>
resultResponseEntity
=
restTemplate
.
postForEntity
(
url
,
json
,
Result
.
class
);
//
System
.
err
.
println
(
resultResponseEntity
);
//}
}
@Autowired
private
TokenRepository
tokenRepository
;
@Test
public
void
test2
(){
Optional
<
Token
>
firstToken
=
tokenRepository
.
findFirstToken
();
if
(
firstToken
.
isPresent
()){
System
.
out
.
println
(
firstToken
.
get
().
getToken
());
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论