Skip to content

Commit

Permalink
API changelog eventbrite.
Browse files Browse the repository at this point in the history
  • Loading branch information
harshal6 committed Oct 17, 2020
1 parent 79f66ba commit 4e1451b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions CRM/Eventbrite/Form/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions settings/Eventbrite.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '',
),
);

0 comments on commit 4e1451b

Please sign in to comment.