Skip to content

Commit 3a877c5

Browse files
committed
Move Webhooks tests
1 parent d3a616e commit 3a877c5

File tree

4 files changed

+30
-36
lines changed

4 files changed

+30
-36
lines changed

src/__tests__/bankingWebhooks.spec.ts renamed to src/__tests__/webhooks/bankingWebhooks.spec.ts

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// requests
2-
import { AccountHolderNotificationRequest } from "../typings/configurationWebhooks/accountHolderNotificationRequest";
3-
import { BalanceAccountNotificationRequest } from "../typings/configurationWebhooks/balanceAccountNotificationRequest";
4-
import { AuthenticationNotificationRequest } from "../typings/acsWebhooks/authenticationNotificationRequest";
5-
import { TransferNotificationRequest } from "../typings/transferWebhooks/transferNotificationRequest";
6-
import { PaymentMethodScheduledForRemovalNotificationRequest } from "../typings/managementWebhooks/paymentMethodScheduledForRemovalNotificationRequest";
7-
import { TransactionNotificationRequestV4 } from "../typings/transactionWebhooks/transactionNotificationRequestV4";
8-
import { NegativeBalanceCompensationWarningNotificationRequest } from "../typings/negativeBalanceWarningWebhooks/negativeBalanceCompensationWarningNotificationRequest";
9-
import { BalanceAccountBalanceNotificationRequest } from "../typings/balanceWebhooks/balanceAccountBalanceNotificationRequest";
2+
import { AccountHolderNotificationRequest } from "../../typings/configurationWebhooks/accountHolderNotificationRequest";
3+
import { BalanceAccountNotificationRequest } from "../../typings/configurationWebhooks/balanceAccountNotificationRequest";
4+
import { AuthenticationNotificationRequest } from "../../typings/acsWebhooks/authenticationNotificationRequest";
5+
import { TransferNotificationRequest } from "../../typings/transferWebhooks/transferNotificationRequest";
6+
import { PaymentMethodScheduledForRemovalNotificationRequest } from "../../typings/managementWebhooks/paymentMethodScheduledForRemovalNotificationRequest";
7+
import { TransactionNotificationRequestV4 } from "../../typings/transactionWebhooks/transactionNotificationRequestV4";
8+
import { NegativeBalanceCompensationWarningNotificationRequest } from "../../typings/negativeBalanceWarningWebhooks/negativeBalanceCompensationWarningNotificationRequest";
9+
import { BalanceAccountBalanceNotificationRequest } from "../../typings/balanceWebhooks/balanceAccountBalanceNotificationRequest";
1010

1111
// handlers
12-
import { AcsWebhooksHandler } from "../typings/acsWebhooks/acsWebhooksHandler";
13-
import { ReportWebhooksHandler } from "../typings/reportWebhooks/reportWebhooksHandler";
14-
import { ConfigurationWebhooksHandler } from "../typings/configurationWebhooks/configurationWebhooksHandler";
15-
import { TransferWebhooksHandler } from "../typings/transferWebhooks/transferWebhooksHandler";
16-
import { NegativeBalanceWarningWebhooksHandler } from "../typings/negativeBalanceWarningWebhooks/negativeBalanceWarningWebhooksHandler";
17-
import { TransactionWebhooksHandler } from "../typings/transactionWebhooks/transactionWebhooksHandler";
18-
import { BalanceWebhooksHandler } from "../typings/balanceWebhooks/balanceWebhooksHandler";
19-
import { ReportNotificationRequest } from "../typings/reportWebhooks/reportNotificationRequest";
12+
import { AcsWebhooksHandler } from "../../typings/acsWebhooks/acsWebhooksHandler";
13+
import { ReportWebhooksHandler } from "../../typings/reportWebhooks/reportWebhooksHandler";
14+
import { ConfigurationWebhooksHandler } from "../../typings/configurationWebhooks/configurationWebhooksHandler";
15+
import { TransferWebhooksHandler } from "../../typings/transferWebhooks/transferWebhooksHandler";
16+
import { NegativeBalanceWarningWebhooksHandler } from "../../typings/negativeBalanceWarningWebhooks/negativeBalanceWarningWebhooksHandler";
17+
import { TransactionWebhooksHandler } from "../../typings/transactionWebhooks/transactionWebhooksHandler";
18+
import { BalanceWebhooksHandler } from "../../typings/balanceWebhooks/balanceWebhooksHandler";
19+
import { ReportNotificationRequest } from "../../typings/reportWebhooks/reportNotificationRequest";
2020

