category | OSS |
---|---|
package | OSS_PaymentProcessor |
copyright | Copyright (c) 2007 - 2012, Open Source Solutions Limited, Dublin, Ireland |
license | New BSD License |
__construct(array $config, \OSS_Log $logger)
array
An associated array of realex.* parameters from application.ini
\OSS_PaymentProcessor_Realex_Exception |
---|
cancelCard(\Entities\RealexCard $card) : \CreditcardTrasaction
Sends a 'card-cancel-card' request to Realex which remove credit card from Realex.
This also logs the transaction into the \Entities\RealexTransaction table, and returns that object which can be queried for the request and transaction state.
If $this->_fake_transactions is true then it skips the Realex request and returns with success after performing all normal database operations as if the request was sent.
see | \global\$_fake_transactions |
---|
\Entities\RealexCard
\CreditcardTrasaction
$rtranscreateCardRef(\Entities\RealexCard $card) : string
All cards added to the Realex store (linked to a payer) must be uniquely identifiable with a unique key. We use the integer primary key from the \Entities\RealexCard table.
These cards are added to payers in the Realex system.
see | \global\OSS_PaymentProcessor_Realex::createCreditCardRef() |
---|
\Entities\RealexCard
The instance of the \Entities\RelaexCard object
string
The unqiue card IDcreateOrderId(\Entities\RealexTrasaction $rtrans) : string
Every Realex transaction must have a unique order id. We use the integer primary key of the \Entities\RealexTransaction table (which records all Realex transactions) for this.
see | \Entities\RealexTransaction |
---|
\Entities\RealexTrasaction
An instance of a save()'d object
\OSS_PaymentProcessor_Realex_Exception |
---|
string
The unique transaction IDcreatePayerRef(\Entities\Customer $customer) : string
All payers that we create must be identifiable by us with a unique ID. For this we use the integer primary key from the \Etnities\Customer object.
Later this ID can be used in RealEFT transactions for recurring payments, etc.
\Entities\Customer
The instance of the payer's \Entities\Customer object
string
The unique payer IDeditPayer(\Entities\RealexPayer $payer) : boolean | int
Sends a 'edit-payer' request to Realex which updates payer data in Realex.
This also logs the transaction into the \Entities\ReaelxTransaction table, and returns that object which can be queried for the request and transaction state.
If $this->_fake_transactions is true then it skips the Realex request and returns with success after performing all normal database operations as if the request was sent.
see | \global\$_fake_transactions |
---|
\Entities\RealexPayer
boolean
int
the result (true on success, otherwise integer on error)getCardType($cardType) : string
string
getMoneyFromCustomer(\Entities\RealexPayer $payer, $amount, mixed $rtrans) : bool
It's wrapper function for receiptIn function. It takes three parameters. Payer from ho it will take money, the amount of money and arrow to transaction object which will be created in receiptIn function.
function will return true or false, depends on transaction status.
An example usage is:
$rtrans = null;
$payer = $this->getD2Em()->getRepostory( '\\Entities\\RealexPayer' )->find( $id );
...
if( $this->getPaygate()->getMoneyFromCustomer( $payer, 100, $rtrans ) )
// do something
else
$result = $rtrans->getResult(); //for other actions.
see | \global\self::receiptIn() |
---|
\Entities\RealexPayer
The payer to take money
mixed
&$rtrans Arrow to new \Entities\RealexTransaction
\OSS_PaymentProcessor_Exception |
---|
bool
getTimeStamp() : string
string
YYYYmmddhhmmss formated timestampgiveMoneyToCustomer(\Entities\RealexPayer $payer, $amount, mixed $rtrans) : bool
It's wrapper function for paymentOut function. It takes three parameters. Payer for ho it will give money, the amount of money and arrow to transaction object which will be created in receiptIn function.
function will return true or false, depends on transaction status.
An example usage is:
$rtrans = null;
$payer = $this->getD2Em()->getRepostory( '\\Entities\\RealexPayer' )->find( $id );
...
if( $this->getPaygate()->getMoneyFromCustomer( $payer, 100, $rtrans ) )
// do something
else
$result = $rtrans->getResult(); //for other actions.
see | \global\self::paymentOut() |
---|
\Entities\RealexPayer
The payer to give money
mixed
&$rtrans Arrow to new \Entities\RealexTransaction
\OSS_PaymentProcessor_Exception |
---|
bool
newCard(\Entities\RealexCard $card) : \Entities\RealexTransaction
Sends a 'card-new' request to Realex which creates a new credit card at Realex which later can be used by RealEFT for recurring payments ('receipt-in').
This also logs the transaction into the \Entities\RealexTransaction table, and returns that object which can be queried for the request and transaction state.
If $this->_fake_transactions is true then it skips the Realex request and returns with success after performing all normal database operations as if the request was sent.
see | \global\$_fake_transactions |
---|
\Entities\RealexCard
The credit card object to add to Realex
\OSS_PaymentProcessor_Exception |
---|
\Entities\RealexTransaction
The resultant \Entities\RealexTransaction objectnewPayer(\Entities\Realex $payer) : \Entities\RealexTransaction
Sends a 'payer-new' request to Realex which creates a new payer at Realex which later can be used by RealEFT for recurring payments ('receipt-in').
This also logs the transaction into the \Entities\RealexTransaction table, and returns that object which can be queried for the request and transaction state.
If $this->_fake_transactions is true then it skips the Realex request and returns with success after performing all normal database operations as if the request was sent.
see | \global\$_fake_transactions |
---|
\Entities\Realex
The payer who will be associated as payer in Realex
\OSS_PaymentProcessor_Exception |
---|
\Entities\RealexTransaction
The resultant \Entities\RealexTransaction objectpaymentOut(\Entities\RealexCard $card, int | float $amount) : \CreditcardTransaction
Sends a 'receipt-out' request to Realex which creates a new payment at Realex.
This also logs the transaction into the \Entities\RealexTransaction table, and returns that object which can be queried for the request and transaction state.
If $this->_fake_transactions is true then it skips the Realex request and returns with success after performing all normal database operations as if the request was sent.
see | \global\$_fake_transactions |
---|
\Entities\RealexCard
int
float
the amount to be withdrawn from the card, in the biggest unit of the currency, e.g. in euro or dollar and not in cent, then conversion is made inside the method
\OSS_PaymentProcessor_Exception |
---|
\CreditcardTransaction
The resultant CreditcardTransaction objectreceiptIn(\Entities\RealexCard $card, int | float $amount) : \Entities\RealexTransaction
Sends a 'receipt-in' request to Realex which creates a new payment at Realex.
This also logs the transaction into the \Entities\RealexTransaction table, and returns that object which can be queried for the request and transaction state.
If $this->_fake_transactions is true then it skips the Realex request and returns with success after performing all normal database operations as if the request was sent.
see | \global\$_fake_transactions |
---|
\Entities\RealexCard
int
float
the amount to be withdrawn from the card, in the biggest unit of the currency, e.g. in euro or dollar and not in cent, then conversion is made inside the method
\OSS_PaymentProcessor_Exception |
---|
\Entities\RealexTransaction
The resultant \Entities\RealexTransaction objectupdateCard(\Entities\RealexCard $card) : boolean | int
Sends a 'update-card' request to Realex which updates credit card data in Realex.
This also logs the transaction into the \Entities\RealexTransaction table, and returns that object which can be queried for the request and transaction state.
If $this->_fake_transactions is true then it skips the Realex request and returns with success after performing all normal database operations as if the request was sent.
see | \global\$_fake_transactions |
---|
\Entities\RealexCard
boolean
int
true on success, otherwise an error codegetD2EM() : string
getMerchantId() : string
getMerchantSecret() : string
getRefundPassword() : string
_checkResponse(string $resp)
Outside of the possible checks that Realex performs, we need to allow for one more: an invalid hash of the received XML response indicated a bad transmission / man in the middle attack.
string
The parsed Realex XML response as an array
_completeFakeTransation(\Entities\RealexTransaction $rtrans) : \Entities\RealexTransaction
If $this->_fake_transactions is set to true, the system will not perform any Realex requests but fake the transactions in the database meaning we:
<
pre>FAKETRANS
\Entities\RealexTransaction
The transaction object to create the fake entries in
\Entities\RealexTransaction
The modified (and save()'d) transaction object_log(string $msg, int $pri)
string
The log message
int
The priority of the message (defaults: OSS_Log::DEBUG)
_parseResponse(string $xml, \Entities\RealexTransaction $rtrans) : \Entities\ReleaxTransaction
This function:
string
The XML response from Realex for processing
\Entities\RealexTransaction
An instance of the \Entities\RealexTransaciton object
\OSS_PaymentProcessor_Realex_Receipt_Exception |
---|
\Entities\ReleaxTransaction
The updated $rtrans object for fluent interface_sendRequest(\Entities\RealexTransaction $rtrans, string $reqXML) : bool
This function does the heavy lifting for sending a request to Realex and parsing and processing the reponse. Specifically:
sends the request to Realex
If the request fails:
If the request succeeds:
\Entities\RealexTransaction
The instance of \Entities\RealexTransaction to send to Realex
string
The XML request package to send to Realex
\OSS_PaymentProcessor_Realex_Exception |
---|
bool
True if the API/CGI request succeeded (IT DOES NOT MEAN THE REALEX TRANSACTION SUCCEEDED!)$CARD_TYPES : array
$ERR_TEXT : array
.. codes
$OPTIONAL_PARAMS : array
$REQUIRED_PARAMS : array
$_account : string
$_cgi_timeout : int
$_cgi_url : string
$_d2em : \EntityManager
$_fake_transactions : bool
$_keep_request_data : bool
Some transactions require non-stored data (e.g. credit card number) to replay a failed transaction (such as createCreditCard()) which we will store and delete when we successfully replay the transaction. Setting this to true means we don't remove it.
WARNING: Set to true only for testing!
$_merchant_secret : string
$_refund_password : string
$_user_agent : string
CARD_TYPE_LASER
CARD_TYPE_MASTERCARD
CARD_TYPE_VISA
ERR_RESPONSE_INVALID_HASH : integer