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

Added charge total amount (BT-108) #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ZATCA::UBL::CommonAggregateComponents::LegalMonetaryTotal < ZATCA::UBL::BaseComponent
attr_reader :line_extension_amount, :tax_exclusive_amount,
:tax_inclusive_amount, :allowance_total_amount, :prepaid_amount,
:tax_inclusive_amount, :allowance_total_amount, :charge_total_amount, :prepaid_amount,
:payable_amount, :currency_id

# <cac:LegalMonetaryTotal>
Expand All @@ -17,6 +17,7 @@ def initialize(
tax_exclusive_amount:,
tax_inclusive_amount:,
allowance_total_amount:,
charge_total_amount:,
prepaid_amount: nil,
payable_amount: nil,
currency_id: "SAR"
Expand All @@ -25,6 +26,7 @@ def initialize(
@tax_exclusive_amount = tax_exclusive_amount
@tax_inclusive_amount = tax_inclusive_amount
@allowance_total_amount = allowance_total_amount
@charge_total_amount = charge_total_amount
@prepaid_amount = prepaid_amount
@payable_amount = payable_amount
@currency_id = currency_id
Expand Down Expand Up @@ -52,6 +54,7 @@ def elements
ZATCA::UBL::BaseComponent.new(name: "cbc:TaxExclusiveAmount", value: @tax_exclusive_amount, attributes: {"currencyID" => @currency_id}),
ZATCA::UBL::BaseComponent.new(name: "cbc:TaxInclusiveAmount", value: @tax_inclusive_amount, attributes: {"currencyID" => @currency_id}),
ZATCA::UBL::BaseComponent.new(name: "cbc:AllowanceTotalAmount", value: @allowance_total_amount, attributes: {"currencyID" => @currency_id}),
ZATCA::UBL::BaseComponent.new(name: "cbc:ChargeTotalAmount", value: @charge_total_amount, attributes: {"currencyID" => @currency_id}),
prepaid_amount_element,
payable_amount_element
]
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/simplified_invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
tax_exclusive_amount: "201.00",
tax_inclusive_amount: "231.15",
allowance_total_amount: "0.00",
charge_total_amount: "0.00",
prepaid_amount: "0.00",
payable_amount: "231.15"
).freeze
Expand Down
2 changes: 2 additions & 0 deletions spec/fixtures/standard_invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def construct_signed_standard_invoice
tax_exclusive_amount: "900.00",
tax_inclusive_amount: "1035.00",
allowance_total_amount: "0.00",
charge_total_amount: "0.00",
payable_amount: "1035.00"
)

Expand Down Expand Up @@ -265,6 +266,7 @@ def construct_unsigned_standard_invoice
tax_exclusive_amount: "4.00",
tax_inclusive_amount: "4.60",
allowance_total_amount: "0.00",
charge_total_amount: "0.00",
prepaid_amount: "0.00",
payable_amount: "4.60"
)
Expand Down