From 4e1451b638cbfeb10a0ba5f534acb21838a0a37f Mon Sep 17 00:00:00 2001 From: Harshal Date: Sat, 17 Oct 2020 16:25:40 +0530 Subject: [PATCH] API changelog eventbrite. --- CRM/Eventbrite/Form/Settings.php | 10 ++++++---- settings/Eventbrite.setting.php | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CRM/Eventbrite/Form/Settings.php b/CRM/Eventbrite/Form/Settings.php index 87c7ae1..ec0f13d 100644 --- a/CRM/Eventbrite/Form/Settings.php +++ b/CRM/Eventbrite/Form/Settings.php @@ -32,6 +32,7 @@ public function __construct( public function buildQuickForm() { $settings = $this->_settings; foreach ($settings as $name => $setting) { + if (isset($setting['quick_form_type'])) { switch ($setting['html_type']) { case 'Select': @@ -285,11 +286,12 @@ private function _validateTokenOnFormLoad() { private function _confirmWebhookOnFormLoad() { if (!$this->_flagSubmitted) { + $organization_id = CRM_Utils_Array::value('eventbrite_api_organization_id', $this->setDefaultValues()); + $request_path = '/organizations/'. $organization_id .'/webhooks/'; if ($token = CRM_Utils_Array::value('eventbrite_api_token', $this->setDefaultValues())) { try { $eb = CRM_Eventbrite_EvenbriteApi::singleton(); - $result = $eb->request('/webhooks/'); - + $result = $eb->request('/organizations/'. $organization_id .'/webhooks/'); $myListener = CRM_Eventbrite_Utils::getWebhookListenerUrl(); $countWebhooksExising = $createdWebhooks = 0; @@ -310,7 +312,7 @@ private function _confirmWebhookOnFormLoad() { 'endpoint_url' => $myListener, 'actions' => "attendee.updated", ); - $result = $eb->request('/webhooks/', $body, NULL, 'POST'); + $result = $eb->request($request_path, $body, NULL, 'POST'); if ($error = CRM_Utils_Array::value('error', $result)) { $error_message = CRM_Utils_Array::value('status_code', $result); $error_message .= ': ' . $error; @@ -326,7 +328,7 @@ private function _confirmWebhookOnFormLoad() { 'endpoint_url' => $myListener, 'actions' => "order.updated", ); - $result = $eb->request('/webhooks/', $body, NULL, 'POST'); + $result = $eb->request( $request_path, $body, NULL, 'POST'); if ($error = CRM_Utils_Array::value('error', $result)) { $error_message = CRM_Utils_Array::value('status_code', $result); $error_message .= ': ' . $error; diff --git a/settings/Eventbrite.setting.php b/settings/Eventbrite.setting.php index c61a5af..280c7c9 100644 --- a/settings/Eventbrite.setting.php +++ b/settings/Eventbrite.setting.php @@ -55,8 +55,8 @@ 'description' => E::ts('Eventbrite system ID for the Eventbrite organization to which all linked events will belong.'), 'title' => E::ts('Eventbrite API Organization ID'), 'html_type' => 'Text', - // Omitting this line causes the setting to be omitted from the Settings form: - // 'quick_form_type' => 'Element', + // adding it back to implement the new api. + 'quick_form_type' => 'Element', 'description' => '', ), );