PluginProbe ʕ •ᴥ•ʔ
CommerceBird – AI Command Center, ERP Integrations & B2B for WooCommerce (Zoho, Exact Online). / 2.4.2
CommerceBird – AI Command Center, ERP Integrations & B2B for WooCommerce (Zoho, Exact Online). v2.4.2
3.0.3 3.0.2 3.0.1 trunk 2.2.14 2.2.15 2.2.16 2.2.17 2.2.18 2.2.19 2.3.0 2.3.1 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1 2.5.2 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.7.91 2.7.92 2.7.93 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0
commercebird / includes / classes / zoho-crm / class-zcrm-contact.php
commercebird / includes / classes / zoho-crm Last commit date
class-zcrm-contact.php 1 year ago class-zcrm-modules.php 1 year ago class-zcrm-product.php 11 months ago class-zcrm-salesorder.php 1 year ago index.php 1 year ago
class-zcrm-contact.php
78 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 use CMBIRD_API_Handler_Zoho;
8
9 class CMBIRD_ZCRM_Contact {
10
11 /**
12 * create API Get call to Zoho CRM to get all contacts
13 *
14 * @return array | \WP_Error
15 */
16 public function cmbird_get_contacts() {
17 $zoho_crm_url = get_option( 'cmbird_zoho_crm_url' );
18 $url = $zoho_crm_url . 'crm/v2/Contacts';
19 $execute_curl_call_handle = new CMBIRD_API_Handler_Zoho();
20 $json = $execute_curl_call_handle->execute_curl_call_get( $url );
21 if ( is_wp_error( $json ) ) {
22 return $json;
23 } else {
24 // Parse the response
25 $parsed_contacts = array();
26
27 foreach ( $json->data as $contact ) {
28 $parsed_contacts[] = array(
29 'id' => $contact->id,
30 'contact_name' => $contact->contact_name,
31 'account_name' => $contact->account_name,
32 'contact_type' => $contact->contact_type,
33 'phone' => $contact->phone,
34 'email' => $contact->email,
35 'website' => $contact->website,
36 'created_time' => $contact->created_time,
37 'modified_time' => $contact->modified_time,
38 );
39 }
40
41 return $parsed_contacts;
42 }
43 }
44
45 /**
46 * create API Get call to Zoho CRM to get a contact
47 *
48 * @param contact_id $contact_id - contact id
49 * @return array | \WP_Error
50 */
51 public function cmbird_get_contact( $contact_id ) {
52 $zoho_crm_url = get_option( 'cmbird_zoho_crm_url' );
53 $url = $zoho_crm_url . 'crm/v2/Contacts/' . $contact_id;
54 $execute_curl_call_handle = new CMBIRD_API_Handler_Zoho();
55 $json = $execute_curl_call_handle->execute_curl_call_get( $url );
56 if ( is_wp_error( $json ) ) {
57 return $json;
58 } else {
59 // Parse the response
60 $parsed_contact = array();
61
62 $parsed_contact = array(
63 'id' => $json->data->id,
64 'contact_name' => $json->data->contact_name,
65 'account_name' => $json->data->account_name,
66 'contact_type' => $json->data->contact_type,
67 'phone' => $json->data->phone,
68 'email' => $json->data->email,
69 'website' => $json->data->website,
70 'created_time' => $json->data->created_time,
71 'modified_time' => $json->data->modified_time,
72 );
73
74 return $parsed_contact;
75 }
76 }
77 }
78