Skip to content

Commit

Permalink
refactor(notifications): add wording for renamed verification events
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Feb 13, 2024
1 parent 43ddef0 commit a24a5c9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 18 deletions.
12 changes: 10 additions & 2 deletions core/notifications/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@ circle_threshold_reached.inner.body: "You have welcomed %{threshold} people to B
circle_threshold_reached.outer.title: "Outer Circle gains 💪"
circle_threshold_reached.outer.body: "Your Outer Circle reached %{threshold} people. You are driving Bitcoin adoption!"

documents_submitted.title: "Documents Received"
documents_submitted.body: "The documents for your verification are being processed."
identity_verification_approved.title: "Your Identity has been verified!"
identity_verification_approved.body: "The documents for your verification have been processed."

identity_verification_declined.reason.documents_not_clear: "the uploaded documents were not clear"
identity_verification_declined.reason.photo_not_clear: "the picture you submitted was not clear"
identity_verification_declined.title: "Your Identity could not be verified!"
identity_verification_declined.body: "We were not able to process your documents because ${reason}."

identity_verification_review_pending.title: "Your verification is in process!"
identity_verification_review_pending.body: "We have received your documents and are processing them."
12 changes: 6 additions & 6 deletions core/notifications/src/grpc/server/convert.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::proto;
use crate::app::error::ApplicationError;
use crate::primitives::*;
use crate::user_notification_settings;
use crate::{
app::error::ApplicationError, notification_event, primitives::*, user_notification_settings,
};

impl From<proto::NotificationCategory> for UserNotificationCategory {
fn from(category: proto::NotificationCategory) -> Self {
Expand Down Expand Up @@ -82,14 +82,14 @@ impl From<proto::CircleTimeFrame> for CircleTimeFrame {
}
}

impl From<proto::DeclinedReason> for IdentityVerificationDeclinedReason {
impl From<proto::DeclinedReason> for notification_event::IdentityVerificationDeclinedReason {
fn from(reason: proto::DeclinedReason) -> Self {
match reason {
proto::DeclinedReason::DocumentsNotClear => {
IdentityVerificationDeclinedReason::DocumentsNotClear
notification_event::IdentityVerificationDeclinedReason::DocumentsNotClear
}
proto::DeclinedReason::VerificationPhotoNotClear => {
IdentityVerificationDeclinedReason::VerificationPhotoNotClear
notification_event::IdentityVerificationDeclinedReason::VerificationPhotoNotClear
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/notifications/src/grpc/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl NotificationsService for Notifications {
)),
}) => {
let declined_reason = proto::DeclinedReason::try_from(declined_reason)
.map(primitives::IdentityVerificationDeclinedReason::from)
.map(notification_event::IdentityVerificationDeclinedReason::from)
.map_err(|e| Status::invalid_argument(e.to_string()))?;
self.app
.handle_notification_event(notification_event::IdentityVerificationDeclined {
Expand Down
31 changes: 28 additions & 3 deletions core/notifications/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,37 @@ impl Messages {
let body = t!("identity_verification_approved.body", locale = locale).to_string();
LocalizedMessage { title, body }
}

pub fn identity_verification_declined(
locale: &str,
_event: &IdentityVerificationDeclined,
event: &IdentityVerificationDeclined,
) -> LocalizedMessage {
let title = t!("identity_verification_declined.title", locale = locale).to_string();
let body = t!("identity_verification_declined.body", locale = locale).to_string();
let reason = match event.declined_reason {
IdentityVerificationDeclinedReason::DocumentsNotClear => {
t!(
"identity_verification_declined.reason.documents_not_clear",
locale = locale
)
}
IdentityVerificationDeclinedReason::VerificationPhotoNotClear => {
t!(
"identity_verification_declined.reason.photo_not_clear",
locale = locale
)
}
};
let title = t!(
"identity_verification_declined.title",
locale = locale,
reason = reason
)
.to_string();
let body = t!(
"identity_verification_declined.body",
locale = locale,
reason = reason
)
.to_string();
LocalizedMessage { title, body }
}

Expand Down
6 changes: 6 additions & 0 deletions core/notifications/src/notification_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ impl From<IdentityVerificationApproved> for NotificationEventPayload {
}
}

#[derive(Debug, Serialize, Deserialize)]
pub enum IdentityVerificationDeclinedReason {
DocumentsNotClear,
VerificationPhotoNotClear,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct IdentityVerificationDeclined {
pub user_id: GaloyUserId,
Expand Down
6 changes: 0 additions & 6 deletions core/notifications/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,3 @@ impl std::fmt::Display for CircleTimeFrame {
}
}
}

#[derive(Debug, Serialize, Deserialize)]
pub enum IdentityVerificationDeclinedReason {
DocumentsNotClear,
VerificationPhotoNotClear,
}

0 comments on commit a24a5c9

Please sign in to comment.