sessions

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionsPath          = "sessions"
	CollectDataPath       = "collect-data"
	CompletePath          = "complete"
	IssuerFingerprintPath = "issuer-fingerprint"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountTypeCardProductType added in v1.2.3

type AccountTypeCardProductType string
const (
	Credit        AccountTypeCardProductType = "credit"
	Debit         AccountTypeCardProductType = "debit"
	NotApplicable AccountTypeCardProductType = "not_applicable"
)

type Acs

type Acs struct {
	ReferenceNumber           string                `json:"reference_number,omitempty"`
	TransactionId             string                `json:"transaction_id,omitempty"`
	OperatorId                string                `json:"operator_id,omitempty"`
	Url                       string                `json:"url,omitempty"`
	SignedContent             string                `json:"signed_content,omitempty"`
	ChallengeMandated         bool                  `json:"challenge_mandated,omitempty"`
	AuthenticationType        string                `json:"authentication_type,omitempty"`
	ChallengeCancelReason     ChallengeCancelReason `json:"challenge_cancel_reason,omitempty"`
	Interface                 SessionInterface      `json:"interface,omitempty"`
	UiTemplate                channels.UIElements   `json:"ui_template,omitempty"`
	ChallengeCancelReasonCode string                `json:"challenge_cancel_reason_code,omitempty"`
}

type AuthenticationMethod

type AuthenticationMethod string
const (
	FederatedId              AuthenticationMethod = "federated_id"
	Fido                     AuthenticationMethod = "fido"
	IssuerCredentials        AuthenticationMethod = "issuer_credentials"
	NoAuthentication         AuthenticationMethod = "no_authentication"
	OwnCredentials           AuthenticationMethod = "own_credentials"
	ThirdPartyAuthentication AuthenticationMethod = "third_party_authentication"
)

type AuthenticationType

type AuthenticationType string
const (
	AddCardAuthType      AuthenticationType = "add_card"
	InstallmentAuthType  AuthenticationType = "installment"
	MaintainCardAuthType AuthenticationType = "maintain_card"
	RecurringAuthType    AuthenticationType = "recurring"
	RegularAuthType      AuthenticationType = "regular"
)

type CardInfo

type CardInfo struct {
	InstrumentId string                        `json:"instrument_id,omitempty"`
	Fingerprint  string                        `json:"fingerprint,omitempty"`
	Metadata     *SessionsCardMetadataResponse `json:"metadata,omitempty"`
}

type CardholderAccountInfo

type CardholderAccountInfo struct {
	PurchaseCount                      int64                                     `json:"purchase_count,omitempty"`
	AccountAge                         string                                    `json:"account_age,omitempty"`
	AddCardAttempts                    int64                                     `json:"add_card_attempts,omitempty"`
	ShippingAddressAge                 string                                    `json:"shipping_address_age,omitempty"`
	AccountNameMatchesShippingName     bool                                      `json:"account_name_matches_shipping_name,omitempty"`
	SuspiciousAccountActivity          bool                                      `json:"suspicious_account_activity,omitempty"`
	TransactionsToday                  int64                                     `json:"transactions_today,omitempty"`
	AuthenticationMethod               *AuthenticationMethod                     `json:"authentication_method,omitempty"` // Deprecated field
	CardholderAccountAgeIndicator      common.CardholderAccountAgeIndicatorType  `json:"cardholder_account_age_indicator,omitempty"`
	AccountChange                      *time.Time                                `json:"account_change,omitempty"`
	AccountChangeIndicator             common.AccountChangeIndicatorType         `json:"account_change_indicator,omitempty"`
	AccountDate                        *time.Time                                `json:"account_date,omitempty"`
	AccountPasswordChange              string                                    `json:"account_password_change,omitempty"`
	AccountPasswordChangeIndicator     common.AccountPasswordChangeIndicatorType `json:"account_password_change_indicator,omitempty"`
	TransactionsPerYear                int                                       `json:"transactions_per_year,omitempty"`
	PaymentAccountAge                  *time.Time                                `json:"payment_account_age,omitempty"`
	ShippingAddressUsage               *time.Time                                `json:"shipping_address_usage,omitempty"`
	AccountType                        AccountTypeCardProductType                `json:"account_type,omitempty"`
	AccountId                          string                                    `json:"account_id,omitempty"`
	ThreeDsRequestorAuthenticationInfo *ThreeDsRequestorAuthenticationInfo       `json:"three_ds_requestor_authentication_info,omitempty"`
}

