-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
184 lines (161 loc) · 6.3 KB
/
Copy pathTest.java
File metadata and controls
184 lines (161 loc) · 6.3 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
import com.google.gson.Gson;
import kr.co.bootpay.Bootpay;
import kr.co.bootpay.model.request.*;
import kr.co.bootpay.model.response.ResToken;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
public class Test {
static Bootpay bootpay;
public static void main(String[] args) {
bootpay = new Bootpay("5b8f6a4d396fa665fdc2b5ea", "rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=");
System.out.println("2134");
goGetToken();
getBillingKey();
// requestSubscribe();
// reserveSubscribe();
// destroyBillingKey();
// reserveCancelSubscribe();
// receiptCancel();
// getUserToken();
// requestLink();
// submit();
// goVerfity();
// certificate();
}
public static void goGetToken() {
try {
HttpResponse res = bootpay.getAccessToken();
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
ResToken resToken = new Gson().fromJson(str, ResToken.class);
System.out.println(resToken);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void getBillingKey() {
Subscribe subscribeBilling = new Subscribe();
subscribeBilling.itemName = "정기결제 테스트 아이템";
subscribeBilling.orderId = "" + (System.currentTimeMillis() / 1000);
subscribeBilling.pg = "nicepay";
subscribeBilling.cardNo = "5570**********1074"; //실제 테스트시에는 *** 마스크처리가 아닌 숫자여야 함
subscribeBilling.cardPw = "**"; //실제 테스트시에는 *** 마스크처리가 아닌 숫자여야 함
subscribeBilling.expireYear = "**"; //실제 테스트시에는 *** 마스크처리가 아닌 숫자여야 함
subscribeBilling.expireMonth = "**"; //실제 테스트시에는 *** 마스크처리가 아닌 숫자여야 함
subscribeBilling.identifyNumber = ""; //주민등록번호
try {
HttpResponse res = bootpay.getBillingKey(subscribeBilling);
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void destroyBillingKey() {
try {
HttpResponse res = bootpay.destroyBillingKey("6100e7ea0d681b001fd4de69");
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void requestSubscribe() {
SubscribePayload payload = new SubscribePayload();
payload.billingKey = "6100e8c80d681b001dd4e0d7";
payload.itemName = "아이템01";
payload.price = 1000;
payload.orderId = "" + (System.currentTimeMillis() / 1000);
try {
HttpResponse res = bootpay.requestSubscribe(payload);
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void reserveSubscribe() {
SubscribePayload payload = new SubscribePayload();
payload.billingKey = "6100e77a0d681b002ad4e5d9";
payload.itemName = "아이템01";
payload.price = 1000;
payload.orderId = "" + (System.currentTimeMillis() / 1000);
payload.executeAt = (System.currentTimeMillis() / 1000) + 10000;
try {
HttpResponse res = bootpay.reserveSubscribe(payload);
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void reserveCancelSubscribe() {
try {
HttpResponse res = bootpay.reserveCancelSubscribe("6100e892019943002150fef3");
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void receiptCancel() {
Cancel cancel = new Cancel();
cancel.receiptId = "6100e77a019943003650f4d5";
cancel.name = "관리자";
cancel.reason = "테스트 결제";
// String receipt_id = "";
try {
HttpResponse res = bootpay.receiptCancel(cancel);
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void getUserToken() {
UserToken userToken = new UserToken();
try {
HttpResponse res = bootpay.getUserToken(userToken);
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void requestLink() {
Payload payload = new Payload();
try {
HttpResponse res = bootpay.requestLink(payload);
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void submit() {
try {
HttpResponse res = bootpay.submit("");
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void goVerfity() {
try {
HttpResponse res = bootpay.verify("6100e8e7019943003850f9b0");
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void certificate() {
try {
HttpResponse res = bootpay.certificate("593f8febe13f332431a8ddae");
String str = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println(str);
} catch (Exception e) {
e.printStackTrace();
}
}
}