common

package
v0.0.0-...-ff628f3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDefaultClient

func BuildDefaultClient() *http.Client

func BuildPath

func BuildPath(params ...string) string

func BuildQueryPath

func BuildQueryPath(path string, queryValues interface{}) (string, error)

func EscapeQuotes

func EscapeQuotes(s string) string

func Marshal

func Marshal(request interface{}) (*bytes.Buffer, error)

func Unmarshal

func Unmarshal(metadata *HttpMetadata, responseMapping interface{}) error

Types

type AccountHolder

type AccountHolder struct {
	Type              AccountHolderType            `json:"type,omitempty"`
	Title             string                       `json:"title,omitempty"`
	FirstName         string                       `json:"first_name,omitempty"`
	MiddleName        string                       `json:"middle_name,omitempty"`
	LastName          string                       `json:"last_name,omitempty"`
	CompanyName       string                       `json:"company_name,omitempty"`
	TaxId             string                       `json:"tax_id,omitempty"`
	DateOfBirth       string                       `json:"date_of_birth,omitempty"`
	CountryOfBirth    string                       `json:"country_of_birth,omitempty"`
	ResidentialStatus string                       `json:"residential_status,omitempty"`
	BillingAddress    *Address                     `json:"billing_address,omitempty"`
	Phone             *Phone                       `json:"phone,omitempty"`
	Identification    *AccountHolderIdentification `json:"identification,omitempty"`
	Email             string                       `json:"email,omitempty"`
	Gender            string                       `json:"gender,omitempty"`
}

type AccountHolderIdentification

type AccountHolderIdentification struct {
	Type           AccountHolderIdentificationType `json:"type,omitempty"`
	Number         string                          `json:"number,omitempty"`
	IssuingCountry Country                         `json:"issuing_country,omitempty"`
	DateOfExpiry   string                          `json:"date_of_expiry,omitempty"`
}

type AccountHolderIdentificationType

type AccountHolderIdentificationType string
const (
	Passport            AccountHolderIdentificationType = "passport"
	DrivingLicence      AccountHolderIdentificationType = "driving_licence"
	NationalId          AccountHolderIdentificationType = "national_id"
	CompanyRegistration AccountHolderIdentificationType = "company_registration"
	TaxId               AccountHolderIdentificationType = "tax_id"
)

type AccountHolderType

type AccountHolderType string
const (
	Individual AccountHolderType = "individual"
	Corporate  AccountHolderType = "corporate"
	Government AccountHolderType = "government"
)

type AccountType

type AccountType string
const (
	Savings AccountType = "savings"
	Current AccountType = "current"
	Cash    AccountType = "cash"
)

type Address

type Address struct {
	AddressLine1 string  `json:"address_line1,omitempty"`
	AddressLine2 string  `json:"address_line2,omitempty"`
	City         string  `json:"city,omitempty"`
	State        string  `json:"state,omitempty"`
	Zip          string  `json:"zip,omitempty"`
	Country      Country `json:"country,omitempty"`
}

type AlternativeResponse

type AlternativeResponse map[string]interface{}

type AmountAllocations

type AmountAllocations struct {
	Id         string      `json:"id,omitempty"`
	Amount     int64       `json:"amount,omitempty"`
	Reference  string      `json:"reference,omitempty"`
	Commission *Commission `json:"commission,omitempty"`
}

type BankDetails

type BankDetails struct {
	Name    string   `json:"name,omitempty"`
	Branch  string   `json:"branch,omitempty"`
	Address *Address `json:"address,omitempty"`
}

type CardCategory

type CardCategory string
const (
	Consumer          CardCategory = "Consumer"
	Commercial        CardCategory = "Commercial"
	All               CardCategory = "All"
	OtherCardCategory CardCategory = "Other"
)

type CardType

type CardType string
const (
	Credit        CardType = "Credit"
	Debit         CardType = "Debit"
	Prepaid       CardType = "Prepaid"
	Charge        CardType = "Charge"
	DeferredDebit CardType = "Deferred Debit"
)

