Skip to content

Card expiry dates do not honour empty dates #29

@judgej

Description

@judgej

If an expiry date is not set in the card, then Omnipay\Common\CreditCard::getExpiryDate() will return "1299" as the date.

The setExpiryMonth() - but strangly not the setExpiryYear() - casts the value provided to an integer, which comes out as 0 (zero) for null and "".

The date string by default, then becomes:

gmdate($format, gmmktime(0, 0, 0, $this->getExpiryMonth(), 1, $this->getExpiryYear()));
gmdate("my", gmmktime(0, 0, 0, 0, 1, 0));
or
gmdate("my", gmmktime(0, 0, 0, 0, 1, null));

or "1299".

This causes a problem with the silent redirect type of gateways. With these gateways, you pre-populate the AuthorizeRequest object with what information is already know. This tends to be the billing and possibly the shipping person details, and maybe the cart details too. The AuthorizeRequest->send() will give you a AuthorizeResponse object that is used to populate the form. AuthorizeResponse->getData() gives you the data that goes into this form, with keys appropriately named for the remote gateway (remember - this is a silent POST, so the form on the merchant's site will POST direct to the gateway site).

So, this form starts with no credit card, and no CVV details, but an expiration date (and I assume start date) of "'1299".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions