Sha256: c371df7fb388283b69984d9f55ff1aa2ab301210f4fa9ccdfa0354f36bc58bb2

Contents?: true

Size: 1.95 KB

Versions: 13

Compression:

Stored size: 1.95 KB

Contents

class Epics::HIA < Epics::GenericRequest

  def root
    "ebicsUnsecuredRequest"
  end

  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

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

  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

  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

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
epics-1.5.1 lib/epics/hia.rb
epics-1.5.0 lib/epics/hia.rb
epics-1.4.1 lib/epics/hia.rb
epics-1.4.0 lib/epics/hia.rb
epics-1.3.1 lib/epics/hia.rb
epics-1.3.0 lib/epics/hia.rb
epics-1.2.2 lib/epics/hia.rb
epics-1.2.1 lib/epics/hia.rb
epics-1.2.0 lib/epics/hia.rb
epics-1.1.2 lib/epics/hia.rb
epics-1.1.1 lib/epics/hia.rb
epics-1.1.0 lib/epics/hia.rb
epics-1.0.0 lib/epics/hia.rb