chore: update deps and use dotenvy instead of dotenv

This commit is contained in:
Edgar 2022-11-09 10:07:28 +01:00
parent 557113084b
commit 7a764c5cfe
9 changed files with 21 additions and 18 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "paypal-rs" name = "paypal-rs"
version = "0.2.3" version = "0.2.4"
authors = ["Edgar <git@edgarluque.com>"] authors = ["Edgar <git@edgarluque.com>"]
description = "A library that wraps the paypal api asynchronously." description = "A library that wraps the paypal api asynchronously."
repository = "https://github.com/edg-l/paypal-rs/" repository = "https://github.com/edg-l/paypal-rs/"
@ -14,12 +14,12 @@ edition = "2021"
[dependencies] [dependencies]
reqwest = { version = "0.11.12", default-features = false, features = ["json"] } reqwest = { version = "0.11.12", default-features = false, features = ["json"] }
serde = { version = "1.0.145", features = ["derive"] } serde = { version = "1.0.147", features = ["derive"] }
serde_json = "1.0.85" serde_json = "1.0.87"
serde_with = "2.0.1" serde_with = "2.0.1"
chrono = { version = "0.4.22", features = ["serde"] } chrono = { version = "0.4.22", features = ["serde"] }
jsonwebtoken = "8.1.1" jsonwebtoken = "8.1.1"
base64 = "0.13.0" base64 = "0.13.1"
log = "0.4.17" log = "0.4.17"
bytes = "1.2.1" bytes = "1.2.1"
derive_builder = "0.11.2" derive_builder = "0.11.2"
@ -27,9 +27,9 @@ serde_qs = "0.10.1"
[dev-dependencies] [dev-dependencies]
tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] }
dotenv = "0.15.0" dotenvy = "0.15.6"
color-eyre = "0.6.2" color-eyre = "0.6.2"
wiremock = "0.5.14" wiremock = "0.5.15"
[features] [features]
default = ["reqwest/native-tls"] default = ["reqwest/native-tls"]

View file

@ -25,7 +25,7 @@ use paypal_rs::{
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
dotenv::dotenv().ok(); dotenvy::dotenv().ok();
let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); let clientid = std::env::var("PAYPAL_CLIENTID").unwrap();
let secret = std::env::var("PAYPAL_SECRET").unwrap(); let secret = std::env::var("PAYPAL_SECRET").unwrap();

View file

@ -6,7 +6,7 @@ use paypal_rs::{data::common::Currency, Client};
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
color_eyre::install()?; color_eyre::install()?;
dotenv::dotenv().ok(); dotenvy::dotenv().ok();
let clientid = std::env::var("PAYPAL_CLIENTID")?; let clientid = std::env::var("PAYPAL_CLIENTID")?;
let secret = std::env::var("PAYPAL_SECRET")?; let secret = std::env::var("PAYPAL_SECRET")?;

View file

@ -397,7 +397,7 @@ mod tests {
use crate::Client; use crate::Client;
async fn create_client() -> Client { async fn create_client() -> Client {
dotenv::dotenv().ok(); dotenvy::dotenv().ok();
let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); let clientid = std::env::var("PAYPAL_CLIENTID").unwrap();
let secret = std::env::var("PAYPAL_SECRET").unwrap(); let secret = std::env::var("PAYPAL_SECRET").unwrap();

View file

@ -92,7 +92,7 @@ impl Client {
/// ///
/// #[tokio::main] /// #[tokio::main]
/// async fn main() { /// async fn main() {
/// # dotenv::dotenv().ok(); /// # dotenvy::dotenv().ok();
/// let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); /// let clientid = std::env::var("PAYPAL_CLIENTID").unwrap();
/// let secret = std::env::var("PAYPAL_SECRET").unwrap(); /// let secret = std::env::var("PAYPAL_SECRET").unwrap();
/// ///

View file

@ -1,6 +1,6 @@
//! Paypal object definitions used by the orders api. //! Paypal object definitions used by the orders api.
use super::{common::*, invoice::BillingInfo}; use super::common::*;
use derive_builder::Builder; use derive_builder::Builder;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none; use serde_with::skip_serializing_none;
@ -669,7 +669,7 @@ pub struct PaymentCard {
/// The card owner name. /// The card owner name.
pub name: String, pub name: String,
/// The billing address. /// The billing address.
pub billing_address: Address pub billing_address: Address,
} }
/// A transaction reference. /// A transaction reference.
@ -695,7 +695,7 @@ pub struct StoredCredential {
/// The stored credential usage, e.g: SUBSEQUENT /// The stored credential usage, e.g: SUBSEQUENT
pub usage: String, pub usage: String,
/// The billing address. /// 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. /// A order payload to be used when creating an order.

View file

@ -1,6 +1,5 @@
//! This module contains the endpoint trait used to implemented api endpoints. //! This module contains the endpoint trait used to implemented api endpoints.
use crate::{LIVE_ENDPOINT, SANDBOX_ENDPOINT, PaypalEnv};
use serde::{de::DeserializeOwned, Serialize}; use serde::{de::DeserializeOwned, Serialize};
use std::borrow::Cow; use std::borrow::Cow;

View file

@ -24,7 +24,7 @@
//! //!
//! #[tokio::main] //! #[tokio::main]
//! async fn main() { //! async fn main() {
//! dotenv::dotenv().ok(); //! dotenvy::dotenv().ok();
//! let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); //! let clientid = std::env::var("PAYPAL_CLIENTID").unwrap();
//! let secret = std::env::var("PAYPAL_SECRET").unwrap(); //! let secret = std::env::var("PAYPAL_SECRET").unwrap();
//! //!
@ -180,7 +180,7 @@ mod tests {
use std::str::FromStr; use std::str::FromStr;
pub async fn create_client() -> Client { pub async fn create_client() -> Client {
dotenv::dotenv().ok(); dotenvy::dotenv().ok();
let clientid = env::var("PAYPAL_CLIENTID").unwrap(); let clientid = env::var("PAYPAL_CLIENTID").unwrap();
let secret = env::var("PAYPAL_SECRET").unwrap(); let secret = env::var("PAYPAL_SECRET").unwrap();

View file

@ -8,7 +8,11 @@ use wiremock::{
}; };
fn create_client(url: &str) -> Client { 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] #[tokio::test]