Customer Redirected to My Account Overview Instead of Successful Payment Page
In the following implementations, customers are redirected to the My Account Overview page after they have paid an invoice using Windcave’s external checkout:
-
SiteBuilder Extensions Kilimanjaro
-
SiteBuilder Extensions Premium Kilimanjaro
-
SuiteCommerce Advanced (SCA) Kilimanjaro
-
SCA 2018.2
-
SCA 2020.1
-
SCA 2020.1.12
-
SCA 2021.2
-
SCA 2021.2.3
These patch instructions describe how to correct this problem so that customers are redirected to the Successful Payment page after they pay the invoice.
To implement this patch, create a custom module to override the ExternalPayment.Model.js
JavaScript file, which is part of the ExternalPayment module.
If you are unfamiliar with implementing patches for SCA, refer to the following:
Step 1: Create the Override File
-
Following the instructions in the Patch Using Override Mode procedure, create a new directory and file:
/Modules/extensions/ExternalPayment@1.0.0/JavaScript/ ExternalPayment.Model.js
. -
In the new
ExternalPayment.Model.js
file, in the method_isDone
, find and replace the following line of code with the provided code sample.Find the following code:
, status_hold_value = this._getConfiguration(record_type, 'statusHoldValue', 'HOLD');
And replace it with the following code:
, status_hold_value = this._getConfiguration(record_type, 'statusHoldValue', 'HOLD') , status_success_value = this._getConfiguration(record_type, 'statusSuccessValue', 'SUCCESS');
-
Then find and replace the following line of code with the provided code sample.
Find the following code:
return status === status_accept_value || status === status_hold_value;
And replace it with the following code:
return status === status_accept_value || status === status_hold_value || status === status_success_value;
-
In the method
_getStatusFromRequest
, find and replace the following line of code with the provided code sample.Find the following code:
return request.getParameter(this._getConfiguration(record_type, 'statusParameterName' , 'status'));
And replace it with the following code:
var default_status = 'status'; if(record_type === 'customerpayment'){ default_status = 'nlstatus'; } return request.getParameter(this._getConfiguration(record_type, 'statusParameterName' , default_status));
-
In the method
_validateStatusFromReques
t, find and replace the following line of code with the provided code sample.Find the following code:
, status_reject_value = this._getConfiguration(record_type, 'statusRejectValue' , 'REJECT');
And replace it with the following code:
, status_reject_value = this._getConfiguration(record_type, 'statusRejectValue' , 'REJECT') , status_success_value = this._getConfiguration(record_type, 'statusAcceptValue', 'SUCCESS');
-
Then find and replace the following line of code with the provided code sample.
Find the following code:
return status === status_accept_value || status === status_hold_value || status === status_reject_value;
And replace it with the following code:
return status === status_accept_value || status === status_hold_value || status === status_reject_value || status === status_success_value;
-
In the method
_getDataFromRedirect
, find and replace the following line of code with the provided code sample.Find the following code:
, configration_parameters = this._getConfiguration(record_type, 'parameters' , ['tranid', 'authcode', 'status'])
And replace it with the following code:
, configration_parameters = this._getConfiguration(record_type, 'parameters' , ['tranid', 'authcode', 'status', 'nlstatus'])
-
Save the file.
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/ExternalPayment@1.0.0/ns.package.json{ "gulp": { "javascript": [ "JavaScript/*.js" ] }, "overrides": { "suitecommerce/ExternalPayment@X.Y.Z/SuiteScript/ExternalPayment.Model.js" : "SuiteScript/ExternalPayment.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 themodules
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/ExternalPaymentExtension": "1.0.0", . . .
Step 3: Test and Deploy Your Patch
Follow the instructions provided in the Patch Using Override Mode procedure to test and deploy your patch.