Not Redirected to External Payment from the checkout page it was opening again a checkout page it self

Not Redirected to External Payment from the checkout page it was opening again a checkout page it self

When a user clicks the Continue to External Payment button during checkout, instead of sending the user to the external payment system, SCA redirects the user to the beginning of the checkout process.

This error occurs because SuiteCommerce Advanced deprecated the existing payment processing status result, HOLD, in 17.1. Instead, SCA uses a new status result, PENDING. As a result, any SCA sites implementing the Vinson release requires this patch to use third-party payment systems.

To implement this patch, you must extend the prototype object for the ExternalPaymentModel function that includes the _isDone()_validateRecordStatus(), and _validateStatusFromRequest() methods. This function is located in ExternalPayment.Model.js for the ExternalPayment module. .

Step 1: Extend the ExternalPayment.Model.js File

  1. If you have not done so already, create a directory to store your custom module.Give this directory a name similar to the module being customized. For example, create Modules/extensions/ExternalPaymentExtension@1.0.0
  2. In your new ExternalPaymentExtension@1.0.0 directory, create a subdirectory called JavaScript.For example: Modules/extensions/ExternalPaymentExtension@1.0.0/SuiteScript
  3. In your new JavaScript subdirectory, create a JavaScript file to extend ExternalPayment.Model.js.Name this file according to best practices. For example:ExternalPayment.Model.Extension.js
  4. Open this file and extend the ExternalPaymentModel() function as shown in the following code snippet.
            define('ExternalPayment.Model.Extension'

, [
‘ExternalPayment.Model’
, ‘underscore’
]
, function (
ExternalPaymentModel
, _
)
{
‘use strict’;

_.extend(ExternalPaymentModel.prototype,
{
  _isDone: function (request, record_type)
  {
    var status = this._getStatusFromRequest(request, record_type)
    ,  status_accept_value = this._getConfiguration(record_type, 'statusAcceptValue','ACCEPT')
    ,  status_hold_value = this._getConfiguration(record_type, 'statusHoldValue', 'HOLD')

    //Added by payment
    ,  status_pending_value = this._getConfiguration(record_type, 'statusPendingValue', 'PENDING')
    return status === status_accept_value || status === status_hold_value || status === status_pending_value;
  }

  , _validateRecordStatus: function (record)
  {
    //Modified by Payment
    return record.getFieldValue('paymenteventholdreason') === 'FORWARD_REQUESTED';
  }

  , _validateStatusFromRequest: function (request, record_type)
  {
    var status = this._getStatusFromRequest(request, record_type)
    ,  status_accept_value = this._getConfiguration(record_type, 'statusAcceptValue' , 'ACCEPT')
    ,  status_hold_value = this._getConfiguration(record_type, 'statusHoldValue' , 'HOLD')

    //Added by Payment
    ,  status_pending_value = this._getConfiguration(record_type, 'statusPendingValue', 'PENDING')
    ,  status_reject_value = this._getConfiguration(record_type, 'statusRejectValue' , 'REJECT');

    //Modified by Payment
    return status === status_accept_value || status === status_pending_value || status === status_hold_value || status === status_reject_value;
  }
});

});
like this we need to extend the model and view we can achieve the requirement

Leave a comment

Your email address will not be published. Required fields are marked *