paystack/models/
generic.rs

1//! Generic Model
2//! ==========
3//! This file contains generic models for the Paystack API.
4
5use serde::{Deserialize, Serialize};
6
7/// MetaData of list response
8#[derive(Debug, Deserialize, Serialize, Clone)]
9pub struct MetaData {
10    /// This is the total number of transactions that were performed by the customer.
11    pub total: u32,
12    /// This is the number of records skipped before the first record in the array returned.
13    pub skipped: u32,
14    /// This is the maximum number of records that will be returned per request.
15    #[serde(rename = "perPage")]
16    pub per_page: String,
17    /// This is the current `page` being returned.
18    pub page: u32,
19    /// This is how many pages in total are available for retrieval considering the maximum records per page specified.
20    #[serde(rename = "pageCount")]
21    pub page_count: u32,
22}
23
24/// This struct represents the authorization data of the transaction status response
25#[derive(Debug, Deserialize, Serialize, Clone)]
26pub struct Authorization {
27    /// Authorization code generated for the Transaction.
28    pub authorization_code: Option<String>,
29    /// Bin number for Transaction authorization.
30    pub bin: Option<String>,
31    /// Last 4 digits of authorized card.
32    pub last4: Option<String>,
33    /// Authorized card expiry month.
34    pub exp_month: Option<String>,
35    /// Authorized card expiry year.
36    pub exp_year: Option<String>,
37    /// Authorization channel. It could be `card` or `bank`.
38    pub channel: Option<String>,
39    /// Type of card used in the Authorization
40    pub card_type: Option<String>,
41    /// Name of bank associated with the Authorization.
42    pub bank: Option<String>,
43    /// Country code of the Authorization.
44    pub country_code: Option<String>,
45    /// Brand of of the Authorization if it is a card.
46    pub brand: Option<String>,
47    /// Specifies if the Authorization is reusable.
48    pub reusable: Option<bool>,
49    /// Signature of the Authorization.
50    pub signature: Option<String>,
51    /// Name of the account associated with the authorization.
52    pub account_name: Option<String>,
53}
54
55/// Represents the JSON response of the Paystack API when there is no data property
56#[derive(Debug, Deserialize, Serialize)]
57pub struct ResponseWithoutData {
58    /// The status of the JSON response.
59    pub status: bool,
60    /// The message associated with the JSON response.
61    pub message: String,
62}