fix(loyalty): admin/store/merchant card detail return phone + birthday

The shared card-detail-view template already renders
card.customer_phone and card.customer_birthday, but CardDetailResponse
was missing both fields, so every consumer (admin, store, merchant)
silently returned them as undefined and the UI showed "-".

Added the two fields to the schema and populated them from
customer.phone / customer.birth_date in all three endpoints. Data was
persisting correctly all along — purely a serialization gap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 19:45:25 +02:00
parent bdb613581c
commit caf1361291
4 changed files with 8 additions and 0 deletions

View File

@@ -381,6 +381,8 @@ def get_merchant_card(
enrolled_at_store_id=card.enrolled_at_store_id,
customer_name=customer.full_name if customer else None,
customer_email=customer.email if customer else None,
customer_phone=customer.phone if customer else None,
customer_birthday=customer.birth_date if customer else None,
merchant_name=card.merchant.name if card.merchant else None,
qr_code_data=card.qr_code_data or card.card_number,
program_name=program.display_name,

View File

@@ -228,6 +228,8 @@ def get_card_detail(
enrolled_at_store_id=card.enrolled_at_store_id,
customer_name=customer.full_name if customer else None,
customer_email=customer.email if customer else None,
customer_phone=customer.phone if customer else None,
customer_birthday=customer.birth_date if customer else None,
merchant_name=card.merchant.name if card.merchant else None,
qr_code_data=card.qr_code_data or card.card_number,
program_name=program.display_name,

View File

@@ -656,6 +656,8 @@ def get_card_detail(
enrolled_at_store_name=enrolled_store_name,
customer_name=customer.full_name if customer else None,
customer_email=customer.email if customer else None,
customer_phone=customer.phone if customer else None,
customer_birthday=customer.birth_date if customer else None,
merchant_name=card.merchant.name if card.merchant else None,
qr_code_data=card.qr_code_data or card.card_number,
program_name=program.display_name,

View File

@@ -97,6 +97,8 @@ class CardDetailResponse(CardResponse):
# Customer info
customer_name: str | None = None
customer_email: str | None = None
customer_phone: str | None = None
customer_birthday: date | None = None
# Merchant info
merchant_name: str | None = None