Skip to content

Commit

Permalink
change request api version to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
jleifeld committed Apr 17, 2020
1 parent 44bfe4b commit d7d0291
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cypress/support/commands/fixture-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Cypress.Commands.add('setToInitialState', () => {
return cy.log('Cleaning, please wait a little bit.').then(() => {
return cy.cleanUpPreviousState();
}).then(() => {
return cy.clearCacheAdminApi('DELETE', 'api/v*/_action/cache');
return cy.clearCacheAdminApi('DELETE', 'api/v2/_action/cache');
}).then(() => {
return cy.setLocaleToEnGb();
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands/storefront-api-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Cypress.Commands.add('storefrontApiRequest', (method, endpoint, header = {}, bod
...body
},
method: method,
url: `/sales-channel-api/v*/${endpoint}`
url: `/sales-channel-api/v2/${endpoint}`
};

return cy.request(requestConfig).then((result) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = class AdminApiService extends ApiService {
}

clearCache() {
return super.clearCache('/v*/_action/cache');
return super.clearCache('/v2/_action/cache');
}

loginToAdministration() {
Expand Down
8 changes: 4 additions & 4 deletions cypress/support/service/administration/fixture.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ class AdminFixtureService {
}

create(endpoint, rawData) {
return this.apiClient.post(`/v*/${endpoint}?response=true`, rawData);
return this.apiClient.post(`/v2/${endpoint}?response=true`, rawData);
}

update(userData) {
if (!userData.id) {
throw new Error('Update fixtures must always contain an id');
}
return this.apiClient.patch(`/v*/${userData.type}/${userData.id}`, userData.data);
return this.apiClient.patch(`/v2/${userData.type}/${userData.id}`, userData.data);
}

authenticate() {
return this.apiClient.loginToAdministration();
}

search(type, filter) {
return this.apiClient.post(`/v*/search/${type}?response=true`, {
return this.apiClient.post(`/v2/search/${type}?response=true`, {
filter: [{
field: filter.field ? filter.field : 'name',
type: 'equals',
Expand All @@ -40,7 +40,7 @@ class AdminFixtureService {
}

clearCache() {
return this.apiClient.delete('/v*/_action/cache').catch((err) => {
return this.apiClient.delete('/v2/_action/cache').catch((err) => {
console.log('Cache could not be cleared')
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const AdminFixtureService = require('../fixture.service.js');

class CategoryFixtureService extends AdminFixtureService {
setCategoryFixture(userData) {
return this.apiClient.post('/v*/category?_response=true', userData);
return this.apiClient.post('/v2/category?_response=true', userData);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const AdminFixtureService = require('../fixture.service.js');
class CmsFixtureService extends AdminFixtureService {
setCmsPageFixture(userData) {
return this.apiClient.post('/v*/cms-page?_response=true', userData);
return this.apiClient.post('/v2/cms-page?_response=true', userData);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CustomerFixtureService extends AdminFixtureService {
return this.mergeFixtureWithData(finalCustomerRawData, finalAddressRawData);
})
.then((finalCustomerData) => {
return this.apiClient.post('/v*/customer?_response=true', finalCustomerData);
return this.apiClient.post('/v2/customer?_response=true', finalCustomerData);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProductFixture extends AdminFixtureService {
manufacturerId: manufacturer.id
}, userData);
}).then((finalProductData) => {
return this.apiClient.post('/v*/product?_response=true', finalProductData);
return this.apiClient.post('/v2/product?_response=true', finalProductData);
}).then((result) => {
return this.setProductVisible(userData.name, categoryName);
});
Expand All @@ -34,7 +34,7 @@ class ProductFixture extends AdminFixtureService {
let salesChannelId = '';
let productId = '';

return this.apiClient.post('/v*/search/sales-channel?response=true', {
return this.apiClient.post('/v2/search/sales-channel?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -43,7 +43,7 @@ class ProductFixture extends AdminFixtureService {
}).then((data) => {
salesChannelId = data.id;

return this.apiClient.post('/v*/search/product?response=true', {
return this.apiClient.post('/v2/search/product?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -53,7 +53,7 @@ class ProductFixture extends AdminFixtureService {
}).then((data) => {
productId = data.id;
}).then(() => {
return this.apiClient.post('/v*/search/category?response=true', {
return this.apiClient.post('/v2/search/category?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PropertyFixtureService extends AdminFixtureService {

const finalData = this.mergeFixtureWithData(propertyJson, userData);

return this.apiClient.post('/v*/property-group?_response=true', finalData);
return this.apiClient.post('/v2/property-group?_response=true', finalData);
}
}
module.exports = PropertyFixtureService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class AdminSalesChannelFixture extends AdminFixtureService {
navigationCategoryId: navigationCategory.id
}, userData);
}).then((finalChannelData) => {
return this.apiClient.post('/v*/sales-channel?_response=true', finalChannelData);
return this.apiClient.post('/v2/sales-channel?_response=true', finalChannelData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ShippingFixtureService extends AdminFixtureService {
deliveryTimeId: deliveryTime.id
});
}).then((finalShippingData) => {
return this.apiClient.post('/v*/shipping-method?_response=true', finalShippingData);
return this.apiClient.post('/v2/shipping-method?_response=true', finalShippingData);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SnippetFixtureService extends AdminFixtureService {

const snippetData = this.snippetFixture;

return this.apiClient.post('/v*/search/language?response=true', {
return this.apiClient.post('/v2/search/language?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -28,7 +28,7 @@ class SnippetFixtureService extends AdminFixtureService {
}).then((data) => {
languageId = data.id;
}).then(() => {
return this.apiClient.post('/v*/search/snippet-set?response=true', {
return this.apiClient.post('/v2/search/snippet-set?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -45,7 +45,7 @@ class SnippetFixtureService extends AdminFixtureService {
}, snippetData);
})
.then((finalSnippetData) => {
return this.apiClient.post('/v*/snippet?_response=true', finalSnippetData, userData);
return this.apiClient.post('/v2/snippet?_response=true', finalSnippetData, userData);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/service/saleschannel/fixture.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SalesChannelFixtureService {
}

getClientId(salesChannelName = 'Storefront') {
return this.adminApiClient.post('/v*/search/sales-channel?response=true', {
return this.adminApiClient.post('/v2/search/sales-channel?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand Down
18 changes: 9 additions & 9 deletions cypress/support/service/saleschannel/fixture/order.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class OrderFixtureService extends SalesChannelFixtureService {
this.apiClient.setAccessKey(result);
})
.then(() => {
return this.apiClient.post('/v*/customer/login', JSON.stringify({
return this.apiClient.post('/v2/customer/login', JSON.stringify({
username: customer.username,
password: customer.password
}));
Expand All @@ -16,17 +16,17 @@ class OrderFixtureService extends SalesChannelFixtureService {
return this.apiClient.setContextToken(contextToken['sw-context-token']);
})
.then(() => {
return this.apiClient.post('/v*/checkout/cart');
return this.apiClient.post('/v2/checkout/cart');
})
.then(() => {
return this.apiClient.post(`/v*/checkout/cart/line-item/${productId}`, {
return this.apiClient.post(`/v2/checkout/cart/line-item/${productId}`, {
type: 'product',
referencedId: productId,
stackable: true
});
})
.then(() => {
return this.apiClient.post('/v*/checkout/order');
return this.apiClient.post('/v2/checkout/order');
})
.catch((err) => {
console.log('err :', err);
Expand Down Expand Up @@ -70,33 +70,33 @@ class OrderFixtureService extends SalesChannelFixtureService {
return this.apiClient.setContextToken(this.createUuid().replace(/-/g, ''));
})
.then(() => {
return this.apiClient.post('/v*/checkout/cart');
return this.apiClient.post('/v2/checkout/cart');
})
.then(() => {
return this.apiClient.post(`/v*/checkout/cart/line-item/${productId}`, {
return this.apiClient.post(`/v2/checkout/cart/line-item/${productId}`, {
type: 'product',
referencedId: productId,
stackable: true
});
})
.then(() => {
return this.apiClient.post('/v*/checkout/guest-order', customerRawData);
return this.apiClient.post('/v2/checkout/guest-order', customerRawData);
})
.catch((err) => {
console.log('err :', err);
});
}

setPromotionFixture(userData) {
return this.adminApiClient.post('/v*/promotion?_response=true', userData);
return this.adminApiClient.post('/v2/promotion?_response=true', userData);
}

setDiscountFixture(userData, promotionId) {
userData.promotion_discount.payload.forEach(item => {
item.promotionId = promotionId;
});

return this.adminApiClient.post('/v*/_action/sync', userData);
return this.adminApiClient.post('/v2/_action/sync', userData);
}
}

Expand Down

0 comments on commit d7d0291

Please sign in to comment.