bagisto / bagisto

Free and open source laravel eCommerce platform
https://bagisto.com
Open Software License 3.0
15.3k stars 2.2k forks source link

pending payment error when i create transaction #5086

Closed ghost closed 3 years ago

ghost commented 3 years ago

Issue Description

I create an order with automatic invoice and payment at the door and add a payment from the transactions page, but the status remains as pending payment and does not change.

I got the error in the video, you can check it https://drive.google.com/file/d/1b8vYqLHFJDQmCyIAZy6kaxoLAkVKCU7M/view?usp=sharing

Preconditions

Bagisto version

local.ERROR: Call to undefined method Webkul\Product\Type\Configurable::evaluatePrice() (View: /home/ardenoff/public_html/resources/themes/velocity/views/products/price.blade.php) {"view":{"view":"/home/ardenoff/public_html/packages/Webkul/Product/src/Type/Configurable.php","data":[]},"exception":"[object] (Facade\Ignition\Exceptions\ViewException(code: 0): Call to undefined method Webkul\Product\Type\Configurable::evaluatePrice() (View: /home/ardenoff/public_html/resources/themes/velocity/views/products/price.blade.php) at /home/ardenoff/public_html/packages/Webkul/Product/src/Type/Configurable.php:580) [stacktrace]

image

devansh-webkul commented 3 years ago

Hi @Arsivpro,

I just checked in the fresh instance and it is not reproducible. Do you upgrade the project or using the fresh instance.

ghost commented 3 years ago

@devansh-webkul I am using the project you see. I complete the code update with the incoming commit update

devansh-webkul commented 3 years ago

@Arsivpro,

The error evaluatePrice() undefined which you are saying, its already present and i am not able to reproduce this, https://github.com/bagisto/bagisto/blob/7cd34d0a03ef7b4d0794fcec179971f1ae508075/packages/Webkul/Product/src/Type/AbstractType.php#L802

ghost commented 3 years ago

@devansh-webkul Are you saying it's a bug that's being worked on?

devansh-webkul commented 3 years ago

No, I am saying it's not reproduced what you are saying. It looks like you have upgraded your version.

ghost commented 3 years ago

@devansh-webkul this is correct i upgraded i am on latest version

devansh-webkul commented 3 years ago

Yes, check whether all changes are present or not. Maybe some small issue is there.

ghost commented 3 years ago

After updating this page, there were a few problems, I think the problem is here, 1st error tax 18%, price 1.6949 should appear price 2, 1.99 rounding error seen The second error is that it shows the pending payment when the transaction is added to the invoice. https://github.com/bagisto/bagisto/blob/7cd34d0a03ef7b4d0794fcec179971f1ae508075/packages/Webkul/Product/src/Type/AbstractType.php

devansh-webkul commented 3 years ago

In the latest version, we have implemented several features like tax enhancement. I can best suggest you take a replica of the fresh latest version also. If a bug is found in the latest version then let us know.

ghost commented 3 years ago

@devansh-webkul I did the tax updates without any errors, even I thought there would be a problem and ran it by installing a different bagisto project, but there is a problem with rounding. Example I entered the product with 18% tax, the price is 1.6949, on the front end it should appear: 2, visible: 1.99

devansh-webkul commented 3 years ago

Hi, can you just verify here also, https://bagisto-speed.webkul.com/

ghost commented 3 years ago

@devansh-webkul You can view this product, tax 18% price 1.6949 should appear $2, display $1.99 https://bagisto-speed.webkul.com/sunglasses

devansh-webkul commented 3 years ago

The product price is $1.69.

The 18% of $1.69 is $0.30.

Total: $1.69 + $0.30 = $1.99

And the default it is rounded to 2 decimal place so it can't be $2. Because its an float value not an integer.

ghost commented 3 years ago

@devansh-webkul open the calculator and do 2/1.18 and see the result, each of my products is moving in this direction, I write the fraction as 5 numbers, actually 18% of 2 is 0.36

ghost commented 3 years ago

@devansh-webkul but instead of doing 2*18 % + = in tax calculations, I do 2/0.18 because the result is rounded

devansh-webkul commented 3 years ago

Results are rounded off to two. The calculations are showing right as per the calculations I can't do anything on this. You might be trying 1.64 + 0.36.

ghost commented 3 years ago

@devansh-webkul Your opinion is important to me. Any suggestions on how to write 2$ with 18% tax calculated?

devansh-webkul commented 3 years ago

I understand your concern I will update you regarding the same.

ghost commented 3 years ago

@devansh-webkul ok i'm waiting on the issue

devansh-webkul commented 3 years ago

Well, I just tested everything rounded off reverse can't be possible because of 18 per cent tax and the round of 2 and this is default behaviour either you need to customize something to meet your need.

Even in the calculator, it's going $1.999995. So logically $1.99 is right.

ghost commented 3 years ago

@devansh-webkul Bagisto system does not use 2*18%-= when calculating tax, instead it uses 2/1.18 system, so it is a bit unlikely that my calculation is wrong because it only happens on some products, 6 products out of 200 have this error

devansh-webkul commented 3 years ago

Alright, I am closing this as I haven't seen anything. For you, you can customize it, if you want. For discussion, you can use the Bagisto forum.