type ChallengeIndicator

type ChallengeIndicator string
const (
	NoPreference              ChallengeIndicator = "no_preference"
	NoChallengeRequested      ChallengeIndicator = "no_challenge_requested"
	ChallengeRequested        ChallengeIndicator = "challenge_requested"
	ChallengeRequestedMandate ChallengeIndicator = "challenge_requested_mandate"
)

type Commission

type Commission struct {
	Amount     int64   `json:"amount,omitempty"`
	Percentage float32 `json:"percentage,omitempty"`
}

type ContentResponse

type ContentResponse struct {
	HttpMetadata HttpMetadata
	Content      string `json:"content,omitempty"`
}

type Country

type Country string
const (
	AF Country = "AF"
	AX Country = "AX"
	AL Country = "AL"
	DZ Country = "DZ"
	AS Country = "AS"
	AO Country = "AO"
	AI Country = "AI"
	AG Country = "AG"
	AR Country = "AR"
	AM Country = "AM"
	AW Country = "AW"
	AC Country = "AC"
	AU Country = "AU"
	AQ Country = "AQ"
	AT Country = "AT"
	AZ Country = "AZ"
	BS Country = "BS"
	BH Country = "BH"
	BD Country = "BD"
	BB Country = "BB"
	BY Country = "BY"
	BE Country = "BE"
	BZ Country = "BZ"
	BJ Country = "BJ"
	BM Country = "BM"
	BT Country = "BT"
	BO Country = "BO"
	BQ Country = "BQ"
	BA Country = "BA"
	BW Country = "BW"
	BV Country = "BV"
	BR Country = "BR"
	IO Country = "IO"
	VG Country = "VG"
	BN Country = "BN"
	BG Country = "BG"
	BF Country = "BF"
	BI Country = "BI"
	KH Country = "KH"
	CM Country = "CM"
	CA Country = "CA"
	CV Country = "CV"
	KY Country = "KY"
	CF Country = "CF"
	TD Country = "TD"
	CL Country = "CL"
	CN Country = "CN"
	TW Country = "TW"
	CX Country = "CX"
	PF Country = "PF"
	CC Country = "CC"
	CO Country = "CO"
	KM Country = "KM"
	CG Country = "CG"
	CD Country = "CD"
	CK Country = "CK"
	CR Country = "CR"
	CI Country = "CI"
	HR Country = "HR"
	CU Country = "CU"
	CW Country = "CW"
	CY Country = "CY"
	CZ Country = "CZ"
	DK Country = "DK"
	DJ Country = "DJ"
	DM Country = "DM"
	DO Country = "DO"
	EC Country = "EC"
	EG Country = "EG"
	SV Country = "SV"
	GQ Country = "GQ"
	ER Country = "ER"
	EE Country = "EE"
	SZ Country = "SZ"
	ET Country = "ET"
	FK Country = "FK"
	FO Country = "FO"
	FJ Country = "FJ"
	FI Country = "FI"
	FR Country = "FR"
	GF Country = "GF"
	TF Country = "TF"
	GA Country = "GA"
	GM Country = "GM"
	GE Country = "GE"
	DE Country = "DE"
	GH Country = "GH"
	GI Country = "GI"
	GR Country = "GR"
	GL Country = "GL"
	GD Country = "GD"
	GP Country = "GP"
	GU Country = "GU"
	GT Country = "GT"
	GG Country = "GG"
	GN Country = "GN"
	GW Country = "GW"
	GY Country = "GY"
	HT Country = "HT"
	HM Country = "HM"
	HN Country = "HN"
	HK Country = "HK"
	HU Country = "HU"
	IS Country = "IS"
	IN Country = "IN"
	ID Country = "ID"
	IR Country = "IR"
	IQ Country = "IQ"
	IE Country = "IE"
	IM Country = "IM"
	IL Country = "IL"
	IT Country = "IT"
	JM Country = "JM"
	JP Country = "JP"
	JE Country = "JE"
	JO Country = "JO"
	KZ Country = "KZ"
	KE Country = "KE"
	KI Country = "KI"
	KP Country = "KP"
	KR Country = "KR"
	KW Country = "KW"
	KG Country = "KG"
	LA Country = "LA"
	LV Country = "LV"
	LB Country = "LB"
	LS Country = "LS"
	LR Country = "LR"
	LY Country = "LY"
	LI Country = "LI"
	LT Country = "LT"
	LU Country = "LU"
	MO Country = "MO"
	MK Country = "MK"
	MG Country = "MG"
	MW Country = "MW"
	MY Country = "MY"
	MV Country = "MV"
	ML Country = "ML"
	MT Country = "MT"
	MH Country = "MH"
	MQ Country = "MQ"
	MR Country = "MR"
	MU Country = "MU"
	YT Country = "YT"
	MX Country = "MX"
	FM Country = "FM"
	MD Country = "MD"
	MC Country = "MC"
	MN Country = "MN"
	ME Country = "ME"
	MS Country = "MS"
	MA Country = "MA"
	MZ Country = "MZ"
	MM Country = "MM"
	NA Country = "NA"
	NR Country = "NR"
	NP Country = "NP"
	NL Country = "NL"
	AN Country = "AN"
	NC Country = "NC"
	NZ Country = "NZ"
	NI Country = "NI"
	NE Country = "NE"
	NG Country = "NG"
	NU Country = "NU"
	NF Country = "NF"
	MP Country = "MP"
	NO Country = "NO"
	OM Country = "OM"
	PK Country = "PK"
	PW Country = "PW"
	PA Country = "PA"
	PG Country = "PG"
	PY Country = "PY"
	PE Country = "PE"
	PH Country = "PH"
	PN Country = "PN"
	PL Country = "PL"
	PT Country = "PT"
	PR Country = "PR"
	QA Country = "QA"
	RE Country = "RE"
	RO Country = "RO"
	RU Country = "RU"
	RW Country = "RW"
	BL Country = "BL"
	SH Country = "SH"
	KN Country = "KN"
	LC Country = "LC"
	MF Country = "MF"
	PM Country = "PM"
	VC Country = "VC"
	WS Country = "WS"
	SM Country = "SM"
	ST Country = "ST"
	SA Country = "SA"
	SN Country = "SN"
	RS Country = "RS"
	SC Country = "SC"
	SL Country = "SL"
	SG Country = "SG"
	SX Country = "SX"
	SK Country = "SK"
	SI Country = "SI"
	SB Country = "SB"
	SO Country = "SO"
	ZA Country = "ZA"
	GS Country = "GS"
	SS Country = "SS"
	ES Country = "ES"
	LK Country = "LK"
	SD Country = "SD"
	SR Country = "SR"
	SJ Country = "SJ"
	SE Country = "SE"
	CH Country = "CH"
	SY Country = "SY"
	TJ Country = "TJ"
	TZ Country = "TZ"
	TH Country = "TH"
	TL Country = "TL"
	TG Country = "TG"
	TK Country = "TK"
	TO Country = "TO"
	TT Country = "TT"
	TA Country = "TA"
	TN Country = "TN"
	TR Country = "TR"
	TM Country = "TM"
	TC Country = "TC"
	TV Country = "TV"
	VI Country = "VI"
	UG Country = "UG"
	UA Country = "UA"
	AE Country = "AE"
	GB Country = "GB"
	US Country = "US"
	UY Country = "UY"
	UZ Country = "UZ"
	VU Country = "VU"
	VA Country = "VA"
	VE Country = "VE"
	VN Country = "VN"
	UM Country = "UM"
	WF Country = "WF"
	EH Country = "EH"
	YE Country = "YE"
	ZM Country = "ZM"
	ZW Country = "ZW"
	PS Country = "PS"
	QZ Country = "QZ"
)

