Ïnitial Commit App
This commit is contained in:
parent
ebde8bc052
commit
f9dee33e2f
26 changed files with 6860 additions and 0 deletions
70
webhook/app-uninstalled.php
Normal file
70
webhook/app-uninstalled.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/common_function.php';
|
||||
include_once '../user/user_functions.php';
|
||||
|
||||
if (MODE == 'dev') {
|
||||
$shop = $_GET['shop'];
|
||||
} else {
|
||||
$shop = isset($_SERVER['X-Shopify-Shop-Domain']) ? $_SERVER['X-Shopify-Shop-Domain'] : $_SERVER['HTTP_X_SHOPIFY_SHOP_DOMAIN'];
|
||||
}
|
||||
|
||||
$cf_obj = new common_function();
|
||||
$us_obj = new User_functions($shop);
|
||||
|
||||
$shop_name = $email = $store_user_id = '';
|
||||
$where = array('shop' => $shop);
|
||||
$shop_detail = $cf_obj->select_row(TABLE_USER_STORES, 'store_user_id, name, shop, email', $where);
|
||||
if(!empty($shop_detail)){
|
||||
$store_user_id = $shop_detail['store_user_id'];
|
||||
$shop_name = $shop_detail['name'];
|
||||
$shopdom = $shop_detail['shop'];
|
||||
$email = $shop_detail['email'];
|
||||
|
||||
//save plugin is deactive on plugins db this plugin
|
||||
$cf_obj->plugin_active_inactive($shop_detail, 0);
|
||||
|
||||
//remove the js script from html
|
||||
// SEND API CALL
|
||||
$data = array(
|
||||
'domain' => $shopdom,
|
||||
'user_domain' => $shopdom,
|
||||
'email' => $email,
|
||||
'user_email' => $email,
|
||||
'secret' => '$2y$10$9ygTfodVBVM0XVCdyzEUK.0FIuLnJT0D42sIE6dIu9r/KY3XaXXyS',
|
||||
'platform' => 'shopify',
|
||||
'status'=>'0'
|
||||
);
|
||||
|
||||
// /******* Curl call start *****/
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://seersco.com/api/banner-settings",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => $data
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$error_number = curl_errno($curl);
|
||||
$error_message = curl_error($curl);
|
||||
curl_close($curl);
|
||||
|
||||
$result = json_decode($response, TRUE);
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'status' => '0',
|
||||
'app_status' => '0',
|
||||
'toggle_status' => '0'
|
||||
);
|
||||
$where = array('shop' => $shop);
|
||||
$cf_obj->update(TABLE_USER_STORES, $fields, $where);
|
||||
?>
|
48
webhook/customer-data.php
Normal file
48
webhook/customer-data.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/common_function.php';
|
||||
|
||||
/* Common function object */
|
||||
$cf_obj = new common_function();
|
||||
|
||||
$shop_info = file_get_contents('php://input');
|
||||
|
||||
/* shop info array */
|
||||
$shop_info = json_decode($shop_info, TRUE);
|
||||
|
||||
$selected_field = 'store_user_id,email';
|
||||
$where = array('shop' => $shop_info['shop_domain']);
|
||||
$table_shop_info = $cf_obj->select_row(TABLE_USER_STORES, $selected_field, $where);
|
||||
|
||||
if ($table_shop_info != '' && !empty($table_shop_info) && $table_shop_info['email'] != '') {
|
||||
$fields = array(
|
||||
'domain' => '',
|
||||
'owner' => '',
|
||||
'shop_plan' => '',
|
||||
'money_format' => '',
|
||||
'currency' => '',
|
||||
'address1' => '',
|
||||
'address2' => '',
|
||||
'city' => '',
|
||||
'country_name' => '',
|
||||
'phone' => '',
|
||||
'province' => '',
|
||||
'zip' => '',
|
||||
'timezone' => '',
|
||||
'iana_timezone' => '',
|
||||
'weight_unit' => ''
|
||||
);
|
||||
|
||||
$where = array('shop' => $shop_info['shop_domain']);
|
||||
$cf_obj->update(TABLE_USER_STORES, $fields, $where);
|
||||
|
||||
/**
|
||||
* Declare array table data deleted after app uninstall rule GDPR
|
||||
*/
|
||||
$table_array = array();
|
||||
|
||||
foreach ($table_array as $table) {
|
||||
$where = array('store_user_id' => $table_shop_info['store_user_id']);
|
||||
$cf_obj->delete($table, $where);
|
||||
}
|
||||
}
|
48
webhook/customer-request.php
Normal file
48
webhook/customer-request.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/common_function.php';
|
||||
|
||||
/* Common function object */
|
||||
$cf_obj = new common_function();
|
||||
|
||||
$shop_info = file_get_contents('php://input');
|
||||
|
||||
/* shop info array */
|
||||
$shop_info = json_decode($shop_info, TRUE);
|
||||
|
||||
$selected_field = 'store_user_id,email';
|
||||
$where = array('shop' => $shop_info['shop_domain']);
|
||||
$table_shop_info = $cf_obj->select_row(TABLE_USER_STORES, $selected_field, $where);
|
||||
|
||||
if ($table_shop_info != '' && !empty($table_shop_info) && $table_shop_info['email'] != '') {
|
||||
$fields = array(
|
||||
'domain' => '',
|
||||
'owner' => '',
|
||||
'shop_plan' => '',
|
||||
'money_format' => '',
|
||||
'currency' => '',
|
||||
'address1' => '',
|
||||
'address2' => '',
|
||||
'city' => '',
|
||||
'country_name' => '',
|
||||
'phone' => '',
|
||||
'province' => '',
|
||||
'zip' => '',
|
||||
'timezone' => '',
|
||||
'iana_timezone' => '',
|
||||
'weight_unit' => ''
|
||||
);
|
||||
|
||||
$where = array('shop' => $shop_info['shop_domain']);
|
||||
$cf_obj->update(TABLE_USER_STORES, $fields, $where);
|
||||
|
||||
/**
|
||||
* Declare array table data deleted after app uninstall rule GDPR
|
||||
*/
|
||||
$table_array = array();
|
||||
|
||||
foreach ($table_array as $table) {
|
||||
$where = array('store_user_id' => $table_shop_info['store_user_id']);
|
||||
$cf_obj->delete($table, $where);
|
||||
}
|
||||
}
|
11
webhook/index.html
Normal file
11
webhook/index.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
38
webhook/shop-info-remove.php
Normal file
38
webhook/shop-info-remove.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/common_function.php';
|
||||
|
||||
/* Common function object */
|
||||
$cf_obj = new common_function();
|
||||
|
||||
$shop_info = file_get_contents('php://input');
|
||||
|
||||
/* shop info array */
|
||||
$shop_info = json_decode($shop_info, TRUE);
|
||||
|
||||
$selected_field = 'store_user_id,email';
|
||||
$where = array('shop' => $shop_info['shop_domain']);
|
||||
$table_shop_info = $cf_obj->select_row(TABLE_USER_STORES, $selected_field, $where);
|
||||
|
||||
if ($table_shop_info != '' && !empty($table_shop_info) && $table_shop_info['email'] != '') {
|
||||
$fields = array(
|
||||
'domain' => '',
|
||||
'owner' => '',
|
||||
'shop_plan' => '',
|
||||
'money_format' => '',
|
||||
'currency' => '',
|
||||
'address1' => '',
|
||||
'address2' => '',
|
||||
'city' => '',
|
||||
'country_name' => '',
|
||||
'phone' => '',
|
||||
'province' => '',
|
||||
'zip' => '',
|
||||
'timezone' => '',
|
||||
'iana_timezone' => '',
|
||||
'weight_unit' => ''
|
||||
);
|
||||
|
||||
$where = array('shop' => $shop_info['shop_domain']);
|
||||
$cf_obj->update(TABLE_USER_STORES, $fields, $where);
|
||||
}
|
42
webhook/shop-update.php
Normal file
42
webhook/shop-update.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/common_function.php';
|
||||
|
||||
$shop = $_SERVER['HTTP_X_SHOPIFY_SHOP_DOMAIN'];
|
||||
|
||||
$cf_obj = new common_function($shop);
|
||||
|
||||
$hmac_header = $_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256'];
|
||||
|
||||
/* Here we get all information about customer */
|
||||
$shop_update = file_get_contents('php://input');
|
||||
|
||||
/* Todo: checked verify_webhook response(return type ) than set condition according to it */
|
||||
$verified = $cf_obj->verify_webhook($shop_update, $hmac_header);
|
||||
|
||||
if (!empty($cf_obj) && $verified && $cf_obj->is_json($shop_update)) {
|
||||
/* shop detail array */
|
||||
$shop_detail_arr = json_decode($shop_update, TRUE);
|
||||
$fields = array(
|
||||
'currency' => $shop_detail_arr['currency'],
|
||||
'money_format' => mysqli_real_escape_string($cf_obj->db_connection, $shop_detail_arr['money_format']),
|
||||
'owner' => $shop_detail_arr['shop_owner'],
|
||||
'shop_plan' => $shop_detail_arr['plan_name'],
|
||||
'address1' => $shop_detail_arr['address1'],
|
||||
'address2' => $shop_detail_arr['address2'],
|
||||
'city' => $shop_detail_arr['city'],
|
||||
'country_name' => $shop_detail_arr['country_name'],
|
||||
'phone' => $shop_detail_arr['phone'],
|
||||
'province' => $shop_detail_arr['province'],
|
||||
'zip' => $shop_detail_arr['zip'],
|
||||
'timezone' => $shop_detail_arr['timezone'],
|
||||
'iana_timezone' => $shop_detail_arr['iana_timezone'],
|
||||
'domain' => $shop_detail_arr['domain'],
|
||||
'weight_unit' => $shop_detail_arr['weight_unit'],
|
||||
);
|
||||
|
||||
$selected_field = 'shop_plan, store_user_id';
|
||||
$where = array('shop' => $shop);
|
||||
$shop_info_db = $cf_obj->select_row(TABLE_USER_STORES, $selected_field, $where);
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue