From 7a764c5cfece08cc2df9fa85f356ea079eef6eb7 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Wed, 9 Nov 2022 10:07:28 +0100 Subject: [PATCH] chore: update deps and use dotenvy instead of dotenv --- Cargo.toml | 12 ++++++------ README.md | 2 +- examples/invoice.rs | 2 +- src/api/invoice.rs | 2 +- src/client.rs | 2 +- src/data/orders.rs | 6 +++--- src/endpoint.rs | 1 - src/lib.rs | 4 ++-- tests/auth_tests.rs | 8 ++++++-- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3783785..32529e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "paypal-rs" -version = "0.2.3" +version = "0.2.4" authors = ["Edgar "] description = "A library that wraps the paypal api asynchronously." repository = "https://github.com/edg-l/paypal-rs/" @@ -14,12 +14,12 @@ edition = "2021" [dependencies] reqwest = { version = "0.11.12", default-features = false, features = ["json"] } -serde = { version = "1.0.145", features = ["derive"] } -serde_json = "1.0.85" +serde = { version = "1.0.147", features = ["derive"] } +serde_json = "1.0.87" serde_with = "2.0.1" chrono = { version = "0.4.22", features = ["serde"] } jsonwebtoken = "8.1.1" -base64 = "0.13.0" +base64 = "0.13.1" log = "0.4.17" bytes = "1.2.1" derive_builder = "0.11.2" @@ -27,9 +27,9 @@ serde_qs = "0.10.1" [dev-dependencies] tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] } -dotenv = "0.15.0" +dotenvy = "0.15.6" color-eyre = "0.6.2" -wiremock = "0.5.14" +wiremock = "0.5.15" [features] default = ["reqwest/native-tls"] diff --git a/README.md b/README.md index 66a7c78..607ee8f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ use paypal_rs::{ #[tokio::main] async fn main() { - dotenv::dotenv().ok(); + dotenvy::dotenv().ok(); let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); let secret = std::env::var("PAYPAL_SECRET").unwrap(); diff --git a/examples/invoice.rs b/examples/invoice.rs index 1867065..aa09b0e 100644 --- a/examples/invoice.rs +++ b/examples/invoice.rs @@ -6,7 +6,7 @@ use paypal_rs::{data::common::Currency, Client}; #[tokio::main] async fn main() -> Result<()> { color_eyre::install()?; - dotenv::dotenv().ok(); + dotenvy::dotenv().ok(); let clientid = std::env::var("PAYPAL_CLIENTID")?; let secret = std::env::var("PAYPAL_SECRET")?; diff --git a/src/api/invoice.rs b/src/api/invoice.rs index b24960b..68d704e 100644 --- a/src/api/invoice.rs +++ b/src/api/invoice.rs @@ -397,7 +397,7 @@ mod tests { use crate::Client; async fn create_client() -> Client { - dotenv::dotenv().ok(); + dotenvy::dotenv().ok(); let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); let secret = std::env::var("PAYPAL_SECRET").unwrap(); diff --git a/src/client.rs b/src/client.rs index ebe19bd..9a77f04 100644 --- a/src/client.rs +++ b/src/client.rs @@ -92,7 +92,7 @@ impl Client { /// /// #[tokio::main] /// async fn main() { - /// # dotenv::dotenv().ok(); + /// # dotenvy::dotenv().ok(); /// let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); /// let secret = std::env::var("PAYPAL_SECRET").unwrap(); /// diff --git a/src/data/orders.rs b/src/data/orders.rs index e8bacbe..598364b 100644 --- a/src/data/orders.rs +++ b/src/data/orders.rs @@ -1,6 +1,6 @@ //! Paypal object definitions used by the orders api. -use super::{common::*, invoice::BillingInfo}; +use super::common::*; use derive_builder::Builder; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; @@ -669,7 +669,7 @@ pub struct PaymentCard { /// The card owner name. pub name: String, /// The billing address. - pub billing_address: Address + pub billing_address: Address, } /// A transaction reference. @@ -695,7 +695,7 @@ pub struct StoredCredential { /// The stored credential usage, e.g: SUBSEQUENT pub usage: String, /// The billing address. - pub previous_network_transaction_reference: TransactionReference + pub previous_network_transaction_reference: TransactionReference, } /// A order payload to be used when creating an order. diff --git a/src/endpoint.rs b/src/endpoint.rs index 6e57124..3ff8560 100644 --- a/src/endpoint.rs +++ b/src/endpoint.rs @@ -1,6 +1,5 @@ //! This module contains the endpoint trait used to implemented api endpoints. -use crate::{LIVE_ENDPOINT, SANDBOX_ENDPOINT, PaypalEnv}; use serde::{de::DeserializeOwned, Serialize}; use std::borrow::Cow; diff --git a/src/lib.rs b/src/lib.rs index 4ec0544..37b645a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,7 +24,7 @@ //! //! #[tokio::main] //! async fn main() { -//! dotenv::dotenv().ok(); +//! dotenvy::dotenv().ok(); //! let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); //! let secret = std::env::var("PAYPAL_SECRET").unwrap(); //! @@ -180,7 +180,7 @@ mod tests { use std::str::FromStr; pub async fn create_client() -> Client { - dotenv::dotenv().ok(); + dotenvy::dotenv().ok(); let clientid = env::var("PAYPAL_CLIENTID").unwrap(); let secret = env::var("PAYPAL_SECRET").unwrap(); diff --git a/tests/auth_tests.rs b/tests/auth_tests.rs index 5e2cab3..98ef155 100644 --- a/tests/auth_tests.rs +++ b/tests/auth_tests.rs @@ -8,13 +8,17 @@ use wiremock::{ }; fn create_client(url: &str) -> Client { - Client::new("clientid".to_string(), "secret".to_string(), PaypalEnv::Mock(url.to_string())) + Client::new( + "clientid".to_string(), + "secret".to_string(), + PaypalEnv::Mock(url.to_string()), + ) } #[tokio::test] async fn test_auth() -> color_eyre::Result<()> { color_eyre::install()?; - + let mock_server = MockServer::start().await; let access_token: serde_json::Value = serde_json::from_str(include_str!("resources/oauth_token.json")).unwrap();