I've tried 51111111111111111.toString() and parseI...
# suitescript
c
I've tried 51111111111111111.toString() and parseInt('5111111111111111')
l
setFieldValue(‘ccnumber’, ‘4111 1111 1111 1111’);
c
@Luiz Morais I am doing this
Copy code
customer.setSublistValue({sublistId: 'creditcards', fieldId: 'ccnumber', line: 0, value: '5111111111111111'});
l
customer.setCurrentLineItemValue(‘creditcards’, ‘ccnumber’, ‘4111111111111111’); That’s my code for 1.0 … I’m not sure this list only works in Dynamic mode… Are you adding this when create the customer or is it an existing customer?
the code I sent you before is for Sales Order, sorry (setFieldValue)
c
When creating a customer and editing a customer
trying to do it in standard mode
this is the error when entering the ccNum as a number
Copy code
message: "Credit card number must contain only digits.",
and this error when it's a string
Copy code
Credit card number is not valid.  Please check that all digits were entered correctly
b
do the usual thing of entering the credit card in the ui first
p
is it possible the card is being validated?
b
your test credit card is not the usual mastercard test number
general rule is that your credit card must validate against the luhn algorithm
😮 1
c
@battk yeah looks like that was the issue,thanks
that format is fine for visa with a leading 4 but not for mastercard
s
There is a fairly comprehensive set of test card numbers here, for various gateways: https://github.com/drmonkeyninja/test-payment-cards
🙌 1
t
Okay, learnt something new today, luhn algoritm . Thanks @battk
b
not terribly useful, its basically always wrong to be handling credit card numbers