Comparing version 3.0.14 to 3.0.15
# Changelog | ||
## 3.0.15 | ||
* added Sanboxed field to the outbound message model | ||
* fix parsing bounced messages | ||
## 3.0.14 | ||
@@ -4,0 +9,0 @@ |
@@ -148,3 +148,3 @@ "use strict"; | ||
if (regexResult !== null) { | ||
result = regexResult[1].split(', '); | ||
result = regexResult[1].split(',').map(function (element) { return element.trim(); }); | ||
return result; | ||
@@ -159,4 +159,3 @@ } | ||
InactiveRecipientsError.inactiveRecipientsPatterns = [ | ||
/Found inactive addresses: (.+?)\.?$/m, | ||
/these inactive addresses: (.+?)\. Inactive/, | ||
/Found inactive addresses: (.+?)\.? Inactive/, | ||
/these inactive addresses: (.+?)\.?$/ | ||
@@ -163,0 +162,0 @@ ]; |
@@ -24,2 +24,3 @@ import { Hash } from "../client/SupportingTypes"; | ||
MessageStream: string; | ||
Sandboxed: boolean; | ||
} | ||
@@ -26,0 +27,0 @@ export interface OutboundMessageDetails extends OutboundMessage { |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "3.0.14", | ||
"version": "3.0.15", | ||
"author": "Igor Balos", | ||
@@ -15,0 +15,0 @@ "contributors": [ |
@@ -112,7 +112,7 @@ import { Errors } from "../../src"; | ||
const error: any = { | ||
message: "InactiveRecipientsError: You tried to send to recipients " + | ||
"that have all been marked as inactive.\n" + | ||
"Found inactive addresses: nothing2@example.com, nothing@example.com.\n" + | ||
"Inactive recipients are ones that have generated a hard bounce, " + | ||
"a spam complaint, or a manual suppression.\n", errorCode: 406, status: 422 | ||
message: "You tried to send to recipient(s) that have been marked as inactive. " + | ||
"Found inactive addresses: bounce@example.com, bounce2@example.com. " + | ||
"Inactive recipients are ones that have generated a hard bounce, a spam complaint, or a manual suppression." | ||
, errorCode: 406, status: 422 | ||
}; | ||
@@ -124,3 +124,3 @@ | ||
expect(postmarkError.name).to.equal("InactiveRecipientsError"); | ||
expect(postmarkError.recipients).to.eql([ 'nothing2@example.com', 'nothing@example.com' ]) | ||
expect(postmarkError.recipients).to.eql([ 'bounce@example.com', 'bounce2@example.com' ]) | ||
}); | ||
@@ -137,20 +137,36 @@ | ||
it("parse some inactive recipients", () => { | ||
const message = "Message OK, but will not deliver to these inactive addresses: " + | ||
"nothing2@example.com, nothing@example.com" | ||
it("parse some inactive recipients - single", () => { | ||
const message = "Message OK, but will not deliver to these inactive addresses: bounce@example.com" | ||
const inactiveRecipients = Errors.InactiveRecipientsError.parseInactiveRecipients(message) | ||
expect(inactiveRecipients).to.eql([ 'nothing2@example.com', 'nothing@example.com' ]) | ||
expect(inactiveRecipients).to.eql([ 'bounce@example.com' ]) | ||
}); | ||
it("parse some inactive recipients - different error message", () => { | ||
const message = "Message OK, but will not deliver to these inactive addresses: " + | ||
"nothing2@example.com, nothing@example.com. Inactive addresses can be activated." | ||
it("parse some inactive recipients - multiple", () => { | ||
const message = "Message OK, but will not deliver to these inactive addresses: bounce@example.com, bounce2@example.com" | ||
const inactiveRecipients = Errors.InactiveRecipientsError.parseInactiveRecipients(message) | ||
expect(inactiveRecipients).to.eql([ 'nothing2@example.com', 'nothing@example.com' ]) | ||
expect(inactiveRecipients).to.eql([ 'bounce@example.com', 'bounce2@example.com' ]) | ||
}); | ||
it("parse all inactive recipients - multiple", () => { | ||
const message = "You tried to send to recipient(s) that have been marked as inactive. Found inactive addresses: " + | ||
"bounce@example.com, bounce2@example.com. " + | ||
"Inactive recipients are ones that have generated a hard bounce, a spam complaint, or a manual suppression." | ||
const inactiveRecipients = Errors.InactiveRecipientsError.parseInactiveRecipients(message); | ||
expect(inactiveRecipients).to.eql([ 'bounce@example.com', 'bounce2@example.com' ]) | ||
}); | ||
it("parse all inactive recipients - multiple - no whitespace between addresses", () => { | ||
const message = "You tried to send to recipient(s) that have been marked as inactive. Found inactive addresses: " + | ||
"bounce@example.com,bounce2@example.com " + | ||
"Inactive recipients are ones that have generated a hard bounce, a spam complaint, or a manual suppression." | ||
const inactiveRecipients = Errors.InactiveRecipientsError.parseInactiveRecipients(message); | ||
expect(inactiveRecipients).to.eql([ 'bounce@example.com', 'bounce2@example.com' ]) | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
314505
150
5435