MagicSmoke  $VERSION$
MTDeductVoucher Class Reference

Deducts an amount from a voucher - this can be used for items that are not in the MagicSmoke shop repository. More...

#include <srcMTDeductVoucher.h>

Inheritance diagram for MTDeductVoucher:
MTransaction

Public Member Functions

 MTDeductVoucher ()
 default constructor: generates an invalid transaction More...
 
 MTDeductVoucher (const MTDeductVoucher &)
 copy constructor: the two copies share their state More...
 
virtual ~MTDeductVoucher ()
 deletes this instance More...
 
Q_SLOT Nullable< qint64 > getamount () const
 The amount actually transferred. Can only be zero (not enough left on the voucher) or the same as above. More...
 
Q_SLOT Nullable< MOVouchergetvoucher () const
 The full voucher object after the transaction. More...
 
MTDeductVoucheroperator= (const MTDeductVoucher &)
 copy assignment: the copy shares the state of the original object More...
 

Static Public Member Functions

static MTDeductVoucher asyncQuery (const QString &avoucherid, const qint64 &aamount, const QString &acomment, QString iface="MagicSmoke")
 emits the query over the network and returns the transaction object, use isFinished() to check for the transaction's state More...
 
static MTDeductVoucher query (const QString &avoucherid, const qint64 &aamount, const QString &acomment, QString iface="MagicSmoke")
 emits the query over the network and returns the finished transaction object More...
 
- Static Public Member Functions inherited from MTransaction
static void setStartStopActions (const MTStartStop &start, const MTStartStop &stop)
 set actions to be executed at start/stop More...
 

Protected Member Functions

 MTDeductVoucher (const QString &avoucherid, const qint64 &aamount, const QString &acomment, QString iface)
 generates an instance from its properties More...
 
virtual void endQuery ()
 
- Protected Member Functions inherited from MTransaction
 MTransaction (QString iface=QString())
 internal: construct the transaction More...
 
 MTransaction (const WTransaction &)
 internal: copy the transaction More...
 
 MTransaction (const MTransaction &)
 internal: copy the transaction More...
 
QByteArray executeQuery (QString, QByteArray)
 internal: extend executeQuery to show a wait cursor More...
 

Friends

class MTDeductVoucher_Private
 

Detailed Description

Deducts an amount from a voucher - this can be used for items that are not in the MagicSmoke shop repository.

Fails if the voucher is not paid for yet. Will not transfer anything if the voucher does not contain enough money. Fails if the voucher is not valid anymore.

Constructor & Destructor Documentation

MTDeductVoucher::MTDeductVoucher ( const QString &  avoucherid,
const qint64 &  aamount,
const QString &  acomment,
QString  iface 
)
explicitprotected

generates an instance from its properties

Parameters
avoucheridID of the voucher to be used
aamountAmount to be deducted. Must be positive.
acommentA comment noting why it was deducted.
ifaceID of the interface that the transaction will be sent on

References MTDeductVoucher_Private::in_amount, MTDeductVoucher_Private::in_comment, MTDeductVoucher_Private::in_voucherid, and MTDeductVoucher_Private.

MTDeductVoucher::MTDeductVoucher ( )

default constructor: generates an invalid transaction

References MTDeductVoucher_Private.

MTDeductVoucher::MTDeductVoucher ( const MTDeductVoucher t)

copy constructor: the two copies share their state

References MTDeductVoucher_Private::attach().

MTDeductVoucher::~MTDeductVoucher ( )
virtual

deletes this instance

References MTDeductVoucher_Private::detach().

Member Function Documentation

MTDeductVoucher MTDeductVoucher::asyncQuery ( const QString &  avoucherid,
const qint64 &  aamount,
const QString &  acomment,
QString  iface = "MagicSmoke" 
)
static

emits the query over the network and returns the transaction object, use isFinished() to check for the transaction's state

Parameters
avoucheridID of the voucher to be used
aamountAmount to be deducted. Must be positive.
acommentA comment noting why it was deducted.
ifaceID of the interface that the transaction will be sent on
void MTDeductVoucher::endQuery ( )
protectedvirtual
Nullable< qint64 > MTDeductVoucher::getamount ( ) const

The amount actually transferred. Can only be zero (not enough left on the voucher) or the same as above.

References MTDeductVoucher_Private::out_amount.

Referenced by MOverview::deductVoucher().

Nullable< MOVoucher > MTDeductVoucher::getvoucher ( ) const

The full voucher object after the transaction.

References MTDeductVoucher_Private::out_voucher.

Referenced by MOverview::deductVoucher().

MTDeductVoucher & MTDeductVoucher::operator= ( const MTDeductVoucher t)

copy assignment: the copy shares the state of the original object

References MTDeductVoucher_Private::attach(), and MTDeductVoucher_Private::detach().

MTDeductVoucher MTDeductVoucher::query ( const QString &  avoucherid,
const qint64 &  aamount,
const QString &  acomment,
QString  iface = "MagicSmoke" 
)
static

emits the query over the network and returns the finished transaction object

Parameters
avoucheridID of the voucher to be used
aamountAmount to be deducted. Must be positive.
acommentA comment noting why it was deducted.
ifaceID of the interface that the transaction will be sent on

Referenced by MInterface::queryDeductVoucher().

Friends And Related Function Documentation

friend class MTDeductVoucher_Private
friend

Referenced by MTDeductVoucher().


The documentation for this class was generated from the following files: