taler-rust

GNU Taler code in Rust. Largely core banking integrations.
Log | Files | Refs | Submodules | README | LICENSE

types.rs (29853B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2025, 2026 Taler Systems SA
      4 
      5   TALER is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU Affero General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
     12 
     13   You should have received a copy of the GNU Affero General Public License along with
     14   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 
     17 use std::collections::BTreeMap;
     18 
     19 use compact_str::CompactString;
     20 use jiff::Timestamp;
     21 use serde::{Deserialize, Serialize};
     22 use taler_common::types::{amount::Decimal, payto::FullPayto};
     23 use url::Url;
     24 
     25 use crate::payto::{CyclosAccount, CyclosId, FullCyclosPayto};
     26 
     27 #[derive(Debug, Serialize, Clone)]
     28 #[serde(rename_all = "camelCase")]
     29 pub enum OrderBy {
     30     AmountAsc,
     31     AmountDesc,
     32     DateAsc,
     33     DateDesc,
     34 }
     35 
     36 #[derive(Debug, Deserialize, Clone)]
     37 #[serde(rename_all = "camelCase")]
     38 pub struct Type {
     39     pub id: CyclosId,
     40     pub internal_name: Option<String>,
     41     pub name: String,
     42 }
     43 
     44 #[derive(Debug, Deserialize, Clone)]
     45 #[serde(rename_all = "camelCase")]
     46 pub struct Currency {
     47     #[serde(flatten)]
     48     pub ty: Type,
     49     pub decimal_digits: u8,
     50     pub symbol: String,
     51 }
     52 
     53 #[derive(Debug, Deserialize, Clone)]
     54 #[serde(rename_all = "camelCase")]
     55 pub struct AccountStatus {
     56     pub available_balance: Option<Decimal>,
     57     pub balance: Decimal,
     58 }
     59 
     60 #[derive(Debug, Deserialize, Clone)]
     61 #[serde(rename_all = "camelCase")]
     62 pub struct Account {
     63     pub currency: Currency,
     64     pub status: AccountStatus,
     65     #[serde(rename = "type")]
     66     pub ty: Type,
     67 }
     68 
     69 #[derive(Debug, Deserialize)]
     70 #[serde(rename_all = "camelCase")]
     71 pub struct User {
     72     pub id: CyclosId,
     73     pub name: String,
     74 }
     75 
     76 impl User {
     77     pub fn payto(&self, root: CompactString) -> FullCyclosPayto {
     78         FullPayto::new(CyclosAccount { id: self.id, root }, &self.name)
     79     }
     80 }
     81 
     82 #[derive(Debug, Deserialize)]
     83 #[serde(rename_all = "camelCase")]
     84 pub struct PaymentData {
     85     #[serde(flatten)]
     86     pub ty: Type,
     87     pub currency: Currency,
     88 }
     89 
     90 #[derive(Debug, Deserialize)]
     91 #[serde(rename_all = "camelCase")]
     92 pub struct DataForTransaction {
     93     pub payment_types: Vec<PaymentData>,
     94 }
     95 
     96 #[derive(Debug, Deserialize)]
     97 #[serde(rename_all = "camelCase")]
     98 pub struct RelatedAccount {
     99     pub id: CyclosId,
    100     #[serde(rename = "type")]
    101     pub ty: Type,
    102     #[serde(flatten)]
    103     pub kind: AccountKind,
    104 }
    105 
    106 #[derive(Debug)]
    107 pub struct Pagination<T> {
    108     pub page: T,
    109     pub current_page: u64,
    110     pub has_next_page: bool,
    111 }
    112 
    113 #[derive(Debug, Deserialize)]
    114 #[serde(rename_all = "camelCase")]
    115 pub struct HistoryItem {
    116     pub id: CyclosId,
    117     pub date: Timestamp,
    118     pub amount: String,
    119     #[serde(rename = "type")]
    120     pub ty: Type,
    121     pub description: Option<String>,
    122     pub related_account: RelatedAccount,
    123     pub transaction: Option<TransactionMini>,
    124 }
    125 
    126 #[derive(Debug, Deserialize)]
    127 #[serde(rename_all = "camelCase")]
    128 pub struct TransferView {
    129     pub id: CyclosId,
    130     pub date: Timestamp,
    131     pub amount: Decimal,
    132     #[serde(rename = "type")]
    133     pub ty: Type,
    134 }
    135 
    136 #[derive(Debug, Deserialize)]
    137 #[serde(rename_all = "camelCase")]
    138 pub struct Transfer {
    139     pub id: CyclosId,
    140     pub date: Timestamp,
    141     pub amount: Decimal,
    142     pub can_chargeback: bool,
    143     pub kind: TransferKind,
    144     pub currency: Currency,
    145     pub chargeback_of: Option<TransferView>,
    146     pub charged_back_by: Option<TransferView>,
    147     #[serde(rename = "type")]
    148     pub ty: Type,
    149 }
    150 
    151 #[derive(Debug, Deserialize)]
    152 #[serde(rename_all = "camelCase")]
    153 pub struct Transaction {
    154     pub id: CyclosId,
    155     pub date: Timestamp,
    156     pub amount: Decimal,
    157     pub kind: TxKind,
    158     pub currency: Currency,
    159     #[serde(rename = "type")]
    160     pub ty: Type,
    161 }
    162 
    163 #[derive(Debug, Deserialize)]
    164 #[serde(rename_all = "camelCase")]
    165 pub struct TransactionMini {
    166     pub id: CyclosId,
    167     pub kind: TxKind,
    168 }
    169 
    170 #[derive(Debug, serde::Deserialize)]
    171 #[serde(rename_all = "camelCase")]
    172 /// Indicates the reason the transfer was created.
    173 pub enum TransferKind {
    174     /// A transfer generated by an account fee charge
    175     AccountFee,
    176     /// A transfer which either withdraws or credits funds of an account being disposed
    177     BalanceDisposal,
    178     /// A transfer which is a chargeback of another transfer
    179     Chargeback,
    180     /// An imported transfer
    181     Import,
    182     /// A transfer which is the initial credit for a newly created account
    183     InitialCredit,
    184     /// A transfer generated when processing a scheduled / recurring payment installment / occurrence
    185     Installment,
    186     /// A transfer generated by a direct payment or accepting a webshop order
    187     Payment,
    188     /// A transfer generated by a transfer fee charge
    189     TransferFee,
    190 }
    191 
    192 #[derive(Debug, serde::Deserialize)]
    193 #[serde(rename_all = "camelCase")]
    194 pub enum TxKind {
    195     Chargeback,
    196     ExternalPayment,
    197     Import,
    198     Order,
    199     Payment,
    200     PaymentRequest,
    201     RecurringPayment,
    202     ScheduledPayment,
    203     Ticket,
    204 }
    205 
    206 #[derive(Debug, serde::Deserialize)]
    207 #[serde(rename_all = "camelCase")]
    208 pub enum InvalidDeviceConfirmation {
    209     InvalidConfirmation,
    210     InvalidDevice,
    211     MaxCheckAtemptsReached,
    212 }
    213 
    214 #[derive(Debug, serde::Deserialize)]
    215 #[serde(rename_all = "camelCase")]
    216 pub struct UserInfo {
    217     pub id: CyclosId,
    218     pub display: String,
    219 }
    220 
    221 #[derive(Debug, serde::Deserialize)]
    222 #[serde(rename_all = "camelCase")]
    223 #[serde(tag = "kind")]
    224 pub enum AccountKind {
    225     System,
    226     User { user: UserInfo },
    227 }
    228 #[derive(Debug, serde::Deserialize)]
    229 #[serde(rename_all = "camelCase")]
    230 pub struct NotificationStatus {
    231     pub new_notifications: u32,
    232     pub unread_notifications: u32,
    233     pub notification: Notification,
    234 }
    235 
    236 #[derive(Debug, serde::Deserialize)]
    237 #[serde(rename_all = "camelCase")]
    238 pub struct Notification {
    239     pub id: CyclosId,
    240     pub date: Timestamp,
    241     #[serde(rename = "type")]
    242     pub ty: NotificationType,
    243     pub entity_type: Option<NotificationEntityType>,
    244 }
    245 
    246 #[derive(Debug, serde::Deserialize)]
    247 #[serde(rename_all = "camelCase")]
    248 pub struct DataForUi {
    249     pub cyclos_version: String,
    250     pub cyclos_revision: String,
    251     pub root_url: Url,
    252     pub api_url: Url,
    253     pub application_name: String,
    254 }
    255 
    256 #[derive(Debug, serde::Deserialize)]
    257 #[serde(rename_all = "camelCase")]
    258 pub enum UserStatus {
    259     Active,
    260     Blocked,
    261     Disabled,
    262     Pending,
    263     Purged,
    264     Removed,
    265 }
    266 
    267 #[derive(Debug, serde::Deserialize)]
    268 #[serde(rename_all = "camelCase")]
    269 pub enum PasswordStatus {
    270     Active,
    271     Disabled,
    272     Expired,
    273     IndefinitelyBlocked,
    274     NeverCreated,
    275     Pending,
    276     Reset,
    277     TemporarilyBlocked,
    278 }
    279 
    280 #[derive(Debug, serde::Deserialize, thiserror::Error)]
    281 #[serde(tag = "code", rename_all = "camelCase")]
    282 pub enum UnauthorizedError {
    283     #[error("blockedAccessClient - The access client used for access is blocked")]
    284     BlockedAccessClient,
    285     #[error("invalidAccessClient - The access client used for access is invalid")]
    286     InvalidAccessClient,
    287     #[error(
    288         "invalidAccessToken '{error}' - The OAuth2 / OpenID Connect access token used for access is invalid"
    289     )]
    290     InvalidAccessToken { error: String },
    291     #[error(
    292         "invalidChannelUsage - Attempt to login on a stateless-only channel, or use stateless in a stateful-only channel, or invoke as guest in a channel configuration which is only for users"
    293     )]
    294     InvalidChannelUsage,
    295     #[error(
    296         "invalidNetwork - Attempt to access a network that has been disabled, or a restricted global administrator is trying to login to a inaccessible network"
    297     )]
    298     InvalidNetwork,
    299     #[error("loggedOut - The session token used for access is invalid")]
    300     LoggedOut,
    301     #[error(
    302         "login - Either user identification (principal) or password are invalid. May have additional information, such as the user / password status"
    303     )]
    304     Login,
    305     #[error(
    306         "missingAuthorization - Attempt to access an operation as guest, but the operation requires authentication"
    307     )]
    308     MissingAuthorization,
    309     #[error(
    310         "remoteAddressBlocked - The IP address being used for access has been blocked by exceeding tries with invalid users"
    311     )]
    312     RemoteAddressBlocked,
    313     #[error(
    314         "unauthorizedAddress - The user cannot access the system using an IP address that is not white-listed"
    315     )]
    316     UnauthorizedAddress,
    317     #[error(
    318         "unauthorizedUrl - The user's configuration demands access using a specific URL, and this access is being done using another one"
    319     )]
    320     UnauthorizedUrl,
    321 }
    322 
    323 #[derive(Debug, serde::Deserialize, thiserror::Error)]
    324 #[serde(tag = "code", rename_all = "camelCase")]
    325 /// Error codes for 403 Forbidden HTTP status.
    326 pub enum ForbiddenError {
    327     #[error("blockedByTotp - The user was blocked for exceeding the TOTP attempts")]
    328     BlockedByTotp,
    329     #[error("devicePinRemoved - The device pin was removed by exceeding the allowed attempts")]
    330     DevicePinRemoved,
    331     #[error("disabledPassword - The password being used was disabled")]
    332     DisabledPassword,
    333     #[error("expiredPassword - The password being used has expired")]
    334     ExpiredPassword,
    335     #[error("illegalAction - Attempt to perform an action that is not allowed on this context")]
    336     IllegalAction,
    337     #[error("inaccessibleChannel - This channel cannot be accessed by the user")]
    338     InaccessibleChannel,
    339     #[error(
    340         "inaccessibleGroup - An administrator logging in another user which is not of the managed groups. Should be handled generically, in case more group-specific login restrictions are added to Cyclos"
    341     )]
    342     InaccessibleGroup,
    343     #[error(
    344         "inaccessibleNetwork - A restricted global administrator is trying to login to a network they can't access"
    345     )]
    346     InaccessibleNetwork,
    347     #[error(
    348         "inaccessiblePrincipal - The used identification method (principal type) cannot be used in this channel"
    349     )]
    350     InaccessiblePrincipal,
    351     #[error(
    352         "indefinitelyBlocked - The password was indefinitely blocked by exceeding the allowed attempts"
    353     )]
    354     IndefinitelyBlocked,
    355     #[error("invalidDeviceActivationCode - The device activation code was no valid")]
    356     InvalidDeviceActivationCode,
    357     #[error(
    358         "invalidDeviceConfirmation - The device confirmation being used is invalid (normally as a confirmation password)"
    359     )]
    360     InvalidDeviceConfirmation,
    361     #[error(
    362         "invalidPassword - The password being used is invalid (normally the confirmation password)"
    363     )]
    364     InvalidPassword,
    365     #[error("invalidTotp - A given TOTP is invalid")]
    366     InvalidTotp,
    367     #[error("loginConfirmation - The user needs to confirm the login before proceeding")]
    368     LoginConfirmation,
    369     #[error(
    370         "operatorWithPendingAgreements - The operator cannot access because his owner member has pending agreements"
    371     )]
    372     OperatorWithPendingAgreements,
    373     #[error("otpInvalidated - The OTP was invalidated")]
    374     OtpInvalidated,
    375     #[error(
    376         "pendingAgreements - There is at least one agreement which needs to be accepted in order to access the system"
    377     )]
    378     PendingAgreements,
    379     #[error(
    380         "permissionDenied - The operation was denied because a required permission was not granted"
    381     )]
    382     PermissionDenied,
    383     #[error("resetPassword - The password being used was manually reset")]
    384     ResetPassword,
    385     #[error(
    386         "temporarilyBlocked - The password was temporarily blocked by exceeding the allowed attempts"
    387     )]
    388     TemporarilyBlocked,
    389 }
    390 
    391 #[derive(Debug, serde::Deserialize, thiserror::Error)]
    392 #[serde(tag = "code", rename_all = "camelCase")]
    393 /// Error codes for 404 Service Unavailable entity HTTP status. It means that some required service couldn't be contacted
    394 pub enum UnavailableError {
    395     #[error("emailSending - An error has occurred trying to send the a required email")]
    396     Emailsending,
    397     #[error("smsSending - An error has occurred trying to send a required SMS message")]
    398     Smssending,
    399 }
    400 
    401 #[derive(Debug, serde::Deserialize, thiserror::Error)]
    402 #[serde(tag = "code", rename_all = "camelCase")]
    403 #[error("{entity_type} {key}")]
    404 /// Error codes for 404 Not Found
    405 pub struct NotFoundError {
    406     pub entity_type: String,
    407     pub key: String,
    408 }
    409 
    410 #[derive(Debug, serde::Deserialize, thiserror::Error)]
    411 #[serde(tag = "code", rename_all = "camelCase")]
    412 /// Error types associated to the HTTP Status 500.
    413 pub enum UnexpectedError {
    414     #[error("buyVoucher - An error has occurred when buying a voucher")]
    415     BuyVoucher,
    416     #[error("forgottenPassword - An error has occurred when changing a forgotten password")]
    417     ForgottenPassword,
    418     #[error("general - An unexpected error has occurred")]
    419     General,
    420     #[error("initializeNfc - An error has occurred when initializing a NFC token")]
    421     InitializeNfc,
    422     #[error("nested - An error which has another internal error at a given property / index")]
    423     Nested,
    424     #[error("nfcAuth - An error has occurred when making an external NFC authentication")]
    425     NfcAuth,
    426     #[error("oidc - An error for an OpenID Connect / OAuth 2 operation")]
    427     Oidc,
    428     #[error("payment - An error has occurred when making a payment")]
    429     Payment,
    430     #[error("personalizeNfc - An error has occurred when personalizing a NFC token")]
    431     PersonalizeNfc,
    432     #[error("pos - An error has occurred when receiving a payment on a POS operation")]
    433     Pos,
    434     #[error("redeemVoucher - An error has occurred when redeeming a voucher")]
    435     RedeemVoucher,
    436     #[error("shoppingCart - An error has occurred when interacting with a shopping cart")]
    437     ShoppingCart,
    438     #[error("shoppingCartCheckout - An error has occurred when checking out a shopping cart")]
    439     ShoppingCartCheckout,
    440     #[error("topUpVoucher - An error has occurred on a voucher top-up")]
    441     TopUpVoucher,
    442 }
    443 
    444 #[derive(Debug, serde::Deserialize, thiserror::Error)]
    445 #[serde(tag = "code", rename_all = "camelCase")]
    446 /// Error codes for 422 Unprocessable entity HTTP status. It means there was an error with the input sent to the operation.
    447 pub enum InputError {
    448     #[error("aggregated - Represents an aggregation of other input errors")]
    449     Aggregated,
    450     #[error(
    451         "dataConversion {value} - Some data conversion has failed. For example, when sending a date with an invalid format"
    452     )]
    453     DataConversion { value: String },
    454     #[error("fileUploadSize {max_file_size} - An uploaded file size exceeds the maximum allowed")]
    455     #[serde(rename_all = "camelCase")]
    456     FileUploadSize { max_file_size: usize },
    457     #[error(
    458         "maxItems {max_items} - There was an attempt to create an item, but the maximum number of allowed items was exceeded"
    459     )]
    460     #[serde(rename_all = "camelCase")]
    461     MaxItems { max_items: usize },
    462     #[error("missingParameter {name} - Missing a required request parameter")]
    463     MissingParameter { name: String },
    464     #[error("queryParse {value} - A full-text query keywords contained an invalid text")]
    465     QueryParse { value: String },
    466     #[error(
    467         "validation {general_errors:?} {property_errors:?} - One or more of the fields sent contains invalid values"
    468     )]
    469     #[serde(rename_all = "camelCase")]
    470     Validation {
    471         #[serde(default)]
    472         general_errors: Vec<String>,
    473         #[serde(default)]
    474         properties: Vec<String>,
    475         #[serde(default)]
    476         property_errors: BTreeMap<String, Vec<String>>,
    477     },
    478 }
    479 
    480 #[derive(Debug, serde::Deserialize, PartialEq, Eq)]
    481 #[serde(rename_all = "camelCase")]
    482 /// The different notification types generated for users / administrators.
    483 pub enum NotificationType {
    484     /// A notification generated if a notification created when an advertisement is authorized
    485     AdAuthorized,
    486     /// A notification generated if a notification created when an advertisement expires
    487     AdExpired,
    488     /// A notification generated if a notification created by a new advertisement (Simple or Webshop)
    489     AdInterestNotification,
    490     /// A notification generated if an ad is pending by broker authorization
    491     AdPendingAuthorization,
    492     /// An admin notification generated if an advertisement is pending for authorization
    493     AdPendingByAdminAuthorization,
    494     /// A notification generated if a question answered to some AD (Simple or Webshop)
    495     AdQuestionAnswered,
    496     /// A notification generated if a question created to some AD (Simple or Webshop)
    497     AdQuestionCreated,
    498     /// A notification generated if a notification created when an advertisement authorization is rejected
    499     AdRejected,
    500     /// A notification generated if a user performed a new payment through a channel that is not the SMS channel
    501     AllNonSmsPerformedPayments,
    502     /// An admin notification generated if an application error has occurred
    503     ApplicationError,
    504     /// A notification generated if a webshop product is out of stock
    505     ArticleOutOfStock,
    506     /// A notification generated if the authorization of a payment was canceled. This notification is to be sent to the payer
    507     AuthorizedPaymentCanceled,
    508     /// A notification generated if the authorization of a payment was denied. This notification is to be sent to the payer
    509     AuthorizedPaymentDenied,
    510     /// A notification generated if the authorization of a payment has expired. This notification is to be sent to the payer
    511     AuthorizedPaymentExpired,
    512     /// A notification generated if the authorization of a payment succeeded (the payment went successfully through its final authorization and is now processed). This notification is to be sent to the payer
    513     AuthorizedPaymentSucceeded,
    514     /// Deprecated: Voucher notifications are no longer only for bought.. A notification generated if a one or more bought vouchers are about to expire
    515     BoughtVouchersAboutToExpire,
    516     /// Deprecated: Voucher notifications are no longer only for bought.. A notification generated if a bought voucher has new expiration date
    517     BoughtVouchersExpirationDateChanged,
    518     /// Deprecated: Voucher notifications are no longer only for bought.. A notification generated if one or more bought vouchers have expired
    519     BoughtVouchersExpired,
    520     /// A notification generated if a broker has been assigned to a user
    521     BrokerAssigned,
    522     /// A notification generated if a broker has been unassigned from a user
    523     BrokerUnassigned,
    524     /// A notification generated if the external payment has reached the expiration date
    525     ExternalPaymentExpired,
    526     /// A notification generated if the performed external payment has failed processing
    527     ExternalPaymentPerformedFailed,
    528     /// A notification generated if the received external payment has failed processing
    529     ExternalPaymentReceivedFailed,
    530     /// An admin notification generated if an external payment has expired
    531     ExternalUserPaymentExpired,
    532     /// An admin notification generated if an external payment failed processing
    533     ExternalUserPaymentPerformedFailed,
    534     /// A notification generated if a transaction feedback was modified
    535     FeedbackChanged,
    536     /// A notification generated if a transaction feedback was created
    537     FeedbackCreated,
    538     /// A notification generated if a transaction feedback is about to expire
    539     FeedbackExpirationReminder,
    540     /// A notification generated if a performed payment can have an optional feedback
    541     FeedbackOptional,
    542     /// A notification generated if a transaction feedback was replied
    543     FeedbackReplyCreated,
    544     /// A notification generated if a performed payment needs to be given a feedback
    545     FeedbackRequired,
    546     /// An admin notification generated if a voucher will expire in a few days
    547     GeneratedVouchersAboutToExpire,
    548     /// An admin notification generated if a voucher has expired
    549     GeneratedVouchersExpired,
    550     /// A notification generated if a recurring payment to a user has been canceled (only if the recurring payment is shown to receiver)
    551     IncomingRecurringPaymentCanceled,
    552     /// A notification generated if a recurring payment to a user has failed (only if the recurring payment is shown to receiver)
    553     IncomingRecurringPaymentFailed,
    554     /// A notification generated if a recurring payment to a user was received (only if the recurring payment is shown to receiver)
    555     IncomingRecurringPaymentReceived,
    556     /// A notification generated if a scheduled payment to a user has been canceled (only if the scheduled payment is shown to receiver)
    557     IncomingScheduledPaymentCanceled,
    558     /// A notification generated if a scheduled payment to a user has failed (only if the scheduled payment is shown to receiver)
    559     IncomingScheduledPaymentFailed,
    560     /// A notification generated if a scheduled payment to a user was received (only if the scheduled payment is shown to receiver)
    561     IncomingScheduledPaymentReceived,
    562     /// A notification generated if a limit (lower/upper) has changed on an account
    563     LimitChange,
    564     /// A notification generated if a product with stock quantity under limit
    565     LowStockQuantity,
    566     /// A notification generated if the maximum number of SMS messages per month has been reached
    567     MaxSmsPerMonthReached,
    568     /// A notification generated if an user has been assigned to a broker
    569     MemberAssigned,
    570     /// A notification generated if an user has been unassigned from a broker
    571     MemberUnassigned,
    572     /// An admin notification generated if a network is created
    573     NetworkCreated,
    574     /// A notification generated if a token / card has been created
    575     NewToken,
    576     /// A notification generated if a token / card has been created, but needs to be activated before being used
    577     NewTokenPendingActivation,
    578     /// A notification generated if a payment performed by an operator with authorization type
    579     OperatorAuthorizedPaymentApprovedStillPending,
    580     /// A notification generated if a payment performed by an operator with authorization type
    581     OperatorAuthorizedPaymentCanceled,
    582     /// A notification generated if a payment performed by an operator with authorization type
    583     OperatorAuthorizedPaymentDenied,
    584     /// A notification generated if a payment performed by an operator with authorization type
    585     OperatorAuthorizedPaymentExpired,
    586     /// A notification generated if a payment performed by an operator with authorization type
    587     OperatorAuthorizedPaymentSucceeded,
    588     /// A notification generated if a payment performed by an operator with authorization type
    589     OperatorPaymentAwaitingAuthorization,
    590     /// A notification generated if a pending order has been canceled
    591     OrderCanceledBuyer,
    592     /// A notification generated if a pending order has been canceled
    593     OrderCanceledSeller,
    594     /// A notification generated if a new web shop order created from a shopping cart checkout
    595     OrderCreated,
    596     /// A notification generated if an order payment was canceled by authorizer
    597     OrderPaymentCanceledBuyer,
    598     /// A notification generated if an order payment was canceled by authorizer
    599     OrderPaymentCanceledSeller,
    600     /// A notification generated if an order payment was denied by authorizer
    601     OrderPaymentDeniedBuyer,
    602     /// A notification generated if an order payment was denied by authorizer
    603     OrderPaymentDeniedSeller,
    604     /// A notification generated if an order payment has automatically expired
    605     OrderPaymentExpiredBuyer,
    606     /// A notification generated if an order payment has automatically expired
    607     OrderPaymentExpiredSeller,
    608     /// A notification generated if an order accepted by buyer/seller but the payment is pending for authorization
    609     OrderPendingAuthorizationBuyer,
    610     /// A notification generated if an order accepted by buyer/seller but the payment is pending for authorization
    611     OrderPendingAuthorizationSeller,
    612     /// A notification generated if an order pending buyer approval
    613     OrderPendingBuyer,
    614     /// A notification generated if an order buyer needs to fill in the delivery data
    615     OrderPendingDeliveryDataBuyer,
    616     /// A notification generated if an order seller needs to fill in the delivery data
    617     OrderPendingDeliveryDataSeller,
    618     /// A notification generated if an order accepted by buyer (sent to seller)
    619     OrderRealizedBuyer,
    620     /// A notification generated if an order accepted by seller (sent to buyer)
    621     OrderRealizedSeller,
    622     /// A notification generated if an order rejected by buyer
    623     OrderRejectedByBuyer,
    624     /// A notification generated if an order rejected by seller
    625     OrderRejectedBySeller,
    626     /// A notification generated if a password status has changed
    627     PasswordStatusChanged,
    628     /// An admin notification generated if a payment is awaiting for authorization
    629     PaymentAwaitingAdminAuthorization,
    630     /// A notification generated if a user must authorize a pending payment
    631     PaymentAwaitingAuthorization,
    632     /// An admin notification generated if a payment is performed
    633     PaymentPerformed,
    634     /// A notification generated if a payment performed from a user is charged back
    635     PaymentPerformedChargedBack,
    636     /// A notification generated if a user received a new payment
    637     PaymentReceived,
    638     /// A notification generated if a payment received by a user is charged back
    639     PaymentReceivedChargedBack,
    640     /// A notification generated if a payment request was canceled
    641     PaymentRequestCanceled,
    642     /// A notification generated if a payment request was denied
    643     PaymentRequestDenied,
    644     /// A notification generated if the payment request's expiration date has changed
    645     PaymentRequestExpirationDateChanged,
    646     /// A notification generated if a payment request has expired
    647     PaymentRequestExpired,
    648     /// A notification generated if a payment request was processed
    649     PaymentRequestProcessed,
    650     /// A notification generated if a payment request was received
    651     PaymentRequestReceived,
    652     /// A notification generated if a recurring payment from a user has failed (probably because of lack of funds)
    653     RecurringPaymentFailed,
    654     /// A notification generated if an occurrence of an outgoing recurring payment was processed
    655     RecurringPaymentOccurrenceProcessed,
    656     /// A notification generated if a reference was modified
    657     ReferenceChanged,
    658     /// A notification generated if a reference has been set
    659     ReferenceCreated,
    660     /// A notification generated if a sale pending buyer approval
    661     SalePendingBuyer,
    662     /// A notification generated if a sale accepted by buyer (sent to seller)
    663     SaleRealizedBuyer,
    664     /// A notification generated if a sale rejected by seller
    665     SaleRejectedSeller,
    666     /// A notification generated if a scheduled payment from a user has failed (probably because of lack of funds)
    667     ScheduledPaymentFailed,
    668     /// A notification generated if a scheduled payment to a user has been processed
    669     ScheduledPaymentInstallmentProcessed,
    670     /// A notification generated if a payment request which was scheduled has failed processing (probably because of lack of funds), and is being reopened
    671     ScheduledPaymentRequestFailed,
    672     /// A notification generated if the payment request's expiration date has changed. This notification is to be sent to the sender
    673     SentPaymentRequestExpirationDateChanged,
    674     /// A notification generated if a user performed a new payment through SMS
    675     SmsPerformedPayment,
    676     /// An admin notification generated if a system alert as occurred
    677     SystemAlert,
    678     /// A notification generated if the invocation of a webhook after (a successful) ticket approval has failed
    679     TicketWebhookFailed,
    680     /// A notification generated if a token / card status has changed
    681     TokenStatusChanged,
    682     /// An admin notification generated if a member alert as occurred
    683     UserAlert,
    684     /// An admin notification generated if a user import has been done
    685     UserImport,
    686     /// An admin notification generated if a new user has been registered
    687     UserRegistration,
    688     /// A notification generated if a user status has changed
    689     UserStatusChanged,
    690     /// A notification generated if a one or more bought vouchers are about to expire
    691     VoucherAboutToExpire,
    692     /// A notification generated when a voucher was assigned to the user
    693     VoucherAssigned,
    694     /// An admin notification generated if a voucher type allowing buy is about to expire
    695     VoucherBuyingAboutToExpire,
    696     /// A notification generated if a bought voucher has new expiration date
    697     VoucherExpirationDateChanged,
    698     /// A notification generated if one or more bought vouchers have expired
    699     VoucherExpired,
    700     /// A voucher PIN was blocked by exceeding invalid attempts
    701     VoucherPinBlocked,
    702     /// A voucher was redeemed
    703     VoucherRedeem,
    704     /// A voucher was topped-up
    705     VoucherTopUp,
    706 }
    707 
    708 #[derive(Debug, serde::Deserialize, PartialEq, Eq)]
    709 #[serde(rename_all = "camelCase")]
    710 /// The type of the entity referenced by the notification, if any.
    711 pub enum NotificationEntityType {
    712     /// The entity is an user account
    713     Account,
    714     /// The entity is an advertisement question
    715     AdQuestion,
    716     /// The entity is an error log
    717     ErrorLog,
    718     /// The entity is a transaction feedback
    719     Feedback,
    720     /// The entity is a
    721     Marketplace,
    722     /// The entity is a network
    723     Network,
    724     /// The entity is an order
    725     Order,
    726     /// The entity is a password type
    727     PasswordType,
    728     /// The entity is an user reference
    729     Reference,
    730     /// The entity is a system alert
    731     SystemAlert,
    732     /// The entity is a token (user identification)
    733     Token,
    734     /// The entity is a transaction
    735     Transaction,
    736     /// The entity is a transfer
    737     Transfer,
    738     /// The entity is an user
    739     User,
    740     /// The entity is an user alert
    741     UserAlert,
    742     /// The entity is an user imported file
    743     UserImportedFile,
    744     /// The entity is a voucher
    745     Voucher,
    746     /// The entity is a voucher transaction (redeem or top-up)
    747     VoucherTransaction,
    748     /// The entity is a voucher type
    749     VoucherType,
    750 }