Problem/Motivation

I have a case that when the user enters his credit card information, I create a new card request to the payment gateway and I get a token that will expire after 15 minutes, so I set payment method expiration after 15 minutes.
If the user didn't complete the checkout process and added more products to the cart (let's say this took more than 15 minutes) when he checkout again he will find that his entered card information is available in the payment methods options, but the token is expired and he can't complete the purchase.
Also, this issue can happen if the card has a close expire date (next day for example) and the user didn't complete the checkout process and came in the next day. If the session didn't expire he will find his credit card info available, but it's expired.

Proposed resolution

Check if order attached payment method is expired before showing it as an option

Remaining tasks

none

User interface changes

none

API changes

none

Data model changes

Issue fork commerce-3080552

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anas_maw created an issue. See original summary.

anas_maw’s picture

Status: Active » Needs review
StatusFileSize
new886 bytes

This patch will fix the issue by adding a check if the payment method is expired.

jeff veit’s picture

zaporylie made their first commit to this issue’s fork.

zaporylie’s picture

Status: Needs review » Reviewed & tested by the community

It makes sense to me so moving to RTBC. Added test assert to cover this bug.

  • jsacksick committed aa542a63 on 8.x-2.x authored by zaporylie
    Issue #3080552 by zaporylie, anas_maw: Don't show expired payment method...
jsacksick’s picture

Status: Reviewed & tested by the community » Fixed

Merged, thank you for the tests!

  • jsacksick committed a6bf3a02 on 3.0.x authored by zaporylie
    Issue #3080552 by zaporylie, anas_maw: Don't show expired payment method...
jsacksick’s picture

Maybe we should add this check for non reusable payment methods only?

So:

if ((!$order_payment_method->isReusable() && $order_payment_method->isExpired())?

To address the nonce usecase (i.e. short lived payment methods?)

anas_maw’s picture

@jacksick, thanks merging the patch, could you please give us the fix credit :)

jsacksick’s picture

jsacksick’s picture

Your username was specified in the commit message, not really sure why that doesn't give you credit...

zaporylie’s picture

I see I didn't get one either even though I made sure both our nicknames are included in the MR title/commit. Seems like this works differently nowadays than what I am used to.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.