├── .gitattributes
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── _config.yml
├── docs
├── allclasses-frame.html
├── allclasses-noframe.html
├── com
│ └── midtrans
│ │ ├── Config.html
│ │ ├── ConfigBuilder.html
│ │ ├── ConfigFactory.html
│ │ ├── Midtrans.html
│ │ ├── httpclient
│ │ ├── APIHttpClient.html
│ │ ├── CoreApi.html
│ │ ├── IrisApi.html
│ │ ├── SnapApi.html
│ │ ├── TransactionApi.html
│ │ ├── error
│ │ │ ├── MidtransError.html
│ │ │ ├── package-frame.html
│ │ │ ├── package-summary.html
│ │ │ └── package-tree.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── java
│ │ ├── ConcurrentTest.html
│ │ ├── ConfigGlobalTest.html
│ │ ├── ConfigTest.html
│ │ ├── ConfigViaBuilderTest.html
│ │ ├── CoreApiStaticTest.html
│ │ ├── CoreApiTest.html
│ │ ├── IrisApiStaticTest.html
│ │ ├── IrisApiTest.html
│ │ ├── MidtransCoreApiTest.html
│ │ ├── MidtransIrisApiTest.html
│ │ ├── MidtransSnapApiTest.html
│ │ ├── SnapApiStaticTest.html
│ │ ├── SnapApiTest.html
│ │ ├── TransactionApiTest.html
│ │ ├── mockupdata
│ │ │ ├── Constant.html
│ │ │ ├── DataMockup.html
│ │ │ ├── package-frame.html
│ │ │ ├── package-summary.html
│ │ │ └── package-tree.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ ├── package-tree.html
│ │ ├── proxy
│ │ ├── ProxyConfig.html
│ │ ├── ProxyConfigBuilder.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── service
│ │ ├── MidtransCoreApi.html
│ │ ├── MidtransIrisApi.html
│ │ ├── MidtransSnapApi.html
│ │ ├── impl
│ │ │ ├── MidtransCoreApiImpl.html
│ │ │ ├── MidtransIrisApiImpl.html
│ │ │ ├── MidtransSnapApiImpl.html
│ │ │ ├── package-frame.html
│ │ │ ├── package-summary.html
│ │ │ └── package-tree.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ └── utils
│ │ ├── Utility.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
├── constant-values.html
├── deprecated-list.html
├── help-doc.html
├── index-files
│ ├── index-1.html
│ ├── index-10.html
│ ├── index-11.html
│ ├── index-12.html
│ ├── index-13.html
│ ├── index-14.html
│ ├── index-15.html
│ ├── index-16.html
│ ├── index-17.html
│ ├── index-18.html
│ ├── index-19.html
│ ├── index-2.html
│ ├── index-20.html
│ ├── index-21.html
│ ├── index-22.html
│ ├── index-3.html
│ ├── index-4.html
│ ├── index-5.html
│ ├── index-6.html
│ ├── index-7.html
│ ├── index-8.html
│ └── index-9.html
├── index.html
├── overview-frame.html
├── overview-summary.html
├── overview-tree.html
├── package-list
├── script.js
├── serialized-form.html
└── stylesheet.css
├── example
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── midtrans
│ │ ├── sample
│ │ ├── SampleApplication.java
│ │ ├── SampleCoreApi.java
│ │ ├── SampleIrisApi.java
│ │ ├── SampleSnapApi.java
│ │ ├── controller
│ │ │ ├── CoreApiController.java
│ │ │ ├── HomeController.java
│ │ │ ├── IrisController.java
│ │ │ ├── MobileSdkBackendController.java
│ │ │ ├── SnapController.java
│ │ │ └── TokenizationSdkController.java
│ │ └── data
│ │ │ ├── Constant.java
│ │ │ └── DataMockup.java
│ │ └── snapbi
│ │ ├── SnapBiCancel.java
│ │ ├── SnapBiDirectDebitPayment.java
│ │ ├── SnapBiQris.java
│ │ ├── SnapBiRefund.java
│ │ ├── SnapBiStatus.java
│ │ ├── SnapBiVa.java
│ │ └── SnapBiWebhookServer.java
│ └── resources
│ ├── application.properties
│ └── templates
│ ├── coreapi
│ ├── core-api.html
│ ├── credit-card.html
│ └── gopay.html
│ ├── fragments
│ └── header.html
│ ├── index.html
│ ├── iris
│ ├── create-payout.html
│ └── index.html
│ ├── layout.html
│ ├── mobile
│ └── mobile-sdk.html
│ └── snap
│ ├── check-out.html
│ └── snap.html
├── library
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── midtrans
│ │ │ ├── Config.java
│ │ │ ├── ConfigBuilder.java
│ │ │ ├── ConfigFactory.java
│ │ │ ├── Midtrans.java
│ │ │ ├── httpclient
│ │ │ ├── APIHttpClient.java
│ │ │ ├── CoreApi.java
│ │ │ ├── IrisApi.java
│ │ │ ├── SnapApi.java
│ │ │ ├── TransactionApi.java
│ │ │ └── error
│ │ │ │ └── MidtransError.java
│ │ │ ├── proxy
│ │ │ ├── ProxyConfig.java
│ │ │ └── ProxyConfigBuilder.java
│ │ │ ├── service
│ │ │ ├── MidtransCoreApi.java
│ │ │ ├── MidtransIrisApi.java
│ │ │ ├── MidtransSnapApi.java
│ │ │ └── impl
│ │ │ │ ├── MidtransCoreApiImpl.java
│ │ │ │ ├── MidtransIrisApiImpl.java
│ │ │ │ └── MidtransSnapApiImpl.java
│ │ │ ├── snapbi
│ │ │ ├── SnapBi.java
│ │ │ ├── SnapBiApiRequestor.java
│ │ │ └── SnapBiConfig.java
│ │ │ └── utils
│ │ │ └── Utility.java
│ └── resources
│ │ └── version.properties
│ └── test
│ ├── java
│ └── com
│ │ └── midtrans
│ │ └── java
│ │ ├── ConcurrentTest.java
│ │ ├── ConfigGlobalTest.java
│ │ ├── ConfigTest.java
│ │ ├── ConfigViaBuilderTest.java
│ │ ├── CoreApiTest.java
│ │ ├── IrisApiTest.java
│ │ ├── MidtransCoreApiTest.java
│ │ ├── MidtransIrisApiTest.java
│ │ ├── MidtransSnapApiTest.java
│ │ ├── SnapApiTest.java
│ │ ├── TransactionApiTest.java
│ │ └── mockupdata
│ │ ├── Constant.java
│ │ └── DataMockup.java
│ └── resources
│ └── junit-platform.properties
├── mvnw
├── mvnw.cmd
└── pom.xml
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 | **/test-launch.config
7 |
8 | # BlueJ files
9 | *.ctxt
10 |
11 | # Mobile Tools for Java (J2ME)
12 | .mtj.tmp/
13 |
14 | # Package Files #
15 | *.jar
16 | *.war
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 | *.iml
22 | **/*.vsix
23 |
24 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
25 | hs_err_pid*
26 |
27 |
28 | **/.idea/
29 | **/node_modules/
30 | .DS_Store
31 | target/
32 | .classpath
33 | .project
34 | .settings
35 | **/.checkstyle
36 | target/
37 | bin/
38 | **/lib/
39 | out/
40 | server/
41 |
42 | jdtls/
43 |
44 | !java-extension/.mvn/wrapper/maven-wrapper.jar
45 |
46 | out
47 | node_modules
48 | *.vsix
49 | .vscode-test
50 | resources/templates/css/**
51 | resources/templates/js/**
52 | resources/templates/fonts/**
53 | dist
54 |
55 | ## Maven:
56 | !.mvn/wrapper/maven-wrapper.jar
57 | /.mvn/
58 | /mvnw
59 | /mvnw.bat
60 | mvnw.cmd
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | before_install: cd library
3 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## CHANGELOG MIDTRANS JAVA LIBRARY
2 |
3 | ## v3.2.1 (October 16, 2024)
4 |
5 | Feature:
6 | - New method to verify webhook notification
7 |
8 | ## v3.2.0 (September 24, 2024)
9 |
10 | Feature:
11 | - New method to support SnapBi for direct debit, va, and qris.
12 |
13 | -
14 | ## v3.0.0 (April 13, 2021)
15 |
16 | Feature:
17 | - new static method CoreApi, SnapApi, IrisApi, TransactionApi
18 | - can change, TimeUnit for http connection settings
19 | - can set global config via Midtrans class
20 | - can add custom headers with config class
21 | - validation for server-key empty, contain whitespace
22 |
23 | Improvement:
24 | - handle okhttp raw error/exception via MidtransError exception class
25 |
26 | Notable changes:
27 | - Migrate from retrofit to okhttp as http client
28 | - Migrate repo host from jcenter/bintray to maven central
29 |
30 | ## v2.1.1 (April 27, 2020)
31 |
32 | Feature:
33 |
34 | - API Iris disbursement
35 | - Payment BIN API
36 | - Set Connection Pool & Keep alive connection
37 | - Set header X-Idempotency-key for Iris and Idempotency-Key for Payment
38 | - Set `X-Append-Notification`: to add new notification url(s) alongside the settings on dashboard
39 | - Set `X-Override-Notification`: to use new notification url(s) disregarding the settings on dashboard
40 | - Library version on `User-Agent` header
41 |
42 | Improvement:
43 |
44 | - Change logic for setup headers
45 | - Remove versioning path from base URL, move to `String API_VERSION` in CoreAPI, SnapAPI interface class
46 | - Improve conditional logic for HttpLoggingInterceptors. Now all debugging response will be handled only from HttpLoggingInterceptors Which can show logs request and response information
47 |
48 | Bugs fix:
49 | - Failure/error response from Midtrans api result in empty json.
50 |
51 | ## v1.1.1 (Feb 3, 2020)
52 |
53 | Improvement:
54 |
55 | HttpLoggingInterceptor: Which can show logs request and response information. This feature This feature is disabled by default on production mode.
56 |
57 | ## v1.1.0 (Nov 27, 2019)
58 |
59 | Feature:
60 |
61 | - Allow HTTP Proxy config
62 | - Allow set connectionTimeout
63 | - Allow set readTimeout
64 | - Allow set writeTimeout
65 |
66 | ## v1.0.0 (Sep 25, 2019) New release
67 |
68 | Feature:
69 | - CoreAPI basic functionality
70 | - Snap API basic functionality
71 | - Include Spring project example
72 | - Basic usage sample on Readme
73 | - Release via Bintray maven
74 |
75 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 MIDTRANS PT
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-minimal
--------------------------------------------------------------------------------
/docs/allclasses-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes
7 |
8 |
9 |
10 |
11 |
12 | All Classes
13 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/docs/allclasses-noframe.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes
7 |
8 |
9 |
10 |
11 |
12 | All Classes
13 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/docs/com/midtrans/httpclient/error/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.httpclient.error
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
Exceptions
15 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/com/midtrans/httpclient/error/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.httpclient.error
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
74 |
75 |
76 | -
77 |
78 | Exception Summary
79 |
80 | Exception |
81 | Description |
82 |
83 |
84 |
85 | MidtransError |
86 |
87 | MidtransError class to catch error messages
88 | |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
113 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/docs/com/midtrans/httpclient/error/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.httpclient.error Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
83 | - java.lang.Throwable (implements java.io.Serializable)
84 |
85 | - java.lang.Exception
86 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
114 |
141 |
142 |
143 |
144 |
--------------------------------------------------------------------------------
/docs/com/midtrans/httpclient/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.httpclient
7 |
8 |
9 |
10 |
11 |
12 |
13 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/docs/com/midtrans/httpclient/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.httpclient Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
89 |
90 |
91 |
92 |
93 |
110 |
137 |
138 |
139 |
140 |
--------------------------------------------------------------------------------
/docs/com/midtrans/java/mockupdata/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.java.mockupdata
7 |
8 |
9 |
10 |
11 |
12 |
13 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/com/midtrans/java/mockupdata/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.java.mockupdata
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
74 |
75 |
76 | -
77 |
78 | Class Summary
79 |
80 | Class |
81 | Description |
82 |
83 |
84 |
85 | Constant |
86 | |
87 |
88 |
89 | DataMockup |
90 | |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
115 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/docs/com/midtrans/java/mockupdata/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.java.mockupdata Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
83 | - com.midtrans.java.mockupdata.Constant
84 | - com.midtrans.java.mockupdata.DataMockup
85 |
86 |
87 |
88 |
89 |
90 |
107 |
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/docs/com/midtrans/java/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.java
7 |
8 |
9 |
10 |
11 |
12 |
13 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/docs/com/midtrans/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans
7 |
8 |
9 |
10 |
11 |
12 |
13 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docs/com/midtrans/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
88 |
89 |
90 |
91 |
92 |
109 |
110 |
111 | - Prev
112 | - Next
113 |
114 |
118 |
121 |
122 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/docs/com/midtrans/proxy/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.proxy
7 |
8 |
9 |
10 |
11 |
12 |
13 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/com/midtrans/proxy/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.proxy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
74 |
75 |
76 | -
77 |
78 | Class Summary
79 |
80 | Class |
81 | Description |
82 |
83 |
84 |
85 | ProxyConfig |
86 |
87 | Merchant proxy configuration
88 | |
89 |
90 |
91 | ProxyConfigBuilder |
92 |
93 | Proxy configuration builder
94 | |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
119 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/docs/com/midtrans/proxy/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.proxy Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
86 |
87 |
88 |
89 |
90 |
107 |
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/docs/com/midtrans/service/impl/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.service.impl
7 |
8 |
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/com/midtrans/service/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.service
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
Interfaces
15 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/com/midtrans/service/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.service
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
74 |
75 |
76 | -
77 |
78 | Interface Summary
79 |
80 | Interface |
81 | Description |
82 |
83 |
84 |
85 | MidtransCoreApi |
86 |
87 | Gateway for midtrans CoreAPI
88 | |
89 |
90 |
91 | MidtransIrisApi |
92 | |
93 |
94 |
95 | MidtransSnapApi |
96 |
97 | Gateway for midtrans SnapAPI
98 | |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
123 |
150 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/docs/com/midtrans/service/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.service Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Interface Hierarchy
80 |
85 |
86 |
87 |
104 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/docs/com/midtrans/utils/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.utils
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/com/midtrans/utils/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.utils
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
74 |
75 |
76 | -
77 |
78 | Class Summary
79 |
80 | Class |
81 | Description |
82 |
83 |
84 |
85 | Utility |
86 | |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
111 |
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/docs/com/midtrans/utils/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.midtrans.utils Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
83 | - com.midtrans.utils.Utility
84 |
85 |
86 |
87 |
88 |
89 |
106 |
107 |
108 | - Prev
109 | - Next
110 |
111 |
115 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Generated Documentation (Untitled)
7 |
60 |
61 |
75 |
76 |
--------------------------------------------------------------------------------
/docs/overview-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Overview List
7 |
8 |
9 |
10 |
11 |
12 |
13 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/docs/package-list:
--------------------------------------------------------------------------------
1 | com.midtrans
2 | com.midtrans.httpclient
3 | com.midtrans.httpclient.error
4 | com.midtrans.java
5 | com.midtrans.java.mockupdata
6 | com.midtrans.proxy
7 | com.midtrans.service
8 | com.midtrans.service.impl
9 | com.midtrans.utils
10 |
--------------------------------------------------------------------------------
/docs/script.js:
--------------------------------------------------------------------------------
1 | function show(type)
2 | {
3 | count = 0;
4 | for (var key in methods) {
5 | var row = document.getElementById(key);
6 | if ((methods[key] & type) != 0) {
7 | row.style.display = '';
8 | row.className = (count++ % 2) ? rowColor : altColor;
9 | }
10 | else
11 | row.style.display = 'none';
12 | }
13 | updateTabs(type);
14 | }
15 |
16 | function updateTabs(type)
17 | {
18 | for (var value in tabs) {
19 | var sNode = document.getElementById(tabs[value][0]);
20 | var spanNode = sNode.firstChild;
21 | if (value == type) {
22 | sNode.className = activeTableTab;
23 | spanNode.innerHTML = tabs[value][1];
24 | }
25 | else {
26 | sNode.className = tableTab;
27 | spanNode.innerHTML = "" + tabs[value][1] + "";
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/docs/serialized-form.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Serialized Form
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
74 |
111 |
112 |
129 |
130 |
131 | - Prev
132 | - Next
133 |
134 |
138 |
141 |
142 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
--------------------------------------------------------------------------------
/example/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.midtrans
7 | sample-application
8 | 2.0.1
9 | war
10 |
11 |
12 | org.springframework.boot
13 | spring-boot-starter-parent
14 | 2.1.7.RELEASE
15 |
16 |
17 |
18 |
19 | UTF-8
20 | 1.8
21 |
22 |
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-starter-thymeleaf
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | nz.net.ultraq.thymeleaf
34 | thymeleaf-layout-dialect
35 | 2.3.0
36 |
37 |
38 |
39 |
40 | org.springframework.boot
41 | spring-boot-starter-test
42 | test
43 |
44 |
45 | com.midtrans
46 | java-library
47 | 3.2.1
48 | compile
49 |
50 |
51 |
52 |
53 |
54 |
55 | org.springframework.boot
56 | spring-boot-maven-plugin
57 |
58 |
59 | com.heroku.sdk
60 | heroku-maven-plugin
61 |
62 | midtrans-java
63 |
64 |
65 |
66 |
67 | 2.0.16
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/example/src/main/java/com/midtrans/sample/SampleApplication.java:
--------------------------------------------------------------------------------
1 | package com.midtrans.sample;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.boot.builder.SpringApplicationBuilder;
7 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
8 |
9 | @SpringBootApplication
10 | public class SampleApplication extends SpringBootServletInitializer {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(SampleApplication.class, args);
14 | }
15 |
16 | @Override
17 | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
18 | return builder.sources(SampleApplication.class);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/example/src/main/java/com/midtrans/sample/SampleCoreApi.java:
--------------------------------------------------------------------------------
1 | package com.midtrans.sample;
2 |
3 | import com.midtrans.Config;
4 | import com.midtrans.ConfigFactory;
5 | import com.midtrans.Midtrans;
6 | import com.midtrans.httpclient.CoreApi;
7 | import com.midtrans.httpclient.error.MidtransError;
8 | import com.midtrans.sample.data.DataMockup;
9 | import com.midtrans.service.MidtransCoreApi;
10 | import org.json.JSONObject;
11 |
12 | import java.util.Map;
13 |
14 | import static com.midtrans.sample.data.Constant.sandboxClientKey;
15 | import static com.midtrans.sample.data.Constant.sandboxServerKey;
16 |
17 | public class SampleCoreApi {
18 |
19 | public static void main(String[] args) throws MidtransError {
20 | DataMockup dataMockup = new DataMockup();
21 | dataMockup.setPaymentType("gopay");
22 |
23 | /*
24 | Core Api Request with global config
25 | */
26 | RequestWithCoreApiAndGlobalConfig(dataMockup.initDataMock());
27 |
28 | /*
29 | Core Api Request with options config
30 | */
31 | RequestWithCoreApiAndConfigOptions(dataMockup.initDataMock());
32 |
33 | /*
34 | Api Request with MidtransCoreApi object and specific config
35 | */
36 | RequestWithMidtransCoreApiObject(dataMockup.initDataMock());
37 | }
38 |
39 |
40 | private static void RequestWithCoreApiAndGlobalConfig(Map request) throws MidtransError {
41 | /*
42 | Set configuration globally
43 | */
44 | Midtrans.serverKey = sandboxServerKey;
45 | Midtrans.clientKey = sandboxClientKey;
46 |
47 | /*
48 | Api Request with static method using Global Config
49 | */
50 | JSONObject result = CoreApi.chargeTransaction(request);
51 | System.out.println(result);
52 | }
53 |
54 | private static void RequestWithCoreApiAndConfigOptions(Map request) throws MidtransError {
55 | /*
56 | Initiate Config Object
57 | */
58 | Config configOptions = Config.builder()
59 | .setServerKey(sandboxServerKey)
60 | .setClientKey(sandboxClientKey)
61 | .setIsProduction(false)
62 | .build();
63 |
64 | /*
65 | Api request with static method using Config Options
66 | */
67 |
68 | JSONObject result = CoreApi.chargeTransaction(request, configOptions);
69 | System.out.println(result);
70 | }
71 |
72 | private static void RequestWithMidtransCoreApiObject(Map request) throws MidtransError {
73 | /*
74 | Initiate MidtransCoreApi Object with minimal config, also you can initiate config, with config builder.
75 | */
76 | MidtransCoreApi coreApi = new ConfigFactory(new Config(sandboxServerKey, sandboxClientKey, false)).getCoreApi();
77 |
78 | /*
79 | Api request to Midtrans API
80 | */
81 | JSONObject result = coreApi.chargeTransaction(request);
82 | System.out.println(result);
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/example/src/main/java/com/midtrans/sample/SampleIrisApi.java:
--------------------------------------------------------------------------------
1 | package com.midtrans.sample;
2 |
3 | import com.midtrans.Config;
4 | import com.midtrans.ConfigFactory;
5 | import com.midtrans.httpclient.IrisApi;
6 | import com.midtrans.httpclient.error.MidtransError;
7 | import com.midtrans.service.MidtransIrisApi;
8 | import org.json.JSONObject;
9 |
10 | import static com.midtrans.sample.data.Constant.*;
11 |
12 | public class SampleIrisApi {
13 |
14 | public static void main(String[] args) throws MidtransError {
15 | /*
16 | Iris Api Request with options config
17 | */
18 | RequestWithIrisApiAndConfigOptions();
19 |
20 | /*
21 | Api Request via MidtransIrisApi object with minimal config
22 | */
23 | RequestWithMidtransIrisApiObject();
24 | }
25 |
26 |
27 | private static void RequestWithIrisApiAndConfigOptions() throws MidtransError {
28 | /*
29 | Initiate Config Object
30 | */
31 | Config configOptions = Config.builder()
32 | .setServerKey(sandboxCreatorKey)
33 | .setIsProduction(false)
34 | .build();
35 |
36 | /*
37 | Api request with static method using Config Options
38 | */
39 | JSONObject result = IrisApi.getBalance(configOptions);
40 | System.out.println(result);
41 | }
42 |
43 |
44 | private static void RequestWithMidtransIrisApiObject() throws MidtransError {
45 | /*
46 | Initiate MidtransSnapApi Object with minimal config, also you can initiate config with config builder.
47 | */
48 | MidtransIrisApi irisApi = new ConfigFactory(new Config(sandboxCreatorKey, null, false)).getIrisApi();
49 |
50 | /*
51 | Api request to Midtrans API
52 | */
53 | JSONObject result = irisApi.getBalance();
54 | System.out.println(result);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/example/src/main/java/com/midtrans/sample/SampleSnapApi.java:
--------------------------------------------------------------------------------
1 | package com.midtrans.sample;
2 |
3 | import com.midtrans.Config;
4 | import com.midtrans.ConfigFactory;
5 | import com.midtrans.Midtrans;
6 | import com.midtrans.httpclient.SnapApi;
7 | import com.midtrans.httpclient.error.MidtransError;
8 | import com.midtrans.sample.data.DataMockup;
9 | import com.midtrans.service.MidtransSnapApi;
10 | import org.json.JSONObject;
11 |
12 | import java.util.Map;
13 |
14 | import static com.midtrans.sample.data.Constant.sandboxClientKey;
15 | import static com.midtrans.sample.data.Constant.sandboxServerKey;
16 |
17 | public class SampleSnapApi {
18 |
19 | public static void main(String[] args) throws MidtransError {
20 | DataMockup dataMockup = new DataMockup();
21 | dataMockup.setPaymentType("gopay");
22 |
23 | /*
24 | Snap Api Request with global config
25 | */
26 | RequestWithSnapApiAndGlobalConfig(dataMockup.initDataMock());
27 |
28 | /*
29 | Snap Api Request with options config
30 | */
31 | RequestWithSnapApiAndConfigOptions(dataMockup.initDataMock());
32 |
33 | /*
34 | Api Request with MidtransSnapApi object and specific config
35 | */
36 | RequestWithMidtransSnapApiObject(dataMockup.initDataMock());
37 | }
38 |
39 |
40 | private static void RequestWithSnapApiAndGlobalConfig(Map request) throws MidtransError {
41 | /*
42 | Set configuration globally
43 | */
44 | Midtrans.serverKey = sandboxServerKey;
45 | Midtrans.clientKey = sandboxClientKey;
46 |
47 | /*
48 | Api Request with static method using Global Config
49 | */
50 | JSONObject result = SnapApi.createTransaction(request);
51 | System.out.println(result);
52 | }
53 |
54 | private static void RequestWithSnapApiAndConfigOptions(Map request) throws MidtransError {
55 | /*
56 | Initiate Config Object
57 | */
58 | Config configOptions = Config.builder()
59 | .setServerKey(sandboxServerKey)
60 | .setClientKey(sandboxClientKey)
61 | .setIsProduction(false)
62 | .build();
63 |
64 | /*
65 | Api request with static method using Config Options
66 | */
67 | JSONObject result = SnapApi.createTransaction(request, configOptions);
68 | System.out.println(result);
69 | }
70 |
71 | private static void RequestWithMidtransSnapApiObject(Map request) throws MidtransError {
72 | /*
73 | Initiate MidtransSnapApi Object with minimal config, also you can initiate config, with config builder.
74 | */
75 | MidtransSnapApi snapApi = new ConfigFactory(new Config(sandboxServerKey, sandboxClientKey, false)).getSnapApi();
76 |
77 | /*
78 | Api request to Midtrans API
79 | */
80 | JSONObject result = snapApi.createTransaction(request);
81 | System.out.println(result);
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/example/src/main/java/com/midtrans/sample/controller/HomeController.java:
--------------------------------------------------------------------------------
1 | package com.midtrans.sample.controller;
2 |
3 | import com.midtrans.sample.data.DataMockup;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RequestMethod;
9 | import org.springframework.web.bind.annotation.RequestParam;
10 |
11 | import java.util.Map;
12 |
13 |
14 | @Controller
15 | public class HomeController {
16 |
17 | String clientKey = "SB-Mid-client-nKsqvar5cn60u2Lv";
18 |
19 | @Autowired
20 | private DataMockup dataMockup;
21 |
22 | @RequestMapping(value = "/", method = RequestMethod.GET)
23 | public String home() {
24 | return index();
25 | }
26 |
27 | @RequestMapping(value = "/index", method = RequestMethod.GET)
28 | private String index() {
29 | return "index";
30 | }
31 |
32 | @RequestMapping(value = "/mobile-sdk", method = RequestMethod.GET)
33 | private String mobileSdk() {
34 | return "mobile/mobile-sdk";
35 | }
36 |
37 | @RequestMapping(value = "/api/core-api", method = RequestMethod.GET)
38 | public String coreApi(Model model) {
39 | Map objectMap = dataMockup.initDataMock();
40 | model.addAttribute("data", objectMap);
41 | return "coreapi/core-api";
42 | }
43 |
44 | @RequestMapping(value = "/api/checkout", method = RequestMethod.GET)
45 | public String checkOut(@RequestParam(value = "paymentType") String typePayment,
46 | Model model) {
47 | Map result = dataMockup.initDataMock();
48 | model.addAttribute("result", result);
49 | model.addAttribute("clientKey", clientKey);
50 | if (typePayment.equals("cc")) {
51 | return "coreapi/credit-card";
52 | } else if (typePayment.equals("gopay")) {
53 | return "coreapi/gopay";
54 | }
55 | return "redirect:/api/core-api";
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/example/src/main/java/com/midtrans/sample/controller/MobileSdkBackendController.java:
--------------------------------------------------------------------------------
1 | package com.midtrans.sample.controller;
2 |
3 | import com.midtrans.Config;
4 | import com.midtrans.httpclient.error.MidtransError;
5 | import com.midtrans.httpclient.SnapApi;
6 | import com.midtrans.httpclient.TransactionApi;
7 | import org.json.JSONObject;
8 | import org.springframework.http.HttpStatus;
9 | import org.springframework.http.MediaType;
10 | import org.springframework.http.ResponseEntity;
11 | import org.springframework.web.bind.annotation.PostMapping;
12 | import org.springframework.web.bind.annotation.RequestBody;
13 | import org.springframework.web.bind.annotation.RestController;
14 |
15 | import java.util.Map;
16 |
17 | import static com.midtrans.sample.data.Constant.sandboxServerKey;
18 |
19 | /**
20 | * This is sample springboot controller for implement Midtrans mobile SDK.
21 | * You need to setup Frontend (Midtrans SDK Config) into your mobile app that using Midtrans mobile SDK.
22 | *
23 | * more details: https://mobile-docs.midtrans.com/#getting-started
24 | */
25 | @RestController
26 | public class MobileSdkBackendController {
27 |
28 | /**
29 | * Midtrans java sample use, Using static method and Midtrans Config {@link Config}.
30 | * This is a new static method, the config will use for request Snap token on Midtrans API static (SnapApi class).
31 | * {@link SnapApi}
32 | * Sample use on mobile sdk backend Controller @line 47
33 | *
34 | * also you can put others config, like enableLog, timeConnect, proxy, idempotent-key, etc.
35 | */
36 | private Config configOptions = Config.builder()
37 | .setServerKey(sandboxServerKey)
38 | .setIsProduction(false)
39 | .setPaymentOverrideNotification("https://midtrans-java.herokuapp.com/payment-status-notification-handler")
40 | .build();
41 |
42 |
43 | // API `/charge` for mobile SDK to get Snap Token
44 | @PostMapping(value = "/charge", produces = MediaType.APPLICATION_JSON_VALUE)
45 | public ResponseEntity