List of all members | Public Member Functions | Protected Attributes | Protected Member Functions
CyberSourceProcessor Class Reference

The implementation of CyberSource-specific credit card handling. More...

#include <cybersourceprocessor.h>

Public Member Functions

 CyberSourceProcessor ()
 
virtual ~CyberSourceProcessor ()
 
- Public Member Functions inherited from CreditCardProcessor
virtual ~CreditCardProcessor ()
 
virtual int authorize (const int pccardid, const QString &pcvv, const double pamount, double ptax, bool ptaxexempt, double pfreight, double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, QString preftype, int &prefid)
 Processes pre-authorization transactions. More...
 
virtual int charge (const int pccardid, const QString &pcvv, const double pamount, const double ptax, const bool ptaxexempt, const double pfreight, const double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, QString preftype, int &prefid)
 Processes charge transactions. More...
 
virtual int chargePreauthorized (const QString &pcvv, const double pamount, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid)
 Processes 'capture' transactions, or charges against a prior preauthorization. More...
 
virtual int credit (const int pccardid, const QString &pcvv, const double pamount, const double ptax, const bool ptaxexempt, const double pfreight, const double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, QString preftype, int &prefid)
 Processes credit transactions. More...
 
virtual Q_INVOKABLE int defaultPort (bool=false)
 Return the default port expected by the subclass. More...
 
virtual Q_INVOKABLE QString defaultServer ()
 Return the default server expected by the subclass. More...
 
virtual Q_INVOKABLE bool handlesChecks ()
 Returns whether the subclass handles checks. More...
 
virtual Q_INVOKABLE bool isLive ()
 Returns whether credit card processing is configured in live mode. More...
 
virtual Q_INVOKABLE bool isTest ()
 Returns whether credit card processing is configured in test mode. More...
 
virtual Q_INVOKABLE void reset ()
 Reset error handling internal settings so previous transactions don't interfere with new transactions. More...
 
virtual int reversePreauthorized (const double pamount, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, QString preftype, int prefid)
 Reverse a preauthorization. More...
 
virtual Q_INVOKABLE int testConfiguration ()
 Test whether common credit card processing configuration options are consistent. More...
 
virtual int voidPrevious (int &)
 Processes void transactions. More...
 

Protected Attributes

QDomDocument * _doc
 
QDomElement _requestMessage
 
- Protected Attributes inherited from CreditCardProcessor
QList< FraudCheckResult * > _avsCodes
 
QString _company
 
QList< FraudCheckResult * > _cvvCodes
 
int _defaultLivePort
 
QString _defaultLiveServer
 
int _defaultTestPort
 
QString _defaultTestServer
 
QList< QPair< QString, QString > > _extraHeaders
 
QHttp * _http
 
bool _ignoreSslErrors
 
bool _passedAvs
 
bool _passedCvv
 
QString _plogin
 
QString _ppassword
 
QString _pport
 
QString _pserver
 

Protected Member Functions

virtual int buildCommon (const int pccardid, const QString &pcvv, const double pamount, const int pcurrid, QString &pneworder, QString &preforder, const CCTransaction ptranstype)
 
virtual int doAuthorize (const int pccardid, const QString &pcvv, double &pamount, const double ptax, const bool ptaxexempt, const double pfreight, const double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams)
 Placeholder for subclasses to override. More...
 
virtual int doCharge (const int pccardid, const QString &pcvv, const double pamount, const double ptax, const bool ptaxexempt, const double pfreight, const double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams)
 Placeholder for subclasses to override. More...
 
virtual int doChargePreauthorized (const int pccardid, const QString &pcvv, const double pamount, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams)
 Placeholder for subclasses to override. More...
 
virtual int doCredit (const int pccardid, const QString &pcvv, const double pamount, const double ptax, const bool ptaxexempt, const double pfreight, const double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams)
 Placeholder for subclasses to override. More...
 
virtual int doReverseAuthorize (const int pccardid, const double pamount, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams)
 
virtual int doTestConfiguration ()
 Placeholder for subclasses to override. More...
 
