From c66a71d0367de808a8fa7adbb1f6877453f3169d Mon Sep 17 00:00:00 2001 From: Luke Eller Date: Wed, 3 Jul 2024 10:30:18 +1000 Subject: [PATCH 1/5] PROMO-1050 Add shipping discount action --- reference/promotions.v3.yml | 47 +++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/reference/promotions.v3.yml b/reference/promotions.v3.yml index dd309724a..360c33f16 100644 --- a/reference/promotions.v3.yml +++ b/reference/promotions.v3.yml @@ -34,7 +34,7 @@ paths: get: tags: - Promotions (Bulk) - summary: Get All Promotions + summary: Get All Promotions description: |- Returns a list of *promotions*. @@ -120,7 +120,7 @@ paths: get: tags: - Promotions (Single) - summary: Get Promotion + summary: Get Promotion description: |- Returns a single *promotion*. @@ -170,7 +170,7 @@ paths: delete: tags: - Promotions (Single) - summary: Delete Promotion + summary: Delete Promotion description: |- Deletes a promotion. @@ -189,7 +189,7 @@ paths: get: tags: - Coupon Codes (Bulk) - summary: Get Coupon Codes + summary: Get Coupon Codes description: |- Get codes for a particular promotion. @@ -204,7 +204,7 @@ paths: post: tags: - Coupon Codes (Single) - summary: Create A Coupon Code + summary: Create A Coupon Code description: |- Create a new code for the promotion. @@ -242,7 +242,7 @@ paths: delete: tags: - Coupon Codes (Bulk) - summary: Delete Multiple Coupon Codes + summary: Delete Multiple Coupon Codes description: |- Deletes multiple coupon codes relating to the given promotion. Currently, batches are limited to 50 coupon codes. @@ -819,6 +819,33 @@ components: minimum: 1 required: - zone_ids + ShippingDiscountAction: + title: Shipping Discount Action + type: object + description: |- + **Shipping Discount Action** + Discounts shipping, optionally restricted to specific shipping methods. + properties: + shipping_discount: + type: object + properties: + discount: + $ref: '#/components/schemas/Discount' + method_ids: + description: '' + oneOf: + - type: string + enum: + - '*' + description: All configured shipping methods. + - type: array + uniqueItems: true + description: List of shipping method IDs to which the shipping discount can apply. + items: + type: integer + minimum: 1 + required: + - method_ids Discount: title: Discount description: '**Discount**' @@ -928,9 +955,9 @@ components: type: array description: Specifies where the notification message will be displayed. example: - - HOME_PAGE - - PRODUCT_PAGE - - CART_PAGE + - HOME_PAGE + - PRODUCT_PAGE + - CART_PAGE - CHECKOUT_PAGE items: type: string @@ -1338,7 +1365,7 @@ components: success: 0 failed: 0 422 - Error Deleting: - example: + example: errors: - status: 422 title: Errors occurred in bulk delete action. From fd39e6d2a330f3dc440ada3b2f345d02ca515cd0 Mon Sep 17 00:00:00 2001 From: Luke Eller Date: Wed, 3 Jul 2024 11:52:36 +1000 Subject: [PATCH 2/5] PROMO-1050 Add as_total field to shipping discount action --- reference/promotions.v3.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reference/promotions.v3.yml b/reference/promotions.v3.yml index 360c33f16..b9aa833fa 100644 --- a/reference/promotions.v3.yml +++ b/reference/promotions.v3.yml @@ -831,6 +831,12 @@ components: properties: discount: $ref: '#/components/schemas/Discount' + as_total: + type: boolean + description: |- + Set this value to true to distribute the discount as a total among shipping destinations. By default, the discount applies to each destination. + Example: If set to false, the discount is $10 and you have 2 shipping destinations eligible for this discount, the shipping cost for both destinations will be discounted by $10, with a total of $20 off the order. + If set to true, $10 will be distributed among the 2 shipping destinations, weighted by their respective price. In a case where there are 2 destinations sharing the same cost, each will be discounted by $5. method_ids: description: '' oneOf: From 5236071624f10491ac9a5266ea145b0559a12683 Mon Sep 17 00:00:00 2001 From: Luke Eller Date: Wed, 3 Jul 2024 13:04:19 +1000 Subject: [PATCH 3/5] PROMO-1050 Remove as_total field from shipping discount action --- reference/promotions.v3.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/reference/promotions.v3.yml b/reference/promotions.v3.yml index b9aa833fa..35566d513 100644 --- a/reference/promotions.v3.yml +++ b/reference/promotions.v3.yml @@ -831,12 +831,6 @@ components: properties: discount: $ref: '#/components/schemas/Discount' - as_total: - type: boolean - description: |- - Set this value to true to distribute the discount as a total among shipping destinations. By default, the discount applies to each destination. - Example: If set to false, the discount is $10 and you have 2 shipping destinations eligible for this discount, the shipping cost for both destinations will be discounted by $10, with a total of $20 off the order. - If set to true, $10 will be distributed among the 2 shipping destinations, weighted by their respective price. In a case where there are 2 destinations sharing the same cost, each will be discounted by $5. method_ids: description: '' oneOf: @@ -852,6 +846,7 @@ components: minimum: 1 required: - method_ids + - discount Discount: title: Discount description: '**Discount**' From a47c1ba473ff4469090d7c7b3fd18bf0137cc52d Mon Sep 17 00:00:00 2001 From: Luke Eller Date: Wed, 3 Jul 2024 16:08:13 +1000 Subject: [PATCH 4/5] PROMO-1050 Restrict count of shipping method IDs to 250 --- reference/promotions.v3.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/promotions.v3.yml b/reference/promotions.v3.yml index 35566d513..76443e021 100644 --- a/reference/promotions.v3.yml +++ b/reference/promotions.v3.yml @@ -844,6 +844,7 @@ components: items: type: integer minimum: 1 + maximum: 250 required: - method_ids - discount From d15febb3d7d282174734b6330286568d74f450b9 Mon Sep 17 00:00:00 2001 From: Luke Eller Date: Thu, 1 Aug 2024 08:10:59 +1000 Subject: [PATCH 5/5] PROMO-1050 Add ShippingDiscountAction as valid action --- reference/promotions.v3.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/promotions.v3.yml b/reference/promotions.v3.yml index 76443e021..571bdc185 100644 --- a/reference/promotions.v3.yml +++ b/reference/promotions.v3.yml @@ -975,6 +975,7 @@ components: - $ref: '#/components/schemas/GiftItemAction' - $ref: '#/components/schemas/FixedPriceSetAction' - $ref: '#/components/schemas/ShippingAction' + - $ref: '#/components/schemas/ShippingDiscountAction' ProductOptionsItemMatcher: title: Product Options Item Matcher type: object