1
0
mirror of synced 2024-11-22 13:06:05 +03:00

remove currency constants

This commit is contained in:
Alex Lushpai 2018-11-08 10:15:27 +03:00
parent bc030989df
commit 7b29b9d33d
3 changed files with 9 additions and 22 deletions

View File

@ -11,7 +11,7 @@ import (
var ( var (
mgURL = os.Getenv("MG_URL") mgURL = os.Getenv("MG_URL")
mgToken = os.Getenv("MG_TOKEN") mgToken = os.Getenv("MG_TOKEN")
channelId, _ = strconv.ParseUint(os.Getenv("MG_CHANNEL"), 10, 64) channelID, _ = strconv.ParseUint(os.Getenv("MG_CHANNEL"), 10, 64)
ext = strconv.FormatInt(time.Now().UTC().UnixNano(), 10) ext = strconv.FormatInt(time.Now().UTC().UnixNano(), 10)
) )
@ -34,7 +34,7 @@ func TestMgClient_TransportChannels(t *testing.T) {
func TestMgClient_ActivateTransportChannel(t *testing.T) { func TestMgClient_ActivateTransportChannel(t *testing.T) {
c := client() c := client()
ch := Channel{ ch := Channel{
ID: channelId, ID: channelID,
Type: "telegram", Type: "telegram",
Name: "@my_shopping_bot", Name: "@my_shopping_bot",
Settings: ChannelSettings{ Settings: ChannelSettings{
@ -121,7 +121,7 @@ func TestMgClient_ActivateNewTransportChannel(t *testing.T) {
func TestMgClient_UpdateTransportChannel(t *testing.T) { func TestMgClient_UpdateTransportChannel(t *testing.T) {
c := client() c := client()
ch := Channel{ ch := Channel{
ID: channelId, ID: channelID,
Name: "@my_shopping_bot_2", Name: "@my_shopping_bot_2",
Settings: ChannelSettings{ Settings: ChannelSettings{
SpamAllowed: false, SpamAllowed: false,
@ -170,7 +170,7 @@ func TestMgClient_Messages(t *testing.T) {
Nickname: "octopus", Nickname: "octopus",
Firstname: "Joe", Firstname: "Joe",
}, },
Channel: channelId, Channel: channelID,
ExternalChatID: "24798237492374", ExternalChatID: "24798237492374",
} }
@ -196,7 +196,7 @@ func TestMgClient_UpdateMessages(t *testing.T) {
ExternalID: ext, ExternalID: ext,
Text: "hello hello!", Text: "hello hello!",
}, },
channelId, channelID,
} }
dataU, status, err := c.UpdateMessages(sndU) dataU, status, err := c.UpdateMessages(sndU)
@ -220,7 +220,7 @@ func TestMgClient_MarkMessageReadAndDelete(t *testing.T) {
MarkMessageReadRequestMessage{ MarkMessageReadRequestMessage{
ExternalID: ext, ExternalID: ext,
}, },
channelId, channelID,
} }
_, status, err := c.MarkMessageRead(snd) _, status, err := c.MarkMessageRead(snd)
@ -235,7 +235,7 @@ func TestMgClient_MarkMessageReadAndDelete(t *testing.T) {
Message{ Message{
ExternalID: ext, ExternalID: ext,
}, },
channelId, channelID,
} }
data, status, err := c.DeleteMessage(sndD) data, status, err := c.DeleteMessage(sndD)
@ -249,7 +249,7 @@ func TestMgClient_MarkMessageReadAndDelete(t *testing.T) {
func TestMgClient_DeactivateTransportChannel(t *testing.T) { func TestMgClient_DeactivateTransportChannel(t *testing.T) {
c := client() c := client()
deleteData, status, err := c.DeactivateTransportChannel(channelId) deleteData, status, err := c.DeactivateTransportChannel(channelID)
if err != nil { if err != nil {
t.Errorf("%d %v", status, err) t.Errorf("%d %v", status, err)

View File

@ -70,7 +70,7 @@ func makeRequest(reqType, url string, buf *bytes.Buffer, c *MgClient) ([]byte, i
} }
if resp.StatusCode >= http.StatusInternalServerError { if resp.StatusCode >= http.StatusInternalServerError {
err = fmt.Errorf("HTTP request error. Status code: %d.\n", resp.StatusCode) err = fmt.Errorf("http request error. status code: %d", resp.StatusCode)
return res, resp.StatusCode, err return res, resp.StatusCode, err
} }

View File

@ -39,19 +39,6 @@ const (
MsgOrderStatusCodeComplete = "complete" MsgOrderStatusCodeComplete = "complete"
// MsgOrderStatusCodeCancel order status group cancel // MsgOrderStatusCodeCancel order status group cancel
MsgOrderStatusCodeCancel = "cancel" MsgOrderStatusCodeCancel = "cancel"
// MsgCurrencyRub currency code for russian ruble
MsgCurrencyRub = "rub"
// MsgCurrencyUah currency code for ukrainian hryvnia
MsgCurrencyUah = "uah"
// MsgCurrencyByr currency code for belorussian ruble
MsgCurrencyByr = "byr"
// MsgCurrencyKzt currency code for kazakh tenge
MsgCurrencyKzt = "kzt"
// MsgCurrencyUsd currency code for us dollar
MsgCurrencyUsd = "usd"
// MsgCurrencyEur currency code for euro
MsgCurrencyEur = "eur"
) )
// MgClient type // MgClient type