Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Bug fix for "Withdrawal current balance is incorrect" #882

Merged
merged 1 commit into from
Oct 16, 2020

Conversation

ceefour
Copy link
Contributor

@ceefour ceefour commented Aug 5, 2020

Reference: Dokan Pro support ticket #338760.

This PR fixes the bug that occurs because Dokan did not use proper cache behavior :

  1. used wrong cache group & cache key
  2. did not flush the relevant cache entries after balance was updated

@ceefour
Copy link
Contributor Author

ceefour commented Aug 12, 2020

Please merge

@yasqihafizhana
Copy link

Please merge, because we need to fix this bug immediately

Copy link
Contributor

@kapilpaul kapilpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is working fine.

@zamandevs
Copy link
Contributor

@ceefour Did you check Reports? It's not working properly. When caching enables our current implementation for Withdrew current balance is wrong & reports is fine. but this PR cause wrong Reports. Please look into this scenario.

Copy link
Contributor

@zamandevs zamandevs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not working properly. produce wrong Report.

@ceefour
Copy link
Contributor Author

ceefour commented Sep 2, 2020

@zamandevs Thank you for confirming that "When caching enabled our current implementation for Withdraw current balance is wrong & reports is fine"

Note that I am not a weDevs developer, I am developer with an active Dokan Professional 3 Sites license. However, previously weDevs have refused to acknowledge this problem since more than a month ago, and blamed the caching plugin. That's why I attempted, with very limited knowledge of Dokan plugin internals, to make my own fix and contribute the solution back.

Can you confirm that weDevs will provide a proper fix to this problem and can you give a time estimate ?

@zamandevs
Copy link
Contributor

@ceefour Thanks for your contribution. hopefully, we will fix this on the next release.

@ceefour ceefour mentioned this pull request Oct 14, 2020
$cache_group = 'dokan_seller_data_' . $user_id;
$cache_key = 'dokan_seller_balance_' . $user_id;
wp_cache_delete( $cache_key, $cache_group );
dokan_cache_update_group( $cache_key , $cache_group );
Copy link
Contributor

@tareq1988 tareq1988 Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ceefour we don't need this line 35. If you remove this line, we can merge this PR.

@@ -28,7 +28,11 @@ public function __construct() {
* @return void
*/
public static function delete_seller_balance_cache( $status, $user_id, $id ) {
wp_cache_delete( 'dokan_seller_balance_' . $user_id );
// Fix Dokan Pro ticket #338760: Current balance after withdrawal incorrect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the comment!

@ceefour ceefour force-pushed the patch-1 branch 2 times, most recently from c81d14c to ae3c28c Compare October 16, 2020 05:22
@ceefour
Copy link
Contributor Author

ceefour commented Oct 16, 2020

@tareq1988 @kapilpaul I've removed the requested lines. Please re-review for merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants