Serialize default card auth and presence for Customers

This commit is contained in:
Rob Harrington
2018-05-09 11:37:23 +10:00
committed by Maikel Linke
parent 21c24eb69b
commit a03dd1e10c

View File

@@ -1,5 +1,6 @@
class Api::Admin::CustomerSerializer < ActiveModel::Serializer
attributes :id, :email, :enterprise_id, :user_id, :code, :tags, :tag_list, :name
attributes :allow_charges, :default_card_present?
has_one :ship_address, serializer: Api::AddressSerializer
has_one :bill_address, serializer: Api::AddressSerializer
@@ -18,4 +19,9 @@ class Api::Admin::CustomerSerializer < ActiveModel::Serializer
tag_rule_map || { text: tag, rules: nil }
end
end
def default_card_present?
return unless object.user
object.user.default_card.present?
end
end