Code Monkey home page Code Monkey logo

credit-card's People

Contributors

avrahamappel avatar darkaonline avatar enzyofficial avatar esazykin avatar faytekin avatar gizburdt avatar guizoxxv avatar hugofabricio avatar laravel-shift avatar nessimabadi avatar punyflash avatar sekaiichi avatar ssx avatar stefanheimann avatar stylecibot avatar vlasscontreras avatar zeh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

credit-card's Issues

There is no way to set message of new CardExpirationDate('m/y') class

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.

How can get card brand?

Is there the possibility to obtain the card brand after validate? This because i want only accept VISA, MasterCard, American Ex and JCB

Problems validating the month

$this->validate($request, [
            'credit_card_expiration_date' => ['required', new CardExpirationDate('Y-m')]
        ]);

When insert 2020/13, 2020/14 ..., until 2020/99 passes the validation.

  • This is incorrect because the year is only 12 months.
  • Validation fails only when there are three digits in the month.

Regards.

Custom message without translation

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);

Add laravel 7 support

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"
    }
}

wrong rules for validation

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'))]
    ];
}

PHP8 support

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?

There is no way to set `MM/YY` format for CardExpirationDate

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? :โ€“)

How to customize validation message from Form Request ?

['required', new CardNumber], 'expiry' => ['required', new CardExpirationDate($this->get('expiry'))], 'cvc' => ['required', new CardCvc($this->get('number'))], 'parcelas' => 'required', 'cpf' => 'required', 'telefone' => 'required|max:15', ]; } /** * Get the error messages for the defined validation rules. * * @return array */ public function messages() { return [ 'number.credit_card.card_checksum_invalid' => 'your credit card number is invalid', ]; } }

How to validate an flag?

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.

Laravel 6.0

Hi, I was wondering if the package could be updated to Laravel 6..0?

Thanks! :)

[Welling To Contribute] Laravel 10 support

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?

Custom Message

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));
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.