feat(loyalty): push a locked PIN through FCM
A customer whose PIN locks after five wrong attempts is now told by a push through FCM instead of WhatsApp (docs/prd-point-coin.md F11), to every device registered at /customer/devices. The push is titled "PIN terkunci", says until when it is locked, and carries type PIN_LOCKED and locked_until in its data so the app can offer the PIN reset. As before, only the attempt that reached the limit sends it, and a failure to send is logged without affecting the lock. OtpProcessor.SendWhatsAppMessage was only there for this alert and is removed; OTPs still go out by WhatsApp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bf9651e221
commit
4432f0a10d
@@ -18,8 +18,6 @@ type OtpProcessor interface {
|
||||
CreateOtpSession(ctx context.Context, phoneNumber string, purpose string) (*entities.OtpSession, error)
|
||||
ResendOtpSession(ctx context.Context, phoneNumber string, purpose string) (*entities.OtpSession, error)
|
||||
SendOtpViaWhatsApp(phoneNumber string, otpCode string, purpose string) error
|
||||
// SendWhatsAppMessage sends any message to a customer number, formatted like OTPs.
|
||||
SendWhatsAppMessage(phoneNumber string, message string) error
|
||||
ValidateOtpCode(code string) bool
|
||||
ValidateOtpSession(ctx context.Context, token string, code string) (*entities.OtpSession, error)
|
||||
InvalidateOtpSession(ctx context.Context, token string) error
|
||||
@@ -242,10 +240,3 @@ func (p *otpProcessor) formatPhoneNumber(phoneNumber string) string {
|
||||
|
||||
return digits
|
||||
}
|
||||
|
||||
func (p *otpProcessor) SendWhatsAppMessage(phoneNumber string, message string) error {
|
||||
if err := p.fonnteClient.SendWhatsAppMessage(p.formatPhoneNumber(phoneNumber), message); err != nil {
|
||||
return fmt.Errorf("failed to send WhatsApp message: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user