Documentation ¶
Overview ¶
Package v1 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router gin.IRouter, si ServerInterface)
- func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
- type Error
- type GetLivenessParams
- type GinServerOptions
- type Liveness
- type LivenessStatus
- type MiddlewareFunc
- type MpesaCallbackMessage
- type N400
- type N401
- type N403
- type N404
- type N500
- type PaymentsServer
- type PostPaymentCallbackJSONRequestBody
- type ServerInterface
- type ServerInterfaceWrapper
- type XRequestID
- type XRequestIdType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router gin.IRouter, si ServerInterface)
RegisterHandlers creates http.Handler with routing matching OpenAPI spec.
func RegisterHandlersWithOptions ¶
func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
RegisterHandlersWithOptions creates http.Handler with additional options
Types ¶
type Error ¶
type Error struct { Code int `json:"code"` Domain *string `json:"domain,omitempty"` Message string `json:"message"` Reason *string `json:"reason,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }
Error General API Error Response
type GetLivenessParams ¶
type GetLivenessParams struct { // XRequestID X-Request-ID XRequestID *XRequestID `json:"X-Request-ID,omitempty"` }
GetLivenessParams defines parameters for GetLiveness.
type GinServerOptions ¶
type GinServerOptions struct { BaseURL string Middlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
GinServerOptions provides options for the Gin server.
type Liveness ¶
type Liveness struct { Message *string `json:"message,omitempty" validate:"required"` Status *LivenessStatus `json:"status,omitempty" validate:"required,oneof=UP DOWN"` }
Liveness defines model for Liveness.
type LivenessStatus ¶
type LivenessStatus string
LivenessStatus defines model for Liveness.Status.
const ( DOWN LivenessStatus = "DOWN" UP LivenessStatus = "UP" )
Defines values for LivenessStatus.
type MiddlewareFunc ¶
type MpesaCallbackMessage ¶
type MpesaCallbackMessage struct { BillRefNumber *string `json:"billRefNumber,omitempty"` BusinessShortCode *string `json:"businessShortCode,omitempty"` FirstName *string `json:"firstName,omitempty"` InvoiceNumber *string `json:"invoiceNumber,omitempty"` LastName *string `json:"lastName,omitempty"` MiddleName *string `json:"middleName,omitempty"` Msisdn *string `json:"msisdn,omitempty"` OrgAccountBalance *string `json:"orgAccountBalance,omitempty"` ResultCode *string `json:"resultCode,omitempty"` ResultDesc *string `json:"resultDesc,omitempty"` ThirdPartyTransID *string `json:"thirdPartyTransID,omitempty"` TransAmount *string `json:"transAmount,omitempty"` TransID *string `json:"transID,omitempty"` TransactionStatus *string `json:"transactionStatus,omitempty"` TransactionType *string `json:"transactionType,omitempty"` }
MpesaCallbackMessage defines model for MpesaCallbackMessage.
type PaymentsServer ¶
func NewPaymentsServer ¶
func NewPaymentsServer(log *zerolog.Logger, build string) *PaymentsServer
NewPaymentsServer constructs a new PaymentsServer.
func (*PaymentsServer) GetLiveness ¶
func (p *PaymentsServer) GetLiveness(c *gin.Context, params GetLivenessParams)
GetLiveness returns a simple UP message to indicate the service is running.
func (*PaymentsServer) PostPaymentCallback ¶
func (p *PaymentsServer) PostPaymentCallback(c *gin.Context)
PostPaymentCallback handles the callback from the payment provider.
type PostPaymentCallbackJSONRequestBody ¶
type PostPaymentCallbackJSONRequestBody = MpesaCallbackMessage
PostPaymentCallbackJSONRequestBody defines body for PostPaymentCallback for application/json ContentType.
type ServerInterface ¶
type ServerInterface interface { // Get liveness status // (GET /liveness) GetLiveness(c *gin.Context, params GetLivenessParams) // Callback endpoint for M-Pesa payment updates // (POST /payments/callback) PostPaymentCallback(c *gin.Context) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetLiveness ¶
func (siw *ServerInterfaceWrapper) GetLiveness(c *gin.Context)
GetLiveness operation middleware
func (*ServerInterfaceWrapper) PostPaymentCallback ¶
func (siw *ServerInterfaceWrapper) PostPaymentCallback(c *gin.Context)
PostPaymentCallback operation middleware