models

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: 1 Imported by: 0

Documentation

Overview

Package models contains the required data structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cancel

type Cancel struct {
	HREF   string `json:"href"`
	Method string `json:"method"`
}

Cancel contains a link to cancel the payment

type CostLinksDB

type CostLinksDB struct {
	Resource string `bson:"resource"`
	Self     string `bson:"self" validate:"required"`
}

CostLinksDB is a set of URLs related to the resource, including self

type CostResourceRest

type CostResourceRest struct {
	Amount                  string            `json:"amount"                    validate:"required"`
	AvailablePaymentMethods []string          `json:"available_payment_methods" validate:"required"`
	ClassOfPayment          []string          `json:"class_of_payment"          validate:"required"`
	Description             string            `json:"description"               validate:"required"`
	DescriptionIdentifier   string            `json:"description_identifier"    validate:"required"`
	ProductType             string            `json:"product_type"              validate:"required"`
	DescriptionValues       map[string]string `json:"description_values"`
}

CostResourceRest contains the details of an individual Cost Resource

type CostsRest

type CostsRest struct {
	Description      string             `json:"description"`
	Etag             string             `json:"etag"`
	Costs            []CostResourceRest `json:"items"`
	Kind             string             `json:"kind"`
	Links            PaymentLinksRest   `json:"links"`
	PaidAt           time.Time          `json:"paid_at"`
	PaymentReference string             `json:"payment_reference"`
	Status           string             `json:"status"`
	CompanyNumber    string             `json:"company_number"`
}

Costs contains details of all the Cost Resources

type CreatedByDB

type CreatedByDB struct {
	Email    string `bson:"email"`
	Forename string `bson:"forename"`
	ID       string `bson:"id"`
	Surname  string `bson:"surname"`
}

CreatedByDB is the user who is creating the payment session

type CreatedByRest

type CreatedByRest struct {
	Email    string `json:"email"`
	Forename string `json:"forename"`
	ID       string `json:"id"`
	Surname  string `json:"surname"`
}

CreatedByRest is the user who is creating the payment session

type Events

type Events struct {
	HREF   string `json:"href"`
	Method string `json:"method"`
}

Events contains a link to payment events

type ExternalPaymentJourney

type ExternalPaymentJourney struct {
	NextURL string `json:"NextURL"`
}

ExternalPaymentJourney contains the URL required to access external payment provider session

type GovPayLinks struct {
	Self        Self        `json:"self"`
	NextURL     NextURL     `json:"next_url"`
	NextURLPost NextURLPost `json:"next_url_post"`
	Events      Events      `json:"events"`
	Refunds     Refunds     `json:"refunds"`
	Cancel      Cancel      `json:"cancel"`
}

GovPayLinks contains links for this payment, including the next_url to continue the journey, and the link to check the status.

type IncomingExternalPaymentJourneyRequest

type IncomingExternalPaymentJourneyRequest struct {
	PaymentMethod string `json:"payment_method"`
	Resource      string `json:"resource"`
}

IncomingExternalPaymentJourneyRequest is the data received in the body of the incoming request

type IncomingGovPayResponse

type IncomingGovPayResponse struct {
	Amount            int               `json:"amount"`
	State             State             `json:"state"`
	Description       string            `json:"description"`
	Reference         string            `json:"reference"`
	Language          string            `json:"language"`
	PaymentID         string            `json:"payment_id"`
	PaymentProvider   string            `json:"payment_provider"`
	ReturnURL         string            `json:"return_url"`
	CreatedDate       string            `json:"created_date"`
	RefundSummary     RefundSummary     `json:"refund_summary"`
	SettlementSummary SettlementSummary `json:"settlement_summary"`
	DelayedCapture    bool              `json:"delayed_capture"`
	GovPayLinks       GovPayLinks       `json:"_links"`
	CardBrand         string            `json:"card_brand"`
}

IncomingGovPayResponse is the response expected back from GovPay after a payment session has been successfully initiated

type IncomingPaymentResourceRequest

type IncomingPaymentResourceRequest struct {
	RedirectURI string `json:"redirect_uri" validate:"required,url"`
	Reference   string `json:"reference"`
	Resource    string `json:"resource"     validate:"required,url"`
	State       string `json:"state"        validate:"required"`
}

IncomingPaymentResourceRequest is the data received in the body of the incoming request

type NextURL

type NextURL struct {
	HREF   string `json:"href"`
	Method string `json:"method"`
}

NextURL contains where to navigate the user next as a GET

type NextURLPost

type NextURLPost struct {
	PostType string `json:"type"`
	Params   Params `json:"params"`
	HREF     string `json:"href"`
	Method   string `json:"method"`
}

NextURLPost contains where to navigate the user next as a POST

type OutgoingGovPayRequest

type OutgoingGovPayRequest struct {
	Amount      int    `json:"amount"`
	Reference   string `json:"reference"`
	ReturnURL   string `json:"return_url"`
	Description string `json:"description"`
}

