Technical Manual ONLINE ISSUANCE BY HSBC LINK Gateway of Payments HSBC Non Registered Collection Version: 2.5 Jul/2014 PUBLIC SUMMARY PRESENTATION 03 1. PRELIMINARY NOTES 04 2. LEGISLATION 05 3. PROCESS OF SERVICE HIRING 05 4. INTERFACE OF CUSTOMER ELETRONIC 06 5. MATURITY DATE 08 6. DOCUMENT NUMBER 08 7. INSTRUCTIONS 08 8. DRAWEE DATA 08 9. RE-ISSUANCE 08 10. HSBC LOGO 08 11. TESTS 09 12. ANNEX I – Integration Check List 10 13. ANNEX Il – Example of ASP Development 13 14. ANNEX lll – Example of PHP Development 15 15. ANNEX IV – Example of JSP Development 16 16. ANNEX V – Example of ASP.NET/C# Development 18 17. GLOSSARY 20 PUBLIC - 2 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . ONLINE ISSUANCE BY HSBC LINK - NON REGISTERED COLLECTION PRELIMINARY NOTES BLOQUETO FILLING PRESENTATION Dear Customer We, from HSBC Bank Brasil S.A. – Branch Múltiplo are handling the Technical Manual Volume of Non Registered Collection - On-line Issuance by HSBC Link. Through it, the people in charge of giving you computing support will have the necessary instructions to keep the integration with quality and agility of our services. The Technical Manual of Non Registered Collection – On-line Issuance by HSBC Link provides all the information so that the bloqueto issuance of collection can be done in your processing environment, which will provide agility and efficiency while collecting your on line sales. If you have doubts, contact your manager. PUBLIC - 3 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 1. PRELIMINARY NOTES The words with an asterisk (*) have the meaning in the glossary WHAT IS THE NON REGISTERED COLLECTION? The Non Registered Collection – On-line Issuance by HSBC Link is HSBC Collection modality, and objectifies to attend the customers who carry out on line sales and want to offer this manner of payment to their clients. Thereby, the on line bloqueto* issuance is made on the HSBC systems, with the data given by the customer, offering a bloqueto image on the internet, to be printed by its clients. The client does not have to develop on his system the intelligence of formatting of bloqueto and the bar code. To operate the information interchange that the customer Will know which issued bloquetos by the HSBC link were paid, this manual is complemented by the Technical Manual Standard CNAB 400 or CNAB 240. PUBLIC - 4 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 2. LEGISLATION The words with an asterisk (*) have the meaning in the glossary The standardization of Collection bloqueto*, specifically of Clearing Form, obeys the model CADOC 24044-4, established by Banco Central do Brasil, through the Circular Letter 2.414, on October, 7th, 1993, and modified by the Circular Letter 2790 on March, 3rd, 1998. Changing the specifications of Bar code, with the introduction of Auto-digit conference (DAC), occurred by Circular Letter No. 2,531 the Bank on February, 24th, 1995. The changes on the specifications of Bar Code, with the introduction of “Maturity Factor” on collection bloquetos, occurred by the Circular Letter 125 of Banco Central do Brasil, on May,2nd,2000. 3. PROCESS OF SERVICE HIRING The Customer must hire the Non Registered Collection offers by HSBC. This volume of collection is the most recommended because in sales by internet, the good is only delivered or the service is only done after the payment confirmation. The bloqueto nonpayment issued on internet do not characterize debt, therefore, there cannot be process of protest by the buyer. The customer also signs the Contract of Services Deliver for Releasing of Collection Bloquetos by Electronic Way. After the Non Registered Collection hire, the HSBC will define the ASSIGNOR CODE and will inform it for the Customer. The customer must inform the IP number (s) of his servants for the bank, that use them as a security parameter, There is no quantity limit of IPs that can be registered. The reason is that the solution requires the assignor Web servant opens a direct connection (Server-to-server) with the HSBC servant. This connection is only accepted if the IP of origin is registered. (See the item Interface of Customer Electronic Commerce with HSBC). PUBLIC - 5 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 4. INTERFACE OF CUSTOMER ELECTRONIC COMMERCE WITH HSBC The On Line Issuance process works according to the following way: (see picture) 1. DRAWEE access the company site and makes his buying 2. DRAWEE, after registering on the assignor site, selects the payment form (Clearing Bloqueto) 3. DRAWEE carries out a submit for a link lodged on the assignor servant. 4. The assignor servant carries out a direct connection (Server-to-Server) via post (see item Observations, below the item 9) for the address. https://wwws5.hsbc.com.br/OFB-BOL-CNR/servlets/GeraBoleto?ServletState=10 5. The post sent to the Customer Servant for the HSBC link must contain the following data so that the bloqueto generation can occur successfully: Field Name Type of Data Size Format codigoCedente dataVencimento valorDocumento numeroParcela totalParcelas numeroDocumento L1 L2 L3 L4 L5 unidadeCedente nomeSacado cpfCnpjSacado enderecoSacado numeroSacado complementoSacado cepSacado bairroSacado cidadeSacado estadoSacado NUMERIC DATE ALPHANUMERIC NUMERIC NUMERIC NUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC NUMERIC ALPHANUMERIC NUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC ALPHANUMERIC 7 10 10 02 02 13 66 66 66 66 66 54 30 14 40 05 10 10 15 15 02 9999999 DD/MM/YYYY 9999999.99 99 99 9999999999999 99999999999999 99.999-999 Filling Mandatory? Observation S S S N N S N N N N N N S S N N N N N N N Messages that will be not shown on the bloqueto Attention: the capital and the lower case letters must be respected, for URL as well as from the parameter name of the post. The field indicated on the table above with Mandatory Filling “n” must be generated with a “blank” content. 6. HSBC validates if the assignor is registered and if the requisition has as the origin the assignor servants. PUBLIC - 6 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 7. HSBC obtains the assignor information, the typed line and the bar code and sets the bloqueto. 8. HSBC gives the PDF content back with the bloqueto generates for the Customer servant. 9. The assignor servant captures the PDF generated and presents it in a proper page (lodged on his servant). Observation: - The data informed by the assignor are not validated by HSBC (drawee, value, date of maturity, etc.). Therefore, it is the Customer responsibility to send them correctly. - Important: The call for the HSBC URL must be carried out internally through a connection Server-to-Server from the assignor servant to the HSBC servant. If the assignor releases the HSBC link on his own page (example: if the HSBC URL is put as “Action” from a HTML “form”), the bloqueto will not be generates, because on this case, the requisition/ connection will be leaving form the drawee IP and not from the assignor servant IP. See the following picture: 2. Assignor carries out an INTERN REQUISITION for the generation link of HSBC bloqueto 1. Carries out a requisition for a page lodged on the assignor servant DRAWEE ASSIGNOR 5. Assignor presents the bloqueto generated as if it was generated on its own servant HSBC 3. HSBC gives back with the generated bloqueto 4. Assignor captures the returned PDF and presents it on a page lodged on its own servant PUBLIC - 7 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 5. Maturity Date It is recommended that the maturity date defined by the customer must be always on the Day after the buying or more, in order to enable to the customer the payment, if he makes the buying after the time of banking expedient. 6. Document Number - Field “numberDocument” This number is unique for the bloqueto.It must be controlled by the customer and will be used on the conciliation of settled payments, because it will be sent to the Customer on the settlement return file. 7. Instructions The instruction field has the purpose of leading the cashier about the bloqueto receipt. To compose the group of messages, the customer can use as a model the standard instructions listed on the section Table of Informative Notes- note 9 from the Technical Manual – Volume I, CNAB 400 Standard. The instructions will be sent on the fields “L1”, “L2”, “L3”, “L4” e “L5” of the message. 8. Drawee Data As the bloqueto will be issued by the site, drawee data besides the name and the CPF*/CNPJ* are not mandatory. 9. RE-ISSUANCE It is suggested to the Customer to set on his site, in a accessible form to the consumer , the possibility or issuing again the banking bloqueto related to his buying, avoiding losses on the bloqueto which can become in losses of sales from the customer. The re issuance link must repeat the process of call on the HSBC site, with a new maturity date, if necessary, in order to enable the payment in any branch of any bank. 10. HSBC LOGO Occasionally it is possible to use the HSBC logo to indicate the option of payment with bloqueto. If the customer wishes to use it, He must contact the manager for orientations. PUBLIC - 8 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 11. TESTS Before setting this payment option by banking bloqueto on his site, the customer must wait for the manager signal To initiate the connection tests, in order to have the appropriate technical homologation. This procedure is indispensable to guarantee the connection quality and the bloqueto generation. It is recommended to the customer to certify that the Check list of integration (Annex I) has been verified. PUBLIC - 9 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 12. ANNEX I - Integration Check list 1 2 3 4 The connection must be mandatorily SSL (Door 443) The parameter names, principally the ServletState and the assignor code must respect the nomenclature defined on the integration document, including capital and lower case letters. The ServletState must be passed with the address (URL), and the others on the Post line. When the HSBC receives the HTTP Post request, validates if the IP of connection origin is the IP which is registered on the system, namely, the Web servant IP of the customer. It does not work if it is done a redirect or any other type of call that is directly from the customer browser for our system. (Referrer, JavaScript, etc.). (See the pictures at the end of this document) Parameters values on Post queryString must be “URLEncoded” according to the format MIME application/x-www-form-urlencoded. Example: spaces do not converted for ‘+’, special letters are converted to “%xy”, where xy is the hexadecimal code of letter, etc. Details/ Solution example The program of the store, which runs on the servant (JSP, ASP, CGI) must have a logical similar to the following: var resultHSBC=executePOSTParaURLdoHSBC(parameters,......); printOutputForCustomer(resultHSBC); On this example, the variable resultHSBC, after executed the passage, would be loaded with the HSBC URL answer. On this way, who makes the Post for HSBC is the servant of store lodging, and not the customer browser. The Post result is included dynamically, by the store system, on the page content for the customer. For example: See pictures below PUBLIC - 10 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . PUBLIC - 11 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . PUBLIC - 12 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 13. ANNEX II - Example of ASP development <%@language=VBScript%> <html> <head> <title>gera_boleto</title> <style> body { margin: 20px; font: 11px sans-serif; color: #000; } th { font: bold 11px sans-serif; color: #000; padding: 4px 10px; border-bottom: 1px solid #9E9E9E; } td { font: 11px sans-serif; color: #000; text-align: right; padding: 4px 10px; border-bottom: 1px solid #9E9E9E; } hr { border: 10px 0 20px 0; color: #9E9E9E; background-color: #9E9E9E; height: 1px; width: 100%; } #erro { font: bold 16px sans-serif; color: #F00 } .tit { font: bold 16px sans-serif; color: #000; } </style> </head> <body> <% Server.ScriptTimeout = 300 '####################################################### '### CONEXÃO MSXML2 PARA BUSCAR DADOS '####################################################### set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") on error resume next '####################################################### '### CONEXÃO PARA PASSAR PARAMETROS E RECEBER O HTML '####################################################### codigoCedente = "3752950" dataVencimento = "10/02/2008" valorDocumento = "0001043.67" numeroParcela = "01" totalParcelas = "02" numeroDocumento = "0000000000001" L1 = "Senhor(a) Caixa, favor seguir as instruções abaixo:" L2 = "1. Não receber este documento após a data de seu vencimento" L3 = "2. Valores expressos em Reais" L4 = "3. Não receber por depósito bancário" L5 = "Reader's Digest Brasil" unidadeCedente = "NOME FAKE DO BRASIL" nomeSacado = "NOME FAKE DA SILVA" cpfCnpjSacado = "12345678901234" enderecoSacado = "RUA DO CARMO" numeroSacado = "43" complementoSacado = "10 ANDAR" cepSacado = "22.222-222" bairroSacado = "CENTRO" cidadeSacado = "RIO DE JANEIRO" estadoSacado = "RJ" url = "https://wwws5.hsbc.com.br/OFB-BOL-CNR/servlets/GeraBoleto?ServletState=10" xmlhttp.open "POST", url, false xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xmlhttp.send "codigoCedente=" & codigoCedente& "&dataVencimento=" & dataVencimento & "&valorDocumento=" & valorDocumento & "&numeroParcela=" & numeroParcela& "&totalParcelas=" & totalParcelas & "&numeroDocumento=" & numeroDocumento & "&L1=" & L1 & "&L2=" & L2 & "&L3=" & L3 & "&L4=" & L4 & "&L5=" & L5 & "&unidadeCedente=" & unidadeCedente & "&nomeSacado=" & nomeSacado & "&cpfCnpjSacado=" & cpfCnpjSacado & "&enderecoSacado=" & enderecoSacado & "&numeroSacado=" & numeroSacado & "&complementoSacado=" & complementoSacado & "&cepSacado=" & cepSacado & "&bairroSacado=" & bairroSacado & "&cidadeSacado=" & cidadeSacado & "&estadoSacado=" & estadoSacado //boleto = xmlhttp.responseText //Response.Write "retorno: " & boleto Response.ContentType = "application/pdf" //To open the file in browser, define the property below as "inline" //To force file download, define the property below as "attachment" //To define the file name, define the property filename below the desired name, // in this case it is defined as BoletoHSBC.pdf but could be any file name that better // suits the customer needs //If you do not want to define a file name, just leave it blank or erase the property filename below Response.AppendHeader("content-disposition", "inline;filename=BoletoHSBC.pdf"); PUBLIC - 13 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . Response.BinaryWrite xmlhttp.responseBody set xmlhttp = nothing %> </body> </html> Observation: The example above is for the solution understanding, and not for the use exactly as it is. PUBLIC - 14 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 14. ANNEX III - Example of PHP development <?php $sock = fsockopen("ssl://wwws5.hsbc.com.br", 443, $errno, $errstr, 30); if(!$sock) die ("$errstr ($errno)\n"); $data = "ServletState=10&codigoCedente=3709590 &dataVencimento=30/08/2007&valorDocumento=1.00&numeroParcela=1&totalParcelas=1&numeroDocumento=0000000000159&L 1=Instrução1&L2=Instrução 2&L3=Instrução 3&L4=Instrução 4&L5=Instrução5&unidadeCedente=01&nomeSacado=Alexandre&cpfCnpjSacado=01848547927&enderecoSacado=Rua Cel. de tal, 397 - Apto.2&numeroSacado=&complementoSacado=&cepSacado=04.676-010&bairroSacado=Belenzinho&cidadeSacado=São Paulo&estadoSacado=SP"; $d1 = explode('&', $data); $data = ""; for($i=0;$i<sizeof($d1);$i++) { list($field, $value) = explode('=', $d1[$i]); $data .= $field . "=" . urlencode($value) . "&"; } fputs($sock, fputs($sock, fputs($sock, fputs($sock, fputs($sock, fputs($sock, fputs($sock, fputs($sock, "POST /OFB-BOL-CNR/servlets/GeraBoleto HTTPS/1.0\r\n"); "Host: wwws5.hsbc.com.br\r\n"); "Content-type: application/x-www-form-urlencoded\r\n"); "Content-length: " . strlen($data) . "\r\n"); "Accept: */*\r\n"); "\r\n"); "$data\r\n"); "\r\n"); $headers = ""; while ($str = trim(fgets($sock, 4096))) { $headers .= "$str\n"; } $body = ""; while (!feof($sock)) { $body .= fgets($sock, 4096); } fclose($sock); /** * Cabeçalho de resposta * */ //print "<!--\n" . $headers . "\n-->\n\n"; /** * Corpo do documento retornado * */ print $body; ?> Observation: The example above is for solution understanding to be developed and not for the use exactly as it is. PUBLIC - 15 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 15. ANNEX IV - Example of JSP development <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.net.URL" %> <%@page import="java.net.URLEncoder" %> <%@page import="java.net.URLConnection" %> <%@page import="java.io.OutputStreamWriter" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page import="java.io.DataInputStream"%> <html> <head> <title>JSP Form Demo</title> <style type="text/css"> label{ margin-right:20px;} input{ margin-top:5px;} </style> </head> <body> <b>Página Encontrada!</b> <% System.out.println("Preparando chamada..."); String val = request.getParameter("isSubmitted"); int isSubmitted = 0; if (val != null) { System.out.println("Preparando dados..."); isSubmitted = Integer.parseInt(val); if (isSubmitted == 1) { String codigoCedente = "3752950"; String dataVencimento = "10/02/2008"; String valorDocumento = "0001043.67"; String numeroParcela = "01"; String totalParcelas = "02"; String numeroDocumento = "0000000000001"; String L1 = "Senhor(a) Caixa, favor seguir as instruções abaixo:"; String L2 = "1. Não receber este documento após a data de seu vencimento"; String L3 = "2. Valores expressos em Reais"; String L4 = "3. Não receber por depósito bancário"; String L5 = "Reader's Digest Brasil"; String unidadeCedente = "NOME FAKE DO BRASIL"; String nomeSacado = "NOME FAKE DA SILVA"; String cpfCnpjSacado = "12345678901234"; String enderecoSacado = "RUA DO CARMO"; String numeroSacado = "43"; String complementoSacado = "10 ANDAR"; String cepSacado = "22.222-222"; String bairroSacado = "CENTRO"; String cidadeSacado = "RIO DE JANEIRO"; String estadoSacado = "RJ"; String data = URLEncoder.encode("codigoCedente", "UTF-8") + "=" + URLEncoder.encode(codigoCedente, "UTF-8"); data += "&" + URLEncoder.encode("dataVencimento", "UTF-8") + "=" + URLEncoder.encode(dataVencimento, "UTF8"); data += "&" + URLEncoder.encode("valorDocumento", "UTF-8") + "=" + URLEncoder.encode(valorDocumento, "UTF8"); data += "&" + URLEncoder.encode("numeroParcela", "UTF-8") + "=" + URLEncoder.encode(numeroParcela, "UTF-8"); data += "&" + URLEncoder.encode("totalParcelas", "UTF-8") + "=" + URLEncoder.encode(totalParcelas, "UTF-8"); data += "&" + URLEncoder.encode("numeroDocumento", "UTF-8") + "=" + URLEncoder.encode(numeroDocumento, "UTF-8"); data += "&" data += "&" data += "&" data += "&" data += "&" data += "&" + URLEncoder.encode("L1", "UTF-8") + "=" + URLEncoder.encode(L1, "UTF-8"); + URLEncoder.encode("L2", "UTF-8") + "=" + URLEncoder.encode(L2, "UTF-8"); + URLEncoder.encode("L3", "UTF-8") + "=" + URLEncoder.encode(L3, "UTF-8"); + URLEncoder.encode("L4", "UTF-8") + "=" + URLEncoder.encode(L4, "UTF-8"); + URLEncoder.encode("L5", "UTF-8") + "=" + URLEncoder.encode(L5, "UTF-8"); + URLEncoder.encode("unidadeCedente", "UTF-8") + "=" + URLEncoder.encode(unidadeCedente, "UTF- 8"); data += "&" + URLEncoder.encode("numeroDocumento", "UTF-8") + "=" + URLEncoder.encode(numeroDocumento, "UTF-8"); PUBLIC - 16 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . data += "&" + URLEncoder.encode("nomeSacado", "UTF-8") + "=" + URLEncoder.encode(nomeSacado, "UTF-8"); data += "&" + URLEncoder.encode("cpfCnpjSacado", "UTF-8") + "=" + URLEncoder.encode(cpfCnpjSacado, "UTF-8"); data += "&" + URLEncoder.encode("enderecoSacado", "UTF-8") + "=" + URLEncoder.encode(enderecoSacado, "UTF8"); data += "&" + URLEncoder.encode("numeroSacado", "UTF-8") + "=" + URLEncoder.encode(numeroSacado, "UTF-8"); data += "&" + URLEncoder.encode("complementoSacado", "UTF-8") + "=" + URLEncoder.encode(complementoSacado, "UTF-8"); data += "&" + URLEncoder.encode("cepSacado", "UTF-8") + "=" + URLEncoder.encode(cepSacado, "UTF-8"); data += "&" + URLEncoder.encode("bairroSacado", "UTF-8") + "=" + URLEncoder.encode(bairroSacado, "UTF-8"); data += "&" + URLEncoder.encode("cidadeSacado", "UTF-8") + "=" + URLEncoder.encode(cidadeSacado, "UTF-8"); data += "&" + URLEncoder.encode("estadoSacado", "UTF-8") + "=" + URLEncoder.encode(estadoSacado, "UTF-8"); // Enviado Dados para a emissão do boleto System.out.println("Montando URL de conexão..."); URL url = new URL("https://wwws5.hsbc.com.br/OFB-BOL-CNR/servlets/GeraBoleto?ServletState=10"); // Montando a conexão com o Servidor URLConnection conn = url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); DataInputStream input; System.out.println("Enviando dados..."); wr.write(data); wr.flush(); // Get response data. System.out.println("Retorno da chamada ..."); input = new DataInputStream (conn.getInputStream ()); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(response.getOutputStream()); int bytesRead = 0; byte[] buffer = new byte[1024]; response.setContentLength(connection.getContentLength()); response.setContentType("application/pdf"); //To open the file in browser, define the property below as "inline" //To force file download, define the property below as "attachment" //To define the file name, define the property filename below the desired name, // in this case it is defined as BoletoHSBC.pdf but could be any file name that better // suits the customer needs //If you do not want to define a file name, just leave it blank or erase the property filename below response.setHeader("Content-Disposition", "inline; filename=BoletoHSBC.pdf"); response.setHeader("Cache-Control", "cache, must-revalidate"); response.setHeader("Pragma", "public"); while ((bytesRead = bufferedInputStream.read(buffer)) != -1) { bufferedOutputStream.write(buffer, 0, bytesRead); } bufferedOutputStream.flush(); input.close (); } } %> </body> </html> Observation: The example above is for solution understanding to be developed and not for the use exactly as it is. PUBLIC - 17 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 16. ANNEX V - Example ASP.NET/C# development using using using using using using System; System.Collections.Generic; System.Linq; System.Web; System.Web.UI; System.Web.UI.WebControls; namespace TesteWeb { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { if (txtTeste.Text != "") { string url = "https://wwws5.hsbc.com.br/OFB-BOL-CNR/servlets/GeraBoleto?ServletState=10"; chamaURL(url); } } private void chamaURL(string url) { String codigoCedente = "3752950"; String dataVencimento = "10/02/2008"; String valorDocumento = "0001043.67"; String numeroParcela = "01"; String totalParcelas = "02"; String numeroDocumento = "0000000000001"; String L1 = "Senhor(a) Caixa, favor seguir as instruções abaixo:"; String L2 = "1. Não receber este documento após a data de seu vencimento"; String L3 = "2. Valores expressos em Reais"; String L4 = "3. Não receber por depósito bancário"; String L5 = "Reader's Digest Brasil"; String unidadeCedente = "NOME FAKE DO BRASIL"; String nomeSacado = "NOME FAKE DA SILVA"; String cpfCnpjSacado = "12345678901234"; String enderecoSacado = "RUA DO CARMO"; String numeroSacado = "43"; String complementoSacado = "10 ANDAR"; String cepSacado = "22.222-222"; String bairroSacado = "CENTRO"; String cidadeSacado = "RIO DE JANEIRO"; String estadoSacado = "RJ"; String data = "codigoCedente" + "=" + codigoCedente ; data += "&" + "dataVencimento" + "=" + dataVencimento; data += "&" + "valorDocumento" + "=" + valorDocumento; data += "&" + "numeroParcela" + "=" + numeroParcela; data += "&" + "totalParcelas" + "=" + totalParcelas; data += "&" + "numeroDocumento" + "=" + numeroDocumento; data += "&" + "L1" + "=" + L1; data += "&" + "L2" + "=" + L2; data += "&" + "L3" + "=" + L3; data += "&" + "L4" + "=" + L4; data += "&" + "L5" + "=" + L5; data += "&" + "unidadeCedente" + "=" + unidadeCedente; data += "&" + "numeroDocumento" + "=" + numeroDocumento; data += "&" + "nomeSacado" + "=" + nomeSacado; data += "&" + "cpfCnpjSacado" + "=" + cpfCnpjSacado; data += "&" + "enderecoSacado" + "=" + enderecoSacado; data += "&" + "numeroSacado" + "=" + numeroSacado; PUBLIC - 18 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . data += "&" data += "&" data += "&" data += "&" data += "&" + "complementoSacado" + "=" + complementoSacado; + "cepSacado" + "=" + cepSacado; + "bairroSacado" + "=" + bairroSacado; + "cidadeSacado" + "=" + cidadeSacado; + "estadoSacado" + "=" + estadoSacado; Encoding encoding = Encoding.ASCII; byte[] dados = encoding.GetBytes(data); // Prepara chamada HttpWebRequest oRequest = (HttpWebRequest)WebRequest.Create(url); oRequest.Method = "POST"; oRequest.ContentType = "application/x-www-form-urlencoded"; oRequest.ContentLength = dados.Length; Stream oReqStream = oRequest.GetRequestStream(); //Envia os dados oReqStream.Write(dados, 0, dados.Length); oReqStream.Close(); //Recupera resposta HttpWebResponse oResponse = (HttpWebResponse)oRequest.GetResponse(); Stream oRespStream = oResponse.GetResponseStream(); int buffer = 1024; byte[] dataBuffer = new byte[buffer]; int count = 0; MemoryStream ms = new MemoryStream(); while ((count = oRespStream.Read(dataBuffer, 0, buffer)) > 0) { ms.Write(dataBuffer, 0, count); } oRespStream.Close(); Response.AddHeader("Content-Type", "application/pdf"); //To open the file in browser, define the property below as "inline" //To force file download, define the property below as "attachment" //To define the file name, define the property filename below the desired name, // in this case it is defined as BoletoHSBC.pdf but could be any file name that better // suits the customer needs //If you do not want to define a file name, just leave it blank or erase the property filename below Response.AddHeader("Content-Disposition", "inline; filename=BoletoHSBC.pdf;"); Response.AddHeader("Content-Length", ms.Length.ToString()); Response.BinaryWrite(ms.ToArray()); Response.Flush(); Response.End(); } } } Observation: The example above is for solution understanding to be developed and not for the use exactly as it is. PUBLIC - 19 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. . 17. GLOSSARY Bloqueto: bar-coded bills that are issued by the seller to the buyer of goods or services which can be paid electronically, via Internet banking, ATM or at bank branches with cash, card or check. Bloquetos contain all relevant invoice information and may be issued electronically or in a paper-based format and delivered via the postal service or private couriers. CPF: Cadastro de Pessoa Física – Tax Roll of Natural Person. CNPJ: Cadastro Nacional de Pessoa Jurídica – National Directoru of Legal Entities. PUBLIC - 20 Gateway of Payments HSBC – Jul/2014 © Copyright HSBC Bank Brazil S.A. - Banco Múltiplo - All rights reserved. .