virtual int doVoidPrevious (const int pccardid, const QString &pcvv, const double pamount, const int pcurrid, QString &pneworder, QString &preforder, QString &papproval, int &pccpayid, ParameterList &pparams)
 Placeholder for subclasses to override. More...
 
virtual int handleResponse (const QString &presponse, const int pccardid, const CCTransaction ptype, double &pamount, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams)
 
virtual bool handlesCreditCards ()
 Returns whether the subclass handles credit cards. More...
 
virtual QVariant xqresult (QXmlQuery *xq, QString query, QVariant::Type type=QVariant::String)
 Return the result of extracting a given value from an XML response from CyberSource. More...
 
- Protected Member Functions inherited from CreditCardProcessor
 CreditCardProcessor ()
 Construct and initialize a default CreditCardProcessor. More...
 
virtual FraudCheckResultavsCodeLookup (QChar pcode)
 
virtual QString buildURL (const QString, const QString, const bool)
 Construct a valid URL from the information in the configuration. More...
 
virtual int checkCreditCard (const int pccid, const QString &pcvv, QString &pccard_x)
 Check if the given credit card is consistent and active. More...
 
virtual int checkCreditCardProcessor ()
 
virtual FraudCheckResultcvvCodeLookup (QChar pcode)
 
virtual int doReversePreauthorized (const double pamount, const int pcurrid, QString &pneworder, QString &preforder, int pccpayid, ParameterList &pparams)
 Placeholder for subclasses to override. More...
 
virtual int fraudChecks ()
 Handle fraud checking as determined by the system configuration. More...
 
virtual int sendViaHTTP (const QString &, QString &)
 Send an HTTP request to the configured credit card service and wait for its response. More...
 
virtual int updateCCPay (int &, ParameterList &)
 Insert into or update the ccpay table based on parameters extracted from the credit card processing service' response to a transaction request. More...
 

Additional Inherited Members

- Public Types inherited from CreditCardProcessor
enum  CCTransaction {
  Authorize, Reverse, Capture, Charge,
  Credit, Void
}
 
enum  FraudCheck {
  Match = 0x0000, NoMatch = 0x0001, NotAvail = 0x0002, Address = 0x0004,
  PostalCode = 0x0008, Name = 0x0010, NotProcessed = 0x0020, Invalid = 0x0040,
  ServiceUnavailable = 0x0080, IssuerNotCertified = 0x0100, Suspicious = 0x0200, Unsupported = 0x0400
}
 
- Static Public Member Functions inherited from CreditCardProcessor
static Q_INVOKABLE ParameterList authorize (const ParameterList &)
 Processes pre-authorization transactions. More...
 
static Q_INVOKABLE ParameterList charge (const ParameterList &)
 Processes charge transactions. More...
 
static Q_INVOKABLE ParameterList chargePreauthorized (const ParameterList &)
 Captures preauthorized transactions. More...
 
static Q_INVOKABLE ParameterList credit (const ParameterList &)
 Processes credit transactions. More...
 
static Q_INVOKABLE QString errorMsg ()
 Returns the most recent error message set by CreditCardProcessor or one of its subclasses. More...
 
static Q_INVOKABLE QString errorMsg (const int)
 Returns the error message associated with the given pcode. More...
 
static Q_INVOKABLE CreditCardProcessorgetProcessor (const QString=QString())
 Get a new instance of a specific CreditCardProcessor subclass. More...
 
static Q_INVOKABLE int printReceipt (const int)
 Print the CCReceipt report for a credit card transaction. More...
 
static Q_INVOKABLE QString typeToCode (CCTransaction ptranstype)
 
static Q_INVOKABLE ParameterList voidPrevious (const ParameterList &)
 Processes void transactions. More...
 
- Protected Slots inherited from CreditCardProcessor
void sslErrors (const QList< QSslError > &errors)
 
- Static Protected Member Functions inherited from CreditCardProcessor
static double currToCurr (const int, const int, const double, int *=0)
 Convert between two currencies. More...
 
- Static Protected Attributes inherited from CreditCardProcessor
static QString _errorMsg = ""
 
static QHash< int, QString > _msgHash
 

