lib/eet.js
function doRequest (options, items) {
  const uid = options.uid || uuid.v4()
  const date = options.currentDate || new Date()
  const soapOptions = {}
  if (options.playground) {
    soapOptions.endpoint = PG_WSDL_URL
  }
  if (options.httpClient) {
    soapOptions.httpClient = options.httpClient
  }
  const timeout = options.timeout || 2000
  const offline = options.offline || false

  return new Promise((resolve, reject) => {
    const body = getBodyItems(options.privateKey, date, uid, items)
    soap.createClient(WSDL, soapOptions, (err, client) => {
      if (err) return reject(err)
      client.setSecurity(new WSSecurity(options.privateKey, options.certificate, uid))
      client.OdeslaniTrzby(body, (err, response) => {
        if (err) return reject(err)
        try {
          validate.httpResponse(response)
          resolve(getResponseItems(response))
        } catch (e) {
          reject(e)
        }
      }, {timeout: timeout})
    })
  }).catch(err => {
    if (!offline) return Promise.reject(err)
    let code = getFooterItems(options.privateKey, items)
    let bkp = code.bkp
    let pkp = code.pkp
    return Promise.resolve({pkp: pkp.$value, bkp: bkp.$value, err})
  })
}
function doRequest (options, items) {
  const uid = options.uid || uuid.v4()
  const date = options.currentDate || new Date()
  const soapOptions = {}
  if (options.playground) {
    soapOptions.endpoint = PG_WSDL_URL
  }
  if (options.httpClient) {
    soapOptions.httpClient = options.httpClient
  }
  const timeout = options.timeout || 2000
  const offline = options.offline || false

  return new Promise((resolve, reject) => {
    const body = getBodyItems(options.privateKey, date, uid, items)
    soap.createClient(WSDL, soapOptions, (err, client) => {
      if (err) return reject(err)
      client.setSecurity(new WSSecurity(options.privateKey, options.certificate, uid))
      client.OdeslaniTrzby(body, (err, response) => {
        if (err) return reject(err)
        try {
          validate.httpResponse(response)
          resolve(getResponseItems(response))
        } catch (e) {
          reject(e)
        }
      }, {timeout: timeout})
    })
  }).catch(err => {
    if (!offline) return Promise.reject(err)
    let code = getFooterItems(options.privateKey, items)
    let bkp = code.bkp
    let pkp = code.pkp
    return Promise.resolve({pkp: pkp.$value, bkp: bkp.$value, err})
  })
}
function doRequest ( options , items ) { const uid = options . uid || uuid . v4 ( ) const date = options . currentDate || new Date ( ) const soapOptions = { } if ( options . playground ) { soapOptions . endpoint = PG_WSDL_URL } if ( options . httpClient ) { soapOptions . httpClient = options . httpClient } const timeout = options . timeout || 2000 const offline = options . offline || false return new Promise ( ( resolve , reject ) => { const body = getBodyItems ( options . privateKey , date , uid , items ) soap . createClient ( WSDL , soapOptions , ( err , client ) => { if ( err ) return reject ( err ) client . setSecurity ( new WSSecurity ( options . privateKey , options . certificate , uid ) ) client . OdeslaniTrzby ( body , ( err , response ) => { if ( err ) return reject ( err ) try { validate . httpResponse ( response ) resolve ( getResponseItems ( response ) ) } catch ( e ) { reject ( e ) } } , { timeout : timeout } ) } ) } ) . catch ( err => { if ( ! offline ) return Promise . reject ( err ) let code = getFooterItems ( options . privateKey , items ) let bkp = code . bkp let pkp = code . pkp return Promise . resolve ( { pkp : pkp . $value , bkp : bkp . $value , err } ) } ) }
Odeslani platby do EET.

Volby:
- options.playground (boolean): povolit testovaci prostredi, def. false
- options.offline (boolean): při chybě vygeneruje PKP a BKP, def. false

Polozky (items) jsou popsany u funkce getItemsForBody().

Vraci Promise. Pokud je vse v poradku, vrati FIK, v opacnem pripade vraci info o chybe.
Odeslani platby do EET .