zooz

package module
v0.0.0-...-9b1604f Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

README

Zooz API client GoDoc Build Status Go Report Card

This repo contains Zooz API client written in Go.

Zooz API documentation: https://developers.paymentsos.com/docs/api

Before using this client you need to register and configure Zooz account: https://developers.paymentsos.com/docs/quick-start.html

How to install

Download package:

go get github.com/gojuno/go-zooz

Client uses github.com/pkg/errors, so you may need to download this package as well:

go get github.com/pkg/errors

How to use

To init client you will need private_key and app_id which you can get from your Zooz account profile.

import "github.com/gojuno/go-zooz"
...
// Init client
client := zooz.New(
	zooz.OptAppID("com.yourhost.go_client"),
	zooz.OptPrivateKey("a630518c-22da-4eaa-bb39-502ad7832030"),
)

// Create new customer
customer, customerErr := client.Customer().New(
	context.Background(),
	"customer_idempotency_key",
	&zooz.CustomerParams{
		CustomerReference: "1234",
		FirstName:         "John",
		LastName:          "Doe",
	},
)

// Create new payment method
paymentMethod, paymentMethodErr := client.PaymentMethod().New(
	context.Background(),
	"payment_method_idempotency_key",
	customer.ID,
	"918a917e-4cf9-4303-949c-d0cd7ff7f619",
)

// Delete customer
deleteCustomerErr := client.Customer().Delete(context.Background(), customer.ID)

Custom HTTP client

By default Zooz client uses http.DefaultClient. You can set custom HTTP client using zooz.OptHTTPClient option:

httpClient := &http.Client{
	Timeout: time.Minute,
}

client := zooz.New(
	zooz.OptAppID("com.yourhost.go_client"),
	zooz.OptPrivateKey("a630518c-22da-4eaa-bb39-502ad7832030"),
	zooz.OptHTTPClient(httpClient),
)

You can use any HTTP client, implementing zooz.HTTPClient interface with method Do(r *http.Request) (*http.Response, error). Built-in net/http client implements it, of course.

Test/live environment

Zooz supports test and live environment. Environment is defined by x-payments-os-env request header.

By default, client sends test value. You can redefine this value to live using zooz.OptEnv(zooz.EnvLive) option.

client := zooz.New(
	zooz.OptAppID("com.yourhost.go_client"),
	zooz.OptPrivateKey("a630518c-22da-4eaa-bb39-502ad7832030"),
	zooz.OptEnv(zooz.EnvLive),
)

Tokens

API methods for Tokens are not implemented in this client, because they are supposed to be used on client-side, not server-side. See example here: https://developers.paymentsos.com/docs/collecting-payment-details.html

Documentation

Overview

Package zooz contains Go client for Zooz API.

Zooz API documentation: https://developers.paymentsos.com/docs/api

Before using this client you need to register and configure Zooz account: https://developers.paymentsos.com/docs/quick-start.html

Index

Constants

View Source
const (

	// EnvTest is a value for test environment header
	EnvTest env = "test"
	// EnvLive is a value for live environment header
	EnvLive env = "live"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Category    string `json:"category"`
	Description string `json:"description"`
	MoreInfo    string `json:"more_info"`
}

APIError represents API error response. https://developers.paymentsos.com/docs/api#/introduction/responses/errors

func (APIError) String

func (e APIError) String() string

String implements stringer interface.

type AdditionalDetails

type AdditionalDetails map[string]string

AdditionalDetails is a set of any custom key-value info.

type Address

