Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Invoice gross_amount from calculators when checkout a payment #15

Merged
merged 1 commit into from

2 participants

@Irio
Collaborator

Using #net_amount as contribution's amount in a transaction it's just wrong. The #gross_amount method stands just for this, so should be used.

Should fix #14.

@Irio Irio Invoice gross_amount from calculators when checkout a payment
Using net_amount as contribution's amount in a transaction it's just
wrong. The #gross_amount method stands just for this, so should be used.
061e15d
@josemarluedke josemarluedke merged commit d897325 into master
@josemarluedke josemarluedke deleted the im-invoice-gross-amount-on-payments branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2014
  1. @Irio

    Invoice gross_amount from calculators when checkout a payment

    Irio authored
    Using net_amount as contribution's amount in a transaction it's just
    wrong. The #gross_amount method stands just for this, so should be used.
This page is out of date. Refresh to see the latest.
View
2  app/models/neighborly/balanced/payment.rb
@@ -24,7 +24,7 @@ def checkout!
end
def contribution_amount_in_cents
- (fee_calculator.net_amount * 100).round
+ (fee_calculator.gross_amount * 100).round
end
def fee_calculator
View
8 spec/models/neighborly/balanced/payment_spec.rb
@@ -16,9 +16,9 @@
context "when customer is paying fees" do
let(:attributes) { { pay_fee: '1', use_card: 'my-new-card' } }
- it "returns net amount from TransactionAdditionalFeeCalculator" do
+ it "returns gross amount from TransactionAdditionalFeeCalculator" do
Neighborly::Balanced::Creditcard::TransactionAdditionalFeeCalculator.
- any_instance.stub(:net_amount).and_return(15)
+ any_instance.stub(:gross_amount).and_return(15)
expect(subject.contribution_amount_in_cents).to eql(1500)
end
end
@@ -26,9 +26,9 @@
context "when customer is not paying fees" do
let(:attributes) { { pay_fee: '0', use_card: 'my-new-card' } }
- it "returns net amount from TransactionInclusiveFeeCalculator" do
+ it "returns gross amount from TransactionInclusiveFeeCalculator" do
Neighborly::Balanced::Creditcard::TransactionInclusiveFeeCalculator.
- any_instance.stub(:net_amount).and_return(10)
+ any_instance.stub(:gross_amount).and_return(10)
expect(subject.contribution_amount_in_cents).to eql(1000)
end
end
Something went wrong with that request. Please try again.