mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Serialize default card auth and presence for Customers
This commit is contained in:
committed by
Maikel Linke
parent
21c24eb69b
commit
a03dd1e10c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user