type Address struct {
	Country   string `json:"country,omitempty"`
	State     string `json:"state,omitempty"`
	City      string `json:"city,omitempty"`
	Line1     string `json:"line1,omitempty"`
	Line2     string `json:"line2,omitempty"`
	ZipCode   string `json:"zip_code,omitempty"`
	Title     string `json:"title,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	Phone     string `json:"phone,omitempty"`
	Email     string `json:"email,omitempty"`
}

Address is a set of fields describing customer address.

type Authorization

type Authorization struct {
	ID                         string                  `json:"id"`
	Result                     Result                  `json:"result"`
	Amount                     int64                   `json:"amount"`
	Created                    json.Number             `json:"created"`
	ReconciliationID           string                  `json:"reconciliation_id"`
	PaymentMethod              PaymentMethodHref       `json:"payment_method"`
	ThreeDSecureAttributes     *ThreeDSecureAttributes `json:"three_d_secure_attributes"`
	Installments               *Installments           `json:"installments"`
	ProviderData               ProviderData            `json:"provider_data"`
	ProviderSpecificData       map[string]interface{}  `json:"provider_specific_data"`
	OriginatingPurchaseCountry string                  `json:"originating_purchase_country"`
	IPAddress                  string                  `json:"ip_address"`
	Redirection                *Redirection            `json:"redirection"`
}

Authorization is a model of entity.

type AuthorizationClient

type AuthorizationClient struct {
	Caller Caller
}

AuthorizationClient is a client for work with Authorization entity. https://developers.paymentsos.com/docs/api#/reference/authorizations

func (*AuthorizationClient) Get

func (c *AuthorizationClient) Get(ctx context.Context, paymentID string, authorizationID string) (*Authorization, error)

Get returns Authorization entity.

func (*AuthorizationClient) GetList

func (c *AuthorizationClient) GetList(ctx context.Context, paymentID string) ([]Authorization, error)

GetList returns list of all Authorizations for given payment ID.

func (*AuthorizationClient) New

func (c *AuthorizationClient) New(ctx context.Context, idempotencyKey string, paymentID string, params *AuthorizationParams, clientInfo *ClientInfo) (*Authorization, error)

New creates new Authorization entity.

type AuthorizationParams

type AuthorizationParams struct {
	PaymentMethod          PaymentMethodDetails    `json:"payment_method"`
	MerchantSiteURL        string                  `json:"merchant_site_url,omitempty"`
	ReconciliationID       string                  `json:"reconciliation_id,omitempty"`
	ThreeDSecureAttributes *ThreeDSecureAttributes `json:"three_d_secure_attributes,omitempty"`
	Installments           *Installments           `json:"installments,omitempty"`
	ProviderSpecificData   map[string]interface{}  `json:"provider_specific_data,omitempty"`
}

AuthorizationParams is a set of params for creating entity.

type Caller

type Caller interface {
	Call(ctx context.Context, method, path string, headers map[string]string, reqObj interface{}, respObj interface{}) error
}

Caller makes HTTP call with given options and decode response into given struct. Client implements this interface and pass itself to entity clients. You may create entity clients with own caller for test purposes.

type Capture

type Capture struct {
	CaptureParams

	ID           string       `json:"id"`
	Result       Result       `json:"result"`
	Created      json.Number  `json:"created"`
	ProviderData ProviderData `json:"provider_data"`
}

Capture is a model of entity.

type CaptureClient

type CaptureClient struct {
	Caller Caller
}

CaptureClient is a client for work with Capture entity. https://developers.paymentsos.com/docs/api#/reference/captures

func (*CaptureClient) Get

func (c *CaptureClient) Get(ctx context.Context, paymentID string, captureID string) (*Capture, error)

Get returns Capture entity.

func (*CaptureClient) GetList

func (c *CaptureClient) GetList(ctx context.Context, paymentID string) ([]Capture, error)

GetList returns list of Captures for given payment ID.

func (*CaptureClient) New

func (c *CaptureClient) New(ctx context.Context, idempotencyKey string, paymentID string, params *CaptureParams) (*Capture, error)

New creates new Capture entity.

type CaptureParams

type CaptureParams struct {
	ReconciliationID string `json:"reconciliation_id,omitempty"`
	Amount           int64  `json:"amount,omitempty"`
}

CaptureParams is a set of params for creating entity.

type Charge

type Charge struct {
	ID                         string                  `json:"id"`
	Result                     Result                  `json:"result"`
	Amount                     int64                   `json:"amount"`
	Created                    json.Number             `json:"created"`
	ReconciliationID           string                  `json:"reconciliation_id"`
	PaymentMethod              PaymentMethodHref       `json:"payment_method"`
	ThreeDSecureAttributes     *ThreeDSecureAttributes `json:"three_d_secure_attributes"`
	Installments               *Installments           `json:"installments"`
	ProviderData               ProviderData            `json:"provider_data"`
	ProviderSpecificData       map[string]interface{}  `json:"provider_specific_data"`
	OriginatingPurchaseCountry string                  `json:"originating_purchase_country"`
	IPAddress                  string                  `json:"ip_address"`
	Redirection                *Redirection            `json:"redirection"`
}

Charge is a model of entity.

type ChargeClient

type ChargeClient struct {
	Caller Caller
}

ChargeClient is a client for work with Charge entity. https://developers.paymentsos.com/docs/api#/reference/charges

func (*ChargeClient) Get

func (c *ChargeClient) Get(ctx context.Context, paymentID string, chargeID string) (*Charge, error)

Get returns Charge entity.

func (*ChargeClient) GetList

func (c *ChargeClient) GetList(ctx context.Context, paymentID string) ([]Charge, error)

GetList returns a list of Charges for given payment ID.

func (*ChargeClient) New

func (c *ChargeClient) New(ctx context.Context, idempotencyKey string, paymentID string, params *ChargeParams, clientInfo *ClientInfo) (*Charge, error)

New creates new Charge entity.

type ChargeParams

type ChargeParams struct {
	PaymentMethod          PaymentMethodDetails    `json:"payment_method"`
	MerchantSiteURL        string                  `json:"merchant_site_url,omitempty"`
	ReconciliationID       string                  `json:"reconciliation_id,omitempty"`
	ThreeDSecureAttributes *ThreeDSecureAttributes `json:"three_d_secure_attributes,omitempty"`
	Installments           *Installments           `json:"installments,omitempty"`
	ProviderSpecificData   map[string]interface{}  `json:"provider_specific_data,omitempty"`
}

ChargeParams is a set of params for creating entity.

type Client

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

Client contains API parameters and provides set of API entity clients.

func New

func New(options ...Option) *Client

New creates new client with given options.

func (*Client) Authorization

func (c *Client) Authorization() *AuthorizationClient

Authorization creates client for work with corresponding entity.

func (*Client) Call

func (c *Client) Call(ctx context.Context, method, path string, headers map[string]string, reqObj interface{}, respObj interface{}) (callErr error)

Call does HTTP request with given params using set HTTP client. Response will be decoded into respObj. Error may be returned if something went wrong. If API return error as response, then Call returns error of type zooz.Error.

func (*Client) Capture

func (c *Client) Capture() *CaptureClient

Capture creates client for work with corresponding entity.

func (*Client) Charge

func (c *Client) Charge() *ChargeClient

Charge creates client for work with corresponding entity.

func (*Client) Customer

func (c *Client) Customer() *CustomerClient

Customer creates client for work with corresponding entity.

func (*Client) Payment

func (c *Client) Payment() *PaymentClient

Payment creates client for work with corresponding entity.

func (*Client) PaymentMethod

func (c *Client) PaymentMethod() *PaymentMethodClient

PaymentMethod creates client for work with corresponding entity.

func (*Client) Redirection

func (c *Client) Redirection() *RedirectionClient

Redirection creates client for work with corresponding entity.

func (*Client) Refund

func (c *Client) Refund() *RefundClient

Refund creates client for work with corresponding entity.

func (*Client) Void

func (c *Client) Void() *VoidClient

Void creates client for work with corresponding entity.

type ClientInfo

type ClientInfo struct {
	IPAddress string
	UserAgent string
}

ClientInfo represents optional request params for some methods.

type Customer

type Customer struct {
	CustomerParams

	ID             string          `json:"id"`
	Created        json.Number     `json:"created"`
	Modified       json.Number     `json:"modified"`
	PaymentMethods []PaymentMethod `json:"payment_methods"`
}

Customer is a model of entity.

type CustomerClient

type CustomerClient struct {
	Caller Caller
}

CustomerClient is a client for work with Customer entity. https://developers.paymentsos.com/docs/api#/reference/customers

func (*CustomerClient) Delete

func (c *CustomerClient) Delete(ctx context.Context, id string) error

Delete deletes Customer entity.

func (*CustomerClient) Get

func (c *CustomerClient) Get(ctx context.Context, id string) (*Customer, error)

Get returns Customer entity.

func (*CustomerClient) New

func (c *CustomerClient) New(ctx context.Context, idempotencyKey string, params *CustomerParams) (*Customer, error)

New creates new Customer entity.

func (*CustomerClient) Update

func (c *CustomerClient) Update(ctx context.Context, id string, params *CustomerParams) (*Customer, error)

Update updates Customer entity with given params and return updated Customer entity.

type CustomerParams

type CustomerParams struct {
	CustomerReference string            `json:"customer_reference"`
	FirstName         string            `json:"first_name,omitempty"`
	LastName          string            `json:"last_name,omitempty"`
	Email             string            `json:"email,omitempty"`
	AdditionalDetails AdditionalDetails `json:"additional_details,omitempty"`
	ShippingAddress   *Address          `json:"shipping_address,omitempty"`
}

CustomerParams is a set of params for creating and updating entity.

type Error

type Error struct {
	StatusCode int
	RequestID  string
	APIError   APIError
}

Error represents possible client error.

func (*Error) Error

func (e *Error) Error() string

Error implements error interface.

type HTTPClient

type HTTPClient interface {
	Do(r *http.Request) (*http.Response, error)
}

HTTPClient is interface fot HTTP client. Built-in net/http.Client implements this interface as well.

type IdentityDocument

type IdentityDocument struct {
	Type   string `json:"type"`
	Number string `json:"number"`
}

IdentityDocument represents some identity document.

type Installments

type Installments struct {
	NumberOfInstallments    int64 `json:"number_of_installments"`
	FirstPaymentAmount      int64 `json:"first_payment_amount"`
	RemainingPaymentsAmount int64 `json:"remaining_payments_amount"`
}

Installments is a set of options of installments.

type Option

type Option func(*Client)

Option is a callback for redefine client parameters.

func OptAppID

func OptAppID(appID string) Option

OptAppID returns option with given App ID.

func OptEnv

func OptEnv(env env) Option

OptEnv returns option with given environment value.

func OptHTTPClient

func OptHTTPClient(httpClient HTTPClient) Option

OptHTTPClient returns option with given HTTP client.

func OptPrivateKey

func OptPrivateKey(privateKey string) Option

OptPrivateKey returns option with given private key.

type Payment

type Payment struct {
	PaymentParams

	ID                  string              `json:"id"`
	Created             json.Number         `json:"created"`
	Modified            json.Number         `json:"modified"`
	Status              PaymentStatus       `json:"status"`
	PossibleNextActions []PaymentNextAction `json:"possible_next_actions"`

	// Expansions
	PaymentMethod    *PaymentMethodHref       `json:"payment_method"`
	Customer         *Customer                `json:"customer"`
	RelatedResources *PaymentRelatedResources `json:"related_resources"`
}

Payment is a model of entity.

type PaymentAction

type PaymentAction string

PaymentAction is a type of action performed on payment

const (
	PaymentActionAuthorize     PaymentAction = "Authorize"
	PaymentActionCharge        PaymentAction = "Charge"
	PaymentActionCapture       PaymentAction = "Capture"
	PaymentActionRefund        PaymentAction = "Refund"
	PaymentActionVoid          PaymentAction = "Void"
	PaymentActionUpdatePayment PaymentAction = "Update Payment"
)

List of possible payment action values.

type PaymentClient

type PaymentClient struct {
	Caller Caller
}

PaymentClient is a client for work with Payment entity. https://developers.paymentsos.com/docs/api#/reference/payments

func (*PaymentClient) Get

func (c *PaymentClient) Get(ctx context.Context, id string, expands ...PaymentExpand) (*Payment, error)

Get returns Payment entity with optional expansions. You may specify any number of expansion or use zooz.PaymentExpandAll for expand payments with all expansions.

func (*PaymentClient) New

func (c *PaymentClient) New(ctx context.Context, idempotencyKey string, params *PaymentParams) (*Payment, error)

New creates new Payment entity.

func (*PaymentClient) Update

func (c *PaymentClient) Update(ctx context.Context, id string, params *PaymentParams) (*Payment, error)

Update changes Payment entity and returned updated entity. Payment details can only be updated if no other action has been performed on the Payment resource. Note: In addition to the fields that you want to update, you must re-send all the other original argument fields, because this operation replaces the Payment resource.

type PaymentExpand

type PaymentExpand string

PaymentExpand is a type of "expand" param value, used while requesting payment

const (
	PaymentExpandAuthorizations PaymentExpand = "authorizations"
	PaymentExpandRedirections   PaymentExpand = "redirections"
	PaymentExpandCaptures       PaymentExpand = "captures"
	PaymentExpandRefunds        PaymentExpand = "refunds"
	PaymentExpandVoids          PaymentExpand = "voids"
	PaymentExpandCredits        PaymentExpand = "credits"
	PaymentExpandCustomer       PaymentExpand = "customer"
	PaymentExpandPaymentMethod  PaymentExpand = "payment_method"
	PaymentExpandAll            PaymentExpand = "all"
)

List of possible payment expansion values.

type PaymentMethod

type PaymentMethod struct {
	Type               string            `json:"type"`
	TokenType          string            `json:"token_type"`
	PassLuhnValidation bool              `json:"pass_luhn_validation"`
	Token              string            `json:"token"`
	Created            json.Number       `json:"created"`
	Customer           string            `json:"customer"`
	AdditionalDetails  AdditionalDetails `json:"additional_details"`
	BinNumber          json.Number       `json:"bin_number"`
	Vendor             string            `json:"vendor"`
	Issuer             string            `json:"issuer"`
	CardType           string            `json:"card_type"`
	Level              string            `json:"level"`
	CountryCode        string            `json:"country_code"`
	HolderName         string            `json:"holder_name"`
	ExpirationDate     string            `json:"expiration_date"`
	Last4Digits        string            `json:"last_4_digits"`
	IdentityDocument   *IdentityDocument `json:"identity_document"`
	BillingAddress     *Address          `json:"billing_address"`
}

PaymentMethod is a entity model.

type PaymentMethodClient

type PaymentMethodClient struct {
	Caller Caller
}

PaymentMethodClient is a client for work with PaymentMethod entity. https://developers.paymentsos.com/docs/api#/reference/payment-methods

func (*PaymentMethodClient) Get

func (c *PaymentMethodClient) Get(ctx context.Context, customerID string, token string) (*PaymentMethod, error)

Get returns PaymentMethod entity by customer ID and token.

func (*PaymentMethodClient) GetList

func (c *PaymentMethodClient) GetList(ctx context.Context, customerID string) ([]PaymentMethod, error)

GetList returns list of PaymentMethods for given customer.

func (*PaymentMethodClient) New

func (c *PaymentMethodClient) New(ctx context.Context, idempotencyKey string, customerID string, token string) (*PaymentMethod, error)

New creates new PaymentMethod entity.

type PaymentMethodDetails

type PaymentMethodDetails struct {
	Type              string            `json:"type"`
	Token             string            `json:"token,omitempty"`
	CreditCardCvv     string            `json:"credit_card_cvv,omitempty"`
	SourceType        string            `json:"source_type,omitempty"`
	Vendor            string            `json:"vendor,omitempty"`
	AdditionalDetails AdditionalDetails `json:"additional_details,omitempty"`
}

PaymentMethodDetails represents payment method details for POST requests.

type PaymentMethodHref

type PaymentMethodHref struct {
	Href          string         `json:"href"`
	PaymentMethod *PaymentMethod `json:"payment_method"`
}

PaymentMethodHref wraps PaymentMethod with associated href.

type PaymentNextAction

type PaymentNextAction struct {
	Action PaymentAction `json:"action"`
	Href   string        `json:"href"`
}

PaymentNextAction represents action which may be performed on Payment entity.

type PaymentOrder

type PaymentOrder struct {
	ID                string                 `json:"id,omitempty"`
	AdditionalDetails AdditionalDetails      `json:"additional_details,omitempty"`
	TaxAmount         int64                  `json:"tax_amount,omitempty"`
	TaxPercentage     int64                  `json:"tax_percentage,omitempty"`
	LineItems         []PaymentOrderLineItem `json:"line_items,omitempty"`
}

PaymentOrder represents order description.

type PaymentOrderLineItem

type PaymentOrderLineItem struct {
	ID        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	Quantity  int64  `json:"quantity,omitempty"`
	UnitPrice int64  `json:"unit_price,omitempty"`
}

PaymentOrderLineItem represents one item of order.

type PaymentParams

type PaymentParams struct {
	Amount                  int64             `json:"amount"`
	Currency                string            `json:"currency"`
	CustomerID              string            `json:"customer_id,omitempty"`
	AdditionalDetails       AdditionalDetails `json:"additional_details,omitempty"`
	StatementSoftDescriptor string            `json:"statement_soft_descriptor,omitempty"`
	Order                   *PaymentOrder     `json:"order,omitempty"`
	ShippingAddress         *Address          `json:"shipping_address,omitempty"`
	BillingAddress          *Address          `json:"billing_address,omitempty"`
}

PaymentParams is a set of params for creating and updating entity.

type PaymentRelatedResources

type PaymentRelatedResources struct {
	Authorizations []Authorization `json:"authorizations"`
	Charges        []Charge        `json:"charges"`
	Voids          []Void          `json:"voids"`
	Redirections   []Redirection   `json:"redirections"`
	Captures       []Capture       `json:"captures"`
	Refunds        []Refund        `json:"refunds"`
}

PaymentRelatedResources is a set of resources related to Payment.

type PaymentStatus

type PaymentStatus string

PaymentStatus is a type of payment status

const (
	PaymentStatusInitialized PaymentStatus = "Initialized"
	PaymentStatusPending     PaymentStatus = "Pending"
	PaymentStatusAuthorized  PaymentStatus = "Authorized"
	PaymentStatusCaptured    PaymentStatus = "Captured"
	PaymentStatusRefunded    PaymentStatus = "Refunded"
	PaymentStatusVoided      PaymentStatus = "Voided"
)

List of possible payment status values.

type ProviderData

type ProviderData struct {
	ProviderName          string             `json:"provider_name"`
	ResponseCode          string             `json:"response_code"`
	Description           string             `json:"description"`
	RawResponse           string             `json:"raw_response"`
	AvsCode               string             `json:"avs_code"`
	AuthorizationCode     string             `json:"authorization_code"`
	TransactionID         string             `json:"transaction_id"`
	ExternalID            string             `json:"external_id"`
	Documents             []ProviderDocument `json:"documents"`
	AdditionalInformation map[string]string  `json:"additional_information"`
}

ProviderData is a set of params describing payment provider.

type ProviderDocument

type ProviderDocument struct {
	Descriptor  string `json:"descriptor"`
	ContentType string `json:"content_type"`
	Href        string `json:"href"`
}

ProviderDocument represents provider document.

type Redirection

type Redirection struct {
	ID              string      `json:"id"`
	Created         json.Number `json:"created"`
	MerchantSiteURL string      `json:"merchant_site_url"`
	URL             string      `json:"url"`
}

Redirection is a entity model.

type RedirectionClient

type RedirectionClient struct {
	Caller Caller
}

RedirectionClient is a client for work with Redirection entity. https://developers.paymentsos.com/docs/api#/reference/redirections

func (*RedirectionClient) Get

func (c *RedirectionClient) Get(ctx context.Context, paymentID string, redirectionID string) (*Redirection, error)

Get creates new Redirection entity.

func (*RedirectionClient) GetList

func (c *RedirectionClient) GetList(ctx context.Context, paymentID string) ([]Redirection, error)

GetList returns a list of Redirections for given payment.

type Refund

type Refund struct {
	RefundParams

	ID           string       `json:"id"`
	Result       Result       `json:"result"`
	Created      json.Number  `json:"created"`
	ProviderData ProviderData `json:"provider_data"`
}

Refund is a entity model.

type RefundClient

type RefundClient struct {
	Caller Caller
}

RefundClient is a client for work with Refund entity. https://developers.paymentsos.com/docs/api#/reference/refunds

func (*RefundClient) Get

func (c *RefundClient) Get(ctx context.Context, paymentID string, refundID string) (*Refund, error)

Get returns Refund entity.

func (*RefundClient) GetList

func (c *RefundClient) GetList(ctx context.Context, paymentID string) ([]Refund, error)

GetList returns a list of Refunds for given payment.

func (*RefundClient) New

func (c *RefundClient) New(ctx context.Context, idempotencyKey string, paymentID string, params *RefundParams) (*Refund, error)

New creates new Refund entity.

type RefundParams

type RefundParams struct {
	ReconciliationID string `json:"reconciliation_id,omitempty"`
	Amount           int64  `json:"amount,omitempty"`
	CaptureID        string `json:"capture_id,omitempty"`
	Reason           string `json:"reason,omitempty"`
}

RefundParams is a set of params for creating entity.

type Result

type Result struct {
	Status      string `json:"status"`
	Category    string `json:"category"`
	SubCategory string `json:"sub_category"`
	Description string `json:"description"`
}

Result represents status and category of some methods response.

type ThreeDSecureAttributes

type ThreeDSecureAttributes struct {
	Encoding string `json:"encoding"`
	XID      string `json:"xid"`
	CAVV     string `json:"cavv"`
	EciFlag  string `json:"eci_flag"`
}

ThreeDSecureAttributes is a set of attributes for 3D-Secure.

type Void

type Void struct {
	ID           string       `json:"id"`
	Result       Result       `json:"result"`
	Created      json.Number  `json:"created"`
	ProviderData ProviderData `json:"provider_data"`
}

Void is an entity model.

type VoidClient

type VoidClient struct {
	Caller Caller
}

VoidClient is a client for work with Void entity. https://developers.paymentsos.com/docs/api#/reference/voids

func (*VoidClient) Get

func (c *VoidClient) Get(ctx context.Context, paymentID string, voidID string) (*Void, error)

Get returns Void entity.

func (*VoidClient) GetList

func (c *VoidClient) GetList(ctx context.Context, paymentID string) ([]Void, error)

GetList returns a list of Void for given payment.

func (*VoidClient) New

func (c *VoidClient) New(ctx context.Context, idempotencyKey string, paymentID string) (*Void, error)

New create new Void entity.

Jump to

Keyboard shortcuts

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