type Category

type Category string
const (
	Payment    Category = "payment"
	NonPayment Category = "nonPayment"
)

type ChallengeCancelReason

type ChallengeCancelReason string
const (
	CardHolderCancel    ChallengeCancelReason = "cardholder_cancel"
	TransactionTimedOut ChallengeCancelReason = "transaction_timed_out"
	ChallengeTimedOut   ChallengeCancelReason = "challenge_timed_out"
	TransactionError    ChallengeCancelReason = "transaction_error"
	SdkTimedOut         ChallengeCancelReason = "sdk_timed_out"
	Unknown             ChallengeCancelReason = "unknown"
)

type Client

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

func NewClient

func NewClient(configuration *configuration.Configuration, apiClient client.HttpClient) *Client

func (*Client) CompleteSession

func (c *Client) CompleteSession(sessionId, sessionSecret string) (*common.MetadataResponse, error)

func (*Client) GetSessionDetails

func (c *Client) GetSessionDetails(sessionId string, sessionSecret string) (*GetSessionResponse, error)

func (*Client) RequestSession

func (c *Client) RequestSession(request SessionRequest) (*SessionResponse, error)

func (*Client) Update3dsMethodCompletion

func (c *Client) Update3dsMethodCompletion(
	sessionId string,
	request ThreeDsMethodCompletionRequest,
	sessionSecret string,
) (*Update3dsMethodCompletionResponse, error)

func (*Client) UpdateSession

func (c *Client) UpdateSession(
	sessionId string,
	request channels.Channel,
	sessionSecret string,
) (*GetSessionResponse, error)

type DeliveryTimeframe

type DeliveryTimeframe string
const (
	ElectronicDelivery DeliveryTimeframe = "electronic_delivery"
	SameDay            DeliveryTimeframe = "same_day"
	Overnight          DeliveryTimeframe = "overnight"
	TwoDayOrMore       DeliveryTimeframe = "two_day_or_more"
)

type Ds

type Ds struct {
	DsId            string `json:"ds_id,omitempty"`
	ReferenceNumber string `json:"reference_number,omitempty"`
	TransactionId   string `json:"transaction_id,omitempty"`
}

type DsPublicKeys

type DsPublicKeys struct {
	DsPublic string `json:"ds_public,omitempty"`
	CaPublic string `json:"ca_public,omitempty"`
}

type GetSessionResponse

type GetSessionResponse struct {
	SessionDetails
}

type InitialTransaction added in v1.2.3

type InitialTransaction struct {
	AcsTransactionId        string `json:"acs_transaction_id,omitempty"`
	AuthenticationMethod    string `json:"authentication_method,omitempty"`
	AuthenticationTimestamp string `json:"authentication_timestamp,omitempty"`
	AuthenticationData      string `json:"authentication_data,omitempty"`
	InitialSessionId        string `json:"initial_session_id,omitempty"`
}

type Installment

type Installment struct {
	NumberOfPayments    int    `json:"number_of_payments,omitempty"`
	DaysBetweenPayments int    `json:"days_between_payments,omitempty" default:"1"`
	Expiry              string `json:"expiry,omitempty" default:"99991231"`
}

type MerchantRiskInfo

