Skip to content

Commit

Permalink
Added test code and data, added pf struct
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantiago2719 committed Aug 15, 2023
1 parent aebe2ba commit d096608
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
26 changes: 23 additions & 3 deletions payment-vault/src/payment.rs
Expand Up @@ -52,9 +52,9 @@ pub struct Buyer<T = Sex> {

#[derive(Debug, Serialize)]
pub struct RedirectUrl {
pub success: Option<String>,
pub failure: Option<String>,
pub cancel: Option<String>,
pub success: String,
pub failure: String,
pub cancel: String,
}

#[derive(Debug, Serialize)]
Expand Down Expand Up @@ -95,10 +95,30 @@ pub struct TotalAmount {
pub currency: String,
}

#[derive(Debug, Serialize)]
#[allow(non_snake_case)]
pub struct PaymentFacilitator {
pub smi: String,
pub smn: String,
pub mci: String,
pub mpc: String,
pub mco: String,
}

#[derive(Debug, Serialize)]
#[allow(non_snake_case)]
pub struct MetaData {
pub subMerchantRequestReferenceNumber: String,
pub pf: PaymentFacilitator,
}

#[derive(Debug, Serialize)]
#[allow(non_snake_case)]
pub struct Payment {
paymentTokenId: String,
pub totalAmount: TotalAmount,
pub buyer: Buyer,
pub redirectUrl: RedirectUrl,
pub requestReferenceNumber: String,
pub metadata: Option<MetaData>,
}
15 changes: 13 additions & 2 deletions payment-vault/tests/payment_gateway/payment_token.rs
Expand Up @@ -58,15 +58,26 @@ mod test_payment_token {
lastName: "Doe".to_string(),
middleName: "".to_string(),
email: "john.doe@example.com".to_string(),
phone: "12345567889".to_string(),
phone: "+63(2)1234567890".to_string(),
shippingType: ShippingType::ST,
};

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

let _redirect_url: RedirectUrl = RedirectUrl {
success: "https://www.merchantsite.com/success".to_string(),
failure: "https://www.merchantsite.com/failure".to_string(),
cancel: "https://www.merchantsite.com/cancel".to_string(),
};

let _total_amount: TotalAmount = TotalAmount {
amount: "100".to_string(),
currency: "PHP".to_string(),
};

let _buyer_user: Buyer = Buyer {
billingAddress: billing_address,
shippingAddress: shipping_address,
Expand Down

0 comments on commit d096608

Please sign in to comment.