All Release Notes

Added GraphQL mutations for the CartDiscount and ProductDiscount

30 May 2018
Enhancement
GraphQLPricing

Mutations for the CartDiscount and ProductDiscount are now supported on the GraphQL endpoint.

  • [GraphQL API] Following types were added in the GraphQL schema:
    • AbsoluteDiscountValueInput, CartDiscountDraft, CartDiscountTargetInput, CartDiscountUpdateAction, CartDiscountValueInput, ChangeCartDiscountCartPredicate, ChangeCartDiscountIsActive, ChangeCartDiscountName, ChangeCartDiscountRequiresDiscountCode, ChangeCartDiscountSortOrder, ChangeCartDiscountStackingMode, ChangeCartDiscountTarget, ChangeCartDiscountValue, CustomLineItemsTargetInput, ExternalDiscountValueInput, GiftLineItemValueInput, LineItemsTargetInput, MoneyInput, MultiBuyCustomLineItemsTargetInput, MultiBuyLineItemsTargetInput, ProductDiscountDraft, ProductDiscountValueInput, RelativeDiscountValueInput, SetCartDiscountCustomField, SetCartDiscountCustomType, SetCartDiscountDescription, SetCartDiscountValidFrom, SetCartDiscountValidUntil, ShippingTargetInput.
  • [GraphQL API] Type ProductDiscount was changed:
    • ProductDiscount type description is changed
  • [GraphQL API] Type Mutation was changed:
    • Field updateProductDiscount was added to Mutation type
    • Field updateCartDiscount was added to Mutation type
    • Field deleteProductDiscount was added to Mutation type
    • Field createProductDiscount was added to Mutation type
    • Field createCartDiscount was added to Mutation type
    • Field deleteCartDiscount was added to Mutation type

Following changes were introduced in the GraphQL schema (in GraphQL Schema Definition Language):

extend type Mutation {
createCartDiscount(draft: CartDiscountDraft!): CartDiscount
createProductDiscount(draft: ProductDiscountDraft!): ProductDiscount
deleteCartDiscount(id: String!, version: Long!): CartDiscount
deleteProductDiscount(id: String!, version: Long!): ProductDiscount
updateCartDiscount(id: String!, version: Long!, actions: [CartDiscountUpdateAction!]!): CartDiscount
updateProductDiscount(id: String!, version: Long!, actions: [CartDiscountUpdateAction!]!): ProductDiscount
}
input AbsoluteDiscountValueInput {
money: [MoneyInput!]!
}
input CartDiscountDraft {
value: CartDiscountValueInput!
cartPredicate: String!
target: CartDiscountTargetInput
sortOrder: String!
name: [LocalizedStringInput!]!
description: [LocalizedStringInput!]
validFrom: DateTime
validUntil: DateTime
stackingMode: StackingMode = Stacking
requiresDiscountCode: Boolean = false
isActive: Boolean = true
custom: CustomFieldsDraft
}
input CartDiscountTargetInput {
lineItems: LineItemsTargetInput
customLineItems: CustomLineItemsTargetInput
shipping: ShippingTargetInput
multiBuyLineItems: MultiBuyLineItemsTargetInput
multiBuyCustomLineItems: MultiBuyCustomLineItemsTargetInput
}
input CartDiscountUpdateAction {
changeValue: ChangeCartDiscountValue
changeCartPredicate: ChangeCartDiscountCartPredicate
changeTarget: ChangeCartDiscountTarget
setValidFrom: SetCartDiscountValidFrom
setValidUntil: SetCartDiscountValidUntil
changeIsActive: ChangeCartDiscountIsActive
changeStackingMode: ChangeCartDiscountStackingMode
changeRequiresDiscountCode: ChangeCartDiscountRequiresDiscountCode
changeName: ChangeCartDiscountName
setDescription: SetCartDiscountDescription
changeSortOrder: ChangeCartDiscountSortOrder
setCustomType: SetCartDiscountCustomType
setCustomField: SetCartDiscountCustomField
}
input CartDiscountValueInput {
relative: RelativeDiscountValueInput
absolute: AbsoluteDiscountValueInput
giftLineItem: GiftLineItemValueInput
}
input ChangeCartDiscountCartPredicate {
cartPredicate: String!
}
input ChangeCartDiscountIsActive {
isActive: Boolean!
}
input ChangeCartDiscountName {
name: [LocalizedStringInput!]!
}
input ChangeCartDiscountRequiresDiscountCode {
requiresDiscountCode: Boolean!
}
input ChangeCartDiscountSortOrder {
sortOrder: String!
}
input ChangeCartDiscountStackingMode {
stackingMode: StackingMode!
}
input ChangeCartDiscountTarget {
target: CartDiscountTargetInput!
}
input ChangeCartDiscountValue {
value: CartDiscountValueInput!
}
input CustomLineItemsTargetInput {
predicate: String!
}
input ExternalDiscountValueInput {
dummy: String
}
input GiftLineItemValueInput {
product: ResourceIdentifierInput!
variantId: Int!
distributionChannel: ResourceIdentifierInput
supplyChannel: ResourceIdentifierInput
}
input LineItemsTargetInput {
predicate: String!
}
input MoneyInput {
currencyCode: Currency!
centAmount: Long!
}
input MultiBuyCustomLineItemsTargetInput {
predicate: String!
triggerQuantity: Long!
discountedQuantity: Long!
maxOccurrence: Int
selectionMode: SelectionMode
}
input MultiBuyLineItemsTargetInput {
predicate: String!
triggerQuantity: Long!
discountedQuantity: Long!
maxOccurrence: Int
selectionMode: SelectionMode
}
input ProductDiscountDraft {
value: ProductDiscountValueInput!
predicate: String!
sortOrder: String!
name: [LocalizedStringInput!]!
description: [LocalizedStringInput!]
validFrom: DateTime
validUntil: DateTime
isActive: Boolean = true
}
input ProductDiscountValueInput {
relative: RelativeDiscountValueInput
absolute: AbsoluteDiscountValueInput
external: ExternalDiscountValueInput
}
input RelativeDiscountValueInput {
permyriad: Int!
}
input SetCartDiscountCustomField {
name: String!
value: String
}
input SetCartDiscountCustomType {
typeId: String
typeKey: String
type: ResourceIdentifierInput
fields: [CustomFieldInput!]
}
input SetCartDiscountDescription {
description: [LocalizedStringInput!]
}
input SetCartDiscountValidFrom {
validFrom: DateTime
}
input SetCartDiscountValidUntil {
validUntil: DateTime
}
input ShippingTargetInput {
dummy: String
}