Skip to content

Commit 3484626

Browse files
authored
Merge pull request #63 from hyperwallet/V4-unable-to-list-webhooks
V4 unable to list webhooks
2 parents e80398d + d326447 commit 3484626

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Hyperwallet.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,9 @@ export default class Hyperwallet {
17411741
* @param {api-callback} callback - The callback for this call
17421742
*/
17431743
listWebhookNotifications(options, callback) {
1744-
const LIST_WEBHOOK_NOTIFICATIONS_FILTERS = ["programToken", "type"];
1744+
const LIST_WEBHOOK_NOTIFICATIONS_FILTERS = ["programToken", "createdBefore", "createdAfter",
1745+
"type", "sortBy", "limit"];
1746+
17451747
if (options && !this.isValidFilter(options, LIST_WEBHOOK_NOTIFICATIONS_FILTERS)) {
17461748
throw new Error("Invalid Filter. Expected - ".concat(LIST_WEBHOOK_NOTIFICATIONS_FILTERS));
17471749
}
@@ -1987,12 +1989,12 @@ export default class Hyperwallet {
19871989
/**
19881990
* Validate the options filter
19891991
*
1990-
* @param {Object} inputFilters - The query parameters in the URI
1992+
* @param {Object} options - The query parameters in the URI
19911993
* @param {Object} listFilters - Defined list of filters for a business object
19921994
*/
19931995

1994-
isValidFilter(inputFilters, listFilters) {
1995-
return Object.keys(inputFilters).every(elem => listFilters.includes(elem));
1996+
isValidFilter(options, listFilters) {
1997+
return Object.keys(options).every(elem => listFilters.includes(elem));
19961998
}
19971999

19982000
//--------------------------------------

test/Hyperwallet.spec.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,11 @@ describe("Hyperwallet", () => {
247247
/** @test {Hyperwallet#listUsers} */
248248
it("should do get call with options", () => {
249249
const callback = () => null;
250-
client.listUsers({ clientUserId: "test-client-user-id", status: "test-status" }, callback);
250+
client.listUsers({ clientUserId: "test-client-user-id", email: "test-email", programToken: "test-programToken",
251+
status: "test-status", verificationStatus: "test-verificationStatus" }, callback);
251252
apiClientSpy.should.have.been.calledOnce();
252-
apiClientSpy.should.have.been.calledWith("users", { clientUserId: "test-client-user-id", status: "test-status" });
253+
apiClientSpy.should.have.been.calledWith("users", { clientUserId: "test-client-user-id", email: "test-email",
254+
programToken: "test-programToken", status: "test-status", verificationStatus: "test-verificationStatus" });
253255
});
254256

255257
/** @test {Hyperwallet#listUsers} */
@@ -4061,7 +4063,8 @@ describe("Hyperwallet", () => {
40614063
/** @test {Hyperwallet#listWebhookNotifications} */
40624064
it("should throw error for invalid filter", () => {
40634065
const callback = () => null;
4064-
expect(() => client.listWebhookNotifications({ test: "value" }, callback)).to.throw("Invalid Filter. Expected - programToken,type");
4066+
expect(() => client.listWebhookNotifications({ test: "value" }, callback)).to.throw(
4067+
"Invalid Filter. Expected - programToken,createdBefore,createdAfter,type,sortBy,limit");
40654068
});
40664069

40674070
/** @test {Hyperwallet#listWebhookNotifications} */

0 commit comments

Comments
 (0)