Upstream sync

This commit is contained in:
Senad Uka
2018-05-16 18:30:59 +02:00
parent 4852a5586c
commit 2e5444bed8
11 changed files with 2370 additions and 18 deletions

View File

@@ -1,6 +1,10 @@
package eligibilityroute
import (
"encoding/xml"
"fmt"
"html"
"strings"
"sync"
"bitbucket.org/nemt/nemt-portal-api/application/applicationservice"
@@ -42,8 +46,22 @@ func (c *controller) handleEligibility(ctx echo.Context) error {
ret, err := c.bcbsi.BXE.CheckEligibility(eligibility)
if err != nil {
fmt.Println("Error Here: ", err.Error())
return routeutils.HandleAPIError(ctx, err)
}
return routeutils.ResponseAPIOK(ctx, ret)
if ret.QueryResult.HIPPA271.T271 != "" {
xmlString := html.UnescapeString(ret.QueryResult.HIPPA271.T271)
xmlReader := strings.NewReader(xmlString)
var f viewmodel.Interchange271
err = xml.NewDecoder(xmlReader).Decode(&f)
if err != nil {
fmt.Println("Error to unmarshal: ", err.Error())
}
return ctx.JSON(200, f)
} else {
return routeutils.ResponseAPIOK(ctx, ret)
}
}