Problem/Motivation
Hi, I believe I’ve encountered two issues with the module. I hope the problem isn’t on my end—my apologies if it is.
1. The site returns an error when the order total is 0: AssertionError: Cannot load the "commerce_payment_method" entity with NULL ID in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
2. The log indicates: Warning: Undefined array key "payment_method" in commerce_funds_payment_validate() (line 218 of /Users/imac/Sites/mojedilna.dev/web/modules/commerce_funds/commerce_funds.module).
3. The site also returns an error if a 100% discount on the order total is applied and then attempted to be removed—the discount cannot be removed.
Steps to reproduce
New installation of: Drupal 10, Commerce 2, Commerce Funds, Commerce Promotions
1. Create a product with, for example, a value of 100 USD.
2. Create a promotion with a coupon: Percentage off the order subtotal—set to 100% (any discount leading to a 0 order total works).
3. Add the product to the cart and proceed to checkout.
4. Apply the coupon; the price is reduced to 0 USD.
5. From this point on, the coupon cannot be removed; the site returns a warning: Oops, something went wrong. Check your browser's developer console for more details.
6. Continuing to Order Review results in an error: The website encountered an unexpected error. Try again later. AssertionError: Cannot load the "commerce_payment_method" entity with NULL ID in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
I'm not knowledgeable enough to definitively say the issues are caused by the Commerce Funds module. I experimented with it on my site for about a day, then set up a new Drupal installation with the minimum modules (as mentioned above), and the issue only arises when the Commerce Funds module is installed, even without setting up the CF payment method. Uninstalling the module makes the checkout process work again.
Any help would be greatly appreciated - it's a great module with important features.
Thank you very much!
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | Screenshot 2024-10-08 at 18.28.33.png | 45.68 KB | pavelblazek |
| #3 | order_0_validation-3474991-3.patch | 1.84 KB | aporie |
Comments
Comment #2
pavelblazek commentedComment #3
aporieHi,
Wasn't able to reproduce all your error (the error 500 with NULL ID), but I think this should do it.
Can you try the attached patch?
Comment #4
pavelblazek commentedHi,
Thank you very much for looking into this, and I apologize for the delay in getting back to this project. The patch did fix the initial issue; however, I am encountering some additional problems. It may be related to my site's setup, but for example, my user and site balances show the same number, and deposits are no longer being added to users' balances, among other issues.
Would you be willing to schedule a video call? I would be happy to compensate you for your time. I could set up a copy of my live site (www.mojedilna.com) and walk you through the issues I’m experiencing.
I have already set up an online example I mentioned in my first post—a new site with Commerce, Funds, and Promotions—currently without your patch. It throws the error you could not reproduce. Here is the link: https://ellipse-konference.cz. The login details are as follows:
User: Administrator
Password: Admin
Thank you very much!
Comment #5
aporieHi,
These two issues are known issues of misuse of commerce funds:
I think I will update the documentation with these info ;)
Comment #6
pavelblazek commentedHi Victor,
Thank you very much for your response. I apologise for my mistake regarding the deposit not showing up—I’ve done it before, but I forgot to check the payment as received before writing my last comment.
Regarding the user/site balance, I was aware of user 1, but what threw me off was that the same applies to anyone who has the "Administer all transactions" permission, which makes sense. I apologize.
Unfortunately, I am still struggling with the module and must have done something wrong. Now I can only see the "Funds balance" (create a new wallet) payment method. I understand that the Wallet payment method is shown only when the user has a wallet. However, I deposited money into the user's account, but the payment is still not displayed. When I go to the user's Payment Methods page, it says, "There are no payment methods yet," even though I just deposited some amount into the user's account.
I'm truly sorry. I’m unable to figure out what I might have messed up.
Thank you, Pavel
Comment #7
aporie--> True
Are you a native english speaker? Because I know my terminology has been quite confusing for some users.
Account Balance = where the funds are stored for each users. Each user has an account balance by default and when you transfer money from one user to another, it should be credited.
Wallets = Those are completely independent of where funds are stored or not. It's just a terminology used to name the "payment methods". Wallets are only created for user to purchase products on your website using their "Account balance" funds. Drupal commerce require a Payment Method to make a purchase on your website, so if you want to buy a product using your account balance, I had to create a "virtual" Payment Method option in the list called "Wallet" to allow them to do so.
Hence, when you deposit funds to your Account Balance, there is no need to have a virtual wallet, as you MUST use another payment method to credit it. Wallet Payment Method is only created to purchase a product using your Account Balance.
Comment #8
pavelblazek commentedI'm far from a native speaker, I'm from the Czech Rep.
I believe I understand your terminology and how the module works. However, I’m struggling to figure out what I might have messed up that only allows me to see the Funds balance (create a new wallet) payment method. The module did show The Wallet payment method like two months ago when I was developing the site, but I got spooked by the site/user balance (now resolved due to permissions) and while poking around, I noticed that there is only the option to create a new wallet payment method. I’m just not able to trace back what I might have set up differently. How to make The Wallet payment method visible / available.
I'm sorry, I hate to bother you.
Comment #9
aporieHmm, I don't know if you really have an issue or not, but normally if you follow the workflow "Create a new wallet" it should create it for your user in the current currency.