Merge pull request #149 from yetmgetaewunetu/bug-fix-payload

fix: updated update sms status to use the new updated sms in the payload
This commit is contained in:
Israel Abebe
2025-10-06 08:13:00 +03:00
committed by GitHub
2 changed files with 14 additions and 8 deletions

View File

@@ -754,7 +754,11 @@ recipient,
}
// Update the SMS
const updatedSms = await this.smsModel.findByIdAndUpdate(dto.smsId, { $set: updateData });
const updatedSms = await this.smsModel.findByIdAndUpdate(
dto.smsId,
{ $set: updateData },
{ new: true }
);
// Check if all SMS in batch have the same status, then update batch status
if (dto.smsBatchId) {

View File

@@ -14,10 +14,10 @@ const message_received_payload = {
smsId: 'smsId',
sender: '+123456789',
message: 'message',
receivedAt: 'datetime',
receivedAt: '2025-10-05T13:00:35.208Z',
deviceId: 'deviceId',
webhookSubscriptionId: 'webhookSubscriptionId',
webhookEvent: 'sms.received',
webhookEvent: 'MESSAGE_RECEIVED',
}
const message_send_template = {
smsId: 'smsId',
@@ -27,17 +27,18 @@ const message_send_template = {
recipient: "+123456789",
deviceId: 'deviceId',
webhookSubscriptionId: 'webhookSubscriptionId',
webhookEvent: 'sms.received',
}
const sms_delivered_payload = {
...message_send_template,
sentAt: "datetime",
deliveredAt: 'datetime',
sentAt: "2025-10-05T13:00:35.208Z",
deliveredAt: '2025-10-05T13:00:35.208Z',
webhookEvent: 'MESSAGE_DELIVERED',
}
const sms_sent_payload = {
...message_send_template,
status: "sent"
status: "sent",
webhookEvent: 'MESSAGE_SENT',
}
const sms_sent_failed = {
@@ -45,7 +46,8 @@ const sms_sent_failed = {
status: "failed",
errorCode: "ErorCode",
errorMessage: "Error",
failedAt: "datetime"
failedAt: "2025-10-05T13:00:35.208Z",
webhookEvent: 'MESSAGE_FAILED',
}
const VERIFICATION_CODE = `