obscuravpn_api/cmd/stripe/
subscription.rs

1use crate::cmd::Cmd;
2use serde::{Deserialize, Serialize};
3
4const CREATE_STRIPE_SUBSCRIPTION_CHECKOUT_PATH: &str = "stripe/create_checkout_session";
5const CREATE_PORTAL_SESSION_CHECKOUT_PATH: &str = "stripe/create_portal_session";
6
7#[derive(Debug, Serialize, Deserialize, Clone)]
8pub struct CreateStripeSubscriptionCheckout {}
9
10impl Default for CreateStripeSubscriptionCheckout {
11    fn default() -> Self {
12        Self::new()
13    }
14}
15
16impl CreateStripeSubscriptionCheckout {
17    pub fn new() -> Self {
18        Self {}
19    }
20}
21
22#[derive(Debug, Serialize, Deserialize, Clone)]
23pub struct CreateStripeSubscriptionCheckoutOutput {
24    pub checkout_url: String,
25}
26
27impl CreateStripeSubscriptionCheckoutOutput {
28    pub fn new(checkout_url: String) -> Self {
29        Self { checkout_url }
30    }
31}
32
33impl Cmd for CreateStripeSubscriptionCheckout {
34    type Output = CreateStripeSubscriptionCheckoutOutput;
35    const METHOD: http::Method = http::Method::POST;
36    const PATH: &'static str = CREATE_STRIPE_SUBSCRIPTION_CHECKOUT_PATH;
37}
38
39#[derive(Debug, Serialize, Deserialize, Clone)]
40pub struct CreateStripeManageSubscriptionSession {
41    pub session_id: String,
42}
43
44impl CreateStripeManageSubscriptionSession {
45    pub fn new(session_id: String) -> Self {
46        Self { session_id }
47    }
48}
49
50#[derive(Debug, Serialize, Deserialize, Clone)]
51pub struct CreateStripeManageSubscriptionSessionOutput {
52    pub portal_url: String,
53}
54
55impl CreateStripeManageSubscriptionSessionOutput {
56    pub fn new(portal_url: String) -> Self {
57        Self { portal_url }
58    }
59}
60
61impl Cmd for CreateStripeManageSubscriptionSession {
62    type Output = CreateStripeManageSubscriptionSessionOutput;
63
64    const METHOD: http::Method = http::Method::POST;
65    const PATH: &'static str = CREATE_PORTAL_SESSION_CHECKOUT_PATH;
66}