paymentlib/nswcpp/jsonb/
agency_completion_payment.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::nswcpp::jsonb::b_pay::BPay;
use crate::nswcpp::jsonb::card::Card;

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AgencyCompletionPayment {
    pub payment_method: String,
    pub payment_reference: String,
    pub payment_completion_reference: String,
    pub bank_reference: String,
    pub amount: f64,
    pub surcharge: f64,
    pub surcharge_gst: f64,
    pub agency_transaction_id: String,
    pub card: Option<Vec<Card>>,
    pub b_pay: Option<Vec<BPay>>,
}

impl AgencyCompletionPayment {
    pub fn normalize(&self) -> AgencyCompletionPayment {
        AgencyCompletionPayment {
            payment_method: self.payment_method.clone(),
            payment_reference: self.payment_reference.clone(),
            payment_completion_reference: self.payment_completion_reference.clone(),
            bank_reference: self.bank_reference.clone(),
            amount: self.amount,
            surcharge: self.surcharge,
            surcharge_gst: self.surcharge_gst,
            agency_transaction_id: self.agency_transaction_id.clone(),
            card: self.card.clone().clone(),
            b_pay: self.b_pay.clone(),
        }
    }
}