type Currency

type Currency string
const (
	AED Currency = "AED"
	AFN Currency = "AFN"
	ALL Currency = "ALL"
	AMD Currency = "AMD"
	ANG Currency = "ANG"
	AOA Currency = "AOA"
	ARS Currency = "ARS"
	AUD Currency = "AUD"
	AWG Currency = "AWG"
	AZN Currency = "AZN"
	BAM Currency = "BAM"
	BBD Currency = "BBD"
	BDT Currency = "BDT"
	BGN Currency = "BGN"
	BHD Currency = "BHD"
	BIF Currency = "BIF"
	BMD Currency = "BMD"
	BND Currency = "BND"
	BOB Currency = "BOB"
	BRL Currency = "BRL"
	BSD Currency = "BSD"
	BTN Currency = "BTN"
	BWP Currency = "BWP"
	BYN Currency = "BYN"
	BZD Currency = "BZD"
	CAD Currency = "CAD"
	CDF Currency = "CDF"
	CHF Currency = "CHF"
	CLF Currency = "CLF"
	CLP Currency = "CLP"
	CNY Currency = "CNY"
	COP Currency = "COP"
	CRC Currency = "CRC"
	CUP Currency = "CUP"
	CVE Currency = "CVE"
	CZK Currency = "CZK"
	DJF Currency = "DJF"
	DKK Currency = "DKK"
	DOP Currency = "DOP"
	DZD Currency = "DZD"
	EEK Currency = "EEK"
	EGP Currency = "EGP"
	ERN Currency = "ERN"
	ETB Currency = "ETB"
	EUR Currency = "EUR"
	FJD Currency = "FJD"
	FKP Currency = "FKP"
	GBP Currency = "GBP"
	GEL Currency = "GEL"
	GHS Currency = "GHS"
	GIP Currency = "GIP"
	GMD Currency = "GMD"
	GNF Currency = "GNF"
	GTQ Currency = "GTQ"
	GYD Currency = "GYD"
	HKD Currency = "HKD"
	HNL Currency = "HNL"
	HRK Currency = "HRK"
	HTG Currency = "HTG"
	HUF Currency = "HUF"
	IDR Currency = "IDR"
	ILS Currency = "ILS"
	INR Currency = "INR"
	IQD Currency = "IQD"
	IRR Currency = "IRR"
	ISK Currency = "ISK"
	JMD Currency = "JMD"
	JOD Currency = "JOD"
	JPY Currency = "JPY"
	KES Currency = "KES"
	KGS Currency = "KGS"
	KHR Currency = "KHR"
	KMF Currency = "KMF"
	KPW Currency = "KPW"
	KRW Currency = "KRW"
	KWD Currency = "KWD"
	KYD Currency = "KYD"
	KZT Currency = "KZT"
	LAK Currency = "LAK"
	LBP Currency = "LBP"
	LKR Currency = "LKR"
	LRD Currency = "LRD"
	LSL Currency = "LSL"
	LTL Currency = "LTL"
	LVL Currency = "LVL"
	LYD Currency = "LYD"
	MAD Currency = "MAD"
	MDL Currency = "MDL"
	MGA Currency = "MGA"
	MKD Currency = "MKD"
	MMK Currency = "MMK"
	MNT Currency = "MNT"
	MOP Currency = "MOP"
	MRU Currency = "MRU"
	MUR Currency = "MUR"
	MVR Currency = "MVR"
	MWK Currency = "MWK"
	MXN Currency = "MXN"
	MYR Currency = "MYR"
	MZN Currency = "MZN"
	NAD Currency = "NAD"
	NGN Currency = "NGN"
	NIO Currency = "NIO"
	NOK Currency = "NOK"
	NPR Currency = "NPR"
	NZD Currency = "NZD"
	OMR Currency = "OMR"
	PAB Currency = "PAB"
	PEN Currency = "PEN"
	PGK Currency = "PGK"
	PHP Currency = "PHP"
	PKR Currency = "PKR"
	PLN Currency = "PLN"
	PYG Currency = "PYG"
	QAR Currency = "QAR"
	RON Currency = "RON"
	RSD Currency = "RSD"
	RUB Currency = "RUB"
	RWF Currency = "RWF"
	SAR Currency = "SAR"
	SBD Currency = "SBD"
	SCR Currency = "SCR"
	SDG Currency = "SDG"
	SEK Currency = "SEK"
	SGD Currency = "SGD"
	SHP Currency = "SHP"
	SLL Currency = "SLL"
	SOS Currency = "SOS"
	SRD Currency = "SRD"
	STN Currency = "STN"
	SVC Currency = "SVC"
	SYP Currency = "SYP"
	SZL Currency = "SZL"
	THB Currency = "THB"
	TJS Currency = "TJS"
	TMT Currency = "TMT"
	TND Currency = "TND"
	TOP Currency = "TOP"
	TRY Currency = "TRY"
	TTD Currency = "TTD"
	TWD Currency = "TWD"
	TZS Currency = "TZS"
	UAH Currency = "UAH"
	UGX Currency = "UGX"
	USD Currency = "USD"
	UYU Currency = "UYU"
	UZS Currency = "UZS"
	VEF Currency = "VEF"
	VND Currency = "VND"
	VUV Currency = "VUV"
	WST Currency = "WST"
	XAF Currency = "XAF"
	XCD Currency = "XCD"
	XOF Currency = "XOF"
	XPF Currency = "XPF"
	YER Currency = "YER"
	ZAR Currency = "ZAR"
	ZMK Currency = "ZMK"
	ZMW Currency = "ZMW"
	ZWL Currency = "ZWL"
)

