github.com/mundipagg/boleto-api@v0.0.0-20230620145841-3f9ec742599f/santander/request.go (about) 1 package santander 2 3 const registerBoleto = ` 4 ## SOAPAction:create 5 ## Content-Type:text/xml 6 7 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:impl="http://impl.webservice.ymb.app.bsbr.altec.com/"> 8 <soapenv:Header/> 9 <soapenv:Body> 10 <impl:registraTitulo> 11 <dto> 12 <dtNsu>{{today | brDateWithoutDelimiter }}</dtNsu> 13 <estacao>{{.Authentication.Username}}</estacao> 14 <nsu>{{santanderNSUPrefix (padLeft (toString .Title.OurNumber) "0" 13)}}</nsu> 15 <ticket>{{unscape .Authentication.AuthorizationToken}}</ticket> 16 <tpAmbiente>{{santanderEnv}}</tpAmbiente> 17 </dto> 18 </impl:registraTitulo> 19 </soapenv:Body> 20 </soapenv:Envelope> 21 ` 22 23 const registerSantanderResponse = ` 24 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 25 <soapenv:Body> 26 <dlwmin:registraTituloResponse xmlns:dlwmin="http://impl.webservice.ymb.app.bsbr.altec.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 27 <return xmlns:ns2="http://impl.webservice.ymb.app.bsbr.altec.com/"> 28 <descricaoErro>{{message}}</descricaoErro> 29 <situacao>{{errorCode}}</situacao> 30 <titulo> 31 <cdBarra>{{barcodeNumber}}</cdBarra> 32 <linDig>{{digitableLine}}</linDig> 33 <nossoNumero>{{ourNumber}}</nossoNumero> 34 </titulo> 35 </return> 36 </dlwmin:registraTituloResponse> 37 </soapenv:Body> 38 </soapenv:Envelope> 39 ` 40 41 const requestTicket = ` 42 43 ## SOAPAction:create 44 ## Content-Type:text/xml 45 46 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:impl="http://impl.webservice.dl.app.bsbr.altec.com/"> 47 <soapenv:Header/> 48 <soapenv:Body> 49 <impl:create> 50 <TicketRequest> 51 <dados> 52 <entry> 53 <key>CONVENIO.COD-BANCO</key> 54 <value>0033</value> 55 </entry> 56 <entry> 57 <key>CONVENIO.COD-CONVENIO</key> 58 <value>{{.Agreement.AgreementNumber}}</value> 59 </entry> 60 <entry> 61 <key>PAGADOR.TP-DOC</key> 62 {{if eq .Buyer.Document.Type "CPF"}} 63 <value>01</value> 64 {{else}} 65 <value>02</value> 66 {{end}} 67 </entry> 68 <entry> 69 <key>PAGADOR.NUM-DOC</key> 70 <value>{{extractNumbers .Buyer.Document.Number}}</value> 71 </entry> 72 <entry> 73 <key>PAGADOR.NOME</key> 74 <value>{{clearString (truncate .Buyer.Name 40)}}</value> 75 </entry> 76 <entry> 77 <key>PAGADOR.ENDER</key> 78 <value>{{clearString (truncate .Buyer.Address.Street 40)}}</value> 79 </entry> 80 <entry> 81 <key>PAGADOR.BAIRRO</key> 82 <value>{{clearString (truncate .Buyer.Address.District 30)}}</value> 83 </entry> 84 <entry> 85 <key>PAGADOR.CIDADE</key> 86 <value>{{clearString (truncate .Buyer.Address.City 20)}}</value> 87 </entry> 88 <entry> 89 <key>PAGADOR.UF</key> 90 <value>{{clearString (truncate .Buyer.Address.StateCode 2)}}</value> 91 </entry> 92 <entry> 93 <key>PAGADOR.CEP</key> 94 <value>{{truncate (extractNumbers .Buyer.Address.ZipCode) 8}}</value> 95 </entry> 96 <entry> 97 <key>TITULO.NOSSO-NUMERO</key> 98 <value>{{padLeft (toString .Title.OurNumber) "0" 13}}</value> 99 </entry> 100 <entry> 101 <key>TITULO.SEU-NUMERO </key> 102 <value>{{.Title.DocumentNumber}}</value> 103 </entry> 104 <entry> 105 <key>TITULO.DT-VENCTO</key> 106 <value>{{brDateWithoutDelimiter .Title.ExpireDateTime}}</value> 107 </entry> 108 <entry> 109 <key>TITULO.DT-EMISSAO</key> 110 <value>{{today | brDateWithoutDelimiter}}</value> 111 </entry> 112 <entry> 113 <key>TITULO.ESPECIE</key> 114 <value>{{ .Title.BoletoTypeCode}}</value> 115 </entry> 116 <entry> 117 <key>TITULO.TP-DESC</key> 118 <value>0</value> 119 </entry> 120 <entry> 121 <key>TITULO.TP-PROTESTO</key> 122 <value>0</value> 123 </entry> 124 <entry> 125 <key>TITULO.QT-DIAS-PROTESTO</key> 126 <value>0</value> 127 </entry> 128 <entry> 129 <key>TITULO.QT-DIAS-BAIXA</key> 130 <value>0</value> 131 </entry> 132 <entry> 133 <key>TITULO.VL-NOMINAL</key> 134 <value>{{.Title.AmountInCents}}</value> 135 </entry> 136 <entry> 137 <key>MENSAGEM</key> 138 <value>{{clearString (truncate .Title.Instructions 100)}}</value> 139 </entry> 140 </dados> 141 <expiracao>600</expiracao> 142 <sistema>YMB</sistema> 143 </TicketRequest> 144 </impl:create> 145 </soapenv:Body> 146 </soapenv:Envelope> 147 ` 148 149 const ticketReponse = ` 150 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 151 <soapenv:Body> 152 <dlwmin:createResponse xmlns:dlwmin="http://impl.webservice.dl.app.bsbr.altec.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 153 <TicketResponse> 154 <retCode>{{returnCode}}</retCode> 155 <ticket>{{ticket}}</ticket> 156 </TicketResponse> 157 </dlwmin:createResponse> 158 </soapenv:Body> 159 </soapenv:Envelope> 160 ` 161 162 func getResponseSantander() string { 163 return registerSantanderResponse 164 } 165 166 func getRequestSantander() string { 167 return registerBoleto 168 } 169 170 func getRequestTicket() string { 171 return requestTicket 172 } 173 174 func getTicketResponse() string { 175 return ticketReponse 176 }