Class: Ufebs::Documents::BasePayment
- Inherits:
-
Object
- Object
- Ufebs::Documents::BasePayment
- Includes:
- HappyMapper
- Defined in:
- lib/ufebs/documents/base_payment.rb
Direct Known Subclasses
Constant Summary collapse
- DOCUMENT_NUMBER_TYPE =
'06'.freeze
- SYSTEM_CODE =
'02'.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, trans_kind: DOCUMENT_NUMBER_TYPE, payt_kind: nil, system_code: nil, payment_precedence: nil, processing_details: nil, departmental_info: nil) {|_self| ... } ⇒ BasePayment
constructor
A new instance of BasePayment.
- #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, trans_kind: DOCUMENT_NUMBER_TYPE, payt_kind: nil, system_code: nil, payment_precedence: nil, processing_details: nil, departmental_info: nil) {|_self| ... } ⇒ BasePayment
Returns a new instance of BasePayment.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ufebs/documents/base_payment.rb', line 21 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, trans_kind: DOCUMENT_NUMBER_TYPE, payt_kind: nil, system_code: nil, payment_precedence: nil, processing_details: 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 @payment_precedence = payment_precedence @processing_details = processing_details.is_a?(Hash) ? ::Ufebs::Entities::ProcessingDetails.new(processing_details) : processing_details @ed_author = @type_number = trans_kind @system_code = system_code || SYSTEM_CODE yield self if block_given? super() end |
Instance Method Details
#as_xml(encoding: 'UTF-8') ⇒ Object
17 18 19 |
# File 'lib/ufebs/documents/base_payment.rb', line 17 def as_xml(encoding: 'UTF-8') to_xml(Nokogiri::XML::Builder.new(:encoding => encoding)).to_xml end |