[MM-29845] Add CWS Webhook endpoint and payment failed email (#16351)

* Add a new handler to allow authentication via CWS API Key

* Make error better

* Add tests and cases for new handler functions

* Move some code around

* Add test for GetCloudSession function

* unset the env after test completion

* Remove white space

* Add CWS Webhook endpoint and email code

* handle returned errors from email sending function

* Change FailureCode to FailureMessage

* Remove unnecessary translations

* Fix translations

* Forgot to add template

* Update api4/cloud.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Update api4/cloud.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Update api4/cloud.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* PR changes

* Update app/email.go

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Close body in proper spot

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>
Этот коммит содержится в:
Nick Misasi
2020-11-25 15:45:15 -05:00
коммит произвёл GitHub
родитель a87e8d1c20
Коммит 9b6ee63a1e
8 изменённых файлов: 234 добавлений и 7 удалений

Просмотреть файл

@@ -3,6 +3,10 @@
package model
const (
EventTypeFailedPayment = "failed-payment"
)
// Product model represents a product on the cloud system.
type Product struct {
ID string `json:"id"`
@@ -112,3 +116,14 @@ type InvoiceLineItem struct {
Type string `json:"type"`
Metadata map[string]interface{} `json:"metadata"`
}
type CWSWebhookPayload struct {
Event string `json:"event"`
FailedPayment *FailedPayment `json:"failed_payment"`
}
type FailedPayment struct {
CardBrand string `json:"card_brand"`
LastFour int `json:"last_four"`
FailureMessage string `json:"failure_message"`
}