
* Update schema, remove transaction specific files * Merge `.transaction` queries and mutations into regular files * Merge OrderDetails fragments * Remove usage of `.transaction` graphl types * Update fixtures * Remove usage of useFlag, remove duplicated queries & mutations * Fix displayed event type for INFO * Remove type alias from order/types.ts, remove type casting * Fix failing tests * Add preview label and better description in Channel settings * Update button in GrantRefund page * Fix missing data-test-id * add e2e for capture transactions in orders * creates tests for transactions order view switched on --------- Co-authored-by: Jonatan Witoszek <jonatan.witoszek@saleor.io> Co-authored-by: wojteknowacki <wojciech.nowacki@saleor.io>
119 lines
2.7 KiB
JavaScript
119 lines
2.7 KiB
JavaScript
export function createChannel({
|
|
isActive = true,
|
|
name,
|
|
slug = name,
|
|
currencyCode = "PLN",
|
|
defaultCountry = "PL",
|
|
}) {
|
|
const createChannelMutation = `mutation{
|
|
channelCreate(input: {
|
|
isActive: ${isActive}
|
|
name: "${name}"
|
|
slug: "${slug}"
|
|
currencyCode: "${currencyCode}"
|
|
defaultCountry: ${defaultCountry}
|
|
}){
|
|
channel{
|
|
id
|
|
name
|
|
slug
|
|
}
|
|
errors{
|
|
code
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy
|
|
.sendRequestWithQuery(createChannelMutation)
|
|
.its("body.data.channelCreate.channel");
|
|
}
|
|
|
|
export function getChannels() {
|
|
const getChannelsInfoQuery = `query{
|
|
channels{
|
|
name
|
|
id
|
|
isActive
|
|
slug
|
|
currencyCode
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(getChannelsInfoQuery);
|
|
}
|
|
|
|
export function deleteChannel(channelId, targetChannelId) {
|
|
const deleteChannelMutation = `mutation{
|
|
channelDelete(id: "${channelId}", input:{
|
|
channelId: "${targetChannelId}"
|
|
}){
|
|
channel{
|
|
name
|
|
}
|
|
errors{
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(deleteChannelMutation);
|
|
}
|
|
|
|
export function activateChannel(channelId) {
|
|
const mutation = `mutation{
|
|
channelActivate(id:"${channelId}"){
|
|
errors{
|
|
field
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(mutation);
|
|
}
|
|
|
|
export function updateChannelWarehouses(channelId, warehouseId) {
|
|
const mutation = `mutation{
|
|
channelUpdate(id:"${channelId}", input:{
|
|
addWarehouses:"${warehouseId}"
|
|
}){
|
|
errors{
|
|
field
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(mutation);
|
|
}
|
|
|
|
export function updateChannelOrderSettings({
|
|
channelId,
|
|
automaticallyConfirmAllNewOrders = true,
|
|
automaticallyFulfillNonShippableGiftCard = true,
|
|
expireOrdersAfter = 0,
|
|
markAsPaidStrategy = "PAYMENT_FLOW", // TRANSACTION_FLOW - creates the TransactionItem object.
|
|
defaultTransactionFlowStrategy = "AUTHORIZATION",
|
|
}) {
|
|
const mutation = `mutation{
|
|
channelUpdate(id:"${channelId}", input: {orderSettings: {
|
|
automaticallyConfirmAllNewOrders: ${automaticallyConfirmAllNewOrders},
|
|
automaticallyFulfillNonShippableGiftCard: ${automaticallyFulfillNonShippableGiftCard},
|
|
expireOrdersAfter: ${expireOrdersAfter},
|
|
markAsPaidStrategy: ${markAsPaidStrategy},
|
|
defaultTransactionFlowStrategy: ${defaultTransactionFlowStrategy}
|
|
}}){
|
|
errors{
|
|
field
|
|
message
|
|
}
|
|
channel {
|
|
orderSettings{
|
|
automaticallyConfirmAllNewOrders
|
|
automaticallyFulfillNonShippableGiftCard
|
|
expireOrdersAfter
|
|
markAsPaidStrategy
|
|
defaultTransactionFlowStrategy
|
|
}
|
|
}
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(mutation);
|
|
}
|