Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Payment
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Dec 2016 at 15:40 UTC
Updated:
14 Aug 2017 at 15:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
bojanz commentedWe need to filter them out, as well as those whose billing country isn't in the list of store's supported billing countries.
Comment #3
arosboro commentedHere's a quick patch that accomplishes the filtering on REQUEST_TIME and the store's billing countries. It does not alter the address' country_code options in commerce_payment_gateway_form.
Comment #4
mglamanMarking for review
Comment #5
mglamanWe have a time service (8.3.x backport) to use instead. Constant is to be deprecated.
Also we need a test.
Comment #6
mglamanHere is patch using time service and a test https://github.com/drupalcommerce/commerce/pull/605
Shoot. I forgot about this in the patch. I think this should probably go in its own follow-up? Or we should change issue title to reflect "reusable should account for expired and methods with proper billing countries"
Comment #7
mglamanUpdated title.
Comment #8
mglamanHere's an adjustment which tests countries, too. Moved the logic to the storage. Ran into a blocker for using entity_reference_revisions for the entity query. Blocked on #2822359: Support "entity" property definition in entity queries using Entity Reference Revisions fields.
Comment #9
borisson_Mostly docs things that can be improved, tests looks good. I think the tag can be removed?
80 cols.
This probably reads easier as an
array_filter($payment_methods, function() { ... }).That doesn't really matter though. It's the same result.
I think we can improve the comment here.
An optional store, when passed the returned payment methods will only be those that are allowed for the the store's billing countries.Not sure if that makes sense?
This docblock can be replaced by {@inheritdoc}
80 cols.
Too many blank lines. 1 should suffice.
Needs a docblock.
Needs a blank link in between.
Comment #10
vasikehere is a new patch that add a solution for #2848754: Completing checkout as anonymous user stores payment method.
I included in the patch here as i think it completes the work done here (tests PaymentMethodReusableTest).
Extra: extra check for billing country restrictions added
For this patch, i used the PR patch:
https://github.com/drupalcommerce/commerce/pull/605
as the #8 patch throws an error:
PHPUnit_Framework_Exception: PHP Fatal error: Call to a member function getCountryCode() on a non-object in /d8path/modules/contrib/commerce/modules/payment/src/PaymentMethodStorage.php on line 97Probably, somthing is missing from that patch.
Interdiff available.
Comment #11
bojanz commentedWe don't want to tag a new beta without this.
Comment #12
luksakThe patch in #10 fixed the issue of all anonymous user's payment methods being stored and showing up for other users.
Comment #13
bojanz commentedI don't like the passing of $store to loadReusable(), it doesn't make sense from an API standpoint. We should be passing $billing_countries instead.
Making the change.
Comment #15
bojanz commentedComment #17
rgpublicUm, I thought Expires=0 means "Never expires". But when I use it, the payment method is filtered anyway...?
Comment #18
rgpublicPS: I've changed PaymentMethodStorage.php like so:
This makes the never-expiring payment methods appear again. Don't know at all whether this naive approach is correct. Put perhaps this quick band-aid fix is useful for anyone.