payments

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

HTTPClient is a concrete implmentation of an HTTP client which can communicate with the payments service

func NewHTTP

func NewHTTP(baseURL string) *HTTPClient

func (*HTTPClient) HealthCheck added in v0.0.7

func (h *HTTPClient) HealthCheck() bool

HealthCheck checks whether the payments API is up

func (*HTTPClient) MakePayment

func (h *HTTPClient) MakePayment(details *models.PaymentDetails) (*models.PaymentResponse, error)

MakePayment calls the payments api

type HealthCheckResponse added in v0.0.7

type HealthCheckResponse struct {
	Status string `json:"status"`
}

type PaymentRequest

type PaymentRequest struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Number string `json:"number"`
	Expiry string `json:"expiry"`
	CVC    string `json:"cvc"`
	// contains filtered or unexported fields
}

PaymentRequest defines the JSON request for the Payments API

func (*PaymentRequest) FromModel

func (pr *PaymentRequest) FromModel(m *models.PaymentDetails)

FromModel converts a graphql model into a payment request

func (*PaymentRequest) Read

func (pr *PaymentRequest) Read(p []byte) (n int, err error)

type PaymentResponse

type PaymentResponse struct {
	ID             string `json:"id"`
	Message        string `json:"message"`
	CardPlaintext  string `json:"card_plaintext"`
	CardCiphertext string `json:"card_ciphertext"`
}

func (*PaymentResponse) ToModel

func (pr *PaymentResponse) ToModel(m *models.PaymentResponse)

ToModel converts a go Struct into a payment response model

Jump to

Keyboard shortcuts

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