type CustomerRequest

type CustomerRequest struct {
	Id        string `json:"id,omitempty"`
	Email     string `json:"email,omitempty"`
	Name      string `json:"name,omitempty"`
	TaxNumber string `json:"tax_number,omitempty"`
	Phone     *Phone `json:"phone,omitempty"`
	Default   bool   `json:"default,omitempty"`
}

type CustomerResponse

type CustomerResponse struct {
	Id    string `json:"id,omitempty"`
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
	Phone *Phone `json:"phone,omitempty"`
}

type DateRangeQuery

type DateRangeQuery struct {
	From *time.Time `url:"from,omitempty" layout:"2006-01-02T15:04:05Z"`
	To   *time.Time `url:"to,omitempty" layout:"2006-01-02T15:04:05Z"`
}

type DocumentType

type DocumentType string
const (
	PassportDocumentType DocumentType = "passport"
	NationalIdentityCard DocumentType = "national_identity_card"
	DrivingLicense       DocumentType = "driving_license"
	CitizenCard          DocumentType = "citizen_card"
	ResidencePermit      DocumentType = "residence_permit"
	ElectoralId          DocumentType = "electoral_id"
)

type Exemption

type Exemption string
const (
	None                      Exemption = "none"
	LowValue                  Exemption = "low_value"
	RecurringOperation        Exemption = "recurring_operation"
	TransactionRiskAssessment Exemption = "transaction_risk_assessment"
	SecureCorporatePayment    Exemption = "secure_corporate_payment"
	TrustedListing            Exemption = "trusted_listing"
	ThreeDsOutage             Exemption = "3ds_outage"
	ScaDelegation             Exemption = "sca_delegation"
	OutOfScaScope             Exemption = "out_of_sca_scope"
	Other                     Exemption = "other"
	LowRiskProgram            Exemption = "low_risk_program"
)

