forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reprocess.go
36 lines (30 loc) · 884 Bytes
/
reprocess.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
package bridge
import (
"encoding/json"
"net/http"
)
// ReprocessRequest represents request made to /reprocess endpoint of bridge server
type ReprocessRequest struct {
OperationID string `form:"operation_id" valid:"required"`
// Force is required for reprocessing successful payments. Please use with caution!
Force bool `form:"force" valid:"-"`
}
func (r ReprocessRequest) Validate(params ...interface{}) error {
// No custom validations
return nil
}
// ReprocessResponse represents a response returned by /reprocess endpoint
type ReprocessResponse struct {
Status string `json:"status"`
Message string `json:"message,omitempty"`
}
func (r ReprocessResponse) HTTPStatus() int {
if r.Status == "ok" {
return http.StatusOK
} else {
return http.StatusBadRequest
}
}
func (r ReprocessResponse) Marshal() ([]byte, error) {
return json.MarshalIndent(r, "", " ")
}