pub struct Order {Show 40 fields
pub id: Uuid,
pub kind: String,
pub event_id: String,
pub hash: Option<String>,
pub preimage: Option<String>,
pub creator_pubkey: String,
pub cancel_initiator_pubkey: Option<String>,
pub buyer_pubkey: Option<String>,
pub master_buyer_pubkey: Option<String>,
pub seller_pubkey: Option<String>,
pub master_seller_pubkey: Option<String>,
pub status: String,
pub price_from_api: bool,
pub premium: i64,
pub payment_method: String,
pub amount: i64,
pub min_amount: Option<i64>,
pub max_amount: Option<i64>,
pub buyer_dispute: bool,
pub seller_dispute: bool,
pub buyer_cooperativecancel: bool,
pub seller_cooperativecancel: bool,
pub fee: i64,
pub routing_fee: i64,
pub fiat_code: String,
pub fiat_amount: i64,
pub buyer_invoice: Option<String>,
pub range_parent_id: Option<Uuid>,
pub invoice_held_at: i64,
pub taken_at: i64,
pub created_at: i64,
pub buyer_sent_rate: bool,
pub seller_sent_rate: bool,
pub failed_payment: bool,
pub payment_attempts: i64,
pub expires_at: i64,
pub trade_index_seller: Option<i64>,
pub trade_index_buyer: Option<i64>,
pub next_trade_pubkey: Option<String>,
pub next_trade_index: Option<i64>,
}
Expand description
Database representation of an order
Fields§
§id: Uuid
§kind: String
§event_id: String
§hash: Option<String>
§preimage: Option<String>
§creator_pubkey: String
§cancel_initiator_pubkey: Option<String>
§buyer_pubkey: Option<String>
§master_buyer_pubkey: Option<String>
§seller_pubkey: Option<String>
§master_seller_pubkey: Option<String>
§status: String
§price_from_api: bool
§payment_method: String
§amount: i64
§min_amount: Option<i64>
§max_amount: Option<i64>
§buyer_dispute: bool
§seller_dispute: bool
§buyer_cooperativecancel: bool
§seller_cooperativecancel: bool
§fee: i64
§routing_fee: i64
§fiat_code: String
§fiat_amount: i64
§buyer_invoice: Option<String>
§range_parent_id: Option<Uuid>
§invoice_held_at: i64
§taken_at: i64
§created_at: i64
§buyer_sent_rate: bool
§seller_sent_rate: bool
§failed_payment: bool
§payment_attempts: i64
§expires_at: i64
§trade_index_seller: Option<i64>
§trade_index_buyer: Option<i64>
§next_trade_pubkey: Option<String>
§next_trade_index: Option<i64>
Implementations§
Source§impl Order
impl Order
Sourcepub fn as_new_order(&self) -> SmallOrder
pub fn as_new_order(&self) -> SmallOrder
Convert an order to a small order
Sourcepub fn get_order_kind(&self) -> Result<Kind, ServiceError>
pub fn get_order_kind(&self) -> Result<Kind, ServiceError>
Get the kind of the order
Sourcepub fn get_order_status(&self) -> Result<Status, ServiceError>
pub fn get_order_status(&self) -> Result<Status, ServiceError>
Get the status of the order in case
Sourcepub fn check_status(&self, status: Status) -> Result<(), CantDoReason>
pub fn check_status(&self, status: Status) -> Result<(), CantDoReason>
Compare the status of the order
Sourcepub fn is_buy_order(&self) -> Result<(), CantDoReason>
pub fn is_buy_order(&self) -> Result<(), CantDoReason>
Check if the order is a buy order
Sourcepub fn is_sell_order(&self) -> Result<(), CantDoReason>
pub fn is_sell_order(&self) -> Result<(), CantDoReason>
Check if the order is a sell order
Sourcepub fn sent_from_maker(&self, sender: PublicKey) -> Result<(), CantDoReason>
pub fn sent_from_maker(&self, sender: PublicKey) -> Result<(), CantDoReason>
Check if the sender is the creator of the order
Sourcepub fn not_sent_from_maker(&self, sender: PublicKey) -> Result<(), CantDoReason>
pub fn not_sent_from_maker(&self, sender: PublicKey) -> Result<(), CantDoReason>
Check if the sender is the creator of the order
Sourcepub fn get_creator_pubkey(&self) -> Result<PublicKey, ServiceError>
pub fn get_creator_pubkey(&self) -> Result<PublicKey, ServiceError>
Get the creator pubkey
Sourcepub fn get_buyer_pubkey(&self) -> Result<PublicKey, ServiceError>
pub fn get_buyer_pubkey(&self) -> Result<PublicKey, ServiceError>
Get the buyer pubkey
Sourcepub fn get_seller_pubkey(&self) -> Result<PublicKey, ServiceError>
pub fn get_seller_pubkey(&self) -> Result<PublicKey, ServiceError>
Get the seller pubkey
Sourcepub fn get_master_buyer_pubkey(
&self,
password: Option<&SecretString>,
) -> Result<String, ServiceError>
pub fn get_master_buyer_pubkey( &self, password: Option<&SecretString>, ) -> Result<String, ServiceError>
Get the master buyer pubkey
Sourcepub fn get_master_seller_pubkey(
&self,
password: Option<&SecretString>,
) -> Result<String, ServiceError>
pub fn get_master_seller_pubkey( &self, password: Option<&SecretString>, ) -> Result<String, ServiceError>
Get the master seller pubkey
Sourcepub fn is_range_order(&self) -> bool
pub fn is_range_order(&self) -> bool
Check if the order is a range order
pub fn count_failed_payment(&mut self, retries_number: i64)
Sourcepub fn has_no_amount(&self) -> bool
pub fn has_no_amount(&self) -> bool
Check if the order has no amount
Sourcepub fn set_timestamp_now(&mut self)
pub fn set_timestamp_now(&mut self)
Set the timestamp to now
Sourcepub fn is_full_privacy_order(
&self,
password: Option<&SecretString>,
) -> Result<(Option<String>, Option<String>), ServiceError>
pub fn is_full_privacy_order( &self, password: Option<&SecretString>, ) -> Result<(Option<String>, Option<String>), ServiceError>
Check if a user is creating a full privacy order so he doesn’t to have reputation compare master keys with the order keys if they are the same the user is in full privacy mode otherwise the user is not in normal mode and has a reputation
Sourcepub fn setup_dispute(
&mut self,
is_buyer_dispute: bool,
) -> Result<(), CantDoReason>
pub fn setup_dispute( &mut self, is_buyer_dispute: bool, ) -> Result<(), CantDoReason>
Setup the dispute status
If the pubkey is the buyer, set the buyer dispute to true If the pubkey is the seller, set the seller dispute to true
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Order
impl<'de> Deserialize<'de> for Order
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Order> for SmallOrder
impl From<Order> for SmallOrder
Source§impl From<SmallOrder> for Order
impl From<SmallOrder> for Order
Source§fn from(small_order: SmallOrder) -> Self
fn from(small_order: SmallOrder) -> Self
Auto Trait Implementations§
impl Freeze for Order
impl RefUnwindSafe for Order
impl Send for Order
impl Sync for Order
impl Unpin for Order
impl UnwindSafe for Order
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more