type File

type File struct {
	File    string
	Purpose Purpose
}

func (*File) GetFieldName

func (f *File) GetFieldName() string

func (*File) GetFile

func (f *File) GetFile() string

func (*File) GetPurpose

func (f *File) GetPurpose() Purpose

type FileResponse

type FileResponse struct {
	HttpMetadata HttpMetadata
	Id           string          `json:"id,omitempty"`
	Filename     string          `json:"filename,omitempty"`
	Purpose      Purpose         `json:"purpose,omitempty"`
	Size         uint64          `json:"size,omitempty"`
	UploadedOn   *time.Time      `json:"uploaded_on,omitempty"`
	Links        map[string]Link `json:"_links"`
}

type FileUpload

type FileUpload interface {
	GetFile() string
	GetPurpose() Purpose
	GetFieldName() string
}

type FileUploadRequest

type FileUploadRequest struct {
	W *multipart.Writer
	B *bytes.Buffer
}

func BuildFileUploadRequest

func BuildFileUploadRequest(upload FileUpload) (*FileUploadRequest, error)

type Headers

type Headers struct {
	Header       http.Header
	CKORequestID *string `json:"cko-request-id,omitempty"`
	CKOVersion   *string `json:"cko-version,omitempty"`
}

type HttpMetadata

type HttpMetadata struct {
	Status       string     `json:"status,omitempty"`
	StatusCode   int        `json:"status_code,omitempty"`
	ResponseBody []byte     `json:"response_body,omitempty"`
	ResponseCSV  [][]string `json:"response_csv,omitempty"`
	Headers      *Headers   `json:"headers,omitempty"`
}

