This action occurs before a return action is performed. Changes made to the return in this action persist in Kibo.
Action Type | Embedded |
---|---|
Full Action ID | embedded.commerce.return.actions.before |
Runs multiple custom functions? | Yes |
JavaScript File Structure
Action files share the following basic structure:
module.exports = function(context, callback) { // Your custom code here callback(); };
When you code the custom function for an action, you have access to two arguments:
callback
—This argument follows the established JavaScript callback pattern: it takes an error as the first argument (or null if there is no error) and a result as the second argument (if required).
context
—This argument provides the function access to relevant objects and methods that interface with Kibo.
Context: Return
The following methods and objects are available to this action through the use of the context
argument.
Microservice Operation
This action corresponds to the microservice that creates returns.
Get Methods
Exec Methods
Context Objects Available to All Actions
Get
get.rma
Retrieves the current return.
Parameters | Type | Description |
---|---|---|
N/A | N/A | N/A |
Example:
context.get.rma();
Response:
{ "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "availableActions": "string", "changeMessages": [ { "amount": "decimal", "appId": "string", "appKey": "string", "appName": "string", "correlationId": "string", "createDate": "DateTime", "id": "string", "identifier": "string", "message": "string", "metadata": "object", "newValue": "string", "oldValue": "string", "subject": "string", "subjectType": "string", "success": "bool", "userFirstName": "string", "userId": "string", "userLastName": "string", "userScopeType": "string", "verb": "string" } ], "channelCode": "string", "contact": { "address": { "address1": "string", "address2": "string", "address3": "string", "address4": "string", "addressType": "string", "cityOrTown": "string", "countryCode": "string", "isValidated": "bool", "postalOrZipCode": "string", "stateOrProvince": "string" }, "companyOrOrganization": "string", "email": "string", "firstName": "string", "id": "int", "lastNameOrSurname": "string", "middleNameOrInitial": "string", "phoneNumbers": { "home": "string", "mobile": "string", "work": "string" } }, "currencyCode": "string", "customerAccountId": "int", "customerInteractionType": "string", "id": "string", "items": [ { "bundledProducts": [ { "productCode": "string", "quantity": "int" } ], "id": "string", "notes": [ { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "id": "string", "text": "string" } ], "orderItemId": "string", "orderItemOptionAttributeFQN": "string", "orderLineId": "int", "product": { "allocationExpiration": "DateTime", "allocationId": "int", "bundledProducts": [ { "allocationExpiration": "DateTime", "allocationId": "int", "creditValue": "decimal", "deltaPrice": "decimal", "description": "string", "fulfillmentStatus": "string", "goodsType": "string", "isPackagedStandAlone": "bool", "measurements": { "height": { "unit": "string", "value": "decimal" }, "length": { "unit": "string", "value": "decimal" }, "weight": { "unit": "string", "value": "decimal" }, "width": { "unit": "string", "value": "decimal" } }, "name": "string", "optionAttributeFQN": "string", "optionValue": "object", "productCode": "string", "productReservationId": "int", "quantity": "int" } ], "categories": [ { "id": "int", "parent": "self" } ], "description": "string", "discountsRestricted": "bool", "discountsRestrictedEndDate": "DateTime", "discountsRestrictedStartDate": "DateTime", "fulfillmentStatus": "string", "fulfillmentTypesSupported": "string", "goodsType": "string", "imageAlternateText": "string", "imageUrl": "string", "isPackagedStandAlone": "bool", "isRecurring": "bool", "isTaxable": "bool", "measurements": { "height": { "unit": "string", "value": "decimal" }, "length": { "unit": "string", "value": "decimal" }, "weight": { "unit": "string", "value": "decimal" }, "width": { "unit": "string", "value": "decimal" } }, "mfgPartNumber": "string", "name": "string", "options": [ { "attributeFQN": "string", "dataType": "string", "name": "string", "shopperEnteredValue": "object", "stringValue": "string", "value": "object" } ], "price": { "creditValue": "decimal", "msrp": "decimal", "price": "decimal", "priceListCode": "string", "priceListEntryMode": "string", "salePrice": "decimal", "tenantOverridePrice": "decimal" }, "productCode": "string", "productReservationId": "int", "productType": "string", "productUsage": "string", "properties": [ { "attributeFQN": "string", "dataType": "string", "isMultiValue": "bool", "name": "string", "values": [ { "stringValue": "string", "value": "object" } ] } ], "upc": "string", "variationProductCode": "string" }, "productLossAmount": "decimal", "productLossTaxAmount": "decimal", "quantityReceived": "int", "quantityReplaced": "int", "quantityRestockable": "int", "quantityShipped": "int", "reasons": [ { "quantity": "int", "reason": "string" } ], "receiveStatus": "string", "refundAmount": "decimal", "refundStatus": "string", "replaceStatus": "string", "returnNotRequired": "bool", "returnType": "string", "shippingLossAmount": "decimal", "shippingLossTaxAmount": "decimal", "totalWithoutWeightedShippingAndHandling": "decimal", "totalWithWeightedShippingAndHandling": "decimal" } ], "locationCode": "string", "lossTotal": "decimal", "notes": [ { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "id": "string", "text": "string" } ], "originalOrderId": "string", "originalOrderNumber": "int", "packages": [ { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "availableActions": "string", "changeMessages": [ { "amount": "decimal", "appId": "string", "appKey": "string", "appName": "string", "correlationId": "string", "createDate": "DateTime", "id": "string", "identifier": "string", "message": "string", "metadata": "object", "newValue": "string", "oldValue": "string", "subject": "string", "subjectType": "string", "success": "bool", "userFirstName": "string", "userId": "string", "userLastName": "string", "userScopeType": "string", "verb": "string" } ], "code": "string", "fulfillmentDate": "DateTime", "fulfillmentLocationCode": "string", "hasLabel": "bool", "id": "string", "items": [ { "fulfillmentItemType": "string", "lineId": "int", "optionAttributeFQN": "string", "productCode": "string", "quantity": "int" } ], "measurements": { "height": { "unit": "string", "value": "decimal" }, "length": { "unit": "string", "value": "decimal" }, "weight": { "unit": "string", "value": "decimal" }, "width": { "unit": "string", "value": "decimal" } }, "packagingType": "string", "shipmentId": "string", "shippingMethodCode": "string", "shippingMethodName": "string", "status": "string", "trackingNumber": "string" } ], "payments": [ { "amountCollected": "decimal", "amountCredited": "decimal", "amountRequested": "decimal", "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "availableActions": "string", "billingInfo": { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "billingContact": { "address": { "address1": "string", "address2": "string", "address3": "string", "address4": "string", "addressType": "string", "cityOrTown": "string", "countryCode": "string", "isValidated": "bool", "postalOrZipCode": "string", "stateOrProvince": "string" }, "companyOrOrganization": "string", "email": "string", "firstName": "string", "id": "int", "lastNameOrSurname": "string", "middleNameOrInitial": "string", "phoneNumbers": { "home": "string", "mobile": "string", "work": "string" } }, "card": { "cardNumberPartOrMask": "string", "expireMonth": "short", "expireYear": "short", "isCardInfoSaved": "bool", "isUsedRecurring": "bool", "nameOnCard": "string", "paymentOrCardType": "string", "paymentServiceCardId": "string" }, "check": { "checkNumber": "string" }, "data": "string", "externalTransactionId": "string", "isSameBillingShippingAddress": "bool", "paymentType": "string", "paymentWorkflow": "string", "purchaseOrder": { "customFields": [ { "code": "string", "label": "string", "value": "string" } ], "paymentTerm": { "code": "string", "description": "string" }, "purchaseOrderNumber": "string" }, "storeCreditCode": "string" }, "changeMessages": [ { "amount": "decimal", "appId": "string", "appKey": "string", "appName": "string", "correlationId": "string", "createDate": "DateTime", "id": "string", "identifier": "string", "message": "string", "metadata": "object", "newValue": "string", "oldValue": "string", "subject": "string", "subjectType": "string", "success": "bool", "userFirstName": "string", "userId": "string", "userLastName": "string", "userScopeType": "string", "verb": "string" } ], "data": "string", "externalTransactionId": "string", "id": "string", "interactions": [ { "amount": "decimal", "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "checkNumber": "string", "currencyCode": "string", "gatewayAuthCode": "string", "gatewayAVSCodes": "string", "gatewayCVV2Codes": "string", "gatewayInteractionId": "int", "gatewayResponseCode": "string", "gatewayResponseData": [ { "key": "string", "value": "string" } ], "gatewayResponseText": "string", "gatewayTransactionId": "string", "id": "string", "interactionDate": "DateTime", "interactionType": "string", "isManual": "bool", "isRecurring": "bool", "note": "string", "orderId": "string", "paymentEntryStatus": "string", "paymentId": "string", "paymentTransactionInteractionIdReference": "int", "status": "string" } ], "isRecurring": "bool", "orderId": "string", "paymentServiceTransactionId": "string", "paymentType": "string", "paymentWorkflow": "string", "status": "string" } ], "productLossTaxTotal": "decimal", "productLossTotal": "decimal", "receiveStatus": "string", "refundAmount": "decimal", "refundStatus": "string", "replaceStatus": "string", "returnNumber": "int", "returnOrderId": "string", "returnType": "string", "rmaDeadline": "DateTime", "shippingLossTaxTotal": "decimal", "shippingLossTotal": "decimal", "siteId": "int", "status": "string", "tenantId": "int", "userId": "string", "visitId": "string", "webSessionId": "string" }
For information about the properties in the response, refer to the REST API Help.
get.returnAction
Retrieves the current return action.
Parameters | Type | Description |
---|---|---|
N/A | N/A | N/A |
Example:
context.get.returnAction();
Response:
Returns an available return action.
Exec
exec.addReturnItem
Adds an item to the RMA.
Parameters | Type | Description |
---|---|---|
returnItem | object | A return item API object. |
Example:
context.exec.addReturnItem(returnItemA);
Response:
{ "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "availableActions": "string", "changeMessages": [ { "amount": "decimal", "appId": "string", "appKey": "string", "appName": "string", "correlationId": "string", "createDate": "DateTime", "id": "string", "identifier": "string", "message": "string", "metadata": "object", "newValue": "string", "oldValue": "string", "subject": "string", "subjectType": "string", "success": "bool", "userFirstName": "string", "userId": "string", "userLastName": "string", "userScopeType": "string", "verb": "string" } ], "channelCode": "string", "contact": { "address": { "address1": "string", "address2": "string", "address3": "string", "address4": "string", "addressType": "string", "cityOrTown": "string", "countryCode": "string", "isValidated": "bool", "postalOrZipCode": "string", "stateOrProvince": "string" }, "companyOrOrganization": "string", "email": "string", "firstName": "string", "id": "int", "lastNameOrSurname": "string", "middleNameOrInitial": "string", "phoneNumbers": { "home": "string", "mobile": "string", "work": "string" } }, "currencyCode": "string", "customerAccountId": "int", "customerInteractionType": "string", "id": "string", "items": [ { "bundledProducts": [ { "productCode": "string", "quantity": "int" } ], "id": "string", "notes": [ { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "id": "string", "text": "string" } ], "orderItemId": "string", "orderItemOptionAttributeFQN": "string", "orderLineId": "int", "product": { "allocationExpiration": "DateTime", "allocationId": "int", "bundledProducts": [ { "allocationExpiration": "DateTime", "allocationId": "int", "creditValue": "decimal", "deltaPrice": "decimal", "description": "string", "fulfillmentStatus": "string", "goodsType": "string", "isPackagedStandAlone": "bool", "measurements": { "height": { "unit": "string", "value": "decimal" }, "length": { "unit": "string", "value": "decimal" }, "weight": { "unit": "string", "value": "decimal" }, "width": { "unit": "string", "value": "decimal" } }, "name": "string", "optionAttributeFQN": "string", "optionValue": "object", "productCode": "string", "productReservationId": "int", "quantity": "int" } ], "categories": [ { "id": "int", "parent": "self" } ], "description": "string", "discountsRestricted": "bool", "discountsRestrictedEndDate": "DateTime", "discountsRestrictedStartDate": "DateTime", "fulfillmentStatus": "string", "fulfillmentTypesSupported": "string", "goodsType": "string", "imageAlternateText": "string", "imageUrl": "string", "isPackagedStandAlone": "bool", "isRecurring": "bool", "isTaxable": "bool", "measurements": { "height": { "unit": "string", "value": "decimal" }, "length": { "unit": "string", "value": "decimal" }, "weight": { "unit": "string", "value": "decimal" }, "width": { "unit": "string", "value": "decimal" } }, "mfgPartNumber": "string", "name": "string", "options": [ { "attributeFQN": "string", "dataType": "string", "name": "string", "shopperEnteredValue": "object", "stringValue": "string", "value": "object" } ], "price": { "creditValue": "decimal", "msrp": "decimal", "price": "decimal", "priceListCode": "string", "priceListEntryMode": "string", "salePrice": "decimal", "tenantOverridePrice": "decimal" }, "productCode": "string", "productReservationId": "int", "productType": "string", "productUsage": "string", "properties": [ { "attributeFQN": "string", "dataType": "string", "isMultiValue": "bool", "name": "string", "values": [ { "stringValue": "string", "value": "object" } ] } ], "upc": "string", "variationProductCode": "string" }, "productLossAmount": "decimal", "productLossTaxAmount": "decimal", "quantityReceived": "int", "quantityReplaced": "int", "quantityRestockable": "int", "quantityShipped": "int", "reasons": [ { "quantity": "int", "reason": "string" } ], "receiveStatus": "string", "refundAmount": "decimal", "refundStatus": "string", "replaceStatus": "string", "returnNotRequired": "bool", "returnType": "string", "shippingLossAmount": "decimal", "shippingLossTaxAmount": "decimal", "totalWithoutWeightedShippingAndHandling": "decimal", "totalWithWeightedShippingAndHandling": "decimal" } ], "locationCode": "string", "lossTotal": "decimal", "notes": [ { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "id": "string", "text": "string" } ], "originalOrderId": "string", "originalOrderNumber": "int", "packages": [ { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "availableActions": "string", "changeMessages": [ { "amount": "decimal", "appId": "string", "appKey": "string", "appName": "string", "correlationId": "string", "createDate": "DateTime", "id": "string", "identifier": "string", "message": "string", "metadata": "object", "newValue": "string", "oldValue": "string", "subject": "string", "subjectType": "string", "success": "bool", "userFirstName": "string", "userId": "string", "userLastName": "string", "userScopeType": "string", "verb": "string" } ], "code": "string", "fulfillmentDate": "DateTime", "fulfillmentLocationCode": "string", "hasLabel": "bool", "id": "string", "items": [ { "fulfillmentItemType": "string", "lineId": "int", "optionAttributeFQN": "string", "productCode": "string", "quantity": "int" } ], "measurements": { "height": { "unit": "string", "value": "decimal" }, "length": { "unit": "string", "value": "decimal" }, "weight": { "unit": "string", "value": "decimal" }, "width": { "unit": "string", "value": "decimal" } }, "packagingType": "string", "shipmentId": "string", "shippingMethodCode": "string", "shippingMethodName": "string", "status": "string", "trackingNumber": "string" } ], "payments": [ { "amountCollected": "decimal", "amountCredited": "decimal", "amountRequested": "decimal", "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "availableActions": "string", "billingInfo": { "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "billingContact": { "address": { "address1": "string", "address2": "string", "address3": "string", "address4": "string", "addressType": "string", "cityOrTown": "string", "countryCode": "string", "isValidated": "bool", "postalOrZipCode": "string", "stateOrProvince": "string" }, "companyOrOrganization": "string", "email": "string", "firstName": "string", "id": "int", "lastNameOrSurname": "string", "middleNameOrInitial": "string", "phoneNumbers": { "home": "string", "mobile": "string", "work": "string" } }, "card": { "cardNumberPartOrMask": "string", "expireMonth": "short", "expireYear": "short", "isCardInfoSaved": "bool", "isUsedRecurring": "bool", "nameOnCard": "string", "paymentOrCardType": "string", "paymentServiceCardId": "string" }, "check": { "checkNumber": "string" }, "data": "string", "externalTransactionId": "string", "isSameBillingShippingAddress": "bool", "paymentType": "string", "paymentWorkflow": "string", "purchaseOrder": { "customFields": [ { "code": "string", "label": "string", "value": "string" } ], "paymentTerm": { "code": "string", "description": "string" }, "purchaseOrderNumber": "string" }, "storeCreditCode": "string" }, "changeMessages": [ { "amount": "decimal", "appId": "string", "appKey": "string", "appName": "string", "correlationId": "string", "createDate": "DateTime", "id": "string", "identifier": "string", "message": "string", "metadata": "object", "newValue": "string", "oldValue": "string", "subject": "string", "subjectType": "string", "success": "bool", "userFirstName": "string", "userId": "string", "userLastName": "string", "userScopeType": "string", "verb": "string" } ], "data": "string", "externalTransactionId": "string", "id": "string", "interactions": [ { "amount": "decimal", "auditInfo": { "createBy": "string", "createDate": "DateTime", "updateBy": "string", "updateDate": "DateTime" }, "checkNumber": "string", "currencyCode": "string", "gatewayAuthCode": "string", "gatewayAVSCodes": "string", "gatewayCVV2Codes": "string", "gatewayInteractionId": "int", "gatewayResponseCode": "string", "gatewayResponseData": [ { "key": "string", "value": "string" } ], "gatewayResponseText": "string", "gatewayTransactionId": "string", "id": "string", "interactionDate": "DateTime", "interactionType": "string", "isManual": "bool", "isRecurring": "bool", "note": "string", "orderId": "string", "paymentEntryStatus": "string", "paymentId": "string", "paymentTransactionInteractionIdReference": "int", "status": "string" } ], "isRecurring": "bool", "orderId": "string", "paymentServiceTransactionId": "string", "paymentType": "string", "paymentWorkflow": "string", "status": "string" } ], "productLossTaxTotal": "decimal", "productLossTotal": "decimal", "receiveStatus": "string", "refundAmount": "decimal", "refundStatus": "string", "replaceStatus": "string", "returnNumber": "int", "returnOrderId": "string", "returnType": "string", "rmaDeadline": "DateTime", "shippingLossTaxTotal": "decimal", "shippingLossTotal": "decimal", "siteId": "int", "status": "string", "tenantId": "int", "userId": "string", "visitId": "string", "webSessionId": "string" }
For information about the properties in the response, refer to the REST API Help.
exec.setRMADeadline
Sets the deadline for the shopper to ship the items in the RMA to the merchant.
Parameters | Type | Description |
---|---|---|
rmaDeadline | Date | A date in UTC format. |
Example:
context.exec.setRMADeadline('2017-01-01T08:00:00.000Z');
Response:
No response.
Context Objects Available to All Actions
apiContext
Accesses tenant information.
Properties | Type | Description |
---|---|---|
baseUrl | string | The base URL for the site. |
basePciUrl | string | The base PCI URL for the site. |
tenantPod | string | The name of the tenant pod in which the tenant resides. |
appClaims | string | The application claims token. |
appKey | string | The application key. |
tenantId | integer | Unique identifier for the tenant. |
siteId | integer | Unique identifier for the site. This ID is used at all levels of a store, catalog, and tenant to associate objects to a site. |
masterCatalogId | integer | Unique identifier for the master catalog. |
catalogId | integer | The unique identifier for the product catalog. Catalogs are part of a master catalog. |
currencyCode | string | The default three-letter ISO currency code for monetary amounts. |
previewDate | date/time | The date and time that the content is being viewed. This might be a future date if the content is previewed with an active date range set in the future. |
localeCode | string | The locale code per the country code provided. This code determines the localized content to use and display. |
correlationId | string | The unique identifier of the API request associated with the event action, which might contain multiple actions. |
isAuthorizedAsAdmin | Boolean | Indicates whether the Dev Account user is authorized as an admin. |
userClaims | string | The user claims token. |
Example:
context.apiContext.baseUrl;
configuration
Receives a JSON response that contains information about the configuration data set in the Action Management JSON editor.
Properties | Type | Description |
---|---|---|
Varies | object | Custom fields and values that you can set in the Action Management JSON Editor. |
Example:
context.configuration.customData;