Skip to main content

PaymentCorrection

Struct PaymentCorrection 

Source
pub struct PaymentCorrection {
Show 21 fields pub correction_id: String, pub company_code: String, pub customer_id: String, pub original_payment_id: String, pub correction_type: PaymentCorrectionType, pub original_amount: Decimal, pub correction_amount: Decimal, pub currency: String, pub correction_date: NaiveDate, pub reversal_je_id: Option<String>, pub correcting_payment_id: Option<String>, pub affected_invoice_ids: Vec<String>, pub status: CorrectionStatus, pub reason: Option<String>, pub bank_reference: Option<String>, pub chargeback_code: Option<String>, pub fee_amount: Decimal, pub created_at: DateTime<Utc>, pub created_by: Option<String>, pub resolved_at: Option<DateTime<Utc>>, pub notes: Option<String>,
}
Expand description

A payment correction record.

Fields§

§correction_id: String

Unique correction identifier.

§company_code: String

Company code.

§customer_id: String

Customer ID.

§original_payment_id: String

Original payment ID being corrected.

§correction_type: PaymentCorrectionType

Type of correction.

§original_amount: Decimal

Original payment amount.

§correction_amount: Decimal

Correction amount (positive for reversals, negative for adjustments).

§currency: String

Currency.

§correction_date: NaiveDate

Date of correction.

§reversal_je_id: Option<String>

Reversal journal entry ID if applicable.

§correcting_payment_id: Option<String>

Correcting payment ID (new payment if re-processed).

§affected_invoice_ids: Vec<String>

Related invoice IDs affected.

§status: CorrectionStatus

Status of the correction.

§reason: Option<String>

Reason for correction.

§bank_reference: Option<String>

Bank reference (for NSF/chargeback).

§chargeback_code: Option<String>

Chargeback code if applicable.

§fee_amount: Decimal

Fee amount (bank fees, chargeback fees).

§created_at: DateTime<Utc>

Created timestamp.

§created_by: Option<String>

Created by user.

§resolved_at: Option<DateTime<Utc>>

Resolved timestamp.

§notes: Option<String>

Notes.

Implementations§

Source§

impl PaymentCorrection

Source

pub fn new( correction_id: String, company_code: String, customer_id: String, original_payment_id: String, correction_type: PaymentCorrectionType, original_amount: Decimal, correction_amount: Decimal, currency: String, correction_date: NaiveDate, ) -> Self

Creates a new payment correction.

Source

pub fn nsf( correction_id: String, company_code: String, customer_id: String, original_payment_id: String, original_amount: Decimal, currency: String, correction_date: NaiveDate, bank_reference: String, nsf_fee: Decimal, ) -> Self

Creates an NSF (Non-Sufficient Funds) correction.

Source

pub fn chargeback( correction_id: String, company_code: String, customer_id: String, original_payment_id: String, chargeback_amount: Decimal, currency: String, correction_date: NaiveDate, chargeback_code: String, reason: String, ) -> Self

Creates a chargeback correction.

Source

pub fn with_reversal_je(self, je_id: String) -> Self

Sets the reversal journal entry.

Source

pub fn add_affected_invoice(&mut self, invoice_id: String)

Adds an affected invoice.

Source

pub fn process(&mut self, reversal_je_id: Option<String>)

Processes the correction.

Source

pub fn resolve(&mut self, correcting_payment_id: Option<String>)

Resolves the correction (e.g., customer re-paid).

Source

pub fn write_off(&mut self)

Writes off the correction as bad debt.

Trait Implementations§

Source§

impl Clone for PaymentCorrection

Source§

fn clone(&self) -> PaymentCorrection

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 PaymentCorrection

Source§

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

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

impl<'de> Deserialize<'de> for PaymentCorrection

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 PaymentCorrection

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>,