Changes for page API

Last modified by David Persson on 2022/08/11 10:43
From empty
To version 12.1
edited by David Persson
on 2020/01/16 23:45
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +API
Parent
... ... @@ -1,0 +1,1 @@
1 +Main.credit-account.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.XWikiGuest
1 +xwiki:XWiki.dap
Default language
... ... @@ -1,0 +1,1 @@
1 +en
Tags
... ... @@ -1,0 +1,1 @@
1 +px-custom-page-content
Content
... ... @@ -1,0 +1,163 @@
1 +(% class="jumbotron" %)
2 +(((
3 +(% class="container" %)
4 +(((
5 +Integrate to **PayEx Credit Account API **
6 +)))
7 +)))
8 +
9 +== ChangeLog ==
10 +
11 +
12 +== Glossary ==
13 +
14 +*
15 +
16 +(% class="wikigeneratedid" %)
17 +== Resource overview ==
18 +
19 +[[image:1579214755752-602.png||height="744" width="407"]]
20 +
21 +== Introduction ==
22 +
23 +The credit-account functions i divided in three different apis.
24 +
25 +* [[Acquiring>>doc:.credit-account-acquiring.WebHome]] - Functions to create reservations and transactions on an account.
26 +* [[Onboarding>>doc:.credit-account-onboardings.WebHome]] - Functions to list possible account types, onboard/create new accounts including the signing process
27 +* [[Account >>doc:.credit-account.WebHome]]- Functions to view details and interact with a specific account
28 +
29 +=== REST-full pattern guidance ===
30 +
31 +(% class="lead" %)
32 +The resources follows REST-full patterns including hyper-media links, we use hyper-media and backend-for-frontend principles to impose business rules and reduce duplication of business logic. Errors uses HTTP friendly status codes as well as detailed "problem+json" responses.
33 +
34 +----
35 +
36 +==== Basic resources ====
37 +
38 +(% class="box" %)
39 +(((
40 +//Basic resources uses the common HTTP patterns for GET, POST, PUT, PATCH, DELETE.//
41 +)))
42 +
43 +Requests __**without**__ specific resource identifier - f.ex. /ledger/credit-account/v1/XXX/accounts
44 +
45 +* HTTP GET - Returns a list of resources
46 +* HTTP POST - Creates a new resource
47 +
48 +Requests __**with**__ specific //__resource identifier__// - f.ex. /ledger/credit-account/v1/XXX/accounts///__1234568__//
49 +
50 +* HTTP GET - Returns a specific resource
51 +* HTTP PUT - Updates a specific resource
52 +* HTTP PATCH - Partially updates a specific resource
53 +* HTTP DELETE - Deletes a specific resource
54 +
55 +==== Operation resources ====
56 +
57 +(% class="box" %)
58 +(((
59 +//Functions that cannot be mapped directly to resources are called "Operation Resources" they only support HTTP POST//.
60 +)))
61 +
62 +Requests __**without**__ specific resource identifier operates on the list
63 +
64 +* HTTP POST - f.ex. /ledger/credit-account/v1/XXX/accounts/generate-summary - Generates a summary
65 +
66 +Requests __**with**__ specific resource identifier operates on a resource
67 +
68 +* HTTP POST - f.ex. /ledger/credit-account/v1/XXX/accounts/1234568/initiates-termination - Starts termination of an account
69 +
70 +==== Hyper-media response ====
71 +
72 +The response will include a list of operations that is possible to perform. Below is an example when a HTTP-GET Request is issued to retrieve information on an account. The response includes an "operations" property with a list of possible possible operations. The list of operations returned only contains business-rule and access-control validated operations. In the sample below the only allowed way to interact with the resource is to issue "patch" requests to modify fields. Different states as well as access permissions on the resource affect which operations are returned.
73 +
74 +
75 +{{code language="javascript" title="**Hyper-media response sample**"}}
76 +{
77 + "@id": "/ledger/credit-account/v1/501/accounts/1234567", //Resource identifier
78 + //Fields...
79 + "operations" : [
80 + {
81 + "rel" : "partial-update",
82 + "method" : "patch",
83 + "href" : "/ledger/credit-account-onboardings/v1/501/accounts/123456"
84 + }
85 + ]
86 +}
87 +{{/code}}
88 +
89 +
90 +(% class="box successmessage" %)
91 +(((
92 +**Tip:** As an implementing consumer of the api **operations** should be taken into consideration rather than trying to determine possible operation based on other basic resource properties. By following this tip we: minimize duplication of business logic, simplify maintenance when business rules change, have a clear separation of concerns.
93 +)))
94 +
95 +----
96 +
97 +=== Problems ===
98 +
99 +(% class="box" %)
100 +(((
101 +Errors uses HTTP friendly status codes as well as detailed "problem+json" responses. All errors that can be avoided by the client is in the **"HTTP status 4XX"** ragne, all errors that must be fixed by payex is in the **"HTTP status 5XX"** range. All errors contains an instance-id, the instance-id should be provided in support questions to simplify the support process.
102 +)))
103 +
104 +
105 +If an error occur or any validation failed, a "problem" response will be returned.
106 +Below is a list of problems that can occur:
107 +
108 +**HttpStatus 401 Unauthorized**
109 +
110 +* Token expired
111 +* Token invalid
112 +* SellerNumber does not match token
113 +* CompanyNumber does not match token
114 +
115 +**HttpStatus 400 Error**
116 +
117 +* Validation: Argument required
118 +* Validation: Invalid value
119 +
120 +**HttpStatus 422 Unprocessable entity**
121 +
122 +* Authorization declined
123 +
124 +**HttpStatus 409 Conflict**
125 +
126 +* Invoice already authorized
127 +* Duplicate InvoiceNumber
128 +* Authorization is cancelled
129 +* Authorization already captured
130 +* Authorization has expired
131 +* Insufficient debited amount XXX
132 +
133 +**HttpStatus 501 NotImplemented**
134 +
135 +* CompanyNumber XXX not configured
136 +* SellerNumber XXX not configured at PayEx
137 +* CompanyNumber XXX missing configuration
138 +
139 +**HttpStatus 404 NotFound**
140 +
141 +* Authorization not found
142 +
143 +==== Sample ====
144 +
145 +Below is an example of a problem that will be returned if buyer##.nationalConsumerIdentifier.value## is not valid in the authorization post request.
146 +
147 +{{code language="http" title="**Response**"}}
148 +HTTP/1.1 400 Error
149 +Content-Type: application/problem+json
150 +
151 +{
152 + "Type": "http://[DNS]/ledger/invoice-purchase/problems/validation",
153 + "Title": "A validation error occurred",
154 + "Status": 400, //Fel status code..
155 + "Instance": "dd07e588-70c8-4b27-95f5-020cc2968c06",
156 + "Detail": "A validation error occurred. Please fix the problems mentioned in the 'problems' property below.",
157 + "Problems": [
158 + {
159 + "buyer.nationalConsumerIdentifier.value": "Not a valid SE nationalConsumerIdentifier"
160 + }
161 + ]
162 +}
163 +{{/code}}
1579214755752-602.png
Author
... ... @@ -1,0 +1,1 @@
1 +xwiki:XWiki.dap
Size
... ... @@ -1,0 +1,1 @@
1 +0 bytes
Content