1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use crate::config::{Client, Response};
use crate::ids::ChargeId;
use crate::params::Object;
use crate::resources::{Charge, Rule};
use serde_derive::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CaptureCharge<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub application_fee: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub receipt_email: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_descriptor: Option<&'a str>,
}
impl Charge {
pub fn capture(
client: &Client,
charge_id: &ChargeId,
params: CaptureCharge<'_>,
) -> Response<Charge> {
client.post_form(&format!("/charges/{}/capture", charge_id), params)
}
}
impl Object for Rule {
type Id = String;
fn id(&self) -> Self::Id {
self.id.clone()
}
fn object(&self) -> &'static str {
""
}
}