Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The user's payment method pages need a "Set default" link. Just like profiles have.
Comment | File | Size | Author |
---|---|---|---|
#26 | interdiff-24-26.txt | 18.07 KB | mjpa |
#26 | 2790533-26.patch | 14.54 KB | mjpa |
#24 | interdiff_23-24.txt | 622 bytes | ctrlADel |
#24 | 2790533-24.patch | 18.77 KB | ctrlADel |
#23 | 2790533-23.patch | 18.73 KB | ctrlADel |
Issue fork commerce-2790533
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
miteshmapworking on this.
Comment #3
miteshmapcouldn't make it work. :(
Comment #4
vasikei'll try
Comment #5
vasikeThere is PR for this:
https://github.com/drupalcommerce/commerce/pull/655
- Create new route for set-default
- Build a controller for the route
- Add this to payment methods list operations
- Default by default for the first or unique user payment method
- Extend and update Payment method tests to include this functionality (both Entity and functional)
- Extend the payment method storage with loadMultipleByUser & loadDefaultByUser methods.
Not sure about the loadMultipleByUser & loadDefaultByUser methods implementations.
Maybe some extra properties should be involved.
Comment #6
vasikeNow that we have #2827144: Support multiple payment gateways on Checkout Payment information pane
we need to use the default payment method in the Payment information pane.
PR updated with a commit on this.
Comment #7
vasikePR updated with a commit to fix travis errors.
Now we're green
Last commit fix the postSave make it default for anonymous: no need to check/set the default for anonymous.
Comment #8
sumanthkumarc CreditAttribution: sumanthkumarc at Azri Solutions commentedAdding related issue, https://www.drupal.org/node/2860102, the getDefaultPaymentMethodOption doesn't check if gateway is avaialble.
Comment #9
vasikePR "reroll"
Comment #10
nikathoneUploading a patch based on @vasike PR for patching sake.
Comment #12
nikathoneAnother patch for the sake of patching with a rebase of the current commerce based on the PR at https://github.com/drupalcommerce/commerce/pull/848 which is just a rebase of https://github.com/drupalcommerce/commerce/pull/655 by @vasike
Comment #14
nikathoneThis might cause
Call to a member function id() on boolean in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->getDefaultPaymentMethodOption()
if the current user doesn't have any payment method. Note when testing my user did have a completed order though. The fix would be something likeif ($default_payment_method && in_array($default_payment_method->id(), $option_ids))
Comment #15
nikathoneRerolled PR at https://github.com/drupalcommerce/commerce/pull/655 with latest commerce.
Comment #17
nikathoneAdding an event to which is dispatched on post save about payment is default. I wasn't sure if this should be added on this patch or in a follow up issue. I will need the maintainer to let me know then we can go with the patch at #15 or if ok then we go with this one. Also leaving it to need work until we figure out why the test are not passing.
Comment #18
nikathoneJust found out that I uploaded a wrong file for #15. Here is another one hopefully it will pass the tests now.
Comment #19
nikathoneComment #21
nikathoneOops uploaded wrong patch file.
Comment #22
Anas_maw CreditAttribution: Anas_maw at Coders Enterprise Web & Mobile Solutions commentedReroll the latest patch to the latest dev version
Comment #23
ctrlADelRerolled against dev
Comment #24
ctrlADelSmall fix to address when the order has a payment method attached but that payment method is not available in the options.
Comment #26
mjpa CreditAttribution: mjpa commentedAttached a reroll against dev and the following changes:
loadByUser()
instead ofloadDefaultByUser()
Comment #28
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedComment #29
SocialNicheGuru CreditAttribution: SocialNicheGuru commenteddoes not apply to commerce 2.x-dev
Comment #32
RhiP CreditAttribution: RhiP commented.