-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add status callback options to send calls
- Loading branch information
Showing
7 changed files
with
167 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,33 @@ describe("notification api", () => { | |
}); | ||
}); | ||
|
||
it("should send an email with status callback url and bearer token", () => { | ||
let email = "[email protected]", | ||
templateId = "123", | ||
options = { | ||
personalisation: { foo: "bar" }, | ||
statusCallbackUrl: "https://localhost/callback", | ||
statusCallbackBearerToken: "1234567890" | ||
}, | ||
data = { | ||
template_id: templateId, | ||
email_address: email, | ||
personalisation: options.personalisation, | ||
status_callback_url: options.statusCallbackUrl, | ||
status_callback_bearer_token: options.statusCallbackBearerToken | ||
}; | ||
|
||
notifyAuthNock | ||
.post("/v2/notifications/email", data) | ||
.reply(200, { hooray: "bkbbk" }); | ||
|
||
return notifyClient | ||
.sendEmail(templateId, email, options) | ||
.then(response => { | ||
expect(response.statusCode).to.equal(200); | ||
}); | ||
}); | ||
|
||
it("should reject options dicts with unknown options", () => { | ||
let email = "[email protected]", | ||
templateId = "123", | ||
|
@@ -154,6 +181,33 @@ describe("notification api", () => { | |
}); | ||
}); | ||
|
||
it("should send an sms with status callback url and bearer token", () => { | ||
let phoneNo = "07525755555", | ||
templateId = "123", | ||
options = { | ||
personalisation: { foo: "bar" }, | ||
statusCallbackUrl: "https://localhost/callback", | ||
statusCallbackBearerToken: "1234567890" | ||
}, | ||
data = { | ||
template_id: templateId, | ||
phone_number: phoneNo, | ||
personalisation: options.personalisation, | ||
status_callback_url: options.statusCallbackUrl, | ||
status_callback_bearer_token: options.statusCallbackBearerToken | ||
}; | ||
|
||
notifyAuthNock | ||
.post("/v2/notifications/sms", data) | ||
.reply(200, { hooray: "bkbbk" }); | ||
|
||
return notifyClient | ||
.sendSms(templateId, phoneNo, options) | ||
.then(function(response) { | ||
expect(response.statusCode).to.equal(200); | ||
}); | ||
}); | ||
|
||
it("should reject options dicts with unknown options", () => { | ||
let phoneNumber = "07123456789", | ||
templateId = "123", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters