use crate::prelude::*;
#[derive(
Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Builder, Getters, WithSetters,
)]
pub struct PaymentInformation {
#[getset(get = "pub", set_with = "pub")]
iban: String,
#[getset(get = "pub", set_with = "pub")]
bank_name: String,
#[getset(get = "pub", set_with = "pub")]
bic: String,
#[getset(get = "pub", set_with = "pub")]
currency: Currency,
#[getset(get = "pub", set_with = "pub")]
terms: PaymentTerms,
}
impl HasSample for PaymentInformation {
fn sample() -> Self {
Self::builder()
.bank_name("Banque de Paris".into())
.iban("FR76 3000 6000 0112 3456 7890 189".into())
.bic("BNPAFRPP".into())
.currency(Currency::EUR)
.terms(PaymentTerms::sample())
.build()
}
fn sample_other() -> Self {
Self::builder()
.bank_name("Bank of London".into())
.iban("GB29 NWBK 6016 1331 9268 19".into())
.bic("NWBKGB2L".into())
.currency(Currency::USD)
.terms(PaymentTerms::sample_other())
.build()
}
}
#[cfg(test)]
mod tests {
use super::*;
type Sut = PaymentInformation;
#[test]
fn equality() {
assert_eq!(Sut::sample(), Sut::sample());
assert_eq!(Sut::sample_other(), Sut::sample_other());
}
#[test]
fn inequality() {
assert_ne!(Sut::sample(), Sut::sample_other());
}
}