Browse Source

покупаем вип

master
gsd 2 years ago
parent
commit
647c472975
  1. 31
      src/main/java/app/controllers/user/ProfileController.java
  2. 3
      src/main/resources/application.yaml

31
src/main/java/app/controllers/user/ProfileController.java

@ -1,5 +1,6 @@
package app.controllers.user;
import app.annotations.enums.AuthMethod;
import app.annotations.interfaces.CheckWebAccess;
import app.entities.SocialAuth;
import app.services.ProfileService;
@ -8,6 +9,7 @@ import app.services.db.FreeVIPService;
import app.utils.SteamIDConverter;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@ -19,6 +21,11 @@ public class ProfileController {
private FreeVIPService freeVIPService;
private ReportService reportService;
@Value("${backend.vip.buy.steam}")
private String STEAM_TRADE;
@Value("${backend.vip.buy.qiwi}")
private String QIWI_LINK;
@Autowired
public ProfileController(ProfileService profileService,
FreeVIPService freeVIPService,
@ -65,4 +72,28 @@ public class ProfileController {
text
), HttpStatus.OK);
}
@GetMapping("/buyvip")
@CheckWebAccess(auth_method = AuthMethod.STEAM64)
public ResponseEntity BuyVIP(HttpServletRequest request,
@CookieValue(value = "steam64", defaultValue = "") String steam64,
@RequestParam String buy_type,
@RequestParam(required = false, defaultValue = "") Integer cost) {
switch (buy_type) {
case "steam":{
return ResponseEntity.status(HttpStatus.FOUND)
.header("Location", STEAM_TRADE)
.build();
}
case "qiwi":
String steam2 = profileService.GetProfile(steam64, "").getSteamids().steam2;
return ResponseEntity.status(HttpStatus.FOUND)
.header("Location", String.valueOf(QIWI_LINK).replace("(AMOUNT)", String.valueOf(cost)).replace("(COMMENT)", steam2))
.build();
default:
return ResponseEntity.status(HttpStatus.FOUND)
.header("Location", "http://www.consultant.ru/document/cons_doc_LAW_6300/4e3d0ddc5edee16d48ad06866de7851fa2a55b3e/")
.build();
}
}
}

3
src/main/resources/application.yaml

@ -46,6 +46,9 @@ backend:
kd: 300
vip:
discord: ${VIP_DISCORD_WEBHOOK}
buy:
steam: ${VIP_STEAMTRADE}
qiwi: ${VIP_QIWILINK}
a2s:
backend_url: ${A2S_BACKEND_URL}

Loading…
Cancel
Save