Class: Epics::HIA

Inherits:
GenericRequest show all
Defined in:
lib/epics/hia.rb

Instance Attribute Summary

Attributes inherited from GenericRequest

#client, #transaction_id

Instance Method Summary collapse

Methods inherited from GenericRequest

#auth_signature, #initialize, #nonce, #timestamp, #to_receipt_xml, #to_transfer_xml

Constructor Details

This class inherits a constructor from Epics::GenericRequest

Instance Method Details

#bodyObject



28
29
30
31
32
33
34
# File 'lib/epics/hia.rb', line 28

def body
  {
    "DataTransfer" => {
      "OrderData" => Base64.strict_encode64(Zlib::Deflate.deflate(order_data))
    }
  }
end

#headerObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/epics/hia.rb', line 7

def header
  {
    :@authenticate => true,
    static: {
      "HostID" => host_id,
      "PartnerID" => partner_id,
      "UserID" => user_id,
      "Product" => {
        :@Language => "de",
        :content! => "EPICS - a ruby ebics kernel"
      },
      "OrderDetails" => {
        "OrderType" => "HIA",
        "OrderAttribute" => "DZNNN"
      },
      "SecurityMedium" => "0000"
   },
    "mutable" => ""
  }
end

#order_dataObject



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
# File 'lib/epics/hia.rb', line 36

def order_data
  "<?xml version='1.0' encoding='utf-8'?>\n"+
  Gyoku.xml("HIARequestOrderData" => {
    :"@xmlns:ds" => "http://www.w3.org/2000/09/xmldsig#",
    :"@xmlns" => "urn:org:ebics:H004",
    "AuthenticationPubKeyInfo" => {
      "PubKeyValue" => {
        "ds:RSAKeyValue" => {
          "ds:Modulus" => Base64.strict_encode64([client.x.n].pack("H*")),
          "ds:Exponent" => Base64.strict_encode64(client.x.key.e.to_s(2))
        }
      },
      "AuthenticationVersion" => "X002"
    },
    "EncryptionPubKeyInfo" => {
      "PubKeyValue" => {
        "ds:RSAKeyValue" => {
          "ds:Modulus" => Base64.strict_encode64([client.e.n].pack("H*")),
          "ds:Exponent" => Base64.strict_encode64(client.e.key.e.to_s(2))
        }
      },
      "EncryptionVersion" => "E002"
    },

    "PartnerID" => partner_id,
    "UserID" => user_id
  })
end

#rootObject



3
4
5
# File 'lib/epics/hia.rb', line 3

def root
  "ebicsUnsecuredRequest"
end

#to_xmlObject



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/epics/hia.rb', line 65

def to_xml
  Nokogiri::XML.parse(Gyoku.xml(    {
    root => {
      :"@xmlns:ds" => "http://www.w3.org/2000/09/xmldsig#",
      :@xmlns => "urn:org:ebics:H004",
      :@Version => "H004",
      :@Revision => "1",
      :header => header,
      "body" => body
    }
  }), nil, "utf-8").to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
end