This commit is contained in:
Edgar 2021-07-02 11:38:43 +02:00
parent a364cd26e6
commit 2ac44b4c91
No known key found for this signature in database
GPG key ID: 8731E6C0166EAA85
4 changed files with 12 additions and 8 deletions

View file

@ -1,4 +1,4 @@
use paypal_rs::{common::*, errors::*, invoice::*, Client, HeaderParams, Prefer}; use paypal_rs::{common::*, errors::*, invoice::*, Client, HeaderParams};
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), ResponseError> { async fn main() -> Result<(), ResponseError> {

View file

@ -61,7 +61,7 @@ pub struct Address {
} }
/// Represents money /// Represents money
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq, Clone)]
pub struct Money { pub struct Money {
/// The [three-character ISO-4217 currency code](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/) that identifies the currency. /// The [three-character ISO-4217 currency code](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/) that identifies the currency.
pub currency_code: Currency, pub currency_code: Currency,
@ -73,7 +73,7 @@ pub struct Money {
pub value: String, pub value: String,
} }
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq, Clone, Copy)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum LinkMethod { pub enum LinkMethod {
@ -89,7 +89,7 @@ pub enum LinkMethod {
/// A HTOAES link /// A HTOAES link
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Default, Serialize, Deserialize)] #[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct LinkDescription { pub struct LinkDescription {
/// The complete target URL. /// The complete target URL.
pub href: String, pub href: String,
@ -100,7 +100,7 @@ pub struct LinkDescription {
} }
/// ISO-4217 currency codes. /// ISO-4217 currency codes.
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Copy)]
pub enum Currency { pub enum Currency {
/// Australian dollar /// Australian dollar
AUD, AUD,

View file

@ -108,7 +108,7 @@ pub struct Metadata {
/// The details of the invoice. Includes the invoice number, date, payment terms, and audit metadata. /// The details of the invoice. Includes the invoice number, date, payment terms, and audit metadata.
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize, Default)]
pub struct InvoiceDetail { pub struct InvoiceDetail {
/// The reference data. Includes a post office (PO) number. /// The reference data. Includes a post office (PO) number.
pub reference: Option<String>, pub reference: Option<String>,
@ -521,7 +521,7 @@ pub enum Status {
/// An invoice payload /// An invoice payload
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize, Default)]
pub struct InvoicePayload { pub struct InvoicePayload {
/// The details of the invoice. Includes the invoice number, date, payment terms, and audit metadata. /// The details of the invoice. Includes the invoice number, date, payment terms, and audit metadata.
pub detail: InvoiceDetail, pub detail: InvoiceDetail,

View file

@ -339,12 +339,13 @@ pub enum CaptureStatusDetails {
} }
/// A captured payment. /// A captured payment.
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct Capture { pub struct Capture {
/// The status of the captured payment. /// The status of the captured payment.
pub status: CaptureStatus, pub status: CaptureStatus,
/// The details of the captured payment status. /// The details of the captured payment status.
pub status_details: CaptureStatusDetails, pub status_details: Option<CaptureStatusDetails>,
} }
/// The status of the refund /// The status of the refund
@ -380,10 +381,13 @@ pub struct Refund {
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct PaymentCollection { pub struct PaymentCollection {
/// An array of authorized payments for a purchase unit. A purchase unit can have zero or more authorized payments. /// An array of authorized payments for a purchase unit. A purchase unit can have zero or more authorized payments.
#[serde(default)]
pub authorizations: Vec<AuthorizationWithData>, pub authorizations: Vec<AuthorizationWithData>,
/// An array of captured payments for a purchase unit. A purchase unit can have zero or more captured payments. /// An array of captured payments for a purchase unit. A purchase unit can have zero or more captured payments.
#[serde(default)]
pub captures: Vec<Capture>, pub captures: Vec<Capture>,
/// An array of refunds for a purchase unit. A purchase unit can have zero or more refunds. /// An array of refunds for a purchase unit. A purchase unit can have zero or more refunds.
#[serde(default)]
pub refunds: Vec<Refund>, pub refunds: Vec<Refund>,
} }