only return gateway payment info if set on customer

This commit is contained in:
Andy Brett
2020-12-05 07:20:26 -08:00
parent eddf8da107
commit d55343da1a

View File

@@ -1,6 +1,14 @@
module Api
class CustomerSerializer < ActiveModel::Serializer
attributes :id, :enterprise_id, :name, :code, :email, :allow_charges,
:gateway_recurring_payment_client_secret, :gateway_shop_id
attributes :id, :enterprise_id, :name, :code, :email, :allow_charges
def attributes
hash = super
if secret = object.gateway_recurring_payment_client_secret
hash.merge!(gateway_recurring_payment_client_secret: secret)
end
hash.merge!(gateway_shop_id: object.gateway_shop_id) if object.gateway_shop_id
hash
end
end
end