checkout

package
v0.0.0-...-e2bdc13 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.3.0"

Version identifies the current library version. Should match the git tag

Variables

View Source
var ErrNotFound = errors.New("resource not found")

Functions

func GetUserAgent

func GetUserAgent() string

Types

type AdyenBadConfig

type AdyenBadConfig struct {
	// \`error:psp:bad_config`
	Type string `json:"type"`
	// Some fields are invalid
	Message string `json:"message"`
	// An object containing `PSP` and an array of objects with the invalid fields.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the configuration used to initialize Adyen contains at least one invalid field. *

func (AdyenBadConfig) MarshalJSON

func (obj AdyenBadConfig) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type AdyenInitError

type AdyenInitError struct {
	// \`error:psp:bad_config`
	Type string `json:"type"`
	// Could not initialise Adyen
	Message string `json:"message"`
	// An object containing `PSP`, `clientKey`, and `enviroment`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when Adyen cannot be initialized. *

func (AdyenInitError) Error

func (obj AdyenInitError) Error() string

func (AdyenInitError) MarshalJSON

func (obj AdyenInitError) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type AdyenTimeout

type AdyenTimeout struct {
	// \`error:psp:bad_config`
	Type string `json:"type"`
	// Timeout while initialising Adyen
	Message string `json:"message"`
	// An object containing `PSP`, `clientKey`, and `enviroment`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when a timeout error occurs while initializing Adyen. *

func (AdyenTimeout) MarshalJSON

func (obj AdyenTimeout) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type ApplicationDeactivated

type ApplicationDeactivated struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// Application `{appId}` for seller `{sellerId}` is disabled
	Message string `json:"message"`
	// An object containing `sellerId` and `appId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the requested application is deactivated. Activate the application in the Merchant Center to continue. *

func (ApplicationDeactivated) MarshalJSON

func (obj ApplicationDeactivated) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type ApplicationNotFound

type ApplicationNotFound struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// Application `{appId}` for seller `{sellerId}` not found
	Message string `json:"message"`
	// An object containing `sellerId` and `appId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the requested application is not found. The application may have been deleted or its configuration is incorrect. *

func (ApplicationNotFound) MarshalJSON

func (obj ApplicationNotFound) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type BadInputData

type BadInputData struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// Some fields are invalid
	Message string `json:"message"`
	// An object containing an array of `field`, `message`, and `invalidValue`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the `checkoutConfig` object contains one or more invalid fields. *

func (BadInputData) MarshalJSON

func (obj BadInputData) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type CartEmptiedDuringCheckout

type CartEmptiedDuringCheckout struct {
	// \`error:cart:empty`
	Type string `json:"type"`
	// Cart `{cartId}` was emptied during checkout
	Message string `json:"message"`
	// An object containing `cartId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the Cart was emptied during the checkout. It is not possible to recover from this, the customer must restart the checkout process. *

func (CartEmptiedDuringCheckout) MarshalJSON

func (obj CartEmptiedDuringCheckout) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type CartEmpty

type CartEmpty struct {
	// \`error:cart:empty`
	Type string `json:"type"`
	// Cart `{cartId}` is empty
	Message string `json:"message"`
	// An object containing `cartId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the Cart for the current checkout is empty. The Cart must contain at least one Line Item. *

func (CartEmpty) MarshalJSON

func (obj CartEmpty) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type CartNotFound

type CartNotFound struct {
	// \`error:cart:not_found`
	Type string `json:"type"`
	// Cart `{cartId}` for seller `{sellerId}` and application `{appId}` not found
	Message string `json:"message"`
	// An object containing `sellerId`, `appId`, and `cartId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the Cart is not found. A valid Cart with at least one Line Item is required to start the checkout. *

func (CartNotFound) MarshalJSON

func (obj CartNotFound) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type CheckoutCancelled

type CheckoutCancelled struct {
	// \`info:app:status`
	Type string `json:"type"`
	// Checkout cancelled
	Message string `json:"message"`
	// An object containing additional data about the event.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the customer cancels the checkout. *

func (CheckoutCancelled) MarshalJSON

func (obj CheckoutCancelled) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type CheckoutCompleted

type CheckoutCompleted struct {
	// \`info:app:status`
	Type string `json:"type"`
	// Checkout for `{orderId}` completed
	Message string `json:"message"`
	// An object containing `orderId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the customer completes the checkout. *

func (CheckoutCompleted) MarshalJSON

func (obj CheckoutCompleted) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type CheckoutLoaded

type CheckoutLoaded struct {
	// \`info:app:status`
	Type string `json:"type"`
	// Checkout loaded
	Message string `json:"message"`
	// An object containing additional data about the event.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the checkout was loaded successfully and it is waiting for the configuration parameters passed through the `checkoutConfig` object. *

func (CheckoutLoaded) MarshalJSON

func (obj CheckoutLoaded) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type CheckoutStarted

type CheckoutStarted struct {
	// \`info:app:status`
	Type string `json:"type"`
	// Checkout started
	Message string `json:"message"`
	// An object containing additional data about the event.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the checkout receives the configuration parameters passed through the `checkoutConfig` object and starts successfully. *

func (CheckoutStarted) MarshalJSON

func (obj CheckoutStarted) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type Client

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

func NewClient

func NewClient(cfg *ClientConfig) (*Client, error)

NewClient creates a new client based on the provided ClientConfig

type ClientConfig

type ClientConfig struct {
	URL         string
	Credentials *clientcredentials.Config
	LogLevel    int
	HTTPClient  *http.Client
	UserAgent   string
}

type Date

type Date struct {
	Year  int
	Month time.Month
	Day   int
}

Date holds date information for Commercetools API format

func NewDate

func NewDate(year int, month time.Month, day int) Date

NewDate initializes a Date struct

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

MarshalJSON marshals into the commercetools date format

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON data into a Date struct

type DecodeStruct

type DecodeStruct interface {
	DecodeStruct(map[string]interface{}) error
}

type GenericRequestError

type GenericRequestError struct {
	Content    []byte
	StatusCode int
	Response   *http.Response
}

func (GenericRequestError) Error

func (e GenericRequestError) Error() string

type InitTimeout

type InitTimeout struct {
	// \`error:init:timeout`
	Type string `json:"type"`
	// Timeout error, no init message received
	Message string `json:"message"`
	// An object containing additional data about the event.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the checkout has not received the configuration parameters passed through the `checkoutConfig` object on time. *

func (InitTimeout) MarshalJSON

func (obj InitTimeout) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type InvalidToken

type InvalidToken struct {
	// \`error:token:invalid`
	Type string `json:"type"`
	// The token is invalid
	Message string `json:"message"`
	// An object containing additional data about the event.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the `accessToken` is invalid. *

func (InvalidToken) MarshalJSON

func (obj InvalidToken) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type NoAllowedOrigins

type NoAllowedOrigins struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// There are no allowed origins configured
	Message string `json:"message"`
	// An object containing additional data about the event.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when there are no allowed origins configured for the current application. Add at least one **Origin URL** in your [application settings in the Merchant Center](/configuring-checkout#applications). *

func (NoAllowedOrigins) MarshalJSON

func (obj NoAllowedOrigins) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type NoPaymentMethods

type NoPaymentMethods struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// There are no payment methods configured
	Message string `json:"message"`
	// An object containing additional data about the event.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when there are no payment methods available. Add at least one **Payment method** in your [application settings in the Merchant Center](/configuring-checkout#payment-connector). *

func (NoPaymentMethods) MarshalJSON

func (obj NoPaymentMethods) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type NoShippingMethods

type NoShippingMethods struct {
	// \`warn:init:bad_config`
	Type string `json:"type"`
	// There are no shipping methods matching cart
	Message string `json:"message"`
	// An object containing `cartId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when no Shipping Method is available for the shipping address of the Cart. This may indicate an incomplete configuration. *

func (NoShippingMethods) MarshalJSON

func (obj NoShippingMethods) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type OrderCreated

type OrderCreated struct {
	// \`info:order:status`
	Type string `json:"type"`
	// Order `{orderId}` created
	Message string `json:"message"`
	// An object containing `orderId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the checkout successfully creates an Order. *

func (OrderCreated) MarshalJSON

func (obj OrderCreated) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type ResponseMessage

type ResponseMessage interface{}

type SellerIsDeactivated

type SellerIsDeactivated struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// Seller `{sellerId}` is deactivated
	Message string `json:"message"`
	// An object containing `sellerId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the seller is deactivated and the checkout cannot be initialized. Contact commercetools support. *

func (SellerIsDeactivated) MarshalJSON

func (obj SellerIsDeactivated) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type SellerNotFound

type SellerNotFound struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// Seller `{sellerId}` not found
	Message string `json:"message"`
	// An object containing `sellerId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the seller is not found. The seller may have been deleted or the configuration may not be correct. Contact commercetools support. *

func (SellerNotFound) MarshalJSON

func (obj SellerNotFound) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type SetUserAgentTransport

type SetUserAgentTransport struct {
	T http.RoundTripper
	// contains filtered or unexported fields
}

func (*SetUserAgentTransport) RoundTrip

func (sat *SetUserAgentTransport) RoundTrip(req *http.Request) (*http.Response, error)

type ShippingAddressMissing

type ShippingAddressMissing struct {
	// \`error:cart:field_required`
	Type string `json:"type"`
	// The shippingAddress field is missing for cart `{cartId}`
	Message string `json:"message"`
	// An object containing `cartId`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the checkout is initialised with [`skipShipping` set to `true`](/installing-checkout#placeholder-values). You must populate the `shippingAddress` field of the Cart with at least the shipping country. *

func (ShippingAddressMissing) MarshalJSON

func (obj ShippingAddressMissing) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type UnallowedOrigin

type UnallowedOrigin struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// Unallowed origin `{origin}`, allowed origins `{allowedOrigins}`
	Message string `json:"message"`
	// An object containing `origin` and `allowedOrigins`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the currently used origin URL is not in the list of the [**Origin URLs** configured in the Merchant Centre](/configuring-checkout#create-an-application) and the checkout cannot be initialized. Add the **Origin URL** in your application settings in the Merchant Center. *

func (UnallowedOrigin) MarshalJSON

func (obj UnallowedOrigin) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

type UnavailableLocale

type UnavailableLocale struct {
	// \`error:init:bad_config`
	Type string `json:"type"`
	// The provided locale `{locale}` is not available for translated definitions
	Message string `json:"message"`
	// An object containing `locale`.
	Payload *interface{} `json:"payload,omitempty"`
}

* * Generated when the provided locale is not [available for localization](/installing-checkout#locales). The checkout falls back to English. *

func (UnavailableLocale) MarshalJSON

func (obj UnavailableLocale) MarshalJSON() ([]byte, error)

MarshalJSON override to set the discriminator value or remove optional nil slices

Jump to

Keyboard shortcuts

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