Inchoo / magento2-Inchoo_Stripe

Stripe payment gateway Magento2 extension
56 stars 36 forks source link

please insert a valid credit card expiration date #11

Open alexcrz opened 8 years ago

alexcrz commented 8 years ago

Hi, I managed to install the inchoo stripe module , but when I go on the checkout page and insert the credit card info , when I try to pay I get please insert a valid credit card expiration date error. I have tryed with several credit cards , and allways get the same error.

rahulvramesh commented 8 years ago

Override validate() function in Payment.php

udovicic commented 8 years ago

I have tried several of these on Magento 2.1., and haven't seen any issues:

https://stripe.com/docs/testing

Could you give me an example? Provided that it is a test credit card, of course.

felipemarques commented 8 years ago

I have the same problem with the message: please insert a valid credit card expiration date I can resolve this, changing the file app/code/Inchoo/Stripe/Model/Payment.php and adding the following code:

    /**
     * Assign data to info model instance
     *
     * @param \Magento\Framework\DataObject|mixed $data
     * @return $this
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function assignData(\Magento\Framework\DataObject $data)
    {
        if (!$data instanceof \Magento\Framework\DataObject) {
            $data = new \Magento\Framework\DataObject($data);
        }

        $info = $this->getInfoInstance();
        $info->setCcType(
            $data->getDataByPath('additional_data/cc_type')
        )->setCcOwner(
            $data->getDataByPath('additional_data/cc_owner')
        )->setCcLast4(
            substr($data->getDataByPath('additional_data/cc_number'), -4)
        )->setCcNumber(
            $data->getDataByPath('additional_data/cc_number')
        )->setCcCid(
            $data->getDataByPath('additional_data/cc_cid')
        )->setCcExpMonth(
            $data->getDataByPath('additional_data/cc_exp_month')
        )->setCcExpYear(
            $data->getDataByPath('additional_data/cc_exp_year')
        )->setCcSsIssue(
            $data->getCcSsIssue()
        )->setCcSsStartMonth(
            $data->getCcSsStartMonth()
        )->setCcSsStartYear(
            $data->getCcSsStartYear()
        );
        return $this;
    }