-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.go
32 lines (24 loc) · 1.13 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
Package maib provides tools to interact with the MAIB ECommerce system in a type safe way.
# Requirements
To use this module you should:
- Understand how MAIB ECommerce works
- Have a .pfx certificate
- Register as a merchant in MAIB
# Usage
1. Use [NewClient] to set up a [Client] that communicates with the MAIB ECommerce system.
2. Send a [Request] with [Client.Send] (The requests described in the ECommerce
documentation are implemented in the requests package).
3. Decode the returned map into a result struct with requests.DecodeResult.
# Error Handling
Use errors.As to check the type and the contents of the errors returned by [Client.Send]:
- types.ErrMalformedPayload is returned before sending the request if it
has failed validation.
- types.ErrMAIB is returned if the response has a non-200 code, or its
body starts with "error:".
- types.ErrParse is returned if the response has an invalid structure, or
a response field has an unexpected datatype.
See the example to get an understanding of the full flow.
[requests]: https://pkg.go.dev/github.com/NikSays/go-maib-ecomm/requests
*/
package maib