Class: Cetustek::Models::AllowanceData
- Inherits:
-
Object
- Object
- Cetustek::Models::AllowanceData
- Defined in:
- lib/cetustek/models/allowance_data.rb
Overview
Request data for CreateAllowance (開立折讓單), spec AVM-26-03 Table 15/16. Line items reuse InvoiceItem (code/name/quantity/unit/unit_price).
Constant Summary collapse
- TAX_TYPES =
折讓單稅別只有應稅/零稅率/免稅,發票的 4 (特種稅率)、5 (經海關出口) 與 9 (混合) 在折讓單無效。
[TaxType::TAXABLE, TaxType::ZERO_RATE, TaxType::TAX_FREE].freeze
Instance Attribute Summary collapse
-
#allowance_date ⇒ Object
readonly
Returns the value of attribute allowance_date.
-
#allowance_number ⇒ Object
readonly
Returns the value of attribute allowance_number.
-
#buyer_address ⇒ Object
readonly
Returns the value of attribute buyer_address.
-
#buyer_email ⇒ Object
readonly
Returns the value of attribute buyer_email.
-
#invoice_number ⇒ Object
readonly
Returns the value of attribute invoice_number.
-
#invoice_year ⇒ Object
readonly
Returns the value of attribute invoice_year.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#round_num ⇒ Object
readonly
Returns the value of attribute round_num.
-
#tax_type ⇒ Object
readonly
Returns the value of attribute tax_type.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ AllowanceData
constructor
A new instance of AllowanceData.
Constructor Details
#initialize(attributes = {}) ⇒ AllowanceData
Returns a new instance of AllowanceData.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cetustek/models/allowance_data.rb', line 18 def initialize(attributes = {}) @allowance_number = attributes[:allowance_number] @allowance_date = attributes[:allowance_date] @invoice_number = attributes[:invoice_number] @invoice_year = attributes[:invoice_year] @buyer_address = attributes[:buyer_address] @buyer_email = attributes[:buyer_email] @tax_type = attributes[:tax_type] || TaxType::TAXABLE unless TAX_TYPES.include?(@tax_type.to_i) raise ArgumentError, "tax_type must be 1 (應稅), 2 (零稅率) or 3 (免稅), got #{@tax_type.inspect}" end @reason = attributes[:reason] @round_num = attributes[:round_num] # optional 金額計算位數 @items = attributes[:items] || [] end |
Instance Attribute Details
#allowance_date ⇒ Object (readonly)
Returns the value of attribute allowance_date.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def allowance_date @allowance_date end |
#allowance_number ⇒ Object (readonly)
Returns the value of attribute allowance_number.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def allowance_number @allowance_number end |
#buyer_address ⇒ Object (readonly)
Returns the value of attribute buyer_address.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def buyer_address @buyer_address end |
#buyer_email ⇒ Object (readonly)
Returns the value of attribute buyer_email.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def buyer_email @buyer_email end |
#invoice_number ⇒ Object (readonly)
Returns the value of attribute invoice_number.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def invoice_number @invoice_number end |
#invoice_year ⇒ Object (readonly)
Returns the value of attribute invoice_year.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def invoice_year @invoice_year end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def items @items end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def reason @reason end |
#round_num ⇒ Object (readonly)
Returns the value of attribute round_num.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def round_num @round_num end |
#tax_type ⇒ Object (readonly)
Returns the value of attribute tax_type.
14 15 16 |
# File 'lib/cetustek/models/allowance_data.rb', line 14 def tax_type @tax_type end |