Skip to main content

Payment

Struct Payment 

Source
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: DocumentHeader

Document header

§payment_type: PaymentType

Payment type

§business_partner_id: String

Business partner ID (vendor or customer)

§is_vendor: bool

Is this a vendor (true) or customer (false)?

§payment_method: PaymentMethod

Payment method

§payment_status: PaymentStatus

Payment status

§amount: Decimal

Payment amount

§currency: String

Payment currency

§house_bank: String

Bank account (house bank)

§bank_account_id: String

Bank account ID

§partner_bank_account: Option<String>

Partner bank details

§value_date: NaiveDate

Value 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: Decimal

Total discount taken

§total_write_off: Decimal

Total write-off

§bank_charges: Decimal

Bank charges

§exchange_rate: Decimal

Exchange rate (if foreign currency)

§fx_gain_loss: Decimal

FX gain/loss

§payment_run_id: Option<String>

Payment run ID (if from automatic payment run)

§is_bank_cleared: bool

Is this payment cleared by bank?

§bank_statement_ref: Option<String>

Bank statement reference

§cleared_date: Option<NaiveDate>

Cleared date

§is_voided: bool

Is this payment voided?

§void_reason: Option<String>

Void reason

Implementations§

Source§

impl Payment

Source

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.

Source

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.

Source

pub fn with_payment_method(self, method: PaymentMethod) -> Self

Set payment method.

Source

pub fn with_bank( self, house_bank: impl Into<String>, account_id: impl Into<String>, ) -> Self

Set house bank.

Source

pub fn with_check_number(self, check_number: impl Into<String>) -> Self

Set check number.

Source

pub fn with_value_date(self, date: NaiveDate) -> Self

Set value date.

Source

pub fn add_allocation(&mut self, allocation: PaymentAllocation)

Add an allocation.

Source

pub fn allocate_to_invoice( &mut self, invoice_id: impl Into<String>, invoice_type: DocumentType, amount: Decimal, discount: Decimal, )

Allocate to an invoice.

Source

pub fn recalculate_totals(&mut self)

Recalculate totals.

Source

pub fn total_allocated(&self) -> Decimal

Total allocated amount.

Source

pub fn unallocated(&self) -> Decimal

Unallocated amount.

Source

pub fn approve(&mut self, user: impl Into<String>)

Approve the payment.

Source

pub fn send_to_bank(&mut self, user: impl Into<String>)

Send to bank.

Source

pub fn clear(&mut self, clear_date: NaiveDate, statement_ref: impl Into<String>)

Record bank clearing.

Source

pub fn void(&mut self, reason: impl Into<String>, user: impl Into<String>)

Void the payment.

Source

pub fn post(&mut self, user: impl Into<String>, posting_date: NaiveDate)

Post the payment.

Source

pub fn generate_gl_entries(&self) -> Vec<(String, Decimal, Decimal)>

Generate GL entries for payment.

Trait Implementations§

Source§

impl Clone for Payment

Source§

fn clone(&self) -> Payment

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Payment

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Payment

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Payment

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,