github.com/mundipagg/boleto-api@v0.0.0-20230620145841-3f9ec742599f/pefisa/response.go (about)

     1  package pefisa
     2  
     3  const registerBoletoResponsePefisa = `
     4  {
     5      {{if (hasErrorTags . "errorCode") | (hasErrorTags . "errorMessage")}}
     6          "Errors": [
     7              {
     8                  "Code": "{{trim .errorCode}}",
     9                  "Message": "{{trim .errorMessage}}"
    10              }
    11          ]
    12      {{else}}
    13  	    "DigitableLine": "{{fmtDigitableLine (replace (replace .digitableLine "." "") " " "") }}",
    14  	    "BarCodeNumber": "{{trim .barCodeNumber}}"
    15      {{end}}
    16  }
    17  `
    18  
    19  const boletoResponsePefisa = `
    20  {
    21  	"data": {
    22          "codigoBarras": "{{barCodeNumber}}",
    23  		"linhaDigitavel": "{{digitableLine}}"
    24      }
    25  }
    26  `
    27  
    28  const boletoResponseErrorPefisaArray = `
    29  {
    30  	"code": "{{errorCode}}",
    31  	"message": "{{errorMessage}}"
    32  }
    33  `
    34  
    35  const boletoResponseErrorPefisa = `
    36  {
    37  	"error": "{{errorCode}}",
    38  	"error_description": "{{errorMessage}}"
    39  }
    40  `
    41  
    42  func getResponsePefisa() string {
    43  	return boletoResponsePefisa
    44  }
    45  
    46  func getAPIResponsePefisa() string {
    47  	return registerBoletoResponsePefisa
    48  }
    49  
    50  func getResponseErrorPefisaArray() string {
    51  	return boletoResponseErrorPefisaArray
    52  }
    53  
    54  func getResponseErrorPefisa() string {
    55  	return boletoResponseErrorPefisa
    56  }