Loading frontend/email_invite.html +7 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,13 @@ flags: name="ref" type="hidden" /> <input class="requestInput" id="shop" name="shop" type="hidden" /> <div class="field has-text-centered" id="buttonField"> <div class="control"> <button class="button button-primary is-rounded" id="submitButton" type="submit"> Loading frontend/js/email-invite.js +4 −0 Original line number Diff line number Diff line Loading @@ -86,10 +86,14 @@ $(document).ready(function () { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const referrerCode = urlParams.get('ref'); const shopLocation = urlParams.get('shop') let endPoint = `/signup/process_email_invite.php?lang=${lang}`; if (referrerCode != null) { document.getElementById("ref").value = referrerCode; } if (shopLocation != null) { document.getElementById("shop").value = shopLocation; } $.post( endPoint, $("#inviteRequestForm").serialize(), Loading frontend/js/register.js +2 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ $(document).ready(function () { } else { const refCode = searchParams.has('ref')? searchParams.get('ref') : null; const shopLocation = searchParams.has('shop')? searchParams.get('shop') : null; //post data url = $("#registrationform").attr("action"); Loading @@ -177,6 +178,7 @@ $(document).ready(function () { authmail: authmail, authsecret: authsecret, ref: refCode, shop: shopLocation, tosAccepted: tosAccepted, }, function (response) { Loading htdocs/accounts/wp_account_creator.php +6 −3 Original line number Diff line number Diff line Loading @@ -5,11 +5,14 @@ class WPAccountCreator implements AccountCreator { private string $wordPressUrl; private string $wordPressCredentials; public function __construct(string $wordPressUrl, string $username, string $appPassword) private string $wordPressUserUrl; public function __construct(string $wordPressUrl, string $username, string $appPassword, string $shopLocation = null) { $this->wordPressUrl = endsWith($wordPressUrl, "/") ? $wordPressUrl : $wordPressUrl . "/"; $this->wordPressUserUrl = $this->wordPressUrl . "?rest_route=/wp/v2/users"; $this->wordPressReferralRewardsUrl = $this->wordPressUrl . "?rest_route=/referral-program/v1/reward-referrer"; if ($shopLocation) { $this->wordPressUrl .= $shopLocation . '/'; } $this->wordPressCredentials = base64_encode($username . ":" . $appPassword); } public function validateData(object $userData): ValidatedData Loading Loading @@ -110,7 +113,7 @@ class WPAccountCreator implements AccountCreator return false; } $curl = curl_init(); $url = $this->wordPressReferralRewardsUrl; $url = $this->wordPressUrl . "?rest_route=/referral-program/v1/reward-referrer"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, Loading htdocs/create.php +7 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ $authmail = $_POST['authmail']; $authsecret = $_POST['authsecret']; $tosAccepted = isset($_POST['tosAccepted']) ? $_POST['tosAccepted'] : false; $referrerCode = isset($_POST["ref"]) ? $_POST["ref"] : null; $shopLocation = isset($_POST["shop"]) ? $_POST["shop"] : null; $referrerCode = is_string($referrerCode) ? $referrerCode : null; $resultmail = $mbox . "@" . $mail_domain; Loading Loading @@ -182,6 +183,7 @@ function shouldRewardReferrer(object $userData): bool function createAccounts(array $accountsCreators, object $userData) { global $shopLocation; foreach ($accountsCreators as $accountCreator) { try { $accountCreator->tryToCreate($userData); Loading @@ -196,8 +198,11 @@ function createAccounts(array $accountsCreators, object $userData) $E_SHOP_URL = getenv("E_SHOP_URL"); $E_SHOP_USERNAME = getenv("E_SHOP_USERNAME"); $E_SHOP_APP_PASS = getenv("E_SHOP_APP_PASS"); $wpShop = new \WPAccountCreator($E_SHOP_URL, $E_SHOP_USERNAME, $E_SHOP_APP_PASS); $status = $wpShop->sendWPRewardRequest($userData); if ($shopLocation) { $E_SHOP_APP_PASS = getenv("E_SHOP_APP_PASS_" . strtoupper($shopLocation)); } $wpShop = new \WPAccountCreator($E_SHOP_URL, $E_SHOP_USERNAME, $E_SHOP_APP_PASS, $shopLocation); $status = $wpShop->sendWPRewardRequest($userData, $shopLocation); } } Loading Loading
frontend/email_invite.html +7 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,13 @@ flags: name="ref" type="hidden" /> <input class="requestInput" id="shop" name="shop" type="hidden" /> <div class="field has-text-centered" id="buttonField"> <div class="control"> <button class="button button-primary is-rounded" id="submitButton" type="submit"> Loading
frontend/js/email-invite.js +4 −0 Original line number Diff line number Diff line Loading @@ -86,10 +86,14 @@ $(document).ready(function () { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const referrerCode = urlParams.get('ref'); const shopLocation = urlParams.get('shop') let endPoint = `/signup/process_email_invite.php?lang=${lang}`; if (referrerCode != null) { document.getElementById("ref").value = referrerCode; } if (shopLocation != null) { document.getElementById("shop").value = shopLocation; } $.post( endPoint, $("#inviteRequestForm").serialize(), Loading
frontend/js/register.js +2 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ $(document).ready(function () { } else { const refCode = searchParams.has('ref')? searchParams.get('ref') : null; const shopLocation = searchParams.has('shop')? searchParams.get('shop') : null; //post data url = $("#registrationform").attr("action"); Loading @@ -177,6 +178,7 @@ $(document).ready(function () { authmail: authmail, authsecret: authsecret, ref: refCode, shop: shopLocation, tosAccepted: tosAccepted, }, function (response) { Loading
htdocs/accounts/wp_account_creator.php +6 −3 Original line number Diff line number Diff line Loading @@ -5,11 +5,14 @@ class WPAccountCreator implements AccountCreator { private string $wordPressUrl; private string $wordPressCredentials; public function __construct(string $wordPressUrl, string $username, string $appPassword) private string $wordPressUserUrl; public function __construct(string $wordPressUrl, string $username, string $appPassword, string $shopLocation = null) { $this->wordPressUrl = endsWith($wordPressUrl, "/") ? $wordPressUrl : $wordPressUrl . "/"; $this->wordPressUserUrl = $this->wordPressUrl . "?rest_route=/wp/v2/users"; $this->wordPressReferralRewardsUrl = $this->wordPressUrl . "?rest_route=/referral-program/v1/reward-referrer"; if ($shopLocation) { $this->wordPressUrl .= $shopLocation . '/'; } $this->wordPressCredentials = base64_encode($username . ":" . $appPassword); } public function validateData(object $userData): ValidatedData Loading Loading @@ -110,7 +113,7 @@ class WPAccountCreator implements AccountCreator return false; } $curl = curl_init(); $url = $this->wordPressReferralRewardsUrl; $url = $this->wordPressUrl . "?rest_route=/referral-program/v1/reward-referrer"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, Loading
htdocs/create.php +7 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ $authmail = $_POST['authmail']; $authsecret = $_POST['authsecret']; $tosAccepted = isset($_POST['tosAccepted']) ? $_POST['tosAccepted'] : false; $referrerCode = isset($_POST["ref"]) ? $_POST["ref"] : null; $shopLocation = isset($_POST["shop"]) ? $_POST["shop"] : null; $referrerCode = is_string($referrerCode) ? $referrerCode : null; $resultmail = $mbox . "@" . $mail_domain; Loading Loading @@ -182,6 +183,7 @@ function shouldRewardReferrer(object $userData): bool function createAccounts(array $accountsCreators, object $userData) { global $shopLocation; foreach ($accountsCreators as $accountCreator) { try { $accountCreator->tryToCreate($userData); Loading @@ -196,8 +198,11 @@ function createAccounts(array $accountsCreators, object $userData) $E_SHOP_URL = getenv("E_SHOP_URL"); $E_SHOP_USERNAME = getenv("E_SHOP_USERNAME"); $E_SHOP_APP_PASS = getenv("E_SHOP_APP_PASS"); $wpShop = new \WPAccountCreator($E_SHOP_URL, $E_SHOP_USERNAME, $E_SHOP_APP_PASS); $status = $wpShop->sendWPRewardRequest($userData); if ($shopLocation) { $E_SHOP_APP_PASS = getenv("E_SHOP_APP_PASS_" . strtoupper($shopLocation)); } $wpShop = new \WPAccountCreator($E_SHOP_URL, $E_SHOP_USERNAME, $E_SHOP_APP_PASS, $shopLocation); $status = $wpShop->sendWPRewardRequest($userData, $shopLocation); } } Loading