Skip to content

Commit

Permalink
added address struct
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantiago2719 committed Apr 7, 2023
1 parent 736c403 commit 34b8cad
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions payment-vault/src/payment.rs
Expand Up @@ -15,6 +15,30 @@ struct Card {
pub card: CardDetails,
}

#[derive(Debug)]
pub enum ShippingType {
ST,
SD,
}

#[derive(Debug, Serialize)]
#[allow(non_snake_case)]
pub struct Address<T = ShippingType> {
pub line1: Option<String>,
pub line2: Option<String>,
pub city: Option<String>,
pub state: Option<String>,
pub zipCode: Option<String>,
// ISO 3166 aplha-2 notion of the country
pub countryCode: String,
pub firstName: Option<String>,
pub middleName: Option<String>,
pub lastName: Option<String>,
pub phone: Option<String>,
pub email: Option<String>,
pub shippingType: T,
}

#[async_trait]
pub trait PaymentGateway {
/// Returns a response that contains the paymentTokenId to be use for furhter transaction
Expand All @@ -28,6 +52,12 @@ pub trait PaymentGateway {
async fn create_payment(&self) -> Result<Response, Box<dyn std::error::Error>>;
}

impl Address {
fn new(&self) -> Self {
todo!()
}
}

/// Implement the PaymentGateway trait to MayaClient
#[async_trait]
impl PaymentGateway for MayaClient {
Expand Down

0 comments on commit 34b8cad

Please sign in to comment.