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

discount_rate type error in Xeroizer::Record::LineItem#line_amount #448

Open
balmoral opened this issue Aug 1, 2018 · 1 comment
Open
Labels
Milestone

Comments

@balmoral
Copy link

balmoral commented Aug 1, 2018

discount_rate if present is a string and needs to be converted to a float when calculating line_amount in a LineItem:

    class LineItem < Base
      def line_amount(summary_only = false)
        return attributes[:line_amount] if summary_only || @line_amount_set

        if quantity && unit_amount
          total = quantity * unit_amount
          if discount_rate
            # CHANGE: discount_rate.to_f
            BigDecimal((total * ((100 - discount_rate.to_f) / 100)).to_s).round(2)
          else
            BigDecimal(total.to_s).round(2)
          end
        end
      end
    end
@CloCkWeRX
Copy link
Collaborator

I just merged #397; perhaps you'd like to do a similar PR?

@CloCkWeRX CloCkWeRX added the bug label Nov 11, 2018
@CloCkWeRX CloCkWeRX modified the milestones: 2.18.0+, 2.19.0 Nov 11, 2018
@CloCkWeRX CloCkWeRX modified the milestones: 2.19.0, 2.20.0 Jul 5, 2019
@CloCkWeRX CloCkWeRX modified the milestones: 2.20.0, 2.21.0 Oct 17, 2019
rjaus added a commit that referenced this issue Sep 22, 2021
rjaus added a commit that referenced this issue Sep 27, 2021
* tests are running successfully now

* removed deprecated private, public, partner apps and removed/upgrade oauth1 related tests

* version bump 3.0.0

* invoice change to fix issue #395

* resolves issue #442

* added gdpr request status for contacts to resolve #441

* fixed issue #448

* invoice requires date, added to test

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

No branches or pull requests

2 participants