Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update common params used in upcoming invoice API request #409

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions src/resources/invoice_ext.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use serde::Serialize;

use crate::client::{Client, Response};
use crate::ids::{CouponId, CustomerId, InvoiceId, PlanId, SubscriptionId, SubscriptionItemId};
use crate::params::{Metadata, Timestamp};
use crate::resources::{CollectionMethod, Invoice};
use crate::ids::{CouponId, CustomerId, InvoiceId, SubscriptionId};
use crate::params::Timestamp;
use crate::resources::{
generated::billing::subscription::SubscriptionProrationBehavior, CollectionMethod, Invoice,
UpdateSubscriptionItems,
};

#[deprecated(since = "0.12.0")]
pub type InvoiceCollectionMethod = CollectionMethod;
Expand Down Expand Up @@ -32,13 +35,13 @@ pub struct RetrieveUpcomingInvoice {
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription: Option<SubscriptionId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_items: Option<SubscriptionItemFilter>,
pub subscription_items: Option<Vec<UpdateSubscriptionItems>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_prorate: Option<bool>,
pub subscription_proration_behavior: Option<SubscriptionProrationBehavior>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_proration_date: Option<Timestamp>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_tax_percent: Option<f64>,
pub subscription_start_date: Option<Timestamp>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_trial_end: Option<Timestamp>,
}
Expand All @@ -50,24 +53,10 @@ impl RetrieveUpcomingInvoice {
coupon: None,
subscription: None,
subscription_items: None,
subscription_prorate: None,
subscription_proration_behavior: None,
subscription_proration_date: None,
subscription_tax_percent: None,
subscription_start_date: None,
subscription_trial_end: None,
}
}
}

#[derive(Clone, Debug, Serialize)]
pub struct SubscriptionItemFilter {
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<SubscriptionItemId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub deleted: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
#[serde(skip_serializing_if = "Option::is_none")]
pub plan: Option<PlanId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub quantity: Option<u64>,
}