Skip to content

Commit 23f382d

Browse files
authored
Merge pull request #432 from Shopify/samih/update_allocator_js_schema
Update discounts allocator functions graphql schemas
2 parents 6539b18 + 1a190b8 commit 23f382d

File tree

2 files changed

+64
-47
lines changed

2 files changed

+64
-47
lines changed

discounts/javascript/discounts-allocator/default/schema.graphql

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,11 @@ type Discount implements HasMetafields {
27092709
The strategy that's applied to the list of discounts.
27102710
"""
27112711
enum DiscountApplicationStrategy {
2712+
"""
2713+
Apply all discounts with conditions that are satisfied.
2714+
"""
2715+
ALL
2716+
27122717
"""
27132718
Only apply the first discount with conditions that are satisfied.
27142719
"""
@@ -2755,14 +2760,9 @@ type DiscountProposal {
27552760
targets: [CartLineTarget!]!
27562761

27572762
"""
2758-
The value of the reduction.
2759-
"""
2760-
value: Decimal!
2761-
2762-
"""
2763-
The value type of the discount.
2763+
The value of the discount.
27642764
"""
2765-
valueType: Value!
2765+
value: Value!
27662766
}
27672767

27682768
input DisplayableError {
@@ -2777,6 +2777,22 @@ input DisplayableError {
27772777
reason: String!
27782778
}
27792779

2780+
"""
2781+
A fixed amount value.
2782+
"""
2783+
type FixedAmount {
2784+
"""
2785+
The fixed amount value of the discount, in the currency of the cart.
2786+
"""
2787+
amount: Decimal!
2788+
2789+
"""
2790+
Allocation method of the discount, will be allocated on each line if it's
2791+
true, else will be allocated across target lines.
2792+
"""
2793+
appliesToEachItem: Boolean!
2794+
}
2795+
27802796
"""
27812797
The result of the Function. In API versions 2023-10 and beyond, this type is deprecated in favor of `FunctionRunResult`.
27822798
"""
@@ -4026,11 +4042,16 @@ input OutputAllocations {
40264042
The ID of the source discount proposal.
40274043
"""
40284044
discountProposalId: Handle!
4045+
}
40294046

4047+
"""
4048+
A percentage value.
4049+
"""
4050+
type Percentage {
40304051
"""
4031-
The sequence of this allocation display.
4052+
The percentage value.
40324053
"""
4033-
sequence: Int
4054+
value: Decimal!
40344055
}
40354056

40364057
"""
@@ -4309,19 +4330,9 @@ For example, "05:43:21".
43094330
scalar TimeWithoutTimezone
43104331

43114332
"""
4312-
List of different types of values discounts can have.
4333+
The value of the discount.
43134334
"""
4314-
enum Value {
4315-
"""
4316-
A discount with a fixed amount value.
4317-
"""
4318-
FIXED_AMOUNT
4319-
4320-
"""
4321-
A discount with a percentage value.
4322-
"""
4323-
PERCENTAGE
4324-
}
4335+
union Value = FixedAmount | Percentage
43254336

43264337
"""
43274338
A void type that can be used to return a null value from a mutation.

discounts/rust/discounts-allocator/default/schema.graphql

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,11 +1554,6 @@ enum CountryCode {
15541554
"""
15551555
UM
15561556

1557-
"""
1558-
Unknown country code.
1559-
"""
1560-
UNKNOWN__
1561-
15621557
"""
15631558
United States.
15641559
"""
@@ -2714,6 +2709,11 @@ type Discount implements HasMetafields {
27142709
The strategy that's applied to the list of discounts.
27152710
"""
27162711
enum DiscountApplicationStrategy {
2712+
"""
2713+
Apply all discounts with conditions that are satisfied.
2714+
"""
2715+
ALL
2716+
27172717
"""
27182718
Only apply the first discount with conditions that are satisfied.
27192719
"""
@@ -2760,14 +2760,9 @@ type DiscountProposal {
27602760
targets: [CartLineTarget!]!
27612761

27622762
"""
2763-
The value of the reduction.
2764-
"""
2765-
value: Decimal!
2766-
2767-
"""
2768-
The value type of the discount.
2763+
The value of the discount.
27692764
"""
2770-
valueType: Value!
2765+
value: Value!
27712766
}
27722767

27732768
input DisplayableError {
@@ -2782,6 +2777,22 @@ input DisplayableError {
27822777
reason: String!
27832778
}
27842779

2780+
"""
2781+
A fixed amount value.
2782+
"""
2783+
type FixedAmount {
2784+
"""
2785+
The fixed amount value of the discount, in the currency of the cart.
2786+
"""
2787+
amount: Decimal!
2788+
2789+
"""
2790+
Allocation method of the discount, will be allocated on each line if it's
2791+
true, else will be allocated across target lines.
2792+
"""
2793+
appliesToEachItem: Boolean!
2794+
}
2795+
27852796
"""
27862797
The result of the Function. In API versions 2023-10 and beyond, this type is deprecated in favor of `FunctionRunResult`.
27872798
"""
@@ -4031,11 +4042,16 @@ input OutputAllocations {
40314042
The ID of the source discount proposal.
40324043
"""
40334044
discountProposalId: Handle!
4045+
}
40344046

4047+
"""
4048+
A percentage value.
4049+
"""
4050+
type Percentage {
40354051
"""
4036-
The sequence of this allocation display.
4052+
The percentage value.
40374053
"""
4038-
sequence: Int
4054+
value: Decimal!
40394055
}
40404056

40414057
"""
@@ -4314,19 +4330,9 @@ For example, "05:43:21".
43144330
scalar TimeWithoutTimezone
43154331

43164332
"""
4317-
List of different types of values discounts can have.
4333+
The value of the discount.
43184334
"""
4319-
enum Value {
4320-
"""
4321-
A discount with a fixed amount value.
4322-
"""
4323-
FIXED_AMOUNT
4324-
4325-
"""
4326-
A discount with a percentage value.
4327-
"""
4328-
PERCENTAGE
4329-
}
4335+
union Value = FixedAmount | Percentage
43304336

43314337
"""
43324338
A void type that can be used to return a null value from a mutation.

0 commit comments

Comments
 (0)