type MerchantRiskInfo struct {
	DeliveryEmail             string                        `json:"delivery_email,omitempty"`
	DeliveryTimeframe         DeliveryTimeframe             `json:"delivery_timeframe,omitempty"`
	IsPreorder                bool                          `json:"is_preorder,omitempty"`
	IsReorder                 bool                          `json:"is_reorder,omitempty"`
	ShippingIndicator         ShippingIndicator             `json:"shipping_indicator,omitempty"`
	ReorderItemsIndicator     ReorderItemsIndicatorType     `json:"reorder_items_indicator,omitempty"`
	PreOrderPurchaseIndicator PreOrderPurchaseIndicatorType `json:"pre_order_purchase_indicator,omitempty"`
	PreOrderDate              *time.Time                    `json:"pre_order_date,omitempty"`
	GiftCardAmount            string                        `json:"gift_card_amount,omitempty"`
	GiftCardCurrency          string                        `json:"gift_card_currency,omitempty"`
	GiftCardCount             string                        `json:"gift_card_count,omitempty"`
}

type NextAction

type NextAction string
const (
	Authenticate        NextAction = "authenticate"
	ChallengeCardHolder NextAction = "challenge_cardholder"
	CollectChannelData  NextAction = "collect_channel_data"
	Complete            NextAction = "complete"
	IssueFingerprint    NextAction = "issuer_fingerprint"
	RedirectCardholder  NextAction = "redirect_cardholder"
)

type Optimization added in v1.2.3

type Optimization struct {
	Optimized           bool                `json:"optimized,omitempty"`
	Framework           string              `json:"framework,omitempty"`
	OptimizedProperties []OptimizedProperty `json:"optimized_properties,omitempty"`
}

type OptimizedProperty added in v1.2.3

type OptimizedProperty struct {
	Field          string `json:"field,omitempty"`
	OriginalValue  string `json:"original_value,omitempty"`
	OptimizedValue string `json:"optimized_value,omitempty"`
}

type PreOrderPurchaseIndicatorType added in v1.2.3

type PreOrderPurchaseIndicatorType string
const (
	FutureAvailability   PreOrderPurchaseIndicatorType = "future_availability"
	MerchandiseAvailable PreOrderPurchaseIndicatorType = "merchandise_available"
)

type Recurring

type Recurring struct {
	DaysBetweenPayments int    `json:"days_between_payments,omitempty" default:"1"`
	Expiry              string `json:"expiry,omitempty" default:"99991231"`
}

type ReorderItemsIndicatorType added in v1.2.3

type ReorderItemsIndicatorType string
const (
	FirstTimeOrdered ReorderItemsIndicatorType = "first_time_ordered"
	Reordered        ReorderItemsIndicatorType = "reordered"
)

type ResponseCode

type ResponseCode string
const (
	A ResponseCode = "A"
	C ResponseCode = "C"
	D ResponseCode = "D"
	I ResponseCode = "I"
	N ResponseCode = "N"
	R ResponseCode = "R"
	U ResponseCode = "U"
	Y ResponseCode = "Y"
)

type SchemeInfo

type SchemeInfo struct {
	Name   sources.SessionScheme `json:"name,omitempty"`
	Score  string                `json:"score,omitempty"`
	Avalgo string                `json:"avalgo,omitempty"`
}

type SessionDetails

