|
6 | 6 |
|
7 | 7 | "github.com/NdoleStudio/httpsms/pkg/events" |
8 | 8 |
|
9 | | - "github.com/google/uuid" |
10 | | - |
11 | 9 | "github.com/NdoleStudio/httpsms/pkg/entities" |
12 | 10 | "github.com/matcornic/hermes/v2" |
13 | 11 | "github.com/palantir/stacktrace" |
@@ -129,18 +127,19 @@ func (factory *hermesNotificationEmailFactory) WebhookSendFailed(user *entities. |
129 | 127 | }, nil |
130 | 128 | } |
131 | 129 |
|
132 | | -func (factory *hermesNotificationEmailFactory) MessageExpired(user *entities.User, messageID uuid.UUID, owner string, contact string, content string) (*Email, error) { |
| 130 | +func (factory *hermesNotificationEmailFactory) MessageExpired(user *entities.User, payload *events.MessageSendExpiredPayload) (*Email, error) { |
133 | 131 | email := hermes.Email{ |
134 | 132 | Body: hermes.Body{ |
135 | 133 | Title: "Hello", |
136 | 134 | Intros: []string{ |
137 | | - fmt.Sprintf("The SMS message which you sent to %s has expired at %s and you will need to resend this message.", factory.formatPhoneNumber(contact), user.UserTimeString(time.Now())), |
| 135 | + fmt.Sprintf("The SMS message which you sent to %s has expired at %s and you will need to resend this message.", factory.formatPhoneNumber(payload.Contact), user.UserTimeString(time.Now())), |
138 | 136 | }, |
139 | 137 | Dictionary: []hermes.Entry{ |
140 | | - {"ID", messageID.String()}, |
141 | | - {"From", factory.formatPhoneNumber(owner)}, |
142 | | - {"To", factory.formatPhoneNumber(contact)}, |
143 | | - {"Message", content}, |
| 138 | + {"ID", payload.MessageID.String()}, |
| 139 | + {"From", factory.formatPhoneNumber(payload.Owner)}, |
| 140 | + {"To", factory.formatPhoneNumber(payload.Contact)}, |
| 141 | + {"Message", payload.Content}, |
| 142 | + {"Encrypted", factory.formatBool(payload.Encrypted)}, |
144 | 143 | }, |
145 | 144 | Actions: []hermes.Action{ |
146 | 145 | { |
@@ -178,19 +177,20 @@ func (factory *hermesNotificationEmailFactory) MessageExpired(user *entities.Use |
178 | 177 | }, nil |
179 | 178 | } |
180 | 179 |
|
181 | | -func (factory *hermesNotificationEmailFactory) MessageFailed(user *entities.User, messageID uuid.UUID, owner, contact, content, reason string) (*Email, error) { |
| 180 | +func (factory *hermesNotificationEmailFactory) MessageFailed(user *entities.User, payload *events.MessageSendFailedPayload) (*Email, error) { |
182 | 181 | email := hermes.Email{ |
183 | 182 | Body: hermes.Body{ |
184 | 183 | Title: "Hello", |
185 | 184 | Intros: []string{ |
186 | | - fmt.Sprintf("The SMS message which you sent to %s has failed at %s and you will need to resend this message.", factory.formatPhoneNumber(contact), user.UserTimeString(time.Now())), |
| 185 | + fmt.Sprintf("The SMS message which you sent to %s has failed at %s and you will need to resend this message.", factory.formatPhoneNumber(payload.Contact), user.UserTimeString(time.Now())), |
187 | 186 | }, |
188 | 187 | Dictionary: []hermes.Entry{ |
189 | | - {"ID", messageID.String()}, |
190 | | - {"From", factory.formatPhoneNumber(owner)}, |
191 | | - {"To", factory.formatPhoneNumber(contact)}, |
192 | | - {"Message", content}, |
193 | | - {"Failure Reason", reason}, |
| 188 | + {"ID", payload.ID.String()}, |
| 189 | + {"From", factory.formatPhoneNumber(payload.Owner)}, |
| 190 | + {"To", factory.formatPhoneNumber(payload.Contact)}, |
| 191 | + {"Message", payload.Content}, |
| 192 | + {"Encrypted", factory.formatBool(payload.Encrypted)}, |
| 193 | + {"Failure Reason", payload.ErrorMessage}, |
194 | 194 | }, |
195 | 195 | Actions: []hermes.Action{ |
196 | 196 | { |
|
0 commit comments