ruby_ufebs 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fde77327f89a47d9093cf6348a1166f21646a87
4
- data.tar.gz: ac8b9f64f3fede7f12a31e2ed0c74bd8a3130c58
3
+ metadata.gz: 3b26e315abe1ba3846ac7362ab810fcec51c7a26
4
+ data.tar.gz: ae6b218f92527545fd7a2802c5a14e2dad6a5787
5
5
  SHA512:
6
- metadata.gz: b91e5fed70f42e635255acdf20a61ff3975a3d6962232161ba0ed87fc08299abc5f8e54798984e152d93e41c80b430a066f90f8512ca1788fdd06290abde1fcb
7
- data.tar.gz: dd597a549024422c3c692894b18d1ffa06c070f642c9f075fa52f9a42296735cec527609bd291123f063b7b1f621b0559fe519f0c19ab4987f79e73b5f2cc5ae
6
+ metadata.gz: 85d3cbfad527726ed2c74d240d8cfdda6d837fa2240c3175b212836a39bff643057ae977d0157a74dddcf25e1e68655657a79e9e8bf4f64c2b9c5bc7caa7ce41
7
+ data.tar.gz: f4c2b875afbe21fa5feed68e178efa788bc58890ba72d76b3aa92cc8f9b3792717c9112585c10f789fffd313390559fe5919892498c0c16b12b4e61393db73c1
@@ -0,0 +1,59 @@
1
+ require_relative 'payment_response'
2
+ require_relative '../entities/session'
3
+
4
+ module Ufebs
5
+ module Documents
6
+ class Package
7
+ include HappyMapper
8
+ register_namespace 'ed', "urn:cbr-ru:ed:v2.0"
9
+ tag 'PacketEPD'
10
+ namespace 'ed'
11
+
12
+ attribute :ed_date, String, tag: 'EDDate'
13
+ attribute :ed_author, String, tag: 'EDAuthor'
14
+ attribute :ed_receiver, String, tag: 'EDReceiver'
15
+ attribute :number, String, tag: 'EDNo'
16
+ attribute :quantity, String, tag: 'EDQuantity'
17
+ attribute :sum, String, tag: 'Sum'
18
+ attribute :system_code, String, tag: 'SystemCode'
19
+
20
+ has_many :payment_orders, Ufebs::Documents::PaymentOrder
21
+ has_one :session, ::Ufebs::Entities::Session, tag: 'Session', state_when_nil: false
22
+
23
+ def initialize(payment_orders=[], params = {})
24
+ @payment_orders = payment_orders
25
+ @ed_date = Date.parse(params.fetch(:ed_date){Time.now}.to_s).strftime('%Y-%m-%d')
26
+ @ed_author = params[:ed_author]
27
+ @ed_receiver = params[:ed_receiver]
28
+ @number = params[:number]
29
+ @quantity = params[:quantity] || payment_orders.size
30
+ @sum = params[:sum]
31
+ @system_code = '01'
32
+ super()
33
+ end
34
+
35
+ def to_xml(encoding: 'UTF-8')
36
+ super(Nokogiri::XML::Builder.new(:encoding => encoding)).to_xml
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ # <?xml version="1.0" encoding="WINDOWS-1251"?>
43
+ # <PacketESID xmlns="urn:cbr-ru:ed:v2.0" EDAuthor="4583001999" EDCreationTime="13:33:08" EDDate="2018-02-23" EDNo="1070230" EDReceiver="4525420000">
44
+ # <dsig:SigValue xmlns:dsig="urn:cbr-ru:dsig:v1.1">MIIBaQYJKoZIhvcNAQcCoIIBWjCCAVYCAQExDjAMBggqhQMHAQECAgUAMAsGCSqGSIb3DQEHATGCATIwggEuAgEBMGAwTDELMAkGA1UEBhMCUlUxCzAJBgNVBAgTAjAwMQ8wDQYDVQQHEwZSVEdTQlIxDTALBgNVBAoTBEdDS0kxEDAOBgNVBAMTB0FETUlOQ0ECEEBQFMCd4KlDNKW6RlhblsQwDAYIKoUDBwEBAgIFAKBpMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTE4MDIyNzEzMzIzMlowLwYJKoZIhvcNAQkEMSIEIPretuTeA+Uosyhj6ROUT66yYTuZF+aaXclhxXXKmPxdMAwGCCqFAwcBAQEBBQAEQD/Ah3zv5DZv13fsX1Pcqd3Z7YFls14j+4rnYkrRuU31oR1clc4YUG1Lg71Hrp7q/uErXapd33FrjKyxO7Dvfxo=</dsig:SigValue>
45
+ # <InitialPacketED EDAuthor="4525420000" EDDate="2018-02-23" EDNo="5"/>
46
+ # <Session>
47
+ # <SessionID>6</SessionID>
48
+ # </Session>
49
+ # <ED206 Acc="30101810945250000420" BICCorr="044525000" CorrAcc="40101810845250010102" DC="1" EDAuthor="4583001999" EDDate="2018-02-23" EDNo="1070231" EDReceiver="4525420000" Sum="381" SystemCode="01" TransDate="2018-02-23" TransTime="13:33:08">
50
+ # <AccDoc AccDocDate="2018-02-23" AccDocNo="441"/>
51
+ # <EDRefID EDAuthor="4525420000" EDDate="2018-02-23" EDNo="6"/>
52
+ # <ProcessingDetails CreditDate="2018-02-23" DebitDate="2018-02-23"/>
53
+ # </ED206>
54
+ # <ED206 Acc="30101810945250000420" BICCorr="044525000" CorrAcc="40101810045250010041" DC="1" EDAuthor="4583001999" EDDate="2018-02-23" EDNo="1070232" EDReceiver="4525420000" Sum="680700" SystemCode="01" TransDate="2018-02-23" TransTime="13:33:08">
55
+ # <AccDoc AccDocDate="2018-02-23" AccDocNo="459"/>
56
+ # <EDRefID EDAuthor="4525420000" EDDate="2018-02-23" EDNo="7"/>
57
+ # <ProcessingDetails CreditDate="2018-02-23" DebitDate="2018-02-23"/>
58
+ # </ED206>
59
+ # </PacketESID>
@@ -0,0 +1,57 @@
1
+ module Ufebs
2
+ module Documents
3
+ class PaymentResponse
4
+ include HappyMapper
5
+
6
+ register_namespace 'ed', "urn:cbr-ru:ed:v2.0"
7
+ tag 'ED206'
8
+ namespace 'ed'
9
+
10
+ attribute :acc, String, tag: 'Acc'
11
+ attribute :bic_corr, String, tag: 'BICCorr'
12
+ attribute :corr_acc, String, tag: 'CorrAcc'
13
+ attribute :dc, String, tag: 'DC'
14
+ attribute :ed_author, String, tag: 'EDAuthor'
15
+ attribute :ed_date, String, tag: 'EDDate'
16
+ attribute :ed_no, String, tag: 'EDNo'
17
+ attribute :ed_receiver, String, tag: 'EDReceiver'
18
+ attribute :sum, String, tag: 'Sum'
19
+ attribute :system_code, String, tag: 'SystemCode'
20
+ attribute :trans_date, String, tag: 'TransDate'
21
+ attribute :trans_time, String, tag: 'TransTime'
22
+
23
+ has_one :acc_doc, ::Ufebs::Entities::AccDoc, tag: 'AccDoc'
24
+ has_one :ed_ref_id, ::Ufebs::Entities::EdRefId, tag: 'EDRefID'
25
+ has_one :processing_details, ::Ufebs::Entities::ProcessingDetails, tag: 'ProcessingDetails'
26
+
27
+ def initialize(params = {})
28
+ params.each do |key, value|
29
+ case key
30
+ when :acc_doc
31
+ @acc_doc = value.is_a?(Hash) ? ::Ufebs::Entities::AccDoc.new(value) : acc_doc
32
+ when :ed_ref_id
33
+ @ed_ref_id = value.is_a?(Hash) ? ::Ufebs::Entities::EdRefId.new(value) : acc_doc
34
+ when :processing_details
35
+ @processing_details = value.is_a?(Hash) ? ::Ufebs::Entities::ProcessingDetails.new(value) : acc_doc
36
+ else instance_variable_set("@#{key}".to_sym, value)
37
+ end
38
+
39
+ super()
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ # <ED206 Acc="30101810945250000420"
46
+ # BICCorr="044525000"
47
+ # CorrAcc="40101810045250010041"
48
+ # DC="1" EDAuthor="4583001999"
49
+ # EDDate="2018-02-23" EDNo="1070232"
50
+ # EDReceiver="4525420000" Sum="680700"
51
+ # SystemCode="01"
52
+ # TransDate="2018-02-23"
53
+ # TransTime="13:33:08">
54
+ # <AccDoc AccDocDate="2018-02-23" AccDocNo="459"/>
55
+ # <EDRefID EDAuthor="4525420000" EDDate="2018-02-23" EDNo="7"/>
56
+ # <ProcessingDetails CreditDate="2018-02-23" DebitDate="2018-02-23"/>
57
+ # </ED206>
data/lib/ufebs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RubyUfebs
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/ufebs.rb CHANGED
@@ -155,10 +155,21 @@ module Ufebs
155
155
  params.is_a?(Hash) ? Ufebs::Documents::PaymentOrder.new(params) : Ufebs::Documents::PaymentOrder.parse(params)