Detailed Description

The implementation of CyberSource-specific credit card handling.

Constructor & Destructor Documentation

CyberSourceProcessor::CyberSourceProcessor ( )
CyberSourceProcessor::~CyberSourceProcessor ( )
virtual

Member Function Documentation

int CyberSourceProcessor::buildCommon ( const int  pccardid,
const QString &  pcvv,
const double  pamount,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
const CCTransaction  ptranstype 
)
protectedvirtual
int CyberSourceProcessor::doAuthorize ( const int  pccardid,
const QString &  pcvv,
double &  pamount,
const double  ptax,
const bool  ptaxexempt,
const double  pfreight,
const double  pduty,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
int &  pccpayid,
ParameterList &  pParams 
)
protectedvirtual

Placeholder for subclasses to override.

See also
authorize

Reimplemented from CreditCardProcessor.

int CyberSourceProcessor::doCharge ( const int  pccardid,
const QString &  pcvv,
const double  pamount,
const double  ptax,
const bool  ptaxexempt,
const double  pfreight,
const double  pduty,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
int &  pccpayid,
ParameterList &  pParams 
)
protectedvirtual

Placeholder for subclasses to override.

See also
charge

Reimplemented from CreditCardProcessor.

int CyberSourceProcessor::doChargePreauthorized ( const int  pccardid,
const QString &  pcvv,
const double  pamount,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
int &  pccpayid,
ParameterList &  pParams 
)
protectedvirtual

Placeholder for subclasses to override.

See also
chargePreauthorized

Reimplemented from CreditCardProcessor.

int CyberSourceProcessor::doCredit ( const int  pccardid,
const QString &  pcvv,
const double  pamount,
const double  ptax,
const bool  ptaxexempt,
const double  pfreight,
const double  pduty,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
int &  pccpayid,
ParameterList &  pParams 
)
protectedvirtual

Placeholder for subclasses to override.

See also
credit

Reimplemented from CreditCardProcessor.

int CyberSourceProcessor::doReverseAuthorize ( const int  pccardid,
const double  pamount,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
int &  pccpayid,
ParameterList &  pparams 
)
protectedvirtual
int CyberSourceProcessor::doTestConfiguration ( )
protectedvirtual

Placeholder for subclasses to override.

See also
testConfiguration

Reimplemented from CreditCardProcessor.

int CyberSourceProcessor::doVoidPrevious ( const int  pccardid,
const QString &  pcvv,
const double  pamount,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
QString &  papproval,
int &  pccpayid,
ParameterList &  pParams 
)
protectedvirtual

Placeholder for subclasses to override.

See also
voidPrevious

Reimplemented from CreditCardProcessor.

int CyberSourceProcessor::handleResponse ( const QString &  presponse,
const int  pccardid,
const CCTransaction  ptype,
double &  pamount,
const int  pcurrid,
QString &  pneworder,
QString &  preforder,
int &  pccpayid,
ParameterList &  pparams 
)
protectedvirtual
bool CyberSourceProcessor::handlesCreditCards ( )
protectedvirtual

Returns whether the subclass handles credit cards.

Reimplemented from CreditCardProcessor.

QVariant CyberSourceProcessor::xqresult ( QXmlQuery *  xq,
QString  query,
QVariant::Type  type = QVariant::String 
)
protectedvirtual

Return the result of extracting a given value from an XML response from CyberSource.

The input query can specify a full or relative path within the XML stream. If it starts with a slash ('/') then it's treated as a full path. Otherwise it's treated as a relative path with respect to soap:Envelope/soap:Body/c:replyMessage

Queries with relative paths always return the text() value. Queries with full paths must completely specify what they want returned. In either case, the query is wrapped with namespace handling.

The xq parameter is expected to be an initialized QXmlQuery with focus already set on the XML to be queried.

Member Data Documentation

QDomDocument* CyberSourceProcessor::_doc
protected
QDomElement CyberSourceProcessor::_requestMessage
protected

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

Generated on Fri Oct 7 2016 14:23:28 xTuple ERP Programmer Reference, Version 4.2.0 doxygen 1.8.10