@dszp/n8n-nodes-onebill 0.0.2 → 0.1.0
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/README.md +53 -0
- package/dist/nodes/OneBill/GenericFunctions.js +4 -0
- package/dist/nodes/OneBill/GenericFunctions.js.map +1 -1
- package/dist/nodes/OneBill/OneBill.node.js +342 -12
- package/dist/nodes/OneBill/OneBill.node.js.map +1 -1
- package/dist/nodes/OneBill/OneBill.node.json +1 -1
- package/dist/nodes/OneBill/descriptions/BundleDescription.d.ts +3 -0
- package/dist/nodes/OneBill/descriptions/BundleDescription.js +207 -0
- package/dist/nodes/OneBill/descriptions/BundleDescription.js.map +1 -0
- package/dist/nodes/OneBill/descriptions/LeadDescription.d.ts +3 -0
- package/dist/nodes/OneBill/descriptions/LeadDescription.js +383 -0
- package/dist/nodes/OneBill/descriptions/LeadDescription.js.map +1 -0
- package/dist/nodes/OneBill/descriptions/PartnerDescription.d.ts +3 -0
- package/dist/nodes/OneBill/descriptions/PartnerDescription.js +249 -0
- package/dist/nodes/OneBill/descriptions/PartnerDescription.js.map +1 -0
- package/dist/nodes/OneBill/descriptions/PaymentDescription.js +12 -45
- package/dist/nodes/OneBill/descriptions/PaymentDescription.js.map +1 -1
- package/dist/nodes/OneBill/descriptions/SubscriberDescription.js +349 -1
- package/dist/nodes/OneBill/descriptions/SubscriberDescription.js.map +1 -1
- package/dist/nodes/OneBill/descriptions/VendorDescription.d.ts +3 -0
- package/dist/nodes/OneBill/descriptions/VendorDescription.js +190 -0
- package/dist/nodes/OneBill/descriptions/VendorDescription.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ This is an n8n community node for the [OneBill](https://www.onebillsoftware.com/
|
|
|
7
7
|
[Installation](#installation) |
|
|
8
8
|
[Operations](#operations) |
|
|
9
9
|
[Credentials](#credentials) |
|
|
10
|
+
[API Coverage](#api-coverage) |
|
|
10
11
|
[Resources](#resources)
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
@@ -18,6 +19,10 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
|
|
|
18
19
|
### Subscriber
|
|
19
20
|
- Create, Get, Get Many, Update, Close, Suspend, Resume, Reopen
|
|
20
21
|
- Get Balance, Get Subscriptions
|
|
22
|
+
- Get Contacts, Add Contact, Update Contact, Remove Contact
|
|
23
|
+
|
|
24
|
+
### Lead
|
|
25
|
+
- Create, Get, Get Many, Update, Convert to Subscriber
|
|
21
26
|
|
|
22
27
|
### Order
|
|
23
28
|
- Create, Get, Get Many, Validate, Activate, Update Quote
|
|
@@ -31,9 +36,18 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
|
|
|
31
36
|
### Product
|
|
32
37
|
- Create, Get, Get Many, Update, Delete
|
|
33
38
|
|
|
39
|
+
### Bundle
|
|
40
|
+
- Create, Get, Get Many, Update
|
|
41
|
+
|
|
34
42
|
### Ticket
|
|
35
43
|
- Create, Get, Update, Get History
|
|
36
44
|
|
|
45
|
+
### Partner
|
|
46
|
+
- Create, Get, Update, Delete, Delete Contacts, Suspend, Resume
|
|
47
|
+
|
|
48
|
+
### Vendor
|
|
49
|
+
- Create, Get, Update
|
|
50
|
+
|
|
37
51
|
## Credentials
|
|
38
52
|
|
|
39
53
|
To use this node, you need the following credentials from your OneBill account:
|
|
@@ -47,6 +61,45 @@ To use this node, you need the following credentials from your OneBill account:
|
|
|
47
61
|
| **Password** | Your OneBill account password (SHA256-hashed automatically) |
|
|
48
62
|
| **Scope** | OAuth scope (default: `trust`) |
|
|
49
63
|
|
|
64
|
+
## API Coverage
|
|
65
|
+
|
|
66
|
+
The OneBill API has approximately 135 endpoints across 13 services. This node currently implements 54 operations across 10 resources (~40% coverage), focusing on the most common billing and subscription management tasks.
|
|
67
|
+
|
|
68
|
+
### Implemented Endpoints
|
|
69
|
+
|
|
70
|
+
| Resource | Service | Operations |
|
|
71
|
+
|----------|---------|------------|
|
|
72
|
+
| **Subscriber** | SubscriberService | Create, Get, Get Many, Update, Close, Suspend, Resume, Reopen, Get Balance, Get Subscriptions, Get Contacts, Add Contact, Update Contact, Remove Contact |
|
|
73
|
+
| **Lead** | SubscriberService | Create, Get, Get Many, Update, Convert to Subscriber |
|
|
74
|
+
| **Order** | OrderService | Create, Get, Get Many, Validate, Activate, Update Quote |
|
|
75
|
+
| **Invoice** | InvoiceService | Get, Get Many, Modify |
|
|
76
|
+
| **Payment** | PaymentService | Create, Get Many, Get for Subscriber |
|
|
77
|
+
| **Product** | ProductService | Create, Get, Get Many, Update, Delete |
|
|
78
|
+
| **Bundle** | ProductService | Create, Get, Get Many, Update |
|
|
79
|
+
| **Ticket** | TicketManagementService | Create, Get, Update, Get History |
|
|
80
|
+
| **Partner** | PartnerService | Create, Get, Update, Delete, Delete Contacts, Suspend, Resume |
|
|
81
|
+
| **Vendor** | PartnerService | Create, Get, Update |
|
|
82
|
+
|
|
83
|
+
### Not Yet Implemented
|
|
84
|
+
|
|
85
|
+
| Service | Endpoints | Description |
|
|
86
|
+
|---------|-----------|-------------|
|
|
87
|
+
| **PromotionService** | ~13 | Coupon, Discount, Grant, Trial, Counter CRUD |
|
|
88
|
+
| **RuleService** | ~48 | Rules for billing, collections, late fees, order validation, etc. |
|
|
89
|
+
| **UserService** | 5 | User CRUD and roles listing |
|
|
90
|
+
| **UtilityService** | 3 | Transaction and usage exports |
|
|
91
|
+
| **BillingService** | 1 | Transaction-level bill now |
|
|
92
|
+
| **CommonService** | 1 | Custom lists with hierarchy |
|
|
93
|
+
|
|
94
|
+
Additional missing operations on implemented services:
|
|
95
|
+
|
|
96
|
+
| Service | Missing Operations |
|
|
97
|
+
|---------|-------------------|
|
|
98
|
+
| **SubscriberService** | Bill, Get Documents, Swap/Modify Provisioning Attributes |
|
|
99
|
+
| **OrderService** | Re-rate |
|
|
100
|
+
| **ProductService** | Delete Price Plan, Resell Templates |
|
|
101
|
+
| **TicketManagementService** | Templates, Classifications, Response Templates, Departments, Incident Types, Tags |
|
|
102
|
+
|
|
50
103
|
## Resources
|
|
51
104
|
|
|
52
105
|
- [OneBill Developer Guide](https://dev.onebillsoftware.com/)
|
|
@@ -129,6 +129,10 @@ async function oneBillApiRequestAllItems(method, endpoint, body = {}, qs = {}, d
|
|
|
129
129
|
if (dataKey && response[dataKey]) {
|
|
130
130
|
items = response[dataKey];
|
|
131
131
|
}
|
|
132
|
+
else if (dataKey && !response[dataKey]) {
|
|
133
|
+
hasMore = false;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
132
136
|
else if (Array.isArray(response)) {
|
|
133
137
|
items = response;
|
|
134
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/OneBill/GenericFunctions.ts"],"names":[],"mappings":";;AAmBA,oCAEC;AAKD,0CAEC;AAKD,wCA6CC;AAwBD,8CAiEC;AAMD,
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/OneBill/GenericFunctions.ts"],"names":[],"mappings":";;AAmBA,oCAEC;AAKD,0CAEC;AAKD,wCA6CC;AAwBD,8CAiEC;AAMD,8DA+DC;AA5OD,mCAAoC;AAWpC,+CAA4C;AAG5C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAgD,CAAC;AAK3E,SAAgB,YAAY,CAAC,QAAgB;IAC5C,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAKD,SAAgB,eAAe,CAAC,QAAgB;IAC/C,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAKM,KAAK,UAAU,cAAc,CAEnC,WAAwB;IAExB,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAkB,CAAC;IAChD,MAAM,QAA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AI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAE1C,OAAO,GAAG,KAAK,CAAC;YAChB,SAAS;QACV,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,KAAK,GAAG,QAAyB,CAAC;QACnC,CAAC;aAAM,CAAC;YAEP,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC1B,OAAO,GAAG,KAAK,CAAC;YAChB,SAAS;QACV,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAG1B,IAAI,KAAK,IAAI,UAAU,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;YACzC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;QAID,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,KAAK,CAAC;QACzD,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,IAAK,UAAqB,EAAE,CAAC;YAChE,OAAO,GAAG,KAAK,CAAC;YAChB,SAAS;QACV,CAAC;QAED,UAAU,IAAI,QAAQ,CAAC;IACxB,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACX,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -42,6 +42,10 @@ const InvoiceDescription_1 = require("./descriptions/InvoiceDescription");
|
|
|
42
42
|
const PaymentDescription_1 = require("./descriptions/PaymentDescription");
|
|
43
43
|
const ProductDescription_1 = require("./descriptions/ProductDescription");
|
|
44
44
|
const TicketDescription_1 = require("./descriptions/TicketDescription");
|
|
45
|
+
const LeadDescription_1 = require("./descriptions/LeadDescription");
|
|
46
|
+
const BundleDescription_1 = require("./descriptions/BundleDescription");
|
|
47
|
+
const PartnerDescription_1 = require("./descriptions/PartnerDescription");
|
|
48
|
+
const VendorDescription_1 = require("./descriptions/VendorDescription");
|
|
45
49
|
class OneBill {
|
|
46
50
|
constructor() {
|
|
47
51
|
this.description = {
|
|
@@ -72,14 +76,26 @@ class OneBill {
|
|
|
72
76
|
type: 'options',
|
|
73
77
|
noDataExpression: true,
|
|
74
78
|
options: [
|
|
79
|
+
{
|
|
80
|
+
name: 'Bundle',
|
|
81
|
+
value: 'bundle',
|
|
82
|
+
},
|
|
75
83
|
{
|
|
76
84
|
name: 'Invoice',
|
|
77
85
|
value: 'invoice',
|
|
78
86
|
},
|
|
87
|
+
{
|
|
88
|
+
name: 'Lead',
|
|
89
|
+
value: 'lead',
|
|
90
|
+
},
|
|
79
91
|
{
|
|
80
92
|
name: 'Order',
|
|
81
93
|
value: 'order',
|
|
82
94
|
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Partner/Agent',
|
|
97
|
+
value: 'partner',
|
|
98
|
+
},
|
|
83
99
|
{
|
|
84
100
|
name: 'Payment',
|
|
85
101
|
value: 'payment',
|
|
@@ -96,21 +112,33 @@ class OneBill {
|
|
|
96
112
|
name: 'Ticket',
|
|
97
113
|
value: 'ticket',
|
|
98
114
|
},
|
|
115
|
+
{
|
|
116
|
+
name: 'Vendor',
|
|
117
|
+
value: 'vendor',
|
|
118
|
+
},
|
|
99
119
|
],
|
|
100
120
|
default: 'subscriber',
|
|
101
121
|
},
|
|
102
|
-
...
|
|
103
|
-
...
|
|
104
|
-
...OrderDescription_1.orderOperations,
|
|
105
|
-
...OrderDescription_1.orderFields,
|
|
122
|
+
...BundleDescription_1.bundleOperations,
|
|
123
|
+
...BundleDescription_1.bundleFields,
|
|
106
124
|
...InvoiceDescription_1.invoiceOperations,
|
|
107
125
|
...InvoiceDescription_1.invoiceFields,
|
|
126
|
+
...LeadDescription_1.leadOperations,
|
|
127
|
+
...LeadDescription_1.leadFields,
|
|
128
|
+
...OrderDescription_1.orderOperations,
|
|
129
|
+
...OrderDescription_1.orderFields,
|
|
130
|
+
...PartnerDescription_1.partnerOperations,
|
|
131
|
+
...PartnerDescription_1.partnerFields,
|
|
108
132
|
...PaymentDescription_1.paymentOperations,
|
|
109
133
|
...PaymentDescription_1.paymentFields,
|
|
110
134
|
...ProductDescription_1.productOperations,
|
|
111
135
|
...ProductDescription_1.productFields,
|
|
136
|
+
...SubscriberDescription_1.subscriberOperations,
|
|
137
|
+
...SubscriberDescription_1.subscriberFields,
|
|
112
138
|
...TicketDescription_1.ticketOperations,
|
|
113
139
|
...TicketDescription_1.ticketFields,
|
|
140
|
+
...VendorDescription_1.vendorOperations,
|
|
141
|
+
...VendorDescription_1.vendorFields,
|
|
114
142
|
],
|
|
115
143
|
};
|
|
116
144
|
this.methods = {
|
|
@@ -195,6 +223,18 @@ class OneBill {
|
|
|
195
223
|
else if (resource === 'ticket') {
|
|
196
224
|
responseData = await handleTicket.call(this, operation, i);
|
|
197
225
|
}
|
|
226
|
+
else if (resource === 'lead') {
|
|
227
|
+
responseData = await handleLead.call(this, operation, i);
|
|
228
|
+
}
|
|
229
|
+
else if (resource === 'bundle') {
|
|
230
|
+
responseData = await handleBundle.call(this, operation, i);
|
|
231
|
+
}
|
|
232
|
+
else if (resource === 'partner') {
|
|
233
|
+
responseData = await handlePartner.call(this, operation, i);
|
|
234
|
+
}
|
|
235
|
+
else if (resource === 'vendor') {
|
|
236
|
+
responseData = await handleVendor.call(this, operation, i);
|
|
237
|
+
}
|
|
198
238
|
else {
|
|
199
239
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: `Unknown resource: ${resource}` });
|
|
200
240
|
}
|
|
@@ -216,6 +256,45 @@ class OneBill {
|
|
|
216
256
|
}
|
|
217
257
|
}
|
|
218
258
|
exports.OneBill = OneBill;
|
|
259
|
+
function stripPasswordsFromContacts(contacts) {
|
|
260
|
+
for (const contact of contacts) {
|
|
261
|
+
for (const key of ['userDetail', 'userDetails']) {
|
|
262
|
+
if (contact[key] && typeof contact[key] === 'object') {
|
|
263
|
+
delete contact[key].password;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function buildCommunicationPoints(fields) {
|
|
269
|
+
const fieldMap = [
|
|
270
|
+
{ field: 'emailAddress', type: 'EMAIL' },
|
|
271
|
+
{ field: 'contactPhone', type: 'PHONE' },
|
|
272
|
+
{ field: 'cellPhone', type: 'CPHONE' },
|
|
273
|
+
{ field: 'alternatePhone', type: 'APHONE' },
|
|
274
|
+
];
|
|
275
|
+
const points = [];
|
|
276
|
+
for (const { field, type } of fieldMap) {
|
|
277
|
+
if (fields[field] !== undefined) {
|
|
278
|
+
const value = fields[field];
|
|
279
|
+
points.push(value ? { type, value } : { type });
|
|
280
|
+
delete fields[field];
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return points;
|
|
284
|
+
}
|
|
285
|
+
function buildUserDetail(fields) {
|
|
286
|
+
const userDetailKeys = ['username', 'userRoleName', 'is2faEnabled'];
|
|
287
|
+
const detail = {};
|
|
288
|
+
let hasAny = false;
|
|
289
|
+
for (const key of userDetailKeys) {
|
|
290
|
+
if (fields[key] !== undefined) {
|
|
291
|
+
detail[key] = fields[key];
|
|
292
|
+
delete fields[key];
|
|
293
|
+
hasAny = true;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return hasAny ? detail : undefined;
|
|
297
|
+
}
|
|
219
298
|
async function handleSubscriber(operation, i) {
|
|
220
299
|
if (operation === 'create') {
|
|
221
300
|
const body = {
|
|
@@ -230,7 +309,13 @@ async function handleSubscriber(operation, i) {
|
|
|
230
309
|
}
|
|
231
310
|
if (operation === 'get') {
|
|
232
311
|
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
233
|
-
|
|
312
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`);
|
|
313
|
+
delete response.status;
|
|
314
|
+
const includeHashes = this.getNodeParameter('includePasswordHashes', i, false);
|
|
315
|
+
if (!includeHashes && response.contact) {
|
|
316
|
+
stripPasswordsFromContacts(response.contact);
|
|
317
|
+
}
|
|
318
|
+
return response;
|
|
234
319
|
}
|
|
235
320
|
if (operation === 'getAll') {
|
|
236
321
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
@@ -263,13 +348,73 @@ async function handleSubscriber(operation, i) {
|
|
|
263
348
|
}
|
|
264
349
|
if (operation === 'getBalance') {
|
|
265
350
|
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
266
|
-
|
|
351
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}/balance`);
|
|
352
|
+
delete response.status;
|
|
353
|
+
return response;
|
|
267
354
|
}
|
|
268
355
|
if (operation === 'getSubscriptions') {
|
|
269
356
|
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
270
357
|
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}/subscriptions`);
|
|
271
358
|
return response.subscriptions || [response];
|
|
272
359
|
}
|
|
360
|
+
if (operation === 'getContacts') {
|
|
361
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
362
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`);
|
|
363
|
+
const contacts = response.contact || [];
|
|
364
|
+
const includeHashes = this.getNodeParameter('includePasswordHashes', i, false);
|
|
365
|
+
if (!includeHashes) {
|
|
366
|
+
stripPasswordsFromContacts(contacts);
|
|
367
|
+
}
|
|
368
|
+
return contacts.map((contact, index) => ({ _contactIndex: index, ...contact }));
|
|
369
|
+
}
|
|
370
|
+
if (operation === 'addContact') {
|
|
371
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
372
|
+
const contactFields = this.getNodeParameter('contactFields', i);
|
|
373
|
+
contactFields.emailAddress = this.getNodeParameter('emailAddress', i);
|
|
374
|
+
contactFields.communicationPoint = buildCommunicationPoints(contactFields);
|
|
375
|
+
const userDetail = buildUserDetail(contactFields);
|
|
376
|
+
if (userDetail) {
|
|
377
|
+
contactFields.userDetail = userDetail;
|
|
378
|
+
}
|
|
379
|
+
const subscriber = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`);
|
|
380
|
+
const contacts = subscriber.contact || [];
|
|
381
|
+
contacts.push(contactFields);
|
|
382
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`, { contact: contacts });
|
|
383
|
+
return response;
|
|
384
|
+
}
|
|
385
|
+
if (operation === 'updateContact') {
|
|
386
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
387
|
+
const contactIndex = this.getNodeParameter('contactIndex', i);
|
|
388
|
+
const updateContactFields = this.getNodeParameter('updateContactFields', i);
|
|
389
|
+
const commPoints = buildCommunicationPoints(updateContactFields);
|
|
390
|
+
if (commPoints.length > 0) {
|
|
391
|
+
updateContactFields.communicationPoint = commPoints;
|
|
392
|
+
}
|
|
393
|
+
const userDetail = buildUserDetail(updateContactFields);
|
|
394
|
+
if (userDetail) {
|
|
395
|
+
updateContactFields.userDetail = userDetail;
|
|
396
|
+
}
|
|
397
|
+
const subscriber = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`);
|
|
398
|
+
const contacts = subscriber.contact || [];
|
|
399
|
+
if (contactIndex < 0 || contactIndex >= contacts.length) {
|
|
400
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Contact index ${contactIndex} is out of bounds. The subscriber has ${contacts.length} contact(s) (indices 0–${contacts.length - 1}).`, { itemIndex: i });
|
|
401
|
+
}
|
|
402
|
+
Object.assign(contacts[contactIndex], updateContactFields);
|
|
403
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`, { contact: contacts });
|
|
404
|
+
return response;
|
|
405
|
+
}
|
|
406
|
+
if (operation === 'removeContact') {
|
|
407
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
408
|
+
const contactIndex = this.getNodeParameter('contactIndex', i);
|
|
409
|
+
const subscriber = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`);
|
|
410
|
+
const contacts = subscriber.contact || [];
|
|
411
|
+
if (contactIndex < 0 || contactIndex >= contacts.length) {
|
|
412
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Contact index ${contactIndex} is out of bounds. The subscriber has ${contacts.length} contact(s) (indices 0–${contacts.length - 1}).`, { itemIndex: i });
|
|
413
|
+
}
|
|
414
|
+
contacts.splice(contactIndex, 1);
|
|
415
|
+
await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}`, { contact: contacts });
|
|
416
|
+
return { deleted: true };
|
|
417
|
+
}
|
|
273
418
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown subscriber operation: ${operation}`);
|
|
274
419
|
}
|
|
275
420
|
async function handleOrder(operation, i) {
|
|
@@ -343,15 +488,24 @@ async function handlePayment(operation, i) {
|
|
|
343
488
|
return await GenericFunctions_1.oneBillApiRequest.call(this, 'POST', '/rest/PaymentService/v1/payment', body);
|
|
344
489
|
}
|
|
345
490
|
if (operation === 'getAll') {
|
|
346
|
-
const
|
|
347
|
-
const
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
491
|
+
const qs = {};
|
|
492
|
+
const rangeFrom = this.getNodeParameter('rangeFrom', i);
|
|
493
|
+
const rangeTo = this.getNodeParameter('rangeTo', i);
|
|
494
|
+
if (rangeFrom) {
|
|
495
|
+
qs.rangeFrom = rangeFrom;
|
|
496
|
+
}
|
|
497
|
+
if (rangeTo) {
|
|
498
|
+
qs.rangeTo = rangeTo;
|
|
499
|
+
}
|
|
500
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', '/rest/PaymentService/v1/payments', {}, qs);
|
|
501
|
+
return response.payment || [];
|
|
351
502
|
}
|
|
352
503
|
if (operation === 'getForSubscriber') {
|
|
353
504
|
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
354
|
-
|
|
505
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/PaymentService/v1/payments/${encodeURIComponent(accountNumber)}`);
|
|
506
|
+
const responseArray = (Array.isArray(response) ? response : [response]);
|
|
507
|
+
const first = (responseArray[0] || {});
|
|
508
|
+
return first.payment || [];
|
|
355
509
|
}
|
|
356
510
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown payment operation: ${operation}`);
|
|
357
511
|
}
|
|
@@ -423,4 +577,180 @@ async function handleTicket(operation, i) {
|
|
|
423
577
|
}
|
|
424
578
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown ticket operation: ${operation}`);
|
|
425
579
|
}
|
|
580
|
+
async function handleLead(operation, i) {
|
|
581
|
+
if (operation === 'create') {
|
|
582
|
+
const body = {
|
|
583
|
+
accountName: this.getNodeParameter('accountName', i),
|
|
584
|
+
};
|
|
585
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
586
|
+
if (additionalFields.contact && typeof additionalFields.contact === 'string') {
|
|
587
|
+
additionalFields.contact = JSON.parse(additionalFields.contact);
|
|
588
|
+
}
|
|
589
|
+
if (additionalFields.customFields && typeof additionalFields.customFields === 'string') {
|
|
590
|
+
additionalFields.customFields = JSON.parse(additionalFields.customFields);
|
|
591
|
+
}
|
|
592
|
+
Object.assign(body, additionalFields);
|
|
593
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'POST', '/rest/SubscriberService/v1/lead', body);
|
|
594
|
+
}
|
|
595
|
+
if (operation === 'get') {
|
|
596
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
597
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/SubscriberService/v1/leads/${encodeURIComponent(accountNumber)}`);
|
|
598
|
+
}
|
|
599
|
+
if (operation === 'getAll') {
|
|
600
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
601
|
+
const filters = this.getNodeParameter('filters', i);
|
|
602
|
+
const qs = { ...filters };
|
|
603
|
+
const limit = returnAll ? undefined : this.getNodeParameter('limit', i);
|
|
604
|
+
return await GenericFunctions_1.oneBillApiRequestAllItems.call(this, 'GET', '/rest/SubscriberService/v1/leads', {}, qs, 'subscriber', limit);
|
|
605
|
+
}
|
|
606
|
+
if (operation === 'update') {
|
|
607
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
608
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
609
|
+
if (updateFields.contact && typeof updateFields.contact === 'string') {
|
|
610
|
+
updateFields.contact = JSON.parse(updateFields.contact);
|
|
611
|
+
}
|
|
612
|
+
if (updateFields.customFields && typeof updateFields.customFields === 'string') {
|
|
613
|
+
updateFields.customFields = JSON.parse(updateFields.customFields);
|
|
614
|
+
}
|
|
615
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', `/rest/SubscriberService/v1/leads/${encodeURIComponent(accountNumber)}`, updateFields);
|
|
616
|
+
}
|
|
617
|
+
if (operation === 'convertToSubscriber') {
|
|
618
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
619
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'POST', `/rest/SubscriberService/v1/subscribers/${encodeURIComponent(accountNumber)}/leadToSubscriber`);
|
|
620
|
+
}
|
|
621
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown lead operation: ${operation}`);
|
|
622
|
+
}
|
|
623
|
+
async function handleBundle(operation, i) {
|
|
624
|
+
if (operation === 'create') {
|
|
625
|
+
const body = {
|
|
626
|
+
bundleCode: this.getNodeParameter('bundleCode', i),
|
|
627
|
+
name: this.getNodeParameter('name', i),
|
|
628
|
+
};
|
|
629
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
630
|
+
if (additionalFields.bundleProduct && typeof additionalFields.bundleProduct === 'string') {
|
|
631
|
+
additionalFields.bundleProduct = JSON.parse(additionalFields.bundleProduct);
|
|
632
|
+
}
|
|
633
|
+
Object.assign(body, additionalFields);
|
|
634
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'POST', '/rest/ProductService/v1/products/bundle', body);
|
|
635
|
+
}
|
|
636
|
+
if (operation === 'get') {
|
|
637
|
+
const bundleCode = this.getNodeParameter('bundleCode', i);
|
|
638
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/ProductService/v1/bundles/${encodeURIComponent(bundleCode)}`);
|
|
639
|
+
}
|
|
640
|
+
if (operation === 'getAll') {
|
|
641
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
642
|
+
const filters = this.getNodeParameter('filters', i);
|
|
643
|
+
const qs = { ...filters };
|
|
644
|
+
const limit = returnAll ? undefined : this.getNodeParameter('limit', i);
|
|
645
|
+
return await GenericFunctions_1.oneBillApiRequestAllItems.call(this, 'GET', '/rest/ProductService/v1/bundles', {}, qs, 'bundle', limit);
|
|
646
|
+
}
|
|
647
|
+
if (operation === 'update') {
|
|
648
|
+
const body = JSON.parse(this.getNodeParameter('updateBody', i));
|
|
649
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', '/rest/ProductService/v1/products/bundle', body);
|
|
650
|
+
}
|
|
651
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown bundle operation: ${operation}`);
|
|
652
|
+
}
|
|
653
|
+
async function handlePartner(operation, i) {
|
|
654
|
+
if (operation === 'create') {
|
|
655
|
+
const body = {
|
|
656
|
+
accountName: this.getNodeParameter('accountName', i),
|
|
657
|
+
};
|
|
658
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
659
|
+
if (additionalFields.contacts && typeof additionalFields.contacts === 'string') {
|
|
660
|
+
additionalFields.contacts = JSON.parse(additionalFields.contacts);
|
|
661
|
+
}
|
|
662
|
+
if (additionalFields.customFields && typeof additionalFields.customFields === 'string') {
|
|
663
|
+
additionalFields.customFields = JSON.parse(additionalFields.customFields);
|
|
664
|
+
}
|
|
665
|
+
Object.assign(body, additionalFields);
|
|
666
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'POST', '/rest/PartnerService/v1/partners', body);
|
|
667
|
+
}
|
|
668
|
+
if (operation === 'get') {
|
|
669
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
670
|
+
const response = await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/PartnerService/v1/partners/${encodeURIComponent(accountNumber)}`);
|
|
671
|
+
delete response.status;
|
|
672
|
+
const addresses = response.address;
|
|
673
|
+
if (addresses && addresses.length > 0) {
|
|
674
|
+
const primary = addresses.find((a) => a.defaultBilling) || addresses[0];
|
|
675
|
+
response._addressLine1 = primary.addLine1 || '';
|
|
676
|
+
response._addressLine2 = primary.addLine2 || '';
|
|
677
|
+
response._city = primary.city || '';
|
|
678
|
+
response._state = primary.state || '';
|
|
679
|
+
response._country = primary.country || '';
|
|
680
|
+
response._zip = primary.zip || '';
|
|
681
|
+
}
|
|
682
|
+
const includeHashes = this.getNodeParameter('includePasswordHashes', i, false);
|
|
683
|
+
const contacts = response.contact;
|
|
684
|
+
if (contacts && contacts.length > 0) {
|
|
685
|
+
if (!includeHashes) {
|
|
686
|
+
stripPasswordsFromContacts(contacts);
|
|
687
|
+
}
|
|
688
|
+
const primary = contacts.find((c) => c.primaryContact) || contacts[0];
|
|
689
|
+
response._contactFirstName = primary.firstName || '';
|
|
690
|
+
response._contactLastName = primary.lastName || '';
|
|
691
|
+
const comPoints = primary.communicationPoint;
|
|
692
|
+
if (comPoints) {
|
|
693
|
+
for (const cp of comPoints) {
|
|
694
|
+
if (cp.type === 'EMAIL' && cp.value)
|
|
695
|
+
response._contactEmail = cp.value;
|
|
696
|
+
if (cp.type === 'PHONE' && cp.value)
|
|
697
|
+
response._contactPhone = cp.value;
|
|
698
|
+
if (cp.type === 'CPHONE' && cp.value)
|
|
699
|
+
response._contactCellPhone = cp.value;
|
|
700
|
+
if (cp.type === 'APHONE' && cp.value)
|
|
701
|
+
response._contactAltPhone = cp.value;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return response;
|
|
706
|
+
}
|
|
707
|
+
if (operation === 'delete') {
|
|
708
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
709
|
+
await GenericFunctions_1.oneBillApiRequest.call(this, 'DELETE', `/rest/PartnerService/v1/partners/${encodeURIComponent(accountNumber)}`);
|
|
710
|
+
return { deleted: true };
|
|
711
|
+
}
|
|
712
|
+
if (operation === 'deleteContacts') {
|
|
713
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
714
|
+
const contactIds = JSON.parse(this.getNodeParameter('contactIds', i));
|
|
715
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', `/rest/PartnerService/v1/channel/deleteContacts/${encodeURIComponent(accountNumber)}`, { contactIds });
|
|
716
|
+
}
|
|
717
|
+
if (operation === 'suspend') {
|
|
718
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
719
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', `/rest/PartnerService/v1/partners/${encodeURIComponent(accountNumber)}/suspend`);
|
|
720
|
+
}
|
|
721
|
+
if (operation === 'resume') {
|
|
722
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
723
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', `/rest/PartnerService/v1/partners/${encodeURIComponent(accountNumber)}/resume`);
|
|
724
|
+
}
|
|
725
|
+
if (operation === 'update') {
|
|
726
|
+
const body = JSON.parse(this.getNodeParameter('updateBody', i));
|
|
727
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', '/rest/PartnerService/v1/partners', body);
|
|
728
|
+
}
|
|
729
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown partner operation: ${operation}`);
|
|
730
|
+
}
|
|
731
|
+
async function handleVendor(operation, i) {
|
|
732
|
+
if (operation === 'create') {
|
|
733
|
+
const body = {
|
|
734
|
+
accountName: this.getNodeParameter('accountName', i),
|
|
735
|
+
};
|
|
736
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
737
|
+
if (additionalFields.contacts && typeof additionalFields.contacts === 'string') {
|
|
738
|
+
additionalFields.contacts = JSON.parse(additionalFields.contacts);
|
|
739
|
+
}
|
|
740
|
+
if (additionalFields.customFields && typeof additionalFields.customFields === 'string') {
|
|
741
|
+
additionalFields.customFields = JSON.parse(additionalFields.customFields);
|
|
742
|
+
}
|
|
743
|
+
Object.assign(body, additionalFields);
|
|
744
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'POST', '/rest/PartnerService/v1/vendor', body);
|
|
745
|
+
}
|
|
746
|
+
if (operation === 'get') {
|
|
747
|
+
const accountNumber = this.getNodeParameter('accountNumber', i);
|
|
748
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'GET', `/rest/PartnerService/v1/vendor/${encodeURIComponent(accountNumber)}`);
|
|
749
|
+
}
|
|
750
|
+
if (operation === 'update') {
|
|
751
|
+
const body = JSON.parse(this.getNodeParameter('updateBody', i));
|
|
752
|
+
return await GenericFunctions_1.oneBillApiRequest.call(this, 'PUT', '/rest/PartnerService/v1/vendor', body);
|
|
753
|
+
}
|
|
754
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown vendor operation: ${operation}`);
|
|
755
|
+
}
|
|
426
756
|
//# sourceMappingURL=OneBill.node.js.map
|