How to create a JE in NS from OrderLines from SF?

I am trying to import salesorderitems from SF.

Then i am trying to create a credit and debit line for every order line item using a transformation.

I am using a transformation using javascript shown below but it doesnt seem to work.

This is how orderlines looks like for a salesorder

{
  "page_of_records": [
    {
      "record": {
        "attributes": {
          "type": "s_c__Payment__c",
          "url": "/services/data/v61.0/sobjects/s_c__Payment__c/a10V100000Kqx3iIAB"
        },
        "Id": "a10V100000Kqx3iIAB",
        "Name": "Payment-1048492",
        "s_c__Order_Id__c": "801V100000nR3fEIAS",
        "Order_Number__c": "01825890",
        "Deposit_Account__c": "10302",
        "Cash_Sale__c": true,
        "Customer_Deposit__c": true,
        "s_c__Amount__c": 159.75,
        "Order_Paid_In_Full__c": true,
        "Batch_ID__c": "1055493750"
      }
    },
    {
      "record": {
        "attributes": {
          "type": "s_c__Payment__c",
          "url": "/services/data/v61.0/sobjects/s_c__Payment__c/a10V100000Kqx3jIAB"
        },
        "Id": "a10V100000Kqx3jIAB",
        "Name": "Payment-1048493",
        "s_c__Order_Id__c": "801V100000nR3fEIAS",
        "Order_Number__c": "01825890",
        "Deposit_Account__c": "10302",
        "Cash_Sale__c": true,
        "Customer_Deposit__c": true,
        "s_c__Amount__c": 479.25,
        "Order_Paid_In_Full__c": true,
        "Batch_ID__c": "1055493750"
      }
    }
  ]
}
function transform (options) {
  // Normalize: transform may get the full page (array) or a single record
  var input = options.record;
  
  var creditRecords = Array.isArray(input) ? input : [input];

  // Unwrap if fields are nested under a "record" property
  creditRecords = creditRecords.map(function (r) {
    return (r && r.record) ? r.record : r;
  });

  var DEBIT_ACCT = '703'; // hardcoded debit-side account
  var CREDIT_ACCT = '539';

  var lines = [];
  var ex = '';
  creditRecords.forEach(function (rec) {
    var amount = rec.TotalPrice;
    ex = rec.OrderId;
    // Shared dimensions for both sides of the pair
    var department = rec.Department__c;          // confirm -> internalId
    var klass      = rec.Service_Line__c;        // confirm -> internalId
    var location   = rec.Netsuite_Location_Id__c;

    // Credit line
    lines.push({
      linetype:'credit',
      credit: amount,
      debit: 0,
      account:CREDIT_ACCT,
      memo: 'Credit Line',
      department: department,
      class: klass,
      location: location,
      revrecstartdate: rec.Rev_Rec_Start_Date__c,
      revrecenddate: rec.Rev_Rec_End_Date__c,
      revrecrulename:"Rev Start/End Date"
      
    });

    // Debit line (mirror)
    lines.push({
      linetype:'debit',
      debit: amount,
      credit:0,
      account: DEBIT_ACCT,
      memo: 'Debit Line',
      department: department,
      class: klass,
      location: location,
      revrecenddate: '',
      revrecstartdate: '',
      revrecrulename:''
    });
  });

  // Build the JE header + nested lines
  return {
    externalId: ex,        // TBD - derive from Order or a sequence
    subsidiary: '3',
    currency: '1',
    memo: 'Dummy JE for testing',  // TBD
    approved: false,
    customform: '221',
    lines: lines
    // tranDate / postingPeriod omitted - you said they're auto-populated.
    // Add them here if you'd rather set them explicitly.
  };
}

The transformer i am using is abv and the NS mappings are below
z

I keep getting errors from NS below which makes me think that the transformer is not working
How can this be corrected ??

Can you share the errors from the "View response" tab? We are only seeing the retry data.

Thanks for looking into this Alan !!
The request to netsuite is below :


The response is below: