some times Selected Invoice Not Displayed while making a payment in website

some times Selected Invoice Not Displayed while making a payment in website for this we can get resolve using this method.

In some cases, users making an invoice payment experience an issue where the Make a Payment page does not display the selected invoice. Instead, users receive the following message:

You don't have any Open Invoices at the moment, see Invoices Paid in Full

Perform the following steps to resolve this problem:

  • Extend the LivePayment.Model.js file
  • Prepare the Developer Tools for Your Customizations
  • Deploy your extension

You can download the code samples described in this procedure here: MakePaymentPageNotDisplaying-MontBlanc.zip.

Step 1: Extend the LivePayment.Model.js File

  1. The LivePayment.Model.js file is located within the Modules/suitecommerce/LivePayment@x.x.x/SuiteScript folder.If you have not done so already, create a directory to store your custom module.Following best practices, name this directory extensions and place it in your Modules directory. Depending on your implementation and customizations, this directory might already exist.
  2. Open your extensions directory and create a custom module to maintain your customizations.Give this directory a unique name that is similar to the module being customized. For example:Modules/extensions/LivePayment.Extension@1.0.0/
  3. In your new module, create a subdirectory named SuiteScript.
  4. In your SuiteScript subdirectory, create a new JavaScript file.Give this file a unique name that is similar to the file being modified. For example:Modules/extensions/LivePayment.Extension@1.0.0/SuiteScript/LivePayment.Model.Extension.js
  5. Open this file and set it up to overwrite the setInvoices() method of the LivePayment.Model.js file.Your file should match the following code snippet:

define(
‘LivePayment.Model.Extension’
, [‘LivePayment.Model’, ‘Utils’, ‘underscore’]
, function (LivePaymentModel, Utils, _)
{
‘use strict’;

_.extend(LivePaymentModel.prototype,
{
setInvoices: function(customer_payment, result)
{
result.invoices = [];

     var invoice_ids_to_search = [];

     for (var i = 1; i <= customer_payment.getLineItemCount('apply'); i++)
     {
     if (customer_payment.getLineItemValue('apply', 'type', i) === 'Invoice')
        {
           var invoice = {
                 internalid: customer_payment.getLineItemValue('apply', 'internalid', i)
              ,   total: Utils.toCurrency(customer_payment.getLineItemValue('apply', 'total', i))
              ,   total_formatted: Utils.formatCurrency(customer_payment.getLineItemValue('apply', 'total', i))
              ,   apply: customer_payment.getLineItemValue('apply', 'apply', i) === 'T'
              ,   applydate: customer_payment.getLineItemValue('apply', 'applydate', i)
              ,   currency: customer_payment.getLineItemValue('apply', 'currency', i)
              ,   discamt: Utils.toCurrency(customer_payment.getLineItemValue('apply', 'discamt', i))
              ,   discamt_formatted: Utils.formatCurrency(customer_payment.getLineItemValue('apply', 'discamt', i))
              ,   disc: Utils.toCurrency(customer_payment.getLineItemValue('apply', 'disc', i))
              ,   disc_formatted: Utils.formatCurrency(customer_payment.getLineItemValue('apply', 'disc', i))
              ,   discdate: customer_payment.getLineItemValue('apply', 'discdate', i)
              ,   amount: Utils.toCurrency(customer_payment.getLineItemValue('apply', 'amount', i))
              ,   amount_formatted: Utils.formatCurrency(customer_payment.getLineItemValue('apply', 'amount', i))
              ,   due: Utils.toCurrency(customer_payment.getLineItemValue('apply', 'due', i))
              ,   due_formatted: Utils.formatCurrency(customer_payment.getLineItemValue('apply', 'due', i))
              ,   tranid: customer_payment.getLineItemValue('apply', 'refnum', i)
           };
           result.invoices.push(invoice);
           invoice_ids_to_search.push(invoice.internalid);
        }
     }

     return result;
  }

});
});
6. Save the file.

Step 2: Prepare the Developer Tools for Your Customizations

  1. Open the LivePayment.Extension @1.0.0 module.
  2. Create a file in this module and name it ns.package.json.Modules/extensions/LivePayment.Extension@1.0.0/ns.package.json
  3. Build the ns.package.json file using the following code:

{
“gulp”: {
“ssp-libraries”: [
“SuiteScript/*.js”
]
}
}

  1. Save the ns.package.json file.
  2. Open the distro.json file.This file is located in the top-level directory of your SuiteCommerce Advanced source code.
  3. Add your custom module to the modules object to ensure that the Gulp tasks include your extension when you deploy.Your code should look similar to the following example:

{
“name”: “SuiteCommerce Advanced Mont Blanc”,
“version”: “2.0”,
“buildToolsVersion”: “1.1.0”,
“folders”: {
“modules”: “Modules”,
“suitecommerceModules”: “Modules/suitecommerce”,
“thirdPartyModules”: “Modules/third_parties”,
“distribution”: “LocalDistribution”,
“deploy”: “DeployDistribution”
},
“modules”: {
“extensions/LivePayment.Extension”: “1.0.0”,
“suitecommerce/Account”: “2.1.0”,
//…

  1. Add LivePayment.Model.Extension as a dependency to SCA entry point within the ssp-libraries object:Your code should look similar to the following example:

//…
“ssp-libraries”: {
“entryPoint”: “SCA”,
“dependencies”: [
“Application”,
//..
“LivePayment.Model.Extension”
//..
],
//…

  1. Save the distro.json file.

Step 3: Deploy Your Extension

then check that the this method is working or not.

Leave a comment

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