pub struct PaymentMethod {Show 13 fields
pub id: Uuid,
pub organization_id: Uuid,
pub owner_id: Uuid,
pub method_type: PaymentMethodType,
pub stripe_payment_method_id: String,
pub stripe_customer_id: String,
pub display_label: String,
pub is_default: bool,
pub is_active: bool,
pub metadata: Option<String>,
pub expires_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Payment method entity - Represents a stored payment method
Belgian property management context:
- Store payment methods for recurring charges
- Support cards (Stripe) and SEPA mandates (Belgian bank accounts)
- PCI-DSS compliant: Never store raw card data, only Stripe tokens
Fields§
§id: Uuid§organization_id: UuidOrganization (multi-tenant isolation)
owner_id: UuidOwner who owns this payment method
method_type: PaymentMethodTypePayment method type
stripe_payment_method_id: StringStripe payment method ID (pm_xxx for cards, sepa_debit_xxx for SEPA)
stripe_customer_id: StringStripe customer ID (links payment method to customer)
display_label: StringDisplay label for UI (e.g., “Visa •••• 4242”, “SEPA BE68 5390 0754”)
is_default: boolIs this the default payment method for the owner?
is_active: boolIs this payment method active? (can be deactivated)
metadata: Option<String>Card/SEPA specific metadata (JSON) - stores last4, brand, expiry, etc.
expires_at: Option<DateTime<Utc>>Expiry date for cards (not applicable for SEPA)
created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl PaymentMethod
impl PaymentMethod
Sourcepub fn new(
organization_id: Uuid,
owner_id: Uuid,
method_type: PaymentMethodType,
stripe_payment_method_id: String,
stripe_customer_id: String,
display_label: String,
is_default: bool,
) -> Result<Self, String>
pub fn new( organization_id: Uuid, owner_id: Uuid, method_type: PaymentMethodType, stripe_payment_method_id: String, stripe_customer_id: String, display_label: String, is_default: bool, ) -> Result<Self, String>
Create a new payment method
§Arguments
organization_id- Organization ID (multi-tenant)owner_id- Owner who owns this payment methodmethod_type- Payment method type (Card or SepaDebit)stripe_payment_method_id- Stripe payment method IDstripe_customer_id- Stripe customer IDdisplay_label- Display label for UIis_default- Is this the default payment method?
§Returns
Ok(PaymentMethod)- New payment methodErr(String)- Validation error
Sourcepub fn set_default(&mut self)
pub fn set_default(&mut self)
Set as default payment method
Sourcepub fn unset_default(&mut self)
pub fn unset_default(&mut self)
Unset as default payment method
Sourcepub fn deactivate(&mut self) -> Result<(), String>
pub fn deactivate(&mut self) -> Result<(), String>
Deactivate payment method (soft delete)
Sourcepub fn reactivate(&mut self) -> Result<(), String>
pub fn reactivate(&mut self) -> Result<(), String>
Reactivate payment method
Sourcepub fn set_metadata(&mut self, metadata: String)
pub fn set_metadata(&mut self, metadata: String)
Set metadata (JSON)
Sourcepub fn set_expiry(&mut self, expires_at: DateTime<Utc>) -> Result<(), String>
pub fn set_expiry(&mut self, expires_at: DateTime<Utc>) -> Result<(), String>
Set expiry date (for cards only)
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if payment method is expired (cards only)
Trait Implementations§
Source§impl Clone for PaymentMethod
impl Clone for PaymentMethod
Source§fn clone(&self) -> PaymentMethod
fn clone(&self) -> PaymentMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaymentMethod
impl Debug for PaymentMethod
Source§impl<'de> Deserialize<'de> for PaymentMethod
impl<'de> Deserialize<'de> for PaymentMethod
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<PaymentMethod> for PaymentMethodResponse
impl From<PaymentMethod> for PaymentMethodResponse
Source§fn from(method: PaymentMethod) -> Self
fn from(method: PaymentMethod) -> Self
Auto Trait Implementations§
impl Freeze for PaymentMethod
impl RefUnwindSafe for PaymentMethod
impl Send for PaymentMethod
impl Sync for PaymentMethod
impl Unpin for PaymentMethod
impl UnwindSafe for PaymentMethod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more