Изменения документа ../credit-account
Изменил последним Helge Dahl 2020/02/06 17:55
От версии 3.3
отредактировано David Persson
на 2019/12/04 10:15
на 2019/12/04 10:15
К версии 4.1
отредактировано David Persson
на 2019/12/04 10:25
на 2019/12/04 10:25
Комментарий к изменению: К данной версии нет комментариев
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -222,36 +222,67 @@ 222 222 223 223 {{/code}} 224 224 225 -== Cr edits ==225 +== Cards == 226 226 227 -To credit an existing invoice you first need retreive the specific authorization resource (get request). If the authorization has been captured and is valid for crediting the response will contain an URL to the ##credits## resource. To complete the credit you need to call this URL with a post request containing the credit details. 228 228 229 -[[image:InvoicePurchase external - Credit.svg||height="443" width="844"]] 230 - 231 -To credit a captured authorization (with authorizationId 123 in the example below) we need to perform a post request as below 232 - 233 233 {{code language="http" title="**Request**"}} 234 -POST /ledger/ invoice-purchase/v1/XXX/authorization/123/credits HTTP/1.1229 +POST /ledger/credit-account/v1/XXX/accounts/123/cards HTTP/1.1 235 235 Host: - 236 236 Authorization: Bearer <Token> 237 237 Content-Type: application/json 238 238 234 + 235 +{{/code}} 236 + 237 + 238 +{{code language="http" title="**Response**"}} 239 +HTTP/1.1 201 Created 240 +Content-Type: application/json 241 + 239 239 { 240 - "amountInclVat" : 100 243 + "cards" : [ 244 + {"PanTrunc" : "85479**********648", "@id" : "/ledger/credit-account/v1/501/accounts/123456/cards/741"}, 245 + {"PanTrunc" : "12345**********456", "@id" : "/ledger/credit-account/v1/501/accounts/123456/cards/742"} 246 + ] 241 241 } 242 242 {{/code}} 243 243 244 -If the credit succeeds, it should respond with something like the following: 250 +{{code language="http" title="**Request**"}} 251 +POST /ledger/credit-account/v1/XXX/accounts/123/cards/456 HTTP/1.1 252 +Host: - 253 +Authorization: Bearer <Token> 254 +Content-Type: application/json 245 245 256 + 257 +{{/code}} 258 + 259 + 246 246 {{code language="http" title="**Response**"}} 247 247 HTTP/1.1 201 Created 248 248 Content-Type: application/json 249 249 250 250 { 251 - "amountInclVat" : 100, 252 - "creditedAmount" : 100, 253 - "@id" : "/ledger/invoice-purchase/v1/501/authorizations/credits/456", 254 - "parentHREF": "/ledger/invoice-purchase/v1/501/authorizations/123" 265 + "token": "954c8699-b38f-47a2-b568-668b8837dad8", 266 + "PanTrunc": "85479*********648", 267 + "deleted" : false, 268 + "mainCard": true, 269 + "cardHolder" : { 270 + "number" : "123465", 271 + "name": "test testsson", 272 + "nationalConsumerIdentifier": { 273 + "value": "19101010-1010", 274 + "countryCode": "SE" 275 + } 276 + }, 277 + "@id": "/ledger/credit-account/v1/501/accounts/123456/cards/741", 278 + "parentHREF": "/ledger/credit-account/v1/501/accounts/123456", 279 + "operation" : [ 280 + { 281 + "rel" : "delete-card-info", 282 + "method" : "patch", 283 + "href" : "/ledger/credit-account/v1/501/accounts/123456/cards/741" 284 + } 285 + ] 255 255 } 256 256 {{/code}} 257 257