Merge remote-tracking branch 'origin/develop' into BETTERZON-140

This commit is contained in:
Jegor 2021-06-17 17:19:07 +02:00
commit 012de346e8
17 changed files with 2158 additions and 1937 deletions

View File

@ -25,8 +25,8 @@ crawlingstatusRouter.get('/', async (req: Request, res: Response) => {
try { try {
// Authenticate user // Authenticate user
const user_ip = req.connection.remoteAddress ?? ''; const user_ip = req.connection.remoteAddress ?? '';
const session_id = req.body.session_id; const session_id = (req.query.session_id ?? '').toString();
const session_key = req.body.session_key; const session_key = (req.query.session_key ?? '').toString();
const user = await UserService.checkSession(session_id, session_key, user_ip); const user = await UserService.checkSession(session_id, session_key, user_ip);
if (!user.is_admin) { if (!user.is_admin) {

View File

@ -24,8 +24,8 @@ favoriteshopsRouter.get('/', async (req: Request, res: Response) => {
try { try {
// Authenticate user // Authenticate user
const user_ip = req.connection.remoteAddress ?? ''; const user_ip = req.connection.remoteAddress ?? '';
const session_id = req.params.session_id; const session_id = (req.query.session_id ?? '').toString();
const session_key = req.params.session_key; const session_key = (req.query.session_key ?? '').toString();
const user = await UserService.checkSession(session_id, session_key, user_ip); const user = await UserService.checkSession(session_id, session_key, user_ip);
const priceAlarms = await FavoriteShopsService.getFavoriteShops(user.user_id); const priceAlarms = await FavoriteShopsService.getFavoriteShops(user.user_id);
@ -76,8 +76,8 @@ favoriteshopsRouter.delete('/:id', async (req: Request, res: Response) => {
try { try {
// Authenticate user // Authenticate user
const user_ip = req.connection.remoteAddress ?? ''; const user_ip = req.connection.remoteAddress ?? '';
const session_id = req.params.session_id; const session_id = (req.query.session_id ?? '').toString();
const session_key = req.params.session_key; const session_key = (req.query.session_key ?? '').toString();
const user = await UserService.checkSession(session_id, session_key, user_ip); const user = await UserService.checkSession(session_id, session_key, user_ip);
// Get info for price alarm creation // Get info for price alarm creation

View File

@ -24,8 +24,8 @@ pricealarmsRouter.get('/', async (req: Request, res: Response) => {
try { try {
// Authenticate user // Authenticate user
const user_ip = req.connection.remoteAddress ?? ''; const user_ip = req.connection.remoteAddress ?? '';
const session_id = req.params.session_id; const session_id = (req.query.session_id ?? '').toString();
const session_key = req.params.session_key; const session_key = (req.query.session_key ?? '').toString();
const user = await UserService.checkSession(session_id, session_key, user_ip); const user = await UserService.checkSession(session_id, session_key, user_ip);
const priceAlarms = await PriceAlarmsService.getPriceAlarms(user.user_id); const priceAlarms = await PriceAlarmsService.getPriceAlarms(user.user_id);
@ -106,3 +106,29 @@ pricealarmsRouter.put('/', async (req: Request, res: Response) => {
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'})); res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
} }
}); });
// DELETE pricealarms/:id
pricealarmsRouter.delete('/:id', async (req, res) => {
try {
// Authenticate user
const user_ip = req.connection.remoteAddress ?? '';
const session_id = (req.query.session_id ?? '').toString();
const session_key = (req.query.session_key ?? '').toString();
const user = await UserService.checkSession(session_id, session_key, user_ip);
const id: number = parseInt(req.params.id, 10);
const success = await PriceAlarmsService.deletePriceAlarm(id, user.user_id);
if (success) {
res.status(200).send(JSON.stringify({success: true}));
return;
} else {
res.status(500).send(JSON.stringify({success: false}));
return;
}
} catch (e) {
console.log('Error handling a request: ' + e.message);
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
}
});

View File

@ -92,3 +92,24 @@ export const updatePriceAlarm = async (alarm_id: number, user_id: number, define
} }
} }
}; };
/**
* Deletes the given price alarm
* @param alarm_id The id of the price alarm to update
* @param user_id The id of the user that wants to update the price alarm
*/
export const deletePriceAlarm = async (alarm_id: number, user_id: number): Promise<boolean> => {
let conn;
try {
conn = await pool.getConnection();
const res = await conn.query('DELETE FROM price_alarms WHERE alarm_id = ? AND user_id = ?', [alarm_id, user_id]);
return res.affectedRows === 1;
} catch (err) {
throw err;
} finally {
if (conn) {
conn.end();
}
}
};

View File

@ -282,11 +282,11 @@ export const getBestDeals = async (amount: number): Promise<Prices> => {
'price_in_cents': lowestPrice.price_in_cents, 'price_in_cents': lowestPrice.price_in_cents,
'timestamp': lowestPrice.timestamp, 'timestamp': lowestPrice.timestamp,
'amazonDifference': (amazonPrice.price_in_cents - lowestPrice.price_in_cents), 'amazonDifference': (amazonPrice.price_in_cents - lowestPrice.price_in_cents),
'amazonDifferencePercent': ((1 - (lowestPrice.price_in_cents / amazonPrice.price_in_cents)) * 100), 'amazonDifferencePercent': ((amazonPrice.price_in_cents / lowestPrice.price_in_cents) * 100),
}; };
// Push only deals were the amazon price is actually higher // Push only deals were the amazon price is actually higher
if (deal.amazonDifferencePercent > 0) { if (deal.amazonDifferencePercent > 0 && deal.amazonDifference > 0) {
deals.push(deal as Deal); deals.push(deal as Deal);
} }
} }

View File

@ -37,8 +37,8 @@ vendorsRouter.get('/managed', async (req: Request, res: Response) => {
try { try {
// Authenticate user // Authenticate user
const user_ip = req.connection.remoteAddress ?? ''; const user_ip = req.connection.remoteAddress ?? '';
const session_id = req.params.session_id; const session_id = (req.query.session_id ?? '').toString();
const session_key = req.params.session_key; const session_key = (req.query.session_key ?? '').toString();
const user = await UserService.checkSession(session_id, session_key, user_ip); const user = await UserService.checkSession(session_id, session_key, user_ip);
const vendors = await VendorService.getManagedShops(user.user_id); const vendors = await VendorService.getManagedShops(user.user_id);

View File

@ -9,7 +9,9 @@ import stepdefs.Preconditions;
@RunWith(Cucumber.class) @RunWith(Cucumber.class)
@CucumberOptions( @CucumberOptions(
features = {"src/test/resource/searchProduct.feature", features = {"src/test/resource/searchProduct.feature",
"src/test/resource/priceAlarms.feature"} "src/test/resource/priceAlarms.feature",
"src/test/resource/favoriteShopList.feature",
"src/test/resource/manageVendor.feature"}
) )
public class RunTest { public class RunTest {

View File

@ -0,0 +1,27 @@
package stepdefs;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class FavoriteShopList {
@Given("^the user has at least (\\d+) favorite shop$")
public void the_user_has_at_least_favorite_shop(int arg1) throws Exception {
}
@When("^the user clicks on favorite shops$")
public void the_user_clicks_on_favorite_shops() throws Exception {
}
@Then("^he should see his favorite shops list$")
public void he_Should_see_his_favorite_shops_list() throws Exception {
}
@When("^he clicks on delete a favorite shop entry$")
public void he_clicks_on_delete_a_favorite_shop_enty() throws Exception {
}
@Then("^the favorite shop entry should be deleted$")
public void the_favorite_shop_entry_should_be_deleted() throws Exception {
}
}

View File

@ -0,0 +1,31 @@
package stepdefs;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class ManageVendor {
@Given("^the user is logged in as vendor manager$")
public void the_user_is_logged_in_as_vendor_manager() throws Exception {
}
@When("^the user opens the shop managing page$")
public void the_user_opens_the_shop_managing_page() throws Exception {
}
@When("^the user clicks on deactivate a listing$")
public void the_user_clicks_on_deactivate_a_listing() throws Exception {
}
@Then("^the listing should be deactivated$")
public void the_listing_should_be_deactivated() throws Exception {
}
@When("^the user clicks on deactivate the shop$")
public void the_user_clicks_on_deactivate_the_shop() throws Exception {
}
@Then("^the shop and all related listings should be deactivated$")
public void the_shop_and_all_related_listings_should_be_deactivated() throws Exception {
}
}

View File

@ -16,7 +16,7 @@ public class SearchProduct {
//throw new PendingException(); //throw new PendingException();
Preconditions.driver.get("https://betterzon.xyz"); Preconditions.driver.get("https://betterzon.xyz");
WebElement logo = (new WebDriverWait(Preconditions.driver, 10)) WebElement logo = (new WebDriverWait(Preconditions.driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.cssSelector(".logo"))); .until(ExpectedConditions.elementToBeClickable(By.cssSelector(".navbar-brand")));
} }
@When("^the user enters the search term \"([^\"]*)\" and clicks search$") @When("^the user enters the search term \"([^\"]*)\" and clicks search$")
@ -25,7 +25,7 @@ public class SearchProduct {
searchField.sendKeys(searchTerm); searchField.sendKeys(searchTerm);
searchField.sendKeys(Keys.ENTER); searchField.sendKeys(Keys.ENTER);
WebElement logo = (new WebDriverWait(Preconditions.driver, 10)) WebElement logo = (new WebDriverWait(Preconditions.driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.cssSelector(".logo"))); .until(ExpectedConditions.elementToBeClickable(By.cssSelector(".navbar-brand")));
} }
@Then("^the user should see the error page \"([^\"]*)\"$") @Then("^the user should see the error page \"([^\"]*)\"$")

View File

@ -0,0 +1,20 @@
Feature: Favorite Shop List
Scenario: Access Favorite Shop List
Given the user is on the landing page
And the user is logged in
And the user has at least 1 favorite shop
When the user clicks on the profile icon
Then the profile details popup should open
When the user clicks on favorite shops
Then he should see his favorite shops list
Scenario: Remove Favorite Shop Entry
Given the user is on the landing page
And the user is logged in
And the user has at least 1 favorite shop
When the user clicks on the profile icon
Then the profile details popup should open
When the user clicks on favorite shops
And he clicks on delete a favorite shop entry
Then the favorite shop entry should be deleted

View File

@ -0,0 +1,15 @@
Feature: Manage Vendor Shop
Scenario: Deactivate Product Listing
Given the user is on the landing page
And the user is logged in as vendor manager
When the user opens the shop managing page
And the user clicks on deactivate a listing
Then the listing should be deactivated
Scenario: Deactivate Shop Completely
Given the user is on the landing page
And the user is logged in as vendor manager
When the user opens the shop managing page
And the user clicks on deactivate the shop
Then the shop and all related listings should be deactivated

View File

@ -1,3 +1,3 @@
<div class="copyright py-4 text-center text-white"> <div class="copyright py-4 text-center text-white">
<div class="container"><small>Copyright &copy; Your Website 2021</small></div> <div class="container"><small>Copyright &copy; Betterzon 2021</small></div>
</div> </div>

View File

@ -445,6 +445,25 @@ export class ApiService {
} }
} }
/**
* Deletes the given price alarm
* @param alarmId the price alarm to delete
* @return Observable<any> The observable response of the api
*/
deletePriceAlarm(alarmId: number): Observable<any> {
try {
const sessionInfo = this.getSessionInfoFromLocalStorage();
let params = new HttpParams();
params = params.append('session_id', sessionInfo.session_id);
params = params.append('session_key', sessionInfo.session_key);
return this.http.delete((this.apiUrl + '/pricealarms/' + alarmId), {params});
} catch (exception) {
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
}
}
/* __ __ /* __ __
/ / / /_______ __________ / / / /_______ __________

View File

@ -1 +1 @@
<mxfile host="app.diagrams.net" modified="2020-12-03T09:39:52.243Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" etag="RUzsjnuqX_zRTCHSTruo" version="13.10.6" type="github"><diagram id="QFWcWedTnleHV76omDGD" name="Page-1">5Vzbdps6EP0aPzYLxMX40Una9JbTNG5Pc56yZFBsWkCukGM7X38kDBgkxXYxt6QPyTJjkGHPnotGIwbGRbi+InAxv8YeCgZA89YD43IAwNDR2H8u2GQCcyuYEd/bivSdYOI/oVSYXjdb+h6KSydSjAPqL8pCF0cRcmlJBgnBq/JpDzgo/+oCzpAkmLgwkKU/fI/Ot1IHDHfy98ifzbNf1u3R9psQZienTxLPoYdXBZHxdmBcEIzp9lO4vkABxy7DZXvdu2e+zW+MoIgec8HTFQDvv94+EF03rj9u7qO7n5dv0lEeYbBMH/gWzfyYIoI8Jv8eI5LePd1kkLAHWfCPyzAYuxSTgXH+iAj1GWif4RQFNzj2qY8jdsoUU4rDwgnjwJ/xLyheMOmchgE70NlH+WmyW2NXonVBlD7dFcIhomTDTsm+NVKkN8Lxaqe4TDQv6MxOZTClyiwfeYcm+5AC+gfgmhK4EpYo8sacpewowhE6EhPklUgrI1J4YkvxxJmMoABS/7FMdRUM6S/cYJ/dSQ440MqAOwKQMV4SF6UXFZkpjGOb+8ehkMwQlcZJdJI/dHU1WX+ZmkZ6RT0d0nfDerJfuZ5EM6isp47tKbvtgqImCBJ3nsRfFk+0G4K9pUtl9QUBi+tcbau5T9FkAV3+zYplFmVVPvhBcIEDHnvYdYYHkfPgMnlMCf6FCt/YroOmD/XEF6BbJVgNS44vOtjDj9oDjC6H79dlEqLHyeE91SSkgZq2CSBpaoooS7OecHS23jxJamOcpGVdlbmd6rJoCKkIpimWy3SKiCL3Cn3PC54zMoKXkYf4o2j1WI0xMsteTTYaU0EgUT/12YwhaeJ7RF5w0is4JdOS8G016dWHh/AdADvg3J4ylO0Z/zSZM2SA9mUVtYU8XtLAj5g1ZbPGmtguqsMx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Z28PaTKGn11E1O0dOxlQ09sTFzekoyj6vKW2dzylhpXINHlWcPKEjd3E/iRh4hx2MSm250ln6e5ALq/Zsl+ky/bAk4qzzIFzrNONnpZ9jM12gPJhbjPrj5DlvO4WwQ9JnkgLBeuwwF2ArToMk1HBrpll1mpwOHBeJ7smdLLoHL5DeTbvKJEAjQjhzR7mwBo3c9mbDrsaEGvHa1ddb+56Ghto2VHW6mU8sJIpmhWeREkE6bww6rVF0tY6LNbrr4AOWceABuG3O8nFe/ykR+5wdJDuXBWOiU9EjnKVDZJD1VztJzBeIEiRQUhL+WUqB3wgs95nhsIu1tfbtvoXl/8J+zX7Xqobjo1+VP7kGOukeqfrp782ysYP9Jfn7/d2T+nWqRoFznCnUqTP0EFCsV3toZQ1ws8Dr5homFFyRMMgkL8yOfxtbbQSRnoUcp8poUurxm2kpSqYKur77U9n3nYliq24T1Pq66M0xA2TVZu9DBsYaCWjbPh5taqE8yTbNkSbDlfAuvMluV+hAZaiGvFzGlza7kSs3qaDvob302npvguDjRsboeGUlGntgi8NEVJ+FZNxNpWlLz+dhPAKEo6+rZ9USblr+uaoBAp26779Hqi07I9QaUOUKzaNLaSrNKN3HD5IVwETBEML66f5CUk1+zukCJQvFq9DFWvVKhJL+xw9xrWrYnt3mVrvP0f</diagram></mxfile> <mxfile host="Electron" modified="2021-06-15T10:10:23.336Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/13.4.5 Chrome/83.0.4103.122 Electron/9.1.0 Safari/537.36" etag="xPXaWnl_FRrq1LtBykUU" version="13.4.5" type="device"><diagram id="QFWcWedTnleHV76omDGD" name="Page-1">5Vzbdps6EP0aP7YLxMXw6CRt0jY5Te1e0qcsGRSbFhAVOL58/ZHMxUZSbBcDxmnXagsDlmHPntFoZuSedhksrgmMpnfYRX4PKO6ip131ALAtQP9lgmUqMEwtFUyI56YidSMYeSuUCZVMOvNcFJduTDD2Ey8qCx0chshJSjJICJ6Xb3vCf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hLJbva0W5AczsNrcVSzF77TvtdauuqYofyeKL8w37kGNL6uemKQHfyj+J0LKixOoTWzz4eCLo69Vs/OZ1ZwNJqaGxEqtMCWLv4ocg8lHA8HL/HUVYsi2gTSliV0Qp61t8D59xVmf7Tl0XJieofAvQShTwMtpKeZ1ZrIvamM6laAMB7YFL6a6EaN6r4bdYasCMLxoXzDsZZkcvAY9aznGzb22N8i/T41QTfJEBzDVftV2Ab4tvrl1ACuLRO2+kKQON+7M7g0BP7hHx6KuwSad2OknaUbrIJy49oFUl1JtiSsxHaplSksZzN/DC9GclWOs5x6+291Ic5fH5vRSmIcYkTe2lkKItrnnvs40UG9CPauc/STDCW4PZ5n4KKc71rFj/1qPtMrC9Ds08pUPTuYnNrOrP+FWA8Fsgld0ZPd38jm16++bHgLV3/wM=</diagram></mxfile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -273,6 +273,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});" "});"
], ],
"type": "text/javascript" "type": "text/javascript"
@ -284,7 +286,7 @@
"header": [], "header": [],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\r\n \"vendor_id\": 7,\r\n \"first_name\": \"Test\",\r\n \"last_name\": \"Contact\",\r\n \"gender\": \"Unix\",\r\n \"email\": \"testcontact@betterzon.xyz\",\r\n \"phone\": \"+49 123 456789\"\r\n}", "raw": "{\r\n \"session_id\": \"{{session_id}}\",\r\n \"session_key\": \"{{session_key}}\",\r\n \"vendor_id\": 7,\r\n \"first_name\": \"Test\",\r\n \"last_name\": \"Contact\",\r\n \"gender\": \"Unix\",\r\n \"email\": \"testcontact@betterzon.xyz\",\r\n \"phone\": \"+49 123 456789\"\r\n}",
"options": { "options": {
"raw": { "raw": {
"language": "json" "language": "json"
@ -338,6 +340,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});" "});"
], ],
"type": "text/javascript" "type": "text/javascript"
@ -349,7 +353,7 @@
"header": [], "header": [],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\r\n \"vendor_id\": 7,\r\n \"first_name\": \"Test\",\r\n \"last_name\": \"Contact\",\r\n \"gender\": \"Unix\",\r\n \"email\": \"testcontact@betterzon.xyz\",\r\n \"phone\": \"+49 123 456789\"\r\n}", "raw": "{\r\n \"session_id\": \"{{session_id}}\",\r\n \"session_key\": \"{{session_key}}\",\r\n \"vendor_id\": 7,\r\n \"first_name\": \"Test\",\r\n \"last_name\": \"Contact\",\r\n \"gender\": \"Unix\",\r\n \"email\": \"testcontact@betterzon.xyz\",\r\n \"phone\": \"+49 123 456789\"\r\n}",
"options": { "options": {
"raw": { "raw": {
"language": "json" "language": "json"
@ -412,6 +416,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});\r", "});\r",
"" ""
], ],
@ -435,7 +441,7 @@
} }
}, },
"url": { "url": {
"raw": "https://backend.betterzon.xyz/crawlingstatus", "raw": "https://backend.betterzon.xyz/crawlingstatus?session_id={{session_id}}&session_key={{session_key}}",
"protocol": "https", "protocol": "https",
"host": [ "host": [
"backend", "backend",
@ -444,6 +450,16 @@
], ],
"path": [ "path": [
"crawlingstatus" "crawlingstatus"
],
"query": [
{
"key": "session_id",
"value": "{{session_id}}"
},
{
"key": "session_key",
"value": "{{session_key}}"
}
] ]
} }
}, },
@ -561,6 +577,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});\r", "});\r",
"" ""
], ],
@ -573,7 +591,7 @@
"header": [], "header": [],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\r\n \"vendor_id\": 7\r\n}", "raw": "{\r\n \"session_id\": \"{{session_id}}\",\r\n \"session_key\": \"{{session_key}}\",\r\n \"vendor_id\": 7\r\n}",
"options": { "options": {
"raw": { "raw": {
"language": "json" "language": "json"
@ -630,6 +648,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
" getNewFavId();\r", " getNewFavId();\r",
"});\r", "});\r",
"\r", "\r",
@ -643,6 +663,8 @@
" body: {\r", " body: {\r",
" mode: 'raw',\r", " mode: 'raw',\r",
" raw: JSON.stringify({\r", " raw: JSON.stringify({\r",
" session_id: pm.collectionVariables.get(\"session_id\"),\r",
" session_key: pm.collectionVariables.get(\"session_key\"),\r",
" vendor_id: 7\r", " vendor_id: 7\r",
" })\r", " })\r",
" }\r", " }\r",
@ -652,7 +674,7 @@
"\r", "\r",
" // Get the id of the entry\r", " // Get the id of the entry\r",
" pm.sendRequest({\r", " pm.sendRequest({\r",
" url: 'https://backend.betterzon.xyz/favoriteshops',\r", " url: ('https://backend.betterzon.xyz/favoriteshops?session_id=' + pm.collectionVariables.get(\"session_id\") + '&session_key=' + pm.collectionVariables.get(\"session_key\")),\r",
" method: 'GET'\r", " method: 'GET'\r",
" }, function (err, response) {\r", " }, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
@ -677,7 +699,7 @@
} }
}, },
"url": { "url": {
"raw": "https://backend.betterzon.xyz/favoriteshops/4", "raw": "https://backend.betterzon.xyz/favoriteshops/{{created_favshop_id}}",
"protocol": "https", "protocol": "https",
"host": [ "host": [
"backend", "backend",
@ -686,7 +708,7 @@
], ],
"path": [ "path": [
"favoriteshops", "favoriteshops",
"4" "{{created_favshop_id}}"
] ]
} }
}, },
@ -851,6 +873,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});" "});"
], ],
"type": "text/javascript" "type": "text/javascript"
@ -861,7 +885,7 @@
"method": "GET", "method": "GET",
"header": [], "header": [],
"url": { "url": {
"raw": "https://backend.betterzon.xyz/pricealarms", "raw": "https://backend.betterzon.xyz/pricealarms?session_id={{session_id}}&session_key={{session_key}}",
"protocol": "https", "protocol": "https",
"host": [ "host": [
"backend", "backend",
@ -870,6 +894,16 @@
], ],
"path": [ "path": [
"pricealarms" "pricealarms"
],
"query": [
{
"key": "session_id",
"value": "{{session_id}}"
},
{
"key": "session_key",
"value": "{{session_key}}"
}
] ]
} }
}, },
@ -910,6 +944,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});" "});"
], ],
"type": "text/javascript" "type": "text/javascript"
@ -921,7 +957,7 @@
"header": [], "header": [],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\r\n \"product_id\": 1,\r\n \"defined_price\": 23400\r\n}", "raw": "{\r\n \"session_id\": \"{{session_id}}\",\r\n \"session_key\": \"{{session_key}}\",\r\n \"product_id\": 1,\r\n \"defined_price\": 23400\r\n}",
"options": { "options": {
"raw": { "raw": {
"language": "json" "language": "json"
@ -978,6 +1014,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});" "});"
], ],
"type": "text/javascript" "type": "text/javascript"
@ -989,7 +1027,7 @@
"header": [], "header": [],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\r\n \"alarm_id\": 12,\r\n \"defined_price\": 23400\r\n}", "raw": "{\r\n \"session_id\": \"{{session_id}}\",\r\n \"session_key\": \"{{session_key}}\",\r\n \"alarm_id\": 12,\r\n \"defined_price\": 23400\r\n}",
"options": { "options": {
"raw": { "raw": {
"language": "json" "language": "json"
@ -1202,6 +1240,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});" "});"
], ],
"type": "text/javascript" "type": "text/javascript"
@ -1213,7 +1253,7 @@
"header": [], "header": [],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\r\n \"vendor_id\": 7,\r\n \"product_id\": 1,\r\n \"price_in_cents\": 123456\r\n}", "raw": "{\r\n \"session_id\": \"{{session_id}}\",\r\n \"session_key\": \"{{session_key}}\",\r\n \"vendor_id\": 7,\r\n \"product_id\": 1,\r\n \"price_in_cents\": 123456\r\n}",
"options": { "options": {
"raw": { "raw": {
"language": "json" "language": "json"
@ -1513,7 +1553,7 @@
"header": [], "header": [],
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\r\n \"username\": \"Testuser\",\r\n \"password\": \"Testpassword\",\r\n \"email\": \"Wrongemail\"\r\n}", "raw": "{\r\n \"username\": \"Testuser\",\r\n \"password\": \"never_gonna_give_you_up\",\r\n \"email\": \"Wrongemail\"\r\n}",
"options": { "options": {
"raw": { "raw": {
"language": "json" "language": "json"
@ -1851,6 +1891,8 @@
" }\r", " }\r",
"}, function (err, response) {\r", "}, function (err, response) {\r",
" pm.expect(err).to.not.be.ok;\r", " pm.expect(err).to.not.be.ok;\r",
" pm.collectionVariables.set(\"session_id\", response.json().session_id);\r",
" pm.collectionVariables.set(\"session_key\", response.json().session_key);\r",
"});" "});"
], ],
"type": "text/javascript" "type": "text/javascript"
@ -1861,7 +1903,7 @@
"method": "GET", "method": "GET",
"header": [], "header": [],
"url": { "url": {
"raw": "https://backend.betterzon.xyz/vendors/managed", "raw": "https://backend.betterzon.xyz/vendors/managed?session_id={{session_id}}&session_key={{session_key}}",
"protocol": "https", "protocol": "https",
"host": [ "host": [
"backend", "backend",
@ -1871,6 +1913,16 @@
"path": [ "path": [
"vendors", "vendors",
"managed" "managed"
],
"query": [
{
"key": "session_id",
"value": "{{session_id}}"
},
{
"key": "session_key",
"value": "{{session_key}}"
}
] ]
} }
}, },
@ -1915,6 +1967,14 @@
{ {
"key": "rand_user_id", "key": "rand_user_id",
"value": "" "value": ""
},
{
"key": "session_id",
"value": ""
},
{
"key": "session_key",
"value": ""
} }
] ]
} }