156
156
  end
157
157
 
158
- def PackedEPD(payment_eds, params)
158
+ def PacketEPD(payment_eds, params)
159
159
  Ufebs::Documents::Package.new(payment_eds, params)
160
160
  end
161
161
 
162
+ def ED206(params)
163
+ return Ufebs::Documents::PaymentResponse.new(params) if params.is_a?(Hash)
164
+ Ufebs::Documents::PaymentResponse.parse(params)
165
+ end
166
+
167
+ def ED205(params)
168
+ end
169
+
170
+ def packetESID
171
+ end
172
+
162
173
  def validate(doc)
163
174
  doc = Nokogiri::XML(doc) if doc.is_a?(String)
164
175
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_ufebs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Burdaev
@@ -424,7 +424,9 @@ files:
424
424
  - lib/ufebs.rb
425
425
  - lib/ufebs/configuration.rb
426
426
  - lib/ufebs/documents/package.rb
427
+ - lib/ufebs/documents/package_response.rb
427
428
  - lib/ufebs/documents/payment_order.rb
429
+ - lib/ufebs/documents/payment_response.rb
428
430
  - lib/ufebs/entities/acc_doc.rb
429
431
  - lib/ufebs/entities/bank.rb
430
432
  - lib/ufebs/entities/departmental_info.rb