a return authorization request is not submitted if the invoice status is set to Approved and there is a gift certificate included in the order. This error message appears on Commerce websites affected by this problem: “Gift Certificate From, Recipient Name, and Recipient Email are required.”
Create the Override File:
setLines: function (return_authorization, lines, transaction_lines)
setLines: function (return_authorization, lines, transaction_lines)
{
var line_count = return_authorization.getLineItemCount('item')
, add_line = true
, i = 1;
while (i <= line_count)
{
var line_item_value =
return_authorization.getLineItemValue('item', 'id', i);
add_line = this.findLine(line_item_value, lines);
if (add_line)
{
var transaction_line = _.findWhere(transaction_lines,
{ line: line_item_value });
if (transaction_line)
{
return_authorization.setLineItemValue('item',
'rate', i, transaction_line.rate);
}
return_authorization.setLineItemValue('item',
'quantity', i, add_line.quantity);
return_authorization.setLineItemValue('item',
'description', i, add_line.reason);
i++;
}
else
{
var item_type =
return_authorization.getLineItemValue('item', 'itemtype', i);
if (item_type == 'GiftCert') {
return_authorization.removeLineItem('item', i);
line_count--;
} else {
return_authorization.setLineItemValue('item',
'quantity', i, 0);
i++;
}
}
}
}
Step 2: Prepare the Developer Tools For Your Patch
When preparing the Developer Tools for your patch as described in the Patch Using Override Mode procedure, perform the following actions:
Paste the following sample code into the new ns.package.json file that you create in the Modules directory: /Modules/extensions/ReturnAuthorizationExtension@1.0.0/ns.package.json
{
"gulp": {
"javascript": [
"JavaScript/*.js"
]
},
"overrides": {
"suitecommerce/ReturnAuthorization@X.Y.Z/JavaScript/ReturnAuthorization.Model.js" : "JavaScript/ReturnAuthorization.Model.js"
}
}
Important: You must replace the string, X.Y.Z, with the version of the module in your implementation of SCA.
Open the distro.json file in the root SCA development directory and then add your custom module to the modules object as described in the Patch Using Override Mode procedure. The following sample shows the value to add to the list of existing values that follow the “modules” key.
"modules": {
"extensions/ReturnAuthorizationExtension": "1.0.0",
. . .
Step 3: Test and Deploy Your Patch