Purchase Float #775
Replies: 4 comments 3 replies
-
Hello. Only the whole amount is always stored in the database. If you call the *float method, then the number calculated using the formula is saved to the database: amount * 10^decimal_places. Let decimal_places =2. That is, you enter 100 into the depositFloat() method, but 100*10^2 (=10000) will be saved into the database. Purchases operate under a strict contract. I did not want to divide them into two contracts (integers and fractions), but left only integers. The functionality, according to my analytics, is not very popular. It is used at first by startups, and later they implement their more complex functionality as part of the package. I deliberately do not complicate the payment functionality with unnecessary functionality, because everyone needs different functionality and it is difficult to do something completely general. If you have any ideas, I don't mind listening to them. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply. Which float method are you referring to? I can't find float method for purchase. only for deposit, withdraw and the rest under the HasWalletFloat trait. I am talking of purchases. Not regular depositFloat and Withdraw |
Beta Was this translation helpful? Give feedback.
-
I also noticed that the paid method is deprecated in CartPay trait. Is there a new way to check if user have paid? |
Beta Was this translation helpful? Give feedback.
-
Check out this package https://github.com/stephenjude/laravel-wallet. It has only one method that handles integer and float. If the deposit method handles float number by defualt, the purchase functionality wouldn't need two contracts. If deposit, is written as : ` public function deposit(int|string $amount, ?array $meta = null, bool $confirmed = true): Transaction
I want to know the possible implications. Will values be lost as you previous showed me in your previous example in the other discussion. I have tried using depositFloat for integers, and it worked perfectly well. I don't see why this isn't the default mode for the deposit method. I am sorry I am asking too many questions and I appreciate the time you take to answer questions |
Beta Was this translation helpful? Give feedback.
-
I can't find a way to make purchase for float amount in the documentation. when I try, it stores only Int amount in database
Beta Was this translation helpful? Give feedback.
All reactions