1.7.0 • Published 2 months ago

es-dsn-proxy v1.7.0

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

ES DSN proxy

Similar to: http://github.com/payfit/dsn-proxy

Description

This service listen messages from a channel NSQ: declaration-generated These messages (containing declaration ids) are processed following these steps:

  • A call is made to app.payfit.com to get the declaration from its id
  • This declaration's json field is transformed into XML
  • This XML is ran by IRPF's java module (provided by Spain government)
  • This module outputs a new XML that is read/transformed into JSON
  • This JSON is used to update corresponding Jetlang's variables, by calling app.payfit.com
  • In case of error: the declaration's json field is updated

Installation

You have two choices to run this project:

  • Use docker
  • Install dependencies locally

Docker (easy)

Run docker-compose up --build

The app will be available on port 3220

Locally

Install the JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Install dependencies: npm i

Run the app: npm run dev

Routes

POST /getRawDocument
[{
  "identifier": "parent",
  "values": [
    {
      "identifier": "children1",
      "value": "..."
    },
    {
      "identifier": "children2",
      "values": [
        ...
      ]
    }
  ]
}]
POST /validate
{
  "declarationId": "a declaration id in string format" // Example: "5a68a92dbb29d4022433e4db"
}

/getRawDocument

The submitted JSON must respect the following structure:

[{
  "identifier": "parent",
  "values": [
    {
      "identifier": "children1",
      "value": "..."
    },
    {
      "identifier": "children2",
      "values": [
        ...
      ]
    }
  ]
}]

It must have a parent, and can have an inifinite number of children / nesting levels.