2121
describe("BankingWebhooks Tests", function (): void {
2222

@@ -112,12 +112,6 @@ describe("BankingWebhooks Tests", function (): void {
112112

113113
});
114114

115-
it("should verify the banking hmac", function (): void {
116-
const jsonString = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}";
117-
const isValid = hmacValidator.validateHMACSignature("D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F", "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA=", jsonString);
118-
expect(isValid).toBe(true);
119-
});
120-
121115
it("should deserialize Transaction v4 Webhooks", function (): void {
122116
const json = {
123117
"data": {

src/__tests__/managementWebhooks.spec.ts renamed to src/__tests__/webhooks/managementWebhooks.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { PaymentMethodCreatedNotificationRequest } from "../typings/managementWebhooks/paymentMethodCreatedNotificationRequest";
2-
import { MerchantUpdatedNotificationRequest } from "../typings/managementWebhooks/merchantUpdatedNotificationRequest";
3-
import { PaymentMethodRequestRemovedNotificationRequest } from "../typings/managementWebhooks/paymentMethodRequestRemovedNotificationRequest";
4-
import { PaymentMethodScheduledForRemovalNotificationRequest } from "../typings/managementWebhooks/paymentMethodScheduledForRemovalNotificationRequest";
5-
import { ManagementWebhooksHandler } from "../typings/managementWebhooks/managementWebhooksHandler";
1+
import { PaymentMethodCreatedNotificationRequest } from "../../typings/managementWebhooks/paymentMethodCreatedNotificationRequest";
2+
import { MerchantUpdatedNotificationRequest } from "../../typings/managementWebhooks/merchantUpdatedNotificationRequest";
3+
import { PaymentMethodRequestRemovedNotificationRequest } from "../../typings/managementWebhooks/paymentMethodRequestRemovedNotificationRequest";
4+
import { PaymentMethodScheduledForRemovalNotificationRequest } from "../../typings/managementWebhooks/paymentMethodScheduledForRemovalNotificationRequest";
5+
import { ManagementWebhooksHandler } from "../../typings/managementWebhooks/managementWebhooksHandler";
66

77
describe("ManagementWebhooksHandler", function (): void {
88

src/__tests__/notification.spec.ts renamed to src/__tests__/webhooks/notification.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import authorisationTrue from "../__mocks__/notification/authorisationTrue.json";
2-
import captureTrue from "../__mocks__/notification/captureTrue.json";
3-
import captureFalse from "../__mocks__/notification/captureFalse.json";
4-
import refundTrue from "../__mocks__/notification/refundTrue.json";
5-
import refundFalse from "../__mocks__/notification/refundFalse.json";
1+
import authorisationTrue from "../../__mocks__/notification/authorisationTrue.json";
2+
import captureTrue from "../../__mocks__/notification/captureTrue.json";
3+
import captureFalse from "../../__mocks__/notification/captureFalse.json";
4+
import refundTrue from "../../__mocks__/notification/refundTrue.json";
5+
import refundFalse from "../../__mocks__/notification/refundFalse.json";
66

77
// requests
8-
import NotificationRequest from "../notification/notificationRequest";
9-
import { Notification, NotificationRequestItem } from "../typings/notification/models";
8+
import NotificationRequest from "../../notification/notificationRequest";
9+
import { Notification, NotificationRequestItem } from "../../typings/notification/models";
1010
import NotificationEnum = NotificationRequestItem.EventCodeEnum;
1111
import SuccessEnum = NotificationRequestItem.SuccessEnum;
1212

src/__tests__/transferWebhook.spec.ts renamed to src/__tests__/webhooks/transferWebhook.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { EstimationTrackingData } from "../typings/transferWebhooks/estimationTrackingData";
2-
import { TransferWebhooksHandler } from "../typings/transferWebhooks/transferWebhooksHandler";
1+
import { EstimationTrackingData } from "../../typings/transferWebhooks/estimationTrackingData";
2+
import { TransferWebhooksHandler } from "../../typings/transferWebhooks/transferWebhooksHandler";
33

44
describe("Transfer Webhook Serialization", (): void => {
55
// disabling temporarily (must address oneOf deserialization issue)

0 commit comments

Comments
 (0)