Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(c *Client)
- func Wallet(wallet string) func(c *Client)
- type Balance
- type BalanceResponse
- type Cards
- type CardsDetectResponse
- type Client
- type History
- type Opt
- type PaymentRequest
- type PaymentResponse
- type PaymentsResponse
- type Profile
- type ProfileResponse
- type StatResponse
- type Txn
Constants ¶
View Source
const ( // BaseURL represent base url BaseURL = "https://edge.qiwi.com" // OpenBaseURL open base url OpenBaseURL = "https://qiwi.com" // VersionAPI current qiwi.com api version VersionAPI = "v1" )
View Source
const ( // EndpointProfile endpoint EndpointProfile = "person-profile/v1/profile/current" // EndpointIdent identification endpoint EndpointIdent = "identification/v1/persons/%s/identification" // %s - wallet // EndpointPaymentsHistory get history EndpointPaymentsHistory = "payment-history/v1/persons/%s/payments" // %s - wallet // EndpointStat get stat of payments EndpointStat = "payment-history/v1/persons/%s/payments/total" // %s - wallet // EndpointTxnInfo get info anout single txn EndpointTxnInfo = "payment-history/v1/transactions/%s" // %s - txn_id // EndpointBalance get wallet balance EndpointBalance = "funding-sources/v1/accounts/current" // EndpointCardsDetect detect code of PS EndpointCardsDetect = "card/detect.action" // EndpointCardsPayment send money from wallet EndpointCardsPayment = "sinap/api/v2/terms/%d/payments" )
Variables ¶
View Source
var ( // OpenMethods not require Bearer token OpenMethods = map[string]bool{ EndpointCardsDetect: true, } )
Functions ¶
Types ¶
type Balance ¶
type Balance struct {
// contains filtered or unexported fields
}
Balance for payment-history endpoints
func (*Balance) Current ¶
func (b *Balance) Current() (hr *BalanceResponse, err error)
Current call api and get current user balance
type BalanceResponse ¶
type BalanceResponse struct {
Accounts []struct {
Alias string `json:"alias"`
FsAlias string `json:"fsAlias"`
Title string `json:"title"`
Type struct {
ID string `json:"id"`
Title string `json:"title"`
} `json:"type"`
HasBalance bool `json:"hasBalance"`
Balance struct {
Amount float64 `json:"amount"`
Currency int `json:"currency"`
} `json:"balance"`
Currency int `json:"currency"`
} `json:"accounts"`
}
BalanceResponse response of balance request
type Cards ¶
type Cards struct {
// contains filtered or unexported fields
}
Cards for payment-history endpoints
type CardsDetectResponse ¶
type CardsDetectResponse struct {
Code struct {
Value json.Number `json:"value"`
Name string `json:"_name"`
} `json:"code"`
Message json.Number `json:"message"`
}
CardsDetectResponse api response
type Client ¶
type Client struct {
History *History
Profile *Profile
Balance *Balance
Cards *Cards
// contains filtered or unexported fields
}
Client main struct
type History ¶
type History struct {
// contains filtered or unexported fields
}
History for payment-history endpoints
type PaymentRequest ¶
type PaymentRequest struct {
ID string `json:"id"`
Sum struct {
Amount float64 `json:"amount"`
Currency string `json:"currency"`
} `json:"sum"`
PaymentMethod struct {
Type string `json:"type"`
AccountID string `json:"accountId"`
} `json:"paymentMethod"`
Fields struct {
Account string `json:"account"`
} `json:"fields"`
}
PaymentRequest request of payment
type PaymentResponse ¶
type PaymentResponse struct {
ID string `json:"id"`
Terms string `json:"terms"`
Fields struct {
Account string `json:"account"`
} `json:"fields"`
Sum struct {
Amount float64 `json:"amount"`
Currency string `json:"currency"`
} `json:"sum"`
Source string `json:"source"`
Transaction struct {
ID string `json:"id"`
State struct {
Code string `json:"code"`
} `json:"state"`
} `json:"transaction"`
}
PaymentResponse foemat of payment response
type PaymentsResponse ¶
type PaymentsResponse struct {
Data []Txn `json:"data"`
NextTxnID interface{} `json:"nextTxnId"`
NextTxnDate interface{} `json:"nextTxnDate"`
}
PaymentsResponse api response format
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile for profile endpoints
func (*Profile) Current ¶
func (h *Profile) Current() (hr *ProfileResponse, err error)
Current call api and get current user profile
type ProfileResponse ¶
type ProfileResponse struct {
AuthInfo struct {
BoundEmail string `json:"boundEmail"`
IP string `json:"ip"`
LastLoginDate time.Time `json:"lastLoginDate"`
MobilePinInfo struct {
LastMobilePinChange time.Time `json:"lastMobilePinChange"`
MobilePinUsed bool `json:"mobilePinUsed"`
NextMobilePinChange time.Time `json:"nextMobilePinChange"`
} `json:"mobilePinInfo"`
PassInfo struct {
LastPassChange time.Time `json:"lastPassChange"`
NextPassChange time.Time `json:"nextPassChange"`
PasswordUsed bool `json:"passwordUsed"`
} `json:"passInfo"`
PersonID int64 `json:"personId"`
PinInfo struct {
PinUsed bool `json:"pinUsed"`
} `json:"pinInfo"`
RegistrationDate time.Time `json:"registrationDate"`
} `json:"authInfo"`
ContractInfo struct {
Blocked bool `json:"blocked"`
ContractID int64 `json:"contractId"`
CreationDate time.Time `json:"creationDate"`
Features []interface{} `json:"features"`
IdentificationInfo []struct {
BankAlias string `json:"bankAlias"`
IdentificationLevel string `json:"identificationLevel"`
} `json:"identificationInfo"`
} `json:"contractInfo"`
UserInfo struct {
DefaultPayCurrency int `json:"defaultPayCurrency"`
DefaultPaySource int `json:"defaultPaySource"`
Email interface{} `json:"email"`
FirstTxnID int64 `json:"firstTxnId"`
Language string `json:"language"`
Operator string `json:"operator"`
PhoneHash string `json:"phoneHash"`
PromoEnabled interface{} `json:"promoEnabled"`
} `json:"userInfo"`
}
ProfileResponse reponse
type StatResponse ¶
type StatResponse struct {
IncomingTotal []struct {
Amount float64 `json:"amount"`
Currency int `json:"currency"`
} `json:"incomingTotal"`
OutgoingTotal []struct {
Amount float64 `json:"amount"`
Currency int `json:"currency"`
} `json:"outgoingTotal"`
}
StatResponse response of stat endpoind
type Txn ¶
type Txn struct {
TxnID int64 `json:"txnId"`
PersonID int64 `json:"personId"`
Date time.Time `json:"date"`
ErrorCode int `json:"errorCode"`
Error string `json:"error"`
Status string `json:"status"`
Type string `json:"type"`
StatusText string `json:"statusText"`
TrmTxnID string `json:"trmTxnId"`
Account string `json:"account"`
Sum struct {
Amount float64 `json:"amount"`
Currency int `json:"currency"`
} `json:"sum"`
Commission struct {
Amount float64 `json:"amount"`
Currency int `json:"currency"`
} `json:"commission"`
Total struct {
Amount float64 `json:"amount"`
Currency int `json:"currency"`
} `json:"total"`
Provider struct {
ID int `json:"id"`
ShortName string `json:"shortName"`
LongName string `json:"longName"`
LogoURL string `json:"logoUrl"`
Description string `json:"description"`
Keys string `json:"keys"`
SiteURL string `json:"siteUrl"`
Extras []interface{} `json:"extras"`
} `json:"provider"`
Source interface{} `json:"source"`
Comment string `json:"comment"`
CurrencyRate int `json:"currencyRate"`
Extras []interface{} `json:"extras"`
ChequeReady bool `json:"chequeReady"`
BankDocumentAvailable bool `json:"bankDocumentAvailable"`
BankDocumentReady bool `json:"bankDocumentReady"`
RepeatPaymentEnabled bool `json:"repeatPaymentEnabled"`
FavoritePaymentEnabled bool `json:"favoritePaymentEnabled"`
RegularPaymentEnabled bool `json:"regularPaymentEnabled"`
}
Txn represent qiwi transaction
Click to show internal directories.
Click to hide internal directories.