forked from Yuri-Lima/Perfex-Hook-List
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.php
More file actions
70 lines (54 loc) · 1.89 KB
/
hooks.php
File metadata and controls
70 lines (54 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/* From version 1.2.0 my_functions_helper.php removed from the main files and need to be created when needed.
/* Upload this file to application/helpers IF DONT EXISTS */
/* Add your own functions here */
defined('BASEPATH') or exit('No direct script access allowed');
function client_added($data) {
$clientid = &get_instance();
$curl = curl_init();
$headers = [
'content-type: lication/x-www-form-urlencoded'
];
$info = [
];
$body = [
'name' => get_staff_user_id(),//$data['ID'],
'number' => '353834191605',
'message' => "Novo Cliente Adcionado no Perfex do Yuri teste'\n'"
];
curl_setopt_array($curl,[
CURLOPT_URL => "https://whatsappversion2.herokuapp.com/send-message",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
// CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $body
]);
$response = curl_exec($curl);
$status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE)
curl_close($curl);
return $data;
}
hooks()->add_action('before_client_updated','client_added', 10);
function invoice_notify($id) {
$clientid = &get_instance();
$curl = curl_init();
$headers = [
'content-type: lication/x-www-form-urlencoded'
];
$body = [
'name' => $clientid,
'number' => '353834191605',
'message' => 'Fatura Gerada Perfex'
//$invoice_id $email
];
curl_setopt_array($curl,[
CURLOPT_URL => "https://whatsappversion2.herokuapp.com/send-message",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
// CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $body
]);
$response = curl_exec($curl);
curl_close($curl);
}
hooks()->add_action('after_invoice_added','invoice_notify', 10);