This commit is contained in:
Edgar 2022-04-20 09:35:00 +02:00
parent 3f783a824f
commit d38ef6f80e
No known key found for this signature in database
GPG key ID: 8731E6C0166EAA85
10 changed files with 34 additions and 42 deletions

View file

@ -13,7 +13,7 @@ use serde::Serialize;
use crate::{
data::{
invoice::{Invoice, InvoiceList, InvoicePayload, CancelReason},
invoice::{CancelReason, Invoice, InvoiceList, InvoicePayload},
orders::InvoiceNumber,
},
endpoint::Endpoint,
@ -215,10 +215,7 @@ pub struct UpdateInvoice {
impl UpdateInvoice {
/// New constructor.
pub fn new(invoice: Invoice, query: UpdateInvoiceQuery) -> Self {
Self {
invoice,
query
}
Self { invoice, query }
}
}
@ -252,16 +249,13 @@ pub struct CancelInvoice {
/// The invoice id.
pub invoice_id: String,
/// The reason of the cancelation.
pub reason: CancelReason
pub reason: CancelReason,
}
impl CancelInvoice {
/// New constructor.
pub fn new(invoice_id: String, reason: CancelReason) -> Self {
Self {
invoice_id,
reason
}
Self { invoice_id, reason }
}
}

View file

@ -1,4 +1,4 @@
//! This module contains the api endpoints.
pub mod orders;
pub mod invoice;
pub mod orders;

View file

@ -6,10 +6,9 @@ use std::borrow::Cow;
use derive_builder::Builder;
use serde::Serialize;
use serde_json::json;
use crate::{
data::orders::{Order, OrderPayload, PaymentSourceResponse},
data::orders::{Order, OrderPayload},
endpoint::Endpoint,
};
@ -114,7 +113,7 @@ pub struct CaptureOrder {
/// The id of the order.
pub order_id: String,
/// The endpoint body.
pub body: Option<PaymentSourceBody>
pub body: Option<PaymentSourceBody>,
}
impl CaptureOrder {
@ -155,7 +154,7 @@ pub struct AuthorizeOrder {
/// The order id.
order_id: String,
/// The endpoint body.
pub body: Option<PaymentSourceBody>
pub body: Option<PaymentSourceBody>,
}
impl AuthorizeOrder {

View file

@ -1,6 +1,6 @@
//! 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 serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

View file

@ -1,5 +1,5 @@
//! This module contains the data structures used in the api endpoints.
pub mod common;
pub mod orders;
pub mod invoice;
pub mod orders;

View file

@ -1,8 +1,6 @@
//! Paypal object definitions used by the orders api.
use super::common::*;
use crate::errors::{PaypalError, ResponseError};
use crate::HeaderParams;
use derive_builder::Builder;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

View file

@ -1,8 +1,8 @@
//! 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 serde::{Serialize, de::DeserializeOwned};
use crate::{SANDBOX_ENDPOINT, LIVE_ENDPOINT};
/// A trait implemented by api endpoints.
pub trait Endpoint {

View file

@ -75,13 +75,14 @@
//! - [ ] Payment Experience Web Profiles API - 1.0.0
#![deny(missing_docs)]
#![forbid(unsafe_code)]
pub mod api;
pub mod client;
pub mod countries;
pub mod data;
pub mod endpoint;
pub mod errors;
pub mod client;
pub use client::*;
use derive_builder::Builder;
@ -160,9 +161,9 @@ struct AuthAssertionClaims {
#[cfg(test)]
mod tests {
use crate::{countries::Country};
use crate::countries::Country;
use crate::data::common::Currency;
use crate::{Client};
use crate::Client;
use std::env;
use std::str::FromStr;