handle http 402 status
This commit is contained in:
parent
bf853827a4
commit
75086f650d
2
go.mod
2
go.mod
@ -44,7 +44,7 @@ require (
|
||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||
github.com/pkg/errors v0.8.0
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/retailcrm/api-client-go v1.0.7
|
||||
github.com/retailcrm/api-client-go v1.1.0
|
||||
github.com/retailcrm/mg-transport-api-client-go v1.1.11
|
||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect
|
||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
|
||||
|
4
go.sum
4
go.sum
@ -93,8 +93,8 @@ github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/retailcrm/api-client-go v1.0.7 h1:j4C2PvPUDP9nAuYWDvJPnYNpkj+LDBgn71kHvxJmSPg=
|
||||
github.com/retailcrm/api-client-go v1.0.7/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
|
||||
github.com/retailcrm/api-client-go v1.1.0 h1:APPO6ccJAeMV7Jz7BhrtDKSOm2r1j5Ft6fuEXNP2ij4=
|
||||
github.com/retailcrm/api-client-go v1.1.0/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
|
||||
github.com/retailcrm/mg-transport-api-client-go v1.1.11 h1:jAIOKqkjA2r0v/V6lTHYQsD8q0lFpfpqzAffHAJlhCQ=
|
||||
github.com/retailcrm/mg-transport-api-client-go v1.1.11/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
|
||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=
|
||||
|
@ -187,6 +187,12 @@ func createHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if status == http.StatusPaymentRequired {
|
||||
c.AbortWithStatusJSON(BadRequest("error_payment_mg"))
|
||||
logger.Error(conn.APIURL, status, errr.ApiErr, data)
|
||||
return
|
||||
}
|
||||
|
||||
if status >= http.StatusBadRequest {
|
||||
c.AbortWithStatusJSON(BadRequest("error_activity_mg"))
|
||||
logger.Error(conn.APIURL, status, errr.ApiErr, data)
|
||||
|
@ -27,6 +27,7 @@ incorrect_token: Create the correct token
|
||||
error_creating_webhook: Error when creating a webhook
|
||||
error_adding_bot: Error when adding a bot
|
||||
error_save: Error while saving, contact technical support
|
||||
error_payment_mg: Your account has insufficient funds to activate integration module
|
||||
missing_credentials: "Required methods: {{.Credentials}}"
|
||||
error_activity_mg: Check if the integration with retailCRM Chat is enabled in retailCRM settings
|
||||
info_bot: "If you have a problem with connecting a bot, please, refer to the <a target='_blank' href='//www.retailcrm.pro/docs/Users/Telegram'>documentation</a>"
|
||||
|
@ -28,6 +28,7 @@ incorrect_token: Crear el token correcto
|
||||
error_creating_webhook: Error al crear el webhook
|
||||
error_adding_bot: Error al añadir el bot
|
||||
error_save: Error al guardar, contacte con el soporte técnico
|
||||
error_payment_mg: Su cuenta no tiene fondos suficientes para activar el módulo de integración.
|
||||
missing_credentials: "Métodos requeridos: {{.Credenciales}}"
|
||||
error_activity_mg: Revisar si la integración con retailCRM Chat está habilitada en Ajustes de retailCRM
|
||||
info_bot: "Si tiene dificultades para conectar el bot, por favor, consulte la <a target='_blank' href='//www.retailcrm.pro/docs/Users/Telegram'>documentación</a>"
|
||||
|
@ -27,6 +27,7 @@ incorrect_token: Установите корректный токен
|
||||
error_creating_webhook: Ошибка при создании webhook
|
||||
error_adding_bot: Ошибка при добавлении бота
|
||||
error_save: Ошибка при сохранении, обратитесь в службу технической поддержки
|
||||
error_payment_mg: На Вашем счете недостаточно средств для активации данного модуля
|
||||
missing_credentials: "Необходимые методы: {{.Credentials}}"
|
||||
error_activity_mg: Проверьте активность интеграции с retailCRM Chat в настройках retailCRM
|
||||
info_bot: "Если у вас возникли трудности при подключении бота, изучите, пожалуйста, <a target='_blank' href='//www.retailcrm.ru/docs/Users/Telegram'>документацию</a>"
|
||||
|
Loading…
Reference in New Issue
Block a user