Documentation ¶
Overview ¶
Package service contains the controllers used by the the API endpoints.
Index ¶
- Constants
- func IsExpired(paymentSession models.PaymentResourceRest, cfg *config.Config) (bool, error)
- type GovPayService
- func (gp GovPayService) CheckProvider(paymentResource *models.PaymentResourceRest) (*models.StatusResponse, ResponseType, error)
- func (gp *GovPayService) GenerateNextURLGovPay(req *http.Request, paymentResource *models.PaymentResourceRest) (string, ResponseType, error)
- func (gp *GovPayService) GetGovPayPaymentDetails(paymentResource *models.PaymentResourceRest) (*models.PaymentDetails, ResponseType, error)
- type PaymentService
- func (service *PaymentService) CreateExternalPaymentJourney(req *http.Request, paymentSession *models.PaymentResourceRest) (*models.ExternalPaymentJourney, ResponseType, error)
- func (service *PaymentService) CreatePaymentSession(req *http.Request, createResource models.IncomingPaymentResourceRequest) (*models.PaymentResourceRest, ResponseType, error)
- func (service *PaymentService) GetPaymentSession(req *http.Request, id string) (*models.PaymentResourceRest, ResponseType, error)
- func (service *PaymentService) PatchPaymentSession(req *http.Request, id string, ...) (ResponseType, error)
- func (service *PaymentService) StoreExternalPaymentStatusURI(req *http.Request, id string, externalPaymentStatusURI string) error
- type PaymentStatus
- type ResponseType
Constants ¶
const PaymentSessionKind = "payment-session#payment-session"
PaymentSessionKind is the value stored in the payment resource kind field
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GovPayService ¶
type GovPayService struct {
PaymentService PaymentService
}
GovPayService handles the specific functionality of integrating GovPay provider into Payment Sessions
func (GovPayService) CheckProvider ¶
func (gp GovPayService) CheckProvider(paymentResource *models.PaymentResourceRest) (*models.StatusResponse, ResponseType, error)
CheckProvider checks the status of the payment with GovPay provider
func (*GovPayService) GenerateNextURLGovPay ¶
func (gp *GovPayService) GenerateNextURLGovPay(req *http.Request, paymentResource *models.PaymentResourceRest) (string, ResponseType, error)
GenerateNextURLGovPay creates a gov pay session linked to the given payment session and stores the required details on the payment session
func (*GovPayService) GetGovPayPaymentDetails ¶
func (gp *GovPayService) GetGovPayPaymentDetails(paymentResource *models.PaymentResourceRest) (*models.PaymentDetails, ResponseType, error)
GetGovPayPaymentDetails gets the details of a GovPay payment
type PaymentService ¶
PaymentService contains the DAO for db access
func (*PaymentService) CreateExternalPaymentJourney ¶
func (service *PaymentService) CreateExternalPaymentJourney(req *http.Request, paymentSession *models.PaymentResourceRest) (*models.ExternalPaymentJourney, ResponseType, error)
CreateExternalPaymentJourney creates an external payment session with a Payment Provider that is given, e.g: GovPay
func (*PaymentService) CreatePaymentSession ¶
func (service *PaymentService) CreatePaymentSession(req *http.Request, createResource models.IncomingPaymentResourceRequest) (*models.PaymentResourceRest, ResponseType, error)
CreatePaymentSession creates a payment session and returns a journey URL for the calling app to redirect to
func (*PaymentService) GetPaymentSession ¶
func (service *PaymentService) GetPaymentSession(req *http.Request, id string) (*models.PaymentResourceRest, ResponseType, error)
GetPaymentSession retrieves the payment session with the given ID from the database
func (*PaymentService) PatchPaymentSession ¶
func (service *PaymentService) PatchPaymentSession(req *http.Request, id string, paymentResourceUpdateRest models.PaymentResourceRest) (ResponseType, error)
PatchPaymentSession updates an existing payment session with the data provided from the Rest model
func (*PaymentService) StoreExternalPaymentStatusURI ¶
func (service *PaymentService) StoreExternalPaymentStatusURI(req *http.Request, id string, externalPaymentStatusURI string) error
StoreExternalPaymentStatusURI stores a new value in the payment resource metadata for the ExternalPaymentStatusURI
type PaymentStatus ¶
type PaymentStatus int
PaymentStatus Enum Type
const ( Pending PaymentStatus = 1 + iota InProgress Paid NoFunds Failed Expired )
Enumeration containing all possible payment statuses
func (PaymentStatus) String ¶
func (paymentStatus PaymentStatus) String() string
type ResponseType ¶
type ResponseType int
ResponseType enumerates the types of authentication supported
const ( // InvalidData response InvalidData ResponseType = iota // Error response Error // Forbidden response Forbidden // NotFound response NotFound // Success response Success )
func (ResponseType) String ¶
func (a ResponseType) String() string
String representation of `ResponseType`