@pliancy/salesforce-cpq-sdk 1.10.0 → 1.12.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.
@@ -1,10 +1,11 @@
1
1
  import { Connection, SaveResult } from 'jsforce';
2
- import { FullOrder, OrderStatus } from './order.types';
2
+ import { FullOrder, Order, OrderStatus } from './order.types';
3
3
  export declare class Orders {
4
4
  private readonly connection;
5
5
  private readonly client;
6
6
  private readonly items;
7
7
  constructor(connection: Connection);
8
8
  getByStartDateForAccount(accountId: string, startDate: string, status: OrderStatus): Promise<FullOrder[]>;
9
+ getDraftByQuoteId(id: string): Promise<Order | null>;
9
10
  activate(orderId: string): Promise<SaveResult>;
10
11
  }
@@ -20,6 +20,16 @@ class Orders {
20
20
  }
21
21
  return orders;
22
22
  }
23
+ async getDraftByQuoteId(id) {
24
+ const order = (await this.client.findOne({
25
+ SBQQ__Quote__c: id,
26
+ Status: 'Draft',
27
+ }));
28
+ if (!order)
29
+ return null;
30
+ order.lineItems = await this.items.getByOrderId(order.Id);
31
+ return order;
32
+ }
23
33
  async activate(orderId) {
24
34
  return this.client.update({ Id: orderId, Status: 'Activated' });
25
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pliancy/salesforce-cpq-sdk",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "description": "Salesforce CPQ SDK for Node.js",