cleanup
This commit is contained in:
parent
3f783a824f
commit
d38ef6f80e
|
@ -13,7 +13,7 @@ use serde::Serialize;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
data::{
|
data::{
|
||||||
invoice::{Invoice, InvoiceList, InvoicePayload, CancelReason},
|
invoice::{CancelReason, Invoice, InvoiceList, InvoicePayload},
|
||||||
orders::InvoiceNumber,
|
orders::InvoiceNumber,
|
||||||
},
|
},
|
||||||
endpoint::Endpoint,
|
endpoint::Endpoint,
|
||||||
|
@ -215,10 +215,7 @@ pub struct UpdateInvoice {
|
||||||
impl UpdateInvoice {
|
impl UpdateInvoice {
|
||||||
/// New constructor.
|
/// New constructor.
|
||||||
pub fn new(invoice: Invoice, query: UpdateInvoiceQuery) -> Self {
|
pub fn new(invoice: Invoice, query: UpdateInvoiceQuery) -> Self {
|
||||||
Self {
|
Self { invoice, query }
|
||||||
invoice,
|
|
||||||
query
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,16 +249,13 @@ pub struct CancelInvoice {
|
||||||
/// The invoice id.
|
/// The invoice id.
|
||||||
pub invoice_id: String,
|
pub invoice_id: String,
|
||||||
/// The reason of the cancelation.
|
/// The reason of the cancelation.
|
||||||
pub reason: CancelReason
|
pub reason: CancelReason,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CancelInvoice {
|
impl CancelInvoice {
|
||||||
/// New constructor.
|
/// New constructor.
|
||||||
pub fn new(invoice_id: String, reason: CancelReason) -> Self {
|
pub fn new(invoice_id: String, reason: CancelReason) -> Self {
|
||||||
Self {
|
Self { invoice_id, reason }
|
||||||
invoice_id,
|
|
||||||
reason
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! This module contains the api endpoints.
|
//! This module contains the api endpoints.
|
||||||
|
|
||||||
pub mod orders;
|
|
||||||
pub mod invoice;
|
pub mod invoice;
|
||||||
|
pub mod orders;
|
||||||
|
|
|
@ -6,10 +6,9 @@ use std::borrow::Cow;
|
||||||
|
|
||||||
use derive_builder::Builder;
|
use derive_builder::Builder;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::json;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
data::orders::{Order, OrderPayload, PaymentSourceResponse},
|
data::orders::{Order, OrderPayload},
|
||||||
endpoint::Endpoint,
|
endpoint::Endpoint,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,7 +113,7 @@ pub struct CaptureOrder {
|
||||||
/// The id of the order.
|
/// The id of the order.
|
||||||
pub order_id: String,
|
pub order_id: String,
|
||||||
/// The endpoint body.
|
/// The endpoint body.
|
||||||
pub body: Option<PaymentSourceBody>
|
pub body: Option<PaymentSourceBody>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CaptureOrder {
|
impl CaptureOrder {
|
||||||
|
@ -155,7 +154,7 @@ pub struct AuthorizeOrder {
|
||||||
/// The order id.
|
/// The order id.
|
||||||
order_id: String,
|
order_id: String,
|
||||||
/// The endpoint body.
|
/// The endpoint body.
|
||||||
pub body: Option<PaymentSourceBody>
|
pub body: Option<PaymentSourceBody>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AuthorizeOrder {
|
impl AuthorizeOrder {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Paypal object definitions used in the invoice api.
|
//! Paypal object definitions used in the invoice api.
|
||||||
|
|
||||||
use crate::{data::common::*, data::common::LinkDescription};
|
use crate::{data::common::LinkDescription, data::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;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//! This module contains the data structures used in the api endpoints.
|
//! This module contains the data structures used in the api endpoints.
|
||||||
|
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod orders;
|
|
||||||
pub mod invoice;
|
pub mod invoice;
|
||||||
|
pub mod orders;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
//! Paypal object definitions used by the orders api.
|
//! Paypal object definitions used by the orders api.
|
||||||
|
|
||||||
use super::common::*;
|
use super::common::*;
|
||||||
use crate::errors::{PaypalError, ResponseError};
|
|
||||||
use crate::HeaderParams;
|
|
||||||
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;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
//! 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};
|
||||||
|
use serde::{de::DeserializeOwned, Serialize};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use serde::{Serialize, de::DeserializeOwned};
|
|
||||||
use crate::{SANDBOX_ENDPOINT, LIVE_ENDPOINT};
|
|
||||||
|
|
||||||
/// A trait implemented by api endpoints.
|
/// A trait implemented by api endpoints.
|
||||||
pub trait Endpoint {
|
pub trait Endpoint {
|
||||||
|
|
|
@ -75,13 +75,14 @@
|
||||||
//! - [ ] Payment Experience Web Profiles API - 1.0.0
|
//! - [ ] Payment Experience Web Profiles API - 1.0.0
|
||||||
|
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
|
pub mod client;
|
||||||
pub mod countries;
|
pub mod countries;
|
||||||
pub mod data;
|
pub mod data;
|
||||||
pub mod endpoint;
|
pub mod endpoint;
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
pub mod client;
|
|
||||||
pub use client::*;
|
pub use client::*;
|
||||||
|
|
||||||
use derive_builder::Builder;
|
use derive_builder::Builder;
|
||||||
|
@ -160,9 +161,9 @@ struct AuthAssertionClaims {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{countries::Country};
|
use crate::countries::Country;
|
||||||
use crate::data::common::Currency;
|
use crate::data::common::Currency;
|
||||||
use crate::{Client};
|
use crate::Client;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue