Commit cc0a7b88 authored by mattwire's avatar mattwire
Browse files

Fix retrieving eventType for webhooks

parent 4a48d113
......@@ -53,6 +53,7 @@ class CRM_Core_Payment_AuthNetIPN extends CRM_Core_Payment_BaseIPN {
$webhook = new AuthnetWebhook(CRM_Core_Payment_AuthorizeNetCommon::getSignature($this->_paymentProcessor->getPaymentProcessor()), $ipnData);
if ($webhook->isValid()) {
// Get the transaction ID
$this->eventType = $webhook->eventType;
$this->trxnId = $webhook->payload->id;
}
parent::__construct();
......@@ -72,7 +73,7 @@ class CRM_Core_Payment_AuthNetIPN extends CRM_Core_Payment_BaseIPN {
CRM_Core_Payment_AuthorizeNetCommon::getTransactionKey($this->_paymentProcessor->getPaymentProcessor()),
$this->_paymentProcessor->getIsTestMode() ? AuthnetApiFactory::USE_DEVELOPMENT_SERVER : AuthnetApiFactory::USE_PRODUCTION_SERVER
);
/** @var AuthnetWebhooksResponse $response */
/** @var \JohnConde\Authnet\AuthnetJsonResponse $response */
$response = $request->getTransactionDetailsRequest(['transId' => $this->getTransactionId()]);
if ($response->messages->resultCode !== 'Ok') {
......@@ -83,11 +84,10 @@ class CRM_Core_Payment_AuthNetIPN extends CRM_Core_Payment_BaseIPN {
if ($this->getParamFromResponse($response, 'is_recur')) {
$this->contribution_recur_id = $this->getRecurringContributionIDFromSubscriptionID($this->getParamFromResponse($response, 'subscription_id'));
}
$this->event_type = $response->getEventType();
$this->event_date = date('YmdHis', strtotime($response->getEventDate()));
// Process the event
switch ($response->getEventType()) {
switch ($this->eventType) {
case 'net.authorize.payment.authcapture.created':
// Notifies you that an authorization and capture transaction was created.
if ($this->getParamFromResponse($response, 'is_recur')) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment