service

package
v1.1.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package service contains the controllers used by the the API endpoints.

Index

Constants

View Source
const PaymentSessionKind = "payment-session#payment-session"

PaymentSessionKind is the value stored in the payment resource kind field

Variables

This section is empty.

Functions

func IsExpired

func IsExpired(paymentSession models.PaymentResourceRest, cfg *config.Config) (bool, error)

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

type PaymentService struct {
	DAO    dao.DAO
	Config config.Config
}

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
	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`

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL