1
0
mirror of synced 2024-11-25 06:26:03 +03:00

add new fields to the ActivateTemplateRequest

This commit is contained in:
Pavel 2023-10-18 09:47:05 +03:00 committed by GitHub
commit 9f3cda8be6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -367,6 +367,8 @@ func (t *MGClientTest) Test_ActivateTemplate() {
Text: "!", Text: "!",
}, },
}, },
RejectionReason: "",
VerificationStatus: "approved",
} }
defer gock.Off() defer gock.Off()

View File

@ -48,7 +48,7 @@ type Template struct {
ButtonParams []ButtonParam `json:"buttonParams,omitempty"` ButtonParams []ButtonParam `json:"buttonParams,omitempty"`
Lang string `json:"lang,omitempty"` Lang string `json:"lang,omitempty"`
Category string `json:"category,omitempty"` Category string `json:"category,omitempty"`
RejectedReason string `json:"rejected_reason,omitempty"` RejectionReason string `json:"rejection_reason,omitempty"`
VerificationStatus string `json:"verification_status,omitempty"` VerificationStatus string `json:"verification_status,omitempty"`
} }

View File

@ -90,8 +90,7 @@ func TestUnmarshalMediaInteractiveTemplate(t *testing.T) {
"text": "Yes" "text": "Yes"
} }
], ],
"rejected_reason": "NONE", "verification_status": "approved"
"status": "APPROVED"
}` }`
assert.NoError(t, json.Unmarshal([]byte(input), &template)) assert.NoError(t, json.Unmarshal([]byte(input), &template))
@ -101,6 +100,7 @@ func TestUnmarshalMediaInteractiveTemplate(t *testing.T) {
assert.Equal(t, "http://example.com/intaro/d2222", template.HeaderParams.VideoURL) assert.Equal(t, "http://example.com/intaro/d2222", template.HeaderParams.VideoURL)
assert.Equal(t, "http://example.com/intaro/d4444", template.HeaderParams.DocumentURL) assert.Equal(t, "http://example.com/intaro/d4444", template.HeaderParams.DocumentURL)
assert.Equal(t, "Scooter", *template.Footer) assert.Equal(t, "Scooter", *template.Footer)
assert.Equal(t, "approved", template.VerificationStatus)
assert.Equal(t, URLButton, template.ButtonParams[0].ButtonType) assert.Equal(t, URLButton, template.ButtonParams[0].ButtonType)
assert.Equal(t, "222ddd", template.ButtonParams[0].URLParameter) assert.Equal(t, "222ddd", template.ButtonParams[0].URLParameter)
assert.Equal(t, QuickReplyButton, template.ButtonParams[1].ButtonType) assert.Equal(t, QuickReplyButton, template.ButtonParams[1].ButtonType)

View File

@ -558,12 +558,14 @@ type TransportRequestMeta struct {
} }
type ActivateTemplateRequest struct { type ActivateTemplateRequest struct {
Code string `binding:"required,min=1,max=512" json:"code"` Code string `binding:"required,min=1,max=512" json:"code"`
Name string `binding:"required,min=1,max=512" json:"name"` Name string `binding:"required,min=1,max=512" json:"name"`
Type string `binding:"required" json:"type"` Type string `binding:"required" json:"type"`
Template []TemplateItem `json:"template"` Template []TemplateItem `json:"template"`
Lang string `json:"lang,omitempty"` Lang string `json:"lang,omitempty"`
Category string `json:"category,omitempty"` Category string `json:"category,omitempty"`
RejectionReason string `json:"rejection_reason,omitempty"`
VerificationStatus string `json:"verification_status,omitempty"`
} }
var ErrInvalidOriginator = errors.New("invalid originator") var ErrInvalidOriginator = errors.New("invalid originator")