-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(anrok): call report credit note job when creating a credit note (#…
…2617) When creating a credit note we should schedule a job to report credit note creation to tax provider is customer has tax_provider set up; When reporting credit note, the reported amount should be taken from the items amounts
- Loading branch information
1 parent
1d7ec67
commit b4cd672
Showing
7 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe CreditNoteItem, type: :model do | ||
subject(:credit_note_item) { create(:credit_note_item) } | ||
|
||
it { is_expected.to belong_to(:credit_note) } | ||
it { is_expected.to belong_to(:fee) } | ||
|
||
describe '#sub_total_excluding_taxes_amount_cents' do | ||
let(:credit_note_item) { build(:credit_note_item, amount_cents: 100, fee: fee) } | ||
let(:fee) { build(:fee, amount_cents: 1000, precise_amount_cents: 1000, precise_coupons_amount_cents: 0) } | ||
|
||
context 'when there are no coupons applied' do | ||
it 'returns item amount with coupons applied' do | ||
expect(credit_note_item.sub_total_excluding_taxes_amount_cents).to eq(100) | ||
end | ||
end | ||
|
||
context 'when there are coupons applied' do | ||
let(:fee) { build(:fee, amount_cents: 1000, precise_amount_cents: 1000, precise_coupons_amount_cents: 20) } | ||
|
||
it 'returns item amount with coupons applied' do | ||
expect(credit_note_item.sub_total_excluding_taxes_amount_cents).to eq(98) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters