citcallgo

package module
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 10 Imported by: 0

README

citcall-client

Client for Citcall in Go Lang

Verify Success Response

{"rc":"00","info":"valid","trxid":"20190801155256104472275025","trxid_verify":"20190801155200606557556587","msisdn":"+6281234567890","token":null,"token_verify":"12345"} 

Verify Invalid token

{"rc":79,"info":"Invalid token"}

Contributors

Documentation

Index

Constants

View Source
const (
	CitcallOK                          = 0
	CitcallWrongMethod                 = 99
	CitcallAuthorizationFailed         = 98
	CitcallMissingParameter            = 88
	CitcallUserIDNotFound              = 77
	CitcallSenderIDClosed              = 44
	CitcallUnknownErrorOrFailed        = 6
	CitcallServiceTemporaryUnavailable = 34
	CitcallWrongPassword               = 76
	CitcallMaintenanceInProgress       = 66
	CitcallInsufficientAmount          = 14
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CitcallAsyncMiscallOtpRequest added in v1.1.0

type CitcallAsyncMiscallOtpRequest struct {
	MSISDN    string `json:"msisdn"`
	Gateway   int    `json:"gateway"`
	ValidTime int    `json:"valid_time"`
	LimitTry  int    `json:"limit_try"`
}

CitcallAsyncMiscallOtpRequest cicall async miscall request

type CitcallMiscallOtpResponse added in v1.1.0

type CitcallMiscallOtpResponse struct {
	ResponseCode FlexInt `json:"rc"`
	TrxID        string  `json:"trxid"`
	MSISDN       string  `json:"msisdn"`
	Token        string  `json:"token"`
	Gateway      int     `json:"gateway"`
	ErrorStatus  bool    `json:"-"`
}

CitcallMiscallOtpResponse citcall MISCALLOTP Response

func (CitcallMiscallOtpResponse) Error added in v1.1.0

type CitcallSmsOtpRequest

type CitcallSmsOtpRequest struct {
	SenderID  string `json:"senderid"`
	MSISDN    string `json:"msisdn"`
	Text      string `json:"text"`
	Token     string `json:"token"`
	ValidTime int    `json:"valid_time"`
	LimitTry  int    `json:"limit_try"`
}

CitcallSmsOtpRequest citcall SMSOTP Request

type CitcallSmsOtpResponse

type CitcallSmsOtpResponse struct {
	ResponseCode FlexInt `json:"rc"`
	Info         string  `json:"info"`
	SmsCount     int     `json:"sms_count"`
	MSISDN       string  `json:"msisdn"`
	Text         string  `json:"text"`
	TrxID        string  `json:"trxid"`
	Currency     string  `json:"currency"`
	Price        int     `json:"price"`
	Token        string  `json:"token"`
	ErrorStatus  bool    `json:"-"`
}

CitcallSmsOtpResponse citcall SMSOTP Response

func (CitcallSmsOtpResponse) Error

func (e CitcallSmsOtpResponse) Error() string

type CitcallSmsOtpVerifyRequest

type CitcallSmsOtpVerifyRequest struct {
	TrxID  string `json:"trxid"`
	MSISDN string `json:"msisdn"`
	Token  string `json:"token"`
}

CitcallSmsOtpVerifyRequest citcall SMSOTP Verify Request

type CitcallSmsOtpVerifyResponse

type CitcallSmsOtpVerifyResponse struct {
	ResponseCode FlexInt `json:"rc"`
	Info         string  `json:"info"`
	TrxID        string  `json:"trxid"`
	TrxIDVerify  string  `json:"trxid_verify"`
	Token        string  `json:"token"`
	TokenVerify  string  `json:"token_verify"`

	ErrorStatus bool `json:"-"`
}

CitcallSmsOtpVerifyResponse citcall SMSOTP Verify Response

func (CitcallSmsOtpVerifyResponse) Error

type CitcallSmsRequest added in v1.1.2

type CitcallSmsRequest struct {
	SenderID string `json:"senderid"`
	MSISDN   string `json:"msisdn"`
	Text     string `json:"text"`
}

CitcallSmsRequest citcall SMSOTP Request

type CitcallSmsResponse added in v1.1.2

type CitcallSmsResponse struct {
	ResponseCode FlexInt `json:"rc"`
	Info         string  `json:"info"`
	SmsCount     int     `json:"sms_count"`
	MSISDN       string  `json:"msisdn"`
	Text         string  `json:"text"`
	TrxID        string  `json:"trxid"`
	Currency     string  `json:"currency"`
	Price        int     `json:"price"`
	Token        int     `json:"token"`
	ErrorStatus  bool    `json:"-"`
}

CitcallSmsOtpResponse citcall SMSOTP Response

func (CitcallSmsResponse) Error added in v1.1.2

func (e CitcallSmsResponse) Error() string

type Client

type Client struct {
	APIEnvType   EnvironmentType
	SecretAPIKey string

	LogLevel int
}

Client struct

func NewClient

func NewClient() Client

NewClient : this function will always be called when the library is in use

func (*Client) ExecuteRequest

func (c *Client) ExecuteRequest(req *http.Request, v interface{}) (httpStatus int, err error)

ExecuteRequest : execute request

func (*Client) NewRequest

func (c *Client) NewRequest(method string, fullPath string, body io.Reader) (*http.Request, error)

NewRequest : send new request

type EnvironmentType

type EnvironmentType int8

EnvironmentType value

const (

	// Sandbox : represent sandbox environment
	Sandbox EnvironmentType

	// Production : represent production environment
	Production
)

func (EnvironmentType) CreateAsyncMiscallURL added in v1.1.0

func (e EnvironmentType) CreateAsyncMiscallURL() string

CreateAsyncMiscallURL : Create Asynchronous Miscall URL

func (EnvironmentType) CreateSmsOtpURL

func (e EnvironmentType) CreateSmsOtpURL() string

CreateSmsOtpURL : Create SMSOTP URL

func (EnvironmentType) CreateSmsOtpVerifyURL

func (e EnvironmentType) CreateSmsOtpVerifyURL() string

CreateSmsOtpVerifyURL : Create VERIFY URL

func (EnvironmentType) CreateSmsURL added in v1.1.2

func (e EnvironmentType) CreateSmsURL() string

func (EnvironmentType) String

func (e EnvironmentType) String() string

implement stringer

type FlexInt

type FlexInt int

A FlexInt is an int that can be unmarshalled from a JSON field that has either a number or a string value. E.g. if the json field contains an string "42", the FlexInt value will be "42".

func (*FlexInt) UnmarshalJSON

func (fi *FlexInt) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface, which allows us to ingest values of any json type as an int and run our custom conversion

type SmsGateway

type SmsGateway struct {
	Client Client
}

SmsGateway struct

func (*SmsGateway) RequestMiscallOtp added in v1.1.0

func (gateway *SmsGateway) RequestMiscallOtp(req *CitcallAsyncMiscallOtpRequest) (response *CitcallMiscallOtpResponse, err error)

RequestMiscallOtp request miscall for OTP

func (*SmsGateway) SendSms added in v1.1.2

func (gateway *SmsGateway) SendSms(req *CitcallSmsRequest) (response *CitcallSmsResponse, err error)

SendSms send sms

func (*SmsGateway) SendSmsOtp

func (gateway *SmsGateway) SendSmsOtp(req *CitcallSmsOtpRequest) (response *CitcallSmsOtpResponse, err error)

SendSmsOtp send sms for OTP

func (*SmsGateway) VerifySmsOtp

func (gateway *SmsGateway) VerifySmsOtp(req *CitcallSmsOtpVerifyRequest) (response *CitcallSmsOtpVerifyResponse, err error)

VerifySmsOtp Verify SMS OTP

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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