Documentation ¶
Index ¶
- Constants
- Variables
- func CheckProjectAuthRequestSignature(dispatch HandlerSet, ctx echo.Context, projectId string) error
- func ExtractBinderContext(ctx echo.Context) echo.Binder
- func ExtractRawBodyContext(ctx echo.Context) []byte
- func GetValidationError(err error) (rspErr billingpb.ResponseErrorMessage)
- func LogSrvCallFailedGRPC(log logger.Logger, err error, name, method string, req interface{})
- func NewManagementApiResponseError(code, msg string, details ...string) billingpb.ResponseErrorMessage
- func NewValidationError(details string) billingpb.ResponseErrorMessage
- func RequestResponseHeadersToString(headers map[string][]string) string
- func SetBinder(ctx echo.Context, binder echo.Binder)
- func SetRawBodyContext(ctx echo.Context, rawBody []byte)
- type Binder
- type Config
- type Dictionary
- type Groups
- type Handler
- type HandlerSet
- type Handlers
- type OrderJsonBinder
- type PaymentCreateProcessBinder
- type Services
- type Template
- type Validator
Constants ¶
View Source
const ( Prefix = "internal.dispatcher" UnmarshalKey = "dispatcher" UnmarshalGlobalConfigKey = "dispatcher.global" NoAuthGroupPath = "/api/v1" )
View Source
const ( RequestParameterId = "id" RequestParameterOrderId = "order_id" RequestParameterZipUsa = "zip_usa" RequestParameterReceiptId = "receipt_id" QueryParameterNameUtmMedium = "utm_medium" QueryParameterNameUtmCampaign = "utm_campaign" QueryParameterNameUtmSource = "utm_source" ErrorMessageMask = "field validation for '%s' failed on the '%s' tag" HeaderAcceptLanguage = "Accept-Language" HeaderUserAgent = "User-Agent" HeaderXApiSignatureHeader = "X-API-SIGNATURE" HeaderReferer = "referer" ErrorFieldService = "service" ErrorFieldMethod = "method" ErrorFieldRequest = "request" InternalErrorTemplate = "internal error" ValidationParameterOrderId = "OrderId" ValidationParameterOrderUuid = "OrderUuid" )
Variables ¶
View Source
var ( BinderDefault = &Binder{} EchoBinderDefault = &echo.DefaultBinder{} )
View Source
var ( ErrorUnknown = NewManagementApiResponseError("co000001", "unknown error. try request later") ErrorValidationFailed = NewManagementApiResponseError("co000002", "validation failed") ErrorInternal = NewManagementApiResponseError("co000003", InternalErrorTemplate) ErrorIncorrectOrderId = NewManagementApiResponseError("co000004", "incorrect order identifier") ErrorMessageSignatureHeaderIsEmpty = NewManagementApiResponseError("co000005", "header with request signature can't be empty") ErrorRequestParamsIncorrect = NewManagementApiResponseError("co000006", "incorrect request parameters") ErrorRequestDataInvalid = NewManagementApiResponseError("co000007", "request data invalid") ErrorMessageIncorrectZip = NewManagementApiResponseError("co000008", "incorrect zip code") ValidationErrors = map[string]billingpb.ResponseErrorMessage{ ValidationParameterOrderId: ErrorIncorrectOrderId, ValidationParameterOrderUuid: ErrorIncorrectOrderId, } )
Functions ¶
func CheckProjectAuthRequestSignature ¶
func CheckProjectAuthRequestSignature(dispatch HandlerSet, ctx echo.Context, projectId string) error
CheckProjectAuthRequestSignature
func ExtractBinderContext ¶
func ExtractBinderContext(ctx echo.Context) echo.Binder
ExtractBinderContext
func ExtractRawBodyContext ¶
func ExtractRawBodyContext(ctx echo.Context) []byte
ExtractRawBodyContext
func GetValidationError ¶
func GetValidationError(err error) (rspErr billingpb.ResponseErrorMessage)
GetValidationError
func LogSrvCallFailedGRPC ¶
func NewManagementApiResponseError ¶
func NewManagementApiResponseError(code, msg string, details ...string) billingpb.ResponseErrorMessage
NewManagementApiResponseError
func NewValidationError ¶
func NewValidationError(details string) billingpb.ResponseErrorMessage
NewValidationError
func RequestResponseHeadersToString ¶
RequestResponseHeadersToString
Types ¶
type Config ¶
type Config struct { CookieDomain string `envconfig:"COOKIE_DOMAIN" required:"true"` CookieName string `envconfig:"COOKIE_NAME" default:"_ps_ctkn"` AllowOrigin string `envconfig:"ALLOW_ORIGIN" default:"*"` // OrderInlineFormUrlMask url like a https://checkout.tst.pay.super.com/pay/order/ OrderInlineFormUrlMask string `envconfig:"ORDER_INLINE_FORM_URL_MASK" required:"true"` CustomerTokenCookiesLifetimeHours int64 `envconfig:"CUSTOMER_TOKEN_COOKIES_LIFETIME" default:"720"` }
type Dictionary ¶
type HandlerSet ¶
type HandlerSet struct { Services Services Validate *validator.Validate AwareSet provider.AwareSet }
HandlerSet
func (HandlerSet) BindAndValidate ¶
func (h HandlerSet) BindAndValidate(req interface{}, ctx echo.Context) *echo.HTTPError
BindAndValidate
func (HandlerSet) SrvCallHandler ¶
func (h HandlerSet) SrvCallHandler(req interface{}, err error, name, method string) *echo.HTTPError
SrvCallHandler returns error if present, otherwise response as JSON with 200 OK
type OrderJsonBinder ¶
type OrderJsonBinder struct{}
func (*OrderJsonBinder) Bind ¶
func (cb *OrderJsonBinder) Bind(i interface{}, ctx echo.Context) (err error)
Bind
type PaymentCreateProcessBinder ¶
type PaymentCreateProcessBinder struct{}
func (*PaymentCreateProcessBinder) Bind ¶
func (cb *PaymentCreateProcessBinder) Bind(i interface{}, ctx echo.Context) (err error)
Bind
Click to show internal directories.
Click to hide internal directories.