octopian-apis 1.0.27 → 1.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octopian-apis",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "Transaction APIs SDK that implements Octopian Services which will be used for any node project typescript or javascript",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -671,6 +671,23 @@ export async function AddRequest(AddRequestDTO, AuthToken = null, Timeout = 3000
671
671
  );
672
672
  return APIResponse;
673
673
  }
674
+
675
+ export async function AddRequestAndSubmit(AddRequestDTO, AuthToken = null, Timeout = 30000) {
676
+ let APIResponse = await apiHandler.PostMethod(
677
+ RequestsAPIConstants.uriAddRequest(),
678
+ AddRequestDTO,
679
+ AuthToken,
680
+ Timeout
681
+ );
682
+
683
+ await SubmitCart({
684
+ specificRequestIds: [APIResponse.Result.RequestId],
685
+ ShippingAddressId: 0,
686
+ BillingAddressId: 0,
687
+ PaymentMethod: "Card",
688
+ });
689
+ return APIResponse;
690
+ }
674
691
  /**
675
692
  * @description
676
693
  * Submits the cart with the given details.
@@ -1421,7 +1421,7 @@ export async function DABGetPaymentURL(
1421
1421
  );
1422
1422
  if (addrequestResult.StatusCode === 200 && isAddToCart) {
1423
1423
  DABSubmitCart({
1424
- RequestId: addrequestResult.Result.RequestId,
1424
+ specificRequestIds: [addrequestResult.Result.RequestId],
1425
1425
  ShippingAddressId: 0,
1426
1426
  BillingAddressId: 0,
1427
1427
  PaymentMethod: "Card",
package/src/index.d.ts CHANGED
@@ -4392,6 +4392,34 @@ interface RequestsRequesterServices {
4392
4392
  AuthToken?: string | null,
4393
4393
  Timeout?: number | null
4394
4394
  ) => BaseResponse<AddRequestOutput | BaseErrorResponse>;
4395
+
4396
+ /**
4397
+ * @description
4398
+ * Adds a request and submits it.
4399
+ *
4400
+ * @param {RequesterAddRequestInput} AddRequestDTO
4401
+ * Data object containing fields necessary for adding a request.
4402
+ *
4403
+ * @param {string} AuthToken
4404
+ * Authentication token for authorization purposes.
4405
+ *
4406
+ * @param {number} Timeout
4407
+ * Time in milliseconds to wait before the request times out. Default is 30000.
4408
+ *
4409
+ * @returns
4410
+ * An object containing the response from the Add Request and Submit request, including
4411
+ * success message, status code, and any additional data returned by the API.
4412
+ * {
4413
+ * Message: Success,
4414
+ * StatusCode: 200,
4415
+ * Result: AddRequestOutput
4416
+ * }
4417
+ */
4418
+ AddRequestAndSubmit: (
4419
+ Input: RequesterAddRequestInput,
4420
+ AuthToken?: string | null,
4421
+ Timeout?: number | null
4422
+ ) => BaseResponse<AddRequestOutput | BaseErrorResponse>;
4395
4423
  /**
4396
4424
  * @description
4397
4425
  * Cancels the draft requests by sending a POST request with the provided cancellation data.
package/src/index.js CHANGED
@@ -243,6 +243,7 @@ const {
243
243
  AgentMaintainInteractorAttributeList,
244
244
  AgentSubmitCart,
245
245
  AddRequest,
246
+ AddRequestAndSubmit,
246
247
  CancelDraftRequestList,
247
248
  CancelRequest,
248
249
  GetCartDefinition,
@@ -288,6 +289,7 @@ const RequestsDispatchServices = {
288
289
  const RequestsRequesterServices = {
289
290
  AgentAddRequest,
290
291
  AddRequest,
292
+ AddRequestAndSubmit,
291
293
  CancelDraftRequestList,
292
294
  CancelRequest,
293
295
  GetCartDefinition,