Class: Ufebs::Documents::PaymentOrder
- Inherits:
-
Object
- Object
- Ufebs::Documents::PaymentOrder
- Includes:
- HappyMapper
- Defined in:
- lib/ufebs/documents/payment_order.rb
Constant Summary collapse
- InvalidPriority =
Class.new(StandardError)
- DOCUMENT_NUMBER_TYPE =
'01'.freeze
- SYSTEM_CODE =
'01'.freeze
Instance Method Summary collapse
- #as_xml(encoding: 'UTF-8') ⇒ Object
-
#initialize(ed_date: Time.now, number: nil, sum: nil, charge_off_date: Time.now, priority: 0, receipt_date: Time.now, ed_author: '', acc_doc: nil, payer: nil, payee: nil, purpose: '', uin: nil, payt_kind: nil, system_code: nil, departmental_info: nil) {|_self| ... } ⇒ PaymentOrder
constructor
A new instance of PaymentOrder.
- #validate ⇒ Object
Constructor Details
#initialize(ed_date: Time.now, number: nil, sum: nil, charge_off_date: Time.now, priority: 0, receipt_date: Time.now, ed_author: '', acc_doc: nil, payer: nil, payee: nil, purpose: '', uin: nil, payt_kind: nil, system_code: nil, departmental_info: nil) {|_self| ... } ⇒ PaymentOrder
Returns a new instance of PaymentOrder.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ufebs/documents/payment_order.rb', line 46 def initialize( ed_date: Time.now, number: nil, sum: nil, charge_off_date: Time.now, priority: 0, receipt_date: Time.now, ed_author: '', acc_doc: nil, payer: nil, payee: nil, purpose: '', uin: nil, payt_kind: nil, system_code: nil, departmental_info: nil ) raise InvalidPriority.new('priority Реквизит должен иметь значение в диапазоне 0-5.') unless (0..5).include?(priority.to_i) @ed_date = Date.parse(ed_date.to_s).strftime('%Y-%m-%d') @number = number @sum = sum @charge_off_date = Date.parse(charge_off_date.to_s).strftime('%Y-%m-%d') @receipt_date = Date.parse(receipt_date.to_s).strftime('%Y-%m-%d') @priority = priority @acc_doc = acc_doc.is_a?(Hash) ? Ufebs::Entities::AccDoc.new(acc_doc) : acc_doc @payer = payer.is_a?(Hash) ? Ufebs::Entities::Participant.new(payer) : payer @payee = payer.is_a?(Hash) ? Ufebs::Entities::Participant.new(payee) : payee @purpose = purpose @departmental_info = departmental_info.is_a?(Hash) ? Ufebs::Entities::DepartmentalInfo.new(departmental_info) : departmental_info @uin = uin @payt_kind = payt_kind @ed_author = @type_number = DOCUMENT_NUMBER_TYPE @system_code = system_code || SYSTEM_CODE yield self if block_given? super() end |
Instance Method Details
#as_xml(encoding: 'UTF-8') ⇒ Object
42 43 44 |
# File 'lib/ufebs/documents/payment_order.rb', line 42 def as_xml(encoding: 'UTF-8') to_xml(Nokogiri::XML::Builder.new(:encoding => encoding)).to_xml end |