diff --git a/app/models/provider.rb b/app/models/provider.rb index af4c6080b..7e0654468 100644 --- a/app/models/provider.rb +++ b/app/models/provider.rb @@ -137,7 +137,12 @@ def as_indexed_json(options={}) "joined" => joined, "twitter_handle" => twitter_handle, "ror_id" => ror_id, - "billing_information" => billing_information, + "billing_information" => { + "address" => address, + "postCode" => post_code, + "state" => state, + "city" => city + }, "created" => created, "updated" => updated, "deleted_at" => deleted_at, diff --git a/app/serializers/provider_serializer.rb b/app/serializers/provider_serializer.rb index 542fb6f86..6c06e55a9 100644 --- a/app/serializers/provider_serializer.rb +++ b/app/serializers/provider_serializer.rb @@ -22,7 +22,7 @@ class ProviderSerializer end attribute :billing_information, if: Proc.new { |object, params| params[:current_ability] && params[:current_ability].can?(:read_billing_information, object) == true } do |object| - object.billing_information.transform_keys!{ |key| key.to_s.camelcase(:lower) } if object.billing_information.present? + object.billing_information.present? ? object.billing_information.transform_keys!{ |key| key.to_s.camelcase(:lower) } : {} end attribute :twitter_handle, if: Proc.new { |object, params| params[:current_ability] && params[:current_ability].can?(:read_billing_information, object) == true } do |object|