Last active
May 24, 2022 14:00
-
-
Save saulmoralespa/0950069326b3302457dad8c2060c9633 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function return_get_user() { | |
$apikey_config = return_generate_apikey(get_option('mpq_email'), get_option('mpq_password')); | |
$url = get_url_api() . 'getUser'; | |
$curl = curl_init($url); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json', | |
'session-tracker:a0c96ea6-b22d-4fb7-a278-850678d5429c', | |
'apikey:' . $apikey_config, | |
)); | |
$result_getUser = curl_exec($curl); | |
curl_close($curl); | |
$result_getUser_json = json_decode($result_getUser, true); | |
$name = $result_getUser_json['name'] . " " . $result_getUser_json['surname']; | |
$address = $result_getUser_json['address']; | |
$locationCode = $result_getUser_json['locationCode']; | |
$email = $result_getUser_json['email']; | |
$cellPhone = $result_getUser_json['cellPhone']; | |
$documentNumber = $result_getUser_json['documentNumber']; | |
$documentType = $result_getUser_json['documentType']; | |
if ($result_getUser_json['clientType'] == "SaaS" ) { | |
$clientType = $result_getUser_json['clientType']; | |
} | |
else { | |
$clientType = 'Usuario Mipaquete'; | |
} | |
$dataUser = array($name, $address, $locationCode, $email, $cellPhone, $documentNumber, $documentType, $clientType); | |
return apply_filters( 'shipping_mipaquete_data_user', $dataUser); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment