@pliancy/salesforce-cpq-sdk 1.2.0 → 1.3.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.
|
@@ -5,9 +5,7 @@ export declare class Accounts {
|
|
|
5
5
|
private readonly connection;
|
|
6
6
|
private readonly client;
|
|
7
7
|
constructor(connection: Connection);
|
|
8
|
-
getAll(): Promise<
|
|
9
|
-
[name: string]: import("jsforce").SObjectFieldType | null;
|
|
10
|
-
} & import("jsforce").Record)[]>;
|
|
8
|
+
getAll(): Promise<Account[]>;
|
|
11
9
|
getById(id: string): Promise<Account | null>;
|
|
12
10
|
getByCustomField(field: string, value: string): Promise<(Account & CustomFieldQuery<Account>) | null>;
|
|
13
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection, SaveResult } from 'jsforce';
|
|
1
|
+
import { Connection, SaveResult, Schema, QueryCondition } from 'jsforce';
|
|
2
2
|
import { QuoteWithLineItems, UpdateQuoteLinesRequest } from './quote.types';
|
|
3
3
|
export declare class Quotes {
|
|
4
4
|
private readonly connection;
|
|
@@ -6,8 +6,8 @@ export declare class Quotes {
|
|
|
6
6
|
private readonly items;
|
|
7
7
|
constructor(connection: Connection);
|
|
8
8
|
getById(id: string): Promise<QuoteWithLineItems | null>;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
getQuoteByAccountId(accountId: string, options?: QueryCondition<Schema, 'SBQQ__Quote__c'>): Promise<QuoteWithLineItems | null>;
|
|
10
|
+
getQuotesForBillingPeriod(startDate: string, endDate: string, options?: QueryCondition<Schema, 'SBQQ__Quote__c'>): Promise<QuoteWithLineItems[]>;
|
|
11
11
|
updateLineItemQuantities(lineItems: UpdateQuoteLinesRequest): Promise<SaveResult[]>;
|
|
12
12
|
order(quoteId: string): Promise<SaveResult>;
|
|
13
13
|
}
|
|
@@ -16,22 +16,24 @@ class Quotes {
|
|
|
16
16
|
quote.lineItems = await this.items.getByQuoteId(quote.Id);
|
|
17
17
|
return quote;
|
|
18
18
|
}
|
|
19
|
-
async
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
async getQuoteByAccountId(accountId, options) {
|
|
20
|
+
const query = { SBQQ__Account__c: accountId };
|
|
21
|
+
if (options)
|
|
22
|
+
Object.assign(query, options);
|
|
23
|
+
const quote = (await this.client.findOne(query));
|
|
24
24
|
if (!quote)
|
|
25
25
|
return null;
|
|
26
26
|
quote.lineItems = await this.items.getByQuoteId(quote.Id);
|
|
27
27
|
return quote;
|
|
28
28
|
}
|
|
29
|
-
async
|
|
30
|
-
const
|
|
31
|
-
SBQQ__Type__c: 'Renewal',
|
|
29
|
+
async getQuotesForBillingPeriod(startDate, endDate, options) {
|
|
30
|
+
const query = {
|
|
32
31
|
SBQQ__StartDate__c: { $eq: new jsforce_1.SfDate(startDate) },
|
|
33
32
|
SBQQ__EndDate__c: { $eq: new jsforce_1.SfDate(endDate) },
|
|
34
|
-
}
|
|
33
|
+
};
|
|
34
|
+
if (options)
|
|
35
|
+
Object.assign(query, options);
|
|
36
|
+
const quotes = (await this.client.find(query));
|
|
35
37
|
if (!(quotes && quotes.length))
|
|
36
38
|
return [];
|
|
37
39
|
for (const quote of quotes) {
|