Ask tekstmelding for purchase date. Fallback to legacy din_sms_sent
This commit is contained in:
1 parent
669b1325de
commit
c69ae02301
2 files changed
+27
No files matched your search
@@ -5,4 +5,5 @@
|
||||
define("REGISTRATION_URL_TIMEOUT_DAYS", 3);
|
||||
define("MAILCHIMP_API_KEY", "");
|
||||
define("MAILCHIMP_LIST_ID", "004f53d7c6");
|
||||
define("TEKSTMELDING_API_KEY", 'qwertyuiop');
|
||||
?>
|
||||
@@ -588,7 +588,33 @@ function save_activation_form($data) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function get_purchase_date($phone, $activation_code) {
|
||||
$url = "https://tekstmelding.neuf.no/inside-code-purchase-date";
|
||||
|
||||
$params = array(
|
||||
'api_key' => TEKSTMELDING_API_KEY,
|
||||
'number' => str_replace('+', '', $phone),
|
||||
'activation_code' => $activation_code,
|
||||
);
|
||||
$url .= '?' . http_build_query($params);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$timestamp = clean_timestamp($result);
|
||||
|
||||
if ($timestamp === false) {
|
||||
return get_purchase_date_legacy($phone, $activation_code);
|
||||
}
|
||||
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
function get_purchase_date_legacy($phone, $activation_code) {
|
||||
global $conn;
|
||||
$gsm = substr($phone, 3); // strip off country code
|
||||
|
||||
|
||||
Reference in new issue
Block a user