pub struct Payment {Show 26 fields
pub header: DocumentHeader,
pub payment_type: PaymentType,
pub business_partner_id: String,
pub is_vendor: bool,
pub payment_method: PaymentMethod,
pub payment_status: PaymentStatus,
pub amount: Decimal,
pub currency: String,
pub house_bank: String,
pub bank_account_id: String,
pub partner_bank_account: Option<String>,
pub value_date: NaiveDate,
pub check_number: Option<String>,
pub wire_reference: Option<String>,
pub allocations: Vec<PaymentAllocation>,
pub total_discount: Decimal,
pub total_write_off: Decimal,
pub bank_charges: Decimal,
pub exchange_rate: Decimal,
pub fx_gain_loss: Decimal,
pub payment_run_id: Option<String>,
pub is_bank_cleared: bool,
pub bank_statement_ref: Option<String>,
pub cleared_date: Option<NaiveDate>,
pub is_voided: bool,
pub void_reason: Option<String>,
}Expand description
Payment document (AP Payment or AR Receipt).
Fields§
§header: DocumentHeaderDocument header
payment_type: PaymentTypePayment type
business_partner_id: StringBusiness partner ID (vendor or customer)
is_vendor: boolIs this a vendor (true) or customer (false)?
payment_method: PaymentMethodPayment method
payment_status: PaymentStatusPayment status
amount: DecimalPayment amount
currency: StringPayment currency
house_bank: StringBank account (house bank)
bank_account_id: StringBank account ID
partner_bank_account: Option<String>Partner bank details
value_date: NaiveDateValue date (when funds are available)
check_number: Option<String>Check number (if check payment)
wire_reference: Option<String>Wire reference
allocations: Vec<PaymentAllocation>Allocations to invoices
total_discount: DecimalTotal discount taken
total_write_off: DecimalTotal write-off
bank_charges: DecimalBank charges
exchange_rate: DecimalExchange rate (if foreign currency)
fx_gain_loss: DecimalFX gain/loss
payment_run_id: Option<String>Payment run ID (if from automatic payment run)
is_bank_cleared: boolIs this payment cleared by bank?
bank_statement_ref: Option<String>Bank statement reference
cleared_date: Option<NaiveDate>Cleared date
is_voided: boolIs this payment voided?
void_reason: Option<String>Void reason
Implementations§
Source§impl Payment
impl Payment
Sourcepub fn new_ap_payment(
payment_id: impl Into<String>,
company_code: impl Into<String>,
vendor_id: impl Into<String>,
amount: Decimal,
fiscal_year: u16,
fiscal_period: u8,
payment_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn new_ap_payment( payment_id: impl Into<String>, company_code: impl Into<String>, vendor_id: impl Into<String>, amount: Decimal, fiscal_year: u16, fiscal_period: u8, payment_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create a new AP payment.
Sourcepub fn new_ar_receipt(
payment_id: impl Into<String>,
company_code: impl Into<String>,
customer_id: impl Into<String>,
amount: Decimal,
fiscal_year: u16,
fiscal_period: u8,
payment_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn new_ar_receipt( payment_id: impl Into<String>, company_code: impl Into<String>, customer_id: impl Into<String>, amount: Decimal, fiscal_year: u16, fiscal_period: u8, payment_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create a new AR receipt.
Sourcepub fn with_payment_method(self, method: PaymentMethod) -> Self
pub fn with_payment_method(self, method: PaymentMethod) -> Self
Set payment method.
Sourcepub fn with_bank(
self,
house_bank: impl Into<String>,
account_id: impl Into<String>,
) -> Self
pub fn with_bank( self, house_bank: impl Into<String>, account_id: impl Into<String>, ) -> Self
Set house bank.
Sourcepub fn with_check_number(self, check_number: impl Into<String>) -> Self
pub fn with_check_number(self, check_number: impl Into<String>) -> Self
Set check number.
Sourcepub fn with_value_date(self, date: NaiveDate) -> Self
pub fn with_value_date(self, date: NaiveDate) -> Self
Set value date.
Sourcepub fn add_allocation(&mut self, allocation: PaymentAllocation)
pub fn add_allocation(&mut self, allocation: PaymentAllocation)
Add an allocation.
Sourcepub fn allocate_to_invoice(
&mut self,
invoice_id: impl Into<String>,
invoice_type: DocumentType,
amount: Decimal,
discount: Decimal,
)
pub fn allocate_to_invoice( &mut self, invoice_id: impl Into<String>, invoice_type: DocumentType, amount: Decimal, discount: Decimal, )
Allocate to an invoice.
Sourcepub fn recalculate_totals(&mut self)
pub fn recalculate_totals(&mut self)
Recalculate totals.
Sourcepub fn total_allocated(&self) -> Decimal
pub fn total_allocated(&self) -> Decimal
Total allocated amount.
Sourcepub fn unallocated(&self) -> Decimal
pub fn unallocated(&self) -> Decimal
Unallocated amount.
Sourcepub fn send_to_bank(&mut self, user: impl Into<String>)
pub fn send_to_bank(&mut self, user: impl Into<String>)
Send to bank.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Payment
impl<'de> Deserialize<'de> for Payment
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>,
Auto Trait Implementations§
impl Freeze for Payment
impl RefUnwindSafe for Payment
impl Send for Payment
impl Sync for Payment
impl Unpin for Payment
impl UnsafeUnpin for Payment
impl UnwindSafe for Payment
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.