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
use serde::{Deserialize, Serialize};
use crate::client::{Client, Response};
use crate::ids::{CustomerId, PaymentMethodId};
use crate::resources::PaymentMethod;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AttachPaymentMethod {
pub customer: CustomerId,
}
impl PaymentMethod {
pub fn attach(
client: &Client,
payment_method_id: &PaymentMethodId,
params: AttachPaymentMethod,
) -> Response<PaymentMethod> {
client.post_form(&format!("/payment_methods/{}/attach", payment_method_id), params)
}
pub fn detach(client: &Client, payment_method_id: &PaymentMethodId) -> Response<PaymentMethod> {
client.post(&format!("/payment_methods/{}/detach", payment_method_id))
}
}