@signalhousellc/sdk 1.0.33 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/domains/Billing.js +26 -0
- package/src/domains/Messages.js +5 -1
package/package.json
CHANGED
package/src/domains/Billing.js
CHANGED
|
@@ -2,6 +2,32 @@ export class Billing {
|
|
|
2
2
|
constructor(client, enableAdmin) {
|
|
3
3
|
this.client = client;
|
|
4
4
|
this.enableAdmin = enableAdmin;
|
|
5
|
+
|
|
6
|
+
if (enableAdmin) {
|
|
7
|
+
this.admin = {
|
|
8
|
+
/**
|
|
9
|
+
* Issue a credit to a customer's wallet
|
|
10
|
+
* @async
|
|
11
|
+
* @roles signalhouse_admin, signalhouse_api, signalhouse_user
|
|
12
|
+
* @param {Object} params
|
|
13
|
+
* @param {string} params.groupId - The group ID to credit
|
|
14
|
+
* @param {number} params.amount - Amount in microdollars
|
|
15
|
+
* @param {string} params.transactionType - Type of credit (e.g. "Goodwill Credit", "Billing Correction")
|
|
16
|
+
* @param {string} params.description - Reason for the credit (1-500 characters)
|
|
17
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
18
|
+
* @returns {Promise<Object>} The created transaction object
|
|
19
|
+
*/
|
|
20
|
+
issueCredit: async ({ groupId, amount, transactionType, description, options = {} }) => {
|
|
21
|
+
this.client._require({ groupId, amount, transactionType, description });
|
|
22
|
+
const safeGroupId = encodeURIComponent(groupId);
|
|
23
|
+
return this.client(`/billing/wallet/credit/${safeGroupId}`, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
body: { amount, transactionType, description },
|
|
26
|
+
...options,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
5
31
|
}
|
|
6
32
|
|
|
7
33
|
/**
|
package/src/domains/Messages.js
CHANGED
|
@@ -19,6 +19,8 @@ export class Messages {
|
|
|
19
19
|
* @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
|
|
20
20
|
* @param {string} [params.messageType] - Filter messages by their type (SMS, MMS)
|
|
21
21
|
* @param {string} [params.carrier] - Filter messages by the carrier used for sending
|
|
22
|
+
* @param {string} [params.senderPhoneNumber] - Filter messages by the sender's phone number
|
|
23
|
+
* @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
|
|
22
24
|
* @param {string} [params.startDate] - Filter messages by their start date
|
|
23
25
|
* @param {string} [params.endDate] - Filter messages by their end date
|
|
24
26
|
* @param {string} [params.sortField] - The field to sort the messages by
|
|
@@ -35,6 +37,8 @@ export class Messages {
|
|
|
35
37
|
subgroupId,
|
|
36
38
|
groupId,
|
|
37
39
|
phoneNumber,
|
|
40
|
+
senderPhoneNumber,
|
|
41
|
+
recipientPhoneNumber,
|
|
38
42
|
status,
|
|
39
43
|
direction,
|
|
40
44
|
messageType,
|
|
@@ -47,7 +51,7 @@ export class Messages {
|
|
|
47
51
|
limit,
|
|
48
52
|
options = {},
|
|
49
53
|
}) {
|
|
50
|
-
const filters = { id, campaignId, brandId, subgroupId, groupId, phoneNumber, status, direction, messageType, carrier, startDate, endDate, sortField, sortOrder, page, limit };
|
|
54
|
+
const filters = { id, campaignId, brandId, subgroupId, groupId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, carrier, startDate, endDate, sortField, sortOrder, page, limit };
|
|
51
55
|
const queryString = this.client._getQueryString(filters);
|
|
52
56
|
return this.client(`/message${queryString}`, { method: "GET", ...options });
|
|
53
57
|
}
|