diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d60e36..f1a1bc0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,24 @@ jobs: with: token: ${{ secrets.SOMLENG_PERSONAL_ACCESS_TOKEN }} + create-sentry-release: + name: Create Sentry Release + runs-on: ubuntu-latest + needs: + - release + if: ${{ needs.release.outputs.release_created }} + steps: + - uses: actions/checkout@v4 + + - name: Create Sentry release + uses: getsentry/action-release@v1 + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: somleng + SENTRY_PROJECT: sms-gateway + with: + environment: production + build-packages: name: Build Packages runs-on: ubuntu-latest diff --git a/lib/gateways/smpp_delivery_receipt.js b/lib/gateways/smpp_delivery_receipt.js index 10952db..53eb6e8 100644 --- a/lib/gateways/smpp_delivery_receipt.js +++ b/lib/gateways/smpp_delivery_receipt.js @@ -21,7 +21,11 @@ class SMPPDeliveryReceipt { result.status = "delivered"; } else if (matches.groups.stat === "ENROUTE" || matches.groups.stat === "ENROUTE") { result.status = "sent"; - } else if (matches.groups.stat === "UNDELIVERABLE" || matches.groups.stat === "UNDELIV") { + } else if ( + matches.groups.stat === "UNDELIVERABLE" || + matches.groups.stat === "UNDELIV" || + matches.groups.stat === "REJECTD" + ) { result.status = "failed"; } else { throw new UnsupportedDeliveryStatusError("Unsupported Delivery Status Error"); diff --git a/package-lock.json b/package-lock.json index fe29fa8..b770aa0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2775,12 +2775,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -3910,9 +3910,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" diff --git a/test/lib/gateways/smpp_delivery_receipt.test.js b/test/lib/gateways/smpp_delivery_receipt.test.js index 1eb52e4..6daea35 100644 --- a/test/lib/gateways/smpp_delivery_receipt.test.js +++ b/test/lib/gateways/smpp_delivery_receipt.test.js @@ -35,6 +35,15 @@ describe(SMPPDeliveryReceipt, () => { expect(deliveryReceipt.status).toEqual("failed"); }); + it("parses rejected receipt from Kannel", () => { + const message = + "id:577e505a-dbd7-46ab-a04c-5a927ffb85b1 sub:001 dlvrd:000 submit date:2408201338 done date:240820093823 stat:REJECTD err:00B text:You"; + + const deliveryReceipt = SMPPDeliveryReceipt.parse(message); + + expect(deliveryReceipt.status).toEqual("failed"); + }); + it("handles unsupported message format", () => { const message = "id:88316820 sub:0 dlvrd:0 submit date:2302281324 done date:2302281325 err:500 Text:Hello World from out";