meorphistest40

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Meorphis Test 46 Go API Library

Go Reference

The Meorphis Test 46 Go library provides convenient access to the Meorphis Test 46 REST API from applications written in Go. The full API of this library can be found in api.md.

It is generated with Stainless.

Installation

import (
	"github.com/meorphis/test-repo-15/v2" // imported as meorphistest40
)

Or to pin the version:

go get -u 'github.com/meorphis/test-repo-15@v2.0.0'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/meorphis/test-repo-15/v2"
	"github.com/meorphis/test-repo-15/v2/option"
)

func main() {
	client := meorphistest40.NewClient(
		option.WithEnvironmentEnvironment1(), // defaults to option.WithEnvironmentProduction()
	)
	card, err := client.Cards.New(context.TODO(), meorphistest40.CardNewParams{
		Type: meorphistest40.F(meorphistest40.CardNewParamsTypeReplaceMe),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", card.Token)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: meorphistest40.F("hello"),

	// Explicitly send `"description": null`
	Description: meorphistest40.Null[string](),

	Point: meorphistest40.F(meorphistest40.Point{
		X: meorphistest40.Int(0),
		Y: meorphistest40.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: meorphistest40.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the repsonse JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := meorphistest40.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Cards.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *meorphistest40.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Cards.New(context.TODO(), meorphistest40.CardNewParams{
	Type: meorphistest40.F(meorphistest40.CardNewParamsTypeReplaceMe),
})
if err != nil {
	var apierr *meorphistest40.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/cards": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Cards.New(
	ctx,
	meorphistest40.CardNewParams{
		Type: meorphistest40.F(meorphistest40.CardNewParamsTypeReplaceMe),
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as param.Field[io.Reader]. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper meorphistest40.FileParam(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := meorphistest40.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Cards.New(
	context.TODO(),
	meorphistest40.CardNewParams{
		Type: meorphistest40.F(meorphistest40.CardNewParamsTypeReplaceMe),
	},
	option.WithMaxRetries(5),
)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]interface{}

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   meorphistest40.F("id_xxxx"),
    Data: meorphistest40.F(FooNewParamsData{
        FirstName: meorphistest40.F("John"),
    }),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := meorphistest40.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type AccountConfiguration

type AccountConfiguration struct {
	// Globally unique identifier for the account. This is the same as the
	// account_token returned by the enroll endpoint. If using this parameter, do not
	// include pagination.
	Token string `json:"token,required" format:"uuid"`
	// Spend limit information for the user containing the daily, monthly, and lifetime
	// spend limit of the account. Any charges to a card owned by this account will be
	// declined once their transaction volume has surpassed the value in the applicable
	// time limit (rolling). A lifetime limit of 0 indicates that the lifetime limit
	// feature is disabled.
	SpendLimit AccountConfigurationSpendLimit `json:"spend_limit,required"`
	// Account state:
	//
	//   - `ACTIVE` - Account is able to transact and create new cards.
	//   - `PAUSED` - Account will not be able to transact or create new cards. It can be
	//     set back to `ACTIVE`.
	//   - `CLOSED` - Account will permanently not be able to transact or create new
	//     cards.
	State         AccountConfigurationState         `json:"state,required"`
	AccountHolder AccountConfigurationAccountHolder `json:"account_holder"`
	// List of identifiers for the Auth Rule(s) that are applied on the account.
	AuthRuleTokens      []string                                `json:"auth_rule_tokens"`
	VerificationAddress AccountConfigurationVerificationAddress `json:"verification_address"`
	JSON                accountConfigurationJSON                `json:"-"`
}

func (*AccountConfiguration) UnmarshalJSON

func (r *AccountConfiguration) UnmarshalJSON(data []byte) (err error)

type AccountConfigurationAccountHolder

type AccountConfigurationAccountHolder struct {
	// Globally unique identifier for the account holder.
	Token string `json:"token,required"`
	// Only applicable for customers using the KYC-Exempt workflow to enroll authorized
	// users of businesses. Account_token of the enrolled business associated with an
	// enrolled AUTHORIZED_USER individual.
	BusinessAccountToken string `json:"business_account_token,required"`
	// Email address.
	Email string `json:"email,required"`
	// Phone number of the individual.
	PhoneNumber string                                `json:"phone_number,required"`
	JSON        accountConfigurationAccountHolderJSON `json:"-"`
}

func (*AccountConfigurationAccountHolder) UnmarshalJSON

func (r *AccountConfigurationAccountHolder) UnmarshalJSON(data []byte) (err error)

type AccountConfigurationSpendLimit

type AccountConfigurationSpendLimit struct {
	// Daily spend limit (in cents).
	Daily int64 `json:"daily,required"`
	// Total spend limit over account lifetime (in cents).
	Lifetime int64 `json:"lifetime,required"`
	// Monthly spend limit (in cents).
	Monthly int64                              `json:"monthly,required"`
	JSON    accountConfigurationSpendLimitJSON `json:"-"`
}

Spend limit information for the user containing the daily, monthly, and lifetime spend limit of the account. Any charges to a card owned by this account will be declined once their transaction volume has surpassed the value in the applicable time limit (rolling). A lifetime limit of 0 indicates that the lifetime limit feature is disabled.

func (*AccountConfigurationSpendLimit) UnmarshalJSON

func (r *AccountConfigurationSpendLimit) UnmarshalJSON(data []byte) (err error)

type AccountConfigurationState

type AccountConfigurationState string

Account state:

  • `ACTIVE` - Account is able to transact and create new cards.
  • `PAUSED` - Account will not be able to transact or create new cards. It can be set back to `ACTIVE`.
  • `CLOSED` - Account will permanently not be able to transact or create new cards.
const (
	AccountConfigurationStateActive AccountConfigurationState = "ACTIVE"
	AccountConfigurationStatePaused AccountConfigurationState = "PAUSED"
	AccountConfigurationStateClosed AccountConfigurationState = "CLOSED"
)

func (AccountConfigurationState) IsKnown

func (r AccountConfigurationState) IsKnown() bool

type AccountConfigurationVerificationAddress

type AccountConfigurationVerificationAddress struct {
	// Valid deliverable address (no PO boxes).
	Address1 string `json:"address1,required"`
	// City name.
	City string `json:"city,required"`
	// Country name. Only USA is currently supported.
	Country string `json:"country,required"`
	// Valid postal code. Only USA ZIP codes are currently supported, entered as a
	// five-digit ZIP or nine-digit ZIP+4.
	PostalCode string `json:"postal_code,required"`
	// Valid state code. Only USA state codes are currently supported, entered in
	// uppercase ISO 3166-2 two-character format.
	State string `json:"state,required"`
	// Unit or apartment number (if applicable).
	Address2 string                                      `json:"address2"`
	JSON     accountConfigurationVerificationAddressJSON `json:"-"`
}

func (*AccountConfigurationVerificationAddress) UnmarshalJSON

func (r *AccountConfigurationVerificationAddress) UnmarshalJSON(data []byte) (err error)

type AccountCreditConfigurationService

type AccountCreditConfigurationService struct {
	Options []option.RequestOption
}

AccountCreditConfigurationService contains methods and other services that help with interacting with the meorphis-test-46 API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountCreditConfigurationService method instead.

func NewAccountCreditConfigurationService

func NewAccountCreditConfigurationService(opts ...option.RequestOption) (r *AccountCreditConfigurationService)

NewAccountCreditConfigurationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountCreditConfigurationService) Get

func (r *AccountCreditConfigurationService) Get(ctx context.Context, accountToken string, opts ...option.RequestOption) (res *BusinessAccount, err error)

Get an Account's credit configuration

func (*AccountCreditConfigurationService) Update

Update a Business Accounts credit configuration

type AccountCreditConfigurationUpdateParams

type AccountCreditConfigurationUpdateParams struct {
	// Number of days within the billing period
	BillingPeriod param.Field[int64] `json:"billing_period"`
	// Credit limit extended to the Business Account
	CreditLimit param.Field[int64] `json:"credit_limit"`
	// The external bank account token to use for auto-collections
	ExternalBankAccountToken param.Field[string] `json:"external_bank_account_token" format:"uuid"`
	// Number of days after the billing period ends that a payment is required
	PaymentPeriod param.Field[int64] `json:"payment_period"`
}

func (AccountCreditConfigurationUpdateParams) MarshalJSON

func (r AccountCreditConfigurationUpdateParams) MarshalJSON() (data []byte, err error)

type AccountService

type AccountService struct {
	Options             []option.RequestOption
	CreditConfiguration *AccountCreditConfigurationService
}

AccountService contains methods and other services that help with interacting with the meorphis-test-46 API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountService method instead.

func NewAccountService

func NewAccountService(opts ...option.RequestOption) (r *AccountService)

NewAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountService) Get

func (r *AccountService) Get(ctx context.Context, accountToken string, opts ...option.RequestOption) (res *AccountConfiguration, err error)

Get account configuration such as spend limits.

func (*AccountService) Update

func (r *AccountService) Update(ctx context.Context, accountToken string, body AccountUpdateParams, opts ...option.RequestOption) (res *AccountConfiguration, err error)

Update account configuration such as spend limits and verification address. Can only be run on accounts that are part of the program managed by this API key.

Accounts that are in the `PAUSED` state will not be able to transact or create new cards.

type AccountUpdateParams

type AccountUpdateParams struct {
	// Amount (in cents) for the account's daily spend limit. By default the daily
	// spend limit is set to $1,250.
	DailySpendLimit param.Field[int64] `json:"daily_spend_limit"`
	// Amount (in cents) for the account's lifetime spend limit. Once this limit is
	// reached, no transactions will be accepted on any card created for this account
	// until the limit is updated. Note that a spend limit of 0 is effectively no
	// limit, and should only be used to reset or remove a prior limit. Only a limit of
	// 1 or above will result in declined transactions due to checks against the
	// account limit. This behavior differs from the daily spend limit and the monthly
	// spend limit.
	LifetimeSpendLimit param.Field[int64] `json:"lifetime_spend_limit"`
	// Amount (in cents) for the account's monthly spend limit. By default the monthly
	// spend limit is set to $5,000.
	MonthlySpendLimit param.Field[int64] `json:"monthly_spend_limit"`
	// Account states.
	State param.Field[AccountUpdateParamsState] `json:"state"`
	// Address used during Address Verification Service (AVS) checks during
	// transactions if enabled via Auth Rules.
	VerificationAddress param.Field[AccountUpdateParamsVerificationAddress] `json:"verification_address"`
}

func (AccountUpdateParams) MarshalJSON

func (r AccountUpdateParams) MarshalJSON() (data []byte, err error)

type AccountUpdateParamsState

type AccountUpdateParamsState string

Account states.

const (
	AccountUpdateParamsStateActive AccountUpdateParamsState = "ACTIVE"
	AccountUpdateParamsStatePaused AccountUpdateParamsState = "PAUSED"
)

func (AccountUpdateParamsState) IsKnown

func (r AccountUpdateParamsState) IsKnown() bool

type AccountUpdateParamsVerificationAddress

type AccountUpdateParamsVerificationAddress struct {
	Address1   param.Field[string] `json:"address1"`
	Address2   param.Field[string] `json:"address2"`
	City       param.Field[string] `json:"city"`
	Country    param.Field[string] `json:"country"`
	PostalCode param.Field[string] `json:"postal_code"`
	State      param.Field[string] `json:"state"`
}

Address used during Address Verification Service (AVS) checks during transactions if enabled via Auth Rules.

func (AccountUpdateParamsVerificationAddress) MarshalJSON

func (r AccountUpdateParamsVerificationAddress) MarshalJSON() (data []byte, err error)

type BusinessAccount

type BusinessAccount struct {
	// Account token
	Token                    string                                  `json:"token,required" format:"uuid"`
	CollectionsConfiguration BusinessAccountCollectionsConfiguration `json:"collections_configuration"`
	// Credit limit extended to the Account
	CreditLimit int64               `json:"credit_limit"`
	JSON        businessAccountJSON `json:"-"`
}

func (*BusinessAccount) UnmarshalJSON

func (r *BusinessAccount) UnmarshalJSON(data []byte) (err error)

type BusinessAccountCollectionsConfiguration

type BusinessAccountCollectionsConfiguration struct {
	// Number of days within the billing period
	BillingPeriod int64 `json:"billing_period,required"`
	// Number of days after the billing period ends that a payment is required
	PaymentPeriod int64 `json:"payment_period,required"`
	// The external bank account token to use for auto-collections
	ExternalBankAccountToken string                                      `json:"external_bank_account_token" format:"uuid"`
	JSON                     businessAccountCollectionsConfigurationJSON `json:"-"`
}

func (*BusinessAccountCollectionsConfiguration) UnmarshalJSON

func (r *BusinessAccountCollectionsConfiguration) UnmarshalJSON(data []byte) (err error)

type Card

type Card struct {
	// Globally unique identifier.
	Token string `json:"token,required" format:"uuid"`
	// An RFC 3339 timestamp for when the card was created. UTC time zone.
	Created time.Time   `json:"created,required" format:"date-time"`
	Funding CardFunding `json:"funding,required"`
	// Last four digits of the card number.
	LastFour string `json:"last_four,required"`
	// Amount (in cents) to limit approved authorizations. Transaction requests above
	// the spend limit will be declined.
	SpendLimit int64 `json:"spend_limit,required"`
	// Spend limit duration values:
	//
	//   - `ANNUALLY` - Card will authorize transactions up to spend limit in a calendar
	//     year.
	//   - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime
	//     of the card.
	//   - `MONTHLY` - Card will authorize transactions up to spend limit for the
	//     trailing month. Month is calculated as this calendar date one month prior.
	//   - `TRANSACTION` - Card will authorize multiple transactions if each individual
	//     transaction is under the spend limit.
	SpendLimitDuration CardSpendLimitDuration `json:"spend_limit_duration,required"`
	// Card state values:
	//
	//   - `CLOSED` - Card will no longer approve authorizations. Closing a card cannot
	//     be undone.
	//   - `OPEN` - Card will approve authorizations (if they match card and account
	//     parameters).
	//   - `PAUSED` - Card will decline authorizations, but can be resumed at a later
	//     time.
	//   - `PENDING_FULFILLMENT` - The initial state for cards of type `PHYSICAL`. The
	//     card is provisioned pending manufacturing and fulfillment. Cards in this state
	//     can accept authorizations for e-commerce purchases, but not for "Card Present"
	//     purchases where the physical card itself is present.
	//   - `PENDING_ACTIVATION` - Each business day at 2pm Eastern Time Zone (ET), cards
	//     of type `PHYSICAL` in state `PENDING_FULFILLMENT` are sent to the card
	//     production warehouse and updated to state `PENDING_ACTIVATION` . Similar to
	//     `PENDING_FULFILLMENT`, cards in this state can be used for e-commerce
	//     transactions. API clients should update the card's state to `OPEN` only after
	//     the cardholder confirms receipt of the card.
	//
	// In sandbox, the same daily batch fulfillment occurs, but no cards are actually
	// manufactured.
	State CardState `json:"state,required"`
	// Card types:
	//
	//   - `VIRTUAL` - Card will authorize at any merchant and can be added to a digital
	//     wallet like Apple Pay or Google Pay (if the card program is digital
	//     wallet-enabled).
	//   - `PHYSICAL` - Manufactured and sent to the cardholder. We offer white label
	//     branding, credit, ATM, PIN debit, chip/EMV, NFC and magstripe functionality.
	//     Reach out at [acme.com/contact](https://acme.com/contact) for more
	//     information.
	//   - `SINGLE_USE` - Card is closed upon first successful authorization.
	//   - `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that
	//     successfully authorizes the card.
	Type CardType `json:"type,required"`
	// List of identifiers for the Auth Rule(s) that are applied on the card.
	AuthRuleTokens []string `json:"auth_rule_tokens"`
	// Three digit cvv printed on the back of the card.
	Cvv string `json:"cvv"`
	// Specifies the digital card art to be displayed in the user’s digital wallet
	// after tokenization. This artwork must be approved by Mastercard and configured
	// by Acme to use. See
	// [Flexible Card Art Guide](https://docs.acme.com/docs/about-digital-wallets#flexible-card-art).
	DigitalCardArtToken string `json:"digital_card_art_token" format:"uuid"`
	// Two digit (MM) expiry month.
	ExpMonth string `json:"exp_month"`
	// Four digit (yyyy) expiry year.
	ExpYear string `json:"exp_year"`
	// Hostname of card’s locked merchant (will be empty if not applicable).
	Hostname string `json:"hostname"`
	// Friendly name to identify the card. We recommend against using this field to
	// store JSON data as it can cause unexpected behavior.
	Memo string `json:"memo"`
	// Primary Account Number (PAN) (i.e. the card number). Customers must be PCI
	// compliant to have PAN returned as a field in production. Please contact
	// [support@acme.com](mailto:support@acme.com) for questions.
	Pan  string   `json:"pan"`
	JSON cardJSON `json:"-"`
}

func (*Card) UnmarshalJSON

func (r *Card) UnmarshalJSON(data []byte) (err error)

type CardFinancialTransactionService

type CardFinancialTransactionService struct {
	Options []option.RequestOption
}

CardFinancialTransactionService contains methods and other services that help with interacting with the meorphis-test-46 API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCardFinancialTransactionService method instead.

func NewCardFinancialTransactionService

func NewCardFinancialTransactionService(opts ...option.RequestOption) (r *CardFinancialTransactionService)

NewCardFinancialTransactionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CardFinancialTransactionService) Get

func (r *CardFinancialTransactionService) Get(ctx context.Context, cardToken string, financialTransactionToken string, opts ...option.RequestOption) (res *FinancialTransaction, err error)

Get the card financial transaction for the provided token.

type CardFunding

type CardFunding struct {
	// A globally unique identifier for this FundingAccount.
	Token string `json:"token,required" format:"uuid"`
	// An RFC 3339 string representing when this funding source was added to the Acme
	// account. This may be `null`. UTC time zone.
	Created time.Time `json:"created,required" format:"date-time"`
	// The last 4 digits of the account (e.g. bank account, debit card) associated with
	// this FundingAccount. This may be null.
	LastFour string `json:"last_four,required"`
	// State of funding source.
	//
	// Funding source states:
	//
	//   - `ENABLED` - The funding account is available to use for card creation and
	//     transactions.
	//   - `PENDING` - The funding account is still being verified e.g. bank
	//     micro-deposits verification.
	//   - `DELETED` - The founding account has been deleted.
	State CardFundingState `json:"state,required"`
	// Types of funding source:
	//
	// - `DEPOSITORY_CHECKING` - Bank checking account.
	// - `DEPOSITORY_SAVINGS` - Bank savings account.
	Type CardFundingType `json:"type,required"`
	// Account name identifying the funding source. This may be `null`.
	AccountName string `json:"account_name"`
	// The nickname given to the `FundingAccount` or `null` if it has no nickname.
	Nickname string          `json:"nickname"`
	JSON     cardFundingJSON `json:"-"`
}

func (*CardFunding) UnmarshalJSON

func (r *CardFunding) UnmarshalJSON(data []byte) (err error)

type CardFundingState

type CardFundingState string

State of funding source.

Funding source states:

  • `ENABLED` - The funding account is available to use for card creation and transactions.
  • `PENDING` - The funding account is still being verified e.g. bank micro-deposits verification.
  • `DELETED` - The founding account has been deleted.
const (
	CardFundingStateEnabled CardFundingState = "ENABLED"
	CardFundingStatePending CardFundingState = "PENDING"
	CardFundingStateDeleted CardFundingState = "DELETED"
)

func (CardFundingState) IsKnown

func (r CardFundingState) IsKnown() bool

type CardFundingType

type CardFundingType string

Types of funding source:

- `DEPOSITORY_CHECKING` - Bank checking account. - `DEPOSITORY_SAVINGS` - Bank savings account.

const (
	CardFundingTypeDepositoryChecking CardFundingType = "DEPOSITORY_CHECKING"
	CardFundingTypeDepositorySavings  CardFundingType = "DEPOSITORY_SAVINGS"
)

func (CardFundingType) IsKnown

func (r CardFundingType) IsKnown() bool

type CardNewParams

type CardNewParams struct {
	// Card types:
	//
	//   - `VIRTUAL` - Card will authorize at any merchant and can be added to a digital
	//     wallet like Apple Pay or Google Pay (if the card program is digital
	//     wallet-enabled).
	//   - `PHYSICAL` - Manufactured and sent to the cardholder. We offer white label
	//     branding, credit, ATM, PIN debit, chip/EMV, NFC and magstripe functionality.
	//     Reach out at [acme.com/contact](https://acme.com/contact) for more
	//     information.
	//   - `SINGLE_USE` - Card is closed upon first successful authorization.
	//   - `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that
	//     successfully authorizes the card.
	Type param.Field[CardNewParamsType] `json:"type,required"`
	// Globally unique identifier for the account that the card will be associated
	// with. Required for programs enrolling users using the
	// [/account_holders endpoint](https://docs.acme.com/docs/account-holders-kyc). See
	// [Managing Your Program](doc:managing-your-program) for more information.
	AccountToken param.Field[string] `json:"account_token" format:"uuid"`
	// For card programs with more than one BIN range. This must be configured with
	// Acme before use. Identifies the card program/BIN range under which to create the
	// card. If omitted, will utilize the program's default `card_program_token`. In
	// Sandbox, use 00000000-0000-0000-1000-000000000000 and
	// 00000000-0000-0000-2000-000000000000 to test creating cards on specific card
	// programs.
	CardProgramToken param.Field[string]               `json:"card_program_token" format:"uuid"`
	Carrier          param.Field[CardNewParamsCarrier] `json:"carrier"`
	// Specifies the digital card art to be displayed in the user’s digital wallet
	// after tokenization. This artwork must be approved by Mastercard and configured
	// by Acme to use. See
	// [Flexible Card Art Guide](https://docs.acme.com/docs/about-digital-wallets#flexible-card-art).
	DigitalCardArtToken param.Field[string] `json:"digital_card_art_token" format:"uuid"`
	// Two digit (MM) expiry month. If neither `exp_month` nor `exp_year` is provided,
	// an expiration date will be generated.
	ExpMonth param.Field[string] `json:"exp_month"`
	// Four digit (yyyy) expiry year. If neither `exp_month` nor `exp_year` is
	// provided, an expiration date will be generated.
	ExpYear param.Field[string] `json:"exp_year"`
	// Friendly name to identify the card. We recommend against using this field to
	// store JSON data as it can cause unexpected behavior.
	Memo param.Field[string] `json:"memo"`
	// Encrypted PIN block (in base64). Only applies to cards of type `PHYSICAL` and
	// `VIRTUAL`. See
	// [Encrypted PIN Block](https://docs.acme.com/docs/cards#encrypted-pin-block-enterprise).
	Pin param.Field[string] `json:"pin"`
	// Only applicable to cards of type `PHYSICAL`. This must be configured with Acme
	// before use. Specifies the configuration (i.e., physical card art) that the card
	// should be manufactured with.
	ProductID       param.Field[string]                       `json:"product_id"`
	ShippingAddress param.Field[CardNewParamsShippingAddress] `json:"shipping_address"`
	// Shipping method for the card. Only applies to cards of type PHYSICAL. Use of
	// options besides `STANDARD` require additional permissions.
	//
	//   - `STANDARD` - USPS regular mail or similar international option, with no
	//     tracking
	//   - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option,
	//     with tracking
	//   - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking
	//   - `EXPRESS` - FedEx Express, 3-day shipping, with tracking
	//   - `2_DAY` - FedEx 2-day shipping, with tracking
	//   - `EXPEDITED` - FedEx Standard Overnight or similar international option, with
	//     tracking
	ShippingMethod param.Field[CardNewParamsShippingMethod] `json:"shipping_method"`
	// Amount (in cents) to limit approved authorizations. Transaction requests above
	// the spend limit will be declined. Note that a spend limit of 0 is effectively no
	// limit, and should only be used to reset or remove a prior limit. Only a limit of
	// 1 or above will result in declined transactions due to checks against the card
	// limit.
	SpendLimit param.Field[int64] `json:"spend_limit"`
	// Spend limit duration values:
	//
	//   - `ANNUALLY` - Card will authorize transactions up to spend limit in a calendar
	//     year.
	//   - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime
	//     of the card.
	//   - `MONTHLY` - Card will authorize transactions up to spend limit for the
	//     trailing month. Month is calculated as this calendar date one month prior.
	//   - `TRANSACTION` - Card will authorize multiple transactions if each individual
	//     transaction is under the spend limit.
	SpendLimitDuration param.Field[CardNewParamsSpendLimitDuration] `json:"spend_limit_duration"`
	// Card state values:
	//
	//   - `OPEN` - Card will approve authorizations (if they match card and account
	//     parameters).
	//   - `PAUSED` - Card will decline authorizations, but can be resumed at a later
	//     time.
	State          param.Field[CardNewParamsState] `json:"state"`
	IdempotencyKey param.Field[string]             `header:"Idempotency-Key"`
}

func (CardNewParams) MarshalJSON

func (r CardNewParams) MarshalJSON() (data []byte, err error)

type CardNewParamsCarrier

type CardNewParamsCarrier struct {
	// QR code url to display on the card carrier
	QrCodeURL param.Field[string] `json:"qr_code_url"`
}

func (CardNewParamsCarrier) MarshalJSON

func (r CardNewParamsCarrier) MarshalJSON() (data []byte, err error)

type CardNewParamsShippingAddress

type CardNewParamsShippingAddress struct {
	// Valid USPS routable address.
	Address1 param.Field[string] `json:"address1,required"`
	// City
	City param.Field[string] `json:"city,required"`
	// Uppercase ISO 3166-1 alpha-3 three character abbreviation.
	Country param.Field[string] `json:"country,required"`
	// Customer's first name. This will be the first name printed on the physical card.
	FirstName param.Field[string] `json:"first_name,required"`
	// Customer's surname (family name). This will be the last name printed on the
	// physical card.
	LastName param.Field[string] `json:"last_name,required"`
	// Postal code (formerly zipcode). For US addresses, either five-digit zipcode or
	// nine-digit "ZIP+4".
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Uppercase ISO 3166-2 two character abbreviation for US and CA. Optional with a
	// limit of 24 characters for other countries.
	State param.Field[string] `json:"state,required"`
	// Unit number (if applicable).
	Address2 param.Field[string] `json:"address2"`
	// Email address to be contacted for expedited shipping process purposes. Required
	// if `shipping_method` is `EXPEDITED`.
	Email param.Field[string] `json:"email"`
	// Text to be printed on line two of the physical card. Use of this field requires
	// additional permissions.
	Line2Text param.Field[string] `json:"line2_text"`
	// Cardholder's phone number in E.164 format to be contacted for expedited shipping
	// process purposes. Required if `shipping_method` is `EXPEDITED`.
	PhoneNumber param.Field[string] `json:"phone_number"`
}

func (CardNewParamsShippingAddress) MarshalJSON

func (r CardNewParamsShippingAddress) MarshalJSON() (data []byte, err error)

type CardNewParamsShippingMethod

type CardNewParamsShippingMethod string

Shipping method for the card. Only applies to cards of type PHYSICAL. Use of options besides `STANDARD` require additional permissions.

  • `STANDARD` - USPS regular mail or similar international option, with no tracking
  • `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking
  • `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking
  • `EXPRESS` - FedEx Express, 3-day shipping, with tracking
  • `2_DAY` - FedEx 2-day shipping, with tracking
  • `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking
const (
	CardNewParamsShippingMethodStandard             CardNewParamsShippingMethod = "STANDARD"
	CardNewParamsShippingMethodStandardWithTracking CardNewParamsShippingMethod = "STANDARD_WITH_TRACKING"
	CardNewParamsShippingMethodPriority             CardNewParamsShippingMethod = "PRIORITY"
	CardNewParamsShippingMethodExpress              CardNewParamsShippingMethod = "EXPRESS"
	CardNewParamsShippingMethod2Day                 CardNewParamsShippingMethod = "2_DAY"
	CardNewParamsShippingMethodExpedited            CardNewParamsShippingMethod = "EXPEDITED"
)

func (CardNewParamsShippingMethod) IsKnown

func (r CardNewParamsShippingMethod) IsKnown() bool

type CardNewParamsSpendLimitDuration

type CardNewParamsSpendLimitDuration string

Spend limit duration values:

  • `ANNUALLY` - Card will authorize transactions up to spend limit in a calendar year.
  • `FOREVER` - Card will authorize only up to spend limit for the entire lifetime of the card.
  • `MONTHLY` - Card will authorize transactions up to spend limit for the trailing month. Month is calculated as this calendar date one month prior.
  • `TRANSACTION` - Card will authorize multiple transactions if each individual transaction is under the spend limit.
const (
	CardNewParamsSpendLimitDurationAnnually    CardNewParamsSpendLimitDuration = "ANNUALLY"
	CardNewParamsSpendLimitDurationForever     CardNewParamsSpendLimitDuration = "FOREVER"
	CardNewParamsSpendLimitDurationMonthly     CardNewParamsSpendLimitDuration = "MONTHLY"
	CardNewParamsSpendLimitDurationTransaction CardNewParamsSpendLimitDuration = "TRANSACTION"
)

func (CardNewParamsSpendLimitDuration) IsKnown

type CardNewParamsState

type CardNewParamsState string

Card state values:

  • `OPEN` - Card will approve authorizations (if they match card and account parameters).
  • `PAUSED` - Card will decline authorizations, but can be resumed at a later time.
const (
	CardNewParamsStateOpen   CardNewParamsState = "OPEN"
	CardNewParamsStatePaused CardNewParamsState = "PAUSED"
)

func (CardNewParamsState) IsKnown

func (r CardNewParamsState) IsKnown() bool

type CardNewParamsType

type CardNewParamsType string

Card types:

  • `VIRTUAL` - Card will authorize at any merchant and can be added to a digital wallet like Apple Pay or Google Pay (if the card program is digital wallet-enabled).
  • `PHYSICAL` - Manufactured and sent to the cardholder. We offer white label branding, credit, ATM, PIN debit, chip/EMV, NFC and magstripe functionality. Reach out at acme.com/contact(https://acme.com/contact) for more information.
  • `SINGLE_USE` - Card is closed upon first successful authorization.
  • `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that successfully authorizes the card.
const (
	CardNewParamsTypeVirtual        CardNewParamsType = "VIRTUAL"
	CardNewParamsTypePhysical       CardNewParamsType = "PHYSICAL"
	CardNewParamsTypeMerchantLocked CardNewParamsType = "MERCHANT_LOCKED"
	CardNewParamsTypeSingleUse      CardNewParamsType = "SINGLE_USE"
)

func (CardNewParamsType) IsKnown

func (r CardNewParamsType) IsKnown() bool

type CardProvisionParams

type CardProvisionParams struct {
	// Only applicable if `digital_wallet` is `APPLE_PAY`. Omit to receive only
	// `activationData` in the response. Apple's public leaf certificate. Base64
	// encoded in PEM format with headers `(-----BEGIN CERTIFICATE-----)` and trailers
	// omitted. Provided by the device's wallet.
	Certificate param.Field[string] `json:"certificate" format:"byte"`
	// Name of digital wallet provider.
	DigitalWallet param.Field[CardProvisionParamsDigitalWallet] `json:"digital_wallet"`
	// Only applicable if `digital_wallet` is `APPLE_PAY`. Omit to receive only
	// `activationData` in the response. Base64 cryptographic nonce provided by the
	// device's wallet.
	Nonce param.Field[string] `json:"nonce" format:"byte"`
	// Only applicable if `digital_wallet` is `APPLE_PAY`. Omit to receive only
	// `activationData` in the response. Base64 cryptographic nonce provided by the
	// device's wallet.
	NonceSignature param.Field[string] `json:"nonce_signature" format:"byte"`
	IdempotencyKey param.Field[string] `header:"Idempotency-Key"`
}

func (CardProvisionParams) MarshalJSON

func (r CardProvisionParams) MarshalJSON() (data []byte, err error)

type CardProvisionParamsDigitalWallet

type CardProvisionParamsDigitalWallet string

Name of digital wallet provider.

const (
	CardProvisionParamsDigitalWalletApplePay   CardProvisionParamsDigitalWallet = "APPLE_PAY"
	CardProvisionParamsDigitalWalletGooglePay  CardProvisionParamsDigitalWallet = "GOOGLE_PAY"
	CardProvisionParamsDigitalWalletSamsungPay CardProvisionParamsDigitalWallet = "SAMSUNG_PAY"
)

func (CardProvisionParamsDigitalWallet) IsKnown

type CardProvisionResponse

type CardProvisionResponse struct {
	ProvisioningPayload string                    `json:"provisioning_payload"`
	JSON                cardProvisionResponseJSON `json:"-"`
}

func (*CardProvisionResponse) UnmarshalJSON

func (r *CardProvisionResponse) UnmarshalJSON(data []byte) (err error)

type CardService

type CardService struct {
	Options               []option.RequestOption
	FinancialTransactions *CardFinancialTransactionService
}

CardService contains methods and other services that help with interacting with the meorphis-test-46 API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCardService method instead.

func NewCardService

func NewCardService(opts ...option.RequestOption) (r *CardService)

NewCardService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CardService) Get

func (r *CardService) Get(ctx context.Context, cardToken string, opts ...option.RequestOption) (res *Card, err error)

Get card configuration such as spend limit and state.

func (*CardService) New

func (r *CardService) New(ctx context.Context, params CardNewParams, opts ...option.RequestOption) (res *Card, err error)

Create a new virtual or physical card. Parameters `pin`, `shipping_address`, and `product_id` only apply to physical cards.

func (*CardService) Provision

func (r *CardService) Provision(ctx context.Context, cardToken string, params CardProvisionParams, opts ...option.RequestOption) (res *CardProvisionResponse, err error)

Allow your cardholders to directly add payment cards to the device's digital wallet (e.g. Apple Pay) with one touch from your app.

This requires some additional setup and configuration. Please [Contact Us](https://acme.com/contact) or your Customer Success representative for more information.

func (*CardService) Update

func (r *CardService) Update(ctx context.Context, cardToken string, body CardUpdateParams, opts ...option.RequestOption) (res *Card, err error)

Update the specified properties of the card. Unsupplied properties will remain unchanged. `pin` parameter only applies to physical cards.

_Note: setting a card to a `CLOSED` state is a final action that cannot be undone._

type CardSpendLimitDuration

type CardSpendLimitDuration string

Spend limit duration values:

  • `ANNUALLY` - Card will authorize transactions up to spend limit in a calendar year.
  • `FOREVER` - Card will authorize only up to spend limit for the entire lifetime of the card.
  • `MONTHLY` - Card will authorize transactions up to spend limit for the trailing month. Month is calculated as this calendar date one month prior.
  • `TRANSACTION` - Card will authorize multiple transactions if each individual transaction is under the spend limit.
const (
	CardSpendLimitDurationAnnually    CardSpendLimitDuration = "ANNUALLY"
	CardSpendLimitDurationForever     CardSpendLimitDuration = "FOREVER"
	CardSpendLimitDurationMonthly     CardSpendLimitDuration = "MONTHLY"
	CardSpendLimitDurationTransaction CardSpendLimitDuration = "TRANSACTION"
)

func (CardSpendLimitDuration) IsKnown

func (r CardSpendLimitDuration) IsKnown() bool

type CardState

type CardState string

Card state values:

  • `CLOSED` - Card will no longer approve authorizations. Closing a card cannot be undone.
  • `OPEN` - Card will approve authorizations (if they match card and account parameters).
  • `PAUSED` - Card will decline authorizations, but can be resumed at a later time.
  • `PENDING_FULFILLMENT` - The initial state for cards of type `PHYSICAL`. The card is provisioned pending manufacturing and fulfillment. Cards in this state can accept authorizations for e-commerce purchases, but not for "Card Present" purchases where the physical card itself is present.
  • `PENDING_ACTIVATION` - Each business day at 2pm Eastern Time Zone (ET), cards of type `PHYSICAL` in state `PENDING_FULFILLMENT` are sent to the card production warehouse and updated to state `PENDING_ACTIVATION` . Similar to `PENDING_FULFILLMENT`, cards in this state can be used for e-commerce transactions. API clients should update the card's state to `OPEN` only after the cardholder confirms receipt of the card.

In sandbox, the same daily batch fulfillment occurs, but no cards are actually manufactured.

const (
	CardStateClosed             CardState = "CLOSED"
	CardStateOpen               CardState = "OPEN"
	CardStatePaused             CardState = "PAUSED"
	CardStatePendingActivation  CardState = "PENDING_ACTIVATION"
	CardStatePendingFulfillment CardState = "PENDING_FULFILLMENT"
)

func (CardState) IsKnown

func (r CardState) IsKnown() bool

type CardType

type CardType string

Card types:

  • `VIRTUAL` - Card will authorize at any merchant and can be added to a digital wallet like Apple Pay or Google Pay (if the card program is digital wallet-enabled).
  • `PHYSICAL` - Manufactured and sent to the cardholder. We offer white label branding, credit, ATM, PIN debit, chip/EMV, NFC and magstripe functionality. Reach out at acme.com/contact(https://acme.com/contact) for more information.
  • `SINGLE_USE` - Card is closed upon first successful authorization.
  • `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that successfully authorizes the card.
const (
	CardTypeVirtual        CardType = "VIRTUAL"
	CardTypePhysical       CardType = "PHYSICAL"
	CardTypeMerchantLocked CardType = "MERCHANT_LOCKED"
	CardTypeSingleUse      CardType = "SINGLE_USE"
)

func (CardType) IsKnown

func (r CardType) IsKnown() bool

type CardUpdateParams

type CardUpdateParams struct {
	// Identifier for any Auth Rules that will be applied to transactions taking place
	// with the card.
	AuthRuleToken param.Field[string] `json:"auth_rule_token"`
	// Specifies the digital card art to be displayed in the user’s digital wallet
	// after tokenization. This artwork must be approved by Mastercard and configured
	// by Acme to use. See
	// [Flexible Card Art Guide](https://docs.acme.com/docs/about-digital-wallets#flexible-card-art).
	DigitalCardArtToken param.Field[string] `json:"digital_card_art_token" format:"uuid"`
	// Friendly name to identify the card. We recommend against using this field to
	// store JSON data as it can cause unexpected behavior.
	Memo param.Field[string] `json:"memo"`
	// Encrypted PIN block (in base64). Only applies to cards of type `PHYSICAL` and
	// `VIRTUAL`. See
	// [Encrypted PIN Block](https://docs.acme.com/docs/cards#encrypted-pin-block-enterprise).
	Pin param.Field[string] `json:"pin"`
	// Amount (in cents) to limit approved authorizations. Transaction requests above
	// the spend limit will be declined. Note that a spend limit of 0 is effectively no
	// limit, and should only be used to reset or remove a prior limit. Only a limit of
	// 1 or above will result in declined transactions due to checks against the card
	// limit.
	SpendLimit param.Field[int64] `json:"spend_limit"`
	// Spend limit duration values:
	//
	//   - `ANNUALLY` - Card will authorize transactions up to spend limit in a calendar
	//     year.
	//   - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime
	//     of the card.
	//   - `MONTHLY` - Card will authorize transactions up to spend limit for the
	//     trailing month. Month is calculated as this calendar date one month prior.
	//   - `TRANSACTION` - Card will authorize multiple transactions if each individual
	//     transaction is under the spend limit.
	SpendLimitDuration param.Field[CardUpdateParamsSpendLimitDuration] `json:"spend_limit_duration"`
	// Card state values:
	//
	//   - `CLOSED` - Card will no longer approve authorizations. Closing a card cannot
	//     be undone.
	//   - `OPEN` - Card will approve authorizations (if they match card and account
	//     parameters).
	//   - `PAUSED` - Card will decline authorizations, but can be resumed at a later
	//     time.
	State param.Field[CardUpdateParamsState] `json:"state"`
}

func (CardUpdateParams) MarshalJSON

func (r CardUpdateParams) MarshalJSON() (data []byte, err error)

type CardUpdateParamsSpendLimitDuration

type CardUpdateParamsSpendLimitDuration string

Spend limit duration values:

  • `ANNUALLY` - Card will authorize transactions up to spend limit in a calendar year.
  • `FOREVER` - Card will authorize only up to spend limit for the entire lifetime of the card.
  • `MONTHLY` - Card will authorize transactions up to spend limit for the trailing month. Month is calculated as this calendar date one month prior.
  • `TRANSACTION` - Card will authorize multiple transactions if each individual transaction is under the spend limit.
const (
	CardUpdateParamsSpendLimitDurationAnnually    CardUpdateParamsSpendLimitDuration = "ANNUALLY"
	CardUpdateParamsSpendLimitDurationForever     CardUpdateParamsSpendLimitDuration = "FOREVER"
	CardUpdateParamsSpendLimitDurationMonthly     CardUpdateParamsSpendLimitDuration = "MONTHLY"
	CardUpdateParamsSpendLimitDurationTransaction CardUpdateParamsSpendLimitDuration = "TRANSACTION"
)

func (CardUpdateParamsSpendLimitDuration) IsKnown

type CardUpdateParamsState

type CardUpdateParamsState string

Card state values:

  • `CLOSED` - Card will no longer approve authorizations. Closing a card cannot be undone.
  • `OPEN` - Card will approve authorizations (if they match card and account parameters).
  • `PAUSED` - Card will decline authorizations, but can be resumed at a later time.
const (
	CardUpdateParamsStateClosed CardUpdateParamsState = "CLOSED"
	CardUpdateParamsStateOpen   CardUpdateParamsState = "OPEN"
	CardUpdateParamsStatePaused CardUpdateParamsState = "PAUSED"
)

func (CardUpdateParamsState) IsKnown

func (r CardUpdateParamsState) IsKnown() bool

type Client

type Client struct {
	Options  []option.RequestOption
	Accounts *AccountService
	Cards    *CardService
	Status   *StatusService
}

Client creates a struct with services and top level methods that help with interacting with the meorphis-test-46 API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned [url.Values] will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Error

type Error = apierror.Error

type FinancialTransaction

type FinancialTransaction struct {
	// Globally unique identifier.
	Token string `json:"token,required" format:"uuid"`
	// Status types:
	//
	//   - `CARD` - Issuing card transaction.
	//   - `ACH` - Transaction over ACH.
	//   - `TRANSFER` - Internal transfer of funds between financial accounts in your
	//     program.
	Category FinancialTransactionCategory `json:"category,required"`
	// Date and time when the financial transaction first occurred. UTC time zone.
	Created time.Time `json:"created,required" format:"date-time"`
	// 3-digit alphabetic ISO 4217 code for the settling currency of the transaction.
	Currency string `json:"currency,required"`
	// A string that provides a description of the financial transaction; may be useful
	// to display to users.
	Descriptor string `json:"descriptor,required"`
	// A list of all financial events that have modified this financial transaction.
	Events []FinancialTransactionEvent `json:"events,required"`
	// Pending amount of the transaction in the currency's smallest unit (e.g., cents),
	// including any acquirer fees. The value of this field will go to zero over time
	// once the financial transaction is settled.
	PendingAmount int64 `json:"pending_amount,required"`
	// APPROVED transactions were successful while DECLINED transactions were declined
	// by user, Acme, or the network.
	Result FinancialTransactionResult `json:"result,required"`
	// Amount of the transaction that has been settled in the currency's smallest unit
	// (e.g., cents), including any acquirer fees. This may change over time.
	SettledAmount int64 `json:"settled_amount,required"`
	// Status types:
	//
	//   - `DECLINED` - The card transaction was declined.
	//   - `EXPIRED` - Acme reversed the card authorization as it has passed its
	//     expiration time.
	//   - `PENDING` - Authorization is pending completion from the merchant or pending
	//     release from ACH hold period
	//   - `SETTLED` - The financial transaction is completed.
	//   - `VOIDED` - The merchant has voided the previously pending card authorization.
	Status FinancialTransactionStatus `json:"status,required"`
	// Date and time when the financial transaction was last updated. UTC time zone.
	Updated time.Time                `json:"updated,required" format:"date-time"`
	JSON    financialTransactionJSON `json:"-"`
}

func (*FinancialTransaction) UnmarshalJSON

func (r *FinancialTransaction) UnmarshalJSON(data []byte) (err error)

type FinancialTransactionCategory

type FinancialTransactionCategory string

Status types:

  • `CARD` - Issuing card transaction.
  • `ACH` - Transaction over ACH.
  • `TRANSFER` - Internal transfer of funds between financial accounts in your program.
const (
	FinancialTransactionCategoryCard     FinancialTransactionCategory = "CARD"
	FinancialTransactionCategoryACH      FinancialTransactionCategory = "ACH"
	FinancialTransactionCategoryTransfer FinancialTransactionCategory = "TRANSFER"
)

func (FinancialTransactionCategory) IsKnown

func (r FinancialTransactionCategory) IsKnown() bool

type FinancialTransactionEvent

type FinancialTransactionEvent struct {
	// Globally unique identifier.
	Token string `json:"token" format:"uuid"`
	// Amount of the financial event that has been settled in the currency's smallest
	// unit (e.g., cents).
	Amount int64 `json:"amount"`
	// Date and time when the financial event occurred. UTC time zone.
	Created time.Time `json:"created" format:"date-time"`
	// APPROVED financial events were successful while DECLINED financial events were
	// declined by user, Acme, or the network.
	Result FinancialTransactionEventsResult `json:"result"`
	// Event types:
	//
	//   - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to
	//     insufficient balance.
	//   - `ACH_ORIGINATION_PENDING` - ACH origination pending release from an ACH hold.
	//   - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to
	//     available balance.
	//   - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder.
	//   - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available
	//     balance.
	//   - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial
	//     Institution.
	//   - `AUTHORIZATION` - Authorize a card transaction.
	//   - `AUTHORIZATION_ADVICE` - Advice on a card transaction.
	//   - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Acme.
	//   - `AUTHORIZATION_REVERSAL` - Card Authorization was reversed by the merchant.
	//   - `BALANCE_INQUIRY` - A card balance inquiry (typically a $0 authorization) has
	//     occurred on a card.
	//   - `CLEARING` - Card Transaction is settled.
	//   - `CORRECTION_DEBIT` - Manual card transaction correction (Debit).
	//   - `CORRECTION_CREDIT` - Manual card transaction correction (Credit).
	//   - `CREDIT_AUTHORIZATION` - A refund or credit card authorization from a
	//     merchant.
	//   - `CREDIT_AUTHORIZATION_ADVICE` - A credit card authorization was approved on
	//     your behalf by the network.
	//   - `FINANCIAL_AUTHORIZATION` - A request from a merchant to debit card funds
	//     without additional clearing.
	//   - `FINANCIAL_CREDIT_AUTHORIZATION` - A request from a merchant to refund or
	//     credit card funds without additional clearing.
	//   - `RETURN` - A card refund has been processed on the transaction.
	//   - `RETURN_REVERSAL` - A card refund has been reversed (e.g., when a merchant
	//     reverses an incorrect refund).
	//   - `TRANSFER` - Successful internal transfer of funds between financial accounts.
	//   - `TRANSFER_INSUFFICIENT_FUNDS` - Declined internl transfer of funds due to
	//     insufficient balance of the sender.
	Type FinancialTransactionEventsType `json:"type"`
	JSON financialTransactionEventJSON  `json:"-"`
}

func (*FinancialTransactionEvent) UnmarshalJSON

func (r *FinancialTransactionEvent) UnmarshalJSON(data []byte) (err error)

type FinancialTransactionEventsResult

type FinancialTransactionEventsResult string

APPROVED financial events were successful while DECLINED financial events were declined by user, Acme, or the network.

const (
	FinancialTransactionEventsResultApproved FinancialTransactionEventsResult = "APPROVED"
	FinancialTransactionEventsResultDeclined FinancialTransactionEventsResult = "DECLINED"
)

func (FinancialTransactionEventsResult) IsKnown

type FinancialTransactionEventsType

type FinancialTransactionEventsType string

Event types:

  • `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient balance.
  • `ACH_ORIGINATION_PENDING` - ACH origination pending release from an ACH hold.
  • `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available balance.
  • `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder.
  • `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance.
  • `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial Institution.
  • `AUTHORIZATION` - Authorize a card transaction.
  • `AUTHORIZATION_ADVICE` - Advice on a card transaction.
  • `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Acme.
  • `AUTHORIZATION_REVERSAL` - Card Authorization was reversed by the merchant.
  • `BALANCE_INQUIRY` - A card balance inquiry (typically a $0 authorization) has occurred on a card.
  • `CLEARING` - Card Transaction is settled.
  • `CORRECTION_DEBIT` - Manual card transaction correction (Debit).
  • `CORRECTION_CREDIT` - Manual card transaction correction (Credit).
  • `CREDIT_AUTHORIZATION` - A refund or credit card authorization from a merchant.
  • `CREDIT_AUTHORIZATION_ADVICE` - A credit card authorization was approved on your behalf by the network.
  • `FINANCIAL_AUTHORIZATION` - A request from a merchant to debit card funds without additional clearing.
  • `FINANCIAL_CREDIT_AUTHORIZATION` - A request from a merchant to refund or credit card funds without additional clearing.
  • `RETURN` - A card refund has been processed on the transaction.
  • `RETURN_REVERSAL` - A card refund has been reversed (e.g., when a merchant reverses an incorrect refund).
  • `TRANSFER` - Successful internal transfer of funds between financial accounts.
  • `TRANSFER_INSUFFICIENT_FUNDS` - Declined internl transfer of funds due to insufficient balance of the sender.
const (
	FinancialTransactionEventsTypeACHInsufficientFunds         FinancialTransactionEventsType = "ACH_INSUFFICIENT_FUNDS"
	FinancialTransactionEventsTypeACHOriginationPending        FinancialTransactionEventsType = "ACH_ORIGINATION_PENDING"
	FinancialTransactionEventsTypeACHOriginationReleased       FinancialTransactionEventsType = "ACH_ORIGINATION_RELEASED"
	FinancialTransactionEventsTypeACHReceiptPending            FinancialTransactionEventsType = "ACH_RECEIPT_PENDING"
	FinancialTransactionEventsTypeACHReceiptReleased           FinancialTransactionEventsType = "ACH_RECEIPT_RELEASED"
	FinancialTransactionEventsTypeACHReturn                    FinancialTransactionEventsType = "ACH_RETURN"
	FinancialTransactionEventsTypeAuthorization                FinancialTransactionEventsType = "AUTHORIZATION"
	FinancialTransactionEventsTypeAuthorizationAdvice          FinancialTransactionEventsType = "AUTHORIZATION_ADVICE"
	FinancialTransactionEventsTypeAuthorizationExpiry          FinancialTransactionEventsType = "AUTHORIZATION_EXPIRY"
	FinancialTransactionEventsTypeAuthorizationReversal        FinancialTransactionEventsType = "AUTHORIZATION_REVERSAL"
	FinancialTransactionEventsTypeBalanceInquiry               FinancialTransactionEventsType = "BALANCE_INQUIRY"
	FinancialTransactionEventsTypeClearing                     FinancialTransactionEventsType = "CLEARING"
	FinancialTransactionEventsTypeCorrectionDebit              FinancialTransactionEventsType = "CORRECTION_DEBIT"
	FinancialTransactionEventsTypeCorrectionCredit             FinancialTransactionEventsType = "CORRECTION_CREDIT"
	FinancialTransactionEventsTypeCreditAuthorization          FinancialTransactionEventsType = "CREDIT_AUTHORIZATION"
	FinancialTransactionEventsTypeCreditAuthorizationAdvice    FinancialTransactionEventsType = "CREDIT_AUTHORIZATION_ADVICE"
	FinancialTransactionEventsTypeFinancialAuthorization       FinancialTransactionEventsType = "FINANCIAL_AUTHORIZATION"
	FinancialTransactionEventsTypeFinancialCreditAuthorization FinancialTransactionEventsType = "FINANCIAL_CREDIT_AUTHORIZATION"
	FinancialTransactionEventsTypeReturn                       FinancialTransactionEventsType = "RETURN"
	FinancialTransactionEventsTypeReturnReversal               FinancialTransactionEventsType = "RETURN_REVERSAL"
	FinancialTransactionEventsTypeTransfer                     FinancialTransactionEventsType = "TRANSFER"
	FinancialTransactionEventsTypeTransferInsufficientFunds    FinancialTransactionEventsType = "TRANSFER_INSUFFICIENT_FUNDS"
)

func (FinancialTransactionEventsType) IsKnown

type FinancialTransactionResult

type FinancialTransactionResult string

APPROVED transactions were successful while DECLINED transactions were declined by user, Acme, or the network.

const (
	FinancialTransactionResultApproved FinancialTransactionResult = "APPROVED"
	FinancialTransactionResultDeclined FinancialTransactionResult = "DECLINED"
)

func (FinancialTransactionResult) IsKnown

func (r FinancialTransactionResult) IsKnown() bool

type FinancialTransactionStatus

type FinancialTransactionStatus string

Status types:

  • `DECLINED` - The card transaction was declined.
  • `EXPIRED` - Acme reversed the card authorization as it has passed its expiration time.
  • `PENDING` - Authorization is pending completion from the merchant or pending release from ACH hold period
  • `SETTLED` - The financial transaction is completed.
  • `VOIDED` - The merchant has voided the previously pending card authorization.
const (
	FinancialTransactionStatusDeclined FinancialTransactionStatus = "DECLINED"
	FinancialTransactionStatusExpired  FinancialTransactionStatus = "EXPIRED"
	FinancialTransactionStatusPending  FinancialTransactionStatus = "PENDING"
	FinancialTransactionStatusSettled  FinancialTransactionStatus = "SETTLED"
	FinancialTransactionStatusVoided   FinancialTransactionStatus = "VOIDED"
)

func (FinancialTransactionStatus) IsKnown

func (r FinancialTransactionStatus) IsKnown() bool

type StatusListResponse

type StatusListResponse struct {
	Message string                 `json:"message"`
	JSON    statusListResponseJSON `json:"-"`
}

func (*StatusListResponse) UnmarshalJSON

func (r *StatusListResponse) UnmarshalJSON(data []byte) (err error)

type StatusService

type StatusService struct {
	Options []option.RequestOption
}

StatusService contains methods and other services that help with interacting with the meorphis-test-46 API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewStatusService method instead.

func NewStatusService

func NewStatusService(opts ...option.RequestOption) (r *StatusService)

NewStatusService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*StatusService) List

func (r *StatusService) List(ctx context.Context, opts ...option.RequestOption) (res *StatusListResponse, err error)

API status check

Jump to

Keyboard shortcuts

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