type SessionDetails struct {
	HttpMetadata           common.HttpMetadata
	Id                     string                     `json:"id,omitempty"`
	SessionSecret          string                     `json:"session_secret,omitempty"`
	TransactionId          string                     `json:"transaction_id,omitempty"`
	Scheme                 sources.SessionScheme      `json:"scheme,omitempty"`
	Amount                 int64                      `json:"amount,omitempty"`
	Currency               common.Currency            `json:"currency,omitempty"`
	Completed              bool                       `json:"completed,omitempty"`
	Challenged             bool                       `json:"challenged,omitempty"`
	AuthenticationType     AuthenticationType         `json:"authentication_type,omitempty"`
	AuthenticationCategory Category                   `json:"authentication_category,omitempty"`
	Status                 SessionStatus              `json:"status,omitempty"`
	StatusReason           StatusReason               `json:"status_reason,omitempty"`
	NextActions            []NextAction               `json:"next_actions,omitempty"`
	ProtocolVersion        string                     `json:"protocol_version,omitempty"`
	AccountInfo            *CardholderAccountInfo     `json:"account_info,omitempty"`
	MerchantRiskInfo       *MerchantRiskInfo          `json:"merchant_risk_info,omitempty"`
	Reference              string                     `json:"reference,omitempty"`
	Card                   *CardInfo                  `json:"card,omitempty"`
	Recurring              *Recurring                 `json:"recurring,omitempty"`
	Installment            *Installment               `json:"installment,omitempty"`
	InitialTransaction     *InitialTransaction        `json:"initial_transaction,omitempty"`
	AuthenticationDate     *time.Time                 `json:"authentication_date,omitempty"`
	ChallengeIndicator     *common.ChallengeIndicator `json:"challenge_indicator,omitempty"`
	Optimization           *Optimization              `json:"optimization,omitempty"`
	Certificates           *DsPublicKeys              `json:"certificates,omitempty"`
	Approved               bool                       `json:"approved,omitempty"`
	TransactionType        TransactionType            `json:"transaction_type,omitempty"`
	Ds                     *Ds                        `json:"ds,omitempty"`
	Acs                    *Acs                       `json:"acs,omitempty"`
	ResponseCode           ResponseCode               `json:"response_code,omitempty"`
	ResponseStatusReason   string                     `json:"response_status_reason,omitempty"`
	Pareq                  string                     `json:"pareq,omitempty"`
	Cryptogram             string                     `json:"cryptogram,omitempty"`
	Eci                    string                     `json:"eci,omitempty"`
	Xid                    string                     `json:"xid,omitempty"`
	CardholderInfo         string                     `json:"cardholder_info,omitempty"`
	CustomerIp             string                     `json:"customer_ip,omitempty"`
	Exemption              *ThreeDsExemption          `json:"exemption,omitempty"`
	FlowType               common.ThreeDsFlowType     `json:"flow_type,omitempty"`
	SchemeInfo             *SchemeInfo                `json:"scheme_info,omitempty"`
	Links                  map[string]common.Link     `json:"_links,omitempty"`
}

type SessionInterface

type SessionInterface string
const (
	Html     SessionInterface = "html"
	NativeUi SessionInterface = "native_ui"
)

type SessionMarketplaceData

type SessionMarketplaceData struct {
	SubEntityId string `json:"sub_entity_id,omitempty"`
}

type SessionRequest

type SessionRequest struct {
	Source                        sources.SessionSource      `json:"source,omitempty"`
	Amount                        int64                      `json:"amount,omitempty"`
	Currency                      common.Currency            `json:"currency,omitempty"`
	ProcessingChannelId           string                     `json:"processing_channel_id,omitempty"`
	Marketplace                   *SessionMarketplaceData    `json:"marketplace,omitempty"`
	AuthenticationType            AuthenticationType         `json:"authentication_type,omitempty"`
	AuthenticationCategory        Category                   `json:"authentication_category,omitempty"`
	AccountInfo                   *CardholderAccountInfo     `json:"account_info,omitempty"`
	ChallengeIndicator            common.ChallengeIndicator  `json:"challenge_indicator,omitempty"`
	BillingDescriptor             *SessionsBillingDescriptor `json:"billing_descriptor,omitempty"`
	Reference                     string                     `json:"reference,omitempty"`
	MerchantRiskInfo              *MerchantRiskInfo          `json:"merchant_risk_info,omitempty"`
	PriorTransactionReference     string                     `json:"prior_transaction_reference,omitempty"`
	TransactionType               TransactionType            `json:"transaction_type,omitempty"`
	ShippingAddress               *sources.SessionAddress    `json:"shipping_address,omitempty"`
	ShippingAddressMatchesBilling bool                       `json:"shipping_address_matches_billing,omitempty"`
	Completion                    completion.Completion      `json:"completion,omitempty"`
	ChannelData                   channels.Channel           `json:"channel_data,omitempty"`
	Recurring                     *Recurring                 `json:"recurring,omitempty"`
	Installment                   *Installment               `json:"installment,omitempty"`
	Optimization                  *Optimization              `json:"optimization,omitempty"`
	InitialTransaction            *InitialTransaction        `json:"initial_transaction,omitempty"`
}

