|
1 | | -/** |
2 | | -Open Bank Project - API |
3 | | -Copyright (C) 2011-2019, TESOBE GmbH. |
4 | | -
|
5 | | -This program is free software: you can redistribute it and/or modify |
6 | | -it under the terms of the GNU Affero General Public License as published by |
7 | | -the Free Software Foundation, either version 3 of the License, or |
8 | | -(at your option) any later version. |
9 | | -
|
10 | | -This program is distributed in the hope that it will be useful, |
11 | | -but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | | -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | | -GNU Affero General Public License for more details. |
14 | | -
|
15 | | -You should have received a copy of the GNU Affero General Public License |
16 | | -along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | | -
|
18 | | -Email: contact@tesobe.com |
19 | | -TESOBE GmbH. |
20 | | -Osloer Strasse 16/17 |
21 | | -Berlin 13359, Germany |
22 | | -
|
23 | | -This product includes software developed at |
24 | | -TESOBE (http://www.tesobe.com/) |
25 | | -
|
26 | | - */ |
27 | 1 | package code.api.v2_0_0 |
28 | 2 |
|
29 | 3 | import scala.language.reflectiveCalls |
30 | 4 | import code.api.OBPRestHelper |
31 | | -import code.api.util.APIUtil.{OBPEndpoint, getAllowedEndpoints} |
32 | | -import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus} |
| 5 | +import code.api.util.APIUtil.OBPEndpoint |
33 | 6 | import code.api.util.VersionedOBPApis |
34 | | -import code.api.v1_3_0.APIMethods130 |
35 | | -import code.api.v1_4_0.APIMethods140 |
| 7 | +import code.api.v1_4_0.OBPAPI1_4_0 |
36 | 8 | import code.util.Helper.MdcLoggable |
| 9 | +import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus} |
37 | 10 |
|
38 | | -object OBPAPI2_0_0 extends OBPRestHelper with APIMethods130 with APIMethods140 with APIMethods200 with MdcLoggable with VersionedOBPApis{ |
39 | | - |
| 11 | +/* |
| 12 | +This file defines which endpoints from all the versions are available in v2.0.0. |
| 13 | +All v2.0.0 endpoints have been migrated to Http4s200 — this object is retained |
| 14 | +only for resource-doc aggregation and the Lift dispatch registry. |
| 15 | + */ |
| 16 | +object OBPAPI2_0_0 extends OBPRestHelper with MdcLoggable with VersionedOBPApis { |
40 | 17 |
|
41 | | - val version : ApiVersion = ApiVersion.v2_0_0 // "2.0.0" |
| 18 | + val version: ApiVersion = ApiVersion.v2_0_0 |
42 | 19 | val versionStatus = ApiVersionStatus.DEPRECATED.toString |
43 | 20 |
|
| 21 | + val Implementations2_0_0 = Http4s200.Implementations2_0_0 |
44 | 22 |
|
45 | | - // Note: Since we pattern match on these routes, if two implementations match a given url the first will match |
46 | | - |
47 | | - lazy val endpointsOf1_2_1 = List( |
48 | | - Implementations1_2_1.getBanks, |
49 | | - Implementations1_2_1.bankById, |
50 | | - // Now in 2_0_0 |
51 | | -// Implementations1_2_1.allAccountsAllBanks, |
52 | | -// Implementations1_2_1.privateAccountsAllBanks, |
53 | | -// Implementations1_2_1.publicAccountsAllBanks, |
54 | | -// Implementations1_2_1.allAccountsAtOneBank, |
55 | | -// Implementations1_2_1.privateAccountsAtOneBank, |
56 | | -// Implementations1_2_1.publicAccountsAtOneBank, |
57 | | -// Implementations1_2_1.accountById, |
58 | | - Implementations1_2_1.updateAccountLabel, |
59 | | - Implementations1_2_1.getViewsForBankAccount, |
60 | | - Implementations1_2_1.createViewForBankAccount, |
61 | | - Implementations1_2_1.updateViewForBankAccount, |
62 | | - Implementations1_2_1.deleteViewForBankAccount, |
63 | | -// Implementations1_2_1.getPermissionsForBankAccount, |
64 | | -// Implementations1_2_1.getPermissionForUserForBankAccount, |
65 | | - Implementations1_2_1.addPermissionForUserForBankAccountForMultipleViews, |
66 | | - Implementations1_2_1.addPermissionForUserForBankAccountForOneView, |
67 | | - Implementations1_2_1.removePermissionForUserForBankAccountForOneView, |
68 | | - Implementations1_2_1.removePermissionForUserForBankAccountForAllViews, |
69 | | - Implementations1_2_1.getOtherAccountsForBankAccount, |
70 | | - Implementations1_2_1.getOtherAccountByIdForBankAccount, |
71 | | - Implementations1_2_1.getOtherAccountMetadata, |
72 | | - Implementations1_2_1.getCounterpartyPublicAlias, |
73 | | - Implementations1_2_1.addCounterpartyPublicAlias, |
74 | | - Implementations1_2_1.updateCounterpartyPublicAlias, |
75 | | - Implementations1_2_1.deleteCounterpartyPublicAlias, |
76 | | - Implementations1_2_1.getOtherAccountPrivateAlias, |
77 | | - Implementations1_2_1.addOtherAccountPrivateAlias, |
78 | | - Implementations1_2_1.updateCounterpartyPrivateAlias, |
79 | | - Implementations1_2_1.deleteCounterpartyPrivateAlias, |
80 | | - Implementations1_2_1.addCounterpartyMoreInfo, |
81 | | - Implementations1_2_1.updateCounterpartyMoreInfo, |
82 | | - Implementations1_2_1.deleteCounterpartyMoreInfo, |
83 | | - Implementations1_2_1.addCounterpartyUrl, |
84 | | - Implementations1_2_1.updateCounterpartyUrl, |
85 | | - Implementations1_2_1.deleteCounterpartyUrl, |
86 | | - Implementations1_2_1.addCounterpartyImageUrl, |
87 | | - Implementations1_2_1.updateCounterpartyImageUrl, |
88 | | - Implementations1_2_1.deleteCounterpartyImageUrl, |
89 | | - Implementations1_2_1.addCounterpartyOpenCorporatesUrl, |
90 | | - Implementations1_2_1.updateCounterpartyOpenCorporatesUrl, |
91 | | - Implementations1_2_1.deleteCounterpartyOpenCorporatesUrl, |
92 | | - Implementations1_2_1.addCounterpartyCorporateLocation, |
93 | | - Implementations1_2_1.updateCounterpartyCorporateLocation, |
94 | | - Implementations1_2_1.deleteCounterpartyCorporateLocation, |
95 | | - Implementations1_2_1.addCounterpartyPhysicalLocation, |
96 | | - Implementations1_2_1.updateCounterpartyPhysicalLocation, |
97 | | - Implementations1_2_1.deleteCounterpartyPhysicalLocation, |
98 | | - Implementations1_2_1.getTransactionsForBankAccount, |
99 | | - Implementations1_2_1.getTransactionByIdForBankAccount, |
100 | | - Implementations1_2_1.getTransactionNarrative, |
101 | | - Implementations1_2_1.addTransactionNarrative, |
102 | | - Implementations1_2_1.updateTransactionNarrative, |
103 | | - Implementations1_2_1.deleteTransactionNarrative, |
104 | | - Implementations1_2_1.getCommentsForViewOnTransaction, |
105 | | - Implementations1_2_1.addCommentForViewOnTransaction, |
106 | | - Implementations1_2_1.deleteCommentForViewOnTransaction, |
107 | | - Implementations1_2_1.getTagsForViewOnTransaction, |
108 | | - Implementations1_2_1.addTagForViewOnTransaction, |
109 | | - Implementations1_2_1.deleteTagForViewOnTransaction, |
110 | | - Implementations1_2_1.getImagesForViewOnTransaction, |
111 | | - Implementations1_2_1.addImageForViewOnTransaction, |
112 | | - Implementations1_2_1.deleteImageForViewOnTransaction, |
113 | | - Implementations1_2_1.getWhereTagForViewOnTransaction, |
114 | | - Implementations1_2_1.addWhereTagForViewOnTransaction, |
115 | | - Implementations1_2_1.updateWhereTagForViewOnTransaction, |
116 | | - Implementations1_2_1.deleteWhereTagForViewOnTransaction, |
117 | | - Implementations1_2_1.getOtherAccountForTransaction |
118 | | - //Implementations1_2_1.makePayment |
119 | | - ) |
120 | | - |
121 | | - // New in 1.3.0 |
122 | | - val endpointsOf1_3_0 = Implementations1_3_0.getCards :: |
123 | | - Implementations1_3_0.getCardsForBank:: |
124 | | - Nil |
125 | | - |
126 | | - // New in 1.4.0 |
127 | | - // Possible Endpoints 2.0.0 (less info about the views) |
128 | | - val endpointsOf1_4_0 = List( Implementations1_4_0.getCustomer, |
129 | | - // Now in 2.0.0 Implementations1_4_0.addCustomer, |
130 | | - Implementations1_4_0.getCustomersMessages, |
131 | | - Implementations1_4_0.addCustomerMessage, |
132 | | - Implementations1_4_0.getBranches, |
133 | | - Implementations1_4_0.getAtms, |
134 | | - Implementations1_4_0.getProducts, |
135 | | - Implementations1_4_0.getCrmEvents, |
136 | | - Implementations1_4_0.getTransactionRequestTypes) |
137 | | - |
138 | | - // Updated in 2.0.0 (less info about the views) |
139 | | - val endpointsOf2_0_0 = List( |
140 | | - Implementations2_0_0.root, |
141 | | - Implementations2_0_0.getPrivateAccountsAllBanks, |
142 | | - Implementations2_0_0.corePrivateAccountsAllBanks, |
143 | | - Implementations2_0_0.publicAccountsAllBanks, |
144 | | - Implementations2_0_0.getPrivateAccountsAtOneBank, |
145 | | - Implementations2_0_0.corePrivateAccountsAtOneBank, // this is /my accounts |
146 | | - Implementations2_0_0.privateAccountsAtOneBank, // This was missing for a while from v2.0.0 |
147 | | - Implementations2_0_0.publicAccountsAtOneBank, |
148 | | - // Updated in 2.0.0 (added sorting and better guards / error messages) |
149 | | - Implementations2_0_0.accountById, |
150 | | - Implementations2_0_0.getPermissionsForBankAccount, |
151 | | - Implementations2_0_0.getPermissionForUserForBankAccount, |
152 | | - // New in 2.0.0 |
153 | | - Implementations2_0_0.getKycDocuments, |
154 | | - Implementations2_0_0.getKycMedia, |
155 | | - Implementations2_0_0.getKycStatuses, |
156 | | - Implementations2_0_0.getKycChecks, |
157 | | - Implementations2_0_0.getSocialMediaHandles, |
158 | | - Implementations2_0_0.addKycDocument, |
159 | | - Implementations2_0_0.addKycMedia, |
160 | | - Implementations2_0_0.addKycStatus, |
161 | | - Implementations2_0_0.addKycCheck, |
162 | | - Implementations2_0_0.addSocialMediaHandle, |
163 | | - Implementations2_0_0.getCoreAccountById, |
164 | | - Implementations2_0_0.getCoreTransactionsForBankAccount, |
165 | | - Implementations2_0_0.createAccount, |
166 | | - Implementations2_0_0.getTransactionTypes, |
167 | | - Implementations2_0_0.createUser, |
168 | | -// Implementations2_0_0.createMeeting, |
169 | | -// Implementations2_0_0.getMeetings, |
170 | | -// Implementations2_0_0.getMeeting, |
171 | | - Implementations2_0_0.createCustomer, |
172 | | - Implementations2_0_0.getCurrentUser, |
173 | | - Implementations2_0_0.getUser, |
174 | | - Implementations2_0_0.createUserCustomerLinks, |
175 | | - Implementations2_0_0.addEntitlement, |
176 | | - Implementations2_0_0.getEntitlements, |
177 | | - Implementations2_0_0.deleteEntitlement, |
178 | | - Implementations2_0_0.getAllEntitlements, |
179 | | - Implementations2_0_0.elasticSearchWarehouse, |
180 | | - Implementations2_0_0.elasticSearchMetrics, |
181 | | - Implementations2_0_0.getCustomers |
182 | | - ) |
183 | | - |
184 | | - |
185 | | - val allResourceDocs = |
186 | | - Implementations2_0_0.resourceDocs ++ |
187 | | - Implementations1_4_0.resourceDocs ++ |
188 | | - Implementations1_3_0.resourceDocs ++ |
189 | | - Implementations1_2_1.resourceDocs |
190 | | - |
191 | | - // Filter the possible endpoints by the disabled / enabled Props settings and add them together |
192 | | - val routes : List[OBPEndpoint] = |
193 | | - getAllowedEndpoints(endpointsOf1_2_1, Implementations1_2_1.resourceDocs) ::: |
194 | | - getAllowedEndpoints(endpointsOf1_3_0, Implementations1_3_0.resourceDocs) ::: |
195 | | - getAllowedEndpoints(endpointsOf1_4_0, Implementations1_4_0.resourceDocs) ::: |
196 | | - getAllowedEndpoints(endpointsOf2_0_0, Implementations2_0_0.resourceDocs) |
197 | | - |
198 | | - |
199 | | - |
200 | | - registerRoutes(routes, allResourceDocs, apiPrefix) |
| 23 | + def allResourceDocs = collectResourceDocs(OBPAPI1_4_0.allResourceDocs, Http4s200.resourceDocs) |
201 | 24 |
|
202 | | - logger.info(s"version $version has been run! There are ${routes.length} routes.") |
| 25 | + val routes: List[OBPEndpoint] = Nil |
203 | 26 |
|
| 27 | + registerRoutes(routes, allResourceDocs, apiPrefix, true) |
204 | 28 |
|
| 29 | + logger.info(s"version $version has been run! There are ${routes.length} routes, ${allResourceDocs.length} allResourceDocs.") |
205 | 30 | } |
0 commit comments