laravel-validation-rules / credit-card Goto Github PK
View Code? Open in Web Editor NEWCredit Card Validation
Home Page: https://laravel-validation-rules.github.io/
License: Apache License 2.0
Credit Card Validation
Home Page: https://laravel-validation-rules.github.io/
License: Apache License 2.0
Here is my validation
'expiry_input' => ['required', new CardExpirationDate('m/y')],
For required i can set message at at laravel messages method but for another fields how i can set the message ?
I get this error message
validation.credit_card.card_expiration_date_invalid.
I want to change that.
Error is validation.credit_card.card_expiation_year_invalid (expiration spelt wrong).
I'working with Stripe, i tested cards form here Test card numbers
Only fail JCB card number, can you fix it?
I'm trying to use my card with the ELO mais flag, but it's wrongly invalidating the cvv.
Validation for the Hipercard card does not work
Add laravel 7 support to composer.json file
{
"require": {
"illuminate/validation": "^5.5|^6.0|^7.0",
"illuminate/translation": "^5.5|^6.0|^7.0"
}
}
if 'card_number' is empty it's validation crash .. cvc need 'card_number'
public function rules()
{
return [
'card_number' => ['required', new CardNumber],
'expiration_year' => ['required', new CardExpirationYear($this->get('expiration_month'))],
'expiration_month' => ['required', new CardExpirationMonth($this->get('expiration_year'))],
'cvc' => ['required', new CardCvc($this->get('card_number'))]
];
}
How to add new cards?
Factory::makeFromNumber("4111111x111111sss111")->isValidCardNumber()
returns true
I can't give custom messages.
public function rules() {
$rules = [
'card_number' => ['required', new CardNumber],
'expiry_year' => ['required', new CardExpirationYear($this->get('expiry_month'))],
'expiry_month' => ['required', new CardExpirationMonth($this->get('expiry_year'))],
'cvv' => ['required', new CardCvc($this->get('card_number'))]
];
}
return $rules;
}
public function messages() {
return [
'required' => 'The :attribute field is required',
'card_number.validation.credit_card.card_invalid' => 'Credit card is invalid',
'card_number.validation.credit_card.card_length_invalid' => 'Credit card is invalid'
];
}
public function failedValidation(Validator $validator) {
throw new HttpResponseException(response()->json($validator->errors(), 422));
}
Hey,
Thank you for the time and effort you put into putting this package together!
I'm welling to contribute a working PR to support Laravel 10. Would you be down to accept the PR as soon as you can?
I'm trying to do like this:
return [
'card.expirationDate' => ['required', new CardExpirationDate('MM\/YY')],
// ...
];
When the lib tun passes()
method it runs inside and throw an Exception:
// This can throw Invalid Date Exception if format is not supported.
Carbon::parse($value);
There are no ways to disable this parsing or etc.
What do you think about this bug/feature? :โ)
$this->validate($request, [
'credit_card_expiration_date' => ['required', new CardExpirationDate('Y-m')]
]);
When insert 2020/13, 2020/14 ..., until 2020/99 passes the validation.
Regards.
Hi,
I can see there's some work on making the library support PHP8, but I'm still getting errors when adding this library to my project.
Root composer.json requires laravel-validation-rules/credit-card 1.5.0 -> satisfiable by laravel-validation-rules/credit-card[1.5.0].
- laravel-validation-rules/credit-card 1.5.0 requires php 7.* -> your php version (8.0.1) does not satisfy that requirement.
Is there an expected timeline on when this will be updated?
I need to validate a flag. How I do?
I receive a flag as a string and I need to check if it is valid.
Hi, I was wondering if the package could be updated to Laravel 6..0?
Thanks! :)
Is there a way to add custom messages in code without using translation?
For example:
$rules = [
'card_number' => ['required', new CardNumber],
'expiration_year' => ['required', new CardExpirationYear($request->input('expiration_month'))],
'expiration_month' => ['required', new CardExpirationMonth($request->input('expiration_year'))],
'cvc' => ['required', new CardCvc($request->input('card_number'))],
];
$messages = [
'required' => 'The :attribute field is required',
'card_number.validation.credit_card.card_invalid' => 'Credit card is invalid'
];
$validator = Validator::make($request->all(), $rules, $messages);
Is there the possibility to obtain the card brand after validate? This because i want only accept VISA, MasterCard, American Ex and JCB
I am updating a website to Laravel 11 but this package is not working with that. Please provide Laravel 11 support ASAP.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.