-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
How Filter transactions #888
Comments
Hello. This change is directly related to the addition of support for uuid identifiers to the project. For you, the connection should now be like this. $transfer->to->holder;
$transfer->from->holder; Where holder will be the owner of the wallet. Upgrade guide: |
UPD: will not work |
I am not sure , even when I am flowing upgrade guide and upgrading to [6.2.4] I have a lot of issues , which is happening while making transfer or pay , like this error |
hello, I have another issue , actually after I upgrade and no issue come out , when I am using $user->pay($item) I see the transactiosns has been done in database , but no effect to the balance , the balance remain same when I am using pay / safepay |
@starking8b I thought you were already on more modern versions of the package.
This is too small a part of the trace to understand the reason from it.
Please attach a code example. Details are very important. For example, support for laravel transactions appeared only in laravel-wallet 9.6. The more information, the more accurate the answer will be. I need from you:
Because this is version 6.x, then are you using bavix/laravel-wallet-vacuum or not? |
actually in config/wallet.php if I use Wallet::class as a model I get that error but when I am override the wallet using this model
where I added the holder relation the cast error is not shown , when I am using it in the wallet.php file like this
this is the exception that I had
but after that this code is working
the parent company can add/Reduce Limit to Child company , and the balance get effected , but this code is not effecting the balance
and even I added credit to one company using this code
but when I am doing pay function the credit is not reduced it still same I am using
I am not using laravel-wallet-vacuum |
Upd : now I am using Wallet 7.x after I upgraded from 6.1 to 6.2.4 then to 7.x |
I noticed somethings else
and this is what I have in database
as u see the balance is 74351 when I making payment the log showing me this balance
and after the payment is done I get this balance which i in negative after making some payment which is right actually
but when I am trying to get the balance every time it showing the 744.51 I don't understand all the transactions in my database has confirmed and it has value 1 |
after a lot of trying now I upgraded my laravel to version 9 , and updated wallet package to version 9.x as well , it seems working well , but credit I don't think it is working , I added credit to the company , but I am not able to pay |
So, after your trace and metadata, everything has changed a lot. I would like to immediately note that I tested integration with mariadb starting from 10.5, and laravel-wallet ^11.0 supports mariadb only from version 10.10+, because The Laravel core is changing a lot. More details here: laravel/framework#48455 Total what you have now: Let's recalculate the balance of all wallets. You can do this using the library: composer require bavix/laravel-wallet-warmup:2.2.0 Next, let's run the recalculation command. ./artisan wallet:warm-up Now a little about your package setup. I highly recommend at least setting up redis. You may often catch a race condition. I noticed that you set the limit =1000 in the credit field, but the coefficient for you (your business logic) is set to 100. Considering your business model, 1000/100 = 10.00. Conventionally, you have issued a credit limit of 10. I would start from decimal places, you clearly have it =2. This means that for *float methods the shift is two decimal places. |
Oh, that's right. Don't forget to run the command artisan bx:transfer:fix |
Today or tomorrow I definitely won’t have time to prepare a test environment for myself to test your case. But I'll try this over the weekend if you haven't figured out your problems yet. |
many thanks for your help , I ll try to figure it out ,if not success I will wait for your help , |
oh without understanding the balance issue has been solved :) I don't know how , but now when I am paying it decreesing the balance .
although i am using where("holder_type",Invoice::class) but it is trying to search in other model like revenue which i don't want ,and this is my data
as u see the holder is Invoice , but I get error that saying the Revenue::customer relation is not exists |
Example of filtering by name: laravel-wallet/tests/Units/Domain/TransfersFilterTest.php Lines 48 to 61 in 6302638
By analogy, you can make a similar filter for to or any other field. BUT I highly do not recommend doing such complex filters in the database. It is better to describe the index and do the search through elasticsearch, for example. |
Did you succeed? |
This issue is stale because it has been open 7 days with no activity. |
I have integrated wallet in my system , my system structure has many models which using the wallet , like Company , Subscriber, Invoice, Revenue , I have a page where I listing all the transactions without any issue , my problem is with globalfilter in datatable , I want the admin to filter the name or username of the company or customer who made this transaction , or the transactiosn that received from the searched word
actually I have override the Transaction Model and I added these 2 relations
now when I am retrieving the data using this query
$queryBuilder= Transaction::query()->with(["deposit_transfer","deposit_transfer.from","deposit_transfer.from.holder","withdraw_transfer","withdraw_transfer.to","withdraw_transfer.to.wallet.holder"])-> withoutGlobalScope('company_id');
and this is how I am showing the name or username(in case of subscriber) of the owner of the transaction using yajra datatable
the records are coming right without any issue , but I am not able to filter actually
this is my filter code
this is only in case of withdraw , as I am trying with it right now , but it is not working as expected and it return error that saying Revenue not has customer relation , I am not sure why it is trying with revenue model although I am seting the holder type to be invoice .
can u help me please
The text was updated successfully, but these errors were encountered: