Changes for page Payment API
Last modified by Thomas Warren on 2020/01/23 13:50
From version 29.25
edited by Thomas Warren
on 2020/01/23 09:04
on 2020/01/23 09:04
To version 29.26
edited by Thomas Warren
on 2020/01/23 11:12
on 2020/01/23 11:12
Change comment: There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,20 +2,23 @@ 1 - 2 2 ## Overview 3 ------- 4 4 3 +--- 4 + 5 5 This API is a gateway for receiving payments through our system. It's ment to simplify external integration between different domains such as credit cards, prepaid cards and value codes. 6 6 7 7 ## Swagger documentation 8 ------- 9 9 9 +--- 10 + 10 10 * [VasPublicPaymentApi](https://stage-evc.payex.com/payment-api/swagger-ui.html) 11 11 12 12 # Public Payment API Client 13 ------- 14 14 15 +--- 16 + 15 15 ## Prerequisites 16 ------- 17 17 19 +--- 20 + 18 18 * Java 11 19 19 * VueJS 20 20 * Maven ... ... @@ -21,8 +21,9 @@ 21 21 * Postgres 22 22 23 23 ## Project setup 24 ------- 25 25 28 +--- 29 + 26 26 vas-payment-api-client 27 27 ├─┬ backend → backend module with Spring Boot code 28 28 │ ├── src ... ... @@ -33,11 +33,13 @@ 33 33 └── pom.xml → Maven parent pom managing both modules 34 34 35 35 ## Security 36 ------- 37 37 38 -<details> 39 - <summary>Oauth2:</summary> 41 +— 40 40 43 + Oauth2: 44 + 45 + 46 + 41 41 VasPublicPaymentApi requires an OAuth2 access token for interaction. 42 42 This application automatically handles token fetching and refreshing by using [Spring Security](https://docs.spring.io/spring-security-oauth2-boot/docs/current/reference/htmlsingle/#boot-features-security-custom-user-info-client). 43 43 Configuration values are set in [application.yml](./backend/src/main/resources/application.yml): ... ... @@ -79,11 +79,16 @@ 79 79 } 80 80 ``` 81 81 82 - </details>88 + 83 83 84 -<details> 85 - <summary>HMAC:</summary> 90 + 86 86 92 + 93 + 94 + HMAC: 95 + 96 + 97 + 87 87 The API also requires HMAC authentication to be present in a request. 88 88 In this client the HMAC value is automatically calculated by [HmacSignatureBuilder.java](./backend/src/main/java/com/payex/vas/demo/config/security/HmacSignatureBuilder.java) and added to all outgoing requests in [ExternalRequestInterceptor.java](./backend/src/main/java/com/payex/vas/demo/config/ExternalRequestInterceptor.java) 89 89 ... ... @@ -92,7 +92,7 @@ 92 92 Expected `Hmac` header format is: 93 93 94 94 ```text 95 -HmacSHA512 <user>:<nonce>:<digest> 106 +HmacSHA512 <user>:<nonce>:<digest> 96 96 ``` 97 97 98 98 where `digest` is a Base64 formatted HMAC SHA512 digest of the following string: ... ... @@ -121,12 +121,12 @@ 121 121 -H 'Transmission-Time: 2019-06-18T09:19:15.208257Z' \ 122 122 -H 'Session-Id: e0447bd2-ab64-b456-b17b-da274bb8428e' \ 123 123 -d '{ 124 - 125 - 126 - 127 - 128 - 129 - 135 + "accountIdentifier": { 136 + "accountKey": "7013369000000000000", 137 + "cvc": "123", 138 + "expiryDate": "2019-12-31", 139 + "instrument": "GC" 140 + } 130 130 }' 131 131 ``` 132 132 ... ... @@ -141,12 +141,12 @@ 141 141 21a0213e-30eb-85ab-b355-a310d31af30e 142 142 2019-06-18T09:19:15.208257Z 143 143 { 144 - 145 - 146 - 147 - 148 - 149 - 155 + "accountIdentifier": { 156 + "accountKey": "7013360000000000000", 157 + "cvc": "123", 158 + "expiryDate": "2020-12-31", 159 + "instrument": "CC" 160 + } 150 150 } 151 151 ``` 152 152 ... ... @@ -227,11 +227,14 @@ 227 227 228 228 ``` 229 229 230 - </details>241 + 231 231 243 + 244 + 232 232 ### Security documentation 233 ------- 234 234 247 +--- 248 + 235 235 * [OAuth2](https://oauth.net/2/) 236 236 * [Client Credentials](https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/) 237 237 * [The RESTful CookBook: HMAC](http://restcookbook.com/Basics/loggingin/) ... ... @@ -238,10 +238,11 @@ 238 238 * [HMAC - Wikipedia](https://en.wikipedia.org/wiki/HMAC) 239 239 240 240 ## First App run 241 ------- 242 242 256 +--- 257 + 243 243 **NB! The application expects a PostgreSQL server to be running on localhost with a username `test` and password `test` to exist.** 244 -**This can automatically be configured if PostgreSQL server is started in docker with environment variables `POSTGRES_USER=test` and `POSTGRES_PASSWORD=test` are set (See [docker-compose.yml](./docker-compose.yml)).** 259 +**This can automatically be configured if PostgreSQL server is started in docker with environment variables `POSTGRES_USER=test` and `POSTGRES_PASSWORD=test` are set (See [docker-compose.yml](https://github.com/PayEx/vas-payment-api-client/blob/master/docker-compose.yml)[[./docker-compose.yml]]).** 245 245 246 246 Inside the root directory, do a: 247 247 ... ... @@ -258,22 +258,25 @@ 258 258 Now go to <http://localhost:8080/> and have a look at your new client. 259 259 260 260 ## Testing application 261 ------- 262 262 277 +--- 278 + 263 263 1. Add a new card with provided details from PayEx. 264 264 1. Click on newly added Card 265 265 1. Click on "initiate payment" to create a new transaction 266 266 267 267 ## Build docker image: 268 ------- 269 269 285 +--- 286 + 270 270 ```bash 271 271 mvn --projects backend clean compile jib:dockerBuild 272 272 ``` 273 273 274 274 ## Deploy to local docker: 275 ------- 276 276 293 +--- 294 + 277 277 ```bash 278 278 docker-compose up -d 279 279 ```