Skip to content
Snippets Groups Projects
Commit 04bbde9f authored by bewe's avatar bewe
Browse files

feat: add email

parent 317c2a89
Branches
No related merge requests found
<?php <?php
function buyItem($merchId, $userId) function buyItem($merchId, $userId, $email)
{ {
// rest buy merchandise // rest buy merchandise
$ch = curl_init(); $ch = curl_init();
...@@ -12,7 +12,8 @@ function buyItem($merchId, $userId) ...@@ -12,7 +12,8 @@ function buyItem($merchId, $userId)
CURLOPT_POSTFIELDS, CURLOPT_POSTFIELDS,
json_encode( json_encode(
array( array(
"user_id" => (int)$userId "user_id" => (int)$userId,
"email" => $email
) )
) )
); );
...@@ -31,7 +32,8 @@ function buyItem($merchId, $userId) ...@@ -31,7 +32,8 @@ function buyItem($merchId, $userId)
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['buyMerch'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['buyMerch'])) {
$merchId = $_POST['merchId']; $merchId = $_POST['merchId'];
$userId = $_POST['userId']; $userId = $_POST['userId'];
$email = $_POST['email'];
buyItem($merchId, $userId); buyItem($merchId, $userId, $email);
} }
?> ?>
\ No newline at end of file
...@@ -8,6 +8,7 @@ class Merchandise extends Controller ...@@ -8,6 +8,7 @@ class Merchandise extends Controller
$data["pageTitle"] = "Merch!"; $data["pageTitle"] = "Merch!";
$data["user_id"] = $_SESSION['user_id']; $data["user_id"] = $_SESSION['user_id'];
$data["email"] = $_SESSION['email'];
// user's gems // user's gems
$baseUrl = 'http://soap:8080/service/gems'; $baseUrl = 'http://soap:8080/service/gems';
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<form action="../../../api/merch/buy.php" method="post"> <form action="../../../api/merch/buy.php" method="post">
<input type="hidden" name="merchId" value="<?= $merch['merchandise_id'] ?>"> <input type="hidden" name="merchId" value="<?= $merch['merchandise_id'] ?>">
<input type="hidden" name="userId" value="<?= $data['user_id'] ?>"> <input type="hidden" name="userId" value="<?= $data['user_id'] ?>">
<input type="hidden" name="email" value="<?= $data['email'] ?>">
<button type="submit" name="buyMerch">Buy</button> <button type="submit" name="buyMerch">Buy</button>
</form> </form>
</div> </div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment