Skip to content

Commit

Permalink
added buyer details
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantiago2719 committed Aug 15, 2023
1 parent 48dd0af commit aebe2ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions payment-vault/src/payment.rs
Expand Up @@ -24,8 +24,8 @@ pub enum ShippingType {

#[derive(Debug, Serialize)]
pub struct ContactDetails {
pub phone: Option<String>,
pub email: Option<String>,
pub phone: String,
pub email: String,
}

#[derive(Debug, Serialize)]
Expand All @@ -38,7 +38,7 @@ pub enum Sex {
#[allow(non_snake_case)]
pub struct Buyer<T = Sex> {
pub firstName: String,
pub middleName: Option<String>,
pub middleName: String,
pub lastName: String,
pub birthday: String,
// Birthday in ISO 8601 / RFC 3339 full-date format.
Expand Down
22 changes: 19 additions & 3 deletions payment-vault/tests/payment_gateway/payment_token.rs
Expand Up @@ -39,16 +39,15 @@ mod test_payment_token {

#[tokio::test]
async fn create_payment() {
let _billing_address = BillingAddress {
let billing_address = BillingAddress {
line1: "Street 123".to_string(),
line2: "Brgy. Poblacion".to_string(),
city: "Mandaluyong".to_string(),
state: "Philippines".to_string(),
zipCode: "2313".to_string(),
countryCode: "PH".to_string(),
};

let _shipping_address: ShippingAddress = ShippingAddress {
let shipping_address: ShippingAddress = ShippingAddress {
line1: "Street 123".to_string(),
line2: "Brgy. Poblacion".to_string(),
city: "Mandaluyong".to_string(),
Expand All @@ -62,5 +61,22 @@ mod test_payment_token {
phone: "12345567889".to_string(),
shippingType: ShippingType::ST,
};

let contact: ContactDetails = ContactDetails {
phone: "+639951234567".to_string(),
email: "sample@google.com".to_string(),
};

let _buyer_user: Buyer = Buyer {
billingAddress: billing_address,
shippingAddress: shipping_address,
firstName: "John".to_string(),
lastName: "Doe".to_string(),
middleName: "".to_string(),
birthday: "".to_string(),
customerSince: "".to_string(),
contact: contact,
sex: Sex::M,
};
}
}

0 comments on commit aebe2ba

Please sign in to comment.