Get Payment Instrument of Customer Record
Hi,
I need to develop a suitelet script which accept customer id and return payment instruments information such as payment card id, memo, etc
And this is my current script ( I don’t know how to find payment instrument so I developed it as return parent field value )
function onRequest(context) {try {if (context.request.method === http.Method.POST) {var requestBody = context.request.body;var customerId = JSON.parse(requestBody).customerId;var searchRec = search.create({type: search.Type.CUSTOMER,filters: [['internalid', 'anyof', customerId]],columns: [search.createColumn({ name: 'parent' })]}).run().getRange({start: 0,end: 1});if (searchRec.length > 0) {var paymentMemo = searchRec[0].getValue({name: 'parent'});var resData={sucess:"Sucess",memo: paymentMemo};context.response.write(JSON.stringify(resData));} else {var errorRes = {error: "Not found for the given customerId."}context.response.write(errorRes);}}} catch (e) {log.error('suitelet error', JSON.stringify(e));throw e.message;}
Please let me know if someone have knowledge to solve this problem.
Thank you