CRM_Core_Payment_PaymentExpressIPN
class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN
Class CRM_Core_Payment_PaymentExpressIPN
Properties
static | $_now | from CRM_Core_Payment_BaseIPN | |
protected array | $_inputParameters | Input parameters from payment processor. Store these so that the code does not need to keep retrieving from the http request | from CRM_Core_Payment_BaseIPN |
protected bool | $_isRecurring | Only used by AuthorizeNetIPN. | from CRM_Core_Payment_BaseIPN |
protected bool | $_isFirstOrLastRecurringPayment | Only used by AuthorizeNetIPN. | from CRM_Core_Payment_BaseIPN |
protected object | $_mode | Mode of operation: live or test |
Methods
Constructor.
Validate incoming data.
Load objects related to contribution.
Set contribution to failed.
Handled pending contribution status.
Process cancelled payment outcome.
No description
No description
No description
The function gets called when a new order takes place.
/** The function returns the component(Event/Contribute.
Main notification processing method.
Converts the comma separated name-value pairs in
Details
at line 93
__construct(string $mode, $paymentProcessor)
Constructor.
in CRM_Core_Payment_BaseIPN at line 74
setInputParameters(array $parameters)
Store input array on the class.
in CRM_Core_Payment_BaseIPN at line 104
bool
validateData(array $input, array $ids, array $objects, bool $required = TRUE, int $paymentProcessorID = NULL)
Validate incoming data.
This function is intended to ensure that incoming data matches It provides a form of pseudo-authentication - by checking the calling fn already knows the correct contact id & contribution id (this can be problematic when that has changed in the meantime for transactions that are delayed & contacts are merged in-between. e.g Paypal allows you to resend Instant Payment Notifications if you, for example, moved site and didn't update your IPN URL.
in CRM_Core_Payment_BaseIPN at line 162
bool|array
loadObjects(array $input, array $ids, array $objects, bool $required, int $paymentProcessorID, array $error_handling = NULL)
Load objects related to contribution.
in CRM_Core_Payment_BaseIPN at line 218
bool
failed(array $objects, object $transaction, array $input = [])
Set contribution to failed.
in CRM_Core_Payment_BaseIPN at line 283
bool
pending(array $objects, object $transaction)
Handled pending contribution status.
in CRM_Core_Payment_BaseIPN at line 300
bool
cancelled(array $objects, CRM_Core_Transaction $transaction, array $input = [])
Process cancelled payment outcome.
in CRM_Core_Payment_BaseIPN at line 367
bool
unhandled(array $objects, CRM_Core_Transaction $transaction)
Rollback unhandled outcomes.
in CRM_Core_Payment_BaseIPN at line 481
completeTransaction(array $input, array $ids, array $objects, CRM_Core_Transaction $transaction, bool $recur = FALSE)
deprecated
deprecated Jumbled up function. The purpose of this function is to transition a pending transaction to Completed including updating any related entities. It has been overloaded to also add recurring transactions to the database, cloning the original transaction and updating related entities. It is recommended to avoid calling this function directly and call the api functions: - contribution.completetransaction - contribution.repeattransaction These functions are the focus of testing efforts and more accurately reflect the division of roles (the job of the IPN class is to determine the outcome, transaction id, invoice id & to validate the source and from there it should be possible to pass off transaction management.) This function has been problematic for some time but there are now several tests via the api_v3_Contribution test and the Paypal & Authorize.net IPN tests so any refactoring should be done in conjunction with those. This function needs to have the 'body' moved to the CRM_Contribute_BAO_Contribute class and to undergo refactoring to separate the complete transaction and repeat transaction functionality into separate functions with a shared function that updates related components. Note that it is not necessary payment processor extension to implement an IPN class now. In general the code on the IPN class is better accessed through the api which de-jumbles it a bit. e.g the payment class can have a function like (based on Omnipay extension): public function handlePaymentNotification() { $response = $this->getValidatedOutcome(); if ($response->isSuccessful()) { try { // @todo check if it is a repeat transaction & call repeattransaction instead. civicrm_api3('contribution', 'completetransaction', array('id' => $this->transaction_id)); } catch (CiviCRM_API3_Exception $e) { if (!stristr($e->getMessage(), 'Contribution already completed')) { $this->handleError('error', $this->transaction_id . $e->getMessage(), 'ipn_completion', 9000, 'An error may have occurred. Please check your receipt is correct'); $this->redirectOrExit('success'); } elseif ($this->transaction_id) { civicrm_api3('contribution', 'create', array('id' => $this->transaction_id, 'contribution_status_id' => 'Failed')); }
in CRM_Core_Payment_BaseIPN at line 494
bool
getBillingID(array $ids)
Get site billing ID.
in CRM_Core_Payment_BaseIPN at line 529
array
sendMail(array $input, array $ids, array $objects, array $values, bool $recur = FALSE, bool $returnMessageText = FALSE)
deprecated
deprecated
at line 64
static mixed
retrieve(string $name, $type, $object, bool $abort = TRUE)
at line 113
bool
newOrderNotify($success, array $privateData, $component, $amount, $transactionReference)
The function gets called when a new order takes place.
at line 201
static array
getContext(array $privateData, int $orderNo)
/** The function returns the component(Event/Contribute.
.)and whether it is Test or not
at line 277
static
main(string $dps_method, array $rawPostData, string $dps_url, string $dps_user, string $dps_key, string $mac_key)
Main notification processing method.
hex string from paymentexpress is passed to this function as hex string. Code based on googleIPN mac_key is only passed if the processor is pxaccess as it is used for decryption $dps_method is either pxaccess or pxpay
at line 441
static array
stringToArray(string $str)
Converts the comma separated name-value pairs in