-
Notifications
You must be signed in to change notification settings - Fork 28
/
webhook_handler.go
55 lines (49 loc) · 1.71 KB
/
webhook_handler.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package configurationwebhook
import (
"encoding/json"
)
// HandleAccountNotificationRequest creates a Notification object from the given JSON string
func HandleAccountHolderNotificationRequest(req string) (*AccountHolderNotificationRequest, error) {
res := AccountHolderNotificationRequest{}
err := json.Unmarshal([]byte(req), &res)
if err != nil {
return nil, err
}
return &res, nil
}
// HandleBalanceAccountNotificationRequest creates a Notification object from the given JSON string
func HandleBalanceAccountNotificationRequest(req string) (*BalanceAccountNotificationRequest, error) {
res := BalanceAccountNotificationRequest{}
err := json.Unmarshal([]byte(req), &res)
if err != nil {
return nil, err
}
return &res, nil
}
// HandleCardOrderNotificationRequest creates a Notification object from the given JSON string
func HandleCardOrderNotificationRequest(req string) (*CardOrderNotificationRequest, error) {
res := CardOrderNotificationRequest{}
err := json.Unmarshal([]byte(req), &res)
if err != nil {
return nil, err
}
return &res, nil
}
// HandlePaymentNotificationRequest creates a Notification object from the given JSON string
func HandlePaymentNotificationRequest(req string) (*PaymentNotificationRequest, error) {
res := PaymentNotificationRequest{}
err := json.Unmarshal([]byte(req), &res)
if err != nil {
return nil, err
}
return &res, nil
}
// HandleSweepconfigurationNotificationRequest creates a Notification object from the given JSON string
func HandleSweepConfigurationNotificationRequest(req string) (*SweepConfigurationNotificationRequest, error) {
res := SweepConfigurationNotificationRequest{}
err := json.Unmarshal([]byte(req), &res)
if err != nil {
return nil, err
}
return &res, nil
}