Order

Struct Order 

Source
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§premium: i64§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

Source

pub fn as_new_order(&self) -> SmallOrder

Convert an order to a small order

Source

pub fn get_order_kind(&self) -> Result<Kind, ServiceError>

Get the kind of the order

Source

pub fn get_order_status(&self) -> Result<Status, ServiceError>

Get the status of the order in case

Source

pub fn check_status(&self, status: Status) -> Result<(), CantDoReason>

Compare the status of the order

Source

pub fn is_buy_order(&self) -> Result<(), CantDoReason>

Check if the order is a buy order

Source

pub fn is_sell_order(&self) -> Result<(), CantDoReason>

Check if the order is a sell order

Source

pub fn sent_from_maker(&self, sender: PublicKey) -> Result<(), CantDoReason>

Check if the sender is the creator of the order

Source

pub fn not_sent_from_maker(&self, sender: PublicKey) -> Result<(), CantDoReason>

Check if the sender is the creator of the order

Source

pub fn get_creator_pubkey(&self) -> Result<PublicKey, ServiceError>

Get the creator pubkey

Source

pub fn get_buyer_pubkey(&self) -> Result<PublicKey, ServiceError>

Get the buyer pubkey

Source

pub fn get_seller_pubkey(&self) -> Result<PublicKey, ServiceError>

Get the seller pubkey

Source

pub fn get_master_buyer_pubkey( &self, password: Option<&SecretString>, ) -> Result<String, ServiceError>

Get the master buyer pubkey

Source

pub fn get_master_seller_pubkey( &self, password: Option<&SecretString>, ) -> Result<String, ServiceError>

Get the master seller pubkey

Source

pub fn is_range_order(&self) -> bool

Check if the order is a range order

Source

pub fn count_failed_payment(&mut self, retries_number: i64)

Source

pub fn has_no_amount(&self) -> bool

Check if the order has no amount

Source

pub fn set_timestamp_now(&mut self)

Set the timestamp to now

Source

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

Source

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 Clone for Order

Source§

fn clone(&self) -> Order

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 Order

Source§

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

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

impl Default for Order

Source§

fn default() -> Order

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Order

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 From<Order> for SmallOrder

Source§

fn from(order: Order) -> Self

Converts to this type from the input type.
Source§

impl From<SmallOrder> for Order

Source§

fn from(small_order: SmallOrder) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Order

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§

§

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> 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,