func NewSessionRequest added in v1.2.3

func NewSessionRequest() *SessionRequest

type SessionResponse

type SessionResponse struct {
	Accepted *SessionDetails `json:"accepted,omitempty"`
	Created  *SessionDetails `json:"created,omitempty"`
}

func (*SessionResponse) MapResponse

func (r *SessionResponse) MapResponse(response *SessionDetails)

type SessionSecretCredentials

type SessionSecretCredentials struct {
	SessionSecret string
}

func NewSessionSecretCredentials

func NewSessionSecretCredentials(sessionSecret string) *SessionSecretCredentials

func (*SessionSecretCredentials) GetAuthorization

type SessionStatus

type SessionStatus string
const (
	Approved           SessionStatus = "approved"
	Attempted          SessionStatus = "attempted"
	Challenged         SessionStatus = "challenged"
	ChallengeAbandoned SessionStatus = "challenge_abandoned"
	Declined           SessionStatus = "declined"
	Expired            SessionStatus = "expired"
	Pending            SessionStatus = "pending"
	Processing         SessionStatus = "processing"
	Rejected           SessionStatus = "rejected"
	Unavailable        SessionStatus = "unavailable"
)

type SessionsBillingDescriptor

type SessionsBillingDescriptor struct {
	Name string `json:"name,omitempty"`
}

type SessionsCardMetadataResponse added in v1.2.3

type SessionsCardMetadataResponse struct {
	CardType      common.CardType     `json:"card_type"`
	CardCategory  common.CardCategory `json:"card_category"`
	IssuerName    string              `json:"issuer_name"`
	IssuerCountry common.Country      `json:"issuer_country"`
	ProductId     string              `json:"product_id"`
	ProductType   string              `json:"product_type"`
}

type ShippingIndicator

type ShippingIndicator string
const (
	Visa ShippingIndicator = "visa"
)

type StatusReason

type StatusReason string
const (
	AresError    StatusReason = "ares_error"
	AresStatus   StatusReason = "ares_status"
	VeresError   StatusReason = "veres_error"
	VeresStatus  StatusReason = "veres_status"
	ParesError   StatusReason = "pares_error"
	ParesStatus  StatusReason = "pares_status"
	RreqError    StatusReason = "rreq_error"
	RreqStatus   StatusReason = "rreq_status"
	RiskDeclined StatusReason = "risk_declined"
)

type ThreeDsExemption

type ThreeDsExemption struct {
	Requested          string              `json:"requested,omitempty"`
	Applied            common.Exemption    `json:"applied,omitempty"`
	Code               string              `json:"code,omitempty"`
	TrustedBeneficiary *TrustedBeneficiary `json:"trusted_beneficiary,omitempty"`
}

type ThreeDsMethodCompletionRequest

type ThreeDsMethodCompletionRequest struct {
	ThreeDsMethodCompletion common.ThreeDsMethodCompletion `json:"three_ds_method_completion,omitempty"`
}

type ThreeDsReqAuthMethodType added in v1.2.3

type ThreeDsReqAuthMethodType string
const (
	ThreeDsFederatedId                              ThreeDsReqAuthMethodType = "federated_id"
	ThreeDsFidoAuthenticator                        ThreeDsReqAuthMethodType = "fido_authenticator"
	ThreeDsFidoAuthenticatorFidoAssuranceDataSigned ThreeDsReqAuthMethodType = "fido_authenticator_fido_assurance_data_signed"
	ThreeDsIssuerCredentials                        ThreeDsReqAuthMethodType = "issuer_credentials"
	ThreeDsNoAuthenticationOccurred                 ThreeDsReqAuthMethodType = "no_threeds_requestor_authentication_occurred"
	ThreeDsSrcAssuranceData                         ThreeDsReqAuthMethodType = "src_assurance_data"
	ThreeDsOwnCredentials                           ThreeDsReqAuthMethodType = "three3ds_requestor_own_credentials"
	ThreeDsThirdPartyAuthentication                 ThreeDsReqAuthMethodType = "third_party_authentication"
)

type ThreeDsRequestorAuthenticationInfo added in v1.2.3

type ThreeDsRequestorAuthenticationInfo struct {
	ThreeDsReqAuthMethod    *ThreeDsReqAuthMethodType `json:"three_ds_req_auth_method,omitempty"`
	ThreeDsReqAuthTimestamp *time.Time                `json:"three_ds_req_auth_timestamp,omitempty"`
	ThreeDsReqAuthData      string                    `json:"three_ds_req_auth_data,omitempty"`
}

type TransactionType

type TransactionType string
const (
	AccountFunding           TransactionType = "account_funding"
	CheckAcceptance          TransactionType = "check_acceptance"
	GoodsService             TransactionType = "goods_service"
	PrepaidActivationAndLoad TransactionType = "prepaid_activation_and_load"
	QuashiCardTransaction    TransactionType = "quashi_card_transaction"
)

type TrustedBeneficiary

type TrustedBeneficiary struct {
	Status TrustedBeneficiaryStatusType `json:"status,omitempty"`
	Source string                       `json:"source,omitempty"`
}

type TrustedBeneficiaryStatusType added in v1.2.3

type TrustedBeneficiaryStatusType string
const (
	TrustedBeneficiaryE TrustedBeneficiaryStatusType = "E"
	TrustedBeneficiaryN TrustedBeneficiaryStatusType = "N"
	TrustedBeneficiaryP TrustedBeneficiaryStatusType = "P"
	TrustedBeneficiaryR TrustedBeneficiaryStatusType = "R"
	TrustedBeneficiaryU TrustedBeneficiaryStatusType = "U"
	TrustedBeneficiaryY TrustedBeneficiaryStatusType = "Y"
)

type Update3dsMethodCompletionResponse

type Update3dsMethodCompletionResponse struct {
	HttpMetadata           common.HttpMetadata
	Id                     string                 `json:"id,omitempty"`
	SessionSecret          string                 `json:"session_secret,omitempty"`
	TransactionId          string                 `json:"transaction_id,omitempty"`
	Scheme                 sources.SessionScheme  `json:"scheme,omitempty"`
	Amount                 int64                  `json:"amount,omitempty"`
	Currency               common.Currency        `json:"currency,omitempty"`
	Completed              bool                   `json:"completed,omitempty"`
	Challenged             bool                   `json:"challenged,omitempty"`
	AuthenticationType     AuthenticationType     `json:"authentication_type,omitempty"`
	AuthenticationCategory Category               `json:"authentication_category,omitempty"`
	Certificates           *DsPublicKeys          `json:"certificates,omitempty"`
	Status                 SessionStatus          `json:"status,omitempty"`
	StatusReason           StatusReason           `json:"status_reason,omitempty"`
	Approved               bool                   `json:"approved,omitempty"`
	ProtocolVersion        string                 `json:"protocol_version,omitempty"`
	AccountInfo            *CardholderAccountInfo `json:"account_info,omitempty"`
	MerchantRiskInfo       *MerchantRiskInfo      `json:"merchant_risk_info,omitempty"`
	Reference              string                 `json:"reference,omitempty"`
	TransactionType        TransactionType        `json:"transaction_type,omitempty"`
	NextActions            []NextAction           `json:"next_actions,omitempty"`
	Ds                     *Ds                    `json:"ds,omitempty"`
	Acs                    *Acs                   `json:"acs,omitempty"`
	ResponseCode           ResponseCode           `json:"response_code,omitempty"`
	ResponseStatusReason   string                 `json:"response_status_reason,omitempty"`
	Pareq                  string                 `json:"pareq,omitempty"`
	Cryptogram             string                 `json:"cryptogram,omitempty"`
	Eci                    string                 `json:"eci,omitempty"`
	Xid                    string                 `json:"xid,omitempty"`
	Card                   *CardInfo              `json:"card,omitempty"`
	Links                  map[string]common.Link `json:"_links"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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