Skip to content

Instantly share code, notes, and snippets.

@lucascs lucascs/boleto.clj
Created Feb 26, 2014

Embed
What would you like to do?
Caelum Stella em Clojure
(ns accounts.adapters.boleto
(:import (br.com.caelum.stella.boleto
Datas Sacado Emissor Boleto
bancos.Santander transformer.GeradorDeBoleto)))
(defn generate []
(let [datas (-> (Datas/novasDatas)
(.comDocumento 15 2 2014)
(.comProcessamento 15 2 2014)
(.comVencimento 17 2 2014))
emissor (-> (Emissor/novoEmissor)
(.comCedente "Meu estabelecimento legal")
(.comAgencia 1234)
(.comDigitoAgencia \4)
(.comContaCorrente 12345678)
(.comNumeroConvenio 9876543)
(.comDigitoContaCorrente \5)
(.comCarteira 18)
(.comNossoNumero 9000000000000))
sacado (-> (Sacado/novoSacado)
(.comNome "Joao Fulano")
(.comCpf "111.222.333-12")
(.comEndereco "Av dos testes, 111 apto 333")
(.comBairro "Bairro Teste")
(.comCep "01234-111")
(.comCidade "São Paulo")
(.comUf "SP"))
banco (Santander.)
varargs (fn [type & args] (into-array type args))
boleto (-> (Boleto/novoBoleto)
(.comBanco banco)
(.comDatas datas)
(.comDescricoes (varargs String "Um boleto legal" "Legal mesmo"))
(.comEmissor emissor)
(.comSacado sacado)
(.comValorBoleto "200.00")
(.comNumeroDoDocumento "1234")
(.comInstrucoes (varargs String "nao se arrependa!" "mesmo!"))
(.comLocaisDePagamento (varargs String "Nas casas lotericas")))
gerador (GeradorDeBoleto. (varargs Boleto boleto))]
(-> gerador (.geraPDF "boleto.pdf"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.