MagicSmoke  $VERSION$
MTUseVoucher Class Reference

Use a voucher to pay for an order. More...

#include <srcMTUseVoucher.h>

Inheritance diagram for MTUseVoucher:
MTransaction

Public Member Functions

 MTUseVoucher ()
 default constructor: generates an invalid transaction More...
 
 MTUseVoucher (const MTUseVoucher &)
 copy constructor: the two copies share their state More...
 
virtual ~MTUseVoucher ()
 deletes this instance More...
 
Q_SLOT Nullable< qint64 > getamount () const
 The amount that was deducted. More...
 
Q_SLOT Nullable< MOOrdergetorder () const
 The full order object after the transaction. More...
 
Q_SLOT Nullable< MOVouchergetvoucher () const
 The full voucher object after the transaction. More...
 
MTUseVoucheroperator= (const MTUseVoucher &)
 copy assignment: the copy shares the state of the original object More...
 

Static Public Member Functions

static MTUseVoucher asyncQuery (const qint64 &aorderid, const QString &avoucherid, 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 MTUseVoucher query (const qint64 &aorderid, const QString &avoucherid, 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

 MTUseVoucher (const qint64 &aorderid, const QString &avoucherid, 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 MTUseVoucher_Private
 

Detailed Description

Use a voucher to pay for an order.

The system automatically deducts as much as is due for the order or as much as is left on the voucher - whichever is lower. If the voucher is not paid for the transaction will fail. The transaction will never transfer money from an order back to the voucher. If the voucher is no longer valid the transaction will fail.

Constructor & Destructor Documentation

MTUseVoucher::MTUseVoucher ( const qint64 &  aorderid,
const QString &  avoucherid,
QString  iface 
)
explicitprotected

generates an instance from its properties

Parameters
aorderidID of the order that is to be paid for
avoucheridID of the voucher that is to be used for payment
ifaceID of the interface that the transaction will be sent on

References MTUseVoucher_Private::in_orderid, MTUseVoucher_Private::in_voucherid, and MTUseVoucher_Private.

MTUseVoucher::MTUseVoucher ( )

default constructor: generates an invalid transaction

References MTUseVoucher_Private.

MTUseVoucher::MTUseVoucher ( const MTUseVoucher t)

copy constructor: the two copies share their state

References MTUseVoucher_Private::attach().

MTUseVoucher::~MTUseVoucher ( )
virtual

deletes this instance

References MTUseVoucher_Private::detach().

Member Function Documentation

MTUseVoucher MTUseVoucher::asyncQuery ( const qint64 &  aorderid,
const QString &  avoucherid,
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
aorderidID of the order that is to be paid for
avoucheridID of the voucher that is to be used for payment
ifaceID of the interface that the transaction will be sent on
void MTUseVoucher::endQuery ( )
protectedvirtual
Nullable< qint64 > MTUseVoucher::getamount ( ) const

The amount that was deducted.

References MTUseVoucher_Private::out_amount.

Nullable< MOOrder > MTUseVoucher::getorder ( ) const

The full order object after the transaction.

References MTUseVoucher_Private::out_order.

Nullable< MOVoucher > MTUseVoucher::getvoucher ( ) const

The full voucher object after the transaction.

References MTUseVoucher_Private::out_voucher.

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

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

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

MTUseVoucher MTUseVoucher::query ( const qint64 &  aorderid,
const QString &  avoucherid,
QString  iface = "MagicSmoke" 
)
static

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

Parameters
aorderidID of the order that is to be paid for
avoucheridID of the voucher that is to be used for payment
ifaceID of the interface that the transaction will be sent on

Referenced by MInterface::queryUseVoucher().

Friends And Related Function Documentation

friend class MTUseVoucher_Private
friend

Referenced by MTUseVoucher().


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