type IdResponse

type IdResponse struct {
	HttpMetadata HttpMetadata
	Id           string          `json:"id,omitempty"`
	Links        map[string]Link `json:"_links"`
}

type InstrumentCustomerResponse

type InstrumentCustomerResponse struct {
	Id      string `json:"id,omitempty"`
	Email   string `json:"email,omitempty"`
	Name    string `json:"name,omitempty"`
	Phone   *Phone `json:"phone,omitempty"`
	Default bool   `json:"default,omitempty"`
}

type InstrumentDetails

type InstrumentDetails struct {
	Id                         string                      `json:"id,omitempty"`
	Fingerprint                string                      `json:"fingerprint,omitempty"`
	InstrumentCustomerResponse *InstrumentCustomerResponse `json:"customer,omitempty"`
	AccountHolder              *AccountHolder              `json:"account_holder,omitempty"`
}

type InstrumentType

type InstrumentType string
const (
	Card        InstrumentType = "card"
	BankAccount InstrumentType = "bank_account"
	Token       InstrumentType = "token"
	CardToken   InstrumentType = "card_token"
)
type Link struct {
	HRef  *string `json:"href,omitempty"`
	Title *string `json:"title,omitempty"`
}

type MarketplaceData deprecated

type MarketplaceData struct {
	SubEntityId string              `json:"sub_entity_id,omitempty"`
	SubEntities []AmountAllocations `json:"sub_entities,omitempty"`
}

Deprecated: should use AmountAllocations instead

type MetadataResponse

type MetadataResponse struct {
	HttpMetadata HttpMetadata
}

type Phone

type Phone struct {
	CountryCode string `json:"country_code,omitempty"`
	Number      string `json:"number,omitempty"`
}

type Purpose

type Purpose string
const (
	// Disputes
	DisputesEvidence Purpose = "dispute_evidence"

	// Accounts
	BankVerification      Purpose = "bank_verification"
	IdentityVerification  Purpose = "identity_verification"
	CompanyVerification   Purpose = "company_verification"
	FinancialVerification Purpose = "financial_verification"
)

type ThreeDsFlowType

type ThreeDsFlowType string
const (
	Challenged            ThreeDsFlowType = "challenged"
	Frictionless          ThreeDsFlowType = "frictionless"
	FrictionlessDelegated ThreeDsFlowType = "frictionless_delegated"
)

type ThreeDsMethodCompletion

type ThreeDsMethodCompletion string

type TypeMapping

type TypeMapping struct {
	Type        string `json:"type"`
	ControlType string `json:"control_type"`
}

type UpdateCustomerRequest

type UpdateCustomerRequest struct {
	Id      string `json:"id,omitempty"`
	Default bool   `json:"default,omitempty"`
}

Jump to

Keyboard shortcuts

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