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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | hide-expired-payment-methd-3080552-1.patch | 886 bytes | anas_maw |
Issue fork commerce-3080552
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
Comment #2
anas_maw commentedThis patch will fix the issue by adding a check if the payment method is expired.
Comment #3
jeff veit commentedComment #6
zaporylieIt makes sense to me so moving to RTBC. Added test assert to cover this bug.
Comment #8
jsacksick commentedMerged, thank you for the tests!
Comment #10
jsacksick commentedMaybe 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?)
Comment #11
anas_maw commented@jacksick, thanks merging the patch, could you please give us the fix credit :)
Comment #12
jsacksick commentedComment #13
jsacksick commentedYour username was specified in the commit message, not really sure why that doesn't give you credit...
Comment #14
zaporylieI 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.