@moneylion/engine-api 1.3.5 → 1.3.6

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 CHANGED
@@ -112,15 +112,18 @@ const leadData = {
112
112
  purpose: "debt_consolidation",
113
113
  loanAmount: 10000
114
114
  },
115
- offerCatalogProductTypes: ["DebtSettlement"] // Note: different from productTypes
115
+ productTypes: ["DebtSettlement"] // Product types for offer catalog
116
116
  };
117
117
 
118
+ // First, create or get a lead UUID
119
+ const leadUuid = await leads.create(leadData);
120
+
118
121
  // Non-blocking: returns AsyncOfferCatalogRateTable that you can resolve
119
- const asyncRateTable = await leads.getOfferCatalogRateTable(leadData);
122
+ const asyncRateTable = await leads.getOfferCatalogRateTable(leadUuid, leadData);
120
123
  const rateTable = await asyncRateTable.resolve();
121
124
 
122
125
  // Blocking: waits for the final rate table
123
- const rateTable = await leads.getOfferCatalogRateTableBlocking(leadData);
126
+ const rateTable = await leads.getOfferCatalogRateTableBlocking(leadUuid, leadData);
124
127
  ```
125
128
 
126
129
  #### Fetching an Existing Offer Catalog Rate Table
package/dist/leads.d.ts CHANGED
@@ -93,20 +93,21 @@ export declare class Leads {
93
93
  /**
94
94
  * Create a new offer catalog rate table for a lead.
95
95
  *
96
- * @param lead - An object representing the lead information including offerCatalogProductTypes.
96
+ * @param leadUuid - The UUID of the lead for which to create the rate table.
97
+ * @param lead - An object representing the lead information.
97
98
  *
98
99
  * @returns AsyncOfferCatalogRateTable
99
100
  *
100
101
  * @remarks
101
102
  * This method returns an AsyncOfferCatalogRateTable.
102
103
  * Use the resolve method on the returned object to retrieve the final Offer Catalog Rate Table.
103
- * The lead data should include offerCatalogProductTypes (e.g., ["DebtSettlement"]) instead of productTypes.
104
104
  */
105
- getOfferCatalogRateTable(lead: LeadCreateData): Promise<AsyncOfferCatalogRateTable>;
105
+ getOfferCatalogRateTable(leadUuid: string, lead: LeadCreateData): Promise<AsyncOfferCatalogRateTable>;
106
106
  /**
107
107
  * Create a new offer catalog rate table, immediately resolving it.
108
108
  *
109
- * @param lead - An object representing the lead information including offerCatalogProductTypes.
109
+ * @param leadUuid - The UUID of the lead for which to create the rate table.
110
+ * @param lead - An object representing the lead information.
110
111
  *
111
112
  * @returns OfferCatalogRateTable
112
113
  *
@@ -114,7 +115,6 @@ export declare class Leads {
114
115
  * This method will immediately resolve the final Offer Catalog Rate Table.
115
116
  * This may mean waiting a significant amount of time before it is finalized.
116
117
  * Only use this if you can handle waiting for that amount of time.
117
- * The lead data should include offerCatalogProductTypes (e.g., ["DebtSettlement"]) instead of productTypes.
118
118
  */
119
- getOfferCatalogRateTableBlocking(lead: LeadCreateData): Promise<OfferCatalogRateTable>;
119
+ getOfferCatalogRateTableBlocking(leadUuid: string, lead: LeadCreateData): Promise<OfferCatalogRateTable>;
120
120
  }
package/dist/leads.js CHANGED
@@ -147,18 +147,18 @@ export class Leads {
147
147
  /**
148
148
  * Create a new offer catalog rate table for a lead.
149
149
  *
150
- * @param lead - An object representing the lead information including offerCatalogProductTypes.
150
+ * @param leadUuid - The UUID of the lead for which to create the rate table.
151
+ * @param lead - An object representing the lead information.
151
152
  *
152
153
  * @returns AsyncOfferCatalogRateTable
153
154
  *
154
155
  * @remarks
155
156
  * This method returns an AsyncOfferCatalogRateTable.
156
157
  * Use the resolve method on the returned object to retrieve the final Offer Catalog Rate Table.
157
- * The lead data should include offerCatalogProductTypes (e.g., ["DebtSettlement"]) instead of productTypes.
158
158
  */
159
- getOfferCatalogRateTable(lead) {
159
+ getOfferCatalogRateTable(leadUuid, lead) {
160
160
  return __awaiter(this, void 0, void 0, function* () {
161
- const resp = yield this.client.post("originator/offerCatalogRateTables", lead);
161
+ const resp = yield this.client.post(`leads/${leadUuid}/offerCatalogRateTables`, lead);
162
162
  const rateTable = offerCatalogRateTableDecoder.runWithException(resp);
163
163
  const asyncRateTable = new AsyncOfferCatalogRateTable({
164
164
  rateTable,
@@ -170,7 +170,8 @@ export class Leads {
170
170
  /**
171
171
  * Create a new offer catalog rate table, immediately resolving it.
172
172
  *
173
- * @param lead - An object representing the lead information including offerCatalogProductTypes.
173
+ * @param leadUuid - The UUID of the lead for which to create the rate table.
174
+ * @param lead - An object representing the lead information.
174
175
  *
175
176
  * @returns OfferCatalogRateTable
176
177
  *
@@ -178,11 +179,10 @@ export class Leads {
178
179
  * This method will immediately resolve the final Offer Catalog Rate Table.
179
180
  * This may mean waiting a significant amount of time before it is finalized.
180
181
  * Only use this if you can handle waiting for that amount of time.
181
- * The lead data should include offerCatalogProductTypes (e.g., ["DebtSettlement"]) instead of productTypes.
182
182
  */
183
- getOfferCatalogRateTableBlocking(lead) {
183
+ getOfferCatalogRateTableBlocking(leadUuid, lead) {
184
184
  return __awaiter(this, void 0, void 0, function* () {
185
- const resp = yield this.client.post("blocking/originator/offerCatalogRateTables", lead);
185
+ const resp = yield this.client.post(`blocking/leads/${leadUuid}/offerCatalogRateTables`, lead);
186
186
  const rateTable = offerCatalogRateTableDecoder.runWithException(resp);
187
187
  return rateTable;
188
188
  });
@@ -235,6 +235,8 @@ const patchLeadUuidResponse = "patch-lead-uuid-response";
235
235
  const createLeadUuidResponse = "create-lead-uuid-response";
236
236
  const getRateTableLeadUuid = "get-rate-table-lead-uuid";
237
237
  const getRateTableLeadUuidBlocking = "get-rate-table-lead-uuid-blocking";
238
+ const getOfferCatalogRateTableLeadUuid = "get-offer-catalog-rate-table-lead-uuid";
239
+ const getOfferCatalogRateTableLeadUuidBlocking = "get-offer-catalog-rate-table-lead-uuid-blocking";
238
240
  const handlers = [
239
241
  http.post(`${testHost}/blocking/leads/rateTables`, () => {
240
242
  return new HttpResponse(JSON.stringify(fullRateTable), { status: 200 });
@@ -275,12 +277,12 @@ const handlers = [
275
277
  });
276
278
  }),
277
279
  // Offer Catalog endpoints
278
- http.post(`${testHost}/originator/offerCatalogRateTables`, () => {
280
+ http.post(`${testHost}/leads/${getOfferCatalogRateTableLeadUuid}/offerCatalogRateTables`, () => {
279
281
  return new HttpResponse(JSON.stringify(pendingOfferCatalogRateTable), {
280
282
  status: 200,
281
283
  });
282
284
  }),
283
- http.post(`${testHost}/blocking/originator/offerCatalogRateTables`, () => {
285
+ http.post(`${testHost}/blocking/leads/${getOfferCatalogRateTableLeadUuidBlocking}/offerCatalogRateTables`, () => {
284
286
  return new HttpResponse(JSON.stringify(fullOfferCatalogRateTable), {
285
287
  status: 200,
286
288
  });
@@ -338,14 +340,14 @@ describe("Leads", () => {
338
340
  }));
339
341
  test("Get offer catalog rate table endpoint returns an async rate table", () => __awaiter(void 0, void 0, void 0, function* () {
340
342
  const leads = new Leads(testHost, token);
341
- const resp = yield leads.getOfferCatalogRateTable(testLeadData);
343
+ const resp = yield leads.getOfferCatalogRateTable(getOfferCatalogRateTableLeadUuid, testLeadData);
342
344
  expect(resp).toBeInstanceOf(AsyncOfferCatalogRateTable);
343
345
  const rateTable = yield resp.resolve();
344
346
  expect(rateTable).toEqual(fullOfferCatalogRateTable);
345
347
  }));
346
348
  test("Get offer catalog rate table blocking endpoint returns a resolved rate table", () => __awaiter(void 0, void 0, void 0, function* () {
347
349
  const leads = new Leads(testHost, token);
348
- const resp = yield leads.getOfferCatalogRateTableBlocking(testLeadData);
350
+ const resp = yield leads.getOfferCatalogRateTableBlocking(getOfferCatalogRateTableLeadUuidBlocking, testLeadData);
349
351
  expect(resp).toEqual(fullOfferCatalogRateTable);
350
352
  }));
351
353
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneylion/engine-api",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Interface to engine.tech API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",