Documentation
¶
Index ¶
- Variables
- func Decrypt(dst io.Writer, src io.Reader, srcSize int, key *rsa.PrivateKey) error
- func Encrypt(dst io.Writer, src io.Reader, srcSize int, key *rsa.PublicKey) error
- func GenOrderID() string
- func GenerateKeysPEM(prvKeyDst, pubKeyDst io.Writer, bits int) error
- func MarshalGzipJSON(w io.Writer, data interface{}) error
- func UnmarshalGzipJSON(r io.Reader, data interface{}) error
- type BatchError
- type BlockPEM
- type CheckAccount
- type CheckAccountResponse
- type Config
- type Envelope
- type EnvelopeBase
- type EnvelopeResponse
- type EnvelopeResponseData
- type Error
- type HTTPClient
- type KeyStore
- type Option
- type PartnerAPI
- type Process
- type ProcessResponse
- type QueryByMSISDN
- type QueryByTransaction
- type QueryRequestEnvelope
- type QueryRequests
- type QueryRequestsResponse
- type Request
- type RequestDisbursement
- type RequestDisbursementEnvelope
- type RequestDisbursementResponse
- type SoapClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBatchWaitDisb = &BatchError{Code: "WAIT_DISB"} ErrBatchCancelDisb = &BatchError{Code: "CANCEL_DISB"} ErrBatchDisbursement = &BatchError{Code: "DISBURSEMENT"} ErrBatchDisbTimeout = &BatchError{Code: "DISB_TIMEOUT"} ErrBatchDisbSuccess = &BatchError{Code: "DISB_SUCCESS"} ErrBatchDisbFailed = &BatchError{Code: "DISB_FAILED"} )
View Source
var ErrNoPEM = errors.New("no PEM data is found")
Functions ¶
func GenOrderID ¶
func GenOrderID() string
func MarshalGzipJSON ¶
func UnmarshalGzipJSON ¶
Types ¶
type BatchError ¶
func (BatchError) Error ¶
func (e BatchError) Error() string
func (*BatchError) Is ¶
func (e *BatchError) Is(target error) bool
type BlockPEM ¶
type BlockPEM []byte
BlockPEM is a slice of bytes where the information is PEM in the environment variable.
type CheckAccount ¶
type CheckAccountResponse ¶
type CheckAccountResponse struct {
CheckAccount
Package string `json:"package"`
ErrorCode string `json:"errorCode"`
ErrorDesc string `json:"errorDesc"`
}
func (CheckAccountResponse) Err ¶ added in v0.1.1
func (r CheckAccountResponse) Err() error
type Config ¶
type EnvelopeBase ¶
type EnvelopeBase struct {
Password string `json:"password"`
ServiceCode string `json:"serviceCode"`
Username string `json:"username"`
Data []byte `json:"data,omitempty"`
OrderID string `json:"orderId"`
}
func (*EnvelopeBase) SetData ¶
func (e *EnvelopeBase) SetData(val []byte)
func (*EnvelopeBase) SetPassword ¶
func (e *EnvelopeBase) SetPassword(val string)
func (*EnvelopeBase) SetServiceCode ¶
func (e *EnvelopeBase) SetServiceCode(val string)
func (*EnvelopeBase) SetUsername ¶
func (e *EnvelopeBase) SetUsername(val string)
type EnvelopeResponse ¶
type EnvelopeResponse struct {
Data json.RawMessage `json:"data"`
Signature []byte `json:"signature"`
}
type EnvelopeResponseData ¶
type EnvelopeResponseData struct {
Data []byte `json:"data,omitempty"`
OrderID string `json:"orderId"`
RealServiceCode string `json:"realServiceCode"`
ServiceCode string `json:"serviceCode"`
Username string `json:"username"`
RequestId string `json:"requestId"`
TransDate string `json:"transDate"`
BatchErrorCode string `json:"batchErrorCode"`
BatchErrorDesc string `json:"batchErrorDesc"`
ErrorCode string `json:"errorCode"`
ErrorDesc string `json:"errorDesc"`
}
func (EnvelopeResponseData) CheckError ¶
func (e EnvelopeResponseData) CheckError() error
type HTTPClient ¶
HTTPClient is a client which can make HTTP requests An example implementation is net/http.Client
type KeyStore ¶
type KeyStore interface {
Sign(data []byte) (signature []byte, err error)
Verify(data, signature []byte) (err error)
Decrypt(msg []byte) (string, error)
Encrypt(msg []byte) (string, error)
}
func NewKeyStore ¶
type Option ¶
type Option func(*options)
A Option sets options such as credentials, tls, etc.
func WithHTTPClient ¶
func WithHTTPClient(c HTTPClient) Option
WithHTTPClient is an Option to set the HTTP client to use
func WithKeyStore ¶
WithKeyStore is an Option to set BasicAuth
type PartnerAPI ¶
type PartnerAPI interface {
Process(ctx context.Context, req Request, response interface{}) error
CheckAccount(ctx context.Context, orderID string, checks ...CheckAccount) ([]CheckAccountResponse, error)
RequestDisbursement(ctx context.Context, orderID string, transactionContent string, reqs ...RequestDisbursement) ([]RequestDisbursementResponse, error)
QueryRequests(ctx context.Context, orderID string, query QueryRequests) ([]QueryRequestsResponse, error)
}
func NewPartnerAPI ¶
func NewPartnerAPI(url string, opt ...Option) (_ PartnerAPI, err error)
func ProvidePartnerAPI ¶
func ProvidePartnerAPI(cfg *Config, client HTTPClient) (PartnerAPI, error)
type ProcessResponse ¶
type QueryByMSISDN ¶
type QueryByMSISDN string
func (QueryByMSISDN) Data ¶
func (q QueryByMSISDN) Data() string
func (QueryByMSISDN) Type ¶
func (q QueryByMSISDN) Type() string
type QueryByTransaction ¶
type QueryByTransaction string
func (QueryByTransaction) Data ¶
func (q QueryByTransaction) Data() string
func (QueryByTransaction) Type ¶
func (q QueryByTransaction) Type() string
type QueryRequestEnvelope ¶
type QueryRequestEnvelope struct {
EnvelopeBase
QueryType string `json:"queryType,omitempty"`
QueryData string `json:"queryData,omitempty"`
}
type QueryRequests ¶
type QueryRequestsResponse ¶ added in v0.1.1
type QueryRequestsResponse struct {
RequestDisbursement
ErrorCode string `json:"errorCode"`
ErrorMsg string `json:"errorMsg"`
}
func (QueryRequestsResponse) Err ¶ added in v0.1.1
func (r QueryRequestsResponse) Err() error
type Request ¶
func NewRequest ¶
type RequestDisbursement ¶
type RequestDisbursement struct {
TransactionID string `json:"transId"`
MSISDN string `json:"msisdn"`
CustomerName string `json:"customerName"`
Amount uint64 `json:"amount"`
SMSContent string `json:"smsContent"`
Note string `json:"note"`
}
func (RequestDisbursement) CheckAccount ¶
func (rd RequestDisbursement) CheckAccount() CheckAccount
type RequestDisbursementEnvelope ¶
type RequestDisbursementEnvelope struct {
EnvelopeBase
TotalAmount uint64 `json:"totalAmount"`
TotalTransactions int `json:"totalTrans"`
TransactionContent string `json:"transContent"`
}
type RequestDisbursementResponse ¶
type RequestDisbursementResponse struct {
RequestDisbursement
ErrorCode string `json:"errorCode"`
ErrorDesc string `json:"errorDesc"`
}
func (RequestDisbursementResponse) Err ¶ added in v0.1.1
func (r RequestDisbursementResponse) Err() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.