refactor: use newtype pattern for email addresses (#819)

Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
Nachiket Kanore
2023-05-04 19:28:20 +05:30
committed by GitHub
parent 92ae2d92f1
commit b8e2b1c5f4
30 changed files with 211 additions and 145 deletions

View File

@ -155,7 +155,7 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
pub trait PaymentsAuthorizeRequestData {
fn is_auto_capture(&self) -> Result<bool, Error>;
fn get_email(&self) -> Result<Secret<String, Email>, Error>;
fn get_email(&self) -> Result<Email, Error>;
fn get_browser_info(&self) -> Result<types::BrowserInformation, Error>;
fn get_order_details(&self) -> Result<OrderDetails, Error>;
fn get_card(&self) -> Result<api::Card, Error>;
@ -174,7 +174,7 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()),
}
}
fn get_email(&self) -> Result<Secret<String, Email>, Error> {
fn get_email(&self) -> Result<Email, Error> {
self.email.clone().ok_or_else(missing_field_err("email"))
}
fn get_browser_info(&self) -> Result<types::BrowserInformation, Error> {