@pliancy/salesforce-cpq-sdk 1.3.0 → 1.4.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.
@@ -13,6 +13,7 @@ export interface Quote {
13
13
  LastActivityDate?: string;
14
14
  LastViewedDate: string;
15
15
  LastReferencedDate: string;
16
+ ApprovalStatus__c: ApprovalStatus;
16
17
  SBQQ__Account__c: string;
17
18
  SBQQ__BillingCity__c: string;
18
19
  SBQQ__BillingCountry__c: string;
@@ -97,3 +98,4 @@ export type QuoteWithLineItems = Quote & {
97
98
  };
98
99
  export type UpdateQuoteLine = Pick<QuoteLine, 'Id' | 'SBQQ__Quantity__c'>;
99
100
  export type UpdateQuoteLinesRequest = UpdateQuoteLine[];
101
+ export type ApprovalStatus = 'Approved' | 'Rejected' | 'Pending' | 'Approval Not Required' | 'Required : Not Sent for Approval';
@@ -9,5 +9,6 @@ export declare class Quotes {
9
9
  getQuoteByAccountId(accountId: string, options?: QueryCondition<Schema, 'SBQQ__Quote__c'>): Promise<QuoteWithLineItems | null>;
10
10
  getQuotesForBillingPeriod(startDate: string, endDate: string, options?: QueryCondition<Schema, 'SBQQ__Quote__c'>): Promise<QuoteWithLineItems[]>;
11
11
  updateLineItemQuantities(lineItems: UpdateQuoteLinesRequest): Promise<SaveResult[]>;
12
- order(quoteId: string): Promise<SaveResult>;
12
+ order(quoteId: string, options?: QueryCondition<Schema, 'SBQQ__Quote__c'>): Promise<SaveResult>;
13
+ approve(quoteId: string): Promise<SaveResult>;
13
14
  }
@@ -44,8 +44,15 @@ class Quotes {
44
44
  async updateLineItemQuantities(lineItems) {
45
45
  return this.items.update(lineItems);
46
46
  }
47
- async order(quoteId) {
48
- return this.client.update({ Id: quoteId, SBQQ__Ordered__c: true });
47
+ async order(quoteId, options) {
48
+ const query = { Id: quoteId, SBQQ__Ordered__c: true };
49
+ if (options)
50
+ Object.assign(query, options);
51
+ return this.client.update(query);
52
+ }
53
+ async approve(quoteId) {
54
+ await this.connection.process.approval.submit(quoteId);
55
+ return this.client.update({ Id: quoteId, ApprovalStatus__c: 'Approved' });
49
56
  }
50
57
  }
51
58
  exports.Quotes = Quotes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pliancy/salesforce-cpq-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "description": "Salesforce CPQ SDK for Node.js",