Skip to main content

core_invoice/
payment.rs

1use crate::identifier::Identifier;
2
3/// BG-17 credit transfer. BT-84 account id (IBAN), BT-85 name, BT-86 provider (BIC).
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct CreditTransfer {
6    pub account_id: Identifier,
7    pub account_name: Option<String>,
8    pub provider: Option<String>,
9}
10
11/// BG-18 card. BT-87 PAN, BT-88 holder. Tests use obviously fake PANs.
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct PaymentCard {
14    pub pan: String,
15    pub holder: Option<String>,
16}
17
18/// BG-19 direct debit. BT-89 mandate, BT-90 creditor id, BT-91 debited account.
19#[derive(Debug, Clone, PartialEq, Eq)]
20pub struct DirectDebit {
21    pub mandate: Option<String>,
22    pub creditor_id: Option<Identifier>,
23    pub debited_account: Option<Identifier>,
24}
25
26/// BG-17 xor BG-18 xor BG-19. Several IBANs are several credit-transfer accounts.
27/// Do not store IBAN as a string beside this enum.
28#[derive(Debug, Clone, PartialEq, Eq)]
29pub enum PaymentMeans {
30    CreditTransfer(Vec<CreditTransfer>),
31    Card(PaymentCard),
32    DirectDebit(DirectDebit),
33}