OutgoingGovPayRequest is the request sent to GovPay to initiate a payment session

type Params

type Params struct {
	ChargeTokenID string `json:"chargeTokenId"`
}

Params contains the charge token for the payment

type PaymentDetails

type PaymentDetails struct {
	CardType          string `json:"card_type"`
	ExternalPaymentID string `json:"external_payment_id"`
	TransactionDate   string `json:"transaction_date"`
	PaymentStatus     string `json:"payment_status"`
}

PaymentDetails is used by the payment-details endpoint to return card type and an auth number which is the payment id

type PaymentLinksDB

type PaymentLinksDB struct {
	Journey  string `bson:"journey"`
	Resource string `bson:"resource"`
	Self     string `bson:"self" validate:"required"`
}

PaymentLinksDB is a set of URLs related to the resource, including self

type PaymentLinksRest

type PaymentLinksRest struct {
	Journey  string `json:"journey"`
	Resource string `json:"resource"`
	Self     string `json:"self" validate:"required"`
}

PaymentLinksRest is a set of URLs related to the resource, including self

type PaymentResourceDB

type PaymentResourceDB struct {
	ID                       string                `bson:"_id"`
	RedirectURI              string                `bson:"redirect_uri"`
	State                    string                `bson:"state"`
	ExternalPaymentStatusURI string                `bson:"external_payment_status_url"`
	Data                     PaymentResourceDataDB `bson:"data"`
}

PaymentResourceDB contains all payment details to be stored in the DB

type PaymentResourceDataDB

type PaymentResourceDataDB struct {
	Amount                  string         `bson:"amount"`
	AvailablePaymentMethods []string       `bson:"available_payment_methods,omitempty"`
	CompletedAt             time.Time      `bson:"completed_at,omitempty"`
	CreatedAt               time.Time      `bson:"created_at,omitempty"`
	CreatedBy               CreatedByDB    `bson:"created_by"`
	Description             string         `bson:"description"`
	Links                   PaymentLinksDB `bson:"links"`
	PaymentMethod           string         `bson:"payment_method"`
	Reference               string         `bson:"reference,omitempty"`
	CompanyNumber           string         `bson:"company_number,omitempty"`
	Status                  string         `bson:"status"`
	Etag                    string         `bson:"etag"`
	Kind                    string         `bson:"kind"`
}

PaymentResourceDataDB is public facing payment details to be returned in the response

type PaymentResourceMetaDataRest

type PaymentResourceMetaDataRest struct {
	ID                       string
	RedirectURI              string
	State                    string
	ExternalPaymentStatusURI string
}

PaymentResourceMetaDataRest contains all metadata fields that are relevant to the payment resource but not part of the Rest resource

type PaymentResourceRest

type PaymentResourceRest struct {
	Amount                  string                      `json:"amount"`
	AvailablePaymentMethods []string                    `json:"available_payment_methods,omitempty"`
	CompletedAt             time.Time                   `json:"completed_at,omitempty"`
	CreatedAt               time.Time                   `json:"created_at,omitempty"`
	CreatedBy               CreatedByRest               `json:"created_by"`
	Description             string                      `json:"description"`
	Links                   PaymentLinksRest            `json:"links"`
	PaymentMethod           string                      `json:"payment_method,omitempty"`
	Reference               string                      `json:"reference,omitempty"`
	CompanyNumber           string                      `json:"company_number,omitempty"`
	Status                  string                      `json:"status"`
	Costs                   []CostResourceRest          `json:"costs"`
	Etag                    string                      `json:"etag"`
	Kind                    string                      `json:"kind"`
	MetaData                PaymentResourceMetaDataRest `json:"-"`
}

PaymentResourceRest is public facing payment details to be returned in the response

type RedirectParams

type RedirectParams struct {
	State  string
	Ref    string
	Status string
}

RedirectParams contains parameters for redirecting.

type RefundSummary

type RefundSummary struct {
	Status          string `json:"status"`
	AmountAvailable int    `json:"amount_available"`
	AmountSubmitted int    `json:"amount_submitted"`
}

RefundSummary is the refund status of the payment

type Refunds

type Refunds struct {
	HREF   string `json:"href"`
	Method string `json:"method"`
}

Refunds contains a link to payment refunds

type Self

type Self struct {
	HREF   string `json:"href"`
	Method string `json:"method"`
}

Self links to the payment

type SettlementSummary

type SettlementSummary struct {
	CaptureSubmitTime string `json:"capture_submit_time"`
	CapturedDate      string `json:"captured_date"`
}

SettlementSummary is the settlement status of the payment

type State

type State struct {
	Status   string `json:"status"`
	Finished bool   `json:"finished"`
	Code     string `json:"code"`
}

State is the current state of the payment

type StatusResponse

type StatusResponse struct {
	Status string
}

StatusResponse is the generic response

Jump to

Keyboard shortcuts

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