Welcome Guest, Not a member yet? Register   Sign In
Issue with credit card validation
#1

(This post was last modified: 05-16-2024, 08:52 AM by eleumas.)

Hi! I have this validation rule:

Code:
'cardNumber' => [
        'label' => lang('App.label_credit_card_number'),
        'rules' => 'required|valid_cc_number[amex, unionpay, carteblanche, dinersclub, discover, interpayment, jcb, maestro, dankort, mir, troy, mastercard, visa, uatp, verve, cibc, rbc, tdtrust, scotia, bmoabm, hsbc]'
      ],

and I have this error:

Code:
Validation.valid_cc_number

Why?

Thanks for help me.
Reply
#2

(This post was last modified: 05-16-2024, 10:30 AM by JustJohnQ.)

Looks like a translation issue based on the code you posted.

Looks like a translation issue based on the code you posted.
Reply
#3

Issue about what translation? I have uploaded the system translation for the languages that i use and the error is the result of $this->validation->listError.

What can i try to do? I read about an issue with valid_cc_number[] validation rule. Is possible this in the latest version of codeigniter?
Reply
#4

Usually payment gateways provide an iframe or routed payment screen and they take care of everything including security. So, first of all, is it really safe to handle the payment processing and verification check on your own? Because this is a critical process.
Reply
#5

The language string for credit card validation is:
PHP Code:
// Credit Cards

'valid_cc_num' => '{field} does not appear to be a valid credit card number.'
It looks like you are trying to display an error message which is not defined.
Reply
#6

(This post was last modified: 05-17-2024, 02:15 AM by eleumas.)

(05-16-2024, 12:24 PM)demyr Wrote: Usually payment gateways provide an iframe or routed payment screen and they take care of everything including security. So, first of all, is it really safe to handle the payment processing and verification check on your own? Because this is a critical process.

Is not a payment process ma only a booking form where the customer add his credit card for reserve a stay. For example a CVV code is not required.

(05-16-2024, 11:43 PM)JustJohnQ Wrote: The language string for credit card validation is:
PHP Code:
// Credit Cards

'valid_cc_num' => '{field} does not appear to be a valid credit card number.'
It looks like you are trying to display an error message which is not defined.

In /system/Language/it/Validation.php the string is correct. Is perfectly like your code.
Reply
#7

(This post was last modified: 05-17-2024, 02:30 AM by JustJohnQ.)

Did you add 'valid_cc_number' yourself?

The correct syntax is indeed:
PHP Code:
Validation.valid_cc_num 

But your error message shows a different syntax:
PHP Code:
Validation.valid_cc_number 
Reply
#8

(This post was last modified: 05-17-2024, 03:09 AM by eleumas.)

(05-17-2024, 02:29 AM)JustJohnQ Wrote: Did you add 'valid_cc_number' yourself?

The correct syntax is indeed:
PHP Code:
Validation.valid_cc_num 

But your error message shows a different syntax:
PHP Code:
Validation.valid_cc_number 

In the language file (/system/Language/en/Validation.php) the string is:

Code:
'valid_cc_num' => '{field} does not appear to be a valid credit card number.',

BUT the issue is when in the validation rule I add more credit cards:

Code:
'cardNumber' => [
        'label' => lang('App.label_credit_card_number'),
        'rules' => 'required|integer|valid_cc_number[mastercard, visa]'
      ],

For example, if I remove Visa the validation works fine.

EDIT (new test):

If I use this code:

Code:
'cardNumber' => [
        'label' => lang('App.label_credit_card_number'),
        'rules' => 'required|integer|valid_cc_number[visa]'
      ],

but inside the input insert the Mastercard number I have the same error.

Code:
Validation.valid_cc_number
[Image: Screenshot-2024-05-17-alle-12-06-42.png]

I found this: https://forum.codeigniter.com/thread-79357.html but is not a good solution for the user experience.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB