From 9d25ab0199e8d08751fd72af2d75653f72d6ee23 Mon Sep 17 00:00:00 2001 From: Evgeny Levenets Date: Fri, 26 May 2017 18:49:23 +0300 Subject: [PATCH] CAPI-142: fixed decoding optional fields (#62) * makefile fixed --- Makefile | 2 +- apps/capi/src/capi_real_handler.erl | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 694e759..eaf1991 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ start: submodules devrel: submodules $(REBAR) release -release: distclean generate +release: submodules distclean generate $(REBAR) as prod release clean: diff --git a/apps/capi/src/capi_real_handler.erl b/apps/capi/src/capi_real_handler.erl index aa9eaf7..3c20bdd 100644 --- a/apps/capi/src/capi_real_handler.erl +++ b/apps/capi/src/capi_real_handler.erl @@ -1540,7 +1540,10 @@ decode_context(#'Content'{ data = InvoiceContext }) -> % @TODO deal with non json contexts - jsx:decode(InvoiceContext, [return_maps]). + jsx:decode(InvoiceContext, [return_maps]); + +decode_context(undefined) -> + undefined. decode_party(#domain_Party{ id = PartyID, @@ -2028,7 +2031,10 @@ decode_geo_location_info(#geo_ip_LocationInfo{ #{ <<"cityGeoID">> => CityID, <<"countryGeoID">> => CountryID - }. + }; + +decode_geo_location_info(undefined) -> + undefined. decode_location_name(GeoID, Name) -> #{